Example #1
0
	public static function checkUrlAvailable()
	{
		global $vbulletin;
		global $vbphrase;
		require_once DIR . '/includes/functions_databuild.php';
		require_once DIR . '/includes/functions_misc.php';
		fetch_phrase_group('cpcms');
		$vbulletin->input->clean_array_gpc('r', array(
			'url' => TYPE_STR,
			'nodeid' => TYPE_INT));

		$xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
		$xml->add_group('root');
		$url_conflict = '';

		if (strlen($vbulletin->GPC['url'])
			and $row = $vbulletin->db->query_first($sql="SELECT nodeid FROM " . TABLE_PREFIX .
			"cms_node WHERE new != 1 AND lower(url)='" . $vbulletin->db->escape_string(strtolower($vbulletin->GPC['url'])) ."'"
			. ($vbulletin->GPC_exists['nodeid'] ? " and nodeid <> " . $vbulletin->GPC['nodeid'] : "" ) )
			and intval($row['nodeid']))
		{
			$url_conflict = $vbphrase['url_in_use'];
		}

		$xml->add_tag('html', $url_conflict);
		$xml->close_group();
		$xml->print_xml();
		return '';
	}
Example #2
0
/**
* Halts execution and shows the specified error message
*
* @param	string	Error message
* @param	string	Optional HTML code to insert in the <head> of the error page
* @param	boolean	If true, set the visitor's status on WOL to error page
* @param	string	Optional template to force the display to use. Ignored if showing a lite error
*/
function standard_error($error = '', $headinsert = '', $savebadlocation = true, $override_template = '')
{
    global $header, $footer, $headinclude, $forumjump, $timezone, $gobutton;
    global $vbulletin, $vbphrase, $stylevar, $template_hook;
    global $pmbox, $show, $ad_location, $notifications_menubits, $notifications_total;
    $show['notices'] = false;
    construct_forum_jump();
    $title = $vbulletin->options['bbtitle'];
    $pagetitle =& $title;
    $errormessage = $error;
    if (!$vbulletin->userinfo['badlocation'] and $savebadlocation) {
        $vbulletin->userinfo['badlocation'] = 3;
    }
    require_once DIR . '/includes/functions_misc.php';
    $postvars = construct_post_vars_html();
    if (defined('VB_ERROR_PERMISSION') and VB_ERROR_PERMISSION == true) {
        $show['permission_error'] = true;
    } else {
        $show['permission_error'] = false;
    }
    $show['search_noindex'] = (bool) ($vbulletin->userinfo['permissions']['forumpermissions'] & $vbulletin->bf_ugp_forumpermissions['canview']);
    $navbits = $navbar = '';
    if (defined('VB_ERROR_LITE') and VB_ERROR_LITE == true) {
        $templatename = 'STANDARD_ERROR_LITE';
        define('NOPMPOPUP', 1);
        // No Footer here
    } else {
        if ($vbulletin->userinfo['permissions']['forumpermissions'] & $vbulletin->bf_ugp_forumpermissions['canview']) {
            $show['forumdesc'] = false;
            $navbits = construct_navbits(array('' => $vbphrase['vbulletin_message']));
            eval('$navbar = "' . fetch_template('navbar') . '";');
        }
        $templatename = $override_template ? preg_replace('#[^a-z0-9_]#i', '', $override_template) : 'STANDARD_ERROR';
    }
    ($hook = vBulletinHook::fetch_hook('error_generic')) ? eval($hook) : false;
    if ($vbulletin->GPC['ajax']) {
        require_once DIR . '/includes/class_xml.php';
        $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
        $xml->add_tag('error', $errormessage);
        $xml->print_xml();
        exit;
    } else {
        if ($vbulletin->noheader) {
            @header('Content-Type: text/html' . ($vbulletin->userinfo['lang_charset'] != '' ? '; charset=' . $vbulletin->userinfo['lang_charset'] : ''));
        }
        eval('print_output("' . fetch_template($templatename) . '");');
        exit;
    }
}
Example #3
0
	require_once(DIR . '/includes/functions_editor.php');

	$vminfo = verify_visitormessage($vbulletin->GPC['vmid']);

	$editorid = construct_edit_toolbar(
		htmlspecialchars_uni($vminfo['pagetext']),
		false,
		'visitormessage',
		true,
		true,
		false,
		'qenr',
		$vbulletin->GPC['editorid']
	);

	$xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');

	$xml->add_group('quickedit');
	$xml->add_tag('editor', process_replacement_vars($messagearea), array(
		'reason'       => '',
		'parsetype'    => 'visitormessage',
		'parsesmilies' => true,
		'mode'         => $show['is_wysiwyg_editor']
	));
	$xml->close_group();

	$xml->print_xml();
}

($hook = vBulletinHook::fetch_hook('visitor_message_complete')) ? eval($hook) : false;
Example #4
0
		'width'   => TYPE_UINT,
		'height'  => TYPE_UINT,
		'first'   => TYPE_BOOL,
	  'last'    => TYPE_BOOL,
		'current' => TYPE_UINT,
	  'total'   => TYPE_UINT
	));
	$width = $vbulletin->GPC['width'];
	$height = $vbulletin->GPC['height'];
	$first = $vbulletin->GPC['first'];
	$last = $vbulletin->GPC['last'];
	$current = $vbulletin->GPC['current'];
	$total = $vbulletin->GPC['total'];

	require_once(DIR . '/includes/class_xml.php');
	$xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');

	if (in_array(strtolower($attachmentinfo['extension']), array('jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp')))
	{
		$uniqueid = $vbulletin->GPC['uniqueid'];
		$imagelink = 'attachment.php?' . $vbulletin->session->vars['sessionurl'] . 'attachmentid=' . $attachmentinfo['attachmentid'] . '&d=' . $attachmentinfo['dateline'];
		$attachmentinfo['date_string'] = vbdate($vbulletin->options['dateformat'], $attachmentinfo['dateline']);
		$attachmentinfo['time_string'] = vbdate($vbulletin->options['timeformat'], $attachmentinfo['dateline']);
		$show['newwindow'] = ($attachmentinfo['newwindow'] ? true : false);

		($hook = vBulletinHook::fetch_hook('attachment_lightbox')) ? eval($hook) : false;

		$templater = vB_Template::create('lightbox');
			$templater->register('attachmentinfo', $attachmentinfo);
			$templater->register('current', $current);
			$templater->register('first', $first);
Example #5
0
	/**
	 * vB_Search_Type::getUiXml()
	 * This gets the xml which will be passed to the ajax function. It just wraps
	 * get_ui in html
	 *
	 * @param array $prefs : the stored prefs for this contenttype
	 * @return the appropriate user interface wrapped in XML
	 */
	public function getUiXml($prefs)
	{
		global $vbulletin;
		$xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
		$xml->add_group('root');

		$xml->add_tag('html', $this->listUi($prefs));

		$xml->close_group();
		$xml->print_xml();
	}
Example #6
0
	//and that page will do all the work.
}

//This is for the calendar widget paging;
if ($_REQUEST['do'] == 'calwidget' )
{
	$vbulletin->input->clean_array_gpc('r', array(
		'year' => TYPE_UINT,
		'month' => TYPE_UINT));

	if ( $vbulletin->GPC_exists['year'] AND $vbulletin->GPC_exists['month'])
	{
		$view = vBCms_Widget_Calendar::getCalendar($vbulletin->GPC['year'], $vbulletin->GPC['month']);
		$view->registerTemplater(vB_View::OT_XHTML, new vB_Templater_vB());
		$html = $view->render();
		$xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
		$xml->add_tag('html', $html);
		$xml->print_xml();
	}


}
($hook = vBulletinHook::fetch_hook('ajax_complete')) ? eval($hook) : false;


/*======================================================================*\
|| ####################################################################
|| # 
|| # CVS: $RCSfile$ - $Revision: 37230 $
|| ####################################################################
\*======================================================================*/
Example #7
0
 /**
  * Renders the view to a string and returns it.
  *
  * @return string
  */
 public function render($send_content_headers = false)
 {
     require_once DIR . '/includes/class_xml.php';
     $xml = new vB_AJAX_XML_Builder(vB::$vbulletin, 'text/xml');
     $xml->add_group('container');
     $xml->add_tag('success', 1);
     if ($this->content) {
         $xml->add_tag('html', $this->content->render());
     }
     $xml->add_tag('title', $this->title);
     $xml->add_tag('status', $this->status);
     $xml->add_tag('message', $this->feedback);
     if (sizeof($this->errors)) {
         $xml->add_group('errors');
         foreach ($this->errors as $error) {
             $xml->add_tag('error', $error['message'], array('errcode' => $error['code']));
         }
         $xml->close_group();
     }
     if (sizeof($this->urls)) {
         $xml->add_group('urls');
         foreach ($this->urls as $type => $url) {
             $xml->add_tag('url', $url, array('type' => $type));
         }
         $xml->close_group();
     }
     $xml->close_group();
     if ($send_content_headers and !vB::contentHeadersSent()) {
         $xml->send_content_type_header();
         $xml->send_content_length_header();
         vB::contentHeadersSent(true);
     }
     return $xml->fetch_xml();
 }
Example #8
0
$postbit_factory->registry =& $vbulletin;
$postbit_factory->forum =& $foruminfo;
$postbit_factory->thread =& $threadinfo;
$postbit_factory->cache = array();
$postbit_factory->bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
$postbit_obj =& $postbit_factory->fetch_postbit('post');
$postbit_obj->highlight =& $replacewords;
$postbit_obj->cachable = (!$post['pagetext_html'] and $vbulletin->options['cachemaxage'] > 0 and TIMENOW - $vbulletin->options['cachemaxage'] * 60 * 60 * 24 <= $threadinfo['lastpost']);
($hook = vBulletinHook::fetch_hook('showpost_post')) ? eval($hook) : false;
$postbits = $postbit_obj->construct_postbit($post);
// save post to cache if relevant
if ($postbit_obj->cachable) {
    /*insert query*/
    $db->shutdown_query("\n\t\tREPLACE INTO " . TABLE_PREFIX . "postparsed (postid, dateline, hasimages, pagetext_html, styleid, languageid)\n\t\tVALUES (\n\t\t\t{$post['postid']}, " . intval($threadinfo['lastpost']) . ", " . intval($postbit_obj->post_cache['has_images']) . ", '" . $db->escape_string($postbit_obj->post_cache['text']) . "', " . intval(STYLEID) . ", " . intval(LANGUAGEID) . "\n\t\t\t)\n\t");
}
($hook = vBulletinHook::fetch_hook('showpost_complete')) ? eval($hook) : false;
//if ($_SERVER['REQUEST_METHOD'] == 'POST' AND
if ($vbulletin->GPC['ajax']) {
    require_once DIR . '/includes/class_xml.php';
    $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
    $xml->add_tag('postbit', process_replacement_vars($postbits));
    $xml->print_xml();
} else {
    eval('print_output("' . fetch_template('SHOWTHREAD_SHOWPOST') . '");');
}
/*======================================================================*\
|| ####################################################################
|| # Downloaded: 08:19, Wed Nov 5th 2008
|| # CVS: $RCSfile$ - $Revision: 26399 $
|| ####################################################################
\*======================================================================*/
Example #9
0
    }
    $xml->close_group();
    $doc = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\r\n\r\n";
    $doc .= $xml->output();
    $xml = null;
    require_once DIR . '/includes/functions_file.php';
    file_download($doc, 'vbulletin-settings.xml', 'text/xml');
}
// #############################################################################
// ajax setting value validation
if ($_POST['do'] == 'validate') {
    $vbulletin->input->clean_array_gpc('p', array('varname' => TYPE_STR, 'setting' => TYPE_ARRAY));
    $varname = convert_urlencoded_unicode($vbulletin->GPC['varname']);
    $value = convert_urlencoded_unicode($vbulletin->GPC['setting']["{$varname}"]);
    require_once DIR . '/includes/class_xml.php';
    $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
    $xml->add_group('setting');
    $xml->add_tag('varname', $varname);
    if ($setting = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "setting WHERE varname = '" . $db->escape_string($varname) . "'")) {
        $raw_value = $value;
        $value = validate_setting_value($value, $setting['datatype']);
        $valid = exec_setting_validation_code($setting['varname'], $value, $setting['validationcode'], $raw_value);
    } else {
        $valid = 1;
    }
    $xml->add_tag('valid', $valid);
    $xml->close_group();
    $xml->print_xml();
}
// ***********************************************************************
print_cp_header($vbphrase['vbulletin_options']);
Example #10
0
}
// ######################## CHECK ADMIN PERMISSIONS #######################
if (!($vbulletin->userinfo['permissions']['cms']['admin'] & 2)) {
    print_cp_no_permission();
}
fetch_phrase_group('cpcms');
// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################
//If we get an ajax request, we return the XML and exit
if ($_REQUEST['do'] == 'perms_section') {
    require_once DIR . '/includes/functions_misc.php';
    require_once DIR . '/includes/adminfunctions_misc.php';
    $vbulletin->input->clean_array_gpc('r', array('sectionid' => TYPE_UINT));
    if ($vbulletin->GPC_exists['sectionid']) {
        $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
        $xml->add_group('root');
        $xml->add_tag('html', $vbulletin->GPC['sectionid'] ? getSectionTable($vbulletin->GPC['sectionid']) : showDefault());
        $xml->close_group();
        $xml->print_xml();
        return;
    }
} else {
    if ($_REQUEST['do'] == 'save') {
        saveData();
    } else {
        if ($_REQUEST['do'] == 'remove_perms') {
            removePerms();
        }
    }
}
Example #11
0
 /**
  * Halts execution of the entire system and displays an error message
  *
  * @param	string	Text of the error message. Leave blank to use $this->sql as error text.
  *
  * @return	integer
  */
 function halt($errortext = '')
 {
     global $vbulletin;
     if ($this->connection_recent) {
         $this->error = $this->error($this->connection_recent);
         $this->errno = $this->errno($this->connection_recent);
     }
     if ($this->reporterror) {
         if ($errortext == '') {
             $this->sql = "Invalid SQL:\r\n" . chop($this->sql) . ';';
             $errortext =& $this->sql;
         }
         // Try and stop e-mail flooding.
         if (!$vbulletin->options['disableerroremail']) {
             if (!$vbulletin->options['safeupload']) {
                 $tempdir = ini_get('upload_tmp_dir');
             } else {
                 $tempdir = $vbulletin->options['tmppath'] . '/';
             }
             $unique = md5(COOKIE_SALT);
             $tempfile = $tempdir . "zdberr{$unique}.dat";
             /* If its less than a minute since the last e-mail
             			and the error code is the same as last time, disable e-mail */
             if ($data = @file_get_contents($tempfile)) {
                 $errc = intval(substr($data, 10));
                 $time = intval(substr($data, 0, 10));
                 if ($time and TIMENOW - $time < 60 and intval($this->errno) == $errc) {
                     $vbulletin->options['disableerroremail'] = true;
                 } else {
                     $data = TIMENOW . intval($this->errno);
                     @file_put_contents($tempfile, $data);
                 }
             } else {
                 $data = TIMENOW . intval($this->errno);
                 @file_put_contents($tempfile, $data);
             }
         }
         $vboptions =& $vbulletin->options;
         $technicalemail =& $vbulletin->config['Database']['technicalemail'];
         $bbuserinfo =& $vbulletin->userinfo;
         $requestdate = date('l, F jS Y @ h:i:s A', TIMENOW);
         $date = date('l, F jS Y @ h:i:s A');
         $scriptpath = str_replace('&amp;', '&', $vbulletin->scriptpath);
         $referer = REFERRER;
         $ipaddress = IPADDRESS;
         $classname = get_class($this);
         if ($this->connection_recent) {
             $this->hide_errors();
             list($mysqlversion) = $this->query_first("SELECT VERSION() AS version", DBARRAY_NUM);
             $this->show_errors();
         }
         $display_db_error = (VB_AREA == 'Upgrade' or VB_AREA == 'Install' or $vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel']);
         // Hide the MySQL Version if its going in the source
         if (!$display_db_error) {
             $mysqlversion = '';
         }
         eval('$message = "' . str_replace('"', '\\"', file_get_contents(DIR . '/includes/database_error_message.html')) . '";');
         // add a backtrace to the message
         if ($vbulletin->debug) {
             $trace = debug_backtrace();
             $trace_output = "\n";
             foreach ($trace as $index => $trace_item) {
                 $param = in_array($trace_item['function'], array('require', 'require_once', 'include', 'include_once')) ? $trace_item['args'][0] : '';
                 // remove path
                 $param = str_replace(DIR, '[path]', $param);
                 $trace_item['file'] = str_replace(DIR, '[path]', $trace_item['file']);
                 $trace_output .= "#{$index} {$trace_item['class']}{$trace_item['type']}{$trace_item['function']}({$param}) called in {$trace_item['file']} on line {$trace_item['line']}\n";
             }
             $message .= "\n\nStack Trace:\n{$trace_output}\n";
         }
         require_once DIR . '/includes/functions_log_error.php';
         if (function_exists('log_vbulletin_error')) {
             log_vbulletin_error($message, 'database');
         }
         if ($technicalemail != '' and !$vbulletin->options['disableerroremail'] and verify_email_vbulletin_error($this->errno, 'database')) {
             // If vBulletinHook is defined then we know that options are loaded, so we can then use vbmail
             if (class_exists('vBulletinHook', false)) {
                 @vbmail($technicalemail, $this->appshortname . ' Database Error!', $message, true, $technicalemail);
             } else {
                 @mail($technicalemail, $this->appshortname . ' Database Error!', preg_replace("#(\r\n|\r|\n)#s", @ini_get('sendmail_path') === '' ? "\r\n" : "\n", $message), "From: {$technicalemail}");
             }
         }
         if (defined('STDIN')) {
             echo $message;
             exit;
         }
         // send ajax reponse after sending error email
         if ($vbulletin->GPC['ajax']) {
             require_once DIR . '/includes/class_xml.php';
             $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
             $error = '<p>Database Error</p>';
             if ($vbulletin->debug or VB_AREA == 'Upgrade') {
                 $error .= "\r\n\r\n{$errortext}";
                 $error .= "\r\n\r\n{$this->error}";
             }
             eval('$ajaxmessage = "' . str_replace('"', '\\"', file_get_contents(DIR . '/includes/database_error_message_ajax.html')) . '";');
             $xml->add_group('errors');
             $xml->add_tag('error', $error);
             $xml->add_tag('error_html', $ajaxmessage);
             $xml->close_group('errors');
             $xml->print_xml();
         }
         if (!headers_sent()) {
             if (SAPI_NAME == 'cgi' or SAPI_NAME == 'cgi-fcgi') {
                 header('Status: 503 Service Unavailable');
             } else {
                 header($_SERVER['SERVER_PROTOCOL'] . ' 503 Service Unavailable');
             }
         }
         if ($display_db_error) {
             // display error message on screen
             $message = '<form><textarea rows="15" cols="70" wrap="off" id="message">' . htmlspecialchars_uni($message) . '</textarea></form>';
         } else {
             if ($vbulletin->debug) {
                 // display hidden error message
                 $message = "\r\n<!--\r\n" . htmlspecialchars_uni($message) . "\r\n-->\r\n";
             } else {
                 $message = '';
             }
         }
         if ($vbulletin->options['bburl']) {
             $imagepath = $vbulletin->options['bburl'];
         } else {
             // this might not work with too many slashes in the archive
             $imagepath = VB_AREA == 'Forum' ? '.' : '..';
         }
         eval('$message = "' . str_replace('"', '\\"', file_get_contents(DIR . '/includes/database_error_page.html')) . '";');
         // This is needed so IE doesn't show the pretty error messages
         $message .= str_repeat(' ', 512);
         die($message);
     } else {
         if (!empty($errortext)) {
             $this->error = $errortext;
         }
     }
 }
Example #12
0
            $threadrate->set('threadid', $threadinfo['threadid']);
            $threadrate->set('userid', 0);
            $threadrate->set('vote', $vbulletin->GPC['vote']);
            $threadrate->set('ipaddress', IPADDRESS);
            ($hook = vBulletinHook::fetch_hook('threadrate_add')) ? eval($hook) : false;
            $threadrate->save();
            $update = true;
            if (!$vbulletin->GPC['ajax']) {
                $vbulletin->url = fetch_seo_url('thread', $threadinfo, array('page' => $vbulletin->GPC['pagenumber'], 'pp' => $vbulletin->GPC['perpage']));
                eval(print_standard_redirect('redirect_threadrate_add'));
            }
        }
    }
}
require_once DIR . '/includes/class_xml.php';
$xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
$xml->add_group('threadrating');
if ($update) {
    $thread = $db->query_first_slave("\r\n\t\tSELECT votetotal, votenum\r\n\t\tFROM " . TABLE_PREFIX . "thread\r\n\t\tWHERE threadid = {$threadinfo['threadid']}\r\n\t");
    $average = $thread['votetotal'] / $thread['votenum'];
    $rating = round($average);
    $xml->add_tag('rating_full', vb_number_format($average, 2));
    $xml->add_tag('rating', $rating);
    $xml->add_tag('vote_threshold_met', intval($thread['votenum'] >= $vbulletin->options['showvotes']));
    /*
    //I don't think we need this any longer.
    	if ($thread['votenum'] >= $vbulletin->options['showvotes'])
    	{	// Show Voteavg
    		$thread['voteavg'] = vb_number_format($average, 2);
    //		$thread['rating'] = round($thread['votetotal'] / $thread['votenum']);
    
Example #13
0
/**
* Halts execution and shows the specified message
*
* @param	string	Message to display
* @param	mixed	If specified, a redirect will be performed to the URL in this parameter
* @param	integer	If redirect is specified, this is the time in seconds to delay before redirect
* @param	string	If specified, will provide a specific URL for "Go Back". If empty, no button will be displayed!
* @param bool		If true along with redirect, 'CONTINUE' button will be used instead of automatic redirect
*/
function print_cp_message($text = '', $redirect = NULL, $delay = 1, $backurl = NULL, $continue = false)
{
    global $vbulletin, $vbphrase;
    if ($vbulletin->GPC['ajax']) {
        require_once DIR . '/includes/class_xml.php';
        $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
        $xml->add_tag('error', $text);
        $xml->print_xml();
        exit;
    }
    if ($redirect and $vbulletin->session->vars['sessionurl']) {
        if (strpos($redirect, '?') === false) {
            $redirect .= '?';
        }
        $redirect .= '&' . $vbulletin->session->vars['sessionurl'];
    }
    if (!defined('DONE_CPHEADER')) {
        print_cp_header($vbphrase['vbulletin_message']);
    }
    echo '<p>&nbsp;</p><p>&nbsp;</p>';
    print_form_header('', '', 0, 1, 'messageform', '65%');
    print_table_header($vbphrase['vbulletin_message']);
    print_description_row("<blockquote><br />{$text}<br /><br /></blockquote>");
    if ($redirect and $redirect !== NULL) {
        // redirect to the new page
        if ($continue) {
            $continueurl = str_replace('&amp;', '&', $redirect);
            print_table_footer(2, construct_button_code($vbphrase['continue'], create_full_url($continueurl)));
        } else {
            print_table_footer();
            $redirect_click = create_full_url($redirect);
            $redirect_click = str_replace('"', '', $redirect_click);
            echo '<p align="center" class="smallfont">' . construct_phrase($vbphrase['if_you_are_not_automatically_redirected_click_here_x'], $redirect_click) . "</p>\n";
            print_cp_redirect($redirect, $delay);
        }
    } else {
        // end the table and halt
        if ($backurl === NULL) {
            $backurl = 'javascript:history.back(1)';
        }
        if (strpos($backurl, 'history.back(') !== false) {
            //if we are attempting to run a history.back(1), check we have a history to go back to, otherwise attempt to close the window.
            $back_button = '&nbsp;
				<input type="button" id="backbutton" class="button" value="' . $vbphrase['go_back'] . '" title="" tabindex="1" onclick="if (history.length) { history.back(1); } else { self.close(); }"/>
				&nbsp;
				<script type="text/javascript">
				<!--
				if (history.length < 1 || ((is_saf || is_moz) && history.length <= 1)) // safari + gecko start at 1
				{
					document.getElementById("backbutton").parentNode.removeChild(document.getElementById("backbutton"));
				}
				//-->
				</script>';
            // remove the back button if it leads back to the login redirect page
            if (strpos($vbulletin->url, 'login.php?do=login') !== false) {
                $back_button = '';
            }
        } else {
            if ($backurl !== '') {
                // regular window.location=url call
                $backurl = create_full_url($backurl);
                $backurl = str_replace(array('"', "'"), '', $backurl);
                $back_button = '<input type="button" class="button" value="' . $vbphrase['go_back'] . '" title="" tabindex="1" onclick="window.location=\'' . $backurl . '\';"/>';
            } else {
                $back_button = '';
            }
        }
        print_table_footer(2, $back_button);
    }
    // and now terminate the script
    print_cp_footer();
}
Example #14
0
		$url = $vbulletin->url;
		$templater = vB_Template::create('reputationbit');
			$templater->register('postid', $postid);
			$templater->register('url', $url);
			$templater->register('userinfo', $userinfo);
		$reputationbit = $templater->render();
	}

	if ($vbulletin->GPC['ajax'])
	{
		$templater = vB_Template::create('reputation_ajax');
			$templater->register('reputationbit', $reputationbit);
		$reputation = $templater->render();

		require_once(DIR . '/includes/class_xml.php');
		$xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
		$xml->add_tag('reputationbit', process_replacement_vars($reputation));
		$xml->print_xml();
	}

	// draw nav bar
	$navbits = array();
	$parentlist = array_reverse(explode(',', $foruminfo['parentlist']));
	foreach ($parentlist AS $forumID)
	{
		$forumTitle = $vbulletin->forumcache["$forumID"]['title'];
		$navbits[fetch_seo_url('forum', array('forumid' => $forumID, 'title' => $forumTitle))] = $forumTitle;
	}
	$navbits[fetch_seo_url('thread', $threadinfo, array('p' => $postid)) . "#post$postid"] = $threadinfo['prefix_plain_html'] . ' ' . $threadinfo['title'];
	$navbits[''] = $vbphrase['reputation'];
	$navbits = construct_navbits($navbits);
Example #15
0
 /**
  * Private
  * Verifies that fetch_table_info() has been called for a valid table and sets current error condition to none
  * .. in other words verify that fetchTableInfo returns true before proceeding on
  *
  * @param	void
  *
  * @return	void
  */
 function init_table_info()
 {
     global $vbulletin;
     // need registry!
     if (!$this->init) {
         $this->fetch_table_info();
     }
     if (!$this->init) {
         $message = '<strong>vB_Database_Alter</strong>: fetch_table_info() has not been called successfully.<br />' . $this->fetch_error_message();
         if ($vbulletin->GPC['ajax']) {
             require_once DIR . '/includes/class_xml.php';
             $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
             $xml->add_tag('error', $message);
             $xml->print_xml();
         } else {
             echo $message;
             exit;
         }
     }
     $this->set_error();
 }
Example #16
0
	public static function showCommentsXml($nodeid, $userinfo, $pageno = 1,
		$perpage = 20, $target_url = '')
	{
		require_once DIR . '/includes/functions_misc.php';
		global $show;


		$xml = new vB_AJAX_XML_Builder( vB::$vbulletin, 'text/xml');
		$xml->add_group('root');

		//todo handle prefs for xml types
		$xml->add_tag('html', $check_val = self::showComments($nodeid, $userinfo,  $pageno,
		$perpage, $target_url));

		$xml->close_group();
		$xml->print_xml();
	}
Example #17
0
/**
* Halts execution and shows the specified error message
*
* @param	string	Error message
* @param	string	Optional HTML code to insert in the <head> of the error page
* @param	boolean	If true, set the visitor's status on WOL to error page
* @param	string	Optional template to force the display to use. Ignored if showing a lite error
*/
function standard_error($error = '', $headinsert = '', $savebadlocation = true, $override_template = '')
{
	global $header, $footer, $headinclude, $forumjump, $timezone, $gobutton;
	global $vbulletin, $vbphrase, $template_hook;
	global $pmbox, $show, $ad_location, $notifications_menubits, $notifications_total;

	$show['notices'] = false;

	construct_quick_nav(array(), -1, true, true);

	$title = $vbulletin->options['bbtitle'];
	$pagetitle =& $title;
	$errormessage = $error;

	if (!$vbulletin->userinfo['badlocation'] AND $savebadlocation)
	{
		$vbulletin->userinfo['badlocation'] = 3;
	}
	require_once(DIR . '/includes/functions_misc.php');
	if ($_POST['securitytoken'] OR $vbulletin->GPC['postvars'])
	{
		$postvars = construct_post_vars_html();
		if ($vbulletin->GPC['postvars'])
		{
			$_postvars = @unserialize(verify_client_string($vbulletin->GPC['postvars']));
			if ($_postvars['securitytoken'] = 'guest')
			{
				unset($$postvars);
			}
		}
		else if ($_POST['securitytoken'] == 'guest')
		{
			unset($postvars);
		}
	}
	else
	{
		$postvars = '';
	}

	if (defined('VB_ERROR_PERMISSION') AND VB_ERROR_PERMISSION == true)
	{
		$show['permission_error'] = true;
	}
	else
	{
		$show['permission_error'] = false;
	}

	$show['search_noindex'] = (bool)($vbulletin->userinfo['permissions']['forumpermissions'] & $vbulletin->bf_ugp_forumpermissions['canview']);

	$navbits = $navbar = '';
	if (defined('VB_ERROR_LITE') AND VB_ERROR_LITE == true)
	{
		$templatename = 'STANDARD_ERROR_LITE';
		define('NOPMPOPUP', 1); // No Footer here
	}
	else
	{
		// bug 33454: we used to not register the navbar when users did not have general forum permissions (banned)
		// but that was causing display issues with the vb4 style, so now we always render navbar
		$navbits = construct_navbits(array('' => $vbphrase['vbulletin_message']));
		$navbar = render_navbar_template($navbits);

		$templatename = ($override_template ? preg_replace('#[^a-z0-9_]#i', '', $override_template) : 'STANDARD_ERROR');
	}

	($hook = vBulletinHook::fetch_hook('error_generic')) ? eval($hook) : false;

	if ($vbulletin->GPC['ajax'])
	{
		require_once(DIR . '/includes/class_xml.php');
		$xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
		$xml->add_tag('error', $errormessage);
		$xml->print_xml();
		exit;
	}
	else
	{
		if ($vbulletin->noheader)
		{
			@header('Content-Type: text/html' . ($vbulletin->userinfo['lang_charset'] != '' ? '; charset=' . $vbulletin->userinfo['lang_charset'] : ''));
		}

		$templater = vB_Template::create($templatename);
			$templater->register_page_templates();
			$templater->register('errormessage', $errormessage);
			$templater->register('forumjump', $forumjump);
			$templater->register('headinsert', $headinsert);
			$templater->register('navbar', $navbar);
			$templater->register('pagetitle', $pagetitle);
			$templater->register('postvars', $postvars);
			$templater->register('scriptpath', SCRIPTPATH);
			$templater->register('url', $vbulletin->url);
		print_output($templater->render());
	}
}
Example #18
0
     if ($tags_remain !== null) {
         if ($user_tags_remain == null) {
             $user_tags_remain = $tags_remain;
         } else {
             $user_tags_remain = min($tags_remain, $user_tags_remain);
         }
     }
 }
 ($hook = vBulletinHook::fetch_hook('threadtag_manage_tagsremain')) ? eval($hook) : false;
 $show['tag_limit_phrase'] = $user_tags_remain !== null;
 $tags_remain = vb_number_format($user_tags_remain);
 $tag_delimiters = addslashes_js($vbulletin->options['tagdelimiter']);
 if ($vbulletin->GPC['ajax']) {
     eval('$html = "' . fetch_template('tag_edit_ajax') . '";');
     require_once DIR . '/includes/class_xml.php';
     $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
     $xml->add_group('tag');
     $xml->add_tag('html', process_replacement_vars($html));
     $xml->add_tag('delimiters', $vbulletin->options['tagdelimiter']);
     $xml->close_group();
     $xml->print_xml();
 }
 // navbar and output
 $navbits = array();
 $parentlist = array_reverse(explode(',', substr($foruminfo['parentlist'], 0, -3)));
 foreach ($parentlist as $forumid) {
     $forum_title = $vbulletin->forumcache["{$forumid}"]['title'];
     $navbits['forumdisplay.php?' . $vbulletin->session->vars['sessionurl'] . "f={$forumid}"] = $forum_title;
 }
 $navbits['showthread.php?' . $vbulletin->session->vars['sessionurl'] . "t={$threadinfo['threadid']}"] = $threadinfo['prefix_plain_html'] . ' ' . $threadinfo['title'];
 $navbits[''] = $vbphrase['tag_management'];
Example #19
0
 if ($vbulletin->GPC['preview']) {
     define('MESSAGEPREVIEW', true);
     $preview = process_group_message_preview($message);
     $_GET['do'] = 'message';
 } else {
     $gmid = $dataman->save();
     if ($messageinfo) {
         $gmid = $messageinfo['gmid'];
     }
     if ($messageinfo and !$group['is_owner'] and can_moderate(0, 'caneditgroupmessages')) {
         require_once DIR . '/includes/functions_log_error.php';
         log_moderator_action($messageinfo, 'gm_by_x_for_y_edited', array($messageinfo['postusername'], $group['name']));
     }
     if ($vbulletin->GPC['ajax']) {
         require_once DIR . '/includes/class_xml.php';
         $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
         $xml->add_group('commentbits');
         $state = array('visible');
         if (fetch_socialgroup_modperm('canmoderategroupmessages', $group)) {
             $state[] = 'moderation';
         }
         if (fetch_socialgroup_modperm('canviewdeleted', $group)) {
             $state[] = 'deleted';
             $deljoinsql = "LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON (gm.gmid = deletionlog.primaryid AND deletionlog.type = 'gmid')";
         } else {
             $deljoinsql = '';
         }
         $state_or = array("gm.state IN ('" . implode("','", $state) . "')");
         // Get the viewing user's moderated posts
         if ($vbulletin->userinfo['userid'] and !fetch_socialgroup_modperm('canmoderategroupmessages', $group)) {
             $state_or[] = "(gm.postuserid = " . $vbulletin->userinfo['userid'] . " AND state = 'moderation')";
Example #20
0
function vbseo_complete_sec($sec, $dat_proc = '')
{
    global $vboptions, $forum, $vbulletin, $vbphrase, $postcache, $stylevar, $vbseo_gcache, $vbseo_linkbacks_no, $bbuserinfo;
    if (!VBSEO_ENABLED) {
        return;
    }
    if (defined('VBSEO_UNREG_EXPIRED')) {
        return $newtext;
    }
    if (VBSEO_IGNOREPAGES && preg_match('#(' . VBSEO_IGNOREPAGES . ')#i', VBSEO_REQURL)) {
        return;
    }
    if (VBSEO_REWRITE_THREADS_ADDTITLE && ($sec == 'newpost_preview' || $sec == 'postbit_display_complete')) {
        global $vbseo_previewmessage, $vbseo_cutbburl;
        if ($GLOBALS['post'] && $GLOBALS['post']['message']) {
            $ptext =& $GLOBALS['post']['message'];
        } else {
            $ptext =& $vbseo_previewmessage;
        }
        vbseo_reverse_formats();
        $matchfull = preg_quote('http://' . VBSEO_HTTP_HOST, '#');
        if (VBSEO_REWRITE_THREADS_ADDTITLE_POST) {
            $ptext = preg_replace('#(href=")(' . $matchfull . '[^"]*?' . VBSEO_FIND_P_FORMAT . '[^/"]*")#eis', 'vbseo_replace_urls_mini_post("$1","$2","$3")', $ptext);
            $ptext = preg_replace('#(href=")(' . $matchfull . '[^"]*?showpost\\.' . VBSEO_VB_EXT . '\\?[^"]*?p(?:ostid)?=(\\d+)[^/"]*")#eis', 'vbseo_replace_urls_mini_post("$1","$2","$3")', $ptext);
        }
        $ptext = preg_replace('#(href=")(' . $matchfull . '[^"]*?' . VBSEO_FIND_MT_FORMAT . '[^/"]*")#eis', 'vbseo_replace_urls_mini("$1","$2","$3","m")', $ptext);
        $ptext = preg_replace('#(href=")(' . $matchfull . '[^"]*?' . VBSEO_FIND_T_FORMAT . '[^/"]*")#eis', 'vbseo_replace_urls_mini("$1","$2","$3")', $ptext);
        $ptext = preg_replace('#(href=")(' . $matchfull . '[^"]*?(?:show|print)thread\\.' . VBSEO_VB_EXT . '\\?[^"]*?t(?:hreadid)?=(\\d+)[^/"]*")#eis', 'vbseo_replace_urls_mini("$1","$2","$3")', $ptext);
    }
    if (isset($vbulletin) && !$vbseo_cutbburl) {
        $vbseo_cutbburl = preg_replace('#/$#', '', $vbulletin->options['bburl']);
    }
    if ($sec == 'init_startup' && $vbseo_cutbburl) {
        vbseo_check_stripsids();
        vbseo_prepare_seo_replace();
        if (VBSEO_IN_PINGBACK && THIS_SCRIPT == 'showthread') {
            @header('X-Pingback: ' . $vbseo_cutbburl . '/vbseo-xmlrpc/');
        }
        if (THIS_SCRIPT != 'search') {
            vbseo_prepare_cat_anchors();
        }
        if (THIS_SCRIPT == 'newreply' || THIS_SCRIPT == 'editpost' || THIS_SCRIPT == 'newthread') {
            $vbseo_ref = $_SERVER['HTTP_REFERER'];
            $pre_repl = '';
            $q = $_POST['message'];
            if ($vbseo_ref && strstr(strtolower($vbseo_ref), VBSEO_HTTP_HOST)) {
                $pre_repl = preg_replace('#/[^/]*$#', '/', $vbseo_ref);
            }
            if ($pre_repl && $pre_repl != $vbseo_cutbburl . '/') {
                $rs = '#((?:<a[^>]*?href="|\\[url="|\\[url\\]|<img[^>]*?src="|\\[img="|\\[img\\]))';
                $_POST['message'] = preg_replace($rs . '(' . preg_quote($vbseo_cutbburl) . '/)?([^:"\\[\\]]*?\\.\\.[^:"\\[\\]]*?["\\[])#i', '$1' . $pre_repl . '$3', $_POST['message']);
                do {
                    $_pmsg = $_POST['message'];
                    $_POST['message'] = preg_replace('#(://[^\\"\\]]*?/)([^/\\"\\]]*/)\\.\\./#', '$1', $_POST['message']);
                } while ($_POST['message'] != $_pmsg);
            }
        }
    }
    $newpost_name = '';
    if ($sec == 'blog_fpdata_presave' || $sec == 'blog_textdata_start' || $sec == 'blog_data_start') {
        $newpost_name = 'blog';
    }
    if ($sec == 'newpost_process' || $sec == 'newpost_complete') {
        $newpost_name = 'newpost';
    }
    if ($sec == 'visitormessagedata_start') {
        $newpost_name = 'message';
    }
    $clean_redir = $newpost_name ? 1 : 0;
    if (!$newpost_name && $sec == 'postdata_presave') {
        $newpost_name = 'edit';
    }
    $may_addttl = $clean_redir && (!isset($_POST['vbseo_is_retrtitle']) || isset($_POST['vbseo_retrtitle']));
    $force_addttl = $newpost_name && (isset($_POST['vbseo_is_retrtitle']) && isset($_POST['vbseo_retrtitle']));
    $addttl = VBSEO_REWRITE_EXT_ADDTITLE && ($force_addttl || $may_addttl);
    global ${$newpost_name};
    if (isset(${$newpost_name})) {
        $pmsg_a =& ${$newpost_name};
        if (isset($pmsg_a['message'])) {
            $pmsg =& $pmsg_a['message'];
        }
    }
    if ($clean_redir) {
        vbseo_get_options();
        $redurl = $vboptions['bburl2'] . '/' . VBSEO_REDIRECT_URI . '?redirect=';
        $pmsg = preg_replace('#' . preg_quote($redurl, '#') . '([^"\\]\\[]*)#eis', 'urldecode(\'$1\')', $pmsg);
    }
    if ($addttl) {
        preg_match_all('#\\[url=?\\"?(.*?)\\"?\\](.+?)\\[\\/url\\]#is', $pmsg, $lmatch);
        for ($i = 0; $i < count($lmatch[0]); $i++) {
            $ul = trim($lmatch[1][$i]);
            $ulin = trim($lmatch[2][$i]);
            if ($ul && !@strstr($ulin, $ul)) {
                continue;
            }
            if (!@strstr($ulin, '://')) {
                $ulin = 'http://' . $ulin;
            }
            if (!$ul) {
                $ul = $ulin;
            }
            if (preg_match('#^http://#', $ulin) && (!VBSEO_REWRITE_EXT_ADDTITLE_BLACKLIST || !preg_match('#' . VBSEO_REWRITE_EXT_ADDTITLE_BLACKLIST . '#i', $ulin))) {
                vbseo_reverse_formats();
                $matchfull = preg_quote('http://' . VBSEO_HTTP_HOST, '#');
                $ismatch = false;
                if (VBSEO_REWRITE_THREADS_ADDTITLE_POST) {
                    $ismatch |= preg_match('#' . $matchfull . '[^"]*?/' . VBSEO_FIND_P_FORMAT . '#is', $ulin);
                }
                $ismatch |= preg_match('#' . $matchfull . '[^"]*?/' . VBSEO_FIND_MT_FORMAT . '#is', $ulin);
                $ismatch |= preg_match('#' . $matchfull . '[^"]*?/' . VBSEO_FIND_T_FORMAT . '#is', $ulin);
                $ulin_shot = str_replace(VBSEO_TOPREL_FULL, '', $ulin);
                if (($arr = vbseo_check_url('VBSEO_URL_FORUM_PAGENUM', $ulin_shot)) || ($arr = vbseo_check_url('VBSEO_URL_FORUM', $ulin_shot))) {
                    if (!isset($arr['forum_id']) && (isset($arr['forum_path']) || isset($arr['forum_title']))) {
                        $arr['forum_id'] = vbseo_reverse_forumtitle($arr);
                    }
                    vbseo_get_forum_info();
                    if (!vbseo_forum_is_public($vbseo_gcache['forum'][$arr['forum_id']])) {
                        $ismatch = true;
                    }
                }
                if (!$ismatch) {
                    $pret = vbseo_http_query_full($ulin);
                    $ptitle = vbseo_get_page_title($pret['content'], defined('VBSEO_MAX_TITLE_LENGTH') ? VBSEO_MAX_TITLE_LENGTH : 0);
                    $pcharset = vbseo_get_page_charset($pret['content'], $pret['headers']);
                    $ptitle = vbseo_convert_charset($ptitle, $pcharset);
                    if ($ptitle && $ptitle != $vboptions['bbtitle']) {
                        $pmsg = str_replace($lmatch[0][$i], '[url=' . $ulin . ']' . $ptitle . '[/url]', $pmsg);
                    }
                }
            }
        }
    }
    $trackback = VBSEO_EXT_TRACKBACK && ($sec == 'newpost_complete' || $sec == 'threadmanage_update');
    $pingback = VBSEO_EXT_PINGBACK && $sec == 'newpost_complete';
    if ($pingback || $trackback) {
        global $found_object_ids;
        if (!$vboptions['bburl2'] || !$vbseo_gcache['forum']) {
            vbseo_get_options();
            vbseo_prepare_seo_replace();
            vbseo_get_forum_info();
        }
        $r_post_id = $pmsg_a['postid'];
        if (!$r_post_id && $GLOBALS['threadinfo']) {
            $r_post_id = $GLOBALS['threadinfo']['firstpostid'];
        }
        unset($vbseo_gcache['post'][$r_post_id]);
        $found_object_ids['prepostthread_ids'] = array($r_post_id);
        vbseo_get_post_thread_info($r_post_id);
        $threadid = $vbseo_gcache['post'][$r_post_id]['threadid'];
        vbseo_get_thread_info($threadid);
        $forumid = $vbseo_gcache['thread'][$threadid]['forumid'];
        $vbseo_url_ = vbseo_thread_url_postid($r_post_id);
        $vbseo_url_t = vbseo_thread_url($threadid);
        if (!strstr($vbseo_url_, '://')) {
            $vbseo_url_ = $vboptions['bburl2'] . '/' . $vbseo_url_;
        }
        if (!strstr($vbseo_url_t, '://')) {
            $vbseo_url_t = $vboptions['bburl2'] . '/' . $vbseo_url_t;
        }
        if (THIS_SCRIPT == 'newthread') {
            $vbulletin->db->query_write("INSERT INTO " . vbseo_tbl_prefix('vbseo_serviceupdate') . "\n(s_threadid, s_updated)\nVALUES\n('{$threadid}', 0)\n");
        }
    }
    if ($sec == 'blog_fpdata_postsave') {
        global $blogman;
        if ($blogman && ($bid = $blogman->blog['blogid'])) {
            $vbulletin->db->query_write("INSERT INTO " . vbseo_tbl_prefix('vbseo_serviceupdate') . "\n(s_threadid, s_updated, s_type)\nVALUES\n('{$bid}', 0, 1)\n");
        }
    }
    if ($trackback && $_REQUEST['sendtrackbacks']) {
        $tracurls = explode(' ', $_REQUEST['sendtrackbacks']);
        $tdetails = vbseo_get_thread_details($r_post_id);
        $tdetails['pagetext'] = preg_replace('#\\[.+?\\]#', '', $tdetails['pagetext']);
        vbseo_extra_inc('linkback');
        foreach ($tracurls as $turl) {
            if (trim($turl)) {
                $turl = trim($turl);
                if (!preg_match('#^http://#', $turl)) {
                    continue;
                }
                if (vbseo_pingback_exists($turl, $threadid)) {
                    continue;
                }
                $snippet = vbseo_utf8_substr($tdetails['pagetext'], 0, VBSEO_SNIPPET_LENGTH);
                $res_success = vbseo_do_trackback($turl, $vbseo_url_t, $vbseo_gcache['thread'][$threadid]['title'], $vboptions['bbtitle'], $snippet . '...');
                vbseo_store_pingback($vbseo_url_, $turl, 1, $r_postid, 0, $threadid, 0, $_REQUEST['subject'], $snippet, 0, $res_success, 1, false);
            }
        }
    }
    if ($pingback && vbseo_forum_is_public($vbseo_gcache['forum'][$forumid])) {
        vbseo_extra_inc('linkback');
        preg_match_all('#\\[url=?\\"?(.*?)\\"?\\]#is', $pmsg, $lmatch);
        for ($i = 0; $i < count($lmatch[0]); $i++) {
            $ulin = $lmatch[1][$i];
            if (preg_match('#^http://#', $ulin) && !strstr($ulin, VBSEO_HTTP_HOST) && (!VBSEO_REWRITE_EXT_ADDTITLE_BLACKLIST || !preg_match('#' . VBSEO_REWRITE_EXT_ADDTITLE_BLACKLIST . '#i', $ulin))) {
                if (vbseo_pingback_exists($ulin, $threadid)) {
                    continue;
                }
                $res_success = vbseo_do_pingback($vbseo_url_, $ulin);
                if ($res_success >= 0) {
                    vbseo_store_pingback($vbseo_url_, $ulin, 0, $r_postid, 0, $threadid, 0, $_REQUEST['subject'], $snippet, 0, $res_success, 1);
                }
            }
        }
    }
    switch ($sec) {
        case 'blog_entry_start':
            vbseo_prepend_template('blog_show_entry', '".(($blog[message] = vbseo_process_content_area($blog[message])) ? "":"")."');
            vbseo_prepend_template('blog_comment', '".(($response[message] = vbseo_process_content_area($response[message])) ? "":"")."');
            break;
        case 'blog_entry_complete':
            if (VBSEO_BOOKMARK_BLOG && vbseo_tpl_exists('blog_show_entry')) {
                $vbseo_url_b = vbseo_http_s_url('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['VBSEO_URI']);
                $book_t = urlencode($GLOBALS['blog']['title']);
                $bmlist = vbseo_get_bookmarks();
                $vbseo_post_bookmarks = '';
                foreach ($bmlist as $bm) {
                    $blink = str_replace('%url%', urlencode($vbseo_url_b), str_replace('%title%', $book_t, $bm[0]));
                    eval('$vbseo_post_bookmarks .= "' . fetch_template('vbseo_blog_bmarkentry') . '";');
                }
                $vbseo_post_bookmarks = str_replace('"', '\\"', $vbseo_post_bookmarks);
                $bsection_tpl = str_replace('<!--VBSEO_BOOKMARKS-->', $vbseo_post_bookmarks, fetch_template('vbseo_blog_bmarksection'));
                if (VBSEO_BOOKMARK_BLOG == 1) {
                    $snr = '#(\\"\\.\\(\\(\\$show\\[\'blograting\'\\]\\) \\? \\(\\".*?)(<[^>]*?id=\\\\"blog_title)#is';
                    $pm = vbseo_tpl_match('blog_show_entry', $snr);
                    $pm[1] = str_replace('id=\\"blograting\\" style=\\"float:$stylevar[right]\\">', 'id=\\"blograting\\" style=\\"text-align:center\\">', $pm[1]);
                    $bsection = str_replace('<!--BLOG_RATING-->', $pm[1], $bsection_tpl);
                    vbseo_modify_template('blog_show_entry', $snr, $bsection . '$2');
                } else {
                    vbseo_modify_template('blog_show_entry', '#("\\.\\(\\(\\$' . 'categorybits)#is', $bsection_tpl . '$1', false, '<!--VBSEO_BOOKMARKS-->');
                }
                vbseo_modify_template('blog_show_entry', '#(<div id=\\\\"blog_message\\\\" style=\\\\")(.*?</div>)#', "\$1min-height:60px;\$2\n<br style=\\\"clear:both\\\" />");
            }
            break;
        case 'global_start':
            if (!$vbulletin->userinfo['userid'] && VBSEO_CODE_CLEANUP_PREVIEW && THIS_SCRIPT == 'forumdisplay') {
                $vbulletin->options['threadpreview'] = 0;
                $vbseo_gcache['var']['vboptchanged'] = true;
            }
            if (!$vbulletin->userinfo['userid'] && VBSEO_FORUMJUMP_OFF && $vbulletin && (THIS_SCRIPT == 'forumdisplay' || THIS_SCRIPT == 'showthread')) {
                $vbulletin->options['useforumjump'] = 0;
                $vbseo_gcache['var']['vboptchanged'] = true;
            }
            if (VBSEO_CATEGORY_ANCHOR_LINKS) {
                vbseo_modify_template('forumhome_forumbit_level1_nopost', 'href=\\"forumdisplay', 'id=\\"".$forum[\'nametitle\']."\\" name=\\"".$forum[\'nametitle\']."\\" href=\\"forumdisplay');
            }
            if (VBSEO_IN_REFBACK && (THIS_SCRIPT == 'showthread' || THIS_SCRIPT == 'showpost')) {
                $vbseo_ref = $_SERVER['HTTP_REFERER'];
                if ($vbseo_ref && !strstr(strtolower($vbseo_ref), VBSEO_HTTP_HOST) && !strstr(strtolower($vbseo_ref), str_replace('www.', '', VBSEO_HTTP_HOST))) {
                    if (!defined('VBSEO_REFBACK_BLACKLIST') || !preg_match('#' . VBSEO_REFBACK_BLACKLIST . '#i', $vbseo_ref)) {
                        vbseo_extra_inc('linkback');
                        vbseo_ping_proc($vbseo_ref, VBSEO_TOPREL_FULL . VBSEO_REQURL, 2);
                    }
                }
            }
            break;
        case 'memberlist_bit':
            global $userinfo, $usercache;
            $usercache[$userinfo['userid']] = array('userid' => $userinfo['userid'], 'username' => $userinfo['username']);
            break;
        case 'ajax_start':
            if ($_POST['do'] == 'linkbackmod' && ($linkid = addslashes($_POST['id']))) {
                $ilink = $vbulletin->db->query_first("\nSELECT l.*, t.forumid\nFROM " . vbseo_tbl_prefix('vbseo_linkback') . " l\nLEFT JOIN " . vbseo_tbl_prefix('thread') . " t ON t.threadid = l.t_threadid\nWHERE t_id='{$linkid}'");
                $ismod = can_moderate($ilink['forumid'], 'vbseo_linkbacks') || $vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['ismoderator'];
                if ($ismod) {
                    vbseo_extra_inc('linkback');
                    if ($_POST['action'] == 'mod') {
                        $vbulletin->db->query_write("\nUPDATE " . vbseo_tbl_prefix('vbseo_linkback') . "\nSET t_approve=IF(t_approve,0,1)\nWHERE t_id='{$linkid}'");
                        if (!$ilink['t_approve']) {
                            vbseo_send_notification_pingback($ilink['t_threadid'], $ilink['t_postid'], $ilink['t_src_url'], $ilink['t_title'], $ilink['t_text'], 1, 0);
                        }
                    }
                    if ($_POST['action'] == 'ban') {
                        $purl = parse_url($ilink['t_src_url']);
                        if ($purl['host']) {
                            $bdom = str_replace('www.', '', $purl['host']);
                            vbseo_linkback_bandomain($bdom, 1);
                            $vbulletin->db->query_write("\nUPDATE " . vbseo_tbl_prefix('vbseo_linkback') . "\nSET t_deleted = 1\nWHERE t_src_url LIKE 'http%" . addslashes($bdom) . "/%'");
                        }
                    }
                    if ($_POST['action'] == 'del') {
                        $vbulletin->db->query_write("\nUPDATE " . vbseo_tbl_prefix('vbseo_linkback') . "\nSET t_deleted = 1\nWHERE t_id = '{$linkid}'");
                    }
                    vbseo_linkback_approve($linkid);
                    header('Content-Type: text/plain;');
                    header('Connection: Close');
                    echo $ilink['t_approve'] ? '0' : '1';
                }
                exit;
            }
            if ($_POST['do'] == 'updatelinkback') {
                $vbulletin->input->clean_array_gpc('p', array('linkid' => TYPE_UINT, 'title' => TYPE_STR));
                $linkid = $vbulletin->GPC['linkid'];
                $ilink = $vbulletin->db->query_first("\nSELECT *\nFROM " . vbseo_tbl_prefix('vbseo_linkback') . " l\nWHERE t_id='" . addslashes($linkid) . "'");
                $ismod = can_moderate($ilink['forumid'], 'vbseo_linkbacks') || $vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['ismoderator'];
                if ($ismod) {
                    $ltitle = convert_urlencoded_unicode($vbulletin->GPC['title']);
                    $vbulletin->db->query_write("\nUPDATE " . vbseo_tbl_prefix('vbseo_linkback') . " l\nSET t_title = '" . addslashes($ltitle) . "'\nWHERE t_id = '" . addslashes($linkid) . "'");
                }
                $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
                $xml->add_tag('linkhtml', $ltitle);
                $xml->print_xml();
            }
            break;
        case 'forumadmin_update_save':
            global $vboptions, $forumcache;
            vbseo_get_options();
            vbseo_prepare_seo_replace();
            $vboptions['vbseo_opt'] = array();
            $forumcache2 = $forumcache;
            $forumcache = '';
            vbseo_get_forum_info(true);
            $forumcache = $forumcache2;
            vbseo_check_datastore(true);
            break;
        case 'private_insertpm_process':
            global $pmdm;
            if (is_object($pmdm) && strstr($pmdm->pmtext['message'], '[post]')) {
                vbseo_startup();
                $pmdm->pmtext['message'] = preg_replace('#\\[post\\](\\d+)\\[\\/post\\]#', '[url]' . $vboptions['bburl2'] . '/showthread.php?p=$1#post$1[/url]', $pmdm->pmtext['message']);
                $GLOBALS['VBSEO_REWRITE_TEXTURLS'] = 1;
                $pmdm->pmtext['message'] = make_crawlable($pmdm->pmtext['message']);
                unset($GLOBALS['VBSEO_REWRITE_TEXTURLS']);
            }
            break;
        case 'cache_templates':
            global $globaltemplates, $show, $bbuserinfo;
            if ($_REQUEST['ajax']) {
                if (THIS_SCRIPT == 'blog_post') {
                    $globaltemplates[] = 'blog_comment';
                }
                if (THIS_SCRIPT == 'group') {
                    $globaltemplates[] = 'socialgroups_message';
                }
                if (THIS_SCRIPT == 'album') {
                    $globaltemplates[] = 'picturecomment_message';
                }
                if (THIS_SCRIPT == 'visitormessage') {
                    $globaltemplates[] = 'memberinfo_visitormessage';
                }
            }
            if (THIS_SCRIPT == 'blog' && $_REQUEST['do'] == 'blog') {
                $globaltemplates[] = 'vbseo_blog_bmarkentry';
                $globaltemplates[] = 'vbseo_blog_bmarksection';
            }
            if (THIS_SCRIPT == 'moderation') {
                $globaltemplates[] = 'vbseo_linkbacks';
                $globaltemplates[] = 'vbseo_linkbackbit';
            }
            if (THIS_SCRIPT == 'showthread' && (VBSEO_IN_PINGBACK || VBSEO_IN_TRACKBACK || VBSEO_IN_REFBACK)) {
                $globaltemplates[] = 'vbseo_linkbacks';
                $globaltemplates[] = 'vbseo_linkbackbit';
                $globaltemplates[] = 'vbseo_linkbackmenu';
                $globaltemplates[] = 'vbseo_linkbackmenu_entry';
            }
            if (THIS_SCRIPT == 'misc' && $_REQUEST['do'] == 'pingtrackback') {
                vbseo_safe_redirect('misc.' . VBSEO_VB_EXT . '?do=linkbacks', array('do'));
            }
            if (THIS_SCRIPT == 'misc' && $_REQUEST['do'] == 'linkbacks') {
                $globaltemplates[] = 'vbseo_help_linkback';
            }
            break;
        case 'member_infractionbit':
            $GLOBALS['vbseo_gcache']['post'][$dat_proc['postid']] = $dat_proc;
            break;
        case 'parse_templates':
            vbseo_modify_template('socialgroups_grouplist_bit', '#.$#s', '$0".(($GLOBALS[\'vbseo_gcache\'][\'groups\'][$group[\'groupid\']]=$group)?\'\':\'\')."');
            vbseo_modify_template('memberinfo_socialgroupbit', '#.$#s', '$0".(($GLOBALS[\'vbseo_gcache\'][\'groups\'][$socialgroup[\'groupid\']]=$socialgroup)?\'\':\'\')."');
            vbseo_modify_template('blog_entry_profile', '#.$#s', '$0".(($GLOBALS[\'vbseo_gcache\'][\'blog\'][$this->blog[\'blogid\']]=$this->blog)?\'\':\'\')."');
            vbseo_modify_template('blog_entry_profile', '#.$#s', '$0".(($GLOBALS[\'vblog_categories\']=$this->categories)?\'\':\'\')."');
            vbseo_modify_template('album_picturebit', '#.$#s', '$0".(($GLOBALS[\'vbseo_gcache\'][\'pic\'][$picture[\'pictureid\']]=$picture)?\'\':\'\')."');
            vbseo_modify_template('albumbit', '#.$#s', '$0".(($GLOBALS[\'vbseo_gcache\'][\'album\'][$album[\'albumid\']]=$album)?\'\':\'\')."');
            vbseo_modify_template('memberinfo_albumbit', '#.$#s', '$0".(($GLOBALS[\'vbseo_gcache\'][\'album\'][$album[\'albumid\']]=$album)?\'\':\'\')."');
            vbseo_prepend_template('memberinfo_visitormessage', '".(($message[message] = vbseo_process_content_area($message[message])) ? "":"")."');
            vbseo_prepend_template('socialgroups_message', '".(($message[message] = vbseo_process_content_area($message[message])) ? "":"")."');
            vbseo_prepend_template('picturecomment_message', '".(($message[message] = vbseo_process_content_area($message[message])) ? "":"")."');
            vbseo_prepend_template('pt_issuenotebit_user', '".(($note[message] = vbseo_process_content_area($note[message])) ? "":"")."');
            vbseo_prepend_template('newpost_preview', '".(($previewmessage = vbseo_process_content_area($previewmessage)) ? "":"")."');
            if ((THIS_SCRIPT == 'blog' || THIS_SCRIPT == 'blog_post') && VBSEO_PERMALINK_BLOG > 0) {
                vbseo_modify_template('blog_comment', '#(blogipaddress.*?)(</div>)#s', '$1 <a href=\\"#comment$response[blogtextid]\\"><img src=\\"$stylevar[imagesfolder]/vbseo/anchor.png\\" border=\\"0\\" alt=\\"$vbphrase[vbseo_permalink]\\" class=\\"inlineimg\\" /></a> $2', 0);
                vbseo_modify_template('blog_comment', '#(OR \\$show\\[\\\'reportlink\\\'\\])#s', '$1 OR 1', 0);
            }
            if (THIS_SCRIPT == 'member' || THIS_SCRIPT == 'visitormessage') {
                $vmurl = $_GET['tab'] && $_GET['tab'] != 'visitor_messaging' ? 'member.php?u=' . $_GET['u'] : '';
                $vmurl .= '#vmessage$message[vmid]';
                if (VBSEO_PERMALINK_PROFILE == 2) {
                    vbseo_modify_template('memberinfo_visitormessage', '#\\$message\\[date\\]#s', '<a href=\\"' . $vmurl . '\\">$0</a>', 0);
                } else {
                    if (VBSEO_PERMALINK_PROFILE == 1) {
                        vbseo_modify_template('memberinfo_visitormessage', '#message\\[time\\].*?\\)\\)\\.\\"#s', '$0 - <a href=\\"' . $vmurl . '\\">$vbphrase[vbseo_permalink]</a>', 0);
                    }
                }
                vbseo_modify_template('MEMBERINFO', '#(vBulletin\\.register_control\\(\\\\"vB_TabCtrl\\\\", \\\\"profile_tabs\\\\", \\\\"\\$selected_tab\\\\")#s', "var vbseo_opentab=document.location.hash;\nvbseo_opentab = vbseo_opentab.substring(1,vbseo_opentab.length);\n" . '$1 ? \\"$selected_tab\\" : vbseo_opentab');
            }
            if (THIS_SCRIPT == 'album') {
                if (VBSEO_PERMALINK_ALBUM == 2) {
                    vbseo_modify_template('picturecomment_message', '#\\$message\\[date\\]#s', '<a href=\\"#picturecomment$message[commentid]\\">$0</a>', 0);
                } else {
                    if (VBSEO_PERMALINK_ALBUM == 1) {
                        vbseo_modify_template('picturecomment_message', '#message\\[time\\].*?\\)\\)\\.\\"#s', '$0 - <a href=\\"#picturecomment$message[commentid]\\">$vbphrase[vbseo_permalink]</a>', 0);
                    }
                }
            }
            if (THIS_SCRIPT == 'group') {
                $_plink = 'group.' . VBSEO_VB_EXT . '?groupid=' . $_REQUEST['groupid'] . '#gmessage$message[gmid]';
                if (VBSEO_PERMALINK_GROUPS == 2) {
                    vbseo_modify_template('socialgroups_message', '#\\$message\\[date\\]#s', '<a href=\\"' . $_plink . '\\">$0</a>', 0);
                } else {
                    if (VBSEO_PERMALINK_GROUPS == 1) {
                        vbseo_modify_template('socialgroups_message', '#message\\[time\\].*?\\)\\)\\.\\"#s', '$0 - <a href=\\"' . $_plink . '\\">$vbphrase[vbseo_permalink]</a>', 0);
                    }
                }
            }
            if (VBSEO_IN_PINGBACK || VBSEO_IN_TRACKBACK || VBSEO_IN_REFBACK) {
                if (can_moderate(0, 'vbseo_linkbacks')) {
                    vbseo_modify_template('USERCP_SHELL', '#(do=viewposts&amp;type=moderated.*?</tr>)#is', '$1
<tr>
<td class=\\"".($navclass[moderatedlinkbacks]?$navclass[moderatedlinkbacks]:"alt2")."\\"><a class=\\"smallfont\\" href=\\"moderation.php?$session[sessionurl]do=viewlinkbacks\\">$vbphrase[vbseo_moderated_linkbacks]</a></td>
</tr>');
                }
            }
            if (!$vbulletin->userinfo['userid']) {
                if (VBSEO_CODE_CLEANUP_MEMBER_DROPDOWN) {
                    if (THIS_SCRIPT == 'showthread') {
                        $tplpostbit = vbseo_get_postbit_tpl();
                        vbseo_modify_template($tplpostbit, '#<script[^>]+?>[^<]*?postmenu_\\$post.*?</script>#is', '');
                        vbseo_modify_template($tplpostbit, '#<div class=\\\\"vbmenu_popup.*?</div>#is', '');
                    }
                    if (THIS_SCRIPT == 'blog') {
                        $blog_tpls = array('blog_sidebar_user', 'blog_entry_with_userinfo', 'blog_entry_without_userinfo', 'blog_list_blogs_blog');
                        foreach ($blog_tpls as $_btpl) {
                            vbseo_modify_template($_btpl, '#<script[^>]+?>[^<]*?blogusermenu.*?</script>#is', '');
                            vbseo_modify_template($_btpl, '#<div class=\\\\"vbmenu_popup.*?</div>#is', '');
                        }
                    }
                }
                if (THIS_SCRIPT == 'index') {
                    if (VBSEO_CODE_CLEANUP_LASTPOST == 2) {
                        vbseo_modify_template('FORUMHOME', '#<td[^<]+?vbphrase\\[last_post\\]</td>#is', '');
                        vbseo_modify_template('forumhome_forumbit_level1_nopost', '#<td[^<]+?vbphrase\\[last_post\\].*?</td>#is', '');
                        vbseo_modify_template('FORUMDISPLAY', '#<td[^<]+?(<span[^<]+?)?(<a[^<]+?)?vbphrase\\[last_post\\].*?</td>#is', '');
                        vbseo_modify_template('forumhome_forumbit_level2_post', '#<td[^<]+?forum\\[lastpostinfo\\].*?</td>#is', '');
                        vbseo_modify_template('forumhome_forumbit_level1_post', '#<td[^<]+?forum\\[lastpostinfo\\].*?</td>#is', '');
                        vbseo_modify_template('threadbit', '#\\(\\(\\$show\\[\'threadmoved\'.*?/td>\\s*"\\)\\)\\.#is', '');
                    }
                    if (VBSEO_CODE_CLEANUP_LASTPOST == 1) {
                        vbseo_modify_template('threadbit', '#<a href=[^>]*?->[^>]*?->[^>]*?lastpostid.*?</a>#is', '');
                        vbseo_modify_template('forumhome_lastpostby', '#<a href=[^>]*?->[^>]*?->[^>]*?lastpostid.*?</a>#is', '');
                        $vbphrase['by_x'] = strip_tags($vbphrase['by_x']);
                    }
                    vbseo_modify_template('threadbit', '#<a href=\\\\"misc\\.php\\?do=whoposted.*?>(.*?)</a>#is', '$1');
                }
            }
            break;
        case 'moderation_start':
            if ($_REQUEST['do'] == 'viewlinkbacks') {
                global $navbar, $navclass, $HTML, $navbits, $headinclude, $header, $footer, $db, $show, $navclass, $notices, $pmbox, $notifications_total;
                if (!can_moderate(0, 'vbseo_linkbacks')) {
                    print_no_permission();
                }
                vbseo_startup();
                $vbseolinkbackbits = '';
                $perpage = 20;
                $pagenumber = $_GET['page'] ? $_GET['page'] : 1;
                $vbseodb = vbseo_get_db();
                $tp = $vbseodb->vbseodb_query_first("\nSELECT COUNT(*) as cnt\nFROM " . vbseo_tbl_prefix('vbseo_linkback') . "\nWHERE t_incoming=1 AND t_deleted=0 AND t_approve=0");
                $totalposts = $tp['cnt'];
                $vbseopings = $vbseodb->vbseodb_query($q = "\nSELECT t_id, t_time, t_src_url, t_dest_url, t_type, t_postid, t_postcount, t_threadid, t_page, t_title, t_text, t_approve, forumid\nFROM " . vbseo_tbl_prefix('vbseo_linkback') . "\nLEFT JOIN " . vbseo_tbl_prefix('thread') . " on threadid=t_threadid\nWHERE t_incoming=1 AND t_deleted=0 AND t_approve=0\nORDER BY t_time " . (preg_match('#^(asc|desc)$#i', VBSEO_DEFAULT_LINKBACKS_ORDER) ? VBSEO_DEFAULT_LINKBACKS_ORDER : "DESC") . " LIMIT " . ($pagenumber - 1) * $perpage . "," . $perpage);
                $pagenav = construct_page_nav($pagenumber, $perpage, $totalposts, "moderation.php?do=viewlinkbacks");
                while ($vbseoping = @$vbseodb->funcs['fetch_assoc']($vbseopings)) {
                    if (can_moderate($vbseoping['forumid'], 'vbseo_linkbacks')) {
                        $vbseoping['postno'] = $vbseoping['t_postcount'];
                        $vbseoping['ismod'] = 1;
                        $vbseoping['date'] = vbdate($vbulletin->options['dateformat'], $vbseoping['t_time'], true);
                        $vbseoping['time'] = vbdate($vbulletin->options['timeformat'], $vbseoping['t_time'], true);
                        $vbseoping['t_src_url'] = htmlentities($vbseoping['t_src_url']);
                        $vbseoping['t_dest_url'] = htmlentities($vbseoping['t_dest_url']);
                        $vbseoping['t_text_nohtml'] = htmlspecialchars(strip_tags($vbseoping['t_text']));
                        $vbseoping['t_title_html'] = htmlspecialchars($vbseoping['t_title']);
                        eval('$vbseolinkbackbits .= "' . fetch_template('vbseo_linkbackbit') . '";');
                    }
                }
                if ($vbseolinkbackbits) {
                    eval('$HTML = "' . fetch_template('vbseo_linkbacks') . '";');
                } else {
                    $HTML = $vbphrase['vbseo_no_linkbacks_found'];
                }
                unset($vbseolinkbackbits);
                $navbits[''] = $vbphrase['moderation'];
                $navbits = construct_navbits($navbits);
                construct_usercp_nav('moderatedlinkbacks');
                eval('$navbar = "' . fetch_template('navbar') . '";');
                eval('print_output("' . fetch_template('USERCP_SHELL') . '");');
            }
            break;
        case 'misc_start':
            if ($_REQUEST['do'] == 'linkbacks') {
                global $navbits, $headinclude, $header, $footer;
                $navbits = construct_navbits(array('faq.' . VBSEO_VB_EXT . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['faq'], '' => $vbphrase['vbseo_linkbacks']));
                @extract($GLOBALS);
                @eval('$navbar = "' . fetch_template('navbar') . '";');
                @eval('print_output("' . fetch_template('vbseo_help_linkback') . '");');
            }
            break;
        case 'archive_forum_thread':
            if ($GLOBALS['pda'] == 'vbseo') {
                $GLOBALS['pda'] = false;
            }
            break;
        case 'archive_navigation':
            if (VBSEO_ARCHIVE_ORDER_DESC && !$GLOBALS['pda']) {
                $GLOBALS['pda'] = 'vbseo';
            }
            break;
        case 'forumrules':
            $pingrules = '<div>" . construct_phrase("$vbphrase[vbseo_trackback_is_x]", "misc.".VBSEO_VB_EXT."?do=linkbacks#trackbacks", "' . iif(VBSEO_EXT_TRACKBACK, $vbphrase['on'], $vbphrase['off']) . '") . "</div>
<div>" . construct_phrase("$vbphrase[vbseo_pingback_is_x]", "misc.".VBSEO_VB_EXT."?do=linkbacks#pingbacks", "' . iif(VBSEO_EXT_PINGBACK, $vbphrase['on'], $vbphrase['off']) . '") . "</div>
<div>" . construct_phrase("$vbphrase[vbseo_refback_is_x]", "misc.".VBSEO_VB_EXT."?do=linkbacks#refbacks", "' . iif(VBSEO_IN_REFBACK, $vbphrase['on'], $vbphrase['off']) . '") . "</div>';
            vbseo_modify_template('forumrules', '#(html_code_is_x.*?</div>)#s', '$1' . $pingrules, 0, '<!--LINKBACK_POSTRULES-->');
            break;
        case 'showthread_complete':
            global $onload;
            if (!$onload) {
                $onload = "if (is_ie || is_moz) { var cpost=document.location.hash;if(cpost){ if(cobj = fetch_object(cpost.substring(1,cpost.length)))cobj.scrollIntoView(true); }}";
            }
            if (VBSEO_IN_PINGBACK || VBSEO_IN_TRACKBACK || VBSEO_IN_REFBACK) {
                global $vbseo_bookmarks, $vbseo_linkback_menu, $vbseo_linkback_menu_list, $show, $vbseo_linkback_uri, $thread;
                $vbseo_url_t = urlencode($vboptions['bburl2'] . '/' . vbseo_thread_url($thread['threadid']));
                $book_t = urlencode($thread['title']);
                $is_public = vbseo_forum_is_public($GLOBALS['forum'], $GLOBALS['foruminfo'], false, true);
                if ($is_public && VBSEO_BOOKMARK_THREAD) {
                    $bmlist = vbseo_get_bookmarks();
                    $vbseo_bookmarks = '';
                    $bmno = 0;
                    foreach ($bmlist as $bm) {
                        $vbseo_bookmarks .= '<tr><td class="vbmenu_option"><img class="inlineimg" src="' . $bm[1] . '" alt="' . $bm[2] . '" /> <a href="' . str_replace('%url%', $vbseo_url_t, str_replace('%title%', $book_t, $bm[0])) . '" target="_blank">' . $bm[2] . '</a><a name="vbseodm_' . $bmno++ . '"></a></td></tr>';
                    }
                }
                eval('$vbseo_linkback_menu = "' . fetch_template('vbseo_linkbackmenu_entry') . '";');
                vbseo_modify_template('SHOWTHREAD', '#(<td[^>]*?threadtools)#i', '\\$vbseo_linkback_menu$1', 0, '<!--LINKBACK_MENU-->');
                eval('$vbseo_linkback_menu_list = "' . fetch_template('vbseo_linkbackmenu') . '";');
                if (!vbseo_tpl_search('SHOWTHREAD', '$vbseo_linkback_menu_list')) {
                    vbseo_modify_template('SHOWTHREAD', '#(</body>)#is', '\\$vbseo_linkback_menu_list' . '$1');
                }
                if ($_GET['nojs']) {
                    preg_match('#<table.*?>(.*?)</table>#is', $vbseo_linkback_menu, $vbseo_m);
                    $vbseo_m[1] = str_replace('vbmenu_option', 'alt1', $vbseo_m[1]);
                    $vbseo_m[1] = str_replace('<td', '<td colspan="2"', $vbseo_m[1]);
                    vbseo_modify_template('SHOWTHREAD', "#(sendtofriend\\.gif.*?sendtofriend\\.gif.*?</tr>)#is", "\$1" . addslashes($vbseo_m[1]));
                }
            }
            break;
        case 'showthread_post_start':
            global $vbseolinkbacks, $vbcollapse, $vbseo_linkback_uri, $thread, $db, $show, $found_object_ids;
            if (defined('VBSEO_PRIVATE_REDIRECT_POSTID')) {
                vbseo_get_options();
                if (!($mode_nonlinear = vbseo_is_threadedmode())) {
                    vbseo_get_forum_info();
                    $r_post_id = VBSEO_PRIVATE_REDIRECT_POSTID;
                    $found_object_ids['prepostthread_ids'] = array($r_post_id);
                    $parr = vbseo_get_post_thread_info($r_post_id, true);
                    $threadid = $parr[$r_post_id]['threadid'];
                    vbseo_get_thread_info($threadid);
                    $excpars = array('p', 'page');
                    $vbse_rurl = vbseo_thread_url_postid($r_post_id, isset($_GET['page']) ? $_GET['page'] : 1, $mode_nonlinear);
                    if ($vbse_rurl) {
                        vbseo_url_autoadjust($vbse_rurl, $excpars, false);
                    }
                }
            }
            if (VBSEO_IN_PINGBACK || VBSEO_IN_TRACKBACK || VBSEO_IN_REFBACK) {
                $vbseolinkbacks = '';
                vbseo_get_options();
                vbseo_get_forum_info();
                $vbseo_gcache['thread'][$thread['threadid']] = $thread;
                $vbseo_linkback_uri = vbseo_thread_url($thread['threadid']);
                if (!strstr($vbseo_linkback_uri, '://')) {
                    $vbseo_linkback_uri = preg_replace('#/$#', '', $vbulletin->options['bburl']) . '/' . $vbseo_linkback_uri;
                }
                $showactusers = $vboptions['showthreadusers'] == 1 || $vboptions['showthreadusers'] == 2 || ($vboptions['showthreadusers'] > 2 and $vbulletin->userinfo['userid']);
                if (!vbseo_tpl_search('SHOWTHREAD', '$vbseolinkbacks')) {
                    $search_for = $showactusers ? '".(($show[\'activeusers\']' : '$similarthreads';
                    if (!vbseo_tpl_search('SHOWTHREAD', $search_for)) {
                        $search_for = '<!-- currently active users -->';
                    }
                    vbseo_modify_template('SHOWTHREAD', $search_for, "\$vbseolinkbacks\n{$search_for}");
                }
                $vbseolinkbackbits = '';
                $vbseo_linkbacks_no = 0;
                $ismod = can_moderate($thread['forumid'], 'vbseo_linkbacks') || $vbulletin && $vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['ismoderator'];
                if ($thread['vbseo_linkbacks_no'] || $ismod) {
                    $vbseodb = vbseo_get_db();
                    $vbseopings = $vbseodb->vbseodb_query("\nSELECT t_id, t_time, t_src_url, t_dest_url, t_type, t_postid, t_postcount, t_threadid, t_page, t_title, t_text, t_approve\nFROM " . vbseo_tbl_prefix('vbseo_linkback') . "\nWHERE t_incoming=1 AND t_deleted=0 AND t_wait=0\nAND " . ($ismod ? '' : 't_approve>0 AND ') . "t_threadid = '" . $thread['threadid'] . "' " . "ORDER BY t_time " . (preg_match('#^(asc|desc)$#i', VBSEO_DEFAULT_LINKBACKS_ORDER) ? VBSEO_DEFAULT_LINKBACKS_ORDER : "DESC"));
                    while ($vbseoping = @$vbseodb->funcs['fetch_assoc']($vbseopings)) {
                        $vbseoping['postno'] = $vbseoping['t_postcount'];
                        $vbseoping['ismod'] = $ismod;
                        $vbseoping['date'] = vbdate($vbulletin->options['dateformat'], $vbseoping['t_time'], true);
                        $vbseoping['time'] = vbdate($vbulletin->options['timeformat'], $vbseoping['t_time'], true);
                        $vbseoping['t_text_nohtml'] = htmlspecialchars(strip_tags($vbseoping['t_text']));
                        $vbseoping['t_title_html'] = htmlspecialchars($vbseoping['t_title']);
                        if ($vbseoping['t_postid']) {
                            $vbseo_gcache['postpings'][$vbseoping['t_postid']]++;
                        } else {
                            $vbseo_gcache['postcounts'][vbseo_thread_pagenum($vbseoping['t_page'] - 1, 0) + 1]++;
                        }
                        eval('$vbseolinkbackbits .= "' . fetch_template('vbseo_linkbackbit') . '";');
                        $vbseo_linkbacks_no++;
                    }
                    if ($vbseo_linkbacks_no) {
                        eval('$vbseolinkbacks = "' . fetch_template('vbseo_linkbacks') . '";');
                        if ($showactusers) {
                            $vbseolinkbacks = '<br />' . $vbseolinkbacks;
                        } else {
                            $vbseolinkbacks = $vbseolinkbacks . '<br />';
                        }
                    }
                    unset($vbseolinkbackbits);
                }
            }
            break;
        case 'postbit_display_complete':
            global $thread, $vbseo_lastmod;
            if (!isset($vbseo_lastmod) || $dat_proc['dateline'] > $vbseo_lastmod) {
                $vbseo_lastmod = $dat_proc['dateline'];
            }
            $dat_proc['preposts'] = $dat_proc['postcount'];
            $postcache[$dat_proc['postid']] = $dat_proc;
            $vbseo_gcache['thread'][$thread['threadid']] = $thread;
            $vbseo_postbit_pingback = VBSEO_POSTBIT_PINGBACK > 0 && THIS_SCRIPT != 'private' && THIS_SCRIPT != 'member';
            $vbseo_bookmark = VBSEO_BOOKMARK_POST;
            if ($vbseo_postbit_pingback || $vbseo_bookmark) {
                if (!$vboptions['bburl2']) {
                    vbseo_get_options();
                    vbseo_prepare_seo_replace();
                    vbseo_get_forum_info();
                }
                $GLOBALS['post']['linkbacksno'] = $vbseo_gcache['postpings'][$GLOBALS['post']['postid']] + $vbseo_gcache['postcounts'][$GLOBALS['post']['postcount']];
                $tplpostbit = vbseo_get_postbit_tpl();
                if (!defined('VBSEO_POSTBIT_PINGBACK_CHG_' . $tplpostbit) && vbseo_tpl_exists($tplpostbit)) {
                    define('VBSEO_POSTBIT_PINGBACK_CHG_' . $tplpostbit, 1);
                    $is_public = vbseo_forum_is_public($GLOBALS['forum'], $GLOBALS['foruminfo'], false, true);
                    if ($is_public && $vbseo_bookmark && THIS_SCRIPT == 'showthread' && ($bmlist = vbseo_get_bookmarks())) {
                        $vbseo_url_t = urlencode($vboptions['bburl2'] . '/' . vbseo_thread_url($thread['threadid'], $_GET['page']) . '#') . '$post[postid]';
                        $vbseo_url_t_iis = urlencode($vboptions['bburl2'] . '/' . vbseo_thread_url($thread['threadid'], $_GET['page']));
                        $book_t = urlencode($thread['title']);
                        $vbseo_post_bookmarks = '';
                        foreach ($bmlist as $bm) {
                            $vbseo_post_bookmarks .= '<a href=\\"' . str_replace('%url%', $vbseo_url_t, str_replace('%title%', $book_t, $bm[0])) . '\\" target=\\"_blank\\"><img src=\\"' . $bm[1] . '\\" alt=\\"' . $bm[3] . '\\" border=\\"0\\" /></a>';
                        }
                        $search_for = '<!--VBSEO_BOOKMARKS-->';
                        if (!vbseo_tpl_search($tplpostbit, $search_for)) {
                            $search_for = '".(($post[\'editlink\'])';
                        }
                        vbseo_modify_template($tplpostbit, $search_for, '<div style=\\"float:$stylevar[left]\\">' . $vbseo_post_bookmarks . "</div>\n" . $search_for);
                    }
                    if ($vbseo_postbit_pingback) {
                        $pingtpl = '".($post[\'linkbacksno\']?"<a href=\\"' . ($_POST['ajax'] || THIS_SCRIPT != 'showthread' ? 'showthread.' . VBSEO_VB_EXT . '?p=$post[postid]' : "") . '#linkbacks\\"><img class=\\"inlineimg\\" src=\\"images/vbseo/post_linkback.gif\\" alt=\\"".construct_phrase("$vbphrase[vbseo_no_links_to_this_post]",$post[linkbacksno])."\\" border=\\"0\\" /></a> ":"")."';
                        $pingtpl2 = '<a href=\\"' . ($_POST['ajax'] || THIS_SCRIPT != 'showthread' ? 'showthread.' . VBSEO_VB_EXT . '?p=$post[postid]' : '#post$post[postid]') . '\\" title=\\"".$vbphrase[\'vbseo_link_to_this_post\']."\\">".$vbphrase[\'vbseo_permalink\']."</a>';
                        if (VBSEO_POSTBIT_PINGBACK == 1) {
                            $pingtpl .= $pingtpl2;
                        }
                        if (vbseo_tpl_search($tplpostbit, '<!--PERMALINK_INFO-->')) {
                            vbseo_modify_template($tplpostbit, '<!--PERMALINK_INFO-->', $pingtpl);
                        } else {
                            if (VBSEO_POSTBIT_PINGBACK == 1) {
                                vbseo_modify_template($tplpostbit, '#(\\$show\\[\'messageicon\'\\] OR \\$post\\[\'title\'\\])(.*?)(<div.*?</div>)#s', '$1 OR 1$2<table cellspacing=\\"0\\" cellpadding=\\"0\\" width=\\"100%\\" border=\\"0\\">
<tr><td>$3</td>
<td><div class=\\"smallfont\\" style=\\"float:right\\">' . $pingtpl . '</div></td>
</tr></table>');
                            } else {
                                vbseo_modify_template($tplpostbit, '#("\\.\\(\\(\\$show\\[\'postcount\'\\])#s', $pingtpl . '$1');
                            }
                            if (VBSEO_POSTBIT_PINGBACK == 3) {
                                vbseo_modify_template($tplpostbit, '#("\\.\\(\\(\\$show\\[\'postcount\'\\].*?</a>)#s', '$1 (<b>' . $pingtpl2 . '</b>)');
                            }
                        }
                    }
                }
            }
            break;
        case 'forumhome_complete':
            global $vbseo_onload;
            if (!$onload) {
                $vbseo_onload = " onload=\"if (is_ie || is_moz) { var cpost=document.location.hash;if(cpost){ if(cobj = fetch_object(cpost.substring(1,cpost.length)))cobj.scrollIntoView(true); }}\"";
                vbseo_modify_template('FORUMHOME', '<body>', '<body$vbseo_onload>');
            }
            if (!is_array($GLOBALS['birthdays'])) {
                preg_match_all('#<a href="[^"]*?member\\.php\\?u=(\\d+)".*?>(.+?)<#', $GLOBALS['birthdays'], $birthm);
                foreach ($birthm[1] as $k => $v) {
                    $GLOBALS['usercache'][$v] = array('userid' => $v, 'username' => $birthm[2][$k]);
                }
            }
            break;
        case 'threadmanage_update':
            global $threadinfo;
            if ($threadinfo['title'] != $_REQUEST['title']) {
                $vbseodb = vbseo_get_db();
                $vbseodb->vbseodb_query("UPDATE " . vbseo_tbl_prefix('post') . "\nSET title = '" . $vbseodb->vbseodb_escape_string('re: ' . $_REQUEST['title']) . "'\nWHERE threadid = " . intval($threadinfo['threadid']) . " AND\ntitle = '" . $vbseodb->vbseodb_escape_string('re: ' . $threadinfo['title']) . "'");
            }
            break;
        case 'editpost_edit_complete':
        case 'newreply_form_complete':
        case 'newthread_form_complete':
        case 'threadmanage_complete':
            global $db, $disablesmiliesoption, $threadmanagement, $posticons;
            if (VBSEO_REWRITE_EXT_ADDTITLE) {
                $disablesmiliesoption = '<div><label for="qr_retrtitle"><input type="checkbox" name="vbseo_retrtitle" value="1" id="qr_retrtitle" ' . ($_POST['vbseo_retrtitle'] || !isset($_POST['vbseo_is_retrtitle']) ? ' checked' : '') . '/>' . $vbphrase['vbseo_auto_retrieve_titles'] . '</label>
<input type="hidden" name="vbseo_is_retrtitle" value="1" /></div>' . $disablesmiliesoption;
            }
            if (VBSEO_EXT_TRACKBACK && in_array($sec, array('newthread_form_complete', 'threadmanage_complete', 'newreply_form_complete')) && (!$GLOBALS['threadinfo']['threadid'] || $GLOBALS['threadinfo']['open'] == 1)) {
                $vbseodb = vbseo_get_db();
                $vbseopings = $vbseodb->vbseodb_query("\nSELECT t_time, t_dest_url, t_approve\nFROM " . vbseo_tbl_prefix('vbseo_linkback') . "\nWHERE t_incoming=0 AND t_type=1 AND t_threadid = '" . (isset($GLOBALS['threadinfo']) ? $GLOBALS['threadinfo']['threadid'] : $thread['threadid']) . "'\nORDER BY t_time DESC");
                $plist = '';
                while ($vbseoping = @$vbseodb->funcs['fetch_assoc']($vbseopings)) {
                    $plist .= '<li><strong>' . (strlen($vbseoping['t_dest_url']) > 50 ? substr($vbseoping['t_dest_url'], 0, 50) . '...' : $vbseoping['t_dest_url']) . '</strong></li>';
                }
                if ($plist) {
                    $plist = "<div>" . $vbphrase[vbseo_already_pinged] . ":<ul type=\"disc\">{$plist}</ul></div>";
                }
                $tracklegend = '
<fieldset class="fieldset">
<legend>' . $vbphrase['vbseo_trackback'] . '</legend>
<div style="padding:' . $stylevar['formspacer'] . 'px">
' . $vbphrase['vbseo_send_trackbacks_to'] . ':
<div><label for="trackbackto"><input type="text" class="bginput" size="50" name="sendtrackbacks" value="' . $_REQUEST['sendtrackbacks'] . '" id="trackbackto" tabindex="1" /></label> </div>
' . $plist . '
</div>
</fieldset>
';
                if (in_array($sec, array('threadmanage_complete', 'newreply_form_complete', 'newthread_form_complete'))) {
                    $posticons = $tracklegend . $posticons;
                }
            }
            break;
    }
    if (VBSEO_GOOGLE_AD_SEC) {
        $sps = $usps = array();
        switch ($sec) {
            case 'forumdisplay_complete':
                $sps[] =& $GLOBALS['threadbits'];
                break;
            case 'forumbit_display':
                $sps[] =& $GLOBALS['forum']['title'];
                break;
            case 'forumhome_complete':
                $sps[] =& $GLOBALS['forumbits'];
                break;
            case 'postbit_display_complete':
                $GLOBALS['post']['title_original'] = $GLOBALS['post']['title'];
                $GLOBALS['post']['message_original'] = $GLOBALS['post']['message'];
                $sps[] =& $GLOBALS['post']['message'];
                $sps[] =& $GLOBALS['post']['title'];
                $usps[] =& $GLOBALS['post']['signature'];
                $usps[] =& $GLOBALS['post']['musername'];
                break;
        }
        for ($i = 0; $i < count($sps); $i++) {
            if ($sps[$i]) {
                $sps[$i] = vbseo_google_ad_section($sps[$i]);
            }
        }
        for ($i = 0; $i < count($usps); $i++) {
            if ($usps[$i]) {
                $usps[$i] = vbseo_google_ad_section($usps[$i], true);
            }
        }
    }
}
Example #21
0
    $page_templater->register('ccrecipients', $ccrecipients);
    $page_templater->register('editorid', $editorid);
    $page_templater->register('messagearea', $messagearea);
    $page_templater->register('pm', $pm);
    $page_templater->register('postbit', $postbit);
    $page_templater->register('receipt_question_js', $receipt_question_js);
    $page_templater->register('threadpms', $threadpms);
    $page_templater->register('vBeditTemplate', $vBeditTemplate);
}
// ############################# start pm message history #############################
if ($_REQUEST['do'] == 'showhistory') {
    require_once DIR . '/includes/class_postbit.php';
    require_once DIR . '/includes/functions_bigthree.php';
    $vbulletin->input->clean_gpc('r', array('pmid' => TYPE_UINT));
    require_once DIR . '/includes/class_xml.php';
    $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
    $xml->add_group('response');
    if ($vbulletin->userinfo['userid'] and $vbulletin->GPC['pmid']) {
        $pm = $db->query_first_slave("\n\t\t\tSELECT pm.parentpmid, pmtext.dateline\n\t\t\tFROM " . TABLE_PREFIX . "pm AS pm\n\t\t\tINNER JOIN " . TABLE_PREFIX . "pmtext AS pmtext ON(pmtext.pmtextid = pm.pmtextid)\n\t\t\tWHERE pm.userid=" . $vbulletin->userinfo['userid'] . " AND pm.pmid=" . $vbulletin->GPC['pmid'] . "\n\t\t");
    }
    if (empty($pm)) {
        $xml->add_tag('error', 1);
    } else {
        $threadresult = $vbulletin->db->query_read_slave("\n\t\t\tSELECT pm.*, pmtext.*\n\t\t\tFROM " . TABLE_PREFIX . "pm AS pm\n\t\t\tINNER JOIN " . TABLE_PREFIX . "pmtext AS pmtext ON(pmtext.pmtextid = pm.pmtextid)\n\t\t\tWHERE (pm.parentpmid=" . $pm['parentpmid'] . "\n\t\t\t\t\tOR pm.pmid = " . $pm['parentpmid'] . ")\n\t\t\tAND pm.pmid != " . $vbulletin->GPC['pmid'] . "\n\t\t\tAND pm.userid=" . $vbulletin->userinfo['userid'] . "\n\t\t\tAND pmtext.dateline < " . intval($pm['dateline']) . "\n\t\t\tORDER BY pmtext.dateline DESC\n\t\t");
        if ($vbulletin->db->num_rows($threadresult)) {
            $threadpms = '';
            while ($threadpm = $vbulletin->db->fetch_array($threadresult)) {
                $postbit_factory = new vB_Postbit_Factory();
                $postbit_factory->registry =& $vbulletin;
                $postbit_factory->cache = array();
                $postbit_factory->bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
Example #22
0
    }
    if (!($year = $vbulletin->GPC['year']) or $year > 2037 or $year < 1970) {
        $year = vbdate('Y', TIMENOW, false, false);
    }
    if ($vbulletin->GPC['userid']) {
        $userinfo = fetch_userinfo($vbulletin->GPC['userid']);
    }
    $calendar = construct_calendar($month, $year, $userinfo);
    $xml->add_tag('calendar', $calendar);
    $xml->print_xml();
}
// #############################################################################
// fetch latest blogs
if ($_POST['do'] == 'loadupdated') {
    $vbulletin->input->clean_array_gpc('p', array('type' => TYPE_NOHTML, 'which' => TYPE_NOHTML));
    $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
    // can't view any blogs
    if (!($vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_canviewown']) and !($vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_canviewothers'])) {
        $xml->add_tag('error', 'nopermission');
        $xml->print_xml();
        exit;
    }
    $noresults = 0;
    if (!($data =& fetch_latest_blogs($vbulletin->GPC['which']))) {
        if ($vbulletin->GPC['which'] == 'rating' or $vbulletin->GPC['which'] == 'blograting') {
            $data = fetch_error('blog_no_rated_entries', vB_Template_Runtime::fetchStyleVar('left'), vB_Template_Runtime::fetchStyleVar('imgdir_rating'));
        } else {
            $data = fetch_error('blog_no_entries');
        }
        $data = htmlspecialchars_uni($data);
        $noresults = 1;
Example #23
0
            if (is_array($vbulletin->GPC["{$varname}"])) {
                foreach ($vbulletin->GPC["{$varname}"] as $_cleanme) {
                    $vbulletin->url .= $varname . '[]=' . urlencode($_cleanme) . '&amp;';
                }
            } else {
                $vbulletin->url .= $varname . '[]=' . urlencode($vbulletin->GPC["{$varname}"]) . '&amp;';
            }
        }
        $vbulletin->url = substr($vbulletin->url, 0, -5);
    }
    ($hook = vBulletinHook::fetch_hook('search_doprefs_complete')) ? eval($hook) : false;
    if (!$vbulletin->GPC['ajax']) {
        eval(print_standard_redirect($clearprefs ? 'search_preferencescleared' : 'search_preferencessaved', true, true));
    } else {
        require_once DIR . '/includes/class_xml.php';
        $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
        $xml->add_tag('message', fetch_phrase($clearprefs ? 'redirect_search_preferencescleared' : 'redirect_search_preferencessaved', 'frontredirect', 'redirect_'));
        $xml->print_xml();
    }
}
// #############################################################################
// finish off the page
if ($templatename != '') {
    ($hook = vBulletinHook::fetch_hook('search_complete')) ? eval($hook) : false;
    $navbits = construct_navbits($navbits);
    eval('$navbar = "' . fetch_template('navbar') . '";');
    eval('print_output("' . fetch_template($templatename) . '");');
}
/*======================================================================*\
|| ####################################################################
|| # Downloaded: 22:41, Fri Oct 10th 2008
Example #24
0
             $blograte->set('blogid', $bloginfo['blogid']);
             $blograte->set('userid', 0);
             $blograte->set('vote', $vbulletin->GPC['vote']);
             $blograte->set('ipaddress', IPADDRESS);
             ($hook = vBulletinHook::fetch_hook('blog_rate_add')) ? eval($hook) : false;
             $blograte->save();
             $update = true;
             if (!$vbulletin->GPC['ajax']) {
                 $vbulletin->url = fetch_seo_url('entry', $bloginfo);
                 eval(print_standard_redirect('redirect_blog_rate_add'));
             }
         }
     }
 }
 require_once DIR . '/includes/class_xml.php';
 $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
 $xml->add_group('threadrating');
 if ($update) {
     $blog = $db->query_first_slave("\r\n\t\t\tSELECT ratingtotal, ratingnum\r\n\t\t\tFROM " . TABLE_PREFIX . "blog\r\n\t\t\tWHERE blogid = {$bloginfo['blogid']}\r\n\t\t");
     if ($blog['ratingnum'] > 0 and $blog['ratingnum'] >= $vbulletin->options['vbblog_ratingpost']) {
         // Show Voteavg
         $blog['ratingavg'] = vb_number_format($blog['ratingtotal'] / $blog['ratingnum'], 2);
         $blog['rating'] = intval(round($blog['ratingtotal'] / $blog['ratingnum']));
         $xml->add_tag('voteavg', "<img class=\"inlineimg\" src=\"" . vB_Template_Runtime::fetchStyleVar('imgdir_rating') . "/rating-15_{$blog['rating']}.png\" alt=\"" . construct_phrase($vbphrase['rating_x_votes_y_average'], $blog['ratingnum'], $blog['ratingavg']) . "\" border=\"0\" />");
     } else {
         $xml->add_tag('voteavg', '');
     }
     if (!function_exists('fetch_phrase')) {
         require_once DIR . '/includes/functions_misc.php';
     }
     $xml->add_tag('message', fetch_phrase('redirect_blog_rate_add', 'frontredirect', 'redirect_'));
Example #25
0
// resolve an IP in Who's Online (this uses the WOL permissions)
if ($_REQUEST['do'] == 'resolveip') {
    $vbulletin->input->clean_array_gpc('r', array('ipaddress' => TYPE_NOHTML, 'ajax' => TYPE_BOOL));
    // can we actually resolve this?
    if (!($permissions['wolpermissions'] & $vbulletin->bf_ugp_wolpermissions['canwhosonlineip'])) {
        print_no_permission();
    }
    $resolved_host = htmlspecialchars_uni(@gethostbyaddr($vbulletin->GPC['ipaddress']));
    $ipaddress =& $vbulletin->GPC['ipaddress'];
    // no html'd already
    if ($vbulletin->GPC['ajax']) {
        if (empty($resolved_host)) {
            $resolved_host = $ipaddress;
        }
        require_once DIR . '/includes/class_xml.php';
        $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
        $xml->add_tag('ipaddress', $resolved_host, array('original' => $ipaddress));
        $xml->print_xml();
    } else {
        $navbits = construct_navbits(array('online.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['whos_online'], '' => $vbphrase['resolve_ip_address']));
        eval('$navbar = "' . fetch_template('navbar') . '";');
        eval('print_output("' . fetch_template('whosonline_resolveip') . '");');
    }
    exit;
}
// #######################################################################
// default action
$datecut = TIMENOW - $vbulletin->options['cookietimeout'];
$wol_event = array();
$wol_pm = array();
$wol_calendar = array();
Example #26
0
            $threadrate->set('threadid', $threadinfo['threadid']);
            $threadrate->set('userid', 0);
            $threadrate->set('vote', $vbulletin->GPC['vote']);
            $threadrate->set('ipaddress', IPADDRESS);
            ($hook = vBulletinHook::fetch_hook('threadrate_add')) ? eval($hook) : false;
            $threadrate->save();
            $update = true;
            if (!$vbulletin->GPC['ajax']) {
                $vbulletin->url = 'showthread.php?' . $vbulletin->session->vars['sessionurl'] . "t={$threadinfo['threadid']}&amp;page=" . $vbulletin->GPC['pagenumber'] . "&amp;pp=" . $vbulletin->GPC['perpage'];
                eval(print_standard_redirect('redirect_threadrate_add'));
            }
        }
    }
}
require_once DIR . '/includes/class_xml.php';
$xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
$xml->add_group('threadrating');
if ($update) {
    $thread = $db->query_first_slave("\n\t\tSELECT votetotal, votenum\n\t\tFROM " . TABLE_PREFIX . "thread\n\t\tWHERE threadid = {$threadinfo['threadid']}\n\t");
    if ($thread['votenum'] >= $vbulletin->options['showvotes']) {
        // Show Voteavg
        $thread['voteavg'] = vb_number_format($thread['votetotal'] / $thread['votenum'], 2);
        $thread['rating'] = round($thread['votetotal'] / $thread['votenum']);
        $xml->add_tag('voteavg', process_replacement_vars("{$vbphrase['rating']}: <img class=\"inlineimg\" src=\"{$stylevar['imgdir_rating']}/rating_{$thread['rating']}.gif\" alt=\"" . construct_phrase($vbphrase['thread_rating_x_votes_y_average'], $thread['votenum'], $thread['voteavg']) . "\" border=\"0\" />"));
    } else {
        $xml->add_tag('voteavg', '');
    }
    if (!function_exists('fetch_phrase')) {
        require_once DIR . '/includes/functions_misc.php';
    }
    $xml->add_tag('message', fetch_phrase('redirect_threadrate_add', 'frontredirect', 'redirect_'));
Example #27
0
 protected function processAjax($result)
 {
     require_once DIR . '/includes/class_xml.php';
     $xml = new vB_AJAX_XML_Builder(vB::$vbulletin, 'text/xml');
     if (!$result) {
         $xml->add_tag('nada', '~~No Results Found~~');
         $xml->print_xml();
     }
     $xml->add_group('results');
     $xml->add_tag('count', $result['count']);
     $xml->add_tag('totalcount', $result['totalcount']);
     $xml->add_tag('minid', $result['minid']);
     $xml->add_tag('maxid', $result['maxid']);
     $xml->add_tag('mindateline', $result['mindateline']);
     $xml->add_tag('maxdateline', $result['maxdateline']);
     $xml->add_tag('minscore', $result['minscore']);
     $xml->add_tag('moreresults', $result['moreresults']);
     if ($result['bits']) {
         $xml->add_group('bits');
         foreach ($result['bits'] as $bit) {
             $xml->add_tag('bit', $bit);
         }
         $xml->close_group('bits');
     }
     $xml->close_group('results');
     $xml->print_xml();
 }
Example #28
0
	/**
	 * Gets editor in the selected mode.
	 *
	 * @return string
	 */
	public function actionSwitchMode()
	{
		// Set up the style info - we need charset to be set for convert_urlencoded_unicode
		$this->bootstrap->force_styleid(0);
		$this->bootstrap->load_style();


		require_once DIR . '/includes/class_xml.php';

		vB::$vbulletin->input->clean_array_gpc('r', array(
			'towysiwyg' => vB_Input::TYPE_BOOL,
			'allowsmilie' => vB_Input::TYPE_BOOL,
			'message' => vB_Input::TYPE_STR,
		));

		vB::$vbulletin->GPC['message'] = convert_urlencoded_unicode(vB::$vbulletin->GPC['message']);

		$xml = new vB_AJAX_XML_Builder(vB::$vbulletin, 'text/xml');

		if (vB::$vbulletin->GPC['towysiwyg'])
		{
			$wysiwyg_parser = new vBCms_BBCode_Wysiwyg(vB::$vbulletin, vBCms_BBCode_Wysiwyg::fetchCmsTags());

			// todo: options
			$wysiwyg_html = $wysiwyg_parser->do_parse(vB::$vbulletin->GPC['message'], false, vB::$vbulletin->GPC['allowsmilie'], true, true, true);

			$xml->add_tag('message', process_replacement_vars($wysiwyg_html));
		}
		else
		{
			$html_parser = new vBCms_WysiwygHtmlParser(vB::$vbulletin);
			$do_html = false; // todo: option
			$message = $html_parser->parse(vB::$vbulletin->GPC['message'], $do_html);

			$xml->add_tag('message', process_replacement_vars($message));
		}

		if (!vB::contentHeadersSent())
		{
			$xml->send_content_type_header();
			$xml->send_content_length_header();

			vB::contentHeadersSent(true);
		}

		return $xml->fetch_xml();
	}
Example #29
0
         if (isset($allowedlist)) {
             if (!in_array($value, $allowedlist) and $value != '') {
                 $usercss->invalid["{$selectorname}"]["{$property}"] = ' usercsserror ';
                 continue;
             }
         }
         $usercss->parse($selectorname, $property, $value);
     }
 }
 ($hook = vBulletinHook::fetch_hook('profile_docustomize_process')) ? eval($hook) : false;
 if ($vbulletin->GPC['ajax']) {
     // AJAX means get the preview
     $effective_css = $usercss->build_css($usercss->fetch_effective());
     $effective_css = str_replace('/*sessionurl*/', $vbulletin->session->vars['sessionurl_js'], $effective_css);
     require_once DIR . '/includes/class_xml.php';
     $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
     $xml->add_group('preview');
     $xml->add_tag('css', process_replacement_vars($effective_css));
     $xml->close_group();
     $xml->print_xml();
 }
 if (empty($usercss->error) and empty($usercss->invalid)) {
     $usercss->save();
     $vbulletin->url = "profile.php?" . $vbulletin->session->vars['sessionurl'] . "do=customize";
     eval(print_standard_redirect('usercss_saved'));
 } else {
     if (!empty($usercss->error)) {
         standard_error(implode("<br />", $usercss->error));
     } else {
         // have invalid, no errors
         $_REQUEST['do'] = 'customize';
Example #30
0
                        $vbulletin->GPC['vbulletin_multiquote'] = explode(',', $vbulletin->GPC['vbulletin_multiquote']);
                    }
                    if ($ignore["{$post['userid']}"]) {
                        $fetchtype = 'post_ignore';
                    } else {
                        if ($post['visible'] == 2) {
                            $fetchtype = 'post_deleted';
                        } else {
                            $fetchtype = 'post';
                        }
                    }
                    ($hook = vBulletinHook::fetch_hook('showthread_postbit_create')) ? eval($hook) : false;
                    $show['spacer'] = false;
                    $post['postcount'] = $vbulletin->GPC['postcount'];
                    $postbit_obj =& $postbit_factory->fetch_postbit($fetchtype);
                    $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
                    $xml->add_tag('postbit', process_replacement_vars($postbit_obj->construct_postbit($post)));
                    $xml->print_xml(true);
                    // #############################################################################
                    // #############################################################################
                    // #############################################################################
                } else {
                    $vbulletin->url = 'showthread.php?' . $vbulletin->session->vars['sessionurl'] . "p={$postinfo['postid']}#post{$postinfo['postid']}";
                    eval(print_standard_redirect('redirect_editthanks'));
                }
            }
        }
    }
}
// ############################### start edit post ###############################
if ($_REQUEST['do'] == 'editpost') {