Exemple #1
0
 public function compose()
 {
     Phpfox::isUser(true);
     $aUser = Phpfox::getService('user')->get($this->get('user_id'), true);
     $this->setTitle(Phpfox::getPhrase('interact.interact_with_user', array('fname' => $aUser['full_name'])));
     if (!Phpfox::getService('user.privacy')->hasAccess($aUser['user_id'], 'interact.can_interact')) {
         echo Phpfox::getPhrase('interact.unable_privacy');
         return false;
     }
     if (Phpfox::getParam('interact.interact_friends_only')) {
         if (!Phpfox::getService('friend')->isFriend($aUser['user_id'], Phpfox::getUserId())) {
             echo Phpfox::getPhrase('interact.unable_friend');
             return false;
         }
     }
     if (Phpfox::getUserParam('interact.enable_interactions')) {
         $iAllowed = Phpfox::getUserParam('interact.send_per_hour');
         if ($iAllowed != 0) {
             $iHourSent = Phpfox::getLib('database')->select('COUNT(id)')->from(Phpfox::getT('interactions_main'))->where('is_reply = 0 AND sender_id = ' . Phpfox::getUserId() . ' AND time >= ' . (time() - 3600))->execute('getSlaveField');
             if (!Phpfox::isAdmin() && $iHourSent >= $iAllowed && $this->get('reply') == 0) {
                 echo Phpfox::getPhrase('interact.flood_control', array('allowed' => $iAllowed));
                 return false;
             }
         }
         $iItemId = 0;
         if ($this->get('item_id')) {
             $iItemId = $this->get('item_id');
         }
         Phpfox::getBlock('interact.compose', array('int_id' => $this->get('int_id'), 'user_id' => $this->get('user_id'), 'item_id' => $iItemId, 'is_reply' => $this->get('reply') ? $this->get('reply') : 0));
         echo '<script type="text/javascript">$Core.loadInit();</script>';
     } else {
         echo Phpfox::getPhrase('interact.no_permission');
         return false;
     }
 }
Exemple #2
0
 public function update()
 {
     ($sPlugin = Phpfox_Plugin::get('ad.component_ajax_update__start')) ? eval($sPlugin) : false;
     Phpfox::getBlock('ad.display', array('block_id' => $this->get('block_id')));
     $this->html('#js_ad_space_' . $this->get('block_id'), $this->getContent(false));
     ($sPlugin = Phpfox_Plugin::get('ad.component_ajax_update__end')) ? eval($sPlugin) : false;
 }
 static function getBlock($sModule, $aParams = array())
 {
     ob_start();
     Phpfox::getBlock($sModule, $aParams);
     $sHtml = ob_get_contents();
     ob_end_clean();
     return $sHtml;
 }
Exemple #4
0
	public function attach()
	{
		Phpfox::isUser(true);
		
		$this->setTitle(Phpfox::getPhrase('link.attach_a_link'));
		
		Phpfox::getBlock('link.attach');		
	}
Exemple #5
0
 public function changeLanguage()
 {
     ($sPlugin = Phpfox_Plugin::get('announcement.component_ajax_changelanguage__start')) ? eval($sPlugin) : false;
     $sLanguage = $this->get('sLanguage');
     $aAnnouncements = Phpfox::getService('announcement')->getAnnouncementsByLanguage($sLanguage);
     Phpfox::getBlock('announcement.manage', array('aAnnouncements' => $aAnnouncements));
     $this->call('$("#js_announcements").hide("slow", function(){$(this).html("' . $this->getContent() . '");});');
     ($sPlugin = Phpfox_Plugin::get('announcement.component_ajax_changelanguage__end')) ? eval($sPlugin) : false;
 }
Exemple #6
0
 private function _loadBlocks($location)
 {
     echo '<div class="_block" data-location="' . $location . '">';
     $blocks = \Phpfox_Module::instance()->getModuleBlocks($location);
     foreach ($blocks as $block) {
         \Phpfox::getBlock($block);
     }
     echo '</div>';
 }
Exemple #7
0
 public function browse()
 {
     $this->error(false);
     Phpfox::getBlock('like.browse');
     $sTitle = $this->get('type_id') == 'pages' && $this->get('force_like') == '' ? Phpfox::getPhrase('like.members') : Phpfox::getPhrase('like.people_who_like_this');
     if ($this->get('dislike') == 1) {
         $sTitle = Phpfox::getPhrase('like.people_who_disliked_this');
     }
     $this->setTitle($sTitle);
 }
Exemple #8
0
    public function __construct()
    {
        $Template = \Phpfox_Template::instance();
        $this->_loader = new View\Loader();
        $dir = $Template->theme()->get()->getPath() . 'html';
        if (is_dir($dir)) {
            $this->_loader->addPath($dir, 'Theme');
        }
        $this->_loader->addPath(PHPFOX_DIR . 'theme/default/html', 'Theme');
        $this->_loader->addPath(PHPFOX_DIR . 'views', 'Base');
        $this->_env = new View\Environment($this->_loader, array('cache' => defined('PHPFOX_IS_TECHIE') && PHPFOX_IS_TECHIE || defined('PHPFOX_NO_TEMPLATE_CACHE') ? false : PHPFOX_DIR_FILE . 'cache/twig/', 'autoescape' => false));
        $this->_env->setBaseTemplateClass('Core\\View\\Base');
        $this->_env->addFunction(new \Twig_SimpleFunction('url', function ($url, $params = []) {
            return \Phpfox_Url::instance()->makeUrl($url, $params);
        }));
        $this->_env->addFunction(new \Twig_SimpleFunction('setting', function () {
            return call_user_func_array('setting', func_get_args());
        }));
        $this->_env->addFunction(new \Twig_SimpleFunction('user', function () {
            return call_user_func_array('user', func_get_args());
        }));
        $this->_env->addFunction(new \Twig_SimpleFunction('phrase', function () {
            return call_user_func_array('phrase', func_get_args());
        }));
        $this->_env->addFunction(new \Twig_SimpleFunction('comments', function () {
            \Phpfox::getBlock('feed.comment');
            return '';
        }));
        $this->_env->addFunction(new \Twig_SimpleFunction('payment', function ($params) {
            $params = new \Core\Object($params);
            \Phpfox::getBlock('api.gateway.form', ['gateway_data' => ['item_number' => '@App/' . $params->callback . '|' . $params->id, 'currency_code' => 'USD', 'amount' => $params->amount, 'item_name' => $params->name, 'return' => $params->return, 'recurring' => '', 'recurring_cost' => '', 'alternative_cost' => '', 'alternative_recurring_cost' => '']]);
            return '';
        }));
        $this->_env->addFunction(new \Twig_SimpleFunction('pager', function () {
            $u = \Phpfox_Url::instance();
            if (!isset($_GET['page'])) {
                $_GET['page'] = 1;
            }
            $_GET['page']++;
            $u->setParam('page', $_GET['page']);
            $url = $u->current();
            $html = '
				<div class="js_pager_view_more_link">
					<a href="' . $url . '" class="next_page">
						<i class="fa fa-spin fa-circle-o-notch"></i>
						<span>View More</span>
					</a>
				</div>
			';
            return $html;
        }));
        $this->_env->addFunction(new \Twig_SimpleFunction('_p', function () {
            return call_user_func_array('_p', func_get_args());
        }));
    }
Exemple #9
0
	public function getAll()
	{
		if (!Phpfox::isUser())
		{
			$this->call('<script type="text/javascript">window.location.href = \'' . Phpfox::getLib('url')->makeUrl('user.login') . '\';</script>');
		}
		else
		{
			Phpfox::getBlock('notification.link');	
		}
	}
Exemple #10
0
 public function browse()
 {
     $this->error(false);
     Phpfox::getBlock('like.browse');
     $sTitle = $this->get('type_id') == 'pages' && $this->get('force_like') == '' ? Phpfox::getPhrase('like.members') : 'Followers';
     if ($this->get('dislike') == 1) {
         $sTitle = Phpfox::getPhrase('like.people_who_disliked_this');
     }
     $this->setTitle($sTitle);
     $this->call('<script>$Core.loadInit();</script>');
 }
Exemple #11
0
 public function inlineUpdate()
 {
     if (($iUserId = Tag_Service_Tag::instance()->hasAccess($this->get('sType'), $this->get('item_id'), 'edit_own_tags', 'edit_user_tags')) && Phpfox::getService('tag.process')->update($this->get('sType'), $this->get('item_id'), $iUserId, Phpfox::getLib('parse.format')->isEmpty($this->get('quick_edit_input')) ? null : $this->get('quick_edit_input'))) {
         if (Phpfox::getLib('parse.format')->isEmpty($this->get('quick_edit_input'))) {
             $this->call('$(\'#' . $this->get('id') . '\').parent().remove();');
         } else {
             $aTags = Tag_Service_Tag::instance()->getTagsById($this->get('sType'), $this->get('item_id'));
             Phpfox::getBlock('tag.item', array('bDontCleanTags' => true, 'sType' => $this->get('sType'), 'sTags' => $aTags[$this->get('item_id')], 'iItemId' => $this->get('item_id'), 'iUserId' => $iUserId, 'bIsInline' => true));
             $this->html('#' . $this->get('id'), Phpfox::getLib('parse.output')->clean($this->getContent(false), false), '.highlightFade()');
             $this->html('#' . $this->get('content'), Phpfox::getLib('parse.output')->parse(Phpfox::getLib('parse.input')->clean($this->get('quick_edit_input'))));
         }
     }
 }
 public function edit_status()
 {
     Phpfox::isUser(true);
     $iUserId = phpfox::getUserId();
     $iFeedId = $this->get('feed_id');
     $iItemId = $this->get('id');
     $aUserStatus = phpfox::getService('customfeed.user.status')->getById($iItemId);
     if ($aUserStatus && $aUserStatus['user_id'] == $iUserId) {
         Phpfox::getBlock('customfeed.edit_status', array('iFeedId' => $iFeedId, 'iItemId' => $iItemId, 'aUserStatus' => $aUserStatus));
     } else {
         return false;
     }
 }
Exemple #13
0
	public function getBlocks()
	{
		Phpfox::isUser(true);
		Phpfox::getUserParam('admincp.has_admin_access', true);
		Phpfox::getBlock('admincp.block.setting');		

		$this->html('#js_setting_block', $this->getContent(false));
		$this->show('#content_editor_text');
		$this->show('#js_editing_block');
		$this->html('#js_editing_block_text', ($this->get('m_connection') == '' ? Phpfox::getPhrase('admincp.site_wide') : $this->get('m_connection')));		
		$this->call('$.scrollTo(0);');		
		$this->call('$Core.loadInit();');
		$this->call('Core_drag.init({table: \'.js_drag_drop\', ajax: \'admincp.blockOrdering\'});');
	}
Exemple #14
0
 public function getAll()
 {
     if (!Phpfox::isUser()) {
         $this->call('<script type="text/javascript">window.location.href = \'' . Phpfox::getLib('url')->makeUrl('user.login') . '\';</script>');
     } else {
         // This function caches into a static so it shouldn't be an extra load
         /*
         $aNotifications = Phpfox::getService('notification')->get();
         if (count($aNotifications) < 1)
         {
         	$this->call('<script type="text/javascript">$("#js_total_new_notifications").hide();</script>');
         }
         */
         Phpfox::getBlock('notification.link');
     }
 }
Exemple #15
0
    public function __construct()
    {
        $this->_loader = new View\Loader();
        $this->_loader->addPath(PHPFOX_DIR . 'theme/default/html', 'Theme');
        $this->_loader->addPath(PHPFOX_DIR . 'views', 'Base');
        /*
        $this->_env = new \Twig_Environment($this->_loader, array(
        	'cache' => false,
        	'autoescape' => false
        ));
        */
        $this->_env = new View\Environment($this->_loader, array('cache' => false, 'autoescape' => false));
        $this->_env->setBaseTemplateClass('Core\\View\\Base');
        $this->_env->addFunction(new \Twig_SimpleFunction('url', function ($url, $params = []) {
            return \Phpfox_Url::instance()->makeUrl($url, $params);
        }));
        $this->_env->addFunction(new \Twig_SimpleFunction('phrase', function () {
            return call_user_func_array('phrase', func_get_args());
        }));
        $this->_env->addFunction(new \Twig_SimpleFunction('comments', function () {
            \Phpfox::getBlock('feed.comment');
            return '';
        }));
        $this->_env->addFunction(new \Twig_SimpleFunction('pager', function () {
            $u = \Phpfox_Url::instance();
            if (!isset($_GET['page'])) {
                $_GET['page'] = 1;
            }
            $_GET['page']++;
            $u->setParam('page', $_GET['page']);
            $url = $u->current();
            $html = '
				<div class="js_pager_view_more_link">
					<a href="' . $url . '" class="next_page">
						<i class="fa fa-spin fa-circle-o-notch"></i>
						<span>View More</span>
					</a>
				</div>
			';
            return $html;
        }));
        $this->_env->addFunction(new \Twig_SimpleFunction('_p', function () {
            return call_user_func_array('_p', func_get_args());
        }));
    }
Exemple #16
0
 public function addViaLink()
 {
     Phpfox::isUser(true);
     $aVals = $this->get('val');
     if (Phpfox::getService('link.process')->add($aVals, true)) {
         $iId = Phpfox::getService('link.process')->getInsertId();
         $iAttachmentId = Phpfox::getService('attachment.process')->add(array('category' => $aVals['category_id'], 'link_id' => $iId));
         Phpfox::getBlock('link.display', array('link_id' => $iId));
         $this->call('var $oParent = $(\'#' . $aVals['attachment_obj_id'] . '\');');
         $this->call('$oParent.find(\'.js_attachment:first\').val($oParent.find(\'.js_attachment:first\').val() + \'' . $iAttachmentId . ',\'); $oParent.find(\'.js_attachment_list:first\').show(); $oParent.find(\'.js_attachment_list_holder:first\').prepend(\'<div class="attachment_row">' . $this->getContent() . '</div>\');');
         if (isset($aVals['attachment_inline'])) {
             $this->call('$Core.clearInlineBox();');
         } else {
             $this->call('tb_remove();');
         }
         $this->call("\$('.extra_info').hide();");
     }
 }
Exemple #17
0
 public function __construct()
 {
     $this->_loader = new View\Loader();
     $this->_loader->addPath(PHPFOX_DIR . 'theme/default/html', 'Theme');
     $this->_loader->addPath(PHPFOX_DIR . 'views', 'Base');
     $this->_env = new \Twig_Environment($this->_loader, array('cache' => false, 'autoescape' => false));
     $this->_env->setBaseTemplateClass('Core\\View\\Base');
     $this->_env->addFunction(new \Twig_SimpleFunction('url', function ($url, $params = []) {
         return \Phpfox_Url::instance()->makeUrl($url, $params);
     }));
     $this->_env->addFunction(new \Twig_SimpleFunction('phrase', function () {
         return call_user_func_array('phrase', func_get_args());
     }));
     $this->_env->addFunction(new \Twig_SimpleFunction('comments', function () {
         \Phpfox::getBlock('feed.comment');
         return '';
     }));
     $this->_env->addFunction(new \Twig_SimpleFunction('_p', function () {
         return call_user_func_array('_p', func_get_args());
     }));
 }
Exemple #18
0
 public function getNew()
 {
     Phpfox::getBlock('blog.new');
     $this->html('#' . $this->get('id'), $this->getContent(false));
     $this->call('$(\'#' . $this->get('id') . '\').parents(\'.block:first\').find(\'.bottom li a\').attr(\'href\', \'' . Phpfox::getLib('url')->makeUrl('blog') . '\');');
 }
<?php

defined('PHPFOX') or exit('NO DICE!');
/* Cached: August 23, 2014, 6:25 am */
($sPlugin = Phpfox_Plugin::get('core.template_block_template_menu_1')) ? eval($sPlugin) : false;
if (Phpfox::getUserBy('profile_page_id') <= 0) {
    ?>
						<ul>	
<?php 
    ($sPlugin = Phpfox_Plugin::get('theme_template_core_menu_list')) ? eval($sPlugin) : false;
    if (isset($this->_aVars['bForceLogoOnMenu'])) {
        ?>
								<li><?php 
        Phpfox::getBlock('core.template-logo');
        ?>
</li>
<?php 
    }
    if ($this->_aVars['iMenuCnt'] = 0) {
    }
    if (count((array) $this->_aVars['aMainMenus'])) {
        $this->_aPhpfoxVars['iteration']['menu'] = 0;
        foreach ((array) $this->_aVars['aMainMenus'] as $this->_aVars['iKey'] => $this->_aVars['aMainMenu']) {
            $this->_aPhpfoxVars['iteration']['menu']++;
            ?>

<?php 
            if (!isset($this->_aVars['aMainMenu']['is_force_hidden'])) {
                $this->_aVars['iMenuCnt']++;
            }
            ?>
Exemple #20
0
 public function merge()
 {
     Phpfox::isUser(true);
     Phpfox::getBlock('forum.merge');
 }
 /**
  * Loads a module component. Components are the building blocks of the site and
  * include controllers which build up the pages we see and blocks that build up the controllers.
  *
  * @param string $sClass Name of the component to load.
  * @param array $aParams (Optional) Custom params you can pass to the component.
  * @param string $sType (Optional) Identify if this component is a block or a controller.
  * @param boolean $bTemplateParams Assign $aParams to the template
  * @return mixed Return the component object if it exists, otherwise FALSE.
  */
 public function getComponent($sClass, $aParams = array(), $sType = 'block', $bTemplateParams = false)
 {
     ($sPlugin = Phpfox_Plugin::get('module_getcomponent_start')) ? eval($sPlugin) : false;
     if ($sType == 'ajax' && strpos($sClass, '.') === false) {
         $sClass = $sClass . '.ajax';
     }
     if (is_array($sClass)) {
         return Phpfox::getBlock('core.holder', array('block_location' => $this->_aCacheBlockId[md5($sClass[0])]['location'], 'block_custom_id' => $this->_aCacheBlockId[md5($sClass[0])]['block_id'], 'content' => $sClass[0]));
     }
     $aParts = explode('.', $sClass);
     $sModule = $aParts[0];
     $sComponent = $sType . PHPFOX_DS . substr_replace(str_replace('.', PHPFOX_DS, $sClass), '', 0, strlen($sModule . PHPFOX_DS));
     if ($sType == 'controller') {
         $this->_sModule = $sModule;
         $this->_sController = substr_replace(str_replace('.', PHPFOX_DS, $sClass), '', 0, strlen($sModule . PHPFOX_DS));
     }
     static $sBlockName = '';
     if ($sModule == 'custom') {
         if (preg_match('/block\\' . PHPFOX_DS . 'cf_(.*)/i', $sComponent, $aCustomMatch)) {
             $aParams = array('type_id' => 'user_main', 'template' => 'content', 'custom_field_id' => $aCustomMatch[1]);
             $sBlockName = 'custom_cf_' . $aCustomMatch[1];
             $sComponent = 'block' . PHPFOX_DS . 'display';
             $sClass = 'custom.display';
         }
     }
     /*if (Theme_Service_Theme::instance()->isInDnDMode() || defined('PHPFOX_IN_DESIGN_MODE'))
     		{
     			Phpfox_Template::instance()->assign(array('sDeleteBlock' => str_replace('.','_',$sClass),
     				'bBlockCanMove' => true));				
     		}*/
     $sMethod = $sModule . '_component_' . str_replace(PHPFOX_DS, '_', $sComponent) . '_process';
     /*
     if (preg_match('/(.*?)\((.*?)\)/', $sComponent, $aMatches) && !empty($aMatches[2]))
     {
     	eval('$aParams = array_merge($aParams, array(' . $aMatches[2] . '));');
     
     	$sComponent = $aMatches[1];		
     	$sClass = $aMatches[1];			
     }		
     */
     $sHash = md5($sClass . $sType);
     if (!isset($this->_aModules[$sModule])) {
         return false;
     }
     if (isset($this->_aComponent[$sHash])) {
         $this->_aComponent[$sHash]->__construct(array('sModule' => $sModule, 'sComponent' => $sComponent, 'aParams' => $aParams));
     } else {
         $sClassFile = PHPFOX_DIR_MODULE . $sModule . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . $sComponent . '.class.php';
         if (!file_exists($sClassFile) && isset($aParts[1])) {
             $sClassFile = PHPFOX_DIR_MODULE . $sModule . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . $sComponent . PHPFOX_DS . $aParts[1] . '.class.php';
         }
         ($sPlugin = Phpfox_Plugin::get('library_module_getcomponent_1')) ? eval($sPlugin) : false;
         if (isset($mPluginReturn)) {
             return $mPluginReturn;
         }
         // Lets check if there is such a component
         if (!file_exists($sClassFile)) {
             ($sPlugin = Phpfox_Plugin::get('library_module_getcomponent_2')) ? eval($sPlugin) : false;
             if (isset($mPluginReturn)) {
                 return $mPluginReturn;
             }
             // Opps, for some reason we have loaded an invalid component. Lets send back info to the dev.
             Phpfox_Error::trigger('Failed to load component: ' . $sClass . ' (' . $sClassFile . ')', E_USER_ERROR);
         }
         // Require the component
         require $sClassFile;
         // Get the object
         $this->_aComponent[$sHash] = Phpfox::getObject($sModule . '_component_' . str_replace(PHPFOX_DS, '_', $sComponent), array('sModule' => $sModule, 'sComponent' => $sComponent, 'aParams' => $aParams));
     }
     $mReturn = 'blank';
     if ($sType != 'ajax') {
         ($sPlugin = Phpfox_Plugin::get('component_pre_process')) ? eval($sPlugin) : false;
         $mReturn = $this->_aComponent[$sHash]->process();
         if (is_object($mReturn) && $mReturn instanceof Closure) {
             ob_clean();
             echo $mReturn->__invoke();
             exit;
         }
         if ($sType == 'controller' && (is_array($mReturn) || is_object($mReturn))) {
             if ($mReturn instanceof Core\jQuery) {
                 $mReturn = ['run' => (string) $mReturn];
             }
             ob_clean();
             header('Content-type: application/json');
             echo json_encode($mReturn);
             exit;
         }
         ($sPlugin = Phpfox_Plugin::get('component_post_process')) ? eval($sPlugin) : false;
     }
     $this->_aReturn[$sClass] = $mReturn;
     // If we return the component as 'false' then there is no need to display it.
     if (is_bool($mReturn) && !$mReturn || $this->_bNoTemplate) {
         if ($this->_bNoTemplate) {
             $this->_bNoTemplate = false;
         }
         return $this->_aComponent[$sHash];
     }
     /* Should we pass the params to the template? */
     if ($bTemplateParams) {
         Phpfox_Template::instance()->assign($aParams);
     }
     // Check if we don't want to display a template
     if (!isset($aParams['bNoTemplate']) && $mReturn != 'blank') {
         if ($mReturn && is_string($mReturn)) {
             $sBlockShowName = $sModule == 'custom' && !empty($sBlockName) ? $sBlockName : ucwords(str_replace('.', ' ', $sClass));
             $sBlockBorderJsId = $sModule == 'custom' && !empty($sBlockName) ? $sBlockName : str_replace('.', '_', $sClass);
             $sBlockPath = $sModule . '.' . str_replace('block' . PHPFOX_DS, '', $sComponent);
             $bCanMove = !isset($this->_aMoveBlocks[$this->_sModule . '.' . $this->_sController][$sBlockPath]) || isset($this->_aMoveBlocks[$this->_sModule . '.' . $this->_sController][$sBlockPath]) && $this->_aMoveBlocks[$this->_sModule . '.' . $this->_sController][$sBlockPath] == true;
             Phpfox_Template::instance()->assign(array('sBlockShowName' => $sBlockShowName, 'sBlockBorderJsId' => $sBlockBorderJsId, 'bCanMove' => $bCanMove, 'sClass' => $sClass))->setLayout($mReturn);
         }
         if (!is_array($mReturn)) {
             $sComponentTemplate = $sModule . '.' . str_replace(PHPFOX_DS, '.', $sComponent);
             ($sPlugin = Phpfox_Plugin::get('module_getcomponent_gettemplate')) ? eval($sPlugin) : false;
             Phpfox_Template::instance()->getTemplate($sComponentTemplate);
         }
         // Check if the component we have loaded has the clean() method
         if (is_object($this->_aComponent[$sHash]) && method_exists($this->_aComponent[$sHash], 'clean')) {
             // This method is used to clean out any garbage we don't need later on in the script. In most cases Template assigns.
             $this->_aComponent[$sHash]->clean();
         }
     }
     return $this->_aComponent[$sHash];
 }
Exemple #22
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();
         }
     }
 }
Exemple #23
0
 public function likeList()
 {
     Phpfox::getBlock('feed.like-list');
 }
Exemple #24
0
 public function logo()
 {
     $this->setTitle(Phpfox::getPhrase('profile.cover_photo'));
     $aParams = array('page_id' => $this->get('page_id'));
     Phpfox::getBlock('profile.cover', $aParams);
 }
Exemple #25
0
 private function _loadLikeBlock($iPage)
 {
     $aPage = Phpfox::getService('pages')->getForView($iPage);
     $oAjax = Phpfox_Ajax::instance();
     Phpfox_Template::instance()->assign('aPage', $aPage);
     Phpfox_Component::setPublicParam('aPage', $aPage);
     Phpfox::getBlock('pages.like');
     $oAjax->html('#js_pages_like_join_holder', $oAjax->getContent(false));
 }
Exemple #26
0
 public function loadMailPhrases()
 {
     $sLanguage = $this->get('sLanguage');
     Phpfox::getBlock('language.admincp.email', array('sLanguage' => $sLanguage));
     $this->html('#phrasesContainer', $this->getContent(false));
 }
Exemple #27
0
	public function showConnectBox()
	{
		$this->setTitle(Phpfox::getPhrase('share.social_sharing'));
		Phpfox::getBlock('share.connect');
	}
Exemple #28
0
 public function loadDelayedBlocks()
 {
     // These are blocks intentionally delayed
     $aLocations = explode(',', $this->get('locations'));
     $oModule = Phpfox::getLib('phpfox.module');
     $aParams = $this->get('params');
     define('PHPFOX_LOADING_DELAYED', true);
     if ($this->get('locations') != null && count($aLocations) > 0) {
         $oModule->loadBlocks();
         if ($oModule->getFullControllerName() == 'core.index' && Phpfox::isUser()) {
             $oModule->setController('core.index-member');
         }
         foreach ($aLocations as $iLocation) {
             $aBlocks = $oModule->getModuleBlocks($iLocation, true);
             foreach ($aBlocks as $sBlock) {
                 Phpfox::getBlock($sBlock);
                 $this->html('#delayed_block_' . $iLocation, $this->getContent(false));
             }
         }
     } else {
         if ($this->get('loadContent') != null) {
             $sController = $this->get('loadContent');
             if (!empty($aParams)) {
                 $oRequest = Phpfox::getLib('request');
                 foreach ($aParams as $sIndex => $sKey) {
                     $oRequest->set($sIndex, $sKey);
                 }
             }
             $oModule->getComponent($sController, $aParams, 'controller');
             $this->hide('#delayed_block_image');
             $this->html('#delayed_block', $this->getContent(false));
             $this->show('#delayed_block');
         } else {
             if ($this->get('delayedTemplates') != null) {
                 $aTemplates = $this->get('delayedTemplates');
                 foreach ($aTemplates as $sIndex => $sKey) {
                     $aTemplate = explode('=', $sKey);
                     $sTemplate = Phpfox::getLib('template')->getBuiltFile($aTemplate[1]);
                     $this->html('#' . $aTemplate[1], $sTemplate);
                 }
             }
         }
     }
     $this->call('$Behavior.loadDelayedBlocks = function(){}; $Core.loadInit();');
 }
Exemple #29
0
 public function loginSearch()
 {
     // Parameters to be sent to the block
     $aParams = array('page' => $this->get('page'));
     // Call the block and send the parameters
     Phpfox::getBlock('pages.login', $aParams);
     // Display the block into the TB box
     $this->call('$(\'.js_box_content\').html(\'' . $this->getContent() . '\');');
 }
Exemple #30
-1
 public function process()
 {
     $feed = Feed_Service_Feed::instance()->getForItem($this->request()->get('type'), $this->request()->get('id'));
     $aFeed = Feed_Service_Feed::instance()->get(null, $feed['feed_id']);
     $this->setParam('aFeed', array_merge($aFeed[0], ['feed_display' => 'view']));
     $this->template()->assign('showOnlyComments', true);
     $this->template()->assign('nextIteration', (int) $this->request()->get('page') + 1);
     Phpfox::getBlock('feed.comment');
     $out = "var comment = " . json_encode(['html' => ob_get_contents()]) . "; ";
     $out .= "\$('#js_feed_comment_pager_{$this->request()->get('id')}').prepend(comment.html); \$Core.loadInit();";
     $out .= "obj.remove();";
     ob_clean();
     header('Content-type: application/json');
     echo json_encode(['run' => $out]);
     exit;
 }