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


PHP Phpfox::getCookie方法代码示例

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


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

示例1: setController

 /**
  * Sets the controller for the page we are on. This method controlls what component to load, which 
  * will be used to display the content on that page.
  *
  * @param string $sController (Optional) We find the controller by default, however you can override our default findings by passing the name of the controller with this argument.
  */
 public function setController($sController = '')
 {
     if ($sController) {
         $aParts = explode('.', $sController);
         $this->_sModule = $aParts[0];
         $this->_sController = substr_replace($sController, '', 0, strlen($this->_sModule . '_'));
         ($sPlugin = Phpfox_Plugin::get('set_defined_controller')) ? eval($sPlugin) : false;
         $this->getController();
         return null;
     }
     if ($View = (new Core\Route\Controller())->get()) {
         return $View;
     }
     ($sPlugin = Phpfox_Plugin::get('module_setcontroller_start')) ? eval($sPlugin) : false;
     $oReq = Phpfox_Request::instance();
     $oPage = Phpfox::getService('page');
     $this->_sModule = ($sReq1 = $oReq->get('req1')) ? strtolower($sReq1) : Phpfox::getParam('core.module_core');
     if (($sFrame = $oReq->get('frame')) && in_array($sFrame, $this->_aFrames)) {
         $aFrameParts = explode('-', $sFrame);
         $this->_sModule = strtolower($aFrameParts[0]);
         $this->_sController = strtolower($aFrameParts[1]);
     }
     $this->_aPages = $oPage->getCache();
     if (isset($this->_aPages[$oReq->get('req1')])) {
         $this->_sModule = 'page';
         $this->_sController = 'view';
     }
     $sDir = PHPFOX_DIR_MODULE . $this->_sModule . PHPFOX_DS;
     if ($oReq->get('req2') == Phpfox::getParam('admincp.admin_cp')) {
         Phpfox_Url::instance()->send($oReq->get('req2') . '.' . $oReq->get('req1'));
     }
     if ($oReq->get('req1') == 'admincp' && Phpfox::getParam('admincp.admin_cp') != 'admincp') {
         Phpfox_Url::instance()->send('error.404');
     }
     if ($oReq->get('req2') && file_exists($sDir . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . strtolower($oReq->get('req2')) . '.class.php')) {
         $this->_sController = strtolower($oReq->get('req2'));
     } elseif (strtolower($this->_sModule) != Phpfox::getParam('admincp.admin_cp') && $oReq->get('req3') && file_exists($sDir . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . strtolower($oReq->get('req2')) . PHPFOX_DS . strtolower($oReq->get('req3')) . '.class.php')) {
         $this->_sController = strtolower($oReq->get('req2') . '.' . $oReq->get('req3'));
     } elseif (strtolower($this->_sModule) != Phpfox::getParam('admincp.admin_cp') && $oReq->get('req2') && file_exists($sDir . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . strtolower($oReq->get('req2')) . PHPFOX_DS . 'index.class.php')) {
         $this->_sController = strtolower($oReq->get('req2')) . '.index';
     } else {
         // Over-ride the index page to display the content for guests or members
         if ($this->_sModule == Phpfox::getParam('core.module_core') && $this->_sController == 'index' && Phpfox::getParam('core.module_core') == PHPFOX_MODULE_CORE) {
             $this->_sController = Phpfox::isUser() ? 'index-member' : 'index-visitor';
         }
         if (!file_exists($sDir . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . $this->_sController . '.class.php')) {
             $this->_sModule = 'profile';
         }
         ($sPlugin = Phpfox_Plugin::get('set_controller_else_end')) ? eval($sPlugin) : false;
     }
     if ($this->_sModule == 'theme') {
         if (preg_match('/^(.*?)\\.(jpg|jpeg|gif|png|css|js)$/i', $_GET[PHPFOX_GET_METHOD])) {
             $this->_sModule = 'error';
             $this->_sController = '404';
         }
     }
     if ($this->_sModule != 'profile' && !isset($this->_aModules[$this->_sModule])) {
         $this->_sModule = 'error';
         $this->_sController = '404';
     }
     if (Phpfox::getParam('admincp.admin_cp') != 'admincp' && $oReq->get('req1') == Phpfox::getParam('admincp.admin_cp')) {
         $this->_sModule = 'admincp';
     }
     /*
     		if (Phpfox::isUser() && Phpfox::getParam('core.is_auto_hosted') && Phpfox::getService('log.session')->getOnlineMembers() > Phpfox::getParam('core.phpfox_max_users_online'))
     		{
     			$this->_sModule = 'core';
     			$this->_sController = 'full';
     		}		
     */
     if ($oReq->segment(1) == 'hashtag') {
         $this->_sModule = 'core';
         $this->_sController = Phpfox::isUser() ? 'index-member' : 'index-visitor';
     }
     ($sPlugin = Phpfox_Plugin::get('module_setcontroller_end')) ? eval($sPlugin) : false;
     // Set the language pack cache
     if (Phpfox::getParam('language.cache_phrases')) {
         Phpfox_Locale::instance()->setCache();
     }
     $bCookie = Phpfox::getCookie('page_login') && Phpfox::getUserBy('profile_page_id') > 0;
     if (Phpfox::isUser() && $bCookie != 1 && Phpfox::getUserParam('user.require_profile_image') && Phpfox::getUserBy('user_image') == '' && !($this->_sModule == 'user' && $this->_sController == 'photo' || $this->_sModule == 'user' && $this->_sController == 'logout' || $this->_sModule == 'subscribe')) {
         Phpfox_Url::instance()->send('user.photo', null, Phpfox::getPhrase('user.you_are_required_to_upload_a_profile_image'));
     }
     if (Phpfox::getParam('core.force_https_secure_pages')) {
         $sController = str_replace('mobile.', '', $this->getFullControllerName());
         if ($sController == 'core.index-member' || $sController == 'core.index-visitor') {
             // fixes 14276
             $sController = '';
         }
         if (in_array(str_replace('mobile.', '', $this->getFullControllerName()), Phpfox::getService('core')->getSecurePages())) {
             if (!isset($_SERVER['HTTPS'])) {
                 Phpfox_Url::instance()->send($sController);
             }
         } else {
//.........这里部分代码省略.........
开发者ID:Goudarzi-hahram,项目名称:phpfox,代码行数:101,代码来源:module.class.php

示例2: process

 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     if (defined('PHPFOX_IS_AD_PREVIEW')) {
         return false;
     }
     if (Phpfox::getUserBy('profile_page_id') > 0) {
         return false;
     }
     $oRequest = Phpfox::getLib('request');
     if ($this->template()->bIsSample || $oRequest->get('req2') == 'designer' || $oRequest->get('req2') == 'index-member' && $oRequest->get('req3') == 'customize') {
         return false;
     }
     if (!Phpfox::isModule('friend')) {
         return false;
     }
     $sLastOpenWindow = null;
     $sLastWindowParam = null;
     if ($sLastOpenWindow = Phpfox::getCookie('im_last_open_window')) {
         if (preg_match("/chat_(.*)/i", $sLastOpenWindow, $aMatches)) {
             $sLastOpenWindow = 'chat';
             $sLastWindowParam = (int) $aMatches[1];
         } elseif ($sLastOpenWindow == 'messenger') {
             $sLastOpenWindow = 'messenger';
         }
         Phpfox::setCookie('im_last_open_window', '', -1);
     }
     $iCnt = 0;
     if (Phpfox::getUserBy('im_hide') != '1') {
         $aCond = array('AND f.user_id = ' . Phpfox::getUserId() . ' AND u.im_hide != 1');
         list($iCnt, $aFriends) = Phpfox::getService('im')->getOnlineFriends(Phpfox::getUserId(), $aCond);
     }
     $this->template()->assign(array('iTotalFriendsOnline' => $iCnt, 'sLastOpenWindow' => $sLastOpenWindow, 'sLastWindowParam' => $sLastWindowParam));
 }
开发者ID:Lovinity,项目名称:EQM,代码行数:36,代码来源:footer.class.php

示例3: __construct

 public function __construct()
 {
     parent::__construct();
     if (!self::$_active) {
         $cookie = \Phpfox::getCookie('flavor_id');
         if ($cookie) {
             self::$_active = $this->db->select('t.*, ts.folder AS flavor_folder')->from(':theme_style', 'ts')->join(':theme', 't', ['t.theme_id' => ['=' => 'ts.theme_id']])->where(['ts.style_id' => (int) $cookie])->get();
         } else {
             self::$_active = $this->db->select('t.*, ts.folder AS flavor_folder')->from(':theme', 't')->join(':theme_style', 'ts', ['t.theme_id' => ['=' => 'ts.theme_id'], 'ts.is_default' => 1])->where($cookie ? ['t.theme_id' => (int) $cookie] : ['t.is_default' => 1])->get();
         }
         if (!self::$_active || defined('PHPFOX_CSS_FORCE_DEFAULT')) {
             self::$_active = ['name' => 'Default', 'folder' => 'default', 'flavor_folder' => 'default'];
         }
     }
 }
开发者ID:JerwinPRO,项目名称:phpfox,代码行数:15,代码来源:Theme.php

示例4: registerInvited

 /**
  * Actions to take after an invited guest signs up
  * @param <type> $iGuestId
  * @param <type> $iUser
  * @return <type>
  */
 public function registerInvited($iUserId)
 {
     if ($iInviteId = Phpfox::getCookie('invited_by_user')) {
         $aInvite = $this->database()->select('user_id')->from(Phpfox::getT('user'))->where('user_id = ' . (int) $iInviteId)->execute('getSlaveRow');
     } elseif ($iInviteId = Phpfox::getCookie('invited_by_email')) {
         $aInvite = $this->database()->select('invite_id, user_id')->from($this->_sTable)->where('invite_id = ' . (int) $iInviteId)->execute('getSlaveRow');
         if (isset($aInvite['invite_id'])) {
             $this->database()->delete(Phpfox::getT('invite'), "invite_id = '" . $aInvite['invite_id'] . "'");
         }
     }
     if (isset($aInvite['user_id'])) {
         // Both should now be friends
         $this->_makeFriends($iUserId, $aInvite['user_id']);
         // update the user table field for invite_user_id
         $this->database()->update(Phpfox::getT('user'), array('invite_user_id' => (int) $aInvite['user_id']), 'user_id = ' . $iUserId);
         // award points
         // relying on the script's type validation as its defined as integer
         Phpfox::getService('user.activity')->update($iUserId, 'invite', '+');
         Phpfox::getService('user.activity')->update($aInvite['user_id'], 'invite', '+');
     }
     Phpfox::setCookie('invited_by_user', 0, '-1');
     Phpfox::setCookie('invited_by_email', 0, '-1');
 }
开发者ID:lev1976g,项目名称:core,代码行数:29,代码来源:process.class.php

示例5: add


//.........这里部分代码省略.........
     if (!defined('PHPFOX_INSTALLER') && Phpfox::getParam('user.verify_email_at_signup')) {
         $aInsert['status_id'] = 1;
         // 1 = need to verify email
     }
     if (!defined('PHPFOX_INSTALLER') && Phpfox::getParam('user.approve_users')) {
         $aInsert['view_id'] = '1';
         // 1 = need to approve the user
     }
     if (!Phpfox::getParam('user.profile_use_id') && !Phpfox::getParam('user.disable_username_on_sign_up')) {
         $aVals['user_name'] = str_replace(' ', '_', $aVals['user_name']);
         $aInsert['user_name'] = $oParseInput->clean($aVals['user_name']);
     }
     ($sPlugin = Phpfox_Plugin::get('user.service_process_add_start')) ? eval($sPlugin) : false;
     if (!Phpfox_Error::isPassed()) {
         return false;
     }
     $iId = $this->database()->insert($this->_sTable, $aInsert);
     $aInsert['user_id'] = $iId;
     $aExtras = array('user_id' => $iId);
     ($sPlugin = Phpfox_Plugin::get('user.service_process_add_extra')) ? eval($sPlugin) : false;
     $this->database()->insert(Phpfox::getT('user_activity'), $aExtras);
     $this->database()->insert(Phpfox::getT('user_field'), $aExtras);
     $this->database()->insert(Phpfox::getT('user_space'), $aExtras);
     $this->database()->insert(Phpfox::getT('user_count'), $aExtras);
     if (!defined('PHPFOX_INSTALLER') && Phpfox::getParam('core.city_in_registration') && isset($aVals['city_location'])) {
         Phpfox::getService('user.field.process')->update($iId, 'city_location', Phpfox::getLib('parse.input')->clean($aVals['city_location'], 100));
     }
     if (Phpfox::getParam('user.profile_use_id') || Phpfox::getParam('user.disable_username_on_sign_up')) {
         $this->database()->update($this->_sTable, array('user_name' => 'profile-' . $iId), 'user_id = ' . $iId);
     }
     if ($bHasImage) {
         $this->uploadImage($iId, true, null, true);
     }
     if (Phpfox::isModule('invite') && (Phpfox::getCookie('invited_by_email') || Phpfox::getCookie('invited_by_user'))) {
         Phpfox::getService('invite.process')->registerInvited($iId);
     } elseif (Phpfox::isModule('invite')) {
         Phpfox::getService('invite.process')->registerByEmail($aInsert);
     }
     ($sPlugin = Phpfox_Plugin::get('user.service_process_add_feed')) ? eval($sPlugin) : false;
     if (!defined('PHPFOX_INSTALLER') && !Phpfox::getParam('user.verify_email_at_signup') && !Phpfox::getParam('user.approve_users') && !isset($bDoNotAddFeed)) {
         //(Phpfox::isModule('feed') ? Phpfox::getService('feed.process')->allowGuest()->add('user_joined', $iId, null, $iId) : null);
     }
     if (isset($aVals['country_child_id'])) {
         Phpfox::getService('user.field.process')->update($iId, 'country_child_id', $aVals['country_child_id']);
     }
     if (!defined('PHPFOX_INSTALLER') && Phpfox::getParam('user.split_full_name')) {
         Phpfox::getService('user.field.process')->update($iId, 'first_name', empty($aVals['first_name']) ? null : $aVals['first_name']);
         Phpfox::getService('user.field.process')->update($iId, 'last_name', empty($aVals['last_name']) ? null : $aVals['last_name']);
     }
     if (!defined('PHPFOX_INSTALLER') && Phpfox::getParam('core.registration_enable_dob')) {
         // Updating for the birthday range
         $this->database()->update(Phpfox::getT('user_field'), array('birthday_range' => '\'' . Phpfox::getService('user')->buildAge($aVals['day'], $aVals['month']) . '\''), 'user_id = ' . $iId, false);
     }
     if (!defined('PHPFOX_INSTALLER')) {
         $iFriendId = (int) Phpfox::getParam('user.on_signup_new_friend');
         if ($iFriendId > 0 && Phpfox::isModule('friend')) {
             $iCheckFriend = $this->database()->select('COUNT(*)')->from(Phpfox::getT('friend'))->where('user_id = ' . (int) $iId . ' AND friend_user_id = ' . (int) $iFriendId)->execute('getSlaveField');
             if (!$iCheckFriend) {
                 $this->database()->insert(Phpfox::getT('friend'), array('list_id' => 0, 'user_id' => $iId, 'friend_user_id' => $iFriendId, 'time_stamp' => PHPFOX_TIME));
                 $this->database()->insert(Phpfox::getT('friend'), array('list_id' => 0, 'user_id' => $iFriendId, 'friend_user_id' => $iId, 'time_stamp' => PHPFOX_TIME));
                 Phpfox::getService('friend.process')->updateFriendCount($iId, $iFriendId);
                 Phpfox::getService('friend.process')->updateFriendCount($iFriendId, $iId);
             }
         }
         if ($sPlugin = Phpfox_Plugin::get('user.service_process_add_check_1')) {
             eval($sPlugin);
开发者ID:noikiy,项目名称:phpfox-v3-dist,代码行数:67,代码来源:process.class.php

示例6: display

 /**
  * Displays an image on the site based on params passed
  *
  * @param array $aParams Holds an ARRAY of params about the image
  * @return string Returns the HTML <image> or the full path to the image based on the params passed with the 1st argument
  */
 public function display($aParams, $bIsLoop = false)
 {
     static $aImages = array();
     // Create hash for cache
     $sHash = md5(serialize($aParams));
     // Return cached image
     if (isset($aImages[$sHash])) {
         return $aImages[$sHash];
     }
     $bIsServer = !empty($aParams['server_id']) ? true : false;
     $isObject = false;
     if ($sPlugin = Phpfox_Plugin::get('image_helper_display_start')) {
         eval($sPlugin);
         if (isset($mReturnPlugin)) {
             return $mReturnPlugin;
         }
     }
     if (isset($aParams['theme'])) {
         if (substr($aParams['theme'], 0, 5) == 'ajax/') {
             $type = str_replace(['ajax/', '.gif'], '', $aParams['theme']);
             // $image = '<span class="_ajax_image_' . $type . '"></span>';
             $image = '';
             switch ($type) {
                 case 'large':
                     $image = '<i class="fa fa-spin fa-circle-o-notch _ajax_image_' . $type . '"></i>';
                     break;
             }
             return $image;
         }
         $sSrc = Phpfox_Template::instance()->getStyle('image', $aParams['theme']);
         return '<img src="' . $sSrc . '">';
     }
     if (isset($aParams['max_height']) && !is_numeric($aParams['max_height'])) {
         $aParams['max_height'] = Phpfox::getParam($aParams['max_height']);
     }
     if (isset($aParams['max_width']) && !is_numeric($aParams['max_width'])) {
         $aParams['max_width'] = Phpfox::getParam($aParams['max_width']);
     }
     // Check if this is a users profile image
     $bIsOnline = false;
     $sSuffix = '';
     if (isset($aParams['user'])) {
         if (isset($aParams['user_suffix'])) {
             $sSuffix = $aParams['user_suffix'];
         }
         // Create the local params
         $aParams['server_id'] = isset($aParams['user']['user_' . $sSuffix . 'server_id']) ? $aParams['user']['user_' . $sSuffix . 'server_id'] : (isset($aParams['user'][$sSuffix . 'server_id']) ? $aParams['user'][$sSuffix . 'server_id'] : '');
         $aParams['file'] = $aParams['user'][$sSuffix . 'user_image'];
         $aParams['path'] = 'core.url_user';
         if (isset($aParams['user']['' . $sSuffix . 'is_user_page'])) {
             $aParams['path'] = 'pages.url_image';
             $aParams['suffix'] = '_120';
         }
         $aParams['title'] = $bIsOnline ? Phpfox::getPhrase('core.full_name_is_online', array('full_name' => Phpfox::getLib('parse.output')->shorten($aParams['user'][$sSuffix . 'full_name'], Phpfox::getParam('user.maximum_length_for_full_name')))) : Phpfox::getLib('parse.output')->shorten($aParams['user'][$sSuffix . 'full_name'], Phpfox::getParam('user.maximum_length_for_full_name'));
         // Create the users link
         if (!empty($aParams['user']['profile_page_id']) && !empty($aParams['user']['page_id'])) {
             if (empty($aParams['user']['user_name'])) {
                 $sLink = Phpfox_Url::instance()->makeUrl('pages', $aParams['user']['page_id']);
             }
         } else {
             $sLink = Phpfox_Url::instance()->makeUrl('profile', $aParams['user'][$sSuffix . 'user_name']);
         }
         if (Phpfox::getParam('user.prevent_profile_photo_cache') && isset($aParams['user'][$sSuffix . 'user_id']) && $aParams['user'][$sSuffix . 'user_id'] == Phpfox::getUserId()) {
             $aParams['time_stamp'] = true;
         }
         if (Phpfox::getCookie('recache_image') && isset($aParams['user'][$sSuffix . 'user_id']) && $aParams['user'][$sSuffix . 'user_id'] == Phpfox::getUserId()) {
             $aParams['time_stamp'] = true;
         }
         if (substr($aParams['file'], 0, 1) == '{') {
             $isObject = true;
             $aParams['org_file'] = $aParams['file'];
         }
     }
     if (empty($aParams['file'])) {
         /*
         if (isset($aParams['return_url']) && $aParams['return_url']) {
         	return '';
         }
         */
         $iWidth = 80;
         $iHeight = 70;
         if (isset($aParams['path']) && ($aParams['path'] == 'core.url_user' || $aParams['path'] == 'pages.url_image')) {
             static $aGenders = null;
             if ($aGenders === null) {
                 $aGenders = array();
                 foreach ((array) Phpfox::getParam('core.global_genders') as $iKey => $aGender) {
                     if (isset($aGender[3])) {
                         $aGenders[$iKey] = $aGender[3];
                     }
                 }
             }
             $sGender = '';
             if (isset($aParams['user']) && isset($aParams['user'][$sSuffix . 'gender'])) {
                 if (isset($aGenders[$aParams['user'][$sSuffix . 'gender']])) {
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:phpfox-dist,代码行数:101,代码来源:helper.class.php

示例7: process


//.........这里部分代码省略.........
                 $aVals['user_name'] = str_replace('_', '-', $aVals['user_name']);
                 Phpfox::getService('user.validate')->user($aVals['user_name']);
             }
             ($sPlugin = Phpfox_Plugin::get('user.component_controller_register_1')) ? eval($sPlugin) : false;
             if (isset($aVals['type_register']) && $aVals['type_register'] == 'organization') {
                 Phpfox::getService('user.validate')->email($aVals['organization_email']);
             } else {
                 Phpfox::getService('user.validate')->email($aVals['email']);
             }
             if (Phpfox::getParam('user.reenter_email_on_signup')) {
                 if (empty($aVals['email']) || empty($aVals['confirm_email'])) {
                     Phpfox_Error::set(Phpfox::getPhrase('user.email_s_do_not_match'));
                 } else {
                     if ($aVals['email'] != $aVals['confirm_email']) {
                         Phpfox_Error::set(Phpfox::getPhrase('user.email_s_do_not_match'));
                     }
                 }
             }
             ($sPlugin = Phpfox_Plugin::get('user.component_controller_register_2')) ? eval($sPlugin) : false;
             if ($oValid->isValid($aVals)) {
                 if ($iId = Phpfox::getService('user.process')->add($aVals)) {
                     if (isset($aVals['type_register']) && $aVals['type_register'] == 'organization') {
                         $aVals['email'] = $aVals['organization_email'];
                         $aVals['password'] = $aVals['organization_password'];
                     }
                     if (Phpfox::getService('user.auth')->login($aVals['email'], $aVals['password'])) {
                         if (is_array($iId)) {
                             ($sPlugin = Phpfox_Plugin::get('user.component_controller_register_3')) ? eval($sPlugin) : false;
                             $this->url()->forward($iId[0]);
                         } else {
                             $sRedirect = Phpfox::getParam('user.redirect_after_signup');
                             if (!empty($sRedirect)) {
                                 ($sPlugin = Phpfox_Plugin::get('user.component_controller_register_4')) ? eval($sPlugin) : false;
                                 if (PHPFOX_IS_AJAX) {
                                     echo 'window.location.href="' . Phpfox::getLib('url')->makeUrl($sRedirect) . '";';
                                     die;
                                 }
                                 $this->url()->send($sRedirect);
                             }
                             if (Phpfox::getParam('user.multi_step_registration_form') && is_array(Phpfox::getParam('user.registration_steps')) && count(Phpfox::getParam('user.registration_steps'))) {
                                 $aUrls = Phpfox::getParam('user.registration_steps');
                                 ($sPlugin = Phpfox_Plugin::get('user.component_controller_register_5')) ? eval($sPlugin) : false;
                                 $this->url()->send($aUrls[0], 'register');
                             } else {
                                 ($sPlugin = Phpfox_Plugin::get('user.component_controller_register_6')) ? eval($sPlugin) : false;
                                 if (Phpfox::getLib('session')->get('appinstall') != '') {
                                     $this->url()->send('apps.install.' . Phpfox::getLib('session')->get('appinstall'));
                                 } else {
                                     if (PHPFOX_IS_AJAX) {
                                         echo 'window.location.href="' . Phpfox::getLib('url')->makeUrl('') . '";';
                                         die;
                                     }
                                     $this->url()->send('');
                                 }
                             }
                         }
                     }
                 } else {
                     if (PHPFOX_IS_AJAX) {
                         $aErrors = Phpfox_Error::get();
                         echo '$(".' . $sTab . ' .register_error_panel").html("");';
                         foreach ($aErrors as $key => $value) {
                             $value = str_replace('"', "'", $value);
                             echo '$(".' . $sTab . ' .register_error_panel").append("<div>' . $value . '</div>");';
                         }
                         echo '$(".' . $sTab . ' .register_error_panel").fadeIn();';
                         die;
                     }
                     if (Phpfox::getParam('user.multi_step_registration_form')) {
                         $this->template()->assign('bIsPosted', true);
                         ($sPlugin = Phpfox_Plugin::get('user.component_controller_register_7')) ? eval($sPlugin) : false;
                     }
                 }
             } else {
                 if (PHPFOX_IS_AJAX) {
                     $aErrors = Phpfox_Error::get();
                     echo '$(".' . $sTab . ' .register_error_panel").html("");';
                     foreach ($aErrors as $key => $value) {
                         $value = str_replace('"', "'", $value);
                         echo '$(".' . $sTab . ' .register_error_panel").append("<div>' . $value . '</div>");';
                     }
                     echo '$(".' . $sTab . ' .register_error_panel").fadeIn();';
                     die;
                 }
                 $this->template()->assign(array('bCorrectUsername' => !Phpfox::getParam('user.profile_use_id') && !Phpfox::getParam('user.disable_username_on_sign_up') ? Phpfox::getService('user.validate')->user($aVals['user_name']) : '', 'sUsername' => !Phpfox::getParam('user.profile_use_id') && !Phpfox::getParam('user.disable_username_on_sign_up') ? $aVals['user_name'] : '', 'iTimeZonePosted' => isset($aVals['time_zone']) ? $aVals['time_zone'] : 0));
                 if (Phpfox::getParam('user.multi_step_registration_form')) {
                     $this->template()->assign('bIsPosted', true);
                 }
                 $this->setParam(array('country_child_value' => isset($aVals['country_iso']) ? $aVals['country_iso'] : 0, 'country_child_id' => isset($aVals['country_child_id']) ? $aVals['country_child_id'] : 0));
             }
         }
     } else {
         if ($sSentCookie = Phpfox::getCookie('invited_by_email_form')) {
             $this->template()->assign('aForms', array('email' => $sSentCookie));
         }
     }
     $sTitle = Phpfox::getPhrase('user.sign_and_start_using_site', array('site' => Phpfox::getParam('core.site_title')));
     ($sPlugin = Phpfox_Plugin::get('user.component_controller_register_8')) ? eval($sPlugin) : false;
     $this->template()->setTitle($sTitle)->setFullSite()->setPhrase(array('user.continue'))->setHeader('cache', array('register.css' => 'module_user', 'register.js' => 'module_user', 'country.js' => 'module_core'))->assign(array('sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm(), 'sSiteUrl' => Phpfox::getParam('core.path'), 'aTimeZones' => Phpfox::getService('core')->getTimeZones(), 'aPackages' => Phpfox::isModule('subscribe') ? Phpfox::getService('subscribe')->getPackages(true) : null, 'aSettings' => Phpfox::getService('custom')->getForEdit(array('user_main', 'user_panel', 'profile_panel'), null, null, true), 'sDobStart' => Phpfox::getParam('user.date_of_birth_start'), 'sDobEnd' => Phpfox::getParam('user.date_of_birth_end'), 'sJanrainUrl' => Phpfox::isModule('janrain') ? Phpfox::getService('janrain')->getUrl() : '', 'sUserEmailCookie' => Phpfox::getCookie('invited_by_email_form'), 'sSiteTitle' => Phpfox::getParam('core.site_title'), 'aCitys' => Phpfox::getService('community')->getAllCity()));
 }
开发者ID:laiello,项目名称:kr-indian,代码行数:101,代码来源:register.class.php

示例8: getThread

 public function getThread($aThreadCondition = array(), $mConditions = array(), $sOrder = 'fp.time_stamp ASC', $iPage = '', $iPageSize = '', $sPermaView = null)
 {
     if (Phpfox::getParam('forum.forum_database_tracking')) {
         $this->database()->select('ftr.thread_id AS is_seen, ftr.time_stamp AS last_seen_time, ')->leftJoin(Phpfox::getT('forum_thread_track'), 'ftr', 'ftr.thread_id = ft.thread_id AND ftr.user_id = ' . Phpfox::getUserId());
     }
     $aThread = $this->database()->select('ft.thread_id, ft.time_stamp, ft.time_update, ft.group_id, ft.view_id, ft.forum_id, ft.is_closed, ft.user_id, ft.is_announcement, ft.order_id, ft.title_url, ft.time_update AS last_time_stamp, ft.title, fs.subscribe_id AS is_subscribed, ft.poll_id')->from($this->_sTable, 'ft')->leftJoin(Phpfox::getT('forum_subscribe'), 'fs', 'fs.thread_id = ft.thread_id AND fs.user_id = ' . Phpfox::getUserId())->where($aThreadCondition)->execute('getSlaveRow');
     if (!isset($aThread['thread_id'])) {
         return array(0, array());
     }
     if (!isset($aThread['is_seen'])) {
         $aThread['is_seen'] = 0;
     }
     // Thread not seen
     if (!$aThread['is_seen']) {
         // User has signed up after the post so they have already seen the post
         if (Phpfox::isUser() && Phpfox::getUserBy('joined') > $aThread['last_time_stamp'] || !Phpfox::isUser() && Phpfox::getCookie('visit') > $aThread['last_time_stamp']) {
             $aThread['is_seen'] = 1;
         } elseif (($iLastTimeViewed = Phpfox::getLib('session')->getArray('forum_view', $aThread['thread_id'])) && (int) $iLastTimeViewed > $aThread['last_time_stamp']) {
             $aThread['is_seen'] = 1;
         } elseif (PHPFOX_TIME - Phpfox::getParam('forum.keep_active_posts') * 60 > $aThread['last_time_stamp']) {
             $aThread['is_seen'] = 1;
         }
         // http://www.phpfox.com/tracker/view/14893/
         /*elseif (!empty($aThread['last_time_stamp']) && Phpfox::isUser() && $aThread['last_time_stamp'] < Phpfox::getCookie('last_login'))
         		{
         			$aThread['is_seen'] = 1;
         		}*/
     } else {
         // New post was added
         if ($aThread['last_time_stamp'] > $aThread['last_seen_time']) {
             $aThread['is_seen'] = 0;
         }
     }
     $sViewId = ' AND fp.view_id = 0';
     if (Phpfox::getUserParam('forum.can_approve_forum_post') || Phpfox::getService('forum.moderate')->hasAccess($aThread['forum_id'], 'approve_post')) {
         $sViewId = '';
     }
     $mConditions[] = 'fp.thread_id = ' . $aThread['thread_id'] . $sViewId;
     $iCnt = $this->database()->select('COUNT(*)')->from(Phpfox::getT('forum_post'), 'fp')->where($mConditions)->execute('getSlaveField');
     $aThread['last_update_on'] = '';
     if ($sPermaView !== null) {
         $iCurrentPage = Phpfox::getService('forum.post')->getPostPage($aThread['thread_id'], $sPermaView, $iPageSize);
         $mConditions[] = 'AND fp.post_id = ' . (int) $sPermaView;
     }
     if (!empty($aThread['poll_id']) && Phpfox::isModule('poll')) {
         $aThread['poll'] = Phpfox::getService('poll')->getPollByUrl((int) $aThread['poll_id']);
         $aThread['poll']['bCanEdit'] = false;
     }
     ($sPlugin = Phpfox_Plugin::get('forum.service_thread_getthread_query')) ? eval($sPlugin) : false;
     if (!isset($bLeftJoinQuery)) {
         $bLeftJoinQuery = false;
     }
     $theJoins = function () use($bLeftJoinQuery) {
         if (isset($bLeftJoinQuery) && $bLeftJoinQuery !== false) {
             $this->database()->leftJoin(Phpfox::getT('user'), 'u', 'u.user_id = fp.user_id')->leftJoin(Phpfox::getT('user_field'), 'uf', 'uf.user_id = fp.user_id');
         } else {
             $this->database()->join(Phpfox::getT('user'), 'u', 'u.user_id = fp.user_id')->join(Phpfox::getT('user_field'), 'uf', 'uf.user_id = fp.user_id');
         }
         if (Phpfox::isModule('like')) {
             $this->database()->select('l.like_id AS is_liked, ')->leftJoin(Phpfox::getT('like'), 'l', 'l.type_id = \'forum_post\' AND l.item_id = fp.post_id AND l.user_id = ' . Phpfox::getUserId());
         }
     };
     if (!$iPage) {
         $theJoins();
         $aThread['post_starter'] = $this->database()->select('fp.*, ' . (Phpfox::getParam('core.allow_html') ? 'fpt.text_parsed' : 'fpt.text') . ' AS text, ' . Phpfox::getUserField() . ', u.joined, u.country_iso, uf.signature, uf.total_post')->from(Phpfox::getT('forum_post'), 'fp')->join(Phpfox::getT('forum_post_text'), 'fpt', 'fpt.post_id = fp.post_id')->where($mConditions)->order('fp.time_stamp ASC')->limit(1)->get();
     }
     if (!$iPage) {
         $iPageSize = 4;
         $sOrder = 'fp.time_stamp DESC';
     }
     $theJoins();
     $aThread['posts'] = $this->database()->select('fp.*, ' . (Phpfox::getParam('core.allow_html') ? 'fpt.text_parsed' : 'fpt.text') . ' AS text, ' . Phpfox::getUserField() . ', u.joined, u.country_iso, uf.signature, uf.total_post')->from(Phpfox::getT('forum_post'), 'fp')->join(Phpfox::getT('forum_post_text'), 'fpt', 'fpt.post_id = fp.post_id')->where($mConditions)->order($sOrder)->limit($iPage, $iPageSize, $iCnt, false, false)->execute('getSlaveRows');
     if (!count($aThread['posts'])) {
         throw error('no_items');
     }
     if (isset($aThread['post_starter'])) {
         // $aThread['posts'] = array_merge($aThread['post_starter'], $aThread['posts']);
         $aThread['posts'][] = $aThread['post_starter'];
         $aThread['posts'] = array_reverse($aThread['posts']);
     }
     $sPostIds = '';
     $iTotal = $iPage > 1 ? $iPageSize * $iPage - $iPageSize : 0;
     foreach ($aThread['posts'] as $iKey => $aPost) {
         $iTotal++;
         /*
         if ($aPost['cache_name']) {
         	$aThread['posts'][$iKey]['user_id'] = 0;
         	$aThread['posts'][$iKey]['user_image'] = '';
         	$aThread['posts'][$iKey]['full_name'] = $aPost['cache_name'];
         	$aThread['posts'][$iKey]['no_link'] = true;
         }
         */
         $aThread['posts'][$iKey]['count'] = $sPermaView === null ? $iTotal : Phpfox::getService('forum.post')->getPostCount();
         $aThread['posts'][$iKey]['forum_id'] = $aThread['forum_id'];
         $aThread['posts'][$iKey]['last_update_on'] = Phpfox::getPhrase('forum.last_update_on_time_stamp_by_update_user', array('time_stamp' => Phpfox::getTime(Phpfox::getParam('forum.forum_time_stamp'), $aPost['update_time']), 'update_user' => $aPost['update_user']));
         $aThread['posts'][$iKey]['aFeed'] = array('privacy' => 0, 'comment_privacy' => 0, 'like_type_id' => 'forum_post', 'feed_is_liked' => $aPost['is_liked'] ? true : false, 'item_id' => $aPost['post_id'], 'user_id' => $aPost['user_id'], 'total_like' => $aPost['total_like'], 'feed_link' => Phpfox::permalink('forum.thread', $aThread['thread_id'], $aThread['title']) . 'view_' . $aPost['post_id'] . '/', 'feed_title' => $aThread['title'], 'feed_display' => 'mini', 'feed_total_like' => $aPost['total_like'], 'report_module' => 'forum_post', 'report_phrase' => Phpfox::getPhrase('forum.report_this_post'), 'force_report' => true, 'time_stamp' => $aPost['time_stamp'], 'type_id' => 'forum_post');
         if (Phpfox::isModule('like') && Phpfox::isModule('feed')) {
             $aThread['posts'][$iKey]['aFeed']['feed_like_phrase'] = Feed_Service_Feed::instance()->getPhraseForLikes($aThread['posts'][$iKey]['aFeed']);
         }
         if (isset($aThread['post_starter']) && $aThread['post_starter']['post_id'] == $aPost['post_id']) {
//.........这里部分代码省略.........
开发者ID:JerwinPRO,项目名称:phpfox,代码行数:101,代码来源:thread.class.php

示例9: getLastLogin

	public function getLastLogin()
	{
		static $aUser = null;
		
		if ($aUser !== null)
		{
			return $aUser;
		}
		
		$this->database()->join(Phpfox::getT('user'), 'u', 'u.user_id = pl.user_id');
		
		if (($sPlugin = Phpfox_Plugin::get('pages.service_pages_getlastlogin')))
		{
			eval($sPlugin);
		}		
		
		$aUser = $this->database()->select(Phpfox::getUserField() . ', u.email, u.style_id, u.password')
			->from(Phpfox::getT('pages_login'), 'pl')			
			->where('pl.login_id = ' . (int) Phpfox::getCookie('page_login') . ' AND pl.page_id = ' . Phpfox::getUserBy('profile_page_id'))
			->execute('getSlaveRow');
		
		if (!isset($aUser['user_id']))
		{
			$aUser = false;
			
			return false;
		}
		
		return $aUser;
	}
开发者ID:hoanghd,项目名称:tools,代码行数:30,代码来源:pages.class.php

示例10: getHashForUpload

	/**
	 * Refreshes and returns the hash that allows SWFU file uploads. This is used
	 * together with the auth service to allow the massuploader
	 * @return string
	 */
	public function getHashForUpload()
	{			
		Phpfox::getLib('database')->delete(Phpfox::getT('upload_track'), 'user_id = ' . Phpfox::getUserId());
		$sHash = md5(uniqid() . Phpfox::getUserBy('email') . uniqid() . Phpfox::getUserBy('password_salt'));
	
		/*
		$hFile = fopen(PHPFOX_DIR_FILE . 'create.log', 'a+');
		fwrite($hFile, $sHash . "\n");
		fclose($hFile);		
		*/
		
		Phpfox::getLib('database')->insert(Phpfox::getT('upload_track'), array(
			'user_id' => Phpfox::getUserId(),
			'hash' => $sHash,
			'user_hash' => Phpfox::getLib('parse.input')->clean(Phpfox::getCookie('user_hash')),
			'ip_address' => $_SERVER['REMOTE_ADDR']
				));
		return $sHash;
	}
开发者ID:hoanghd,项目名称:tools,代码行数:24,代码来源:core.class.php

示例11: isInviteOnly

 public function isInviteOnly()
 {
     if (Phpfox::getCookie('invite_only_pass') != '') {
         return false;
     }
     if (Phpfox::getParam('user.invite_only_community')) {
         return true;
     }
     return false;
 }
开发者ID:googlesky,项目名称:snsp.vn,代码行数:10,代码来源:invite.class.php

示例12: add


//.........这里部分代码省略.........
			$aVals['user_name'] = str_replace(' ', '_', $aVals['user_name']);
			$aInsert['user_name'] = $oParseInput->clean($aVals['user_name']);			
		}

		(($sPlugin = Phpfox_Plugin::get('user.service_process_add_start')) ? eval($sPlugin) : false);

		if (!Phpfox_Error::isPassed())
		{
			return false;
		}
		$iId = $this->database()->insert($this->_sTable, $aInsert);
		
		$aExtras = array(
			'user_id' => $iId
		);

		(($sPlugin = Phpfox_Plugin::get('user.service_process_add_extra')) ? eval($sPlugin) : false);

		$this->database()->insert(Phpfox::getT('user_activity'), $aExtras);
		$this->database()->insert(Phpfox::getT('user_field'), $aExtras);
		$this->database()->insert(Phpfox::getT('user_space'), $aExtras);
		$this->database()->insert(Phpfox::getT('user_count'), $aExtras);

		if (Phpfox::getParam('user.profile_use_id') || Phpfox::getParam('user.disable_username_on_sign_up'))
		{
			$this->database()->update($this->_sTable, array('user_name' => 'profile-' . $iId), 'user_id = ' . $iId);
		}
		
		if ($bHasImage)
		{
			$this->uploadImage($iId, true, null, true);
		}		

		((Phpfox::getCookie('invited_by_email') || Phpfox::getCookie('invited_by_user')) ? Phpfox::getService('invite.process')->registerInvited($iId) : null);

		(($sPlugin = Phpfox_Plugin::get('user.service_process_add_feed')) ? eval($sPlugin) : false);
		
		if (!defined('PHPFOX_INSTALLER') && !Phpfox::getParam('user.verify_email_at_signup') && !Phpfox::getParam('user.approve_users') && !isset($bDoNotAddFeed))
		{
			//(Phpfox::isModule('feed') ? Phpfox::getService('feed.process')->allowGuest()->add('user_joined', $iId, null, $iId) : null);
		}

		if (isset($aVals['country_child_id']))
		{
			Phpfox::getService('user.field.process')->update($iId, 'country_child_id', $aVals['country_child_id']);
		}
		
		if (!defined('PHPFOX_INSTALLER') && Phpfox::getParam('core.registration_enable_dob'))
		{
			// Updating for the birthday range
			$this->database()->update(Phpfox::getT('user_field'), array('birthday_range' => '\''.Phpfox::getService('user')->buildAge($aVals['day'], $aVals['month']) .'\''), 'user_id = ' . $iId, false);
		}
		
		if (!defined('PHPFOX_INSTALLER'))
		{
			$iFriendId = (int) Phpfox::getParam('user.on_signup_new_friend');
			if ($iFriendId > 0)
			{
				$this->database()->insert(Phpfox::getT('friend'), array(
						'list_id' => 0,
						'user_id' => $iId,
						'friend_user_id' => $iFriendId,
						'time_stamp' => PHPFOX_TIME
					)
				);
				
开发者ID:hoanghd,项目名称:tools,代码行数:66,代码来源:process.class.php

示例13: setUserSession


//.........这里部分代码省略.........
							'user_agent' => $_SERVER['HTTP_USER_AGENT'],
							'request' => (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST' ? serialize($_POST) : serialize($_GET))
						)
					),
					'time_stamp' => PHPFOX_TIME
				)
			);
		}

		/**
		 * @todo Needs to be added into the 'setting' db table
		 */
		$aDisAllow = array(
			'captcha/image'
		);
		
		// Don't log a session into the DB if we disallow it
		if (Phpfox::getLib('url')->isUrl($aDisAllow))
		{
			return;
		}	
		
		$bIsForum = (strstr($sLocation, Phpfox::getParam('core.module_forum')) ? true : false);
		$iForumId = 0;
		if ($bIsForum)
		{
			$aForumIds = explode('-', $oRequest->get('req2'));
			if (isset($aForumIds[(count($aForumIds) - 1)]))
			{
				$iForumId = (int) $aForumIds[(count($aForumIds) - 1)];				
			}			
		}
		
		$iIsHidden = 0;
		if (Phpfox::isUser())
		{
			if (Phpfox::getUserBy('im_hide'))
			{
				$iIsHidden = 1;	
			}			
		}
		
		if (!isset($this->_aSession['session_hash']))
		{
			$sSessionHash = $oRequest->getSessionHash();
			$this->database()->insert($this->_sTable, array(
					'session_hash' => $sSessionHash,
					'id_hash' => $oRequest->getIdHash(),
					'user_id' => Phpfox::getUserId(),
					'last_activity' => PHPFOX_TIME,
					'location' => $sLocation,
					'is_forum' => ($bIsForum ? '1' : '0'),
					'forum_id' => $iForumId,
					'im_hide' => $iIsHidden,
					'ip_address' => $sIp,
					'user_agent' => $sBrowser
				)
			);
			$oSession->set('session', $sSessionHash);
		}
		else 
		{
			$this->database()->update($this->_sTable, array(
				'last_activity' => PHPFOX_TIME, 
				'user_id' => Phpfox::getUserId(),
				"location" => $sLocation,
				"is_forum" => ($bIsForum ? "1" : "0"),
				"forum_id" => $iForumId,
				'im_hide' => $iIsHidden,
				"ip_address" => $sIp,
				"user_agent" => $sBrowser
			),"session_hash = '" . $this->_aSession["session_hash"] . "'");	
		}
		
		if (!Phpfox::getCookie('visit'))
		{
			Phpfox::setCookie('visit', PHPFOX_TIME);			
		}		
		
		if (Phpfox::isUser())
		{
			if (!Phpfox::getCookie('last_login'))
			{			
				Phpfox::setCookie('last_login', PHPFOX_TIME, (PHPFOX_TIME + (Phpfox::getParam('log.active_session') * 60)));
				if (Phpfox::getUserBy('last_activity') < (PHPFOX_TIME + (Phpfox::getParam('log.active_session') * 60)))
				{
					$this->database()->update(Phpfox::getT('user'), array('last_login' => PHPFOX_TIME), 'user_id = ' . Phpfox::getUserId());
					$this->database()->insert(Phpfox::getT('user_ip'), array(
							'user_id' => Phpfox::getUserId(),
							'type_id' => 'session_login',
							'ip_address' => Phpfox::getIp(),
							'time_stamp' => PHPFOX_TIME
						)
					);	
				}
			}		
			
			$this->database()->update(Phpfox::getT('user'), array('last_activity' => PHPFOX_TIME, 'last_ip_address' => Phpfox::getIp()), 'user_id = ' . Phpfox::getUserId());
		}
	}
开发者ID:hoanghd,项目名称:tools,代码行数:101,代码来源:session.class.php

示例14: process

	/**
	 * Class process method wnich is used to execute this component.
	 */
	public function process()
	{
		// When they first submit the newsletter this block adds it to the ongoing or scheduling
		if ($aVals = $this->request()->getArray('val'))
		{			
			$aNewsletter = Phpfox::getService('newsletter.process')->add($aVals, Phpfox::getUserId());
			if ($aNewsletter['state'] == 1)
			{
				$this->url()->send('admincp.newsletter.add', array('job' => $aNewsletter['newsletter_id']), Phpfox::getPhrase('newsletter.processing_job_newsletter_id', array('newsletter_id' => $aNewsletter['newsletter_id'])));
			}
			elseif ($aNewsletter === false)
			{
			}
			else
			{
				$this->url()->send('admincp.newsletter.manage', null, null);
			}
		}
		// when refreshed by the flow we should get an integer here pointing to the pending job
		elseif ($iJob = $this->request()->getInt('job'))
		{
			list($iContinue,$iPerc) = Phpfox::getService('newsletter.process')->processJob($iJob);			
			if (is_int($iContinue) && $iPerc < 100)
			{
				$sMessage = Phpfox::getPhrase('newsletter.5_seconds_break_processing_job_continue_total_completed_perc', array('continue' => $iContinue, 'perc' => $iPerc));
				$sLink = $this->url()->makeUrl('admincp.newsletter.add', array('job' => $iContinue));
				$this->template()->setHeader('<META HTTP-EQUIV="refresh" content="5;URL='.$sLink.'">')
					->assign(array('sMessage' => $sMessage));
				//$this->url()->send('admincp.newsletter.add', array('job' => $iContinue));
			}
			elseif ($iContinue === true || $iPerc >= 100) // completed successfully
			{
				$this->url()->send('admincp.newsletter.manage', null, Phpfox::getPhrase('newsletter.job_completed_successfully'));
			}
			elseif ($iContinue === false)
			{
				$this->url()->send('admincp.newsletter.manage', null, Phpfox::getPhrase('newsletter.there_was_a_problem_with_this_job_feel_free_to_resume_it_at_any_time'));
			}
		}
		if ($iId = $this->request()->getInt('id') || $iId = $this->request()->getInt('job'))
		{
			$aNewsletter = Phpfox::getService('newsletter')->get($iId);
			$this->template()->assign(array(
					'aForms' => $aNewsletter
				)
			);
		}
		$aValidation = array(
			'type_id' => array(
				'title' => Phpfox::getPhrase('newsletter.select_a_newsletter_type'),
				'def' => 'int'
			),
		);

		// 2 = html; 1 = plain text;
		$oValidator = Phpfox::getLib('validator')->set(array('sFormName' => 'js_form', 'aParams' => $aValidation));
		$aAge = array();
		for ($i = 18; $i <= 68; $i++)
		{
			$aAge[$i] = $i;
		}
		$this->template()->assign(array(
				'aAge' => $aAge,
				'aUserGroups' => Phpfox::getService('user.group')->get(),
				'sCreateJs' => $oValidator->createJS(),
				'sGetJsForm' => $oValidator->getJsForm()
			)
		)
		->setTitle(Phpfox::getPhrase('newsletter.newsletter'))
		->setBreadCrumb(Phpfox::getPhrase('newsletter.newsletter'),  $this->url()->makeUrl('admincp.newsletter.add'))
		->setBreadCrumb(Phpfox::getPhrase('newsletter.add_newsletter'), null, true)
		->setPhrase(array(
				'newsletter.min_age_cannot_be_higher_than_max_age',
				'newsletter.max_age_cannot_be_lower_than_the_min_age'
			)
		)		
		->setEditor(array(
					'wysiwyg' => Phpfox::getCookie('editor_wysiwyg'),
					'toggle' => Phpfox::getCookie('editor_wysiwyg')
				)
			)
		->setHeader(array('add.js' => 'module_newsletter'));
	}
开发者ID:hoanghd,项目名称:tools,代码行数:86,代码来源:add.class.php

示例15: setController

 /**
  * Sets the controller for the page we are on. This method controlls what component to load, which 
  * will be used to display the content on that page.
  *
  * @param string $sController (Optional) We find the controller by default, however you can override our default findings by passing the name of the controller with this argument.
  */
 public function setController($sController = '')
 {
     if ($sController) {
         $aParts = explode('.', $sController);
         $this->_sModule = $aParts[0];
         $this->_sController = substr_replace($sController, '', 0, strlen($this->_sModule . '_'));
         $this->getModuleBlocks(1, true);
         ($sPlugin = Phpfox_Plugin::get('set_defined_controller')) ? eval($sPlugin) : false;
         // Reset the lang. pack cache since we are using a new controller
         if (Phpfox::getParam('language.cache_phrases')) {
             Phpfox::getLib('locale')->cache();
             Phpfox::getLib('locale')->setCache();
         }
         $this->getController();
         return;
     }
     ($sPlugin = Phpfox_Plugin::get('module_setcontroller_start')) ? eval($sPlugin) : false;
     $oUrl = Phpfox::getLib('url');
     $oReq = Phpfox::getLib('request');
     $oPage = Phpfox::getService('page');
     $this->_sModule = ($sReq1 = $oReq->get('req1')) ? strtolower($sReq1) : Phpfox::getParam('core.module_core');
     if (Phpfox::isMobile() && empty($sReq1)) {
         $this->_sModule = 'mobile';
     }
     if (($sFrame = $oReq->get('frame')) && in_array($sFrame, $this->_aFrames)) {
         $aFrameParts = explode('-', $sFrame);
         $this->_sModule = strtolower($aFrameParts[0]);
         $this->_sController = strtolower($aFrameParts[1]);
     }
     $this->_aPages = $oPage->getCache();
     if (isset($this->_aPages[$oReq->get('req1')])) {
         $this->_sModule = 'page';
         $this->_sController = 'view';
     }
     $sDir = PHPFOX_DIR_MODULE . $this->_sModule . PHPFOX_DS;
     if ($oReq->get('req2') == Phpfox::getParam('admincp.admin_cp')) {
         Phpfox::getLib('url')->send($oReq->get('req2') . '.' . $oReq->get('req1'));
     }
     if ($oReq->get('req1') == 'admincp' && Phpfox::getParam('admincp.admin_cp') != 'admincp') {
         Phpfox::getLib('url')->send('error.404');
     }
     if ($oReq->get('req2') && file_exists($sDir . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . strtolower($oReq->get('req2')) . '.class.php')) {
         $this->_sController = strtolower($oReq->get('req2'));
     } elseif (strtolower($this->_sModule) != Phpfox::getParam('admincp.admin_cp') && $oReq->get('req3') && file_exists($sDir . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . strtolower($oReq->get('req2')) . PHPFOX_DS . strtolower($oReq->get('req3')) . '.class.php')) {
         $this->_sController = strtolower($oReq->get('req2') . '.' . $oReq->get('req3'));
     } elseif (strtolower($this->_sModule) != Phpfox::getParam('admincp.admin_cp') && $oReq->get('req2') && file_exists($sDir . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . strtolower($oReq->get('req2')) . PHPFOX_DS . 'index.class.php')) {
         $this->_sController = strtolower($oReq->get('req2')) . '.index';
     } else {
         // Over-ride the index page to display the content for guests or members
         if ($this->_sModule == Phpfox::getParam('core.module_core') && $this->_sController == 'index' && Phpfox::getParam('core.module_core') == PHPFOX_MODULE_CORE) {
             $this->_sController = Phpfox::isUser() ? 'index-member' : 'index-visitor';
         }
         if (!file_exists($sDir . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . $this->_sController . '.class.php')) {
             $this->_sModule = 'profile';
         }
         ($sPlugin = Phpfox_Plugin::get('set_controller_else_end')) ? eval($sPlugin) : false;
     }
     if ($this->_sModule == 'theme') {
         if (preg_match('/^(.*?)\\.(jpg|jpeg|gif|png|css|js)$/i', $_GET[PHPFOX_GET_METHOD])) {
             $this->_sModule = 'error';
             $this->_sController = '404';
         }
     }
     if ($this->_sModule != 'profile' && !isset($this->_aModules[$this->_sModule])) {
         $this->_sModule = 'error';
         $this->_sController = '404';
     }
     if (Phpfox::getParam('admincp.admin_cp') != 'admincp' && $oReq->get('req1') == Phpfox::getParam('admincp.admin_cp')) {
         $this->_sModule = 'admincp';
     }
     ($sPlugin = Phpfox_Plugin::get('module_setcontroller_end')) ? eval($sPlugin) : false;
     // Set the language pack cache
     if (Phpfox::getParam('language.cache_phrases')) {
         Phpfox::getLib('locale')->setCache();
     }
     $bCookie = Phpfox::getCookie('page_login') && Phpfox::getUserBy('profile_page_id') > 0;
     if (Phpfox::isUser() && $bCookie != 1 && Phpfox::getUserParam('user.require_profile_image') && Phpfox::getUserBy('user_image') == '' && !($this->_sModule == 'user' && $this->_sController == 'photo' || $this->_sModule == 'user' && $this->_sController == 'logout' || $this->_sModule == 'subscribe')) {
         Phpfox::getLib('url')->send('user.photo', null, Phpfox::getPhrase('user.you_are_required_to_upload_a_profile_image'));
     }
     if (Phpfox::getParam('core.force_https_secure_pages')) {
         $sController = str_replace('mobile.', '', $this->getFullControllerName());
         if ($sController == 'core.index-member' || $sController == 'core.index-visitor') {
             // fixes 14276
             $sController = '';
         }
         if (in_array(str_replace('mobile.', '', $this->getFullControllerName()), Phpfox::getService('core')->getSecurePages())) {
             if (!isset($_SERVER['HTTPS'])) {
                 Phpfox::getLib('url')->send($sController);
             }
         } else {
             if (Phpfox::getParam('core.force_secure_site')) {
                 if (!isset($_SERVER['HTTPS'])) {
                     Phpfox::getLib('url')->send($sController);
                 }
//.........这里部分代码省略.........
开发者ID:Lovinity,项目名称:EQM,代码行数:101,代码来源:module.class.php


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