本文整理汇总了PHP中build_forum_permissions函数的典型用法代码示例。如果您正苦于以下问题:PHP build_forum_permissions函数的具体用法?PHP build_forum_permissions怎么用?PHP build_forum_permissions使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了build_forum_permissions函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: step_1
/**
* Step #1 - Import Settings XML
*
*/
function step_1()
{
build_forum_permissions();
vBulletinHook::build_datastore($this->db);
build_product_datastore();
build_activitystream_datastore();
if (VB_AREA == 'Upgrade') {
$this->show_message($this->phrase['final']['import_latest_options']);
require_once DIR . '/includes/adminfunctions_options.php';
if (!($xml = file_read(DIR . '/install/vbulletin-settings.xml'))) {
$this->add_error(sprintf($this->phrase['vbphrase']['file_not_found'], 'vbulletin-settings.xml'), self::PHP_TRIGGER_ERROR, true);
return;
}
$this->show_message(sprintf($this->phrase['vbphrase']['importing_file'], 'vbulletin-settings.xml'));
xml_import_settings($xml);
$this->show_message($this->phrase['core']['import_done']);
} else {
$this->skip_message();
}
}
示例2: intval
$childlist = $forumid;
$children = $db->query_read("SELECT forumid FROM " . TABLE_PREFIX . "forum WHERE parentid = " . intval($forumid));
while ($child = $db->fetch_array($children)) {
$childlist .= ',' . $child['forumid'];
}
$childlist .= ',-1';
return $childlist;
}
$forums = $db->query_read("SELECT forumid FROM " . TABLE_PREFIX . "forum WHERE childlist = ''");
$count = 0;
while ($forum = $db->fetch_array($forums)) {
$childlist = construct_child_list($forum['forumid']);
$db->query_write("\n\t\t\tUPDATE " . TABLE_PREFIX . "forum\n\t\t\tSET childlist = '{$childlist}'\n\t\t\tWHERE forumid = {$forum['forumid']}\n\t\t");
$count++;
}
build_forum_permissions();
echo "<p align=\"center\">Updated {$count} forums</p>";
define('SCRIPT_REDIRECT', true);
} else {
if ($_REQUEST['do'] == 'bbactive') {
$db->query_write("\n\t\tUPDATE " . TABLE_PREFIX . "setting\n\t\tSET value = " . ($vbulletin->options['bbactive'] ? 0 : 1) . "\n\t\tWHERE varname = 'bbactive'\n\t");
build_options();
define('SCRIPT_REDIRECT', true);
} else {
if ($_REQUEST['do'] == 'language') {
$vbulletin->input->clean_array_gpc('p', array('languageid' => TYPE_UINT));
require_once DIR . '/includes/adminfunctions_language.php';
$languages = $db->query_read('SELECT * FROM ' . TABLE_PREFIX . 'language');
if ($db->num_rows($languages) == 0) {
// this is just taken from install.php
$db->query_write("INSERT INTO " . TABLE_PREFIX . "language (title, languagecode, charset, decimalsep, thousandsep) VALUES ('English (US)', 'en', 'ISO-8859-1', '.', ',')");
示例3: RebuildForum
function RebuildForum($parentid)
{
global $vbulletin;
$db = $vbulletin->db;
$forums = $db->query_read("\n\t\tSELECT forumid\n\t\tFROM " . TABLE_PREFIX . "forum\n\t\tWHERE parentid = {$parentid} OR forumid = {$parentid}\n\t\tORDER BY forumid");
while ($forum = $db->fetch_array($forums)) {
build_forum_counters($forum['forumid'], true);
vbflush();
}
// and finally rebuild the forumcache
unset($forumarraycache, $vbulletin->forumcache);
build_forum_permissions();
}
示例4: delete
/**
* Deletes a forum and its associated data from the database
*/
function delete()
{
// fetch list of forums to delete
$forumlist = '';
$forums = $this->dbobject->query_read_slave("SELECT forumid FROM " . TABLE_PREFIX . "forum WHERE " . $this->condition);
while ($thisforum = $this->dbobject->fetch_array($forums)) {
$forumlist .= ',' . $thisforum['forumid'];
}
$this->dbobject->free_result($forums);
$forumlist = substr($forumlist, 1);
if ($forumlist == '') {
// nothing to do
$this->error('invalid_forum_specified');
} else {
$condition = "forumid IN ({$forumlist})";
// delete from extra data tables
$this->db_delete(TABLE_PREFIX, 'forumpermission', $condition);
$this->db_delete(TABLE_PREFIX, 'access', $condition);
$this->db_delete(TABLE_PREFIX, 'moderator', $condition);
$this->db_delete(TABLE_PREFIX, 'announcement', $condition);
$this->db_delete(TABLE_PREFIX, 'subscribeforum', $condition);
$this->db_delete(TABLE_PREFIX, 'tachyforumpost', $condition);
$this->db_delete(TABLE_PREFIX, 'podcast', $condition);
$this->db_delete(TABLE_PREFIX, 'forumprefixset', $condition);
require_once DIR . '/includes/functions_databuild.php';
// delete threads in specified forums
$threads = $this->dbobject->query_read_slave("SELECT * FROM " . TABLE_PREFIX . "thread WHERE {$condition}");
while ($thread = $this->dbobject->fetch_array($threads)) {
$threadman =& datamanager_init('Thread', $this->registry, ERRTYPE_SILENT, 'threadpost');
$threadman->set_existing($thread);
$threadman->set_info('skip_moderator_log', true);
$threadman->delete($this->registry->forumcache["{$thread['forumid']}"]['options'] & $this->registry->bf_misc_forumoptions['countposts']);
unset($threadman);
}
$this->dbobject->free_result($threads);
$this->db_delete(TABLE_PREFIX, 'forum', $condition);
build_forum_permissions();
($hook = vBulletinHook::fetch_hook('forumdata_delete')) ? eval($hook) : false;
}
}
示例5: 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>
//.........这里部分代码省略.........
示例6: 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();
}