本文整理汇总了PHP中vbrand函数的典型用法代码示例。如果您正苦于以下问题:PHP vbrand函数的具体用法?PHP vbrand怎么用?PHP vbrand使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vbrand函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate_form_html
/**
* Generates HTML for the subscription form page
*
* @param string Hash used to indicate the transaction within vBulletin
* @param string The cost of this payment
* @param string The currency of this payment
* @param array Information regarding the subscription that is being purchased
* @param array Information about the user who is purchasing this subscription
* @param array Array containing specific data about the cost and time for the specific subscription period
*
* @return array Compiled form information
*/
function generate_form_html($hash, $cost, $currency, $subinfo, $userinfo, $timeinfo)
{
global $vbphrase, $vbulletin, $stylevar, $show;
$item = $hash;
$currency = strtoupper($currency);
$sequence = vbrand(1, 1000);
$fingerprint = $this->hmac($this->settings['txnkey'], $this->settings['authorize_loginid'] . '^' . $sequence . '^' . TIMENOW . '^' . $cost . '^' . $currency);
$timenow = TIMENOW;
$form['action'] = 'https://secure.authorize.net/gateway/transact.dll';
$form['method'] = 'post';
// load settings into array so the template system can access them
$settings =& $this->settings;
eval('$form[\'hiddenfields\'] .= "' . fetch_template('subscription_payment_authorizenet') . '";');
return $form;
}
示例2: ON
// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################
// Send the reminder email only twice. After 1 day and then 5 Days.
$users = $vbulletin->db->query_read("\n\tSELECT user.userid, user.usergroupid, username, email, activationid, user.languageid\n\tFROM " . TABLE_PREFIX . "user AS user\n\tLEFT JOIN " . TABLE_PREFIX . "useractivation AS useractivation ON (user.userid=useractivation.userid AND type = 0)\n\tWHERE user.usergroupid = 3\n\t\tAND ((joindate >= " . (TIMENOW - TWODAYS) . " AND joindate <= " . (TIMENOW - ONEDAY) . ") OR (joindate >= " . (TIMENOW - SIXDAYS) . " AND joindate <= " . (TIMENOW - FIVEDAYS) . "))\n\t\tAND NOT (user.options & " . $vbulletin->bf_misc_useroptions['noactivationmails'] . ")\n");
vbmail_start();
$emails = '';
while ($user = $vbulletin->db->fetch_array($users)) {
// make random number
if (empty($user['activationid'])) {
//none exists so create one
$user['activationid'] = vbrand(0, 100000000);
/*insert query*/
$vbulletin->db->query_write("\n\t\t\tREPLACE INTO " . TABLE_PREFIX . "useractivation\n\t\t\t\t(userid, dateline, activationid, type, usergroupid)\n\t\t\tVALUES\n\t\t\t\t({$user['userid']}, " . TIMENOW . ", {$user['activationid']}, 0, 2)\n\t\t");
} else {
$user['activationid'] = vbrand(0, 100000000);
$vbulletin->db->query_write("\n\t\t\tUPDATE " . TABLE_PREFIX . "useractivation SET\n\t\t\tdateline = " . TIMENOW . ",\n\t\t\tactivationid = {$user['activationid']}\n\t\t\tWHERE userid = {$user['userid']} AND type = 0\n\t\t");
}
$userid = $user['userid'];
$username = $user['username'];
$activateid = $user['activationid'];
eval(fetch_email_phrases('activateaccount', $user['languageid']));
vbmail($user['email'], $subject, $message);
$emails .= iif($emails, ', ');
$emails .= $user['username'];
}
if ($emails) {
log_cron_action($emails, $nextitem, 1);
}
vbmail_end();
/*======================================================================*\
示例3: step_49
/**
* Step #49
*
*/
function step_49()
{
if (!$this->field_exists('attachment', 'filedataid') and $this->field_exists('filedata', 'filedataid')) {
// We have a vb3 attachment table and a vb4 filedata table which causes a problem so move the vb4 filedata table
$this->run_query(sprintf($this->phrase['vbphrase']['update_table'], TABLE_PREFIX . "filedata"), "RENAME TABLE " . TABLE_PREFIX . "filedata TO " . TABLE_PREFIX . "filedata" . vbrand(0, 1000000), self::MYSQL_ERROR_TABLE_EXISTS);
} else {
$this->skip_message();
}
}
示例4: fetch_random_password
/**
* Generates a random password that is much stronger than what we currently use.
*
* @param integer Length of desired password
*/
function fetch_random_password($length = 8)
{
$password_characters = 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz';
$total_password_characters = strlen($password_characters) - 1;
$digit = vbrand(0, $length - 1);
$newpassword = '';
for ($i = 0; $i < $length; $i++)
{
if ($i == $digit)
{
$newpassword .= chr(vbrand(48, 57));
continue;
}
$newpassword .= $password_characters{vbrand(0, $total_password_characters)};
}
return $newpassword;
}
示例5: generate_form_html
/**
* Generates HTML for the subscription form page
*
* @param string Hash used to indicate the transaction within vBulletin
* @param string The cost of this payment
* @param string The currency of this payment
* @param array Information regarding the subscription that is being purchased
* @param array Information about the user who is purchasing this subscription
* @param array Array containing specific data about the cost and time for the specific subscription period
*
* @return array Compiled form information
*/
function generate_form_html($hash, $cost, $currency, $subinfo, $userinfo, $timeinfo)
{
global $vbphrase, $vbulletin, $show;
$item = $hash;
$currency = strtoupper($currency);
$timenow = vB::getRequest()->getTimeNow();
$sequence = vbrand(1, 1000);
$fingerprint = $this->hmac($this->settings['txnkey'], $this->settings['authorize_loginid'] . '^' . $sequence . '^' . $timenow . '^' . $cost . '^' . $currency);
$form['action'] = $this->form_target;
$form['method'] = 'post';
// load settings into array so the template system can access them
$settings =& $this->settings;
$templater = new vB5_Template('subscription_payment_authorizenet');
$templater->register('cost', $cost);
$templater->register('currency', $currency);
$templater->register('fingerprint', $fingerprint);
$templater->register('item', $item);
$templater->register('sequence', $sequence);
$templater->register('settings', $settings);
$templater->register('timenow', $timenow);
$templater->register('userinfo', $userinfo);
$form['hiddenfields'] .= $templater->render();
return $form;
}
示例6: generate_form_html
/**
* Generates HTML for the subscription form page
*
* @param string Hash used to indicate the transaction within vBulletin
* @param string The cost of this payment
* @param string The currency of this payment
* @param array Information regarding the subscription that is being purchased
* @param array Information about the user who is purchasing this subscription
* @param array Array containing specific data about the cost and time for the specific subscription period
*
* @return array Compiled form information
*/
function generate_form_html($hash, $cost, $currency, $subinfo, $userinfo, $timeinfo)
{
global $vbphrase, $vbulletin, $show;
$item = $hash;
$currency = strtoupper($currency);
$sequence = vbrand(1, 1000);
$fingerprint = $this->hmac($this->settings['txnkey'], $this->settings['authorize_loginid'] . '^' . $sequence . '^' . TIMENOW . '^' . $cost . '^' . $currency);
$timenow = TIMENOW;
$form['action'] = 'https://secure.authorize.net/gateway/transact.dll';
$form['method'] = 'post';
// load settings into array so the template system can access them
$settings =& $this->settings;
$templater = vB_Template::create('subscription_payment_authorizenet');
$templater->register('cost', $cost);
$templater->register('currency', $currency);
$templater->register('fingerprint', $fingerprint);
$templater->register('item', $item);
$templater->register('sequence', $sequence);
$templater->register('settings', $settings);
$templater->register('timenow', $timenow);
$templater->register('userinfo', $userinfo);
$form['hiddenfields'] .= $templater->render();
return $form;
}
示例7: while
while ($user = $db->fetch_array($users)) {
echo "{$user['userid']} - {$user['username']} .... \n";
vbflush();
$userid = $user['userid'];
$sendmessage = $vbulletin->GPC['message'];
$sendmessage = str_replace(array('$email', '$username', '$userid'), array($user['email'], $user['username'], $user['userid']), $vbulletin->GPC['message']);
if ($hasactivateid) {
if ($user['usergroupid'] == 3) {
// if in correct usergroup
if (empty($user['activationid'])) {
//none exists so create one
$activate['activationid'] = vbrand(0, 100000000);
/*insert query*/
$db->query_write("\n\t\t\t\t\t\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "useractivation\n\t\t\t\t\t\t\t\t\t\t(userid, dateline, activationid, type, usergroupid)\n\t\t\t\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t\t\t\t({$user['userid']}, " . TIMENOW . ", {$activate['activationid']}, 0, 2)\n\t\t\t\t\t\t\t\t");
} else {
$activate['activationid'] = vbrand(0, 100000000);
$db->query_write("\n\t\t\t\t\t\t\t\t\tUPDATE " . TABLE_PREFIX . "useractivation SET\n\t\t\t\t\t\t\t\t\t\tdateline = " . TIMENOW . ",\n\t\t\t\t\t\t\t\t\t\tactivationid = {$activate['activationid']}\n\t\t\t\t\t\t\t\t\tWHERE userid = {$user['userid']} AND\n\t\t\t\t\t\t\t\t\t\ttype = 0\n\t\t\t\t\t\t\t\t");
}
$activate['link'] = $vbulletin->options['bburl'] . "/register.php?a=act&u={$userid}&i={$activate['activationid']}";
} else {
$activate = array();
}
$sendmessage = str_replace(array('$activateid', '$activatelink'), array($activate['activationid'], $activate['link']), $sendmessage);
}
$sendmessage = str_replace(array('$bburl', '$bbtitle'), array($vbulletin->options['bburl'], $vbulletin->options['bbtitle']), $sendmessage);
if (!$vbulletin->GPC['test']) {
echo $vbphrase['emailing'] . " \n";
vbmail($user['email'], $vbulletin->GPC['subject'], $sendmessage, true, $vbulletin->GPC['from']);
} else {
echo $vbphrase['test'] . " ... \n";
}
示例8: fetch_answer_string
/**
* Generate a random string for image verification
*
* @param int Length of result
*
* @return string
*/
function fetch_answer_string($length = 6)
{
$somechars = '234689ABCEFGHJMNPQRSTWY';
$morechars = '234689ABCEFGHJKMNPQRSTWXYZabcdefghjkmnpstwxyz';
for ($x = 1; $x <= $length; $x++)
{
$chars = ($x <= 2 OR $x == $length) ? $morechars : $somechars;
$number = vbrand(1, strlen($chars));
$word .= substr($chars, $number - 1, 1);
}
return $word;
}
示例9: exec_header_redirect
if (!$user) {
// no activation record, probably got back here after a successful request, back to home
exec_header_redirect($vbulletin->options['forumhome'] . '.php');
}
if ($user['dateline'] < TIMENOW - 24 * 60 * 60) {
// is it older than 24 hours?
eval(standard_error(fetch_error('resetexpired', $vbulletin->session->vars['sessionurl'])));
}
if ($user['activationid'] != $vbulletin->GPC['activationid']) {
//wrong act id
eval(standard_error(fetch_error('resetbadid', $vbulletin->session->vars['sessionurl'])));
}
// delete old activation id
$db->query_write("DELETE FROM " . TABLE_PREFIX . "useractivation WHERE userid = {$userinfo['userid']} AND type = 1");
// make random number
$newpassword = vbrand(0, 100000000);
// init user data manager
$userdata =& datamanager_init('User', $vbulletin, ERRTYPE_STANDARD);
$userdata->set_existing($userinfo);
$userdata->set('password', $newpassword);
$userdata->save();
($hook = vBulletinHook::fetch_hook('reset_password')) ? eval($hook) : false;
eval(fetch_email_phrases('resetpw', $userinfo['languageid']));
vbmail($userinfo['email'], $subject, $message, true);
eval(standard_error(fetch_error('resetpw', $vbulletin->session->vars['sessionurl'])));
}
/*======================================================================*\
|| ####################################################################
|| # Downloaded: 08:19, Wed Nov 5th 2008
|| # CVS: $RCSfile$ - $Revision: 27605 $
|| ####################################################################
示例10: generate_token
/**
* Generates a Random Token and stores it in the database
*
* @param boolean Delete the previous hash generated
*
* @return array an array consisting of the hash, and the answer
*
*/
function generate_token($deletehash = true)
{
$verify = array(
'hash' => md5(uniqid(vbrand(), true)),
'answer' => $this->fetch_answer(),
);
if ($deletehash AND $this->hash)
{
$this->delete_token($this->hash);
}
$this->hash = $verify['hash'];
$this->registry->db->query_write("
INSERT INTO " . TABLE_PREFIX . "humanverify
(hash, answer, dateline)
VALUES
('" . $this->registry->db->escape_string($verify['hash']) . "', '" . $this->registry->db->escape_string($verify['answer']) . "', " . TIMENOW . ")"
);
return $verify;
}
示例11: generateUserSecret
/**
* Generates a totally random string
*
* Intended to populate the user secret field. Exposed as a function
* because the installer doesn't use the normal user save code and will
* need access.
*
* @return string Generated String
*/
public function generateUserSecret()
{
$length = 30;
$secret = '';
for ($i = 0; $i < $length; $i++) {
$secret .= chr(vbrand(33, 126));
}
return $secret;
}
示例12: pre_save
function pre_save($doquery = true)
{
if ($this->presave_called !== null)
{
return $this->presave_called;
}
if (!$this->condition)
{
if (!($blogid = $this->fetch_field('blogid')))
{
global $vbphrase;
$this->error('invalidid', $vbphrase['blog'], $this->registry->options['contactuslink']);
return false;
}
if (!($url = $this->fetch_field('url')))
{
$this->error('no_url_specified');
return false;
}
if (!$this->fetch_field('state'))
{
$this->set('state', 'moderation');
}
if (!$this->fetch_field('dateline'))
{
$this->set('dateline', TIMENOW);
}
if (!$this->fetch_field('title') OR !$this->fetch_field('snippet'))
{
require_once(DIR . '/includes/functions_file.php');
if ($bodyresult = fetch_body_request($url, 100000))
{
if (preg_match('#<head[^>]*>.*<title>(.*)</title>.*</head>.*<body(.*?)#siU', $bodyresult, $matches))
{
$body =& $matches[2];
if (!$this->fetch_field('title'))
{
$this->set('title', $matches[1]);
}
else
{
$this->error('invalid_title_specified');
return false;
}
if (!$this->fetch_field('snippet'))
{
if (preg_match('#(<a[^>]+href=(\'|")' . preg_quote($this->registry->options['bburl'], '#') . '\/blog(?:_callback)?.php\?b(?:logid)?=' . $blogid . '\\2[^>]*>(.*)</a>)#siU', $body, $matches))
{
$hash = md5(TIMENOW . SCRIPTPATH . SESSION_IDHASH . SESSION_HOST . vbrand(1, 1000000));
$body = str_replace($matches[1], "<$hash>" . $matches[3] . "</$hash>", $body);
$body = strip_tags($body, "<$hash>");
$start = strpos($body, "<$hash>" . $matches[3] . "</$hash>");
$length = strlen("<$hash>" . $matches[3] . "</$hash>");
$snippet = str_replace(
array(
"<$hash>",
"</$hash>",
),
array(
'',
'',
),
trim(substr($body, $start - 100, $length + 200))
);
$this->set('snippet', $snippet);
}
else
{
$this->error('could_not_parse_link_href_from_link');
return false;
}
}
return true;
}
else
{
$this->error('failed_to_parse_html_body');
return false;
}
}
else
{
$this->error('failed_to_retrieve_body_' . $url);
return false;
}
}
if ($this->fetch_field('state') == 'visible' AND !$this->info['skip_akismet'])
{
$akismet_url = $this->registry->options['bburl'] . '/blog.php';
$permalink = $this->registry->options['bburl'] . '/blog.php?b= ' . $this->fetch_field('blogid');
if (!empty($this->registry->options['vb_antispam_key']))
{ // global key, use the global URL aka blog.php
$akismet_key = $this->registry->options['vb_antispam_key'];
//.........这里部分代码省略.........
示例13: processOptions
/**
* Set value for basic options.
* @param string Code of the media
* @param string Options of the media
* @return string HTML representation of the media
*/
function processOptions(&$text)
{
$optionArray = explode(',', $options);
$this->_mediaInfo['width'] = iif(isset($optionArray[0]) && !empty($optionArray[0]) && ereg('^[0-9]{1,3}$', $optionArray[0]), $optionArray[0], $this->vbulletin->options['anymediawidth']);
$this->_mediaInfo['height'] = iif(isset($optionArray[1]) && !empty($optionArray[1]) && ereg('^[0-9]{1,3}$', $optionArray[1]), $optionArray[1], $this->vbulletin->options['anymediaheight']);
$this->_mediaInfo['autoplay'] = iif($this->vbulletin->options['anymediaautoplay'], 'true', 'false');
$this->_mediaInfo['loop'] = $this->vbulletin->options['anymedialoop'];
$this->_mediaInfo['extension'] = iif(isset($optionArray[4]) && !empty($optionArray[4]) && array_key_exists(strtolower($optionArray[4]), $this->_typeList), strtolower($optionArray[4]));
$this->_mediaInfo['url'] = $this->_mediaInfo['link'] = $text;
$this->_mediaInfo['id'] = vbrand(1, 1000);
$this->_mediaInfo['userid'] = $this->vbulletin->userinfo['userid'];
$this->_mediaInfo['username'] = $this->vbulletin->userinfo['username'];
$this->_mediaInfo['download'] = iif($this->vbulletin->userinfo['permissions']['anymediapermissions'] & $this->vbulletin->bf_ugp_anymediapermissions['candownload'] && $this->vbulletin->options['anymediadownload'], true, false);
}
示例14: build_user_activation_id
/**
* (Re)Generates an Activation ID for a user
*
* @param integer User's ID
* @param integer The group to move the user to when they are activated
* @param integer 0 for Normal Activation, 1 for Forgotten Password
* @param boolean Whether this is an email change or not
*
* @return string The Activation ID
*
*/
function build_user_activation_id($userid, $usergroupid, $type, $emailchange = 0)
{
global $vbulletin;
if ($usergroupid == 3 or $usergroupid == 0) {
// stop them getting stuck in email confirmation group forever :)
$usergroupid = 2;
}
$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "useractivation WHERE userid = {$userid} AND type = {$type}");
$activateid = vbrand(0, 100000000);
/*insert query*/
$vbulletin->db->query_write("\n\t\tREPLACE INTO " . TABLE_PREFIX . "useractivation\n\t\t\t(userid, dateline, activationid, type, usergroupid, emailchange)\n\t\tVALUES\n\t\t\t({$userid}, " . TIMENOW . ", {$activateid} , {$type}, {$usergroupid}, " . intval($emailchange) . ")\n\t");
if ($userinfo = fetch_userinfo($userid)) {
$userdata =& datamanager_init('User', $vbulletin, ERRTYPE_SILENT);
$userdata->set_existing($userinfo);
$userdata->set_bitfield('options', 'noactivationmails', 0);
$userdata->save();
}
return $activateid;
}
示例15: fetch_user_salt
/**
* Generates a totally random string
*
* @param integer Length of string to create
*
* @return string Generated String
*
*/
function fetch_user_salt($length = 3)
{
$salt = '';
for ($i = 0; $i < $length; $i++) {
$salt .= chr(vbrand(33, 126));
}
return $salt;
}