public function fetch_validated_list($user, $ids, $gids) { //null items are never valid $retval = array_fill_keys($ids, false); ($hook = vBulletinHook::fetch_hook('search_validated_list')) ? eval($hook) : false; return $retval; }
/** * Renders the navigation tabs & links. */ protected function getNavigation() { global $vbulletin; $root = ''; $root_tab = $roots['vbtab_forum']; $tabs = build_navigation_menudata(); $roots = get_navigation_roots(build_navigation_list()); $request_tab = intval($_REQUEST['tabid']); $script_tab = get_navigation_tab_script(); $hook_tabid = $tabid = 0; ($hook = vBulletinHook::fetch_hook('set_navigation_tab_vbview')) ? eval($hook) : false; if ($root) { $tabid = $roots[$root]; } /* Tab setting logic, using above choices. Preference order is (low > high) root > script > hookroot > hookid > request */ $current_tab = $script_tab ? $script_tab : $root_tab; $current_tab = $tabid ? $tabid : $current_tab; $current_tab = $hook_tabid ? $hook_tabid : $current_tab; $current_tab = $request_tab ? $request_tab : $current_tab; $tabid = set_navigation_tab($current_tab, $tabs); $view = new vB_View('navbar_tabs'); $view->tabs = $tabs; $view->selected = $tabid; return $view->render(); }
public function prepare_render($user, $results) { global $show; $this->mod_rights['movethread'] = false; $this->mod_rights['deletethread'] = false; $this->mod_rights['approvethread'] = false; $this->mod_rights['openthread'] = false; $ids = array(); foreach ($results as $result) { $forumid = $result->get_thread()->get_field('forumid'); $this->mod_rights['movethread'] = ($this->mod_rights['movethread'] or $user->canModerateForum($forumid, 'canmanagethreads')); $this->mod_rights['deletethread'] = ($this->mod_rights['deletethread'] or ($user->canModerateForum($forumid, 'candeleteposts') or $user->canModerateForum($forumid, 'canremoveposts'))); $this->mod_rights['approvethread'] = ($this->mod_rights['approvethread'] or $user->canModerateForum($forumid, 'canmoderateposts')); $this->mod_rights['openthread'] = ($this->mod_rights['openthread'] or $user->canModerateForum($forumid, 'canopenclose')); //we need to know if any particular thread allows icons before we render any of them $thread = $result->get_thread(); if ($thread->has_icon()) { $show['threadicons'] = true; } $ids[] = $thread->get_field('threadid'); } //this is used by process_thread_array in functions_forumdisplay.php //which is called from vBForum_Search_Result_Thread::render global $dotthreads; $dotthreads = fetch_dot_threads_array(implode(',', $ids)); ($hook = vBulletinHook::fetch_hook('search_prepare_render')) ? eval($hook) : false; }
/** * Fetches the SQL for loading. * $required_query is used to identify which query to build for classes that * have multiple queries for fetching info. * * This can safely be based on $this->required_info as long as a consitent * flag is used for identifying the query. * * @param int $required_query - The required query * @param bool $force_rebuild - Whether to rebuild the string * * @return string */ protected function getLoadQuery($required_query = self::QUERY_BASIC, $force_rebuild = false) { // Hooks should check the required query before populating the hook vars $hook_query_fields = $hook_query_join = $hook_query_where = ''; ($hook = vBulletinHook::fetch_hook($this->query_hook)) ? eval($hook) : false; if (self::QUERY_BASIC == $required_query) { return $query = " SELECT groupmessage.gmid as itemid, groupmessage.discussionid, groupmessage.postuserid, groupmessage.postusername, groupmessage.dateline, groupmessage.state, groupmessage.title, groupmessage.pagetext, groupmessage.ipaddress, groupmessage.allowsmilie, groupmessage.reportthreadid " . $hook_query_fields . " FROM " . TABLE_PREFIX . "groupmessage AS groupmessage " . $hook_query_join . " WHERE groupmessage.gmid IN (" . implode(',', $this->itemid) . ") $hook_query_where"; } throw (new vB_Exception_Model('Invalid query id \'' . htmlspecialchars($required_query) . '\'specified for social group message collection: ' . htmlspecialchars($query))); }
public function process($config) { global $show; $activitybits = ''; $show['as_blog'] = vB::$vbulletin->products['vbblog']; $show['as_cms'] = vB::$vbulletin->products['vbcms']; $show['as_socialgroup'] = (vB::$vbulletin->options['socnet'] & vB::$vbulletin->bf_misc_socnet['enable_groups'] and vB::$vbulletin->userinfo['permissions']['socialgrouppermissions'] & vB::$vbulletin->bf_ugp_socialgrouppermissions['canviewgroups']); switch ($config['activitystream_sort']) { case '1': $this->orderby = 'score DESC, dateline DESC'; $sort = 'popular'; break; default: // recent $this->getnew = false; $this->orderby = 'dateline DESC'; $sort = 'recent'; } switch ($config['activitystream_filter']) { case '1': $this->setWhereFilter('type', 'photo'); break; case '2': $this->setWhereFilter('section', 'forum'); break; case '3': if ($show['as_cms']) { $this->setWhereFilter('section', 'cms'); } break; case '4': if ($show['as_blog']) { $this->setWhereFilter('section', 'blog'); } break; case '5': $this->setWhereFilter('section', 'socialgroup'); break; default: // all } switch ($config['activitystream_date']) { case '0': $this->setWhereFilter('maxdateline', TIMENOW - 24 * 60 * 60); break; case '1': $this->setWhereFilter('maxdateline', TIMENOW - 7 * 24 * 60 * 60); break; case '2': $this->setWhereFilter('maxdateline', TIMENOW - 30 * 24 * 60 * 60); break; default: // 3 - anytime } ($hook = vBulletinHook::fetch_hook($this->hook_beforefetch)) ? eval($hook) : false; $this->setPage(1, $config['activitystream_limit']); $result = $this->fetchStream($sort, true); $cleaned = array_filter($result['bits']); return $cleaned; }
/** * Fetches the SQL for loading. * $required_query is used to identify which query to build for classes that * have multiple queries for fetching info. * * This can safely be based on $this->required_info as long as a consitent * flag is used for identifying the query. * * @param int $required_query - The required query * @param bool $force_rebuild - Whether to rebuild the string * * @return string */ protected function getLoadQuery($required_query = self::QUERY_BASIC, $force_rebuild = false) { // Hooks should check the required query before populating the hook vars $hook_query_fields = $hook_query_join = $hook_query_where = ''; ($hook = vBulletinHook::fetch_hook($this->query_hook)) ? eval($hook) : false; if (self::QUERY_BASIC == $required_query) { $ids = array_map('intval', $this->itemid); return $query = " SELECT discussion.discussionid as itemid, discussion.*, firstpost.postuserid, firstpost.postusername, firstpost.dateline, firstpost.state, firstpost.title, firstpost.pagetext, firstpost.ipaddress, firstpost.allowsmilie, firstpost.reportthreadid " . $hook_query_fields . " FROM " . TABLE_PREFIX . "discussion AS discussion JOIN " . TABLE_PREFIX . "groupmessage AS firstpost ON discussion.firstpostid = firstpost.gmid INNER JOIN " . TABLE_PREFIX . "socialgroup AS socialgroup ON socialgroup.groupid = discussion.groupid " . $hook_query_join . " WHERE discussion.discussionid IN (" . implode(',', $ids) . ") $hook_query_where"; } throw (new vB_Exception_Model('Invalid query id \'' . htmlspecialchars($required_query) . '\'specified for social group message collection: ' . htmlspecialchars($query))); }
/** * Get similar threads to a given thread title * * A hack to support similar thread functionality -- this used the search system * previous and, in particular, the fulltext indexes on the thread table that * we are trying to get rid of. This allows us to move to the new search * tables in the db search implementation and for other search implementations * to make use of whatever index they have to produce the results. * * Ideally this would work with the normal search interface or at least * generalize to all content types, but the problem was noticed at the * last moment and some thought needs to be put into a more general implementation * (and there is no immediate requirement for one). * * Specialty search controllers can ignore this, it won't be used. * A default implementation is provided that accesses the override hook. * Any custom implementation by a search package should respect the hook override. * * @param string $threadtitle -- The title to match * @param int $threadid -- If provided this thread will be excluded from * similar matches */ public function get_similar_threads($threadtitle, $threadid = 0) { $similarthreads = null; ($hook = vBulletinHook::fetch_hook('search_similarthreads_fulltext')) ? eval($hook) : false; if ($similarthreads !== null) { return $similarthreads; } else { return array(); } }
function parse_video_bbcode($pagetext) { global $vbulletin; ($hook = vBulletinHook::fetch_hook('data_parse_bbcode_video')) ? eval($hook) : false; if (stripos($pagetext, '[video]') !== false) { require_once DIR . '/includes/class_bbcode_alt.php'; $parser = new vB_BbCodeParser_Video_PreParse($vbulletin, array()); $pagetext = $parser->parse($pagetext); } return $pagetext; }
/** * Builds the history bit for a selected history point * * @param array Array of information for this histoy point * @param object BB code parser * * @return string History bit HTML */ function build_history_bit($history, &$bbcode) { global $vbulletin, $vbphrase, $show, $stylevar; $history['editdate'] = vbdate($vbulletin->options['dateformat'], $history['dateline'], true); $history['edittime'] = vbdate($vbulletin->options['timeformat'], $history['dateline']); $history['message'] = $bbcode->parse($history['pagetext'], 'pt'); if ($history['reason'] === '') { $history['reason'] = $vbphrase['n_a']; } ($hook = vBulletinHook::fetch_hook('project_historybit')) ? eval($hook) : false; eval('$edit_history = "' . fetch_template('pt_historybit') . '";'); return $edit_history; }
/** * Contructs a Post Tree * * @param string The template Name to use * @param integer The Thread ID * @param integer The "Root" post for which to work from * @param integer The current "Depth" within the tree * * @return string The Generated Tree * */ function &construct_post_tree($templatename, $threadid, $parentid = 0, $depth = 1) { global $vbulletin, $stylevar, $parentassoc, $show, $vbphrase, $threadedmode; static $postcache; if (!$threadedmode and $vbulletin->userinfo['postorder']) { $postorder = 'DESC'; } $depthnext = $depth + 2; if (!$postcache) { $posts = $vbulletin->db->query_read_slave("\n\t\t\tSELECT post.parentid, post.postid, post.userid, post.pagetext, post.dateline, IF(visible = 2, 1, 0) AS isdeleted,\n\t\t\t\tIF(user.username <> '', user.username, post.username) AS username\n\t\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON user.userid = post.userid\n\t\t\tWHERE post.threadid = {$threadid}\n\t\t\tORDER BY dateline {$postorder}\n\t\t"); while ($post = $vbulletin->db->fetch_array($posts)) { if (!$threadedmode) { $post['parentid'] = 0; } $postcache[$post['parentid']][$post['postid']] = $post; } ksort($postcache); } $counter = 0; $postbits = ''; if (is_array($postcache["{$parentid}"])) { foreach ($postcache["{$parentid}"] as $post) { $parentassoc[$post['postid']] = $post['parentid']; if (($depth + 1) % 4 == 0) { // alternate colors when switching depths; depth gets incremented by 2 each time $post['backcolor'] = '{firstaltcolor}'; $post['bgclass'] = 'alt1'; } else { $post['backcolor'] = '{secondaltcolor}'; $post['bgclass'] = 'alt2'; } $post['postdate'] = vbdate($vbulletin->options['dateformat'], $post['dateline'], true); $post['posttime'] = vbdate($vbulletin->options['timeformat'], $post['dateline']); // cut page text short if too long if (vbstrlen($post['pagetext']) > 100) { $spacepos = strpos($post['pagetext'], ' ', 100); if ($spacepos != 0) { $post['pagetext'] = substr($post['pagetext'], 0, $spacepos) . '...'; } } $post['pagetext'] = nl2br(htmlspecialchars_uni($post['pagetext'])); ($hook = vBulletinHook::fetch_hook('threadmanage_construct_post_tree')) ? eval($hook) : false; eval('$postbits .= "' . fetch_template($templatename) . '";'); $ret =& construct_post_tree($templatename, $threadid, $post['postid'], $depthnext); $postbits .= $ret; } } return $postbits; }
/** * Fetches an array of prefixes for the specified forum. Returned in format: * [prefixsetid][] = prefixid * * @param integer Forum ID to fetch prefixes from * * @return array */ function fetch_prefix_array($forumid) { global $vbulletin; if (isset($vbulletin->prefixcache)) { return is_array($vbulletin->prefixcache["{$forumid}"]) ? $vbulletin->prefixcache["{$forumid}"] : array(); } else { $prefixsets = array(); $prefix_sql = $vbulletin->db->query_read("\n\t\t\tSELECT prefix.*\n\t\t\tFROM " . TABLE_PREFIX . "forumprefixset AS forumprefixset\n\t\t\tINNER JOIN " . TABLE_PREFIX . "prefixset AS prefixset ON (prefixset.prefixsetid = forumprefixset.prefixsetid)\n\t\t\tINNER JOIN " . TABLE_PREFIX . "prefix AS prefix ON (prefix.prefixsetid = prefixset.prefixsetid)\n\t\t\tWHERE forumprefixset.forumid = " . intval($forumid) . "\n\t\t\tORDER BY prefixset.displayorder, prefix.displayorder\n\t\t"); while ($prefix = $vbulletin->db->fetch_array($prefix_sql)) { $prefixsets["{$prefix['prefixsetid']}"][] = $prefix['prefixid']; } ($hook = vBulletinHook::fetch_hook('prefix_fetch_array')) ? eval($hook) : false; return $prefixsets; } }
/** * Prepares a Profile Field * * @param string The name of a field to be prepared */ function prepare($field, $info = null) { if (isset($this->prepared["{$field}"])) { return; } $handled = false; ($hook = vBulletinHook::fetch_hook('userprofile_prepare')) ? eval($hook) : false; if (!$handled) { if (isset($this->prepare_methods["{$field}"])) { $method = $this->prepare_methods["{$field}"]; $this->{$method}($info); } else { $this->prepared["{$field}"] = $this->userinfo["{$field}"]; } } }
/** * Fetches an array of prefixes for the specified forum. Returned in format: * [prefixsetid][] = prefixid * * @param integer Forum ID to fetch prefixes from * * @return array */ function fetch_prefix_array($forumid) { global $vbulletin; if (isset($vbulletin->prefixcache)) { return (is_array($vbulletin->prefixcache["$forumid"]) ? $vbulletin->prefixcache["$forumid"] : array()); } else { $prefixsets = array(); $prefix_sql = $vbulletin->db->query_read(" SELECT prefix.*, prefixpermission.usergroupid AS restriction FROM " . TABLE_PREFIX . "forumprefixset AS forumprefixset INNER JOIN " . TABLE_PREFIX . "prefixset AS prefixset ON (prefixset.prefixsetid = forumprefixset.prefixsetid) INNER JOIN " . TABLE_PREFIX . "prefix AS prefix ON (prefix.prefixsetid = prefixset.prefixsetid) LEFT JOIN " . TABLE_PREFIX . "prefixpermission AS prefixpermission ON (prefix.prefixid = prefixpermission.prefixid) WHERE forumprefixset.forumid = " . intval($forumid) . " ORDER BY prefixset.displayorder, prefix.displayorder "); while ($prefix = $vbulletin->db->fetch_array($prefix_sql)) { if (empty($prefixsets["$prefix[prefixsetid]"]["$prefix[prefixid]"])) { $prefixsets["$prefix[prefixsetid]"]["$prefix[prefixid]"] = array( 'prefixid' => $prefix['prefixid'], 'restrictions' => array() ); } if ($prefix['restriction']) { $prefixsets["$prefix[prefixsetid]"]["$prefix[prefixid]"]['restrictions'][] = $prefix['restriction']; } } ($hook = vBulletinHook::fetch_hook('prefix_fetch_array')) ? eval($hook) : false; return $prefixsets; } }
function verify_authentication2($username) { global $vbulletin; $username = strip_blank_ascii($username, ' '); if ($vbulletin->userinfo = $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, infractiongroupids, username, password, salt FROM " . TABLE_PREFIX . "user WHERE username = '******'")) { if ($vbulletin->GPC[COOKIE_PREFIX . 'userid'] and $vbulletin->GPC[COOKIE_PREFIX . 'userid'] != $vbulletin->userinfo['userid']) { // we have a cookie from a user and we're logging in as // a different user and we're not going to store a new cookie, // so let's unset the old one vbsetcookie('userid', '', true, true, true); vbsetcookie('password', '', true, true, true); } vbsetcookie('userid', $vbulletin->userinfo['userid'], true, true, true); vbsetcookie('password', md5($vbulletin->userinfo['password'] . COOKIE_SALT), true, true, true); $return_value = true; ($hook = vBulletinHook::fetch_hook('login_verify_success')) ? eval($hook) : false; return $return_value; } $return_value = false; ($hook = vBulletinHook::fetch_hook('login_verify_failure_username')) ? eval($hook) : false; return $return_value; }
/** * Fetches the tagbits for display in an entry * * @param array Blog info * * @return string Tag bits */ function fetch_entry_tagbits($bloginfo, &$userinfo) { global $vbulletin, $vbphrase, $show, $template_hook; if ($bloginfo['taglist']) { $tag_array = explode(',', $bloginfo['taglist']); $tag_list = array(); foreach ($tag_array AS $tag) { $tag = trim($tag); if ($tag === '') { continue; } $tag_url = urlencode(unhtmlspecialchars($tag)); $tag = fetch_word_wrapped_string($tag); ($hook = vBulletinHook::fetch_hook('blog_tag_fetchbit')) ? eval($hook) : false; $templater = vB_Template::create('blog_tagbit'); $templater->register('tag', $tag); $templater->register('tag_url', $tag_url); $templater->register('userinfo', $userinfo); $templater->register('pageinfo', array('tag' => $tag_url)); $tag_list[] = trim($templater->render()); } } else { $tag_list = array(); } ($hook = vBulletinHook::fetch_hook('blog_tag_fetchbit_complete')) ? eval($hook) : false; return implode(", ", $tag_list); }
$show['albumselect'] = count($albums) == 1 ? false : true; $vbulletin->userinfo['cachedcss'] = $usercss->build_css($usercss->fetch_effective()); $vbulletin->userinfo['cachedcss'] = str_replace('/*sessionurl*/', $vbulletin->session->vars['sessionurl_js'], $vbulletin->userinfo['cachedcss']); if ($vbulletin->userinfo['cachedcss']) { $userinfo = $vbulletin->userinfo; eval('$usercss_string = "' . fetch_template('memberinfo_usercss') . '";'); } else { $usercss_string = ''; } eval('$headinclude .= "' . fetch_template('modifyusercss_headinclude') . '";'); $navbits[''] = $vbphrase['customize_profile']; construct_usercp_nav('customize'); $templatename = 'modifyusercss'; } // ############################################################################# // spit out final HTML if we have got this far if ($templatename != '') { // make navbar $navbits = construct_navbits($navbits); eval('$navbar = "' . fetch_template('navbar') . '";'); ($hook = vBulletinHook::fetch_hook('profile_complete')) ? eval($hook) : false; // shell template eval('$HTML = "' . fetch_template($templatename) . '";'); eval('print_output("' . fetch_template($shelltemplatename) . '");'); } /*======================================================================*\ || #################################################################### || # Downloaded: 08:19, Wed Nov 5th 2008 || # CVS: $RCSfile$ - $Revision: 28139 $ || #################################################################### \*======================================================================*/
// ######################### START MAIN SCRIPT ############################ // ######################################################################## $vbulletin->db->query_write("\n\tDELETE FROM " . TABLE_PREFIX . "session\n\tWHERE lastactivity < " . intval(TIMENOW - $vbulletin->options['cookietimeout']) . "\n"); $vbulletin->db->query_write("\n\tDELETE FROM " . TABLE_PREFIX . "cpsession\n\tWHERE dateline < " . ($vbulletin->options['timeoutcontrolpanel'] ? intval(TIMENOW - $vbulletin->options['cookietimeout']) : TIMENOW - 3600) . "\n"); require_once DIR . '/vb/search/results.php'; vB_Search_Results::clean(); // expired lost passwords and email confirmations after 4 days $vbulletin->db->query_write("\n\tDELETE FROM " . TABLE_PREFIX . "useractivation\n\tWHERE dateline < " . (TIMENOW - 345600) . " AND\n\t(type = 1 OR (type = 0 and usergroupid = 2))\n"); // old forum/thread read marking data $vbulletin->db->query_write("\n\tDELETE FROM " . TABLE_PREFIX . "threadread\n\tWHERE readtime < " . (TIMENOW - $vbulletin->options['markinglimit'] * 86400)); $vbulletin->db->query_write("\n\tDELETE FROM " . TABLE_PREFIX . "forumread\n\tWHERE readtime < " . (TIMENOW - $vbulletin->options['markinglimit'] * 86400)); $vbulletin->db->query_write("\n\tDELETE FROM " . TABLE_PREFIX . "groupread\n\tWHERE readtime < " . (TIMENOW - $vbulletin->options['markinglimit'] * 86400)); $vbulletin->db->query_write("\n\tDELETE FROM " . TABLE_PREFIX . "discussionread\n\tWHERE readtime < " . (TIMENOW - $vbulletin->options['markinglimit'] * 86400)); // delete expired thread redirects $threads = $vbulletin->db->query_read("\n\tSELECT threadid\n\tFROM " . TABLE_PREFIX . "threadredirect\n\tWHERE expires < " . TIMENOW . "\n"); while ($thread = $vbulletin->db->fetch_array($threads)) { $thread['open'] = 10; $threadman =& datamanager_init('Thread', $vbulletin, ERRTYPE_SILENT, 'threadpost'); $threadman->set_existing($thread); $threadman->delete(false, true, NULL, false); unset($threadman); } vB_Cache::instance()->clean(); ($hook = vBulletinHook::fetch_hook('cron_script_cleanup_hourly')) ? eval($hook) : false; log_cron_action('', $nextitem, 1); /*======================================================================*\ || #################################################################### || # Downloaded: 03:13, Sat Sep 7th 2013 || # CVS: $RCSfile$ - $Revision: 62098 $ || #################################################################### \*======================================================================*/
/** * Deletes a thread with the first post * * @param boolean Whether to consider updating post counts, regardless of forum's settings * @param boolean Whether to physically remove the thread from the database * @param array Array of information for a soft delete * @param boolean Whether to add an entry to the moderator log * * @return mixed The number of affected rows */ function delete($countposts = true, $physicaldel = true, $delinfo = NULL, $dolog = true) { ($hook = vBulletinHook::fetch_hook('threadfpdata_delete')) ? eval($hook) : false; return parent::delete($countposts, $physicaldel, $delinfo, $this->info['skip_moderator_log'] !== null ? !$this->info['skip_moderator_log'] : $dolog); }
true, true, false, 'qenr', $vbulletin->GPC['editorid'] ); $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml'); $xml->add_group('quickedit'); $xml->add_tag('editor', process_replacement_vars($messagearea), array( 'reason' => '', 'parsetype' => 'visitormessage', 'parsesmilies' => true, 'mode' => $show['is_wysiwyg_editor'] )); $xml->close_group(); $xml->print_xml(); } ($hook = vBulletinHook::fetch_hook('visitor_message_complete')) ? eval($hook) : false; /*======================================================================*\ || #################################################################### || # || # CVS: $RCSfile$ - $Revision: 35520 $ || #################################################################### \*======================================================================*/ ?>
/** * Any code to run after deleting * * @param Boolean Do the query? */ function post_delete($doquery = true) { if (!defined('MYSQL_VERSION')) { $mysqlversion = $this->registry->db->query_first("SELECT version() AS version"); define('MYSQL_VERSION', $mysqlversion['version']); } $enginetype = version_compare(MYSQL_VERSION, '4.0.18', '<') ? 'TYPE' : 'ENGINE'; $tabletype = version_compare(MYSQL_VERSION, '4.1', '<') ? 'HEAP' : 'MEMORY'; $aggtable = 'aaggregate_temp_' . $this->registry->userinfo['userid'] . '_' . $this->fetch_field('groupid') . '_' . TIMENOW; $this->registry->db->query_write("\n\t\t\tCREATE TABLE IF NOT EXISTS " . TABLE_PREFIX . "{$aggtable} (\n\t\t\t\tuserid INT UNSIGNED NOT NULL DEFAULT '0',\n\t\t\t\tPRIMARY KEY (userid)\n\t\t\t) {$enginetype} = {$tabletype}\n\t\t"); if ($this->registry->options['usemailqueue'] == 2) { $this->registry->db->lock_tables(array($aggtable => 'WRITE', 'socialgroupmember' => 'WRITE')); } $this->registry->db->query_write("\n\t\t\tINSERT IGNORE INTO " . TABLE_PREFIX . "{$aggtable}\n\t\t\tSELECT userid\n\t\t\tFROM " . TABLE_PREFIX . "socialgroupmember\n\t\t\tWHERE groupid = " . $this->fetch_field('groupid') . "\n\t\t\t\tAND type = 'invited'\n\t\t"); // A user's 'type' doesn't seem to change when a group's type is changed. Why is this? // e.g. a 'moderated' user doesn't become a member if a moderated group is made public $result = array(); if ($this->fetch_field('creatoruserid')) { $result = $this->registry->db->query_first("\n\t\t\t\tSELECT COUNT(*) AS count\n\t\t\t\tFROM " . TABLE_PREFIX . "socialgroupmember\n\t\t\t\tWHERE groupid = " . $this->fetch_field('groupid') . "\n\t\t\t\t\tAND type = 'moderated'\n\t\t\t"); } if ($this->registry->options['usemailqueue'] == 2) { $this->registry->db->unlock_tables(); } $this->registry->db->query_write("DELETE FROM " . TABLE_PREFIX . "socialgroupmember WHERE groupid = " . $this->fetch_field('groupid')); $this->registry->db->query_write("UPDATE " . TABLE_PREFIX . "user AS user," . TABLE_PREFIX . "{$aggtable} AS aggregate\n\t\t\tSET socgroupinvitecount = IF(socgroupinvitecount > 0, socgroupinvitecount - 1, 0)\n\t\t\tWHERE user.userid = aggregate.userid\n\t\t"); if ($result['count']) { $this->registry->db->query_write("\n\t\t\t\tUPDATE " . TABLE_PREFIX . "user\n\t\t\t\tSET socgroupreqcount = IF(socgroupreqcount >= {$result['count']}, socgroupreqcount - {$result['count']}, 0)\n\t\t\t\tWHERE userid = " . $this->fetch_field('creatoruserid') . "\n\t\t\t"); } $this->registry->db->query_write("DROP TABLE IF EXISTS " . TABLE_PREFIX . $aggtable); $this->registry->db->query_write("DELETE FROM " . TABLE_PREFIX . "socialgrouppicture WHERE groupid = " . $this->fetch_field('groupid')); $gms_to_delete = array(); $gmids = $this->registry->db->query_read("SELECT gmid FROM " . TABLE_PREFIX . "groupmessage WHERE groupid = " . $this->fetch_field('groupid')); while ($gmid = $this->registry->db->fetch_array($gmids)) { $gms_to_delete[] = $gmid['gmid']; } if (!empty($gms_to_delete)) { $this->registry->db->query_write("\n\t\t\t\tDELETE FROM " . TABLE_PREFIX . "moderation\n\t\t\t\tWHERE type = 'groupmessage'\n\t\t\t\t\tAND primaryid IN (" . implode(', ', $gms_to_delete) . ")\n\t\t\t"); $this->registry->db->query_write("\n\t\t\t\tDELETE FROM " . TABLE_PREFIX . "deletionlog\n\t\t\t\tWHERE type = 'groupmessage'\n\t\t\t\t\tAND primaryid IN (" . implode(', ', $gms_to_delete) . ")\n\t\t\t"); $this->registry->db->query_write("DELETE FROM " . TABLE_PREFIX . "groupmessage WHERE groupid = " . $this->fetch_field('groupid')); } ($hook = vBulletinHook::fetch_hook('socgroupdata_delete')) ? eval($hook) : false; }
function convert_ids_to_titles() { global $vbulletin; global $albumids, $attachmentids, $calendarids, $eventids, $forumids, $infractionids, $pmids, $postids, $searchids, $socialgroupids, $threadids, $userids; global $wol_album, $wol_attachment, $wol_calendar, $wol_event, $wol_inf, $wol_pm, $wol_post, $wol_search, $wol_socialgroup, $wol_thread, $wol_user; if ($attachmentids) { $postidquery = $vbulletin->db->query_read_slave("\n\t\t\tSELECT postid, attachmentid\n\t\t\tFROM " . TABLE_PREFIX . "attachment\n\t\t\tWHERE attachmentid IN (0{$attachmentids})\n\t\t"); while ($postidqueryr = $vbulletin->db->fetch_array($postidquery)) { $postids .= ',' . $postidqueryr['postid']; $wol_attachment["{$postidqueryr['attachmentid']}"] = $postidqueryr['postid']; } } if ($postids) { $postidquery = $vbulletin->db->query_read_slave("\n\t\t\tSELECT threadid, postid\n\t\t\tFROM " . TABLE_PREFIX . "post\n\t\t\tWHERE postid IN (0{$postids})\n\t\t"); while ($postidqueryr = $vbulletin->db->fetch_array($postidquery)) { $threadids .= ',' . $postidqueryr['threadid']; $wol_post["{$postidqueryr['postid']}"] = $postidqueryr['threadid']; } } if ($socialgroupids) { $socialgroups = $vbulletin->db->query_read_slave("\n\t\t\tSELECT name, groupid\n\t\t\tFROM " . TABLE_PREFIX . "socialgroup\n\t\t\tWHERE groupid IN (0{$socialgroupids})\n\t\t"); while ($socialgroup = $vbulletin->db->fetch_array($socialgroups)) { $wol_socialgroup["{$socialgroup['groupid']}"]['name'] = $socialgroup['name']; } } if ($albumids) { $albums = $vbulletin->db->query_read_slave("\n\t\t\tSELECT title, albumid, state, userid\n\t\t\tFROM " . TABLE_PREFIX . "album\n\t\t\tWHERE albumid IN (0{$albumids})\n\t\t"); while ($album = $vbulletin->db->fetch_array($albums)) { $wol_album["{$album['albumid']}"] = $album; } } if ($threadids) { $threadresults = $vbulletin->db->query_read_slave("\n\t\t\tSELECT thread.title, thread.prefixid, thread.threadid, thread.forumid, thread.postuserid, thread.visible\n\t\t\t" . iif($vbulletin->options['threadpreview'] > 0, ",post.pagetext AS preview") . "\n\t\t\t" . iif($vbulletin->options['threadsubscribed'] and $vbulletin->userinfo['userid'], ", NOT ISNULL(subscribethread.subscribethreadid) AS issubscribed") . "\n\t\t\tFROM " . TABLE_PREFIX . "thread AS thread\n\t\t\t" . iif($vbulletin->options['threadpreview'] > 0, "LEFT JOIN " . TABLE_PREFIX . "post AS post ON(post.postid = thread.firstpostid)") . "\n\t\t\t" . iif($vbulletin->options['threadsubscribed'] and $vbulletin->userinfo['userid'], " LEFT JOIN " . TABLE_PREFIX . "subscribethread AS subscribethread ON(subscribethread.threadid = thread.threadid AND subscribethread.userid = " . $vbulletin->userinfo['userid'] . " AND canview = 1)") . "\n\t\t\tWHERE thread.threadid IN (0{$threadids})\n\t\t"); while ($threadresult = $vbulletin->db->fetch_array($threadresults)) { $wol_thread["{$threadresult['threadid']}"]['title'] = $threadresult['title']; $wol_thread["{$threadresult['threadid']}"]['prefixid'] = $threadresult['prefixid']; $wol_thread["{$threadresult['threadid']}"]['forumid'] = $threadresult['forumid']; $wol_thread["{$threadresult['threadid']}"]['postuserid'] = $threadresult['postuserid']; $wol_thread["{$threadresult['threadid']}"]['isdeleted'] = $threadresult['visible'] == 2 ? true : false; $wol_thread["{$threadresult['threadid']}"]['visible'] = $threadresult['visible'] == 1 ? true : false; $wol_thread["{$threadresult['threadid']}"]['issubscribed'] = $threadresult['issubscribed']; // format thread preview if there is one $userperms = fetch_permissions($threadresult['forumid']); if (!empty($threadresult['preview']) and $vbulletin->options['threadpreview'] > 0 and $userperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) { // Get Buddy List $buddy = array(); if (trim($vbulletin->userinfo['buddylist'])) { $buddylist = preg_split('/( )+/', trim($vbulletin->userinfo['buddylist']), -1, PREG_SPLIT_NO_EMPTY); foreach ($buddylist as $buddyuserid) { $buddy["{$buddyuserid}"] = 1; } } DEVDEBUG('buddies: ' . implode(', ', array_keys($buddy))); // Get Ignore Users $ignore = array(); if (trim($vbulletin->userinfo['ignorelist'])) { $ignorelist = preg_split('/( )+/', trim($vbulletin->userinfo['ignorelist']), -1, PREG_SPLIT_NO_EMPTY); foreach ($ignorelist as $ignoreuserid) { if (!$buddy["{$ignoreuserid}"]) { $ignore["{$ignoreuserid}"] = 1; } } } DEVDEBUG('ignored users: ' . implode(', ', array_keys($ignore))); if (!$ignore["{$threadresult['postuserid']}"]) { $threadresult['preview'] = strip_quotes($threadresult['preview']); $threadresult['preview'] = htmlspecialchars_uni(strip_bbcode(fetch_trimmed_title($threadresult['preview'], $vbulletin->options['threadpreview']), false, true)); $wol_thread["{$threadresult['threadid']}"]['preview'] = $threadresult['preview']; } } } } if ($calendarids) { $calendarresults = $vbulletin->db->query_read_slave("\n\t\t\tSELECT calendarid, title\n\t\t\tFROM " . TABLE_PREFIX . "calendar\n\t\t\tWHERE calendarid IN (0{$calendarids})\n\t\t"); while ($calendarresult = $vbulletin->db->fetch_array($calendarresults)) { $wol_calendar["{$calendarresult['calendarid']}"] = $calendarresult['title']; } } if ($infractionids) { $infractions = $vbulletin->db->query_read_slave("\n\t\t\tSELECT infractionid, userid\n\t\t\tFROM " . TABLE_PREFIX . "infraction\n\t\t\tWHERE infractionid IN (0{$infractionids})\n\t\t"); while ($infraction = $vbulletin->db->fetch_array($infractions)) { $wol_inf["{$infraction['infractionid']}"]['userid'] = $infraction['userid']; $userids .= ',' . $infraction['userid']; } } if ($eventids) { $eventresults = $vbulletin->db->query_read_slave("\n\t\t\tSELECT eventid, title, userid, calendarid\n\t\t\tFROM " . TABLE_PREFIX . "event\n\t\t\tWHERE eventid IN (0{$eventids})\n\t\t"); while ($eventresult = $vbulletin->db->fetch_array($eventresults)) { $wol_event["{$eventresult['eventid']}"]['title'] = $eventresult['title']; $wol_event["{$eventresult['eventid']}"]['calendarid'] = $eventresult['calendarid']; $wol_event["{$eventresult['eventid']}"]['postuserid'] = $eventresult['userid']; } } if ($pmids and $vbulletin->userinfo['permissions']['wolpermissions'] & $vbulletin->bf_ugp_wolpermissions['canwhosonlinefull']) { $pmresults = $vbulletin->db->query_read_slave("\n\t\t\tSELECT pmtext.fromuserid, pm.pmid\n\t\t\tFROM " . TABLE_PREFIX . "pm AS pm\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "pmtext AS pmtext ON (pm.pmtextid = pmtext.pmtextid)\n\t\t\tWHERE pmid IN (0{$pmids})\n\t\t\t"); while ($pmresult = $vbulletin->db->fetch_array($pmresults)) { $wol_pm["{$pmresult['pmid']}"] = $pmresult['fromuserid']; $userids .= ',' . intval($pmresult['fromuserid']); } } if ($searchids and $vbulletin->userinfo['permissions']['wolpermissions'] & $vbulletin->bf_ugp_wolpermissions['canwhosonlinefull']) { $searchresults = $vbulletin->db->query_read_slave("\n\t\t\tSELECT searchid, search.userid, query, searchuser, user.userid AS targetuserid\n\t\t\tFROM " . TABLE_PREFIX . "search AS search\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.username = search.searchuser)\n\t\t\tWHERE searchid IN (0{$searchids})\n\t\t"); while ($searchresult = $vbulletin->db->fetch_array($searchresults)) { if ($searchresult['searchuser']) { if (!$searchresult['targetuserid']) { $result = $vbulletin->db->query_first_slave("\n\t\t\t\t\t\tSELECT userid AS targetuserid\n\t\t\t\t\t\tFROM " . TABLE_PREFIX . "user\n\t\t\t\t\t\tWHERE username = '******'searchuser'])) . "'\n\t\t\t\t\t"); } if ($result['targetuserid']) { $searchresult['targetuserid'] = $result['targetuserid']; } if ($searchresult['targetuserid']) { $userids .= ",{$searchresult['targetuserid']}"; } } $wol_search["{$searchresult['searchid']}"] = $searchresult; } } if ($userids and $vbulletin->userinfo['permissions']['wolpermissions'] & $vbulletin->bf_ugp_wolpermissions['canwhosonlinefull']) { $userresults = $vbulletin->db->query_read_slave("\n\t\t\tSELECT userid, username, IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid\n\t\t\tFROM " . TABLE_PREFIX . "user AS user\n\t\t\tWHERE userid IN (0{$userids})\n\t\t"); while ($userresult = $vbulletin->db->fetch_array($userresults)) { fetch_musername($userresult); $wol_user["{$userresult['userid']}"] = $userresult['musername']; } } ($hook = vBulletinHook::fetch_hook('online_ids_titles')) ? eval($hook) : false; }
function construct_calendar_output($today, $usertoday, $calendarinfo, $fullcalendar = 0, $weekrange = '') { global $birthdaycache, $eventcache, $vbulletin, $vbphrase, $stylevar, $show, $colspan, $days, $months; $calendarid = $calendarinfo['calendarid']; $month = $usertoday['month']; $year = $usertoday['year']; $calendardaybits = ''; $calendarweekbits = ''; if ($calendarinfo['showweekends']) { $weeklength = 7; $colspan = 8; $daywidth = '14%'; $linkwidth = '2%'; } else { $weeklength = 5; $colspan = 6; $daywidth = '19%'; $linkwidth = '5%'; } // set up the controls for this month $displaymonth['starttime'] = gmmktime(12, 0, 0, $month, 1, $year); $displaymonth['numdays'] = gmdate('t', $displaymonth['starttime']); $displaymonth['month'] = gmdate('n', $displaymonth['starttime']); $displaymonth['year'] = gmdate('Y', $displaymonth['starttime']); $todaylink = "{$today['year']}-{$today['mon']}-{$today['mday']}"; // get an array of days starting with the user's chosen week start static $userweek; if (!is_array($userweek)) { $userweek = array(); $curday = $vbulletin->userinfo['startofweek']; while (sizeof($userweek) < $weeklength) { if (!$calendarinfo['showweekends'] and ($curday == 1 or $curday == 7)) { $curday++; } else { $userweek[] = $curday++; } if ($curday > 7) { $curday = 1; } } } // wind back the start day so we have the days preceeding the current month that will be displayed $startday = 1; while ($null++ < 31) { if (gmdate('w', gmmktime(0, 0, 0, $displaymonth['month'], $startday, $displaymonth['year'])) + 1 == $userweek[0]) { break; } else { $startday--; } } if ($fullcalendar) { $template = array('day' => 'calendar_monthly_day', 'day_other' => 'calendar_monthly_day_other', 'week' => 'calendar_monthly_week', 'header' => 'calendar_monthly_header'); } else { if ($startday == 1 and $show['yearlyview']) { // wind back the start day by a week so we always end up with 6 rows for neatness $startday -= 7; } $template = array('day' => 'calendar_smallmonth_day', 'day_other' => 'calendar_smallmonth_day_other', 'week' => 'calendar_smallmonth_week', 'header' => 'calendar_smallmonth_header'); } // fetch special holiday events $eastercache = fetch_easter_array($usertoday['year']); if (!$fullcalendar) { // set up which days will be shown for ($i = 0; $i < 7; $i++) { $dayvarname = 'day' . ($i + 1); if ($userweek["{$i}"]) { ${$dayvarname} = $vbphrase[$days[$userweek[$i]] . '_short']; $show["{$dayvarname}"] = true; } else { $show["{$dayvarname}"] = false; } } } // now start creating the week rows $rows = 0; while (++$rows <= 6) { if (!$show['yearlyview'] and $startday > $displaymonth['numdays']) { break; } // run through the user's week days $calendardaybits = ''; foreach ($userweek as $daycount => $curday) { $datestamp = gmmktime(0, 0, 0, $displaymonth['month'], $startday++, $displaymonth['year']); $dayname = $vbphrase["{$days[$curday]}_abbr"]; $year = gmdate('Y', $datestamp); $month = gmdate('n', $datestamp); $day = gmdate('j', $datestamp); $daylink = "{$year}-{$month}-{$day}"; if (!$daycount) { $firstweek = gmmktime(0, 0, 0, $month, $day, $year); } // is this day today? $show['highlighttoday'] = iif($daylink == $todaylink, true, false); // is this day in our desired month? if ($month != $displaymonth['month']) { $daytemplatename =& $template['day_other']; } else { $daytemplatename =& $template['day']; // is this day in our desired week? if (!$fullcalendar) { if (is_array($weekrange) and $datestamp >= $weekrange['start'] and $datestamp <= $weekrange['end']) { $show['highlightweek'] = true; } else { $show['highlightweek'] = false; } } $show['birthdaylink'] = false; $show['daylink'] = false; $show['holiday'] = false; $showholiday = false; $show['eventlink'] = false; $userbdays = ''; $userevents = ''; $eventdesc = ''; $eventtotal = 0; // get this day's birthdays if ($calendarinfo['showbirthdays'] and $fullcalendar and is_array($birthdaycache["{$month}"]["{$day}"])) { unset($userday); unset($age); unset($birthdaydesc); $bdaycount = 0; foreach ($birthdaycache["{$month}"]["{$day}"] as $index => $value) { $userday = explode('-', $value['birthday']); $bdaycount++; $username = $value['username']; $userid = $value['userid']; if ($year > $userday[2] and $userday[2] != '0000' and $value['showbirthday'] == 2) { $age = '(' . ($year - $userday[2]) . ')'; } else { unset($age); } $birthdaydesc .= iif($birthdaydesc, ', ') . $value['username']; eval('$userbdays .= "' . fetch_template('calendar_monthly_birthday') . '";'); } if ($bdaycount > $calendarinfo['birthdaycount']) { $show['birthdaylink'] = true; } } // get this day's holidays if (!empty($eastercache["{$month}-{$day}-{$year}"])) { $eventtotal++; $event['title'] =& $eastercache["{$month}-{$day}-{$year}"]['title']; $event['preview'] = htmlspecialchars_uni(fetch_trimmed_title($eastercache["{$month}-{$day}-{$year}"]['event'], 300)); $show['daylink'] = true; $eventdesc .= iif($eventdesc, "\r\n") . $event['title']; if ($fullcalendar) { $show['holiday'] = true; $showholiday = true; ($hook = vBulletinHook::fetch_hook('calendar_displaymonth_event')) ? eval($hook) : false; eval('$userevents .= "' . fetch_template('calendar_monthly_event') . '";'); } } // get this day's events if (is_array($eventcache)) { $eventarray = cache_events_day($month, $day, $year); foreach ($eventarray as $index => $event) { $eventtotal++; $show['daylink'] = true; $eventdesc .= iif($eventdesc, "\r\n") . htmlspecialchars_uni($event['title']); if ($fullcalendar) { $eventid = $event['eventid']; $show['holiday'] = iif($event['holidayid'], true, false); if ($show['holiday']) { $showholiday = true; } $show['subscribed'] = iif($event['subscribed'], true, false); if ($calendarinfo['cutoff'] and strlen($event['title']) > $calendarinfo['cutoff'] and !$event['holidayid']) { $event['title'] = substr($event['title'], 0, $calendarinfo['cutoff']) . ' (...)'; } $event['title'] = htmlspecialchars_uni($event['title']); ($hook = vBulletinHook::fetch_hook('calendar_displaymonth_event')) ? eval($hook) : false; eval('$userevents .= "' . fetch_template('calendar_monthly_event') . '";'); } } if ($eventtotal > $calendarinfo['eventcount']) { $show['eventlink'] = true; } } } $show['holiday'] = $showholiday; ($hook = vBulletinHook::fetch_hook('calendar_displaymonth_daybit')) ? eval($hook) : false; eval('$calendardaybits .= "' . fetch_template($daytemplatename) . '";'); // if no weekends, bump on the counter to compensate if (!$calendarinfo['showweekends'] and $daycount >= 4) { $startday += 2; } } ($hook = vBulletinHook::fetch_hook('calendar_displaymonth_weekbit')) ? eval($hook) : false; eval('$calendarrowbits .= "' . fetch_template($template['week']) . '";'); } $year = $displaymonth['year']; $month = $displaymonth['month']; $monthname = $vbphrase["{$months[$month]}"]; ($hook = vBulletinHook::fetch_hook('calendar_displaymonth_month')) ? eval($hook) : false; eval('$calendarrowbits = "' . fetch_template($template['header']) . '";'); return $calendarrowbits; }
// Validate Messages $messages = $db->query_read_slave("\n\t\tSELECT gm.gmid, gm.state, gm.groupid, gm.dateline, gm.postuserid, gm.postusername,\n\t\t\tsocialgroup.name AS group_name, socialgroup.creatoruserid\n\t\tFROM " . TABLE_PREFIX . "groupmessage AS gm\n\t\tLEFT JOIN " . TABLE_PREFIX . "socialgroup AS socialgroup ON (socialgroup.groupid = gm.groupid)\n\t\tWHERE gmid IN ({$messageids})\n\t\t\tAND state = 'deleted'\n\t"); while ($message = $db->fetch_array($messages)) { $message['is_group_owner'] = $message['creatoruserid'] == $vbulletin->userinfo['userid']; $messagearray["{$message['gmid']}"] = $message; $grouplist["{$message['groupid']}"] = true; } if (empty($messagearray)) { standard_error(fetch_error('you_did_not_select_any_valid_messages')); } $db->query_write("\n\t\tDELETE FROM " . TABLE_PREFIX . "deletionlog\n\t\tWHERE type = 'groupmessage' AND\n\t\t\tprimaryid IN(" . implode(',', array_keys($messagearray)) . ")\n\t"); $db->query_write("\n\t\tUPDATE " . TABLE_PREFIX . "groupmessage\n\t\tSET state = 'visible'\n\t\tWHERE gmid IN(" . implode(',', array_keys($messagearray)) . ")\n\t"); foreach ($grouplist as $groupid => $foo) { build_group_counters($groupid); } foreach ($messagearray as $message) { if (!$message['is_group_owner']) { log_moderator_action($message, 'gm_by_x_for_y_undeleted', array($message['postusername'], $message['group_name'])); } } // empty cookie setcookie('vbulletin_inlinegmessage', '', TIMENOW - 3600, '/'); ($hook = vBulletinHook::fetch_hook('group_inlinemod_undelete')) ? eval($hook) : false; eval(print_standard_redirect('redirect_inline_undeletedmessages', true, $forceredirect)); } /*======================================================================*\ || #################################################################### || # Downloaded: 09:39, Wed Nov 5th 2008 || # SVN: $Revision: 27889 $ || #################################################################### \*======================================================================*/
/** * Fetches and prepares posts for quoting. Returned text is BB code. * * @param array Array of post IDs to pull from * @param integer The ID of the thread that is being quoted into * @param integer Returns the number of posts that were unquoted because of the value of the next argument * @param array Returns the IDs of the posts that were actually quoted * @param string Controls what posts are successfully quoted: all, only (only the thread ID), other (only other thread IDs) * @param boolean Whether to undo the htmlspecialchars calls; useful when returning HTML to be entered via JS */ function fetch_quotable_posts($quote_postids, $threadid, &$unquoted_posts, &$quoted_post_ids, $limit_thread = 'only', $unhtmlspecialchars = false) { global $vbulletin; $unquoted_posts = 0; $quoted_post_ids = array(); $quote_postids = array_diff_assoc(array_unique(array_map('intval', $quote_postids)), array(0)); // limit to X number of posts if ($vbulletin->options['mqlimit'] > 0) { $quote_postids = array_slice($quote_postids, 0, $vbulletin->options['mqlimit']); } if (empty($quote_postids)) { // nothing to quote return ''; } $hook_query_fields = $hook_query_joins = ''; ($hook = vBulletinHook::fetch_hook('quotable_posts_query')) ? eval($hook) : false; $quote_post_data = $vbulletin->db->query_read_slave("\n\t\tSELECT post.postid, post.title, post.pagetext, post.dateline, post.userid, post.visible AS postvisible,\n\t\t\tIF(user.username <> '', user.username, post.username) AS username,\n\t\t\tthread.threadid, thread.title AS threadtitle, thread.postuserid, thread.visible AS threadvisible,\n\t\t\tforum.forumid, forum.password\n\t\t\t{$hook_query_fields}\n\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (post.userid = user.userid)\n\t\tINNER JOIN " . TABLE_PREFIX . "thread AS thread ON (post.threadid = thread.threadid)\n\t\tINNER JOIN " . TABLE_PREFIX . "forum AS forum ON (thread.forumid = forum.forumid)\n\t\t{$hook_query_joins}\n\t\tWHERE post.postid IN (" . implode(',', $quote_postids) . ")\n\t"); $quote_posts = array(); while ($quote_post = $vbulletin->db->fetch_array($quote_post_data)) { if ((!$quote_post['postvisible'] or $quote_post['postvisible'] == 2) and !can_moderate($quote_post['forumid']) or (!$quote_post['threadvisible'] or $quote_post['threadvisible'] == 2) and !can_moderate($quote_post['forumid'])) { // no permission to view this post continue; } $forumperms = fetch_permissions($quote_post['forumid']); if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) and ($quote_post['postuserid'] != $vbulletin->userinfo['userid'] or $vbulletin->userinfo['userid'] == 0) or !verify_forum_password($quote_post['forumid'], $quote_post['password'], false) or in_coventry($quote_post['postuserid']) and !can_moderate($quote_post['forumid']) or in_coventry($quote_post['userid']) and !can_moderate($quote_post['forumid'])) { // no permission to view this post continue; } if ($limit_thread == 'only' and $quote_post['threadid'] != $threadid or $limit_thread == 'other' and $quote_post['threadid'] == $threadid or $limit_thread == 'all') { $unquoted_posts++; continue; } $skip_post = false; ($hook = vBulletinHook::fetch_hook('quotable_posts_logic')) ? eval($hook) : false; if ($skip_post) { continue; } $quote_posts["{$quote_post['postid']}"] = $quote_post; } $message = ''; foreach ($quote_postids as $quote_postid) { if (!isset($quote_posts["{$quote_postid}"])) { continue; } $quote_post =& $quote_posts["{$quote_postid}"]; $originalposter = fetch_quote_username($quote_post['username'] . ";{$quote_post['postid']}"); $postdate = vbdate($vbulletin->options['dateformat'], $quote_post['dateline']); $posttime = vbdate($vbulletin->options['timeformat'], $quote_post['dateline']); $pagetext = htmlspecialchars_uni($quote_post['pagetext']); $pagetext = trim(strip_quotes($pagetext)); ($hook = vBulletinHook::fetch_hook('newreply_quote')) ? eval($hook) : false; eval('$message .= "' . fetch_template('newpost_quote', 0, false) . '\\n";'); $quoted_post_ids[] = $quote_postid; } if ($unhtmlspecialchars) { $message = unhtmlspecialchars($message); } return $message; }
($hook = vBulletinHook::fetch_hook('photoplog_edit_sqlreplace')) ? eval($hook) : false; if ($db->query_write("REPLACE INTO " . PHOTOPLOG_PREFIX . "photoplog_fileuploads\r\n\t\t\t(fileid, userid, username, title, description, filename, filesize, dateline, views, catid, moderate, dimensions, setid, \r\n\t\t\tfielddata, num_comments0, num_comments1, num_ratings0, num_ratings1, sum_ratings0, sum_ratings1,\r\n\t\t\tlast_comment_dateline0, last_comment_dateline1, last_comment_id0, last_comment_id1, albumids, exifinfo)\r\n\t\t\tVALUES (\r\n\t\t\t\t" . intval($photoplog_file_id) . ",\r\n\t\t\t\t" . intval($photoplog_file_userid) . ",\r\n\t\t\t\t'" . $db->escape_string($photoplog_file_username) . "',\r\n\t\t\t\t'" . $db->escape_string($photoplog_file_title) . "',\r\n\t\t\t\t'" . $db->escape_string($photoplog_file_description) . "',\r\n\t\t\t\t'" . $db->escape_string($photoplog_replace_name) . "',\r\n\t\t\t\t" . intval($photoplog_file_size) . ",\r\n\t\t\t\t" . intval($photoplog_file_dateline) . ",\r\n\t\t\t\t" . intval($photoplog_file_views) . ",\r\n\t\t\t\t" . intval($photoplog_file_catid) . ",\r\n\t\t\t\t" . intval($photoplog_file_moderate) . ",\r\n\t\t\t\t'" . $db->escape_string($photoplog['dimensions']) . "',\r\n\t\t\t\t" . intval($photoplog_file_setid) . ",\r\n\t\t\t\t'" . $db->escape_string($photoplog_fielddata) . "',\r\n\t\t\t\t" . intval($photoplog_file_nc0) . ",\r\n\t\t\t\t" . intval($photoplog_file_nc1) . ",\r\n\t\t\t\t" . intval($photoplog_file_nr0) . ",\r\n\t\t\t\t" . intval($photoplog_file_nr1) . ",\r\n\t\t\t\t" . intval($photoplog_file_sr0) . ",\r\n\t\t\t\t" . intval($photoplog_file_sr1) . ",\r\n\t\t\t\t" . intval($photoplog_file_lcd0) . ",\r\n\t\t\t\t" . intval($photoplog_file_lcd1) . ",\r\n\t\t\t\t" . intval($photoplog_file_lci0) . ",\r\n\t\t\t\t" . intval($photoplog_file_lci1) . ",\r\n\t\t\t\t'" . $db->escape_string($photoplog_albumids) . "',\r\n\t\t\t\t'" . $db->escape_string($photoplog_exifinfo) . "'\r\n\t\t\t)\r\n\t\t")) { if ($photoplog_file_catid_default >= 0 && $photoplog_file_catid != $photoplog_file_catid_default) { $db->query_write("UPDATE " . PHOTOPLOG_PREFIX . "photoplog_ratecomment\r\n\t\t\t\t\t\tSET catid = " . intval($photoplog_file_catid) . "\r\n\t\t\t\t\t\tWHERE fileid = " . intval($photoplog_file_id) . "\r\n\t\t\t"); photoplog_update_counts_table($photoplog_file_catid_default); } photoplog_update_counts_table($photoplog_file_catid); if ($photoplog_file_moderate == 1 && $vbulletin->options['photoplog_admin_email']) { $photoplog_subject = $photoplog_message = ''; eval(fetch_email_phrases('photoplog_mod_file', -1, '', 'photoplog_')); vbmail($vbulletin->options['webmasteremail'], $photoplog_subject, $photoplog_message, true); } if ($photoplog_file_old && $photoplog_file_edit) { @unlink($photoplog_directory_name . "/" . $photoplog_file_old); @unlink($photoplog_directory_name . "/large/" . $photoplog_file_old); @unlink($photoplog_directory_name . "/medium/" . $photoplog_file_old); @unlink($photoplog_directory_name . "/small/" . $photoplog_file_old); } ($hook = vBulletinHook::fetch_hook('photoplog_edit_doedit_complete')) ? eval($hook) : false; $photoplog_id = intval($photoplog_file_id); $photoplog_url = $photoplog['location'] . '/index.php?' . $vbulletin->session->vars['sessionurl'] . 'n=' . $photoplog_id; exec_header_redirect($photoplog_url); exit; } else { photoplog_output_page('photoplog_error_page', $vbphrase['photoplog_error'], $vbphrase['photoplog_bad_luck']); } } ($hook = vBulletinHook::fetch_hook('photoplog_edit_complete')) ? eval($hook) : false; if ($_REQUEST['do'] != 'edit' && $_POST['do'] != 'doedit') { photoplog_index_bounce(); }
$query = "UPDATE " . TABLE_PREFIX . "forum SET daysprune = 1"; break; case 405: $query = "UPDATE " . TABLE_PREFIX . "forum SET daysprune = 7"; break; case 410: $query = "UPDATE " . TABLE_PREFIX . "forum SET daysprune = 30"; break; case 415: $query = "UPDATE " . TABLE_PREFIX . "forum SET daysprune = 365"; break; case 420: $query = "UPDATE " . TABLE_PREFIX . "forum SET daysprune = -1"; break; default: ($hook = vBulletinHook::fetch_hook('admin_queries_auto_query')) ? eval($hook) : false; } } } if (substr($query, -1) == ';') { $query = substr($query, 0, -1); } $db->hide_errors(); $auto_query_text = ''; if ($vbulletin->GPC['autoquery']) { foreach ($queryoptions as $query_group => $queries) { if (!is_array($queries)) { continue; } foreach ($queries as $query_id => $query_title) { if ($query_id == $vbulletin->GPC['autoquery']) {
/** * Any code to run after deleting * * @param Boolean Do the query? */ function post_delete($doquery = true) { $users = $this->registry->db->query_read_slave("\n\t\t\tSELECT\n\t\t\t\tuserid, {$this->revision} AS revision\n\t\t\tFROM " . TABLE_PREFIX . "user\n\t\t\tWHERE " . $this->condition); while ($user = $this->registry->db->fetch_array($users)) { @unlink($this->fetch_path($user['userid'], $user['revision'])); @unlink($this->fetch_path($user['userid'], $user['revision'], true)); } ($hook = vBulletinHook::fetch_hook('userpicdata_delete')) ? eval($hook) : false; }
/** * Additional data to update after a delete call (such as denormalized values in other tables). * * @param boolean Do the query? */ function post_delete($doquery = true) { $pictures = array(); $picture_sql = $this->registry->db->query_read("\n\t\t\tSELECT albumpicture.pictureid, picture.idhash, picture.extension\n\t\t\tFROM " . TABLE_PREFIX . "albumpicture AS albumpicture\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "picture AS picture ON (albumpicture.pictureid = picture.pictureid)\n\t\t\tWHERE albumpicture.albumid = " . $this->fetch_field('albumid')); while ($picture = $this->registry->db->fetch_array($picture_sql)) { $pictures["{$picture['pictureid']}"] = $picture; } if ($pictures) { if ($this->registry->options['album_dataloc'] != 'db') { // remove from fs foreach ($pictures as $picture) { @unlink(fetch_picture_fs_path($picture)); @unlink(fetch_picture_fs_path($picture, true)); } } $this->registry->db->query_write("\n\t\t\t\tDELETE FROM " . TABLE_PREFIX . "picture\n\t\t\t\tWHERE pictureid IN (" . implode(',', array_keys($pictures)) . ")\n\t\t\t"); // delete based on picture id as this means that when a picture is deleted, // it's removed from all albums automatically $this->registry->db->query_write("\n\t\t\t\tDELETE FROM " . TABLE_PREFIX . "albumpicture\n\t\t\t\tWHERE pictureid IN (" . implode(',', array_keys($pictures)) . ")\n\t\t\t"); $this->registry->db->query_write("\n\t\t\t\tDELETE FROM " . TABLE_PREFIX . "picturecomment\n\t\t\t\tWHERE pictureid IN (" . implode(',', array_keys($pictures)) . ")\n\t\t\t"); require_once DIR . '/includes/functions_picturecomment.php'; build_picture_comment_counters($this->fetch_field('userid')); $groups = array(); $groups_sql = $this->registry->db->query_read("\n\t\t\t\tSELECT DISTINCT socialgroup.*\n\t\t\t\tFROM " . TABLE_PREFIX . "socialgrouppicture AS socialgrouppicture\n\t\t\t\tINNER JOIN " . TABLE_PREFIX . "socialgroup AS socialgroup ON (socialgroup.groupid = socialgrouppicture.groupid)\n\t\t\t\tWHERE socialgrouppicture.pictureid IN (" . implode(',', array_keys($pictures)) . ")\n\t\t\t"); while ($group = $this->registry->db->fetch_array($groups_sql)) { $groups[] = $group; } $this->registry->db->query_write("\n\t\t\t\tDELETE FROM " . TABLE_PREFIX . "socialgrouppicture\n\t\t\t\tWHERE pictureid IN (" . implode(',', array_keys($pictures)) . ")\n\t\t\t"); foreach ($groups as $group) { $groupdata =& datamanager_init('SocialGroup', $this->registry, ERRTYPE_SILENT); $groupdata->set_existing($group); $groupdata->rebuild_picturecount(); $groupdata->save(); } } $this->remove_usercss_background_image(); ($hook = vBulletinHook::fetch_hook('albumdata_delete')) ? eval($hook) : false; return true; }
/** * Constructor - checks that the registry object has been passed correctly. * * @param vB_Registry Instance of the vBulletin data registry object - expected to have the database object as one of its $this->db member. * @param integer One of the ERRTYPE_x constants */ public function __construct(&$registry, $errtype = ERRTYPE_STANDARD) { parent::vB_DataManager($registry, $errtype); ($hook = vBulletinHook::fetch_hook('stylevardata_start')) ? eval($hook) : false; }
/** * Allows hooks to evaluate sort field. * * @param string $field - The client id of the field to sort by */ protected function orderSortFieldHook($field) { $resolved_table = false; $resolved_field = false; ($hook = vBulletinHook::fetch_hook($this->sort_field_hook)) ? eval($hook) : false; if ($resolved_table AND $resolved_field) { $sortfield = $resolved_table . '.' . $resolved_field; if ($sortfield != $this->sortfield) { $this->sortfield = $sortfield; $this->Reset(); } } }