本文整理匯總了PHP中vB_Bitfield_Builder::fetch_errors方法的典型用法代碼示例。如果您正苦於以下問題:PHP vB_Bitfield_Builder::fetch_errors方法的具體用法?PHP vB_Bitfield_Builder::fetch_errors怎麽用?PHP vB_Bitfield_Builder::fetch_errors使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vB_Bitfield_Builder
的用法示例。
在下文中一共展示了vB_Bitfield_Builder::fetch_errors方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: define
if (empty($_REQUEST['do'])) {
$_REQUEST['do'] = 'modify';
}
// ###################### Start add / edit moderator #######################
if ($_REQUEST['do'] == 'add' or $_REQUEST['do'] == 'edit' or $_REQUEST['do'] == 'editglobal') {
require_once DIR . '/includes/class_bitfield_builder.php';
if (vB_Bitfield_Builder::build(false) !== false) {
$myobj =& vB_Bitfield_Builder::init();
if (sizeof($myobj->data['misc']['moderatorpermissions']) != sizeof($vbulletin->bf_misc_moderatorpermissions) or sizeof($myobj->data['misc']['moderatorpermissions2']) != sizeof($vbulletin->bf_misc_moderatorpermissions2)) {
$myobj->save($db);
define('CP_REDIRECT', $vbulletin->scriptpath);
print_stop_message('rebuilt_bitfields_successfully');
}
} else {
echo "<strong>error</strong>\n";
print_r(vB_Bitfield_Builder::fetch_errors());
}
if ($_REQUEST['do'] == 'editglobal') {
$moderator = $db->query_first("\n\t\t\tSELECT user.username, user.userid,\n\t\t\tmoderator.forumid, moderator.permissions, moderator.permissions2, moderator.moderatorid\n\t\t\tFROM " . TABLE_PREFIX . "user AS user\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "moderator AS moderator ON (moderator.userid = user.userid AND moderator.forumid = -1)\n\t\t\tWHERE user.userid = " . $vbulletin->GPC['userid']);
print_form_header('moderator', 'update');
construct_hidden_code('forumid', '-1');
construct_hidden_code('modusername', $moderator['username'], false);
$username = $moderator['username'];
log_admin_action('username = ' . $moderator['username']);
if (empty($moderator['moderatorid'])) {
// this user doesn't have a record for super mod permissions, which is equivalent to having them all (except the email perms)
$globalperms['permissions'] = array_sum($vbulletin->bf_misc_moderatorpermissions) - ($vbulletin->bf_misc_moderatorpermissions['newthreademail'] + $vbulletin->bf_misc_moderatorpermissions['newpostemail']);
$globalperms['permissions2'] = array_sum($vbulletin->bf_misc_moderatorpermissions2);
$moderator = convert_bits_to_array($globalperms['permissions'], $vbulletin->bf_misc_moderatorpermissions);
$perms2 = convert_bits_to_array($globalperms['permissions2'], $vbulletin->bf_misc_moderatorpermissions2);
$moderator['username'] = $username;
示例2: fetch_permission_group
/**
* Fetches an array from the specified permission group (within the ugp tag).
* Note that if you specify an invalid name or the group can't be built
* errors will be printed. Intperms and non-sub-grouped fields will be ignored.
*
* @param string Name of group to fetch.
*
* @return array [subgroup][permtitle] => array(phrase => str, value => int)
*/
function fetch_permission_group($permgroup)
{
$output = array();
$obj =& vB_Bitfield_Builder::init();
if (vB_Bitfield_Builder::build(false) === false) {
echo "<strong>error</strong>\n";
print_r(vB_Bitfield_Builder::fetch_errors());
return $output;
} else {
if (empty($obj->data['ugp']["{$permgroup}"])) {
echo "<strong>error</strong>\n";
echo 'No Data';
return $output;
}
}
foreach ($obj->data['ugp']["{$permgroup}"] as $permtitle => $permvalue) {
if ($permvalue['intperm'] or empty($permvalue['group'])) {
continue;
} else {
$output["{$permvalue['group']}"]["{$permtitle}"] = array('phrase' => $permvalue['phrase'], 'value' => $permvalue['value']);
}
}
return $output;
}
示例3: print_setting_row
/**
* Prints a setting row for use in options.php?do=options
*
* @param array Settings array
* @param array Phrases
*/
function print_setting_row($setting, $settingphrase, $option_config = true)
{
global $vbulletin, $vbphrase, $bgcounter, $settingphrase;
$settingid = $setting['varname'];
echo '<tbody>';
print_description_row(iif($vbulletin->debug and $option_config, '<div class="smallfont" style="float:' . vB_Template_Runtime::fetchStyleVar('right') . '">' . construct_link_code($vbphrase['edit'], "options.php?" . $vbulletin->session->vars['sessionurl'] . "do=editsetting&varname={$setting['varname']}") . construct_link_code($vbphrase['delete'], "options.php?" . $vbulletin->session->vars['sessionurl'] . "do=removesetting&varname={$setting['varname']}") . '</div>') . '<div>' . $settingphrase["setting_{$setting['varname']}_title"] . "<a name=\"{$setting['varname']}\"></a></div>", 0, 2, 'optiontitle' . ($vbulletin->debug ? "\" title=\"\$vbulletin->options['" . $setting['varname'] . "']" : ''));
echo "</tbody><tbody id=\"tbody_{$settingid}\">\r\n";
// make sure all rows use the alt1 class
$bgcounter--;
$description = "<div class=\"smallfont\"" . ($vbulletin->debug ? "title=\"\$vbulletin->options['{$setting['varname']}']\"" : '') . ">" . $settingphrase["setting_{$setting['varname']}_desc"] . '</div>';
$name = "setting[{$setting['varname']}]";
$right = "<span class=\"smallfont\">{$vbphrase['error']}</span>";
$width = 40;
$rows = 8;
if (preg_match('#^input:?(\\d+)$#s', $setting['optioncode'], $matches)) {
$width = $matches[1];
$setting['optioncode'] = '';
} else {
if (preg_match('#^textarea:?(\\d+)(,(\\d+))?$#s', $setting['optioncode'], $matches)) {
$rows = $matches[1];
if ($matches[2]) {
$width = $matches[3];
}
$setting['optioncode'] = 'textarea';
} else {
if (preg_match('#^bitfield:(.*)$#siU', $setting['optioncode'], $matches)) {
$setting['optioncode'] = 'bitfield';
$setting['bitfield'] =& fetch_bitfield_definitions($matches[1]);
} else {
if (preg_match('#^(select|selectmulti|radio):(piped|eval)(\\r\\n|\\n|\\r)(.*)$#siU', $setting['optioncode'], $matches)) {
$setting['optioncode'] = "{$matches['1']}:{$matches['2']}";
$setting['optiondata'] = trim($matches[4]);
} else {
if (preg_match('#^usergroup:?(\\d+)$#s', $setting['optioncode'], $matches)) {
$size = intval($matches[1]);
$setting['optioncode'] = 'usergroup';
} else {
if (preg_match('#^(usergroupextra)(\\r\\n|\\n|\\r)(.*)$#siU', $setting['optioncode'], $matches)) {
$setting['optioncode'] = 'usergroupextra';
$setting['optiondata'] = trim($matches[3]);
} else {
if (preg_match('#^profilefield:?([a-z0-9,;=]*)(?:\\r\\n|\\n|\\r)(.*)$#siU', $setting['optioncode'], $matches)) {
$setting['optioncode'] = 'profilefield';
$setting['optiondata'] = array('constraints' => trim($matches[1]), 'extraoptions' => trim($matches[2]));
} else {
if (preg_match('#^apipostidmanage(?:\\r\\n|\\n|\\r)(.*)$#siU', $setting['optioncode'], $matches)) {
$setting['optioncode'] = 'apipostidmanage';
$setting['optiondata'] = preg_split("#(\r\n|\n|\r)#s", $matches[1], -1, PREG_SPLIT_NO_EMPTY);
}
}
}
}
}
}
}
}
switch ($setting['optioncode']) {
// input type="text"
case '':
print_input_row($description, $name, $setting['value'], 1, $width);
break;
// input type="radio"
// input type="radio"
case 'yesno':
print_yes_no_row($description, $name, $setting['value']);
break;
// textarea
// textarea
case 'textarea':
print_textarea_row($description, $name, $setting['value'], $rows, "{$width}\" style=\"width:90%");
break;
// bitfield
// bitfield
case 'bitfield':
$setting['value'] = intval($setting['value']);
$setting['html'] = '';
if ($setting['bitfield'] === NULL) {
print_label_row($description, construct_phrase("<strong>{$vbphrase['settings_bitfield_error']}</strong>", implode(',', vB_Bitfield_Builder::fetch_errors())), '', 'top', $name, 40);
} else {
#$setting['html'] .= "<fieldset><legend>$vbphrase[yes] / $vbphrase[no]</legend>";
$setting['html'] .= "<div id=\"ctrl_setting[{$setting['varname']}]\" class=\"smallfont\">\r\n";
$setting['html'] .= "<input type=\"hidden\" name=\"setting[{$setting['varname']}][0]\" value=\"0\" />\r\n";
foreach ($setting['bitfield'] as $key => $value) {
$value = intval($value);
$setting['html'] .= "<table style=\"width:175px; float:" . vB_Template_Runtime::fetchStyleVar('left') . "\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr valign=\"top\">\n\t\t\t\t\t<td><input type=\"checkbox\" name=\"setting[{$setting['varname']}][{$value}]\" id=\"setting[{$setting['varname']}]_{$key}\" value=\"{$value}\"" . ($setting['value'] & $value ? ' checked="checked"' : '') . " /></td>\n\t\t\t\t\t<td width=\"100%\" style=\"padding-top:4px\"><label for=\"setting[{$setting['varname']}]_{$key}\" class=\"smallfont\">" . fetch_phrase_from_key($key) . "</label></td>\r\n</tr></table>\r\n";
}
$setting['html'] .= "</div>\r\n";
#$setting['html'] .= "</fieldset>";
print_label_row($description, $setting['html'], '', 'top', $name, 40);
}
break;
// select:piped
// select:piped
case 'select:piped':
//.........這裏部分代碼省略.........
示例4: print_setting_row
/**
* Prints a setting row for use in options.php?do=options
*
* @param array Settings array
* @param array Phrases
*/
function print_setting_row($setting, $settingphrase)
{
global $vbulletin, $vbphrase, $bgcounter, $settingphrase, $stylevar;
$settingid = $setting['varname'];
echo '<tbody>';
print_description_row(iif($vbulletin->debug, '<div class="smallfont" style="float:' . $stylevar['right'] . '">' . construct_link_code($vbphrase['edit'], "options.php?" . $vbulletin->session->vars['sessionurl'] . "do=editsetting&varname={$setting['varname']}") . construct_link_code($vbphrase['delete'], "options.php?" . $vbulletin->session->vars['sessionurl'] . "do=removesetting&varname={$setting['varname']}") . '</div>') . '<div>' . $settingphrase["setting_{$setting['varname']}_title"] . "<a name=\"{$setting['varname']}\"></a></div>", 0, 2, 'optiontitle' . ($vbulletin->debug ? "\" title=\"\$vbulletin->options['" . $setting['varname'] . "']" : ''));
echo "</tbody><tbody id=\"tbody_{$settingid}\">\r\n";
// make sure all rows use the alt1 class
$bgcounter--;
$description = "<div class=\"smallfont\"" . ($vbulletin->debug ? "title=\"\$vbulletin->options['{$setting['varname']}']\"" : '') . ">" . $settingphrase["setting_{$setting['varname']}_desc"] . '</div>';
$name = "setting[{$setting['varname']}]";
$right = "<span class=\"smallfont\">{$vbphrase['error']}</span>";
$width = 40;
$rows = 8;
if (preg_match('#^input:?(\\d+)$#s', $setting['optioncode'], $matches)) {
$width = $matches[1];
$setting['optioncode'] = '';
} else {
if (preg_match('#^textarea:?(\\d+)(,(\\d+))?$#s', $setting['optioncode'], $matches)) {
$rows = $matches[1];
if ($matches[2]) {
$width = $matches[3];
}
$setting['optioncode'] = 'textarea';
} else {
if (preg_match('#^bitfield:(.*)$#siU', $setting['optioncode'], $matches)) {
$setting['optioncode'] = 'bitfield';
$setting['bitfield'] =& fetch_bitfield_definitions($matches[1]);
} else {
if (preg_match('#^(select|radio):(piped|eval)(\\r\\n|\\n|\\r)(.*)$#siU', $setting['optioncode'], $matches)) {
$setting['optioncode'] = "{$matches['1']}:{$matches['2']}";
$setting['optiondata'] = trim($matches[4]);
} else {
if (preg_match('#^usergroup:?(\\d+)$#s', $setting['optioncode'], $matches)) {
$size = intval($matches[1]);
$setting['optioncode'] = 'usergroup';
} else {
if (preg_match('#^(usergroupextra)(\\r\\n|\\n|\\r)(.*)$#siU', $setting['optioncode'], $matches)) {
$setting['optioncode'] = 'usergroupextra';
$setting['optiondata'] = trim($matches[3]);
}
}
}
}
}
}
switch ($setting['optioncode']) {
// input type="text"
case '':
print_input_row($description, $name, $setting['value'], 1, $width);
break;
// input type="radio"
// input type="radio"
case 'yesno':
print_yes_no_row($description, $name, $setting['value']);
break;
// textarea
// textarea
case 'textarea':
print_textarea_row($description, $name, $setting['value'], $rows, "{$width}\" style=\"width:90%");
break;
// bitfield
// bitfield
case 'bitfield':
$setting['value'] = intval($setting['value']);
$setting['html'] = '';
if ($setting['bitfield'] === NULL) {
print_label_row($description, construct_phrase("<strong>{$vbphrase['settings_bitfield_error']}</strong>", implode(',', vB_Bitfield_Builder::fetch_errors())), '', 'top', $name, 40);
} else {
#$setting['html'] .= "<fieldset><legend>$vbphrase[yes] / $vbphrase[no]</legend>";
$setting['html'] .= "<div id=\"ctrl_setting[{$setting['varname']}]\" class=\"smallfont\">\r\n";
$setting['html'] .= "<input type=\"hidden\" name=\"setting[{$setting['varname']}][0]\" value=\"0\" />\r\n";
foreach ($setting['bitfield'] as $key => $value) {
$value = intval($value);
$setting['html'] .= "<table style=\"width:175px; float:{$stylevar['left']}\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr valign=\"top\">\n\t\t\t\t\t<td><input type=\"checkbox\" name=\"setting[{$setting['varname']}][{$value}]\" id=\"setting[{$setting['varname']}]_{$key}\" value=\"{$value}\"" . ($setting['value'] & $value ? ' checked="checked"' : '') . " /></td>\n\t\t\t\t\t<td width=\"100%\" style=\"padding-top:4px\"><label for=\"setting[{$setting['varname']}]_{$key}\" class=\"smallfont\">" . fetch_phrase_from_key($key) . "</label></td>\r\n</tr></table>\r\n";
}
$setting['html'] .= "</div>\r\n";
#$setting['html'] .= "</fieldset>";
print_label_row($description, $setting['html'], '', 'top', $name, 40);
}
break;
// select:piped
// select:piped
case 'select:piped':
print_select_row($description, $name, fetch_piped_options($setting['optiondata']), $setting['value']);
break;
// radio:piped
// radio:piped
case 'radio:piped':
print_radio_row($description, $name, fetch_piped_options($setting['optiondata']), $setting['value'], 'smallfont');
break;
// select:eval
// select:eval
case 'select:eval':
//.........這裏部分代碼省略.........
示例5: print_setting_row
/**
* Prints a setting row for use in options.php?do=options
*
* @param array Settings array
* @param array Phrases
*/
function print_setting_row($setting, $settingphrase, $option_config = true, $userContext = false)
{
global $vbulletin, $bgcounter, $vbphrase;
$settingid = $setting['varname'];
if (empty($userContext)) {
$userContext = vB::getUserContext();
}
echo '<tbody>';
$vb5_config = vB::getConfig();
print_description_row(iif($vb5_config['Misc']['debug'] and $option_config and $userContext->hasAdminPermission('canadminsettingsall'), '<div class="smallfont" style="float:' . vB_Template_Runtime::fetchStyleVar('right') . '">' . construct_link_code($vbphrase['edit'], "options.php?" . vB::getCurrentSession()->get('sessionurl') . "do=editsetting&varname={$setting['varname']}") . construct_link_code($vbphrase['delete'], "options.php?" . vB::getCurrentSession()->get('sessionurl') . "do=removesetting&varname={$setting['varname']}") . '</div>') . '<div>' . $settingphrase["setting_{$setting['varname']}_title"] . "<a name=\"{$setting['varname']}\"></a></div>", 0, 2, 'optiontitle' . ($vb5_config['Misc']['debug'] ? "\" title=\"\$vbulletin->options['" . $setting['varname'] . "']" : ''));
echo "</tbody><tbody id=\"tbody_{$settingid}\">\r\n";
// make sure all rows use the alt1 class
$bgcounter--;
$description = "<div class=\"smallfont\"" . ($vb5_config['Misc']['debug'] ? " title=\"\$vbulletin->options['{$setting['varname']}']\"" : '') . ">" . $settingphrase["setting_{$setting['varname']}_desc"] . '</div>';
$name = "setting[{$setting['varname']}]";
$right = "<span class=\"smallfont\">{$vbphrase['error']}</span>";
$width = 40;
$rows = 8;
if (preg_match('#^input:?(\\d+)$#s', $setting['optioncode'], $matches)) {
$width = $matches[1];
$setting['optioncode'] = '';
} else {
if (preg_match('#^textarea:?(\\d+)(,(\\d+))?$#s', $setting['optioncode'], $matches)) {
$rows = $matches[1];
if ($matches[2]) {
$width = $matches[3];
}
$setting['optioncode'] = 'textarea';
} else {
if (preg_match('#^bitfield:(.*)$#siU', $setting['optioncode'], $matches)) {
$setting['optioncode'] = 'bitfield';
$setting['bitfield'] =& fetch_bitfield_definitions($matches[1]);
} else {
if (preg_match('#^(select|selectmulti|radio):(piped|eval)(\\r\\n|\\n|\\r)(.*)$#siU', $setting['optioncode'], $matches)) {
$setting['optioncode'] = "{$matches['1']}:{$matches['2']}";
$setting['optiondata'] = trim($matches[4]);
} else {
if (preg_match('#^usergroup:?(\\d+)$#s', $setting['optioncode'], $matches)) {
$size = intval($matches[1]);
$setting['optioncode'] = 'usergroup';
} else {
if (preg_match('#^(usergroupextra)(\\r\\n|\\n|\\r)(.*)$#siU', $setting['optioncode'], $matches)) {
$setting['optioncode'] = 'usergroupextra';
$setting['optiondata'] = trim($matches[3]);
} else {
if (preg_match('#^profilefield:?([a-z0-9,;=]*)(?:\\r\\n|\\n|\\r)(.*)$#siU', $setting['optioncode'], $matches)) {
$setting['optioncode'] = 'profilefield';
$setting['optiondata'] = array('constraints' => trim($matches[1]), 'extraoptions' => trim($matches[2]));
}
}
}
}
}
}
}
// Make setting's value the default value if it's null
if ($setting['value'] === NULL) {
$setting['value'] = $setting['defaultvalue'];
}
switch ($setting['optioncode']) {
// input type="text"
case '':
print_input_row($description, $name, $setting['value'], 1, $width);
break;
// input type="radio"
// input type="radio"
case 'yesno':
print_yes_no_row($description, $name, $setting['value']);
break;
// textarea
// textarea
case 'textarea':
print_textarea_row($description, $name, $setting['value'], $rows, "{$width}\" style=\"width:90%");
break;
// bitfield
// bitfield
case 'bitfield':
$setting['value'] = intval($setting['value']);
$setting['html'] = '';
if ($setting['bitfield'] === NULL) {
print_label_row($description, construct_phrase("<strong>{$vbphrase['settings_bitfield_error']}</strong>", implode(',', vB_Bitfield_Builder::fetch_errors())), '', 'top', $name, 40);
} else {
#$setting['html'] .= "<fieldset><legend>$vbphrase[yes] / $vbphrase[no]</legend>";
$setting['html'] .= "<div id=\"ctrl_setting[{$setting['varname']}]\" class=\"smallfont\">\r\n";
$setting['html'] .= "<input type=\"hidden\" name=\"setting[{$setting['varname']}][0]\" value=\"0\" />\r\n";
foreach ($setting['bitfield'] as $key => $value) {
$value = intval($value);
$setting['html'] .= "<table style=\"width:175px; float:" . vB_Template_Runtime::fetchStyleVar('left') . "\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr valign=\"top\">\n\t\t\t\t\t<td><input type=\"checkbox\" name=\"setting[{$setting['varname']}][{$value}]\" id=\"setting[{$setting['varname']}]_{$key}\" value=\"{$value}\"" . ($setting['value'] & $value ? ' checked="checked"' : '') . " /></td>\n\t\t\t\t\t<td width=\"100%\" style=\"padding-top:4px\"><label for=\"setting[{$setting['varname']}]_{$key}\" class=\"smallfont\">" . fetch_phrase_from_key($key) . "</label></td>\r\n</tr></table>\r\n";
}
$setting['html'] .= "</div>\r\n";
#$setting['html'] .= "</fieldset>";
print_label_row($description, $setting['html'], '', 'top', $name, 40);
}
break;
//.........這裏部分代碼省略.........