Example #1
0
 /**
  * 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.');
     }
 }
Example #2
0
 /**
  * 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']));
     }
 }
Example #3
0
 /**
  * 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);
 }
Example #4
0
 /**
  * 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());
 }
Example #5
0
 /**
  * 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));
 }
Example #6
0
 /**
  * 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()));
 }
Example #7
0
 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));
 }
Example #8
0
 /**
  * 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');
 }
Example #9
0
 /**
  * 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));
 }
Example #10
0
 /**
  * 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;
 }
Example #11
0
	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;		
	}
Example #12
0
 /**
  * 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;
 }
Example #13
0
 /**
  * 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']) : ''));
     }
 }
 /**
  * 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'));
 }
Example #15
0
 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();');
     }
 }
Example #16
0
 /**
  * Process the controller
  *
  */
 public function process()
 {
     if (Phpfox::isUser()) {
         $this->url()->send('');
     }
     if ($sRequest = $this->request()->get('id')) {
         if ($aVals = $this->request()->getArray('val')) {
             if (!isset($aVals['newpassword']) || !isset($aVals['newpassword2']) || $aVals['newpassword'] != $aVals['newpassword2']) {
                 Phpfox_Error::set(Phpfox::getPhrase('user.your_confirmed_password_does_not_match_your_new_password'));
             } else {
                 if (Phpfox::getService('user.password')->updatePassword($sRequest, $aVals)) {
                     $this->url()->send('user.password.verify', null, Phpfox::getPhrase('user.password_successfully_updated'));
                 }
             }
         }
         if (Phpfox::getParam('user.shorter_password_reset_routine')) {
             if (Phpfox::getService('user.password')->isValidRequest($sRequest) == true) {
                 $this->template()->assign(array('sRequest' => $sRequest));
             } else {
             }
         } else {
             if (Phpfox::getService('user.password')->verifyRequest($sRequest)) {
                 $this->url()->send('user.password.verify', null, Phpfox::getPhrase('user.new_password_successfully_sent_check_your_email_to_use_your_new_password'));
             }
         }
     }
     $this->template()->setTitle(Phpfox::getPhrase('user.password_request_verification'))->setBreadcrumb(Phpfox::getPhrase('user.password_request_verification'));
 }
Example #17
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     Phpfox::getUserParam('language.can_manage_lang_packs', true);
     $bNoJsValidation = $this->getParam('bNoJsValidation');
     $aModules = Phpfox::getService('admincp.module')->getModules();
     $aLanguages = Phpfox::getService('language')->get();
     if ($sPhrase = $this->getParam('sVar')) {
         $aParts = explode('.', $sPhrase);
         $sPhrase = $aParts[1];
     }
     /*
     $aValidation = array(
     	'var_name' => array(
     		'def' => 'required',
     		'title' => Phpfox::getPhrase('language.select_varname')
     	)
     );
     */
     $aValidation = array();
     $oValid = Phpfox::getLib('validator')->set(array('sFormName' => 'js_phrase_form', 'aParams' => $aValidation));
     if ($aVals = $this->request()->getArray('val')) {
         if (empty($aVals['var_name']) && isset($aVals['text']['en'])) {
             $aVals['var_name'] = $aVals['text']['en'];
         }
         if (empty($aVals['var_name'])) {
             Phpfox_Error::set('Provide a var name.');
         }
         // Check that all the fields are valid
         if ($oValid->isValid($aVals)) {
             // Check to make sure the phrase has not already been added
             if ($sIsPhrase = Phpfox::getService('language.phrase')->isPhrase($aVals)) {
                 Phpfox_Error::set(Phpfox::getPhrase('language.phrase_already_created', array('phrase' => $sIsPhrase)) . ' - ' . Phpfox::getPhrase($sIsPhrase));
                 $sCachePhrase = $sIsPhrase;
             } else {
                 $sVarName = Phpfox::getService('language.phrase.process')->prepare($aVals['var_name']);
                 if (isset($aVals['module'])) {
                     $aParts = explode('|', $aVals['module']);
                     $sVarName = $aParts[1] . '.' . $sVarName;
                 }
                 $sCached = Phpfox::getPhrase('language.phrase_added', array('phrase' => $sVarName));
                 // Add the new phrase
                 $sPhrase = Phpfox::getService('language.phrase.process')->add($aVals);
                 // Verify if we have a return URL, if we do send them there instead
                 if ($sReturn = $this->request()->get('return')) {
                     $this->url()->forward($sReturn, $sCached);
                 } else {
                     Phpfox::getLib('session')->set('cache_new_phrase', $sVarName);
                     // Phrase added lets send them back to the same page with a message that the phrase was added
                     $this->url()->send('admincp.language.phrase.add', array('last-module' => $aParts[1]), $sCached);
                 }
             }
         }
     }
     if (!isset($sCachePhrase) && ($sCachePhrase = Phpfox::getLib('session')->get('cache_new_phrase'))) {
         Phpfox::getLib('session')->remove('cache_new_phrase');
     }
     // Assign needed vars to the template
     $this->template()->assign(array('aProducts' => Phpfox::getService('admincp.product')->get(), 'aModules' => $aModules, 'aLanguages' => $aLanguages, 'sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $bNoJsValidation ? 'return true;' : $oValid->getJsForm(), 'sReturn' => ($sReturn = $this->request()->get('return')) ? $sReturn : $this->getParam('sReturnUrl'), 'sVar' => $sPhrase, 'sCachePhrase' => isset($sCachePhrase) ? $sCachePhrase : '', 'sLastModuleId' => $this->request()->get('last-module')))->setBreadCrumb(Phpfox::getPhrase('language.add_phrase'))->setTitle(Phpfox::getPhrase('language.add_phrase'));
     ($sPlugin = Phpfox_Plugin::get('language.component_controller_admincp_phrase_add_process')) ? eval($sPlugin) : false;
 }
Example #18
0
 public function process()
 {
     if ($this->request()->get('vidlypost')) {
         /*
         $hFile = fopen(PHPFOX_DIR_FILE . 'log' . PHPFOX_DS . 'vidly.log', 'a+');
         fwrite($hFile, print_r($_REQUEST, true) . "\n");
         fclose($hFile);
         */
         if ($this->request()->get('vidlypost') == 'AddMedia') {
             Phpfox::getService('video.process')->vidlyUpdateNewUrl($this->request()->getInt('vidid'), $_REQUEST);
         }
         exit;
     }
     if (!isset($_POST['hash'])) {
         echo json_encode(array('error' => true, 'error_message' => 'No post hash'));
     }
     if ($iId = Phpfox::getService('video')->checkVidlyHash($_POST['hash'])) {
         if (isset($_POST['cmd']) && $_POST['cmd'] == 'done') {
             if (!Phpfox::getService('video.process')->vidlyIsDone()) {
                 echo json_encode(array('error' => true, 'error_message' => implode('', Phpfox_Error::get())));
             }
         }
         echo json_encode(array('passed' => true, 'vidly_id' => $iId));
     } else {
         echo json_encode(array('error' => true, 'error_message' => implode('', Phpfox_Error::get())));
     }
     exit;
 }
Example #19
0
 /**
  * Controller
  */
 public function process()
 {
     if (Phpfox::getParam('core.phpfox_is_hosted')) {
         $this->url()->send('admincp');
     }
     $oArchiveExport = Phpfox::getLib('archive.export')->set(array('zip'));
     $oArchiveImport = Phpfox::getLib('archive.import')->set(array('zip'));
     if (($sExportId = $this->request()->get('id')) && !empty($sExportId)) {
         if ($sData = Phpfox::getService('emoticon')->export($sExportId)) {
             $oArchiveExport->download('phpfox-emoticon-' . $sExportId, 'xml', $sData);
         }
     }
     if (isset($_FILES['import']) && ($aFile = $_FILES['import'])) {
         if (preg_match('/^phpfox-emoticon-(.*?)\\.xml$/i', $aFile['name'], $aMatches)) {
             if ($sXmlData = file_get_contents($aFile['tmp_name'])) {
                 $aParams = Phpfox::getLib('xml.parser')->parse($sXmlData);
                 if (($mReturn = Phpfox::getService('emoticon.process')->import($this->request()->getArray('val'), $aParams)) && is_array($mReturn)) {
                     $this->url()->send('admincp.emoticon.view', array('id' => $mReturn['id']), Phpfox::getPhrase('emoticon.emoticon_package_successfully_created', array('success' => $mReturn['success'], 'failed' => $mReturn['failed'])));
                 }
             }
         } else {
             Phpfox_Error::set(Phpfox::getPhrase('emoticon.not_a_valid_emoticon_package_to_import'));
         }
     }
     $this->template()->setTitle(Phpfox::getPhrase('emoticon.import_emoticons'))->setBreadcrumb(Phpfox::getPhrase('emoticon.emoticons'), $this->url()->makeUrl('admincp.emoticon.package'))->setBreadCrumb(Phpfox::getPhrase('emoticon.import_emoticons'), null, true);
 }
Example #20
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     exit('Use AJAX method');
     Phpfox::isUser(true);
     if (!($iId = $this->request()->get('id'))) {
         return Phpfox_Error::display(Phpfox::getPhrase('video.id_must_be_defined'));
     }
     echo '<script type="text/javascript">';
     if (Phpfox::getService('video.convert')->process($iId)) {
         if ($this->request()->get('video-inline') == '1') {
             $iFeedId = Phpfox::getService('feed.process')->getLastId();
             echo 'window.parent.$.ajaxCall(\'video.displayFeed\', \'id=' . $iFeedId . '&video_id=' . $iId . '\', \'GET\');';
         } elseif ($this->request()->get('isajax')) {
             echo 'window.parent.Editor.insert({type: \'video\', id: \'' . (int) $iId . '\', editor_id: \'' . base64_decode($this->request()->get('editor-id')) . '\'});';
         } else {
             $aVideo = Phpfox::getService('video')->getForEdit($iId);
             echo 'window.parent.location.href = \'' . Phpfox::permalink('video', $aVideo['video_id'], $aVideo['title']) . '\';';
         }
     } else {
         Phpfox::getService('video.process')->delete($iId);
         echo 'window.parent.document.getElementById(\'js_video_upload_error\').style.display = \'block\';';
         echo 'window.parent.document.getElementById(\'js_video_upload_message\').innerHTML = \'' . implode('<br />', Phpfox_Error::get()) . '\';';
         echo 'window.parent.document.getElementById(\'js_upload_inner_form\').style.display = \'block\';';
         echo 'window.parent.document.getElementById(\'js_video_detail\').style.display = \'none\';';
         echo 'window.parent.document.getElementById(\'js_video_process\').style.display = \'none\';';
     }
     echo '</script>';
     exit;
 }
 public function process()
 {
     $sAction = $this->request()->get('req4');
     $sFlag = $this->request()->get('flag');
     if ($sFlag == '') {
         if ($sAction == 'install') {
             $oInstaller = Phpfox::getService('blog.import');
             if ($oInstaller->uninstall() && $oInstaller->install()) {
                 $this->clearCache("file/cache");
                 $this->clearCache("file/gzip");
                 $this->url()->send('admincp.blog.installer.install' . '/flag_success1');
             } else {
                 Phpfox_Error::set('The module blog importer cannot installed, please try again');
             }
         } elseif ($sAction == 'uninstall2') {
             if (Phpfox::getService('blog.import')->uninstall()) {
                 $this->clearCache("file/cache");
                 $this->clearCache("file/gzip");
                 $this->url()->send('admincp.blog.installer.uninstall' . '/flag_success2');
             } else {
                 Phpfox_Error::set('The module blog importer cannot uninstalled, please try again');
             }
         } elseif ($sAction == 'uninstall') {
         } else {
             $this->url()->send('subcribe');
         }
     } elseif ($sFlag == 'success1') {
         $this->url()->send('admincp.blog.installer.install' . '/flag_success', null, 'Congratulation ! The module blog importer v3.02p2 has been installed successfully');
     } elseif ($sFlag == 'success2') {
         $this->url()->send('admincp.blog.installer.uninstall' . '/flag_success', null, 'Uninstall blog importer v3.02p3 done !');
     }
     $this->template()->assign(array('sAction' => $sAction, 'sFlag' => $sFlag))->setBreadCrumb(Phpfox::getPhrase('blog.blog'), $this->url()->makeUrl('admincp.blog'));
 }
Example #22
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     Phpfox::isUser(true);
     if (Phpfox::getUserBy('profile_page_id')) {
         Phpfox::getService('pages')->setIsInPage();
     }
     if (!($aAlbum = Phpfox::getService('photo.album')->getForEdit($this->request()->getInt('id')))) {
         return Phpfox_Error::display(Phpfox::getPhrase('photo.photo_album_not_found'));
     }
     if ($aVals = $this->request()->getArray('val')) {
         if ($this->request()->get('req3') == 'photo') {
             if (Phpfox::getService('photo.process')->massProcess($aAlbum, $aVals)) {
                 $this->url()->send('photo.edit-album.photo', array('id' => $aAlbum['album_id']), Phpfox::getPhrase('photo.photo_s_successfully_updated'));
             }
         } else {
             if (Phpfox::getService('photo.album.process')->update($aAlbum['album_id'], $aVals)) {
                 $this->url()->permalink('photo.album', $aAlbum['album_id'], $aAlbum['name'], true, Phpfox::getPhrase('photo.album_successfully_updated'));
             }
         }
     }
     $aMenus = array('detail' => Phpfox::getPhrase('photo.album_info'), 'photo' => Phpfox::getPhrase('photo.photos'));
     $this->template()->buildPageMenu('js_photo_block', $aMenus, array('link' => $this->url()->permalink('photo.album', $aAlbum['album_id'], $aAlbum['name']), 'phrase' => Phpfox::getPhrase('photo.view_this_album_uppercase')));
     list($iCnt, $aPhotos) = Phpfox::getService('photo')->get('p.album_id = ' . (int) $aAlbum['album_id']);
     list($iAlbumCnt, $aAlbums) = Phpfox::getService('photo.album')->get('pa.user_id = ' . Phpfox::getUserId());
     $this->template()->setTitle(Phpfox::getPhrase('photo.editing_album') . ': ' . $aAlbum['name'])->setFullSite()->setBreadcrumb(Phpfox::getPhrase('photo.photo'), $this->url()->makeUrl('photo'))->setBreadcrumb(Phpfox::getPhrase('photo.editing_album') . ': ' . $aAlbum['name'], $this->url()->makeUrl('photo.edit-album', array('id' => $aAlbum['album_id'])), true)->setHeader(array('edit.css' => 'module_photo', 'photo.js' => 'module_photo'))->assign(array('aForms' => $aAlbum, 'aPhotos' => $aPhotos, 'aAlbums' => $aAlbums));
 }
Example #23
0
 /**
  * Class process method which is used to execute this component.
  */
 public function process()
 {
     $this->template()->setTitle(Phpfox::getPhrase('user.email_verification'))->setBreadcrumb(Phpfox::getPhrase('user.email_verification'))->assign(array('iVerifyUserId' => Phpfox::getLib('session')->get('cache_user_id')));
     $sHash = $this->request()->get('link', '');
     if ($sHash == '') {
     } elseif (Phpfox::getService('user.verify.process')->verify($sHash)) {
         if ($sPlugin = Phpfox_Plugin::get('user.component_verify_process_redirection')) {
             eval($sPlugin);
         }
         $sRedirect = Phpfox::getParam('user.redirect_after_signup');
         if (!empty($sRedirect)) {
             Phpfox::getLib('session')->set('redirect', str_replace('.', '/', $sRedirect));
         }
         if (Phpfox::isMobile()) {
             $this->url()->send('mobile.user.login', null, Phpfox::getPhrase('user.your_email_has_been_verified_please_log_in_with_the_information_you_provided_during_sign_up'));
         }
         // send to the log in and say everything is ok
         Phpfox::getLib('session')->set('verified_do_redirect', '1');
         $this->url()->send('user.login', null, Phpfox::getPhrase('user.your_email_has_been_verified_please_log_in_with_the_information_you_provided_during_sign_up'));
     } else {
         //send to the log in and say there was an error
         Phpfox_Error::set(Phpfox::getPhrase('user.invalid_verification_link'));
         $iTime = Phpfox::getParam('user.verify_email_timeout');
         if ($iTime < 60) {
             $sTime = Phpfox::getPhrase('user.time_minutes', array('time' => $iTime));
         } elseif ($iTime < 60 * 60 * 24) {
             $sTime = $iTime == 60 ? Phpfox::getPhrase('user.time_hour', array('time' => round($iTime / 60))) : Phpfox::getPhrase('user.time_hours', array('time' => round($iTime / 60)));
         } else {
             $sTime = Phpfox::getPhrase('user.time_days', array('time' => $sTime));
         }
         Phpfox::getService('user.verify.process')->sendMail(Phpfox::getLib('session')->get('cache_user_id'));
         $this->template()->assign(array('sTime' => $sTime));
     }
 }
Example #24
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     if (!($aPurchase = Phpfox::getService('subscribe.purchase')->getInvoice($this->request()->getInt('id')))) {
         return Phpfox_Error::display(Phpfox::getPhrase('subscribe.unable_to_find_this_invoice'));
     }
     $this->template()->setTitle(Phpfox::getPhrase('subscribe.membership_packages'))->setBreadcrumb(Phpfox::getPhrase('subscribe.membership_packages'), $this->url()->makeUrl('subscribe'))->setBreadcrumb(Phpfox::getPhrase('subscribe.subscriptions'), $this->url()->makeUrl('subscribe.list'))->setBreadcrumb(Phpfox::getPhrase('subscribe.order_purchase_id_title', array('purchase_id' => $aPurchase['purchase_id'], 'title' => Phpfox::getLib('locale')->convert($aPurchase['title']))), null, true)->assign(array('aPurchase' => $aPurchase));
 }
Example #25
0
 public function share()
 {
     $aPost = $this->get('val');
     if ($aPost['post_type'] == '2') {
         if (!isset($aPost['friends']) || isset($aPost['friends']) && !count($aPost['friends'])) {
             Phpfox_Error::set('Select a friend to share this with.');
         } else {
             $iCnt = 0;
             foreach ($aPost['friends'] as $iFriendId) {
                 $aVals = array('user_status' => $aPost['post_content'], 'parent_user_id' => $iFriendId, 'parent_feed_id' => $aPost['parent_feed_id'], 'parent_module_id' => $aPost['parent_module_id']);
                 if (Phpfox::getService('user.privacy')->hasAccess($iFriendId, 'feed.share_on_wall') && Phpfox::getUserParam('profile.can_post_comment_on_profile')) {
                     $iCnt++;
                     Phpfox::getService('feed.process')->addComment($aVals);
                 }
             }
             $sMessage = '<div class="message">' . str_replace("'", "\\'", Phpfox::getPhrase('feed.successfully_shared_this_item_on_your_friends_wall')) . '</div>';
             if (!$iCnt) {
                 $sMessage = '<div class="error_message">' . str_replace("'", "\\'", Phpfox::getPhrase('user.unable_to_share_this_post_due_to_privacy_settings')) . '</div>';
             }
             $this->call('$(\'#\' + tb_get_active()).find(\'.js_box_content:first\').html(\'' . $sMessage . '\');');
             if ($iCnt) {
                 $this->call('setTimeout(\'tb_remove();\', 2000);');
             }
         }
         return;
     }
     $aVals = array('user_status' => $aPost['post_content'], 'privacy' => '0', 'privacy_comment' => '0', 'parent_feed_id' => $aPost['parent_feed_id'], 'parent_module_id' => $aPost['parent_module_id']);
     if ($iId = Phpfox::getService('user.process')->updateStatus($aVals)) {
         $this->call('$(\'#\' + tb_get_active()).find(\'.js_box_content:first\').html(\'<div class="message">' . str_replace("'", "\\'", Phpfox::getPhrase('feed.successfully_shared_this_item')) . '</div>\'); setTimeout(\'tb_remove();\', 2000);');
     }
 }
Example #26
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     return Phpfox_Error::display('This section has been depreciated');
     Phpfox::getUserParam('comment.can_moderate_comments', true);
     if ($aIds = $this->request()->getArray('id')) {
         if ($this->request()->get('approve')) {
             foreach ($aIds as $iId) {
                 Phpfox::getService('feed.process')->approve($iId);
             }
             $this->url()->send('admincp.feed', array('view' => 'approval'), Phpfox::getPhrase('feed.profile_comment_s_successfully_approved'));
         } else {
             foreach ($aIds as $iId) {
                 Phpfox::getService('feed.process')->deleteFeed($iId);
             }
             $this->url()->send('admincp.feed', array('view' => 'approval'), Phpfox::getPhrase('feed.profile_comment_s_successfully_deleted'));
         }
     }
     $iPage = $this->request()->getInt('page');
     $aPages = array(20, 30, 40, 50);
     $aDisplays = array();
     foreach ($aPages as $iPageCnt) {
         $aDisplays[$iPageCnt] = Phpfox::getPhrase('core.per_page', array('total' => $iPageCnt));
     }
     $aFilters = array('search' => array('type' => 'input:text', 'search' => "AND ls.name LIKE '%[VALUE]%'"), 'display' => array('type' => 'select', 'options' => $aDisplays, 'default' => '20'), 'sort' => array('type' => 'select', 'options' => array('time_stamp' => Phpfox::getPhrase('comment.last_activity'), 'rating ' => Phpfox::getPhrase('comment.rating')), 'default' => 'time_stamp', 'alias' => 'feed'), 'sort_by' => array('type' => 'select', 'options' => array('DESC' => Phpfox::getPhrase('core.descending'), 'ASC' => Phpfox::getPhrase('core.ascending')), 'default' => 'DESC'));
     $oSearch = Phpfox::getLib('search')->set(array('type' => 'feeds', 'filters' => $aFilters, 'search' => 'search'));
     $oSearch->setCondition('AND feed.view_id = 1');
     list($iCnt, $aFeeds) = Phpfox::getService('feed')->getForBrowse($oSearch->getConditions(), $oSearch->getSort(), $oSearch->getPage(), $oSearch->getDisplay());
     Phpfox::getLib('pager')->set(array('page' => $iPage, 'size' => $oSearch->getDisplay(), 'count' => $oSearch->getSearchTotal($iCnt)));
     $this->template()->setTitle(Phpfox::getPhrase('comment.comment_title'))->setBreadcrumb(Phpfox::getPhrase('comment.comment_title'), $this->url()->makeUrl('admincp.comment'))->setHeader('cache', array('comment.css' => 'style_css', 'pager.css' => 'style_css'))->assign(array('aFeeds' => $aFeeds, 'bIsCommentAdminPanel' => true));
 }
Example #27
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     // assign the categories
     $this->template()->assign(array('aCategories' => Phpfox::getService('contact.contact')->getCategories()));
     // create the captcha check JS
     // they need to input some text always
     $aValidation = array('text' => Phpfox::getPhrase('contact.fill_in_some_text_for_your_message'), 'category_id' => Phpfox::getPhrase('contact.you_need_to_choose_a_category'), 'subject' => Phpfox::getPhrase('contact.provide_a_subject'), 'full_name' => Phpfox::getPhrase('contact.provide_your_full_name'));
     // do they need to complete a captcha challenge?
     if (Phpfox::isModule('captcha') && Phpfox::getParam('contact.contact_enable_captcha')) {
         $aValidation['image_verification'] = Phpfox::getPhrase('captcha.complete_captcha_challenge');
     }
     // They always need to input their email address
     $aValidation['email'] = array('def' => 'email', 'title' => Phpfox::getPhrase('contact.provide_a_valid_email'));
     $oValid = Phpfox::getLib('validator')->set(array('sFormName' => 'js_contact_form', 'aParams' => $aValidation));
     // check if we're getting a request:
     if ($aVals = $this->request()->getArray('val')) {
         // check the fields are valid
         if ($oValid->isValid($aVals)) {
             if (Phpfox::getService('contact.contact')->sendContactMessage($aVals)) {
                 if (!empty($aVals['category_id']) && $aVals['category_id'] == 'phpfox_sales_ticket') {
                     $this->url()->send('contact', array('sent' => 'true'));
                 } else {
                     $this->url()->send('contact', null, Phpfox::getPhrase('contact.your_message_was_successfully_sent'));
                 }
             } else {
                 $this->template()->assign(array('aContactErrors' => Phpfox_Error::set(Phpfox::getPhrase('error.site_email_not_set'))));
             }
         }
     }
     if (Phpfox::isUser()) {
         $this->template()->assign(array('sFullName' => Phpfox::getUserBy('full_name'), 'sEmail' => Phpfox::getUserBy('email')));
     }
     $this->template()->setTitle(Phpfox::getPhrase('contact.contact_us'))->setBreadcrumb(Phpfox::getPhrase('contact.contact_us'))->assign(array('sCreateJs' => $oValid->createJs(), 'sGetJsForm' => $oValid->getJsForm(), 'bIsSent' => $this->request()->get('sent')))->setFullSite();
 }
Example #28
0
 /**
  * Controller
  */
 public function process()
 {
     $aLanguage = Phpfox::getService('language')->getLanguage($this->request()->get('id'));
     if (!isset($aLanguage['language_id'])) {
         return Phpfox_Error::display(Phpfox::getPhrase('language.not_a_valid_language_package'));
     }
     $iPage = $this->request()->getInt('page', 0);
     $aXml = Phpfox::getService('core')->getModulePager('phrases', $iPage, 5);
     if ($aXml === false) {
         $sPhrase = Phpfox::getPhrase('language.successfully_imported_missing_phrases');
         Phpfox::getLib('cache')->remove('locale', 'substr');
         if ($this->request()->get('check') == 'true') {
             $this->url()->send('admincp.language', null, $sPhrase);
         } else {
             $this->url()->send('admincp.language.missing', array('id' => $aLanguage['language_id'], 'check' => 'true'));
         }
     }
     $aModules = array();
     if (is_array($aXml)) {
         $iMissing = Phpfox::getService('language.phrase.process')->findMissingPhrases($aLanguage['language_id'], $aXml, $this->request()->get('check') == 'true' ? true : false);
         foreach ($aXml as $sModule => $sPhrases) {
             $aModules[] = $sModule;
         }
         $this->template()->setHeader('<meta http-equiv="refresh" content="2;url=' . $this->url()->makeUrl('admincp.language.missing', array('id' => $aLanguage['language_id'], 'check' => $this->request()->get('check'), 'page' => $iPage + 1)) . '">');
     }
     $this->template()->setTitle(Phpfox::getPhrase('language.find_missing_phrases'))->setBreadcrumb(Phpfox::getPhrase('language.manage_language_packages'), $this->url()->makeUrl('admincp.language'))->setBreadcrumb(Phpfox::getPhrase('language.find_missing_phrases'), $this->url()->makeUrl('current'))->setBreadcrumb($aLanguage['title'], null, true)->assign(array('aModules' => $aModules, 'iMissing' => $iMissing));
 }
Example #29
0
 public function __call($sMethod, $aArguments)
 {
     if ($sPlugin = Phpfox_Plugin::get('younetcore.service_process__call')) {
         return eval($sPlugin);
     }
     Phpfox_Error::trigger('Call to undefined method ' . __CLASS__ . '::' . $sMethod . '()', E_USER_ERROR);
 }
Example #30
0
 public function add($aObject)
 {
     if (!$this->database()->tableExists($aObject['object_table'])) {
         Phpfox_Error::set('Table ' . $aObject['object_table'] . ' does not exist in the database.');
         return false;
     }
     if (!isset($aObject['object_plugin_create'])) {
         $aObject['object_plugin_create'] = '';
     }
     if (!isset($aObject['object_plugin_delete'])) {
         $aObject['object_plugin_delete'] = '';
     }
     if ($aObject['object_static_target']) {
         $aObject['object_column_target_type'] = '';
     }
     $iObjectId = $this->database()->insert($this->_sTable, array('object_name' => $this->preParse()->clean($aObject['object_name']), 'object_table' => $this->preParse()->clean($aObject['object_table']), 'object_column_id' => $this->preParse()->clean($aObject['object_column_id']), 'object_column_user_id' => $this->preParse()->clean($aObject['object_column_user_id']), 'object_column_timestamp' => $this->preParse()->clean($aObject['object_column_timestamp']), 'object_column_title' => $this->preParse()->clean($aObject['object_column_title']), 'object_table_text' => $this->preParse()->clean($aObject['object_table_text']), 'object_column_text' => $this->preParse()->clean($aObject['object_column_text']), 'object_image_location' => $this->preParse()->clean($aObject['object_image_location']), 'object_column_image_path' => $this->preParse()->clean($aObject['object_column_image_path']), 'object_plugin_create' => $this->preParse()->clean($aObject['object_plugin_create']), 'object_plugin_create_id_var_name' => $this->preParse()->clean($aObject['object_plugin_create_id_var_name']), 'object_plugin_delete' => $this->preParse()->clean($aObject['object_plugin_delete']), 'object_plugin_delete_id_var_name' => $this->preParse()->clean($aObject['object_plugin_delete_id_var_name']), 'object_target_handle' => $this->preParse()->clean($aObject['object_target_handle']), 'object_column_target_type' => $this->preParse()->clean($aObject['object_column_target_type']), 'object_static_target' => $this->preParse()->clean($aObject['object_static_target']), 'object_column_target_id' => $this->preParse()->clean($aObject['object_column_target_id']), 'object_url_link' => $this->preParse()->clean($aObject['object_url_link'])));
     if (strlen($aObject['object_plugin_create']) && $aObject['object_plugin_create_id_var_name']) {
         $sEval = 'Phpfox::getService(\'sysop\')->runCreatePlugin(' . (int) $iObjectId . ', ' . $this->preParse()->clean($aObject['object_plugin_create_id_var_name']) . ');';
         $aCustomHook = array('module_id' => 'sysop', 'product_id' => 'AdminTools', 'call_name' => $aObject['object_plugin_create'], 'title' => 'AdminTools, System Operator, Create Object, ' . $this->preParse()->clean($aObject['object_name']), 'php_code' => $sEval, 'is_active' => 1);
         Phpfox::getService('admincp.plugin.process')->add($aCustomHook);
     }
     if (strlen($aObject['object_plugin_delete']) && $aObject['object_plugin_create_id_var_name']) {
         $sEval = 'Phpfox::getService(\'sysop\')->runDeletePlugin(' . (int) $iObjectId . ', ' . $this->preParse()->clean($aObject['object_plugin_delete_id_var_name']) . ');';
         $aCustomHook = array('module_id' => 'sysop', 'product_id' => 'AdminTools', 'call_name' => $aObject['object_plugin_delete'], 'title' => 'AdminTools, System Operator, Delete Object, ' . $this->preParse()->clean($aObject['object_name']), 'php_code' => $sEval, 'is_active' => 1);
         Phpfox::getService('admincp.plugin.process')->add($aCustomHook);
     }
     Phpfox::getLib('cache')->remove();
     return $iObjectId;
 }