本文整理汇总了PHP中fetch_phrase函数的典型用法代码示例。如果您正苦于以下问题:PHP fetch_phrase函数的具体用法?PHP fetch_phrase怎么用?PHP fetch_phrase使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fetch_phrase函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_admin_stop_exception
function print_admin_stop_exception($e)
{
$args = $e->getParams();
$message = fetch_phrase($args[0], 'error', '', false);
if (sizeof($args) > 1) {
$args[0] = $message;
$message = call_user_func_array('construct_phrase', $args);
}
echo "<p>{$message}</p>\n";
}
示例2: output_token
/**
* Returns the HTML to be displayed to the user for Human Verification
*
* @param string Passed to template
*
* @return string HTML to output
*
*/
function output_token($var_prefix = 'humanverify')
{
global $vbphrase, $stylevar, $show;
$vbulletin =& $this->registry;
$humanverify = $this->generate_token();
require_once DIR . '/includes/functions_misc.php';
$humanverify['question'] = fetch_phrase('question' . $humanverify['answer'], 'hvquestion', '', false, true, $this->registry->userinfo['languageid'], false);
eval('$output = "' . fetch_template('humanverify_question') . '";');
return $output;
}
示例3: output_token
/**
* Returns the HTML to be displayed to the user for Human Verification
*
* @param string Passed to template
*
* @return string HTML to output
*
*/
function output_token($var_prefix = 'humanverify')
{
global $vbphrase, $show;
$vbulletin =& $this->registry;
$humanverify = $this->generate_token();
require_once DIR . '/includes/functions_misc.php';
$humanverify['question'] = fetch_phrase('question' . $humanverify['answer'], 'hvquestion', '', false, true, $this->registry->userinfo['languageid'], false);
$templater = vB_Template::create('humanverify_question');
$templater->register('humanverify', $humanverify);
$templater->register('var_prefix', $var_prefix);
$output = $templater->render();
return $output;
}
示例4: fetch_phrase
$messages['errors'][] = $userdata->errors[0];
}
}
// check if username already exists on DB
$user_exists = $db->query_first("\n SELECT userid, username, email, languageid\n FROM " . TABLE_PREFIX . "user\n WHERE username = '" . $db->escape_string($vbulletin->GPC['username']) . "'\n ");
if (!empty($user_exists['username'])) {
$valid_entries = FALSE;
$error_type = "username";
$messages['fields'][] = $error_type;
$messages['errors'][] = "Sorry, this username is already taken.";
// fetch_error('usernametaken', $user_exists['username'], '');
}
if (empty($vbulletin->GPC['terms_and_conditions'])) {
$valid_entries = FALSE;
$userdata->error('fieldmissing');
$messages['errors'][] = $message = "Please agree to the " . fetch_phrase('forum_rules', 'register');
$messages['fields'][] = $error_type = "terms_and_conditions";
}
// validate email
if (is_valid_email_address($vbulletin->GPC['email'])) {
list($email_name, $email_domain) = preg_split("/@/", $vbulletin->GPC['email']);
if (!checkdnsrr($email_domain, "MX")) {
$valid_entries = FALSE;
$messages['errors'][] = $message = fetch_error('bademail') . " No MX records found for domain.";
$messages['fields'][] = $error_type = "email";
} else {
if ($vbulletin->options['requireuniqueemail']) {
// check if email already exists on DB
$user_exists = $db->query_read_slave("\n SELECT userid, username, email, languageid\n FROM " . TABLE_PREFIX . "user\n WHERE UPPER(email) = '" . strtoupper($db->escape_string($vbulletin->GPC['email'])) . "'\n ");
if ($db->num_rows($user_exists)) {
$valid_entries = FALSE;
示例5: exec_send_notification
/**
* Sends Thread subscription Notifications
*
* @param integer The Thread ID
* @param integer The User ID making the Post
* @param integer The Post ID of the new post
*
*/
function exec_send_notification($threadid, $userid, $postid)
{
// $threadid = threadid to send from;
// $userid = userid of who made the post
// $postid = only sent if post is moderated -- used to get username correctly
global $vbulletin, $message, $postusername;
if (!$vbulletin->options['enableemail']) {
return;
}
// include for fetch_phrase
require_once DIR . '/includes/functions_misc.php';
$threadinfo = fetch_threadinfo($threadid);
$foruminfo = fetch_foruminfo($threadinfo['forumid']);
// get last reply time
if ($postid) {
$dateline = $vbulletin->db->query_first("\n\t\t\tSELECT dateline, pagetext\n\t\t\tFROM " . TABLE_PREFIX . "post\n\t\t\tWHERE postid = {$postid}\n\t\t");
$pagetext_orig = $dateline['pagetext'];
$lastposttime = $vbulletin->db->query_first("\n\t\t\tSELECT MAX(dateline) AS dateline\n\t\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\t\tWHERE threadid = {$threadid}\n\t\t\t\tAND dateline < {$dateline['dateline']}\n\t\t\t\tAND visible = 1\n\t\t");
} else {
$lastposttime = $vbulletin->db->query_first("\n\t\t\tSELECT MAX(postid) AS postid, MAX(dateline) AS dateline\n\t\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\t\tWHERE threadid = {$threadid}\n\t\t\t\tAND visible = 1\n\t\t");
$pagetext = $vbulletin->db->query_first("\n\t\t\tSELECT pagetext\n\t\t\tFROM " . TABLE_PREFIX . "post\n\t\t\tWHERE postid = {$lastposttime['postid']}\n\t\t");
$pagetext_orig = $pagetext['pagetext'];
unset($pagetext);
}
$threadinfo['title'] = unhtmlspecialchars($threadinfo['title']);
$foruminfo['title_clean'] = unhtmlspecialchars($foruminfo['title_clean']);
$temp = $vbulletin->userinfo['username'];
if ($postid) {
$postinfo = fetch_postinfo($postid);
$vbulletin->userinfo['username'] = unhtmlspecialchars($postinfo['username']);
} else {
$vbulletin->userinfo['username'] = unhtmlspecialchars(!$vbulletin->userinfo['userid'] ? $postusername : $vbulletin->userinfo['username']);
}
require_once DIR . '/includes/class_bbcode_alt.php';
$plaintext_parser =& new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list());
$pagetext_cache = array();
// used to cache the results per languageid for speed
$mod_emails = fetch_moderator_newpost_emails('newpostemail', $foruminfo['parentlist'], $language_info);
($hook = vBulletinHook::fetch_hook('newpost_notification_start')) ? eval($hook) : false;
$useremails = $vbulletin->db->query_read_slave("\n\t\tSELECT user.*, subscribethread.emailupdate, subscribethread.subscribethreadid\n\t\tFROM " . TABLE_PREFIX . "subscribethread AS subscribethread\n\t\tINNER JOIN " . TABLE_PREFIX . "user AS user ON (subscribethread.userid = user.userid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "usergroup AS usergroup ON (usergroup.usergroupid = user.usergroupid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON (usertextfield.userid = user.userid)\n\t\tWHERE subscribethread.threadid = {$threadid} AND\n\t\t\tsubscribethread.emailupdate IN (1, 4) AND\n\t\t\tsubscribethread.canview = 1 AND\n\t\t\t" . ($userid ? "CONCAT(' ', IF(usertextfield.ignorelist IS NULL, '', usertextfield.ignorelist), ' ') NOT LIKE '% " . intval($userid) . " %' AND" : '') . "\n\t\t\tuser.usergroupid <> 3 AND\n\t\t\tuser.userid <> " . intval($userid) . " AND\n\t\t\tuser.lastactivity >= " . intval($lastposttime['dateline']) . " AND\n\t\t\t(usergroup.genericoptions & " . $vbulletin->bf_ugp_genericoptions['isnotbannedgroup'] . ")\n\t");
vbmail_start();
$evalemail = array();
while ($touser = $vbulletin->db->fetch_array($useremails)) {
if (!($vbulletin->usergroupcache["{$touser['usergroupid']}"]['genericoptions'] & $vbulletin->bf_ugp_genericoptions['isnotbannedgroup'])) {
continue;
} else {
if (in_array($touser['email'], $mod_emails)) {
// this user already received an email about this post via
// a new post email for mods -- don't send another
continue;
}
}
$touser['username'] = unhtmlspecialchars($touser['username']);
$touser['languageid'] = iif($touser['languageid'] == 0, $vbulletin->options['languageid'], $touser['languageid']);
$touser['auth'] = md5($touser['userid'] . $touser['subscribethreadid'] . $touser['salt'] . COOKIE_SALT);
if (empty($evalemail)) {
$email_texts = $vbulletin->db->query_read_slave("\n\t\t\t\tSELECT text, languageid, fieldname\n\t\t\t\tFROM " . TABLE_PREFIX . "phrase\n\t\t\t\tWHERE fieldname IN ('emailsubject', 'emailbody') AND varname = 'notify'\n\t\t\t");
while ($email_text = $vbulletin->db->fetch_array($email_texts)) {
$emails["{$email_text['languageid']}"]["{$email_text['fieldname']}"] = $email_text['text'];
}
require_once DIR . '/includes/functions_misc.php';
foreach ($emails as $languageid => $email_text) {
// lets cycle through our array of notify phrases
$text_message = str_replace("\\'", "'", addslashes(iif(empty($email_text['emailbody']), $emails['-1']['emailbody'], $email_text['emailbody'])));
$text_message = replace_template_variables($text_message);
$text_subject = str_replace("\\'", "'", addslashes(iif(empty($email_text['emailsubject']), $emails['-1']['emailsubject'], $email_text['emailsubject'])));
$text_subject = replace_template_variables($text_subject);
$evalemail["{$languageid}"] = '
$message = "' . $text_message . '";
$subject = "' . $text_subject . '";
';
}
}
// parse the page text into plain text, taking selected language into account
if (!isset($pagetext_cache["{$touser['languageid']}"])) {
$plaintext_parser->set_parsing_language($touser['languageid']);
$pagetext_cache["{$touser['languageid']}"] = $plaintext_parser->parse($pagetext_orig, $foruminfo['forumid']);
}
$pagetext = $pagetext_cache["{$touser['languageid']}"];
if ($threadinfo['prefixid']) {
// need prefix in correct language
$threadinfo['prefix_plain'] = fetch_phrase("prefix_{$threadinfo['prefixid']}_title_plain", 'global', '', false, true, $touser['languageid'], false) . ' ';
} else {
$threadinfo['prefix_plain'] = '';
}
($hook = vBulletinHook::fetch_hook('newpost_notification_message')) ? eval($hook) : false;
eval(iif(empty($evalemail["{$touser['languageid']}"]), $evalemail["-1"], $evalemail["{$touser['languageid']}"]));
if ($touser['emailupdate'] == 4 and !empty($touser['icq'])) {
// instant notification by ICQ
$touser['email'] = $touser['icq'] . '@pager.icq.com';
}
vbmail($touser['email'], $subject, $message);
//.........这里部分代码省略.........
示例6: construct_errors
if ($showemail) {
if (empty($vbulletin->GPC['message']) and $vbulletin->options['uimessage'] and !$nocontact) {
$errors[] = 'nomessagetouser';
}
if (!empty($errors)) {
// include useful functions
require_once DIR . '/includes/functions_newpost.php';
$postpreview = construct_errors(array_map('fetch_error', $errors));
define('PMPREVIEW', 1);
$postmessage = htmlspecialchars_uni($vbulletin->GPC['message']);
} else {
// Email User
require_once DIR . '/includes/class_bbcode_alt.php';
$plaintext_parser =& new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list());
$plaintext_parser->set_parsing_language($touserinfo['languageid']);
$infraction = array('username' => unhtmlspecialchars($userinfo['username']), 'reason' => $infractionlevel['infractionlevelid'] ? fetch_phrase('infractionlevel' . $infractionlevel['infractionlevelid'] . '_title', 'infractionlevel', '', true, true, $userinfo['languageid']) : $vbulletin->GPC['customreason'], 'message' => &$vbulletin->GPC['message'], 'points' => $infdata->fetch_field('points'));
$emailsubphrase = $infraction['points'] > 0 ? 'infraction_received' : 'warning_received';
// if we have a specific post we can link to, link to it
if (!empty($postinfo)) {
$infraction['post'] = $vbulletin->options['bburl'] . "/showthread.php?p={$postinfo['postid']}#post{$postinfo['postid']}";
$infraction['pagetext'] =& $postinfo['pagetext'];
$emailphrase = $emailsubphrase . '_post';
} else {
$infraction['post'] = '';
$emailphrase = $emailsubphrase . '_profile';
}
eval(fetch_email_phrases($emailphrase, $userinfo['languageid'], $emailsubphrase));
$message = $plaintext_parser->parse($message, 'privatemessage');
vbmail($userinfo['email'], $subject, $message);
}
} else {
示例7: set_reportinfo
/**
* Sets information regarding the report
*
* @param array Information regarding the report
*
*/
function set_reportinfo(&$reportinfo)
{
$reportinfo = array_merge($reportinfo, array('forumtitle' => unhtmlspecialchars($this->extrainfo['forum']['title_clean']), 'threadtitle' => unhtmlspecialchars($this->extrainfo['thread']['title']), 'posttitle' => unhtmlspecialchars($this->iteminfo['title']), 'pusername' => unhtmlspecialchars($this->iteminfo['username']), 'puserid' => $this->iteminfo['userid'], 'postid' => $this->iteminfo['postid'], 'threadid' => $this->extrainfo['thread']['threadid'], 'pagetext' => $this->iteminfo['pagetext']));
$reportinfo['prefix_plain'] = $this->extrainfo['thread']['prefixid'] ? fetch_phrase("prefix_" . $this->extrainfo['thread']['prefixid'] . "_title_plain", 'global', '', false, true, 0, false) . ' ' : '';
}
示例8: print_form_header
}
</script>
<?php
print_form_header('user', 'domoderate');
print_table_header($vbphrase['users_awaiting_moderation'], 4);
print_cells_row(array($vbphrase['username'], $vbphrase['email'], $vbphrase['ip_address'], "<input type=\"button\" class=\"button\" value=\"" . $vbphrase['accept_all'] . "\" onclick=\"js_check_radio(1)\" />\n\t\t\t<input type=\"button\" class=\"button\" value=\"" . $vbphrase['delete_all'] . "\" onclick=\"js_check_radio(-1)\" />\n\t\t\t<input type=\"button\" class=\"button\" value=\"" . $vbphrase['ignore_all'] . "\" onclick=\"js_check_radio(0)\" />"), 0, 'thead', -3);
while ($user = $db->fetch_array($users)) {
$cell = array();
$cell[] = "<a href=\"user.php?" . $vbulletin->session->vars['sessionurl'] . "do=edit&u={$user['userid']}\" target=\"_user\"><b>{$user['username']}</b></a>";
$cell[] = "<a href=\"mailto:{$user['email']}\">{$user['email']}</a>";
$cell[] = "<a href=\"usertools.php?" . $vbulletin->session->vars['sessionurl'] . "do=doips&depth=2&ipaddress={$user['ipaddress']}&hash=" . CP_SESSIONHASH . "\" target=\"_user\">{$user['ipaddress']}</a>";
$cell[] = "\n\t\t\t\t<label for=\"v_{$user['userid']}\"><input type=\"radio\" name=\"validate[{$user['userid']}]\" value=\"1\" id=\"v_{$user['userid']}\" tabindex=\"1\" />{$vbphrase['accept']}</label>\n\t\t\t\t<label for=\"d_{$user['userid']}\"><input type=\"radio\" name=\"validate[{$user['userid']}]\" value=\"-1\" id=\"d_{$user['userid']}\" tabindex=\"1\" />{$vbphrase['delete']}</label>\n\t\t\t\t<label for=\"i_{$user['userid']}\"><input type=\"radio\" name=\"validate[{$user['userid']}]\" value=\"0\" id=\"i_{$user['userid']}\" tabindex=\"1\" checked=\"checked\" />{$vbphrase['ignore']}</label>\n\t\t\t";
print_cells_row($cell, 0, '', -4);
}
require_once DIR . '/includes/functions_misc.php';
$template = fetch_phrase('validated', 'emailbody', 'email_');
print_table_break();
print_table_header($vbphrase['email_options']);
print_yes_no_row($vbphrase['send_email_to_accepted_users'], 'send_validated', 1);
print_yes_no_row($vbphrase['send_email_to_deleted_users'], 'send_deleted', 1);
print_description_row($vbphrase['email_will_be_sent_in_user_specified_language']);
print_table_break();
print_submit_row($vbphrase['continue']);
}
}
// ###################### Start do moderate and coppa #######################
if ($_POST['do'] == 'domoderate') {
$vbulletin->input->clean_array_gpc('p', array('send_validated' => TYPE_INT, 'send_deleted' => TYPE_INT, 'validate' => TYPE_ARRAY_INT));
if (empty($vbulletin->GPC['validate'])) {
print_stop_message('please_complete_required_fields');
} else {
示例9: vB_AJAX_XML_Builder
}
}
}
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_'));
} else {
$xml->add_tag('error', fetch_error('threadratevoted'));
}
$xml->close_group();
$xml->print_xml();
/*======================================================================*\
|| ####################################################################
|| # Downloaded: 08:19, Wed Nov 5th 2008
|| # CVS: $RCSfile$ - $Revision: 26399 $
|| ####################################################################
\*======================================================================*/
示例10: post_save_each
function post_save_each($doquery = true)
{
global $vbphrase;
if (!$this->condition) {
if ($postinfo =& $this->info['postinfo']) {
$dataman =& datamanager_init('Post', $this->registry, ERRTYPE_SILENT, 'threadpost');
$dataman->set_existing($postinfo);
$dataman->set('infraction', $this->fetch_field('points') == 0 ? 1 : 2);
$dataman->save();
unset($dataman);
$threadinfo =& $this->info['threadinfo'];
}
if ($userinfo =& $this->info['userinfo']) {
$userdata =& datamanager_init('User', $this->registry, ERRTYPE_SILENT);
$userdata->set_existing($userinfo);
if ($points = $this->fetch_field('points')) {
$userdata->set('ipoints', "ipoints + {$points}", false);
$userdata->set('infractions', 'infractions + 1', false);
} else {
$userdata->set('warnings', 'warnings + 1', false);
}
$userdata->save();
unset($userdata);
if ($points) {
$this->update_infraction_groups($this->fetch_field('action'), $points);
}
// Insert thread
if ($this->registry->options['uiforumid'] and $foruminfo = fetch_foruminfo($this->registry->options['uiforumid'])) {
$infractioninfo = array('title' => $this->fetch_field('customreason') ? unhtmlspecialchars($this->fetch_field('customreason')) : fetch_phrase('infractionlevel' . $this->fetch_field('infractionlevelid') . '_title', 'infractionlevel', '', false, true, 0), 'points' => $points, 'note' => unhtmlspecialchars($this->fetch_field('note')), 'message' => $this->info['message'], 'username' => unhtmlspecialchars($userinfo['username']), 'threadtitle' => unhtmlspecialchars($threadinfo['title']));
if ($threadinfo['prefixid']) {
// need prefix in correct language
$infractioninfo['prefix_plain'] = fetch_phrase("prefix_{$threadinfo['prefixid']}_title_plain", 'global', '', false, true, 0, false) . ' ';
} else {
$infractioninfo['prefix_plain'] = '';
}
eval(fetch_email_phrases($postinfo ? 'infraction_thread_post' : 'infraction_thread_profile', 0, $points > 0 ? 'infraction_thread_infraction' : 'infraction_thread_warning'));
$dataman =& datamanager_init('Thread_FirstPost', $this->registry, ERRTYPE_SILENT, 'threadpost');
$dataman->set_info('forum', $foruminfo);
$dataman->set_info('is_automated', true);
$dataman->set_info('mark_thread_read', true);
$dataman->set('allowsmilie', true);
$dataman->setr('userid', $this->fetch_field('whoadded'));
$dataman->set('title', $subject);
$dataman->setr('pagetext', $message);
$dataman->setr('forumid', $foruminfo['forumid']);
$dataman->set('visible', true);
$threadid = $dataman->save();
// Update infraction with threadid
$infdata =& datamanager_init('Infraction', $this->registry, ERRTYPE_SILENT);
$infractioninfo = array('infractionid' => $this->fetch_field('infractionid'));
$infdata->set_existing($infractioninfo);
$infdata->set('threadid', $threadid);
$infdata->save();
unset($infdata);
}
}
} else {
if ($this->setfields['action'] and ($this->fetch_field('action') == 1 or $this->fetch_field('action') == 2)) {
$this->reset_infraction();
$this->update_infraction_groups($this->existing['action'], $this->existing['points']);
if ($this->fetch_field('action') == 2 and $threadid = $this->fetch_field('threadid') and $threadinfo = fetch_threadinfo($threadid) and $foruminfo = $this->registry->forumcache["{$threadinfo['forumid']}"] and $userid = $this->fetch_field('actionuserid')) {
// Reversed
$infractioninfo = array('reason' => unhtmlspecialchars($this->fetch_field('actionreason')));
eval(fetch_email_phrases('infraction_post', 0, $this->existing['points'] > 0 ? 'infraction_post_infraction' : 'infraction_post_warning'));
$dataman =& datamanager_init('Post', $this->registry, ERRTYPE_SILENT, 'threadpost');
$dataman->set_info('thread', $threadinfo);
$dataman->set_info('forum', $foruminfo);
$dataman->set('threadid', $threadinfo['threadid']);
$dataman->set('userid', $userid);
$dataman->set('allowsmilie', true);
$dataman->set('visible', true);
$dataman->set('title', $subject);
$dataman->set('pagetext', $message);
$dataman->save();
unset($dataman);
}
}
}
($hook = vBulletinHook::fetch_hook('infractiondata_postsave')) ? eval($hook) : false;
}
示例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: exec_digest
function exec_digest($type = 2)
{
global $vbulletin;
// for fetch_phrase
require_once DIR . '/includes/functions_misc.php';
// type = 2 : daily
// type = 3 : weekly
$lastdate = mktime(0, 0);
// midnight today
if ($type == 2) {
// daily
// yesterday midnight
$lastdate -= 24 * 60 * 60;
} else {
// weekly
// last week midnight
$lastdate -= 7 * 24 * 60 * 60;
}
require_once DIR . '/includes/class_bbcode_alt.php';
$plaintext_parser =& new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list());
vbmail_start();
// get new threads
$threads = $vbulletin->db->query_read_slave("\n\t\tSELECT\n\t\tuser.userid, user.salt, user.username, user.email, user.languageid, user.usergroupid, user.membergroupids,\n\t\t\tuser.timezoneoffset, IF(user.options & " . $vbulletin->bf_misc_useroptions['dstonoff'] . ", 1, 0) AS dstonoff,\n\t\t\tIF(user.options & " . $vbulletin->bf_misc_useroptions['hasaccessmask'] . ", 1, 0) AS hasaccessmask,\n\t\tthread.threadid, thread.title, thread.prefixid, thread.dateline, thread.forumid, thread.lastpost, pollid,\n\t\topen, replycount, postusername, postuserid, lastposter, thread.dateline, views, subscribethreadid,\n\t\t\tlanguage.dateoverride AS lang_dateoverride, language.timeoverride AS lang_timeoverride, language.locale AS lang_locale\n\t\tFROM " . TABLE_PREFIX . "subscribethread AS subscribethread\n\t\tINNER JOIN " . TABLE_PREFIX . "thread AS thread ON (thread.threadid = subscribethread.threadid)\n\t\tINNER JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = subscribethread.userid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "usergroup AS usergroup ON (usergroup.usergroupid = user.usergroupid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "language AS language ON (language.languageid = IF(user.languageid = 0, " . intval($vbulletin->options['languageid']) . ", user.languageid))\n\t\tWHERE subscribethread.emailupdate = " . intval($type) . " AND\n\t\t\tthread.lastpost > " . intval($lastdate) . " AND\n\t\t\tthread.visible = 1 AND\n\t\t\tuser.usergroupid <> 3 AND\n\t\t\t(usergroup.genericoptions & " . $vbulletin->bf_ugp_genericoptions['isnotbannedgroup'] . ")\n\t");
while ($thread = $vbulletin->db->fetch_array($threads)) {
$postbits = '';
$userperms = fetch_permissions($thread['forumid'], $thread['userid'], $thread);
if (!($userperms & $vbulletin->bf_ugp_forumpermissions['canview']) or !($userperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) or $thread['postuserid'] != $thread['userid'] and !($userperms & $vbulletin->bf_ugp_forumpermissions['canviewothers'])) {
continue;
}
$userinfo = array('lang_locale' => $thread['lang_locale'], 'dstonoff' => $thread['dstonoff'], 'timezoneoffset' => $thread['timezoneoffset']);
$thread['lastreplydate'] = vbdate($thread['lang_dateoverride'] ? $thread['lang_dateoverride'] : $vbulletin->options['default_dateformat'], $thread['lastpost'], false, true, true, false, $userinfo);
$thread['lastreplytime'] = vbdate($thread['lang_timeoverride'] ? $thread['lang_timeoverride'] : $vbulletin->options['default_timeformat'], $thread['lastpost'], false, true, true, false, $userinfo);
$thread['title'] = unhtmlspecialchars($thread['title']);
$thread['username'] = unhtmlspecialchars($thread['username']);
$thread['postusername'] = unhtmlspecialchars($thread['postusername']);
$thread['lastposter'] = unhtmlspecialchars($thread['lastposter']);
$thread['newposts'] = 0;
$thread['auth'] = md5($thread['userid'] . $thread['subscribethreadid'] . $thread['salt'] . COOKIE_SALT);
if ($thread['prefixid']) {
// need prefix in correct language
$thread['prefix_plain'] = fetch_phrase("prefix_{$thread['prefixid']}_title_plain", 'global', '', false, true, $thread['languageid'], false) . ' ';
} else {
$thread['prefix_plain'] = '';
}
// get posts
$posts = $vbulletin->db->query_read_slave("SELECT\n\t\t\tpost.*,IFNULL(user.username,post.username) AS postusername,\n\t\t\tuser.*,attachment.filename\n\t\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = post.userid)\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "attachment AS attachment ON (attachment.postid = post.postid)\n\t\t\tWHERE threadid = " . intval($thread['threadid']) . " AND\n\t\t\t\tpost.visible = 1 AND\n\t\t\t\tuser.usergroupid <> 3 AND\n\t\t\t\tpost.dateline > " . intval($lastdate) . "\n\t\t\tORDER BY post.dateline\n\t\t");
// compile
$haveothers = false;
while ($post = $vbulletin->db->fetch_array($posts)) {
if ($post['userid'] != $thread['userid']) {
$haveothers = true;
}
$thread['newposts']++;
$post['postdate'] = vbdate($thread['lang_dateoverride'] ? $thread['lang_dateoverride'] : $vbulletin->options['default_dateformat'], $post['dateline'], false, true, true, false, $userinfo);
$post['posttime'] = vbdate($thread['lang_timeoverride'] ? $thread['lang_timeoverride'] : $vbulletin->options['default_timeformat'], $post['dateline'], false, true, true, false, $userinfo);
$post['postusername'] = unhtmlspecialchars($post['postusername']);
$plaintext_parser->set_parsing_language($thread['languageid']);
$post['pagetext'] = $plaintext_parser->parse($post['pagetext'], $thread['forumid']);
($hook = vBulletinHook::fetch_hook('digest_thread_post')) ? eval($hook) : false;
eval(fetch_email_phrases('digestpostbit', $thread['languageid']));
$postbits .= $message;
}
($hook = vBulletinHook::fetch_hook('digest_thread_process')) ? eval($hook) : false;
// Don't send an update if the subscriber is the only one who posted in the thread.
if ($haveothers) {
// make email
eval(fetch_email_phrases('digestthread', $thread['languageid']));
vbmail($thread['email'], $subject, $message);
}
}
unset($plaintext_parser);
// get new forums
$forums = $vbulletin->db->query_read_slave("\n\t\tSELECT user.userid, user.salt, user.username, user.email, user.languageid, user.usergroupid, user.membergroupids,\n\t\t\tuser.timezoneoffset, IF(user.options & " . $vbulletin->bf_misc_useroptions['dstonoff'] . ", 1, 0) AS dstonoff,\n\t\t\tIF(user.options & " . $vbulletin->bf_misc_useroptions['hasaccessmask'] . ", 1, 0) AS hasaccessmask,\n\t\t\tforum.forumid, forum.title_clean, subscribeforum.subscribeforumid,\n\t\t\tlanguage.dateoverride AS lang_dateoverride, language.timeoverride AS lang_timeoverride, language.locale AS lang_locale\n\t\tFROM " . TABLE_PREFIX . "subscribeforum AS subscribeforum\n\t\tINNER JOIN " . TABLE_PREFIX . "forum AS forum ON (forum.forumid = subscribeforum.forumid)\n\t\tINNER JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = subscribeforum.userid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "usergroup AS usergroup ON (usergroup.usergroupid = user.usergroupid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "language AS language ON (language.languageid = IF(user.languageid = 0, " . intval($vbulletin->options['languageid']) . ", user.languageid))\n\t\tWHERE subscribeforum.emailupdate = " . intval($type) . " AND\n\t\t\tforum.lastpost > " . intval($lastdate) . " AND\n\t\t\tuser.usergroupid <> 3 AND\n\t\t\t(usergroup.genericoptions & " . $vbulletin->bf_ugp_genericoptions['isnotbannedgroup'] . ")\n\t");
while ($forum = $vbulletin->db->fetch_array($forums)) {
$userinfo = array('lang_locale' => $forum['lang_locale'], 'dstonoff' => $forum['dstonoff'], 'timezoneoffset' => $forum['timezoneoffset']);
$newthreadbits = '';
$newthreads = 0;
$updatedthreadbits = '';
$updatedthreads = 0;
$forum['username'] = unhtmlspecialchars($forum['username']);
$forum['title_clean'] = unhtmlspecialchars($forum['title_clean']);
$forum['auth'] = md5($forum['userid'] . $forum['subscribeforumid'] . $forum['salt'] . COOKIE_SALT);
$threads = $vbulletin->db->query_read_slave("\n\t\t\tSELECT forum.title_clean AS forumtitle, thread.threadid, thread.title, thread.prefixid,\n\t\t\t\tthread.dateline, thread.forumid, thread.lastpost, pollid, open, thread.replycount,\n\t\t\t\tpostusername, postuserid, thread.lastposter, thread.dateline, views\n\t\t\tFROM " . TABLE_PREFIX . "forum AS forum\n\t\t\tINNER JOIN " . TABLE_PREFIX . "thread AS thread USING(forumid)\n\t\t\tWHERE FIND_IN_SET('" . intval($forum['forumid']) . "', forum.parentlist) AND\n\t\t\t\tthread.lastpost > " . intval($lastdate) . " AND\n\t\t\t\tthread.visible = 1\n\t\t\t");
while ($thread = $vbulletin->db->fetch_array($threads)) {
$userperms = fetch_permissions($thread['forumid'], $forum['userid'], $forum);
// allow those without canviewthreads to subscribe/receive forum updates as they contain not post content
if (!($userperms & $vbulletin->bf_ugp_forumpermissions['canview']) or $thread['postuserid'] != $forum['userid'] and !($userperms & $vbulletin->bf_ugp_forumpermissions['canviewothers'])) {
continue;
}
$thread['forumtitle'] = unhtmlspecialchars($thread['forumtitle']);
$thread['lastreplydate'] = vbdate($forum['lang_dateoverride'] ? $forum['lang_dateoverride'] : $vbulletin->options['default_dateformat'], $thread['lastpost'], false, true, true, false, $userinfo);
$thread['lastreplytime'] = vbdate($forum['lang_timeoverride'] ? $forum['lang_timeoverride'] : $vbulletin->options['default_timeformat'], $thread['lastpost'], false, true, true, false, $userinfo);
$thread['title'] = unhtmlspecialchars($thread['title']);
$thread['postusername'] = unhtmlspecialchars($thread['postusername']);
$thread['lastposter'] = unhtmlspecialchars($thread['lastposter']);
if ($thread['prefixid']) {
// need prefix in correct language
$thread['prefix_plain'] = fetch_phrase("prefix_{$thread['prefixid']}_title_plain", 'global', '', false, true, $forum['languageid'], false) . ' ';
} else {
$thread['prefix_plain'] = '';
//.........这里部分代码省略.........
示例13: print_standard_redirect
/**
* Returns eval()-able code to initiate a standard redirect
*
* The global variable $url should contain the URL target for the redirect
*
* @param mixed Name of redirect phrase, or array if constructing a phrase.
* @param boolean If false, use the name of redirect phrase as the phrase text itself
* @param boolean Whether or not to force a redirect message to be shown
* @param integer Language ID to fetch the phrase from (-1 uses the page-wide default)
* @param bool Force bypass of domain whitelist check
*
* @return none (the session is re-directed).
*/
function print_standard_redirect($redir_phrase, $isphrase = true, $forceredirect = false, $languageid = -1, $bypasswhitelist = false)
{
if (!VB_API) {
if ($isphrase) {
if (!function_exists('fetch_phrase')) {
require_once DIR . '/includes/functions_misc.php';
}
if (is_array($redir_phrase)) {
// array element 0 is the phrase name, convert it to the phrase, and then run it through construct.
$redir_phrase[0] = fetch_phrase($redir_phrase[0], 'frontredirect', 'redirect_', false, false, $languageid);
$phrase = construct_phrase($redir_phrase);
// Build final output.
} else {
$phrase = fetch_phrase($redir_phrase, 'frontredirect', 'redirect_', true, false, $languageid, false);
}
} else {
$phrase = addslashes($redir_phrase);
}
} else {
$phrase = $redir_phrase;
}
return standard_redirect($phrase, $forceredirect, $bypasswhitelist);
}
示例14: fixNodeLR
public static function fixNodeLR($sectionid = false, $nodeleft = 0, $sectiontypeid = false, $findmissing = true)
{
//We pull the list of items that are children of the current node.
global $vbulletin;
global $vbphrase;
$result = '';
if (! intval($sectiontypeid))
{
$sectiontypeid = vB_Types::instance()->getContentTypeID("vBCms_Section");
}
//There can be nodes that don't have a valid parent. In that case, we make a
//"lost and found" section and put them into it. If we do this first, then
//we will automatically fix it.
if ($findmissing)
{
if ($rst = $vbulletin->db->query_read("SELECT n1.nodeid FROM " .
TABLE_PREFIX . "cms_node n1 LEFT JOIN " .
TABLE_PREFIX . "cms_node n2 ON n2.nodeid = n1.parentnode AND n2.nodeid <> n1.nodeid
AND n2.contenttypeid = $sectiontypeid
WHERE n2.nodeid IS NULL AND n1.contenttypeid <> $sectiontypeid;"))
{
$orphans = array();
while($record = $record = $vbulletin->db->fetch_array($rst))
{
$orphans[] = $record['nodeid'];
}
}
//Do we have orphans?
if (count($orphans))
{
//We need to make a lost and found folder.
$record = $vbulletin->db->query_first("SELECT node.nodeid FROM " .
TABLE_PREFIX . "cms_node AS node WHERE node.parentnode IS NULL LIMIT 1");
//Now create a node.
$vbulletin->GPC_exists['parentnode'] = $vbulletin->GPC_exists['sectionid'] = 1;
$vbulletin->GPC['parentnode'] = $vbulletin->GPC['sectionid'] = $record['nodeid'];
if ($content = vBCms_Content::create('vBCms', 'Section'))
{
require_once DIR . '/includes/functions_misc.php';
$nodedm = new vBCms_DM_Section();
$nodedm->set('parentnode', $record['nodeid']);
$nodedm->set('contenttypeid', $sectiontypeid);
vB::$vbulletin->GPC_exists['title'] = 1;
vB::$vbulletin->GPC['title'] = fetch_phrase('lost_found', 'cpcms');
// create content handler
$content = vBCms_Content::create('vBCms', 'Section');
$content->setParentNode( $record['nodeid']);
if (! $sectionid = $content->createDefaultContent($nodedm))
{
throw (new vB_Exception_DM('Could not create new node for content: ' . print_r($nodedm->getErrors())));
}
$result = fetch_phrase('check_lost_found', 'cpcms');
}
vB_Cache::instance()->event('sections_updated');
vB_Cache::instance()->cleanNow();
//We have everything we need. Let's update
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "cms_node SET parentnode = $sectionid, permissionsfrom = 1
WHERE nodeid IN(" . implode(',', $orphans) . ")");
}
self::fixNodeLR(false, 0, $sectiontypeid, false);
return $result;
}
else
{
$rst = $vbulletin->db->query_read($sql = "SELECT node.nodeid, contenttypeid FROM " .
TABLE_PREFIX . "cms_node AS node INNER JOIN " .
TABLE_PREFIX . "cms_nodeinfo AS info ON info.nodeid = node.nodeid WHERE
node.parentnode " . (intval($sectionid) ? "= $sectionid" : "IS NULL") . " ORDER BY nodeleft" );
$nodes = array();
while ($record = $vbulletin->db->fetch_array($rst))
{
$nodes[] = $record;
}
$vbulletin->db->free_result($rst);
$childnodeleft = intval($nodeleft) + 1;
if ($sectionid)
{
//Find out if we should assign permissionsfrom for this record, or inherit from a parent.
if ($permission_record = $vbulletin->db->query_first("SELECT * FROM " . TABLE_PREFIX .
"cms_permissions WHERE nodeid = $sectionid LIMIT 1;" ))
{
$permissionsfrom = $sectionid;
}
else
{
$permission_record = $vbulletin->db->query_first("SELECT permissionsfrom FROM " . TABLE_PREFIX .
"cms_node WHERE nodeid = $sectionid LIMIT 1;" );
$permissionsfrom = $permission_record['permissionsfrom'];
}
}
else
//.........这里部分代码省略.........
示例15: 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();
}
if (VB_AREA == 'Upgrade') {
echo $message;
exit;
}
print_cp_message($message, defined('CP_REDIRECT') ? CP_REDIRECT : NULL, 1, defined('CP_BACKURL') ? CP_BACKURL : NULL, defined('CP_CONTINUE') ? true : false);
}