Esempio n. 1
0
 /**
  * Controller
  */
 public function process()
 {
     Phpfox::getUserParam('comment.can_moderate_comments', true);
     $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' => 'cmt'), 'sort_by' => array('type' => 'select', 'options' => array('DESC' => Phpfox::getPhrase('core.descending'), 'ASC' => Phpfox::getPhrase('core.ascending')), 'default' => 'DESC'));
     $oSearch = Phpfox_Search::instance()->set(array('type' => 'comments', 'filters' => $aFilters, 'search' => 'search'));
     if ($this->request()->get('view') == 'approval') {
         $oSearch->setCondition('AND cmt.view_id = 1');
     } else {
         $oSearch->setCondition('AND cmt.view_id = 9');
     }
     list($iCnt, $aComments) = Phpfox::getService('comment')->get('cmt.*', $oSearch->getConditions(), $oSearch->getSort(), $oSearch->getPage(), $oSearch->getDisplay(), null, true);
     foreach ($aComments as $iKey => $aComment) {
         if (Phpfox::hasCallback($aComment['type_id'], 'getItemName')) {
             $aComments[$iKey]['item_name'] = Phpfox::callback($aComment['type_id'] . '.getItemName', $aComment['comment_id'], $aComment['owner_full_name']);
         }
     }
     Phpfox_Pager::instance()->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('aComments' => $aComments, 'bIsCommentAdminPanel' => true));
 }
Esempio n. 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']));
     }
 }
Esempio n. 3
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     $iRsvp = $this->request()->get('rsvp', 1);
     $iPage = $this->request()->getInt('page');
     $sModule = $this->request()->get('module', false);
     $iItem = $this->request()->getInt('item', false);
     $aCallback = $this->getParam('aCallback', false);
     $iPageSize = 6;
     if (PHPFOX_IS_AJAX) {
         $aCallback = false;
         if ($sModule && $iItem && Phpfox::hasCallback($sModule, 'getEventInvites')) {
             $aCallback = Phpfox::callback($sModule . '.getEventInvites', $iItem);
         }
         $aEvent = Phpfox::getService('event')->callback($aCallback)->getEvent($this->request()->get('id'), true);
         $this->template()->assign('aEvent', $aEvent);
     } else {
         $aEvent = $this->getParam('aEvent');
         $this->template()->assign('aEvent', $aEvent);
     }
     if ($aCallback !== false) {
         $sModule = $aCallback['module'];
         $iItem = $aCallback['item'];
     }
     list($iCnt, $aInvites) = Phpfox::getService('event')->getInvites($aEvent['event_id'], $iRsvp, $iPage, $iPageSize);
     Phpfox::getLib('pager')->set(array('ajax' => 'event.listGuests', 'page' => $iPage, 'size' => $iPageSize, 'count' => $iCnt, 'aParams' => array('id' => $aEvent['event_id'], 'module' => $sModule, 'item' => $iItem, 'rsvp' => $iRsvp)));
     $this->template()->assign(array('aInvites' => $aInvites, 'iRsvp' => $iRsvp));
     if (!PHPFOX_IS_AJAX) {
         $sExtra = '';
         if ($aCallback !== false) {
             $sExtra .= '&module=' . $aCallback['module'] . '&item=' . $aCallback['item'];
         }
         $this->template()->assign(array('sHeader' => Phpfox::getPhrase('event.event_guests'), 'aMenu' => array(Phpfox::getPhrase('event.attending') => '#event.listGuests?rsvp=1&id=' . $aEvent['event_id'] . $sExtra, Phpfox::getPhrase('event.maybe') => '#event.listGuests?rsvp=2&id=' . $aEvent['event_id'] . $sExtra, Phpfox::getPhrase('event.can_t_make_it') => '#event.listGuests?rsvp=3&id=' . $aEvent['event_id'] . $sExtra, Phpfox::getPhrase('event.not_responded') => '#event.listGuests?rsvp=0&id=' . $aEvent['event_id'] . $sExtra), 'sBoxJsId' => 'event_guests'));
         return 'block';
     }
 }
Esempio n. 4
0
	/**
	 * Get the latest shoutouts.
	 *
	 * @param int $iLimit Define the limit so we don't return all the shoutouts.
	 * @return array Array of shoutouts.
	 */
	public function getMessages($iLimit = 5)
	{
		if (isset($this->_aCallback['module']))
		{
			if (Phpfox::hasCallback($this->_aCallback['module'], 'getShoutboxData'))
			{
				$aCallback = Phpfox::callback($this->_aCallback['module'] . '.getShoutboxData');		
				if (isset($aCallback['table']))
				{
					$this->_sTable = Phpfox::getT($aCallback['table']);
					
					$this->database()->where('item_id = ' . (int) $this->_aCallback['item']);
				}
			}
		}				
		
		$aMessages = $this->database()->select('s.shout_id, s.text, s.time_stamp, ' . Phpfox::getUserField())
			->from($this->_sTable, 's')
			->join(Phpfox::getT('user'), 'u', 'u.user_id = s.user_id')
			->limit($iLimit)
			->order('s.time_stamp DESC')
			->execute('getSlaveRows');

		foreach ($aMessages as $iKey => $aMessage)
		{
			$aMessage['text'] = Phpfox::getLib('parse.output')->split(Phpfox::getLib('parse.output')->clean($aMessage['text']), Phpfox::getParam('shoutbox.shoutbox_wordwrap'));
			
			$aMessages[$iKey]['text'] = Phpfox::getService('emoticon')->parse($aMessage['text']);
			$aMessages[$iKey]['module'] = (isset($this->_aCallback['module']) ? $this->_aCallback['module'] : '');
		}
			
		return $aMessages;
	}
Esempio n. 5
0
 /**
  * Get the latest shoutouts.
  *
  * @param int $iLimit Define the limit so we don't return all the shoutouts.
  * @return array Array of shoutouts.
  */
 public function getMessages($iLimit = 5)
 {
     if (isset($this->_aCallback['module'])) {
         if (Phpfox::hasCallback($this->_aCallback['module'], 'getShoutboxData')) {
             $aCallback = Phpfox::callback($this->_aCallback['module'] . '.getShoutboxData');
             if (isset($aCallback['table'])) {
                 $this->_sTable = Phpfox::getT($aCallback['table']);
                 $this->database()->where('item_id = ' . (int) $this->_aCallback['item']);
             }
         }
     }
     $aMessages = $this->database()->select('s.shout_id, s.text, s.time_stamp, ' . Phpfox::getUserField())->from($this->_sTable, 's')->join(Phpfox::getT('user'), 'u', 'u.user_id = s.user_id')->limit($iLimit)->order('s.time_stamp DESC')->execute('getSlaveRows');
     foreach ($aMessages as $iKey => $aMessage) {
         $aMessage['text'] = Phpfox::getLib('parse.output')->replaceHashTags(Phpfox::getLib('parse.output')->split(Phpfox::getLib('parse.output')->clean($aMessage['text']), Phpfox::getParam('shoutbox.shoutbox_wordwrap')));
         if (Phpfox::isModule('emoticon')) {
             $aMessages[$iKey]['text'] = Phpfox::getService('emoticon')->parse($aMessage['text']);
         }
         $aMessages[$iKey]['module'] = isset($this->_aCallback['module']) ? $this->_aCallback['module'] : '';
     }
     // FUDGE Lovinity January 5, 2016: Filter shouts by users who have been blocked or are blocking
     $bIsBlocked = Phpfox::getService('user.block')->isBlocked($aMessages[$iKey]['user_id'], Phpfox::getUserId());
     $bIsBlocked2 = Phpfox::getService('user.block')->isBlocked(Phpfox::getUserId(), $aMessages[$iKey]['user_id']);
     if ($bIsBlocked || $bIsBlocked2) {
         $aMessages[$iKey]['text'] = '<img src="file/public/blocked.png">';
     }
     // END FUDGE
     return $aMessages;
 }
Esempio n. 6
0
 public function process()
 {
     Phpfox::getLib('setting')->setParam(array('profiles.url_image' => Phpfox::getParam('core.url_pic') . 'profiles/'));
     $mUser = $this->request()->get('req2');
     $sSection = $this->request()->get('req3');
     $bIsPublicItemView = false;
     if (Phpfox::isPublicView()) {
         if (!empty($sSection) && Phpfox::isModule($sSection) && $sSection != 'designer' && Phpfox::hasCallback($sSection, 'getItemView') && Phpfox::callback($sSection . '.getItemView') === true) {
             $bIsPublicItemView = true;
         }
     }
     if (!$mUser) {
         if (Phpfox::isUser()) {
             $this->url()->send('profile');
         } else {
             Phpfox::isUser(true);
         }
     }
     // If we are unable to find a user lets make sure we return a 404 page not found error
     $aExtraProfile = Phpfox::getService('profiles')->getProfile($mUser);
     if (count($aExtraProfile) == 0) {
         return Phpfox::getLib('module')->setController('error.404');
     }
     $aUser = Phpfox::getService('user')->get($aExtraProfile['user_id']);
     $this->setParam('aExtraProfile', $aExtraProfile);
     $this->template()->assign(array('aExtraProfile' => $aExtraProfile));
     if (Phpfox::getService('user.block')->isBlocked($aExtraProfile['user_id'], Phpfox::getUserId()) && !Phpfox::getUserParam('user.can_override_user_privacy')) {
         $this->url()->send($aUser['user_name']);
     }
     if (!Phpfox::getService('user.privacy')->hasAccess($aExtraProfile['user_id'], 'profile.view_profile')) {
         $this->url()->send($aUser['user_name']);
     }
     //This is where I want to add $this->request()->get('req3') == gallery
     if (!empty($sSection) && $sSection == 'photo') {
         Phpfox::getLib('module')->setController('profiles.view');
     }
     Phpfox::getUserParam('profile.can_view_users_profile', true);
     $this->template()->setHeader('cache', array('profile.css' => 'style_css', 'feed.js' => 'module_feed'));
     $this->template()->setMeta('description', Phpfox::getPhrase('profiles.meta_description', array('extra_name' => $aExtraProfile['title'], 'site_title' => Phpfox::getParam('core.site_title'), 'meta_description_profile' => Phpfox::getParam('core.meta_description_profile'))));
     $sPageTitle = $aExtraProfile['title'];
     $this->setParam('aFeed', array('comment_type_id' => 'profiles', 'privacy' => 0, 'comment_privacy' => 0, 'item_id' => $aExtraProfile['extra_id'], 'like_type_id' => 'profiles', 'feed_is_liked' => isset($aExtraProfile['is_liked']) ? $aExtraProfile['is_liked'] : false, 'user_id' => $aExtraProfile['user_id'], 'total_comment' => $aExtraProfile['total_comment'], 'total_like' => 0, 'feed_link' => $this->url()->makeUrl('profiles', $aExtraProfile['title_url']), 'feed_title' => $aExtraProfile['title'], 'feed_display' => 'view', 'report_module' => 'profiles', 'report_phrase' => Phpfox::getPhrase('profiles.report_this_profile')));
     if ($this->request()->get('req3') != 'photo') {
         $this->template()->setBreadcrumb($sPageTitle, Phpfox::getLib('url')->makeUrl('profiles.browse'));
     } elseif ($this->request()->get('req3') == '') {
         $this->template()->setBreadcrumb(Phpfox::getPhrase('profiles.extra_profiles'), Phpfox::getLib('url')->makeUrl('profiles.browse'));
     }
     $this->template()->setTitle($sPageTitle)->setEditor(array('load' => 'simple', 'wysiwyg' => Phpfox::isModule('comment') && Phpfox::getParam('comment.wysiwyg_comments') && Phpfox::getUserParam('comment.wysiwyg_on_comments')))->setUrl('profiles')->setHeader('cache', array('comment.css' => 'style_css', 'pager.css' => 'style_css', 'jquery/plugin/jquery.scrollTo.js' => 'static_script', 'quick_edit.js' => 'static_script', 'jquery/plugin/jquery.highlightFade.js' => 'static_script'));
     if ($this->request()->get('update')) {
         $this->template()->setHeader('<script type="text/javascript">window.parent.tb_remove();</script>');
     }
     if ($sPlugin = Phpfox_Plugin::get('profiles.component_controller_index_end')) {
         eval($sPlugin);
         if (isset($mReturnFromPlugin)) {
             return $mReturnFromPlugin;
         }
     }
 }
Esempio n. 7
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     if (Phpfox::getParam('video.convert_servers_secret') != $this->request()->get('_v_secret')) {
         $this->p('Secret does not match', true);
     } else {
         if ($this->request()->get('_v_action')) {
             switch ($this->request()->get('_v_action')) {
                 case 'completed':
                     $iCnt = 0;
                     foreach (Phpfox::getParam('video.convert_servers') as $sServer) {
                         $iCnt++;
                         if (md5($sServer) == $this->request()->get('url')) {
                             break;
                         }
                     }
                     $sDest = '{' . $iCnt . '}' . $this->request()->get('name');
                     $aVideo = Phpfox::getLib('database')->select('*')->from(Phpfox::getT('video'))->where('custom_v_id = ' . (int) $this->request()->get('id'))->execute('getSlaveRow');
                     if (isset($aVideo['video_id'])) {
                         $aCallback = null;
                         if ($aVideo['module_id'] != 'video' && Phpfox::hasCallback($aVideo['module_id'], 'convertVideo')) {
                             $aCallback = Phpfox::callback($aVideo['module_id'] . '.convertVideo', $aVideo);
                         }
                         Phpfox::isModule('feed') ? Phpfox::getService('feed.process')->callback($aCallback)->allowGuest()->add('video', $aVideo['video_id'], $aVideo['privacy'], $aVideo['privacy_comment'], $aVideo['item_id'], $aVideo['user_id']) : null;
                         Phpfox::getLib('database')->update(Phpfox::getT('video'), array('in_process' => '0', 'destination' => $sDest, 'image_path' => $sDest . '.jpg'), 'custom_v_id = ' . (int) $this->request()->get('id'));
                         $bUpdatePoints = $aVideo['module_id'] == 'video' ? Phpfox::getUserParam('video.approve_video_before_display') ? false : true : true;
                         if ($bUpdatePoints === true) {
                             // Update user activity
                             Phpfox::getService('user.activity')->update($aVideo['user_id'], 'video');
                         }
                     }
                     break;
                 case 'canUpload':
                     // Will add security checks later
                     if (Phpfox::getService('video')->checkCustomHash($this->request()->get('hash_id'))) {
                         $this->p('All is good.');
                     } else {
                         $this->p('No token set for this upload.', true);
                     }
                     break;
                 case 'getSettings':
                     $aSettings = array();
                     $aParams = array('video.covert_mp4_exec', 'video.covert_webm_exec', 'video.covert_ogg_exec', 'video.covert_mp4_image');
                     foreach ($aParams as $sParam) {
                         $aSettings[$sParam] = Phpfox::getParam($sParam);
                     }
                     $this->p($aSettings);
                     break;
             }
         } else {
             $this->p('No action provided', true);
         }
     }
     $this->output();
     exit;
 }
 public function _getNotification($iUserId)
 {
     $aGetRows = $this->database()->select('n.*, n.user_id as item_user_id, COUNT(n.notification_id) AS total_extra, ' . Phpfox::getUserField())->from($this->_sTable, 'n')->join(Phpfox::getT('user'), 'u', 'u.user_id = n.owner_user_id')->innerJoin('(SELECT * FROM ' . $this->_sTable . ' AS n WHERE n.user_id = ' . $iUserId . ' ORDER BY n.time_stamp DESC)', 'ninner', 'ninner.notification_id = n.notification_id')->where('n.user_id = ' . $iUserId . '')->group('n.type_id, n.item_id')->order('n.is_seen ASC, n.time_stamp DESC')->limit(5)->execute('getSlaveRows');
     $aRows = array();
     foreach ($aGetRows as $aGetRow) {
         $aRows[(int) $aGetRow['notification_id']] = $aGetRow;
     }
     arsort($aRows);
     $aNotifications = array();
     foreach ($aRows as $aRow) {
         $aParts1 = explode('.', $aRow['type_id']);
         $sModule = $aParts1[0];
         if (strpos($sModule, '_')) {
             $aParts = explode('_', $sModule);
             $sModule = $aParts[0];
         }
         if (Phpfox::isModule($sModule)) {
             if ((int) $aRow['total_extra'] > 1) {
                 $aExtra = $this->database()->select('n.owner_user_id, n.time_stamp, n.is_seen, u.full_name')->from($this->_sTable, 'n')->join(Phpfox::getT('user'), 'u', 'u.user_id = n.owner_user_id')->where('n.type_id = \'' . $this->database()->escape($aRow['type_id']) . '\' AND n.item_id = ' . (int) $aRow['item_id'])->group('u.user_id')->order('n.time_stamp DESC')->limit(10)->execute('getSlaveRows');
                 foreach ($aExtra as $iKey => $aExtraUser) {
                     if ($aExtraUser['owner_user_id'] == $aRow['user_id']) {
                         unset($aExtra[$iKey]);
                     }
                     if (!$aRow['is_seen'] && $aExtraUser['is_seen']) {
                         unset($aExtra[$iKey]);
                     }
                 }
                 if (count($aExtra)) {
                     $aRow['extra_users'] = $aExtra;
                 }
             }
             if (substr($aRow['type_id'], 0, 8) != 'comment_' && !Phpfox::hasCallback($aRow['type_id'], 'getNotification')) {
                 $aCallBack['link'] = '#';
                 $aCallBack['message'] = '2. Notification is missing a callback. [' . $aRow['type_id'] . '::getNotification]';
             } elseif (substr($aRow['type_id'], 0, 8) == 'comment_' && substr($aRow['type_id'], 0, 12) != 'comment_feed' && !Phpfox::hasCallback(substr_replace($aRow['type_id'], '', 0, 8), 'getCommentNotification')) {
                 $aCallBack['link'] = '#';
                 $aCallBack['message'] = 'Notification is missing a callback. [' . substr_replace($aRow['type_id'], '', 0, 8) . '::getCommentNotification]';
             } else {
                 // set wanted user id
                 Phpfox::getService('user.auth')->setUserId($iUserId);
                 $aCallBack = Phpfox::callback($aRow['type_id'] . '.getNotification', $aRow);
                 // reset current user id
                 Phpfox::getService('user.auth')->setUserId(null);
                 if ($aCallBack === false) {
                     $this->database()->delete($this->_sTable, 'notification_id = ' . (int) $aRow['notification_id']);
                     continue;
                 }
             }
             $aNotifications[] = array_merge($aRow, (array) $aCallBack);
         }
         //            $this->database()->update($this->_sTable, array('is_seen' => '1'), 'type_id = \'' . $this->database()->escape($aRow['type_id']) . '\' AND item_id = ' . (int) $aRow['item_id']);
     }
     return $aNotifications;
 }
Esempio n. 9
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     static $aBookmarks = array();
     if (empty($aBookmarks)) {
         $aBookmarks = Phpfox::getService('share')->getType();
     }
     if (!is_array($aBookmarks)) {
         $aBookmarks = array();
     }
     $this->template()->assign(array('sBookmarkType' => $this->getParam('type'), 'sBookmarkUrl' => $this->getParam('url'), 'sBookmarkTitle' => $this->getParam('title'), 'bShowSocialBookmarks' => count($aBookmarks) > 0, 'iFeedId' => Phpfox::hasCallback($this->request()->get('sharemodule'), 'canShareItemOnFeed') ? $this->request()->getInt('feed_id') : 0, 'sShareModule' => $this->request()->get('sharemodule')));
 }
Esempio n. 10
0
 /**
  * This function checks if a user is allowed to update the URL of a specific blog
  */
 public function canUpdateURL($sModule, $iUser, $iItemId)
 {
     // first the general permission
     if (!Phpfox::isModule($sModule) || Phpfox::getUserParam($sModule . '.can_update_url') == false || !Phpfox::hasCallback($sModule, 'getRedirectionTable')) {
         return false;
     }
     $iCnt = $this->database()->select('COUNT(*)')->from(Phpfox::callback($sModule . '.getRedirectionTable'))->where('item_id = ' . (int) $iItemId)->execute('getSlaveField');
     if ($iCnt >= Phpfox::getUserParam($sModule . '.how_many_url_updates') && $iCnt > 0 && Phpfox::getUserParam($sModule . '.how_many_url_updates') > 0) {
         return false;
     }
     return true;
 }
Esempio n. 11
0
 public function loadProfileBlock()
 {
     die('sdsdg');
     exit;
     $sProfileUrl = str_replace('profile_', '', $this->get('url'));
     if ($this->get('url') == 'profile_info') {
         $sProfileUrl = 'profile';
     }
     if (!Phpfox::isModule($sProfileUrl)) {
         Phpfox_Error::set('Trying to load an invalid module.');
     } else {
         if (!Phpfox::hasCallback($sProfileUrl, 'getAjaxProfileController')) {
             Phpfox_Error::set('Unable to load the section you are looking for.');
         }
     }
     if (Phpfox_Error::isPassed()) {
         $oModule = Phpfox::getLib('module');
         $oTpl = Phpfox::getLib('template');
         $oTpl->assign(array('bIsAjaxLoader' => true));
         $aStyleInUse = $oTpl->getStyleInUse();
         $oModule->loadBlocks();
         $aUrlParams = array($this->get('user_name'));
         if ($this->get('url') != 'profile') {
             $aUrlParams[] = str_replace('profile_', '', $this->get('url'));
         }
         Phpfox::getLib('url')->setParam($aUrlParams);
         $oModule->setController(Phpfox::callback($sProfileUrl . '.getAjaxProfileController'));
         if ($aStyleInUse['total_column'] == '3') {
             $oTpl->assign(array('aBlocks1' => $oTpl->bIsSample ? true : Phpfox::getLib('module')->getModuleBlocks(1), 'aBlocks3' => $oTpl->bIsSample ? true : Phpfox::getLib('module')->getModuleBlocks(3), 'aAdBlocks1' => $oTpl->bIsSample ? true : (Phpfox::isModule('ad') ? Phpfox::getService('ad')->getForBlock(1) : null), 'aAdBlocks3' => $oTpl->bIsSample ? true : (Phpfox::isModule('ad') ? Phpfox::getService('ad')->getForBlock(3) : null)));
         } else {
             $oTpl->assign(array('aBlocks1' => array(), 'aBlocks3' => array(), 'aAdBlocks1' => array(), 'aAdBlocks3' => array()));
         }
         $oTpl->assign(array('sPublicMessage' => Phpfox::getMessage(), 'aErrors' => Phpfox_Error::getDisplay() ? Phpfox_Error::get() : array(), 'aStyleInUse' => $aStyleInUse));
         list($aBreadCrumbs, $aBreadCrumbTitle) = $oTpl->getBreadCrumb();
         $this->remove('#js_temp_breadcrumb');
         if (count($aBreadCrumbs)) {
             foreach ($aBreadCrumbs as $sLink => $sPhrase) {
                 $this->append('h1', '<span id="js_temp_breadcrumb"><span class="profile_breadcrumb">&#187;</span><a href="' . $sLink . '">' . $sPhrase . '</a></span>');
                 break;
             }
         }
         $oTpl->getLayout($oTpl->sDisplayLayout);
         $this->html($aStyleInUse['total_column'] == '3' ? '#content_load_data' : '#content', $this->getContent(false));
         if ($this->get('url') == 'profile_info') {
             $this->call('$Core.loadProfileInfo();');
         }
     } else {
         $this->html('#js_profile_block_view_data_' . $this->get('url'), implode('', Phpfox_Error::get()));
     }
     $this->call('$Core.loadInit();');
 }
 /**
  * Add link
  * @param $aVals
  * @param $sUrl
  * @param $aLink
  * @return bool
  */
 public function add($aVals, $sUrl, $aLink)
 {
     $aCallback = null;
     if (isset($aVals['callback_module']) && Phpfox::hasCallback($aVals['callback_module'], 'addLink')) {
         $aCallback = Phpfox::callback($aVals['callback_module'] . '.addLink', $aVals);
     }
     $aVals['link'] = $aLink;
     $aVals['link']['url'] = $sUrl;
     $aVals['link']['image'] = $aLink['default_image'];
     if ($iId = Phpfox::getService('link.process')->add($aVals, false, $aCallback)) {
         return $iId;
     }
     return false;
 }
Esempio n. 13
0
 public function delete($iId, $sModule = '')
 {
     Phpfox::isUser(true);
     Phpfox::getUserParam('shoutbox.can_delete_all_shoutbox_messages', true);
     $sTable = 'shoutbox';
     if (!empty($sModule) && Phpfox::hasCallback($sModule, 'getShoutboxData')) {
         $aCallback = Phpfox::callback($sModule . '.getShoutboxData');
         if (isset($aCallback['table'])) {
             $sTable = $aCallback['table'];
         }
     }
     $this->database()->delete(Phpfox::getT($sTable), 'shout_id = ' . (int) $iId);
     return true;
 }
Esempio n. 14
0
 public function process()
 {
     Phpfox::getLib('setting')->setParam(array('profiles.url_image' => Phpfox::getParam('core.url_pic') . 'profiles/'));
     $mUser = $this->request()->get('req2');
     $sSection = $this->request()->get('req3');
     $bIsPublicItemView = false;
     if (Phpfox::isPublicView()) {
         if (!empty($sSection) && Phpfox::isModule($sSection) && $sSection != 'designer' && Phpfox::hasCallback($sSection, 'getItemView') && Phpfox::callback($sSection . '.getItemView') === true) {
             $bIsPublicItemView = true;
         }
     }
     if (!$mUser) {
         if (Phpfox::isUser()) {
             $this->url()->send('profile');
         } else {
             Phpfox::isUser(true);
         }
     }
     $aExtraProfile = Phpfox::getService('profiles')->getProfile($mUser);
     if (count($aExtraProfile) == 0) {
         return Phpfox::getLib('module')->setController('error.404');
     }
     $aUser = Phpfox::getService('user')->get($aExtraProfile['user_id']);
     $this->setParam('aExtraProfile', $aExtraProfile);
     $this->template()->assign(array('aExtraProfile' => $aExtraProfile));
     if (Phpfox::getService('user.block')->isBlocked($aExtraProfile['user_id'], Phpfox::getUserId()) && !Phpfox::getUserParam('user.can_override_user_privacy')) {
         $this->url()->send($aUser['user_name']);
     }
     if (!Phpfox::getService('user.privacy')->hasAccess($aExtraProfile['user_id'], 'profile.view_profile')) {
         $this->url()->send($aUser['user_name']);
     }
     if (!empty($sSection) && $sSection == 'photo') {
         $this->setParam('aParentModule', array('module_id' => 'profiles', 'item_id' => $aExtraProfile['extra_id'], 'url' => $this->url()->makeUrl('profiles', $aExtraProfile['title_url'])));
         $this->template()->setTitle($aExtraProfile['title'])->setBreadcrumb($aExtraProfile['title'], $this->url()->makeUrl('profiles', $aExtraProfile['title_url']));
         $this->url()->aRewrite['photo/add/'] = 'profiles/redirect/photo/add/' . $aExtraProfile['extra_id'];
         $this->url()->aReverseRewrite['profiles/redirect/photo/add/' . $aExtraProfile['extra_id']] = 'photo/add/';
     }
     Phpfox::getUserParam('profile.can_view_users_profile', true);
     $this->template()->setHeader('cache', array('profile.css' => 'style_css', 'feed.js' => 'module_feed'));
     $this->template()->setMeta('description', Phpfox::getPhrase('profiles.meta_description', array('extra_name' => $aExtraProfile['title'], 'site_title' => Phpfox::getParam('core.site_title'), 'meta_description_profile' => Phpfox::getParam('core.meta_description_profile'))));
     $sPageTitle = $aExtraProfile['title'];
     $this->setParam('aFeed', array('comment_type_id' => 'profiles', 'privacy' => 0, 'comment_privacy' => 0, 'item_id' => $aExtraProfile['extra_id'], 'like_type_id' => 'profiles', 'feed_is_liked' => isset($aExtraProfile['is_liked']) ? $aExtraProfile['is_liked'] : false, 'user_id' => $aExtraProfile['user_id'], 'total_comment' => $aExtraProfile['total_comment'], 'total_like' => 0, 'feed_link' => $this->url()->makeUrl('profiles', $aExtraProfile['title_url']), 'feed_title' => $aExtraProfile['title'], 'feed_display' => 'view', 'report_module' => 'profiles', 'report_phrase' => Phpfox::getPhrase('profiles.report_this_profile')));
     $this->template()->setTitle($sPageTitle)->setEditor(array('load' => 'simple', 'wysiwyg' => Phpfox::isModule('comment') && Phpfox::getParam('comment.wysiwyg_comments') && Phpfox::getUserParam('comment.wysiwyg_on_comments')))->setUrl('profiles')->setHeader('cache', array('comment.css' => 'style_css', 'pager.css' => 'style_css', 'jquery/plugin/jquery.scrollTo.js' => 'static_script', 'quick_edit.js' => 'static_script', 'jquery/plugin/jquery.highlightFade.js' => 'static_script'));
     if ($this->request()->get('update')) {
         $this->template()->setHeader('<script type="text/javascript">window.parent.tb_remove();</script>');
     }
     Phpfox::getComponent('photo.index', array('bNoTemplate' => true), 'controller');
     $this->setParam('global_moderation', array('name' => 'photo', 'ajax' => 'profiles.moderation', 'menu' => array(array('phrase' => Phpfox::getPhrase('photo.delete'), 'action' => 'delete'), array('phrase' => Phpfox::getPhrase('photo.approve'), 'action' => 'approve'))));
 }
Esempio n. 15
0
 /**
  * Controller
  */
 public function process()
 {
     $iId = $this->request()->get('id');
     $aRow = Phpfox::getService('attachment')->getForDownload($iId);
     if (!isset($aRow['destination'])) {
         return Phpfox_Error::display(Phpfox::getPhrase('attachment.no_such_download_found'));
     }
     $sPath = Phpfox::getParam('core.dir_attachment') . sprintf($aRow['destination'], '');
     if (Phpfox::hasCallback($aRow['category_id'], 'attachmentControl')) {
         $bAllowed = Phpfox::callback($aRow['category_id'] . '.attachmentControl', $aRow['item_id']);
         if ($bAllowed == false) {
             return Phpfox_Error::display(Phpfox::getPhrase('attachment.you_are_not_allowed_to_download_this_attachment'));
         }
     }
     Phpfox::getService('attachment.process')->updateCounter($aRow['attachment_id']);
     Phpfox_File::instance()->forceDownload($sPath, $aRow['file_name'], $aRow['mime_type'], $aRow['file_size'], $aRow['server_id']);
     exit;
 }
Esempio n. 16
0
 public function getExtra($aRow)
 {
     $aParts1 = explode('.', $aRow['type_id']);
     $sModule = $aParts1[0];
     if (strpos($sModule, '_')) {
         $aParts = explode('_', $sModule);
         $sModule = $aParts[0];
     }
     if (Phpfox::isModule($sModule)) {
         if ((int) $aRow['total_extra'] > 1) {
             $aExtra = $this->database()->select('n.owner_user_id, n.time_stamp, n.is_seen, u.full_name')->from($this->_sTable, 'n')->join(Phpfox::getT('user'), 'u', 'u.user_id = n.owner_user_id')->where('n.type_id = \'' . $this->database()->escape($aRow['type_id']) . '\' AND n.item_id = ' . (int) $aRow['item_id'])->group('u.user_id')->order('n.time_stamp DESC')->limit(10)->execute('getSlaveRows');
             foreach ($aExtra as $iKey => $aExtraUser) {
                 if ($aExtraUser['owner_user_id'] == $aRow['user_id']) {
                     unset($aExtra[$iKey]);
                 }
                 if (!$aRow['is_seen'] && $aExtraUser['is_seen']) {
                     unset($aExtra[$iKey]);
                 }
             }
             if (count($aExtra)) {
                 $aRow['extra_users'] = $aExtra;
             }
         }
         if (substr($aRow['type_id'], 0, 8) != 'comment_' && !Phpfox::hasCallback($aRow['type_id'], 'getNotification')) {
             $aCallBack['link'] = '#';
             $aCallBack['message'] = '2. Notification is missing a callback. [' . $aRow['type_id'] . '::getNotification]';
         } elseif (substr($aRow['type_id'], 0, 8) == 'comment_' && substr($aRow['type_id'], 0, 12) != 'comment_feed' && !Phpfox::hasCallback(substr_replace($aRow['type_id'], '', 0, 8), 'getCommentNotification')) {
             $aCallBack['link'] = '#';
             $aCallBack['message'] = 'Notification is missing a callback. [' . substr_replace($aRow['type_id'], '', 0, 8) . '::getCommentNotification]';
         } else {
             $aCallBack = Phpfox::callback($aRow['type_id'] . '.getNotification', $aRow);
             $aRow['final_module'] = Phpfox::getLib('module')->sFinalModuleCallback;
             if ($aRow['final_module'] == 'photo') {
                 $aCallBack['link'] = $aCallBack['link'] . 'userid_' . Phpfox::getUserId() . '/';
             }
             if ($aCallBack === false) {
                 return false;
             }
         }
         $aRow = array_merge($aRow, (array) $aCallBack);
     }
     return $aRow;
 }
Esempio n. 17
0
 /**
  * Action to take when user cancelled their account. Remove likes ("Joins" to pages too)
  * @param int $iUser
  */
 public function onDeleteUser($iUser)
 {
     // get all the items from this user
     $aLikes = $this->database()->select('like_id, type_id, item_id')->from(Phpfox::getT('like'))->where('user_id = ' . $iUser)->execute('getSlaveRows');
     foreach ($aLikes as $aLike) {
         $sModule = $aLike['type_id'];
         $sExtra = '';
         if (strpos($sModule, '_') !== false) {
             $aParams = explode('_', $sModule);
             $sModule = $aParams[0];
             $sExtra = ucwords($aParams[1]);
         }
         if (Phpfox::hasCallback($sModule, 'deleteLike' . $sExtra)) {
             Phpfox::callback($sModule . '.deleteLike' . $sExtra, $aLike['item_id']);
         }
     }
     $this->database()->delete(Phpfox::getT('like'), 'user_id = ' . $iUser);
     $this->database()->delete(Phpfox::getT('like_cache'), 'user_id = ' . $iUser);
     return true;
 }
Esempio n. 18
0
	public function addViaStatusUpdate()
	{
		Phpfox::isUser(true);
		
		define('PHPFOX_FORCE_IFRAME', true);
		
		$aVals = (array) $this->get('val');		
		
		$aCallback = null;
		if (isset($aVals['callback_module']) && Phpfox::hasCallback($aVals['callback_module'], 'addLink'))
		{
			$aCallback = Phpfox::callback($aVals['callback_module'] . '.addLink', $aVals);	
		}		
		
		if (($iId = Phpfox::getService('link.process')->add($aVals, false, $aCallback)))
		{
			(($sPlugin = Phpfox_Plugin::get('link.component_ajax_addviastatusupdate')) ? eval($sPlugin) : false);
			
			Phpfox::getService('feed')->callback($aCallback)->processAjax($iId);		
		}		
	}
Esempio n. 19
0
 public function addViaStatusUpdate()
 {
     Phpfox::isUser(true);
     define('PHPFOX_FORCE_IFRAME', true);
     $aVals = (array) $this->get('val');
     $aCallback = null;
     if (isset($aVals['callback_module']) && Phpfox::hasCallback($aVals['callback_module'], 'addLink')) {
         $aCallback = Phpfox::callback($aVals['callback_module'] . '.addLink', $aVals);
     }
     if (!empty($aCallback) && $aCallback['module'] == 'pages') {
         $aPage = Phpfox::getService('pages')->getForView($aCallback['item_id']);
         if (isset($aPage['use_timeline']) && $aPage['use_timeline']) {
             if (!defined('PAGE_TIME_LINE')) {
                 define('PAGE_TIME_LINE', true);
             }
         }
     }
     if ($iId = Phpfox::getService('link.process')->add($aVals, false, $aCallback)) {
         ($sPlugin = Phpfox_Plugin::get('link.component_ajax_addviastatusupdate')) ? eval($sPlugin) : false;
         Feed_Service_Feed::instance()->callback($aCallback)->processAjax($iId);
     }
 }
Esempio n. 20
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     if (!Phpfox::isUser()) {
         return false;
     }
     if (PHPFOX_IS_AJAX) {
         $sModule = $this->request()->get('module', false);
         $iItem = $this->request()->getInt('item', false);
         $aCallback = false;
         if ($sModule && $iItem && Phpfox::hasCallback($sModule, 'getEventInvites')) {
             $aCallback = Phpfox::callback($sModule . '.getEventInvites', $iItem);
         }
     }
     $aEvent = PHPFOX_IS_AJAX ? Phpfox::getService('event')->callback($aCallback)->getEvent($this->request()->get('id'), true) : $this->getParam('aEvent');
     if (PHPFOX_IS_AJAX) {
         $this->template()->assign(array('aEvent' => $aEvent, 'aCallback' => $aCallback));
     } else {
         $aCallback = $this->getParam('aCallback', false);
         $this->template()->assign(array('sHeader' => Phpfox::getPhrase('event.your_rsvp'), 'aCallback' => $aCallback));
         return 'block';
     }
 }
Esempio n. 21
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     $iParentFeedId = (int) $this->getParam('parent_feed_id');
     $sParentModuleId = $this->getParam('parent_module_id');
     if (!$iParentFeedId) {
         return false;
     }
     if (!Phpfox::hasCallback($sParentModuleId, 'canShareItemOnFeed')) {
         return false;
     }
     $aParentFeed = Phpfox::callback($sParentModuleId . '.getActivityFeed', array('feed_id' => $iParentFeedId, 'item_id' => $iParentFeedId), null, true);
     /*
     		if ($aParentFeed[0]['privacy'] != '0')
     		{
     			return false;
     		}
     * 
     */
     if (!isset($aParentFeed['type_id'])) {
         $aParentFeed['type_id'] = $sParentModuleId;
     }
     $this->template()->assign(array('aParentFeed' => $aParentFeed));
 }
Esempio n. 22
0
 public function query($sQuery, $iPage, $iTotalShow, $sView = null)
 {
     if ($sView !== null && Phpfox::isModule($sView)) {
         $aModuleResults = Phpfox::callback($sView . '.globalUnionSearch', $this->preParse()->clean($sQuery));
     } else {
         $aModuleResults = Phpfox::massCallback('globalUnionSearch', $this->preParse()->clean($sQuery));
     }
     $iOffset = $iPage * $iTotalShow;
     $aRows = $this->database()->select('item.*, ' . Phpfox::getUserField())->unionFrom('item')->join(Phpfox::getT('user'), 'u', 'u.user_id = item.item_user_id')->limit($iOffset, $iTotalShow)->order('item_time_stamp DESC')->execute('getSlaveRows');
     $aResults = array();
     foreach ($aRows as $iKey => $aRow) {
         $aResults[] = array_merge($aRow, (array) Phpfox::callback($aRow['item_type_id'] . '.getSearchInfo', $aRow));
     }
     if (Phpfox::getParam('core.section_privacy_item_browsing') && !empty($aResults)) {
         // Check for special filters
         $aToParse = array();
         // Group results by their module
         foreach ($aResults as $aResult) {
             $aToParse[$aResult['item_type_id']][] = $aResult['item_id'];
         }
         foreach ($aToParse as $sModule => $aItems) {
             if (Phpfox::hasCallback($sModule, 'filterSearchResults')) {
                 $aNotAllowed = Phpfox::callback($sModule . '.filterSearchResults', $aItems);
                 if (!empty($aNotAllowed)) {
                     foreach ($aNotAllowed as $aItem) {
                         foreach ($aResults as $iKey => $aResult) {
                             if ($aResult['item_type_id'] == $aItem['item_type_id'] && $aResult['item_id'] == $aItem['item_id']) {
                                 unset($aResults[$iKey]);
                             }
                         }
                     }
                 }
             }
         }
     }
     return $aResults;
 }
Esempio n. 23
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     Phpfox::isUser(true);
     $bIsEdit = false;
     $sStep = $this->request()->get('step', false);
     $sAction = $this->request()->get('req3', false);
     $aCallback = false;
     if ($iId = $this->request()->getInt('id')) {
         if ($aVideo = Phpfox::getService('video')->getForEdit($iId)) {
             $bIsEdit = true;
         }
     }
     if ($bIsEdit === false) {
         return Phpfox_Error::display(Phpfox::getPhrase('video.unable_to_edit_this_video'));
     }
     if ($aVals = $this->request()->getArray('val')) {
         if ($mReturn = Phpfox::getService('video.process')->update($aVideo['video_id'], $aVals)) {
             if (isset($aVals['actions'])) {
                 $this->url()->send('video.edit.' . $aVals['action'], array('id' => $aVideo['video_id']), Phpfox::getPhrase('video.video_successfully_updated'));
             } else {
                 $this->url()->permalink('video', $aVideo['video_id'], $aVideo['title'], true, Phpfox::getPhrase('video.video_successfully_updated'));
             }
         }
         $sStep = isset($aVals['step']) ? $aVals['step'] : '';
         $sAction = isset($aVals['action']) ? $aVals['action'] : '';
     }
     if ($aVideo['module_id'] != 'video' && Phpfox::hasCallback($aVideo['module_id'], 'uploadVideo')) {
         $aCallback = Phpfox::callback($aVideo['module_id'] . '.uploadVideo', $aVideo['item_id']);
     }
     $sVideoMessage = '';
     if ($sVideoMessage = Phpfox::getLib('session')->get('video_add_message')) {
         Phpfox::getLib('session')->remove('video_add_message');
     }
     $this->template()->buildPageMenu('js_video_block', array('detail' => Phpfox::getPhrase('video.video_details'), 'photo' => Phpfox::getPhrase('video.photo')), array('link' => $this->url()->permalink('video', $aVideo['video_id'], $aVideo['title']), 'phrase' => Phpfox::getPhrase('video.view_this_video')));
     $iMaxFileSize = Phpfox::getUserParam('video.max_size_for_video_photos') === 0 ? null : Phpfox::getUserParam('video.max_size_for_video_photos') / 1024 * 1048576;
     $this->template()->setTitle(Phpfox::getPhrase('video.editing_video') . ': ' . $aVideo['title'])->setBreadcrumb(Phpfox::getPhrase('video.videos'), $this->url()->makeUrl('video'))->setBreadcrumb(Phpfox::getPhrase('video.editing_video') . ': ' . $aVideo['title'], $this->url()->makeUrl('video.edit', array('id' => $iId)), true)->setPhrase(array('core.select_a_file_to_upload'))->setHeader(array('video.js' => 'module_video', 'edit.js' => 'module_video', '<script type="text/javascript">$Behavior.videoEditCategory = function(){var aCategories = explode(\',\', \'' . $aVideo['categories'] . '\'); for (i in aCategories) { $(\'#js_mp_holder_\' + aCategories[i]).show(); $(\'#js_mp_category_item_\' + aCategories[i]).attr(\'selected\', true); }}</script>', 'progress.js' => 'static_script', '<script type="text/javascript">$Behavior.videoProgressBarSettings = function(){ oProgressBar = {holder: \'#js_video_block_photo_holder\', progress_id: \'#js_progress_bar\', uploader: \'#js_progress_uploader\', add_more: false, max_upload: 1, total: 1, frame_id: \'js_upload_frame\', file_id: \'image\'}; $Core.progressBarInit();}</script>'))->assign(array('aCallback' => $aCallback, 'sStep' => $sStep, 'sVideoMessage' => $sVideoMessage, 'sAction' => $sAction ? $sAction : 'detail', 'sCategories' => Phpfox::getService('video.category')->get(), 'aForms' => $aVideo, 'iMaxFileSize' => $iMaxFileSize, 'sOnClickDeleteImage' => "if (confirm('" . Phpfox::getPhrase('video.are_you_sure') . "')) { \$('#js_submit_upload_image').show(); \$('#js_video_upload_image').show(); \$('#js_video_current_image').remove(); \$.ajaxCall('video.deleteImage', 'id=" . $aVideo['video_id'] . "'); } return false;", 'iMaxFileSize_filesize' => Phpfox::getLib('phpfox.file')->filesize($iMaxFileSize)));
 }
Esempio n. 24
0
 /**
  * Controller
  */
 public function process()
 {
     Phpfox::getUserParam('event.can_access_event', true);
     $aParentModule = $this->getParam('aParentModule');
     if ($aParentModule === null && $this->request()->getInt('req2') > 0) {
         return Phpfox_Module::instance()->setController('event.view');
     }
     if (($sLegacyTitle = $this->request()->get('req2')) && !empty($sLegacyTitle)) {
         if ($this->request()->get('req3') != '') {
             $sLegacyTitle = $this->request()->get('req3');
         }
         $aLegacyItem = Phpfox::getService('core')->getLegacyItem(array('field' => array('category_id', 'name'), 'table' => 'event_category', 'redirect' => 'event.category', 'title' => $sLegacyTitle, 'search' => 'name_url'));
     }
     if (($iRedirectId = $this->request()->getInt('redirect')) && ($aEvent = Event_Service_Event::instance()->getEvent($iRedirectId, true)) && $aEvent['module_id'] != 'event' && Phpfox::hasCallback($aEvent['module_id'], 'getEventRedirect')) {
         if ($sForward = Phpfox::callback($aEvent['module_id'] . '.getEventRedirect', $aEvent['event_id'])) {
             Phpfox::getService('notification.process')->delete('event_invite', $aEvent['event_id'], Phpfox::getUserId());
             $this->url()->forward($sForward);
         }
     }
     if ($iDeleteId = $this->request()->getInt('delete')) {
         if ($mDeleteReturn = Event_Service_Process::instance()->delete($iDeleteId)) {
             if (is_bool($mDeleteReturn)) {
                 $this->url()->send('event', null, Phpfox::getPhrase('event.event_successfully_deleted'));
             } else {
                 $this->url()->forward($mDeleteReturn, Phpfox::getPhrase('event.event_successfully_deleted'));
             }
         }
     }
     if (($iRedirectId = $this->request()->getInt('redirect')) && ($aEvent = Event_Service_Event::instance()->getEvent($iRedirectId, true))) {
         Phpfox::getService('notification.process')->delete('event_invite', $aEvent['event_id'], Phpfox::getUserId());
         $this->url()->permalink('event', $aEvent['event_id'], $aEvent['title']);
     }
     $bIsUserProfile = false;
     if (defined('PHPFOX_IS_AJAX_CONTROLLER')) {
         $bIsUserProfile = true;
         $aUser = Phpfox::getService('user')->get($this->request()->get('profile_id'));
         $this->setParam('aUser', $aUser);
     }
     if (defined('PHPFOX_IS_USER_PROFILE')) {
         $bIsUserProfile = true;
         $aUser = $this->getParam('aUser');
     }
     $oServiceEventBrowse = Phpfox::getService('event.browse');
     $sCategory = null;
     $sView = $this->request()->get('view', false);
     $aCallback = $this->getParam('aCallback', false);
     $this->search()->set(array('type' => 'event', 'field' => 'm.event_id', 'search_tool' => array('default_when' => 'upcoming', 'when_field' => 'start_time', 'when_upcoming' => true, 'table_alias' => 'm', 'search' => array('action' => $aParentModule === null ? $bIsUserProfile === true ? $this->url()->makeUrl($aUser['user_name'], array('event', 'view' => $this->request()->get('view'))) : $this->url()->makeUrl('event', array('view' => $this->request()->get('view'))) : $aParentModule['url'] . 'event/view_' . $this->request()->get('view') . '/', 'default_value' => Phpfox::getPhrase('event.search_events'), 'name' => 'search', 'field' => 'm.title'), 'sort' => array('latest' => array('m.start_time', Phpfox::getPhrase('event.latest'), 'ASC'), 'most-liked' => array('m.total_like', Phpfox::getPhrase('event.most_liked')), 'most-talked' => array('m.total_comment', Phpfox::getPhrase('event.most_discussed'))), 'show' => array(12, 15, 18, 21))));
     $aBrowseParams = array('module_id' => 'event', 'alias' => 'm', 'field' => 'event_id', 'table' => Phpfox::getT('event'), 'hide_view' => array('pending', 'my'));
     switch ($sView) {
         case 'pending':
             if (Phpfox::getUserParam('event.can_approve_events')) {
                 $this->search()->setCondition('AND m.view_id = 1');
             }
             break;
         case 'my':
             Phpfox::isUser(true);
             $this->search()->setCondition('AND m.user_id = ' . Phpfox::getUserId());
             break;
         default:
             if ($bIsUserProfile) {
                 $this->search()->setCondition('AND m.view_id ' . ($aUser['user_id'] == Phpfox::getUserId() ? 'IN(0,2)' : '= 0') . ' AND m.module_id = "event" AND m.privacy IN(' . (Phpfox::getParam('core.section_privacy_item_browsing') ? '%PRIVACY%' : Phpfox::getService('core')->getForBrowse($aUser)) . ') AND m.user_id = ' . (int) $aUser['user_id']);
             } elseif ($aParentModule !== null) {
                 $this->search()->setCondition('AND m.view_id = 0 AND m.privacy IN(%PRIVACY%) AND m.module_id = \'' . Phpfox_Database::instance()->escape($aParentModule['module_id']) . '\' AND m.item_id = ' . (int) $aParentModule['item_id'] . '');
             } else {
                 switch ($sView) {
                     case 'attending':
                         $oServiceEventBrowse->attending(1);
                         break;
                     case 'may-attend':
                         $oServiceEventBrowse->attending(2);
                         break;
                     case 'not-attending':
                         $oServiceEventBrowse->attending(3);
                         break;
                     case 'invites':
                         $oServiceEventBrowse->attending(0);
                         break;
                 }
                 if ($sView == 'attending') {
                     $this->search()->setCondition('AND m.view_id = 0 AND m.privacy IN(%PRIVACY%)');
                 } else {
                     $this->search()->setCondition('AND m.view_id = 0 AND m.privacy IN(%PRIVACY%) AND m.item_id = ' . ($aCallback !== false ? (int) $aCallback['item'] : 0) . '');
                 }
                 if ($this->request()->getInt('user') && ($aUserSearch = Phpfox::getService('user')->getUser($this->request()->getInt('user')))) {
                     $this->search()->setCondition('AND m.user_id = ' . (int) $aUserSearch['user_id']);
                     $this->template()->setBreadcrumb($aUserSearch['full_name'] . '\'s Events', $this->url()->makeUrl('event', array('user' => $aUserSearch['user_id'])), true);
                 }
             }
             break;
     }
     if ($this->request()->getInt('sponsor') == 1) {
         $this->search()->setCondition('AND m.is_sponsor != 1');
         Phpfox::addMessage(Phpfox::getPhrase('event.sponsor_help'));
     }
     if ($this->request()->get('req2') == 'category') {
         $sCategory = $this->request()->getInt('req3');
         $this->search()->setCondition('AND mcd.category_id = ' . (int) $sCategory);
     }
     if ($sView == 'featured') {
         $this->search()->setCondition('AND m.is_featured = 1');
     }
     $this->setParam('sCategory', $sCategory);
     $oServiceEventBrowse->callback($aCallback)->category($sCategory);
     $this->search()->browse()->params($aBrowseParams)->execute();
     $aFilterMenu = array();
     $bSetFilterMenu = !defined('PHPFOX_IS_USER_PROFILE') && !defined('PHPFOX_IS_PAGES_VIEW');
     if ($sPlugin = Phpfox_Plugin::get('event.component_controller_index_set_filter_menu_1')) {
         eval($sPlugin);
         if (isset($mReturnFromPlugin)) {
             return $mReturnFromPlugin;
         }
     }
     if ($bSetFilterMenu) {
         $aFilterMenu = array(Phpfox::getPhrase('event.all_events') => '', Phpfox::getPhrase('event.my_events') => 'my');
         if (Phpfox::isModule('friend') && !Phpfox::getParam('core.friends_only_community')) {
             $aFilterMenu[Phpfox::getPhrase('event.friends_events')] = 'friend';
         }
         list($iTotalFeatured, $aFeatured) = Event_Service_Event::instance()->getFeatured();
         if ($iTotalFeatured) {
             $aFilterMenu[Phpfox::getPhrase('event.featured_events') . '<span class="pending">' . $iTotalFeatured . '</span>'] = 'featured';
         }
         if (Phpfox::getUserParam('event.can_approve_events')) {
             $iPendingTotal = Event_Service_Event::instance()->getPendingTotal();
             if ($iPendingTotal) {
                 $aFilterMenu[Phpfox::getPhrase('event.pending_events') . '<span class="pending">' . $iPendingTotal . '</span>'] = 'pending';
             }
         }
         $aFilterMenu[] = true;
         $aFilterMenu[Phpfox::getPhrase('event.events_i_m_attending')] = 'attending';
         $aFilterMenu[Phpfox::getPhrase('event.events_i_may_attend')] = 'may-attend';
         $aFilterMenu[Phpfox::getPhrase('event.events_i_m_not_attending')] = 'not-attending';
         $aFilterMenu[Phpfox::getPhrase('event.event_invites')] = 'invites';
         $this->template()->buildSectionMenu('event', $aFilterMenu);
     }
     $this->template()->setTitle($bIsUserProfile ? Phpfox::getPhrase('event.full_name_s_events', array('full_name' => $aUser['full_name'])) : Phpfox::getPhrase('event.events'))->setBreadcrumb(Phpfox::getPhrase('event.events'), $aCallback !== false ? $this->url()->makeUrl($aCallback['url_home'][0], array_merge($aCallback['url_home'][1], array('event'))) : ($bIsUserProfile ? $this->url()->makeUrl($aUser['user_name'], 'event') : $this->url()->makeUrl('event')))->setHeader('cache', array('country.js' => 'module_core', 'browse.css' => 'module_event', 'feed.js' => 'module_feed'))->assign(array('aEvents' => $this->search()->browse()->getRows(), 'sView' => $sView, 'aCallback' => $aCallback, 'sParentLink' => $aCallback !== false ? $aCallback['url_home'][0] . '.' . implode('.', $aCallback['url_home'][1]) . '.event' : 'event', 'sApproveLink' => $this->url()->makeUrl('event', array('view' => 'pending'))));
     if ($sCategory !== null) {
         $aCategories = Phpfox::getService('event.category')->getParentBreadcrumb($sCategory);
         $iCnt = 0;
         foreach ($aCategories as $aCategory) {
             $iCnt++;
             $this->template()->setTitle($aCategory[0]);
             if ($aCallback !== false) {
                 $sHomeUrl = '/' . Phpfox_Url::instance()->doRewrite($aCallback['url_home'][0]) . '/' . implode('/', $aCallback['url_home'][1]) . '/' . Phpfox_Url::instance()->doRewrite('event') . '/';
                 $aCategory[1] = preg_replace('/^http:\\/\\/(.*?)\\/' . Phpfox_Url::instance()->doRewrite('event') . '\\/(.*?)$/i', 'http://\\1' . $sHomeUrl . '\\2', $aCategory[1]);
             }
             $this->template()->setBreadcrumb($aCategory[0], $aCategory[1], empty($sView) ? true : false);
         }
     }
     if ($aCallback !== false) {
         $this->template()->rebuildMenu('event.index', $aCallback['url_home']);
     }
     Phpfox_Pager::instance()->set(array('page' => $this->search()->getPage(), 'size' => $this->search()->getDisplay(), 'count' => $this->search()->browse()->getCount()));
     $this->setParam('global_moderation', array('name' => 'event', 'ajax' => 'event.moderation', 'menu' => array(array('phrase' => Phpfox::getPhrase('event.delete'), 'action' => 'delete'), array('phrase' => Phpfox::getPhrase('event.approve'), 'action' => 'approve'))));
 }
Esempio n. 25
0
    /**
     * Controller
     */
    public function process()
    {
        if ($this->request()->get('picup') == '1') {
            // This redirects the user when Picup has finished uploading the photo
            if ($this->request()->isIOS()) {
                die("<script type='text/javascript'>window.location.href = '" . $this->url()->makeUrl('photo.converting') . "'; </script> ");
            } else {
                die("<script type='text/javascript'>window.open('" . $this->url()->makeUrl('photo.converting') . "', 'my_form'); </script> ");
            }
        }
        // Make sure the user is allowed to upload an image
        Phpfox::isUser(true);
        Phpfox::getUserParam('photo.can_upload_photos', true);
        $sModule = $this->request()->get('module', false);
        $iItem = $this->request()->getInt('item', false);
        $bCantUploadMore = Phpfox::getParam('photo.total_photo_input_bars') > Phpfox::getUserParam('photo.max_images_per_upload');
        $iMaxFileSize = Phpfox::getUserParam('photo.photo_max_upload_size') === 0 ? null : Phpfox::getUserParam('photo.photo_max_upload_size') / 1024 * 1048576;
        $sMethod = Phpfox::getParam('photo.enable_mass_uploader') && $this->request()->get('method', '') != 'simple' ? 'massuploader' : 'simple';
        $sMethodUrl = str_replace(array('method_simple/', 'method_massuploader/'), '', $this->url()->getFullUrl()) . 'method_' . ($sMethod == 'simple' ? 'massuploader' : 'simple') . '/';
        if (Phpfox::isMobile() || $this->request()->isIOS()) {
            $sMethod = 'simple';
            /*
            	$this->template()->setHeader(array(
            		'<script type="text/javascript">
            				var flash_user_id = '.Phpfox::getUserId() .';
            				var sHash = "'.Phpfox::getService('core')->getHashForUpload().'";window.name="my_form";</script>',
            				));
            		
            	if ( ($sBrowser = Phpfox_Request::instance()->getBrowser()) && strpos($sBrowser, 'Safari') !== false)
            	{
            		$this->template()->setHeader(array(
            			'mobile.js' => 'module_photo'
            			))
            		->assign(array('bRawFileInput' => true));
            	}
            */
        }
        $this->template()->setPhrase(array('core.select_a_file_to_upload'));
        if ($sMethod == 'massuploader') {
            $this->template()->setPhrase(array('photo.you_can_upload_a_jpg_gif_or_png_file', 'core.name', 'core.status', 'core.in_queue', 'core.upload_failed_your_file_size_is_larger_then_our_limit_file_size', 'core.more_queued_than_allowed'))->setHeader(array('massuploader/swfupload.js' => 'static_script', 'massuploader/upload.js' => 'static_script', '<script type="text/javascript">
						// test for Firebug Lite (when preset it reloads the page so the user hash is not valid)
						if (typeof window.Firebug !="undefined" && window.Firebug.Lite != "undefined")
						{
							alert("You are using Firebug Lite which is known to have problems with our mass uploader. Please use the basic uploader or disable Firebug Lite and reload this page.");
						}
					$oSWF_settings =
					{
						object_holder: function()
						{
							return \'swf_photo_upload_button_holder\';
						},
						
						div_holder: function()
						{
							return \'swf_photo_upload_button\';
						},
						
						get_settings: function()
						{		
							swfu.setUploadURL("' . $this->url()->makeUrl('photo.frame') . '");
							swfu.setFileSizeLimit("' . $iMaxFileSize . ' B");
							swfu.setFileUploadLimit(' . Phpfox::getUserParam('photo.max_images_per_upload') . ');								
							swfu.setFileQueueLimit(' . Phpfox::getUserParam('photo.max_images_per_upload') . ');
							swfu.customSettings.flash_user_id = ' . Phpfox::getUserId() . ';
							swfu.customSettings.sHash = "' . Phpfox::getService('core')->getHashForUpload() . '";
							swfu.customSettings.sAjaxCall = "photo.process";
							swfu.customSettings.sAjaxCallParams = "' . ($sModule !== false ? '&callback_module=' . $sModule . '&callback_item_id=' . $iItem . '&parent_user_id=' . $iItem . '' : '') . '";
							swfu.customSettings.sAjaxCallAction = function(iTotalImages){								
								tb_show(\'\', \'\', null, \'' . Phpfox::getLib('image.helper')->display(array('theme' => 'ajax/add.gif', 'class' => 'v_middle')) . ' ' . Phpfox::getPhrase('photo.please_hold_while_your_images_are_being_processed_processing_image') . ' <span id="js_photo_upload_process_cnt">1</span> ' . Phpfox::getPhrase('photo.out_of') . ' \' + iTotalImages + \'.\', true);
								$Core.loadInit();
							}
							swfu.atFileQueue = function()
							{
								$(\'#js_photo_form :input\').each(function(iKey, oObject)
								{
									swfu.addPostParam($(oObject).attr(\'name\'), $(oObject).val());
								});
							}
						}
					}
				</script>'));
        }
        $this->template()->setHeader('<script type="text/javascript">$Behavior.photoProgressBarSettings = function(){ if ($Core.exists(\'#js_photo_form_holder\')) { oProgressBar = {html5upload: ' . (Phpfox::getParam('photo.html5_upload_photo') ? 'true' : 'false') . ', holder: \'#js_photo_form_holder\', progress_id: \'#js_progress_bar\', uploader: \'#js_photo_upload_input\', add_more: ' . ($bCantUploadMore ? 'false' : 'true') . ', max_upload: ' . Phpfox::getUserParam('photo.max_images_per_upload') . ', total: 1, frame_id: \'js_upload_frame\', file_id: \'image[]\', valid_file_ext: new Array(\'gif\', \'png\', \'jpg\', \'jpeg\')}; $Core.progressBarInit(); } }</script>');
        $aCallback = false;
        if ($sModule !== false && $iItem !== false && Phpfox::hasCallback($sModule, 'getPhotoDetails')) {
            if ($aCallback = Phpfox::callback($sModule . '.getPhotoDetails', array('group_id' => $iItem))) {
                $this->template()->setBreadcrumb($aCallback['breadcrumb_title'], $aCallback['breadcrumb_home']);
                $this->template()->setBreadcrumb($aCallback['title'], $aCallback['url_home']);
                if ($sModule == 'pages' && !Phpfox::getService('pages')->hasPerm($iItem, 'photo.share_photos')) {
                    return Phpfox_Error::display(Phpfox::getPhrase('photo.unable_to_view_this_item_due_to_privacy_settings'));
                }
            }
        }
        $aPhotoAlbums = Phpfox::getService('photo.album')->getAll(Phpfox::getUserId(), $sModule, $iItem);
        foreach ($aPhotoAlbums as $iAlbumKey => $aPhotoAlbum) {
            if ($aPhotoAlbum['profile_id'] > 0) {
                unset($aPhotoAlbums[$iAlbumKey]);
            }
        }
        $this->template()->setTitle(Phpfox::getPhrase('photo.upload_photos'))->setFullSite()->setBreadcrumb(Phpfox::getPhrase('photo.upload_photos'), $this->url()->makeUrl('photo.add'))->setHeader('cache', array('progress.js' => 'static_script'))->setPhrase(array('core.not_a_valid_file_extension_we_only_allow_ext', 'photo.photo_uploads', 'photo.upload_complete_we_are_currently_processing_the_photos'))->assign(array('iMaxFileSize' => $iMaxFileSize, 'iAlbumId' => $this->request()->getInt('album'), 'aAlbums' => $aPhotoAlbums, 'sModuleContainer' => $sModule, 'iItem' => $iItem, 'sMethod' => $sMethod, 'sMethodUrl' => $sMethodUrl, 'sCategories' => Phpfox::getService('photo.category')->get(false, true)));
    }
Esempio n. 26
0
    /**
     * Class process method wnich is used to execute this component.
     */
    public function process()
    {
        Phpfox::isUser(true);
        Phpfox::getUserParam('music.can_upload_music_public', true);
        $sModule = $this->request()->get('module', false);
        $iItem = $this->request()->getInt('item', false);
        $aCallback = false;
        if ($sModule !== false && $iItem !== false && Phpfox::hasCallback($sModule, 'getMusicDetails')) {
            if ($aCallback = Phpfox::callback($sModule . '.getMusicDetails', array('item_id' => $iItem))) {
                $this->template()->setBreadcrumb($aCallback['breadcrumb_title'], $aCallback['breadcrumb_home']);
                $this->template()->setBreadcrumb($aCallback['title'], $aCallback['url_home']);
                if ($sModule == 'pages' && !Phpfox::getService('pages')->hasPerm($iItem, 'music.share_music')) {
                    return Phpfox_Error::display('Unable to view this item due to privacy settings.');
                }
            }
        }
        $bIsEdit = false;
        $aValidation = array('title' => Phpfox::getPhrase('music.provide_a_name_for_this_song'));
        $oValidator = Phpfox::getLib('validator')->set(array('sFormName' => 'js_music_form', 'aParams' => $aValidation));
        if (($iId = $this->request()->getInt('id')) && ($aEditSong = Phpfox::getService('music')->getForEdit($iId))) {
            if ($aEditSong['module_id'] == 'pages') {
                Phpfox::getService('pages')->setIsInPage();
            }
            $bIsEdit = true;
            $this->template()->assign(array('aForms' => $aEditSong));
        }
        $sMethod = Phpfox::getParam('music.music_enable_mass_uploader') && $this->request()->get('method', 'massuploader') == 'massuploader' ? 'massuploader' : 'simple';
        // used to tell the template where to link for the opposite method
        $sMethodUrl = str_replace(array('method_simple/', 'method_massuploader/'), '', $this->url()->getFullUrl()) . 'method_' . ($sMethod == 'simple' ? 'massuploader' : 'simple') . '/';
        $aVals = $this->request()->getArray('val');
        if (isset($aVals['method'])) {
            $sMethod = $aVals['method'];
        }
        if ($bIsEdit && !empty($aVals) && $this->request()->get('upload_via_song')) {
            if ($oValidator->isValid($aVals)) {
                if (Phpfox::getService('music.process')->update($aEditSong['song_id'], $aVals)) {
                    $this->url()->permalink('music', $aEditSong['song_id'], $aEditSong['title'], true, 'Song successfully updated.');
                }
            }
        } else {
            if ($sMethod == 'simple' && !empty($aVals)) {
                if (isset($aVals['music_title'])) {
                    $aVals['title'] = $aVals['music_title'];
                }
                if ($oValidator->isValid($aVals)) {
                    if ($aSong = Phpfox::getService('music.process')->upload($aVals, isset($aVals['album_id']) ? (int) $aVals['album_id'] : 0)) {
                        if (isset($aVals['iframe'])) {
                            if (isset($aVals['music_title'])) {
                                $iFeedId = Phpfox::getService('feed.process')->getLastId();
                                echo "<script type=\"text/javascript\">";
                                if (Phpfox::isModule('video') && Phpfox::getParam('video.convert_servers_enable')) {
                                    echo 'document.domain = "' . Phpfox::getParam('video.convert_js_parent') . '";';
                                }
                                ($sPlugin = Phpfox_Plugin::get('music.component_controller_upload_feed')) ? eval($sPlugin) : false;
                                echo 'window.parent.$.ajaxCall(\'music.displayFeed\', \'id=' . $iFeedId . '&song_id=' . $aSong['song_id'] . '\', \'GET\');';
                                echo "</script>";
                            } else {
                                Phpfox::addMessage(Phpfox::getPhrase('music.song_successfully_uploaded'));
                                echo "<script type=\"text/javascript\">";
                                echo 'window.parent.location.href = "' . $this->url()->makeUrl('music.album.track', array('id' => $aVals['album_id'], 'method' => 'simple')) . '";';
                                echo '</script>';
                            }
                        } else {
                            Phpfox::addMessage(Phpfox::getPhrase('music.song_successfully_uploaded'));
                            echo "<script type=\"text/javascript\">";
                            echo 'window.parent.location.href = "' . $this->url()->permalink('music', $aSong['song_id'], $aSong['title']) . '";';
                            echo '</script>';
                            exit;
                        }
                        exit;
                    } else {
                        if (isset($aVals['music_title'])) {
                            echo "<script type=\"text/javascript\">";
                            echo 'window.parent.$Core.resetActivityFeedError(\'' . implode('<br />', Phpfox_Error::get()) . '\');';
                            echo "</script>";
                        } else {
                            echo "<script type=\"text/javascript\">";
                            echo 'window.parent.$(\'#js_music_upload_song\').show(); window.parent.$(\'.js_upload_song\').remove();';
                            echo 'window.parent.alert(\'' . implode('\\n', Phpfox_Error::get()) . '\');';
                            echo "</script>";
                            exit;
                        }
                    }
                } else {
                    if (isset($aVals['music_title'])) {
                        echo "<script type=\"text/javascript\">";
                        echo 'window.parent.$Core.resetActivityFeedError(\'' . implode('<br />', Phpfox_Error::get()) . '\');';
                        echo "</script>";
                    } else {
                        echo '<script type="text/javascript">';
                        echo 'window.parent.$Core.resetActivityFeedError(\'' . implode('<br />', Phpfox_Error::get()) . '\');';
                        echo 'window.parent.$Core.music.resetUploadForm(\'' . implode('<br />', Phpfox_Error::get()) . '\');';
                        echo '</script>';
                        exit;
                    }
                }
            } elseif ($sMethod == 'massuploader' && isset($_FILES['Filedata'])) {
                $_FILES['mp3'] = $_FILES['Filedata'];
                if ($aSong = Phpfox::getService('music.process')->upload($aVals, isset($aVals['album_id']) ? (int) $aVals['album_id'] : 0)) {
                    if (isset($aVals['inline'])) {
                        $aSong = Phpfox::getService('music')->getSong($aSong['song_id']);
                        $this->template()->assign(array('aSong' => $aSong));
                        $this->template()->getTemplate('music.block.track-entry');
                        $sOutput = Phpfox::getLib('ajax')->getContent(false);
                        Phpfox::addMessage(Phpfox::getPhrase('music.song_successfully_uploaded'));
                        echo 'window.location.href = "' . $this->url()->makeUrl('music.album.track', array('id' => $aVals['album_id'])) . '";';
                        exit;
                    }
                    echo 'window.location.href = "' . $this->url()->permalink('music', $aSong['song_id'], $aSong['title']) . '";';
                    exit;
                } else {
                    echo '$(\'#js_music_upload_song\').show(); $(\'.js_upload_song\').remove();';
                    echo 'alert(\'' . implode('\\n', Phpfox_Error::get()) . '\');';
                    exit;
                }
            }
        }
        if ($sMethod == 'massuploader') {
            $iMaxFileSize = Phpfox::getUserParam('music.music_max_file_size') === 0 ? null : Phpfox::getUserParam('music.music_max_file_size');
            $this->template()->setHeader('cache', array('massuploader/swfupload.js' => 'static_script', 'massuploader/upload.js' => 'static_script', '<script type="text/javascript">
						$oSWF_settings =
						{
							object_holder: function()
							{
								return \'swf_music_upload_button_holder\';
							},
							
							div_holder: function()
							{
								return \'swf_music_upload_button\';
							},
							
							get_settings: function()
							{		
								swfu.setUploadURL("' . $this->url()->makeUrl('music.upload') . '");
								swfu.setFileSizeLimit("' . $iMaxFileSize . ' MB");
								swfu.setFileUploadLimit(1);
								swfu.setFileQueueLimit(1);
								swfu.customSettings.flash_user_id = ' . Phpfox::getUserId() . ';
								swfu.customSettings.sHash = "' . Phpfox::getService('core')->getHashForUpload() . '";
								swfu.setFileTypes("*.mp3","*.mp3");
								swfu.atFileQueue = function()
								{
									$(\'#js_music_form :input\').each(function(iKey, oObject)
									{
										swfu.addPostParam($(oObject).attr(\'name\'), $(oObject).val());
									});
								}
							}
						}
					</script>', 'upload.css' => 'module_music'))->setPhrase(array('core.name', 'core.status', 'core.in_queue', 'core.upload_failed_your_file_size_is_larger_then_our_limit_file_size', 'core.more_queued_than_allowed'));
        }
        $this->template()->setTitle($bIsEdit ? Phpfox::getPhrase('music.editing_song') . ': ' . $aEditSong['title'] : Phpfox::getPhrase('music.upload_a_song'))->setBreadcrumb(Phpfox::getPhrase('music.music'), $aCallback === false ? $this->url()->makeUrl('music') : $aCallback['url_home_photo'])->setBreadcrumb($bIsEdit ? Phpfox::getPhrase('music.editing_song') . ': ' . $aEditSong['title'] : Phpfox::getPhrase('music.upload_a_song'), $this->url()->makeUrl('music.upload'), true)->setFullSite()->setPhrase(array('music.select_an_mp3'))->setHeader('cache', array('upload.js' => 'module_music', 'progress.css' => 'style_css', 'progress.js' => 'static_script', '<script type="text/javascript">$Behavior.musicUpload = function(){ if ($Core.exists(\'#js_music_form_holder\')) { oProgressBar = {holder: \'#js_music_form_holder\', progress_id: \'#js_progress_bar\', total: 1, max_upload: 1, uploader: \'#js_progress_uploader\', frame_id: \'js_upload_frame\', file_id: \'mp3\'}; $Core.progressBarInit(); }}</script>'))->assign(array('sModule' => $sModule, 'iItem' => $iItem, 'bIsEdit' => $bIsEdit, 'aUploadAlbums' => Phpfox::getService('music.album')->getForUpload($aCallback), 'sCreateJs' => $oValidator->createJS(), 'sGetJsForm' => $oValidator->getJsForm(false), 'iUploadLimit' => Phpfox::getLib('file')->getLimit(Phpfox::getUserParam('music.music_max_file_size')), 'aGenres' => Phpfox::getService('music.genre')->getList(), 'sMethod' => $sMethod, 'sMethodUrl' => $sMethodUrl));
    }
Esempio n. 27
0
	/**
	 * Class process method wnich is used to execute this component.
	 */
	public function process()
	{		
		if (defined('PHPFOX_IS_USER_PROFILE') && ($sLegacyTitle = $this->request()->get('req3')) && !empty($sLegacyTitle))
		{			
			Phpfox::getService('core')->getLegacyItem(array(
					'field' => array('video_id', 'title'),
					'table' => 'video',		
					'redirect' => 'video',
					'title' => $sLegacyTitle
				)
			);
		}			
		
		Phpfox::getUserParam('video.can_access_videos', true);
		
		$aParentModule = $this->getParam('aParentModule');			
		
		if (($iRedirectId = $this->request()->getInt('redirect'))
			&& ($aVideo = Phpfox::getService('video')->getVideo($iRedirectId, true))
			&& $aVideo['module_id'] != 'video'
			&& Phpfox::hasCallback($aVideo['module_id'], 'getVideoRedirect')
		)
		{
			if (($sForward = Phpfox::callback($aVideo['module_id'] . '.getVideoRedirect', $aVideo['video_id'])))
			{	
				$this->url()->forward($sForward);
			}
		}
		
		if (($iRedirectId = $this->request()->getInt('redirect')) && ($aVideo = Phpfox::getService('video')->getVideo($iRedirectId, true)))
		{
			$this->url()->send($aVideo['user_name'], array('video', $aVideo['title_url']));
		}
		
		if (($iDeleteId = $this->request()->getInt('delete')))
		{
			if (Phpfox::getService('video.process')->delete($iDeleteId))
			{
				$this->url()->send('video', null, Phpfox::getPhrase('video.video_successfully_deleted'));
			}
		}
		
		if ($aParentModule === null && $this->request()->getInt('req2'))
		{
			return Phpfox::getLib('module')->setController('video.view');
		}
		
		if ($this->request()->get('req2') == 'category' && ($sLegacyTitle = $this->request()->get('req3')) && !is_numeric($sLegacyTitle) && !empty($sLegacyTitle))
		{
			$aLegacyItem = Phpfox::getService('core')->getLegacyItem(array(
					'field' => array('category_id', 'name'),
					'table' => 'video_category',		
					'redirect' => 'video.category',
					'title' => $sLegacyTitle,
					'search' => 'name_url'
				)
			);		
		}		
		
		$bIsUserProfile = false;
		if (defined('PHPFOX_IS_AJAX_CONTROLLER'))
		{
			$bIsUserProfile = true;
			$aUser = Phpfox::getService('user')->get($this->request()->get('profile_id'));
			$this->setParam('aUser', $aUser);
		}		
		
		if (defined('PHPFOX_IS_USER_PROFILE'))
		{
			$bIsUserProfile = true;
			$aUser = $this->getParam('aUser');
		}
		
		$oServiceVideoBrowse = Phpfox::getService('video.browse');
		$sView = $this->request()->get('view');
		$sCategory = null;		
		$aCallback = false;
		$this->setParam('sTagType', 'video');
		
		$this->search()->set(array(
				'type' => 'video',
				'field' => 'm.video_id',				
				'search_tool' => array(
					'table_alias' => 'm',
					'search' => array(
						'action' => (defined('PHPFOX_IS_PAGES_VIEW') ? $aParentModule['url'] . 'video/' : $this->url()->makeUrl('video', array('view' => $this->request()->get('view')))),
						'default_value' => Phpfox::getPhrase('video.search_videos'),
						'name' => 'search',
						'field' => 'm.title'
					),
					'sort' => array(
						'latest' => array('m.time_stamp', Phpfox::getPhrase('video.latest')),
						'most-viewed' => array('m.total_view', Phpfox::getPhrase('video.most_viewed')),
						'most-liked' => array('m.total_like', Phpfox::getPhrase('video.most_liked')),
						'most-talked' => array('m.total_comment', Phpfox::getPhrase('video.most_discussed'))
					),
					'show' => array(12, 15, 18, 21)
				)
			)
		);
		
		$aBrowseParams = array(
			'module_id' => 'video',
			'alias' => 'm',
			'field' => 'video_id',
			'table' => Phpfox::getT('video'),
			'hide_view' => array('pending', 'my')				
		);			
		
		switch ($sView)
		{
			case 'pending':
				if (Phpfox::getUserParam('video.can_approve_videos'))
				{
					$this->search()->setCondition('AND m.view_id = 2');
				}
				break;
			case 'my':
				Phpfox::isUser(true);
				$this->search()->setCondition('AND m.user_id = ' . Phpfox::getUserId());
				break;
			default:
				if ($bIsUserProfile)
				{
					$this->search()->setCondition('AND m.in_process = 0 AND m.view_id ' . ($aUser['user_id'] == Phpfox::getUserId() ? 'IN(0,2)' : '= 0') . ' AND m.item_id = 0 AND m.privacy IN(' . (Phpfox::getParam('core.section_privacy_item_browsing') ? '%PRIVACY%' : Phpfox::getService('privacy')->getForBrowse($aUser)) . ') AND m.user_id = ' . (int) $aUser['user_id']);
				}
				else
				{			
					if (defined('PHPFOX_IS_PAGES_VIEW'))
					{
						$this->search()->setCondition('AND m.in_process = 0 AND m.view_id = 0 AND m.module_id = \'' . Phpfox::getLib('database')->escape($aParentModule['module_id']) . '\' AND m.item_id = ' . (int) $aParentModule['item_id'] . ' AND m.privacy IN(%PRIVACY%)');
					}
					else
					{
						$this->search()->setCondition('AND m.in_process = 0 AND m.view_id = 0 AND m.item_id = 0 AND m.privacy IN(%PRIVACY%)');
					}
				}
				break;
		}
		
		$sTagSearchValue = null;
		if ($this->request()->get('req2') == 'tag' && $this->request()->get('req3'))
		{
			$sCategory = null;
			$sCategoryUrl = '';
			$sTagSearchValue = $this->request()->get('req3');
		}		
		
		if ($this->request()->get('req2') == 'category')
		{
			$sCategory = $this->request()->getInt('req3');
			$this->search()->setCondition('AND mcd.category_id = ' . (int) $sCategory);
		}
		
		$this->setParam('sCategory', $sCategory);
		if ($this->request()->getInt('sponsor') == 1)
		{
		    $this->search()->setCondition('AND m.is_sponsor != 1');
		    Phpfox::addMessage(Phpfox::getPhrase('video.sponsor_help'));
		}
		
		if ($sView == 'featured')
		{
			$this->search()->setCondition('AND m.is_featured = 1');
		}
		
		$oServiceVideoBrowse->category($sCategory)->tag($sTagSearchValue);					
			
		$this->search()->browse()->params($aBrowseParams)->execute();
		
		$aFilterMenu = array();
		if (!defined('PHPFOX_IS_USER_PROFILE') && !defined('PHPFOX_IS_PAGES_VIEW'))
		{
			$aFilterMenu = array(
				Phpfox::getPhrase('video.all_videos') => '',
				Phpfox::getPhrase('video.my_videos') => 'my'				
			);					
				
			if (Phpfox::isModule('friend') && !Phpfox::getParam('core.friends_only_community'))
			{
				$aFilterMenu[Phpfox::getPhrase('video.friends_videos')] = 'friend';	
			}			
			
			list($iTotalFeatured, $aFeatured) = Phpfox::getService('video')->getFeatured();
			if ($iTotalFeatured)
			{
				$aFilterMenu[Phpfox::getPhrase('video.featured_videos') . '<span class="pending">' . $iTotalFeatured . '</span>'] = 'featured';
			}			
			
			if (Phpfox::getUserParam('video.can_approve_videos'))
			{
				$iPendingTotal = Phpfox::getService('video')->getPendingTotal();
				
				if ($iPendingTotal)
				{
					$aFilterMenu[Phpfox::getPhrase('video.pending') . (Phpfox::getUserParam('video.can_approve_videos') ? '<span class="pending">' . $iPendingTotal . '</span>' : 0)] = 'pending';
				}
			}
			
			$this->template()->buildSectionMenu('video', $aFilterMenu);
		}					
		
		if (defined('PHPFOX_IS_USER_PROFILE'))
		{
			$this->template()->setMeta('description', Phpfox::getPhrase('video.full_name_s_videos_full_name_has_total_video_s' , array('full_name' => $aUser['full_name'], 'total' => $this->search()->browse()->getCount())));
		}
		
		$this->template()->setTitle(($bIsUserProfile ? Phpfox::getPhrase('video.full_name_s_videos', array('full_name' => $aUser['full_name'])) : Phpfox::getPhrase('video.videos')))
			->setBreadcrumb(Phpfox::getPhrase('video.videos'), (defined('PHPFOX_IS_USER_PROFILE') ? $this->url()->makeUrl($aUser['user_name'], 'video') : ($aCallback === false ? $this->url()->makeUrl('video') : $this->url()->makeUrl($aCallback['url_home'][0], array_merge($aCallback['url_home'][1], array('video'))))))
			->setMeta('keywords', Phpfox::getParam('video.video_meta_keywords'))
			->setMeta('description', Phpfox::getParam('video.video_meta_description'))
			->setHeader('cache', array(
					'pager.css' => 'style_css',
					'video.js' => 'module_video',
					'video.css' => 'module_video'
				)
			)
			->assign(array(
					'aVideos' => $this->search()->browse()->getRows(),
					'sLinkPendingVideos' => $this->url()->makeUrl('video.pending'),
					'sView' => $sView,
					'sPublicPhotoView' => $sView
				)
			);		
			
		if ($sCategory !== null)
		{
			$aCategories = Phpfox::getService('video.category')->getParentBreadcrumb($sCategory);
			$iCnt = 0;
			foreach ($aCategories as $aCategory)
			{
				$iCnt++;
				
				$this->template()->setTitle($aCategory[0]);					

				if ($aCallback !== false)
				{
					$sHomeUrl = '/' . $aCallback['url_home'][0] . '/' . implode('/', $aCallback['url_home'][1]) . '/video/';
					$aCategory[1] = preg_replace('/^http:\/\/(.*?)\/video\/(.*?)$/i', 'http://\\1' . $sHomeUrl . '\\2', $aCategory[1]);
				}

				$this->template()->setBreadcrumb($aCategory[0], $aCategory[1], ($iCnt === count($aCategories) ? true : false));
			}			
		}			
			
		if ($aCallback !== false)
		{
			$this->template()->rebuildMenu('video.index', $aCallback['url_home']);
		}
		
		foreach ((array) $this->search()->browse()->getRows() as $aVideo)
		{
			$this->template()->setMeta('keywords', $this->template()->getKeywords($aVideo['title']));
		}
		
		if (!empty($sTagSearchValue))
		{
			$this->template()->setBreadcrumb(Phpfox::getPhrase('video.topic') . ': ' . $sTagSearchValue, $this->url()->makeUrl('video.tag', $sTagSearchValue), true);
		}
		
		Phpfox::getLib('pager')->set(array('page' => $this->search()->getPage(), 'size' => $this->search()->getDisplay(), 'count' => $this->search()->browse()->getCount()));
		
		$this->setParam('global_moderation', array(
				'name' => 'video',
				'ajax' => 'video.moderation',
				'menu' => array(
					array(
						'phrase' => Phpfox::getPhrase('video.delete'),
						'action' => 'delete'
					),
					array(
						'phrase' => Phpfox::getPhrase('video.approve'),
						'action' => 'approve'
					)					
				)
			)
		);		
	}
Esempio n. 28
0
 private function _processFeed($aRow, $sKey, $iUserid, $bFirstCheckOnComments)
 {
     $original = isset($aRow['content']) ? $aRow['content'] : '';
     switch ($aRow['type_id']) {
         case 'comment_profile':
         case 'comment_profile_my':
             $aRow['type_id'] = 'profile_comment';
             break;
         case 'profile_info':
             $aRow['type_id'] = 'custom';
             break;
         case 'comment_photo':
             $aRow['type_id'] = 'photo_comment';
             break;
         case 'comment_blog':
             $aRow['type_id'] = 'blog_comment';
             break;
         case 'comment_video':
             $aRow['type_id'] = 'video_comment';
             break;
         case 'comment_group':
             $aRow['type_id'] = 'pages_comment';
             break;
     }
     if (preg_match('/(.*)_feedlike/i', $aRow['type_id']) || $aRow['type_id'] == 'profile_design') {
         $this->database()->delete(Phpfox::getT('feed'), 'feed_id = ' . (int) $aRow['feed_id']);
         return false;
     }
     /*
     if (($aRow['type_id'])) {
     	$isApp = true;
     }
     */
     try {
         $App = (new Core\App())->get($aRow['type_id']);
         $isApp = true;
     } catch (Exception $e) {
         $isApp = false;
     }
     if (!$isApp && !Phpfox::hasCallback($aRow['type_id'], 'getActivityFeed')) {
         return false;
     }
     $bCacheFeed = false;
     if (Phpfox::getParam('feed.cache_each_feed_entry')) {
         $bCacheFeed = true;
     }
     $sFeedCacheId = $this->cache()->set(array('feeds', $aRow['type_id'] . '_' . $aRow['item_id']));
     if ($bCacheFeed && ($aFeed = $this->cache()->get($sFeedCacheId))) {
         if (Phpfox::hasCallback($aRow['type_id'], 'getActivityFeedCustomChecks')) {
             $aFeed = Phpfox::callback($aRow['type_id'] . '.getActivityFeedCustomChecks', $aFeed, $aRow);
             if ($aFeed === false) {
                 return false;
             }
         }
     } else {
         if ($isApp) {
             // $aFeed = $aRow;
             $aRow['item_id'] = $aRow['feed_id'];
             $Map = $App->map($aRow['content'], $aRow);
             $aFeed = ['is_app' => true, 'feed_link' => $Map->link, 'feed_title' => $Map->title, 'item_id' => $aRow['feed_id'], 'comment_type_id' => 'app', 'like_type_id' => 'app', 'feed_total_like' => (int) $this->database()->select('COUNT(*)')->from(':like')->where(['type_id' => 'app', 'item_id' => $aRow['feed_id']])->execute('getField'), 'total_comment' => (int) $this->database()->select('COUNT(*)')->from(':comment')->where(['type_id' => 'app', 'item_id' => $aRow['feed_id']])->execute('getField'), 'feed_is_liked' => $this->database()->select('COUNT(*)')->from(':like')->where(['type_id' => 'app', 'item_id' => $aRow['feed_id'], 'user_id' => Phpfox::getUserId()])->execute('getField') ? true : false];
             if ($Map->content) {
                 $aFeed['app_content'] = $Map->content;
             }
         } else {
             $aFeed = Phpfox::callback($aRow['type_id'] . '.getActivityFeed', $aRow, isset($this->_aCallback['module']) ? $this->_aCallback : null);
             if ($aFeed === false) {
                 return false;
             }
         }
         /*
          if (!empty($aRow['feed_reference']))
          {
          $aRow['item_id'] = $aRow['feed_reference'];
          }
         */
         if (isset($this->_aViewMoreFeeds[$sKey])) {
             foreach ($this->_aViewMoreFeeds[$sKey] as $iSubKey => $aSubRow) {
                 $mReturnViewMore = $this->_processFeed($aSubRow, $iSubKey, $iUserid, $bFirstCheckOnComments);
                 if ($mReturnViewMore === false) {
                     continue;
                 }
                 // http://www.phpfox.com/tracker/view/15457/
                 $mReturnViewMore['call_displayactions'] = true;
                 // END
                 $aFeed['more_feed_rows'][] = $mReturnViewMore;
             }
         }
         if (Phpfox::isModule('like') && (isset($aFeed['like_type_id']) || isset($aRow['item_id'])) && (isset($aFeed['enable_like']) && $aFeed['enable_like']) || !isset($aFeed['enable_like']) && (isset($aFeed['feed_total_like']) && (int) $aFeed['feed_total_like'] > 0)) {
             $aFeed['likes'] = Phpfox::getService('like')->getLikesForFeed($aFeed['like_type_id'], isset($aFeed['like_item_id']) ? $aFeed['like_item_id'] : $aRow['item_id'], (int) $aFeed['feed_is_liked'] > 0 ? true : false, Phpfox::getParam('feed.total_likes_to_display'), true);
             $aFeed['feed_total_like'] = Phpfox::getService('like')->getTotalLikeCount();
         }
         if (isset($aFeed['comment_type_id']) && (int) $aFeed['total_comment'] > 0 && Phpfox::isModule('comment')) {
             $aFeed['comments'] = Phpfox::getService('comment')->getCommentsForFeed($aFeed['comment_type_id'], $aRow['item_id'], Phpfox::getParam('comment.comment_page_limit'));
         }
         if ($bCacheFeed) {
             $this->cache()->save($sFeedCacheId, $aFeed);
         }
     }
     // Check if user can post comments on this feed/item
     $bCanPostComment = false;
     if ($bFirstCheckOnComments) {
         $bCanPostComment = true;
     }
     if ($iUserid !== null && $iUserid != Phpfox::getUserId()) {
         switch ($aRow['privacy_comment']) {
             case '1':
                 // http://www.phpfox.com/tracker/view/14418/ instead of "if(!Phpfox::getService('user')->getUserObject($iUserid)->is_friend)"
                 if (Friend_Service_Friend::instance()->isFriend(Phpfox::getUserId(), $aRow['user_id'])) {
                     $bCanPostComment = false;
                 }
                 break;
             case '2':
                 // http://www.phpfox.com/tracker/view/14418/ instead of "if (!Phpfox::getService('user')->getUserObject($iUserid)->is_friend && !Phpfox::getService('user')->getUserObject($iUserid)->is_friend_of_friend)"
                 if (Friend_Service_Friend::instance()->isFriend(Phpfox::getUserId(), $aRow['user_id']) && Friend_Service_Friend::instance()->isFriendOfFriend($aRow['user_id'])) {
                     $bCanPostComment = false;
                 }
                 break;
             case '3':
                 $bCanPostComment = false;
                 break;
         }
     }
     if ($iUserid === null) {
         if ($aRow['user_id'] != Phpfox::getUserId()) {
             switch ($aRow['privacy_comment']) {
                 case '1':
                 case '2':
                     if (!isset($aRow['is_friend']) || !$aRow['is_friend']) {
                         $bCanPostComment = false;
                     }
                     break;
                 case '3':
                     $bCanPostComment = false;
                     break;
             }
         }
     }
     $aRow['can_post_comment'] = $bCanPostComment;
     $aFeed['bShowEnterCommentBlock'] = false;
     if (isset($aFeed['feed_total_like']) && $aFeed['feed_total_like'] > 0 || isset($aFeed['marks']) && is_array($aFeed['marks']) && count($aFeed['marks']) || isset($aFeed['comments']) && is_array($aFeed['comments']) && count($aFeed['comments'])) {
         $aFeed['bShowEnterCommentBlock'] = true;
     }
     $aOut = array_merge($aRow, $aFeed);
     $aOut['_content'] = $original;
     if ($sPlugin = Phpfox_Plugin::get('feed.service_feed_processfeed')) {
         eval($sPlugin);
     }
     return $aOut;
 }
Esempio n. 29
0
 public function updateText($iId, $sText)
 {
     if (Phpfox::getService('comment')->hasAccess($iId, 'edit_own_comment', 'edit_user_comment')) {
         $oFilter = Phpfox::getLib('parse.input');
         Phpfox::getService('ban')->checkAutomaticBan($sText);
         if (Phpfox::getParam('comment.spam_check_comments')) {
             if (Phpfox::getLib('spam')->check(array('action' => 'isSpam', 'params' => array('module' => 'comment', 'content' => Phpfox::getLib('parse.input')->prepare($sText))))) {
                 $this->database()->update(Phpfox::getT('comment'), array('view_id' => '9'), "comment_id = " . (int) $iId);
                 Phpfox_Error::set(Phpfox::getPhrase('comment.your_comment_has_been_marked_as_spam_it_will_have_to_be_approved_by_an_admin'));
             }
         }
         $aVals = $this->database()->select('cmt.*')->from($this->_sTable, 'cmt')->where('cmt.comment_id = ' . (int) $iId)->execute('getSlaveRow');
         Phpfox::getLib('parse.bbcode')->useVideoImage($aVals['type_id'] == 'feed' ? true : false);
         $this->database()->update(Phpfox::getT('comment'), array('update_time' => PHPFOX_TIME, "update_user" => Phpfox::getUserBy("full_name")), "comment_id = " . (int) $iId);
         $this->database()->update(Phpfox::getT('comment_text'), array('text' => $oFilter->clean($sText), "text_parsed" => $oFilter->prepare($sText)), "comment_id = " . (int) $iId);
         if (Phpfox::hasCallback($aVals['type_id'], 'updateCommentText')) {
             Phpfox::callback($aVals['type_id'] . '.updateCommentText', $aVals, $oFilter->prepare($sText));
         }
         return true;
     }
     return false;
 }
Esempio n. 30
-1
 /**
  * Controller
  */
 public function process()
 {
     ($sPlugin = Phpfox_Plugin::get('profile.component_block_header_process')) ? eval($sPlugin) : false;
     if (defined('PHPFOX_IS_PAGES_ADD')) {
         return false;
     }
     $aUser = $this->getParam('aUser');
     if ($aUser === null) {
         $aUser = $this->getParam('aPage');
     } else {
         if (!isset($aUser['is_featured'])) {
             // If for some reason this is happening too often check the caching in /file/cache/profile
             // and the user service, function get
             $aUser['is_featured'] = false;
         }
     }
     if (!Phpfox::isModule('friend')) {
         $aUser['is_friend'] = false;
     }
     $aUser['is_header'] = true;
     $aUser['is_liked'] = !isset($aUser['is_liked']) || $aUser['is_liked'] === null || $aUser['is_liked'] < 1 ? false : true;
     if (!isset($aUser['user_id'])) {
         return false;
     }
     if (!defined('PAGE_TIME_LINE') && !defined('PHPFOX_IS_PAGES_VIEW')) {
         if (Phpfox::getParam('user.enable_relationship_status')) {
             $sRelationship = Phpfox::getService('custom')->getRelationshipPhrase($aUser);
             $this->template()->assign(array('sRelationship' => $sRelationship));
         }
         $bCanSendPoke = Phpfox::isModule('poke') && Phpfox::getService('poke')->canSendPoke($aUser['user_id']);
         $this->template()->assign(array('bCanPoke' => $bCanSendPoke));
     } else {
         if (isset($aUser['use_timeline']) && $aUser['use_timeline'] || defined('PHPFOX_IS_PAGES_VIEW')) {
             $sPagesSection = Phpfox::getNonRewritten('pages');
             $sModule = $this->request()->get('req1') == $sPagesSection ? $this->request()->get('req3') : $this->request()->get('req2');
             $sModule = Phpfox_Url::instance()->reverseRewrite($sModule);
             if (Phpfox::isModule($sModule) && Phpfox::hasCallback($sModule, 'getPageSubMenu')) {
                 if (defined('PHPFOX_IS_PAGES_VIEW')) {
                     $aPage = $this->getParam('aPage');
                 }
                 $aMenu = Phpfox::callback($sModule . '.getPageSubmenu', defined('PHPFOX_IS_PAGES_VIEW') ? $aPage : $aUser);
                 if (is_array($aMenu)) {
                     foreach ($aMenu as $iKey => $aSubMenu) {
                         $aMenu[$iKey]['module'] = $sModule;
                         if (isset($aSubMenu['phrase'])) {
                             if (Phpfox_Locale::instance()->isPhrase($sModule . '.' . $aSubMenu['phrase'])) {
                                 $aMenu[$iKey]['var_name'] = $aSubMenu['phrase'];
                             } else {
                                 $aMenu[$iKey]['text'] = $aSubMenu['phrase'];
                             }
                             continue;
                         }
                         switch ($sModule) {
                             case 'event':
                                 $aMenu[$iKey]['var_name'] = 'menu_create_new_' . $sModule;
                                 break;
                             case 'forum':
                                 $aMenu[$iKey]['var_name'] = 'post_a_new_thread';
                                 break;
                             case 'music':
                                 $aMenu[$iKey]['var_name'] = 'menu_upload_a_song';
                                 break;
                             case 'photo':
                                 $aMenu[$iKey]['var_name'] = 'upload_a_new_image';
                                 break;
                             case 'video':
                                 $aMenu[$iKey]['var_name'] = 'menu_upload_a_new_video';
                                 break;
                             default:
                                 $aMenu[$iKey]['var_name'] = 'menu_add_new_' . $sModule;
                         }
                     }
                 }
                 $this->template()->assign(array('aSubMenus' => $aMenu));
             }
         }
     }
     $this->template()->assign(array('aUser' => $aUser));
     if (isset($bHideProfileBlockHeader)) {
         return false;
     }
 }