本文整理汇总了PHP中convert_bits_to_array函数的典型用法代码示例。如果您正苦于以下问题:PHP convert_bits_to_array函数的具体用法?PHP convert_bits_to_array怎么用?PHP convert_bits_to_array使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了convert_bits_to_array函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_from_id
/**
* Load object from an id
*
* @param int $id
* @return vB_Legacy_Calendar
*/
public static function create_from_id($id)
{
global $_CALENDAROPTIONS, $_CALENDARHOLIDAYS;
$calendarinfo = verify_id('calendar', intval($id), false, true);
$getoptions = convert_bits_to_array($calendarinfo['options'], $_CALENDAROPTIONS);
$calendarinfo = array_merge($calendarinfo, $getoptions);
$geteaster = convert_bits_to_array($calendarinfo['holidays'], $_CALENDARHOLIDAYS);
$calendarinfo = array_merge($calendarinfo, $geteaster);
if ($calendarinfo) {
return self::create_from_record($calendarinfo);
} else {
return null;
}
}
示例2: process_showgroups_userinfo
function process_showgroups_userinfo($user)
{
global $vbulletin, $permissions, $stylevar, $show;
$user = array_merge($user, convert_bits_to_array($user['options'], $vbulletin->bf_misc_useroptions));
$user = array_merge($user, convert_bits_to_array($user['adminoptions'], $vbulletin->bf_misc_adminoptions));
cache_permissions($user, false);
fetch_online_status($user, true);
if (!$user['invisible'] or $permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canseehidden']) {
$user['lastonline'] = vbdate($vbulletin->options['dateformat'], $user['lastactivity'], 1);
} else {
$user['lastonline'] = ' ';
}
fetch_musername($user);
return $user;
}
示例3: fetch_vm_ajax_query
$sql = fetch_vm_ajax_query($userinfo, $vbulletin->GPC['vmid'], 'edit');
}
else if ($vbulletin->GPC['fromconverse'])
{
$sql = fetch_vm_ajax_query($userinfo, $vmid, 'wall', $userinfo2);
}
else
{
$sql = fetch_vm_ajax_query($userinfo, $vmid, 'user');
}
$messages = $db->query_read_slave($sql);
while ($message = $db->fetch_array($messages))
{
// Process user.options
$message = array_merge($message, convert_bits_to_array($message['options'], $vbulletin->bf_misc_useroptions));
if ($message['profileuserid'] == $vbulletin->userinfo['userid'] AND $message['state'] == 'visible' AND !$message['messageread'])
{
$read_ids[] = $message['vmid'];
}
$response_handler =& $factory->create($message);
$response_handler->cachable = false;
if ($vbulletin->GPC['fromconverse'])
{
$response_handler->converse = false;
}
else
{
$response_handler->converse = true;
示例4: array
$moderator = array();
foreach ($myobj->data['misc']['moderatorpermissions'] as $permission => $option) {
$moderator["{$permission}"] = $option['default'] ? 1 : 0;
}
foreach ($myobj->data['misc']['moderatorpermissions2'] as $permission => $option) {
$moderator["{$permission}"] = $option['default'] ? 1 : 0;
}
$moderator['forumid'] = $foruminfo['forumid'];
$moderator['forumtitle'] = $foruminfo['forumtitle'];
print_form_header('moderator', 'update');
print_table_header(construct_phrase($vbphrase['add_new_moderator_to_forum_x'], $foruminfo['forumtitle']));
} else {
// edit moderator - query moderator
$moderator = $db->query_first("\n\t\t\tSELECT moderator.moderatorid, moderator.userid,\n\t\t\tmoderator.forumid, moderator.permissions, moderator.permissions2, user.username, forum.title AS forumtitle, user.username\n\t\t\tFROM " . TABLE_PREFIX . "moderator AS moderator\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = moderator.userid)\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "forum AS forum ON (forum.forumid = moderator.forumid)\n\t\t\tWHERE moderatorid = " . $vbulletin->GPC['moderatorid'] . "\n\t\t");
$perms = convert_bits_to_array($moderator['permissions'], $vbulletin->bf_misc_moderatorpermissions);
$perms2 = convert_bits_to_array($moderator['permissions2'], $vbulletin->bf_misc_moderatorpermissions2);
$moderator = array_merge($perms, $perms2, $moderator);
log_admin_action('username = ' . $moderator['username'] . ', userid = ' . $moderator['userid']);
// delete link
print_form_header('moderator', 'remove');
construct_hidden_code('moderatorid', $vbulletin->GPC['moderatorid']);
print_table_header($vbphrase['if_you_would_like_to_remove_this_moderator'] . ' <input type="submit" class="button" value="' . $vbphrase['remove'] . '" tabindex="1" />');
print_table_footer();
print_form_header('moderator', 'update');
construct_hidden_code('moderatorid', $vbulletin->GPC['moderatorid']);
print_table_header(construct_phrase($vbphrase['edit_moderator_x_for_forum_y'], $moderator['username'], $moderator['forumtitle']));
}
}
if ($_REQUEST['do'] != 'editglobal') {
print_forum_chooser($vbphrase['forum_and_children'], 'forumid', $moderator['forumid']);
if ($_REQUEST['do'] == 'add') {
示例5: IF
if ($limitlower <= 0) {
$limitlower = 1;
}
$getevents = $db->query_read_slave("\n\t\tSELECT event.*, IF(dateline_to = 0, 1, 0) AS singleday, user.username, user.options, user.adminoptions, user.usergroupid, user.membergroupids, user.infractiongroupids, IF(options & " . $vbulletin->bf_misc_useroptions['hasaccessmask'] . ", 1, 0) AS hasaccessmask,\n\t\t\tsubscribeevent.reminder, subscribeevent.subscribeeventid\n\t\t\t" . ($vbulletin->options['avatarenabled'] ? ",avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline,customavatar.width AS avwidth,customavatar.height AS avheight, customavatar.width_thumb AS avwidth_thumb, customavatar.height_thumb AS avheight_thumb, filedata_thumb, NOT ISNULL(customavatar.userid) AS hascustom" : "") . "\n\t\tFROM " . TABLE_PREFIX . "subscribeevent AS subscribeevent\n\t\tLEFT JOIN " . TABLE_PREFIX . "event AS event ON (subscribeevent.eventid = event.eventid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (event.userid = user.userid)\n\t\t" . ($vbulletin->options['avatarenabled'] ? "LEFT JOIN " . TABLE_PREFIX . "avatar AS avatar ON(avatar.avatarid = user.avatarid) LEFT JOIN " . TABLE_PREFIX . "customavatar AS customavatar ON(customavatar.userid = user.userid)" : "") . "\n\t\tWHERE\n\t\t\tsubscribeevent.userid = " . $vbulletin->userinfo['userid'] . "\n\t\t\t\tAND\n\t\t\tevent.visible = 1\n\t\tORDER BY\n\t\t\t{$sqlsortfield} {$sortorder}\n\t\tLIMIT " . ($limitlower - 1) . ", {$perpage}\n\t");
$itemcount = ($pagenumber - 1) * $perpage;
$first = $itemcount + 1;
if ($db->num_rows($getevents)) {
$show['haveevents'] = true;
while ($event = $db->fetch_array($getevents)) {
if (empty($reminders["{$event['reminder']}"])) {
$event['reminder'] = 3600;
}
$event['reminder'] = $vbphrase[$reminders[$event['reminder']]];
$offset = $event['dst'] ? $vbulletin->userinfo['timezoneoffset'] : $vbulletin->userinfo['tzoffset'];
$event = array_merge($event, convert_bits_to_array($event['options'], $vbulletin->bf_misc_useroptions));
$event = array_merge($event, convert_bits_to_array($event['adminoptions'], $vbulletin->bf_misc_adminoptions));
cache_permissions($event, false);
fetch_avatar_from_userinfo($event, true);
$event['dateline_from_user'] = $event['dateline_from'] + $offset * 3600;
$event['dateline_to_user'] = $event['dateline_to'] + $offset * 3600;
$event['preview'] = htmlspecialchars_uni(strip_bbcode(fetch_trimmed_title(strip_quotes($event['event']), 300), false, true));
$event = fetch_event_date_time($event);
$event['calendar'] = $calendarcache["{$event['calendarid']}"];
$show['singleday'] = !empty($event['singleday']) ? true : false;
($hook = vBulletinHook::fetch_hook('calendar_viewreminder_event')) ? eval($hook) : false;
$oppositesort = $sortorder == 'asc' ? 'desc' : 'asc';
$templater = vB_Template::create('calendar_reminder_eventbit');
$templater->register('date1', $date1);
$templater->register('date2', $date2);
$templater->register('daterange', $daterange);
$templater->register('event', $event);
示例6: fetch_query_sql
}
$query = fetch_query_sql($langupdate, 'language', "WHERE languageid = " . $vbulletin->GPC['dolanguageid']);
$db->query_write($query);
if ($vbulletin->GPC['isdefault'] and $vbulletin->GPC['dolanguageid'] != $vbulletin->options['languageid']) {
$do = 'setdefault';
} else {
$do = 'modify';
}
build_language_datastore();
define('CP_REDIRECT', 'language.php?dolanguageid=' . $vbulletin->GPC['dolanguageid'] . '&do=' . $do);
print_stop_message('saved_language_x_successfully', $newlang['title']);
}
// ##########################################################################
if ($_REQUEST['do'] == 'edit_settings') {
$language = fetch_languages_array($vbulletin->GPC['dolanguageid']);
$getoptions = convert_bits_to_array($language['options'], $vbulletin->bf_misc_languageoptions);
$language = array_merge($language, $getoptions);
print_form_header('language', 'update_settings');
construct_hidden_code('dolanguageid', $vbulletin->GPC['dolanguageid']);
print_table_header(construct_phrase($vbphrase['x_y_id_z'], $vbphrase['language'], $language['title'], $language['languageid']));
print_description_row($vbphrase['general_settings'], 0, 2, 'thead');
print_input_row($vbphrase['title'], 'title', $language['title'], 0);
print_yes_no_row($vbphrase['allow_user_selection'], 'userselect', $language['userselect']);
print_yes_no_row($vbphrase['is_default_language'], 'isdefault', iif($vbulletin->GPC['dolanguageid'] == $vbulletin->options['languageid'], 1, 0));
print_yes_no_row($vbphrase['enable_directional_markup_fix'], 'options[dirmark]', $language['dirmark']);
print_label_row($vbphrase['text_direction'], '<label for="rb_l2r"><input type="radio" name="options[direction]" id="rb_l2r" value="1" tabindex="1"' . iif($language['direction'], ' checked="checked"') . " />{$vbphrase['left_to_right']}</label><br />" . '
<label for="rb_r2l"><input type="radio" name="options[direction]" id="rb_r2l" value="0" tabindex="1"' . iif(!$language['direction'], ' checked="checked"') . " />{$vbphrase['right_to_left']}</label>", '', 'top', 'direction');
print_input_row($vbphrase['language_code'], 'languagecode', $language['languagecode']);
print_input_row($vbphrase['html_charset'] . "<code><meta http-equiv="Content-Type" content="text/html; charset=<b>{$language['charset']}</b>" /></code>", 'charset', $language['charset']);
print_input_row($vbphrase['image_folder_override'], 'imagesoverride', $language['imagesoverride']);
print_description_row($vbphrase['date_time_formatting'], 0, 2, 'thead');
示例7: photoplog_output_page
photoplog_output_page('photoplog_error_page', $vbphrase['photoplog_error'], $vbphrase['photoplog_bad_inline']);
}
$photoplog_comment_infos = $db->query_read_slave("SELECT commentid, catid, fileid, userid\r\n\t\tFROM " . PHOTOPLOG_PREFIX . "photoplog_ratecomment\r\n\t\tWHERE commentid IN (" . implode(',', $photoplog_comment_ids) . ")\r\n\t\t{$photoplog_catid_sql2}\r\n\t\t{$photoplog_admin_sql2}\r\n\t\tAND comment != ''\r\n\t");
$photoplog_inline_perm = array();
while ($photoplog_comment_info = $db->fetch_array($photoplog_comment_infos)) {
$photoplog_inline_commentid = $photoplog_comment_info['commentid'];
$photoplog_inline_catid = $photoplog_comment_info['catid'];
$photoplog_inline_perm[$photoplog_inline_commentid]['caneditowncomments'] = 0;
$photoplog_inline_perm[$photoplog_inline_commentid]['candeleteowncomments'] = 0;
$photoplog_inline_perm[$photoplog_inline_commentid]['caneditothercomments'] = 0;
$photoplog_inline_perm[$photoplog_inline_commentid]['candeleteothercomments'] = 0;
$photoplog_inline_perm[$photoplog_inline_commentid]['catid'] = 0;
$photoplog_inline_perm[$photoplog_inline_commentid]['fileid'] = 0;
$photoplog_inline_perm[$photoplog_inline_commentid]['userid'] = 0;
if (isset($photoplog_inline_bits[$photoplog_inline_catid])) {
$photoplog_inline_perm[$photoplog_inline_commentid] = convert_bits_to_array($photoplog_inline_bits[$photoplog_inline_catid], $photoplog_categoryoptpermissions);
$photoplog_inline_perm[$photoplog_inline_commentid]['catid'] = $photoplog_inline_catid;
$photoplog_inline_perm[$photoplog_inline_commentid]['fileid'] = $photoplog_comment_info['fileid'];
$photoplog_inline_perm[$photoplog_inline_commentid]['userid'] = $photoplog_comment_info['userid'];
}
}
$db->free_result($photoplog_comment_infos);
if (empty($photoplog_inline_perm)) {
photoplog_index_bounce();
}
$photoplog_comment_sql = array();
$photoplog_cat_ids = array();
$photoplog_file_ids = array();
$photoplog_user_ids = array();
foreach ($photoplog_inline_perm as $photoplog_inline_perm_commentid => $photoplog_inline_perm_array) {
if ($_REQUEST['do'] == 'edit' && $photoplog_file_id != $photoplog_inline_perm_array['fileid']) {
示例8: array
$usergroup = array('pmquota' => 0, 'pmsendmax' => 5, 'attachlimit' => 1000000, 'avatarmaxwidth' => 50, 'avatarmaxheight' => 50, 'avatarmaxsize' => 20000, 'profilepicmaxwidth' => 100, 'profilepicmaxheight' => 100, 'profilepicmaxsize' => 25000, 'sigmaxsizebbcode' => 7);
}
$permgroups = $db->query_read("\n\t\t\tSELECT usergroup.usergroupid, title,\n\t\t\t\t(COUNT(forumpermission.forumpermissionid) + COUNT(calendarpermission.calendarpermissionid)) AS permcount\n\t\t\tFROM " . TABLE_PREFIX . "usergroup AS usergroup\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "forumpermission AS forumpermission ON (usergroup.usergroupid = forumpermission.usergroupid)\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "calendarpermission AS calendarpermission ON (usergroup.usergroupid = calendarpermission.usergroupid)\n\t\t\tGROUP BY usergroup.usergroupid\n\t\t\tHAVING permcount > 0\n\t\t\tORDER BY title\n\t\t");
$ugarr = array('-1' => '--- ' . $vbphrase['none'] . ' ---');
while ($group = $db->fetch_array($permgroups)) {
$ugarr["{$group['usergroupid']}"] = $group['title'];
}
print_table_header($vbphrase['default_forum_permissions']);
print_select_row($vbphrase['create_permissions_based_off_of_forum'], 'ugid_base', $ugarr, $vbulletin->GPC['defaultgroupid']);
print_table_break();
print_table_header($vbphrase['add_new_usergroup']);
} else {
$usergroup = $db->query_first("\n\t\t\tSELECT * FROM " . TABLE_PREFIX . "usergroup\n\t\t\tWHERE usergroupid = " . $vbulletin->GPC['usergroupid'] . "\n\t\t");
$ug_bitfield = array();
foreach ($vbulletin->bf_ugp as $permissiongroup => $fields) {
$ug_bitfield["{$permissiongroup}"] = convert_bits_to_array($usergroup["{$permissiongroup}"], $fields);
}
construct_hidden_code('usergroupid', $vbulletin->GPC['usergroupid']);
print_table_header(construct_phrase($vbphrase['x_y_id_z'], $vbphrase['usergroup'], $usergroup[title], $usergroup[usergroupid]), 2, 0);
}
print_input_row($vbphrase['title'], 'usergroup[title]', $usergroup['title']);
print_input_row($vbphrase['description'], 'usergroup[description]', $usergroup['description']);
print_input_row($vbphrase['usergroup_user_title'], 'usergroup[usertitle]', $usergroup['usertitle']);
print_label_row($vbphrase['username_markup'], '<span style="white-space:nowrap">
<input size="15" type="text" class="bginput" name="usergroup[opentag]" value="' . htmlspecialchars_uni($usergroup['opentag']) . '" tabindex="1" />
<input size="15" type="text" class="bginput" name="usergroup[closetag]" value="' . htmlspecialchars_uni($usergroup['closetag']) . '" tabindex="1" />
</span>', '', 'top', 'htmltags');
print_input_row($vbphrase['password_expiry'], 'usergroup[passwordexpires]', $usergroup['passwordexpires']);
print_input_row($vbphrase['password_history'], 'usergroup[passwordhistory]', $usergroup['passwordhistory']);
print_table_break();
print_column_style_code(array('width: 70%', 'width: 30%'));
示例9: array
if (defined('FEED_SAVE_ERROR') and is_array($feed)) {
// save error, show stuff again
$form_title = $feed['rssfeedid'] ? $vbphrase['edit_rss_feed'] : $vbphrase['add_new_rss_feed'];
} else {
if ($vbulletin->GPC['rssfeedid'] and $feed = $db->query_first("\r\n\t\tSELECT rssfeed.*, user.username\r\n\t\tFROM " . TABLE_PREFIX . "rssfeed AS rssfeed\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = rssfeed.userid)\r\n\t\tWHERE rssfeed.rssfeedid = " . $vbulletin->GPC['rssfeedid'] . "\r\n\t")) {
// feed is defined
$form_title = $vbphrase['edit_rss_feed'];
} else {
// add new feed
$feed = array('options' => 1025, 'ttl' => 1800, 'maxresults' => 0, 'endannouncement' => 7, 'titletemplate' => $vbphrase['rssfeed_title_template'], 'bodytemplate' => $vbphrase['rssfeed_body_template'], 'itemtype' => 'thread');
$form_title = $vbphrase['add_new_rss_feed'];
}
}
$checked = array();
if (!defined('FEED_SAVE_ERROR') and !is_array($feed['options'])) {
$feed['options'] = convert_bits_to_array($feed['options'], $vbulletin->bf_misc_feedoptions);
}
foreach ($feed['options'] as $bitname => $bitvalue) {
$checked["{$bitname}"] = $bitvalue ? ' checked="checked"' : '';
}
$checked['itemtype']["{$feed['itemtype']}"] = ' checked="checked"';
print_form_header('rssposter', 'update');
print_table_header($form_title);
if ($feed['rssfeedid']) {
print_checkbox_row($vbphrase['reset_last_checked_time'], 'resetlastrun', 0, 1, "<span class=\"normal\">{$vbphrase['reset']}</span>");
}
print_yes_no_row($vbphrase['feed_is_enabled'], 'options[enabled]', $feed['options']['enabled']);
print_input_row($vbphrase['title'], 'title', $feed['title'], false, 50);
print_input_row($vbphrase['url_of_feed'], 'url', $feed['url'], true, 50);
print_select_row($vbphrase['check_feed_every'], 'ttl', array(600 => construct_phrase($vbphrase['x_minutes'], 10), 1200 => construct_phrase($vbphrase['x_minutes'], 20), 1800 => construct_phrase($vbphrase['x_minutes'], 30), 3600 => construct_phrase($vbphrase['x_minutes'], 60), 7200 => construct_phrase($vbphrase['x_hours'], 2), 14400 => construct_phrase($vbphrase['x_hours'], 4), 21600 => construct_phrase($vbphrase['x_hours'], 6), 28800 => construct_phrase($vbphrase['x_hours'], 8), 36000 => construct_phrase($vbphrase['x_hours'], 10), 43200 => construct_phrase($vbphrase['x_hours'], 12)), $feed['ttl']);
print_input_row($vbphrase['maximum_items_to_fetch'], 'maxresults', $feed['maxresults'], true, 50);
示例10: foreach
if ($permgroups and $permgroups->valid()) {
foreach ($permgroups as $group) {
$ugarr["{$group['usergroupid']}"] = $group['title'];
}
}
print_table_header($vbphrase['default_forum_permissions']);
print_select_row($vbphrase['create_permissions_based_off_of_forum'], 'ugid_base', $ugarr, $vbulletin->GPC['defaultgroupid']);
print_table_break();
print_table_header($vbphrase['add_new_usergroup_gcpusergroup']);
} else {
$usergroup = vB_Api::instanceInternal('usergroup')->fetchUsergroupByID($vbulletin->GPC['usergroupid']);
$ug_bitfield = array();
foreach ($vbulletin->bf_ugp as $permissiongroup => $fields) {
$ug_bitfield["{$permissiongroup}"] = convert_bits_to_array($usergroup["{$permissiongroup}"], $fields);
if (array_key_exists($permissiongroup, $usergroup_org)) {
$usergroup_org[$permissiongroup] = convert_bits_to_array($usergroup_org["{$permissiongroup}"], $fields);
}
}
try {
$channelPerms = vB_ChannelPermission::instance()->fetchPermissions(1, $usergroup['usergroupid']);
$groupinfo["moderator_permissions"] = array();
$groupinfo["createpermissions"] = array();
if (!empty($channelPerms) and !empty($channelPerms[$usergroup['usergroupid']])) {
$channelPerms = $channelPerms[$usergroup['usergroupid']];
foreach (array('edit_time', 'require_moderate', 'maxtags', 'maxstartertags', 'maxothertags', 'maxattachments') as $field) {
$usergroup[$field] = $channelPerms[$field];
}
$ug_bitfield['createpermissions'] = $usergroup['moderator_permissions'] = array();
foreach ($channelPerms['bitfields']['createpermissions'] as $createPerm) {
if ($createPerm['used']) {
$ug_bitfield['createpermissions'][$createPerm['name']] = $createPerm['set'];
示例11: fetch_forum_permissions
}
}
$getperms = fetch_forum_permissions($usergroupid, $forumid);
construct_hidden_code('forumpermission[usergroupid]', $usergroupid);
construct_hidden_code('forumid', $forumid);
} else {
$getperms = $db->query_first("\n\t\t\tSELECT *\n\t\t\tFROM " . TABLE_PREFIX . "forumpermission\n\t\t\tWHERE forumpermissionid = {$forumpermissionid}\n\t\t");
if (!$getperms) {
print_table_footer();
print_stop_message('invalid_forum_permissions_specified');
}
$usergroup['title'] = $vbulletin->usergroupcache["{$getperms['usergroupid']}"]['title'];
$forum['title'] = $vbulletin->forumcache["{$getperms['forumid']}"]['title'];
construct_hidden_code('forumpermissionid', $forumpermissionid);
}
$forumpermission = convert_bits_to_array($getperms['forumpermissions'], $vbulletin->bf_ugp_forumpermissions);
print_table_header(construct_phrase($vbphrase['edit_forum_permissions_for_usergroup_x_in_forum_y'], $usergroup['title'], $forum['title']));
print_description_row('
<label for="uug_1"><input type="radio" name="useusergroup" value="1" id="uug_1" onclick="this.form.reset(); this.checked=true;"' . iif(empty($forumpermissionid), ' checked="checked"') . ' />' . $vbphrase['use_default_permissions'] . '</label>
<br />
<label for="uug_0"><input type="radio" name="useusergroup" value="0" id="uug_0"' . iif(!empty($forumpermissionid), ' checked="checked"') . ' />' . $vbphrase['use_custom_permissions'] . '</label>
', 0, 2, 'tfoot', '', 'mode');
print_table_break();
print_forum_permission_rows($vbphrase['edit_forum_permissions'], $forumpermission, 'js_set_custom();');
print_submit_row($vbphrase['save']);
}
// ###################### Start do update #######################
if ($_POST['do'] == 'doupdate') {
$vbulletin->input->clean_array_gpc('p', array('forumpermissionid' => TYPE_INT, 'forumpermission' => TYPE_ARRAY_INT, 'useusergroup' => TYPE_INT, 'forumid' => TYPE_INT));
if (!$vbulletin->GPC['forumpermissionid']) {
$forum_perms = $db->query_first("\n\t\t\tSELECT forumpermissionid\n\t\t\tFROM " . TABLE_PREFIX . "forumpermission\n\t\t\tWHERE usergroupid = " . $vbulletin->GPC['forumpermission']['usergroupid'] . "\n\t\t\t\tAND forumid = " . $vbulletin->GPC['forumid']);
示例12: prepare_output
/**
* Prepare any data needed for the output
*
* @param string The id of the block
* @param array Options specific to the block
*/
function prepare_output($id = '', $options = array())
{
global $show, $vbphrase, $messagearea, $vBeditTemplate;
require_once DIR . '/includes/functions_visitormessage.php';
require_once DIR . '/includes/class_bbcode.php';
require_once DIR . '/includes/class_visitormessage.php';
if (is_array($options)) {
$options = array_merge($this->option_defaults, $options);
} else {
$options = $this->option_defaults;
}
if ($options['vmid']) {
$messageinfo = verify_visitormessage($options['vmid'], false);
}
$state = array('visible');
if (fetch_visitor_message_perm('canmoderatevisitormessages', $this->profile->userinfo)) {
$state[] = 'moderation';
}
if (can_moderate(0, 'canmoderatevisitormessages') or $this->registry->userinfo['userid'] == $this->profile->userinfo['userid'] and $this->registry->userinfo['permissions']['visitormessagepermissions'] & $this->registry->bf_ugp_visitormessagepermissions['canmanageownprofile']) {
$state[] = 'deleted';
$deljoinsql = "LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON (visitormessage.vmid = deletionlog.primaryid AND deletionlog.type = 'visitormessage')";
} else {
$deljoinsql = '';
}
$state_or = array("visitormessage.state IN ('" . implode("','", $state) . "')");
// Get the viewing user's moderated posts
if ($this->registry->userinfo['userid'] and !fetch_visitor_message_perm('canmoderatevisitormessages', $this->profile->userinfo)) {
$state_or[] = "(visitormessage.postuserid = " . $this->registry->userinfo['userid'] . " AND state = 'moderation')";
}
$perpage = (!$options['perpage'] or $options['perpage'] > $this->registry->options['vm_maxperpage']) ? $this->registry->options['vm_perpage'] : $options['perpage'];
if ($messageinfo['vmid']) {
$getpagenum = $this->registry->db->query_first("\n\t\t\t\tSELECT COUNT(*) AS comments\n\t\t\t\tFROM " . TABLE_PREFIX . "visitormessage AS visitormessage\n\t\t\t\tWHERE userid = " . $this->profile->userinfo['userid'] . "\n\t\t\t\t\tAND (" . implode(" OR ", $state_or) . ")\n\t\t\t\t\tAND dateline >= {$messageinfo['dateline']}\n\t\t\t");
$options['pagenumber'] = ceil($getpagenum['comments'] / $perpage);
}
$pagenumber = $options['pagenumber'];
do {
if (!$pagenumber or $options['tab'] != $id and $options['tab'] != '') {
$pagenumber = 1;
}
$start = ($pagenumber - 1) * $perpage;
$hook_query_fields = $hook_query_joins = $hook_query_where = '';
($hook = vBulletinHook::fetch_hook('member_profileblock_visitormessage_query')) ? eval($hook) : false;
if ($this->registry->options['globalignore'] != '') {
if (!can_moderate(0, 'candeletevisitormessages') and !can_moderate(0, 'canremovevisitormessages')) {
require_once DIR . '/includes/functions_bigthree.php';
$coventry = fetch_coventry('string');
}
}
$messagebits = '';
$messages = $this->registry->db->query_read("\n\t\t\t\tSELECT " . (!isset($this->profile->prepared['vm_total']) ? "SQL_CALC_FOUND_ROWS" : "") . "\n\t\t\t\t\tvisitormessage.*, user.*, visitormessage.ipaddress AS messageipaddress\n\t\t\t\t\t" . ($this->registry->userinfo['userid'] ? ",IF(userlist.userid IS NOT NULL, 1, 0) AS bbuser_iscontact_of_user" : "") . "\n\t\t\t\t\t" . ($deljoinsql ? ",deletionlog.userid AS del_userid, deletionlog.username AS del_username, deletionlog.reason AS del_reason" : "") . "\n\t\t\t\t\t" . ($this->registry->options['avatarenabled'] ? ",avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline,customavatar.width AS avwidth,customavatar.height AS avheight, customavatar.width_thumb AS avwidth_thumb, customavatar.height_thumb AS avheight_thumb, filedata_thumb, NOT ISNULL(customavatar.userid) AS hascustom" : "") . "\n\t\t\t\t\t{$hook_query_fields}\n\t\t\t\tFROM " . TABLE_PREFIX . "visitormessage AS visitormessage\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (visitormessage.postuserid = user.userid)\n\t\t\t\t" . ($this->registry->userinfo['userid'] ? "LEFT JOIN " . TABLE_PREFIX . "userlist AS userlist ON (userlist.userid = user.userid AND userlist.type = 'buddy' AND userlist.relationid = " . $this->registry->userinfo['userid'] . ")" : "") . "\n\t\t\t\t" . ($this->registry->options['avatarenabled'] ? "LEFT JOIN " . TABLE_PREFIX . "avatar AS avatar ON(avatar.avatarid = user.avatarid) LEFT JOIN " . TABLE_PREFIX . "customavatar AS customavatar ON(customavatar.userid = user.userid)" : "") . "\n\t\t\t\t{$deljoinsql}\n\t\t\t\t{$hook_query_joins}\n\t\t\t\tWHERE visitormessage.userid = " . $this->profile->userinfo['userid'] . "\n\t\t\t\t\tAND (" . implode(" OR ", $state_or) . ")\n\t\t\t\t" . ($coventry ? "AND visitormessage.postuserid NOT IN (" . $coventry . ")" : '') . "\n\t\t\t\t\t{$hook_query_where}\n\t\t\t\tORDER BY visitormessage.dateline DESC\n\t\t\t\tLIMIT {$start}, {$perpage}\n\t\t\t");
if (!isset($this->profile->prepared['vm_total'])) {
list($messagetotal) = $this->registry->db->query_first("SELECT FOUND_ROWS()", DBARRAY_NUM);
} else {
$messagetotal = $this->profile->prepared['vm_total'];
}
if ($start >= $messagetotal) {
$pagenumber = ceil($messagetotal / $perpage);
}
} while ($start >= $messagetotal and $messagetotal);
$this->block_data['messagestart'] = $start + 1;
$this->block_data['messageend'] = min($start + $perpage, $messagetotal);
$bbcode = new vB_BbCodeParser($this->registry, fetch_tag_list());
$factory = new vB_Visitor_MessageFactory($this->registry, $bbcode, $this->profile->userinfo);
$messagebits = '';
if ($this->registry->userinfo['userid'] and empty($options['showignored'])) {
$ignorelist = preg_split('/( )+/', trim($this->registry->userinfo['ignorelist']), -1, PREG_SPLIT_NO_EMPTY);
} else {
$ignorelist = array();
}
$firstrecord = array();
$read_ids = array();
while ($message = $this->registry->db->fetch_array($messages)) {
// Process user.options
$message = array_merge($message, convert_bits_to_array($message['options'], $this->registry->bf_misc_useroptions));
if (!$firstrecord) {
$firstrecord = $message;
}
if ($ignorelist and in_array($message['postuserid'], $ignorelist)) {
$message['ignored'] = true;
}
if (empty($options['showignored']) and in_coventry($message['postuserid'])) {
$message['ignored'] = true;
}
$response_handler =& $factory->create($message);
$response_handler->converse = true;
if (!$message['vm_enable'] and (!can_moderate(0, 'canmoderatevisitormessages') or $this->registry->userinfo['userid'] == $message['postuserid']) or $message['vm_contactonly'] and !can_moderate(0, 'canmoderatevisitormessages') and $message['postuserid'] != $this->registry->userinfo['userid'] and !$message['bbuser_iscontact_of_user']) {
$response_handler->converse = false;
}
$response_handler->cachable = false;
$messagebits .= $response_handler->construct();
if (!$message['messageread'] and $message['state'] == 'visible') {
$read_ids[] = $message['vmid'];
}
$lastcomment = !$lastcomment ? $message['dateline'] : $lastcomment;
//.........这里部分代码省略.........
示例13: unset
unset($photoplog_permissions);
$photoplog_perm_denied = array();
$photoplog_perm_allowed = array();
$photoplog_inline_bits = array();
foreach ($photoplog_perm_membergroups_array as $photoplog_perm_membergroup_groupid) {
foreach ($photoplog_list_relatives as $photoplog_list_relatives_catid => $photoplog_list_relatives_array) {
if (!isset($photoplog_inline_bits[$photoplog_list_relatives_catid])) {
$photoplog_inline_bits[$photoplog_list_relatives_catid] = 0;
}
if ($photoplog_list_relatives_catid != '-1' && $photoplog_current_results[$photoplog_perm_membergroup_groupid][$photoplog_list_relatives_catid]) {
$photoplog_cat_mod_opt = intval($photoplog_current_results[$photoplog_perm_membergroup_groupid][$photoplog_list_relatives_catid]['options']);
$photoplog_cat_mod_val = $photoplog_cat_mod_opt % 2;
if ($photoplog_cat_mod_val == 0) {
$photoplog_perm_denied[] = intval($photoplog_list_relatives_catid);
} else {
$photoplog_cat_mod_arr = convert_bits_to_array($photoplog_cat_mod_opt, $photoplog_categoryoptpermissions);
if (defined('PHOTOPLOG_THIS_SCRIPT') && PHOTOPLOG_THIS_SCRIPT == 'categories' && ($_REQUEST['do'] == 'suggest' && !$photoplog_cat_mod_arr['cansuggestcategories'] || $_REQUEST['do'] == 'create' && !$photoplog_cat_mod_arr['cancreateunmoderatedcategories'])) {
$photoplog_perm_denied[] = intval($photoplog_list_relatives_catid);
} else {
if (defined('PHOTOPLOG_THIS_SCRIPT') && PHOTOPLOG_THIS_SCRIPT == 'edit' && !$photoplog_cat_mod_arr['canuploadfiles']) {
if ($photoplog_perm_catid != $photoplog_list_relatives_catid) {
$photoplog_perm_denied[] = intval($photoplog_list_relatives_catid);
} else {
$photoplog_perm_allowed[] = intval($photoplog_list_relatives_catid);
$photoplog_inline_temp = intval($photoplog_current_results[$photoplog_perm_membergroup_groupid][$photoplog_list_relatives_catid]['options']);
$photoplog_inline_bits[$photoplog_list_relatives_catid] = $photoplog_inline_bits[$photoplog_list_relatives_catid] | $photoplog_inline_temp;
}
} else {
if (defined('PHOTOPLOG_THIS_SCRIPT') && PHOTOPLOG_THIS_SCRIPT == 'search' && !$photoplog_cat_mod_arr['canusesearchfeature']) {
$photoplog_perm_denied[] = intval($photoplog_list_relatives_catid);
} else {
示例14: cache_user_subscriptions
/**
* Caches the subscriptions from the database into an array
*/
function cache_user_subscriptions()
{
if (empty($this->subscriptioncache)) {
$permissions = $this->registry->db->query_read_slave("\n\t\t\t\tSELECT subscriptionid, usergroupid\n\t\t\t\tFROM " . TABLE_PREFIX . "subscriptionpermission\n\t\t\t");
$permcache = array();
while ($perm = $this->registry->db->fetch_array($permissions)) {
$permcache["{$perm['subscriptionid']}"]["{$perm['usergroupid']}"] = $perm['usergroupid'];
}
$subscriptions = $this->registry->db->query_read_slave("SELECT * FROM " . TABLE_PREFIX . "subscription ORDER BY displayorder");
while ($subscription = $this->registry->db->fetch_array($subscriptions)) {
$subscription = array_merge($subscription, convert_bits_to_array($subscription['adminoptions'], $this->registry->bf_misc_adminoptions));
if (!empty($permcache["{$subscription['subscriptionid']}"])) {
$subscription['deniedgroups'] = $permcache["{$subscription['subscriptionid']}"];
}
$this->subscriptioncache["{$subscription['subscriptionid']}"] = $subscription;
}
unset($permcache);
$this->registry->db->free_result($subscriptions);
$this->registry->db->free_result($permissions);
}
}
示例15: fetchDefaultData
/**
* Fetch default usergroup data for adding or editing new usergroup
*
* @param int $usergroupid If present, the data will be copied from this usergroup
* @return array Default usergroup data. It contains four sub-arrays:
* 'usergroup' - Basic usergroup information
* 'ugarr' - usergroups to be used for 'Create Forum Permissions Based off of Usergroup'
* 'ug_bitfield' - Usergroup bitfield
* 'groupinfo' - Usergroup permission information
*/
public function fetchDefaultData($usergroupid = 0)
{
$this->checkHasAdminPermission('canadminpermissions');
$bf_ugp = vB::getDatastore()->get_value('bf_ugp');
require_once DIR . '/includes/class_bitfield_builder.php';
$myobj =& vB_Bitfield_Builder::init();
if ($usergroupid) {
$usergroup = vB::getDbAssertor()->getRow('usergroup', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_TABLE, vB_dB_Query::CONDITIONS_KEY => array('usergroupid' => $usergroupid)));
$ug_bitfield = array();
foreach ($bf_ugp as $permissiongroup => $fields) {
$ug_bitfield["{$permissiongroup}"] = convert_bits_to_array($usergroup["{$permissiongroup}"], $fields);
}
} else {
$ug_bitfield = array('genericoptions' => array('showgroup' => 1, 'showeditedby' => 1, 'isnotbannedgroup' => 1), 'forumpermissions' => array('canview' => 1, 'canviewothers' => 1, 'cangetattachment' => 1, 'cansearch' => 1, 'canthreadrate' => 1, 'canpostattachment' => 1, 'canpostpoll' => 1, 'canvote' => 1, 'canviewthreads' => 1), 'forumpermissions2' => array('cangetimgattachment' => 1), 'wolpermissions' => array('canwhosonline' => 1), 'genericpermissions' => array('canviewmembers' => 1, 'canmodifyprofile' => 1, 'canseeprofilepic' => 1, 'canusesignature' => 1, 'cannegativerep' => 1, 'canuserep' => 1, 'cansearchft_nl' => 1));
// set default numeric permissions
$usergroup = array('pmquota' => 0, 'pmsendmax' => 5, 'attachlimit' => 1000000, 'avatarmaxwidth' => 200, 'avatarmaxheight' => 200, 'avatarmaxsize' => 20000, 'profilepicmaxwidth' => 100, 'profilepicmaxheight' => 100, 'profilepicmaxsize' => 25000, 'sigmaxsizebbcode' => 7);
}
$permgroups = vB::getDbAssertor()->assertQuery('usergroup_fetchperms', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_STORED));
$ugarr = array();
foreach ($permgroups as $group) {
$ugarr["{$group['usergroupid']}"] = $group['title'];
}
foreach ((array) $myobj->data['ugp'] as $grouptitle => $perms) {
if ($grouptitle == 'createpermissions') {
continue;
}
foreach ($perms as $permtitle => $permvalue) {
if (empty($permvalue['group'])) {
continue;
}
$groupinfo["{$permvalue['group']}"]["{$permtitle}"] = array('phrase' => $permvalue['phrase'], 'value' => $permvalue['value'], 'parentgroup' => $grouptitle);
if ($permvalue['intperm']) {
$groupinfo["{$permvalue['group']}"]["{$permtitle}"]['intperm'] = true;
}
if (!empty($myobj->data['layout']["{$permvalue['group']}"]['ignoregroups'])) {
$groupinfo["{$permvalue['group']}"]['ignoregroups'] = $myobj->data['layout']["{$permvalue['group']}"]['ignoregroups'];
}
if (!empty($permvalue['ignoregroups'])) {
$groupinfo["{$permvalue['group']}"]["{$permtitle}"]['ignoregroups'] = $permvalue['ignoregroups'];
}
if (!empty($permvalue['options'])) {
$groupinfo["{$permvalue['group']}"]["{$permtitle}"]['options'] = $permvalue['options'];
}
}
}
return array('usergroup' => $usergroup, 'ug_bitfield' => $ug_bitfield, 'ugarr' => $ugarr, 'groupinfo' => $groupinfo);
}