XjSv
12-10-2009, 06:32 PM
/* To-Do-List plugin */
$r = sed_import('r','G','ALP');
$g = array ('a');
foreach($g as $x) $$x = $HTTP_GET_VARS[$x];
if ($a=="addlist")
{
sed_shield_protect();
$g = array ('nnotebook_id','nnotebook_userid', 'nnotebook_message');
foreach($g as $x) $$x = $HTTP_POST_VARS[$x];
$sql = sed_sql_query("INSERT INTO ".$cfg['plugin']['options']['dbprefix']."_notebook (notebook_id, notebook_userid, notebook_message) VALUES ('$nnotebook_id', '".$usr['id']."', '$nnotebook_message') ");
header("Location: plug.php?e=options");
}
if ($a=="deletelist")
{
$sql = sed_sql_query("DELETE FROM ".$cfg['plugin']['options']['dbprefix']."_notebook WHERE notebook_userid = '".$usr['id']."' AND notebook_id = '$id' ");
header("Location: plug.php?e=options");
}
if ($a=="updatelist")
{
$sql = sed_sql_query("DELETE FROM ".$cfg['plugin']['options']['dbprefix']."_notebook WHERE notebook_userid = '".$usr['id']."' AND notebook_id = '$id' ");
$g = array ('nnotebook_id','nnotebook_userid', 'nnotebook_message');
foreach($g as $x) $$x = $HTTP_POST_VARS[$x];
$sql = sed_sql_query("INSERT INTO ".$cfg['plugin']['options']['dbprefix']."_notebook (notebook_id, notebook_userid, notebook_message) VALUES ('$nnotebook_id', '".$usr['id']."', '$nnotebook_message') ");
header("Location: plug.php?e=options");
}
$notes .= "<p> ".$L['currenttodo']." <ul>";
$query= sed_sql_query("SELECT * FROM ".$cfg['plugin']['options']['dbprefix']."_notebook WHERE notebook_userid = '".$usr['id']."' ORDER by notebook_id DESC");
$notenum = sed_sql_numrows($query);
if ($notenum==0)
{
$notes .="".$L['nonotes']."";
}
while ($sql = sed_sql_fetcharray($query))
{
$notes .= "<li>" .sed_parse(sed_cc($sql['notebook_message']));
$notes .= " <a href=plug.php?e=options&a=deletelist&id=".$sql['notebook_id'];
$notes .= ">[".$L['xdelete']."]</a> ";
$notes .= " <a href=plug.php?e=options&r=updatelist&id=".$sql['notebook_id'];
$notes .= ">[".$L['edit']."]</a></li>";
}
$notes .= "</ul>";
$query = sed_sql_query("SELECT notebook_message FROM ".$cfg['plugin']['options']['dbprefix']."_notebook WHERE notebook_userid = '".$usr['id']."' AND notebook_id = '$id'");
$sql = sed_sql_fetcharray($query);
if ($r=="updatelist")
{
$notes .= "<p>".$L['updatetodo']."";
$notes .= "<form name=\"addentry\" action=\"plug.php?e=options&a=updatelist&id=$id\" method=\"post\">";
$notes .= "<br /><textarea name=\"nnotebook_message\" rows=\"2\" cols=\"30\">".$sql['notebook_message'];
$notes .= "</textarea><br />" .sed_build_bbcodes("addentry","nnotebook_message",$L['BBcodes']);
$notes .= " ".$cfg['separator']." <a href=\"plug.php?e=options\">Add New Note</a><br /><br /><input type=\"submit\" value=\"".$L['updatetodo']."\"></form></p>";
}
else
{
$notes .= "<p>".$L['addtodo']."";
$notes .= "<form name=\"addentry\" action=\"plug.php?e=options&a=addlist\" method=\"post\">";
$notes .= "<br /><textarea name=\"nnotebook_message\" rows=\"2\" cols=\"30\"></textarea>";
$notes .= "<br />" .sed_build_bbcodes("addentry","nnotebook_message",$L['BBcodes']);
$notes .= "<br /><br /><input type=\"submit\" value=\"".$L['addtodo']."\"></form></p>";
}
$r = sed_import('r','G','ALP');
$g = array ('a');
foreach($g as $x) $$x = $HTTP_GET_VARS[$x];
if ($a=="addlist")
{
sed_shield_protect();
$g = array ('nnotebook_id','nnotebook_userid', 'nnotebook_message');
foreach($g as $x) $$x = $HTTP_POST_VARS[$x];
$sql = sed_sql_query("INSERT INTO ".$cfg['plugin']['options']['dbprefix']."_notebook (notebook_id, notebook_userid, notebook_message) VALUES ('$nnotebook_id', '".$usr['id']."', '$nnotebook_message') ");
header("Location: plug.php?e=options");
}
if ($a=="deletelist")
{
$sql = sed_sql_query("DELETE FROM ".$cfg['plugin']['options']['dbprefix']."_notebook WHERE notebook_userid = '".$usr['id']."' AND notebook_id = '$id' ");
header("Location: plug.php?e=options");
}
if ($a=="updatelist")
{
$sql = sed_sql_query("DELETE FROM ".$cfg['plugin']['options']['dbprefix']."_notebook WHERE notebook_userid = '".$usr['id']."' AND notebook_id = '$id' ");
$g = array ('nnotebook_id','nnotebook_userid', 'nnotebook_message');
foreach($g as $x) $$x = $HTTP_POST_VARS[$x];
$sql = sed_sql_query("INSERT INTO ".$cfg['plugin']['options']['dbprefix']."_notebook (notebook_id, notebook_userid, notebook_message) VALUES ('$nnotebook_id', '".$usr['id']."', '$nnotebook_message') ");
header("Location: plug.php?e=options");
}
$notes .= "<p> ".$L['currenttodo']." <ul>";
$query= sed_sql_query("SELECT * FROM ".$cfg['plugin']['options']['dbprefix']."_notebook WHERE notebook_userid = '".$usr['id']."' ORDER by notebook_id DESC");
$notenum = sed_sql_numrows($query);
if ($notenum==0)
{
$notes .="".$L['nonotes']."";
}
while ($sql = sed_sql_fetcharray($query))
{
$notes .= "<li>" .sed_parse(sed_cc($sql['notebook_message']));
$notes .= " <a href=plug.php?e=options&a=deletelist&id=".$sql['notebook_id'];
$notes .= ">[".$L['xdelete']."]</a> ";
$notes .= " <a href=plug.php?e=options&r=updatelist&id=".$sql['notebook_id'];
$notes .= ">[".$L['edit']."]</a></li>";
}
$notes .= "</ul>";
$query = sed_sql_query("SELECT notebook_message FROM ".$cfg['plugin']['options']['dbprefix']."_notebook WHERE notebook_userid = '".$usr['id']."' AND notebook_id = '$id'");
$sql = sed_sql_fetcharray($query);
if ($r=="updatelist")
{
$notes .= "<p>".$L['updatetodo']."";
$notes .= "<form name=\"addentry\" action=\"plug.php?e=options&a=updatelist&id=$id\" method=\"post\">";
$notes .= "<br /><textarea name=\"nnotebook_message\" rows=\"2\" cols=\"30\">".$sql['notebook_message'];
$notes .= "</textarea><br />" .sed_build_bbcodes("addentry","nnotebook_message",$L['BBcodes']);
$notes .= " ".$cfg['separator']." <a href=\"plug.php?e=options\">Add New Note</a><br /><br /><input type=\"submit\" value=\"".$L['updatetodo']."\"></form></p>";
}
else
{
$notes .= "<p>".$L['addtodo']."";
$notes .= "<form name=\"addentry\" action=\"plug.php?e=options&a=addlist\" method=\"post\">";
$notes .= "<br /><textarea name=\"nnotebook_message\" rows=\"2\" cols=\"30\"></textarea>";
$notes .= "<br />" .sed_build_bbcodes("addentry","nnotebook_message",$L['BBcodes']);
$notes .= "<br /><br /><input type=\"submit\" value=\"".$L['addtodo']."\"></form></p>";
}