當前位置: 首頁>>代碼示例>>PHP>>正文


PHP vbmail_start函數代碼示例

本文整理匯總了PHP中vbmail_start函數的典型用法代碼示例。如果您正苦於以下問題:PHP vbmail_start函數的具體用法?PHP vbmail_start怎麽用?PHP vbmail_start使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了vbmail_start函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: send_issue_reply_notification

/**
* Sends the reply notification to users subscribed to this issue.
*
* @param	array	Info about this issue
* @param	array	Info about this note (including text)
*/
function send_issue_reply_notification($issue, $issuenote)
{
    global $vbulletin, $db, $vbphrase;
    if ($issuenote['type'] != 'user' and $issuenote['type'] != 'petition') {
        // only send if the note is a "normal" note type
        return;
    }
    $project = fetch_project_info($issue['projectid']);
    $previousnote = $db->query_first("\r\n\t\tSELECT MAX(dateline) AS dateline\r\n\t\tFROM " . TABLE_PREFIX . "pt_issuenote AS issuenote\r\n\t\tWHERE issuenote.issueid = {$issue['issueid']}\r\n\t\t\tAND issuenote.dateline < {$issuenote['dateline']}\r\n\t\t\tAND issuenote.visible = 'visible'\r\n\t\t\tAND issuenote.type IN ('user', 'petition')\r\n\t");
    $notifications = $db->query_read_slave("\r\n\t\tSELECT user.*\r\n\t\tFROM " . TABLE_PREFIX . "pt_issuesubscribe AS issuesubscribe\r\n\t\tINNER JOIN " . TABLE_PREFIX . "user AS user ON (issuesubscribe.userid = user.userid)\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "usergroup AS usergroup ON (usergroup.usergroupid = user.usergroupid)\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON (usertextfield.userid = user.userid)\r\n\t\tWHERE issuesubscribe.issueid = {$issue['issueid']}\r\n\t\t\tAND issuesubscribe.subscribetype = 'instant'\r\n\t\t\tAND (usergroup.genericoptions & " . $vbulletin->bf_ugp_genericoptions['isnotbannedgroup'] . ")\r\n\t\t\t" . ($issuenote['userid'] ? "AND CONCAT(' ', IF(usertextfield.ignorelist IS NULL, '', usertextfield.ignorelist), ' ') NOT LIKE ' " . intval($issuenote['userid']) . " '" : '') . "\r\n\t\t\tAND user.userid <> {$issuenote['userid']}\r\n\t\t\tAND user.lastactivity >= " . intval($previousnote['dateline']) . "\r\n\t");
    if ($db->num_rows($notifications) == 0) {
        return;
    }
    require_once DIR . '/includes/functions_misc.php';
    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
    $evalemail = array();
    $email_texts = $vbulletin->db->query_read_slave("\r\n\t\tSELECT text, languageid, fieldname\r\n\t\tFROM " . TABLE_PREFIX . "phrase\r\n\t\tWHERE fieldname IN ('emailsubject', 'emailbody') AND varname = 'notify_pt'\r\n\t");
    while ($email_text = $vbulletin->db->fetch_array($email_texts)) {
        $emails["{$email_text['languageid']}"]["{$email_text['fieldname']}"] = $email_text['text'];
    }
    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 . '";
		';
    }
    vbmail_start();
    while ($notification = $vbulletin->db->fetch_array($notifications)) {
        // check that this user has the correct permissions to view
        if (verify_issue_perms($issue, $notification) === false or verify_issue_note_perms($issue, $issuenote, $notification) === false) {
            continue;
        }
        $notification['username'] = unhtmlspecialchars($notification['username']);
        $notification['languageid'] = iif($notification['languageid'] == 0, $vbulletin->options['languageid'], $notification['languageid']);
        // parse the page text into plain text, taking selected language into account
        if (!isset($pagetext_cache["{$notification['languageid']}"])) {
            $plaintext_parser->set_parsing_language($notification['languageid']);
            $pagetext_cache["{$notification['languageid']}"] = $plaintext_parser->parse($issuenote['pagetext'], 'pt');
        }
        $pagetext = $pagetext_cache["{$notification['languageid']}"];
        eval(empty($evalemail["{$notification['languageid']}"]) ? $evalemail["-1"] : $evalemail["{$notification['languageid']}"]);
        vbmail($notification['email'], $subject, $message);
    }
    unset($plaintext_parser, $pagetext_cache);
    vbmail_end();
}
開發者ID:holandacz,項目名稱:nb4,代碼行數:60,代碼來源:functions_pt_posting.php

示例2: 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);
//.........這裏部分代碼省略.........
開發者ID:holandacz,項目名稱:nb4,代碼行數:101,代碼來源:functions_newpost.php

示例3: ceil

            }
        }
    }
    if ($update) {
        $updateids[] = $event['subscribeeventid'];
        $sql[] = " WHEN subscribeeventid = {$event['subscribeeventid']} THEN {$dateline_from} ";
        $eventlist["{$event['userid']}"]["{$event['eventid']}"] = ceil($time_until_event / 60 / 60);
        if (empty($eventcache["{$event['eventid']}"])) {
            $eventcache["{$event['eventid']}"] = array('title' => $event['title'], 'calendarid' => $event['calendarid'], 'calendar' => $event['calendar_title'], 'eventid' => $event['eventid']);
        }
    }
}
if (!empty($updateids)) {
    $vbulletin->db->query_write("\n\t\tUPDATE " . TABLE_PREFIX . "subscribeevent\n\t\tSET lastreminder =\n\t\tCASE\n\t\t " . implode(" \r\n", $sql) . "\n\t\tELSE lastreminder\n\t\tEND\n\t\tWHERE subscribeeventid IN (" . implode(', ', $updateids) . ")\n\t");
}
vbmail_start();
$usernames = '';
$reminderbits = '';
foreach ($eventlist as $userid => $event) {
    $usernames .= iif($usernames, ', ');
    $usernames .= $userinfo["{$userid}"]['username'];
    $reminderbits = '';
    foreach ($event as $eventid => $hour) {
        $eventinfo =& $eventcache["{$eventid}"];
        eval(fetch_email_phrases('reminderbit', $userinfo["{$userid}"]['languageid']));
        $reminderbits .= $message;
    }
    $username = unhtmlspecialchars($userinfo["{$userid}"]['username']);
    eval(fetch_email_phrases('reminder', $userinfo["{$userid}"]['languageid']));
    vbmail($userinfo["{$userid}"]['email'], $subject, $message, true);
    if ($vbulletin->debug and VB_AREA == 'AdminCP') {
開發者ID:holandacz,項目名稱:nb4,代碼行數:31,代碼來源:reminder.php

示例4: post_save_each


//.........這裏部分代碼省略.........

			require_once(DIR . '/includes/class_bbcode_alt.php');
			$plaintext_parser = new vB_BbCodeParser_PlainText($this->registry, fetch_tag_list());
			$pagetext_cache = array(); // used to cache the results per languageid for speed

			$pagetext_orig =& $this->fetch_field('pagetext', 'blog_text');

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

			$useremails = $this->dbobject->query_read_slave("
				SELECT
					user.*,
					blog_subscribeuser.blogsubscribeuserid,
					bm.blogmoderatorid,
					ignored.relationid AS ignoreid, buddy.relationid AS buddyid,
					bu.isblogmoderator, IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid
				FROM " . TABLE_PREFIX . "blog_subscribeuser AS blog_subscribeuser
				INNER JOIN " . TABLE_PREFIX . "user AS user ON (blog_subscribeuser.userid = user.userid)
				LEFT JOIN " . TABLE_PREFIX . "blog_moderator AS bm ON (bm.userid = user.userid)
				LEFT JOIN " . TABLE_PREFIX . "userlist AS buddy ON (buddy.userid = $userid AND buddy.relationid = user.userid AND buddy.type = 'buddy')
				LEFT JOIN " . TABLE_PREFIX . "userlist AS ignored ON (ignored.userid = $userid AND ignored.relationid = user.userid AND ignored.type = 'ignore')
				LEFT JOIN " . TABLE_PREFIX . "blog_user AS bu ON (bu.bloguserid = user.userid)
				WHERE
					blog_subscribeuser.bloguserid = $userid
						AND
					" . ($userid == $postedby_userid ? "blog_subscribeuser.userid <> $userid AND" : "") . "
					blog_subscribeuser.type = 'email'
						AND
					user.usergroupid <> 3
						AND
					user.lastactivity >= " . intval($lastposttime['dateline']) . "
			");

			vbmail_start();

			$setoptions = $this->fetch_field('options');

			$evalemail = array();
			while ($touser = $this->dbobject->fetch_array($useremails))
			{
				cache_permissions($touser, false);
				// only send private entries to contacts and moderators
				if ($setoptions["{$this->bitfields['options']['private']}"] AND !$touser['buddyid'] AND !$touser['blogmoderatorid'] AND !is_member_of_blog($touser, $userinfo))
				{
					continue;
				}

				if (!($this->registry->usergroupcache["$touser[usergroupid]"]['genericoptions'] & $this->registry->bf_ugp_genericoptions['isnotbannedgroup']))
				{
					continue;
				}

				if ($this->fetch_field('state') == 'moderation')
				{
					if ($touser['userid'] != $userid AND !can_moderate_blog('canmoderateentries', $touser))
					{
						continue;
					}
				}

				if (!empty($this->info['categories']))
				{
					prepare_blog_category_permissions($touser);
					if (array_intersect($touser['blogcategorypermissions']['cantview'], $this->info['categories']) AND $userinfo['userid'] != $touser['userid'])
					{
						continue;
開發者ID:hungnv0789,項目名稱:vhtm,代碼行數:67,代碼來源:class_dm_blog.php

示例5: exec_send_sg_notification

/**
 * Sends email notifications for discussions.
 *
 * @param int		$discussion		- The discussion being updated
 * @param int		$messageid		- Id of the message that triggered the update
 * @param string	$postusername	- Optional username displayed on post
 */
function exec_send_sg_notification($discussionid, $gmid = false, $postusername = false)
{
    global $vbulletin;
    if (!$vbulletin->options['enableemail']) {
        return;
    }
    $discussion = fetch_socialdiscussioninfo($discussionid);
    // if there are no subscribers, no need to send notifications
    if (!$discussion['subscribers']) {
        return;
    }
    // if the discussion is moderated or deleted, don't send notification
    if ('deleted' == $discussion['state'] or 'moderation' == $discussion['state']) {
        return;
    }
    $group = fetch_socialgroupinfo($discussion['groupid']);
    if (!$gmid) {
        // get last gmid from discussion
        $gmid = $vbulletin->db->query_first("\n\t\t\tSELECT MAX(gmid) AS gmid\n\t\t\tFROM " . TABLE_PREFIX . "groupmessage AS groupmessage\n\t\t\tWHERE discussionid = {$discussion['discussionid']}\n\t\t\t\tAND state = 'visible'\n\t\t");
        $gmid = $gmid['gmid'];
    }
    // get message details
    $gmessage = fetch_groupmessageinfo($gmid);
    if (!$gmessage) {
        return;
    }
    // get post time of previous message - if a user hasn't been active since then we won't resend a notification
    $lastposttime = ($lastposttime = $vbulletin->db->query_first("\n\t\t\tSELECT MAX(dateline) AS dateline\n\t\t\tFROM " . TABLE_PREFIX . "groupmessage AS groupmessage\n\t\t\tWHERE discussionid = {$discussion['discussionid']}\n\t\t\t\tAND dateline < {$gmessage['dateline']}\n\t\t\t\tAND state = 'visible'\n\t")) ? $lastposttime['dateline'] : $gmessage['dateline'];
    $discussion['title'] = unhtmlspecialchars($discussion['title']);
    $group['name'] = unhtmlspecialchars($group['name']);
    // temporarily use postusername in userinfo
    if (!$postusername) {
        // get current user name if user exists
        if ($gmessage['postuserid'] and $userinfo = fetch_userinfo($gmessage['postuserid'])) {
            $postusername = $userinfo['username'];
        } else {
            $postusername = $gmessage['postusername'];
        }
    }
    $postusername = unhtmlspecialchars($postusername);
    $userid = $gmessage['postuserid'];
    ($hook = vBulletinHook::fetch_hook('newpost_sg_notification_start')) ? eval($hook) : false;
    $useremails = $vbulletin->db->query_read_slave("\n\t\tSELECT user.*, subscribediscussion.emailupdate, subscribediscussion.subscribediscussionid, IF(socialgroupmember.userid IS NOT NULL,1,0) ismember\n\t\tFROM " . TABLE_PREFIX . "subscribediscussion AS subscribediscussion\n\t\tINNER JOIN " . TABLE_PREFIX . "user AS user ON (subscribediscussion.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\tLEFT JOIN " . TABLE_PREFIX . "socialgroupmember AS socialgroupmember ON (socialgroupmember.userid = user.userid AND socialgroupmember.groupid = {$group['groupid']})\n\t\tWHERE subscribediscussion.discussionid = {$discussion['discussionid']}\n\t\t AND subscribediscussion.emailupdate = 1\n\t\t AND " . ($gmessage['postuserid'] ? " CONCAT(' ', IF(usertextfield.ignorelist IS NULL, '', usertextfield.ignorelist), ' ') NOT LIKE ' " . intval($userid) . " '" : '') . "\n\t\t AND user.usergroupid <> 3\n\t\t AND user.userid <> " . intval($userid) . "\n\t\t AND user.lastactivity >= " . intval($lastposttime) . "\n\t\t AND (usergroup.genericoptions & " . $vbulletin->bf_ugp_genericoptions['isnotbannedgroup'] . ")\n\t");
    vbmail_start();
    // parser for plaintexting the message pagetext
    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
    $evalemail = array();
    while ($touser = $vbulletin->db->fetch_array($useremails)) {
        // check user can view discussion
        $permissions = cache_permissions($touser, false);
        if (!($vbulletin->usergroupcache["{$touser['usergroupid']}"]['genericoptions'] & $vbulletin->bf_ugp_genericoptions['isnotbannedgroup']) or !($permissions['forumpermissions'] & $vbulletin->bf_ugp_forumpermissions['canview']) or !($permissions['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canviewgroups']) or $group['options'] & $vbulletin->bf_misc_socialgroupoptions['join_to_view'] and !$touser['ismember'] and !($permissions['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canalwayscreatediscussion']) and !($permissions['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canalwayspostmessage'])) {
            continue;
        }
        $touser['username'] = unhtmlspecialchars($touser['username']);
        $touser['languageid'] = iif($touser['languageid'] == 0, $vbulletin->options['languageid'], $touser['languageid']);
        $touser['auth'] = md5($touser['userid'] . $touser['subscribediscussionid'] . $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_discussion'\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($gmessage['pagetext']);
        }
        $pagetext = $pagetext_cache["{$touser['languageid']}"];
        ($hook = vBulletinHook::fetch_hook('new_sg_message_notification_message')) ? eval($hook) : false;
        eval(iif(empty($evalemail["{$touser['languageid']}"]), $evalemail["-1"], $evalemail["{$touser['languageid']}"]));
        vbmail($touser['email'], $subject, $message);
    }
    $vbulletin->db->free_result($useremails);
    unset($plaintext_parser, $pagetext_cache);
    vbmail_end();
}
開發者ID:benyamin20,項目名稱:vbregistration,代碼行數:98,代碼來源:functions_socialgroup.php

示例6: 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;
    }
    if (trim($vbulletin->options['globalignore']) != '') {
        $coventry = preg_split('#\\s+#s', $vbulletin->options['globalignore'], -1, PREG_SPLIT_NO_EMPTY);
    } else {
        $coventry = array();
    }
    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 = '';
        if ($thread['postuserid'] != $thread['userid'] and in_array($thread['postuserid'], $coventry)) {
            continue;
        }
        $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.*\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\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'] and in_array($post['userid'], $coventry)) {
                continue;
            }
            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']);
            $postlink = fetch_seo_url('thread|nosession|bburl', array('threadid' => $thread['threadid'], 'title' => htmlspecialchars_uni($thread['title'])), array('p' => $post['postid'])) . "#post{$post['postid']}";
            ($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
            // magic vars used by the phrase eval
            $threadlink = fetch_seo_url('thread|nosession|bburl', array('threadid' => $thread['threadid'], 'title' => htmlspecialchars_uni($thread['title'])));
            $unsubscribelink = fetch_seo_url('subscription|nosession|bburl|js', array(), array('do' => 'removesubscription', 'type' => 'thread', 'subscriptionid' => $thread['subscribethreadid'], 'auth' => $thread['auth']));
            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, forum.title, 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");
        while ($thread = $vbulletin->db->fetch_array($threads)) {
            if ($thread['postuserid'] != $forum['userid'] and in_array($thread['postuserid'], $coventry)) {
//.........這裏部分代碼省略.........
開發者ID:0hyeah,項目名稱:yurivn,代碼行數:101,代碼來源:functions_digest.php

示例7: 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'] = '';
//.........這裏部分代碼省略.........
開發者ID:holandacz,項目名稱:nb4,代碼行數:101,代碼來源:functions_digest.php

示例8: vbseo_sitemap_stat

function vbseo_sitemap_stat($stat, $email)
{
    global $vbseo_vars, $vboptions;
    $stat['txt'] = $vbseo_vars['txt'];
    $logfname = VBSEO_DAT_FOLDER . time() . '.log';
    $pf = fopen($logfname, 'w');
    fwrite($pf, serialize($stat));
    fclose($pf);
    @chmod($logfname, 0666);
    if (!$email) {
        return;
    }
    $mailbody = "Hello!\n\nThe vBSEO Google/Yahoo Sitemap has been successfully generated for your vBulletin forums at:\n{$vboptions['bbtitle']} ({$vbseo_vars['bburl']})\n\nReport:\n============================\nClick the following link for your vBSEO Google/Yahoo Sitemap Report:\n{$vbseo_vars['bburl']}/vbseo_sitemap/\n\nSummary:\n============================\nForum Display: " . $stat['f'] . "\nShow Thread: " . $stat['t'] . "\nShow Post: " . $stat['p'] . "\nMember Profiles: " . $stat['m'] . "\nPoll Results: " . $stat['poll'] . "\nArchive: " . ($stat['af'] + $stat['at']) . "\n\nTotal Indexed URLs: " . $stat['urls_no_tot'] . "\nTotal Processing Time: " . number_format($stat['end'] - $stat['start'], 2) . " seconds\n\nGoogle ping: " . (isset($stat['ping']) ? $stat['ping'] ? 'Successful' : 'FAILED' : 'Disabled') . ".\nYahoo ping: " . (isset($stat['pingyahoo']) ? $stat['pingyahoo'] ? 'Successful' : 'FAILED' : 'Disabled') . ".\nAsk ping: " . (isset($stat['pingask']) ? $stat['pingask'] ? 'Successful' : 'FAILED' : 'Disabled') . ".\nMoreover ping: " . (isset($stat['pingmore']) ? $stat['pingmore'] ? 'Successful' : 'FAILED' : 'Disabled') . ".\nLive.com ping: " . (isset($stat['pinglive']) ? $stat['pinglive'] ? 'Successful' : 'FAILED' : 'Disabled') . ".\n\n============================\nvBSEO(TM) c 2005-2008 Crawlability, Inc.\nhttp://www.crawlability.com/vbseo\nhttp://www.vbseo.com\n\n\nNote for vBSEO users: This version of the sitemap generator works with vBSEO 2.4.1 up.\nPlease download the most recent vBSEO here: http://www.vbseo.com/downloads/\n";
    if (VBSEO_ON) {
        $mailbody .= "\n\nFind out more out vBSEO - vBulletin Search Engine Optimization\n============================\n\nvBSEO is the definitive SEO enhancement for your vBulletin community forums!\n\nvBSEO makes it easier for search engines to crawl more of your valuable vBulletin content faster and more often giving you higher keyword relevancy.\n\nBy installing vBSEO for your vBulletin forums you should expect to:\n\n    * Get more of your forum pages indexed in the major search engines\n    * Get your pages indexed faster\n    * Improve your keyword relevancy for all pages\n    * Prevent possible duplicate content penalties\n\nThe result of installing vBSEO you should expect is:\n\n    * Higher visitor to member conversion rate (i.e. gain more new members faster)\n    * Get visitors who are more highly targeted to the content you provide\n    * Increase the monthly revenues earned from your forums\n    * Improve your chances of achieving big-board.com status\n\nvBulletin + vBSEO\n============================\nSerious forum admins choose vBSEO for increased search engine traffic!\nhttp://www.vbseo.com/purchase/\n";
    }
    if (function_exists('vbmail_start')) {
        vbmail_start();
        vbmail($email, 'vBSEO Google/Yahoo Sitemap Updated', $mailbody);
        vbmail_end();
    } else {
        mail($email, 'vBSEO Google/Yahoo Sitemap Updated', $mailbody, "From: " . $email);
    }
}
開發者ID:holandacz,項目名稱:nb4,代碼行數:24,代碼來源:vbseo_sitemap_functions.php

示例9: vbseo_send_notification_pingback

function vbseo_send_notification_pingback($threadid, $postid, $vbseo_linkback_uri, $title, $message, $approve = 1, $sendtocp = 1)
{
    global $vbulletin;
    if (!$vbulletin) {
        return;
    }
    if (!$vbulletin->options['enableemail']) {
        return;
    }
    @define('VBSEO_PREPROCESSED', true);
    $threadinfo = fetch_threadinfo($threadid);
    $foruminfo = fetch_foruminfo($threadinfo['forumid']);
    $threadinfo['title'] = unhtmlspecialchars($threadinfo['title']);
    $foruminfo['title_clean'] = unhtmlspecialchars($foruminfo['title_clean']);
    vbmail_start();
    $evalemail = array();
    if ($approve && VBSEO_PINGBACK_NOTIFY) {
        $useremails = $vbulletin->db->query_read("\nSELECT user.*, subscribethread.emailupdate\nFROM " . vbseo_tbl_prefix('subscribethread') . " AS subscribethread\nINNER JOIN " . vbseo_tbl_prefix('user') . " AS user ON (subscribethread.userid = user.userid)\nLEFT JOIN " . vbseo_tbl_prefix('usergroup') . " AS usergroup ON (usergroup.usergroupid = user.usergroupid)\nLEFT JOIN " . vbseo_tbl_prefix('usertextfield') . " AS usertextfield ON (usertextfield.userid = user.userid)\nWHERE subscribethread.threadid = {$threadid} AND\nsubscribethread.emailupdate IN (1, 4) AND\nuser.usergroupid <> 3 AND\n(usergroup.genericoptions & " . ($vbulletin->bf_ugp_genericoptions['isbannedgroup'] + 0) . ") = 0\n");
        while ($touser = $vbulletin->db->fetch_array($useremails)) {
            if ($vbulletin->usergroupcache["{$touser['usergroupid']}"]['genericoptions'] & $vbulletin->bf_ugp_genericoptions['isbannedgroup'] + 0) {
                continue;
            }
            $touser['username'] = unhtmlspecialchars($touser['username']);
            $touser['languageid'] = iif($touser['languageid'] == 0, $vbulletin->options['languageid'], $touser['languageid']);
            if (empty($evalemail)) {
                $evalemail = vbseo_get_email_templates('vbseo_notify_linkbacks');
            }
            eval(iif(empty($evalemail["{$touser['languageid']}"]), $evalemail["-1"], $evalemail["{$touser['languageid']}"]));
            if ($touser['emailupdate'] == 4 and !empty($touser['icq'])) {
                $touser['email'] = $touser['icq'] . '@pager.icq.com';
            }
            vbmail($touser['email'], $subj, $msg);
        }
    }
    $evalemail = vbseo_get_email_templates('vbseo_notify_linkbacks_mod');
    $more_emails = explode(' ', VBSEO_PINGBACK_NOTIFY_BCC);
    if ($sendtocp) {
        foreach ($more_emails as $email) {
            eval($evalemail["-1"]);
            vbmail($email, $subj, $msg);
        }
    }
    vbmail_end();
}
開發者ID:holandacz,項目名稱:nb4,代碼行數:44,代碼來源:functions_vbseo_linkback.php

示例10: exec_pt_digest

/**
* Sends the selected PT digest (daily or weekly)
*
* @param	string	Digest type (daily or weekly)
*/
function exec_pt_digest($type = 'daily')
{
    global $vbulletin;
    if (empty($vbulletin->pt_permissions)) {
        $vbulletin->datastore->do_db_fetch("'pt_bitfields','pt_permissions'");
    }
    $lastdate = mktime(0, 0);
    // midnight today
    if ($type == 'daily') {
        // daily, yesterday midnight
        $lastdate -= 24 * 60 * 60;
    } else {
        // weekly, last week midnight
        $type = 'weekly';
        $lastdate -= 7 * 24 * 60 * 60;
    }
    require_once DIR . '/includes/functions_misc.php';
    require_once DIR . '/includes/class_bbcode_alt.php';
    $plaintext_parser =& new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list());
    vbmail_start();
    // get new issues
    $issues = $vbulletin->db->query_read_slave("\r\n\t\tSELECT user.userid, user.salt, user.username, user.email, user.languageid, user.usergroupid, user.membergroupids,\r\n\t\t\tuser.timezoneoffset, IF(user.options & " . $vbulletin->bf_misc_useroptions['dstonoff'] . ", 1, 0) AS dstonoff,\r\n\t\t\tissue.*, language.dateoverride AS lang_dateoverride, language.timeoverride AS lang_timeoverride\r\n\t\tFROM " . TABLE_PREFIX . "pt_issuesubscribe AS issuesubscribe\r\n\t\tINNER JOIN " . TABLE_PREFIX . "pt_issue AS issue ON (issue.issueid = issuesubscribe.issueid)\r\n\t\tINNER JOIN " . TABLE_PREFIX . "user AS user ON (issuesubscribe.userid = user.userid)\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "usergroup AS usergroup ON (usergroup.usergroupid = user.usergroupid)\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON (usertextfield.userid = user.userid)\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "language AS language ON (language.languageid = IF(user.languageid = 0, " . intval($vbulletin->options['languageid']) . ", user.languageid))\r\n\t\tWHERE issuesubscribe.subscribetype = '{$type}'\r\n\t\t\tAND issue.lastpost > {$lastdate}\r\n\t\t\tAND issue.visible = 'visible'\r\n\t\t\tAND user.usergroupid <> 3\r\n\t\t\tAND (usergroup.genericoptions & " . $vbulletin->bf_ugp_genericoptions['isnotbannedgroup'] . ")\r\n\t");
    while ($issue = $vbulletin->db->fetch_array($issues)) {
        // check that this user has the correct permissions to view
        $issueperms = fetch_project_permissions($issue, $issue['projectid'], $issue['issuetypeid']);
        if (!($issueperms['generalpermissions'] & $vbulletin->pt_bitfields['general']['canview']) or $issue['userid'] != $issue['submituserid'] and !($issueperms['generalpermissions'] & $vbulletin->pt_bitfields['general']['canviewothers'])) {
            // can't view or can't view others' issues
            continue;
        }
        $notebits = '';
        $hourdiff = (date('Z', TIMENOW) / 3600 - ($issue['timezoneoffset'] + ($issue['dstonoff'] ? 1 : 0))) * 3600;
        $lastpost_adjusted = max(0, $issue['lastpost'] - $hourdiff);
        $issue['lastreplydate'] = date($vbulletin->options['dateformat'], $lastpost_adjusted);
        $issue['lastreplytime'] = date($vbulletin->options['timeformat'], $lastpost_adjusted);
        $issue['title'] = unhtmlspecialchars($issue['title']);
        $issue['username'] = unhtmlspecialchars($issue['username']);
        $issue['submitusername'] = unhtmlspecialchars($issue['submitusername']);
        $issue['lastpostusername'] = unhtmlspecialchars($issue['lastpostusername']);
        $issue['newposts'] = 0;
        // get posts
        $notes = $vbulletin->db->query_read_slave("\r\n\t\t\tSELECT issuenote.*\r\n\t\t\tFROM " . TABLE_PREFIX . "pt_issuenote AS issuenote\r\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = issuenote.userid)\r\n\t\t\tWHERE issuenote.issueid = {$issue['issueid']}\r\n\t\t\t\tAND issuenote.visible = 'visible'\r\n\t\t\t\tAND issuenote.dateline > {$lastdate}\r\n\t\t\tORDER BY issuenote.dateline\r\n\t\t");
        // compile
        $haveothers = false;
        while ($note = $vbulletin->db->fetch_array($notes)) {
            if ($note['userid'] != $issue['userid']) {
                $haveothers = true;
            }
            $issue['newposts']++;
            $dateline_adjusted = max(0, $note['dateline'] - $hourdiff);
            $note['postdate'] = date($vbulletin->options['dateformat'], $dateline_adjusted);
            $note['posttime'] = date($vbulletin->options['timeformat'], $dateline_adjusted);
            $note['username'] = unhtmlspecialchars($note['username']);
            $plaintext_parser->set_parsing_language($issue['languageid']);
            $note['message'] = $plaintext_parser->parse($note['pagetext'], 'pt');
            eval(fetch_email_phrases('pt_digestnotebit', $issue['languageid']));
            $notebits .= $message;
        }
        // Don't send an update if the subscriber is the only one who posted in the issue.
        if ($haveothers) {
            // make email
            eval(fetch_email_phrases('pt_digestissue', $issue['languageid']));
            vbmail($issue['email'], $subject, $message);
        }
    }
    unset($plaintext_parser);
    // get new projects
    $projects = $vbulletin->db->query_read_slave("\r\n\t\tSELECT user.userid, user.salt, user.username, user.email, user.languageid, user.usergroupid, user.membergroupids,\r\n\t\t\tuser.timezoneoffset, IF(user.options & " . $vbulletin->bf_misc_useroptions['dstonoff'] . ", 1, 0) AS dstonoff,\r\n\t\t\tIF(user.options & " . $vbulletin->bf_misc_useroptions['hasaccessmask'] . ", 1, 0) AS hasaccessmask,\r\n\t\t\tproject.*, projecttype.issuetypeid,\r\n\t\t\tlanguage.dateoverride AS lang_dateoverride, language.timeoverride AS lang_timeoverride, language.locale AS lang_locale\r\n\t\tFROM " . TABLE_PREFIX . "pt_projecttypesubscribe AS projecttypesubscribe\r\n\t\tINNER JOIN " . TABLE_PREFIX . "pt_projecttype AS projecttype ON (projecttype.projectid = projecttypesubscribe.projectid AND projecttype.issuetypeid = projecttypesubscribe.issuetypeid)\r\n\t\tINNER JOIN " . TABLE_PREFIX . "pt_project AS project ON (project.projectid = projecttypesubscribe.projectid)\r\n\t\tINNER JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = projecttypesubscribe.userid)\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "usergroup AS usergroup ON (usergroup.usergroupid = user.usergroupid)\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "language AS language ON (language.languageid = IF(user.languageid = 0, " . intval($vbulletin->options['languageid']) . ", user.languageid))\r\n\t\tWHERE projecttypesubscribe.subscribetype = '{$type}'\r\n\t\t\tAND projecttype.lastpost > {$lastdate}\r\n\t\t\tAND user.usergroupid <> 3\r\n\t\t\tAND (usergroup.genericoptions & " . $vbulletin->bf_ugp_genericoptions['isnotbannedgroup'] . ")\r\n\t");
    while ($project = $vbulletin->db->fetch_array($projects)) {
        $userinfo = array('lang_locale' => $project['lang_locale'], 'dstonoff' => $project['dstonoff'], 'timezoneoffset' => $project['timezoneoffset']);
        $newissuebits = '';
        $newissues = 0;
        $updatedissuebits = '';
        $updatedissues = 0;
        $project['username_clean'] = unhtmlspecialchars($project['username']);
        $project['title_clean'] = unhtmlspecialchars($project['title_clean']);
        $project['issuetype_plural'] = fetch_phrase("issuetype_{$project['issuetypeid']}_plural", 'projecttools', '', false, true, $project['languageid'], false);
        $issues = $vbulletin->db->query_read_slave("\r\n\t\t\tSELECT issue.*\r\n\t\t\tFROM " . TABLE_PREFIX . "pt_issue AS issue\r\n\t\t\tWHERE issue.projectid = {$project['projectid']}\r\n\t\t\t\tAND issue.issuetypeid = '{$project['issuetypeid']}'\r\n\t\t\t\tAND issue.visible = 'visible'\r\n\t\t\t\tAND issue.lastpost > {$lastdate}\r\n\t\t");
        while ($issue = $vbulletin->db->fetch_array($issues)) {
            $issueperms = fetch_project_permissions($project, $issue['projectid'], $issue['issuetypeid']);
            if (!($issueperms['generalpermissions'] & $vbulletin->pt_bitfields['general']['canview']) or $issue['userid'] != $issue['submituserid'] and !($issueperms['generalpermissions'] & $vbulletin->pt_bitfields['general']['canviewothers'])) {
                // can't view or can't view others' issues
                continue;
            }
            $issue['lastreplydate'] = vbdate($project['lang_dateoverride'] ? $project['lang_dateoverride'] : $vbulletin->options['default_dateformat'], $issue['lastpost'], false, true, true, false, $userinfo);
            $issue['lastreplytime'] = vbdate($project['lang_timeoverride'] ? $project['lang_timeoverride'] : $vbulletin->options['default_timeformat'], $issue['lastpost'], false, true, true, false, $userinfo);
            $issue['title_clean'] = unhtmlspecialchars($issue['title']);
            $issue['submitusername_clean'] = unhtmlspecialchars($issue['submitusername']);
            $issue['lastposter_clean'] = unhtmlspecialchars($issue['lastposter']);
            eval(fetch_email_phrases('pt_digestissuebit', $project['languageid']));
            if ($issue['submitdate'] > $lastdate) {
                // new issue
                $newissues++;
                $newissuebits .= $message;
            } else {
                $updatedissues++;
//.........這裏部分代碼省略.........
開發者ID:holandacz,項目名稱:nb4,代碼行數:101,代碼來源:functions_pt_digest.php


注:本文中的vbmail_start函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。