当前位置: 首页>>代码示例>>PHP>>正文


PHP sendEmailNotification函数代码示例

本文整理汇总了PHP中sendEmailNotification函数的典型用法代码示例。如果您正苦于以下问题:PHP sendEmailNotification函数的具体用法?PHP sendEmailNotification怎么用?PHP sendEmailNotification使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了sendEmailNotification函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getHardDelayNodes

function getHardDelayNodes($dbSocket)
{
    global $configValues;
    $sql = "SELECT " . "mac,  memfree,  cpu,  wan_ip,  wan_gateway,  lan_mac,  firmware,  firmware_revision " . " FROM " . $configValues['CONFIG_DB_TBL_DALONODE'] . " WHERE ( UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(time) ) > " . $configValues['HARD_DELAY_SEC'];
    $res = $dbSocket->query($sql);
    $nodes = array();
    while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) {
        $message = getHTMLMessage($row);
        $subject = "daloRADIUS Node Monitor: Offline Node";
        sendEmailNotification($subject, $message);
    }
}
开发者ID:fevenor,项目名称:Dockerfile,代码行数:12,代码来源:monitorNodes.php

示例2: register_new_user_local

 function register_new_user_local($registration, $from_intertiki)
 {
     global $_SESSION, $tikilib, $logslib, $userlib, $notificationlib, $prefs, $smarty;
     $result = '';
     if (isset($_SESSION['openid_url'])) {
         $openid_url = $_SESSION['openid_url'];
     } else {
         $openid_url = '';
     }
     $newPass = $registration['pass'] ? $registration['pass'] : $registration["genepass"];
     if ($this->merged_prefs['validateUsers'] == 'y' || isset($this->merged_prefs['validateRegistration']) && $this->merged_prefs['validateRegistration'] == 'y') {
         $apass = md5($tikilib->genPass());
         $userlib->send_validation_email($registration['name'], $apass, $registration['email'], '', '', isset($registration['chosenGroup']) ? $registration['chosenGroup'] : '');
         $userlib->add_user($registration['name'], $newPass, $registration["email"], '', false, $apass, $openid_url, $this->merged_prefs['validateRegistration'] == 'y' ? 'a' : 'u');
         $logslib->add_log('register', 'created account ' . $registration['name']);
         $result = tra('You will receive an email with the information needed to log into this site the first time.');
     } else {
         $userlib->add_user($registration['name'], $newPass, $registration['email'], '', false, NULL, $openid_url);
         $logslib->add_log('register', 'created account ' . $registration['name']);
         $result = $smarty->fetch('mail/user_welcome_msg.tpl');
     }
     if (isset($registration['chosenGroup']) && $userlib->get_registrationChoice($registration['chosenGroup']) == 'y') {
         $userlib->set_default_group($registration['name'], $registration['chosenGroup']);
     } elseif (empty($registration['chosenGroup'])) {
         // to have tiki-user_preferences links par default to the registration tracker
         $userlib->set_default_group($registration['name'], 'Registered');
     }
     $userlib->set_email_group($registration['name'], $registration['email']);
     // save default user preferences
     // Custom fields
     $customfields = $this->get_customfields();
     foreach ($customfields as $custpref => $prefvalue) {
         if (isset($registration[$customfields[$custpref]['prefName']])) {
             $tikilib->set_user_preference($registration['name'], $customfields[$custpref]['prefName'], $registration[$customfields[$custpref]['prefName']]);
         }
     }
     $watches = $tikilib->get_event_watches('user_registers', '*');
     if (count($watches)) {
         require_once "lib/notifications/notificationemaillib.php";
         $smarty->assign('mail_user', $registration['name']);
         $smarty->assign('mail_site', $_SERVER["SERVER_NAME"]);
         sendEmailNotification($watches, null, 'new_user_notification_subject.tpl', null, 'new_user_notification.tpl');
     }
     return $result;
 }
开发者ID:railfuture,项目名称:tiki-website,代码行数:45,代码来源:registrationlib.php

示例3: handleBadUsers

/**
 * handleBadUsers()
 *
 */
function handleBadUsers($dbSocket)
{
    global $configValues;
    // get all online users
    $sql = " SELECT " . " RadAcctId, AcctSessionId, UserName, NASIPAddress, NASPortId, AcctStartTime, AcctSessionTime, AcctInputOctets, AcctOutputOctets, " . " CalledStationId, CallingStationId, FramedIPAddress " . " FROM " . $configValues['CONFIG_DB_TBL_RADACCT'] . " WHERE " . " (AcctStopTime = '0000-00-00 00:00:00' OR AcctStopTime IS NULL) ";
    $res = $dbSocket->query($sql);
    $users = array();
    while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) {
        $download = (double) $row['AcctOutputOctets'];
        $upload = (double) $row['AcctInputOctets'];
        $traffic = (double) $download + $upload;
        $message = getHTMLMessage($row);
        if ($traffic >= $configValues['SOFTLIMIT']) {
            $subject = "daloRADIUS Traffic Notification: Soft Limit";
            sendEmailNotification($subject, $message);
        } else {
            if ($traffic >= $configValues['HARDLIMIT']) {
                $subject = "daloRADIUS Traffic Notification: Hard Limit";
                sendEmailNotification($subject, $message);
            } else {
                continue;
            }
        }
    }
}
开发者ID:fortitudezhang,项目名称:daloradius,代码行数:29,代码来源:monitorUserTraffic.php

示例4: exec

$temp = exec('/opt/vc/bin/vcgencmd measure_temp');
preg_match("/^temp=([\\d.]+)/", $temp, $matches);
// Temperature is stored in at index 1.
$temp = $matches[1];
$date = new DateTime();
$filePath = realpath(dirname(__FILE__));
$ret = exec($filePath . '/update_plotly.py \'' . $date->format('Y-m-d H:i:s') . '\' ' . $temp);
$line = $date->format(DateTime::ISO8601) . ";" . $temp . "\n";
// Write the temp to a file
$filePath = realpath(dirname(__FILE__));
file_put_contents(dirname(__FILE__) . '/temperature.log', $line, FILE_APPEND);
// Check if we should send a notification
$config = getConfig();
$notificationConfig = $config['notification'];
$maxTemp = $notificationConfig['max_temp'];
if ((int) $temp >= $maxTemp) {
    // Temp is too high! Send notification!
    if ($notificationConfig['enable_email']) {
        $addresses = $notificationConfig['email_addresses'];
        sendEmailNotification($temp, $addresses);
    }
    if ($notificationConfig['enable_pushover']) {
        $userkey = $notificationConfig['pushover_userkey'];
        sendPushoverNotification($temp, $userkey);
    }
    if ($notificationConfig['enable_pushbullet']) {
        $deviceid = $notificationConfig['pushbullet_deviceid'];
        $apikey = $notificationConfig['pushbullet_apikey'];
        sendPushbulletNotification($temp, $deviceid, $apikey);
    }
}
开发者ID:Guycorlett,项目名称:User-Projects,代码行数:31,代码来源:monitor.php

示例5: blog_post

 /**
  * blog_post Stores a blog post
  *
  * @param int $blogId
  * @param string $data
  * @param string $excerpt
  * @param string $user
  * @param string $title
  * @param string $contributions
  * @param string $priv
  * @param bool $is_wysiwyg
  * @access public
  * @return int postId
  */
 function blog_post($blogId, $data, $excerpt, $user, $title = '', $contributions = '', $priv = 'n', $created = 0, $is_wysiwyg = FALSE)
 {
     // update tiki_blogs and call activity functions
     global $prefs;
     $tikilib = TikiLib::lib('tiki');
     $smarty = TikiLib::lib('smarty');
     $wysiwyg = $is_wysiwyg == TRUE ? 'y' : 'n';
     if (!$created) {
         $created = $tikilib->now;
     }
     $data = TikiFilter::get('purifier')->filter($data);
     $excerpt = TikiFilter::get('purifier')->filter($excerpt);
     $query = "insert into `tiki_blog_posts`(`blogId`,`data`,`excerpt`,`created`,`user`,`title`,`priv`,`wysiwyg`) values(?,?,?,?,?,?,?,?)";
     $result = $this->query($query, array((int) $blogId, $data, $excerpt, (int) $created, $user, $title, $priv, $wysiwyg));
     $query = "select max(`postId`) from `tiki_blog_posts` where `created`=? and `user`=?";
     $id = $this->getOne($query, array((int) $created, $user));
     $query = "update `tiki_blogs` set `lastModif`=?,`posts`=`posts`+1 where `blogId`=?";
     $result = $this->query($query, array((int) $created, (int) $blogId));
     $this->add_blog_activity($blogId);
     if ($prefs['feature_user_watches'] == 'y' or $prefs['feature_group_watches'] == 'y') {
         $nots = $tikilib->get_event_watches('blog_post', $blogId);
         if (!isset($_SERVER["SERVER_NAME"])) {
             $_SERVER["SERVER_NAME"] = $_SERVER["HTTP_HOST"];
         }
         if ($prefs['user_blog_watch_editor'] != "y") {
             for ($i = count($nots) - 1; $i >= 0; --$i) {
                 if ($nots[$i]['user'] == $user) {
                     unset($nots[$i]);
                     break;
                 }
             }
         }
         if ($prefs['feature_daily_report_watches'] == 'y') {
             $query = "select `title` from `tiki_blogs` where `blogId`=?";
             $blogTitle = $this->getOne($query, array((int) $blogId));
             $reportsManager = Reports_Factory::build('Reports_Manager');
             $reportsManager->addToCache($nots, array("event" => 'blog_post', "blogId" => $blogId, "blogTitle" => $blogTitle, "postId" => $id, "user" => $user));
         }
         if (count($nots)) {
             include_once "lib/notifications/notificationemaillib.php";
             $smarty->assign('mail_site', $_SERVER["SERVER_NAME"]);
             $smarty->assign('mail_title', $this->get_title($blogId));
             $smarty->assign('mail_post_title', $title);
             $smarty->assign('mail_blogid', $blogId);
             $smarty->assign('mail_postid', $id);
             $smarty->assign('mail_user', $user);
             $smarty->assign('mail_data', $data);
             if ($prefs['feature_contribution'] == 'y' && !empty($contributions)) {
                 $contributionlib = TikiLib::lib('contribution');
                 $smarty->assign('mail_contributions', $contributionlib->print_contributions($contributions));
             }
             sendEmailNotification($nots, "watch", "user_watch_blog_post_subject.tpl", $_SERVER["SERVER_NAME"], "user_watch_blog_post.tpl");
         }
     }
     TikiLib::events()->trigger('tiki.blogpost.create', array('type' => 'blog post', 'object' => $id, 'blog' => $blogId, 'user' => $user));
     if ($prefs['feature_actionlog'] == 'y') {
         $logslib = TikiLib::lib('logs');
         $logslib->add_action('Posted', $blogId, 'blog', "blogId={$blogId}&postId={$id}&add=" . strlen($data) . "#postId{$id}", '', '', '', '', $contributions);
     }
     require_once 'lib/search/refresh-functions.php';
     refresh_index('blog_posts', $id);
     $tikilib->object_post_save(array('type' => 'blog post', 'object' => $id, 'description' => substr($data, 0, 200), 'name' => $title, 'href' => "tiki-view_blog_post.php?postId={$id}"), array('content' => $data));
     return $id;
 }
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:78,代码来源:bloglib.php

示例6: callback_tikimail_user_registers

 /**
  *  A callback that performs email notifications when a new user registers
  *  @access private
  *  @returns true on success, false to halt event proporgation
  */
 function callback_tikimail_user_registers($raisedBy, $data)
 {
     global $notificationlib, $smarty;
     include_once "lib/notifications/notificationlib.php";
     $emails = $notificationlib->get_mail_events('user_registers', '*');
     if (count($emails)) {
         $smarty->assign('mail_user', $data['user']);
         $smarty->assign('mail_date', $this->now);
         $smarty->assign('mail_site', $data['mail_site']);
         sendEmailNotification($emails, "email", "new_user_notification_subject.tpl", null, "new_user_notification.tpl");
     }
     return true;
 }
开发者ID:Kraiany,项目名称:kraiany_site_docker,代码行数:18,代码来源:registrationlib.php

示例7: replace_article

 function replace_article($title, $authorName, $topicId, $useImage, $imgname, $imgsize, $imgtype, $imgdata, $heading, $body, $publishDate, $expireDate, $user, $articleId, $image_x, $image_y, $type, $topline, $subtitle, $linkto, $image_caption, $lang, $rating = 0, $isfloat = 'n', $emails = '', $from = '', $list_image_x = '', $list_image_y = '', $ispublished = 'y')
 {
     global $smarty, $tikilib;
     if ($expireDate < $publishDate) {
         $expireDate = $publishDate;
     }
     $hash = md5($title . $heading . $body);
     if (empty($imgdata) || $useImage === 'n') {
         // remove image data if not using it
         $imgdata = '';
     }
     $query = 'select `name` from `tiki_topics` where `topicId` = ?';
     $topicName = $this->getOne($query, array($topicId));
     $size = $body ? mb_strlen($body) : mb_strlen($heading);
     if ($articleId) {
         $oldArticle = $this->get_article($articleId);
         $query = 'update `tiki_articles` set `title` = ?, `authorName` = ?, `topicId` = ?, `topicName` = ?, `size` = ?, `useImage` = ?, `image_name` = ?, ';
         $query .= ' `image_type` = ?, `image_size` = ?, `image_data` = ?, `isfloat` = ?, `image_x` = ?, `image_y` = ?, `list_image_x` = ?, `list_image_y` = ?, `heading` = ?, `body` = ?, ';
         $query .= ' `publishDate` = ?, `expireDate` = ?, `created` = ?, `author` = ?, `type` = ?, `rating` = ?, `topline`=?, `subtitle`=?, `linkto`=?, ';
         $query .= ' `image_caption`=?, `lang`=?, `ispublished`=? where `articleId` = ?';
         $result = $this->query($query, array($title, $authorName, (int) $topicId, $topicName, (int) $size, $useImage, $imgname, $imgtype, (int) $imgsize, $imgdata, $isfloat, (int) $image_x, (int) $image_y, (int) $list_image_x, (int) $list_image_y, $heading, $body, (int) $publishDate, (int) $expireDate, (int) $this->now, $user, $type, (double) $rating, $topline, $subtitle, $linkto, $image_caption, $lang, $ispublished, (int) $articleId));
         // Clear article image cache because image may just have been changed
         $this->delete_image_cache('article', $articleId);
         $event = 'article_edited';
         $nots = $tikilib->get_event_watches('article_edited', '*');
         $nots2 = $tikilib->get_event_watches('topic_article_edited', $topicId);
         $smarty->assign('mail_action', 'Edit');
         $smarty->assign('mail_old_title', $oldArticle['title']);
         $smarty->assign('mail_old_publish_date', $oldArticle['publishDate']);
         $smarty->assign('mail_old_expiration_date', $oldArticle['expireDate']);
         $smarty->assign('mail_old_data', $oldArticle['heading'] . "\n----------------------\n" . $oldArticle['body']);
     } else {
         // Insert the article
         $query = 'insert into `tiki_articles` (`title`, `authorName`, `topicId`, `useImage`, `image_name`, `image_size`, `image_type`, `image_data`, ';
         $query .= ' `publishDate`, `expireDate`, `created`, `heading`, `body`, `hash`, `author`, `nbreads`, `votes`, `points`, `size`, `topicName`, ';
         $query .= ' `image_x`, `image_y`, `list_image_x`, `list_image_y`, `type`, `rating`, `isfloat`,`topline`, `subtitle`, `linkto`,`image_caption`, `lang`, `ispublished`) ';
         $query .= ' values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
         $result = $this->query($query, array($title, $authorName, (int) $topicId, $useImage, $imgname, (int) $imgsize, $imgtype, $imgdata, (int) $publishDate, (int) $expireDate, (int) $this->now, $heading, $body, $hash, $user, 0, 0, 0, (int) $size, $topicName, (int) $image_x, (int) $image_y, (int) $list_image_x, (int) $list_image_y, $type, (double) $rating, $isfloat, $topline, $subtitle, $linkto, $image_caption, $lang, $ispublished));
         $query2 = 'select max(`articleId`) from `tiki_articles` where `created` = ? and `title`=? and `hash`=?';
         $articleId = $this->getOne($query2, array((int) $this->now, $title, $hash));
         global $prefs;
         if ($prefs['feature_score'] == 'y') {
             $this->score_event($user, 'article_new');
         }
         $event = 'article_submitted';
         $nots = $tikilib->get_event_watches('article_submitted', '*');
         $nots2 = $tikilib->get_event_watches('topic_article_created', $topicId);
         $smarty->assign('mail_action', 'New');
     }
     $nots3 = array();
     foreach ($nots as $n) {
         $nots3[] = $n['email'];
     }
     foreach ($nots2 as $n) {
         if (!in_array($n['email'], $nots3)) {
             $nots[] = $n;
         }
     }
     if (is_array($emails) && (empty($from) || $from == $prefs['sender_email'])) {
         foreach ($emails as $n) {
             if (!in_array($n, $nots3)) {
                 $nots[] = array('email' => $n, 'language' => $prefs['site_language']);
             }
         }
     }
     global $prefs;
     if ($prefs['user_article_watch_editor'] != "y") {
         for ($i = count($nots) - 1; $i >= 0; --$i) {
             if ($nots[$i]['user'] == $user) {
                 unset($nots[$i]);
                 break;
             }
         }
     }
     if (!isset($_SERVER['SERVER_NAME'])) {
         $_SERVER['SERVER_NAME'] = $_SERVER['HTTP_HOST'];
     }
     if ($prefs['feature_user_watches'] == 'y' && $prefs['feature_daily_report_watches'] == 'y') {
         $reportsManager = Reports_Factory::build('Reports_Manager');
         $reportsManager->addToCache($nots, array('event' => $event, 'articleId' => $articleId, 'articleTitle' => $title, 'authorName' => $authorName, 'user' => $user));
     }
     if (count($nots) || is_array($emails)) {
         include_once 'lib/notifications/notificationemaillib.php';
         $smarty->assign('mail_site', $_SERVER['SERVER_NAME']);
         $smarty->assign('mail_title', $title);
         $smarty->assign('mail_postid', $articleId);
         $smarty->assign('mail_user', $user);
         $smarty->assign('mail_current_publish_date', $publishDate);
         $smarty->assign('mail_current_expiration_date', $expireDate);
         $smarty->assign('mail_current_data', $heading . "\n----------------------\n" . $body);
         $smarty->assign('mail_heading', $heading);
         $smarty->assign('mail_body', $body);
         sendEmailNotification($nots, 'watch', 'user_watch_article_post_subject.tpl', $_SERVER['SERVER_NAME'], 'user_watch_article_post.tpl');
         if (is_array($emails) && !empty($from) && $from != $prefs['sender_email']) {
             $nots = array();
             foreach ($emails as $n) {
                 $nots[] = array('email' => $n, 'language' => $prefs['site_language']);
             }
             sendEmailNotification($nots, 'watch', 'user_watch_article_post_subject.tpl', $_SERVER['SERVER_NAME'], 'user_watch_article_post.tpl', $from);
         }
//.........这里部分代码省略.........
开发者ID:jkimdon,项目名称:cohomeals,代码行数:101,代码来源:artlib.php

示例8: register_new_user_local

 /**
  * @param $registration
  * @param $from_intertiki
  * @return string
  */
 private function register_new_user_local($registration, $from_intertiki)
 {
     global $_SESSION, $tikilib, $logslib, $userlib, $notificationlib, $prefs, $smarty;
     $result = '';
     if (isset($_SESSION['openid_url'])) {
         $openid_url = $_SESSION['openid_url'];
     } else {
         $openid_url = '';
     }
     $newPass = $registration['pass'] ? $registration['pass'] : $registration["genepass"];
     $pending = false;
     $confirmed = false;
     if ($prefs['userTracker'] === 'y') {
         // this gets called twice if there's a user tracker
         if (!$userlib->get_user_real_case($registration['name'])) {
             $pending = true;
             // first time to just create the basic user record for the tracker to attach to
         } else {
             $confirmed = true;
             // second time to send notifications, join groups etc
         }
     }
     if ($this->merged_prefs['validateUsers'] == 'y' || isset($this->merged_prefs['validateRegistration']) && $this->merged_prefs['validateRegistration'] == 'y') {
         if ($confirmed) {
             $info = $userlib->get_user_info($registration['name']);
             $apass = $info['valid'];
         } else {
             $apass = md5($tikilib->genPass());
         }
         if (!$pending) {
             // don't send validation until user tracker has been validated
             $userlib->send_validation_email($registration['name'], $apass, $registration['email'], '', '', isset($registration['chosenGroup']) ? $registration['chosenGroup'] : 'Registered');
         }
         if (!$confirmed) {
             $userlib->add_user($registration['name'], $newPass, $registration["email"], '', false, $apass, $openid_url, $this->merged_prefs['validateRegistration'] == 'y' ? 'a' : 'u');
         }
         if (!$pending) {
             $logslib->add_log('register', 'created account ' . $registration['name']);
             if ($this->merged_prefs['validateRegistration'] == 'y') {
                 $result = nl2br($smarty->fetch('mail/user_validation_waiting_msg.tpl'));
             } else {
                 $result = $smarty->fetch('mail/user_validation_msg.tpl');
             }
         }
     } else {
         if (!$confirmed) {
             $userlib->add_user($registration['name'], $newPass, $registration['email'], '', false, null, $openid_url);
         }
         if (!$pending) {
             $logslib->add_log('register', 'created account ' . $registration['name']);
             $result = $smarty->fetch('mail/user_welcome_msg.tpl');
         }
     }
     if ($pending) {
         return '';
     }
     if (isset($registration['chosenGroup']) && $userlib->get_registrationChoice($registration['chosenGroup']) == 'y') {
         $userlib->set_default_group($registration['name'], $registration['chosenGroup']);
     } elseif (empty($registration['chosenGroup'])) {
         // to have tiki-user_preferences links par default to the registration tracker
         $userlib->set_default_group($registration['name'], 'Registered');
     }
     $userlib->set_email_group($registration['name'], $registration['email']);
     // save default user preferences
     // Custom fields
     $customfields = $this->get_customfields();
     foreach ($customfields as $custpref => $prefvalue) {
         if (isset($registration[$customfields[$custpref]['prefName']])) {
             $tikilib->set_user_preference($registration['name'], $customfields[$custpref]['prefName'], $registration[$customfields[$custpref]['prefName']]);
         }
     }
     $watches = $tikilib->get_event_watches('user_registers', '*');
     if (count($watches)) {
         require_once "lib/notifications/notificationemaillib.php";
         $smarty->assign('mail_user', $registration['name']);
         $smarty->assign('mail_site', $_SERVER["SERVER_NAME"]);
         sendEmailNotification($watches, null, 'new_user_notification_subject.tpl', null, 'new_user_notification.tpl');
     }
     return $result;
 }
开发者ID:jkimdon,项目名称:cohomeals,代码行数:85,代码来源:registrationlib.php

示例9: replace_article

 function replace_article($title, $authorName, $topicId, $useImage, $imgname, $imgsize, $imgtype, $imgdata, $heading, $body, $publishDate, $expireDate, $user, $articleId, $image_x, $image_y, $type, $topline, $subtitle, $linkto, $image_caption, $lang, $rating = 0, $isfloat = 'n')
 {
     if ($expireDate < $publishDate) {
         $expireDate = $publishDate;
     }
     $hash = md5($title . $heading . $body);
     $now = date("U");
     if (empty($imgdata)) {
         $imgdata = '';
     }
     // Fixed query. -rlpowell
     $query = "select `name`  from `tiki_topics` where `topicId` = ?";
     $topicName = $this->getOne($query, array($topicId));
     $size = strlen($body);
     // Fixed query. -rlpowell
     if ($articleId) {
         // Update the article
         $query = "update `tiki_articles` set `title` = ?, `authorName` = ?, `topicId` = ?, `topicName` = ?, `size` = ?, `useImage` = ?, `image_name` = ?, ";
         $query .= " `image_type` = ?, `image_size` = ?, `image_data` = ?, `isfloat` = ?, `image_x` = ?, `image_y` = ?, `heading` = ?, `body` = ?, ";
         $query .= " `publishDate` = ?, `expireDate` = ?, `created` = ?, `author` = ?, `type` = ?, `rating` = ?, `topline`=?, `subtitle`=?, `linkto`=?, ";
         $query .= " `image_caption`=?, `lang`=?  where `articleId` = ?";
         $result = $this->query($query, array($title, $authorName, (int) $topicId, $topicName, (int) $size, $useImage, $imgname, $imgtype, (int) $imgsize, $imgdata, $isfloat, (int) $image_x, (int) $image_y, $heading, $body, (int) $publishDate, (int) $expireDate, (int) $now, $user, $type, (double) $rating, $topline, $subtitle, $linkto, $image_caption, $lang, (int) $articleId));
     } else {
         // Fixed query. -rlpowell
         // Insert the article
         $query = "insert into `tiki_articles` (`title`, `authorName`, `topicId`, `useImage`, `image_name`, `image_size`, `image_type`, `image_data`, ";
         $query .= " `publishDate`, `expireDate`, `created`, `heading`, `body`, `hash`, `author`, `nbreads`, `votes`, `points`, `size`, `topicName`, ";
         $query .= " `image_x`, `image_y`, `type`, `rating`, `isfloat`,`topline`, `subtitle`, `linkto`,`image_caption`, `lang`) ";
         $query .= " values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
         $result = $this->query($query, array($title, $authorName, (int) $topicId, $useImage, $imgname, (int) $imgsize, $imgtype, $imgdata, (int) $publishDate, (int) $expireDate, (int) $now, $heading, $body, $hash, $user, 0, 0, 0, (int) $size, $topicName, (int) $image_x, (int) $image_y, $type, (double) $rating, $isfloat, $topline, $subtitle, $linkto, $image_caption, $lang));
         // Fixed query. -rlpowell
         $query2 = "select max(`articleId`) from `tiki_articles` where `created` = ? and `title`=? and `hash`=?";
         $articleId = $this->getOne($query2, array((int) $now, $title, $hash));
         global $feature_score;
         if ($feature_score == 'y') {
             $this->score_event($user, 'article_new');
         }
         global $feature_user_watches, $smarty, $tikilib;
         if ($feature_user_watches == 'y') {
             #workaround to "pass" $topicId to get_event_watches
             $GLOBALS["topicId"] = $topicId;
             $nots = $this->get_event_watches('article_submitted', '*');
             if (!isset($_SERVER["SERVER_NAME"])) {
                 $_SERVER["SERVER_NAME"] = $_SERVER["HTTP_HOST"];
             }
             if (count($nots)) {
                 include_once "lib/notifications/notificationemaillib.php";
                 $smarty->assign('mail_site', $_SERVER["SERVER_NAME"]);
                 $smarty->assign('mail_title', $title);
                 $smarty->assign('mail_postid', $articleId);
                 $smarty->assign('mail_date', date("U"));
                 $smarty->assign('mail_user', $user);
                 $smarty->assign('mail_data', $heading . "\n----------------------\n" . $body);
                 $foo = parse_url($_SERVER["REQUEST_URI"]);
                 $machine = $tikilib->httpPrefix() . $foo["path"];
                 $smarty->assign('mail_machine', $machine);
                 $parts = explode('/', $foo['path']);
                 if (count($parts) > 1) {
                     unset($parts[count($parts) - 1]);
                 }
                 $smarty->assign('mail_machine_raw', $tikilib->httpPrefix() . implode('/', $parts));
                 sendEmailNotification($nots, "watch", "user_watch_article_post_subject.tpl", $_SERVER["SERVER_NAME"], "user_watch_article_post.tpl");
             }
         }
     }
     return $articleId;
 }
开发者ID:noikiy,项目名称:owaspbwa,代码行数:67,代码来源:artlib.php

示例10: blog_post

 function blog_post($blogId, $data, $user, $title = '', $contributions = '', $priv = 'n')
 {
     // update tiki_blogs and call activity functions
     global $smarty, $tikilib, $prefs;
     $data = strip_tags($data, '<a><b><i><h1><h2><h3><h4><h5><h6><ul><li><ol><br><p><table><tr><td><img><pre>');
     $query = "insert into `tiki_blog_posts`(`blogId`,`data`,`created`,`user`,`title`,`priv`) values(?,?,?,?,?,?)";
     $result = $this->query($query, array((int) $blogId, $data, (int) $this->now, $user, $title, $priv));
     $query = "select max(`postId`) from `tiki_blog_posts` where `created`=? and `user`=?";
     $id = $this->getOne($query, array((int) $this->now, $user));
     $query = "update `tiki_blogs` set `lastModif`=?,`posts`=`posts`+1 where `blogId`=?";
     $result = $this->query($query, array((int) $this->now, (int) $blogId));
     $this->add_blog_activity($blogId);
     if ($prefs['feature_user_watches'] == 'y') {
         $nots = $this->get_event_watches('blog_post', $blogId);
         if (!isset($_SERVER["SERVER_NAME"])) {
             $_SERVER["SERVER_NAME"] = $_SERVER["HTTP_HOST"];
         }
         if (count($nots)) {
             include_once "lib/notifications/notificationemaillib.php";
             $smarty->assign('mail_site', $_SERVER["SERVER_NAME"]);
             $query = "select `title` from `tiki_blogs` where `blogId`=?";
             $blogTitle = $this->getOne($query, array((int) $blogId));
             $smarty->assign('mail_title', $blogTitle);
             $smarty->assign('mail_post_title', $title);
             $smarty->assign('mail_blogid', $blogId);
             $smarty->assign('mail_postid', $id);
             $smarty->assign('mail_date', $this->now);
             $smarty->assign('mail_user', $user);
             $smarty->assign('mail_data', $data);
             if ($prefs['feature_contribution'] == 'y' && !empty($contributions)) {
                 global $contributionlib;
                 include_once 'lib/contribution/contributionlib.php';
                 $smarty->assign('mail_contributions', $contributionlib->print_contributions($contributions));
             }
             $foo = parse_url($_SERVER["REQUEST_URI"]);
             $machine = $tikilib->httpPrefix() . $foo["path"];
             $smarty->assign('mail_machine', $machine);
             $parts = explode('/', $foo['path']);
             if (count($parts) > 1) {
                 unset($parts[count($parts) - 1]);
             }
             $smarty->assign('mail_machine_raw', $tikilib->httpPrefix() . implode('/', $parts));
             sendEmailNotification($nots, "watch", "user_watch_blog_post_subject.tpl", $_SERVER["SERVER_NAME"], "user_watch_blog_post.tpl");
         }
     }
     if ($prefs['feature_score'] == 'y') {
         $this->score_event($user, 'blog_post');
     }
     if ($prefs['feature_actionlog'] == 'y') {
         global $logslib;
         include_once 'lib/logs/logslib.php';
         $logslib->add_action('Posted', $blogId, 'blog', "blogId={$blogId}&amp;postId={$id}&amp;add=" . strlen($data) . "#postId{$id}", '', '', '', '', $contributions);
     }
     if ($prefs['feature_search'] == 'y' && $prefs['feature_search_fulltext'] != 'y' && $prefs['search_refresh_index_mode'] == 'normal') {
         require_once 'lib/search/refresh-functions.php';
         refresh_index('blog_posts', $id);
     }
     return $id;
 }
开发者ID:Kraiany,项目名称:kraiany_site_docker,代码行数:59,代码来源:bloglib.php

示例11: wiki_rename_page


//.........这里部分代码省略.........
         $data = preg_replace($htmlSearch, $htmlReplace, $data);
         $htmlWantedSearch = '/(' . $quotedOldName . ')?<a class="wiki wikinew" href="tiki-editpage\\.php\\?page=' . $quotedOldHtmlName . '"[^<]+<\\/a>/i';
         $data = preg_replace($htmlWantedSearch, '((' . $newName . '))', $data);
         if ($is_wiki_page) {
             $query = "update `tiki_pages` set `data`=?,`page_size`=? where `pageName`=?";
             $this->query($query, array($data, (int) strlen($data), $page));
         } elseif ($type == 'forum post' || substr($type, -7) == 'comment') {
             $query = "update `tiki_comments` set `data`=? where `threadId`=?";
             $this->query($query, array($data, $objectId));
         }
         $this->invalidate_cache($page);
     }
     // correct toPage and fromPage in tiki_links
     // before update, manage to avoid duplicating index(es) when B is renamed to C while page(s) points to both C (not created yet) and B
     $query = 'select `fromPage` from `tiki_links` where `toPage`=?';
     $result = $this->query($query, array($newName));
     $linksToNew = array();
     while ($res = $result->fetchRow()) {
         $linksToNew[] = $res['fromPage'];
     }
     if ($extra = array_intersect($linksToOld, $linksToNew)) {
         $query = 'delete from `tiki_links` where `fromPage` in (' . implode(',', array_fill(0, count($extra), '?')) . ') and `toPage`=?';
         $this->query($query, array_merge($extra, array($oldName)));
     }
     $query = 'update `tiki_links` set `fromPage`=? where `fromPage`=?';
     $this->query($query, array($newName, $oldName));
     $query = 'update `tiki_links` set `toPage`=? where `toPage`=?';
     $this->query($query, array($newName, $oldName));
     // tiki_footnotes change pageName
     $query = 'update `tiki_page_footnotes` set `pageName`=? where `pageName`=?';
     $this->query($query, array($newName, $oldName));
     // in tiki_categorized_objects update objId
     $newcathref = 'tiki-index.php?page=' . urlencode($newName);
     $query = 'update `tiki_objects` set `itemId`=?,`name`=?,`href`=? where `itemId`=? and `type`=?';
     $this->query($query, array($newName, $newName, $newcathref, $oldName, 'wiki page'));
     $this->rename_object('wiki page', $oldName, $newName, $user);
     // update categories if new name has a category default
     $categlib = TikiLib::lib('categ');
     $categories = $categlib->get_object_categories('wiki page', $newName);
     $info = $this->get_page_info($newName);
     $categlib->update_object_categories($categories, $newName, 'wiki page', $info['description'], $newName, $newcathref);
     $query = 'update `tiki_wiki_attachments` set `page`=? where `page`=?';
     $this->query($query, array($newName, $oldName));
     // group home page
     if ($renameHomes) {
         $query = 'update `users_groups` set `groupHome`=? where `groupHome`=?';
         $this->query($query, array($newName, $oldName));
     }
     // copyright
     $query = 'update tiki_copyrights set `page`=? where `page`=?';
     $this->query($query, array($newName, $oldName));
     //breadcrumb
     if (isset($_SESSION['breadCrumb']) && in_array($oldName, $_SESSION['breadCrumb'])) {
         $pos = array_search($oldName, $_SESSION["breadCrumb"]);
         $_SESSION['breadCrumb'][$pos] = $newName;
     }
     global $prefs;
     global $user;
     $tikilib = TikiLib::lib('tiki');
     $smarty = TikiLib::lib('smarty');
     if ($prefs['feature_use_fgal_for_wiki_attachments'] == 'y') {
         $query = 'update `tiki_file_galleries` set `name`=? where `name`=?';
         $this->query($query, array($newName, $oldName));
     }
     // first get all watches for this page ...
     if ($prefs['feature_user_watches'] == 'y') {
         $nots = $tikilib->get_event_watches('wiki_page_changed', $oldName);
     }
     // ... then update the watches table
     // user watches
     $query = "update `tiki_user_watches` set `object`=?, `title`=?, `url`=? where `object`=? and `type` = 'wiki page'";
     $this->query($query, array($newName, $newName, 'tiki-index.php?page=' . $newName, $oldName));
     $query = "update `tiki_group_watches` set `object`=?, `title`=?, `url`=? where `object`=? and `type` = 'wiki page'";
     $this->query($query, array($newName, $newName, 'tiki-index.php?page=' . $newName, $oldName));
     // now send notification email to all on the watchlist:
     if ($prefs['feature_user_watches'] == 'y') {
         if (!isset($_SERVER["SERVER_NAME"])) {
             $_SERVER['SERVER_NAME'] = $_SERVER['HTTP_HOST'];
         }
         if (count($nots)) {
             include_once 'lib/notifications/notificationemaillib.php';
             $smarty->assign('mail_site', $_SERVER['SERVER_NAME']);
             $smarty->assign('mail_oldname', $oldName);
             $smarty->assign('mail_newname', $newName);
             $smarty->assign('mail_user', $user);
             sendEmailNotification($nots, 'watch', 'user_watch_wiki_page_renamed_subject.tpl', $_SERVER['SERVER_NAME'], 'user_watch_wiki_page_renamed.tpl');
         }
     }
     require_once 'lib/search/refresh-functions.php';
     refresh_index('pages', $oldName, false);
     refresh_index('pages', $newName);
     if ($renameHomes && $prefs['wikiHomePage'] == $oldName) {
         $tikilib->set_preference('wikiHomePage', $newName);
     }
     if ($prefs['feature_trackers'] == 'y') {
         $trklib = TikiLib::lib('trk');
         $trklib->rename_page($oldName, $newName);
     }
     return true;
 }
开发者ID:ameoba32,项目名称:tiki,代码行数:101,代码来源:wikilib.php

示例12: process_action_article

 private function process_action_article($configuration, $data, $rssId)
 {
     $tikilib = TikiLib::lib('tiki');
     $artlib = TikiLib::lib('art');
     $publication = $data['publication_date'];
     // First override with custom settings for source categories if any
     if (isset($data['categories'])) {
         $source_categories = json_decode($data['categories'], true);
     }
     if (!empty($source_categories)) {
         $custominfo = $this->get_article_custom_info($rssId);
         $oldcats = array_keys($custominfo);
         if ($newcats = array_diff($source_categories, $oldcats)) {
             // send a notification if there are new categories
             $nots = $tikilib->get_event_watches('article_submitted', '*');
             if (count($nots)) {
                 $title = $this->modules->fetchOne('name', array('rssId' => $rssId));
                 include_once 'lib/notifications/notificationemaillib.php';
                 $smarty = TikiLib::lib('smarty');
                 $smarty->assign('mail_site', $_SERVER['SERVER_NAME']);
                 $smarty->assign('rssId', $rssId);
                 $smarty->assign('title', $title);
                 $smarty->assign('newcats', $newcats);
                 sendEmailNotification($nots, 'watch', 'rss_new_source_category_subject.tpl', $_SERVER['SERVER_NAME'], 'rss_new_source_category.tpl');
             }
         }
         $current_priority = 0;
         foreach ($custominfo as $source_category => $settings) {
             if (in_array($source_category, $source_categories)) {
                 if (isset($settings['priority']) && $settings['priority'] < $current_priority) {
                     continue;
                 }
                 if (!empty($settings['atype'])) {
                     $configuration['atype'] = $settings['atype'];
                 }
                 if (isset($settings['topic']) && $settings['topic'] > '') {
                     // need to match 0
                     $configuration['topic'] = $settings['topic'];
                 }
                 if (isset($settings['rating']) && $settings['rating'] > '') {
                     // need to match 0
                     $configuration['rating'] = $settings['rating'];
                 }
                 $current_priority = isset($settings['priority']) ? $settings['priority'] : 0;
             }
         }
     }
     if ($configuration['future_publish'] > 0) {
         $publication = $tikilib->now + $configuration['future_publish'] * 60;
     }
     $expire = $publication + 3600 * 24 * $configuration['expiry'];
     if (strpos($data['content'], trim($data['description'])) === 0 && strlen($data['description']) < 1024) {
         $data['content'] = substr($data['content'], strlen(trim($data['description'])));
     }
     $data['content'] = trim($data['content']) == '' ? $data['content'] : '~np~' . $data['content'] . '~/np~';
     $hash = md5($data['title'] . $data['description'] . $data['content']);
     if ($configuration['submission'] == true) {
         $subid = $this->table('tiki_submissions')->fetchOne('subId', array('linkto' => $data['url'], 'topicId' => $configuration['topic'], 'hash' => $hash));
         if (!$subid) {
             $subid = 0;
         }
         $subid = $artlib->replace_submission($data['title'], $data['author'], $configuration['topic'], 'n', '', 0, '', '', $data['description'], $data['content'], $publication, $expire, 'admin', $subid, 0, 0, $configuration['atype'], '', '', $data['url'], '', '', $configuration['rating']);
         if (count($configuration['categories'])) {
             $categlib = TikiLib::lib('categ');
             $objectId = $categlib->add_categorized_object('submission', $subid, $data['title'], $data['title'], 'tiki-edit_submission.php?subId=' . $subid);
             foreach ($configuration['categories'] as $categId) {
                 $categlib->categorize($objectId, $categId);
             }
         }
     } else {
         $id = $this->table('tiki_articles')->fetchOne('articleId', array('linkto' => $data['url'], 'topicId' => $configuration['topic'], 'hash' => $hash));
         if (!$id) {
             $id = 0;
         }
         $id = $artlib->replace_article($data['title'], $data['author'], $configuration['topic'], 'n', '', 0, '', '', $data['description'], $data['content'], $publication, $expire, 'admin', $id, 0, 0, $configuration['atype'], '', '', $data['url'], '', '', $configuration['rating']);
         if (count($configuration['categories'])) {
             $categlib = TikiLib::lib('categ');
             $objectId = $categlib->add_categorized_object('article', $id, $data['title'], $data['title'], 'tiki-read_article.php?articleId=' . $id);
             foreach ($configuration['categories'] as $categId) {
                 $categlib->categorize($objectId, $categId);
             }
         }
         TikiLib::lib('relation')->add_relation('tiki.rss.source', 'article', $id, 'rss', $rssId);
         require_once 'lib/search/refresh-functions.php';
         refresh_index('articles', $id);
         $related_items = TikiLib::lib('relation')->get_relations_to('article', $id, 'tiki.article.attach');
         foreach ($related_items as $item) {
             refresh_index($item['type'], $item['itemId']);
         }
     }
 }
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:91,代码来源:rsslib.php

示例13: notify

 function notify($imageId, $galleryId, $name, $filename, $description, $galleryName, $user)
 {
     global $prefs;
     if ($prefs['feature_user_watches'] == 'y') {
         include_once 'lib/notifications/notificationemaillib.php';
         global $smarty, $tikilib;
         $nots = $this->get_event_watches('image_gallery_changed', $galleryId);
         $smarty->assign_by_ref('galleryId', $galleryId);
         $smarty->assign_by_ref('galleryName', $galleryName);
         $smarty->assign_by_ref('mail_date', date('U'));
         $smarty->assign_by_ref('author', $user);
         $foo = parse_url($_SERVER["REQUEST_URI"]);
         $machine = $tikilib->httpPrefix() . dirname($foo["path"]);
         $smarty->assign_by_ref('mail_machine', $machine);
         $smarty->assign_by_ref('fname', $name);
         $smarty->assign_by_ref('filename', $filename);
         $smarty->assign_by_ref('description', $description);
         $smarty->assign_by_ref('imageId', $imageId);
         sendEmailNotification($nots, 'watch', 'user_watch_image_gallery_changed_subject.tpl', NULL, 'user_watch_image_gallery_upload.tpl');
     }
 }
开发者ID:Kraiany,项目名称:kraiany_site_docker,代码行数:21,代码来源:imagegallib.php

示例14: blog_post

 function blog_post($blogId, $data, $user, $title = '', $trackbacks = '')
 {
     // update tiki_blogs and call activity functions
     global $smarty;
     global $tikilib;
     global $feature_user_watches;
     global $sender_email;
     $tracks = serialize(explode(',', $trackbacks));
     $data = strip_tags($data, '<a><b><i><h1><h2><h3><h4><h5><h6><ul><li><ol><br><p><table><tr><td><img><pre>');
     $now = date("U");
     $query = "insert into `tiki_blog_posts`(`blogId`,`data`,`created`,`user`,`title`,`trackbacks_from`,`trackbacks_to`) values(?,?,?,?,?,?,?)";
     $result = $this->query($query, array((int) $blogId, $data, (int) $now, $user, $title, serialize(array()), serialize(array())));
     $query = "select max(`postId`) from `tiki_blog_posts` where `created`=? and `user`=?";
     $id = $this->getOne($query, array((int) $now, $user));
     // Send trackbacks recovering only successful trackbacks
     $trackbacks = serialize($this->send_trackbacks($id, $trackbacks));
     // Update post with trackbacks successfully sent
     $query = "update `tiki_blog_posts` set `trackbacks_from`=?, `trackbacks_to` = ? where `postId`=?";
     $this->query($query, array(serialize(array()), $trackbacks, (int) $id));
     $query = "update `tiki_blogs` set `lastModif`=?,`posts`=`posts`+1 where `blogId`=?";
     $result = $this->query($query, array((int) $now, (int) $blogId));
     $this->add_blog_activity($blogId);
     if ($feature_user_watches == 'y') {
         $nots = $this->get_event_watches('blog_post', $blogId);
         if (!isset($_SERVER["SERVER_NAME"])) {
             $_SERVER["SERVER_NAME"] = $_SERVER["HTTP_HOST"];
         }
         if (count($nots)) {
             include_once "lib/notifications/notificationemaillib.php";
             $smarty->assign('mail_site', $_SERVER["SERVER_NAME"]);
             $query = "select `title` from `tiki_blogs` where `blogId`=?";
             $blogTitle = $this->getOne($query, array((int) $blogId));
             $smarty->assign('mail_title', $blogTitle);
             $smarty->assign('mail_post_title', $title);
             $smarty->assign('mail_blogid', $blogId);
             $smarty->assign('mail_postid', $id);
             $smarty->assign('mail_date', date("U"));
             $smarty->assign('mail_user', $user);
             $smarty->assign('mail_data', $data);
             $foo = parse_url($_SERVER["REQUEST_URI"]);
             $machine = $tikilib->httpPrefix() . $foo["path"];
             $smarty->assign('mail_machine', $machine);
             $parts = explode('/', $foo['path']);
             if (count($parts) > 1) {
                 unset($parts[count($parts) - 1]);
             }
             $smarty->assign('mail_machine_raw', $tikilib->httpPrefix() . implode('/', $parts));
             sendEmailNotification($nots, "watch", "user_watch_blog_post_subject.tpl", $_SERVER["SERVER_NAME"], "user_watch_blog_post.tpl");
             //@mail($not['email'], tra('Blog post'). ' ' . $blogTitle, $mail_data, "From: $sender_email\r\nContent-type: text/plain;charset=utf-8\r\n");
         }
     }
     global $feature_score;
     if ($feature_score == 'y') {
         $this->score_event($user, 'blog_post');
     }
     return $id;
 }
开发者ID:noikiy,项目名称:owaspbwa,代码行数:57,代码来源:bloglib.php

示例15: replace_article

 function replace_article($title, $authorName, $topicId, $useImage, $imgname, $imgsize, $imgtype, $imgdata, $heading, $body, $publishDate, $expireDate, $user, $articleId, $image_x, $image_y, $type, $topline, $subtitle, $linkto, $image_caption, $lang, $rating = 0, $isfloat = 'n', $emails = '', $from = '', $list_image_x = '', $list_image_y = '', $ispublished = 'y', $fromurl = false)
 {
     $tikilib = TikiLib::lib('tiki');
     $smarty = TikiLib::lib('smarty');
     if ($expireDate < $publishDate) {
         $expireDate = $publishDate;
     }
     $hash = md5($title . $heading . $body);
     if (empty($imgdata) || $useImage === 'n') {
         // remove image data if not using it
         $imgdata = '';
     }
     $query = 'select `name` from `tiki_topics` where `topicId` = ?';
     $topicName = $this->getOne($query, array($topicId));
     $size = $body ? mb_strlen($body) : mb_strlen($heading);
     $info = array('title' => $title, 'authorName' => $authorName, 'topicId' => (int) $topicId, 'topicName' => $topicName, 'size' => (int) $size, 'useImage' => $useImage, 'image_name' => $imgname, 'image_type' => $imgtype, 'image_size' => (int) $imgsize, 'image_data' => $imgdata, 'isfloat' => $isfloat, 'image_x' => (int) $image_x, 'image_y' => (int) $image_y, 'list_image_x' => (int) $list_image_x, 'list_image_y' => (int) $list_image_y, 'heading' => $heading, 'body' => $body, 'publishDate' => (int) $publishDate, 'expireDate' => (int) $expireDate, 'created' => (int) $this->now, 'author' => $user, 'type' => $type, 'rating' => (double) $rating, 'topline' => $topline, 'subtitle' => $subtitle, 'linkto' => $linkto, 'image_caption' => $image_caption, 'lang' => $lang, 'ispublished' => $ispublished);
     $article_table = $this->table('tiki_articles');
     if ($articleId) {
         $oldArticle = $this->get_article($articleId);
         $article_table->update($info, array('articleId' => (int) $articleId));
         // Clear article image cache because image may just have been changed
         $this->delete_image_cache('article', $articleId);
         $event = 'article_edited';
         $nots = $tikilib->get_event_watches('article_edited', '*');
         $nots2 = $tikilib->get_event_watches('topic_article_edited', $topicId);
         $smarty->assign('mail_action', 'Edit');
         $smarty->assign('mail_old_title', $oldArticle['title']);
         $smarty->assign('mail_old_publish_date', $oldArticle['publishDate']);
         $smarty->assign('mail_old_expiration_date', $oldArticle['expireDate']);
         $smarty->assign('mail_old_data', $oldArticle['heading'] . "\n----------------------\n" . $oldArticle['body']);
     } else {
         $articleId = $article_table->insert($info);
         global $prefs;
         if ($prefs['feature_score'] == 'y') {
             $this->score_event($user, 'article_new');
         }
         $event = 'article_submitted';
         $nots = $tikilib->get_event_watches('article_submitted', '*');
         $nots2 = $tikilib->get_event_watches('topic_article_created', $topicId);
         $smarty->assign('mail_action', 'New');
         // Create tracker item as well if feature is enabled
         if (!$fromurl && $prefs['tracker_article_tracker'] == 'y' && ($trackerId = $prefs['tracker_article_trackerId'])) {
             $trklib = TikiLib::lib('trk');
             $definition = Tracker_Definition::get($trackerId);
             if ($fieldId = $definition->getArticleField()) {
                 $addit = array();
                 $addit[] = array('fieldId' => $fieldId, 'type' => 'articles', 'value' => $articleId);
                 $itemId = $trklib->replace_item($trackerId, 0, array('data' => $addit));
                 TikiLib::lib('relation')->add_relation('tiki.article.attach', 'trackeritem', $itemId, 'article', $articleId);
             }
         }
     }
     $nots3 = array();
     foreach ($nots as $n) {
         $nots3[] = $n['email'];
     }
     foreach ($nots2 as $n) {
         if (!in_array($n['email'], $nots3)) {
             $nots[] = $n;
         }
     }
     if (is_array($emails) && (empty($from) || $from == $prefs['sender_email'])) {
         foreach ($emails as $n) {
             if (!in_array($n, $nots3)) {
                 $nots[] = array('email' => $n, 'language' => $prefs['site_language']);
             }
         }
     }
     global $prefs;
     if ($prefs['user_article_watch_editor'] != "y") {
         for ($i = count($nots) - 1; $i >= 0; --$i) {
             if ($nots[$i]['user'] == $user) {
                 unset($nots[$i]);
                 break;
             }
         }
     }
     if (!isset($_SERVER['SERVER_NAME'])) {
         $_SERVER['SERVER_NAME'] = $_SERVER['HTTP_HOST'];
     }
     if ($prefs['feature_user_watches'] == 'y' && $prefs['feature_daily_report_watches'] == 'y') {
         $reportsManager = Reports_Factory::build('Reports_Manager');
         $reportsManager->addToCache($nots, array('event' => $event, 'articleId' => $articleId, 'articleTitle' => $title, 'authorName' => $authorName, 'user' => $user));
     }
     if (count($nots) || is_array($emails)) {
         include_once 'lib/notifications/notificationemaillib.php';
         $smarty->assign('mail_site', $_SERVER['SERVER_NAME']);
         $smarty->assign('mail_title', $title);
         $smarty->assign('mail_postid', $articleId);
         $smarty->assign('mail_user', $user);
         $smarty->assign('mail_current_publish_date', $publishDate);
         $smarty->assign('mail_current_expiration_date', $expireDate);
         $smarty->assign('mail_current_data', $heading . "\n----------------------\n" . $body);
         sendEmailNotification($nots, 'watch', 'user_watch_article_post_subject.tpl', $_SERVER['SERVER_NAME'], 'user_watch_article_post.tpl');
         if (is_array($emails) && !empty($from) && $from != $prefs['sender_email']) {
             $nots = array();
             foreach ($emails as $n) {
                 $nots[] = array('email' => $n, 'language' => $prefs['site_language']);
             }
             sendEmailNotification($nots, 'watch', 'user_watch_article_post_subject.tpl', $_SERVER['SERVER_NAME'], 'user_watch_article_post.tpl', $from);
//.........这里部分代码省略.........
开发者ID:ameoba32,项目名称:tiki,代码行数:101,代码来源:artlib.php


注:本文中的sendEmailNotification函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。