function removeComment($tid, $sid, $ok = 0) { global $ultramode, $prefix, $db, $admin_file; if ($ok) { $tid = intval($tid); $result = $db->sql_query("SELECT date from " . $prefix . "_comments where pid='{$tid}'"); $numresults = $db->sql_numrows($result); $sid = intval($sid); $db->sql_query("update " . $prefix . "_stories set comments=comments-1-'{$numresults}' where sid='{$sid}'"); /* Call recursive delete function to delete the comment and all its childs */ removeSubComments($tid); if ($ultramode) { ultramode(); } Header("Location: modules.php?name=News&file=article&sid={$sid}"); } else { include "header.php"; GraphicAdmin(); OpenTable(); echo "<center><font class=\"title\"><b>" . _REMOVECOMMENTS . "</b></font></center>"; CloseTable(); echo "<br>"; OpenTable(); echo "<center>" . _SURETODELCOMMENTS . ""; echo "<br><br>[ <a href=\"javascript:history.go(-1)\">" . _NO . "</a> | <a href=\"" . $admin_file . ".php?op=RemoveComment&tid={$tid}&sid={$sid}&ok=1\">" . _YES . "</a> ]</center>"; CloseTable(); include "footer.php"; } }
function autoSaveEdit($anid, $title, $hometext, $bodytext, $topic, $notes, $catid, $ihome, $informant, $members, $Mmembers, $date_debval, $date_finval, $epur) { global $aid, $ultramode, $NPDS_Prefix; $title = stripslashes(FixQuotes(str_replace('"', '"', $title))); $hometext = stripslashes(FixQuotes($hometext)); $bodytext = stripslashes(FixQuotes($bodytext)); $notes = stripslashes(FixQuotes($notes)); if ($members == 1 and $Mmembers == '') { $ihome = "-127"; } if ($members == 1 and ($Mmembers > 1 and $Mmembers <= 127)) { $ihome = $Mmembers; } $result = sql_query("UPDATE " . $NPDS_Prefix . "autonews SET catid='{$catid}', title='{$title}', time=now(), hometext='{$hometext}', bodytext='{$bodytext}', topic='{$topic}', notes='{$notes}', ihome='{$ihome}', date_debval='{$date_debval}', date_finval='{$date_finval}', auto_epur='{$epur}' WHERE anid='{$anid}'"); if ($ultramode) { ultramode(); } Header("Location: admin.php?op=autoEdit&anid={$anid}"); }
function changeStory($sid, $subject, $hometext, $bodytext, $topic, $notes, $catid, $ihome, $members, $Mmembers, $Cdate, $Csid, $date_finval, $epur, $theme) { global $NPDS_Prefix; global $aid, $ultramode; $subject = stripslashes(FixQuotes(str_replace('"', '"', $subject))); $hometext = stripslashes(FixQuotes($hometext)); $bodytext = stripslashes(FixQuotes($bodytext)); $notes = stripslashes(FixQuotes($notes)); if ($members == 1 and $Mmembers == "") { $ihome = "-127"; } if ($members == 1 and ($Mmembers > 1 and $Mmembers <= 127)) { $ihome = $Mmembers; } if ($Cdate) { sql_query("UPDATE " . $NPDS_Prefix . "stories SET catid='{$catid}', title='{$subject}', hometext='{$hometext}', bodytext='{$bodytext}', topic='{$topic}', notes='{$notes}', ihome='{$ihome}',time=now(), date_finval='{$date_finval}', auto_epur='{$epur}', archive='0' WHERE sid='{$sid}'"); } else { sql_query("UPDATE " . $NPDS_Prefix . "stories SET catid='{$catid}', title='{$subject}', hometext='{$hometext}', bodytext='{$bodytext}', topic='{$topic}', notes='{$notes}', ihome='{$ihome}', date_finval='{$date_finval}', auto_epur='{$epur}' WHERE sid='{$sid}'"); } if ($Csid) { if ($ibid = theme_image("pick.gif")) { $imgtmp = $ibid; } else { $imgtmp = "images/pick.gif"; } sql_query("UPDATE " . $NPDS_Prefix . "stories SET hometext='<img src=\"" . $imgtmp . "\" border=\"0\" align=\"center\" alt=\"\" /> :: {$hometext}' WHERE sid='{$sid}'"); list($Lsid) = sql_fetch_row(sql_query("SELECT sid FROM " . $NPDS_Prefix . "stories ORDER BY sid DESC")); $Lsid++; sql_query("UPDATE " . $NPDS_Prefix . "stories SET sid='{$Lsid}' WHERE sid='{$sid}'"); // commentaires if (file_exists("modules/comments/article.conf.php")) { include "modules/comments/article.conf.php"; sql_query("UPDATE " . $NPDS_Prefix . "posts SET topic_id='{$Lsid}' WHERE forum_id='{$forum}' AND topic_id='{$topic}'"); } $sid = $Lsid; } global $aid; Ecr_Log("security", "changeStory({$sid}, {$subject}, hometext..., bodytext..., {$topic}, notes..., {$catid}, {$ihome}, {$members}, {$Mmembers}, {$Cdate}, {$Csid}, {$date_finval},{$epur},{$theme}) by AID : {$aid}", ""); if ($ultramode) { ultramode(); } // Cluster Paradise if (file_exists("modules/cluster-paradise/cluster-activate.php")) { include "modules/cluster-paradise/cluster-activate.php"; } if (file_exists("modules/cluster-paradise/cluster-M.php")) { include "modules/cluster-paradise/cluster-M.php"; } // Cluster Paradise // Réseaux sociaux if (file_exists('modules/npds_twi/npds_to_twi.php')) { include 'modules/npds_twi/npds_to_twi.php'; } if (file_exists('modules/npds_fbk/npds_to_fbk.php')) { include 'modules/npds_twi/npds_to_fbk.php'; } // Réseaux sociaux redirect_url("admin.php?op=EditStory&sid={$sid}"); }
function postAdminStory($automated, $year, $day, $month, $hour, $min, $subject, $hometext, $bodytext, $topic, $catid, $ihome, $alanguage, $acomm, $pollTitle, $optionText, $assotop) { global $ultramode, $aid, $prefix, $db; for ($i = 0; $i < sizeof($assotop); $i++) { $associated .= "{$assotop[$i]}-"; } if ($automated == 1) { if ($day < 10) { $day = "0{$day}"; } if ($month < 10) { $month = "0{$month}"; } $sec = "00"; $date = "{$year}-{$month}-{$day} {$hour}:{$min}:{$sec}"; $notes = ""; $author = $aid; $subject = stripslashes(FixQuotes($subject)); $subject = ereg_replace("\"", "''", $subject); $hometext = stripslashes(FixQuotes($hometext)); $bodytext = stripslashes(FixQuotes($bodytext)); $result = $db->sql_query("insert into " . $prefix . "_autonews values (NULL, '{$catid}', '{$aid}', '{$subject}', '{$date}', '{$hometext}', '{$bodytext}', '{$topic}', '{$author}', '{$notes}', '{$ihome}', '{$alanguage}', '{$acomm}', '{$associated}')"); if (!$result) { exit; } $result = $db->sql_query("update " . $prefix . "_authors set counter=counter+1 where aid='{$aid}'"); if ($ultramode) { ultramode(); } Header("Location: admin.php?op=adminMain"); } else { $subject = stripslashes(FixQuotes($subject)); $hometext = stripslashes(FixQuotes($hometext)); $bodytext = stripslashes(FixQuotes($bodytext)); if ($pollTitle != "" and $optionText[1] != "" and $optionText[2] != "") { $haspoll = 1; $timeStamp = time(); $pollTitle = FixQuotes($pollTitle); if (!$db->sql_query("INSERT INTO " . $prefix . "_poll_desc VALUES (NULL, '{$pollTitle}', '{$timeStamp}', '0', '{$alanguage}', '0')")) { return; } $object = $db->sql_fetchrow($db->sql_query("SELECT pollID FROM " . $prefix . "_poll_desc WHERE pollTitle='{$pollTitle}'")); $id = $object['pollID']; $id = intval($id); for ($i = 1; $i <= sizeof($optionText); $i++) { if ($optionText[$i] != "") { $optionText[$i] = FixQuotes($optionText[$i]); } if (!$db->sql_query("INSERT INTO " . $prefix . "_poll_data (pollID, optionText, optionCount, voteID) VALUES ('{$id}', '{$optionText[$i]}', '0', '{$i}')")) { return; } } } else { $haspoll = 0; $id = 0; } $result = $db->sql_query("insert into " . $prefix . "_stories values (NULL, '{$catid}', '{$aid}', '{$subject}', now(), '{$hometext}', '{$bodytext}', '0', '0', '{$topic}', '{$aid}', '{$notes}', '{$ihome}', '{$alanguage}', '{$acomm}', '{$haspoll}', '{$id}', '0', '0', '{$associated}')"); $result = $db->sql_query("select sid from " . $prefix . "_stories WHERE title='{$subject}' order by time DESC limit 0,1"); list($artid) = $db->sql_fetchrow($result); $artid = intval($artid); $db->sql_query("UPDATE " . $prefix . "_poll_desc SET artid='{$artid}' WHERE pollID='{$id}'"); if (!$result) { exit; } $result = $db->sql_query("update " . $prefix . "_authors set counter=counter+1 where aid='{$aid}'"); if ($ultramode) { ultramode(); } Header("Location: admin.php?op=adminMain"); } }
function CreateTopic($xanonpost, $subject, $comment, $pid, $sid, $host_name, $mode, $order, $thold, $posttype) { global $module_name, $user, $userinfo, $EditedMessage, $cookie, $AllowableHTML, $ultramode, $prefix, $anonpost, $articlecomm, $db; cookiedecode($user); $author = FixQuotes($author); $subject = FixQuotes(filter_text($subject, "nohtml")); $comment = format_url($comment); if ($posttype == "exttrans") { $comment = FixQuotes(nl2br(htmlspecialchars(check_words($comment)))); } elseif ($posttype == "plaintext") { $comment = FixQuotes(nl2br(filter_text($comment))); } else { $comment = FixQuotes(filter_text($comment)); } if (is_user($user)) { getusrinfo($user); } if (is_user($user) && !$xanonpost) { getusrinfo($user); $name = $userinfo[username]; $email = $userinfo[femail]; $url = $userinfo[user_website]; $score = 1; } else { $name = ""; $email = ""; $url = ""; $score = 0; } $ip = $_SERVER["REMOTE_HOST"]; if (empty($ip)) { $ip = $_SERVER["REMOTE_ADDR"]; } $fake = $db->sql_numrows($db->sql_query("SELECT * FROM " . $prefix . "_stories WHERE sid='{$sid}'")); $comment = trim($comment); $comment = stripslashes($comment); if ($fake == 1 and $articlecomm == 1) { if ($anonpost == 0 and is_user($user) or $anonpost == 1) { $db->sql_query("INSERT INTO " . $prefix . "_comments VALUES (NULL, '{$pid}', '{$sid}', now(), '{$name}', '{$email}', '{$url}', '{$ip}', '{$subject}', '{$comment}', '{$score}', '0')"); $db->sql_query("UPDATE " . $prefix . "_stories SET comments=comments+1 WHERE sid='{$sid}'"); update_points(5); if ($ultramode) { ultramode(); } } else { echo "Nice try..."; die; } } else { include "header.php"; echo "According to my records, the topic you are trying " . "to reply to does not exist. If you're just trying to be " . "annoying, well then too bad."; include "footer.php"; die; } if (isset($cookie[4])) { $options .= "&mode={$cookie['4']}"; } else { $options .= "&mode=thread"; } if (isset($cookie[5])) { $options .= "&order={$cookie['5']}"; } else { $options .= "&order=0"; } if (isset($cookie[6])) { $options .= "&thold={$cookie['6']}"; } else { $options .= "&thold=0"; } Header("Location: modules.php?name={$module_name}&file=article&sid={$sid}{$options}"); }
function CreateTopic($xanonpost, $subject, $comment, $pid, $sid, $host_name, $mode, $order, $thold) { global $module_name, $user, $userinfo, $EditedMessage, $cookie, $AllowableHTML, $ultramode, $user_prefix, $prefix, $anonpost, $articlecomm, $db, $sitename; cookiedecode($user); getusrinfo($user); $sid = intval($sid); $pid = intval($pid); $author = filter($author, "nohtml", 1); $subject = filter($subject, "nohtml", 1); $comment = format_url($comment); $comment = filter($comment, "", 1); if (empty($subject) or empty($comment)) { include "header.php"; title("{$sitename} - " . _COMMENTSSYSTEM . ""); OpenTable(); echo "<center>" . _COMMENTPOSTERROR . "<br><br>" . _GOBACK . "</center>"; CloseTable(); include "footer.php"; fdie(); } //$comment = filter($comment); if (is_user($user) and !$xanonpost) { $name = $userinfo['username']; $email = $userinfo['femail']; $url = $userinfo['user_website']; $score = 1; } else { $name = ""; $email = ""; $url = ""; $score = 0; } if (!isset($ip)) { $ip = $_SERVER['REMOTE_ADDR']; } $fake = $db->sql_numrows($db->sql_query("SELECT * FROM " . $prefix . "_stories WHERE sid='{$sid}'")); $comment = trim($comment); $comment = filter($comment, "", 1); if ($fake == 1 and $articlecomm == 1) { if ($anonpost == 0 and is_user($user) or $anonpost == 1) { if (is_user($user)) { $krow = $db->sql_fetchrow($db->sql_query("SELECT karma FROM " . $user_prefix . "_users WHERE username='******'")); $koptions = ""; $koptions .= "&mode=" . $mode; $koptions .= "&order=" . $order; $koptions .= "&thold=" . $thold; if ($krow['karma'] == 2) { $db->sql_query("INSERT INTO " . $prefix . "_comments_moderated VALUES (NULL, '{$pid}', '{$sid}', now(), '{$name}', '{$email}', '{$url}', '{$ip}', '{$subject}', '{$comment}', '{$score}', '0', '0')"); include "header.php"; title(_MODERATEDTITLE); OpenTable(); echo "<center>" . _COMMENTMODERATED . ""; echo "<br><br><a href=\"modules.php?name={$module_name}&file=article&sid={$sid}{$koptions}\">" . _MODERATEDRETURN . "</a>"; CloseTable(); include "footer.php"; fdie(); } elseif ($krow['karma'] == 3) { Header("Location: modules.php?name={$module_name}&file=article&sid={$sid}{$koptions}"); fdie(); } } $db->sql_query("INSERT INTO " . $prefix . "_comments VALUES (NULL, '{$pid}', '{$sid}', now(), '{$name}', '{$email}', '{$url}', '{$ip}', '{$subject}', '{$comment}', '{$score}', '0', '0')"); $db->sql_query("UPDATE " . $prefix . "_stories SET comments=comments+1 WHERE sid='{$sid}'"); update_points(5); if ($ultramode) { ultramode(); } } else { die("Nice try.."); } } else { include "header.php"; echo "According to my records, the topic you are trying " . "to reply to does not exist. If you're just trying to be " . "annoying, well then too bad."; include "footer.php"; fdie(); } $options = ""; $options .= "&mode=" . $mode; $options .= "&order=" . $order; $options .= "&thold=" . $thold; Header("Location: modules.php?name={$module_name}&file=article&sid={$sid}{$options}"); }