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


PHP Phpfox_Error类代码示例

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


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

示例1: process

 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     if (isset($_POST['token']) && strlen($_POST['token']) == 40) {
         $aPost = array('token' => $_POST['token'], 'apiKey' => Phpfox::getParam('janrain.janrain_api_key'), 'format' => 'json', 'extended' => 'true');
         $sResult = Phpfox::getLib('request')->send('https://rpxnow.com/api/v2/auth_info', $aPost);
         $aInfo = json_decode($sResult, true);
         if ($aInfo['stat'] == 'ok') {
             $aUserInfo = $aInfo['profile'];
             if ($aUser = Phpfox::getService('janrain')->getUser($aUserInfo)) {
                 list($bIsLoggedIn, $aPostUserInfo) = Phpfox::getService('user.auth')->login($aUser['user_name'], null, false, 'user_name', true);
                 if ($bIsLoggedIn) {
                     $this->url()->send(Phpfox::getParam('user.redirect_after_login'));
                 }
             } else {
                 if (Phpfox::getService('janrain.process')->add($aUserInfo)) {
                     $aUser = Phpfox::getService('janrain')->getUser($aUserInfo);
                     if ($sPlugin = Phpfox_Plugin::get('janrain.component_controller_rpx_1')) {
                         eval($sPlugin);
                         if (isset($mReturnFromPlugin)) {
                             return $mReturnFromPlugin;
                         }
                     }
                     list($bIsLoggedIn, $aPostUserInfo) = Phpfox::getService('user.auth')->login($aUser['user_name'], null, false, 'user_name', true);
                     if ($bIsLoggedIn) {
                         $this->url()->send('user.setting', null, Phpfox::getPhrase('janrain.your_account_has_successfully_been_created_please_enter_your_account_details_below'));
                     }
                 }
             }
         } else {
             Phpfox_Error::set($aInfo['err']['msg']);
         }
     } else {
         Phpfox_Error::set('Authentication canceled.');
     }
 }
开发者ID:googlesky,项目名称:snsp.vn,代码行数:38,代码来源:rpx.class.php

示例2: process

 /**
  * Controller
  */
 public function process()
 {
     if ($iCommentId = $this->request()->getInt('req3')) {
         $aComment = Phpfox::getService('comment')->getComment($iCommentId);
         if (!isset($aComment['comment_id'])) {
             return Phpfox_Error::display(Phpfox::getPhrase('comment.comment_does_not_exist'));
         }
         if (Phpfox::hasCallback('comment', 'getRedirectRequest')) {
             $this->url()->forward(Phpfox::callback('comment.getRedirectRequest', $aComment['comment_id']));
         }
         if (Phpfox::hasCallback($aComment['type_id'], 'getParentItemCommentUrl')) {
             $sNewUrl = Phpfox::callback($aComment['type_id'] . '.getParentItemCommentUrl', $aComment);
             if ($sNewUrl !== false) {
                 $aComment['callback_url'] = $sNewUrl;
             }
         }
         $this->template()->setTitle(Phpfox::getPhrase('comment.viewing_comment'))->setHeader(array('view.css' => 'module_comment'))->setBreadcrumb(Phpfox::getPhrase('comment.viewing_comment'))->assign(array('aComment' => $aComment));
     } else {
         $aComment = Phpfox::getService('comment')->getComment($this->request()->getInt('id'));
         if (!isset($aComment['comment_id'])) {
             return Phpfox_Error::display(Phpfox::getPhrase('comment.comment_does_not_exist'));
         }
         $this->url()->forward(Phpfox::callback('comment.getRedirectRequest', $aComment['comment_id']));
     }
 }
开发者ID:nima7r,项目名称:phpfox-dist,代码行数:28,代码来源:view.class.php

示例3: __get

 /**
  * Gets a param that is part of this component group.
  *
  * @param string $sData Param name.
  * @return mixed If param exists we return the param value otherwise we return NULL.
  */
 public function __get($sData)
 {
     if (isset(self::$_aParams[$this->_sCacheVar][$sData])) {
         return self::$_aParams[$this->_sCacheVar][$sData];
     }
     Phpfox_Error::trigger('Undefined property: ' . $sData, E_USER_ERROR);
 }
开发者ID:nima7r,项目名称:phpfox-dist,代码行数:13,代码来源:component.class.php

示例4: process

 /**
  * Controller
  */
 public function process()
 {
     $this->_setMenuName('admincp.user.cancellations.add');
     // is user trying to edit or add an item?
     if ($aVals = $this->request()->getArray('val')) {
         if (Phpfox::getService('user.cancellations.process')->add($aVals)) {
             if (isset($aVals['iDeleteId'])) {
                 $sMessage = Phpfox::getPhrase('user.option_updated_successfully');
             } else {
                 $sMessage = Phpfox::getPhrase('user.option_added_successfully');
             }
             $this->url()->send('admincp.user.cancellations.manage', null, $sMessage);
         }
     }
     // is user requesting an item for edit?
     if ($iId = $this->request()->getInt('id')) {
         $aDelete = Phpfox::getService('user.cancellations')->get($iId);
         if (empty($aDelete)) {
             Phpfox_Error::set(Phpfox::getPhrase('user.item_not_found'));
         }
         $aDelete = reset($aDelete);
         $this->template()->assign(array('aForms' => $aDelete));
     }
     $this->template()->setTitle(Phpfox::getPhrase('user.add_cancellation_options'))->setBreadcrumb(Phpfox::getPhrase('user.add_cancellation_options'), $this->url()->makeUrl('admincp.user.cancellations.add'), true)->assign(array());
 }
开发者ID:lev1976g,项目名称:core,代码行数:28,代码来源:add.class.php

示例5: process

 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     if ($aVals = $this->request()->getArray('val')) {
         Phpfox::isUser(true);
         Phpfox::getUserParam('comment.can_post_comments', true);
         if (($iFlood = Phpfox::getUserParam('comment.comment_post_flood_control')) !== 0) {
             $aFlood = array('action' => 'last_post', 'params' => array('field' => 'time_stamp', 'table' => Phpfox::getT('comment'), 'condition' => 'type_id = \'' . Phpfox::getLib('database')->escape($aVals['type']) . '\' AND user_id = ' . Phpfox::getUserId(), 'time_stamp' => $iFlood * 60));
             // actually check if flooding
             if (Phpfox::getLib('spam')->check($aFlood)) {
                 Phpfox_Error::set(Phpfox::getPhrase('comment.posting_a_comment_a_little_too_soon_total_time', array('total_time' => Phpfox::getLib('spam')->getWaitTime())));
             }
         }
         if (Phpfox::getLib('parse.format')->isEmpty($aVals['text'])) {
             Phpfox_Error::set(Phpfox::getPhrase('feed.add_some_text_to_your_comment'));
         }
         if (Phpfox_Error::isPassed() && ($iId = Phpfox::getService('comment.process')->add($aVals))) {
             $this->url()->send('feed.view', array('id' => $this->request()->getInt('id')), Phpfox::getPhrase('feed.successfully_added_your_comment'));
         }
     }
     if ($iLikeType = $this->request()->getInt('liketype')) {
         if (Phpfox::getService('feed.process')->like($this->request()->getInt('id'), $iLikeType)) {
             $this->url()->send('feed.view', array('id' => $this->request()->getInt('id')), $iLikeType == '1' ? Phpfox::getPhrase('feed.successfully_liked_this_feed') : Phpfox::getPhrase('feed.successfully_unliked_this_feed'));
         }
     }
     list($iFeedCount, $aFeeds) = Phpfox::getService('feed')->get(null, $this->request()->getInt('id'), 1);
     $iCommentCnt = 0;
     $aComments = array();
     if (Phpfox::getParam('feed.allow_comments_on_feeds')) {
         list($iCommentCnt, $aComments) = Phpfox::getService('comment')->get('cmt.*', array("AND cmt.type_id = 'feed'", 'AND cmt.item_id = ' . (int) $aFeeds[0]['feed_id'], 'AND cmt.view_id = 0'), 'cmt.time_stamp ASC');
     }
     if (!count($aFeeds)) {
         return Phpfox_Error::display(Phpfox::getPhrase('feed.not_a_valid_feed'));
     }
     $this->template()->setMobileHeader(array('feed.css' => 'module_feed'))->assign(array('iFeedId' => $aFeeds[0]['feed_id'], 'aFeeds' => $aFeeds, 'aComments' => $aComments));
 }
开发者ID:googlesky,项目名称:snsp.vn,代码行数:38,代码来源:view-mobile.class.php

示例6: process

 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     $aValidation = array('name' => Phpfox::getPhrase('photo.provide_a_name_for_your_photo_category'));
     $oValid = Phpfox::getLib('validator')->set(array('sFormName' => 'js_form', 'aParams' => $aValidation));
     if (($aOrder = $this->request()->getArray('order')) && Phpfox::getUserParam('photo.can_edit_photo_categories', true) && Phpfox::getService('photo.category.process')->updateOrder($aOrder)) {
         $this->url()->send('admincp.photo', null, Phpfox::getPhrase('photo.photo_category_order_successfully_updated'));
     }
     if (!Phpfox::getUserParam('photo.can_add_public_categories') && !Phpfox::getUserParam('photo.can_edit_photo_categories')) {
         return Phpfox_Error::display(Phpfox::getPhrase('photo.invalid_section'));
     }
     if ($aVals = $this->request()->getArray('val')) {
         if ($oValid->isValid($aVals)) {
             if (isset($aVals['delete']) && Phpfox::getUserParam('photo.can_edit_photo_categories', true)) {
                 if (Phpfox::getService('photo.category.process')->delete($aVals['edit_id'])) {
                     $this->url()->send('admincp.photo', null, Phpfox::getPhrase('photo.photo_category_successfully_deleted'));
                 }
             } else {
                 if (isset($aVals['edit_id'])) {
                     Phpfox::getUserParam('photo.can_edit_photo_categories', true);
                     if (Phpfox::getService('photo.category.process')->update($aVals)) {
                         $this->url()->send('admincp.photo', null, Phpfox::getPhrase('photo.photo_category_successfully_updated'));
                     }
                 } else {
                     Phpfox::getUserParam('photo.can_add_public_categories', true);
                     if (Phpfox::getService('photo.category.process')->add($aVals)) {
                         $this->url()->send('admincp.photo', null, Phpfox::getPhrase('photo.photo_category_successfully_added'));
                     }
                 }
             }
         }
     }
     $this->template()->setTitle(Phpfox::getPhrase('photo.manage_photo_categories'))->setBreadCrumb(Phpfox::getPhrase('photo.manage_photo_categories'), $this->url()->makeUrl('admincp.photo'))->setHeader('cache', array('admin.js' => 'module_photo', 'jquery/ui.js' => 'static_script', 'sort.js' => 'module_photo'))->assign(array('sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm()));
 }
开发者ID:Lovinity,项目名称:EQM,代码行数:36,代码来源:index.class.php

示例7: process

 public function process()
 {
     if ($aVals = $this->request()->getArray('val')) {
         if (Phpfox::getService('custom.relation.process')->add($aVals)) {
             $this->url()->send('admincp.custom.relationships', array(), Phpfox::getPhrase('custom.status_added'));
         }
     }
     if ($iId = $this->request()->getInt('delete')) {
         if (Phpfox::getService('custom.relation.process')->delete($iId)) {
             $this->url()->send('admincp.custom.relationships', array(), Phpfox::getPhrase('custom.status_deleted'));
         }
     }
     $aStatuses = Phpfox::getService('custom.relation')->getAll();
     /* If we're editing lets make it easier and just find the one we're looking for here */
     if ($iEdit = $this->request()->getInt('edit')) {
         $aEdit = array();
         foreach ($aStatuses as $aStatus) {
             if ($aStatus['relation_id'] == $iEdit) {
                 $aEdit = $aStatus;
                 break;
             }
         }
         if (empty($aEdit)) {
             Phpfox_Error::display(Phpfox::getPhrase('custom.not_found'));
         } else {
             $this->template()->assign(array('aEdit' => $aEdit));
         }
     }
     $this->template()->setTitle(Phpfox::getPhrase('custom.admin_menu_manage_relationships'))->setBreadcrumb(Phpfox::getPhrase('custom.admin_menu_manage_relationships'))->setPhrase(array())->assign(array('aStatuses' => $aStatuses));
 }
开发者ID:Lovinity,项目名称:EQM,代码行数:30,代码来源:relationships.class.php

示例8: process

 /**
  * Controller
  */
 public function process()
 {
     Phpfox::getUserParam('music.can_access_music', true);
     define('PHPFOX_SKIP_IM', true);
     $aAlbum = Phpfox::getService('music.album')->getForPlayer($this->request()->getInt('album'));
     $bPlayAll = $this->request()->getInt('play') == 1 ? true : false;
     if (!isset($aAlbum['album_id'])) {
         return Phpfox_Error::display(Phpfox::getPhrase('music.album_you_are_looking_for_cannot_be_found'));
     }
     $aTracks = Phpfox::getService('music.album')->getTracks($aAlbum['user_id'], $aAlbum['album_id']);
     $sPlaylist = '{';
     $sNextSong = '{';
     foreach ($aTracks as $iKey => $aTrack) {
         //$sPlaylist .= '{sPath : "' . $aTrack['song_path'] . '", iId : ' . $aTrack['song_id'] . '},';
         $sPlaylist .= '' . $aTrack['song_id'] . ' : "' . $aTrack['song_path'] . '",';
         if ($iKey > 0) {
             // adding this song's id to the previous song's index
             $sNextSong .= ' ' . $aTracks[$iKey - 1]['song_id'] . ' : ' . $aTracks[$iKey]['song_id'] . ',';
         }
     }
     // add the first song to the last song
     $sNextSong .= ' ' . $aTracks[$iKey]['song_id'] . ' : ' . $aTracks[0]['song_id'];
     $sNextSong .= '}';
     $sPlaylist = rtrim($sPlaylist, ',') . '}';
     $this->template()->setTitle($aAlbum['name'])->assign(array('aAlbum' => $aAlbum, 'bPlayAll' => true))->setHeader(array('blank.css' => 'style_css', '<script type="text/javascript">$Behavior.music_player_load_player = function() { $Core.player.load({id: \'js_music_player' . ($bPlayAll ? '_all' : '') . '\', type: \'music\', playlist: ' . $sPlaylist . ', aNextSong: ' . $sNextSong . '}); };</script>'))->setTemplate('blank');
 }
开发者ID:nima7r,项目名称:phpfox-dist,代码行数:29,代码来源:player.class.php

示例9: process

 /**
  * Controller
  */
 public function process()
 {
     Phpfox::isUser(true);
     if (!Phpfox::getUserParam('user.can_control_notification_privacy') && !Phpfox::getUserParam('user.can_control_profile_privacy')) {
         return Phpfox_Error::display(Phpfox::getPhrase('user.privacy_settings_have_been_disabled_for_your_user_group'));
     }
     if ($aVals = $this->request()->getArray('val')) {
         if (Phpfox::getService('user.privacy.process')->update($aVals)) {
             $this->url()->send('user.privacy', null, Phpfox::getPhrase('user.privacy_settings_successfully_updated'));
         }
     }
     list($aUserPrivacy, $aNotifications, $aProfiles, $aItems) = Phpfox::getService('user.privacy')->get();
     $aUserInfo = Phpfox::getService('user')->get(Phpfox::getUserId());
     ($sPlugin = Phpfox_Plugin::get('user.component_controller_index_process')) ? eval($sPlugin) : false;
     $aMenus = array('profile' => Phpfox::getPhrase('user.profile'), 'items' => Phpfox::getPhrase('user.items'), 'notifications' => Phpfox::getPhrase('user.notifications'), 'blocked' => Phpfox::getPhrase('user.blocked_users'));
     if (!Phpfox::isModule('privacy')) {
         unset($aMenus['items']);
     }
     if (Phpfox::getUserParam('user.can_be_invisible')) {
         // $aMenus['invisible'] = Phpfox::getPhrase('user.invisible_mode');
     }
     $this->template()->buildPageMenu('js_privacy_block', $aMenus, array('no_header_border' => true, 'link' => $this->url()->makeUrl(Phpfox::getUserBy('user_name')), 'phrase' => Phpfox::getPhrase('user.view_your_profile')));
     if ($this->request()->get('view') == 'blocked') {
         $this->template()->assign(array('bGoToBlocked' => true));
     }
     $this->template()->setTitle(Phpfox::getPhrase('user.privacy_settings'))->setBreadcrumb('Account', $this->url()->makeUrl('profile'))->setBreadcrumb(Phpfox::getPhrase('user.privacy_settings'), $this->url()->makeUrl('user.privacy'), true)->setFullSite()->setHeader(array('privacy.css' => 'module_user'))->assign(array('aForms' => $aUserPrivacy['privacy'], 'aPrivacyNotifications' => $aNotifications, 'aProfiles' => $aProfiles, 'aUserPrivacy' => $aUserPrivacy, 'aBlockedUsers' => Phpfox::getService('user.block')->get(), 'aUserInfo' => $aUserInfo, 'aItems' => $aItems));
 }
开发者ID:lev1976g,项目名称:core,代码行数:30,代码来源:privacy.class.php

示例10: process

 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     Phpfox::getUserParam('photo.can_view_photos', true);
     if (!Phpfox::getParam('photo.can_rate_on_photos')) {
         return Phpfox_Error::display(Phpfox::getPhrase('photo.photo_rating_is_disabled'));
     }
     Phpfox::getUserParam('photo.can_rate_on_photos', true);
     if ($iPhotoId = $this->request()->getInt('photo-id')) {
         Phpfox::getService('photo.rate.process')->add($this->request()->getInt('photo-id'), $this->request()->getInt('rating'));
     }
     $sCategory = null;
     if ($this->request()->get('req3') == 'category') {
         $sCategory = $this->request()->getInt('req4');
     }
     ($sPlugin = Phpfox_Plugin::get('photo.component_controller_rate_process_start')) ? eval($sPlugin) : false;
     $aPhoto = Phpfox::getService('photo.rate')->getForRating($sCategory, $this->request()->get('id', null));
     $sBar = '';
     for ($i = 1; $i <= 10; $i++) {
         $sBar .= '<li><a href="' . ($sCategory === null ? $this->url()->makeUrl('photo.rate', array('photo-id' => $aPhoto['photo_id'], 'rating' => $i)) : $this->url()->permalink('photo.rate.category', $this->request()->getInt('req4'), $this->request()->get('req5'), false, null, array('photo-id' => $aPhoto['photo_id'], 'rating' => $i))) . '" class="js_rating_bar">' . $i . '</a></li>';
     }
     $sBar .= '<li><a href="' . ($sCategory === null ? $this->url()->makeUrl('photo.rate') : $this->url()->permalink('photo.rate.category', $this->request()->getInt('req4'), $this->request()->get('req5'))) . '">' . Phpfox::getPhrase('photo.skip') . '</a></li>';
     $this->setParam('sPhotoCategorySubSystem', 'rate');
     $this->setParam('aPhoto', $aPhoto);
     $this->setParam('sCurrentCategory', $sCategory);
     Phpfox::getService('photo')->buildMenu();
     $this->template()->setTitle(Phpfox::getPhrase('photo.rate_photos'))->setBreadcrumb(Phpfox::getPhrase('photo.photos'), $this->url()->makeUrl('photo'))->setHeader('cache', array('rate_bar.css' => 'style_css'))->assign(array('sRatingBar' => $sBar, 'aPhoto' => $aPhoto, 'aCallback' => null));
     ($sPlugin = Phpfox_Plugin::get('photo.component_controller_rate_process_end')) ? eval($sPlugin) : false;
 }
开发者ID:googlesky,项目名称:snsp.vn,代码行数:31,代码来源:rate.class.php

示例11: process

	public function process($aFile)
	{
		return Phpfox_Error::set('Unable to import data using the current routine. Use the manual method of importing data.');
		
		if (!preg_match('/^(.*?)\.zip$/i', $aFile['name']))
		{
			return Phpfox_Error::set('Not a valid ZIP package.');
		}
		
		$sExt = 'zip';

		$sLocation = PHPFOX_DIR_CACHE  . md5(PHPFOX_TIME . uniqid() . $aFile['name']) . PHPFOX_DS;
		
		mkdir($sLocation);
		
		Phpfox::getLib('archive', $sExt)->extract($aFile['tmp_name'], $sLocation);
		
		$aFiles = Phpfox::getLib('file')->getAllFiles($sLocation);
		foreach ($aFiles as $sFile)
		{
			$sNewFile = str_replace($sLocation, '', $sFile);
			$aParts = explode(PHPFOX_DS, $sNewFile);
			unset($aParts[(count($aParts) - 1)]);
			$sDirPath = implode(PHPFOX_DS, $aParts);
			
			Phpfox::getLib('ftp')->mkdir(PHPFOX_DIR . $sDirPath, true);	
			Phpfox::getLib('ftp')->put($sFile, PHPFOX_DIR . $sNewFile);			
		}
		
		Phpfox::getLib('file')->delete_directory($sLocation);		
		
		return true;		
	}
开发者ID:hoanghd,项目名称:tools,代码行数:33,代码来源:import.class.php

示例12: changeEmail

 /**
  * Changes a user's email addres, checks if user is allowed and if he should be made verify their email address
  * afterwards and if it should be logged out immediately after changing it.
  * @param <type> $aUser
  * @param <type> $sMail
  * @return <type>
  */
 public function changeEmail($aUser, $sMail)
 {
     // check if user has enough permissions and the mails dont match if they have to verify the new email upon signup it
     if (Phpfox::getUserGroupParam($aUser['user_group_id'], 'user.can_change_email')) {
         Phpfox::getService('user.validate')->email($sMail);
         if (!Phpfox_Error::isPassed()) {
             return false;
         }
         // check that the new email is not in use.
         $sEmail = Phpfox::getLib('parse.input')->prepare($sMail);
         $inUse = $this->database()->select('email')->where('email = \'' . $sEmail . '\'')->from(Phpfox::getT('user'))->execute('getSlaveField');
         if ($inUse != '') {
             return 'Email address already in use';
         }
         //die(d(Phpfox::getParam('user.verify_email_at_signup'), true));
         // set the status to need to be verified only if they are required at signup
         if (Phpfox::getParam('user.verify_email_at_signup')) {
             $mUser = array('user_id' => $aUser['user_id'], 'email' => Phpfox::getLib('parse.input')->prepare($sMail), 'password' => $aUser['password']);
             $this->database()->update(Phpfox::getT('user'), array('status_id' => 1), 'user_id = ' . (int) $aUser['user_id']);
             $this->sendMail($mUser);
         } else {
             // just change the email
             $this->database()->update(Phpfox::getT('user'), array('email' => Phpfox::getLib('parse.input')->prepare($sMail)), 'user_id = ' . (int) $aUser['user_id']);
         }
         //Phpfox::getParam('user.logout_after_change_email_if_verify') && Phpfox::getParam('user.verify_email_at_signup')
         // check if they should be logged out immediately after changing it. Only then should their status_id be changed
         if (Phpfox::getParam('user.verify_email_at_signup') && Phpfox::getParam('user.logout_after_change_email_if_verify') == true) {
             Phpfox::getService('user.auth')->logout();
         }
         return true;
     }
     return false;
 }
开发者ID:lev1976g,项目名称:core,代码行数:40,代码来源:process.class.php

示例13: process

 /**
  * Controller
  */
 public function process()
 {
     Phpfox::isUser(true);
     // http://www.phpfox.com/tracker/view/15093/
     $bIsThickBox = $this->getParam('bIsThickBox');
     $this->template()->assign(array('bIsThickBox' => $bIsThickBox));
     if ($this->request()->getInt('purchase_id')) {
         if (!($aPackage = Phpfox::getService('subscribe.purchase')->getInvoice($this->request()->getInt('purchase_id'), true))) {
             return Phpfox_Error::set(Phpfox::getPhrase('subscribe.unable_to_find_the_purchase_you_are_looking_for'));
         }
         $iPurchaseId = $aPackage['purchase_id'];
     } else {
         if (!($aPackage = Phpfox::getService('subscribe')->getPackage($this->request()->getInt('id')))) {
             return Phpfox_Error::set(Phpfox::getPhrase('subscribe.unable_to_find_the_package_you_are_looking_for'));
         }
         if (Phpfox::getUserBy('user_group_id') == $aPackage['user_group_id']) {
             return Phpfox_Error::set(Phpfox::getPhrase('subscribe.attempting_to_upgrade_to_the_same_user_group_you_are_already_in'));
         }
         $aPackage['default_currency_id'] = isset($aPackage['default_currency_id']) ? $aPackage['default_currency_id'] : $aPackage['price'][0]['alternative_currency_id'];
         $aPackage['default_cost'] = isset($aPackage['default_cost']) ? $aPackage['default_cost'] : $aPackage['price'][0]['alternative_cost'];
         $iPurchaseId = Phpfox::getService('subscribe.purchase.process')->add(array('package_id' => $aPackage['package_id'], 'currency_id' => $aPackage['default_currency_id'], 'price' => $aPackage['default_cost']));
         /* Make sure we mark it as free only if the default cost is free and its not a recurring charge */
         if ($aPackage['default_cost'] == '0.00' && $aPackage['recurring_period'] == 0) {
             $this->template()->assign('bIsFree', true);
             $this->template()->assign('iPurchaseId', $iPurchaseId);
             Phpfox::getService('subscribe.purchase.process')->update($iPurchaseId, $aPackage['package_id'], 'completed', Phpfox::getUserId(), $aPackage['user_group_id'], $aPackage['fail_user_group']);
             return;
         }
     }
     /* Load the gateway only if its not free */
     if (($aPackage['default_cost'] != '0.00' || $aPackage['recurring_period'] != 0) && $iPurchaseId) {
         $this->setParam('gateway_data', array('item_number' => 'subscribe|' . $iPurchaseId, 'currency_code' => $aPackage['default_currency_id'], 'amount' => $aPackage['default_cost'], 'item_name' => $aPackage['title'], 'return' => $this->url()->makeUrl('subscribe.complete'), 'recurring' => $aPackage['recurring_period'], 'recurring_cost' => isset($aPackage['default_recurring_cost']) ? $aPackage['default_recurring_cost'] : '', 'alternative_cost' => isset($aPackage['price'][0]) ? serialize($aPackage['price']) : '', 'alternative_recurring_cost' => isset($aPackage['recurring_price'][0]) ? serialize($aPackage['recurring_price']) : ''));
     }
 }
开发者ID:lev1976g,项目名称:core,代码行数:37,代码来源:upgrade.class.php

示例14: process

 /**
  * Controller
  * This controller handles invalid user group by 2 means:
  *		1. getInt('id',0) => if no user group is given its explicitly redirected
  *		2. getActivityPoints may return a Phpfox_Error
  */
 public function process()
 {
     $iGroupId = $this->request()->getInt('id', 0);
     $aPoints = Phpfox::getService('user.group.setting')->getActivityPoints($iGroupId);
     if ($aVals = $this->request()->getArray('val')) {
         $oService = Phpfox::getService('user.group.setting.process');
         $aUpdate = array();
         foreach ($aVals['module'] as $iSetting => $iValue) {
             foreach ($aPoints as $iKey => $aPoint) {
                 if ($aPoint['setting_id'] == $iSetting && $iValue != $aPoint['value_actual']) {
                     $aUpdate['value_actual'][$iSetting] = $iValue;
                     /* Update the array to show the change in the template without calling DB again */
                     $aPoints[$iKey]['value_actual'] = $iValue;
                 }
             }
         }
         if (!empty($aUpdate)) {
             $oService->update($aVals['igroup'], $aUpdate);
         }
         $iGroupId = $aVals['igroup'];
     } else {
         if ($iGroupId == 0) {
             $this->url()->send('admincp.user.group', null, Phpfox::getPhrase('user.invalid_user_group'));
         }
     }
     $sUserGroup = Phpfox::getService('user.group')->getGroup($iGroupId);
     if (!Phpfox_Error::isPassed()) {
         $aError = array_unique(Phpfox_Error::get());
         $sMessage = implode(', ', $aError);
         $this->url()->send('admincp.user.group', null, $sMessage);
     }
     $this->template()->setBreadcrumb('Manage Activity Points', $this->url()->makeUrl('current'), true)->setTitle('Manage Activity Points')->assign(array('aPoints' => $aPoints, 'aUserGroup' => $sUserGroup))->setHeader(array('activitypoints.css' => 'module_user'));
 }
开发者ID:nima7r,项目名称:phpfox-dist,代码行数:39,代码来源:activitypoints.class.php

示例15: doPoke

 public function doPoke()
 {
     if (!Phpfox::getUserParam('poke.can_poke')) {
         return Phpfox_Error::display(Phpfox::getPhrase('poke.you_are_not_allowed_to_send_pokes'));
     }
     if (Phpfox::getUserParam('poke.can_only_poke_friends') && !Phpfox::getService('friend')->isFriend(Phpfox::getUserId(), $this->get('user_id'))) {
         return Phpfox_Error::display(Phpfox::getPhrase('poke.you_can_only_poke_your_own_friends'));
     }
     if (Phpfox::getService('poke.process')->sendPoke($this->get('user_id'))) {
         /* Type 1 is when poking back from the display block*/
         if ($this->get('type') == '1') {
             $this->call('$("#poke_' . $this->get('user_id') . '").hide().remove();');
         } else {
             $this->call('$("#liPoke").hide().remove();');
             $this->alert(Phpfox::getPhrase('poke.poke_sent'));
         }
     } else {
         $this->alert(Phpfox::getPhrase('poke.poke_could_not_be_sent'));
     }
     list($iTotalPokes, $aPokes) = Phpfox::getService('poke')->getPokesForUser(Phpfox::getUserId());
     if (!$iTotalPokes) {
         $this->call('$("#js_block_border_poke_display").remove();');
     } else {
         $this->call('$("#poke_' . $this->get('user_id') . '").hide().remove();');
     }
 }
开发者ID:Lovinity,项目名称:EQM,代码行数:26,代码来源:ajax.class.php


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