Beispiel #1
0
 /**
  * Class process method which is used to execute this component.
  */
 public function process()
 {
     $this->template()->setTitle(Phpfox::getPhrase('user.email_verification'))->setBreadcrumb(Phpfox::getPhrase('user.email_verification'))->assign(array('iVerifyUserId' => Phpfox::getLib('session')->get('cache_user_id')));
     $sHash = $this->request()->get('link', '');
     if ($sHash == '') {
     } elseif (Phpfox::getService('user.verify.process')->verify($sHash)) {
         if ($sPlugin = Phpfox_Plugin::get('user.component_verify_process_redirection')) {
             eval($sPlugin);
         }
         $sRedirect = Phpfox::getParam('user.redirect_after_signup');
         if (!empty($sRedirect)) {
             Phpfox::getLib('session')->set('redirect', str_replace('.', '/', $sRedirect));
         }
         if (Phpfox::isMobile()) {
             $this->url()->send('mobile.user.login', null, Phpfox::getPhrase('user.your_email_has_been_verified_please_log_in_with_the_information_you_provided_during_sign_up'));
         }
         // send to the log in and say everything is ok
         Phpfox::getLib('session')->set('verified_do_redirect', '1');
         $this->url()->send('user.login', null, Phpfox::getPhrase('user.your_email_has_been_verified_please_log_in_with_the_information_you_provided_during_sign_up'));
     } else {
         //send to the log in and say there was an error
         Phpfox_Error::set(Phpfox::getPhrase('user.invalid_verification_link'));
         $iTime = Phpfox::getParam('user.verify_email_timeout');
         if ($iTime < 60) {
             $sTime = Phpfox::getPhrase('user.time_minutes', array('time' => $iTime));
         } elseif ($iTime < 60 * 60 * 24) {
             $sTime = $iTime == 60 ? Phpfox::getPhrase('user.time_hour', array('time' => round($iTime / 60))) : Phpfox::getPhrase('user.time_hours', array('time' => round($iTime / 60)));
         } else {
             $sTime = Phpfox::getPhrase('user.time_days', array('time' => $sTime));
         }
         Phpfox::getService('user.verify.process')->sendMail(Phpfox::getLib('session')->get('cache_user_id'));
         $this->template()->assign(array('sTime' => $sTime));
     }
 }
Beispiel #2
0
 public function check($sActualTitle, $sReq = 'req3')
 {
     return;
     if (PHPFOX_IS_AJAX) {
         return;
     }
     $sTitle = urldecode(Phpfox_Request::instance()->get($sReq));
     if (empty($sTitle)) {
         $aParts = explode('/', trim(Phpfox_Request::instance()->get(PHPFOX_GET_METHOD), '/'));
         $iCnt = 0;
         foreach ($aParts as $sPart) {
             if (Phpfox::isMobile() && $sPart == 'mobile') {
                 continue;
             }
             $iCnt++;
             if ((int) str_replace('req', '', $sReq) == $iCnt) {
                 $sTitle = $sPart;
                 break;
             }
         }
     }
     $sActualTitle = Phpfox_Url::instance()->cleanTitle($sActualTitle);
     if (empty($sActualTitle)) {
         return;
     }
     if ($sTitle != $sActualTitle) {
         $sPath = '';
         $aRequests = (array) Phpfox_Request::instance()->getRequests();
         if (defined('PHPFOX_IS_AJAX_PAGE') && PHPFOX_IS_AJAX_PAGE) {
             $aSubRequests = explode('/', trim(Phpfox_Request::instance()->get(PHPFOX_GET_METHOD), '/'));
             $aRequests = array();
             foreach ($aSubRequests as $iKey => $sSubRequest) {
                 $sCurrentCnt = 'req' . ($iKey + 1);
                 $aRequests[$sCurrentCnt] = $sSubRequest;
             }
         }
         if (empty($sTitle)) {
             $aRequests[$sReq] = $sActualTitle;
         }
         foreach ($aRequests as $sKey => $sValue) {
             if ($sKey == PHPFOX_GET_METHOD) {
                 continue;
             }
             if ($sKey == $sReq) {
                 $sValue = $sActualTitle;
             }
             $sPath .= $sValue . '.';
         }
         $sPath = rtrim($sPath, '.');
         if (!empty($sActualTitle)) {
             Phpfox_Url::instance()->send($sPath, array(), null, 301);
         }
     }
 }
Beispiel #3
0
    /**
     * Controller
     */
    public function process()
    {
        Phpfox::getUserParam('feed.can_view_feed', true);
        $sFeedDisplay = 'feed.display';
        ($sPlugin = Phpfox_Plugin::get('feed.component_controller_index_feeddisplay')) ? eval($sPlugin) : false;
        /* Load the picup files if needed*/
        if (Phpfox::isMobile() && (($sBrowser = Phpfox_Request::instance()->getBrowser()) && strpos($sBrowser, 'Safari') !== false)) {
            $sMethod = 'simple';
            $this->template()->setHeader(array('<script type="text/javascript">
						var flash_user_id = ' . Phpfox::getUserId() . ';
						var sHash = "' . Phpfox::getService('core')->getHashForUpload() . '";</script>', 'mobile.js' => 'module_photo'))->assign(array('bRawFileInput' => true));
        }
        $this->template()->setEditor()->setHeader('cache', array('feed.js' => 'module_feed', 'comment.css' => 'style_css', 'quick_edit.js' => 'static_script', 'jquery/plugin/jquery.highlightFade.js' => 'static_script'))->assign(array('sFeedDisplay' => $sFeedDisplay));
    }
Beispiel #4
0
 public function canEndingSoonContest($iContestId)
 {
     $aContest = Phpfox::getService('contest.contest')->getContestForCheckingPermission($iContestId);
     if (!$aContest) {
         return false;
     }
     if (!in_array($aContest['contest_status'], array(Phpfox::getService('contest.constant')->getContestStatusIdByStatusName('on_going')))) {
         return false;
     }
     if ((Phpfox::getUserParam('contest.can_ending_soon_contest') || $aContest['module_id'] == 'pages' && Phpfox::getService('pages')->isAdmin($aContest['item_id'])) && !Phpfox::isMobile()) {
         return true;
     } else {
         return false;
     }
     return true;
 }
Beispiel #5
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     if (Phpfox::isMobile()) {
         return false;
     }
     $mAttachmentShare = $this->getParam('attachment_share', null);
     if ($mAttachmentShare === null) {
         return false;
     }
     if (!is_array($mAttachmentShare)) {
         $mAttachmentShare = array('type' => $mAttachmentShare);
     }
     if (!isset($mAttachmentShare['inline'])) {
         $mAttachmentShare['inline'] = false;
     }
     $this->template()->assign(array('aAttachmentShare' => $mAttachmentShare));
 }
 public function filterAd($aAds)
 {
     if (!is_array($aAds)) {
         return $aAds;
     }
     $aAdId = Phpfox::getParam('bettermobile.mobile_ad_id');
     if (!empty($aAdId)) {
         foreach ($aAds as $iKey => $aAd) {
             if (Phpfox::isMobile()) {
                 if (!in_array($aAd['ad_id'], $aAdId)) {
                     unset($aAds[$iKey]);
                 }
             } else {
                 if (in_array($aAd['ad_id'], $aAdId)) {
                     unset($aAds[$iKey]);
                 }
             }
         }
     }
     return $aAds;
 }
Beispiel #7
0
 public function timeline()
 {
     if (Phpfox::isMobile()) {
         return false;
     }
     if (defined('PAGE_TIME_LINE') && PAGE_TIME_LINE) {
         return true;
     }
     $iUserId = Phpfox_Request::instance()->get('profile_user_id');
     if ((defined('PHPFOX_IS_USER_PROFILE') || !empty($iUserId)) && Phpfox::isModule('feed') && Phpfox::getParam('feed.force_timeline')) {
         return true;
     }
     if (PHPFOX_IS_AJAX && (Phpfox_Request::instance()->get('action') == 'upload_photo_via_share' && Phpfox_Request::instance()->get('callback_module') == 'pages' && Phpfox::getService('pages')->timelineEnabled(Phpfox_Request::instance()->get('callback_item_id')))) {
         return true;
     }
     if (Phpfox::isModule('feed') && !Phpfox::getParam('feed.force_timeline')) {
         if (Phpfox::getParam('feed.timeline_optional') && PHPFOX_IS_AJAX && Phpfox_Request::instance()->get('profile_user_id') > 0) {
             $aUser = Phpfox::getService('user')->getUserObject(Phpfox_Request::instance()->get('profile_user_id'));
             if (isset($aUser->use_timeline) && $aUser->use_timeline) {
                 return true;
             }
         }
         if (!PHPFOX_IS_AJAX && Phpfox::getParam('feed.timeline_optional') && defined('PHPFOX_CURRENT_TIMELINE_PROFILE')) {
             $aUser = Phpfox::getService('user')->getUserObject(PHPFOX_CURRENT_TIMELINE_PROFILE);
             if (isset($aUser->use_timeline) && $aUser->use_timeline) {
                 return true;
             }
         }
         $aCore = Phpfox_Request::instance()->get('core');
         if (PHPFOX_IS_AJAX && Phpfox::getParam('feed.timeline_optional') && isset($aCore['profile_user_id']) && $aCore['profile_user_id'] > 0) {
             Phpfox::getService('user')->get($aCore['profile_user_id']);
             $aUser = Phpfox::getService('user')->getUserObject($aCore['profile_user_id']);
             if (isset($aUser->use_timeline) && $aUser->use_timeline) {
                 return true;
             }
         }
         return false;
     }
     return defined('PHPFOX_IS_USER_PROFILE') ? true : false;
 }
Beispiel #8
0
 public function process()
 {
     Phpfox::getLib('setting')->setParam(array('profile.url_image' => Phpfox::getParam('core.url_pic') . 'subprofiles/'));
     $oServiceProfilesBrowse = Phpfox::getService('profiles.browse');
     $oDatabase = Phpfox::getLib('database');
     $oParseInput = Phpfox::getLib('parse.input');
     $iPage = $this->request()->get('page');
     $iPageSize = 25;
     $iTimeDisplay = Phpfox::getLib('date')->mktime(0, 0, 0, Phpfox::getTime('m'), Phpfox::getTime('d'), Phpfox::getTime('Y'));
     $aPages = Phpfox::isMobile() ? array(10) : array(21, 31, 41, 51);
     $aDisplays = array();
     foreach ($aPages as $iPageCnt) {
         $aDisplays[$iPageCnt] = Phpfox::getPhrase('core.per_page', array('total' => $iPageCnt));
     }
     //get the additional browse filters
     $aBrowseFilters = Phpfox::getService('profiles.browse')->getBrowseFilter();
     $aFilters = array('display' => array('type' => 'select', 'options' => $aDisplays, 'default' => '21'), 'sort' => array('type' => 'select', 'options' => array('time_stamp' => Phpfox::getPhrase('profiles.date_added'), 'title' => Phpfox::getPhrase('profiles.name')), 'default' => 'time_stamp', 'alias' => 'p'), 'sort_by' => array('type' => 'select', 'options' => array('DESC' => Phpfox::getPhrase('core.descending'), 'ASC' => Phpfox::getPhrase('core.ascending')), 'default' => 'DESC'), 'keyword' => array('type' => 'input:text', 'size' => 15, 'search' => 'AND p.title LIKE \'%[VALUE]%\''));
     //add the additional admin enabled browse field filters to $aFilters
     if (!empty($aBrowseFilters)) {
         foreach ($aBrowseFilters as $aBrowseFilter) {
             $aBrowseFilter[$aBrowseFilter['field_name']] = array('type' => 'input:text', 'size' => 15, 'search' => 'AND pfv.cf_' . $aBrowseFilter['field_name'] . ' LIKE \'%[VALUE]%\'');
             $aFilters[$aBrowseFilter['field_name']] = $aBrowseFilter[$aBrowseFilter['field_name']];
         }
     }
     $oFilter = Phpfox::getLib('search')->set(array('type' => 'browse', 'filters' => $aFilters, 'search' => 'keyword', 'custom_search' => true));
     $oServiceProfilesBrowse->condition($oFilter->getConditions())->order($oFilter->getSort())->page($iPage)->size($oFilter->getDisplay())->execute();
     Phpfox::getLib('pager')->set(array('page' => $iPage, 'size' => $oFilter->getDisplay(), 'count' => $oFilter->getSearchTotal($oServiceProfilesBrowse->getCount())));
     //This is for adding the snippet fields that have been enabled by the Admin
     $oProfileFields = Phpfox::getService('profiles.browse')->getBrowseDisplay();
     $this->template()->setTitle(Phpfox::getPhrase('profiles.extra_profiles'))->setBreadcrumb(Phpfox::getPhrase('profiles.extra_profiles'))->setHeader('cache', array('pager.css' => 'style_css'))->assign(array('aProfiles' => $oProfileFields, 'aBrowseFilters' => $aBrowseFilters));
     if ($sPlugin = Phpfox_Plugin::get('profiles.component_controller_browse_end')) {
         eval($sPlugin);
         if (isset($mReturnFromPlugin)) {
             return $mReturnFromPlugin;
         }
     }
 }
Beispiel #9
0
 /**
  * Starts the phpFox engine. Used to get and display the pages controller.
  *
  */
 public static function run()
 {
     if (isset($_REQUEST['m9callback'])) {
         header('Content-type: application/json');
         try {
             $Home = new Core\Home(PHPFOX_LICENSE_ID, PHPFOX_LICENSE_KEY);
             $callback = $_REQUEST['m9callback'];
             unset($_GET['m9callback'], $_GET['do']);
             if (!$_GET) {
                 $_GET = [];
             }
             echo json_encode(call_user_func([$Home, $callback], $_GET));
         } catch (\Exception $e) {
             // throw new \Exception($e->getMessage(), 0, $e);
             echo json_encode(['error' => $e->getMessage()]);
         }
         exit;
     }
     $oTpl = Phpfox_Template::instance();
     $aLocale = Phpfox_Locale::instance()->getLang();
     $oReq = Phpfox_Request::instance();
     $oModule = Phpfox_Module::instance();
     if ($oReq->segment(1) == 'favicon.ico') {
         header('Content-type: image/x-icon');
         echo file_get_contents('http://www.phpfox.com/favicon.ico');
         exit;
     }
     $aStaticFolders = ['file', 'static', 'module', 'apps', 'Apps', 'themes'];
     if (in_array($oReq->segment(1), $aStaticFolders) || $oReq->segment(1) == 'theme' && $oReq->segment(2) != 'demo' && $oReq->segment(1) == 'theme' && $oReq->segment(2) != 'sample') {
         $sUri = Phpfox_Url::instance()->getUri();
         if ($sUri == '/static/ajax.php') {
             $oAjax = Phpfox_Ajax::instance();
             $oAjax->process();
             echo $oAjax->getData();
             exit;
         }
         if (Phpfox::getParam('core.url_rewrite') == '1') {
             header("HTTP/1.0 404 Not Found");
             header('Content-type: application/json');
             echo json_encode(['error' => 404]);
             exit;
         }
         $HTTPCache = new Core\HTTP\Cache();
         $HTTPCache->checkCache();
         $sDir = PHPFOX_DIR;
         if ($oReq->segment(1) == 'Apps' || $oReq->segment(1) == 'apps' || $oReq->segment(1) == 'themes') {
             $sDir = PHPFOX_DIR_SITE;
         }
         $sPath = $sDir . ltrim($sUri, '/');
         if ($oReq->segment(1) == 'themes' && $oReq->segment(2) == 'default') {
             $sPath = PHPFOX_DIR . str_replace('themes/default', 'theme/default', $sUri);
         }
         if ($oReq->segment(3) == 'emoticon') {
             $sPath = str_replace('/file/pic/emoticon/default/', PHPFOX_DIR . 'static/image/emoticon/', $sUri);
         }
         $sType = Phpfox_File::instance()->mime($sUri);
         $sExt = Phpfox_File::instance()->extension($sUri);
         if (!file_exists($sPath)) {
             $sPath = str_replace('PF.Base', 'PF.Base/..', $sPath);
             // header('Content-type: ' . $sType);
             if (!file_exists($sPath)) {
                 header("HTTP/1.0 404 Not Found");
                 header('Content-type: application/json');
                 echo json_encode(['error' => 404]);
                 exit;
             }
         }
         // header('Content-type: ' . $sType);
         $HTTPCache->cache($sType, filemtime($sPath), 7);
         if ($oReq->segment(1) == 'themes') {
             $Theme = $oTpl->theme()->get();
             $Service = new Core\Theme\Service($Theme);
             if ($sType == 'text/css') {
                 echo $Service->css()->getParsed();
             } else {
                 echo $Service->js()->get();
             }
         } else {
             echo @file_get_contents($sPath);
         }
         exit;
     }
     ($sPlugin = Phpfox_Plugin::get('run_start')) ? eval($sPlugin) : false;
     // Load module blocks
     $oModule->loadBlocks();
     if (!Phpfox::getParam('core.branding')) {
         $oTpl->setHeader(array('<meta name="author" content="PHPfox" />'));
     }
     if (strtolower(Phpfox_Request::instance()->get('req1')) == Phpfox::getParam('admincp.admin_cp')) {
         self::$_bIsAdminCp = true;
     }
     $View = $oModule->setController();
     if ($View instanceof Core\View) {
     } else {
         if (!self::$_bIsAdminCp) {
             $View = new Core\View();
         }
     }
     if (!PHPFOX_IS_AJAX_PAGE) {
         $oTpl->setImage(array('ajax_small' => 'ajax/small.gif', 'ajax_large' => 'ajax/large.gif', 'loading_animation' => 'misc/loading_animation.gif', 'close' => 'misc/close.gif', 'move' => 'misc/move.png', 'calendar' => 'jquery/calendar.gif'));
         $oTpl->setHeader(array('<meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />', '<meta http-equiv="Content-Type" content="text/html; charset=' . $aLocale['charset'] . '" />', '<meta http-equiv="cache-control" content="no-cache" />', '<meta http-equiv="expires" content="-1" />', '<meta http-equiv="pragma" content="no-cache" />', '<link rel="shortcut icon" type="image/x-icon" href="' . Phpfox::getParam('core.path') . 'favicon.ico?v=' . $oTpl->getStaticVersion() . '" />'))->setMeta('keywords', Phpfox_Locale::instance()->convert(Phpfox::getParam('core.keywords')))->setMeta('robots', 'index,follow');
         $oTpl->setHeader('cache', Phpfox::getMasterFiles());
         if (Phpfox::isModule('friend')) {
             $oTpl->setPhrase(array('friend.show_more_results_for_search_term'));
         }
         if (PHPFOX_DEBUG) {
             $oTpl->setHeader('cache', array('debug.css' => 'style_css'));
         }
         if (!Phpfox::isMobile() && Phpfox::isUser() && Phpfox::getParam('user.enable_user_tooltip')) {
             $oTpl->setHeader('cache', array('user_info.js' => 'static_script'));
         }
         if (Phpfox::isModule('captcha') && Phpfox::getParam('captcha.recaptcha')) {
             // http://www.phpfox.com/tracker/view/14456/
             $sUrl = (Phpfox::getParam('core.force_https_secure_pages') ? 'https' : 'http') . "://www.google.com/recaptcha/api/js/recaptcha_ajax.js";
             $oTpl->setHeader('<script type="text/javascript" src="' . $sUrl . '"></script>');
         }
     }
     if ($sPlugin = Phpfox_Plugin::get('get_controller')) {
         eval($sPlugin);
     }
     $oTpl->assign(['aGlobalUser' => Phpfox::isUser() ? Phpfox::getUserBy(null) : array()]);
     $oModule->getController();
     Phpfox::getService('admincp.seo')->setHeaders();
     if (!defined('PHPFOX_DONT_SAVE_PAGE')) {
         Phpfox::getLib('session')->set('redirect', Phpfox_Url::instance()->getFullUrl(true));
     }
     if (!defined('PHPFOX_NO_CSRF')) {
         Phpfox::getService('log.session')->verifyToken();
     }
     ($sPlugin = Phpfox_Plugin::get('run')) ? eval($sPlugin) : false;
     if (!self::isAdminPanel()) {
         if (!Phpfox::isMobile() && !PHPFOX_IS_AJAX_PAGE && Phpfox::isModule('rss') && !defined('PHPFOX_IS_USER_PROFILE')) {
             $aFeeds = Phpfox::getService('rss')->getLinks();
             if (is_array($aFeeds) && count($aFeeds)) {
                 foreach ($aFeeds as $sLink => $sPhrase) {
                     $oTpl->setHeader('<link rel="alternate" type="application/rss+xml" title="' . $sPhrase . '" href="' . $sLink . '" />');
                 }
             }
         }
         $aPageLastLogin = Phpfox::isModule('pages') && Phpfox::getUserBy('profile_page_id') ? Phpfox::getService('pages')->getLastLogin() : false;
         $oTpl->assign(array('aMainMenus' => $oTpl->getMenu('main'), 'aSubMenus' => $oTpl->getMenu(), 'bIsUsersProfilePage' => defined('PHPFOX_IS_USER_PROFILE') ? true : false, 'sGlobalUserFullName' => Phpfox::isUser() ? Phpfox::getUserBy('full_name') : null, 'sFullControllerName' => str_replace(array('.', '/'), '_', Phpfox_Module::instance()->getFullControllerName()), 'iGlobalProfilePageId' => Phpfox::getUserBy('profile_page_id'), 'aGlobalProfilePageLogin' => $aPageLastLogin));
         $oTpl->setEditor();
         if (Phpfox::isModule('captcha')) {
             $sCaptchaHeader = Phpfox::getParam('captcha.recaptcha_header');
             if (strlen(preg_replace('/\\s\\s+/', '', $sCaptchaHeader)) > 0) {
                 $oTpl->setHeader(array($sCaptchaHeader));
             }
         }
         if (Phpfox::isModule('notification') && Phpfox::isUser() && Phpfox::getParam('notification.notify_on_new_request')) {
             $oTpl->setHeader('cache', array('update.js' => 'module_notification'));
         }
     }
     if (!PHPFOX_IS_AJAX_PAGE && ($sHeaderFile = $oTpl->getHeaderFile())) {
         ($sPlugin = Phpfox_Plugin::get('run_get_header_file_1')) ? eval($sPlugin) : false;
         require_once $sHeaderFile;
     }
     list($aBreadCrumbs, $aBreadCrumbTitle) = $oTpl->getBreadCrumb();
     $oTpl->assign(array('aErrors' => Phpfox_Error::getDisplay() ? Phpfox_Error::get() : array(), 'sPublicMessage' => Phpfox::getMessage(), 'sLocaleDirection' => $aLocale['direction'], 'sLocaleCode' => $aLocale['language_code'], 'sLocaleFlagId' => $aLocale['image'], 'sLocaleName' => $aLocale['title'], 'aBreadCrumbs' => $aBreadCrumbs, 'aBreadCrumbTitle' => $aBreadCrumbTitle, 'sCopyright' => '&copy; ' . Phpfox::getPhrase('core.copyright') . ' ' . Phpfox::getParam('core.site_copyright')));
     Phpfox::clearMessage();
     unset($_SESSION['phpfox']['image']);
     if (Phpfox::getParam('core.cron')) {
         require_once PHPFOX_DIR_CRON . 'exec.php';
     }
     if ($oReq->isPost()) {
         header('X-Is-Posted: true');
         exit;
     }
     if ($oReq->get('is_ajax_get')) {
         header('X-Is-Get: true');
         exit;
     }
     if (defined('PHPFOX_SITE_IS_OFFLINE')) {
         $oTpl->sDisplayLayout = 'blank';
         unset($View);
     }
     if (!PHPFOX_IS_AJAX_PAGE && $oTpl->sDisplayLayout && !isset($View) || !PHPFOX_IS_AJAX_PAGE && self::isAdminPanel()) {
         $oTpl->getLayout($oTpl->sDisplayLayout);
     }
     if (PHPFOX_IS_AJAX_PAGE) {
         header('Content-type: application/json; charset=utf-8');
         /*
         if (isset($View) && $View instanceof \Core\View) {
         	$content = $View->getContent();
         }
         else {
         	Phpfox_Module::instance()->getControllerTemplate();
         	$content = ob_get_contents(); ob_clean();
         }
         */
         if ($View instanceof \Core\View) {
             $content = $View->getContent();
         } else {
             Phpfox_Module::instance()->getControllerTemplate();
             $content = ob_get_contents();
             ob_clean();
         }
         $oTpl->getLayout('breadcrumb');
         $breadcrumb = ob_get_contents();
         ob_clean();
         $aHeaderFiles = Phpfox_Template::instance()->getHeader(true);
         $aCss = [];
         $aLoadFiles = [];
         foreach ($aHeaderFiles as $sHeaderFile) {
             if (!is_string($sHeaderFile)) {
                 continue;
             }
             if (preg_match('/<style(.*)>(.*)<\\/style>/i', $sHeaderFile)) {
                 $aCss[] = strip_tags($sHeaderFile);
                 continue;
             }
             if (preg_match('/href=(["\']?([^"\'>]+)["\']?)/', $sHeaderFile, $aMatches) > 0 && strpos($aMatches[1], '.css') !== false) {
                 $sHeaderFile = str_replace(array('"', "'"), '', $aMatches[1]);
                 $sHeaderFile = substr($sHeaderFile, 0, strpos($sHeaderFile, '?'));
             }
             $sHeaderFile = strip_tags($sHeaderFile);
             $sNew = preg_replace('/\\s+/', '', $sHeaderFile);
             if (empty($sNew)) {
                 continue;
             }
             $aLoadFiles[] = $sHeaderFile;
         }
         $blocks = [];
         foreach (range(1, 12) as $location) {
             if ($location == 3) {
                 echo \Phpfox_Template::instance()->getSubMenu();
             }
             $aBlocks = Phpfox_Module::instance()->getModuleBlocks($location);
             $blocks[$location] = [];
             foreach ($aBlocks as $sBlock) {
                 Phpfox::getBlock($sBlock);
                 $blocks[$location][] = ob_get_contents();
                 ob_clean();
             }
         }
         $oTpl->getLayout('search');
         $search = ob_get_contents();
         ob_clean();
         Phpfox::getBlock('core.template-menusub');
         $menuSub = ob_get_contents();
         ob_clean();
         $h1 = '';
         if (isset($aBreadCrumbTitle[1])) {
             $h1 .= '<h1><a href="' . $aBreadCrumbTitle[1] . '">' . Phpfox_Parse_Output::instance()->clean($aBreadCrumbTitle[0]) . '</a></h1>';
         }
         $oTpl->getLayout('error');
         $error = ob_get_contents();
         ob_clean();
         $controller = Phpfox_Module::instance()->getFullControllerName();
         $data = json_encode(['content' => str_replace(['&#039;'], ["'"], Phpfox_Parse_Input::instance()->convert($content)), 'title' => html_entity_decode($oTpl->instance()->getTitle()), 'phrases' => Phpfox_Template::instance()->getPhrases(), 'files' => $aLoadFiles, 'css' => $aCss, 'breadcrumb' => $breadcrumb, 'blocks' => $blocks, 'search' => $search, 'menuSub' => $menuSub, 'id' => Phpfox_Module::instance()->getPageId(), 'class' => Phpfox_Module::instance()->getPageClass(), 'h1' => $h1, 'h1_clean' => strip_tags($h1), 'error' => $error, 'controller_e' => Phpfox::isAdmin() ? Phpfox_Url::instance()->makeUrl('admincp.element.edit', ['controller' => base64_encode(Phpfox_Module::instance()->getFullControllerName())]) : null, 'meta' => Phpfox_Template::instance()->getPageMeta(), 'keep_body' => Phpfox_Template::instance()->keepBody()]);
         // header("Content-length: " . strlen($data));
         echo $data;
         // sleep(4);
     } else {
         if (isset($View)) {
             echo $View->getContent();
         }
     }
 }
Beispiel #10
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     // $aUser = (PHPFOX_IS_AJAX ? Phpfox::getService('user')->get(Phpfox::getUserId(), true) : $this->getParam('aUser'));
     $aUser = $this->getParam('aUser');
     /*
     if (PHPFOX_IS_AJAX)
     {
     	$aUser['gender_name'] = Phpfox::getService('user')->gender($aUser['gender']);
     	$aUser['birthday_time_stamp'] = $aUser['birthday'];
     	$aUser['birthday'] = Phpfox::getService('user')->age($aUser['birthday']);
     	$aUser['location'] = Phpfox::getService('core.country')->getCountry($aUser['country_iso']);	
     	$this->template()->assign('aUser', $aUser);
     }
     */
     if (!Phpfox::getService('user.privacy')->hasAccess($aUser['user_id'], 'profile.basic_info')) {
         return false;
     }
     $aUser['bRelationshipHeader'] = true;
     $sRelationship = Phpfox::getService('custom')->getRelationshipPhrase($aUser);
     $aUserDetails = array();
     if (!empty($aUser['gender'])) {
         $aUserDetails[Phpfox::getPhrase('profile.gender')] = '<a href="' . $this->url()->makeUrl('user.browse', array('gender' => $aUser['gender'])) . '">' . $aUser['gender_name'] . '</a>';
     }
     $aUserDetails = array_merge($aUserDetails, $aUser['birthdate_display']);
     $sExtraLocation = '';
     if (!empty($aUser['city_location'])) {
         $sExtraLocation .= '<div class="p_2"><a href="' . $this->url()->makeUrl('user.browse', array('location' => $aUser['country_iso'], 'state' => $aUser['country_child_id'], 'city-name' => $aUser['city_location'])) . '">' . Phpfox::getLib('parse.output')->clean($aUser['city_location']) . '</a> &raquo;</div>';
     }
     if ($aUser['country_child_id'] > 0) {
         $sExtraLocation .= '<div class="p_2"><a href="' . $this->url()->makeUrl('user.browse', array('location' => $aUser['country_iso'], 'state' => $aUser['country_child_id'])) . '">' . Phpfox::getService('core.country')->getChild($aUser['country_child_id']) . '</a> &raquo;</div>';
     }
     if (!empty($aUser['country_iso'])) {
         $aUserDetails[Phpfox::getPhrase('profile.location')] = $sExtraLocation . '<a href="' . $this->url()->makeUrl('user.browse', array('location' => $aUser['country_iso'])) . '">' . Phpfox::getPhraseT($aUser['location'], 'country') . '</a>';
     }
     if ((int) $aUser['last_login'] > 0 && (!$aUser['is_invisible'] || Phpfox::getUserParam('user.can_view_if_a_user_is_invisible') && $aUser['is_invisible'])) {
         $aUserDetails[Phpfox::getPhrase('profile.last_login')] = Phpfox::getLib('date')->convertTime($aUser['last_login'], 'core.profile_time_stamps');
     }
     if ((int) $aUser['joined'] > 0) {
         $aUserDetails[Phpfox::getPhrase('profile.member_since')] = Phpfox::getLib('date')->convertTime($aUser['joined'], 'core.profile_time_stamps');
     }
     if (Phpfox::getUserGroupParam($aUser['user_group_id'], 'profile.display_membership_info')) {
         $aUserDetails[Phpfox::getPhrase('profile.membership')] = (empty($aUser['icon_ext']) ? '' : '<img src="' . Phpfox::getParam('core.url_icon') . $aUser['icon_ext'] . '" class="v_middle" alt="' . Phpfox::getLib('locale')->convert($aUser['title']) . '" title="' . Phpfox::getLib('locale')->convert($aUser['title']) . '" /> ') . $aUser['prefix'] . Phpfox::getLib('locale')->convert($aUser['title']) . $aUser['suffix'];
     }
     $aUserDetails[Phpfox::getPhrase('profile.profile_views')] = $aUser['total_view'];
     if (Phpfox::isModule('rss') && Phpfox::getParam('rss.display_rss_count_on_profile') && Phpfox::getService('user.privacy')->hasAccess($aUser['user_id'], 'rss.display_on_profile')) {
         $aUserDetails[Phpfox::getPhrase('profile.rss_subscribers')] = $aUser['rss_count'];
     }
     $sEditLink = '';
     if ($aUser['user_id'] == Phpfox::getUserId()) {
         $sEditLink = '<div class="js_edit_header_bar">';
         $sEditLink .= '<span id="js_user_basic_info" style="display:none;"><img src="' . $this->template()->getStyle('image', 'ajax/small.gif') . '" alt="" class="v_middle" /></span>';
         $sEditLink .= '<a href="' . Phpfox::getLib('url')->makeUrl('user.profile') . '" id="js_user_basic_edit_link">';
         $sEditLink .= '<img src="' . $this->template()->getStyle('image', 'misc/page_white_edit.png') . '" alt="" class="v_middle" />';
         $sEditLink .= '</a>';
         $sEditLink .= '</div>';
     }
     // Get the Smoker and Drinker details
     $aUserPanel = Phpfox::getService('custom')->getUserPanelForUser($aUser['user_id']);
     foreach ($aUserPanel as $sName => $aField) {
         //$aUserDetails[Phpfox::getPhrase($aField['phrase_var_name'])] = Phpfox::getPhrase($aField['phrase_chosen']);
     }
     $this->template()->assign(array('aUserDetails' => $aUserDetails, 'sBlockJsId' => 'profile_basic_info', 'sRelationship' => $sRelationship));
     $this->setParam('aRatingCallback', array('type' => 'user', 'total_rating' => Phpfox::getPhrase('profile.total_rating_ratings', array('total_rating' => $aUser['total_rating'])), 'default_rating' => $aUser['total_score'], 'item_id' => $aUser['user_id'], 'stars' => range(1, 10)));
     ($sPlugin = Phpfox_Plugin::get('profile.component_block_info')) ? eval($sPlugin) : false;
     if (!Phpfox::isMobile()) {
         $this->template()->assign(array('sHeader' => $sEditLink . Phpfox::getPhrase('profile.basic_info'), 'sEditLink' => $sEditLink));
         return 'block';
     }
 }
Beispiel #11
0
 public function checkFeedShareLink()
 {
     if (Phpfox::isMobile()) {
         return false;
     }
     if (defined('PHPFOX_IS_PAGES_VIEW') && !Phpfox::getService('pages')->hasPerm(null, 'video.share_videos')) {
         return false;
     }
     if (!Phpfox::getParam('video.allow_video_uploading') || !Phpfox::getUserParam('video.can_upload_videos')) {
         return false;
     }
 }
Beispiel #12
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     Phpfox::getUserParam('organization.can_view_browse_organization', true);
     $mId = $this->request()->getInt('req2');
     if (!($aOrganization = Phpfox::getService('organization')->getForView($mId))) {
         return Phpfox_Error::display(Phpfox::getPhrase('organization.the_organization_you_are_looking_for_cannot_be_found'));
     }
     if ($this->request()->get('req3') != '') {
         $this->template()->assign(array('bRefreshPhoto' => true));
     }
     if (Phpfox::getUserParam('organization.can_moderate_organization') || $aOrganization['is_admin']) {
     } else {
         if ($aOrganization['view_id'] != '0') {
             return Phpfox_Error::display(Phpfox::getPhrase('organization.the_organization_you_are_looking_for_cannot_be_found'));
         }
     }
     if ($aOrganization['view_id'] == '2') {
         return Phpfox_Error::display(Phpfox::getPhrase('organization.the_organization_you_are_looking_for_cannot_be_found'));
     }
     if (Phpfox::isMobile()) {
         $aPageMenus = Phpfox::getService('organization')->getMenu($aOrganization);
         $aFilterMenu = array();
         foreach ($aPageMenus as $aPageMenu) {
             $aFilterMenu[$aPageMenu['phrase']] = $aPageMenu['url'];
         }
         $this->template()->buildSectionMenu('organization', $aFilterMenu);
     }
     if (Phpfox::getUserBy('profile_organization_id') <= 0 && Phpfox::isModule('privacy')) {
         Phpfox::getService('privacy')->check('organization', $aOrganization['organization_id'], $aOrganization['user_id'], $aOrganization['privacy'], isset($aOrganization['is_friend']) ? $aOrganization['is_friend'] : 0);
     }
     $bCanViewPage = true;
     // http://www.phpfox.com/tracker/view/15190/
     $sCurrentModule = Phpfox::getLib('url')->reverseRewrite($this->request()->get($this->request()->get('req1') == 'organization' ? 'req3' : 'req2'));
     Phpfox::getService('organization')->buildWidgets($aOrganization['organization_id']);
     if ($aOrganization['designer_style_id']) {
         $this->template()->setStyle(array('style_id' => $aOrganization['designer_style_id'], 'style_folder_name' => $aOrganization['designer_style_folder'], 'theme_folder_name' => $aOrganization['designer_theme_folder'], 'theme_parent_id' => $aOrganization['theme_parent_id'], 'total_column' => $aOrganization['total_column'], 'l_width' => $aOrganization['l_width'], 'c_width' => $aOrganization['c_width'], 'r_width' => $aOrganization['r_width']));
     }
     ($sPlugin = Phpfox_Plugin::get('organization.component_controller_view_build')) ? eval($sPlugin) : false;
     $this->setParam('aParentModule', array('module_id' => 'organization', 'item_id' => $aOrganization['organization_id'], 'url' => Phpfox::getService('organization')->getUrl($aOrganization['organization_id'], $aOrganization['title'], $aOrganization['vanity_url'])));
     if (isset($aOrganization['is_admin']) && $aOrganization['is_admin']) {
         define('PHPFOX_IS_ORGANIZATION_ADMIN', true);
     }
     $sModule = $sCurrentModule;
     // http://www.phpfox.com/tracker/view/15190/
     if (empty($sModule) && !empty($aOrganization['landing_organization'])) {
         $sModule = $aOrganization['landing_organization'];
         $sCurrentModule = $aOrganization['landing_organization'];
     }
     ($sPlugin = Phpfox_Plugin::get('organization.component_controller_view_assign')) ? eval($sPlugin) : false;
     if (isset($aOrganization['use_timeline']) && $aOrganization['use_timeline']) {
         $aPageMenus = Phpfox::getService('organization')->getMenu($aOrganization);
         if (!defined('ORGANIZATION_TIME_LINE')) {
             define('ORGANIZATION_TIME_LINE', true);
         }
         $aOrganization['user_name'] = $aOrganization['title'];
         $this->template()->setFullSite()->assign(array('aUser' => $aOrganization, 'aProfileLinks' => $aPageMenus))->setHeader(array('<script type="text/javascript">oParams["keepContent4"] = false;</script>'));
     }
     $this->setParam('aOrganization', $aOrganization);
     $this->template()->assign(array('aOrganization' => $aOrganization, 'sCurrentModule' => $sCurrentModule, 'bCanViewOrganization' => $bCanViewPage, 'iViewCommentId' => $this->request()->getInt('comment-id'), 'bHasPermToViewOrganizationFeed' => Phpfox::getService('organization')->hasPerm($aOrganization['organization_id'], 'organization.view_browse_updates')))->setHeader('cache', array('profile.css' => 'style_css', 'pages.css' => 'style_css', 'organization.js' => 'module_organization', 'player/flowplayer/flowplayer.js' => 'static_script'));
     if (Phpfox::isMobile()) {
         $this->template()->setBreadcrumb($aOrganization['title'], Phpfox::getService('organization')->getUrl($aOrganization['organization_id'], $aOrganization['title'], $aOrganization['vanity_url']), true);
     }
     $this->setParam('aCallbackShoutbox', array('module' => 'organization', 'item' => $aOrganization['organization_id']));
     if ($bCanViewPage && $sModule != 'photo' && $sModule && Phpfox::isModule($sModule) && Phpfox::hasCallback($sModule, 'getOrganizationSubMenu') && !$this->request()->getInt('comment-id')) {
         if (Phpfox::hasCallback($sModule, 'canViewOrganizationSection') && !Phpfox::callback($sModule . '.canViewOrganizationSection', $aOrganization['organization_id'])) {
             return Phpfox_Error::display(Phpfox::getPhrase('organization.unable_to_view_this_section_due_to_privacy_settings'));
         }
         $this->template()->assign('bIsOrganizationViewSection', true);
         $this->setParam('bIsOrganizationViewSection', true);
         $this->setParam('sCurrentOrganizationModule', $sModule);
         Phpfox::getComponent($sModule . '.index', array('bNoTemplate' => true), 'controller');
     } elseif ($bCanViewPage && $sModule != 'photo' && $sModule && Phpfox::getService('organization')->isWidget($sModule) && !$this->request()->getInt('comment-id')) {
         define('PHPFOX_IS_ORGANIZATION_WIDGET', true);
         $this->template()->assign(array('aWidget' => Phpfox::getService('organization')->getWidget($sModule)));
     } else {
         $sSubController = $this->request()->get('req3');
         if ($sSubController == 'info') {
             return Phpfox::getComponent('organization.info', array('bNoTemplate' => true), 'controller');
         } else {
             if ($sSubController == 'volunteer') {
                 return Phpfox::getComponent('organization.volunteer', array('bNoTemplate' => true), 'controller');
             } else {
                 if ($sSubController == 'photo') {
                     return Phpfox::getComponent('organization.photo', array('bNoTemplate' => true), 'controller');
                 }
             }
         }
         $bCanPostComment = true;
         if ($sCurrentModule == 'pending') {
             $this->template()->assign('aPendingUsers', Phpfox::getService('organization')->getPendingUsers($aOrganization['organization_id']));
             $this->setParam('global_moderation', array('name' => 'organization', 'ajax' => 'organization.moderation', 'menu' => array(array('phrase' => Phpfox::getPhrase('organization.delete'), 'action' => 'delete'), array('phrase' => Phpfox::getPhrase('organization.approve'), 'action' => 'approve'))));
         }
         if (Phpfox::getService('organization')->isAdmin($aOrganization)) {
             define('PHPFOX_FEED_CAN_DELETE', true);
         }
         if (Phpfox::getUserId()) {
             $bIsBlocked = Phpfox::getService('user.block')->isBlocked($aOrganization['user_id'], Phpfox::getUserId());
             if ($bIsBlocked) {
                 $bCanPostComment = false;
             }
         }
         // http://www.phpfox.com/tracker/view/15316/
         if ($sCurrentModule != 'info') {
             define('PHPFOX_IS_ORGANIZATION_IS_INDEX', true);
         }
         $this->setParam('aFeedCallback', array('module' => 'organization', 'table_prefix' => 'organization_', 'ajax_request' => 'organization.addFeedComment', 'item_id' => $aOrganization['organization_id'], 'disable_share' => $bCanPostComment ? false : true, 'feed_comment' => 'organization_comment'));
         if (isset($aOrganization['text']) && !empty($aOrganization['text'])) {
             $this->template()->setMeta('description', $aOrganization['text']);
         }
         $this->template()->setTitle($aOrganization['title'])->setEditor()->setHeader('cache', array('jquery/plugin/jquery.highlightFade.js' => 'static_script', 'jquery/plugin/jquery.scrollTo.js' => 'static_script', 'quick_edit.js' => 'static_script', 'comment.css' => 'style_css', 'pager.css' => 'style_css', 'index.css' => 'module_organization', 'feed.js' => 'module_feed'));
         if (Phpfox::getParam('video.convert_servers_enable')) {
             $this->template()->setHeader('<script type="text/javascript">document.domain = "' . Phpfox::getParam('video.convert_js_parent') . '";</script>');
         }
         if ($sModule == 'designer' && $aOrganization['is_admin']) {
             Phpfox::getUserParam('organization.can_design_organization', true);
             define('PHPFOX_IN_DESIGN_MODE', true);
             define('PHPFOX_CAN_MOVE_BLOCKS', true);
             if ($iTestStyle = $this->request()->get('test_style_id')) {
                 if (Phpfox::getLib('template')->testStyle($iTestStyle)) {
                 }
             }
             $aDesigner = array('current_style_id' => $aOrganization['designer_style_id'], 'design_header' => 'Customize organization', 'current_organization' => Phpfox::getService('organization')->getUrl($aOrganization['organization_id'], $aOrganization['title'], $aOrganization['vanity_url']), 'design_organization' => Phpfox::getService('organization')->getUrl($aOrganization['organization_id'], $aOrganization['title'], $aOrganization['vanity_url']) . 'designer/', 'block' => 'organization.view', 'item_id' => $aOrganization['organization_id'], 'type_id' => 'organization');
             $this->setParam('aDesigner', $aDesigner);
             $this->template()->setHeader('cache', array('jquery/ui.js' => 'static_script', 'sort.js' => 'module_theme', 'style.css' => 'style_css', 'select.js' => 'module_theme', 'design.js' => 'module_theme'))->setHeader(array('<script type="text/javascript">$Behavior.organization_controller_view_designonuptade = function() { function designOnUpdate() { $Core.design.updateSorting(); } };</script>', '<script type="text/javascript">$Behavior.organization_controller_view_design_init = function() { $Core.design.init({type_id: \'organization\', item_id: \'' . $aOrganization['organization_id'] . '\'}); };</script>'))->assign('sCustomDesignId', $aOrganization['organization_id']);
         }
     }
 }
Beispiel #13
0
    /**
     * Class process method wnich is used to execute this component.
     */
    public function process()
    {
        Phpfox::isUser(true);
        Phpfox::getUserParam('video.can_upload_videos', true);
        if (Phpfox::getParam('video.convert_servers_enable')) {
            $this->template()->assign('sCustomVideoHash', Phpfox::getService('video')->addCustomHash());
        }
        if (defined('PHPFOX_IS_HOSTED_SCRIPT')) {
            if (Phpfox::getService('video')->getOnCloudLimit()) {
                return Phpfox_Error::display('Monthly video limit reached.');
            }
        }
        if ($sPlugin = Phpfox_Plugin::get('video.component_controller_add_1')) {
            eval($sPlugin);
            if (isset($mReturnFromPlugin)) {
                return $mReturnFromPlugin;
            }
        }
        $sModule = $this->request()->get('module', false);
        $iItem = $this->request()->getInt('item', false);
        $aCallback = false;
        if ($sModule !== false && $iItem !== false && Phpfox::hasCallback($sModule, 'getVideoDetails')) {
            if ($sPlugin = Phpfox_Plugin::get('video.component_controller_add_2')) {
                eval($sPlugin);
                if (isset($mReturnFromPlugin)) {
                    return $mReturnFromPlugin;
                }
            }
            if ($aCallback = Phpfox::callback($sModule . '.getVideoDetails', 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, 'video.share_videos')) {
                    $sPhrase = Phpfox::getPhrase('video.unable_to_view_this_item_due_to_privacy_settings');
                    if ($sPlugin = Phpfox_Plugin::get('video.component_controller_add_sphrase')) {
                        eval($sPlugin);
                    }
                    return Phpfox_Error::display($sPhrase);
                } else {
                    $sPhrase = '';
                    if ($sPlugin = Phpfox_Plugin::get('video.component_controller_add_sphrase_2')) {
                        eval($sPlugin);
                    }
                    if (!empty($sPhrase)) {
                        return Phpfox_Error::display($sPhrase);
                    }
                }
            }
        }
        if ($aVals = $this->request()->get('val')) {
            if ($sPlugin = Phpfox_Plugin::get('video.component_controller_add_3')) {
                eval($sPlugin);
                if (isset($mReturnFromPlugin)) {
                    return $mReturnFromPlugin;
                }
            }
            if (($iFlood = Phpfox::getUserParam('video.flood_control_videos')) !== 0) {
                $aFlood = array('action' => 'last_post', 'params' => array('field' => 'time_stamp', 'table' => Phpfox::getT('video'), 'condition' => 'user_id = ' . Phpfox::getUserId(), 'time_stamp' => $iFlood * 60));
                // actually check if flooding
                if (Phpfox::getLib('spam')->check($aFlood)) {
                    Phpfox_Error::set(Phpfox::getPhrase('video.you_are_sharing_a_video_a_little_too_soon') . ' ' . Phpfox::getLib('spam')->getWaitTime());
                }
            }
            if (Phpfox_Error::isPassed()) {
                if ($sPlugin = Phpfox_Plugin::get('video.component_controller_add_4')) {
                    eval($sPlugin);
                    if (isset($mReturnFromPlugin)) {
                        return $mReturnFromPlugin;
                    }
                }
                if (Phpfox::getService('video.grab')->get($aVals['url'])) {
                    if ($iId = Phpfox::getService('video.process')->addShareVideo($aVals)) {
                        $aVideo = Phpfox::getService('video')->getForEdit($iId);
                        if (Phpfox::getService('video.grab')->hasImage()) {
                            if (isset($aVals['module']) && isset($aVals['item']) && Phpfox::hasCallback($aVals['module'], 'uploadVideo')) {
                                $aCallback = Phpfox::callback($aVals['module'] . '.uploadVideo', $aVals['item']);
                                if ($aCallback !== false) {
                                    $this->url()->send($aCallback['url_home'], array('video', $sTitle), Phpfox::getPhrase('video.video_successfully_added'));
                                }
                            }
                            $this->url()->permalink('video', $aVideo['video_id'], $aVideo['title'], true, Phpfox::getPhrase('video.video_successfully_added'));
                        } else {
                            $this->url()->send('video.edit.photo', array('id' => $aVideo['video_id']), Phpfox::getPhrase('video.video_successfull_added_however_you_will_have_to_manually_upload_a_photo_for_it'));
                        }
                    }
                }
            }
            $sModule = isset($aVals['module']) ? $aVals['module'] : false;
            $iItem = isset($aVals['item']) ? $aVals['item'] : false;
        }
        $sMethod = Phpfox::getParam('video.video_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()) {
            $sMethod = 'simple';
        }
        if (Phpfox::getParam('video.convert_servers_enable')) {
            $aVideoServers = Phpfox::getParam('video.convert_servers');
            $sCustomServerUrl = $aVideoServers[rand(0, count($aVideoServers) - 1)];
            $this->template()->assign('sVideoServerUrl', $sCustomServerUrl);
        }
        if ($sMethod == 'massuploader') {
            $iMaxFileSize = Phpfox::getUserParam('video.video_file_size_limit') === 0 ? null : Phpfox::getUserParam('video.video_file_size_limit') / 1 * 1048576;
            if (Phpfox::isModule('photo')) {
                $this->template()->setPhrase(array('photo.you_can_upload_a_jpg_gif_or_png_file'));
            }
            // video.video_array_support
            $sVideoFormats = '*.mpg; *.mpeg; *.wmv; *.avi; *.mov; *.flv';
            $sVideoNames = 'Video files (mpg, mpeg, wmv, avi, mov or flv)';
            if (Phpfox::getParam('video.upload_for_html5')) {
                $sVideoFormats = '';
                foreach ((array) Phpfox::getParam('video.video_array_support') as $sFormat => $sType) {
                    $sVideoFormats .= '*.' . $sFormat . '; ';
                }
                $sVideoFormats = trim(trim($sVideoFormats), ';');
                $sVideoNames = $sVideoFormats;
            }
            $this->template()->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'))->setHeader(array('massuploader/swfupload.js' => 'static_script', 'massuploader/upload.js' => 'static_script', '<script type="text/javascript">
					// document.domain = "";
					$oSWF_settings =
					{
						object_holder: function()
						{
							return \'swf_video_upload_button_holder\';
						},
						
						div_holder: function()
						{
							return \'swf_video_upload_button\';
						},
						
						get_settings: function()
						{		
							swfu.setUploadURL("' . (isset($sCustomServerUrl) ? $sCustomServerUrl : $this->url()->makeUrl('video.frame')) . '");
							swfu.setFileSizeLimit("' . $iMaxFileSize . ' B");
							swfu.setFileUploadLimit(1);
							swfu.setFileQueueLimit(1);
							swfu.customSettings.flash_user_id = ' . Phpfox::getUserId() . ';
							swfu.customSettings.sHash = "' . Phpfox::getService('core')->getHashForUpload() . '";
							swfu.setFileTypes("' . $sVideoFormats . '","' . $sVideoNames . '");
							swfu.atFileQueue = function()
							{
								$(\'#js_upload_actual_inner_form\').slideUp();
							
								$(\'#js_video_form :input\').each(function(iKey, oObject)
								{									
									swfu.addPostParam($(oObject).attr(\'name\'), $(oObject).val());
								});
							}
						}
					}
				</script>'));
        }
        $aMenus = array();
        if (Phpfox::getParam('video.allow_video_uploading') || Phpfox::getParam('video.vidly_support')) {
            $aMenus[$this->url()->makeUrl('video.add')] = Phpfox::getPhrase('video.file_upload');
        }
        $aMenus[$this->url()->makeUrl('video.add.url')] = Phpfox::getPhrase('video.paste_url');
        if (!empty($sModule)) {
            foreach ($aMenus as $sUrl => $sPhrase) {
                unset($aMenus[$sUrl]);
                $aMenus[$sUrl . 'module_' . $sModule . '/item_' . $iItem . '/'] = $sPhrase;
            }
        }
        $bIsVideoUploading = false;
        if ((Phpfox::getParam('video.allow_video_uploading') || Phpfox::getParam('video.vidly_support')) && $this->request()->get('req3') != 'url') {
            $bIsVideoUploading = true;
        }
        $this->template()->buildPageMenu('js_upload_video', $aMenus, null, true);
        if (Phpfox::getParam('video.video_upload_service')) {
            Phpfox::getService('video.process')->createVidlyToken();
            $aVidlyParams = array('phrases' => array('select_video' => Phpfox::getPhrase('video.select_video')));
            $this->template()->assign('sVidlyParams', urlencode(json_encode($aVidlyParams)));
            $this->template()->setHeader('<script type="text/javascript">$Behavior.checkOnVideo = function(){setInterval("$(\'#js_video_form\').ajaxCall(\'video.checkOnVideo\');", 5000);}</script>');
        }
        if (Phpfox::getParam('video.convert_servers_enable')) {
            $this->template()->setHeader('<script type="text/javascript">document.domain = "' . Phpfox::getParam('video.convert_js_parent') . '";</script>');
        }
        $this->template()->setTitle(Phpfox::getPhrase('video.upload_share_a_video'))->setBreadcrumb(Phpfox::getPhrase('video.video'), $aCallback === false ? $this->url()->makeUrl('video') : $aCallback['url_home_photo'])->setBreadcrumb(Phpfox::getPhrase('video.upload_share_a_video'), $aCallback === false ? $this->url()->makeUrl('video.add') : $this->url()->makeUrl('video.add', array('module' => $sModule, 'item' => $iItem)), true)->setFullSite()->assign(array('sModule' => $sModule, 'iItem' => $iItem, 'sMethod' => $sMethod, 'sMethodUrl' => $sMethodUrl, 'bIsVideoUploading' => $bIsVideoUploading))->setHeader('cache', array('upload.js' => 'module_video', 'video.js' => 'module_video'));
    }
Beispiel #14
0
 public function checkFeedShareLink()
 {
     if (Phpfox::isMobile()) {
         return false;
     }
     if (!Phpfox::getUserParam('music.can_upload_music_public')) {
         return false;
     }
 }
Beispiel #15
0
 /**
  * Gets any data we plan to place within the HTML tags <head></head>.
  * This method also groups the data to give the template a nice clean look.
  *
  * @return string|array $sData Returns the HTML data to be placed within <head></head>
  */
 public function getHeader($bReturnArray = false)
 {
     if (Phpfox::isAdminPanel()) {
         $this->setHeader(array('custom.css' => 'style_css'));
     }
     if ($this->delayedHeaders) {
         foreach ($this->delayedHeaders as $header) {
             $this->setHeader('cache', $header);
         }
     }
     // $this->setHeader('<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">');
     Core\Event::trigger('lib_phpfox_template_getheader', $this);
     foreach ((new Core\App())->all() as $App) {
         if ($App->head && is_array($App->head)) {
             foreach ($App->head as $head) {
                 $this->setHeader($head);
             }
         }
         if ($App->settings) {
             $Setting = new Core\Setting();
             foreach ($App->settings as $key => $setting) {
                 if (isset($setting->js_variable)) {
                     $this->setHeader('<script>var ' . $key . ' = "' . $Setting->get($key) . '";</script>');
                 }
             }
         }
     }
     $aArrayData = array();
     $sData = '';
     $sJs = '';
     $iVersion = $this->getStaticVersion();
     $oUrl = Phpfox_Url::instance();
     $aUrl = $oUrl->getParams();
     if (!defined('PHPFOX_DESIGN_DND')) {
         define('PHPFOX_DESIGN_DND', false);
     }
     if (!PHPFOX_IS_AJAX_PAGE) {
         ($sPlugin = Phpfox_Plugin::get('template_getheader')) ? eval($sPlugin) : false;
         $sJs .= "\t\t\tvar oCore = {'core.is_admincp': " . (Phpfox::isAdminPanel() ? 'true' : 'false') . ", 'core.section_module': '" . Phpfox_Module::instance()->getModuleName() . "', 'profile.is_user_profile': " . (defined('PHPFOX_IS_USER_PROFILE') && PHPFOX_IS_USER_PROFILE ? 'true' : 'false') . ", 'log.security_token': '" . Phpfox::getService('log.session')->getToken() . "', 'core.url_rewrite': '" . Phpfox::getParam('core.url_rewrite') . "', 'core.country_iso': '" . (Phpfox::isUser() ? Phpfox::getUserBy('country_iso') : '') . "', 'core.can_move_on_a_y_and_x_axis' : " . (!defined('PHPFOX_INSTALLER') && Phpfox::getParam('core.can_move_on_a_y_and_x_axis') ? 'true' : 'false') . ", 'core.default_currency': '" . (defined('PHPFOX_INSTALLER') ? 'USD' : Phpfox::getService('core.currency')->getDefault()) . "', 'core.enabled_edit_area': " . (Phpfox::getParam('core.enabled_edit_area') ? 'true' : 'false') . ", 'core.disable_hash_bang_support': " . (Phpfox::getParam('core.disable_hash_bang_support') ? 'true' : 'false') . ", 'core.site_wide_ajax_browsing': " . (!defined('PHPFOX_IN_DESIGN_MODE') && Phpfox::getParam('core.site_wide_ajax_browsing') && !Phpfox::isAdminPanel() && Phpfox::isUser() ? 'true' : 'false') . ", 'profile.user_id': " . (defined('PHPFOX_IS_USER_PROFILE') && PHPFOX_IS_USER_PROFILE ? Profile_Service_Profile::instance()->getProfileUserId() : 0) . "};\n";
         // You are filtering out the controllers which should not load 'content' ajaxly, finding a way for pages.view/1/info and like that
         $sProgressCssFile = $this->getStyle('css', 'progress.css');
         $sStylePath = str_replace(Phpfox::getParam('core.path'), '', str_replace('progress.css', '', $sProgressCssFile));
         $aJsVars = array('sJsHome' => Phpfox::getParam('core.path'), 'sJsHostname' => $_SERVER['HTTP_HOST'], 'sSiteName' => Phpfox::getParam('core.site_title'), 'sJsStatic' => $oUrl->getDomain() . PHPFOX_STATIC, 'sJsStaticImage' => Phpfox::getParam('core.url_static_image'), 'sImagePath' => $this->getStyle('image'), 'sStylePath' => $this->getStyle('css'), 'sVersion' => Phpfox::getId(), 'sJsAjax' => $oUrl->getDomain() . PHPFOX_STATIC . 'ajax.php', 'sStaticVersion' => $iVersion, 'sGetMethod' => PHPFOX_GET_METHOD, 'sDateFormat' => defined('PHPFOX_INSTALLER') ? '' : Phpfox::getParam('core.date_field_order'), 'sEgiftStyle' => $this->getStyle('css', 'display.css', 'egift'), 'sGlobalTokenName' => Phpfox::getTokenName(), 'sController' => Phpfox_Module::instance()->getFullControllerName(), 'bJsIsMobile' => Phpfox::isMobile() ? true : false, 'sProgressCssFile' => $sProgressCssFile, 'sHostedVersionId' => defined('PHPFOX_IS_HOSTED_VERSION') ? PHPFOX_IS_HOSTED_VERSION : '');
         if (!defined('PHPFOX_INSTALLER')) {
             $aJsVars['bWysiwyg'] = Phpfox::getParam('core.wysiwyg') != 'default' && Phpfox::getParam('core.allow_html') ? true : false;
             $aJsVars['sEditor'] = Phpfox::getParam('core.wysiwyg');
             $aJsVars['sJsCookiePath'] = Phpfox::getParam('core.cookie_path');
             $aJsVars['sJsCookieDomain'] = Phpfox::getParam('core.cookie_domain');
             $aJsVars['sJsCookiePrefix'] = Phpfox::getParam('core.session_prefix');
             $aJsVars['bPhotoTheaterMode'] = Phpfox::isModule('photo') ? Phpfox::getParam('photo.view_photos_in_theater_mode') : false;
             $aJsVars['bUseHTML5Video'] = false;
             // ((Phpfox::isModule('video') && Phpfox::getParam('video.upload_for_html5')) ? true : false);
             if (Phpfox::isAdmin()) {
                 $aJsVars['sAdminCPLocation'] = Phpfox::getParam('admincp.admin_cp');
             } else {
                 $aJsVars['sAdminCPLocation'] = '';
             }
             if (Phpfox::isModule('notification')) {
                 $aJsVars['notification.notify_ajax_refresh'] = Phpfox::getParam('notification.notify_ajax_refresh');
             }
             $sLocalDatepicker = PHPFOX_STATIC . 'jscript/jquery/locale/jquery.ui.datepicker-' . strtolower(Phpfox_Locale::instance()->getLangId()) . '.js';
             if (file_exists($sLocalDatepicker)) {
                 $sFile = str_replace(PHPFOX_STATIC . 'jscript/', '', $sLocalDatepicker);
                 $this->setHeader(array($sFile => 'static_script'));
             }
             /* Only in a few cases will we want to add the visitor's IP */
             if (Phpfox::getParam('core.google_api_key') != '' && Phpfox::getParam('core.ip_infodb_api_key')) {
                 // $aJsVars['sIP'] = Phpfox_Request::instance()->getIp();
             }
             $aJsVars['bEnableMicroblogSite'] = Phpfox::isModule('microblog') ? Phpfox::getParam('microblog.enable_microblog_site') : false;
         }
         ($sPlugin = Phpfox_Plugin::get('template_getheader_setting')) ? eval($sPlugin) : false;
         if (Phpfox::isModule('input') && false) {
             $this->setHeader('cache', array('browse.css' => 'style_css'));
         }
         $sJs .= "\t\t\tvar oParams = {";
         $iCnt = 0;
         foreach ($aJsVars as $sVar => $sValue) {
             $iCnt++;
             if ($iCnt != 1) {
                 $sJs .= ",";
             }
             if (is_bool($sValue)) {
                 $sJs .= "'{$sVar}': " . ($sValue ? 'true' : 'false');
             } elseif (is_numeric($sValue)) {
                 $sJs .= "'{$sVar}': " . $sValue;
             } else {
                 $sJs .= "'{$sVar}': '" . str_replace("'", "\\'", $sValue) . "'";
             }
         }
         $sJs .= "};\n";
         if (!defined('PHPFOX_INSTALLER')) {
             $aLocaleVars = array('core.are_you_sure', 'core.yes', 'core.no', 'core.save', 'core.cancel', 'core.go_advanced', 'core.processing', 'emoticon.emoticons', 'attachment.attach_files', 'core.close', 'core.language_packages', 'core.move_this_block', 'core.uploading', 'language.loading', 'core.saving', 'core.loading_text_editor', 'core.quote', 'core.loading');
             if (Phpfox::isModule('im') && Phpfox::getParam('im.enable_im_in_footer_bar')) {
                 $aLocaleVars[] = 'im.find_your_friends';
             }
             ($sPlugin = Phpfox_Plugin::get('template_getheader_language')) ? eval($sPlugin) : false;
             $sJs .= "\t\t\tvar oTranslations = {";
             $iCnt = 0;
             foreach ($aLocaleVars as $sValue) {
                 $aParts = explode('.', $sValue);
                 if ($aParts[0] != 'core' && !Phpfox::isModule($aParts[0])) {
                     continue;
                 }
                 $iCnt++;
                 if ($iCnt != 1) {
                     $sJs .= ",";
                 }
                 $sJs .= "'{$sValue}': '" . html_entity_decode(str_replace("'", "\\'", Phpfox::getPhrase($sValue)), null, 'UTF-8') . "'";
             }
             $sJs .= "};\n";
             $aModules = Phpfox_Module::instance()->getModules();
             $sJs .= "\t\t\tvar oModules = {";
             $iCnt = 0;
             foreach ($aModules as $sModule => $iModuleId) {
                 $iCnt++;
                 if ($iCnt != 1) {
                     $sJs .= ",";
                 }
                 $sJs .= "'{$sModule}': true";
             }
             $sJs .= "};\n";
         }
         if (count($this->_aImages)) {
             $sJs .= "\t\t\tvar oJsImages = {";
             foreach ($this->_aImages as $sKey => $sImage) {
                 $sJs .= $sKey . ': \'' . $sImage . '\',';
             }
             $sJs = rtrim($sJs, ',');
             $sJs .= "};\n";
         }
         /*
         if (count($this->_aEditor) && isset($this->_aEditor['active']) && $this->_aEditor['active'])
         {
         */
         $aEditorButtons = Phpfox::getLib('editor')->getButtons();
         $iCnt = 0;
         $sJs .= "\t\t\tvar oEditor = {";
         if (count($this->_aEditor) && isset($this->_aEditor['active']) && $this->_aEditor['active']) {
             foreach ($this->_aEditor as $sVar => $mValue) {
                 $iCnt++;
                 if ($iCnt != 1) {
                     $sJs .= ",";
                 }
                 $sJs .= "'{$sVar}': " . (is_bool($mValue) ? $mValue === true ? 'true' : 'false' : "'{$mValue}'") . "";
             }
             $sJs .= ", ";
         }
         $sJs .= "images:[";
         foreach ($aEditorButtons as $mEditorButtonKey => $aEditorButton) {
             $sJs .= "{";
             foreach ($aEditorButton as $sEditorButtonKey => $sEditorButtonValue) {
                 $sJs .= "" . $sEditorButtonKey . ": '" . $sEditorButtonValue . "',";
             }
             $sJs = rtrim($sJs, ',') . "},";
         }
         $sJs = rtrim($sJs, ',') . "]";
         $sJs .= "};\n";
         // }
         if (!defined('PHPFOX_INSTALLER') && Phpfox::getParam('core.load_jquery_from_google_cdn')) {
             $sData .= "\t\t" . '<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/' . Phpfox::getParam('core.jquery_google_cdn_version') . '/jquery.min.js"></script>' . "\n";
         }
     }
     if (PHPFOX_IS_AJAX_PAGE) {
         $this->_aCacheHeaders = array();
     }
     $bIsHttpsPage = false;
     if (!defined('PHPFOX_INSTALLER') && Phpfox::getParam('core.force_https_secure_pages')) {
         if (in_array(str_replace('mobile.', '', Phpfox_Module::instance()->getFullControllerName()), Phpfox::getService('core')->getSecurePages()) && (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')) {
             $bIsHttpsPage = true;
         }
     }
     $aSubCache = array();
     $sStyleCacheData = '';
     $sJsCacheData = '';
     $aCacheJs = array();
     $aCacheCSS = array();
     $this->_sFooter = '';
     $sJs .= "\t\t\t" . 'var $Behavior = {}, $Ready = $Ready = function(callback) {$Behavior[callback.toString().length] = callback;}, $Events = {}, $Event = function(callback) {$Events[callback.toString().length] = callback;};' . "\n";
     $sJs .= "\t\t\t" . 'var $Core = {};' . "\n";
     $aCustomCssFile = array();
     foreach ($this->_aHeaders as $aHeaders) {
         if (!is_array($aHeaders)) {
             $aHeaders = array($aHeaders);
         }
         foreach ($aHeaders as $mKey => $mValue) {
             $sQmark = strpos($mKey, '?') ? '&amp;' : '?';
             if (is_numeric($mKey)) {
                 if ($mValue === null) {
                     continue;
                 }
                 if ($bReturnArray) {
                     $aArrayData[] = $mValue;
                 } else {
                     if (is_string($mValue) && (strpos($mValue, '.js') !== false || strpos($mValue, 'javascript') !== false)) {
                         if (strpos($mValue, 'RecaptchaOptions')) {
                             $sData .= "\t\t" . $mValue . "\n";
                         } else {
                             $this->_sFooter .= "\t\t" . $mValue;
                         }
                     } else {
                         if (is_string($mValue)) {
                             $sData .= "\t\t" . $mValue . "\n";
                         } else {
                             $sData .= "\t\t" . implode($mValue) . "\n";
                         }
                     }
                 }
             } else {
                 if ($mKey == 'master') {
                     $aMaster = array('css' => array(), 'jscript' => array());
                     foreach ($mValue as $sValKey => $sValVal) {
                         if (strpos($sValKey, '.css') !== false) {
                             if ($sValVal == 'style_css') {
                                 $aMaster['css'][] = 'theme' . PHPFOX_DS . 'frontend' . PHPFOX_DS . $this->getThemeFolder() . PHPFOX_DS . 'style' . PHPFOX_DS . $this->getStyleFolder() . PHPFOX_DS . 'css' . PHPFOX_DS . $sValKey;
                             } else {
                                 if (strpos($sValVal, 'module_') !== false) {
                                     $aMaster['css'][] = 'module' . PHPFOX_DS . str_replace('module_', '', $sValVal) . PHPFOX_DS . 'static' . PHPFOX_DS . 'css' . PHFPFOX_DS . $this->getThemeFolder() . PHPFOX_DS . $this->getStyleFolder() . PHPFOX_DS . $sValKey;
                                 }
                             }
                         } else {
                             if (strpos($sValKey, '.js') !== false) {
                                 if ($sValVal == 'static_script') {
                                     $aMaster['jscript'][] = 'static' . PHPFOX_DS . 'jscript' . PHPFOX_DS . $sValKey;
                                 } else {
                                     if (strpos($sValVal, 'module_') !== false) {
                                         $aMaster['jscript'][] = 'module' . PHPFOX_DS . str_replace('module_', '', $sValVal) . PHPFOX_DS . 'static' . PHPFOX_DS . 'jscript' . PHPFOX_DS . $sValKey;
                                     }
                                 }
                             }
                         }
                     }
                     unset($this->_aHeaders[$mKey]);
                     // just to avoid confusions
                     $this->_aHeaders['master'] = $aMaster;
                 } else {
                     $bToHead = false;
                     // This happens when the developer needs something to go to <head>
                     if (is_array($mValue)) {
                         $aKeyHead = array_keys($mValue);
                         $aKeyValue = array_values($mValue);
                         $bToHead = $mKey == 'head';
                         $mKey = array_pop($aKeyHead);
                         $mValue = array_pop($aKeyValue);
                     }
                     switch ($mValue) {
                         case 'style_script':
                             if (isset($aSubCache[$mKey][$mValue])) {
                                 continue;
                             }
                             if ($bReturnArray) {
                                 $aArrayData[] = $this->getStyle('jscript', $mKey);
                             } else {
                                 //$sJsCacheData .= str_replace(Phpfox::getParam('core.path'), '', $this->getStyle('jscript', $mKey)) . ',';
                                 if ($bToHead == 'head') {
                                     $aCacheCSS[] = str_replace(Phpfox::getParam('core.path'), '', $this->getStyle('jscript', $mKey));
                                 } else {
                                     $aCacheJs[] = str_replace(Phpfox::getParam('core.path'), '', $this->getStyle('jscript', $mKey));
                                 }
                             }
                             break;
                         case 'style_css':
                             $bCustomStyle = false;
                             if ($bCustomStyle === false) {
                                 if ($bReturnArray) {
                                     $aArrayData[] = $this->getStyle('css', $mKey);
                                 } else {
                                     $aCacheCSS[] = str_replace(Phpfox::getParam('core.path'), '', $this->getStyle('css', $mKey));
                                 }
                             } else {
                                 if (defined('PHPFOX_IS_HOSTED_SCRIPT')) {
                                     $bLoadCustomThemeOverwrite = true;
                                 } else {
                                     if ($bReturnArray) {
                                         $aArrayData[] = Phpfox::getParam('core.url_file') . 'static/' . $this->_aTheme['style_id'] . '_' . $mKey;
                                     } else {
                                         if (isset($this->_aCacheHeaders[$mKey])) {
                                             // $sStyleCacheData .= str_replace(Phpfox::getParam('core.path'), '', Phpfox::getParam('core.url_file')) . 'static/' . $this->_aTheme['style_id'] . '_' . $mKey . ',';
                                             $aCustomCssFile[] = Phpfox::getParam('core.url_file') . 'static/' . $this->_aTheme['style_id'] . '_' . $mKey . '';
                                         } else {
                                             if ($bIsHttpsPage) {
                                                 //$sData .= "\t\t" . '<link rel="stylesheet" type="text/css" href="' . Phpfox::getParam('core.url_file') . 'static/' . $this->_aTheme['style_id'] . '_secure_' . $mKey . '?v=' . $iVersion . '" />' . "\n";
                                                 $aCustomCssFile[] = Phpfox::getParam('core.url_file') . 'static/' . $this->_aTheme['style_id'] . '_secure_' . $mKey;
                                             } else {
                                                 //$sData .= "\t\t" . '<link rel="stylesheet" type="text/css" href="' . Phpfox::getParam('core.url_file') . 'static/' . $this->_aTheme['style_id'] . '_' . $mKey . '?v=' . $iVersion . '" />' . "\n";
                                                 $aCustomCssFile[] = Phpfox::getParam('core.url_file') . 'static/' . $this->_aTheme['style_id'] . '_' . $mKey;
                                             }
                                         }
                                     }
                                 }
                             }
                             break;
                         case 'static_script':
                             if (isset($aSubCache[$mKey][$mValue])) {
                                 continue;
                             }
                             if (!defined('PHPFOX_INSTALLER') && Phpfox::getParam('core.load_jquery_from_google_cdn')) {
                                 if ($mKey == 'jquery/ui.js' || $mKey == 'jquery/jquery.js') {
                                     if ($mKey == 'jquery/ui.js') {
                                         $this->_sFooter .= "\t\t" . '<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/' . Phpfox::getParam('core.jquery_ui_google_cdn_version') . '/jquery-ui.min.js"></script>' . "\n";
                                     }
                                     continue;
                                 }
                             }
                             if ($bReturnArray) {
                                 $aArrayData[] = Phpfox::getParam('core.url_static_script') . $mKey;
                             } else {
                                 if (isset($this->_aCacheHeaders[$mKey])) {
                                     // $sJsCacheData .= $mKey . ',';
                                     if ($bToHead == 'head') {
                                         $aCacheCSS[] = 'static' . PHPFOX_DS . 'jscript' . PHPFOX_DS . $mKey;
                                     } else {
                                         $aCacheJs[] = 'static' . PHPFOX_DS . 'jscript' . PHPFOX_DS . $mKey;
                                     }
                                 } else {
                                     //$sData .= "\t\t" . '<script type="text/javascript" src="' . Phpfox::getParam('core.url_static_script') . $mKey . $sQmark . 'v=' . $iVersion . '"></script>' . "\n";
                                     if ($bToHead == 'head') {
                                         $aCacheCSS[] = 'static/jscript/' . $mKey;
                                     } else {
                                         $aCacheJs[] = 'static/jscript/' . $mKey;
                                     }
                                 }
                             }
                             break;
                         default:
                             if (preg_match('/module/i', $mValue)) {
                                 $aParts = explode('_', $mValue);
                                 if (isset($aParts[1]) && Phpfox::isModule($aParts[1])) {
                                     if (substr($mKey, -3) == '.js') {
                                         if ($bReturnArray) {
                                             $aArrayData[] = Phpfox::getParam('core.path') . 'module/' . $aParts[1] . '/static/jscript/' . $mKey;
                                         } else {
                                             if (isset($this->_aCacheHeaders[$mKey])) {
                                                 //$sJsCacheData .= 'module/' . $aParts[1] . '/static/jscript/' . $mKey . ',';
                                                 $aCacheJs[] = 'module/' . $aParts[1] . '/static/jscript/' . $mKey;
                                             } else {
                                                 /*
                                                 if (defined('PHPFOX_IS_HOSTED_SCRIPT'))
                                                 {
                                                 	$sData .= "\t\t" . '<script type="text/javascript" src="' . Phpfox::getCdnPath() . 'module/' . $aParts[1] . '/static/jscript/' . $mKey . $sQmark . 'v=' . $iVersion . '"></script>' . "\n";
                                                 }	
                                                 else
                                                 {
                                                 */
                                                 //$sData .= "\t\t" . '<script type="text/javascript" src="' . Phpfox::getParam('core.path') . 'module/' . $aParts[1] . '/static/jscript/' . $mKey . $sQmark . 'v=' . $iVersion . '"></script>' . "\n";
                                                 $aCacheJs[] = 'module/' . $aParts[1] . '/static/jscript/' . $mKey;
                                                 // }
                                             }
                                         }
                                     } elseif (substr($mKey, -4) == '.css') {
                                         $aCacheCSS[] = str_replace(Phpfox::getParam('core.path'), '', $this->getStyle('css', $mKey, $aParts[1]));
                                         $bCustomStyle = false;
                                         if ($bCustomStyle === false) {
                                             if ($bReturnArray) {
                                                 //$aArrayData[] = $this->getStyle('css', $mKey, $aParts[1]);
                                                 $aCachesCSS[] = str_replace(Phpfox::getParam('core.path'), '', $this->getStyle('css', $mKey, $aParts[1]));
                                             } else {
                                                 /*
                                                 if (defined('PHPFOX_IS_HOSTED_SCRIPT'))
                                                 {
                                                     $sData .= "\t\t" . '<link rel="stylesheet" type="text/css" href="' . str_replace(Phpfox::getParam('core.path'), Phpfox::getCdnPath(), $this->getStyle('css', $mKey, $aParts[1])) . $sQmark . 'v=' . $iVersion . '" />' . "\n";
                                                 }
                                                 else
                                                 {
                                                 */
                                                 $aCachesCSS[] = str_replace(Phpfox::getParam('core.path'), '', $this->getStyle('css', $mKey, $aParts[1]));
                                                 // }
                                             }
                                         } else {
                                             //$sStyleCacheData .= str_replace(Phpfox::getParam('core.path'), '', Phpfox::getParam('core.url_file')) . 'static/' . $this->_aTheme['style_id'] . '_' . $aParts[1] . '_' . $mKey . ',';
                                             $aCachesCSS[] = str_replace(Phpfox::getParam('core.path'), '', Phpfox::getParam('core.url_file')) . 'static/' . $this->_aTheme['style_id'] . '_' . $aParts[1] . '_' . $mKey;
                                         }
                                     }
                                 }
                             }
                             break;
                     }
                     $aSubCache[$mKey][$mValue] = true;
                 }
             }
         }
     }
     $sCacheData = '';
     $sCacheData .= "\n\t\t<script type=\"text/javascript\">\n";
     $sCacheData .= $sJs;
     $sCacheData .= "\t\t</script>";
     if (!empty($sStyleCacheData)) {
         $sCacheData .= "\n\t\t" . '<link rel="stylesheet" type="text/css" href="' . Phpfox::getParam('core.url_static') . 'gzip.php?t=css&amp;s=' . $sStylePath . '&amp;f=' . rtrim($sStyleCacheData, ',') . '&amp;v=' . $iVersion . '" />';
     }
     if (!empty($sJsCacheData)) {
         $sCacheData .= "\n\t\t" . '<script type="text/javascript" src="' . Phpfox::getParam('core.url_static') . 'gzip.php?t=js&amp;f=' . rtrim($sJsCacheData, ',') . '&amp;v=' . $iVersion . '"></script>';
     }
     if (!empty($sCacheData)) {
         $sData = preg_replace('/<link rel="shortcut icon" type="image\\/x-icon" href="(.*?)" \\/>/i', '<link rel="shortcut icon" type="image/x-icon" href="\\1" />' . $sCacheData, $sData);
     }
     if ($bReturnArray) {
         $sData = '';
     }
     $aCacheJs = array_unique($aCacheJs);
     $aSubCacheCheck = array();
     foreach ($aCacheCSS as $sFile) {
         if (defined('PHPFOX_INSTALLER')) {
             $sData .= "\t\t" . '<link rel="stylesheet" type="text/css" href="' . $sFile . $sQmark . 'v=' . $iVersion . '" />' . "\n";
         } else {
             if (isset($aSubCacheCheck[$sFile])) {
                 continue;
             }
             $aSubCacheCheck[$sFile] = true;
             $sData .= "\t\t" . '<link rel="stylesheet" type="text/css" href="' . Phpfox::getParam('core.path') . $sFile . $sQmark . 'v=' . $iVersion . '" />' . "\n";
         }
     }
     foreach ($aCacheJs as $sFile) {
         if (defined('PHPFOX_INSTALLER')) {
             $this->_sFooter .= "\t\t" . '<script type="text/javascript" src="../' . $sFile . $sQmark . 'v=' . $iVersion . '"></script>' . "\n";
         } else {
             $this->_sFooter .= "\t\t" . '<script type="text/javascript" src="' . Phpfox::getParam('core.path') . $sFile . $sQmark . 'v=' . $iVersion . '"></script>' . "\n";
         }
     }
     if (!defined('PHPFOX_INSTALLER')) {
         $this->_sFooter .= "\t\t" . '<script type="text/javascript"> $Core.init(); </script>' . "\n";
     }
     if (count($this->_aPhrases)) {
         $sData .= "\n\t\t<script type=\"text/javascript\">\n\t\t";
         foreach ($this->_aPhrases as $sVar => $sPhrase) {
             $sPhrase = html_entity_decode($sPhrase, null, 'UTF-8');
             $sData .= "\t\t\toTranslations['{$sVar}'] = '" . str_replace("'", "\\'", $sPhrase) . "';\n";
         }
         $sData .= "\t\t</script>\n";
     }
     if (!defined('PHPFOX_INSTALLER') && !Phpfox::isAdminPanel()) {
         $Request = \Phpfox_Request::instance();
         if ($Request->segment(1) == 'theme' && $Request->segment(2) == 'demo') {
             $sData .= '<link href="' . Phpfox::getParam('core.path') . 'theme/default/flavor/default.css?v=' . Phpfox::internalVersion() . '" rel="stylesheet">';
         } else {
             $Theme = $this->_theme->get();
             $sData .= '<link href="' . Phpfox::getParam('core.path') . 'themes/' . $Theme->folder . '/flavor/' . $Theme->flavor_folder . '.css?v=' . Phpfox::internalVersion() . '" rel="stylesheet">';
         }
     }
     if (!defined('PHPFOX_INSTALLER')) {
         $Apps = new Core\App();
         foreach ($Apps->all() as $App) {
             $assets = $App->path . 'assets/';
             if (file_exists($assets . 'autoload.js')) {
                 $url = str_replace(PHPFOX_DIR_SITE, Phpfox::getParam('core.path'), $assets) . 'autoload.js';
                 $this->_sFooter .= '<script src="' . $url . '?v=' . Phpfox::internalVersion() . '"></script>';
             }
             if (file_exists($assets . 'autoload.css')) {
                 $url = str_replace(PHPFOX_DIR_SITE, Phpfox::getParam('core.path'), $assets) . 'autoload.css';
                 $sData .= '<link href="' . $url . '?v=' . Phpfox::internalVersion() . '" rel="stylesheet">';
             }
         }
         if (!Phpfox::isAdminPanel() && is_object($this->_theme)) {
             $asset = $this->_theme->get()->getPath() . 'assets/autoload.js';
             if (file_exists($asset)) {
                 $url = str_replace([PHPFOX_DIR_SITE, PHPFOX_DIR], Phpfox::getParam('core.path'), $asset);
                 $this->_sFooter .= '<script src="' . $url . '?v=' . Phpfox::internalVersion() . '"></script>';
             }
         }
     }
     if (isset($this->_meta['head'])) {
         $sData .= $this->_meta['head'];
         if (Phpfox::isAdmin()) {
             $this->_sFooter .= '<script>var page_editor_meta = ' . json_encode(['head' => $this->_meta['head']]) . ';</script>';
         }
     }
     if ($bReturnArray) {
         $aArrayData[] = $sData;
         return $aArrayData;
     }
     // Convert meta data
     $bHasNoDescription = false;
     if (count($this->_aMeta) && !PHPFOX_IS_AJAX_PAGE && !defined('PHPFOX_INSTALLER')) {
         $oPhpfoxParseOutput = Phpfox::getLib('parse.output');
         $aFind = array('&lt;', '&gt;', '$');
         $aReplace = array('<', '>', '&36;');
         foreach ($this->_aMeta as $sMeta => $sMetaValue) {
             $sMetaValue = str_replace($aFind, $aReplace, $sMetaValue);
             $sMetaValue = strip_tags($sMetaValue);
             $sMetaValue = str_replace(array("\n", "\r"), "", $sMetaValue);
             $bIsCustomMeta = false;
             switch ($sMeta) {
                 case 'keywords':
                     if (isset($this->_meta['keywords'])) {
                         $sMetaValue = $this->_meta['keywords'];
                         continue;
                     }
                     $sKeywordSearch = Phpfox::getParam('core.words_remove_in_keywords');
                     if (!empty($sKeywordSearch)) {
                         $aKeywordsSearch = array_map('trim', explode(',', $sKeywordSearch));
                     }
                     $sMetaValue = $oPhpfoxParseOutput->shorten($oPhpfoxParseOutput->clean($sMetaValue), Phpfox::getParam('core.meta_keyword_limit'));
                     $sMetaValue = trim(rtrim(trim($sMetaValue), ','));
                     $aParts = explode(',', $sMetaValue);
                     $sMetaValue = '';
                     $aKeywordCache = array();
                     foreach ($aParts as $sPart) {
                         $sPart = trim($sPart);
                         if (isset($aKeywordCache[$sPart])) {
                             continue;
                         }
                         if (isset($aKeywordsSearch) && in_array(strtolower($sPart), array_map('strtolower', $aKeywordsSearch))) {
                             continue;
                         }
                         $sMetaValue .= $sPart . ', ';
                         $aKeywordCache[$sPart] = true;
                     }
                     $sMetaValue = rtrim(trim($sMetaValue), ',');
                     break;
                 case 'description':
                     if (isset($this->_meta['description'])) {
                         $sMetaValue = $this->_meta['description'];
                         continue;
                     }
                     $bHasNoDescription = true;
                     $sMetaValue = $oPhpfoxParseOutput->shorten($oPhpfoxParseOutput->clean($sMetaValue), Phpfox::getParam('core.meta_description_limit'));
                     break;
                 case 'robots':
                     $bIsCustomMeta = false;
                     break;
                 default:
                     $bIsCustomMeta = true;
                     break;
             }
             $sMetaValue = str_replace('"', '\\"', $sMetaValue);
             $sMetaValue = Phpfox_Locale::instance()->convert($sMetaValue);
             $sMetaValue = html_entity_decode($sMetaValue, null, 'UTF-8');
             $sMetaValue = str_replace(array('<', '>'), '', $sMetaValue);
             if ($bIsCustomMeta) {
                 if ($sMeta == 'og:description') {
                     $sMetaValue = $oPhpfoxParseOutput->shorten($oPhpfoxParseOutput->clean($sMetaValue), Phpfox::getParam('core.meta_description_limit'));
                 }
                 switch ($sMeta) {
                     case 'canonical':
                         $sCanonical = $sMetaValue;
                         $sCanonical = preg_replace('/\\/when\\_([a-zA-Z0-9\\-]+)\\//i', '/', $sCanonical);
                         $sCanonical = preg_replace('/\\/show\\_([a-zA-Z0-9\\-]+)\\//i', '/', $sCanonical);
                         $sCanonical = preg_replace('/\\/view\\_\\//i', '/', $sCanonical);
                         if (Phpfox::isMobile()) {
                             if (Phpfox::getParam('core.url_rewrite') == '1') {
                                 $sCanonical = str_replace(Phpfox::getParam('core.path') . 'mobile/', Phpfox::getParam('core.path'), $sMetaValue);
                             } elseif (Phpfox::getParam('core.url_rewrite') == '2') {
                                 $sCanonical = str_replace('?' . PHPFOX_GET_METHOD . '=/mobile/', '?' . PHPFOX_GET_METHOD . '=/', $sMetaValue);
                             }
                         }
                         $sData .= "\t\t<link rel=\"canonical\" href=\"{$sCanonical}\" />\n";
                         if (!Phpfox::isMobile()) {
                             $sMobileReplace = '';
                             if (Phpfox::getParam('core.url_rewrite') == '1') {
                                 $sMobileReplace = str_replace(Phpfox::getParam('core.path'), Phpfox::getParam('core.path') . 'mobile/', $sCanonical);
                             } elseif (Phpfox::getParam('core.url_rewrite') == '2') {
                                 $sMobileReplace = str_replace('?' . PHPFOX_GET_METHOD . '=/', '?' . PHPFOX_GET_METHOD . '=/mobile/', $sCanonical);
                             }
                             $sData .= "\t\t<link rel=\"alternate\" media=\"only screen and (max-width: 640px)\" href=\"{$sMobileReplace}\" />\n";
                         }
                         break;
                     default:
                         $sData .= "\t\t<meta property=\"{$sMeta}\" content=\"{$sMetaValue}\" />\n";
                         break;
                 }
             } else {
                 if (strpos($sData, 'meta name="' . $sMeta . '"') !== false) {
                     $sData = preg_replace("/<meta name=\"{$sMeta}\" content=\"(.*?)\" \\/>\n\t/i", "<meta" . ($sMeta == 'description' ? ' property="og:description" ' : '') . " name=\"{$sMeta}\" content=\"" . $sMetaValue . "\" />\n\t", $sData);
                 } else {
                     $sData = preg_replace('/<meta/', '<meta name="' . $sMeta . '" content="' . $sMetaValue . '" />' . "\n\t\t" . '<meta', $sData, 1);
                 }
             }
         }
         if (!$bHasNoDescription) {
             $sData .= "\t\t" . '<meta name="description" content="' . Phpfox::getLib('parse.output')->clean(Phpfox_Locale::instance()->convert(Phpfox::getParam('core.description'))) . '" />' . "\n";
         }
     }
     // Clear from memory
     $this->_aHeaders = array();
     $this->_aMeta = array();
     return $sData;
 }
<?php

if (Phpfox::isMobile()) {
    $aDefaultStyle = Phpfox::getService('themesupporter.theme')->getDefaultMobileStyle();
    $this->_sStyleFolder = $aDefaultStyle['style_folder_name'];
    $this->_sThemeFolder = $aDefaultStyle['theme_folder_name'];
}
Beispiel #17
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     if ($sPlugin = Phpfox_Plugin::get('user.component_controller_browse__1')) {
         eval($sPlugin);
         if (isset($aPluginReturn)) {
             return $aPluginReturn;
         }
     }
     $aCallback = $this->getParam('aCallback', false);
     if ($aCallback !== false) {
         if (!Phpfox::getService('group')->hasAccess($aCallback['item'], 'can_view_members')) {
             return Phpfox_Error::display(Phpfox::getPhrase('user.members_section_is_closed'));
         }
     }
     if (defined('PHPFOX_IS_ADMIN_SEARCH')) {
         $aIds = $this->request()->getArray('id');
         if (($aIds = $this->request()->getArray('id')) && count((array) $aIds)) {
             Phpfox::getUserParam('user.can_delete_others_account', true);
             if ($this->request()->get('delete')) {
                 foreach ($aIds as $iId) {
                     if (Phpfox::getService('user')->isAdminUser($iId)) {
                         $this->url()->send('current', null, Phpfox::getPhrase('user.you_are_unable_to_delete_a_site_administrator'));
                     }
                     Phpfox::getService('user.auth')->setUserId($iId);
                     Phpfox::massCallback('onDeleteUser', $iId);
                     Phpfox::getService('user.auth')->setUserId(null);
                 }
                 $this->url()->send('current', null, Phpfox::getPhrase('user.user_s_successfully_deleted'));
             } elseif ($this->request()->get('ban') || $this->request()->get('unban')) {
                 foreach ($aIds as $iId) {
                     if (Phpfox::getService('user')->isAdminUser($iId)) {
                         $this->url()->send('current', null, Phpfox::getPhrase('user.you_are_unable_to_ban_a_site_administrator'));
                     }
                     Phpfox::getService('user.process')->ban($iId, $this->request()->get('ban') ? 1 : 0);
                 }
                 $this->url()->send('current', null, $this->request()->get('ban') ? Phpfox::getPhrase('user.user_s_successfully_banned') : Phpfox::getPhrase('user.user_s_successfully_un_banned'));
             } elseif ($this->request()->get('resend-verify')) {
                 foreach ($aIds as $iId) {
                     Phpfox::getService('user.verify.process')->sendMail($iId);
                 }
                 $this->url()->send('current', null, Phpfox::getPhrase('user.email_verification_s_sent'));
             } elseif ($this->request()->get('verify')) {
                 foreach ($aIds as $iId) {
                     Phpfox::getService('user.verify.process')->adminVerify($iId);
                 }
                 $this->url()->send('current', null, Phpfox::getPhrase('user.user_s_verified'));
             } elseif ($this->request()->get('approve')) {
                 foreach ($aIds as $iId) {
                     Phpfox::getService('user.process')->userPending($iId, '1');
                 }
                 $this->url()->send('current', null, Phpfox::getPhrase('user.user_s_successfully_approved'));
             }
         }
     } else {
         $aCheckParams = array('url' => $this->url()->makeUrl('user.browse'), 'start' => 2, 'reqs' => array('2' => array('browse')));
         if (Phpfox::getParam('core.force_404_check') && !PHPFOX_IS_AJAX && !Phpfox::getService('core.redirect')->check404($aCheckParams)) {
             return Phpfox::getLib('module')->setController('error.404');
         }
     }
     $aPages = Phpfox::isMobile() ? array(10) : array(21, 31, 41, 51);
     $aDisplays = array();
     foreach ($aPages as $iPageCnt) {
         $aDisplays[$iPageCnt] = Phpfox::getPhrase('core.per_page', array('total' => $iPageCnt));
     }
     $aSorts = array('u.full_name' => Phpfox::getPhrase('user.name'), 'u.joined' => Phpfox::getPhrase('user.joined'), 'u.last_login' => Phpfox::getPhrase('user.last_login'), 'ufield.total_rating' => Phpfox::getPhrase('user.rating'));
     $aAge = array();
     for ($i = Phpfox::getService('user')->age(Phpfox::getService('user')->buildAge(1, 1, Phpfox::getParam('user.date_of_birth_end'))); $i <= Phpfox::getService('user')->age(Phpfox::getService('user')->buildAge(1, 1, Phpfox::getParam('user.date_of_birth_start'))); $i++) {
         $aAge[$i] = $i;
     }
     $iDay = date('d');
     $iMonth = date('m');
     $iYear = date('Y');
     $aUserGroups = array();
     foreach (Phpfox::getService('user.group')->get() as $aUserGroup) {
         $aUserGroups[$aUserGroup['user_group_id']] = Phpfox::getLib('locale')->convert($aUserGroup['title']);
     }
     $aGenders = Phpfox::getService('core')->getGenders();
     $aGenders[''] = count($aGenders) == '2' ? Phpfox::getPhrase('user.both') : Phpfox::getPhrase('core.all');
     if ($sPlugin = Phpfox_Plugin::get('user.component_controller_browse_genders')) {
         eval($sPlugin);
     }
     $sDefaultOrderName = 'u.full_name';
     $sDefaultSort = 'ASC';
     if (Phpfox::getParam('user.user_browse_default_result') == 'last_login') {
         $sDefaultOrderName = 'u.last_login';
         $sDefaultSort = 'DESC';
     }
     $aFilters = array('display' => array('type' => 'select', 'options' => $aDisplays, 'default' => 21), 'sort' => array('type' => 'select', 'options' => $aSorts, 'default' => $sDefaultOrderName), 'sort_by' => array('type' => 'select', 'options' => array('DESC' => Phpfox::getPhrase('core.descending'), 'ASC' => Phpfox::getPhrase('core.ascending')), 'default' => $sDefaultSort), 'keyword' => array('type' => 'input:text', 'size' => 15, 'class' => 'txt_input'), 'type' => array('type' => 'select', 'options' => array('0' => array(Phpfox::getPhrase('user.email_name'), 'AND ((u.full_name LIKE \'%[VALUE]%\' OR (u.email LIKE \'%[VALUE]@%\' OR u.email = \'[VALUE]\'))' . (defined('PHPFOX_IS_ADMIN_SEARCH') ? ' OR u.email LIKE \'%[VALUE]\'' : '') . ')'), '1' => array(Phpfox::getPhrase('user.email'), 'AND ((u.email LIKE \'%[VALUE]@%\' OR u.email = \'[VALUE]\'' . (defined('PHPFOX_IS_ADMIN_SEARCH') ? ' OR u.email LIKE \'%[VALUE]%\'' : '') . '))'), '2' => array(Phpfox::getPhrase('user.name'), 'AND (u.full_name LIKE \'%[VALUE]%\')')), 'depend' => 'keyword'), 'group' => array('type' => 'select', 'options' => $aUserGroups, 'add_any' => true, 'search' => 'AND u.user_group_id = \'[VALUE]\''), 'gender' => array('type' => 'input:radio', 'options' => $aGenders, 'default_view' => '', 'search' => 'AND u.gender = \'[VALUE]\'', 'suffix' => '<br />'), 'from' => array('type' => 'select', 'options' => $aAge, 'add_any' => true), 'to' => array('type' => 'select', 'options' => $aAge, 'add_any' => true), 'country' => array('type' => 'select', 'options' => Phpfox::getService('core.country')->get(), 'search' => 'AND u.country_iso = \'[VALUE]\'', 'add_any' => true, 'style' => 'width:150px;', 'id' => 'country_iso'), 'country_child_id' => array('type' => 'select', 'search' => 'AND ufield.country_child_id = \'[VALUE]\'', 'clone' => true), 'status' => array('type' => 'select', 'options' => array('2' => Phpfox::getPhrase('user.all_members'), '1' => Phpfox::getPhrase('user.featured_members'), '4' => Phpfox::getPhrase('user.online'), '3' => Phpfox::getPhrase('user.pending_verification_members'), '5' => Phpfox::getPhrase('user.pending_approval'), '6' => Phpfox::getPhrase('user.not_approved')), 'default_view' => '2'), 'city' => array('type' => 'input:text', 'size' => 15, 'search' => 'AND ufield.city_location LIKE \'%[VALUE]%\''), 'zip' => array('type' => 'input:text', 'size' => 10, 'search' => 'AND ufield.postal_code = \'[VALUE]\''), 'show' => array('type' => 'select', 'options' => array('1' => Phpfox::getPhrase('user.name_and_photo_only'), '2' => Phpfox::getPhrase('user.name_photo_and_users_details')), 'default_view' => Phpfox::getParam('user.user_browse_display_results_default') == 'name_photo_detail' ? '2' : '1'), 'ip' => array('type' => 'input:text', 'size' => 10));
     if (!Phpfox::getUserParam('user.can_search_by_zip')) {
         unset($aFilters['zip']);
     }
     if ($sPlugin = Phpfox_Plugin::get('user.component_controller_browse_filter')) {
         eval($sPlugin);
     }
     $aSearchParams = array('type' => 'browse', 'filters' => $aFilters, 'search' => 'keyword', 'custom_search' => true);
     if (!defined('PHPFOX_IS_ADMIN_SEARCH')) {
         $aSearchParams['no_session_search'] = true;
     }
     $oFilter = Phpfox::getLib('search')->set($aSearchParams);
     $sStatus = $oFilter->get('status');
     $sView = $this->request()->get('view');
     $aCustomSearch = $oFilter->getCustom();
     $bIsOnline = false;
     $bPendingMail = false;
     $mFeatured = false;
     $bIsGender = false;
     switch ((int) $sStatus) {
         case 1:
             $mFeatured = true;
             break;
         case 3:
             if (defined('PHPFOX_IS_ADMIN_SEARCH')) {
                 $oFilter->setCondition('AND u.status_id = 1');
             }
             break;
         case 4:
             $bIsOnline = true;
             break;
         case 5:
             if (defined('PHPFOX_IS_ADMIN_SEARCH')) {
                 $oFilter->setCondition('AND u.view_id = 1');
             }
             break;
         case 6:
             if (defined('PHPFOX_IS_ADMIN_SEARCH')) {
                 $oFilter->setCondition('AND u.view_id = 2');
             }
             break;
         default:
             break;
     }
     $this->template()->setTitle(Phpfox::getPhrase('user.browse_members'))->setBreadcrumb(Phpfox::getPhrase('user.browse_members'), $aCallback !== false ? $this->url()->makeUrl($aCallback['url_home']) : $this->url()->makeUrl((defined('PHPFOX_IS_ADMIN_SEARCH') ? 'admincp.' : '') . 'user.browse'));
     if (!empty($sView)) {
         switch ($sView) {
             case 'online':
                 $bIsOnline = true;
                 break;
             case 'featured':
                 $mFeatured = true;
                 break;
             case 'spam':
                 $oFilter->setCondition('u.total_spam > ' . (int) Phpfox::getParam('core.auto_deny_items'));
                 break;
             case 'pending':
                 if (defined('PHPFOX_IS_ADMIN_SEARCH')) {
                     $oFilter->setCondition('u.view_id = 1');
                 }
                 break;
             case 'top':
                 $bExtendContent = true;
                 $oFilter->setSort('ufield.total_rating');
                 $oFilter->setCondition('AND ufield.total_rating > ' . Phpfox::getParam('user.min_count_for_top_rating'));
                 if ($iUserGenderTop = $this->request()->getInt('topgender')) {
                     $oFilter->setCondition('AND u.gender = ' . (int) $iUserGenderTop);
                 }
                 $iFilterCount = 0;
                 $aFilterMenuCache = array();
                 $aFilterMenu = array(Phpfox::getPhrase('user.all') => '', Phpfox::getPhrase('user.male') => '1', Phpfox::getPhrase('user.female') => '2');
                 if ($sPlugin = Phpfox_Plugin::get('user.component_controller_browse_genders_top_users')) {
                     eval($sPlugin);
                 }
                 $this->template()->setTitle(Phpfox::getPhrase('user.top_rated_members'))->setBreadcrumb(Phpfox::getPhrase('user.top_rated_members'), $this->url()->makeUrl('user.browse', array('view' => 'top')));
                 foreach ($aFilterMenu as $sMenuName => $sMenuLink) {
                     $iFilterCount++;
                     $aFilterMenuCache[] = array('name' => $sMenuName, 'link' => $this->url()->makeUrl('user.browse', array('view' => 'top', 'topgender' => $sMenuLink)), 'active' => $this->request()->get('topgender') == $sMenuLink ? true : false, 'last' => count($aFilterMenu) === $iFilterCount ? true : false);
                     if ($this->request()->get('topgender') == $sMenuLink) {
                         $this->template()->setTitle($sMenuName)->setBreadcrumb($sMenuName, null, true);
                     }
                 }
                 $this->template()->assign(array('aFilterMenus' => $aFilterMenuCache));
                 break;
             default:
                 break;
         }
     }
     if (($iFrom = $oFilter->get('from')) || ($iFrom = $this->request()->getInt('from'))) {
         $oFilter->setcondition('AND u.birthday_search <= \'' . Phpfox::getLib('date')->mktime(0, 0, 0, 1, 1, $iYear - $iFrom) . '\'' . (defined('PHPFOX_IS_ADMIN_SEARCH') && Phpfox::getUserParam('user.remove_users_hidden_age') ? '' : ' AND ufield.dob_setting IN(0,1,2)'));
         $bIsGender = true;
     }
     if (($iTo = $oFilter->get('to')) || ($iTo = $this->request()->getInt('to'))) {
         $oFilter->setcondition('AND u.birthday_search >= \'' . Phpfox::getLib('date')->mktime(0, 0, 0, 1, 1, $iYear - $iTo) . '\'' . (defined('PHPFOX_IS_ADMIN_SEARCH') && Phpfox::getUserParam('user.remove_users_hidden_age') ? '' : ' AND ufield.dob_setting IN(0,1,2)'));
         $bIsGender = true;
     }
     if ($sLocation = $this->request()->get('location')) {
         $oFilter->setCondition('AND u.country_iso = \'' . Phpfox::getLib('database')->escape($sLocation) . '\'');
     }
     if ($sGender = $this->request()->getInt('gender')) {
         $oFilter->setCondition('AND u.gender = \'' . Phpfox::getLib('database')->escape($sGender) . '\'');
     }
     if ($sLocationChild = $this->request()->getInt('state')) {
         $oFilter->setCondition('AND ufield.country_child_id = \'' . Phpfox::getLib('database')->escape($sLocationChild) . '\'');
     }
     if ($sLocationCity = $this->request()->get('city-name')) {
         $oFilter->setCondition('AND ufield.city_location = \'' . Phpfox::getLib('database')->escape(Phpfox::getLib('parse.input')->convert($sLocationCity)) . '\'');
     }
     if (!defined('PHPFOX_IS_ADMIN_SEARCH')) {
         $oFilter->setCondition('AND u.status_id = 0 AND u.view_id = 0');
     } else {
         $oFilter->setCondition('AND u.profile_page_id = 0');
     }
     if (defined('PHPFOX_IS_ADMIN_SEARCH') && ($sIp = $oFilter->get('ip'))) {
         Phpfox::getService('user.browse')->ip($sIp);
     }
     $bExtend = defined('PHPFOX_IS_ADMIN_SEARCH') ? true : ($oFilter->get('show') && $oFilter->get('show') == '2' || !$oFilter->get('show') && Phpfox::getParam('user.user_browse_display_results_default') == 'name_photo_detail' ? true : false);
     $iPage = $this->request()->getInt('page');
     $iPageSize = $oFilter->getDisplay();
     if ($sPlugin = Phpfox_Plugin::get('user.component_controller_browse_filter_process')) {
         eval($sPlugin);
     }
     list($iCnt, $aUsers) = Phpfox::getService('user.browse')->conditions($oFilter->getConditions())->callback($aCallback)->sort($oFilter->getSort())->page($oFilter->getPage())->limit($iPageSize)->online($bIsOnline)->extend(isset($bExtendContent) ? true : $bExtend)->featured($mFeatured)->pending($bPendingMail)->custom($aCustomSearch)->gender($bIsGender)->get();
     /*
     foreach ($aUsers as $iIndex => $aUser)
     {
     	$aUsers[$iIndex]['full_name'] = substr($aUser['full_name'], 0, Phpfox::getParam('user.maximum_length_for_full_name'));
     }
     */
     $iCnt = $oFilter->getSearchTotal($iCnt);
     $aNewCustomValues = array();
     if ($aCustomValues = $this->request()->get('custom')) {
         foreach ($aCustomValues as $iKey => $sCustomValue) {
             $aNewCustomValues['custom[' . $iKey . ']'] = $sCustomValue;
         }
     } else {
         $aCustomValues = array();
     }
     if (!defined('PHPFOX_IS_ADMIN_SEARCH')) {
         //Phpfox::getLib('pager')->set(array('page' => $iPage, 'size' => $iPageSize, 'count' => $iCnt, 'ajax' => 'user.mainBrowse'));
         Phpfox::getLib('pager')->set(array('page' => $iPage, 'size' => $iPageSize, 'count' => $iCnt, 'ajax' => 'user.mainBrowse', 'aParams' => $aNewCustomValues));
     } else {
         Phpfox::getLib('pager')->set(array('page' => $iPage, 'size' => $iPageSize, 'count' => $iCnt));
     }
     Phpfox::getLib('url')->setParam('page', $iPage);
     // http://www.phpfox.com/tracker/view/15277/
     if ($iPage > Phpfox::getLib('pager')->getTotalPages()) {
         Phpfox::getLib('url')->send('error.404');
     }
     if ($this->request()->get('featured') == 1) {
         $this->template()->setHeader(array('drag.js' => 'static_script', '<script type="text/javascript">$Behavior.coreDragInit = function() { Core_drag.init({table: \'#js_drag_drop\', ajax: \'user.setFeaturedOrder\'}); }</script>'))->assign(array('bShowFeatured' => 1));
     }
     foreach ($aUsers as $iKey => $aUser) {
         if (!isset($aUser['user_group_id']) || empty($aUser['user_group_id']) || $aUser['user_group_id'] < 1) {
             $aUser['user_group_id'] = $aUsers[$iKey]['user_group_id'] = 5;
             Phpfox::getService('user.process')->updateUserGroup($aUser['user_id'], 5);
             $aUsers[$iKey]['user_group_title'] = Phpfox::getPhrase('user.user_banned');
         }
         $aBanned = Phpfox::getService('ban')->isUserBanned($aUser);
         $aUsers[$iKey]['is_banned'] = $aBanned['is_banned'];
     }
     $aCustomFields = Phpfox::getService('custom')->getForPublic('user_profile');
     $this->template()->setHeader('cache', array('pager.css' => 'style_css', 'country.js' => 'module_core'))->assign(array('aUsers' => $aUsers, 'bExtend' => $bExtend, 'aCallback' => $aCallback, 'bIsSearch' => $oFilter->isSearch(), 'bIsInSearchMode' => $this->request()->getInt('search-id') ? true : false, 'aForms' => $aCustomSearch, 'aCustomFields' => $aCustomFields, 'sView' => $sView));
     // add breadcrumb if its in the featured members page and not in admin
     if (!defined('PHPFOX_IS_ADMIN_SEARCH')) {
         Phpfox::getUserParam('user.can_browse_users_in_public', true);
         $this->template()->setHeader('cache', array('browse.css' => 'style_css'));
         if (!Phpfox::isMobile()) {
             $this->template()->setHeader('cache', array('browse.js' => 'module_user'));
         }
         if ($this->request()->get('view') == 'featured') {
             $this->template()->setBreadCrumb(Phpfox::getPhrase('user.featured_members'), null, true);
             $sTitle = Phpfox::getPhrase('user.title_featured_members');
             if (!empty($sTitle)) {
                 $this->template()->setTitle($sTitle);
             }
         } elseif ($this->request()->get('view') == 'online') {
             $this->template()->setBreadCrumb(Phpfox::getPhrase('user.menu_who_s_online'), null, true);
             $sTitle = Phpfox::getPhrase('user.title_who_s_online');
             if (!empty($sTitle)) {
                 $this->template()->setTitle($sTitle);
             }
         }
     }
     if ($aCallback !== false) {
         $this->template()->rebuildMenu('user.browse', $aCallback['url'])->removeUrl('user.browse', 'user.browse.view_featured');
     }
 }
 * @author  		Raymond Benc
 * @package  		Module_Feed
 * @version 		$Id: display.html.php 4176 2012-05-16 10:49:38Z Raymond_Benc $
 */
?>
<div class="activity_feed_form_share">
	<div class="activity_feed_form_share_process"><?php 
echo Phpfox::getLib('phpfox.image.helper')->display(array('theme' => 'ajax/add.gif', 'class' => 'v_middle'));
?>
</div>
<?php 
if (!isset($this->_aVars['bSkipShare'])) {
    ?>
		<ul class="activity_feed_form_attach">
<?php 
    if (!Phpfox::isMobile()) {
        ?>
				<li class="share"><?php 
        echo Phpfox::getPhrase('feed.share');
        ?>
:</li>
<?php 
    }
    if (isset($this->_aVars['aFeedCallback']['module'])) {
        ?>
				<li><a href="#" style="background:url('<?php 
        echo Phpfox::getLib('phpfox.image.helper')->display(array('theme' => 'misc/comment_add.png', 'return_url' => true));
        ?>
') no-repeat center left;" rel="global_attachment_status" class="active"><div><?php 
        echo Phpfox::getPhrase('feed.post');
        ?>
            ?>
 value="<?php 
            echo Phpfox::getPhrase('feed.comment');
            ?>
" class="button button_set_off" <?php 
            if (Phpfox::isMobile()) {
            } else {
                ?>
style="display:none;"<?php 
            }
            ?>
/>								
						</div>								
					</div>			
<?php 
            if (!PHPFOX_IS_AJAX && !Phpfox::isMobile() && isset($this->_aVars['sFeedType']) && $this->_aVars['sFeedType'] == 'view' && Phpfox::getUserParam('comment.wysiwyg_on_comments') && Phpfox::getParam('core.wysiwyg') == 'tiny_mce') {
                ?>
					<div><input type="hidden" name="val[is_in_view]" value="1" /></div>
					<script type="text/javascript">
						 $Behavior.commentPreLoadTinymce = function(){
							customTinyMCE_init('js_feed_comment_form_textarea_<?php 
                echo $this->_aVars['aFeed']['feed_id'];
                ?>
');
							$Behavior.commentPreLoadTinymce = function(){}
						 }			
					</script>
<?php 
            }
            ?>
				
<?php

/**
 * Created by JetBrains PhpStorm.
 * User: vantt
 * Date: 12/12/13
 * Time: 9:02 AM
 * To change this template use File | Settings | File Templates.
 */
if (isset($aParams['class']) && $aParams['class'] == 'profile_user_image' && Phpfox::isMobile()) {
    $aParams['suffix'] = "_200_square";
}
Beispiel #21
0
 /**
  * Controller
  */
 public function process()
 {
     if (Phpfox::isMobile() && Phpfox_Module::instance()->getFullControllerName() == 'forum.forum' && !$this->request()->getInt('req2') && !in_array($this->request()->get('view'), array('subscribed', 'new', 'my-thread'))) {
         return Phpfox_Module::instance()->setController('forum.index');
     }
     Phpfox::getUserParam('forum.can_view_forum', true);
     $aParentModule = $this->getParam('aParentModule');
     $bIsSearch = $this->request()->get('search') ? true : false;
     $aCallback = $this->getParam('aCallback', null);
     $sView = $this->request()->get('view');
     $bShowPosts = false;
     $bIsTagSearch = false;
     $bIsModuleTagSearch = false;
     if ($this->request()->get('req2') == 'tag' && $this->request()->get('req3')) {
         $bIsSearch = true;
         $bIsTagSearch = true;
     }
     if ($this->request()->get('req2') == 'tag' && $this->request()->get('req5') && $this->request()->get('module')) {
         if ($aCallback = Phpfox::getService('group')->getGroup($this->request()->get('item'))) {
             $bIsSearch = true;
             $bIsTagSearch = true;
             $bIsModuleTagSearch = true;
             $aCallback['url_home'] = 'group.' . $aCallback['title_url'] . '.forum';
         }
     }
     $oSearch = Forum_Service_Forum::instance()->getSearchFilter($this->getParam('bIsSearchQuery', false), $this->request()->get('forum_id') ? $this->request()->get('forum_id') : $this->request()->getInt('req2'));
     if ($oSearch->isSearch() && $this->request()->getInt('req2') == 'search') {
         $aIds = [];
         $aForums = $this->request()->get('forum_id') ? Forum_Service_Forum::instance()->id($this->request()->get('forum_id'))->live()->getForums() : Forum_Service_Forum::instance()->live()->getForums();
         if ($this->request()->get('forum_id')) {
             $aIds[] = $this->request()->get('forum_id');
         }
         foreach ($aForums as $aForum) {
             $aIds[] = $aForum['forum_id'];
             $aChilds = (array) Forum_Service_Forum::instance()->id($aForum['forum_id'])->getChildren();
             foreach ($aChilds as $iId) {
                 $aIds[] = $iId;
             }
         }
         $oSearch->setCondition('AND ft.forum_id IN(' . implode(',', $aIds) . ')');
     }
     define('PHPFOX_PAGER_FORCE_COUNT', true);
     $iPage = $this->request()->getInt('page');
     $iPageSize = $oSearch->getDisplay();
     $sViewId = 'ft.view_id = 0';
     if ($aCallback === null) {
         $iForumId = $this->request()->getInt('req2');
         if (Phpfox::getUserParam('forum.can_approve_forum_thread') || Phpfox::getService('forum.moderate')->hasAccess($iForumId, 'approve_thread')) {
             $sViewId = 'ft.view_id >= 0';
         }
     }
     if ($aParentModule == null) {
         $iForumId = $this->request()->getInt('req2');
         $aForums = Forum_Service_Forum::instance()->live()->id($iForumId)->getForums();
         // $aForums = array();
         $aForum = Forum_Service_Forum::instance()->id($iForumId)->getForum();
         $this->template()->assign('isSubForumList', true);
     } else {
         $aForum = array();
         $aForums = array();
     }
     if (!$bIsSearch && $this->request()->get('view') != 'pending-post') {
         if ($aParentModule === null) {
             if (!isset($aForum['forum_id']) && empty($sView)) {
                 return Phpfox_Error::display(Phpfox::getPhrase('forum.not_a_valid_forum'));
             }
             if (isset($aForum['forum_id'])) {
                 $this->setParam('iActiveForumId', $aForum['forum_id']);
             }
             if (!empty($sView)) {
                 switch ($sView) {
                     case 'my-thread':
                         $oSearch->setCondition('AND ft.user_id = ' . Phpfox::getUserId());
                         // $bShowPosts = true;
                         break;
                     case 'pending-thread':
                         if (Phpfox::getUserParam('forum.can_approve_forum_thread')) {
                             $sViewId = 'ft.view_id = 1';
                         }
                         break;
                     default:
                         break;
                 }
                 $oSearch->setCondition('AND ft.group_id = 0 AND ' . $sViewId . ' AND ft.is_announcement = 0');
                 $bIsSearch = true;
             } else {
                 $oSearch->setCondition('AND ft.forum_id = ' . $aForum['forum_id'] . ' AND ft.group_id = 0 AND ' . $sViewId . ' AND ft.is_announcement = 0');
             }
         } else {
             $oSearch->setCondition('AND ft.forum_id = 0 AND ft.group_id = ' . $aParentModule['item_id'] . ' AND ' . $sViewId . ' AND ft.is_announcement = 0');
         }
         // get the forums that we cant access
         $aForbiddenForums = Forum_Service_Forum::instance()->getForbiddenForums();
         if (!empty($aForbiddenForums)) {
             $oSearch->setCondition(' AND ft.forum_id NOT IN (' . implode(',', $aForbiddenForums) . ')');
         }
     }
     if ($oSearch->get('result') || $this->request()->get('view') == 'pending-post') {
         if ($this->request()->get('view') == 'pending-post') {
             $bIsSearch = true;
             $bForceResult = true;
             $oSearch->setCondition('AND fp.view_id = 1');
         }
         list($iCnt, $aThreads) = Phpfox::getService('forum.post')->callback($aCallback)->get($oSearch->getConditions(), $oSearch->getSort(), $oSearch->getPage(), $iPageSize);
     } else {
         if (($iDaysPrune = $oSearch->get('days_prune')) && $iDaysPrune != '-1') {
             $oSearch->setCondition('AND ft.time_stamp >= ' . (PHPFOX_TIME - $iDaysPrune * 86400));
         }
         if ($bIsTagSearch === true) {
             if ($bIsModuleTagSearch) {
                 $oSearch->setCondition("AND ft.group_id = " . (int) $aCallback['group_id'] . " AND tag.tag_url = '" . Phpfox_Database::instance()->escape($this->request()->get('req5')) . "'");
             } else {
                 $oSearch->setCondition("AND ft.group_id = 0 AND tag.tag_url = '" . Phpfox_Database::instance()->escape($this->request()->get('req3')) . "'");
             }
         }
         list($iCnt, $aThreads) = Forum_Service_Thread_Thread::instance()->isSearch($bIsSearch)->isTagSearch($bIsTagSearch)->isNewSearch($sView == 'new' ? true : false)->isSubscribeSearch($sView == 'subscribed' ? true : false)->isModuleSearch($bIsModuleTagSearch)->get($oSearch->getConditions(), 'ft.order_id DESC, ' . $oSearch->getSort(), $oSearch->getPage(), $iPageSize);
     }
     $aAccess = Forum_Service_Forum::instance()->getUserGroupAccess($iForumId, Phpfox::getUserBy('user_group_id'));
     Phpfox_Pager::instance()->set(array('page' => $iPage, 'size' => $iPageSize, 'count' => $iCnt));
     $this->template()->assign(array('aThreads' => $aThreads, 'iSearchId' => $this->request()->getInt('search-id'), 'aCallback' => $aParentModule, 'sView' => $sView, 'aPermissions' => $aAccess))->setHeader('cache', array('forum.css' => 'style_css', 'pager.css' => 'style_css', 'selector.js' => 'static_script'));
     if ($bIsSearch && !isset($aForum['forum_id'])) {
         if (is_array($aCallback)) {
             $this->template()->setBreadcrumb('Pages', $this->url()->makeUrl('pages'))->setBreadcrumb($aCallback['title'], $aCallback['url_home']);
         } else {
             $this->template()->setBreadcrumb(Phpfox::getPhrase('forum.forum'), $this->url()->makeUrl('forum'));
         }
         if ($bIsTagSearch) {
             $aTag = Tag_Service_Tag::instance()->getTagInfo('forum', $bIsModuleTagSearch ? $this->request()->get('req5') : $this->request()->get('req3'));
             if (!empty($aTag['tag_text'])) {
                 if ($bIsModuleTagSearch) {
                     $this->template()->setBreadcrumb(Phpfox::getPhrase('forum.threads_tagged_with') . ': ' . $aTag['tag_text'], $this->url()->makeUrl('forum.tag.module_group.item_' . $this->request()->get('item') . '.' . $this->request()->get('req5')), true);
                 } else {
                     $this->template()->setBreadcrumb(Phpfox::getPhrase('forum.tags'), $this->url()->makeUrl('forum.tag'))->setBreadcrumb(Phpfox::getPhrase('forum.threads_tagged_with') . ': ' . $aTag['tag_text'], $this->url()->makeUrl('forum.tag.' . $this->request()->get('req3')), true);
                 }
             }
         } else {
             if (is_array($aCallback)) {
                 // $this->template()->setBreadcrumb(Phpfox::getPhrase('forum.search'), $this->url()->makeUrl('forum.search', array('module' => 'pages', 'item' => $aCallback['group_id'])));
             } else {
                 // $this->template()->setBreadcrumb(Phpfox::getPhrase('forum.search'), $this->url()->makeUrl('forum.search'));
             }
         }
         $this->template()->assign(array('bIsSearch' => true, 'bResult' => isset($bForceResult) ? true : $oSearch->get('result'), 'aForumResults' => $oSearch->get('forum'), 'bIsTagSearch' => $bIsTagSearch));
     } else {
         if (Phpfox::getParam('forum.rss_feed_on_each_forum')) {
             if ($aParentModule === null) {
                 $this->template()->setHeader('<link rel="alternate" type="application/rss+xml" title="' . Phpfox::getPhrase('forum.forum') . ': ' . $aForum['name'] . '" href="' . $this->url()->makeUrl('forum', array('rss', 'forum' => $aForum['forum_id'])) . '" />');
             } else {
                 $this->template()->setHeader('<link rel="alternate" type="application/rss+xml" title="' . Phpfox::getPhrase('forum.group_forum') . ': ' . $aCallback['title'] . '" href="' . $this->url()->makeUrl('forum', array('rss', 'group' => $aCallback['group_id'])) . '" />');
             }
         }
         if ($aCallback === null && $aParentModule === null) {
             if (!$aForum['is_closed'] && Phpfox::getUserParam('forum.can_add_new_thread') || Phpfox::getService('forum.moderate')->hasAccess($aForum['forum_id'], 'add_thread')) {
                 $this->template()->setMenu(['forum.forum' => ['menu_id' => null, 'module' => 'forum', 'url' => $this->url()->makeUrl('forum.post.thread', ['id' => $aForum['forum_id']]), 'var_name' => 'new_thread']]);
             }
         } else {
             if ($aParentModule !== null) {
                 $this->template()->setMenu(['forum.forum' => ['menu_id' => null, 'module' => 'forum', 'url' => $this->url()->makeUrl('forum.post.thread', ['module' => $aParentModule['module_id'], 'item' => $aParentModule['item_id']]), 'var_name' => 'new_thread']]);
                 // d($aParentModule); exit;
             }
         }
         /*
         {if !$aForumData.is_closed && Phpfox::getUserParam('forum.can_add_new_thread') || Phpfox::getService('forum.moderate')->hasAccess('' . $aForumData.forum_id . '', 'add_thread')}
         <div class="sub_menu_bar_main"><a href="{url link='forum.post.thread' id=$aForumData.forum_id}">{phrase var='forum.new_thread'}</a></div>
         		{/if}
         	{else}
         		<div class="sub_menu_bar_main"><a href="{url link='forum.post.thread' module=$aCallback.module_id item=$aCallback.item_id}">{phrase var='forum.new_thread'}</a></div>
         	{/if}
         */
         if ($aParentModule === null) {
             if (!Forum_Service_Forum::instance()->hasAccess($aForum['forum_id'], 'can_view_forum')) {
                 $this->url()->send('forum');
             }
             $this->template()->setTitle(Phpfox_Locale::instance()->convert($aForum['name']))->setBreadcrumb($aForum['breadcrumb'])->setBreadcrumb(Phpfox_Locale::instance()->convert($aForum['name']), $this->url()->permalink('forum', $aForum['forum_id'], $aForum['name']), true)->assign(array('bDisplayThreads' => true, 'aAnnouncements' => Forum_Service_Thread_Thread::instance()->getAnnoucements($iForumId), 'aForums' => $aForums, 'aForumData' => $aForum, 'bHasCategory' => false, 'bIsSubForum' => true, 'bIsSearch' => false, 'bIsTagSearch' => false));
         } else {
             $this->template()->setBreadcrumb(Phpfox::getPhrase('forum.forum'), $this->url()->makeUrl(''))->setTitle(Phpfox::getPhrase('forum.discussions'))->assign(array('bDisplayThreads' => true, 'bHasCategory' => false, 'bIsSubForum' => true, 'bIsSearch' => false, 'bIsTagSearch' => false, 'aAnnouncements' => Forum_Service_Thread_Thread::instance()->getAnnoucements(null, isset($aParentModule['item_id']) ? $aParentModule['item_id'] : 1)));
         }
     }
     if ($bIsSearch && (isset($bForceResult) || $oSearch->get('result'))) {
         if (isset($bForceResult)) {
             $this->setParam('global_moderation', array('name' => 'forumpost', 'ajax' => 'forum.postModeration', 'menu' => array(array('phrase' => Phpfox::getPhrase('forum.delete'), 'action' => 'delete'), array('phrase' => Phpfox::getPhrase('forum.approve'), 'action' => 'approve'))));
         } else {
             $this->template()->assign('bIsPostSearch', true);
         }
     } else {
         $this->setParam('global_moderation', array('name' => 'forum', 'ajax' => 'forum.moderation', 'menu' => array(array('phrase' => Phpfox::getPhrase('forum.delete'), 'action' => 'delete'), array('phrase' => Phpfox::getPhrase('forum.approve'), 'action' => 'approve'))));
     }
 }
Beispiel #22
0
 * To change this template use File | Settings | File Templates.
 */
if (Phpfox::isModule('bettermobile')) {
    if (Phpfox::isMobile()) {
        define('PHPFOX_SKIP_IM', true);
    }
    //if (Phpfox::getLib('setting')->isParam('profile_menus')) {
    if (Phpfox::getLib('setting')->isParam('profile_menus')) {
        $aProfileMenus = Phpfox::getParam('profile_menus');
        if (!empty($aProfileMenus)) {
            Phpfox::getLib('template')->buildSectionMenu('profile', $aProfileMenus);
        }
    }
    //}
    $sControllerName = Phpfox::getLib('module')->getFullControllerName();
    if (Phpfox::isMobile() || $sControllerName == 'forum.forum') {
        //check version
        $sVersion = Phpfox::getVersion();
        $aVersion = preg_split('[\\.]', $sVersion);
        if ($aVersion[0] >= 3 && $aVersion[1] >= 5) {
            $bNewVersion = true;
        }
        Phpfox::getLib('template')->assign(array('bNewVersion' => $bNewVersion, 'iTotalActivityPoints' => (int) Phpfox::getUserBy('activity_points')));
        // check language
        $aLang = Phpfox::getLib('locale')->getLang();
        if ($aLang['direction'] == 'rtl') {
            Phpfox::getLib('template')->setHeader(array('
                    <script type="text/javascript" language="javascript">
                    var bRtl = true;
                    </script>'));
            Phpfox::getLib('template')->setHeader('cache', array('rtl.css' => 'module_bettermobile'));
Beispiel #23
0
 /**
  * Gets any data we plan to place within the HTML tags <head></head>.
  * This method also groups the data to give the template a nice clean look.
  *
  * @return string $sData Returns the HTML data to be placed within <head></head>
  */
 public function getHeader($bReturnArray = false)
 {
     if (Phpfox::isMobile()) {
         $this->setHeader(array('mobile.css' => 'style_css'));
     }
     if (!defined('PHPFOX_INSTALLER')) {
         $this->setHeader(array('custom.css' => 'style_css'));
         $aLocale = Phpfox::getLib('locale')->getLang();
         if ($aLocale['direction'] == 'rtl') {
             $this->setHeader(array('rtl.css' => 'style_css'));
         }
         $sCustomCss = '';
         $aThemeCache = $this->getThemeCache();
         if (isset($aThemeCache['l_width']) && $aThemeCache['l_width'] > 0) {
             $sCustomCss .= '#left { width:' . (int) $aThemeCache['l_width'] . 'px; }';
             $sCustomCss .= '#main_content { margin-left:' . (int) $aThemeCache['l_width'] . 'px; }';
         }
         if (isset($aThemeCache['c_width']) && $aThemeCache['c_width'] > 0) {
             $sCustomCss .= '.content3, .item_view .js_feed_comment_border, .item_view .item_tag_holder, .item_view .attachment_holder_view { width:' . (int) $aThemeCache['c_width'] . 'px; }';
         }
         if (isset($aThemeCache['r_width']) && $aThemeCache['r_width'] > 0) {
             $sCustomCss .= '#right { width:' . (int) $aThemeCache['r_width'] . 'px; }';
             $sCustomCss .= '.content4 { width:' . (960 - (int) $aThemeCache['r_width']) . 'px; }';
         }
         if (!empty($sCustomCss)) {
             $this->setHeader('<style type="text/css">' . $sCustomCss . '</style>');
         }
     }
     $aArrayData = array();
     $sData = '';
     $sCss = '';
     $sJs = '';
     $iVersion = $this->getStaticVersion();
     $oUrl = Phpfox::getLib('url');
     if (defined('PHPFOX_IS_HOSTED_SCRIPT')) {
         $oCache = Phpfox::getLib('cache');
     } else {
         $oCache = Phpfox::getLib('cache', array('storage' => 'file', 'free' => true));
     }
     $aUrl = $oUrl->getParams();
     if (Phpfox::getUserParam('core.can_design_dnd') && Phpfox::getService('theme')->isInDnDMode() && (!isset($aUrl['req2']) || $aUrl['req2'] != 'designer')) {
         if (!defined('PHPFOX_DESIGN_DND')) {
             define('PHPFOX_DESIGN_DND', true);
         }
         /* .
          * Tells if the user is Design mode with Drag and Drop support.
          * Its important to note the difference in the purpose of this
          * constant as it does Not tell if the user CAN enter DesignDND 
          * mode but instead it tells if the user IS already in this 
          * mode
          * .
          */
         $this->_aHeaders[] = array('designdnd.js' => 'module_theme');
     } else {
         if (!defined('PHPFOX_DESIGN_DND')) {
             define('PHPFOX_DESIGN_DND', false);
         }
     }
     if (!PHPFOX_IS_AJAX_PAGE) {
         if (!defined('PHPFOX_INSTALLER')) {
             if (!Phpfox::isAdminPanel()) {
                 $oDb = Phpfox::getLib('database');
                 $oFileCache = Phpfox::getLib('cache');
                 $sFileThemeCssId = $oFileCache->set(array('theme', 'theme_css' . $iVersion));
                 $aCacheStyles = array();
                 if (!($aCacheStyles = $oFileCache->get($sFileThemeCssId))) {
                     $aSavedStyles = $oDb->select('tc.module_id, tc.file_name')->from(Phpfox::getT('theme_css'), 'tc')->where('style_id = ' . (int) $this->_aTheme['style_id'] . '')->execute('getRows');
                     foreach ($aSavedStyles as $aSavedStyle) {
                         $aCacheStyles[$aSavedStyle['module_id'] ? $aSavedStyle['module_id'] : null][$aSavedStyle['file_name']] = true;
                     }
                     $oFileCache->save($sFileThemeCssId, $aCacheStyles);
                 }
             }
         }
         ($sPlugin = Phpfox_Plugin::get('template_getheader')) ? eval($sPlugin) : false;
         $sJs .= "\t\t\tvar oCore = {'core.is_admincp': " . (Phpfox::isAdminPanel() ? 'true' : 'false') . ", 'core.section_module': '" . Phpfox::getLib('module')->getModuleName() . "', 'profile.is_user_profile': " . (defined('PHPFOX_IS_USER_PROFILE') && PHPFOX_IS_USER_PROFILE ? 'true' : 'false') . ", 'log.security_token': '" . Phpfox::getService('log.session')->getToken() . "', 'core.url_rewrite': '" . Phpfox::getParam('core.url_rewrite') . "', 'core.country_iso': '" . (Phpfox::isUser() ? Phpfox::getUserBy('country_iso') : '') . "', 'core.can_move_on_a_y_and_x_axis' : " . (!defined('PHPFOX_INSTALLER') && Phpfox::getParam('core.can_move_on_a_y_and_x_axis') ? 'true' : 'false') . ", 'core.default_currency': '" . (defined('PHPFOX_INSTALLER') ? 'USD' : Phpfox::getService('core.currency')->getDefault()) . "', 'core.enabled_edit_area': " . (Phpfox::getParam('core.enabled_edit_area') ? 'true' : 'false') . ", 'core.disable_hash_bang_support': " . (Phpfox::getParam('core.disable_hash_bang_support') ? 'true' : 'false') . ", 'core.site_wide_ajax_browsing': " . (!defined('PHPFOX_IN_DESIGN_MODE') && Phpfox::getParam('core.site_wide_ajax_browsing') && !Phpfox::isAdminPanel() && Phpfox::isUser() ? 'true' : 'false') . ", 'profile.user_id': " . (defined('PHPFOX_IS_USER_PROFILE') && PHPFOX_IS_USER_PROFILE ? Phpfox::getService('profile')->getProfileUserId() : 0) . "};\n";
         // You are filtering out the controllers which should not load 'content' ajaxly, finding a way for pages.view/1/info and like that
         $sProgressCssFile = $this->getStyle('css', 'progress.css');
         $sStylePath = str_replace(Phpfox::getParam('core.path'), '', str_replace('progress.css', '', $sProgressCssFile));
         $aJsVars = array('sJsHome' => Phpfox::getParam('core.path'), 'sJsHostname' => $_SERVER['HTTP_HOST'], 'sSiteName' => Phpfox::getParam('core.site_title'), 'sJsStatic' => $oUrl->getDomain() . PHPFOX_STATIC, 'sJsStaticImage' => Phpfox::getParam('core.url_static_image'), 'sImagePath' => $this->getStyle('image'), 'sStylePath' => $this->getStyle('css'), 'sVersion' => Phpfox::getId(), 'sJsAjax' => $oUrl->getDomain() . PHPFOX_STATIC . 'ajax.php', 'sStaticVersion' => $iVersion, 'sGetMethod' => PHPFOX_GET_METHOD, 'sDateFormat' => defined('PHPFOX_INSTALLER') ? '' : Phpfox::getParam('core.date_field_order'), 'sJsAjax' => $oUrl->getDomain() . PHPFOX_STATIC . 'ajax.php', 'sEgiftStyle' => $this->getStyle('css', 'display.css', 'egift'), 'sGlobalTokenName' => Phpfox::getTokenName(), 'sController' => Phpfox::getLib('module')->getFullControllerName(), 'bJsIsMobile' => Phpfox::isMobile() ? true : false, 'sProgressCssFile' => $sProgressCssFile, 'sHostedVersionId' => defined('PHPFOX_IS_HOSTED_VERSION') ? PHPFOX_IS_HOSTED_VERSION : '');
         if (!defined('PHPFOX_INSTALLER')) {
             $aJsVars['bWysiwyg'] = Phpfox::getParam('core.wysiwyg') != 'default' && Phpfox::getParam('core.allow_html') ? true : false;
             $aJsVars['sEditor'] = Phpfox::getParam('core.wysiwyg');
             $aJsVars['sJsCookiePath'] = Phpfox::getParam('core.cookie_path');
             $aJsVars['sJsCookieDomain'] = Phpfox::getParam('core.cookie_domain');
             $aJsVars['sJsCookiePrefix'] = Phpfox::getParam('core.session_prefix');
             $aJsVars['bPhotoTheaterMode'] = Phpfox::isModule('photo') ? Phpfox::getParam('photo.view_photos_in_theater_mode') : false;
             $aJsVars['bUseHTML5Video'] = Phpfox::getParam('video.upload_for_html5') ? true : false;
             if (Phpfox::isAdmin()) {
                 $aJsVars['sAdminCPLocation'] = Phpfox::getParam('admincp.admin_cp');
             } else {
                 $aJsVars['sAdminCPLocation'] = '';
             }
             if (Phpfox::isModule('notification')) {
                 $aJsVars['notification.notify_ajax_refresh'] = Phpfox::getParam('notification.notify_ajax_refresh');
             }
             if (Phpfox::isModule('im')) {
                 if (Phpfox::isUser()) {
                     $aJsVars['im_beep'] = Phpfox::getUserBy('im_beep');
                 }
                 $this->setHeader(array('player/' . Phpfox::getParam('core.default_music_player') . '/core.js' => 'static_script'));
                 $aJsVars['im_interval_for_update'] = Phpfox::getParam('im.js_interval_value');
                 if (Phpfox::getParam('im.server_for_ajax_calls') != '') {
                     $aJsVars['im_server'] = Phpfox::getParam('im.server_for_ajax_calls');
                 }
             } elseif (Phpfox::isModule('video')) {
                 $this->setHeader(array('player/' . Phpfox::getParam('core.default_music_player') . '/core.js' => 'static_script'));
             }
             $sLocalDatepicker = PHPFOX_STATIC . 'jscript/jquery/locale/jquery.ui.datepicker-' . strtolower(Phpfox::getLib('locale')->getLangId()) . '.js';
             if (file_exists($sLocalDatepicker)) {
                 $sFile = str_replace(PHPFOX_STATIC . 'jscript/', '', $sLocalDatepicker);
                 $this->setHeader(array($sFile => 'static_script'));
             }
             /* Only in a few cases will we want to add the visitor's IP */
             if (Phpfox::getParam('core.google_api_key') != '' && Phpfox::getParam('core.ip_infodb_api_key')) {
                 // $aJsVars['sIP'] = Phpfox::getLib('request')->getIp();
             }
             $aJsVars['bEnableMicroblogSite'] = Phpfox::isModule('microblog') ? Phpfox::getParam('microblog.enable_microblog_site') : false;
         }
         ($sPlugin = Phpfox_Plugin::get('template_getheader_setting')) ? eval($sPlugin) : false;
         if (Phpfox::isModule('input') && false) {
             $this->setHeader('cache', array('browse.css' => 'style_css'));
         }
         $sJs .= "\t\t\tvar oParams = {";
         $iCnt = 0;
         foreach ($aJsVars as $sVar => $sValue) {
             $iCnt++;
             if ($iCnt != 1) {
                 $sJs .= ",";
             }
             if (is_bool($sValue)) {
                 $sJs .= "'{$sVar}': " . ($sValue ? 'true' : 'false');
             } elseif (is_numeric($sValue)) {
                 $sJs .= "'{$sVar}': " . $sValue;
             } else {
                 $sJs .= "'{$sVar}': '" . str_replace("'", "\\'", $sValue) . "'";
             }
         }
         $sJs .= "};\n";
         if (!defined('PHPFOX_INSTALLER')) {
             $aLocaleVars = array('core.are_you_sure', 'core.yes', 'core.no', 'core.save', 'core.cancel', 'core.go_advanced', 'core.processing', 'emoticon.emoticons', 'attachment.attach_files', 'core.close', 'core.language_packages', 'core.move_this_block', 'core.uploading', 'language.loading', 'core.saving', 'core.loading_text_editor', 'core.quote', 'core.loading');
             if (Phpfox::isModule('im') && Phpfox::getParam('im.enable_im_in_footer_bar')) {
                 $aLocaleVars[] = 'im.find_your_friends';
             }
             ($sPlugin = Phpfox_Plugin::get('template_getheader_language')) ? eval($sPlugin) : false;
             $sJs .= "\t\t\tvar oTranslations = {";
             $iCnt = 0;
             foreach ($aLocaleVars as $sValue) {
                 $aParts = explode('.', $sValue);
                 if ($aParts[0] != 'core' && !Phpfox::isModule($aParts[0])) {
                     continue;
                 }
                 $iCnt++;
                 if ($iCnt != 1) {
                     $sJs .= ",";
                 }
                 $sJs .= "'{$sValue}': '" . html_entity_decode(str_replace("'", "\\'", Phpfox::getPhrase($sValue)), null, 'UTF-8') . "'";
             }
             $sJs .= "};\n";
             $aModules = Phpfox::getLib('module')->getModules();
             $sJs .= "\t\t\tvar oModules = {";
             $iCnt = 0;
             foreach ($aModules as $sModule => $iModuleId) {
                 $iCnt++;
                 if ($iCnt != 1) {
                     $sJs .= ",";
                 }
                 $sJs .= "'{$sModule}': true";
             }
             $sJs .= "};\n";
         }
         if (count($this->_aImages)) {
             $sJs .= "\t\t\tvar oJsImages = {";
             foreach ($this->_aImages as $sKey => $sImage) {
                 $sJs .= $sKey . ': \'' . $sImage . '\',';
             }
             $sJs = rtrim($sJs, ',');
             $sJs .= "};\n";
         }
         /*
         if (count($this->_aEditor) && isset($this->_aEditor['active']) && $this->_aEditor['active'])
         {
         */
         $aEditorButtons = Phpfox::getLib('editor')->getButtons();
         $iCnt = 0;
         $sJs .= "\t\t\tvar oEditor = {";
         if (count($this->_aEditor) && isset($this->_aEditor['active']) && $this->_aEditor['active']) {
             foreach ($this->_aEditor as $sVar => $mValue) {
                 $iCnt++;
                 if ($iCnt != 1) {
                     $sJs .= ",";
                 }
                 $sJs .= "'{$sVar}': " . (is_bool($mValue) ? $mValue === true ? 'true' : 'false' : "'{$mValue}'") . "";
             }
             $sJs .= ", ";
         }
         $sJs .= "images:[";
         foreach ($aEditorButtons as $mEditorButtonKey => $aEditorButton) {
             $sJs .= "{";
             foreach ($aEditorButton as $sEditorButtonKey => $sEditorButtonValue) {
                 $sJs .= "" . $sEditorButtonKey . ": '" . $sEditorButtonValue . "',";
             }
             $sJs = rtrim($sJs, ',') . "},";
         }
         $sJs = rtrim($sJs, ',') . "]";
         $sJs .= "};\n";
         // }
         if (!defined('PHPFOX_INSTALLER') && Phpfox::getParam('core.load_jquery_from_google_cdn')) {
             $sData .= "\t\t" . '<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/' . Phpfox::getParam('core.jquery_google_cdn_version') . '/jquery.min.js"></script>' . "\n";
         }
     }
     if (PHPFOX_IS_AJAX_PAGE) {
         $this->_aCacheHeaders = array();
     }
     $bIsHttpsPage = false;
     if (!defined('PHPFOX_INSTALLER') && Phpfox::getParam('core.force_https_secure_pages')) {
         if (in_array(str_replace('mobile.', '', Phpfox::getLib('module')->getFullControllerName()), Phpfox::getService('core')->getSecurePages()) && (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')) {
             $bIsHttpsPage = true;
         }
     }
     $aSubCache = array();
     $sStyleCacheData = '';
     $sJsCacheData = '';
     $aUrl = Phpfox::getLib('url')->getParams();
     // These two arrays hold the files to be combined+minified and put in CDN (if available)
     $aCacheJs = array();
     $aCacheCSS = array();
     $this->_sFooter = '';
     $sJs .= "\t\t\t" . 'var $Behavior = {};' . "\n";
     $sJs .= "\t\t\t" . 'var $Core = {};' . "\n";
     if (Phpfox::getParam('core.defer_loading_user_images') || Phpfox::getParam('core.defer_loading_images')) {
         $this->setHeader('cache', array('defer_image.js' => 'module_core'));
     }
     if (Phpfox::getParam('core.include_master_files')) {
         $aMasterJS = array();
         $aMasterCSS = array();
     }
     $aCustomCssFile = array();
     foreach ($this->_aHeaders as $aHeaders) {
         if (!is_array($aHeaders)) {
             $aHeaders = array($aHeaders);
         }
         foreach ($aHeaders as $mKey => $mValue) {
             $sQmark = strpos($mKey, '?') ? '&amp;' : '?';
             if (is_numeric($mKey)) {
                 if ($mValue === null) {
                     continue;
                 }
                 if ($bReturnArray) {
                     $aArrayData[] = $mValue;
                 } else {
                     if (is_string($mValue) && (strpos($mValue, '.js') !== false || strpos($mValue, 'javascript') !== false)) {
                         if (strpos($mValue, 'RecaptchaOptions')) {
                             $sData .= "\t\t" . $mValue . "\n";
                         } else {
                             $this->_sFooter .= "\t\t" . $mValue;
                         }
                     } else {
                         if (is_string($mValue)) {
                             $sData .= "\t\t" . $mValue . "\n";
                         } else {
                             $sData .= "\t\t" . implode($mValue) . "\n";
                         }
                     }
                 }
             } else {
                 if ($mKey == 'master') {
                     $aMaster = array('css' => array(), 'jscript' => array());
                     foreach ($mValue as $sValKey => $sValVal) {
                         if (strpos($sValKey, '.css') !== false) {
                             if ($sValVal == 'style_css') {
                                 $aMaster['css'][] = 'theme' . PHPFOX_DS . 'frontend' . PHPFOX_DS . $this->getThemeFolder() . PHPFOX_DS . 'style' . PHPFOX_DS . $this->getStyleFolder() . PHPFOX_DS . 'css' . PHPFOX_DS . $sValKey;
                             } else {
                                 if (strpos($sValVal, 'module_') !== false) {
                                     $aMaster['css'][] = 'module' . PHPFOX_DS . str_replace('module_', '', $sValVal) . PHPFOX_DS . 'static' . PHPFOX_DS . 'css' . PHFPFOX_DS . $this->getThemeFolder() . PHPFOX_DS . $this->getStyleFolder() . PHPFOX_DS . $sValKey;
                                 }
                             }
                         } else {
                             if (strpos($sValKey, '.js') !== false) {
                                 if ($sValVal == 'static_script') {
                                     $aMaster['jscript'][] = 'static' . PHPFOX_DS . 'jscript' . PHPFOX_DS . $sValKey;
                                 } else {
                                     if (strpos($sValVal, 'module_') !== false) {
                                         $aMaster['jscript'][] = 'module' . PHPFOX_DS . str_replace('module_', '', $sValVal) . PHPFOX_DS . 'static' . PHPFOX_DS . 'jscript' . PHPFOX_DS . $sValKey;
                                     }
                                 }
                             }
                         }
                     }
                     unset($this->_aHeaders[$mKey]);
                     // just to avoid confusions
                     $this->_aHeaders['master'] = $aMaster;
                 } else {
                     $bToHead = false;
                     // This happens when the developer needs something to go to <head>
                     if (is_array($mValue)) {
                         $aKeyHead = array_keys($mValue);
                         $aKeyValue = array_values($mValue);
                         $bToHead = $mKey == 'head';
                         $mKey = array_pop($aKeyHead);
                         $mValue = array_pop($aKeyValue);
                     }
                     switch ($mValue) {
                         case 'style_script':
                             if (isset($aSubCache[$mKey][$mValue])) {
                                 continue;
                             }
                             if ($bReturnArray) {
                                 $aArrayData[] = $this->getStyle('jscript', $mKey);
                             } else {
                                 //$sJsCacheData .= str_replace(Phpfox::getParam('core.path'), '', $this->getStyle('jscript', $mKey)) . ',';
                                 if ($bToHead == 'head') {
                                     $aCacheCSS[] = str_replace(Phpfox::getParam('core.path'), '', $this->getStyle('jscript', $mKey));
                                 } else {
                                     $aCacheJs[] = str_replace(Phpfox::getParam('core.path'), '', $this->getStyle('jscript', $mKey));
                                 }
                             }
                             break;
                         case 'style_css':
                             $bCustomStyle = false;
                             if (!defined('PHPFOX_INSTALLER') && !Phpfox::isAdminPanel()) {
                                 if (isset($aCacheStyles[null][$mKey])) {
                                     if (defined('PHPFOX_IS_HOSTED_SCRIPT')) {
                                         $sCssCustomCacheId = $oCache->set($this->_aTheme['style_id'] . '_custom_css_file');
                                     } else {
                                         if ($bIsHttpsPage) {
                                             $sCssCustomCacheId = $oCache->set(PHPFOX_DIR_FILE . 'static' . PHPFOX_DS . $this->_aTheme['style_id'] . '_secure_' . $mKey);
                                         } else {
                                             $sCssCustomCacheId = $oCache->set(PHPFOX_DIR_FILE . 'static' . PHPFOX_DS . $this->_aTheme['style_id'] . '_' . $mKey);
                                         }
                                     }
                                     if (!($aCss = defined('PHPFOX_IS_HOSTED_SCRIPT') ? $oCache->get($sCssCustomCacheId) : $oCache->isCached($sCssCustomCacheId))) {
                                         $oDb = Phpfox::getLib('database');
                                         $aCss = $oDb->select('tc.css_id, tc.css_data, tc.css_data_original')->from(Phpfox::getT('theme_css'), 'tc')->where('style_id = ' . (int) $this->_aTheme['style_id'] . ' AND file_name = \'' . $oDb->escape($mKey) . '\'')->execute('getRow');
                                         if (isset($aCss['css_id'])) {
                                             $oCache->save($sCssCustomCacheId, defined('PHPFOX_IS_HOSTED_SCRIPT') ? $aCss : Phpfox::getLib('file.minimize')->css($aCss['css_data']));
                                             $bCustomStyle = true;
                                         }
                                     } else {
                                         if (defined('PHPFOX_IS_HOSTED_SCRIPT') && isset($aCss['css_id'])) {
                                             $bCustomStyle = true;
                                         } else {
                                             if (file_exists(PHPFOX_DIR_FILE . 'static' . PHPFOX_DS . $this->_aTheme['style_id'] . '_' . $mKey)) {
                                                 $bCustomStyle = true;
                                             }
                                         }
                                     }
                                 } else {
                                     if (file_exists(PHPFOX_DIR_FILE . 'static' . PHPFOX_DS . $this->_aTheme['style_id'] . '_' . $mKey)) {
                                         $bCustomStyle = true;
                                     }
                                 }
                             }
                             if ($bCustomStyle === false) {
                                 if ($bReturnArray) {
                                     $aArrayData[] = $this->getStyle('css', $mKey);
                                 } else {
                                     $aCacheCSS[] = str_replace(Phpfox::getParam('core.path'), '', $this->getStyle('css', $mKey));
                                 }
                             } else {
                                 if (defined('PHPFOX_IS_HOSTED_SCRIPT')) {
                                     $bLoadCustomThemeOverwrite = true;
                                 } else {
                                     if ($bReturnArray) {
                                         $aArrayData[] = Phpfox::getParam('core.url_file') . 'static/' . $this->_aTheme['style_id'] . '_' . $mKey;
                                     } else {
                                         if (isset($this->_aCacheHeaders[$mKey])) {
                                             // $sStyleCacheData .= str_replace(Phpfox::getParam('core.path'), '', Phpfox::getParam('core.url_file')) . 'static/' . $this->_aTheme['style_id'] . '_' . $mKey . ',';
                                             $aCustomCssFile[] = Phpfox::getParam('core.url_file') . 'static/' . $this->_aTheme['style_id'] . '_' . $mKey . '';
                                         } else {
                                             if ($bIsHttpsPage) {
                                                 //$sData .= "\t\t" . '<link rel="stylesheet" type="text/css" href="' . Phpfox::getParam('core.url_file') . 'static/' . $this->_aTheme['style_id'] . '_secure_' . $mKey . '?v=' . $iVersion . '" />' . "\n";
                                                 $aCustomCssFile[] = Phpfox::getParam('core.url_file') . 'static/' . $this->_aTheme['style_id'] . '_secure_' . $mKey;
                                             } else {
                                                 //$sData .= "\t\t" . '<link rel="stylesheet" type="text/css" href="' . Phpfox::getParam('core.url_file') . 'static/' . $this->_aTheme['style_id'] . '_' . $mKey . '?v=' . $iVersion . '" />' . "\n";
                                                 $aCustomCssFile[] = Phpfox::getParam('core.url_file') . 'static/' . $this->_aTheme['style_id'] . '_' . $mKey;
                                             }
                                         }
                                     }
                                 }
                             }
                             break;
                         case 'static_script':
                             if (isset($aSubCache[$mKey][$mValue])) {
                                 continue;
                             }
                             if (!defined('PHPFOX_INSTALLER') && Phpfox::getParam('core.load_jquery_from_google_cdn')) {
                                 if ($mKey == 'jquery/ui.js' || $mKey == 'jquery/jquery.js') {
                                     if ($mKey == 'jquery/ui.js') {
                                         $this->_sFooter .= "\t\t" . '<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/' . Phpfox::getParam('core.jquery_ui_google_cdn_version') . '/jquery-ui.min.js"></script>' . "\n";
                                     }
                                     continue;
                                 }
                             }
                             if ($bReturnArray) {
                                 $aArrayData[] = Phpfox::getParam('core.url_static_script') . $mKey;
                             } else {
                                 if (isset($this->_aCacheHeaders[$mKey])) {
                                     // $sJsCacheData .= $mKey . ',';
                                     if ($bToHead == 'head') {
                                         $aCacheCSS[] = 'static' . PHPFOX_DS . 'jscript' . PHPFOX_DS . $mKey;
                                     } else {
                                         $aCacheJs[] = 'static' . PHPFOX_DS . 'jscript' . PHPFOX_DS . $mKey;
                                     }
                                 } else {
                                     //$sData .= "\t\t" . '<script type="text/javascript" src="' . Phpfox::getParam('core.url_static_script') . $mKey . $sQmark . 'v=' . $iVersion . '"></script>' . "\n";
                                     if ($bToHead == 'head') {
                                         $aCacheCSS[] = 'static/jscript/' . $mKey;
                                     } else {
                                         $aCacheJs[] = 'static/jscript/' . $mKey;
                                     }
                                 }
                             }
                             break;
                         default:
                             if (preg_match('/module/i', $mValue)) {
                                 $aParts = explode('_', $mValue);
                                 if (isset($aParts[1]) && Phpfox::isModule($aParts[1])) {
                                     if (substr($mKey, -3) == '.js') {
                                         if ($bReturnArray) {
                                             $aArrayData[] = Phpfox::getParam('core.path') . 'module/' . $aParts[1] . '/static/jscript/' . $mKey;
                                         } else {
                                             if (isset($this->_aCacheHeaders[$mKey])) {
                                                 //$sJsCacheData .= 'module/' . $aParts[1] . '/static/jscript/' . $mKey . ',';
                                                 $aCacheJs[] = 'module/' . $aParts[1] . '/static/jscript/' . $mKey;
                                             } else {
                                                 /*
                                                 if (defined('PHPFOX_IS_HOSTED_SCRIPT'))
                                                 {
                                                 	$sData .= "\t\t" . '<script type="text/javascript" src="' . Phpfox::getCdnPath() . 'module/' . $aParts[1] . '/static/jscript/' . $mKey . $sQmark . 'v=' . $iVersion . '"></script>' . "\n";
                                                 }	
                                                 else
                                                 {
                                                 */
                                                 //$sData .= "\t\t" . '<script type="text/javascript" src="' . Phpfox::getParam('core.path') . 'module/' . $aParts[1] . '/static/jscript/' . $mKey . $sQmark . 'v=' . $iVersion . '"></script>' . "\n";
                                                 $aCacheJs[] = 'module/' . $aParts[1] . '/static/jscript/' . $mKey;
                                                 // }
                                             }
                                         }
                                     } elseif (substr($mKey, -4) == '.css') {
                                         $aCacheCSS[] = str_replace(Phpfox::getParam('core.path'), '', $this->getStyle('css', $mKey, $aParts[1]));
                                         $bCustomStyle = false;
                                         if (!defined('PHPFOX_INSTALLER') && !Phpfox::isAdminPanel()) {
                                             if (isset($aCacheStyles[$aParts[1]][$mKey])) {
                                                 $sCssCustomCacheId = $oCache->set(PHPFOX_DIR_FILE . 'static' . PHPFOX_DS . $this->_aTheme['style_id'] . '_' . $aParts[1] . '_' . $mKey);
                                                 if (!$oCache->isCached($sCssCustomCacheId)) {
                                                     $oDb = Phpfox::getLib('database');
                                                     $aCss = $oDb->select('tc.css_id, tc.css_data')->from(Phpfox::getT('theme_css'), 'tc')->where('module_id = \'' . $oDb->escape($aParts[1]) . '\' AND style_id = ' . (int) $this->_aTheme['style_id'] . ' AND file_name = \'' . $oDb->escape($mKey) . '\'')->execute('getRow');
                                                     if (isset($aCss['css_id'])) {
                                                         $oCache->save($sCssCustomCacheId, Phpfox::getLib('file.minimize')->css($aCss['css_data']));
                                                         $bCustomStyle = true;
                                                     }
                                                 } else {
                                                     if (file_exists(PHPFOX_DIR_FILE . 'static' . PHPFOX_DS . $this->_aTheme['style_id'] . '_' . $aParts[1] . '_' . $mKey)) {
                                                         $bCustomStyle = true;
                                                     }
                                                 }
                                             } else {
                                                 if (file_exists(PHPFOX_DIR_FILE . 'static' . PHPFOX_DS . $this->_aTheme['style_id'] . '_' . $aParts[1] . '_' . $mKey)) {
                                                     $bCustomStyle = true;
                                                 }
                                             }
                                         }
                                         if ($bCustomStyle === false) {
                                             if ($bReturnArray) {
                                                 //$aArrayData[] = $this->getStyle('css', $mKey, $aParts[1]);
                                                 $aCachesCSS[] = str_replace(Phpfox::getParam('core.path'), '', $this->getStyle('css', $mKey, $aParts[1]));
                                             } else {
                                                 /*
                                                 if (defined('PHPFOX_IS_HOSTED_SCRIPT'))
                                                 {
                                                     $sData .= "\t\t" . '<link rel="stylesheet" type="text/css" href="' . str_replace(Phpfox::getParam('core.path'), Phpfox::getCdnPath(), $this->getStyle('css', $mKey, $aParts[1])) . $sQmark . 'v=' . $iVersion . '" />' . "\n";
                                                 }
                                                 else
                                                 {
                                                 */
                                                 $aCachesCSS[] = str_replace(Phpfox::getParam('core.path'), '', $this->getStyle('css', $mKey, $aParts[1]));
                                                 // }
                                             }
                                         } else {
                                             //$sStyleCacheData .= str_replace(Phpfox::getParam('core.path'), '', Phpfox::getParam('core.url_file')) . 'static/' . $this->_aTheme['style_id'] . '_' . $aParts[1] . '_' . $mKey . ',';
                                             $aCachesCSS[] = str_replace(Phpfox::getParam('core.path'), '', Phpfox::getParam('core.url_file')) . 'static/' . $this->_aTheme['style_id'] . '_' . $aParts[1] . '_' . $mKey;
                                         }
                                     }
                                 }
                             }
                             break;
                     }
                     $aSubCache[$mKey][$mValue] = true;
                 }
             }
         }
     }
     $sCacheData = '';
     $sCacheData .= "\n\t\t<script type=\"text/javascript\">\n";
     $sCacheData .= $sJs;
     $sCacheData .= "\t\t</script>";
     if (!empty($sStyleCacheData)) {
         $sCacheData .= "\n\t\t" . '<link rel="stylesheet" type="text/css" href="' . Phpfox::getParam('core.url_static') . 'gzip.php?t=css&amp;s=' . $sStylePath . '&amp;f=' . rtrim($sStyleCacheData, ',') . '&amp;v=' . $iVersion . '" />';
     }
     if (!empty($sJsCacheData)) {
         $sCacheData .= "\n\t\t" . '<script type="text/javascript" src="' . Phpfox::getParam('core.url_static') . 'gzip.php?t=js&amp;f=' . rtrim($sJsCacheData, ',') . '&amp;v=' . $iVersion . '"></script>';
     }
     if (Phpfox::getParam('core.include_master_files') && Phpfox::isAdminPanel() != true && isset($this->_aHeaders['master'])) {
         // $this->_aHeaders[master] is created in the foreach above and it takes the files listed in Phpfox::getMasterFiles
         $aMasterFiles = $this->_aHeaders['master'];
         require_once PHPFOX_DIR_LIB . 'jsmin/jsmin2.class.php';
         // if the file doesnt exist load the default ones
         if ($this->_sThemeFolder != 'default' || $this->_sStyleFolder != 'default') {
             foreach ($aMasterFiles['css'] as $iKey => $sFile) {
                 if (file_exists(PHPFOX_DIR . $sFile) != true) {
                     // include the default master file
                     $sFile = str_replace($this->getThemeFolder(), 'default', $sFile);
                     $sFile = str_replace($this->getStyleFolder(), 'default', $sFile);
                     $aMasterFiles['css'][$iKey] = $sFile;
                 }
             }
         }
         $sMasterCSSUrl = Phpfox::getLib('file.minimize')->minify($aMasterFiles['css'], $sQmark . 'v=' . $iVersion, false);
         $sCacheData .= "\n\t\t" . '<!-- CSS Master --> <link rel="stylesheet" type="text/css" href="' . $sMasterCSSUrl . '" />';
         $sMasterJSUrl = Phpfox::getLib('file.minimize')->minify($aMasterFiles['jscript'], $sQmark . 'v=' . $iVersion, true);
         $this->_sFooter .= "\n\t\t" . '<!-- JS Master --> <script type="text/javascript" src="' . $sMasterJSUrl . '"></script>';
     }
     if (!empty($sCacheData)) {
         $sData = preg_replace('/<link rel="shortcut icon" type="image\\/x-icon" href="(.*?)" \\/>/i', '<link rel="shortcut icon" type="image/x-icon" href="\\1" />' . $sCacheData, $sData);
     }
     if ($bReturnArray) {
         $sData = '';
     }
     $aCacheJs = array_unique($aCacheJs);
     if (Phpfox::getParam('core.cache_js_css')) {
         $aJqueryPlugins = array();
         foreach ($aCacheJs as $iKey => $sFile) {
             //  if ( (strpos($sFile, 'jquery') !== false) && (strpos($sFile, 'plugin') !== false) )
             if (strpos($sFile, 'jquery') !== false) {
                 // We minify JQuery plug-ins in their own file
                 $aJqueryPlugins[] = $sFile;
                 unset($aCacheJs[$iKey]);
             }
             if ($sFile == 'static/jscript/wysiwyg/tiny_mce/tiny_mce.js') {
                 $this->_sFooter .= "\n\t\t" . '<!-- TinyMCE --> <script type="text/javascript" src="' . Phpfox::getParam('core.path') . $sFile . '?v=' . $iVersion . '"></script>' . "";
                 unset($aCacheJs[$iKey]);
             }
         }
         require_once PHPFOX_DIR_LIB . 'jsmin/jsmin2.class.php';
         if (!empty($aJqueryPlugins)) {
             $sPluginsUrl = Phpfox::getLib('file.minimize')->minify($aJqueryPlugins, $sQmark . 'v=' . $iVersion, true);
             $this->_sFooter .= "\n\t\t" . '<!-- JQuery Plugins --> <script type="text/javascript" src="' . $sPluginsUrl . '"></script>' . "";
         }
         if (!empty($aCacheJs)) {
             $aCacheJs = array_unique($aCacheJs);
             $sJsUrl = Phpfox::getLib('file.minimize')->minify($aCacheJs, $sQmark . 'v=' . $iVersion, true, true);
             $this->_sFooter .= "\n\t\t" . '<!-- Minified --> <script type="text/javascript" src="' . $sJsUrl . '"></script>' . "";
         }
         if (!empty($aCacheCSS)) {
             $sCSSUrl = Phpfox::getLib('file.minimize')->minify($aCacheCSS, $sQmark . 'v=' . $iVersion, false);
             $sData .= "\n\t\t" . '<!-- Minified --> <link rel="stylesheet" type="text/css" href="' . $sCSSUrl . '" />' . "";
         }
         if (!empty($aCustomCssFile)) {
             foreach ($aCustomCssFile as $sCustomCssFile) {
                 $sData .= "\n\t\t" . '<!-- Custom --> <link rel="stylesheet" type="text/css" href="' . $sCustomCssFile . '" />' . "";
             }
         }
     } else {
         $aSubCacheCheck = array();
         foreach ($aCacheCSS as $sFile) {
             if (defined('PHPFOX_INSTALLER')) {
                 $sData .= "\t\t" . '<link rel="stylesheet" type="text/css" href="' . $sFile . $sQmark . 'v=' . $iVersion . '" />' . "\n";
             } else {
                 if (isset($aSubCacheCheck[$sFile])) {
                     continue;
                 }
                 $aSubCacheCheck[$sFile] = true;
                 $sData .= "\t\t" . '<link rel="stylesheet" type="text/css" href="' . Phpfox::getParam('core.path') . $sFile . $sQmark . 'v=' . $iVersion . '" />' . "\n";
             }
         }
         if (!empty($aCustomCssFile)) {
             foreach ($aCustomCssFile as $sCustomCssFile) {
                 $sData .= "\n\t\t" . '<!-- Custom --> <link rel="stylesheet" type="text/css" href="' . $sCustomCssFile . '" />' . "";
             }
         }
         if (Phpfox::getParam('core.defer_loading_js')) {
         } else {
             foreach ($aCacheJs as $sFile) {
                 if (defined('PHPFOX_INSTALLER')) {
                     $this->_sFooter .= "\t\t" . '<script type="text/javascript" src="../' . $sFile . $sQmark . 'v=' . $iVersion . '"></script>' . "\n";
                 } else {
                     $this->_sFooter .= "\t\t" . '<script type="text/javascript" src="' . Phpfox::getParam('core.path') . $sFile . $sQmark . 'v=' . $iVersion . '"></script>' . "\n";
                 }
             }
         }
         if (!defined('PHPFOX_INSTALLER')) {
             $this->_sFooter .= "\t\t" . '<script type="text/javascript"> $Core.init(); </script>' . "\n";
         }
     }
     if (defined('PHPFOX_TEMPLATE_CSS_FILE')) {
         //$this->setHeader(PHPFOX_TEMPLATE_CSS_FILE);
         $sData .= PHPFOX_TEMPLATE_CSS_FILE;
     }
     // And in its own file custom.css maybe check if its not empty like when using the default theme
     /*
             $sCustomFile = 'theme/' . (Phpfox::isAdminPanel() ? 'adminpanel' : (Phpfox::isMobile() ? 'mobile' : 'frontend')) . '/' . $this->getThemeFolder() . '/style/' . $this->getStyleFolder() . '/css/custom.css';
             
             if (Phpfox::getParam('core.cache_js_css') && file_exists(PHPFOX_DIR . $sCustomFile) && filesize(PHPFOX_DIR . $sCustomFile) > 0)
             {
     	$sCustomUrl = Phpfox::getLib('file.minimize')->minify($sCustomFile, $sQmark . 'v=' . $iVersion, false);
     	$sData .= "\n\t\t" . '<!-- Custom --> <link rel="stylesheet" type="text/css" href="' . $sCustomUrl .'" />';
     }
     */
     if (count($this->_aPhrases)) {
         $sData .= "\n\t\t<script type=\"text/javascript\">\n\t\t";
         foreach ($this->_aPhrases as $sVar => $sPhrase) {
             $sPhrase = html_entity_decode($sPhrase, null, 'UTF-8');
             $sData .= "\t\t\toTranslations['{$sVar}'] = '" . str_replace("'", "\\'", $sPhrase) . "';\n";
         }
         $sData .= "\t\t</script>\n";
     }
     if ($bReturnArray) {
         $aArrayData[] = $sData;
         return $aArrayData;
     }
     // Convert meta data
     $bHasNoDescription = false;
     if (count($this->_aMeta) && !PHPFOX_IS_AJAX_PAGE && !defined('PHPFOX_INSTALLER')) {
         $oPhpfoxParseOutput = Phpfox::getLib('parse.output');
         $aFind = array('&lt;', '&gt;', '$');
         $aReplace = array('<', '>', '&36;');
         foreach ($this->_aMeta as $sMeta => $sMetaValue) {
             $sMetaValue = str_replace($aFind, $aReplace, $sMetaValue);
             $sMetaValue = strip_tags($sMetaValue);
             $sMetaValue = str_replace(array("\n", "\r"), "", $sMetaValue);
             $bIsCustomMeta = false;
             switch ($sMeta) {
                 case 'keywords':
                     $sKeywordSearch = Phpfox::getParam('core.words_remove_in_keywords');
                     if (!empty($sKeywordSearch)) {
                         $aKeywordsSearch = array_map('trim', explode(',', $sKeywordSearch));
                     }
                     $sMetaValue = $oPhpfoxParseOutput->shorten($oPhpfoxParseOutput->clean($sMetaValue), Phpfox::getParam('core.meta_keyword_limit'));
                     $sMetaValue = trim(rtrim(trim($sMetaValue), ','));
                     $aParts = explode(',', $sMetaValue);
                     $sMetaValue = '';
                     $aKeywordCache = array();
                     foreach ($aParts as $sPart) {
                         $sPart = trim($sPart);
                         if (isset($aKeywordCache[$sPart])) {
                             continue;
                         }
                         if (isset($aKeywordsSearch) && in_array(strtolower($sPart), array_map('strtolower', $aKeywordsSearch))) {
                             continue;
                         }
                         $sMetaValue .= $sPart . ', ';
                         $aKeywordCache[$sPart] = true;
                     }
                     $sMetaValue = rtrim(trim($sMetaValue), ',');
                     break;
                 case 'description':
                     $bHasNoDescription = true;
                     $sMetaValue = $oPhpfoxParseOutput->shorten($oPhpfoxParseOutput->clean($sMetaValue), Phpfox::getParam('core.meta_description_limit'));
                     break;
                 case 'robots':
                     $bIsCustomMeta = false;
                     break;
                 default:
                     $bIsCustomMeta = true;
                     break;
             }
             $sMetaValue = str_replace('"', '\\"', $sMetaValue);
             $sMetaValue = Phpfox::getLib('locale')->convert($sMetaValue);
             $sMetaValue = html_entity_decode($sMetaValue, null, 'UTF-8');
             $sMetaValue = str_replace(array('<', '>'), '', $sMetaValue);
             if ($bIsCustomMeta) {
                 if ($sMeta == 'og:description') {
                     $sMetaValue = $oPhpfoxParseOutput->shorten($oPhpfoxParseOutput->clean($sMetaValue), Phpfox::getParam('core.meta_description_limit'));
                 }
                 switch ($sMeta) {
                     case 'canonical':
                         $sCanonical = $sMetaValue;
                         $sCanonical = preg_replace('/\\/when\\_([a-zA-Z0-9\\-]+)\\//i', '/', $sCanonical);
                         $sCanonical = preg_replace('/\\/show\\_([a-zA-Z0-9\\-]+)\\//i', '/', $sCanonical);
                         $sCanonical = preg_replace('/\\/view\\_\\//i', '/', $sCanonical);
                         if (Phpfox::isMobile()) {
                             if (Phpfox::getParam('core.url_rewrite') == '1') {
                                 $sCanonical = str_replace(Phpfox::getParam('core.path') . 'mobile/', Phpfox::getParam('core.path'), $sMetaValue);
                             } elseif (Phpfox::getParam('core.url_rewrite') == '2') {
                                 $sCanonical = str_replace('?' . PHPFOX_GET_METHOD . '=/mobile/', '?' . PHPFOX_GET_METHOD . '=/', $sMetaValue);
                             }
                         }
                         $sData .= "\t\t<link rel=\"canonical\" href=\"{$sCanonical}\" />\n";
                         if (!Phpfox::isMobile()) {
                             $sMobileReplace = '';
                             if (Phpfox::getParam('core.url_rewrite') == '1') {
                                 $sMobileReplace = str_replace(Phpfox::getParam('core.path'), Phpfox::getParam('core.path') . 'mobile/', $sCanonical);
                             } elseif (Phpfox::getParam('core.url_rewrite') == '2') {
                                 $sMobileReplace = str_replace('?' . PHPFOX_GET_METHOD . '=/', '?' . PHPFOX_GET_METHOD . '=/mobile/', $sCanonical);
                             }
                             $sData .= "\t\t<link rel=\"alternate\" media=\"only screen and (max-width: 640px)\" href=\"{$sMobileReplace}\" />\n";
                         }
                         break;
                     default:
                         $sData .= "\t\t<meta property=\"{$sMeta}\" content=\"{$sMetaValue}\" />\n";
                         break;
                 }
             } else {
                 if (strpos($sData, 'meta name="' . $sMeta . '"') !== false) {
                     $sData = preg_replace("/<meta name=\"{$sMeta}\" content=\"(.*?)\" \\/>\n\t/i", "<meta" . ($sMeta == 'description' ? ' property="og:description" ' : '') . " name=\"{$sMeta}\" content=\"" . $sMetaValue . "\" />\n\t", $sData);
                 } else {
                     $sData = preg_replace('/<meta/', '<meta name="' . $sMeta . '" content="' . $sMetaValue . '" />' . "\n\t\t" . '<meta', $sData, 1);
                 }
             }
         }
         if (!$bHasNoDescription) {
             $sData .= "\t\t" . '<meta name="description" content="' . Phpfox::getLib('parse.output')->clean(Phpfox::getLib('locale')->convert(Phpfox::getParam('core.description'))) . '" />' . "\n";
         }
     }
     // Clear from memory
     $this->_aHeaders = array();
     $this->_aMeta = array();
     if (isset($bLoadCustomThemeOverwrite)) {
         $sData .= "\t\t" . '<link rel="stylesheet" type="text/css" href="' . Phpfox::getParam('core.rackspace_url') . 'file/static/' . $aCss['css_data_original'] . '" />' . "\n";
     }
     return $sData;
 }
<?php

/**
 * Created by Phpfox.Pro.
 * User: Quang Huy
 * Date: 4/14/13
 * Time: 5:20 PM
 */
if (Phpfox::isMobile() && !$bIsUpdate && Phpfox::getParam('photo.rename_uploaded_photo_names')) {
    Phpfox::getLib('database')->update(Phpfox::getT('photo'), array('title' => $aVals['title'] . '_id_' . $iId), 'photo_id = ' . $iId);
}
 public function add($aVals)
 {
     if (isset($aVals['copy_to_self']) && $aVals['copy_to_self'] == 1) {
         $aVals['to'][] = Phpfox::getUserId();
         unset($aVals['copy_to_self']);
         return $this->add($aVals);
     }
     if (empty($aVals['message'])) {
         return null;
     }
     $bIsThreadReply = false;
     if (!isset($aVals['to']) && !empty($aVals['thread_id']) && Phpfox::getParam('mail.threaded_mail_conversation') && !isset($aVals['claim_page'])) {
         $bIsThreadReply = true;
         $aPastThread = $this->database()->select('mt.*')->from(Phpfox::getT('mail_thread'), 'mt')->join(Phpfox::getT('mail_thread_user'), 'mtu', 'mtu.thread_id = mt.thread_id AND mtu.user_id = ' . Phpfox::getUserId())->where('mt.thread_id = ' . (int) $aVals['thread_id'])->execute('getSlaveRow');
         if (!isset($aPastThread['thread_id'])) {
             return Phpfox_Error::set(Phpfox::getPhrase('mail.unable_to_find_this_conversation'));
         }
         $aThreadUsers = $this->database()->select('*')->from(Phpfox::getT('mail_thread_user'))->where('thread_id = ' . (int) $aPastThread['thread_id'])->execute('getSlaveRows');
         $aOriginal = array();
         foreach ($aThreadUsers as $aThreadUser) {
             if ($aThreadUser['user_id'] == Phpfox::getUserId()) {
                 continue;
             }
             $aOriginal[] = $aThreadUser['user_id'];
         }
     }
     $iSentTo = 0;
     if (isset($aVals['to']) && is_array($aVals['to']) && !Phpfox::getParam('mail.threaded_mail_conversation')) {
         $aCache = array();
         foreach ($aVals['to'] as $mTo) {
             if ($mTo != Phpfox::getUserId()) {
                 ++$iSentTo;
             }
             if (Phpfox::getUserParam('mail.send_message_to_max_users_each_time') > 0 && $iSentTo > Phpfox::getUserParam('mail.send_message_to_max_users_each_time')) {
                 return Phpfox_Error::set(Phpfox::getPhrase('mail.too_many_users_this_message_was_sent_to_the_first_total_users', array('total' => Phpfox::getUserParam('mail.send_message_to_max_users_each_time'))));
             }
             if (strstr($mTo, ',')) {
                 $aParts = explode(',', $mTo);
                 foreach ($aParts as $mUser) {
                     $aVals['to'] = trim($mUser);
                     if (empty($aVals['to'])) {
                         continue;
                     }
                     // Make sure we found a user
                     if (($iTemp = $this->add($aVals, true)) && is_numeric($iTemp)) {
                         $aCache[] = $iTemp;
                     }
                 }
             } else {
                 $aVals['to'] = $mTo;
                 if (empty($aVals['to'])) {
                     continue;
                 }
                 // Make sure we found a user
                 if (($iTemp = $this->add($aVals, true)) && is_numeric($iTemp)) {
                     $aCache[] = $iTemp;
                 }
             }
         }
         if (Phpfox::getUserParam('mail.can_add_attachment_on_mail') && !empty($aVals['attachment']) && count($aCache)) {
             $aLastCache = array_reverse($aCache);
             foreach ($aCache as $iMailId) {
                 $this->database()->update($this->_sTable, array('mass_id' => $aLastCache[0]), 'mail_id = ' . (int) $iMailId);
             }
         }
         if (empty($aCache)) {
             return false;
         }
         return $aCache;
     }
     if (!$bIsThreadReply && Phpfox::getParam('mail.threaded_mail_conversation')) {
         $aOriginal = $aVals['to'];
         $aVals['to'] = $aVals['to'][0];
     }
     if (!$bIsThreadReply) {
         $aDetails = Phpfox::getService('user')->getUser($aVals['to'], Phpfox::getUserField() . ', u.email, u.language_id, u.user_group_id', is_numeric($aVals['to']) ? false : true);
         if (!isset($aDetails['user_id'])) {
             return false;
         }
         if (!isset($aVals['claim_page']) && !Phpfox::getService('user.privacy')->hasAccess($aDetails['user_id'], 'mail.send_message')) {
             return Phpfox_Error::set(Phpfox::getPhrase('mail.unable_to_send_a_private_message_to_full_name_as_they_have_disabled_this_option_for_the_moment', array('full_name' => $aDetails['full_name'])));
         }
         // Check if user is allowed to receive messages: http://forums.phpfox.com/project.php?issueid=2216
         if (Phpfox::getService('user.group.setting')->getGroupParam($aDetails['user_group_id'], 'mail.override_mail_box_limit') == false) {
             if (!Phpfox::getParam('mail.threaded_mail_conversation')) {
                 $iMailBoxLimit = Phpfox::getService('user.group.setting')->getGroupParam($aDetails['user_group_id'], 'mail.mail_box_limit');
                 $iCurrentMessages = $this->database()->select('COUNT(viewer_user_id)')->from($this->_sTable)->where('viewer_user_id = ' . (int) $aVals['to'] . ' AND viewer_type_id != 3 AND viewer_type_id != 1')->execute('getSlaveField');
                 if ($iCurrentMessages >= $iMailBoxLimit) {
                     return Phpfox_Error::set(Phpfox::getPhrase('mail.user_has_reached_their_inbox_limit'));
                 }
             }
         }
         if ($aVals['to'] == Phpfox::getUserId() && !Phpfox::getUserParam('mail.can_message_self')) {
             return Phpfox_Error::set(Phpfox::getPhrase('mail.you_cannot_message_yourself'));
         }
         // check if user can send message to non friends: http://forums.phpfox.com/project.php?issueid=2216
         if (Phpfox::getUserParam('mail.restrict_message_to_friends') && !Phpfox::getService('user.group.setting')->getGroupParam($aDetails['user_group_id'], 'mail.override_restrict_message_to_friends')) {
             ($sPlugin = Phpfox_Plugin::get('mail.service_process_add_1')) ? eval($sPlugin) : false;
             if (isset($sPluginError)) {
                 return false;
             }
             if (!Friend_Service_Friend::instance()->isFriend(Phpfox::getUserId(), $aVals['to'])) {
                 return Phpfox_Error::set(Phpfox::getPhrase('mail.you_can_only_message_your_friends'));
             }
         }
         $aVals = array_merge($aVals, $aDetails);
     }
     $oFilter = Phpfox::getLib('parse.input');
     $oParseOutput = Phpfox::getLib('parse.output');
     $bHasAttachments = Phpfox::getUserParam('mail.can_add_attachment_on_mail') && !empty($aVals['attachment']);
     if (isset($aVals['parent_id'])) {
         $aMail = $this->database()->select('m.mail_id, m.owner_user_id, m.subject, u.email, u.language_id')->from($this->_sTable, 'm')->join(Phpfox::getT('user'), 'u', 'u.user_id = m.owner_user_id')->where('m.mail_id = ' . (int) $aVals['parent_id'] . ' AND viewer_user_id = ' . Phpfox::getUserId())->execute('getSlaveRow');
         if (!isset($aMail['mail_id'])) {
             return Phpfox_Error::set(Phpfox::getPhrase('mail.not_a_valid_message'));
         }
         $aVals['user_id'] = $aMail['owner_user_id'];
         $aVals['subject'] = $aMail['subject'];
         $aVals['email'] = $aMail['email'];
         $aVals['language_id'] = $aMail['language_id'];
     }
     Phpfox::getService('ban')->checkAutomaticBan((isset($aVals['subject']) ? $aVals['subject'] : '') . ' ' . $aVals['message']);
     $aVals['subject'] = isset($aVals['subject']) ? $oFilter->clean($aVals['subject'], 255) : null;
     if (Phpfox::getParam('mail.threaded_mail_conversation')) {
         $aUserInsert = array_merge(array(Phpfox::getUserId()), $aOriginal);
         sort($aUserInsert, SORT_NUMERIC);
         if (!$bIsThreadReply) {
             $sHashId = md5(implode('', $aUserInsert));
             $aPastThread = $this->database()->select('*')->from(Phpfox::getT('mail_thread'))->where('hash_id = \'' . $this->database()->escape($sHashId) . '\'')->execute('getSlaveRow');
         }
         $aThreadUsers = $this->database()->select(Phpfox::getUserField() . ', u.email, u.language_id, u.user_group_id')->from(Phpfox::getT('mail_thread_user'), 'mtu')->join(Phpfox::getT('user'), 'u', 'u.user_id = mtu.user_id')->where('mtu.user_id IN(' . implode(', ', $aUserInsert) . ')')->group('u.user_id')->execute('getSlaveRows');
         foreach ($aThreadUsers as $aThreadUser) {
             if ($aThreadUser['user_id'] != Phpfox::getUserId() && !Phpfox::getService('user.privacy')->hasAccess($aThreadUser['user_id'], 'mail.send_message')) {
                 return Phpfox_Error::set(Phpfox::getPhrase('mail.unable_to_send_a_private_message_to_full_name_as_they_have_disabled_this_option_for_the_moment', array('full_name' => $aThreadUser['full_name'])));
             }
         }
         if (isset($aPastThread['thread_id'])) {
             $iId = $aPastThread['thread_id'];
             $this->database()->update(Phpfox::getT('mail_thread'), array('time_stamp' => PHPFOX_TIME), 'thread_id = ' . (int) $iId);
             $this->database()->update(Phpfox::getT('mail_thread_user'), array('is_sent_update' => '0', 'is_read' => '0', 'is_archive' => '0'), 'thread_id = ' . (int) $iId);
             $this->database()->update(Phpfox::getT('mail_thread_user'), array('is_read' => '1'), 'thread_id = ' . (int) $iId . ' AND user_id = ' . Phpfox::getUserId());
         } else {
             $iId = $this->database()->insert(Phpfox::getT('mail_thread'), array('hash_id' => $sHashId, 'time_stamp' => PHPFOX_TIME));
             foreach ($aUserInsert as $iUserId) {
                 $this->database()->insert(Phpfox::getT('mail_thread_user'), array('thread_id' => $iId, 'is_read' => $iUserId == Phpfox::getUserId() ? '1' : '0', 'is_sent' => $iUserId == Phpfox::getUserId() ? '1' : '0', 'is_sent_update' => $iUserId == Phpfox::getUserId() ? '1' : '0', 'user_id' => (int) $iUserId));
             }
         }
         $iTextId = $this->database()->insert(Phpfox::getT('mail_thread_text'), array('thread_id' => $iId, 'time_stamp' => PHPFOX_TIME, 'user_id' => Phpfox::getUserId(), 'text' => $oFilter->prepare($aVals['message']), 'is_mobile' => Phpfox::isMobile() ? '1' : '0'));
         $this->database()->update(Phpfox::getT('mail_thread'), array('last_id' => (int) $iTextId), 'thread_id = ' . (int) $iId);
         // Send the user an email
         $sLink = Phpfox_Url::instance()->makeUrl('mail.thread', array('id' => $iId));
         foreach ($aThreadUsers as $aThreadUser) {
             if ($aThreadUser['user_id'] == Phpfox::getUserId()) {
                 continue;
             }
             ($sPlugin = Phpfox_Plugin::get('mail.service_process_add_2')) ? eval($sPlugin) : false;
             if (isset($bPluginSkip) && $bPluginSkip === true) {
                 continue;
             }
             Phpfox::getLib('mail')->to($aThreadUser['user_id'])->subject(array('mail.full_name_sent_you_a_message_on_site_title', array('full_name' => Phpfox::getUserBy('full_name'), 'site_title' => Phpfox::getParam('core.site_title')), false, null, $aThreadUser['language_id']))->message(array('mail.full_name_sent_you_a_message_no_subject', array('full_name' => Phpfox::getUserBy('full_name'), 'message' => $oFilter->clean(strip_tags(Phpfox::getLib('parse.bbcode')->cleanCode(str_replace(array('&lt;', '&gt;'), array('<', '>'), $aVals['message'])))), 'link' => $sLink)))->notification('mail.new_message')->send();
         }
         // If we uploaded any attachments make sure we update the 'item_id'
         if ($bHasAttachments) {
             Phpfox::getService('attachment.process')->updateItemId($aVals['attachment'], Phpfox::getUserId(), $iTextId);
             $this->database()->update(Phpfox::getT('mail_thread_text'), array('total_attachment' => Phpfox::getService('attachment')->getCountForItem($iTextId, 'mail')), 'message_id = ' . (int) $iTextId);
         }
         if (isset($aVals['forward_thread_id']) && !empty($aVals['forwards'])) {
             $bHasForward = false;
             $aForwards = explode(',', $aVals['forwards']);
             foreach ($aForwards as $iForward) {
                 $iForward = (int) trim($iForward);
                 if (empty($iForward)) {
                     continue;
                 }
                 $bHasForward = true;
                 $this->database()->insert(Phpfox::getT('mail_thread_forward'), array('message_id' => $iTextId, 'copy_id' => $iForward));
             }
             if ($bHasForward) {
                 $this->database()->update(Phpfox::getT('mail_thread_text'), array('has_forward' => '1'), 'message_id = ' . (int) $iTextId);
             }
         }
     } else {
         $aInsert = array('parent_id' => isset($aVals['parent_id']) ? $aVals['parent_id'] : 0, 'subject' => $aVals['subject'], 'preview' => $oFilter->clean(strip_tags(Phpfox::getLib('parse.bbcode')->cleanCode(str_replace(array('&lt;', '&gt;'), array('<', '>'), $aVals['message']))), 255), 'owner_user_id' => Phpfox::getUserId(), 'viewer_user_id' => $aVals['user_id'], 'viewer_is_new' => 1, 'time_stamp' => PHPFOX_TIME, 'time_updated' => PHPFOX_TIME, 'total_attachment' => $bHasAttachments ? Phpfox::getService('attachment')->getCount($aVals['attachment']) : 0);
         $iId = $this->database()->insert($this->_sTable, $aInsert);
         $this->database()->insert(Phpfox::getT('mail_text'), array('mail_id' => $iId, 'text' => $oFilter->clean($aVals['message']), 'text_parsed' => $oFilter->prepare($aVals['message'])));
         // Send the user an email
         $sLink = Phpfox_Url::instance()->makeUrl('mail.view', array('id' => $iId));
         Phpfox::getLib('mail')->to($aVals['user_id'])->subject(array('mail.full_name_sent_you_a_message_on_site_title', array('full_name' => Phpfox::getUserBy('full_name'), 'site_title' => Phpfox::getParam('core.site_title')), false, null, $aVals['language_id']))->message(array('mail.full_name_sent_you_a_message_subject_subject', array('full_name' => Phpfox::getUserBy('full_name'), 'subject' => $aVals['subject'], 'message' => $oFilter->clean(strip_tags(Phpfox::getLib('parse.bbcode')->cleanCode(str_replace(array('&lt;', '&gt;'), array('<', '>'), $aVals['message'])))), 'link' => $sLink)))->notification('mail.new_message')->send();
         // If we uploaded any attachments make sure we update the 'item_id'
         if ($bHasAttachments) {
             Phpfox::getService('attachment.process')->updateItemId($aVals['attachment'], Phpfox::getUserId(), $iId);
         }
     }
     ($sPlugin = Phpfox_Plugin::get('mail.service_process_add')) ? eval($sPlugin) : false;
     if (\Core\Route\Controller::$isApi) {
         return $iTextId;
     }
     return $iId;
 }
Beispiel #26
0
 /**
  * Get a setting and its value.
  *
  * @param mixed $mVar STRING name of the setting or ARRAY name of the setting.
  * @param string $sDef Default value in case the setting cannot be found.
  * @return nixed Returns the value of the setting, which can be a STRING, ARRAY, BOOL or INT.
  */
 public function getParam($mVar, $sDef = '')
 {
     if ($mVar == 'core.branding' && Phpfox::isPackage(array('premium', 'ultimate'))) {
         return true;
     }
     if ($mVar == 'im.enable_im_in_footer_bar' && Phpfox::isMobile()) {
         return false;
     }
     // http://www.phpfox.com/tracker/view/15079/
     /*if ($mVar == 'core.wysiwyg' && !defined('PHPFOX_INSTALLER') && Phpfox::isMobile())
     		{
     			return 'default';
     		}*/
     if ($mVar == 'core.phpfox_is_hosted') {
         return $this->getParam('core.is_auto_hosted');
     }
     if (defined('PHPFOX_IS_HOSTED_SCRIPT')) {
         /*
         if ($mVar == 'core.url_static_script')
         {
         	return Phpfox::getCdnPath() . 'static/jscript/';
         }
         */
         if ($mVar == 'core.setting_session_prefix') {
             return PHPFOX_IS_HOSTED_SCRIPT;
         } elseif ($mVar == 'video.allow_video_uploading') {
             return true;
         }
         /*
         elseif ($mVar == 'core.cache_js_css')
         {
         	return true;			
         }
         */
     }
     if (defined('PHPFOX_INSTALLER') && $mVar == 'core.cache_js_css') {
         return false;
     }
     if (is_array($mVar)) {
         $sParam = isset($this->_aParams[$mVar[0]][$mVar[1]]) ? $this->_aParams[$mVar[0]][$mVar[1]] : (isset($this->_aDefaults[$mVar[0]][$mVar[1]]) ? $this->_aDefaults[$mVar[0]][$mVar[1]] : Phpfox_Error::trigger('Missing Param: ' . $mVar[0] . '][' . $mVar[1]));
     } else {
         $sParam = isset($this->_aParams[$mVar]) ? $this->_aParams[$mVar] : (isset($this->_aDefaults[$mVar]) ? $this->_aDefaults[$mVar] : Phpfox_Error::trigger('Missing Param: ' . $mVar));
         if (!defined('PHPFOX_INSTALLER') && ($mVar == 'core.footer_bar_site_name' || $mVar == 'core.site_copyright')) {
             $sParam = Phpfox_Locale::instance()->convert($sParam);
         }
         if ($mVar == 'admincp.admin_cp') {
             $sParam = strtolower($sParam);
         }
         if ($mVar == 'user.points_conversion_rate') {
             $sParam = empty($sParam) ? array() : json_decode($sParam, true);
         }
     }
     if ($mVar == 'core.wysiwyg' && !defined('PHPFOX_INSTALLER') && $sParam == 'tiny_mce' && !Phpfox::isModule('tinymce')) {
         return 'default';
     }
     return $sParam;
 }
Beispiel #27
0
 public function _hashSearch()
 {
     if (Phpfox_Request::instance()->get('req1') != 'hashtag' && Phpfox_Request::instance()->get('hashtagsearch') == '') {
         return;
     }
     $sRequest = isset($_GET[PHPFOX_GET_METHOD]) ? $_GET[PHPFOX_GET_METHOD] : '';
     $sReq2 = '';
     if (!empty($sRequest)) {
         $aParts = explode('/', trim($sRequest, '/'));
         $iCnt = 0;
         // http://www.phpfox.com/tracker/view/15000/
         // We have to count the "mobile" part as a req1
         // add one to the count
         $iCntTotal = Phpfox::isMobile() ? 3 : 2;
         foreach ($aParts as $sPart) {
             $iCnt++;
             if ($iCnt === $iCntTotal) {
                 $sReq2 = $sPart;
                 break;
             }
         }
     }
     $sTag = Phpfox_Request::instance()->get('hashtagsearch') ? Phpfox_Request::instance()->get('hashtagsearch') : $sReq2;
     $sTag = \Phpfox_Parse_Output::instance()->parse($sTag);
     //https://github.com/moxi9/phpfox/issues/595
     $sTag = urldecode($sTag);
     if (empty($sTag)) {
         return;
     }
     $sTag = Phpfox::getLib('parse.input')->clean($sTag, 255);
     $sTag = mb_convert_case($sTag, MB_CASE_LOWER, "UTF-8");
     $this->database()->join(Phpfox::getT('tag'), 'hashtag', 'hashtag.item_id = feed.item_id AND hashtag.category_id = feed.type_id AND (tag_text = \'' . Phpfox_Database::instance()->escape($sTag) . '\' OR tag_url = \'' . Phpfox_Database::instance()->escape($sTag) . '\')');
 }
Beispiel #28
0
 public function getActivityFeed($aItem)
 {
     if (Phpfox::isModule('like')) {
         $this->database()->select('l.like_id AS is_liked, ')->leftJoin(Phpfox::getT('like'), 'l', 'l.type_id = \'link\' AND l.item_id = link.link_id AND l.user_id = ' . Phpfox::getUserId());
     }
     $aRow = $this->database()->select('link.*, p.app_id, a.image_path AS app_image_path, ' . Phpfox::getUserField('u', 'parent_'))->from($this->_sTable, 'link')->leftJoin(Phpfox::getT('user'), 'u', 'u.user_id = link.parent_user_id')->leftJoin(Phpfox::getT('pages'), 'p', 'p.page_id = u.profile_page_id')->leftJoin(Phpfox::getT('app'), 'a', 'a.app_id = p.app_id')->where('link.link_id = ' . (int) $aItem['item_id'])->execute('getSlaveRow');
     if (!isset($aRow['link_id'])) {
         return false;
     }
     if (defined('PHPFOX_IS_PAGES_VIEW') && !Phpfox::getService('pages')->hasPerm(null, 'link.view_browse_links') || !defined('PHPFOX_IS_PAGES_VIEW') && $aRow['module_id'] == 'pages' && !Phpfox::getService('pages')->hasPerm($aRow['item_id'], 'link.view_browse_links')) {
         return false;
     }
     if (empty($aRow['link'])) {
         return false;
     }
     // http://www.phpfox.com/tracker/view/14749/
     if (preg_match('/' . Phpfox::getParam('core.host') . '/i', $aRow['link'])) {
         if (Phpfox::isModule('mobile')) {
             // If link is to full site, but user is visiting/using the mobile site.
             if (!preg_match('/mobile/i', $aRow['link']) && Phpfox::isMobile()) {
                 // Build the site URL
                 $sSiteUrl = Phpfox::getParam('core.host') . Phpfox::getParam('core.folder');
                 // add the mobile to the link
                 $aRow['link'] = str_replace($sSiteUrl, $sSiteUrl . 'mobile/', $aRow['link']);
             } elseif (preg_match('/mobile/i', $aRow['link']) && !Phpfox::isMobile()) {
                 // remove mobile from the link
                 $aRow['link'] = str_replace('mobile/', '', $aRow['link']);
             }
         }
     }
     if (substr($aRow['link'], 0, 7) != 'http://' && substr($aRow['link'], 0, 8) != 'https://') {
         $aRow['link'] = 'http://' . $aRow['link'];
     }
     $aParts = parse_url($aRow['link']);
     $sLink = Phpfox::getLib('url')->makeUrl($aRow['parent_user_name']);
     $aReturn = array('feed_title' => $aRow['title'], 'feed_status' => $aRow['status_info'], 'feed_link_comment' => Phpfox::getLib('url')->makeUrl($aItem['user_name'], array('link-id' => $aRow['link_id'])), 'feed_link' => Phpfox::getLib('url')->makeUrl($aItem['user_name'], array('link-id' => $aRow['link_id'])), 'feed_link_actual' => $aRow['link'], 'feed_content' => $aRow['description'], 'total_comment' => $aRow['total_comment'], 'feed_total_like' => $aRow['total_like'], 'feed_is_liked' => isset($aRow['is_liked']) ? $aRow['is_liked'] : false, 'feed_icon' => Phpfox::getLib('image.helper')->display(array('theme' => 'feed/link.png', 'return_url' => true)), 'time_stamp' => $aRow['time_stamp'], 'enable_like' => true, 'comment_type_id' => 'link', 'like_type_id' => 'link', 'feed_title_extra' => $aParts['host'], 'feed_title_extra_link' => $aParts['scheme'] . '://' . $aParts['host'], 'is_custom_app' => $aRow['app_id'], 'app_image_path' => $aRow['app_image_path'], 'custom_data_cache' => $aRow);
     if (Phpfox::getParam('core.warn_on_external_links')) {
         if (!preg_match('/' . preg_quote(Phpfox::getParam('core.host')) . '/i', $aRow['link'])) {
             $aReturn['feed_link_actual'] = Phpfox::getLib('url')->makeUrl('core.redirect', array('url' => Phpfox::getLib('url')->encode($aRow['link'])));
             $aReturn['feed_title_extra_link'] = Phpfox::getLib('url')->makeUrl('core.redirect', array('url' => Phpfox::getLib('url')->encode($aReturn['feed_title_extra_link'])));
         }
     }
     if (!empty($aRow['image'])) {
         $aReturn['feed_image'] = '<img src="' . $aRow['image'] . '" alt="" style="max-width:120px; max-height:90px;" />';
     }
     if ($aRow['module_id'] == 'pages' || $aRow['module_id'] == 'event') {
         $aReturn['parent_user_id'] = 0;
         $aReturn['parent_user_name'] = '';
     }
     if (empty($aRow['module_id']) && !empty($aRow['parent_user_name']) && !defined('PHPFOX_IS_USER_PROFILE') && empty($_POST)) {
         $aReturn['parent_user'] = Phpfox::getService('user')->getUserFields(true, $aRow, 'parent_');
     }
     if (!PHPFOX_IS_AJAX && defined('PHPFOX_IS_USER_PROFILE') && !empty($aRow['parent_user_name']) && $aRow['parent_user_id'] != Phpfox::getService('profile')->getProfileUserId()) {
         $aReturn['feed_mini'] = true;
         $aReturn['no_share'] = true;
         $aReturn['feed_mini_content'] = Phpfox::getPhrase('friend.full_name_posted_a_href_link_a_link_a_on_a_href_parent_user_name', array('full_name' => Phpfox::getService('user')->getFirstName($aItem['full_name']), 'link' => $sLink, 'parent_user_name' => Phpfox::getLib('url')->makeUrl($aRow['parent_user_name']), 'parent_full_name' => $aRow['parent_full_name']));
         unset($aReturn['feed_status'], $aReturn['feed_image'], $aReturn['feed_title'], $aReturn['feed_content']);
     } else {
         if ($aRow['has_embed']) {
             $aReturn['feed_image_onclick'] = '$Core.box(\'link.play\', 700, \'id=' . $aRow['link_id'] . '&amp;feed_id=' . $aItem['feed_id'] . '&amp;popup=true\', \'GET\'); return false;';
         }
     }
     ($sPlugin = Phpfox_Plugin::get('link.component_service_callback_getactivityfeed__1')) ? eval($sPlugin) : false;
     return $aReturn;
 }
Beispiel #29
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)));
    }
 public function checkFeedShareLink()
 {
     if (Phpfox::isMobile()) {
         //return false;
     }
     if (defined('PHPFOX_IS_PAGES_VIEW') && !Phpfox::getService('pages')->hasPerm(null, 'photo.share_photos')) {
         return false;
     }
     if (!Phpfox::getUserParam('photo.can_upload_photos')) {
         return false;
     }
     if (defined('PHPFOX_IS_USER_PROFILE') || Phpfox_Request::instance()->get('req1') == 'feed') {
     } else {
         if (Phpfox::isMobile()) {
             return false;
         }
     }
 }