require_once "lib/commentary.php"; injectrawcomment("AvatarVal", $session['user']['acctid'], $text); } elseif (httpget('deny') && $ok) { $sql = "SELECT name FROM " . db_prefix('accounts') . " WHERE acctid=" . (int) $user; $result = db_query($sql); $row = db_fetch_assoc($result); $username = $row['name']; output("`lAvatar has been set to default picture and user notified to provide a new link!`0`n`n"); $text = "/me`3 denied the avatar of `%{$username}`3 located at " . get_module_pref('avatar', 'avatar', $user); set_module_pref("validated", 1, "avatar", $user); set_module_pref("avatar", "modules/avatar/default.jpg", "avatar", $user); require_once "./lib/systemmail.php"; systemmail($user, array("`xYour avatar has `\$NOT`x been validated!"), array("`^Your picture is not within the local policies/rules. Please choose a new one and petition/mail the appropriate link to us. If you want to upload a new one and need the points back, please also do so.`n`nRegards`n%s`^`n `&Staff", $session['user']['name'])); debuglog(sprintf("Avatar was not found suitable by %s - reset and mailed", sanitize($session['user']['name'])), $user, $user); require_once "lib/commentary.php"; injectrawcomment("AvatarVal", $session['user']['acctid'], $text); } else { output_notl("`n`n"); } $sql = "SELECT count(u.userid) AS counter FROM " . db_prefix("module_userprefs") . " AS u INNER JOIN " . db_prefix("module_userprefs") . " AS t ON u.userid=t.userid AND u.modulename='avatar' AND u.setting='avatar' AND u.value!='' AND t.modulename='avatar' AND t.setting='validated' AND t.value!='1';"; $result = db_query($sql); $num = db_fetch_assoc($result); output("Currently there are %s avatars waiting for validation.`n`n", $num['counter']); addnav("Actions"); if ($num['counter'] > 0) { addnav("Random Validate Avatars", "runmodule.php?module=avatar&op=validate&mode=validate"); $sql = "SELECT a.login as login, u.userid as acctid ,a.name as name,a.emailaddress as email FROM " . db_prefix("module_userprefs") . " AS u INNER JOIN " . db_prefix("module_userprefs") . " AS t RIGHT JOIN " . db_prefix("accounts") . " AS a ON u.userid=t.userid AND a.acctid=u.userid WHERE u.modulename='avatar' AND u.setting='avatar' AND u.value!='' AND t.modulename='avatar' AND t.setting='validated' AND t.value!='1' ORDER BY a.login LIMIT 20;"; $result = db_query($sql); output("Click on the name to YOM a user and on a picture to view it in original size.`n`n"); rawoutput("<table border='0' cellpadding='2' cellspacing='0' width='100%'>"); rawoutput("<tr class='trhead'><td>" . translate_inline("Picture") . "</td><td>" . translate_inline("Name") . "</td><td>" . translate_inline("Ops") . "</td></tr>");
function injectcommentary($section, $talkline, $comment, $schema = false) { global $session, $doublepost, $translation_namespace; if ($schema === false) { $schema = $translation_namespace; } // Make the comment pristine so that we match on it correctly. $comment = stripslashes($comment); tlschema("commentary"); $doublepost = 0; $emptypost = 0; $colorcount = 0; if ($comment != "") { $commentary = str_replace("`n", "", soap($comment)); $y = strlen($commentary); for ($x = 0; $x < $y; $x++) { if (substr($commentary, $x, 1) == "`") { $colorcount++; if ($colorcount >= getsetting("maxcolors", 10)) { $commentary = substr($commentary, 0, $x) . color_sanitize(substr($commentary, $x)); $x = $y; } $x++; } } $args = array('commentline' => $commentary, 'commenttalk' => $talkline); $args = modulehook("commentary", $args); //Begin CMJ Patch to allow players to use the /special switch if ($args['ignore'] == 1) { //Ignore this comment, it is likely a side-effect of using the Special switch return; } $commentary = $args['commentline']; $talkline = $args['commenttalk']; tlschema($schema); $talkline = translate_inline($talkline); tlschema(); $commentary = preg_replace("'([^[:space:]]{45,45})([^[:space:]])'", "\\1 \\2", $commentary); $commentary = addslashes($commentary); // do an emote if the area has a custom talkline and the user // isn't trying to emote already. if ($talkline != "says" && substr($commentary, 0, 1) != ":" && substr($commentary, 0, 2) != "::" && substr($commentary, 0, 3) != "/me" && substr($commentary, 0, 5) != "/game") { $commentary = ":`3{$talkline}, \\\"`#{$commentary}`3\\\""; } if (substr($commentary, 0, 5) == "/game" && ($session['user']['superuser'] & SU_IS_GAMEMASTER) == SU_IS_GAMEMASTER) { //handle game master inserts now, allow double posts injectsystemcomment($section, $commentary); } else { $sql = "SELECT comment,author FROM " . db_prefix("commentary") . " WHERE section='{$section}' ORDER BY commentid DESC LIMIT 1"; $result = db_query($sql); $row = db_fetch_assoc($result); db_free_result($result); if ($row['comment'] != stripslashes($commentary) || $row['author'] != $session['user']['acctid']) { injectrawcomment($section, $session['user']['acctid'], $commentary); $session['user']['laston'] = date("Y-m-d H:i:s"); } else { $doublepost = 1; } } tlschema(); } }
output("Not enough %s on hand to deposit.", translate_inline($g)); } elseif ($amount + $globalg > get_module_setting("maxcoffer{$g}") && get_module_setting("maxcoffer{$g}") > 0) { output("The owner has reached their global limit for coffers. {$globalg} -"); } elseif ($amount + $cofg > get_module_setting("max{$g}", $type) && get_module_setting("max{$g}", $type) != 12345) { output("This %s`0 cannot hold that amount.", translate_inline(get_module_setting("dwname", $type))); } elseif ($amount > $xfer && $xfer > 0) { output("You are not allowed to transfer more than %s %s per transaction.", $xfer, translate_inline($g)); } else { // Added check to remove commentary post after refreshing or posting a comment. debuglog("deposited {$amount} {$g} in dwelling {$dwid} in " . $session['user']['location']); $tamount = $cofg + $amount; $row[$g] = $tamount; $session['user'][$g] -= $amount; $message = sprintf_translate("::deposited `4%s %s%s`&.", $amount, $g == "gems" ? "`%" : "`^", $g); require_once "lib/commentary.php"; injectrawcomment("coffers-{$dwid}", $session['user']['acctid'], $message); db_query("UPDATE " . db_prefix("dwellings") . " SET {$g}={$g}+{$amount} WHERE dwid={$dwid}"); increment_module_pref("cofferdeps", 1); $cofferdeps--; output("`2You deposited %s %s.", $amount, translate_inline($g)); output("`n`@The coffers now hold a balance of `^%s`@ %s.`n", $tamount, translate_inline($g)); } } } break; } if ($subop != "") { $sql = "SELECT gold,gems,type FROM " . db_prefix("dwellings") . " WHERE dwid='{$dwid}'"; $result = db_query($sql); $row = db_fetch_assoc($result); $type = $row['type'];
function injectcommentary($section, $talkline, $comment) { global $session, $doublepost; // Make the comment pristine so that we match on it correctly. $comment = stripslashes($comment); $doublepost = 0; $emptypost = 0; $colorcount = 0; if ($comment != "") { $commentary = str_replace("`n", "", soap($comment)); //maximum color code changes removed for performance reasons // $y = strlen($commentary); // for ($x=0;$x<$y;$x++){ // if (substr($commentary,$x,1)=="`"){ // $colorcount++; // if ($colorcount>=getsetting("maxcolors",10)){ // $commentary = substr($commentary,0,$x).color_sanitize(substr($commentary,$x)); // $x=$y; // } // $x++; // } // } $info = array(); $info['rawcomment'] = $comment; $clanid = $session['user']['clanid']; if ($clanid && $session['user']['clanrank']) { $clansql = "SELECT clanname,clanshort FROM " . db_prefix("clans") . " WHERE clanid='{$clanid}'"; $clanresult = db_query($clansql); $clanrow = db_fetch_assoc($clanresult); $info['clanname'] = $clanrow['clanname']; $info['clanshort'] = $clanrow['clanshort']; $info['clanid'] = $clanid; $info['clanrank'] = $session['user']['clanrank']; } if (!isset($session['user']['prefs']['ucol'])) { $session['user']['prefs']['ucol'] = false; } else { $info['talkcolour'] = $session['user']['prefs']['ucol']; } $args = array('commentline' => $commentary, 'commenttalk' => $talkline, 'info' => $info, 'name' => $session['user']['name'], 'section' => $section); $args = modulehook("postcomment", $args); //debug($args); if ($args['ignore'] == 1) { //A module tells us to ignore this comment, so we will return false; } $commentary = $args['commentline']; $talkline = $args['commenttalk']; $info = $args['info']; $name = $args['name']; $talkline = translate_inline($talkline); //Try to make it so that italics are always closed properly $italics = substr_count($commentary, "`i"); if ($italics) { if ($odd = $italics % 2) { //odd number of italics - add one at the end $commentary .= "`i"; } } //Clean up the comment a bit $commentary = preg_replace("'([^[:space:]]{45,45})([^[:space:]])'", "\\1 \\2", $commentary); $commentary = addslashes($commentary); // Sort out /game switches if (substr($commentary, 0, 5) == "/game" && ($session['user']['superuser'] & SU_IS_GAMEMASTER) == SU_IS_GAMEMASTER) { //handle game master inserts now, allow double posts injectsystemcomment($section, $commentary); } else { //check for double posts $commentbuffer = datacache("commentary/latestcommentary_" . $section, 60); if (is_array($commentbuffer)) { if ($commentbuffer[0]['comment'] == stripslashes($commentary)) { $doublepost = true; } } else { $sql = "SELECT comment FROM " . db_prefix("commentary") . " WHERE section='{$section}' AND author='" . $session['user']['acctid'] . "' ORDER BY commentid DESC LIMIT 1"; $result = db_query($sql); $row = db_fetch_assoc($result); db_free_result($result); if ($row['comment'] == stripslashes($commentary)) { $doublepost = true; } } if (!$doublepost) { //Not a double post, inject the comment injectrawcomment($section, $session['user']['acctid'], $commentary, $session['user']['name'], $info); $session['user']['laston'] = date("Y-m-d H:i:s"); } } } }
function injectcommentary($section, $talkline, $comment) { global $session, $doublepost; // Make the comment pristine so that we match on it correctly. $comment = stripslashes($comment); $doublepost = 0; $emptypost = 0; $colorcount = 0; if ($comment != "") { $commentary = str_replace("`n", "", soap($comment)); //removed for performance // $y = strlen($commentary); // for ($x=0;$x<$y;$x++){ // if (substr($commentary,$x,1)=="`"){ // $colorcount++; // if ($colorcount>=getsetting("maxcolors",10)){ // $commentary = substr($commentary,0,$x).color_sanitize(substr($commentary,$x)); // $x=$y; // } // $x++; // } // } $info = array(); $clanid = $session['user']['clanid']; if ($clanid) { $clansql = "SELECT clanname,clanshort FROM " . db_prefix("clans") . " WHERE clanid='{$clanid}'"; $clanresult = db_query($clansql); $clanrow = db_fetch_assoc($clanresult); $info['clanname'] = $clanrow['clanname']; $info['clanshort'] = $clanrow['clanshort']; $info['clanid'] = $clanid; } $args = array('commentline' => $commentary, 'commenttalk' => $talkline, 'info' => $info, 'name' => $session['user']['name']); $args = modulehook("commentary", $args); if ($args['ignore'] == 1) { //Ignore this comment, it is likely a side-effect of using the Special switch return; } $commentary = $args['commentline']; $talkline = $args['commenttalk']; $info = $args['info']; $name = $args['name']; $talkline = translate_inline($talkline); //Clean up the comment a bit $commentary = preg_replace("'([^[:space:]]{45,45})([^[:space:]])'", "\\1 \\2", $commentary); $commentary = addslashes($commentary); // do an emote if the area has a custom talkline and the user // isn't trying to emote already. if ($talkline != "says" && substr($commentary, 0, 1) != ":" && substr($commentary, 0, 2) != "::" && substr($commentary, 0, 3) != "/me" && substr($commentary, 0, 5) != "/game") { $commentary = ":`3{$talkline}, \\\"`#{$commentary}`3\\\""; } // Sort out /game switches if (substr($commentary, 0, 5) == "/game" && ($session['user']['superuser'] & SU_IS_GAMEMASTER) == SU_IS_GAMEMASTER) { //handle game master inserts now, allow double posts injectsystemcomment($section, $commentary); } else { //This query checks for double posts $sql = "SELECT comment,author FROM " . db_prefix("commentary") . " WHERE section='{$section}' ORDER BY commentid DESC LIMIT 1"; $result = db_query($sql); $row = db_fetch_assoc($result); db_free_result($result); if ($row['comment'] != stripslashes($commentary) || $row['author'] != $session['user']['acctid']) { //Not a double post, inject the comment injectrawcomment($section, $session['user']['acctid'], $commentary, $session['user']['name'], $info); $session['user']['laston'] = date("Y-m-d H:i:s"); } else { $doublepost = 1; } } } }