02-12-2013, 02:30 AM
|
عضو ماسي | | |
In maintenace when I update User Titles and Ranks I get the code displayed and nothing runs, is this a known bug in 4.0.8?
?php /*================================================= =====================*\ || ################################################## ################## || || # vBulletin 4.0.8 - Licence Number VBF94A2D38 || # ---------------------------------------------------------------- # || || # Copyright ©2000-2010 vBulletin Solutions Inc. All Rights Reserved. || || # This file may not be redistributed in whole or significant part. # || || # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # || || #
Content Relevant URLs by vBSEO 3.5.2http://www.vbulletin.com | http://www.vbulletin.com/license.html # || || ################################################## ################## || \*================================================ ======================*/ /** * "Magic" Function that builds all the information regarding infractions * (only used in Cron) * * @param array Infraction Points Array * @param array Infractions Array * @param array Warnings Array * * @return boolean Whether infractions info was updated. * */ function build_user_infractions($points, $infractions, $warnings) { global $vbulletin; $warningsql = array(); $infractionsql = array(); $ipointssql = array(); $querysql = array(); $userids = array(); // ############################ WARNINGS ################################# $wa = array(); foreach($warnings AS $userid => $warning) { $wa["$warning"][] = $userid; $userids["$userid"] = $userid; } unset($warnings); foreach($wa AS $warning => $users) { $warningsql[] = "WHEN userid IN(" . implode(', ', $users) . ") THEN $warning"; } unset($wa); if (!empty($warningsql)) { $querysql[] = " warnings = CAST(warnings AS SIGNED) - CASE " . implode(" \r\n", $warningsql) . " ELSE 0 END"; } unset($warningsql); // ############################ INFRACTIONS ############################## $if = array(); foreach($infractions AS $userid => $infraction) { $if["$infraction"][] = $userid; $userids["$userid"] = $userid; } unset($infractions); foreach($if AS $infraction => $users) { $infractionsql[] = "WHEN userid IN(" . implode(', ', $users) . ") THEN $infraction"; } unset($if); if (!empty($infractionsql)) { $querysql[] = " infractions = CAST(infractions AS SIGNED) - CASE " . implode(" \r\n", $infractionsql) . " ELSE 0 END"; } unset($infractionsql); // ############################ POINTS ################################### $ip = array(); foreach($points AS $userid => $point) { $ip["$point"][] = $userid; } unset($points); foreach($ip AS $point => $users) { $ipointssql[] = "WHEN userid IN(" . implode(', ', $users) . ") THEN $point"; } unset($ip); if (!empty($ipointssql)) { $querysql[] = " ipoints = CAST(ipoints AS SIGNED) - CASE " . implode(" \r\n", $ipointssql) . " ELSE 0 END"; } unset($ipointssql); if (!empty($querysql)) { $vbulletin->db->query_write(" UPDATE " . TABLE_PREFIX . "user SET " . implode(', ', $querysql) . " WHERE userid IN (" . implode(', ', $userids) . ") "); return true; } else { return false; } } /** * Builds infraction groups for users * * @param array User IDs to build * */ function build_infractiongroupids($userids) { global $vbulletin; static $infractiongroups = array(), $beenhere; if (!$beenhere) { $beenhere == true; $groups = $vbulletin->db->query_read_slave(" SELECT usergroupid, orusergroupid, pointlevel, override FROM " . TABLE_PREFIX . "infractiongroup ORDER BY pointlevel "); while ($group = $vbulletin->db->fetch_array($groups)) { $infractiongroups["$group[usergroupid]"]["$group[pointlevel]"][] = array( 'orusergroupid' => $group['orusergroupid'], 'override' => $group['override'], ); } } $users = $vbulletin->db->query_read(" SELECT user.* FROM " . TABLE_PREFIX . "user AS user WHERE userid IN (" . implode(', ', $userids) . ") "); while ($user = $vbulletin->db->fetch_array($users)) { $infractioninfo = fetch_infraction_groups($infractiongroups, $user['userid'], $user['ipoints'], $user['usergroupid']); if (($groupids = implode(',', $infractioninfo['infractiongroupids'])) != $user['infractiongroupids'] OR $infractioninfo['infractiongroupid'] != $user['infractiongroupid']) { $userdata =& datamanager_init('User', $vbulletin, ERRTYPE_STANDARD); $userdata->set_existing($user); $userdata->set('infractiongroupids', $groupids); $userdata->set('infractiongroupid', $infractioninfo['infractiongroupid']); $userdata->save(); } } } /** * Takes valid data and sets it as part of the data to be saved * * @param array List of infraction groups * @param integer Userid of user * @param integer Infraction Points * @param interger Usergroupid * * @return array User's final infraction groups */ function fetch_infraction_groups(&$infractiongroups, $userid, $ipoints, $usergroupid) { static $cache; if (!is_array($data)) { $data = array(); } $infractiongroupids = array(); if (!empty($infractiongroups["$usergroupid"])) { foreach($infractiongroups["$usergroupid"] AS $pointlevel => $orusergroupids) { if ($pointlevel query_read(" SELECT userid FROM " . TABLE_PREFIX . "user WHERE FIND_IN_SET('" . intval($override_groupid) . "', infractiongroupids) "); } else { $user_sql = $vbulletin->db->query_read(" SELECT userid FROM " . TABLE_PREFIX . "user WHERE FIND_IN_SET('" . intval($override_groupid) . "', infractiongroupids) OR (ipoints >= " . intval($point_level) . " " . ($applies_groupid != -1 ? "AND usergroupid = " . intval($applies_groupid) : '') . " ) "); } while ($user = $vbulletin->db->fetch_array($user_sql)) { $users[] = $user['userid']; } if ($users) { build_infractiongroupids($users); } } /*================================================= =====================*\ || ################################################## ################## || # Downloaded: 18:31, Fri Nov 12th 2010 || # CVS: $RCSfile$ - $Revision: 32878 $ || ################################################## ################## \*================================================ ======================*/ ?> Updating user info...
__DEFINE_LIKE_SHARE__
|