本文整理匯總了PHP中DEVDEBUG函數的典型用法代碼示例。如果您正苦於以下問題:PHP DEVDEBUG函數的具體用法?PHP DEVDEBUG怎麽用?PHP DEVDEBUG使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DEVDEBUG函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: fetch_forum_permissions
function fetch_forum_permissions($usergroupid, $forumid)
{
global $vbulletin;
// assign the permissions to the usergroup defaults
$perms = $vbulletin->usergroupcache["{$usergroupid}"]['forumpermissions'];
DEVDEBUG("FPerms: Usergroup Defaults: {$perms}");
// get the parent list of the forum we are interested in, excluding -1
$parentlist = substr($vbulletin->forumcache["{$forumid}"]['parentlist'], 0, -3);
// query forum permissions for the forums in the parent list of the current one
$fperms = $vbulletin->db->query_read("\n\t\tSELECT forumid, forumpermissions\n\t\tFROM " . TABLE_PREFIX . "forumpermission\n\t\tWHERE usergroupid = {$usergroupid}\n\t\tAND forumid IN({$parentlist})\n\t");
// no custom permissions found, return usergroup defaults
if ($vbulletin->db->num_rows($fperms) == 0) {
return array('forumpermissions' => $perms);
} else {
// assign custom permissions to forums
$fp = array();
while ($fperm = $vbulletin->db->fetch_array($fperms)) {
$fp["{$fperm['forumid']}"] = $fperm['forumpermissions'];
}
unset($fperm);
$vbulletin->db->free_result($fperms);
// run through each forum in the forum's parent list in order
foreach (array_reverse(explode(',', $parentlist)) as $parentid) {
// if the current parent forum has a custom permission, use it
if (isset($fp["{$parentid}"])) {
$perms = $fp["{$parentid}"];
DEVDEBUG("FPerms: Custom - forum '" . $vbulletin->forumcache["{$parentid}"]['title'] . "': {$perms}");
}
}
// return the permissions, whatever they may be now.
return array('forumpermissions' => $perms);
}
}
示例2: fetch_search_forumids
function fetch_search_forumids(&$forumchoice, $childforums = 0)
{
global $vbulletin, $display;
// make sure that $forumchoice is an array
if (!is_array($forumchoice)) {
$forumchoice = array($forumchoice);
}
// initialize the $forumids for return by this function
$forumids = array();
foreach ($forumchoice as $forumid) {
// get subscribed forumids
if ($forumid === 'subscribed' and $vbulletin->userinfo['userid'] != 0) {
DEVDEBUG("Querying subscribed forums for " . $vbulletin->userinfo['username']);
$sforums = $vbulletin->db->query_read_slave("\n\t\t\t\tSELECT forumid FROM " . TABLE_PREFIX . "subscribeforum\n\t\t\t\tWHERE userid = " . $vbulletin->userinfo['userid']);
if ($vbulletin->db->num_rows($sforums) == 0) {
// no subscribed forums
eval(standard_error(fetch_error('not_subscribed_to_any_forums')));
}
while ($sforum = $vbulletin->db->fetch_array($sforums)) {
$forumids["{$sforum['forumid']}"] .= $sforum['forumid'];
}
unset($sforum);
$vbulletin->db->free_result($sforums);
} else {
$forumid = intval($forumid);
if (isset($vbulletin->forumcache["{$forumid}"]) and $vbulletin->forumcache["{$forumid}"]['link'] == '') {
$forumids["{$forumid}"] = $forumid;
}
}
}
// now if there are any forumids we have to query, work out their child forums
if (empty($forumids)) {
$forumchoice = array();
$display['forums'] = array();
} else {
// set $forumchoice to show the returned forumids
#$forumchoice = implode(',', $forumids);
// put current forumids into the display table
$display['forums'] = $forumids;
// get child forums of selected forums
if ($childforums) {
require_once DIR . '/includes/functions_misc.php';
foreach ($forumids as $forumid) {
$children = fetch_child_forums($forumid, 'ARRAY');
if (!empty($children)) {
foreach ($children as $childid) {
$forumids["{$childid}"] = $childid;
}
}
unset($children);
}
}
}
// return the array of forumids
return $forumids;
}
示例3: date
$userids2cache[] = $moderator['userid'];
}
}
//Who visited code - copied with permission from Paul M
if ($vbulletin->kbank['who']['enabled'] and THIS_SCRIPT == 'index' and $vbulletin->userinfo['userid']) {
if ($vbulletin->kbank['who']['get24h']) {
$cutoff = TIMENOW - 86400;
$whodesc = $vbphrase['visited_today_24'];
} else {
$whodesc = $vbphrase['visited_today'];
$tnow = date('YmdHis', TIMENOW - intval($vbulletin->options['hourdiff']));
$cutoff = TIMENOW - (substr($tnow, 8, 2) * 3600 + substr($tnow, 10, 2) * 60 + substr($tnow, 12, 2));
}
unset($whotoday);
$todaysusers = $vbulletin->db->query_read_slave("\n\t\t\tSELECT userid,username,usergroupid,displaygroupid,infractiongroupid,lastactivity,options\n\t\t\tFROM " . TABLE_PREFIX . "user FORCE INDEX (lastactivity)\n\t\t\tWHERE lastactivity > {$cutoff}\n\t\t\tORDER BY username\n\t\t");
DEVDEBUG('[kBank] Get $todaysusers');
//Cache - Performance optimizing
$users = array();
$userids = array();
while ($today = $vbulletin->db->fetch_array($todaysusers)) {
$users[] = $today;
$userids[] = $today['userid'];
}
if (count($userids2cache)) {
$userids = array_merge($userids, $userids2cache);
$userids2cache = array();
//Reset
}
findItemsToWork($userids, false, false);
//Cache - complete!
$totaltoday = 0;
示例4: can_moderate_calendar
function can_moderate_calendar($calendarid = 0, $do = '', $userid = -1)
{
global $vbulletin, $cmodcache;
if ($userid == -1) {
$userid = $vbulletin->userinfo['userid'];
}
if ($vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['ismoderator']) {
DEVDEBUG(' USER IS A SUPER MODERATOR');
return true;
}
cache_calendar_moderators();
if ($calendarid == 0) {
// just check to see if the user is a moderator of any calendar
DEVDEBUG('looping through cmodcache to find userid $userid');
$ismod = 0;
foreach ($cmodcache as $calendarmods) {
if (!empty($calendarmods["{$userid}"])) {
$ismod = 1;
break;
}
}
return $ismod;
} else {
// check to see if user is a moderator of specific calendar
$getmodperms = intval($cmodcache["{$calendarid}"]["{$userid}"]['permissions']);
if (empty($do) and $getmodperms) {
return true;
} else {
// check if user is a mod and has permissions to '$do'
if ($getmodperms & $vbulletin->bf_misc_calmoderatorpermissions["{$do}"]) {
return true;
} else {
return false;
}
// if has perms for this action
}
// if is mod for calendar and no action set
}
// if calendarid=0
}
示例5: unset
}
}
}
$db->free_result($posts);
unset($post);
if ($postbits == '' and $vbulletin->GPC['pagenumber'] > 1) {
$pageinfo = array('page' => $vbulletin->GPC['pagenumber'] - 1);
if (!empty($vbulletin->GPC['perpage'])) {
$pageinfo['pp'] = $perpage;
}
if (!empty($vbulletin->GPC['highlight'])) {
$pageinfo['highlight'] = urlencode($vbulletin->GPC['highlight']);
}
exec_header_redirect(fetch_seo_url('thread|js', $threadinfo, $pageinfo));
}
DEVDEBUG("First Post: {$FIRSTPOSTID}; Last Post: {$LASTPOSTID}");
$pageinfo = array();
if ($vbulletin->GPC['highlight']) {
$pageinfo['highlight'] = urlencode($vbulletin->GPC['highlight']);
}
if (!empty($vbulletin->GPC['perpage'])) {
$pageinfo['pp'] = $perpage;
}
$pagenav = construct_page_nav($vbulletin->GPC['pagenumber'], $perpage, $totalposts, '', '', '', 'thread', $threadinfo, $pageinfo);
if ($thread['lastpost'] > $threadview) {
if ($firstnew) {
$firstunread = fetch_seo_url('thread', $threadinfo, array('page' => $vbulletin->GPC['pagenumber'])) . '#post' . $firstnew;
$show['firstunreadlink'] = true;
} else {
$firstunread = fetch_seo_url('thread', $threadinfo, array('goto' => 'newpost'));
$show['firstunreadlink'] = true;
示例6: build_special_templates
/**
* Reads results of form submission and updates special templates accordingly
*
* @param array Array of data from form
* @param string Variable type
* @param string Variable type name
*/
function build_special_templates($newtemplates, $templatetype, $vartype)
{
global $vbulletin, $template_cache;
DEVDEBUG('------------------------');
foreach ($template_cache["{$templatetype}"] as $title => $oldtemplate) {
// ignore the '_validation' and '_failsafe' keys
if ($title == '_validation' or $title == '_failsafe') {
continue;
}
// just carry on if there is no data for the current $newtemplate
if (!isset($newtemplates["{$title}"])) {
DEVDEBUG("\${$vartype}" . "['{$title}'] is not set");
continue;
}
// if delete the customized template, delete and continue
if ($vbulletin->GPC['delete']["{$vartype}"]["{$title}"]) {
if ($vbulletin->GPC['dostyleid'] != -1) {
$vbulletin->db->query_write("\n\t\t\t\t\tDELETE FROM " . TABLE_PREFIX . "template\n\t\t\t\t\tWHERE title = '" . $vbulletin->db->escape_string($title) . "' AND\n\t\t\t\t\ttemplatetype = '{$templatetype}' AND\n\t\t\t\t\tstyleid = " . $vbulletin->GPC['dostyleid'] . "\n\t\t\t\t");
DEVDEBUG("{$vartype} {$title} (reverted)");
if ($templatetype == 'stylevar' and $title == 'codeblockwidth') {
$vbulletin->db->query_write("TRUNCATE TABLE " . TABLE_PREFIX . "postparsed");
}
}
continue;
}
// check for what to do with the template
switch ($templatetype) {
case 'stylevar':
$newtemplate = $newtemplates["{$title}"];
if (isset($newtemplates['_validation']["{$title}"])) {
if (!preg_match($newtemplates['_validation']["{$title}"], $newtemplate)) {
$newtemplate = $newtemplates['_failsafe']["{$title}"];
}
}
break;
case 'css':
$newtemplate = serialize($newtemplates["{$title}"]);
break;
case 'replacement':
$newtemplate = $newtemplates["{$title}"];
break;
}
if ($newtemplate != $oldtemplate['template']) {
// update existing $vartype template
if ($oldtemplate['styleid'] == $vbulletin->GPC['dostyleid']) {
$vbulletin->db->query_write("\n\t\t\t\t\tUPDATE " . TABLE_PREFIX . "template\n\t\t\t\t\tSET template = '" . $vbulletin->db->escape_string($newtemplate) . "',\n\t\t\t\t\tdateline = " . TIMENOW . ",\n\t\t\t\t\tusername = '" . $vbulletin->db->escape_string($vbulletin->userinfo['username']) . "'\n\t\t\t\t\tWHERE title = '" . $vbulletin->db->escape_string($title) . "' AND\n\t\t\t\t\ttemplatetype = '{$templatetype}' AND\n\t\t\t\t\tstyleid = " . $vbulletin->GPC['dostyleid'] . "\n\t\t\t\t");
DEVDEBUG("{$vartype} {$title} (updated)");
// insert new $vartype template
} else {
/*insert query*/
$vbulletin->db->query_write("\n\t\t\t\t\tINSERT INTO " . TABLE_PREFIX . "template\n\t\t\t\t\t(styleid, templatetype, title, dateline, username, template)\n\t\t\t\t\tVALUES\n\t\t\t\t\t(" . intval($vbulletin->GPC['dostyleid']) . ", '{$templatetype}', '" . $vbulletin->db->escape_string($title) . "', " . TIMENOW . ", '" . $vbulletin->db->escape_string($vbulletin->userinfo['username']) . "', '" . $vbulletin->db->escape_string($newtemplate) . "')\n\t\t\t\t");
DEVDEBUG("{$vartype} {$title} (inserted)");
}
if ($templatetype == 'stylevar' and $title == 'codeblockwidth') {
$vbulletin->db->query_write("TRUNCATE TABLE " . TABLE_PREFIX . "postparsed");
}
} else {
DEVDEBUG("{$vartype} {$title} (not changed)");
}
}
// end foreach($template_cache)
}
示例7: build_forum_permissions
/**
* Rebuilds the $vbulletin->usergroupcache and $vbulletin->forumcache from the forum/usergroup tables
*
* @param boolean If true, force a recalculation of the forum parent and child lists
*/
function build_forum_permissions($rebuild_genealogy = true)
{
global $vbulletin, $fpermcache;
#echo "<h1>updateForumPermissions</h1>";
$grouppermissions = array();
$fpermcache = array();
$vbulletin->forumcache = array();
$vbulletin->usergroupcache = array();
// query usergroups
$usergroups = $vbulletin->db->query_read("SELECT * FROM " . TABLE_PREFIX . "usergroup ORDER BY title");
while ($usergroup = $vbulletin->db->fetch_array($usergroups)) {
foreach ($usergroup as $key => $val) {
if (is_numeric($val)) {
$usergroup["{$key}"] += 0;
}
}
$vbulletin->usergroupcache["{$usergroup['usergroupid']}"] = $usergroup;
// Profile pics disabled so don't inherit any of the profile pic settings
if (!($vbulletin->usergroupcache["{$usergroup['usergroupid']}"]['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canprofilepic'])) {
$vbulletin->usergroupcache["{$usergroup['usergroupid']}"]['profilepicmaxwidth'] = -1;
$vbulletin->usergroupcache["{$usergroup['usergroupid']}"]['profilepicmaxheight'] = -1;
$vbulletin->usergroupcache["{$usergroup['usergroupid']}"]['profilepicmaxsize'] = -1;
}
// Avatars disabled so don't inherit any of the avatar settings
if (!($vbulletin->usergroupcache["{$usergroup['usergroupid']}"]['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canuseavatar'])) {
$vbulletin->usergroupcache["{$usergroup['usergroupid']}"]['avatarmaxwidth'] = -1;
$vbulletin->usergroupcache["{$usergroup['usergroupid']}"]['avatarmaxheight'] = -1;
$vbulletin->usergroupcache["{$usergroup['usergroupid']}"]['avatarmaxsize'] = -1;
}
// Signature pics or signatures are disabled so don't inherit any of the signature pic settings
if (!($vbulletin->usergroupcache["{$usergroup['usergroupid']}"]['signaturepermissions'] & $vbulletin->bf_ugp_signaturepermissions['cansigpic']) or !($vbulletin->usergroupcache["{$usergroup['usergroupid']}"]['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canusesignature'])) {
$vbulletin->usergroupcache["{$usergroup['usergroupid']}"]['sigpicmaxwidth'] = -1;
$vbulletin->usergroupcache["{$usergroup['usergroupid']}"]['sigpicmaxheight'] = -1;
$vbulletin->usergroupcache["{$usergroup['usergroupid']}"]['sigpicmaxsize'] = -1;
}
// Signatures are disabled so don't inherit any of the signature settings
if (!($vbulletin->usergroupcache["{$usergroup['usergroupid']}"]['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canusesignature'])) {
$vbulletin->usergroupcache["{$usergroup['usergroupid']}"]['sigmaxrawchars'] = -1;
$vbulletin->usergroupcache["{$usergroup['usergroupid']}"]['sigmaxchars'] = -1;
$vbulletin->usergroupcache["{$usergroup['usergroupid']}"]['sigmaxlines'] = -1;
$vbulletin->usergroupcache["{$usergroup['usergroupid']}"]['sigmaxsizebbcode'] = -1;
$vbulletin->usergroupcache["{$usergroup['usergroupid']}"]['sigmaximages'] = -1;
$vbulletin->usergroupcache["{$usergroup['usergroupid']}"]['signaturepermissions'] = 0;
}
($hook = vBulletinHook::fetch_hook('admin_build_forum_perms_group')) ? eval($hook) : false;
$grouppermissions["{$usergroup['usergroupid']}"] = $usergroup['forumpermissions'];
}
unset($usergroup);
$vbulletin->db->free_result($usergroups);
DEVDEBUG('updateForumCache( ) - Queried Usergroups');
$vbulletin->forumcache = array();
$vbulletin->iforumcache = array();
$forumdata = array();
// get the vbulletin->iforumcache so we can traverse the forums in order within cache_forum_permissions
$newforumcache = $vbulletin->db->query_read("\n\t\tSELECT forum.*" . (VB_AREA != 'Upgrade' ? ", NOT ISNULL(podcast.forumid) AS podcast" : "") . "\n\t\tFROM " . TABLE_PREFIX . "forum AS forum\n\t\t" . (VB_AREA != 'Upgrade' ? "LEFT JOIN " . TABLE_PREFIX . "podcast AS podcast ON (forum.forumid = podcast.forumid AND podcast.enabled = 1)" : "") . "\n\t\tORDER BY displayorder\n\t");
while ($newforum = $vbulletin->db->fetch_array($newforumcache)) {
foreach ($newforum as $key => $val) {
/* values which begin with 0 and are greater than 1 character are strings, since 01 would be an octal number in PHP */
if (is_numeric($val) and !(substr($val, 0, 1) == '0' and strlen($val) > 1) and !in_array($key, array('title', 'title_clean', 'description', 'description_clean'))) {
$newforum["{$key}"] += 0;
}
}
$vbulletin->iforumcache["{$newforum['parentid']}"]["{$newforum['forumid']}"] = $newforum['forumid'];
$forumdata["{$newforum['forumid']}"] = $newforum;
}
$vbulletin->db->free_result($newforumcache);
// get the forumcache into the order specified in $vbulletin->iforumcache
$vbulletin->forumorder = array();
fetch_forum_order();
foreach ($vbulletin->forumorder as $forumid => $depth) {
$vbulletin->forumcache["{$forumid}"] =& $forumdata["{$forumid}"];
$vbulletin->forumcache["{$forumid}"]['depth'] = $depth;
}
unset($vbulletin->forumorder);
// rebuild forum parent/child lists
if ($rebuild_genealogy) {
build_forum_genealogy();
}
// query forum permissions
$fperms = $vbulletin->db->query_read("SELECT * FROM " . TABLE_PREFIX . "forumpermission");
while ($fperm = $vbulletin->db->fetch_array($fperms)) {
$fpermcache["{$fperm['forumid']}"]["{$fperm['usergroupid']}"] = intval($fperm['forumpermissions']);
($hook = vBulletinHook::fetch_hook('admin_build_forum_perms_forum')) ? eval($hook) : false;
}
unset($fperm);
$vbulletin->db->free_result($fperms);
DEVDEBUG('updateForumCache( ) - Queried Forum Pemissions');
// call the function that will work out the forum permissions
cache_forum_permissions($grouppermissions);
// finally replace the existing cache templates
build_datastore('usergroupcache', serialize($vbulletin->usergroupcache), 1);
foreach (array_keys($vbulletin->forumcache) as $forumid) {
unset($vbulletin->forumcache["{$forumid}"]['replycount'], $vbulletin->forumcache["{$forumid}"]['lastpost'], $vbulletin->forumcache["{$forumid}"]['lastposter'], $vbulletin->forumcache["{$forumid}"]['lastthread'], $vbulletin->forumcache["{$forumid}"]['lastthreadid'], $vbulletin->forumcache["{$forumid}"]['lasticonid'], $vbulletin->forumcache["{$forumid}"]['lastprefixid'], $vbulletin->forumcache["{$forumid}"]['threadcount']);
}
build_datastore('forumcache', serialize($vbulletin->forumcache), 1);
//.........這裏部分代碼省略.........
示例8: array
$usergroups = array();
$badgroups = array();
while ($getusergroup = $db->fetch_array($getusergroups)) {
$ugid =& $getusergroup['usergroupid'];
if (isset($vbulletin->usergroupcache["{$ugid}"])) {
$vbulletin->usergroupcache["{$ugid}"]['joinrequests'] = $getusergroup['requests'];
} else {
$badgroups[] = $getusergroup['usergroupid'];
}
}
unset($getusergroup);
$db->free_result($getusergroups);
// if there are any invalid requests, zap them now
if (!empty($badgroups)) {
$badgroups = implode(', ', $badgroups);
DEVDEBUG("Deleting requests from the following invalid usergroups: {$badgroups}");
$db->query_write("DELETE FROM " . TABLE_PREFIX . "usergrouprequest WHERE usergroupid IN ({$badgroups})");
}
// create array to hold options for the menu
$groupsmenu = array();
foreach ($vbulletin->usergroupcache as $id => $usergroup) {
if ($usergroup['ispublicgroup']) {
$groupsmenu["{$id}"] = htmlspecialchars_uni($usergroup['title']) . " ({$vbphrase['join_requests']}: " . vb_number_format($usergroup['joinrequests']) . ")";
}
}
print_form_header('usergroup', 'viewjoinrequests', 0, 1, 'chooser');
print_label_row($vbphrase['usergroup'], '<select name="usergroupid" onchange="this.form.submit();" class="bginput">' . construct_select_options($groupsmenu, $vbulletin->GPC['usergroupid']) . '</select><input type="submit" class="button" value="' . $vbphrase['go'] . '" />', 'thead');
print_table_footer();
unset($groupsmenu);
// now if we are being asked to display a particular usergroup, do so.
if ($vbulletin->GPC['usergroupid']) {
示例9: array
/**
* Caches the smilies in a form ready to be executed.
*
* @param bool Whether HTML parsing is enabled
*
* @return array Reference to smilie cache (key: find text; value: replace text)
*/
function &cache_smilies($do_html)
{
$key = $do_html ? 'html' : 'no_html';
if (isset($this->smilie_cache["{$key}"])) {
return $this->smilie_cache["{$key}"];
}
$sc =& $this->smilie_cache["{$key}"];
$sc = array();
if ($this->registry->smiliecache !== null) {
// we can get the smilies from the smiliecache datastore
DEVDEBUG('returning smilies from the datastore');
foreach ($this->registry->smiliecache as $smilie) {
if (!$do_html) {
$find = htmlspecialchars_uni(trim($smilie['smilietext']));
} else {
$find = trim($smilie['smilietext']);
}
// if you change this HTML tag, make sure you change the smilie remover in code/php/html tag handlers!
if ($this->is_wysiwyg()) {
$replace = "<img src=\"{$smilie['smiliepath']}\" border=\"0\" alt=\"\" title=\"" . htmlspecialchars_uni($smilie['title']) . "\" smilieid=\"{$smilie['smilieid']}\" class=\"inlineimg\" />";
} else {
$replace = "<img src=\"{$smilie['smiliepath']}\" border=\"0\" alt=\"\" title=\"" . htmlspecialchars_uni($smilie['title']) . "\" class=\"inlineimg\" />";
}
$sc["{$find}"] = $replace;
}
} else {
// we have to get the smilies from the database
DEVDEBUG('querying for smilies');
$this->registry->smiliecache = array();
$smilies = $this->registry->db->query_read("\n\t\t\t\tSELECT *, LENGTH(smilietext) AS smilielen\n\t\t\t\tFROM " . TABLE_PREFIX . "smilie\n\t\t\t\tORDER BY smilielen DESC\n\t\t\t");
while ($smilie = $this->registry->db->fetch_array($smilies)) {
if (!$do_html) {
$find = htmlspecialchars_uni(trim($smilie['smilietext']));
} else {
$find = trim($smilie['smilietext']);
}
// if you change this HTML tag, make sure you change the smilie remover in code/php/html tag handlers!
if ($this->is_wysiwyg()) {
$replace = "<img src=\"{$smilie['smiliepath']}\" border=\"0\" alt=\"\" title=\"" . htmlspecialchars_uni($smilie['title']) . "\" smilieid=\"{$smilie['smilieid']}\" class=\"inlineimg\" />";
} else {
$replace = "<img src=\"{$smilie['smiliepath']}\" border=\"0\" alt=\"\" title=\"" . htmlspecialchars_uni($smilie['title']) . "\" class=\"inlineimg\" />";
}
$sc["{$find}"] = $replace;
$this->registry->smiliecache["{$smilie['smilieid']}"] = $smilie;
}
}
return $sc;
}
示例10: findItemsToWork
function findItemsToWork($userids, $work = false, $allstatus = false, $query_hook = false)
{
global $vbulletin, $kbank_active_items;
if (!$vbulletin->kbank['itemEnabled']) {
return false;
}
$didsomething = false;
$userids_query = array();
if ($query_hook['force']) {
$userids_query[] = -1;
}
if (is_numeric($userids)) {
$userids = array($userids);
}
if (is_array($userids)) {
foreach ($userids as $userid) {
if ($allstatus) {
unset($kbank_active_items[$userid]);
}
if (is_numeric($userid) and $userid > 0 and !isset($kbank_active_items[$userid]) and !in_array($userid, $userids_query)) {
$userids_query[] = intval($userid);
$kbank_active_items[$userid] = array();
}
}
}
if (count($userids_query) > 0) {
$items = $vbulletin->db->query_read("\n\t\t\tSELECT \n\t\t\t\titems.*\n\t\t\t\t,user.username AS username\n\t\t\t" . iif($query_hook['fulljoin'], $query_hook['fulljoin'], "FROM `" . TABLE_PREFIX . "kbank_items` AS items\n\t\t\t\t{$query_hook['join']}\n\t\t\t\tLEFT JOIN `" . TABLE_PREFIX . "user` AS user ON (user.userid = items.userid)") . "\n\t\t\tWHERE (\n\t\t\t\t" . iif($query_hook['idcheckfield'] !== false, iif($query_hook['idcheckfield'], $query_hook['idcheckfield'], 'items.userid') . " in (" . implode(',', $userids_query) . ")") . "\n\t\t\t\t{$query_hook['where']}\n\t\t\t\t)\n\t\t\t\tAND items.status > " . iif(!$allstatus, KBANK_ITEM_AVAILABLE, KBANK_ITEM_DELETED) . "\n\t\t\t\tAND (items.expire_time > " . TIMENOW . "\n\t\t\t\t\tOR items.expire_time < 0)\n\t\t\tORDER BY items.userid ASC, items.type ASC, items.expire_time DESC\n\t\t");
DEVDEBUG('[kBank Item] findItemsToWorks query the database');
$itemdatas = array();
$itemtypeids = array();
while ($itemdata = $vbulletin->db->fetch_array($items)) {
$itemdatas[] = $itemdata;
$itemtypeids[] = $itemdata['type'];
}
$vbulletin->db->free_result($items);
unset($item);
//Prepare itemtypes
newItemType($itemtypeids, false, true);
//Load items
$userids2sort = array();
foreach ($itemdatas as $itemdata) {
$item =& newItem($itemdata['itemid'], $itemdata);
$kbank_active_items[$itemdata['userid']][$itemdata['itemid']] = $item;
if (!in_array($itemdata['userid'], $userids2sort)) {
$userids2sort[] = $itemdata['userid'];
}
}
//sorting
foreach ($userids2sort as $userid) {
if ($userid != -1 and is_array($kbank_active_items[$userid])) {
usort($kbank_active_items[$userid], 'findItemsToWork_cmp');
if (count($kbank_active_items[$userid]) > 1) {
//fix itemid, only work if more than 1 item
$items = array();
foreach ($kbank_active_items[$userid] as $item) {
if ($item) {
$items[$item->data['itemid']] = $item;
}
}
$kbank_active_items[$userid] = $items;
}
}
}
}
if ($work) {
foreach ($userids as $userid) {
if (findItemToWork($userid)) {
$didsomething = true;
}
}
}
return $didsomething;
}
示例11: can_moderate_blog
/**
* Determine moderator ability
*
* @param string Permissions
* @param interger Userid
* @param string Comma separated list of usergroups to which the user belongs
*
* @return boolean
*/
function can_moderate_blog($do = '', $userinfo = null)
{
global $vbulletin;
$issupermod = false;
$superpermissions = 0;
if ($userinfo === null)
{
$modinfo =& $vbulletin->userinfo;
}
else
{
$modinfo =& $userinfo;
}
if ($modinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['ismoderator'])
{
DEVDEBUG(' USER IS A SUPER MODERATOR');
$issupermod = true;
}
if (empty($do))
{
if ($issupermod)
{
return true;
}
else if (isset($modinfo['isblogmoderator']))
{
if ($modinfo['isblogmoderator'])
{
DEVDEBUG(' USER HAS ISBLOGMODERATOR SET');
return true;
}
else
{
DEVDEBUG(' USER DOES NOT HAVE ISBLOGMODERATOR SET');
return false;
}
}
}
cache_blog_moderators();
$permissions = intval($vbulletin->vbblog['modcache']["$modinfo[userid]"]['normal']['permissions']);
if ($issupermod)
{
if (isset($vbulletin->vbblog['modcache']["$modinfo[userid]"]['super']))
{
$permissions |= $vbulletin->vbblog['modcache']["$modinfo[userid]"]['super']['permissions'];
}
else
{
$permissions |= array_sum($vbulletin->bf_misc_vbblogmoderatorpermissions);
}
}
if (empty($do) AND $permissions)
{
return true;
}
else if ($permissions & $vbulletin->bf_misc_vbblogmoderatorpermissions["$do"])
{
return true;
}
else
{
return false;
}
}
示例12: array
/**
* Caches the smilies in a form ready to be executed.
*
* @param bool Whether HTML parsing is enabled
*
* @return array Reference to smilie cache (key: find text; value: replace text)
*/
function &cache_smilies($do_html)
{
$key = $do_html ? 'html' : 'no_html';
if (isset($this->smilie_cache["{$key}"])) {
return $this->smilie_cache["{$key}"];
}
$sc =& $this->smilie_cache["{$key}"];
$sc = array();
if ($this->registry->smiliecache !== null) {
// we can get the smilies from the smiliecache datastore
DEVDEBUG('returning smilies from the datastore');
foreach ($this->registry->smiliecache as $smilie) {
if (!$do_html) {
$find = htmlspecialchars_uni(trim($smilie['smilietext']));
} else {
$find = trim($smilie['smilietext']);
}
$smiliepath = preg_match('/^https?:\\/\\//', $smilie['smiliepath']) ? $smilie['smiliepath'] : vB::getDatastore()->getOption('bburl') . '/' . $smilie['smiliepath'];
// if you change this HTML tag, make sure you change the smilie remover in code/php/html tag handlers!
if ($this->is_wysiwyg()) {
$replace = "<img src=\"{$smiliepath}\" border=\"0\" alt=\"\" title=\"" . htmlspecialchars_uni($smilie['title']) . "\" smilieid=\"{$smilie['smilieid']}\" class=\"inlineimg\" />";
} else {
$replace = "<img src=\"{$smiliepath}\" border=\"0\" alt=\"\" title=\"" . htmlspecialchars_uni($smilie['title']) . "\" class=\"inlineimg\" />";
}
$sc["{$find}"] = $replace;
}
} else {
// we have to get the smilies from the database
DEVDEBUG('querying for smilies');
$this->registry->smiliecache = array();
$smilies = vB::getDbAssertor()->getRows('fetchSmilies', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_STORED));
foreach ($smilies as $smilie) {
if (!$do_html) {
$find = htmlspecialchars_uni(trim($smilie['smilietext']));
} else {
$find = trim($smilie['smilietext']);
}
$smiliepath = preg_match('/^https?:\\/\\//', $smilie['smiliepath']) ? $smilie['smiliepath'] : vB::getDatastore()->getOption('bburl') . '/' . $smilie['smiliepath'];
// if you change this HTML tag, make sure you change the smilie remover in code/php/html tag handlers!
if ($this->is_wysiwyg()) {
$replace = "<img src=\"{$smiliepath}\" border=\"0\" alt=\"\" title=\"" . htmlspecialchars_uni($smilie['title']) . "\" smilieid=\"{$smilie['smilieid']}\" class=\"inlineimg\" />";
} else {
$replace = "<img src=\"{$smiliepath}\" border=\"0\" alt=\"\" title=\"" . htmlspecialchars_uni($smilie['title']) . "\" class=\"inlineimg\" />";
}
$sc["{$find}"] = $replace;
$this->registry->smiliecache["{$smilie['smilieid']}"] = $smilie;
}
}
return $sc;
}
示例13: build_channel_permissions
/**
* Rebuilds the $vbulletin->usergroupcache
*/
function build_channel_permissions()
{
global $vbulletin, $npermscache;
$grouppermissions = array();
$npermscache = array();
$vbulletin->usergroupcache = array();
// query usergroups
$usergroups = vB::getDbAssertor()->assertQuery('usergroup', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT), 'title');
foreach ($usergroups as $usergroup) {
foreach ($usergroup as $key => $val) {
if (is_numeric($val)) {
$usergroup["{$key}"] += 0;
}
}
$vbulletin->usergroupcache["{$usergroup['usergroupid']}"] = $usergroup;
$vbulletin->usergroupcache["{$usergroup['usergroupid']}"] = get_disabled_perms($usergroup['usergroupid']) + $vbulletin->usergroupcache["{$usergroup['usergroupid']}"];
// Legacy Hook 'admin_build_forum_perms_group' Removed //
$grouppermissions["{$usergroup['usergroupid']}"] = $usergroup['forumpermissions'];
}
unset($usergroup);
DEVDEBUG('updateChannelCache( ) - Queried Usergroups');
// query forum permissions
$permQry = vB::getDbAssertor()->assertQuery('vBForum:permission', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT));
$permissions = array();
foreach ($permQry as $cperm) {
$permissions["{$cperm['groupid']}"]["{$cperm['nodeid']}"] = $cperm;
$npermscache["{$cperm['nodeid']}"]["{$cperm['groupid']}"] = $cperm;
// Legacy Hook 'admin_build_channel_perms_forum' Removed //
}
$userContext = vB::getUserContext();
if ($userContext) {
$userContext->rebuildGroupAccess();
}
DEVDEBUG('updateChannelCache( ) - Queried Channel Pemissions');
// call the function that will work out the forum permissions
cache_forum_permissions();
// finally replace the existing cache templates
$vbulletin->usergroupcache = vB::getDatastore()->buildUserGroupCache($vbulletin->usergroupcache);
}
示例14: construct_phrase
\*======================================================================*/
global $vbulletin;
if (defined('VB_AREA') and $vbulletin->kbank['enabled'] and ($vbulletin->options['templateversion'] < '3.7.0' or $this->template_name == 'memberinfo_block_statistics')) {
include_once DIR . '/kbank/functions.php';
global $kbank, $userinfo;
if ($vbulletin->kbank['profile_elements'] & $vbulletin->kbank['bitfield']['display_elements']['kbank_show_points']) {
$showpoints = true;
if ($vbulletin->kbank['profile_elements'] & $vbulletin->kbank['bitfield']['display_elements']['kbank_show_toprichest'] and $vbulletin->kbank_toprichest and isset($vbulletin->kbank_toprichest[$userinfo['userid']])) {
$toprichest = construct_phrase($vbphrase['kbank_misc_toprichest_show'], $vbulletin->kbank_toprichest[$userinfo['userid']]['pos']);
}
}
if ($vbulletin->kbank['profile_elements'] & $vbulletin->kbank['bitfield']['display_elements']['kbank_show_items']) {
$showitems = true;
//search for itemtype that user can produce
$itemtypes = $vbulletin->db->query_read("SELECT *\n\t\t\tFROM `" . TABLE_PREFIX . "kbank_itemtypes` AS itemtypes\n\t\t\tWHERE userid LIKE '%,{$userinfo['userid']},%'");
DEVDEBUG('[kBank Item] Query database for user itemtypes');
if ($vbulletin->db->num_rows($itemtypes)) {
$userinfo['kbank_itemtypes'] = '';
while ($itemtypedata = $vbulletin->db->fetch_array($itemtypes)) {
$userinfo['kbank_itemtypes'] .= '<li>' . "<a href=\"{$vbulletin->kbank['phpfile']}?do=shop&username={$userinfo['username']}&itemtypeid={$itemtypedata['itemtypeid']}\" target=\"_blank\">{$itemtypedata['name']}</a>" . '</li>';
}
unset($itemtypedata);
}
$vbulletin->db->free_result($itemtypes);
//search for user items
if ($vbulletin->userinfo['userid'] != $userinfo['userid']) {
//skip 1 query if user is viewing his/her profile. Everything has been loaded!
findItemToWork($userinfo['userid'], true);
}
global $kbank_active_items;
if (count($kbank_active_items[$userinfo['userid']])) {
示例15: ap_doHistory
function ap_doHistory($postid, $points, $reason)
{
if (!is_numeric($postid) or $postid <= 0) {
exit;
}
//Error free!
global $vbulletin, $vbphrase, $messages;
$more_query = array('to' => '', 'from' => '');
//Get user's profile
$user = $vbulletin->db->query_first("\n\t\tSELECT \n\t\t\tpost.userid AS userid, \n\t\t\tuser.username AS username,\n\t\t\tuser.{$vbulletin->kbank['field']} AS total, \n\t\t\tuser.usergroupid AS usergroupid,\n\t\t\tuser.membergroupids AS membergroupids,\n\t\t\tuser.displaygroupid AS displaygroupid,\n\t\t\tuser.usertitle AS usertitle,\n\t\t\tuser.customtitle AS customtitle\n\t\tFROM `" . TABLE_PREFIX . "post` AS post\n\t\tINNER JOIN `" . TABLE_PREFIX . "user` AS user ON (user.userid = post.userid)\n\t\tWHERE postid = '{$postid}';");
DEVDEBUG('[kBank Award] ap_doHistory query the database');
//Check for new usergroup moving
$newug = 0;
foreach ($vbulletin->kbank['award']['listMove2GroupIDs'] as $rule) {
$tmp = explode(':', $rule);
$result_tmp = 12345;
@eval('$result_tmp = (' . ($user['total'] + $points) . $tmp[0] . ');');
if ($result_tmp !== 12345) {
if ($result_tmp !== true and $result_tmp !== false) {
$result_tmp = 12345;
@eval('$result_tmp = (' . ($user['total'] + $points) . '<' . $tmp[0] . ');');
if ($result_tmp === 12345 or $result_tmp !== true or $result_tmp !== false) {
$result_tmp = false;
}
}
} else {
$result_tmp = false;
}
if ($result_tmp) {
$newug = $tmp[1];
}
}
if ($newug != 0 and !is_member_of($user, $vbulletin->kbank['award']['permCanRemoveGroupIDs']) and !is_member_of($user, $newug)) {
$more_query['to'] .= " ,usergroupid = {$newug}";
} else {
$newug = 0;
}
//Done with finding new usergroup
//Add ban record if needed (if new group is a ban group)
if ($newug) {
//Find 'is ban group' groups
$querygroups = array();
foreach ($vbulletin->usergroupcache as $usergroupid => $usergroup) {
if (!($usergroup['genericoptions'] & $vbulletin->bf_ugp_genericoptions['isnotbannedgroup'])) {
$querygroups[] = $usergroupid;
}
}
if (in_array($newug, $querygroups)) {
$adminid = $vbulletin->userinfo['userid'];
if (!$vbulletin->db->query_first("\n\t\t\t\t\tSELECT * FROM `" . TABLE_PREFIX . "userban`\n\t\t\t\t\tWHERE userid = {$user['userid']}\n\t\t\t\t")) {
$vbulletin->db->query("\n\t\t\t\t\tINSERT INTO `" . TABLE_PREFIX . "userban`\n\t\t\t\t\t(userid, usergroupid, displaygroupid, usertitle, customtitle, adminid, bandate, liftdate, reason)\n\t\t\t\t\tVALUES (\n\t\t\t\t\t\t{$user['userid']}\n\t\t\t\t\t\t,{$user['usergroupid']}\n\t\t\t\t\t\t,{$user['displaygroupid']}\n\t\t\t\t\t\t,'{$user['usertitle']}'\n\t\t\t\t\t\t,{$user['customtitle']}\n\t\t\t\t\t\t,{$adminid}\n\t\t\t\t\t\t," . TIMENOW . "\n\t\t\t\t\t\t,0\n\t\t\t\t\t\t,'{$vbphrase['kbank_award_bank_rupted']}'\n\t\t\t\t\t);");
DEVDEBUG('[kBank Award] ap_doHistory query the database 2 times');
}
$more_query['to'] .= " ,usertitle = '{$vbphrase['kbank_award_bank_rupted']}'";
}
}
//Adjust counter
$more_query['to'] .= iif($reason != AWARD_REMOVE, " ,{$vbulletin->kbank['award']['awardedtimes']} = {$vbulletin->kbank['award']['awardedtimes']} + 1", " ,{$vbulletin->kbank['award']['awardedtimes']} = {$vbulletin->kbank['award']['awardedtimes']} - 1") . " ,{$vbulletin->kbank['award']['awardedamount']} = {$vbulletin->kbank['award']['awardedamount']} + {$points}";
//Specified itemname for banklogs
$more_query['banklogs'] = array('itemname' => 'post');
//Update database
$result = transferMoney(0, $user['userid'], $points, array('adminid' => $vbulletin->userinfo['userid'], 'comment' => $reason), null, true, false, KBANK_NO_TAX, false, $postid, $more_query);
//Send PM to user (if action done successfully)
if ($result === true and $vbulletin->kbank['award']['sendPM']) {
//build title,message
$url = $vbulletin->options['bburl'];
if ($reason != AWARD_REMOVE) {
$title = $vbphrase['kbank_award_PM_title'];
$text = construct_phrase($vbphrase['kbank_award_PM_text'], "{$url}/showthread.php?p={$postid}", $points, $reason, "{$url}/member.php?u={$vbulletin->userinfo['userid']}", $vbulletin->userinfo['username'], $vbulletin->kbank['name']);
} else {
$title = $vbphrase['kbank_award_PM_title_deleted'];
$text = construct_phrase($vbphrase['kbank_award_PM_text_deleted'], "{$url}/showthread.php?p={$postid}", "{$url}/member.php?u={$vbulletin->userinfo['userid']}", $vbulletin->userinfo['username']);
}
if ($newug != 0) {
$text .= construct_phrase($vbphrase['kbank_award_usergroup_moved'], $newug);
$messages[] = construct_phrase($vbphrase['kbank_award_usergroup_moved_for_admin'], $newug, $user['username']);
}
$result = kbank_sendPM($vbulletin->userinfo, $user, $title, $text, false);
}
return $result;
}