本文整理汇总了PHP中vB_Bitfield_Builder类的典型用法代码示例。如果您正苦于以下问题:PHP vB_Bitfield_Builder类的具体用法?PHP vB_Bitfield_Builder怎么用?PHP vB_Bitfield_Builder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了vB_Bitfield_Builder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
echo "<p> </p></blockquote>";
}
else
{
echo "<blockquote><p> </p>";
echo "$vbphrase[upgrade_wrong_version]";
echo "<p> </p></blockquote>";
print_upgrade_footer();
}
}
// #############################################################################
if ($vbulletin->GPC['step'] == 1)
{
require_once(DIR . '/includes/class_bitfield_builder.php');
vB_Bitfield_Builder::save($db);
$upgrade->add_index(
sprintf($upgrade_phrases['upgrade_300b3.php']['altering_x_table'], 'socialgroup', 1, 4),
'socialgroup',
'visible',
'visible'
);
$upgrade->add_index(
sprintf($upgrade_phrases['upgrade_300b3.php']['altering_x_table'], 'socialgroup', 2, 4),
'socialgroup',
'picturecount',
'picturecount'
);
示例2: 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;
示例3: disable
/**
* Disable a product, not delete
*
*/
public function disable($productid = null)
{
$productid = $productid ? $productid : $this->productinfo['productid'];
$this->db->query_write("\n\t\t\tUPDATE " . TABLE_PREFIX . "product\n\t\t\tSET active = 0\n\t\t\tWHERE productid = '" . $this->db->escape_string($productid) . "'\n\t\t");
vBulletinHook::build_datastore($this->db);
build_product_datastore();
// build bitfields to remove/add this products bitfields
require_once DIR . '/includes/class_bitfield_builder.php';
vB_Bitfield_Builder::save($this->db);
// Products can enable a cron entries, so we need to rebuild that as well
require_once DIR . '/includes/functions_cron.php';
build_cron_next_run();
// Purge cache -- doesn't apply to pre-vB4 versions
if (class_exists('vB_Cache')) {
vB_Cache::instance()->purge('vb_types.types');
}
// Reload blocks and block types -- doesn't apply to pre-vB4 versions
if (class_exists('vB_BlockManager')) {
$blockmanager = vB_BlockManager::create($this->registry);
$blockmanager->reloadBlockTypes();
$blockmanager->getBlocks(true, true);
}
}
示例4: return_data
/**
* Returns a multi-dimensional array of all defined bitfields, including <nocache> and disabled products
*
* $vbulletin->bf_ugp_forumpermissions['canview'] would be returned as $array['ugp']['forumpermissions']['canview']
*
* @return array
*/
function return_data()
{
if (vB_Bitfield_Builder::build(true, true) === false) {
return false;
}
$obj =& vB_Bitfield_Builder::init();
return $obj->data;
}
示例5: print_forum_permission_rows
function print_forum_permission_rows($customword, $forumpermission = array(), $extra = '')
{
global $vbphrase;
print_label_row("<b>{$customword}</b>", '
<input type="button" class="button" value="' . $vbphrase['all_yes'] . '" onclick="' . iif($extra != '', 'if (js_set_custom()) { ') . ' js_check_all_option(this.form, 1);' . iif($extra != '', ' }') . '" class="button" />
<input type="button" class="button" value=" ' . $vbphrase['all_no'] . ' " onclick="' . iif($extra != '', 'if (js_set_custom()) { ') . ' js_check_all_option(this.form, 0);' . iif($extra != '', ' }') . '" class="button" />
<!--<input type="submit" class="button" value="Okay" class="button" />-->
', 'tcat', 'middle');
// Load permissions
require_once DIR . '/includes/class_bitfield_builder.php';
$groupinfo = vB_Bitfield_Builder::fetch_permission_group('forumpermissions');
foreach ($groupinfo as $grouptitle => $group) {
print_table_header($vbphrase["{$grouptitle}"]);
foreach ($group as $permtitle => $permvalue) {
print_yes_no_row($vbphrase["{$permvalue['phrase']}"], "forumpermission[{$permtitle}]", $forumpermission["{$permtitle}"], $extra);
}
//print_table_break();
//print_column_style_code(array('width: 70%', 'width: 30%'));
}
($hook = vBulletinHook::fetch_hook('admin_fperms_form')) ? eval($hook) : false;
}
示例6: implode
}
$vbulletin->input->clean_gpc('r', "num{$group}", vB_Cleaner::TYPE_UINT);
for ($i = 0; $i < $vbulletin->GPC["num{$group}"]; $i++) {
$vbulletin->GPC['navprefs'][] = $group . "_{$i}";
}
}
$vbulletin->GPC['navprefs'] = implode(',', $vbulletin->GPC['navprefs']);
} else {
$vbulletin->GPC['navprefs'] = '';
}
$vbulletin->GPC['navprefs'] = preg_replace('#[^a-z0-9_,]#i', '', $vbulletin->GPC['navprefs']);
$_REQUEST['do'] = 'savenavprefs';
}
if ($_REQUEST['do'] == 'buildbitfields') {
require_once DIR . '/includes/class_bitfield_builder.php';
vB_Bitfield_Builder::save();
build_channel_permissions();
print_stop_message2('rebuilt_bitfields_successfully', 'index');
}
if ($_REQUEST['do'] == 'buildvideo' and (vB::getUserContext()->hasAdminPermission('canadminstyles') or vB::getUserContext()->hasAdminPermission('canadmintemplates'))) {
require_once DIR . '/includes/functions_databuild.php';
build_bbcode_video();
print_cp_header();
vB_Library::instance('style')->buildAllStyles();
print_stop_message2('rebuilt_video_bbcodes_successfully', 'index');
}
if ($_REQUEST['do'] == 'buildnavprefs') {
$vbulletin->input->clean_array_gpc('r', array('prefs' => vB_Cleaner::TYPE_STR, 'dowhat' => vB_Cleaner::TYPE_STR, 'id' => vB_Cleaner::TYPE_INT));
$vbulletin->GPC['prefs'] = preg_replace('#[^a-z0-9_,]#i', '', $vbulletin->GPC['prefs']);
$_tmp = preg_split('#,#', $vbulletin->GPC['prefs'], -1, PREG_SPLIT_NO_EMPTY);
$_navprefs = array();
示例7: convert_bits_to_array
}
$calendarpermission = convert_bits_to_array($getperms['calendarpermissions'], $vbulletin->bf_ugp_calendarpermissions);
print_table_header(construct_phrase($vbphrase['edit_calendar_permissions_for_usergroup_x_in_calendar_y'], $usergroup['title'], $calendar['title']));
print_description_row('
<label for="uug_1"><input type="radio" name="useusergroup" value="1" id="uug_1" tabindex="1" onclick="this.form.reset(); this.checked=true;"' . iif(!$vbulletin->GPC['calendarpermissionid'], ' checked="checked"', '') . ' />' . $vbphrase['use_default_permissions'] . '</label>
<br />
<label for="uug_0"><input type="radio" name="useusergroup" value="0" id="uug_0" tabindex="1"' . iif($vbulletin->GPC['calendarpermissionid'], ' checked="checked"', '') . ' />' . $vbphrase['use_custom_permissions'] . '</label>
', 0, 2, 'tfoot', '', 'mode');
print_table_break();
print_label_row('<b>' . $vbphrase['custom_calendar_permissions'] . '</b>', '
<input type="button" value="' . $vbphrase['all_yes'] . '" onclick="if (js_set_custom()) { js_check_all_option(this.form, 1); }" class="button" />
<input type="button" value=" ' . $vbphrase['all_no'] . ' " onclick="if (js_set_custom()) { js_check_all_option(this.form, 0); }" class="button" />
', 'tcat', 'middle');
// Load permissions
require_once DIR . '/includes/class_bitfield_builder.php';
$groupinfo = vB_Bitfield_Builder::fetch_permission_group('calendarpermissions');
foreach ($groupinfo as $grouptitle => $group) {
print_table_header($vbphrase["{$grouptitle}"]);
foreach ($group as $permtitle => $permvalue) {
print_yes_no_row($vbphrase["{$permvalue['phrase']}"], "calendarpermission[{$permtitle}]", $calendarpermission["{$permtitle}"], 'js_set_custom();');
}
}
print_submit_row($vbphrase['save']);
}
// ###################### Start do update #######################
if ($_POST['do'] == 'doupdate') {
$vbulletin->input->clean_array_gpc('p', array('calendarpermissionid' => TYPE_INT, 'calendarid' => TYPE_INT, 'useusergroup' => TYPE_INT, 'calendarpermission' => TYPE_ARRAY));
define('CP_REDIRECT', "calendarpermission.php?do=modify#calendar" . $vbulletin->GPC['calendarid']);
if ($vbulletin->GPC['useusergroup']) {
// use usergroup defaults. delete calendarpermission if it exists
if ($vbulletin->GPC['calendarpermissionid']) {
示例8: 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);
}
示例9: implode
/**
* Fetches an array describing the bits in the requested bitfield
*
* @param string Represents the array key required... use x|y|z to fetch ['x']['y']['z']
*
* @return array Reference to the requested array from includes/xml/bitfield_{product}.xml
*/
function &fetch_bitfield_definitions($string)
{
static $bitfields = null;
if ($bitfields === null) {
require_once DIR . '/includes/class_bitfield_builder.php';
$bitfields = vB_Bitfield_Builder::return_data();
}
$keys = "['" . implode("']['", preg_split('#\\|#si', $string, -1, PREG_SPLIT_NO_EMPTY)) . "']";
eval('$return =& $bitfields' . $keys . ';');
return $return;
}
示例10: foreach
}
} else {
if (VB_AREA == 'Install') {
// load it up but don't actually call fetch, we need the ability to overwrite fields.
$datastore_class = !empty($vbulletin->config['Datastore']['class']) ? $vbulletin->config['Datastore']['class'] : 'vB_Datastore';
if ($datastore_class != 'vB_Datastore') {
require_once DIR . '/includes/class_datastore.php';
}
$vbulletin->datastore = new $datastore_class($vbulletin, $db);
}
}
// ## Load latest bitfields, overwrite datastore versions (if they exist)
// ## (so latest upgrade script can access any new permissions)
require_once DIR . '/includes/class_bitfield_builder.php';
if (vB_Bitfield_Builder::build_datastore() !== false) {
$myobj =& vB_Bitfield_Builder::init();
require_once DIR . '/includes/functions.php';
require_once DIR . '/includes/functions_misc.php';
foreach (array_keys($myobj->datastore) as $group) {
$vbulletin->{'bf_' . $group} =& $myobj->datastore["{$group}"];
foreach (array_keys($myobj->datastore["{$group}"]) as $subgroup) {
$vbulletin->{'bf_' . $group . '_' . $subgroup} =& $myobj->datastore["{$group}"]["{$subgroup}"];
}
}
} else {
trigger_error('Error Building Bitfields', E_USER_ERROR);
}
}
// setup an empty hook class in case we run some of the main vB code
require_once DIR . '/includes/class_hook.php';
$vbulletin->pluginlist = '';
示例11: array
// fetch the custom perms, row per type this time
$customperms = array();
$customperms_data = $db->query_read("\n\t\t\tSELECT *\n\t\t\tFROM " . TABLE_PREFIX . "pt_projectpermission\n\t\t\tWHERE usergroupid = {$usergroup_info['usergroupid']}\n\t\t\t\tAND projectid = {$project['projectid']}\n\t\t");
while ($customperm = $db->fetch_array($customperms_data)) {
$perms = $customperm;
unset($perms['usergroupid'], $perms['projectid'], $perms['issuetypeid']);
$customperms["{$customperm['issuetypeid']}"] = $perms;
}
} else {
// editing global permissions
print_table_header(construct_phrase($vbphrase['edit_permissions_for_x'], $usergroup_info['title']), sizeof($issuetype_options) + 1);
$customperms = array();
}
require_once DIR . '/includes/class_bitfield_builder.php';
vB_Bitfield_Builder::build(false);
$builder =& vB_Bitfield_Builder::init();
$perms = array();
$has_custom = array();
if (!$project) {
// these are the global-only (settable in one place) permissions for the project tools
print_description_row($vbphrase['global_project_tools_permissions'], false, 4, 'thead');
foreach ($builder->data['ugp']['ptpermissions'] as $bitname => $permvalue) {
$bit = $permvalue['value'];
print_yes_no_row($vbphrase["{$permvalue['phrase']}"], "ugpermissions[{$bit}]", intval($usergroup_info['ptpermissions']) & intval($bit) ? 1 : 0);
}
print_description_row('<span class="smallfont"><a href="#" onclick="js_open_help(\'projectpermission\', \'edit\', \'about_reports\'); return false;">' . $vbphrase['what_are_reports'] . '</a></span>', false, 2, '', 'right');
print_table_break();
print_table_header(construct_phrase($vbphrase['project_tools_permissions_for_x'], $usergroup_info['title']), sizeof($issuetype_options) + 1);
} else {
// project specific -- let's check the general permissions for this group
if (!(intval($usergroup_info['ptpermissions']) & $vbulletin->bf_ugp_ptpermissions['canviewprojecttools'])) {
示例12: step_7
/**
* Step #7 - Default User Setup...
*
*/
function step_7($data = null)
{
if ($data['response']) {
array_map('trim', $data['htmldata']);
$errors = array();
if (empty($data['htmldata']['username'])) {
$errors['username'] = $this->phrase['install']['error_username'];
}
if (empty($data['htmldata']['email']) or !is_valid_email($data['htmldata']['email'])) {
$errors['email'] = $this->phrase['install']['error_email'];
}
if (empty($data['htmldata']['password']) or empty($data['htmldata']['confirmpassword'])) {
if (empty($data['htmldata']['password'])) {
$errors['password'] = $this->phrase['install']['error_password'];
} else {
if (empty($data['htmldata']['confirmpassword'])) {
$errors['confirmpassword'] = $this->phrase['install']['error_confirmpassword'];
}
}
} else {
if ($data['htmldata']['password'] != $data['htmldata']['confirmpassword']) {
$errors['mismatch'] = $this->phrase['install']['error_password_not_match'];
} else {
if ($data['htmldata']['password'] == $data['htmldata']['username'] and !defined('ALLOW_SAME_USERNAME_PASSWORD')) {
$errors['samepasswordasusername'] = $this->phrase['install']['error_same_password_as_username'];
}
}
}
// check if a user already exists. If so, DO NOT CREATE A NEW USER.
$vbexists = $this->fetch_vbexists();
if (!$vbexists) {
$errors[] = $this->phrase['install']['user_table_missing'];
// we can't create a user without a user table.
} else {
// assuming if user table exists, userid will exist. If a user exists, DO NOT CREATE A NEW USER
if ($this->db->query_first("SELECT userid FROM " . trim($this->registry->config['Database']['tableprefix']) . "user LIMIT 1")) {
$errors[] = $this->phrase['install']['user_already_exists'];
}
}
if (empty($errors)) {
require_once DIR . '/includes/class_bitfield_builder.php';
vB_Bitfield_Builder::save($this->db);
$admin_defaults = array('vbasset_enable', 'showsignatures', 'showavatars', 'showimages', 'adminemail', 'dstauto', 'receivepm', 'showusercss', 'receivefriendemailrequest', 'vm_enable');
$admin_useroption = 0;
foreach ($admin_defaults as $bitfield) {
$admin_useroption |= $this->registry->bf_misc_useroptions["{$bitfield}"];
}
require_once DIR . '/includes/functions_user.php';
//for now we'll just include these to get the define for the salt length. Should investigate
//using the DM to add the initial admin user, but there may be issues with doing that without
//a proper user session (which we can't have until we require the user.
require_once DIR . '/includes/class_dm.php';
require_once DIR . '/includes/class_dm_user.php';
$salt = fetch_user_salt(SALT_LENGTH);
/*insert query*/
$this->db->query_write("\n\t\t\t\t\tINSERT INTO " . TABLE_PREFIX . "user\n\t\t\t\t\t\t(username, salt, password, email, usertitle, joindate, lastvisit, lastactivity, usergroupid, passworddate, options, showvbcode)\n\t\t\t\t\tVALUES (\n\t\t\t\t\t\t'" . $this->db->escape_string(htmlspecialchars_uni($data['htmldata']['username'])) . "',\n\t\t\t\t\t\t'" . $this->db->escape_string($salt) . "',\n\t\t\t\t\t\t'" . $this->db->escape_string(md5(md5($data['htmldata']['password']) . $salt)) . "',\n\t\t\t\t\t\t'" . $this->db->escape_string($data['htmldata']['email']) . "',\n\t\t\t\t\t\t'" . $this->db->escape_string($this->phrase['install']['usergroup_admin_usertitle']) . "',\n\t\t\t\t\t\t" . TIMENOW . ",\n\t\t\t\t\t\t" . TIMENOW . ",\n\t\t\t\t\t\t" . TIMENOW . ",\n\t\t\t\t\t\t6,\n\t\t\t\t\t\tFROM_UNIXTIME(" . TIMENOW . "),\n\t\t\t\t\t\t{$admin_useroption},\n\t\t\t\t\t\t2\n\t\t\t\t\t)\n\t\t\t\t");
$userid = $this->db->insert_id();
/*insert query*/
$this->db->query_write("\n\t\t\t\t\tINSERT INTO " . TABLE_PREFIX . "usertextfield\n\t\t\t\t\t\t(userid)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t({$userid})\n\t\t\t\t");
/*insert query*/
$this->db->query_write("\n\t\t\t\t\tINSERT INTO " . TABLE_PREFIX . "userfield\n\t\t\t\t\t\t(userid)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t({$userid})\n\t\t\t\t");
/*insert query*/
$this->db->query_write("INSERT INTO " . TABLE_PREFIX . "administrator\n\t\t\t\t\t(userid, adminpermissions)\n\t\t\t\tVALUES\n\t\t\t\t\t({$userid}, " . (array_sum($this->registry->bf_ugp_adminpermissions) - 3) . ")\n\t\t\t\t");
/*insert query*/
$this->db->query_write("INSERT INTO " . TABLE_PREFIX . "moderator\n\t\t\t\t\t(userid, forumid, permissions, permissions2)\n\t\t\t\tVALUES\n\t\t\t\t\t(\n\t\t\t\t\t\t{$userid},\n\t\t\t\t\t\t-1,\n\t\t\t\t\t\t" . (array_sum($this->registry->bf_misc_moderatorpermissions) - ($this->registry->bf_misc_moderatorpermissions['newthreademail'] + $this->registry->bf_misc_moderatorpermissions['newpostemail'])) . ",\n\t\t\t\t\t\t" . array_sum($this->registry->bf_misc_moderatorpermissions2) . "\n\t\t\t\t\t)\n\t\t\t\t");
build_image_cache('smilie');
build_image_cache('avatar');
build_image_cache('icon');
build_bbcode_cache();
require_once DIR . '/includes/functions_databuild.php';
build_user_statistics();
require_once DIR . '/includes/adminfunctions_forums.php';
build_forum_child_lists();
build_forum_permissions();
require_once DIR . '/includes/functions_cron.php';
build_cron_next_run();
require_once DIR . '/includes/adminfunctions_attachment.php';
build_attachment_permissions();
require_once DIR . '/includes/class_block.php';
$blockmanager = vB_BlockManager::create($this->registry);
$blockmanager->reloadBlockTypes();
$this->show_message($this->phrase['install']['administrator_account_created']);
return;
} else {
foreach ($errors as $key => $value) {
$errors["{$key}"] = '<span class="usererror">' . $value . '</span>';
}
}
} else {
$data['htmldata'] = array();
}
$html = '<table cellspacing="0" cellpadding="4" border="0" align="center" width="100%" id="cpform_table" class="" style="border-collapse: separate;">
<tbody>
<tr valign="top">
<td class="alt1">' . $this->phrase['install']['username'] . $errors['username'] . '
<span id="htmldata[username]_error" class="usererror hidden">' . $this->phrase['install']['field_required'] . '</span>
//.........这里部分代码省略.........
示例13: install_product
/**
* Installs a product from the xml text
*
* This function depends on the vb class loader, which requires that the
* framework init is called.
*
* @return bool True if the product requires a template merge, false otherwise
*/
function install_product($xml, $allow_overwrite)
{
global $vbphrase;
global $vbulletin;
global $db;
require_once(DIR . '/includes/class_bitfield_builder.php');
require_once(DIR . '/includes/class_xml.php');
require_once(DIR . '/includes/class_block.php');
//share some code with the main xml style import
require_once(DIR . '/includes/adminfunctions_template.php');
print_dots_start('<b>' . $vbphrase['importing_product'] . "</b>, $vbphrase[please_wait]", ':', 'dspan');
$xmlobj = new vB_XML_Parser($xml);
if ($xmlobj->error_no == 1)
{
print_dots_stop();
throw new vB_Exception_AdminStopMessage('no_xml_and_no_path');
}
if(!$arr = $xmlobj->parse())
{
print_dots_stop();
throw new vB_Exception_AdminStopMessage(
array('xml_error_x_at_line_y', $xmlobj->error_string(), $xmlobj->error_line()));
}
// ############## general product information
$info = array(
'productid' => substr(preg_replace('#[^a-z0-9_]#', '', strtolower($arr['productid'])), 0, 25),
'title' => $arr['title'],
'description' => $arr['description'],
'version' => $arr['version'],
'active' => $arr['active'],
'url' => $arr['url'],
'versioncheckurl' => $arr['versioncheckurl']
);
if (!$info['productid'])
{
print_dots_stop();
if (!empty($arr['plugin']))
{
throw new vB_Exception_AdminStopMessage('this_file_appears_to_be_a_plugin');
}
else
{
throw new vB_Exception_AdminStopMessage('invalid_file_specified');
}
}
if (strtolower($info['productid']) == 'vbulletin')
{
print_dots_stop();
throw new vB_Exception_AdminStopMessage(array('product_x_installed_no_overwrite', 'vBulletin'));
}
// check for bitfield conflicts on install
$bitfields = vB_Bitfield_Builder::return_data();
if (!$bitfields)
{
$bfobj =& vB_Bitfield_Builder::init();
if ($bfobj->errors)
{
print_dots_stop();
throw new vB_Exception_AdminStopMessage(array(
'bitfield_conflicts_x',
'<li>' . implode('</li><li>', $bfobj->errors) . '</li>'
));
}
}
// get system version info
$system_versions = array(
'php' => PHP_VERSION,
'vbulletin' => $vbulletin->options['templateversion'],
'products' => fetch_product_list(true)
);
$mysql_version = $db->query_first("SELECT VERSION() AS version");
$system_versions['mysql'] = $mysql_version['version'];
// ############## import dependencies
if (is_array($arr['dependencies']['dependency']))
{
$dependencies =& $arr['dependencies']['dependency'];
if (!isset($dependencies[0]))
{
$dependencies = array($dependencies);
}
//.........这里部分代码省略.........
示例14: process_script_end
/**
* Things to do after each script is processed
*
*/
protected function process_script_end()
{
build_bbcode_cache();
build_options();
require_once DIR . '/includes/functions_databuild.php';
build_bbcode_video(true);
require_once DIR . '/includes/class_bitfield_builder.php';
vB_Bitfield_Builder::save($this->db);
build_forum_permissions();
}
示例15: install_product
/**
* Installs a product from the xml text
*
* This function depends on the vb class loader, which requires that the
* framework init is called.
*
* @return bool True if the product requires a template merge, false otherwise
*/
function install_product($xml, $allow_overwrite = false, $verbose = true)
{
global $vbphrase;
global $vbulletin;
$assertor = vB::getDbAssertor();
require_once DIR . '/includes/class_bitfield_builder.php';
require_once DIR . '/includes/class_xml.php';
//share some code with the main xml style import
require_once DIR . '/includes/adminfunctions_template.php';
if ($verbose) {
print_dots_start('<b>' . $vbphrase['importing_product'] . "</b>, {$vbphrase['please_wait']}", ':', 'dspan');
}
$xmlobj = new vB_XML_Parser($xml);
if ($xmlobj->error_no() == 1) {
if ($verbose) {
print_dots_stop();
}
throw new vB_Exception_AdminStopMessage('no_xml_and_no_path');
}
if (!($arr = $xmlobj->parse())) {
if ($verbose) {
print_dots_stop();
}
throw new vB_Exception_AdminStopMessage(array('xml_error_x_at_line_y', $xmlobj->error_string(), $xmlobj->error_line()));
}
// ############## general product information
$info = array('productid' => substr(preg_replace('#[^a-z0-9_]#', '', strtolower($arr['productid'])), 0, 25), 'title' => $arr['title'], 'description' => $arr['description'], 'version' => $arr['version'], 'active' => $arr['active'], 'url' => $arr['url'], 'versioncheckurl' => $arr['versioncheckurl']);
if (!$info['productid']) {
if ($verbose) {
print_dots_stop();
}
throw new vB_Exception_AdminStopMessage('invalid_file_specified');
}
if (strtolower($info['productid']) == 'vbulletin') {
if ($verbose) {
print_dots_stop();
}
throw new vB_Exception_AdminStopMessage(array('product_x_installed_no_overwrite', 'vBulletin'));
}
// check for bitfield conflicts on install
$bitfields = vB_Bitfield_Builder::return_data();
if (!$bitfields) {
$bfobj =& vB_Bitfield_Builder::init();
if ($bfobj->errors) {
if ($verbose) {
print_dots_stop();
}
throw new vB_Exception_AdminStopMessage(array('bitfield_conflicts_x', '<li>' . implode('</li><li>', $bfobj->errors) . '</li>'));
}
}
// get system version info
$system_versions = array('php' => PHP_VERSION, 'vbulletin' => $vbulletin->options['templateversion'], 'products' => fetch_product_list(true));
$mysql_version = $assertor->getRow('mysqlVersion');
$system_versions['mysql'] = $mysql_version['version'];
// ############## import dependencies
if (isset($arr['dependencies']['dependency']) and is_array($arr['dependencies']['dependency'])) {
$dependencies =& $arr['dependencies']['dependency'];
if (!isset($dependencies[0])) {
$dependencies = array($dependencies);
}
$dependency_errors = array();
$ignore_dependency_errors = array();
// let's check the dependencies
foreach ($dependencies as $dependency) {
// if we get an error, we haven't met this dependency
// if we go through without a problem, we have automatically met
// all dependencies for this "class" (mysql, php, vb, a specific product, etc)
$this_dependency_met = true;
// build a phrase for the version compats -- will look like (minver / maxver)
if ($dependency['minversion']) {
$compatible_phrase = construct_phrase($vbphrase['compatible_starting_with_x'], htmlspecialchars_uni($dependency['minversion']));
} else {
$compatible_phrase = '';
}
if ($dependency['maxversion']) {
$incompatible_phrase = construct_phrase($vbphrase['incompatible_with_x_and_greater'], htmlspecialchars_uni($dependency['maxversion']));
} else {
$incompatible_phrase = '';
}
if ($compatible_phrase or $incompatible_phrase) {
$required_version_info = "({$compatible_phrase}";
if ($compatible_phrase and $incompatible_phrase) {
$required_version_info .= ' / ';
}
$required_version_info .= "{$incompatible_phrase})";
}
// grab the appropriate installed version string
if ($dependency['dependencytype'] == 'product') {
// group dependencies into types -- individual products get their own group
$dependency_type_key = "product-{$dependency['parentproductid']}";
// undocumented feature -- you can put a producttitle attribute in a dependency so the id isn't displayed
$parent_product_title = !empty($dependency['producttitle']) ? $dependency['producttitle'] : $dependency['parentproductid'];
//.........这里部分代码省略.........