function &fetch_rank(&$userinfo) { global $vbulletin; if (!is_array($vbulletin->ranks)) { // grab ranks since we didn't include 'ranks' in $specialtemplates $vbulletin->ranks =& build_ranks(); } $doneusergroup = array(); $userrank = ''; foreach ($vbulletin->ranks as $rank) { $displaygroupid = empty($userinfo['displaygroupid']) ? $userinfo['usergroupid'] : $userinfo['displaygroupid']; if ($userinfo['posts'] >= $rank['m'] and (!isset($doneusergroup["{$rank['u']}"]) or $doneusergroup["{$rank['u']}"] === $rank['m']) and ($rank['u'] > 0 and is_member_of($userinfo, $rank['u'], false) and (empty($rank['d']) or $rank['u'] == $displaygroupid) or $rank['u'] == 0 and (empty($rank['d']) or empty($userrank)))) { if (!empty($userrank) and $rank['s']) { $userrank .= '<br />'; } $doneusergroup["{$rank['u']}"] = $rank['m']; for ($x = $rank['l']; $x--; $x > 0) { if (empty($rank['t'])) { $userrank .= "<img src=\"{$rank['i']}\" alt=\"\" border=\"\" />"; } else { $userrank .= $rank['i']; } } } } return $userrank; }
function post_thanks_off($forumid = 0, $postinfo = array(), $threadfirstpostid = 0, $this_script = '') { global $vbulletin; ($hook = vBulletinHook::fetch_hook('post_thanks_function_post_thanks_off_start')) ? eval($hook) : false; if (!$vbulletin->options['post_thanks_on_off'] || $forumid == 0 || post_thanks_in_array($forumid, $vbulletin->options['post_thanks_forum_off'])) { return true; } if ($vbulletin->options['post_thanks_forum_first_all'] && !($postinfo['postid'] == $threadfirstpostid) || post_thanks_in_array($forumid, $vbulletin->options['post_thanks_forum_first']) && !($postinfo['postid'] == $threadfirstpostid)) { return true; } if (!($this_script == 'showthread' || $this_script == 'showpost' || $this_script == '')) { return true; } if ($vbulletin->options['post_thanks_usergroup_getting']) { if (is_member_of($postinfo, explode("|", $vbulletin->options['post_thanks_usergroup_getting']))) { return true; } } if ($vbulletin->options['post_thanks_user_getting']) { if (in_array($postinfo['userid'], explode("|", $vbulletin->options['post_thanks_user_getting']))) { return true; } } ($hook = vBulletinHook::fetch_hook('post_thanks_function_post_thanks_off_end')) ? eval($hook) : false; return false; }
function getSkimClass($userinfo) { global $vbulletin; static $skimLinksDisableUsergroups = null; static $skimWordsDisableUserGroups = null; if ($skimLinksDisableUsergroups === null) { $skimLinksDisableUsergroups = json_decode($vbulletin->options['skimlinks_disable_groups_parse']); } if ($skimWordsDisableUserGroups === null) { $skimWordsDisableUserGroups = json_decode($vbulletin->options['skimwords_disable_groups_parse']); } $skimLinks = false; $skimWords = false; if (empty($skimLinksDisableUsergroups) || !is_member_of($userinfo, $skimLinksDisableUsergroups)) { $skimLinks = true; } if (empty($skimWordsDisableUserGroups) || !is_member_of($userinfo, $skimWordsDisableUserGroups)) { $skimWords = true; } if ($skimLinks and $skimWords) { return ''; } else { if ($skimLinks) { return 'noskimwords'; } else { if ($skimWords) { return 'noskimlinks'; } else { return 'noskim'; } } } }
function kBankHide(&$registry) { //create new object if (is_object($registry)) { $this->registry =& $registry; } else { trigger_error("vB_Database::Registry object is not an object", E_USER_ERROR); } //Check if user is banned $is_banned = !($this->registry->usergroupcache[$this->registry->userinfo['usergroupid']]['genericoptions'] & $this->registry->bf_ugp_genericoptions['isnotbannedgroup']) ? true : false; if (is_member_of($this->registry->userinfo, 3, 4) or $is_banned or THIS_SCRIPT == 'misc') { $this->settings['banned'] = true; } //Check if we need to use html version if (in_array(THIS_SCRIPT, array('ajax', 'editpost', 'misc', 'newthread', 'newreply', 'printthread', 'showpost', 'showthread'))) { $this->settings['dohtml'] = true; //Let's use html! } else { $this->settings['dohtml'] = false; //Plain text only } if (isset($this->registry->kbank['hide']['shortcut'])) { foreach ($this->tags as $key => $tag) { if (strtolower($tag['name']) == strtolower($this->registry->kbank['hide']['shortcut'])) { $this->tags[$key]['name'] .= '|HIDE'; } } } //Prepair regex foreach ($this->tags as $key => $tag) { $this->tags[$key]['regex'] = "\\[({$tag['name']})(=("|\"|'|)?([0-9]+)\\3)?\\]((.|\r|\n)*)\\[\\/\\1\\]"; //$this->tags[$key]['regex_close'] = "\[\/($tag[name])\]"; - not needed $this->tags[$key]['regex_open'] = "\\[({$tag['name']})(=("|\"|'|)?([0-9]+)\\3)?\\]"; } }
/** * Check main user group and plugin settings * Note: Also used as condition for showing "Freeze account" button * */ function fu_user_can_be_frozen($user_info) { global $vbulletin; if (is_member_of($user_info, unserialize($vbulletin->options['fu_source_groups'])) and 0 < $vbulletin->options['fu_frozen_group']) { return true; } return false; }
/** * Check if user is able to vote/remove votes * * @return bool */ public function has_vote_permission() { $banned_group = unserialize($this->registry->options['vbv_grp_banned']); $disabled_group = unserialize($this->registry->options['vbv_grp_disable']); $readonly_group = unserialize($this->registry->options['vbv_grp_read_only']); if (is_member_of($this->registry->userinfo, $banned_group) or is_member_of($this->registry->userinfo, $disabled_group) or is_member_of($this->registry->userinfo, $readonly_group)) { return false; } return true; }
/** * * Check if module should be ON * */ function CheckMrgDPEnabled() { global $vbulletin, $foruminfo, $mrgdp_enable, $mrgdp_timespan; if (!$vbulletin->userinfo) { return false; } // Module is enabled by default $mrgdp_enable = true; // set timespan $mrgdp_timespan = $vbulletin->options['mrgdp_timespan']; // check ignore groups $mrgdp_ignore_groups = unserialize($vbulletin->options['mrgdp_ignore_groups']); if (is_member_of($vbulletin->userinfo, $mrgdp_ignore_groups)) { $mrgdp_enable = false; } if ($mrgdp_enable and is_array($foruminfo)) { $mrgdp_this_forum = explode(',', $foruminfo['parentlist']); // check enabled forums if it is not empty $mrgdp_enable_forums = trim($vbulletin->options['mrgdp_enable_forums']); if (!empty($mrgdp_enable_forums)) { // default value $mrgdp_enable = false; $mrgdp_forums = explode(',', $mrgdp_enable_forums); foreach ($mrgdp_forums as &$mrgdp_forumid) { if (in_array(intval($mrgdp_forumid), $mrgdp_this_forum)) { $mrgdp_enable = true; break; } } unset($mrgdp_forums); } unset($mrgdp_enable_forums); if ($mrgdp_enable) { // check ignore forums $mrgdp_ignore_forums = trim($vbulletin->options['mrgdp_ignore_forums']); if (!empty($mrgdp_ignore_forums)) { $mrgdp_forums = explode(',', $mrgdp_ignore_forums); foreach ($mrgdp_forums as &$mrgdp_forumid) { if (in_array(intval($mrgdp_forumid), $mrgdp_this_forum)) { $mrgdp_enable = false; break; } } unset($mrgdp_forums); } unset($mrgdp_ignore_forums); } unset($mrgdp_this_forum); } return $mrgdp_enable; }
function get_system_list($access = "", $current = 0, $maxwidth = 50) { global $dbconn; global $session, $roles; $system_id_list = ""; function int_val(&$item) { $item = strval(intval($item)); } if (is_array($current)) { array_walk($current, 'int_val'); } else { $current = intval("{$current}"); } $query = "SELECT work_system.system_id, system_desc "; $query .= "FROM work_system WHERE active "; if ($access != "" && !is_member_of('Admin', 'Support')) { $query .= " AND EXISTS (SELECT system_usr.system_id FROM system_usr WHERE system_usr.system_id=work_system.system_id"; $query .= " AND user_no={$session->user_no} "; $query .= " AND role~*'[{$access}]') "; } if (is_array($current)) { $query .= " OR work_system.system_id IN (" . implode(",", $current) . ") "; } else { if ($current != "") { $query .= " OR work_system.system_id={$current}"; } } $query .= " ORDER BY LOWER(system_desc);"; $rid = awm_pgexec($dbconn, $query); if (!$rid) { return; } if (pg_NumRows($rid) > 0) { // Build table of systems found $rows = pg_NumRows($rid); for ($i = 0; $i < $rows; $i++) { $system_id = pg_Fetch_Object($rid, $i); $system_id_list .= "<option value=\"" . urlencode($system_id->system_id) . "\""; if (is_array($current) && in_array($system_id->system_id, $current, true) || "{$system_id->system_id}" == "{$current}") { $system_id_list .= " SELECTED"; } $system_id->system_desc = substr($system_id->system_desc, 0, $maxwidth); $system_id_list .= ">{$system_id->system_desc}</option>\n"; } } return $system_id_list; }
/** * Skimlinks vBulletin Plugin * * @author Skimlinks * @version 2.0.7 * @copyright © 2011 Skimbit Ltd. */ function disableSkimProduct($product, $threadinfo) { global $vbulletin; if ($threadinfo['lastpost'] > TIMENOW - 86400 * $vbulletin->options["{$product}_thread_age_limit"]) { return 'true'; } $disableForum = json_decode($vbulletin->options["{$product}_disable_forums"]); if (is_array($disableForum) and in_array($threadinfo['forumid'], $disableForum)) { return 'true'; } $disabledGroups = json_decode($vbulletin->options["{$product}_disable_groups"]); if (is_array($disabledGroups) and is_member_of($vbulletin->userinfo, $disabledGroups)) { return 'true'; } return 'false'; }
/** * Fetches the IDs of the notices to display on a particular page. * * @return array Array of IDs to display */ function fetch_relevant_notice_ids() { global $vbulletin, $vbphrase, $foruminfo, $threadinfo, $postinfo; $forum_pages = array('poll', 'editpost', 'threadrate', 'postings', 'showthread', 'newthread', 'forumdisplay', 'newreply', 'threadtag', 'inlinemod', 'announcement', 'showpost'); $ignore_np_notices = isset($_COOKIE[COOKIE_PREFIX . 'np_notices_displayed']) ? explode(',', $_COOKIE[COOKIE_PREFIX . 'np_notices_displayed']) : array(); $display_notices = array(); $vbulletin->np_notices_displayed = array(); ($hook = vBulletinHook::fetch_hook('notices_check_start')) ? eval($hook) : false; foreach ($vbulletin->noticecache AS $noticeid => $notice) { foreach ($notice AS $criteriaid => $conditions) { switch ($criteriaid) { case 'persistent': { if ($conditions == 0 AND in_array($noticeid, $ignore_np_notices)) // session cookie set in print_output() { continue 3; } break; } case 'dismissible': { if (in_array($noticeid, fetch_dismissed_notices())) { continue 3; } break; } /*case 'notice_x_not_displayed': // this is now handled differently - see $remove_display_notices below { if (in_array(intval($conditions[0]), $display_notices)) { continue 3; } break; }*/ case 'in_usergroup_x': { if (!is_member_of($vbulletin->userinfo, intval($conditions[0]))) { continue 3; } break; } case 'not_in_usergroup_x': { if (is_member_of($vbulletin->userinfo, intval($conditions[0]))) { continue 3; } break; } case 'browsing_forum_x': { if ($foruminfo['forumid'] != intval($conditions[0]) OR !in_array(THIS_SCRIPT, $forum_pages)) { continue 3; } break; } case 'browsing_forum_x_and_children': { if (!in_array(THIS_SCRIPT, $forum_pages) OR !in_array(intval($conditions[0]), explode(',', $foruminfo['parentlist']))) { continue 3; } break; } case 'no_visit_in_x_days': { if ($vbulletin->userinfo['lastvisit'] > TIMENOW - $conditions[0] * 86400) { continue 3; } break; } case 'has_never_posted': { if ($vbulletin->userinfo['lastpost'] > 0) { continue 3; } break; } case 'no_posts_in_x_days': { if ($vbulletin->userinfo['lastpost'] == 0 OR $vbulletin->userinfo['lastpost'] > TIMENOW - $conditions[0] * 86400) { continue 3; } break; } case 'has_x_postcount': { if (!check_notice_criteria_between($vbulletin->userinfo['posts'], $conditions[0], $conditions[1])) { continue 3; } break; } case 'has_x_reputation': { if (!check_notice_criteria_between($vbulletin->userinfo['reputation'], $conditions[0], $conditions[1])) { continue 3; } break; } case 'has_x_infraction_points': { if (!check_notice_criteria_between($vbulletin->userinfo['ipoints'], $conditions[0], $conditions[1])) { continue 3; } break; } case 'pm_storage_x_percent_full': { if ($vbulletin->userinfo['permissions']['pmquota']) { $pmboxpercentage = $vbulletin->userinfo['pmtotal'] / $vbulletin->userinfo['permissions']['pmquota'] * 100; if (!check_notice_criteria_between($pmboxpercentage, $conditions[0], $conditions[1])) { continue 3; } } else { continue 3; } break; } case 'username_is': { if (strtolower($vbulletin->userinfo['username']) != strtolower(trim($conditions[0]))) { continue 3; } break; } case 'is_birthday': { if (substr($vbulletin->userinfo['birthday'], 0, 5) != vbdate('m-d', TIMENOW, false, false)) { continue 3; } break; } case 'came_from_search_engine': if (!is_came_from_search_engine()) { continue 3; } break; case 'style_is_x': { if (STYLEID != intval($conditions[0])) { continue 3; } break; } case 'in_coventry': { if (!in_array($vbulletin->userinfo['userid'], preg_split('#\s+#', $vbulletin->options['globalignore'], -1, PREG_SPLIT_NO_EMPTY))) { continue 3; } break; } case 'is_date': { if (empty($conditions[1]) AND vbdate('d-m-Y', TIMENOW, false, false) != $conditions[0]) // user timezone { continue 3; } else if ($conditions[1] AND gmdate('d-m-Y', TIMENOW) != $conditions[0]) // utc { continue 3; } break; } case 'is_time': { if (preg_match('#^(\d{1,2}):(\d{2})$#', $conditions[0], $start_time) AND preg_match('#^(\d{1,2}):(\d{2})$#', $conditions[1], $end_time)) { if (empty($conditions[2])) // user timezone { $start = mktime($start_time[1], $start_time[2]) + $vbulletin->options['hourdiff']; $end = mktime($end_time[1], $end_time[2]) + $vbulletin->options['hourdiff']; $now = mktime() + $vbulletin->options['hourdiff']; } else // utc { $start = gmmktime($start_time[1], $start_time[2]); $end = gmmktime($end_time[1], $end_time[2]); $now = gmmktime(); } if ($now < $start OR $now > $end) { continue 3; } } else { continue 3; } break; } default: { $abort = false; ($hook = vBulletinHook::fetch_hook('notices_check_criteria')) ? eval($hook) : false; if ($abort) { continue 3; } } } } $display_notices["$noticeid"] = $noticeid; if ($notice['persistent'] == 0) { $vbulletin->np_notices_displayed["$noticeid"] = $noticeid; } } // now go through removing notices using the 'notice_x_not_displayed' criteria $remove_display_notices = array(); foreach ($vbulletin->noticecache AS $noticeid => $notice) { if (isset($notice['notice_x_not_displayed']) AND isset($display_notices[intval($notice['notice_x_not_displayed'][0])])) { $remove_display_notices["$noticeid"] = $noticeid; } } foreach ($remove_display_notices AS $noticeid) { unset($display_notices["$noticeid"], $vbulletin->np_notices_displayed["$noticeid"]); } return $display_notices; }
} // ######################################################################## // ######################### START MAIN SCRIPT ############################ // ######################################################################## // ################## Begin 'do' Branching ################### // set default branch action if (empty($_REQUEST['do'])) { $_REQUEST['do'] = 'manage'; } // ###################### Start Manage ####################### if ($_REQUEST['do'] == 'manage') { $vbulletin->input->clean_gpc('r', 'u', TYPE_UINT); // get bounced user info $buser = $db->query_first("\n\t\t\tSELECT * FROM " . TABLE_PREFIX . "user\n\t\t\tWHERE userid = " . $vbulletin->GPC['u'] . "\n\t"); // Do a safety check to make sure managed member is not an Admin, supermoderator, or Moderator if (is_member_of($buser['usergroupid'], 5, 6, 7)) { // Exit script define('CP_REDIRECT', 'user.php?do=modify'); print_stop_message('anti_member_x_is_in_a_protected_usergroup', $buser['username']); exit; } // if buser's ezb_oldugid is == 0 then this is first time buser has bounced if ($buser['ezb_oldugid'] == 0) { if ($vbulletin->options['ezb_updateusergroup'] == true) { // Save Member's Original UsergroupID $vbulletin->db->query_write("\n\t\t\t\tUPDATE " . TABLE_PREFIX . "user\n\t\t\t\tSET ezb_oldugid = " . $buser['usergroupid'] . "\n\t\t\t\tWHERE userid = " . $buser['userid'] . "\n\t\t\t"); // Update usergroupid $vbulletin->db->query_write("\n\t\t\t\tUPDATE " . TABLE_PREFIX . "user \n\t\t\t\tSET usergroupid\t= '" . $vbulletin->options['ezb_newusergroupid'] . "'\n\t\t\t\tWHERE userid\t= " . $buser['userid'] . "\t\n\t\t\t"); } // Update Receive Email from Administrators to NO ( UPDATE user SET options = options + 16 WHERE NOT (options & 16) ) $vbulletin->db->query_write("\n\t\t\tUPDATE " . TABLE_PREFIX . "user \n\t\t\tSET options = options - 16 \n\t\t\tWHERE options & 16 AND userid = " . $buser['userid'] . "\n\t\t");
if (!is_member_of($vbulletin->userinfo, $vbulletin->kbank['MemberGroupIDs']) and !is_member_of($vbulletin->userinfo, $vbulletin->kbank['BankRuptGroupID']) or calcMonthlyTaxPayTime($vbulletin->userinfo, 'next', 1) > TIMENOW) { eval(standard_error(fetch_error('kbank_tax_not_require'))); } if (!$autodirected) { $vbulletin->input->clean_array_gpc('p', array('referer' => TYPE_STR, 'choice' => TYPE_STR)); $tax = calcMonthlyTax($vbulletin->userinfo); } else { //Autodirect from 'tax' $vbulletin->GPC['choice'] = 'pay'; } $vbulletin->url = $vbulletin->GPC['referer']; switch ($vbulletin->GPC['choice']) { case 'pay': transferMoney($vbulletin->userinfo['userid'], 0, $tax['tax_total'], 'tax_' . TIMENOW, null, true, false, KBANK_NO_TAX, true, 0, array('banklogs_itemname' => 'tax')); $user_new = array(); if (is_member_of($vbulletin->userinfo, $vbulletin->kbank['BankRuptGroupID'])) { if ($ban_record = $vbulletin->db->query_first("\n\t\t\t\t\tSELECT * FROM `" . TABLE_PREFIX . "userban`\n\t\t\t\t\tWHERE userid = adminid\n\t\t\t\t\t\tAND userid = {$vbulletin->userinfo['userid']}\n\t\t\t\t\t\t#AND reason = 'kbank_bankrupt_tax'")) { $user_new = array_merge($user_new, array('usergroupid' => $ban_record['usergroupid'], 'displaygroupid' => $ban_record['displaygroupid'], 'usertitle' => $ban_record['usertitle'], 'customtitle' => $ban_record['customtitle'])); $vbulletin->db->query_write("\n\t\t\t\t\t\tDELETE FROM `" . TABLE_PREFIX . "userban`\n\t\t\t\t\t\tWHERE userid = {$vbulletin->userinfo['userid']}\n\t\t\t\t\t"); } else { $user_new['usergroupid'] = $vbulletin->kbank['NormalGroupID']; $usergroup = $vbulletin->usergroupcache["{$user_new['usergroupid']}"]; if (!$usergroup['usertitle']) { $gettitle = $db->query_first("\n\t\t\t\t\t\t\tSELECT title\n\t\t\t\t\t\t\tFROM " . TABLE_PREFIX . "usertitle\n\t\t\t\t\t\t\tWHERE minposts <= {$vbulletin->userinfo['posts']}\n\t\t\t\t\t\t\tORDER BY minposts DESC\n\t\t\t\t\t\t"); $user_new['usertitle'] = $gettitle['title']; } else { $user_new['usertitle'] = $usergroup['usertitle']; } } } $user_new['kbank_nextpay'] = calcMonthlyTaxPayTime($vbulletin->userinfo, 'next');
foreach ($vbulletin->forumcache as $forumid => $forum) { if (!$forum['link']) { $showinstant = 0; //get full forum info $forum = fetch_foruminfo($forum["forumid"], false); //if the user has permission to view the given forum, and if forum is postable... if ($perms = fetch_permissions($forum["forumid"]) and $perms & $vbulletin->bf_ugp_forumpermissions["canview"] and $forum["cancontainthreads"] and $forum["displayorder"] > 0 and $forum["options"] & $vbulletin->bf_misc_forumoptions['active']) { //get the level of the subscription for the given forum $sub_level = $db->query_first("\r\n\t\t\t\t\tSELECT emailupdate\r\n\t\t\t\t\tFROM " . TABLE_PREFIX . "subscribeforum\r\n\t\t\t\t\tWHERE forumid = '" . $forum["forumid"] . "' AND userid = " . $vbulletin->userinfo['userid'] . " LIMIT 1\r\n\t\t\t\t"); $usergroupids = explode(",", $forum["ei_usergroups"]); //if the user hits the set all none or set all instant buttons... if ($_REQUEST["setall"] == "none") { $sub_level["emailupdate"] = 0; } //write out a row with the info - title, description, and selected subscription if ($forum["ei_active"] and is_member_of($vbulletin->userinfo, $usergroupids)) { $showinstant = 1; $showallinstant = 1; if ($_REQUEST["setall"] == "instant") { $sub_level["emailupdate"] = 1; } } else { if ($_REQUEST["setall"] == "instant") { $sub_level["emailupdate"] = 0; } } eval('$forumbits .= "' . fetch_template('usercp_sub_mgr_forumbits') . '";'); } } } // draw cp nav bar
echo "morning."; } else { if ($hour < 18) { echo "afternoon."; } else { echo "evening."; } } } ?> Since you're on the support side of things you now get to see a list of systems and the numbers of requests active for each one. Click on the name of a system to see those currently active requests. Create a search called 'Home' to replace this default list. <?php // Should already be tested, but we might as well check again. if (!is_member_of('Admin', 'Support', 'Contractor')) { return; } $query = "SELECT s.system_id, lower(s.system_desc) AS lcname, s.system_desc, "; $query .= "to_char( max(r.request_on), 'D Mon YYYY') AS last_request_date, "; $query .= "count(r.request_id) AS active_sys_requests "; $query .= "FROM work_system s "; $query .= "JOIN system_usr su ON s.system_id = su.system_id "; $query .= "JOIN request r ON r.system_id = su.system_id "; $query .= "WHERE su.user_no = {$session->user_no} AND s.active AND r.active "; $query .= "AND su.role IN ( 'A', 'S', 'C', 'E', 'O', 'V' ) "; $query .= "AND (r.last_activity > (current_timestamp - '30 days'::interval) "; $query .= " OR r.last_status NOT IN ( 'F', 'C' ) ) "; $query .= "GROUP BY lower(s.system_desc), s.system_id, s.system_desc "; $query .= "HAVING COUNT(r.request_id) > 0 "; $query .= "ORDER BY lower(s.system_desc) ";
<?php $because = ""; if (!$logged_on) { $because .= "You must log on with a valid password and maintainer ID\n"; } $fsystem_id = intval("{$fsystem_id}"); if ($fsystem_id == 0) { if ($session->system_id == 0) { $because .= "You must select a valid system\n"; } else { $fsystem_id == $session->system_id; } } // Validate that they are only maintaining a request for a system_id they if (is_member_of('Admin')) { // OK, they can do anything :-) } else { if ($system_id_roles["{$fsystem_id}"] == "V") { $because = "You may only view records for that system"; } else { if ($system_id_roles["{$fsystem_id}"] == "H" || $system_id_roles["{$fsystem_id}"] == "M") { // That's OK - this is their home system_id, or maintenance is enabled } else { $because .= "You may only maintain requests from your organisation\n"; } } } if ("{$because}" != "") { $because = "<H2>Errors with request:</H2>\n" . nl2br($because) . "<HR>\n"; $because .= "<P><B>Changes have not been processed - please correct because and re-submit</B></P>\n";
$datetime[lastemail] = $now - 60 * 60 * 24 * $vbulletin->options['frequency']; $usergroups = explode(",", $vbulletin->options['usergroups']); if ($vbulletin->options['reminder_posts']) { $result = $vbulletin->db->query_read("SELECT * FROM " . TABLE_PREFIX . "user WHERE lastpost < '{$datetime['lastpost']}' AND emailDate < '{$datetime['lastemail']}' AND options & 16"); //print("SELECT * FROM " . TABLE_PREFIX . "user WHERE lastpost < '$datetime[lastpost]' AND emailDate < '$datetime[lastemail]' AND options & 16<br/>"); $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET emailDate = '{$now}' WHERE lastpost < '{$datetime['lastpost']}' AND emailDate < '{$datetime['lastemail']}' AND options & 16"); //print("UPDATE " . TABLE_PREFIX . "user SET emailDate = '$now' WHERE lastpost < '$datetime[lastpost]' AND emailDate < '$datetime[lastemail]' AND options & 16<br/>"); } else { $result = $vbulletin->db->query_read("SELECT * FROM " . TABLE_PREFIX . "user WHERE lastactivity < '{$datetime['lastpost']}' AND emailDate < '{$datetime['lastemail']}' AND options & 16"); //print("SELECT * FROM " . TABLE_PREFIX . "user WHERE lastactivity < '$datetime[lastpost]' AND emailDate < '$datetime[lastemail]' AND options & 16<br/>"); $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET emailDate = '{$now}' WHERE lastactivity < '{$datetime['lastpost']}' AND emailDate < '{$datetime['lastemail']}' AND options & 16"); //print("UPDATE " . TABLE_PREFIX . "user SET emailDate = '$now' WHERE lastactivity < '$datetime[lastpost]' AND emailDate < '$datetime[lastemail]' AND options & 16<br/>"); } print "Found " . mysql_num_rows($result) . " Inactive Users.<br/><br/>"; while ($row = $vbulletin->db->fetch_array($result)) { if (is_member_of($row, $usergroups)) { print "Sent To: {$row['username']}<br/>"; $username = $row[username]; $toemail = $row[email]; $userid = $row[userid]; $bbtitle = $vbulletin->options['bbtitle']; $homeurl = $vbulletin->options['homeurl']; $forumurl = $vbulletin->options['bburl']; $hometitle = $vbulletin->options['hometitle']; eval('$message = "' . addslashes($vbulletin->options['message']) . '";'); $message = stripslashes($message); //$headers = "MIME-Version: 1.0" . "\r\nContent-type: text/html; charset=iso-8859-1" . "\r\n"; $uheaders .= "To: {$username} <{$email}>" . "\r\n"; $uheaders .= "From: " . $vbulletin->options['bbtitle'] . " Reminder Service <" . $vbulletin->options['webmasteremail'] . ">" . "\r\n"; eval('$subject = "' . addslashes($vbulletin->options['subject']) . '";'); $subject = stripslashes($subject);
<?php include "always.php"; require_once "authorisation-page.php"; $session->LoginRequired(); $can_edit = is_member_of('Admin', 'Support'); $can_vote = is_member_of('Admin', 'Support'); $can_cool = is_member_of('Admin', 'Support'); $can_can = is_member_of('Admin'); $form = "wu"; $nodename = str_replace("\\", "", $wu); $nodename = str_replace("/", "", $nodename); $nodename = str_replace("'", "''", $nodename); $last = intval("{$last}"); if (isset($node_id)) { $node_id = intval($node_id); $current_node = $node_id; } if ("{$submit}" != "") { include "{$form}-valid.php"; if ("{$because}" == "") { include "{$form}-action.php"; } } $title = "{$system_name} - " . ucfirst($form); $right_panel = true; include "page-header.php"; include "{$form}-form.php"; include "page-footer.php";
} echo "</tr>\n"; } if ("{$uncharged}" != "") { echo "<tr><td colspan={$numcols}><input type=submit class=submit alt=\"apply changes\" name=submit value=\"Apply Charges\"></td></tr>\n"; echo "</form>\n"; } printf("<tr class=row%1d>\n", $i % 2); printf("<td align=right colspan=" . (isset($org_code) && $org_code > 0 ? "3" : "4") . ">%9.2f hours</td>\n", $total_hours); printf("<th colspan=2 align=right>%9.2f</td>\n", $grand_total); echo "<td colspan=2> </td></tr>\n"; echo "</table>\n"; } } echo "</table></form>\n"; if (is_member_of('Admin', 'Support') && "{$style}" != "stripped") { $this_page = "{$PHP_SELF}?f={$form}&style=%s&format=%s"; if ("{$search_for}" != "") { $this_page .= "&search_for={$search_for}"; } if (isset($org_code) && $org_code > 0) { $this_page .= "&org_code={$org_code}"; } if (isset($system_id) && $system_id > 0) { $this_page .= "&system_id={$system_id}"; } if (isset($requested_by)) { $this_page .= "&requested_by={$requested_by}"; } if (isset($user_no) && $user_no > 0) { $this_page .= "&user_no={$user_no}";
function iskBankCompany($userinfo) { //Require usergroupid (primary), membergroupids (additional) global $vbulletin; return is_member_of($userinfo, $vbulletin->kbank['CompanyGroupIDs']) and !is_member_of($userinfo, $vbulletin->kbank['BankRuptGroupID']); }
<?php $invalid = false; // Validate that they are only maintaining their own timesheets if (is_member_of('Admin', 'Support')) { // OK, they can add time onto requests :-) } else { if (is_member_of('Contractor')) { // Build an array of the request IDs the person is trying to put time against $request_ids = array(); for ($dow = 0; $dow < 7; $dow++) { while (list($k, $v) = each($tm[$dow])) { if ($v != "") { list($number, $description) = split('/', $v, 2); $number = intval($number); if ($number > 0) { $request_ids[$number] = $number; } } } } // Select the user's system_role for each such system $sql = "SELECT request.request_id, system_usr.role "; $sql .= "FROM request LEFT OUTER JOIN system_usr ON request.system_id = system_usr.system_id AND system_usr.user_no=? "; $sql .= "WHERE request_id IN (" . implode(",", $request_ids) . ");"; $qry = new PgQuery($sql, $session->user_no); if ($qry->Exec("TimeSheet")) { if ($qry->rows > 0) { while ($row = $qry->Fetch()) { $request_ids[$row->request_id] = $row->role; }
} } } file_put_contents($cachefile, serialize($streams)); } else { $streams = unserialize(file_get_contents($cachefile)); } // Hook into forumhome_above_forums $templater = vB_Template::create('technidev_twitch'); $templater->register('streams', $streams); $templater->register('streamCount', empty($streams) ? 0 : count($streams)); $templater->register('streamPermission', unserialize($vbulletin->options['technidev_twitch_canblock'])); $template_hook['forumhome_above_forums'] .= $templater->render(); } // Possibility for administrators or moderators to block certain streams. if (!empty($vbulletin->GPC['td_stream_block']) && is_member_of($vbulletin->userinfo, unserialize($vbulletin->options['technidev_twitch_canblock']))) { // First iterate through the current blocked cache file to make sure it's not there already. $blocked = unserialize(file_get_contents($blockedfile)); if (empty($blocked)) { $blocked = array(); } if (in_array(urldecode($vbulletin->GPC['td_stream_block']), $blocked)) { $vbulletin->url = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : $vbulletin->options['bburl'] . '/forum.php'; print_standard_redirect('This user is blocked already.', false, true); } // Add to the file. array_push($blocked, urldecode($vbulletin->GPC['td_stream_block'])); file_put_contents($blockedfile, serialize($blocked)); // Remove the current cached file. unlink($cachefile); print_standard_redirect('The user has been blocked.', false, true);
/** * Quick Method of building the CPNav Template * * @param string The selected item in the CPNav */ function construct_usercp_nav($selectedcell = 'usercp') { global $navclass, $cpnav, $gobutton, $vbphrase; global $messagecounters, $subscribecounters, $vbulletin; global $show, $subscriptioncache, $template_hook; $cells = array( 'usercp', 'signature', 'profile', 'options', 'connections', 'password', 'avatar', 'profilepic', 'album', 'pm_messagelist', 'pm_newpm', 'pm_trackpm', 'pm_editfolders', 'substhreads_listthreads', 'substhreads_editfolders', 'deletedthreads', 'deletedposts', 'moderatedthreads', 'moderatedposts', 'moderatedvms', 'deletedvms', 'moderatedgms', 'deletedgms', 'moderateddiscussions', 'deleteddiscussions', 'moderatedpcs', 'deletedpcs', 'moderatedpics', 'event_reminders', 'paid_subscriptions', 'socialgroups', 'usergroups', 'buddylist', 'ignorelist', 'attachments', 'customize', 'privacy', 'deleteditems', 'moderateditems', 'newitems', 'newvms', 'newgms', 'newdiscussions', 'newpcs', 'newpics' ); ($hook = vBulletinHook::fetch_hook('usercp_nav_start')) ? eval($hook) : false; // TODO: Issue #29084 - Reenable Profile Styling /* if (!($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_profile_styling'])) { $show['customizelink'] = false; } else if ( ($vbulletin->userinfo['permissions']['usercsspermissions'] & $vbulletin->bf_ugp_usercsspermissions['caneditfontfamily']) OR ($vbulletin->userinfo['permissions']['usercsspermissions'] & $vbulletin->bf_ugp_usercsspermissions['caneditfontsize']) OR ($vbulletin->userinfo['permissions']['usercsspermissions'] & $vbulletin->bf_ugp_usercsspermissions['caneditcolors']) OR ($vbulletin->userinfo['permissions']['usercsspermissions'] & $vbulletin->bf_ugp_usercsspermissions['caneditbgimage']) OR ($vbulletin->userinfo['permissions']['usercsspermissions'] & $vbulletin->bf_ugp_usercsspermissions['caneditborders']) ) { $show['customizelink'] = true; } else { $show['customizelink'] = false; } */ $show['customizelink'] = false; $show['privacylink'] = (($vbulletin->userinfo['permissions']['usercsspermissions'] & $vbulletin->bf_ugp_usercsspermissions['caneditprivacy']) AND $vbulletin->options['profileprivacy']); if ($show['avatarlink'] AND !($vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canuseavatar'])) { $membergroups = fetch_membergroupids_array($vbulletin->userinfo); // We don't have any predefined avatars or user's groups are all denied permission if (!empty($vbulletin->noavatarperms) AND ($vbulletin->noavatarperms['all'] == true OR !count(array_diff($membergroups, $vbulletin->noavatarperms)))) { $show['avatarlink'] = false; } else if (!empty($vbulletin->userinfo['infractiongroupids'])) { $show['avatarlink'] = ($categorycache =& fetch_avatar_categories($vbulletin->userinfo)); } } // currently, we only have faceboook as external login, // but as we add more, we need to add them to this assignment $show['externalconnections'] = $vbulletin->options['enablefacebookconnect']; if ($selectedcell == 'attachments') { $show['attachments'] = true; } else { require_once(DIR . '/packages/vbattach/attach.php'); $attachmultiple = new vB_Attachment_Display_Multiple($vbulletin); if ($results = $attachmultiple->fetch_results('a.userid = ' . $vbulletin->userinfo['userid'], true)) { $show['attachments'] = true; } } if ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_groups'] AND $vbulletin->userinfo['permissions']['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canviewgroups']) { $show['socialgroupslink'] = true; } if (!$vbulletin->options['subscriptionmethods']) { $show['paidsubscriptions'] = false; } else { // cache all the subscriptions - should move this to a datastore object at some point require_once(DIR . '/includes/class_paid_subscription.php'); $subobj = new vB_PaidSubscription($vbulletin); $subobj->cache_user_subscriptions(); $show['paidsubscriptions'] = false; foreach ($subobj->subscriptioncache AS $subscription) { $subscriptionid =& $subscription['subscriptionid']; if ($subscription['active'] AND (empty($subscription['deniedgroups']) OR count(array_diff(fetch_membergroupids_array($vbulletin->userinfo), $subscription['deniedgroups'])))) { $show['paidsubscriptions'] = true; break; } } } // check to see if there are usergroups available $show['publicgroups'] = false; foreach ($vbulletin->usergroupcache AS $usergroup) { if ($usergroup['ispublicgroup'] OR ($usergroup['canoverride'] AND is_member_of($vbulletin->userinfo, $usergroup['usergroupid']))) { $show['publicgroups'] = true; break; } } // Setup Moderation Links if (can_moderate()) { $show['deleteditems'] = true; $show['deletedmessages'] = true; } $show['moderatedposts'] = can_moderate(0, 'canmoderateposts'); $show['deletedposts'] = ($show['moderatedposts'] OR can_moderate(0, 'candeleteposts') OR can_moderate(0, 'canremoveposts')); // visitor messages if ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_visitor_messaging']) { $show['moderatedvms'] = can_moderate(0, 'canmoderatevisitormessages'); $show['deletedvms'] = ($show['moderatedvms'] OR can_moderate(0, 'candeletevisitormessages') OR can_moderate(0, 'canremovevisitormessages')); $show['newvms'] = ($show['moderatedvms'] OR $show['deletedvms'] OR can_moderate(0, 'caneditvisitormessages')); } // group messages if ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_groups'] AND $vbulletin->options['socnet_groups_msg_enabled']) { $show['moderatedgms'] = can_moderate(0, 'canmoderategroupmessages'); $show['deletedgms'] = ($show['moderatedgms'] OR can_moderate(0, 'candeletegroupmessages') OR can_moderate(0, 'canremovegroupmessages')); $show['newgms'] = ($show['moderatedgms'] OR $show['deletedgms'] OR can_moderate(0, 'caneditgroupmessages')); } // group discussions if ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_groups'] AND $vbulletin->options['socnet_groups_msg_enabled']) { $show['moderateddiscussions'] = can_moderate(0, 'canmoderatediscussions'); $show['deleteddiscussions'] = ($show['moderateddiscussions'] OR (can_moderate(0, 'candeletediscussions') OR can_moderate(0, 'canremovediscussions'))); $show['newdiscussions'] = ($show['moderateddiscussions'] OR $show['deleteddiscussions'] OR can_moderate(0, 'caneditdiscussions')); } // picture comments if ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_albums'] AND $vbulletin->options['pc_enabled']) { $show['moderatedpcs'] = can_moderate(0, 'canmoderatepicturecomments'); $show['deletedpcs'] = ($show['moderatedpcs'] OR can_moderate(0, 'candeletepicturecomments') OR can_moderate(0, 'canremovepicturecomments')); $show['newpcs'] = ($show['moderatedpcs'] OR $show['deletedpcs'] OR can_moderate(0, 'caneditpicturecomments')); } // pictures if ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_albums']) { $show['moderatedpics'] = can_moderate(0, 'canmoderatepictures'); $show['newpics'] = ($show['moderatedpics'] OR can_moderate(0, 'caneditalbumpicture')); } $show['moderateditems'] = ($show['moderatedposts'] OR $show['moderatedvms'] OR $show['moderatedgms'] OR $show['moderateddiscussions'] OR $show['moderatedpcs'] OR $show['moderatedpics']); $show['deleteditems'] = ($show['deletedposts'] OR $show['deletedvms'] OR $show['deletedgms'] OR $show['deleteddiscussions'] OR $show['deletedpcs']); $show['newitems'] = ($show['newposts'] OR $show['newvms'] OR $show['newgms'] OR $show['newdiscussions'] OR $show['newpcs'] OR $show['newpics']); $show['moderation'] = ($show['moderateditems'] OR $show['deleteditems'] OR $show['newitems']); // album setup $show['albumlink'] = ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_albums'] AND $vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canviewmembers'] AND $vbulletin->userinfo['permissions']['albumpermissions'] & $vbulletin->bf_ugp_albumpermissions['canviewalbum'] AND $vbulletin->userinfo['permissions']['albumpermissions'] & $vbulletin->bf_ugp_albumpermissions['canalbum'] ); // set the class for each cell/group $navclass = array(); foreach ($cells AS $cellname) { $navclass["$cellname"] = 'inactive'; } $navclass["$selectedcell"] = 'active'; // variable to hold templates for pm / subs folders $cpnav = array(); // get PM folders $cpnav['pmfolders'] = ''; $pmfolders = array('0' => $vbphrase['inbox'], '-1' => $vbphrase['sent_items']); if (!empty($vbulletin->userinfo['pmfolders'])) { $pmfolders = $pmfolders + unserialize($vbulletin->userinfo['pmfolders']); } foreach ($pmfolders AS $folderid => $foldername) { $linkurl = 'private.php?' . $vbulletin->session->vars['sessionurl'] . "folderid=$folderid"; $templater = vB_Template::create('usercp_nav_folderbit'); $templater->register('foldername', $foldername); $templater->register('linkurl', $linkurl); $cpnav['pmfolders'] .= $templater->render(); } // get subscriptions folders $cpnav['subsfolders'] = ''; $subsfolders = unserialize($vbulletin->userinfo['subfolders']); if (!empty($subsfolders)) { foreach ($subsfolders AS $folderid => $foldername) { $linkurl = 'subscription.php?' . $vbulletin->session->vars['sessionurl'] . "folderid=$folderid"; $templater = vB_Template::create('usercp_nav_folderbit'); $templater->register('foldername', $foldername); $templater->register('linkurl', $linkurl); $cpnav['subsfolders'] .= $templater->render(); } } if ($cpnav['subsfolders'] == '') { $linkurl = 'subscription.php?' . $vbulletin->session->vars['sessionurl'] . 'folderid=0'; $foldername = $vbphrase['subscriptions']; $templater = vB_Template::create('usercp_nav_folderbit'); $templater->register('foldername', $foldername); $templater->register('linkurl', $linkurl); $cpnav['subsfolders'] .= $templater->render(); } ($hook = vBulletinHook::fetch_hook('usercp_nav_complete')) ? eval($hook) : false; }
function show_sidebar_menu() { global $PHP_SELF, $session, $c, $theme, $hurl, $lsid, $help_url, $qams_enabled; if ($qams_enabled && strstr($PHP_SELF, "qams")) { menu_break_line(); menu_url_line("/", "Go to the WRMS Work Request Management System", "WRMS", "head"); menu_break_line(); // QAMS MENU ITEMS.. menu_url_line("/qams-project.php?edit=1", "Create a new project", "New Project", "head"); // Not yet implemented.. //menu_url_line("/qams-project-search.php", "Search for projects", "Search Projects", "head"); if (isset($lsid)) { menu_url_line("/?logout=1&forget=1{$hurl}", "Log me out and stop logging me in automatically", "Forget Me", "head"); } else { menu_url_line("/?logout=1{$hurl}", "Au revoir!", "Log Off", "head"); } menu_break_line(); echo '<form method="get" action="/qams-project.php" name="quickwr" id="quickwr" style="display:inline">'; printf(' <b>PROJ:</b><input type="text" size="7" title="%s" value="%d" name="request_id">', 'Enter a Project Number and press [Enter] to go to it directly.', $GLOBALS['request_id']); echo "</form><br >"; menu_break_line(); menu_url_line("/qams.php?filter=my", "Show projects I am involved in", "My Projects"); menu_url_line("/qams.php?filter=recent", "Show the most recent projects", "Recent Projects"); menu_break_line(); menu_url_line("/qams-refdoc-index.php", "Quality Assurance Documents Index", "Documents"); } else { // WRMS MENU ITEMS.. menu_url_line("/wr.php", "Enter a new work request into the system.", "New Request", "head"); $tooltip = "A comprehensive search facility for reporting on work requests."; menu_url_line("/wrsearch.php", $tooltip, "Search Requests", "head"); if (is_member_of('Admin', 'Support', 'Contractor')) { menu_url_line("/timesheet.php", "", "Timesheet Entry", "head"); } if ($qams_enabled) { menu_url_line("/qams.php", "Go to the QAMS Quality Assurance Management System", "Quality System", "head"); } if (isset($lsid)) { menu_url_line("/?logout=1&forget=1{$hurl}", "Log me out and stop logging me in automatically", "Forget Me", "head"); } else { menu_url_line("/?logout=1{$hurl}", "Au revoir!", "Log Off", "head"); } menu_break_line(); printf(<<<EOFORM <form method="get" action="/wr.php" name="quickwr" id="quickwr" style="display:inline"> <b>W/R:</b><input type="text" size="7" title="%s" value="%d" name="request_id"> </form><br > EOFORM , 'Enter a W/R number and press [Enter] to go to it directly.', $GLOBALS['request_id']); $tooltip = "Run this saved search"; $tooltip2 = "Edit this saved search"; $qry = new PgQuery("SELECT * FROM saved_queries WHERE user_no = '{$session->user_no}' AND in_menu ORDER BY query_name"); if ($qry->Exec("block-menu") && $qry->rows > 0) { menu_break_line(); while ($thisquery = $qry->Fetch()) { echo " <a href=\"/wrsearch.php?style=plain&saved_query=" . urlencode($thisquery->query_name) . "\" class=\"block\" title=\"{$tooltip}\" alt=\"{$tooltip}\"><b>»</b>{$thisquery->query_name}</a>"; if ($thisquery->query_params != "") { echo " <a href=\"/wrsearch.php?saved_query=" . urlencode($thisquery->query_name) . "\" class=\"block\" title=\"{$tooltip2}\"><b>«e»</b></a>"; } echo "<br >\n"; } echo " <a href=\"/saved_searches.php\">...more</a><br >\n"; } else { menu_break_line(); $tooltip = "List, run and edit all of your saved searches."; menu_url_line("/saved_searches.php", $tooltip, "Saved Searches"); } menu_break_line(); menu_url_line($help_url, "Help on this screen", "Help"); $tooltip = "Maintain your name, phone and e-mail details, or change your password"; menu_url_line("user.php?edit=1&user_no={$session->user_no}", $tooltip, "Edit My Info"); if (is_member_of('Admin', 'Support', 'OrgMgr')) { // menu_break_line(); $tooltip = "Review and update details about your organisation."; menu_url_line("/org.php?org_code={$session->org_code}", $tooltip, "My Organisation"); $tooltip = "List the WRMS users for your organisation."; menu_url_line("/usrsearch.php?org_code={$session->org_code}", $tooltip, "Our Users"); $tooltip = "Create a new WRMS user for your organisation."; menu_url_line("/user.php?org_code={$session->org_code}", $tooltip, "New User"); $tooltip = "List the 'Systems' your organisation may create Work Requests for."; menu_url_line("/form.php?form=syslist&org_code={$session->org_code}", $tooltip, "Our Systems"); if (is_member_of('Admin')) { menu_url_line("/lookups.php", "", "Lookup Codes"); menu_url_line("/form.php?form=attachment_type", "", "Attachment Types"); menu_url_line("/form.php?form=sessionlist", "", "Sessions"); } } if (is_member_of('Admin', 'Support')) { menu_break_line(); menu_url_line("/form.php?f=orglist", "", "All Organisations"); menu_url_line("/form.php?f=syslist", "", "General Systems"); menu_url_line("/new_organisation.php", "Add a new organisation, with a general system and primary user", "New Organisation"); menu_url_line("/form.php?user_no={$session->user_no}&form=timelist&uncharged=1", "", "My Uncharged Work"); menu_url_line("/form.php?f=timelist&uncharged=1", "", "All Work"); menu_url_line("/form.php?f=simpletimelist", "", "Work by Person"); menu_url_line("/form.php?f=timelist&uncharged=1&charge=1", "", "Work To Charge"); $tooltip = "A report showing the activity in the WRMS."; menu_url_line("/requestchange.php", $tooltip, "WRMS Activity"); } if (is_member_of('Admin', 'Support') || $GLOBALS['rank_report_anyone']) { $tooltip = "A ranked list of work requests, most important and urgent at the top"; menu_url_line("/requestrank.php?qs=complex", $tooltip, "Request Ranking"); } } if (is_member_of('Admin', 'Support')) { menu_url_line("/statuspie.php", 'A pie chart of request statuses for a period / system / organisation', "Status Pie"); } if (is_member_of('Admin', 'Accounts')) { menu_url_line("/work_summary.php", 'Show work summary for an Organisation / System / Person etc.', "Work Summary"); } $theme->BlockClose(); }
/** * Quick Method of building the CPNav Template * * @param string The selected item in the CPNav */ function construct_usercp_nav($selectedcell = 'usercp') { global $navclass, $cpnav, $gobutton, $stylevar, $vbphrase; global $messagecounters, $subscribecounters, $vbulletin; global $show, $subscriptioncache, $template_hook; $cells = array('usercp', 'signature', 'profile', 'options', 'password', 'avatar', 'profilepic', 'album', 'pm_messagelist', 'pm_newpm', 'pm_trackpm', 'pm_editfolders', 'substhreads_listthreads', 'substhreads_editfolders', 'deletedthreads', 'deletedposts', 'moderatedthreads', 'moderatedposts', 'moderatedvms', 'deletedvms', 'moderatedgms', 'deletedgms', 'moderatedpcs', 'deletedpcs', 'moderatedpics', 'event_reminders', 'paid_subscriptions', 'usergroups', 'buddylist', 'ignorelist', 'attachments', 'customize'); ($hook = vBulletinHook::fetch_hook('usercp_nav_start')) ? eval($hook) : false; // Get forums that allow canview access $canget = $canpost = ''; foreach ($vbulletin->userinfo['forumpermissions'] as $forumid => $perm) { if ($perm & $vbulletin->bf_ugp_forumpermissions['canview'] and $perm & $vbulletin->bf_ugp_forumpermissions['canviewthreads'] and $perm & $vbulletin->bf_ugp_forumpermissions['cangetattachment']) { $canget .= ",{$forumid}"; } if ($perm & $vbulletin->bf_ugp_forumpermissions['canpostattachment'] and !empty($vbulletin->userinfo['attachmentextensions'])) { $canpost .= ",{$forumid}"; } } if (!$canpost) { $attachments = $vbulletin->db->query_first_slave("\n\t\t\tSELECT COUNT(*) AS total\n\t\t\tFROM " . TABLE_PREFIX . "attachment AS attachment\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = attachment.postid)\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "thread AS thread ON (post.threadid = thread.threadid)\n\t\t\tWHERE attachment.userid = " . $vbulletin->userinfo['userid'] . "\n\t\t\t\tAND\t((forumid IN(0{$canget}) AND thread.visible = 1 AND post.visible = 1) OR attachment.postid = 0)\n\t\t"); $totalattachments = intval($attachments['total']); } if (!($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_profile_styling'])) { $show['customizelink'] = false; } else { if ($vbulletin->userinfo['permissions']['usercsspermissions'] & $vbulletin->bf_ugp_usercsspermissions['caneditfontfamily'] or $vbulletin->userinfo['permissions']['usercsspermissions'] & $vbulletin->bf_ugp_usercsspermissions['caneditfontsize'] or $vbulletin->userinfo['permissions']['usercsspermissions'] & $vbulletin->bf_ugp_usercsspermissions['caneditcolors'] or $vbulletin->userinfo['permissions']['usercsspermissions'] & $vbulletin->bf_ugp_usercsspermissions['caneditbgimage'] or $vbulletin->userinfo['permissions']['usercsspermissions'] & $vbulletin->bf_ugp_usercsspermissions['caneditborders']) { $show['customizelink'] = true; } else { $show['customizelink'] = false; } } if ($show['avatarlink'] and !($vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canuseavatar'])) { $membergroups = fetch_membergroupids_array($vbulletin->userinfo); // We don't have any predefined avatars or user's groups are all denied permission if (!empty($vbulletin->noavatarperms) and ($vbulletin->noavatarperms['all'] == true or !count(array_diff($membergroups, $vbulletin->noavatarperms)))) { $show['avatarlink'] = false; } else { if (!empty($vbulletin->userinfo['infractiongroupids'])) { $show['avatarlink'] = $categorycache =& fetch_avatar_categories($vbulletin->userinfo); } } } if ($totalattachments or $canpost) { $show['attachments'] = true; } if ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_groups'] and $vbulletin->userinfo['permissions']['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canviewgroups']) { $show['socialgroupslink'] = true; } if (!$vbulletin->options['subscriptionmethods']) { $show['paidsubscriptions'] = false; } else { // cache all the subscriptions - should move this to a datastore object at some point require_once DIR . '/includes/class_paid_subscription.php'; $subobj = new vB_PaidSubscription($vbulletin); $subobj->cache_user_subscriptions(); $show['paidsubscriptions'] = false; foreach ($subobj->subscriptioncache as $subscription) { $subscriptionid =& $subscription['subscriptionid']; if ($subscription['active'] and (empty($subscription['deniedgroups']) or count(array_diff(fetch_membergroupids_array($vbulletin->userinfo), $subscription['deniedgroups'])))) { $show['paidsubscriptions'] = true; break; } } } // check to see if there are usergroups available $show['publicgroups'] = false; foreach ($vbulletin->usergroupcache as $usergroup) { if ($usergroup['ispublicgroup'] or $usergroup['canoverride'] and is_member_of($vbulletin->userinfo, $usergroup['usergroupid'])) { $show['publicgroups'] = true; break; } } // Setup Moderation Links if (can_moderate()) { $show['deleteditems'] = true; $show['deletedmessages'] = true; } if (can_moderate(0, 'canmoderateposts')) { $show['moderatedposts'] = true; } if (can_moderate(0, 'canmoderatevisitormessages') and $vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_visitor_messaging']) { $show['moderatedvms'] = true; $show['deletedvms'] = true; } if (can_moderate(0, 'canmoderategroupmessages') and $vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_groups'] and $vbulletin->options['socnet_groups_msg_enabled']) { $show['moderatedgms'] = true; $show['deletedgms'] = true; } if (can_moderate(0, 'canmoderatepicturecomments') and $vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_albums'] and $vbulletin->options['pc_enabled']) { $show['moderatedpcs'] = true; $show['deletedpcs'] = true; } if (can_moderate(0, 'canmoderatepictures') and $vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_albums']) { $show['moderatedpics'] = true; } $show['moderateditems'] = ($show['moderatedposts'] or $show['moderatedvms'] or $show['moderatedgms'] or $show['moderatedpcs'] or $show['moderatedpics']); $show['moderation'] = ($show['deleteditems'] or $show['moderateditems']); // album setup $show['albumlink'] = ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_albums'] and $vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canviewmembers'] and $vbulletin->userinfo['permissions']['albumpermissions'] & $vbulletin->bf_ugp_albumpermissions['canviewalbum'] and $vbulletin->userinfo['permissions']['albumpermissions'] & $vbulletin->bf_ugp_albumpermissions['canalbum']); // set the class for each cell/group $navclass = array(); foreach ($cells as $cellname) { $navclass["{$cellname}"] = 'alt2'; } $navclass["{$selectedcell}"] = 'alt1'; // variable to hold templates for pm / subs folders $cpnav = array(); // get PM folders $cpnav['pmfolders'] = ''; $pmfolders = array('0' => $vbphrase['inbox'], '-1' => $vbphrase['sent_items']); if (!empty($vbulletin->userinfo['pmfolders'])) { $pmfolders = $pmfolders + unserialize($vbulletin->userinfo['pmfolders']); } foreach ($pmfolders as $folderid => $foldername) { $linkurl = 'private.php?' . $vbulletin->session->vars['sessionurl'] . "folderid={$folderid}"; eval('$cpnav[\'pmfolders\'] .= "' . fetch_template('usercp_nav_folderbit') . '";'); } // get subscriptions folders $cpnav['subsfolders'] = ''; $subsfolders = unserialize($vbulletin->userinfo['subfolders']); if (!empty($subsfolders)) { foreach ($subsfolders as $folderid => $foldername) { $linkurl = 'subscription.php?' . $vbulletin->session->vars['sessionurl'] . "folderid={$folderid}"; eval('$cpnav[\'subsfolders\'] .= "' . fetch_template('usercp_nav_folderbit') . '";'); } } if ($cpnav['subsfolders'] == '') { $linkurl = 'subscription.php?' . $vbulletin->session->vars['sessionurl'] . 'folderid=0'; $foldername = $vbphrase['subscriptions']; eval('$cpnav[\'subsfolders\'] .= "' . fetch_template('usercp_nav_folderbit') . '";'); } ($hook = vBulletinHook::fetch_hook('usercp_nav_complete')) ? eval($hook) : false; }
/** * Fetch notices to be displayed * * @param int $channelid Current Channel ID * @param array $ignore_np_notices Ignored non-persistent notice ids * @param boolean Whether or not to do the phrase replacement, if false, the client is responsible * @return array Notices * * @see fetch_relevant_notice_ids() */ public function fetch($channelid = 0, $ignore_np_notices = array(), $replace_phrases = false) { if ($channelid) { $channelapi = vB_Api::instanceInternal('content_channel'); // This is to verify $channelid $channelapi->fetchChannelById($channelid); } $noticecache = vB::getDatastore()->getValue('noticecache'); $userinfo = vB::getCurrentSession()->fetch_userinfo(); $vboptions = vB::getDatastore()->getValue('options'); $display_notices = array(); foreach ($noticecache as $noticeid => $notice) { foreach ($notice as $criteriaid => $conditions) { switch ($criteriaid) { case 'persistent': if ($conditions == 0 and is_array($ignore_np_notices) and in_array($noticeid, $ignore_np_notices)) { continue 3; } break; case 'dismissible': if ($conditions == 1 and in_array($noticeid, $this->fetchDismissedNotices())) { continue 3; } break; /*case 'notice_x_not_displayed': // this is now handled differently - see $remove_display_notices below { if (in_array(intval($conditions[0]), $display_notices)) { continue 3; } break; }*/ /*case 'notice_x_not_displayed': // this is now handled differently - see $remove_display_notices below { if (in_array(intval($conditions[0]), $display_notices)) { continue 3; } break; }*/ case 'in_usergroup_x': if (!is_member_of($userinfo, intval($conditions[0]))) { continue 3; } break; case 'not_in_usergroup_x': if (is_member_of($userinfo, intval($conditions[0]))) { continue 3; } break; case 'browsing_forum_x': if (!$channelid or $channelid != intval($conditions[0])) { continue 3; } break; case 'browsing_forum_x_and_children': if (!$channelid) { continue 3; } $parents = vB_Library::instance('node')->getParents($channelid); $parentids = array(); foreach ($parents as $parent) { if ($parent['nodeid'] != 1) { $parentids[] = $parent['nodeid']; } } if (!in_array(intval($conditions[0]), $parentids)) { continue 3; } break; case 'no_visit_in_x_days': if ($userinfo['lastvisit'] > vB::getRequest()->getTimeNow() - $conditions[0] * 86400) { continue 3; } break; case 'has_never_posted': if ($userinfo['posts'] > 0) { continue 3; } break; case 'no_posts_in_x_days': if ($userinfo['lastpost'] == 0 or $userinfo['lastpost'] > vB::getRequest()->getTimeNow() - $conditions[0] * 86400) { continue 3; } break; case 'has_x_postcount': if (!$this->checkNoticeCriteriaBetween($userinfo['posts'], $conditions[0], $conditions[1])) { continue 3; } break; case 'has_x_reputation': if (!$this->checkNoticeCriteriaBetween($userinfo['reputation'], $conditions[0], $conditions[1])) { continue 3; } break; case 'has_x_infraction_points': if (!$this->checkNoticeCriteriaBetween($userinfo['ipoints'], $conditions[0], $conditions[1])) { continue 3; } break; case 'pm_storage_x_percent_full': if ($userinfo['permissions']['pmquota']) { $pmboxpercentage = $userinfo['pmtotal'] / $userinfo['permissions']['pmquota'] * 100; if (!$this->checkNoticeCriteriaBetween($pmboxpercentage, $conditions[0], $conditions[1])) { continue 3; } } else { continue 3; } break; case 'username_is': if (strtolower($userinfo['username']) != strtolower(trim($conditions[0]))) { continue 3; } break; case 'is_birthday': if (substr($userinfo['birthday'], 0, 5) != vbdate('m-d', vB::getRequest()->getTimeNow(), false, false)) { continue 3; } break; case 'came_from_search_engine': if (!is_came_from_search_engine()) { continue 3; } break; case 'style_is_x': if (STYLEID != intval($conditions[0])) { continue 3; } break; case 'in_coventry': if (!in_array($userinfo['userid'], preg_split('#\\s+#', $vboptions['globalignore'], -1, PREG_SPLIT_NO_EMPTY))) { continue 3; } break; case 'is_date': if (empty($conditions[1]) and vbdate('d-m-Y', vB::getRequest()->getTimeNow(), false, false) != $conditions[0]) { continue 3; } else { if ($conditions[1] and gmdate('d-m-Y', vB::getRequest()->getTimeNow()) != $conditions[0]) { continue 3; } } break; case 'is_time': if (preg_match('#^(\\d{1,2}):(\\d{2})$#', $conditions[0], $start_time) and preg_match('#^(\\d{1,2}):(\\d{2})$#', $conditions[1], $end_time)) { if (empty($conditions[2])) { $start = mktime($start_time[1], $start_time[2]) + $vboptions['hourdiff']; $end = mktime($end_time[1], $end_time[2]) + $vboptions['hourdiff']; $now = mktime() + $vboptions['hourdiff']; } else { $start = gmmktime($start_time[1], $start_time[2]); $end = gmmktime($end_time[1], $end_time[2]); $now = gmmktime(); } if ($now < $start or $now > $end) { continue 3; } } else { continue 3; } break; default: $abort = false; if ($abort) { continue 3; } } } $display_notices["{$noticeid}"] = $noticeid; } // now go through removing notices using the 'notice_x_not_displayed' criteria $remove_display_notices = array(); foreach ($noticecache as $noticeid => $notice) { if (isset($notice['notice_x_not_displayed']) and isset($display_notices[intval($notice['notice_x_not_displayed'][0])])) { $remove_display_notices["{$noticeid}"] = $noticeid; } } foreach ($remove_display_notices as $noticeid) { unset($display_notices["{$noticeid}"]); } $return = array(); if ($display_notices) { if ($replace_phrases) { // Prefech phrases $phrases = array(); foreach ($display_notices as $display_notice) { $phrases[] = "notice_{$display_notice}_html"; } $vbphrase = vB_Api::instanceInternal('phrase')->fetch($phrases); foreach ($display_notices as $display_notice) { $notice_html = str_replace(array('{musername}', '{username}', '{userid}', '{sessionurl}', '{sessionurl_q}', '{register_page}', '{help_page}'), array($userinfo['musername'], $userinfo['username'], $userinfo['userid'], vB::getCurrentSession()->get('sessionurl'), vB::getCurrentSession()->get('sessionurl_q'), vB5_Route::buildUrl('register|fullurl'), vB5_Route::buildUrl('help|fullurl')), $vbphrase["notice_{$display_notice}_html"]); $return[$display_notice] = $noticecache[$display_notice]; $return[$display_notice]['notice_html'] = $notice_html; } } else { foreach ($display_notices as $display_notice) { $return[$display_notice] = $noticecache[$display_notice]; $return[$display_notice]['notice_phrase_varname'] = "notice_{$display_notice}_html"; } } } return $return; }
<?php $its = array(); $its[] = array('title' => 'About noblood', 'desc' => 'Who we are, what we do, how we do it and what you can do.', 'url' => 'about/'); $its[] = array('title' => 'Enter Forums', 'desc' => 'Review latest discussions.', 'url' => 'forums/'); $its[] = array('title' => 'Projects NEW!', 'desc' => 'Suggest new features, report bugs, participate in site development tasks.', 'url' => 'projects/'); $its[] = array('title' => 'Ask A Question', 'desc' => 'Post a question to the community.', 'url' => 'newthread.php?do=newthread&f=59'); // setup to search for unanswered posts $fwsfut_display = 0; if ($vbulletin->options['fwsfut_all_grps'] == 0) { $fwsfut_display = 1; } if ($vbulletin->options['fwsfut_all_grps'] == 1) { $fwsfut_groups = explode(',', $vbulletin->options['fwsfut_grps']); if (is_member_of($vbulletin->userinfo, $fwsfut_groups)) { $fwsfut_display = 1; } } if ($fwsfut_display == 1) { $its[] = array('title' => 'Answer A Question', 'desc' => 'Share your expertise - respond to unanswered questions.', 'url' => $vbulletin->options['bburl'] . '/search.php?' . $session['sessionurl'] . 'do=process&replyless=1&replylimit=0&exclude=' . $vbulletin->options['fwsfut_exclude_forums'] . '&nocache=' . $vbulletin->options['fwsfut_cache_enable']); } $its[] = array('title' => 'Share News', 'desc' => 'Share industry news.', 'url' => 'newthread.php?do=newthread&f=4'); $its[] = array('title' => 'Events Calendar', 'desc' => 'Review and share events of interest.', 'url' => 'calendar.php?do=add&c=1'); //$its[] = array('title' => 'Link To Us', 'desc' => 'Place HTML on your site or in your blog.'); //$its[] = array('title' => 'Get Involved', 'desc' => 'Please help us improve this resource.'); $its[] = array('title' => 'Tell a Friend', 'desc' => 'Invite friends and collegues to participate in this community.', 'url' => 'invite'); $its[] = array('title' => 'Support', 'desc' => 'Please help us support this site.', 'url' => '/donate'); $community = ' <div id="community_r"> <div id="community_top"> <h3>Welcome To Our Community</h3>
/** * Fetches the IDs of the notices to display on a particular page. * * @return array Array of IDs to display */ function fetch_relevant_notice_ids() { global $vbulletin, $vbphrase, $stylevar, $foruminfo, $threadinfo, $postinfo; $forum_pages = array('poll', 'editpost', 'threadrate', 'postings', 'showthread', 'newthread', 'forumdisplay', 'newreply', 'threadtag', 'inlinemod', 'announcement', 'showpost'); $ignore_np_notices = explode(',', $_COOKIE[COOKIE_PREFIX . 'np_notices_displayed']); $display_notices = array(); $vbulletin->np_notices_displayed = array(); ($hook = vBulletinHook::fetch_hook('notices_check_start')) ? eval($hook) : false; foreach ($vbulletin->noticecache as $noticeid => $notice) { foreach ($notice as $criteriaid => $conditions) { switch ($criteriaid) { case 'persistent': if ($conditions == 0 and in_array($noticeid, $ignore_np_notices)) { continue 3; } break; /*case 'notice_x_not_displayed': // this is now handled differently - see $remove_display_notices below { if (in_array(intval($conditions[0]), $display_notices)) { continue 3; } break; }*/ /*case 'notice_x_not_displayed': // this is now handled differently - see $remove_display_notices below { if (in_array(intval($conditions[0]), $display_notices)) { continue 3; } break; }*/ case 'in_usergroup_x': if (!is_member_of($vbulletin->userinfo, intval($conditions[0]))) { continue 3; } break; case 'not_in_usergroup_x': if (is_member_of($vbulletin->userinfo, intval($conditions[0]))) { continue 3; } break; case 'browsing_forum_x': if ($foruminfo['forumid'] != intval($conditions[0]) or !in_array(THIS_SCRIPT, $forum_pages)) { continue 3; } break; case 'browsing_forum_x_and_children': if (!in_array(intval($conditions[0]), explode(',', $foruminfo['parentlist'])) or !in_array(THIS_SCRIPT, $forum_pages)) { continue 3; } break; case 'no_visit_in_x_days': if ($vbulletin->userinfo['lastvisit'] > TIMENOW - $conditions[0] * 86400) { continue 3; } break; case 'has_never_posted': if ($vbulletin->userinfo['lastpost'] > 0) { continue 3; } break; case 'no_posts_in_x_days': if ($vbulletin->userinfo['lastpost'] == 0 or $vbulletin->userinfo['lastpost'] > TIMENOW - $conditions[0] * 86400) { continue 3; } break; case 'has_x_postcount': if (!check_notice_criteria_between($vbulletin->userinfo['posts'], $conditions[0], $conditions[1])) { continue 3; } break; case 'has_x_reputation': if (!check_notice_criteria_between($vbulletin->userinfo['reputation'], $conditions[0], $conditions[1])) { continue 3; } break; case 'has_x_infraction_points': if (!check_notice_criteria_between($vbulletin->userinfo['ipoints'], $conditions[0], $conditions[1])) { continue 3; } break; case 'pm_storage_x_percent_full': if ($vbulletin->userinfo['permissions']['pmquota']) { $pmboxpercentage = $vbulletin->userinfo['pmtotal'] / $vbulletin->userinfo['permissions']['pmquota'] * 100; if (!check_notice_criteria_between($pmboxpercentage, $conditions[0], $conditions[1])) { continue 3; } } else { continue 3; } break; case 'username_is': if (strtolower($vbulletin->userinfo['username']) != strtolower(trim($conditions[0]))) { continue 3; } break; case 'is_birthday': if (substr($vbulletin->userinfo['birthday'], 0, 5) != vbdate('m-d', TIMENOW, false, false)) { continue 3; } break; case 'style_is_x': if (STYLEID != intval($conditions[0])) { continue 3; } break; case 'in_coventry': if (!in_array($vbulletin->userinfo['userid'], preg_split('#\\s+#', $vbulletin->options['globalignore'], -1, PREG_SPLIT_NO_EMPTY))) { continue 3; } break; case 'is_date': if (vbdate('d-m-Y', TIMENOW, false, false) != $conditions[0]) { continue 3; } break; default: $abort = false; ($hook = vBulletinHook::fetch_hook('notices_check_criteria')) ? eval($hook) : false; if ($abort) { continue 3; } } } $display_notices["{$noticeid}"] = $noticeid; if ($notice['persistent'] == 0) { $vbulletin->np_notices_displayed["{$noticeid}"] = $noticeid; } } // now go through removing notices using the 'notice_x_not_displayed' criteria $remove_display_notices = array(); foreach ($vbulletin->noticecache as $noticeid => $notice) { if (isset($notice['notice_x_not_displayed']) and isset($display_notices[intval($notice['notice_x_not_displayed'][0])])) { $remove_display_notices["{$noticeid}"] = $noticeid; } } foreach ($remove_display_notices as $noticeid) { unset($display_notices["{$noticeid}"], $vbulletin->np_notices_displayed["{$noticeid}"]); } return $display_notices; }
<?php include_once 'functions_vb_ad_management.php'; $addelimiter = $vbulletin->options['adintegrate_delimiter']; // Run through the general settings to see if the conditions are correct for ads. if (!is_member_of($vbulletin->userinfo, explode($addelimiter, $vbulletin->options['adintegrate_usergroupids_off'])) && (empty($vbulletin->options['adintegrate_usergroupids_on']) || is_member_of($vbulletin->userinfo, explode($addelimiter, $vbulletin->options['adintegrate_usergroupids_on'])))) { if (!in_array(THIS_SCRIPT, explode($addelimiter, $vbulletin->options['adintegrate_this_script_off']))) { if (!isset($foruminfo['forumid']) || !in_array($foruminfo['forumid'], explode($addelimiter, $vbulletin->options['adintegrate_forumids_off'])) && (empty($vbulletin->options['adintegrate_forumids_on']) || in_array($foruminfo['forumid'], explode($addelimiter, $vbulletin->options['adintegrate_forumids_on'])))) { // General settings check out, display the ads! $do_ads = '1'; // Full-page and tracking if ($vbulletin->options['adintegrate_fullpage_onoff'] == '1') { if ($vbulletin->options['adintegrate_fullpage_timetoad'] > '0') { $fullpage_remaining = $vbulletin->input->clean_gpc('c', COOKIE_PREFIX . 'fullpage', TYPE_INT); if ($fullpage_remaining + $vbulletin->options['adintegrate_fullpage_timetoad'] < TIMENOW || empty($fullpage_remaining) && $vbulletin->options['adintegrate_fullpage_arrival'] == '1') { $fullpage_adcode = createad($vbulletin->options['adintegrate_fullpage_adcode']); if (!empty($fullpage_adcode)) { $adintegrate_domain = explode('/', $vbulletin->options['bburl']); $adintegrate_url = $vbulletin->options['bburl'] . '/advertisement.php?url=' . $adintegrate_domain['0'] . '//' . $adintegrate_domain['2'] . $_SERVER['REQUEST_URI']; header("Location: {$adintegrate_url}"); } vbsetcookie('fullpage', TIMENOW); } else { if ($fullpage_remaining < '1000') { vbsetcookie('fullpage', TIMENOW); } } } else { if ($vbulletin->options['adintegrate_fullpage_pageviewstoad'] > '0') { if (in_array(THIS_SCRIPT, explode($addelimiter, $vbulletin->options['adintegrate_fullpage_thisscript']))) { $chanceofad = $vbulletin->options['adintegrate_fullpage_pageviewstoad'];
$grand_qty_total += $qty_total; } if ($show_details) { echo "<tr class=\"row3\">\n<td colspan=\"7\"> </td></tr>\n"; } } } if ($show_work) { printf("<tr class=\"row%1d\">\n<th align=\"left\" colspan=\"4\">Grand Total</th>\n<th align=\"right\">%9.2f </th><th> </th><th align=\"right\">%9.2f </th>\n</tr>\n", $i % 2, $grand_qty_total, $grand_total); } echo "</table>\n"; if ("{$style}" != "stripped") { echo "<br clear=all><hr>\n<table cellpadding=5 cellspacing=5 align=right><tr><td>Rerun as report: </td>\n<td>\n"; printf("<a href=\"{$this_page}\" target=_new>Brief</a>\n", "stripped", "brief"); printf(" | <a href=\"{$this_page}&maxresults=5000\">All Rows</a>\n", $style, $format); if (is_member_of('Admin', 'Support')) { printf(" | <a href=\"{$this_page}\" target=_new>Activity</a>\n", "stripped", "activity"); } printf(" | <a href=\"{$this_page}\" target=_new>Detailed</a>\n", "stripped", "detailed"); if (is_member_of('Admin', 'Support', 'Manage')) { printf(" | <a href=\"{$this_page}\" target=_new>Quotes</a>\n", "stripped", "quotes"); } if (is_member_of('Admin', 'Support')) { printf(" | <a href=\"{$this_page}\" target=_new>Ultimate</a>\n", "stripped", "ultimate"); } if (is_member_of('Admin', 'Support')) { printf(" | <a href=\"{$this_page}\" target=_new>Brief (editable)</a>\n", "stripped", "edit"); } echo "</td></tr></table>\n"; } include "page-footer.php";
function sharead($output, $simplesearch = '0') { global $addelimiter, $vbulletin, $foruminfo, $threadinfo; // Set up user details for the permission checks below...regardless of whether the query runs. $global_userx = $vbulletin->userinfo['userid']; $global_usergroupx = $vbulletin->userinfo['usergroupid']; // Find the fields preg_match_all('/#(field([0-9]{1,}))#/i', $output, $adintegrate_fields); $adintegrate_fields['1'] = array_unique($adintegrate_fields['1']); if (!empty($adintegrate_fields['1']) && (THIS_SCRIPT == 'showthread' || THIS_SCRIPT == 'showpost')) { if (!isset($foruminfo['forumid']) || !in_array($foruminfo['forumid'], explode($addelimiter, $vbulletin->options['adintegrate_sharing_forumids_off'])) && (empty($vbulletin->options['adintegrate_sharing_forumids_on']) || in_array($foruminfo['forumid'], explode($addelimiter, $vbulletin->options['adintegrate_sharing_forumids_on'])))) { foreach ($adintegrate_fields['1'] as $adintegrate_fielded) { $fieldx .= 'userfield.' . $adintegrate_fielded . ', '; } $fieldx = substr_replace($fieldx, '', -2); if (!empty($vbulletin->options['adintegrate_sharing_force_threadstarter']) || !empty($vbulletin->options['adintegrate_sharing_force_lastposter'])) { if (in_array($foruminfo['forumid'], explode($addelimiter, $vbulletin->options['adintegrate_sharing_force_threadstarter']))) { $this_poster = 'threadstarter'; } else { $this_poster = 'lastposter'; } } else { $adintegrate_sharing_who = array('staff', 'threadstarter', 'lastposter'); $adintegrate_sharing_percent = array($vbulletin->options['adintegrate_sharing_chanceofstaff'], $vbulletin->options['adintegrate_sharing_chanceofthreadstarter'], $vbulletin->options['adintegrate_sharing_chanceoflastposter']); array_multisort($adintegrate_sharing_percent, SORT_DESC, $adintegrate_sharing_who); $adsharing_rand = mt_rand(1, 100); $hundred = '100'; $i = '0'; while ($i < '3') { if (!isset($adintegrate_sharing_assigned)) { $hundred = $hundred - $adintegrate_sharing_percent["{$i}"]; } if ($adsharing_rand > $hundred && !isset($adintegrate_sharing_assigned)) { $adintegrate_sharing_assigned = $adintegrate_sharing_who["{$i}"]; } $i++; } unset($i); unset($hundred); } } } // We have the shared group assignment, query for the user. if (isset($adintegrate_sharing_assigned)) { if ($adintegrate_sharing_assigned == 'lastposter') { $global_getshared = $vbulletin->db->query_first_slave("\n\t\t\t\t\tSELECT post.userid, " . $vbulletin->db->escape_string($fieldx) . ", user.usergroupid\n\t\t\t\t\tFROM " . TABLE_PREFIX . "post AS post, " . TABLE_PREFIX . "userfield AS userfield, " . TABLE_PREFIX . "user AS user\n\t\t\t\t\tWHERE threadid = '" . $vbulletin->db->escape_string($threadinfo['threadid']) . "'\n\t\t\t\t\tAND userfield.userid = post.userid\n\t\t\t\t\tAND user.userid = post.userid\n\t\t\t\t\tORDER BY post.dateline DESC\n\t\t\t\t\tLIMIT 1\n\t\t\t\t"); $global_userx = $global_getshared['userid']; $global_usergroupx = $global_getshared['usergroupid']; } else { if ($adintegrate_sharing_assigned == 'threadstarter') { if ($threadinfo['postuserid'] != $vbulletin->userinfo['userid']) { $global_userx = $threadinfo['postuserid']; $global_getshared = $vbulletin->db->query_first_slave("\n\t\t\t\t\t\tSELECT user.usergroupid, " . $vbulletin->db->escape_string($fieldx) . "\n\t\t\t\t\t\tFROM " . TABLE_PREFIX . "user AS user, " . TABLE_PREFIX . "userfield AS userfield\n\t\t\t\t\t\tWHERE user.userid = '" . $vbulletin->db->escape_string($threadinfo['postuserid']) . "'\n\t\t\t\t\t\tAND userfield.userid = '" . $vbulletin->db->escape_string($threadinfo['postuserid']) . "'\n\t\t\t\t\t"); $global_usergroupx = $global_getshared['usergroupid']; } } else { // Annoyingly, ORDER BY RAND() LIMIT 1 was no good because each moderator that was manually added to a forum gained // an additional entry for each forum. So a Super Mod would have 1 entry, a standard mod of 3 forums would have 3 entries // which screwed up the random distribution. So all moderators are pulled, duplicates are merged and then one is picked. // Fair, but not terribly efficient. If there's a way to do this in SQL, I don't know it. W $moderator_forumid = "OR (user.usergroupid = '7' AND moderator.forumid = '-1' OR moderator.forumid = '" . $vbulletin->db->escape_string($foruminfo['forumid']) . "')"; $global_getshared = $vbulletin->db->query_read_slave("\n\t\t\t\t\tSELECT moderator.userid, moderator.forumid, user.usergroupid, " . $vbulletin->db->escape_string($fieldx) . "\n\t\t\t\t\tFROM " . TABLE_PREFIX . "moderator AS moderator, " . TABLE_PREFIX . "userfield AS userfield, " . TABLE_PREFIX . "user AS user\n\t\t\t\t\tWHERE user.userid != '1'\n\t\t\t\t\tAND user.userid = moderator.userid\n\t\t\t\t\tAND userfield.userid = moderator.userid\n\t\t\t\t\tAND user.usergroupid = '5'\n\t\t\t\t\tOR user.usergroupid = '6'\n\t\t\t\t\t\t" . $moderator_forumid . "\n\t\t\t\t"); $global_getshared = array(); while ($moderator = $vbulletin->db->fetch_array($global_getshared)) { $global_getshared[] = $moderator; } $global_getshared = array_rand(array_unique($global_getshared)); $global_userx = $global_getshared['userid']; $global_usergroupx = $global_getshared['usergroupid']; } } } if ($global_userx == $vbulletin->userinfo['userid'] || is_member_of($global_usergroupx, explode($addelimiter, $vbulletin->options['adintegrate_sharing_usergroupids_off'])) || in_coventry($global_userx, true) || !empty($vbulletin->options['adintegrate_sharing_usergroupids_on']) && !is_member_of($global_usergroupx, explode($addelimiter, $vbulletin->options['adintegrate_sharing_usergroupids_on']))) { // User is banned for one reason or another, remove their assignment so it uses the admin's default adcode. $global_getshared = array(); } if (!empty($adintegrate_fields['1'])) { if ($simplesearch == '0') { $preg_find_open = '<div (id|class)="([\\w]+)_adcode">(.*)'; $preg_find_close = '(.*)<\\/div>'; $preg_replace_open = '<div $1="$2_adcode">$3'; $preg_replace_close = '$4</div>'; } foreach ($adintegrate_fields['1'] as $adintegrate_find) { $adintegrate_replace = $global_getshared["{$adintegrate_find}"]; // This user's custom field is empty or they're banned from sharing, use the admin's default. if (empty($adintegrate_replace)) { $adintegrate_replace = 'adintegrate_' . $adintegrate_find; $adintegrate_replace = $vbulletin->options["{$adintegrate_replace}"]; } $adintegrate_preg_find[] = "/{$preg_find_open}#{$adintegrate_find}#{$preg_find_close}/siU"; $adintegrate_preg_replace[] = "{$preg_replace_open}{$adintegrate_replace}{$preg_replace_close}"; } if (isset($adintegrate_preg_find)) { $output = preg_replace($adintegrate_preg_find, $adintegrate_preg_replace, $output); } } return $output; }