本文整理汇总了PHP中vB_AJAX_XML_Builder::print_xml方法的典型用法代码示例。如果您正苦于以下问题:PHP vB_AJAX_XML_Builder::print_xml方法的具体用法?PHP vB_AJAX_XML_Builder::print_xml怎么用?PHP vB_AJAX_XML_Builder::print_xml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vB_AJAX_XML_Builder
的用法示例。
在下文中一共展示了vB_AJAX_XML_Builder::print_xml方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showCommentsXml
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();
}
示例2: standard_error
/**
* 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);
//.........这里部分代码省略.........
示例3: halt
//.........这里部分代码省略.........
}
$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('&', '&', $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;
}
}
}
示例4: vbseo_complete_sec
//.........这里部分代码省略.........
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';
}
示例5: checkUrlAvailable
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 '';
}
示例6: print_cp_message
/**
* 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> </p><p> </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('&', '&', $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 = '
<input type="button" id="backbutton" class="button" value="' . $vbphrase['go_back'] . '" title="" tabindex="1" onclick="if (history.length) { history.back(1); } else { self.close(); }"/>
<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();
}
示例7: fetch_query_status
/**
* Retrieve current MYSQL process list
*
*/
protected function fetch_query_status()
{
$xml = new vB_AJAX_XML_Builder($this->registry, 'text/xml', vB_Template_Runtime::fetchStyleVar('charset'));
$xml->add_group('processes');
$xml->add_tag('query_status', $this->phrase['core']['query_status_title']);
$processes = $this->db->query_read("\n\t\t\tSHOW FULL PROCESSLIST\n\t\t");
$found = false;
while ($process = $this->db->fetch_array($processes)) {
if ($process['db'] == $this->registry->config['Database']['dbname'] and $process['User'] == $this->registry->config['MasterServer']['username'] and $process['Info'] != 'SHOW FULL PROCESSLIST' and $process['Command'] == 'Query' and preg_match('/^(\\s+)?### vBulletin Database Alter ###/s', $process['Info'])) {
$process['Info'] = preg_replace("/^(\\s+)?### vBulletin Database Alter ###/s", "", $process['Info']);
$found = true;
$totalseconds = intval($process['Time']);
$hours = floor($seconds / 3600);
$totalseconds -= $hours * 3600;
$minutes = floor($totalseconds / 60);
$totalseconds -= $minutes * 60;
$seconds = $totalseconds;
$xml->add_tag('process', construct_phrase($this->phrase['core']['process_x_y_z'], str_pad($hours, 2, "0", STR_PAD_LEFT), str_pad($minutes, 2, "0", STR_PAD_LEFT), str_pad($seconds, 2, "0", STR_PAD_LEFT), htmlspecialchars_uni($process['State']), htmlspecialchars_uni($process['Info'])));
}
}
if (!$found) {
$xml->add_tag('noprocess', $this->phrase['core']['no_processes_found']);
}
$xml->close_group('processes');
$xml->print_xml();
}
示例8: processAjax
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();
}
示例9: print_stop_message
/**
* Halts execution and shows a message based upon a parsed phrase
*
* After the first parameter, this function can take any number of additional
* parameters, in order to replace {1}, {2}, {3},... {n} variable place holders
* within the given phrase text. The parsed phrase is then passed to print_cp_message()
*
* Note that a redirect can be performed if CP_REDIRECT is defined with a URL
*
* @param string Name of phrase (from the Error phrase group)
* @param string 1st variable replacement {1}
* @param string 2nd variable replacement {2}
* @param string Nth variable replacement {n}
*/
function print_stop_message($phrasename)
{
global $vbulletin, $vbphrase;
if (!function_exists('fetch_phrase'))
{
require_once(DIR . '/includes/functions_misc.php');
}
$message = fetch_phrase($phrasename, 'error', '', false);
$args = func_get_args();
if (sizeof($args) > 1)
{
$args[0] = $message;
$message = call_user_func_array('construct_phrase', $args);
}
if (defined('CP_CONTINUE'))
{
define('CP_REDIRECT', CP_CONTINUE);
}
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();
}
print_cp_message(
$message,
defined('CP_REDIRECT') ? CP_REDIRECT : NULL,
1,
defined('CP_BACKURL') ? CP_BACKURL : NULL,
defined('CP_CONTINUE') ? true : false
);
}
示例10: halt
//.........这里部分代码省略.........
$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");
}
}
// 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 = 'Database Error';
if ($vbulletin->debug)
{
$error .= "\n";
$error .= $this->sql;
$error .= "\n";
$error .= $error_text;
}
$xml->add_tag('error', $error);
$xml->print_xml();
}
if (!headers_sent())
{
if (SAPI_NAME == 'cgi' OR SAPI_NAME == 'cgi-fcgi')
{
header('Status: 503 Service Unavailable');
}
else
{
header('HTTP/1.1 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
{
// display hidden error message
$message = "\r\n<!--\r\n" . htmlspecialchars_uni($message) . "\r\n-->\r\n";
}
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;
}
}
示例11: actionRate
//.........这里部分代码省略.........
$ratedm->save();
}
$update = true;
}
}
else
{
$ratedm = new vBCms_DM_Rate();
$ratedm->set('nodeid', $nodeid);
$ratedm->set('userid', vB::$vbulletin->userinfo['userid']);
$ratedm->set('vote', intval($vote));
$ratedm->save();
$update = true;
}
}
else
{
// Check for cookie on user's computer for this blogid
if ($rated AND !vB::$vbulletin->options['votechange'])
{
}
else
{
// Check for entry in Database for this Ip Addr/blogid
if ($rating = vB::$db->query_first("
SELECT *
FROM " . TABLE_PREFIX . "cms_rate
WHERE ipaddress = '" . vB::$db->escape_string(IPADDRESS) . "'
AND nodeid = $nodeid
"))
{
if (vB::$vbulletin->options['votechange'])
{
if ($vote != $rating['vote'])
{
$rateitem = new vBCms_Item_Rate($rating['rateid']);
$ratedm = new vBCms_DM_Rate($rateitem);
$ratedm->set('nodeid', $nodeid);
$ratedm->set('vote', intval($vote));
$ratedm->save();
}
$update = true;
}
}
else
{
$ratedm = new vBCms_DM_Rate();
$ratedm->set('nodeid', $nodeid);
$ratedm->set('userid', 0);
$ratedm->set('vote', intval($vote));
$ratedm->save();
$update = true;
}
}
}
require_once(DIR . '/includes/class_xml.php');
$xml = new vB_AJAX_XML_Builder(vB::$vbulletin, 'text/xml');
$xml->add_group('threadrating');
if ($update)
{
$node = vB::$db->query_first_slave("
SELECT ratingtotal, ratingnum
FROM " . TABLE_PREFIX . "cms_nodeinfo
WHERE nodeid = $nodeid
");
if ($node['ratingnum'] > 0 AND $node['ratingnum'] >= vB::$vbulletin->options['showvotes'])
{ // Show Voteavg
$node['ratingavg'] = vb_number_format($node['ratingtotal'] / $node['ratingnum'], 2);
$node['rating'] = intval(round($node['ratingtotal'] / $node['ratingnum']));
$xml->add_tag('voteavg', "<img class=\"inlineimg\" src=\"" . vB_Template_Runtime::fetchStyleVar('imgdir_rating') . "/rating-15_$node[rating].png\" alt=\"" . construct_phrase($vbphrase['rating_x_votes_y_average'], $node['ratingnum'], $node['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_'));
}
else // Already voted error...
{
if (!empty($rating['nodeid']))
{
set_bbarray_cookie('cms_rate', $rating['nodeid'], $rating['vote'], 1);
}
$xml->add_tag('error', fetch_error('blog_rate_voted'));
}
$xml->close_group();
$xml->print_xml();
}
示例12: standard_error
/**
* 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']);
$navbar = '';
$navbits = construct_navbits(array('' => $vbphrase['vbulletin_message']));
if (defined('VB_ERROR_LITE') and VB_ERROR_LITE == true) {
$templatename = 'STANDARD_ERROR_LITE';
define('NOPMPOPUP', 1);
// No Footer here
} else {
$templatename = $override_template ? preg_replace('#[^a-z0-9_]#i', '', $override_template) : 'STANDARD_ERROR';
}
$show['dst_correction'] = false;
($hook = vBulletinHook::fetch_hook('error_generic')) ? eval($hook) : false;
// VBIV-4792 always render navbar (also fixes VBIV-11560).
$navbar = render_navbar_template($navbits);
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'] : ''));
}
$redirpath = SCRIPTPATH;
$pathinfo = $vbulletin->input->parse_url($VB_URL);
$options = array($vbulletin->options['vbforum_url'], $vbulletin->options['vbblog_url'], $vbulletin->options['vbcms_url']);
foreach ($options as $value) {
if ($value and $info = $vbulletin->input->parse_url($value)) {
if ("{$info['scheme']}://{$info['host']}" == VB_URL_SCHEME . '://' . VB_URL_HOST) {
$redirpath = $vbulletin->input->xss_clean(VB_URL);
break;
}
}
}
$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', $redirpath);
$templater->register('url', $vbulletin->url);
print_output($templater->render());
}
}
示例13: outputError
function outputError($errors)
{
global $vbulletin;
if (!is_array($errors)) {
$errors = array($errors);
//create array with 1 item
}
if ($vbulletin->GPC['ajax']) {
require_once DIR . '/includes/class_xml.php';
$xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
$xml->add_group('response');
$html = '';
$xml->add_tag('error', implode(',', $errors));
$xml->close_group();
$xml->print_xml(true);
} else {
eval(standard_error(implode('<br/>', $errors)));
}
exit;
//just in case...
}
示例14: while
$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());
$postbit_obj =& $postbit_factory->fetch_postbit('pm');
$threadpms .= $postbit_obj->construct_postbit($threadpm);
}
} else {
$threadpms = vB_Template::create('pm_nomessagehistory')->render();
}
$xml->add_tag('html', process_replacement_vars($threadpms));
}
$xml->close_group();
$xml->print_xml(true);
}
// ############################### start pm folder view ###############################
if ($_REQUEST['do'] == 'messagelist') {
$vbulletin->input->clean_array_gpc('r', array('folderid' => TYPE_INT, 'perpage' => TYPE_UINT, 'pagenumber' => TYPE_UINT));
($hook = vBulletinHook::fetch_hook('private_messagelist_start')) ? eval($hook) : false;
$folderid = $vbulletin->GPC['folderid'];
$folderjump = construct_folder_jump(0, $vbulletin->GPC['folderid'], false, '', true);
$foldername = $foldernames["{$vbulletin->GPC['folderid']}"]['name'];
// count receipts
$receipts = $db->query_first_slave("\n\t\tSELECT\n\t\t\tSUM(IF(readtime <> 0, 1, 0)) AS confirmed,\n\t\t\tSUM(IF(readtime = 0, 1, 0)) AS unconfirmed\n\t\tFROM " . TABLE_PREFIX . "pmreceipt\n\t\tWHERE userid = " . $vbulletin->userinfo['userid']);
// get ignored users
$ignoreusers = preg_split('#\\s+#s', $vbulletin->userinfo['ignorelist'], -1, PREG_SPLIT_NO_EMPTY);
$totalmessages = intval($messagecounters["{$vbulletin->GPC['folderid']}"]);
// build pm counters bar, folder is 100 if we have no quota so red shows on the main bar
$tdwidth = array();
示例15: standard_error
/**
* 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;
}
}