Exemple #1
0
	function send_ping($pingurl, $url, $title = '', $excerpt = '', $blog_title = '')
	{
		$params = array(
			'url'        => $url,
			'title'      => $title,
			'excerpt'    => $excerpt,
			'blog_title' => $blog_title,
		);

		foreach($params AS $key => $val)
		{
			if (!empty($val))
			{
				$query[] = $key . '=' . urlencode($val);
			}
		}

		$vurl = new vB_vURL($this->registry);
		$vurl->set_option(VURL_URL, $pingurl);
		$vurl->set_option(VURL_POST, 1);
		$vurl->set_option(VURL_HEADER, 1);
		$vurl->set_option(VURL_ENCODING, 'gzip');
		$vurl->set_option(VURL_POSTFIELDS, implode('&', $query));
		$vurl->set_option(VURL_RETURNTRANSFER, 1);
		$vurl->set_option(VURL_CLOSECONNECTION, 1);
		return $vurl->exec();
	}
 /**
  * Verify is supplied token/reponse is valid
  *
  *	@param	array	Values given by user 'input' and 'hash'
  *
  * @return	bool
  */
 function verify_token($input)
 {
     if (!isset($input['recaptcha_challenge_field'])) {
         $input['recaptcha_challenge_field'] = '';
     }
     if (!isset($input['recaptcha_response_field'])) {
         $input['recaptcha_response_field'] = '';
     }
     if ($input['recaptcha_response_field'] and $input['recaptcha_challenge_field']) {
         // Contact recaptcha.net
         $private_key = $this->registry->options['hv_recaptcha_privatekey'] ? $this->registry->options['hv_recaptcha_privatekey'] : '6LfHsgMAAAAAACYsFwZz6cqcG-WWnfay7NIrciyU';
         $query = array('privatekey=' . urlencode($private_key), 'remoteip=' . urlencode(IPADDRESS), 'challenge=' . urlencode($input['recaptcha_challenge_field']), 'response=' . urlencode($input['recaptcha_response_field']));
         $vurl = new vB_vURL();
         $vurl->set_option(VURL_URL, 'http://api-verify.recaptcha.net/verify');
         $vurl->set_option(VURL_USERAGENT, 'vBulletin ' . FILE_VERSION);
         $vurl->set_option(VURL_POST, 1);
         $vurl->set_option(VURL_POSTFIELDS, implode('&', $query));
         $vurl->set_option(VURL_RETURNTRANSFER, 1);
         $vurl->set_option(VURL_CLOSECONNECTION, 1);
         if (($result = $vurl->exec()) === false) {
             $this->error = 'humanverify_recaptcha_unreachable';
             return false;
         } else {
             $result = explode("\n", $result);
             if ($result[0] === 'true') {
                 return true;
             }
             switch ($result[1]) {
                 case 'invalid-site-public-key':
                     $this->error = 'humanverify_recaptcha_publickey';
                     break;
                 case 'invalid-site-private-key':
                     $this->error = 'humanverify_recaptcha_privatekey';
                     break;
                 case 'invalid-referrer':
                     $this->error = 'humanverify_recaptcha_referrer';
                     break;
                 case 'invalid-request-cookie':
                     $this->error = 'humanverify_recaptcha_challenge';
                     break;
                 case 'verify-params-incorrect':
                     $this->error = 'humanverify_recaptcha_parameters';
                     break;
                 default:
                     $this->error = 'humanverify_image_wronganswer';
             }
             return false;
         }
     } else {
         $this->error = 'humanverify_image_wronganswer';
         return false;
     }
 }
Exemple #3
0
	/**
	 * Overrides the Facebook API request methods, so we can use vUrl
	 *
	 * @param String $url the URL to make the request to
	 * @param Array $params the parameters to use for the POST body
	 * @param CurlHandler $ch optional initialized curl handle
	 * @return String the response text
	 */
	protected function makeRequest($url, $params, $ch = null)
	{
		global $vbulletin;
		$opts = self::$CURL_OPTS;

		require_once(DIR . '/includes/class_vurl.php');
		$vurl = new vB_vURL($vbulletin);
		$vurl->set_option(VURL_URL, $url);
		$vurl->set_option(VURL_CONNECTTIMEOUT, $opts[CURLOPT_CONNECTTIMEOUT]);
		$vurl->set_option(VURL_TIMEOUT, $opts[CURLOPT_TIMEOUT]);
		$vurl->set_option(VURL_POST, 1);
		// If we want to use more advanced features such as uploading pictures
		// to facebook, we may need to remove http_build_query and refactor
		// vB_vURL to accept an array of POST data and send the multipart/form-data
		// Content-Type header.
		$vurl->set_option(VURL_POSTFIELDS, http_build_query($params, '', '&'));
		$vurl->set_option(VURL_RETURNTRANSFER, $opts[CURLOPT_RETURNTRANSFER]);
		$vurl->set_option(VURL_CLOSECONNECTION, $opts[CURLOPT_RETURNTRANSFER]);
		$vurl->set_option(VURL_USERAGENT, $opts[CURLOPT_USERAGENT]);
		return $vurl->exec();
	}
 /**
  * Send POST request to API server
  *
  * @param	string	API method to call
  * @param	array	Variables to post
  *
  * @return	string	Response to this request from remote server
  */
 private static function sendRequest($method, $params)
 {
     require_once DIR . '/includes/class_vurl.php';
     $vurl = new vB_vURL(self::$registry);
     $vurl->set_option(VURL_URL, self::POSTURL . $method);
     $vurl->set_option(VURL_POST, 1);
     $vurl->set_option(VURL_RETURNTRANSFER, 1);
     $vurl->set_option(VURL_CLOSECONNECTION, true);
     $vurl->set_option(VURL_POSTFIELDS, http_build_query($params, '', '&'));
     return $vurl->exec();
 }
Exemple #5
0
 /**
  * Overrides the Facebook API request methods, so we can use vUrl
  *
  * @param String $url the URL to make the request to
  * @param Array $params the parameters to use for the POST body
  * @param CurlHandler $ch optional initialized curl handle
  * @return String the response text
  */
 protected function makeRequest($url, $params, $ch = null)
 {
     // try Facebook's cURL implementation (including the new bundled certificates)
     if (function_exists('curl_init')) {
         try {
             $result = parent::makeRequest($url, $params, $ch);
         } catch (Exception $e) {
             $result = false;
         }
         if ($result) {
             return $result;
         }
     }
     // use vB_vURL implmentation
     global $vbulletin;
     $opts = self::$CURL_OPTS;
     require_once DIR . '/includes/class_vurl.php';
     $vurl = new vB_vURL($vbulletin);
     $vurl->set_option(VURL_URL, $url);
     $vurl->set_option(VURL_CONNECTTIMEOUT, $opts[CURLOPT_CONNECTTIMEOUT]);
     $vurl->set_option(VURL_TIMEOUT, $opts[CURLOPT_TIMEOUT]);
     $vurl->set_option(VURL_POST, 1);
     // If we want to use more advanced features such as uploading pictures
     // to facebook, we may need to remove http_build_query and refactor
     // vB_vURL to accept an array of POST data and send the multipart/form-data
     // Content-Type header.
     $vurl->set_option(VURL_POSTFIELDS, http_build_query($params, '', '&'));
     $vurl->set_option(VURL_RETURNTRANSFER, $opts[CURLOPT_RETURNTRANSFER]);
     $vurl->set_option(VURL_CLOSECONNECTION, $opts[CURLOPT_RETURNTRANSFER]);
     $vurl->set_option(VURL_USERAGENT, $opts[CURLOPT_USERAGENT]);
     $result = $vurl->exec();
     // TODO: add some error checking here
     // particularly check if $vurl->fetch_error() returns VURL_ERROR_SSL, meaning the server
     // does not have access to TLS/SSL with which to communicate with facebook
     return $result;
 }
Exemple #6
0
 /**
  * Parse HTML Page and get its title/meta and images
  *
  * @param  string URL of the Page
  *
  * @return array
  */
 public function parsePage($url)
 {
     // Validate url
     if (!preg_match('|^http(s)?://[a-z0-9-]+(\\.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url)) {
         throw new vB_Exception_Api('upload_invalid_url');
     }
     if (($urlparts = vB_String::parseUrl($url)) === false) {
         throw new vB_Exception_Api('upload_invalid_url');
     }
     // Try to fetch the url
     $vurl = new vB_vURL();
     $vurl->set_option(VURL_URL, $url);
     // Use IE8's User-Agent for the best compatibility
     $vurl->set_option(VURL_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)');
     $vurl->set_option(VURL_RETURNTRANSFER, 1);
     $vurl->set_option(VURL_CLOSECONNECTION, 1);
     $vurl->set_option(VURL_FOLLOWLOCATION, 1);
     $vurl->set_option(VURL_HEADER, 1);
     $page = $vurl->exec();
     return $this->extractData($page, $urlparts);
 }
Exemple #7
0
 /** Upload an image based on the url
  *
  *  @param  int     user ID
  * 	@param 	string	remote url
  *  @param	bool	save as attachment
  *
  *	@return	mixed	array of data, includes filesize, dateline, htmltype, filename, extension, and filedataid
  **/
 public function uploadUrl($userid, $url, $attachment = false, $uploadfrom = '')
 {
     //Leave for consistency with admincp
     if (!defined('ATTACH_AS_FILES_NEW')) {
         define('ATTACH_AS_FILES_NEW', 2);
     }
     //Did we get a valid url?
     if (empty($url)) {
         // throw the same exception to mitigate SSRF (VBV-13082)
         throw new vB_Exception_Api('upload_invalid_image');
     }
     if (!preg_match('#^https?://#i', $url)) {
         // throw the same exception to mitigate SSRF (VBV-13082)
         throw new vB_Exception_Api('upload_invalid_image');
     }
     // Retrieve the image
     $vurl = new vB_vURL();
     $fileResult = $vurl->fetch_body($url, 0, false, true);
     if (empty($fileResult['body'])) {
         // throw the same exception to mitigate SSRF (VBV-13082)
         throw new vB_Exception_Api('upload_invalid_image');
     }
     $pathinfo = pathinfo($url);
     if (empty($pathinfo)) {
         // throw the same exception to mitigate SSRF (VBV-13082)
         throw new vB_Exception_Api('upload_invalid_image');
     }
     // if there's no extension here try get one from elsewhere
     $extension_map = $this->imageHandler->getExtensionMap();
     if (empty($pathinfo['extension']) or !array_key_exists(strtolower($pathinfo['extension']), $extension_map)) {
         // try to get an extension from the content type header
         if (!empty($fileResult['headers']['content-type'])) {
             // should be something like image/jpeg
             $typeData = explode('/', $fileResult['headers']['content-type']);
             if (count($typeData) == 2 and array_key_exists(trim($typeData[1]), $extension_map)) {
                 $extension = strtolower($extension_map[trim($typeData[1])]);
             }
         }
         $name = $pathinfo['basename'] . '.' . $extension;
     } else {
         $extension = $pathinfo['extension'];
         $name = $pathinfo['basename'];
     }
     $extension = strtolower($extension);
     $filename = vB_Utilities::getTmpFileName($userid, 'vbattach', ".{$extension}");
     file_put_contents($filename, $fileResult['body']);
     $filesize = strlen($fileResult['body']);
     //Make a local copy
     $filearray = array('name' => $name, 'size' => $filesize, 'type' => 'image/' . $extension_map[$extension], 'tmp_name' => $filename);
     if (!empty($uploadfrom)) {
         $filearray['uploadFrom'] = $uploadfrom;
     }
     if ($attachment) {
         return $this->uploadAttachment($userid, $filearray);
     }
     $result = $this->saveUpload($userid, $filearray, $fileResult['body'], $filesize, $extension, true);
     if (file_exists($filearray['tmp_name'])) {
         @unlink($filearray['tmp_name']);
     }
     return $result;
 }
Exemple #8
0
			$avatar['avatarpath'] = create_full_url($avatar['avatarpath']);
		}
		if (substr($avatar['avatarpath'], 0, 7) == 'http://')
		{
			if ($vbulletin->options['safeupload'])
			{
				$imagepath = $vbulletin->options['tmppath'] . '/' . md5(uniqid(microtime()) . $avatar['avatarid']);
			}
			else
			{
				$imagepath = tempnam(ini_get('upload_tmp_dir'), 'vbthumb');
			}
			if ($filenum = @fopen($imagepath, 'wb'))
			{
				require_once(DIR . '/includes/class_vurl.php');
				$vurl = new vB_vURL($vbulletin);
				$vurl->set_option(VURL_URL, $avatar['avatarpath']);
				$vurl->set_option(VURL_HEADER, true);
				$vurl->set_option(VURL_RETURNTRANSFER, true);
				if ($result = $vurl->exec())
				{
					@fwrite($filenum, $result['body']);
				}
				unset($vurl);
				@fclose($filenum);
				$remotefile = true;
			}
		}

		if (!file_exists($imagepath))
		{
Exemple #9
0
 /**
  * Submits a request to the Akismet service (POST)
  *
  * @access	private
  *
  * @param	string	URL to submit to
  * @param	array	Array of data to submit
  *
  * @return	string	Data returned by Akismet
  */
 function _submit($url, $params)
 {
     $query = array();
     $params['blog'] = $this->akismet_board;
     foreach ($params as $key => $val) {
         if (!empty($val)) {
             $query[] = $key . '=' . urlencode($val);
         }
     }
     $vurl = new vB_vURL($this->registry);
     $vurl->set_option(VURL_URL, $url);
     $vurl->set_option(VURL_USERAGENT, 'vBulletin/' . FILE_VERSION . ' | Akismet/1.0');
     $vurl->set_option(VURL_POST, 1);
     $vurl->set_option(VURL_POSTFIELDS, implode('&', $query));
     $vurl->set_option(VURL_RETURNTRANSFER, 1);
     $vurl->set_option(VURL_CLOSECONNECTION, 1);
     return $vurl->exec();
 }
Exemple #10
0
 /**
  * Upload an avatar from a URL and set it to be this user's custom avatar
  *
  * @param	string	The URL to retrieve the image from
  * @param	array	An array containing the 'crop' element which contains the info to crop the image
  *
  * @return	mixed	an array- which can have $errors or avatarpath- the path from baseurl_core
  */
 public function uploadUrl($url, $data = array())
 {
     if (!defined('ATTACH_AS_FILES_NEW')) {
         //Leave for consistency with admincp
         define('ATTACH_AS_FILES_NEW', 2);
     }
     $imageHandler = vB_Image::instance();
     $usercontext = vB::getUserContext();
     //Only logged-in-users can upload files
     if (!$usercontext->fetchUserId() or !$usercontext->hasPermission('genericpermissions', 'canuseavatar') or !$usercontext->hasPermission('genericpermissions', 'canmodifyprofile')) {
         throw new vB_Exception_Api('no_permission_use_avatar');
     }
     //Did we get a valid url?
     if (empty($url)) {
         // throw the same exception to mitigate SSRF (VBV-13082)
         throw new vB_Exception_Api('upload_invalid_image');
     }
     if (!preg_match('#^https?://#i', $url)) {
         // throw the same exception to mitigate SSRF (VBV-13082)
         throw new vB_Exception_Api('upload_invalid_image');
     }
     // Retrieve the image
     $vurl = new vB_vURL();
     $fileResult = $vurl->fetch_body($url, 0, false, true);
     if (empty($fileResult['body'])) {
         // throw the same exception to mitigate SSRF (VBV-13082)
         throw new vB_Exception_Api('upload_invalid_image');
     }
     $pathinfo = pathinfo($url);
     $data['crop']['org_file_info'] = $pathinfo;
     if (!empty($fileResult['body']) and !empty($pathinfo)) {
         $extension_map = $imageHandler->getExtensionMap();
         if (empty($pathinfo['extension']) or !array_key_exists(strtolower($pathinfo['extension']), $extension_map)) {
             // try to get an extension from the content type header
             if (!empty($fileResult['headers']['content-type'])) {
                 // should be something like image/jpeg
                 $typeData = explode('/', $fileResult['headers']['content-type']);
                 if (count($typeData) == 2 and array_key_exists(trim($typeData[1]), $extension_map)) {
                     $extension = strtolower($extension_map[trim($typeData[1])]);
                 }
             }
         } else {
             $extension = $pathinfo['extension'];
         }
         //did we get an extension?
         if (empty($extension)) {
             // throw the same exception to mitigate SSRF (VBV-13082)
             throw new vB_Exception_Api('upload_invalid_image');
         }
         //Make a local copy
         $filename = vB_Utilities::getTmpFileName('', 'vbprofile', ".{$extension}");
         file_put_contents($filename, $fileResult['body']);
         return vB_Library::instance('user')->uploadAvatar($filename, empty($data['crop']) ? array() : $data['crop']);
     }
 }
Exemple #11
0
 /**
  * Requests headers of remote file to retrieve size without downloading the file
  *
  * @param	string	URL of remote file to retrieve size from
  */
 function fetch_remote_filesize($url)
 {
     if (!preg_match('#^((http|ftp)s?):\\/\\/#i', $url, $check)) {
         $this->set_error('upload_invalid_url');
         return false;
     }
     require_once DIR . '/includes/class_vurl.php';
     $vurl = new vB_vURL($this->registry);
     $vurl->set_option(VURL_URL, $url);
     $vurl->set_option(VURL_HEADER, 1);
     $vurl->set_option(VURL_NOBODY, 1);
     $vurl->set_option(VURL_USERAGENT, 'vBulletin via PHP');
     $vurl->set_option(VURL_CUSTOMREQUEST, 'HEAD');
     $vurl->set_option(VURL_RETURNTRANSFER, 1);
     $vurl->set_option(VURL_CLOSECONNECTION, 1);
     if ($result = $vurl->exec2() and $length = intval($result['content-length'])) {
         return $length;
     } else {
         return false;
     }
 }
 /**
  * Requests headers of remote file to retrieve size without downloading the file
  *
  * @param	string	URL of remote file to retrieve size from
  */
 function fetch_remote_filesize($url)
 {
     if (!preg_match('#^((http|ftp)s?):\\/\\/#i', $url, $check)) {
         $this->set_error('upload_invalid_url');
         return false;
     }
     require_once DIR . '/includes/class_vurl.php';
     $vurl = new vB_vURL($this->registry);
     $vurl->set_option(VURL_URL, $url);
     $vurl->set_option(VURL_FOLLOWLOCATION, 1);
     $vurl->set_option(VURL_HEADER, 1);
     $vurl->set_option(VURL_NOBODY, 1);
     $vurl->set_option(VURL_USERAGENT, 'vBulletin via PHP');
     $vurl->set_option(VURL_CUSTOMREQUEST, 'HEAD');
     $vurl->set_option(VURL_RETURNTRANSFER, 1);
     $vurl->set_option(VURL_CLOSECONNECTION, 1);
     $result = $vurl->exec2();
     if ($result and $length = intval($result['content-length'])) {
         return $length;
     } else {
         if ($result['http-response']['statuscode'] == "200") {
             // We have an HTTP 200 OK, but no content-length, return -1 and let VURL handle the max fetch size
             return -1;
         } else {
             return false;
         }
     }
 }
 /**
  * Perform verification of the payment, this is called from the payment gatewa
  *
  * @return	bool	Whether the payment is valid
  */
 public function verify_payment()
 {
     $this->registry->input->clean_array_gpc('p', array('serial-number' => vB_Cleaner::TYPE_NOHTML));
     if (!$this->registry->GPC['serial-number']) {
         $this->sendHeader(false);
         $this->error_code = 'missing_serial_number';
         return false;
     }
     if (!$this->test()) {
         $this->sendHeader(false);
         $this->error_code = 'Payment processor not configured';
         return false;
     }
     $xml = new vB_XML_Builder();
     $xml->add_group('notification-history-request', array('xmlns' => 'http://checkout.google.com/schema/2'));
     $xml->add_tag('serial-number', $this->registry->GPC['serial-number']);
     $xml->close_group('notification-history-request');
     $xmlString = $xml->fetch_xml();
     $submitUrl = ($this->settings['sandbox'] ? $this->sandboxNotifyUrl : $this->productionNotifyUrl) . trim($this->settings['google_merchant_id']);
     $headers = array('Authorization: Basic ' . base64_encode(trim($this->settings['google_merchant_id']) . ':' . trim($this->settings['google_merchant_key'])), 'Content-Type: application/xml; charset=UTF-8', 'Accept: application/xml; charset=UTF-8');
     $vurl = new vB_vURL();
     $vurl->set_option(VURL_URL, $submitUrl);
     $vurl->set_option(VURL_USERAGENT, 'vBulletin/' . SIMPLE_VERSION);
     $vurl->set_option(VURL_HTTPHEADER, $headers);
     $vurl->set_option(VURL_POST, 1);
     $vurl->set_option(VURL_POSTFIELDS, $xmlString);
     $vurl->set_option(VURL_RETURNTRANSFER, 1);
     $vurl->set_option(VURL_CLOSECONNECTION, 1);
     $result = $vurl->exec();
     $xmlobj = new vB_XML_Parser($result);
     $xmlobj->include_first_tag = true;
     $parsed_xml = $xmlobj->parse();
     if ($parsed_xml === false or !is_array($parsed_xml)) {
         $this->error_code = 'xml_parse_failed';
         $this->sendHeader(false);
         return false;
     }
     $data = each($parsed_xml);
     $notificationType = $data['key'];
     $parsed_xml = $data['value'];
     $this->transaction_id = isset($parsed_xml['google-order-number']) ? $parsed_xml['google-order-number'] : false;
     $hash = isset($parsed_xml['order-summary']['shopping-cart']['items']['item']['merchant-item-id']) ? $parsed_xml['order-summary']['shopping-cart']['items']['item']['merchant-item-id'] : false;
     $order_state = isset($parsed_xml['order-summary']['financial-order-state']) ? $parsed_xml['order-summary']['financial-order-state'] : false;
     $totalcost = isset($parsed_xml['order-summary']['total-charge-amount']['value']) ? floatval($parsed_xml['order-summary']['total-charge-amount']['value']) : 0;
     $tax = isset($parsed_xml['order-summary']['order-adjustment']['total-tax']['value']) ? floatval($parsed_xml['order-summary']['order-adjustment']['total-tax']['value']) : 0;
     $currency = isset($parsed_xml['order-summary']['total-charge-amount']['currency']) ? strtolower($parsed_xml['order-summary']['total-charge-amount']['currency']) : 0;
     $cost = $totalcost - $tax;
     if ($this->transaction_id and $hash) {
         $this->paymentinfo = vB::getDbAssertor()->getRow('vBForum:getPaymentinfo', array('hash' => $hash));
         if (!empty($this->paymentinfo)) {
             $sub = vB::getDbAssertor()->getRow('vBForum:subscription', array('subscriptionid' => $this->paymentinfo['subscriptionid']));
             $subcost = unserialize($sub['cost']);
             if ($subcost) {
                 $this->paymentinfo['currency'] = $currency;
                 $this->paymentinfo['amount'] = $cost;
                 switch ($notificationType) {
                     case 'charge-amount-notification':
                         if ($cost == floatval($subcost["{$this->paymentinfo[subscriptionsubid]}"]['cost'][$currency])) {
                             $this->type = 1;
                         } else {
                             $this->error_code = 'invalid_payment_amount - XML: ' . $result . htmlspecialchars_uni(' SubmitURL: ' . $submitUrl . ' Headers: ' . implode(' ', $headers));
                         }
                         break;
                     case 'refund-amount-notification':
                     case 'chargeback-amount-notification':
                         $this->type = 2;
                         break;
                     case 'new-order-notification':
                     case 'risk-information-notification':
                     case 'authorization-amount-notification':
                         $this->error_code = 'ignored_status_update';
                         $this->type = 3;
                         break;
                     default:
                 }
                 if ($this->type == 0 and $this->error_code == '') {
                     switch ($order_state) {
                         case 'CANCELLED':
                         case 'CANCELLED_BY_GOOGLE':
                             $this->type = 2;
                             break;
                             // Ignore these states
                         // Ignore these states
                         case 'PAYMENT_DECLINED':
                         case 'REVIEWING':
                         case 'CHARGEABLE':
                         case 'CHARGING':
                         case 'CHARGED':
                             $this->type = 3;
                             $this->error_code = 'ignored_status_update';
                         default:
                     }
                 }
             } else {
                 $this->error_code = 'invalid_subscription - XML: ' . $result . htmlspecialchars_uni(' SubmitURL: ' . $submitUrl . ' Headers: ' . implode(' ', $headers));
             }
         } else {
             $this->error_code = 'invalid_payment - XML: ' . $result . htmlspecialchars_uni(' SubmitURL: ' . $submitUrl . ' Headers: ' . implode(' ', $headers));
         }
         $this->sendHeader(true);
     } else {
         $this->error_code = 'invalid_XML_response - XML: ' . $result . htmlspecialchars_uni(' SubmitURL: ' . $submitUrl . ' Headers: ' . implode(' ', $headers));
         $this->sendHeader(false);
         return false;
     }
     $xml = new vB_XML_Builder();
     $xml->add_group('notification-acknowledgment', array('xmlns' => 'http://checkout.google.com/schema/2', 'serial-number' => $this->registry->GPC['serial-number']));
     $xml->close_group();
     $xml->send_content_type_header();
     $xml->send_content_length_header();
     echo $xml->fetch_xml();
     return $this->type > 0 and $this->type < 3;
 }
Exemple #14
0
 /**
  * Submits a request to the Akismet service (POST)
  *
  * @access	private
  *
  * @param	string	URL to submit to
  * @param	array	Array of data to submit
  *
  * @return	string	Data returned by Akismet
  */
 protected function _submit($submitUrl, $params)
 {
     //$params['is_test'] = 1;
     $query = array();
     foreach ($params as $key => $val) {
         if (!empty($val)) {
             $query[] = $key . '=' . urlencode($val);
         }
     }
     $vurl = new vB_vURL();
     $vurl->set_option(VURL_URL, $submitUrl);
     $vurl->set_option(VURL_USERAGENT, 'vBulletin/' . SIMPLE_VERSION . ' | Akismet/1.1');
     $vurl->set_option(VURL_POST, 1);
     $vurl->set_option(VURL_POSTFIELDS, implode('&', $query));
     $vurl->set_option(VURL_RETURNTRANSFER, 1);
     $vurl->set_option(VURL_CLOSECONNECTION, 1);
     return $vurl->exec();
 }
Exemple #15
0
	/**
	* Public
	* Output the XML-RPC Call via HTTP POST
	*
	*/
	function send_xml_call($url)
	{
		if ($this->outputtype != 'call')
		{
			trigger_error('vB_XMLRPC_Client::send_xml_call() Must call build_xml_call() before send_xml_call()', E_USER_ERROR);
		}

		$vurl = new vB_vURL($this->registry);
		$vurl->set_option(VURL_URL, $url);
		$vurl->set_option(VURL_POST, 1);
		$vurl->set_option(VURL_HEADER, 1);
		$vurl->set_option(VURL_ENCODING, 'gzip');
		$vurl->set_option(VURL_HTTPHEADER, array(
			$this->xml_object->fetch_content_type_header(),
		));
		$vurl->set_option(VURL_MAXREDIRS, 1);
		$vurl->set_option(VURL_FOLLOWLOCATION, 1);
		$vurl->set_option(VURL_POSTFIELDS, $this->xml_object->fetch_xml_tag() . $this->xml_object->output());
		$vurl->set_option(VURL_RETURNTRANSFER, 1);
		$vurl->set_option(VURL_CLOSECONNECTION, 1);
		return $vurl->exec();
	}
 /**
  * Submits a request to the Stop Forum Post service
  *
  * @access	private
  *
  * @param	string	URL to submit to
  *
  * @return	string	Data returned by Stop Forum Spam
  */
 protected function _submit($url)
 {
     $vurl = new vB_vURL();
     $vurl->set_option(VURL_URL, $url);
     $vurl->set_option(VURL_USERAGENT, 'vBulletin/' . SIMPLE_VERSION);
     $vurl->set_option(VURL_RETURNTRANSFER, 1);
     $vurl->set_option(VURL_CLOSECONNECTION, 1);
     return $vurl->exec();
 }
Exemple #17
0
 /**
  * Get information from video's URL.
  * This method makes use of bbcode_video table to get provider information
  * @param $url
  * @return array|bool Video data. False if the url is not supported or invalid
  */
 public function getVideoFromUrl($url)
 {
     static $scraped = 0;
     $vboptions = vB::getDatastore()->get_value('options');
     if (!$this->providers) {
         $bbcodes = $this->assertor->assertQuery("video_fetchproviders", array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_STORED));
         foreach ($bbcodes as $bbcode) {
             $this->providers["{$bbcode['tagoption']}"] = $bbcode;
         }
     }
     if (!empty($this->providers)) {
         $match = false;
         foreach ($this->providers as $provider) {
             $addcaret = $provider['regex_url'][0] != '^' ? '^' : '';
             if (preg_match('#' . $addcaret . $provider['regex_url'] . '#si', $url, $match)) {
                 break;
             }
         }
         if ($match) {
             if (!$provider['regex_scrape'] and $match[1]) {
                 $data = array('provider' => $provider['tagoption'], 'code' => $match[1], 'url' => $url);
             } else {
                 if ($provider['regex_scrape'] and $vboptions['bbcode_video_scrape'] > 0 and $scraped < $vboptions['bbcode_video_scrape']) {
                     $vurl = new vB_vURL();
                     $result = $vurl->fetch_body($url);
                     if (preg_match('#' . $provider['regex_scrape'] . '#si', $result, $scrapematch)) {
                         $data = array('provider' => $provider['tagoption'], 'code' => $scrapematch[1], 'url' => $url);
                     }
                     $scraped++;
                 }
             }
         }
         if (!empty($data)) {
             return $data;
         } else {
             return false;
         }
     }
     return false;
 }
Exemple #18
0
 /**
  * Ping the search engines
  * @param 	object		A vB_vURL object
  *
  * @return	none		A blind call, no return currently parsed
  */
 public function ping_search_engines()
 {
     if (!$this->registry->options['sitemap_se_submit']) {
         // value of 0 in bitfield means all search engines are disabled
         return;
     }
     require_once DIR . '/includes/class_vurl.php';
     $vurl = new vB_vURL($this->registry);
     $vurl->set_option(VURL_HEADER, true);
     $vurl->set_option(VURL_RETURNTRANSFER, true);
     $map_url = urlencode($this->registry->options['bburl'] . "/xmlsitemap.php");
     foreach ($this->search_engines as $bit_option => $callback_url) {
         if ($this->registry->options['sitemap_se_submit'] & $bit_option) {
             $vurl->set_option(VURL_URL, $callback_url . $map_url);
             $vurl->exec();
         }
     }
 }
function fetch_body_request($url, $maxsize = 0, $dieonmaxsize = false, $returnheaders = false)
{
    global $vbulletin;
    require_once DIR . '/includes/class_vurl.php';
    $vurl = new vB_vURL($vbulletin);
    return $vurl->fetch_body($url, $maxsize, $dieonmaxsize, $returnheaders);
}
/**
* Prints a setting row for use in options.php?do=options
*
* @param	array	Settings array
* @param	array	Phrases
*/
function print_setting_row($setting, $settingphrase, $option_config = true)
{
    global $vbulletin, $vbphrase, $bgcounter, $settingphrase;
    $settingid = $setting['varname'];
    echo '<tbody>';
    print_description_row(iif($vbulletin->debug and $option_config, '<div class="smallfont" style="float:' . vB_Template_Runtime::fetchStyleVar('right') . '">' . construct_link_code($vbphrase['edit'], "options.php?" . $vbulletin->session->vars['sessionurl'] . "do=editsetting&amp;varname={$setting['varname']}") . construct_link_code($vbphrase['delete'], "options.php?" . $vbulletin->session->vars['sessionurl'] . "do=removesetting&amp;varname={$setting['varname']}") . '</div>') . '<div>' . $settingphrase["setting_{$setting['varname']}_title"] . "<a name=\"{$setting['varname']}\"></a></div>", 0, 2, 'optiontitle' . ($vbulletin->debug ? "\" title=\"\$vbulletin->options['" . $setting['varname'] . "']" : ''));
    echo "</tbody><tbody id=\"tbody_{$settingid}\">\r\n";
    // make sure all rows use the alt1 class
    $bgcounter--;
    $description = "<div class=\"smallfont\"" . ($vbulletin->debug ? "title=\"\$vbulletin->options['{$setting['varname']}']\"" : '') . ">" . $settingphrase["setting_{$setting['varname']}_desc"] . '</div>';
    $name = "setting[{$setting['varname']}]";
    $right = "<span class=\"smallfont\">{$vbphrase['error']}</span>";
    $width = 40;
    $rows = 8;
    if (preg_match('#^input:?(\\d+)$#s', $setting['optioncode'], $matches)) {
        $width = $matches[1];
        $setting['optioncode'] = '';
    } else {
        if (preg_match('#^textarea:?(\\d+)(,(\\d+))?$#s', $setting['optioncode'], $matches)) {
            $rows = $matches[1];
            if ($matches[2]) {
                $width = $matches[3];
            }
            $setting['optioncode'] = 'textarea';
        } else {
            if (preg_match('#^bitfield:(.*)$#siU', $setting['optioncode'], $matches)) {
                $setting['optioncode'] = 'bitfield';
                $setting['bitfield'] =& fetch_bitfield_definitions($matches[1]);
            } else {
                if (preg_match('#^(select|selectmulti|radio):(piped|eval)(\\r\\n|\\n|\\r)(.*)$#siU', $setting['optioncode'], $matches)) {
                    $setting['optioncode'] = "{$matches['1']}:{$matches['2']}";
                    $setting['optiondata'] = trim($matches[4]);
                } else {
                    if (preg_match('#^usergroup:?(\\d+)$#s', $setting['optioncode'], $matches)) {
                        $size = intval($matches[1]);
                        $setting['optioncode'] = 'usergroup';
                    } else {
                        if (preg_match('#^(usergroupextra)(\\r\\n|\\n|\\r)(.*)$#siU', $setting['optioncode'], $matches)) {
                            $setting['optioncode'] = 'usergroupextra';
                            $setting['optiondata'] = trim($matches[3]);
                        } else {
                            if (preg_match('#^profilefield:?([a-z0-9,;=]*)(?:\\r\\n|\\n|\\r)(.*)$#siU', $setting['optioncode'], $matches)) {
                                $setting['optioncode'] = 'profilefield';
                                $setting['optiondata'] = array('constraints' => trim($matches[1]), 'extraoptions' => trim($matches[2]));
                            } else {
                                if (preg_match('#^apipostidmanage(?:\\r\\n|\\n|\\r)(.*)$#siU', $setting['optioncode'], $matches)) {
                                    $setting['optioncode'] = 'apipostidmanage';
                                    $setting['optiondata'] = preg_split("#(\r\n|\n|\r)#s", $matches[1], -1, PREG_SPLIT_NO_EMPTY);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    switch ($setting['optioncode']) {
        // input type="text"
        case '':
            print_input_row($description, $name, $setting['value'], 1, $width);
            break;
            // input type="radio"
        // input type="radio"
        case 'yesno':
            print_yes_no_row($description, $name, $setting['value']);
            break;
            // textarea
        // textarea
        case 'textarea':
            print_textarea_row($description, $name, $setting['value'], $rows, "{$width}\" style=\"width:90%");
            break;
            // bitfield
        // bitfield
        case 'bitfield':
            $setting['value'] = intval($setting['value']);
            $setting['html'] = '';
            if ($setting['bitfield'] === NULL) {
                print_label_row($description, construct_phrase("<strong>{$vbphrase['settings_bitfield_error']}</strong>", implode(',', vB_Bitfield_Builder::fetch_errors())), '', 'top', $name, 40);
            } else {
                #$setting['html'] .= "<fieldset><legend>$vbphrase[yes] / $vbphrase[no]</legend>";
                $setting['html'] .= "<div id=\"ctrl_setting[{$setting['varname']}]\" class=\"smallfont\">\r\n";
                $setting['html'] .= "<input type=\"hidden\" name=\"setting[{$setting['varname']}][0]\" value=\"0\" />\r\n";
                foreach ($setting['bitfield'] as $key => $value) {
                    $value = intval($value);
                    $setting['html'] .= "<table style=\"width:175px; float:" . vB_Template_Runtime::fetchStyleVar('left') . "\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr valign=\"top\">\n\t\t\t\t\t<td><input type=\"checkbox\" name=\"setting[{$setting['varname']}][{$value}]\" id=\"setting[{$setting['varname']}]_{$key}\" value=\"{$value}\"" . ($setting['value'] & $value ? ' checked="checked"' : '') . " /></td>\n\t\t\t\t\t<td width=\"100%\" style=\"padding-top:4px\"><label for=\"setting[{$setting['varname']}]_{$key}\" class=\"smallfont\">" . fetch_phrase_from_key($key) . "</label></td>\r\n</tr></table>\r\n";
                }
                $setting['html'] .= "</div>\r\n";
                #$setting['html'] .= "</fieldset>";
                print_label_row($description, $setting['html'], '', 'top', $name, 40);
            }
            break;
            // select:piped
        // select:piped
        case 'select:piped':
            print_select_row($description, $name, fetch_piped_options($setting['optiondata']), $setting['value']);
            break;
            // radio:piped
        // radio:piped
        case 'radio:piped':
            print_radio_row($description, $name, fetch_piped_options($setting['optiondata']), $setting['value'], 'smallfont');
            break;
            // select:eval
        // select:eval
        case 'select:eval':
            $options = null;
            eval($setting['optiondata']);
            if (is_array($options) and !empty($options)) {
                print_select_row($description, $name, $options, $setting['value']);
            } else {
                print_input_row($description, $name, $setting['value']);
            }
            break;
            // select:eval
        // select:eval
        case 'selectmulti:eval':
            $options = null;
            eval($setting['optiondata']);
            if (is_array($options) and !empty($options)) {
                print_select_row($description, $name . '[]', $options, $setting['value'], false, 5, true);
            } else {
                print_input_row($description, $name, $setting['value']);
            }
            break;
            // radio:eval
        // radio:eval
        case 'radio:eval':
            $options = null;
            eval($setting['optiondata']);
            if (is_array($options) and !empty($options)) {
                print_radio_row($description, $name, $options, $setting['value'], 'smallfont');
            } else {
                print_input_row($description, $name, $setting['value']);
            }
            break;
        case 'username':
            if (intval($setting['value']) and $userinfo = $vbulletin->db->query_first("SELECT username FROM " . TABLE_PREFIX . "user WHERE userid = " . intval($setting['value']))) {
                print_input_row($description, $name, $userinfo['username'], false);
            } else {
                print_input_row($description, $name);
            }
            break;
        case 'usergroup':
            $usergrouplist = array();
            foreach ($vbulletin->usergroupcache as $usergroup) {
                $usergrouplist["{$usergroup['usergroupid']}"] = $usergroup['title'];
            }
            if ($size > 1) {
                print_select_row($description, $name . '[]', array(0 => '') + $usergrouplist, unserialize($setting['value']), false, $size, true);
            } else {
                print_select_row($description, $name, $usergrouplist, $setting['value']);
            }
            break;
        case 'usergroupextra':
            $usergrouplist = fetch_piped_options($setting['optiondata']);
            foreach ($vbulletin->usergroupcache as $usergroup) {
                $usergrouplist["{$usergroup['usergroupid']}"] = $usergroup['title'];
            }
            print_select_row($description, $name, $usergrouplist, $setting['value']);
            break;
        case 'profilefield':
            static $profilefieldlistcache = array();
            $profilefieldlisthash = md5(serialize($setting['optiondata']));
            if (!isset($profilefieldlistcache[$profilefieldlisthash])) {
                $profilefieldlist = fetch_piped_options($setting['optiondata']['extraoptions']);
                $constraints = preg_split('#;#', $setting['optiondata']['constraints'], -1, PREG_SPLIT_NO_EMPTY);
                $where = array();
                foreach ($constraints as $constraint) {
                    $constraint = explode('=', $constraint);
                    switch ($constraint[0]) {
                        case 'editablegt':
                            $where[] = 'editable > ' . intval($constraint[1]);
                            break;
                        case 'types':
                            $constraint[1] = preg_split('#,#', $constraint[1], -1, PREG_SPLIT_NO_EMPTY);
                            if (!empty($constraint[1])) {
                                $where[] = "type IN('" . implode("', '", array_map(array($vbulletin->db, 'escape_string'), $constraint[1])) . "')";
                            }
                            break;
                    }
                }
                $profilefields = $vbulletin->db->query_read_slave("\n\t\t\t\t\tSELECT *\n\t\t\t\t\tFROM " . TABLE_PREFIX . "profilefield\n\t\t\t\t\t" . (!empty($where) ? 'WHERE ' . implode(' AND ', $where) : '') . "\n\t\t\t\t\tORDER BY displayorder\n\t\t\t\t");
                while ($profilefield = $vbulletin->db->fetch_array($profilefields)) {
                    $fieldname = "field{$profilefield['profilefieldid']}";
                    $profilefieldlist[$fieldname] = construct_phrase($vbphrase['profilefield_x_fieldid_y'], fetch_phrase_from_key("{$fieldname}_title"), $fieldname);
                }
                $profilefieldlistcache[$profilefieldlisthash] = $profilefieldlist;
                unset($profilefieldlist, $constraints, $constraint, $where, $profilefields, $profilefield, $fieldname);
            }
            print_select_row($description, $name, $profilefieldlistcache[$profilefieldlisthash], $setting['value']);
            break;
            // arbitrary number of <input type="text" />
        // arbitrary number of <input type="text" />
        case 'multiinput':
            $setting['html'] = "<div id=\"ctrl_{$setting['varname']}\"><fieldset id=\"multi_input_fieldset_{$setting['varname']}\" style=\"padding:4px\">";
            $setting['values'] = unserialize($setting['value']);
            $setting['values'] = is_array($setting['values']) ? $setting['values'] : array();
            $setting['values'][] = '';
            foreach ($setting['values'] as $key => $value) {
                $setting['html'] .= "<div id=\"multi_input_container_{$setting['varname']}_{$key}\">" . ($key + 1) . " <input type=\"text\" class=\"bginput\" name=\"setting[{$setting['varname']}][{$key}]\" id=\"multi_input_{$setting['varname']}_{$key}\" size=\"40\" value=\"" . htmlspecialchars_uni($value) . "\" tabindex=\"1\" /></div>";
            }
            $i = sizeof($setting['values']);
            if ($i == 0) {
                $setting['html'] .= "<div><input type=\"text\" class=\"bginput\" name=\"setting[{$setting['varname']}][{$i}]\" size=\"40\" tabindex=\"1\" /></div>";
            }
            $setting['html'] .= "\n\t\t\t\t</fieldset>\n\t\t\t\t<div class=\"smallfont\"><a href=\"#\" onclick=\"return multi_input['{$setting['varname']}'].add()\">Add Another Option</a></div>\n\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t<!--\n\t\t\t\tmulti_input['{$setting['varname']}'] = new vB_Multi_Input('{$setting['varname']}', {$i}, '" . $vbulletin->options['cpstylefolder'] . "');\n\t\t\t\t//-->\n\t\t\t\t</script>\n\t\t\t";
            print_label_row($description, $setting['html']);
            break;
            // activity stream options
        // activity stream options
        case 'activitystream':
            $options = array();
            $activities = $vbulletin->db->query_read("\n\t\t\t\tSELECT\n\t\t\t\t\ttypeid, section, type, enabled\n\t\t\t\tFROM " . TABLE_PREFIX . "activitystreamtype AS a\n\t\t\t\tINNER JOIN " . TABLE_PREFIX . "package AS p ON (p.packageid = a.packageid)\n\t\t\t\tORDER BY section, type\n\t\t\t");
            while ($activity = $vbulletin->db->fetch_array($activities)) {
                $options["{$activity['section']}_{$activity['type']}"] = $activity;
            }
            $setting['html'] = '';
            $setting['html'] .= "<div id=\"ctrl_setting[{$setting['varname']}]\" class=\"smallfont\">\r\n";
            $setting['html'] .= "<input type=\"hidden\" name=\"setting[{$setting['varname']}][0]\" value=\"0\" />\r\n";
            foreach ($options as $key => $activity) {
                $setting['html'] .= "<table style=\"width:175px; float:" . vB_Template_Runtime::fetchStyleVar('left') . "\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr valign=\"top\">\n\t\t\t\t<td><input type=\"checkbox\" name=\"setting[{$setting['varname']}][{$activity['typeid']}]\" id=\"setting[{$setting['varname']}]_{$key}\" value=\"1\"" . ($activity['enabled'] ? ' checked="checked"' : '') . " /></td>\n\t\t\t\t<td width=\"100%\" style=\"padding-top:4px\"><label for=\"setting[{$setting['varname']}]_{$key}\" class=\"smallfont\">" . fetch_phrase_from_key($key) . "</label></td>\r\n</tr></table>\r\n";
            }
            print_label_row($description, $setting['html'], '', 'top', $name, 40);
            break;
            // default registration options
        // default registration options
        case 'defaultregoptions':
            $setting['value'] = intval($setting['value']);
            $checkbox_options = array('receiveemail' => 'display_email', 'adminemail' => 'receive_admin_emails', 'invisiblemode' => 'invisible_mode', 'vcard' => 'allow_vcard_download', 'signature' => 'display_signatures', 'avatar' => 'display_avatars', 'image' => 'display_images', 'showreputation' => 'display_reputation', 'enablepm' => 'receive_private_messages', 'emailonpm' => 'send_notification_email_when_a_private_message_is_received', 'pmpopup' => 'pop_up_notification_box_when_a_private_message_is_received');
            $setting['value'] = intval($setting['value']);
            $setting['html'] = '';
            #$setting['html'] .= "<fieldset><legend>$vbphrase[yes] / $vbphrase[no]</legend>";
            $setting['html'] .= "<div id=\"ctrl_setting[{$setting['varname']}]\" class=\"smallfont\">\r\n";
            $setting['html'] .= "<input type=\"hidden\" name=\"setting[{$setting['varname']}][0]\" value=\"0\" />\r\n";
            foreach ($checkbox_options as $key => $phrase) {
                $value = $vbulletin->bf_misc_regoptions["{$key}"];
                $setting['html'] .= "<table style=\"width:175px; float:" . vB_Template_Runtime::fetchStyleVar('left') . "\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr valign=\"top\">\n\t\t\t\t<td><input type=\"checkbox\" name=\"setting[{$setting['varname']}][{$value}]\" id=\"setting[{$setting['varname']}]_{$key}\" value=\"{$value}\"" . ($setting['value'] & $value ? ' checked="checked"' : '') . " /></td>\n\t\t\t\t<td width=\"100%\" style=\"padding-top:4px\"><label for=\"setting[{$setting['varname']}]_{$key}\" class=\"smallfont\">" . fetch_phrase_from_key($phrase) . "</label></td>\r\n</tr></table>\r\n";
            }
            #$setting['html'] .= "</fieldset>";
            print_label_row($description, $setting['html'], '', 'top', $name, 40);
            break;
            // cp folder options
        // cp folder options
        case 'cpstylefolder':
            if ($folders = fetch_cpcss_options() and !empty($folders)) {
                print_select_row($description, $name, $folders, $setting['value'], 1, 6);
            } else {
                print_input_row($description, $name, $setting['value'], 1, 40);
            }
            break;
        case 'apipostidmanage':
            $setting['html'] = "<div id=\"ctrl_apipostidmanage\"><fieldset id=\"multi_input_fieldset_apipostidmanage}\" style=\"padding:4px\">";
            $setting['values'] = unserialize($setting['value']);
            $setting['values'] = is_array($setting['values']) ? $setting['values'] : array();
            $setting['html'] .= "\n\t\t\t\t<div style=\"padding:4px\">\n\t\t\t\t\t<span style=\"display:block\">{$vbphrase['apipostidmanage_enable']}</span>\n\t\t\t\t\t<label for=\"multi_input_apipostidmanage_enable1\" />\n\t\t\t\t\t\t<input type=\"radio\"" . ($setting['values']['enable'] ? ' checked="checked" ' : '') . "class=\"bginput\" name=\"setting[apipostidmanage][enable]\" id=\"multi_input_apipostidmanage_enable1\"  value=\"1\" tabindex=\"1\" />\n\t\t\t\t\t\t{$vbphrase['yes']}\n\t\t\t\t\t</label>\n\t\t\t\t\t<label for=\"multi_input_{$setting['varname']}_enable2\" />\n\t\t\t\t\t\t<input type=\"radio\"" . (!$setting['values']['enable'] ? ' checked="checked" ' : '') . "class=\"bginput\" name=\"setting[apipostidmanage][enable]\" id=\"multi_input_apipostidmanage_enable2\"  value=\"0\" tabindex=\"1\" />\n\t\t\t\t\t\t{$vbphrase['no']}\n\t\t\t\t\t</label>\n\t\t\t\t</div>";
            foreach ($setting['optiondata'] as $device) {
                if (!$vbphrase['apipostidmanage_' . $device]) {
                    continue;
                }
                $setting['html'] .= "<div style=\"padding:4px\">\n\t\t\t\t\t<span style=\"display:block\">" . $vbphrase['apipostidmanage_' . $device] . "</span>\n\t\t\t\t\t<input type=\"text\" class=\"bginput\" name=\"setting[apipostidmanage][{$device}]\" id=\"multi_input_apipostidmanage_{$device}\" size=\"50\" value=\"" . htmlspecialchars_uni($setting['values'][$device]) . "\" tabindex=\"1\" />\n\t\t\t\t</div>";
            }
            $setting['html'] .= "</fieldset></div>";
            print_label_row($description, $setting['html'], '', 'top', 'apipostidmanage');
            break;
            break;
            // cookiepath / cookiedomain options
        // cookiepath / cookiedomain options
        case 'cookiepath':
        case 'cookiedomain':
            $func = 'fetch_valid_' . $setting['optioncode'] . 's';
            $cookiesettings = $func($setting['optioncode'] == 'cookiepath' ? $vbulletin->script : $_SERVER['HTTP_HOST'], $vbphrase['blank']);
            $setting['found'] = in_array($setting['value'], array_keys($cookiesettings));
            $setting['html'] = "\n\t\t\t<div id=\"ctrl_{$setting['varname']}\">\n\t\t\t<fieldset>\n\t\t\t\t<legend>{$vbphrase['suggested_settings']}</legend>\n\t\t\t\t<div style=\"padding:4px\">\n\t\t\t\t\t<select name=\"setting[{$setting['varname']}]\" tabindex=\"1\" class=\"bginput\">" . construct_select_options($cookiesettings, $setting['value']) . "\n\t\t\t\t\t</select>\n\t\t\t\t</div>\n\t\t\t</fieldset>\n\t\t\t<br />\n\t\t\t<fieldset>\n\t\t\t\t<legend>{$vbphrase['custom_setting']}</legend>\n\t\t\t\t<div style=\"padding:4px\">\n\t\t\t\t\t<label for=\"{$settingid}o\"><input type=\"checkbox\" id=\"{$settingid}o\" name=\"setting[{$settingid}_other]\" tabindex=\"1\" value=\"1\"" . ($setting['found'] ? '' : ' checked="checked"') . " />{$vbphrase['use_custom_setting']}\n\t\t\t\t\t</label><br />\n\t\t\t\t\t<input type=\"text\" class=\"bginput\" size=\"25\" name=\"setting[{$settingid}_value]\" value=\"" . ($setting['found'] ? '' : $setting['value']) . "\" />\n\t\t\t\t</div>\n\t\t\t</fieldset>\n\t\t\t</div>";
            print_label_row($description, $setting['html'], '', 'top', $name, 50);
            break;
        case 'facebooksslcheck':
            require_once DIR . '/includes/class_vurl.php';
            $vurl = new vB_vURL($vbulletin);
            $result = $vurl->test_ssl();
            print_label_row($description, $result ? $vbphrase['supported'] : $vbphrase['not_supported']);
            break;
        case 'usergroups:none':
            $array = build_usergroup_list($vbphrase['none'], 0);
            $size = sizeof($array);
            print_select_row($description, $name . '[]', $array, unserialize($setting['value']), false, $size > 10 ? 10 : $size, true);
            break;
        case 'usergroups:all':
            $array = build_usergroup_list($vbphrase['all'], -1);
            $size = sizeof($array);
            print_select_row($description, $name . '[]', $array, unserialize($setting['value']), false, $size > 10 ? 10 : $size, true);
            break;
        case 'forums:all':
            $array = construct_forum_chooser_options(-1, $vbphrase['all']);
            $size = sizeof($array);
            $vbphrase[forum_is_closed_for_posting] = $vbphrase[closed];
            print_select_row($description, $name . '[]', $array, unserialize($setting['value']), false, $size > 10 ? 10 : $size, true);
            break;
        case 'forums:none':
            $array = construct_forum_chooser_options(0, $vbphrase['none']);
            $size = sizeof($array);
            $vbphrase[forum_is_closed_for_posting] = $vbphrase[closed];
            print_select_row($description, $name . '[]', $array, unserialize($setting['value']), false, $size > 10 ? 10 : $size, true);
            break;
            // just a label
        // just a label
        default:
            $handled = false;
            ($hook = vBulletinHook::fetch_hook('admin_options_print')) ? eval($hook) : false;
            if (!$handled) {
                eval("\$right = \"<div id=\\\"ctrl_setting[{$setting['varname']}]\\\">{$setting['optioncode']}</div>\";");
                print_label_row($description, $right, '', 'top', $name, 50);
            }
            break;
    }
    echo "</tbody>\r\n";
    $valid = exec_setting_validation_code($setting['varname'], $setting['value'], $setting['validationcode']);
    echo "<tbody id=\"tbody_error_{$settingid}\" style=\"display:" . (($valid === 1 or $valid === true) ? 'none' : '') . "\"><tr><td class=\"alt1 smallfont\" colspan=\"2\"><div style=\"padding:4px; border:solid 1px red; background-color:white; color:black\"><strong>{$vbphrase['error']}</strong>:<div id=\"span_error_{$settingid}\">{$valid}</div></div></td></tr></tbody>";
}