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


PHP vB::getCurrentsession方法代码示例

本文整理汇总了PHP中vB::getCurrentsession方法的典型用法代码示例。如果您正苦于以下问题:PHP vB::getCurrentsession方法的具体用法?PHP vB::getCurrentsession怎么用?PHP vB::getCurrentsession使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vB的用法示例。


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

示例1: sendModeratorNotification

 /**
  * Sends emails to moderators configured in admincp
  */
 protected function sendModeratorNotification($nodeid)
 {
     // This is the list of ALL mods who have either the newpostemail or the newthreademail option enabled
     // We'll go through this list and figure out which ones are moderators of the ancestor channels of $nodeid
     $notify = vB_Cache::instance(vB_Cache::CACHE_STD)->read('vB_Mod_PostNotify');
     if ($notify === false) {
         $library = vB_Library::instance('usergroup');
         $smodgroups = $library->getSuperModGroups();
         //force to have a non empty array or the query will be unhappy.  It's unlikely that a site will
         //not have any usergroups with the superadmin flag set, but its possible
         if (!$smodgroups) {
             $smodgroups = array(0);
         }
         $notify = array();
         $bitFields = vb::getDatastore()->getValue('bf_misc_moderatorpermissions');
         $modQry = $this->assertor->assertQuery('vBForum:modPostNotify', array('bfPost' => $bitFields['newpostemail'], 'bfTopic' => $bitFields['newthreademail'], 'smodgroups' => $smodgroups));
         $events = array();
         if ($modQry->valid()) {
             foreach ($modQry as $mod) {
                 $events[$mod['userid']] = 'userChg_' . $mod['userid'];
                 //Every time a moderator changes emails, is deleted, etc, we have to invalidate it.
                 if (!isset($notify[$mod['nodeid']])) {
                     $notify[$mod['nodeid']] = array("posts" => array(), "topics" => array());
                 }
                 if ($mod['notifypost'] > 0) {
                     $notify[$mod['nodeid']]['posts'][] = $mod['email'];
                 }
                 if ($mod['notifytopic'] > 0) {
                     $notify[$mod['nodeid']]['topics'][] = $mod['email'];
                 }
             }
         }
         // all these user change events could be a lot...
         $events['vB_ModPostNotifyChg'] = 'vB_ModPostNotifyChg';
         vB_Cache::instance(vB_Cache::CACHE_STD)->write('vB_Mod_PostNotify', $notify, 1440, $events);
     }
     // grab parents of the added node, and see if we have any moderators on the channel
     $parents = vB::getDbAssertor()->getRows('vBForum:closure', array('child' => $nodeid));
     $notifyList = array();
     // the actual list of emails that are associated with this node.
     $node = vB_Library::instance('node')->getNodeFullContent($nodeid);
     $node = $node[$nodeid];
     if ($node['starter'] == $node['nodeid']) {
         $notifyKey = "topics";
     } else {
         $notifyKey = "posts";
     }
     foreach ($parents as $closure) {
         $parentid = $closure['parent'];
         if (array_key_exists($parentid, $notify)) {
             // each found list is an array of emails, so we have to merge
             $notifyList = array_merge($notifyList, $notify[$parentid][$notifyKey]);
         }
     }
     // Global moderators case. At the moment, the global mods in the moderator table has nodeid = 0 so the
     // closure check above leaves them out.
     if (!empty($notify[0])) {
         $notifyList = array_merge($notifyList, $notify[0][$notifyKey]);
     }
     $notifyList = array_unique($notifyList);
     if (empty($notifyList)) {
         return;
     }
     // grab some data for the message
     $userinfo = vB::getCurrentsession()->fetch_userinfo();
     $forumName = vB::getDatastore()->getOption('bbtitle');
     $starter = vB_Library::instance('node')->getNodeFullContent($node['starter']);
     $starter = $starter[$node['starter']];
     $threadTitle = $starter['title'];
     // Below is the call to fetch the url to the thread starter
     // $threadLink = vB5_Route::buildUrl($starter['routeid'] . '|fullurl', $starter);
     // If we want the direct link to the post, below is what's needed
     $routeInfo = array('nodeid' => $nodeid);
     // Using the normal vB5_Route::buildURL can throw an exception, because it'll likely use the
     // conversation route which checks permissions on the *current* user in the constructor and
     // throw an exception.
     // So we'll use vB5_Route_Node
     $nodeLink = vB5_Route::buildUrl('node|fullurl', $routeInfo);
     $message = vB_Phrase::fetchSinglePhrase('new_post_notification_a_b_c_d_e_f', array($userinfo['username'], $node['channeltitle'], $forumName, $threadTitle, $nodeLink, $node['rawtext']));
     $subject = vB_Phrase::fetchSinglePhrase('new_post_in_forum_x', $node['channeltitle']);
     // send emails
     foreach ($notifyList as $email) {
         if ($email != $userinfo['email']) {
             vB_Mail::vbmail($email, $subject, $message, true, '', '', '', TRUE);
         }
     }
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:90,代码来源:content.php


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