本文整理汇总了PHP中build_user_statistics函数的典型用法代码示例。如果您正苦于以下问题:PHP build_user_statistics函数的具体用法?PHP build_user_statistics怎么用?PHP build_user_statistics使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了build_user_statistics函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: vbflush
vbflush();
$db->query_write("DELETE FROM " . TABLE_PREFIX . "session WHERE userid IN({$userids})");
echo $vbphrase['okay'] . '</p><p>' . $vbphrase['deleting_usergroup_join_requests'] . "\n";
vbflush();
$db->query_write("DELETE FROM " . TABLE_PREFIX . "usergrouprequest WHERE userid IN({$userids})");
echo $vbphrase['okay'] . '</p><p>' . $vbphrase['deleting_bans'] . "\n";
vbflush();
$db->query_write("DELETE FROM " . TABLE_PREFIX . "userban WHERE userid IN({$userids})");
echo $vbphrase['okay'] . '</p><p>' . $vbphrase['deleting_usernotes'] . "\n";
vbflush();
$db->query_write("DELETE FROM " . TABLE_PREFIX . "usernote WHERE userid IN({$userids})");
echo $vbphrase['okay'] . '</p><p>' . $vbphrase['updating_threads_posts'] . "</p>\n";
vbflush();
build_adminutil_text('ids', $userids);
require_once DIR . '/includes/functions_databuild.php';
build_user_statistics();
print_cp_redirect("user.php?" . $vbulletin->session->vars['sessionurl'] . "do=prune_updateposts&startat=0", 1);
exit;
} else {
if ($vbulletin->GPC['dowhat'] == 'move') {
$group = $db->query_first("\n\t\t\t\tSELECT title\n\t\t\t\tFROM " . TABLE_PREFIX . "usergroup\n\t\t\t\tWHERE usergroupid = " . $vbulletin->GPC['movegroup']);
echo '<p>' . $vbphrase['updating_users'] . "\n";
vbflush();
$db->query_write("\n\t\t\t\tUPDATE " . TABLE_PREFIX . "user\n\t\t\t\tSET displaygroupid = IF(displaygroupid = usergroupid, 0, displaygroupid),\n\t\t\t\t\tusergroupid = " . $vbulletin->GPC['movegroup'] . "\n\t\t\t\tWHERE userid IN({$userids})\n\t\t\t");
echo $vbphrase['okay'] . '</p><p><b>' . $vbphrase['moved_users_successfully'] . '</b></p>';
print_cp_redirect("user.php?" . $vbulletin->session->vars['sessionurl'] . "do=prune", 1);
} else {
$vbulletin->input->clean_array_gpc('r', array('usergroupid' => TYPE_INT, 'daysprune' => TYPE_INT, 'minposts' => TYPE_INT, 'joindate' => TYPE_STR, 'order' => TYPE_STR));
define('CP_REDIRECT', "user.php?do=pruneusers" . "&usergroupid=" . $vbulletin->GPC['usergroupid'] . "&daysprune=" . $vbulletin->GPC['daysprune'] . "&minposts=" . $vbulletin->GPC['minposts'] . "&joindate=" . $vbulletin->GPC['joindate'] . "&order=" . $vbulletin->GPC['order']);
print_stop_message('invalid_action_specified');
}
示例2: pruneUpdateposts
/**
* Do prune/move users (step 2). Userids to be updated are stored in adminutil table.
*
* @param integer $startat Start at index.
* @return integer |bool Next startat value. True means all users have been updated.
*/
public function pruneUpdateposts($startat)
{
$this->checkHasAdminPermission('canadminusers');
require_once DIR . '/includes/adminfunctions.php';
$userids = fetch_adminutil_text('ids');
if (!$userids) {
$userids = '0';
}
$users = vB::getDbAssertor()->getRows('user_fetch', array('userids' => $userids, vB_dB_Query::PARAM_LIMITSTART => intval($startat)));
if ($users) {
foreach ($users as $user) {
vB::getDbAssertor()->assertQuery('user_updatethread', array('username' => $user['username'], 'userid' => $user['userid']));
vB::getDbAssertor()->assertQuery('user_updatepost', array('username' => $user['username'], 'userid' => $user['userid']));
}
return $startat + 50;
} else {
vB::getDbAssertor()->assertQuery('user_deleteusertextfield', array('userids' => $userids));
vB::getDbAssertor()->assertQuery('user_deleteuserfield', array('userids' => $userids));
vB::getDbAssertor()->assertQuery('user_deleteuser', array('userids' => $userids));
require_once DIR . '/includes/functions_databuild.php';
build_user_statistics();
return true;
}
}
示例3: update_username
/**
* Updates all denormalized tables that contain a 'username' field (or field that holds a username)
*
* @param integer User ID
* @param string The user name. Helpful if you want to call this function from outside the DM.
*/
function update_username($userid, $username = null)
{
if ($username != null and $username != '') {
$doupdate = true;
} else {
if (isset($this->user['username']) and $this->user['username'] != $this->existing['username']) {
$doupdate = true;
$username = $this->user['username'];
} else {
$doupdate = false;
}
}
if ($doupdate) {
// pm receipt 'tousername'
$this->dbobject->query_write("\n\t\t\t\tUPDATE " . TABLE_PREFIX . "pmreceipt SET\n\t\t\t\t\ttousername = '" . $this->dbobject->escape_string($username) . "'\n\t\t\t\tWHERE touserid = {$userid}\n\t\t\t");
// pm text 'fromusername'
$this->dbobject->query_write("\n\t\t\t\tUPDATE " . TABLE_PREFIX . "pmtext SET\n\t\t\t\t\tfromusername = '" . $this->dbobject->escape_string($username) . "'\n\t\t\t\tWHERE fromuserid = {$userid}\n\t\t\t");
// these updates work only when the old username is known,
// so don't bother forcing them to update if the names aren't different
if ($this->existing['username'] != $username) {
// pm text 'touserarray'
$this->dbobject->query_write("\n\t\t\t\t\tUPDATE " . TABLE_PREFIX . "pmtext SET\n\t\t\t\t\t\ttouserarray = REPLACE(touserarray,\n\t\t\t\t\t\t\t'i:{$userid};s:" . strlen($this->existing['username']) . ":\"" . $this->dbobject->escape_string($this->existing['username']) . "\";',\n\t\t\t\t\t\t\t'i:{$userid};s:" . strlen($username) . ":\"" . $this->dbobject->escape_string($username) . "\";'\n\t\t\t\t\t\t)\n\t\t\t\t\tWHERE touserarray LIKE '%i:{$userid};s:" . strlen($this->existing['username']) . ":\"" . $this->dbobject->escape_string_like($this->existing['username']) . "\";%'\n\t\t\t\t");
// forum 'lastposter'
$this->dbobject->query_write("\n\t\t\t\t\tUPDATE " . TABLE_PREFIX . "forum SET\n\t\t\t\t\t\tlastposter = '" . $this->dbobject->escape_string($username) . "'\n\t\t\t\t\tWHERE lastposter = '" . $this->dbobject->escape_string($this->existing['username']) . "'\n\t\t\t\t");
// thread 'lastposter'
$this->dbobject->query_write("\n\t\t\t\t\tUPDATE " . TABLE_PREFIX . "thread SET\n\t\t\t\t\t\tlastposter = '" . $this->dbobject->escape_string($username) . "'\n\t\t\t\t\tWHERE lastposter = '" . $this->dbobject->escape_string($this->existing['username']) . "'\n\t\t\t\t");
}
// thread 'postusername'
$this->dbobject->query_write("\n\t\t\t\tUPDATE " . TABLE_PREFIX . "thread SET\n\t\t\t\t\tpostusername = '" . $this->dbobject->escape_string($username) . "'\n\t\t\t\tWHERE postuserid = {$userid}\n\t\t\t");
// post 'username'
$this->dbobject->query_write("\n\t\t\t\tUPDATE " . TABLE_PREFIX . "post SET\n\t\t\t\t\tusername = '" . $this->dbobject->escape_string($username) . "'\n\t\t\t\tWHERE userid = {$userid}\n\t\t\t");
// usernote 'username'
$this->dbobject->query_write("\n\t\t\t\tUPDATE " . TABLE_PREFIX . "usernote\n\t\t\t\tSET username = '" . $this->dbobject->escape_string($username) . "'\n\t\t\t\tWHERE posterid = {$userid}\n\t\t\t");
// deletionlog 'username'
$this->dbobject->query_write("\n\t\t\t\tUPDATE " . TABLE_PREFIX . "deletionlog\n\t\t\t\tSET username = '" . $this->dbobject->escape_string($username) . "'\n\t\t\t\tWHERE userid = {$userid}\n\t\t\t");
// editlog 'username'
$this->dbobject->query_write("\n\t\t\t\tUPDATE " . TABLE_PREFIX . "editlog\n\t\t\t\tSET username = '" . $this->dbobject->escape_string($username) . "'\n\t\t\t\tWHERE userid = {$userid}\n\t\t\t");
// Rebuild newest user information
require_once DIR . '/includes/functions_databuild.php';
($hook = vBulletinHook::fetch_hook('userdata_update_username')) ? eval($hook) : false;
build_user_statistics();
}
}
示例4: 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>
//.........这里部分代码省略.........
示例5: update_username
/**
* Updates all denormalized tables that contain a 'username' field (or field that holds a username)
*
* @param integer User ID
* @param string The user name. Helpful if you want to call this function from outside the DM.
*/
function update_username($userid, $username = null)
{
if ($username != null and $username != '') {
$doupdate = true;
} else {
if (isset($this->user['username']) and $this->user['username'] != $this->existing['username']) {
$doupdate = true;
$username = $this->user['username'];
} else {
$doupdate = false;
}
}
if ($doupdate) {
// usernote 'username'
$this->assertor->update('usernote', array('username' => $username), array('posterid' => $userid));
// deletionlog 'username'
$this->assertor->update('deletionlog', array('username' => $username), array('userid' => $userid));
// editlog 'username'
$this->assertor->update('editlog', array('username' => $username), array('userid' => $userid));
// postedithistory 'username'
$this->assertor->update('vbForum:postedithistory', array('username' => $username), array('userid' => $userid));
//Now we need to update what remains.
$this->assertor->assertQuery('vBForum:node', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_UPDATE, vB_dB_Query::CONDITIONS_KEY => array('userid' => $userid), 'authorname' => $username));
$this->assertor->assertQuery('vBForum:node', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_UPDATE, vB_dB_Query::CONDITIONS_KEY => array('lastauthorid' => $userid), 'lastcontentauthor' => $username));
// Rebuild newest user information
require_once DIR . '/includes/functions_databuild.php';
// Legacy Hook 'userdata_update_username' Removed //
build_user_statistics();
build_birthdays();
}
}
示例6: update_username
//.........这里部分代码省略.........
'i:$userid;s:" . strlen($username) . ":\"" . $this->dbobject->escape_string($username) . "\";'
)
WHERE touserarray LIKE '%i:$userid;s:" . strlen($this->existing['username']) . ":\"" . $this->dbobject->escape_string_like($this->existing['username']) . "\";%'
");
// forum 'lastposter'
$this->dbobject->query_write("
UPDATE " . TABLE_PREFIX . "forum SET
lastposter = '" . $this->dbobject->escape_string($username) . "'
WHERE lastposter = '" . $this->dbobject->escape_string($this->existing['username']) . "'
");
// thread 'lastposter'
$this->dbobject->query_write("
UPDATE " . TABLE_PREFIX . "thread SET
lastposter = '" . $this->dbobject->escape_string($username) . "'
WHERE lastposter = '" . $this->dbobject->escape_string($this->existing['username']) . "'
");
}
// thread 'postusername'
$this->dbobject->query_write("
UPDATE " . TABLE_PREFIX . "thread SET
postusername = '" . $this->dbobject->escape_string($username) . "'
WHERE postuserid = $userid
");
// post 'username'
$this->dbobject->query_write("
UPDATE " . TABLE_PREFIX . "post SET
username = '" . $this->dbobject->escape_string($username) . "'
WHERE userid = $userid
");
// usernote 'username'
$this->dbobject->query_write("
UPDATE " . TABLE_PREFIX . "usernote
SET username = '" . $this->dbobject->escape_string($username) . "'
WHERE posterid = $userid
");
// deletionlog 'username'
$this->dbobject->query_write("
UPDATE " . TABLE_PREFIX . "deletionlog
SET username = '" . $this->dbobject->escape_string($username) . "'
WHERE userid = $userid
");
// editlog 'username'
$this->dbobject->query_write("
UPDATE " . TABLE_PREFIX . "editlog
SET username = '" . $this->dbobject->escape_string($username) . "'
WHERE userid = $userid
");
// postedithistory 'username'
$this->dbobject->query_write("
UPDATE " . TABLE_PREFIX . "postedithistory
SET username = '" . $this->dbobject->escape_string($username) . "'
WHERE userid = $userid
");
// socialgroup 'lastposter'
$this->dbobject->query_write("
UPDATE " . TABLE_PREFIX . "socialgroup
SET lastposter = '" . $this->dbobject->escape_string($username) . "'
WHERE lastposterid = $userid
");
// discussion 'lastposter'
$this->dbobject->query_write("
UPDATE " . TABLE_PREFIX . "discussion
SET lastposter = '" . $this->dbobject->escape_string($username) . "'
WHERE lastposterid = $userid
");
// groupmessage 'postusername'
$this->dbobject->query_write("
UPDATE " . TABLE_PREFIX . "groupmessage
SET postusername = '" . $this->dbobject->escape_string($username) . "'
WHERE postuserid = $userid
");
// visitormessage 'postusername'
$this->dbobject->query_write("
UPDATE " . TABLE_PREFIX . "visitormessage
SET postusername = '" . $this->dbobject->escape_string($username) . "'
WHERE postuserid = $userid
");
// Rebuild newest user information
require_once(DIR . '/includes/functions_databuild.php');
($hook = vBulletinHook::fetch_hook('userdata_update_username')) ? eval($hook) : false;
build_user_statistics();
build_birthdays();
}
}