function lasteditlock() { global $db, $mybb, $forum; if ($mybb->input['action'] == "edit_post" || $mybb->input['action'] == "editpost") { $post = get_post(intval($mybb->input['pid'])); $msg = "Sorry you can't edit a post once a moderator has edited it."; if (!is_moderator($forum['fid'], "canviewips") && ($post['edituid'] != $mybb->user['uid'] && $post['edituid'] != 0)) { switch ($mybb->input['action']) { case edit_post: xmlhttp_error($msg); break; case editpost: error($msg); break; } if ($mybb->input['do'] == "update_post") { error($msg); } } } }
function lockposts() { global $mybb, $db, $lang; $lang->load('lockposts'); // Get post info $pid = intval($mybb->input['pid']); $query = $db->simple_select("posts", "*", "pid='{$pid}'"); $post = $db->fetch_array($query); $fid = $post['fid']; if ($post['locked'] != 0) { if (is_moderator($fid, "candeleteposts") && $mybb->input['action'] == "deletepost") { return; } else { if (!is_moderator($fid, "caneditposts")) { if (THIS_SCRIPT != 'xmlhttp.php') { error($lang->post_locked); } else { xmlhttp_error(str_replace('<br />', " ", $lang->post_locked)); } return; } } } }
while ($buddy = $db->fetch_array($query)) { $buddy_name = format_name($buddy['username'], $buddy['usergroup'], $buddy['displaygroup']); $profile_link = build_profile_link($buddy_name, $buddy['uid'], '_blank'); if ($buddy['lastactive'] > $timecut && ($buddy['invisible'] == 0 || $mybb->user['usergroup'] == 4) && $buddy['lastvisit'] != $buddy['lastactive']) { eval("\$online[] = \"" . $templates->get("xmlhttp_buddyselect_online") . "\";"); } else { eval("\$offline[] = \"" . $templates->get("xmlhttp_buddyselect_offline") . "\";"); } } $online = implode("", $online); $offline = implode("", $offline); $plugins->run_hooks("xmlhttp_get_buddyselect_end"); eval("\$buddy_select = \"" . $templates->get("xmlhttp_buddyselect") . "\";"); echo $buddy_select; } else { xmlhttp_error($lang->buddylist_error); } } } } } } } } } } } } /** * Spits an XML Http based error message back to the browser *
function prostats_run_ajax() { global $mybb, $plugins, $lang, $parser, $session, $prostats_tbl; $lang->load('prostats'); if (!$mybb->settings['ps_enable'] || $mybb->settings['ps_hidefrombots'] && !empty($session->is_spider)) { error($lang->prostats_disabled); } if (!is_object($parser)) { require_once MYBB_ROOT . 'inc/class_parser.php'; $parser = new postParser(); } if ($mybb->input['action'] != "prostats_reload" || $mybb->request_method != "post") { return false; exit; } if (!verify_post_check($mybb->input['my_post_key'], true)) { xmlhttp_error($lang->invalid_post_code); } prostats_run_index(true); $plugins->run_hooks('prostats_xml_pre_output_page'); header('Content-Type: text/json'); echo json_encode(array("html" => $prostats_tbl)); }
function msb_gettoken() { global $mybb, $lang, $parser, $settings; if (!is_object($parser)) { require_once MYBB_ROOT . 'inc/class_parser.php'; $parser = new postParser(); } if ($mybb->input['action'] != "msb_gettoken" || $mybb->request_method != "post") { return false; exit; } if (!verify_post_check($mybb->input['my_post_key'], true)) { xmlhttp_error($lang->invalid_post_code); } if ($mybb->input['action'] == "msb_gettoken") { $arraytoken = array('token' => msb_token_gen()); echo json_encode($arraytoken); } }
function newpoints_editpost_xmlhttp() { global $db, $mybb, $thread, $lang, $charset; if (!$mybb->user['uid']) { return; } if ($mybb->settings['newpoints_main_enabled'] != 1) { return; } if ($mybb->settings['newpoints_income_perchar'] == 0) { return; } if ($mybb->input['action'] != "edit_post") { return; } elseif ($mybb->input['action'] == "edit_post" && $mybb->input['do'] != 'update_post') { return; } if ($mybb->input['editdraft']) { return; } // Verify POST request if (!verify_post_check($mybb->input['my_post_key'], true)) { xmlhttp_error($lang->invalid_post_code); } $post = get_post($mybb->input['pid']); $fid = intval($post['fid']); // check forum rules $forumrules = newpoints_getrules('forum', $fid); if (!$forumrules) { $forumrules['rate'] = 1; } // no rule set so default income rate is 1 // if the forum rate is 0, nothing is going to be added so let's just leave the function if ($forumrules['rate'] == 0) { return; } // check group rules - primary group check $grouprules = newpoints_getrules('group', $mybb->user['usergroup']); if (!$grouprules) { $grouprules['rate'] = 1; } // no rule set so default income rate is 1 // if the group rate is 0, nothing is going to be added so let's just leave the function if ($grouprules['rate'] == 0) { return; } // get old message $oldpost_wo_quotes = preg_replace("/\\[quote.*?\\](.*?)\\[\\/quote\\]((\\s)*(\\[\\/quote])*)*/is", '', $post['message']); $oldcharcount = my_strlen($oldpost_wo_quotes); $message = strval($_POST['value']); if (my_strtolower($charset) != "utf-8") { if (function_exists("iconv")) { $message = iconv($charset, "UTF-8//IGNORE", $message); } else { if (function_exists("mb_convert_encoding")) { $message = @mb_convert_encoding($message, $charset, "UTF-8"); } else { if (my_strtolower($charset) == "iso-8859-1") { $message = utf8_decode($message); } } } } $newpost_wo_quotes = preg_replace("/\\[quote.*?\\](.*?)\\[\\/quote\\]((\\s)*(\\[\\/quote])*)*/is", '', $message); $newcharcount = my_strlen($newpost_wo_quotes); // calculate points per character bonus // let's see if the number of characters in the post is greater than the minimum characters if ($newcharcount >= $mybb->settings['newpoints_income_minchar']) { // if we have more characters now if ($newcharcount > $oldcharcount) { // calculate bonus based on difference of characters // bonus will be positive as the new message is longer than the old one $bonus = ($newcharcount - $oldcharcount) * $mybb->settings['newpoints_income_perchar']; } elseif ($newcharcount < $oldcharcount) { // calculate bonus based on difference of characters // bonus will be positive as the new message is longer than the old one $bonus = ($newcharcount - $oldcharcount) * $mybb->settings['newpoints_income_perchar']; } elseif ($newcharcount == $oldcharcount) { $bonus = 0; } } else { // calculate bonus based on difference of characters // bonus will be negative as the new message is shorter than the minimum chars $bonus = ($newcharcount - $oldcharcount) * $mybb->settings['newpoints_income_perchar']; } // give points to the poster newpoints_addpoints($mybb->user['uid'], $bonus, $forumrules['rate'], $grouprules['rate'], false, true); }