load("misc"); $plugins->run_hooks("misc_start"); if($mybb->input['action'] == "markread") { if($mybb->input['fid']) { $validforum = validateforum(addslashes($mybb->input['fid'])); if(!$validforum) { error($lang->error_invalidforum); } mysetarraycookie("forumread", $mybb->input['fid'], time()); $plugins->run_hooks("misc_markread_forum"); redirect("forumdisplay.php?fid=".$mybb->input['fid'], $lang->redirect_markforumread); } else { if($mybb->user['uid'] != 0) { $db->query("UPDATE ".TABLE_PREFIX."users SET lastvisit='".time()."' WHERE uid='".$mybb->user[uid]."'"); } else { mysetcookie("mybb[lastvisit]", time()); } $plugins->run_hooks("misc_markread_end"); redirect("index.php", $lang->redirect_markforumsread); } } elseif($mybb->input['action'] == "clearpass") { $plugins->run_hooks("misc_clearpass"); if($mybb->input['fid']) { mysetcookie("forumpass[".intval($mybb->input['fid'])."]", ""); redirect("index.php", $lang->redirect_forumpasscleared); } } elseif($mybb->input['action'] == "rules") { if($mybb->input['fid']) { $plugins->run_hooks("misc_rules_start"); $query = $db->query("SELECT * FROM ".TABLE_PREFIX."forums WHERE fid='".intval($mybb->input['fid'])."' AND active!='no'"); $forum = $db->fetch_array($query); $forumpermissions = forum_permissions($forum['fid']); if($forum['type'] != "f" || $forum['rules'] == "") { error($lang->error_invalidforum); } if($forumpermissions['canview'] != "yes") { nopermission(); } if(!$forum['rulestitle']) { $forum['rulestitle'] = sprintf($lang->forum_rules, $forum['name']); } $forum['rules'] = postify($forum['rules'], "yes", "yes", "yes", "yes"); // Make navigation makeforumnav($mybb->input['fid']); addnav($forum['rulestitle']); $plugins->run_hooks("misc_rules_end"); eval("\$rules = \"".$templates->get("misc_rules_forum")."\";"); outputpage($rules); } } elseif($mybb->input['action'] == "help") { $lang->load("helpdocs"); $lang->load("helpsections"); $lang->load("customhelpdocs"); $lang->load("customhelpsections"); addnav($lang->nav_helpdocs, "misc.php?action=help"); $query = $db->query("SELECT h.*, s.enabled AS section FROM ".TABLE_PREFIX."helpdocs h LEFT JOIN ".TABLE_PREFIX."helpsections s ON (s.sid=h.sid) WHERE h.hid='".intval($mybb->input['hid'])."'"); $helpdoc = $db->fetch_array($query); if($helpdoc['hid']) { if($helpdoc['section'] != "no" && $helpdoc['enabled'] != "no") { $plugins->run_hooks("misc_help_helpdoc_start"); if($helpdoc['usetranslation'] == "yes" || $helpdoc['hid'] <= 7) { $langnamevar = "d".$helpdoc['hid']."_name"; $langdescvar = "d".$helpdoc['hid']."_desc"; $langdocvar = "d".$helpdoc['hid']."_document"; $helpdoc['name'] = $lang->$langnamevar; $helpdoc['description'] = $lang->$langdescvar; $helpdoc['document'] = $lang->$langdocvar; } addnav($helpdoc['name']); $plugins->run_hooks("misc_help_helpdoc_end"); eval("\$helppage = \"".$templates->get("misc_help_helpdoc")."\";"); outputpage($helppage); } else { error($lang->error_invalidhelpdoc); } } else { $plugins->run_hooks("misc_help_section_start"); $query = $db->query("SELECT * FROM ".TABLE_PREFIX."helpdocs ORDER BY sid, disporder"); while($helpdoc = $db->fetch_array($query)) { $helpdocs[$helpdoc['sid']][$helpdoc['disporder']][$helpdoc['hid']] = $helpdoc; } unset($helpdoc); $query = $db->query("SELECT * FROM ".TABLE_PREFIX."helpsections WHERE enabled!='no' ORDER BY disporder"); while($section = $db->fetch_array($query)) { if($section['usetranslation'] == "yes" || $section['sid'] <= 2) { $langnamevar = "s".$section['sid']."_name"; $langdescvar = "s".$section['sid']."_desc"; $section['name'] = $lang->$langnamevar; $section['description'] = $lang->$langdescvar; } else { $section['name'] = stripslashes($section['name']); $section['description'] = stripslashes($section['description']); } if(is_array($helpdocs[$section['sid']])) { $altbg = "trow1"; $helpbits = ""; while(list($key, $bit) = each($helpdocs[$section['sid']])) { while(list($key, $helpdoc) = each($bit)) { if($helpdoc['enabled'] != "no") { if($helpdoc['usetranslation'] == "yes" || $helpdoc['hid'] <= 7) { $langnamevar = "d".$helpdoc['hid'].'_name'; $langdescvar = "d".$helpdoc['hid'].'_desc'; $helpdoc['name'] = $lang->$langnamevar; $helpdoc['description'] = $lang->$langdescvar; } else { $helpdoc['name'] = stripslashes($helpdoc['name']); $helpdoc['description'] = stripslashes($helpdoc['description']); } eval("\$helpbits .= \"".$templates->get("misc_help_section_bit")."\";"); if($altbg == "trow2") { $altbg = "trow1"; } else { $altbg = "trow2"; } } } $expdisplay = ""; $sname = "sid_".$section['sid']."_c"; if($_COOKIE['collapsed'][$sname] == "display: show;") { $expcolimage = "collapse_collapsed.gif"; $expdisplay = "display: none;"; } else { $expcolimage = "collapse.gif"; } } eval("\$sections .= \"".$templates->get("misc_help_section")."\";"); } } $plugins->run_hooks("misc_help_section_end"); eval("\$help = \"".$templates->get("misc_help")."\";"); outputpage($help); } } elseif($mybb->input['action'] == "buddypopup") { $plugins->run_hooks("misc_buddypopup_start"); if($mybb->user['uid'] == 0) { nopermission(); } if($mybb->input['removebuddy']) { $buddies = $mybb->user['buddylist']; $namesarray = explode(",",$buddies); if(is_array($namesarray)) { foreach($namesarray as $key => $buddyid) { if($buddyid == $mybb->input['removebuddy']) { unset($namesarray[$key]); } } $buddylist = implode(",", $namesarray); $query = $db->query("UPDATE ".TABLE_PREFIX."users SET buddylist='$buddylist' WHERE uid='".$mybb->user['uid']."'"); $mybb->user['buddylist'] = $buddylist; } } // Load Buddies $buddies = $mybb->user['buddylist']; $namesarray = explode(",",$buddies); if(is_array($namesarray)) { while(list($key, $buddyid) = each($namesarray)) { $sql .= "$comma'$buddyid'"; $comma = ","; } $timecut = time() - $mybb->settings['wolcutoff']; $query = $db->query("SELECT u.*, g.canusepms FROM ".TABLE_PREFIX."users u LEFT JOIN ".TABLE_PREFIX."usergroups g ON (g.gid=u.usergroup) WHERE u.uid IN ($sql)"); while($buddy = $db->fetch_array($query)) { if($mybb->user['receivepms'] != "no" && $buddy['receivepms'] != "no" && $buddy['canusepms'] != "no") { eval("\$pmbuddy = \"".$templates->get("misc_buddypopup_user_sendpm")."\";"); } else { $pmbuddy = ""; } if($buddy['lastactive'] > $timecut && ($buddy['invisible'] == "no" || $mybb->user['usergroup'] == 4) && $buddy['lastvisit'] != $buddy['lastactive']) { eval("\$buddys[online] .= \"".$templates->get("misc_buddypopup_user_online")."\";"); } else { eval("\$buddys[offline] .= \"".$templates->get("misc_buddypopup_user_offline")."\";"); } } } $plugins->run_hooks("misc_buddypopup_end"); eval("\$buddylist = \"".$templates->get("misc_buddypopup")."\";"); outputpage($buddylist); } elseif($mybb->input['action'] == "whoposted") { $numposts = 0; $altbg = "trow1"; $query = $db->query("SELECT COUNT(p.pid) AS posts, p.username AS postusername, u.uid, u.username FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid) WHERE tid='".intval($mybb->input['tid'])."' AND p.visible='1' GROUP BY u.uid ORDER BY posts DESC"); while($poster = $db->fetch_array($query)) { if($poster['username'] == "") { $poster['username'] = $poster['postusername']; } $numposts += $poster['posts']; eval("\$whoposted .= \"".$templates->get("misc_whoposted_poster")."\";"); if($altbg == "trow2") { $altbg = "trow1"; } else { $altbg = "trow2"; } } eval("\$whop = \"".$templates->get("misc_whoposted")."\";"); outputpage($whop); } elseif($mybb->input['action'] == "smilies") { if($mybb->input['popup']) { // make small popup list of smilies $e = 1; $class = "trow1"; $smilies = "