예제 #1
0
 /**
  * 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
0
파일: activate.php 프로젝트: holandacz/nb4
// ########################################################################
// ######################### 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
0
 /**
  * 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
0
/**
* 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;
}
 /**
  * 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
0
	/**
	* 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
0
파일: email.php 프로젝트: holandacz/nb4
 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
0
	/**
	* 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
0
파일: login.php 프로젝트: holandacz/nb4
    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
0
	/**
	 * 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
0
 /**
  * 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
0
	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'];
				}
				else
				{
					$akismet_key = $this->info['akismet_key'];
					$akismet_url = $this->registry->options['bburl'] . '/blog.php?u=' . $this->fetch_field('userid');
				}

				if (!empty($akismet_key))
				{
					// these are taken from the Akismet API: http://akismet.com/development/api/
					$akismet_data = array();
					$akismet_data['user_ip'] = IPADDRESS;
					$akismet_data['user_agent'] = USER_AGENT;
					$akismet_data['permalink'] = $permalink;
					$akismet_data['comment_type'] = 'trackback';
					$akismet_data['comment_author_url'] = $this->fetch_field('url');
					$akismet_data['comment_content'] = $this->fetch_field('snippet');
					if (verify_akismet_status($akismet_key, $akismet_url, $akismet_data) == 'spam')
					{
						$this->set('state', 'moderation');
					}
				}
			}

		}

		$return_value = true;
		($hook = vBulletinHook::fetch_hook('blog_trackbackdata_presave')) ? eval($hook) : false;

		$this->presave_called = $return_value;
		return $return_value;
	}
예제 #13
0
 /**
  * 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
0
/**
 * (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
0
/**
 * 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;
}
/**
 * Fetches a random social group
 *
 * @param boolean $force_rebuild				Force the cache to be rebuilt
 * @param boolean $without_icon					Fetch groups that have no icon
 * @return array								Array of groupinfos
 */
function fetch_socialgroup_random_group($without_icon = false)
{
    global $vbulletin;
    $total = $vbulletin->db->query_first("\n\t\tSELECT COUNT(*) AS total\n\t\tFROM " . TABLE_PREFIX . "socialgroup AS socialgroup\n\t\tINNER JOIN " . TABLE_PREFIX . "socialgroupicon AS sgicon ON (sgicon.groupid = socialgroup.groupid)\n\t");
    if (!$total['total']) {
        return false;
    }
    $hook_query_fields = $hook_query_joins = $hook_query_where = '';
    ($hook = vBulletinHook::fetch_hook('group_fetch_random')) ? eval($hook) : false;
    $sql = "SELECT socialgroup.*, sgicon.dateline AS icondateline,\n\t\t\t\t\tsgicon.thumbnail_width AS iconthumb_width, sgicon.thumbnail_height AS iconthumb_height,\n\t\t\t\t\tsocialgroup.socialgroupcategoryid AS categoryid, sgc.title AS categoryname\n\t\t\t\t\t{$hook_query_fields}\n\t\t\tFROM " . TABLE_PREFIX . "socialgroup AS socialgroup " . ($without_icon ? 'LEFT' : 'INNER') . " JOIN " . TABLE_PREFIX . "socialgroupicon AS sgicon ON (sgicon.groupid = socialgroup.groupid)\n\t\t\tINNER JOIN " . TABLE_PREFIX . "socialgroupcategory AS sgc ON (sgc.socialgroupcategoryid = socialgroup.socialgroupcategoryid)\n\t\t\t{$hook_query_joins}\n\t\t\t{$hook_query_where}\n\t\t\tLIMIT " . vbrand(0, max(--$total['total'], 1)) . ", 1\n\t";
    $result = $vbulletin->db->query_first($sql);
    if (!$result and !$without_icon) {
        return fetch_socialgroup_random_group(true);
    }
    return $result;
}
예제 #17
0
/**
 * Fetches random social groups
 *
 * @return array								Array of groupinfos
 */
function fetch_socialgroup_random_groups()
{
	global $vbulletin;

	$total = $vbulletin->db->query_first("
		SELECT COUNT(*) AS total
		FROM " . TABLE_PREFIX . "socialgroup AS socialgroup
		LEFT JOIN " . TABLE_PREFIX . "socialgroupicon AS sgicon ON (sgicon.groupid = socialgroup.groupid)
	");

	if (!$total['total'])
	{
		return array();
	}

	$hook_query_fields = $hook_query_joins = $hook_query_where = '';
	($hook = vBulletinHook::fetch_hook('group_fetch_random')) ? eval($hook) : false;

	$sql = "
		SELECT socialgroup.*, socialgroup.dateline AS createdate
			,sgicon.dateline AS icondateline, sgicon.thumbnail_width AS iconthumb_width, sgicon.thumbnail_height AS iconthumb_height
			,sgc.title AS categoryname, sgc.socialgroupcategoryid AS categoryid
		FROM " . TABLE_PREFIX ."socialgroup AS socialgroup
		LEFT JOIN " . TABLE_PREFIX . "socialgroupicon AS sgicon ON sgicon.groupid = socialgroup.groupid
		INNER JOIN " . TABLE_PREFIX . "socialgroupcategory AS sgc ON (sgc.socialgroupcategoryid = socialgroup.socialgroupcategoryid)
		$hook_query_joins
		$hook_query_where
		LIMIT " . vbrand(0, max(--$total['total'],1)) . ", 10
	";

	$result = $vbulletin->db->query_read_slave($sql);

	$groups = array();
	while ($group = $vbulletin->db->fetch_array($result))
	{
		$group = prepare_socialgroup($group, true);

		$group['delete_group'] = can_delete_group($group);
		$group['edit_group'] = can_edit_group($group);
		$group['leave_group'] = can_leave_group($group);
		$group['group_options'] = ($group['delete_group'] OR $group['edit_group'] OR $group['leave_group']);

		$groups[] = $group;
	}
	$vbulletin->db->free_result($result);

	return $groups;
}
예제 #18
0
// #############################################################################
/*
	Make the renames into their own step so that they don't trip the "existing table" check
	The check takes place on each step prior to the rename so that the attachment file we are moving
	will conflict with the attachment file we are creating.  An extra step is a quicker and safer
	alternative to coding overrides into the check code.
*/
if ($vbulletin->GPC['step'] == 4)
{
	if (!$upgrade->field_exists('attachment', 'filedataid') AND $upgrade->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
		$upgrade->run_query(
			sprintf($vbphrase['update_table'], TABLE_PREFIX . "filedata"),
			"RENAME TABLE " . TABLE_PREFIX . "filedata TO " . TABLE_PREFIX . "filedata" . vbrand(0, 1000000),
			MYSQL_ERROR_TABLE_EXISTS
		);
	}

	$upgrade->run_query(
		sprintf($vbphrase['update_table'], TABLE_PREFIX . "attachment"),
		"RENAME TABLE " . TABLE_PREFIX . "attachment TO " . TABLE_PREFIX . "filedata",
		MYSQL_ERROR_TABLE_EXISTS
	);

	$upgrade->execute();
}

// #############################################################################
if ($vbulletin->GPC['step'] == 5)
예제 #19
0
 if (empty($vbulletin->GPC['email_subject']) or empty($vbulletin->GPC['email']) or empty($vbulletin->GPC['email_from'])) {
     print_stop_message('please_complete_required_fields');
 }
 if (false === strpos($vbulletin->GPC['email'], '{password}')) {
     print_stop_message('you_must_enter_the_password_token_into_the_message');
 }
 // select affected users
 $result = $vbulletin->db->query("\r\n\t\tSELECT userid \r\n\t\tFROM " . TABLE_PREFIX . "user \r\n\t\tWHERE password = MD5(CONCAT(MD5(username),salt)) " . ($period ? 'AND lastvisit < ' . (TIMENOW - $period) : '') . " \r\n\t\tAND userid > {$lastuser}  \r\n\t\tLIMIT 0, " . $vbulletin->GPC['quantity'] . "\r\n\t");
 if ($total = $vbulletin->db->num_rows($result)) {
     while ($user = $vbulletin->db->fetch_array($result)) {
         // fetch their info
         $user = fetch_userinfo($user['userid']);
         // set last user processed
         $lastuser = $user['userid'];
         // make random password
         $newpassword = substr(md5(vbrand(0, 100000000)), 0, 8);
         // send mail to user
         $message = str_replace('{username}', $user['username'], $vbulletin->GPC['email']);
         $message = str_replace('{password}', $newpassword, $message);
         if (!vbmail($user['email'], $vbulletin->GPC['email_subject'], $message, true, $vbulletin->GPC['from'])) {
             $email_errors = true;
             continue;
         }
         // reset the password
         $userdata = datamanager_init('User', $vbulletin, ERRTYPE_SILENT);
         $userdata->set_existing($user);
         $userdata->set('password', $newpassword);
         $userdata->save();
         // check reset for errors
         if (sizeof($userdata->errors)) {
             $reset_errors = true;
예제 #20
0
파일: tools.php 프로젝트: holandacz/nb4
    print_table_break();
    print_table_header('Cookies');
    print_column_style_code(array('width:30%'));
    $vbulletin->options['cookiedomain'] = iif($vbulletin->options['cookiedomain'] == '', ' ( blank ) ', '<b>' . htmlspecialchars_uni($vbulletin->options['cookiedomain']) . '</b>');
    $vbulletin->options['cookiepath'] = iif($vbulletin->options['cookiepath'] == '', ' ( blank ) ', '<b>' . htmlspecialchars_uni($vbulletin->options['cookiepath']) . '</b>');
    print_label_row('Cookie Prefix', '<b>' . htmlspecialchars_uni(COOKIE_PREFIX) . '</b> (<em>set in includes/config.php</em>)');
    print_label_row(construct_link_code('Reset Cookie Domain', THIS_SCRIPT . '?do=cookie&amp;type=domain'), 'Reset the cookie domain to be blank<dfn>Currently: ' . $vbulletin->options['cookiedomain'] . '</dfn>');
    print_label_row(construct_link_code('Reset Cookie Path', THIS_SCRIPT . '?do=cookie&amp;type=path'), 'Reset the cookie path to be <b>/</b><dfn>Currently: ' . $vbulletin->options['cookiepath'] . '</dfn>');
    print_table_break();
    print_table_header('MySQL');
    print_column_style_code(array('width:30%'));
    print_label_row(construct_link_code('Run Query', THIS_SCRIPT . '?do=mysql&amp;type=query'), 'This allows you to run alter and update queries on the database');
    print_label_row(construct_link_code('Repair Tables', THIS_SCRIPT . '?do=mysql&amp;type=repair'), 'You can select tables that need repaired here');
    print_label_row(construct_link_code('Reset Admin Access', THIS_SCRIPT . '?do=user&amp;type=access'), 'Reset admin access for a user');
    print_table_break();
    $randnumb = vbrand(0, 100000000);
    print_table_header('Other Tools');
    print_column_style_code(array('width:30%'));
    print_label_row(construct_link_code($vbulletin->options['bbactive'] ? 'Turn Off Forum' : 'Turn On Forum', THIS_SCRIPT . '?do=bbactive'), 'Your forum is <b>' . ($vbulletin->options['bbactive'] ? 'On' : 'Off') . '</b>');
    $childcount = $db->query_first("\n\t\tSELECT COUNT(*) AS count\n\t\tFROM " . TABLE_PREFIX . "forum\n\t\tWHERE childlist = ''\n\t");
    if ($childcount['count']) {
        print_label_row(construct_link_code('Rebuild', THIS_SCRIPT . '?do=childlist'), 'You have forum with empty childlists, which is not good.');
    }
    print_label_row(construct_link_code('Default Language', THIS_SCRIPT . '?do=language'), 'Reset board default language.');
    print_table_break();
    print_table_header('Time');
    print_column_style_code(array('width:30%'));
    print_label_row('System Time', $systemdate = date('r T'));
    print_label_row('Your Time', $userdate = vbdate('r T'));
    print_table_footer();
} else {
 /**
  * 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'];
     vB::getDbAssertor()->assertQuery('humanverify', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_INSERT, 'hash' => $verify['hash'], 'answer' => $verify['answer'], 'dateline' => vB::getRequest()->getTimeNow()));
     return $verify;
 }