/** * Controller */ public function process() { if (!Profile_Service_Profile::instance()->timeline() && !$this->getParam('bIsPage')) { return false; } $aUser = $this->getParam('aUser'); if ($aUser === null) { $aUser = $this->getParam('aPage'); $this->setParam('aUser', $aUser); } if (isset($aUser['is_page']) && $aUser['is_page'] && isset($aUser['owner_language_id']) && isset($aUser['link']) && isset($aUser['page_user_id'])) { $aUser['user_id'] = $aUser['page_user_id']; } if (empty($aUser['user_id'])) { return false; } if (!isset($aUser['birthday_search'])) { $aUser['birthday_search'] = PHPFOX_TIME; } if (defined('PHPFOX_IS_PAGES_VIEW')) { $aUser['birthday_search'] = Feed_Service_Feed::instance()->getOldPost($aUser['page_id']); } //$aTimeline = Feed_Service_Feed::instance()->getTimeLineYears($aUser['user_id'], $aUser['birthday_search']); if (isset($aUser['birthday']) && $aUser['birthday'] == null) { $aTimeline = Feed_Service_Feed::instance()->getTimeLineYears($aUser['user_id'], $aUser['joined']); } else { $aTimeline = Feed_Service_Feed::instance()->getTimeLineYears($aUser['user_id'], $aUser['birthday_search']); } $this->template()->assign(array('aTimelineDates' => $aTimeline)); }
/** * Controller */ public function process() { $aRow = $this->getParam('aUser'); if (!isset($aRow['user_id'])) { return false; } if (!isset($aRow['has_rated'])) { $aRow['has_rated'] = false; } $this->template()->setTitle(Profile_Service_Profile::instance()->getProfileTitle($aRow)); $this->template()->setEditor(); }
/** * Controller */ public function process() { if (!defined('PHPFOX_IS_USER_PROFILE') && !defined('PAGE_TIME_LINE')) { return false; } ($sPlugin = Phpfox_Plugin::get('profile.component_block_pic_start')) ? eval($sPlugin) : false; if (isset($bHideThisBlock)) { return false; } $aUser = $this->getParam('aUser'); if ($aUser === null) { $aUser = $this->getParam('aPage'); $aUser['user_image'] = $aUser['image_path']; foreach ($aUser as $sKey => $sValue) { if (strpos($sKey, 'owner_') !== false && $sKey != 'owner_user_image') { $aUser[str_replace('owner_', '', $sKey)] = $sValue; } } if (Profile_Service_Profile::instance()->timeline()) { $this->template()->assign(array('sProfileUrl' => Phpfox::getParam('core.url_user') . sprintf($aUser['image_path'], ''))); } } // http://www.phpfox.com/tracker/view/15187/ if (defined('PHPFOX_IS_PAGES_VIEW') && Phpfox::getParam('core.allow_cdn')) { $iOwnerUserId = $aUser['user_id']; $iOwnerServerId = $aUser['server_id']; $sOwnerFullName = $aUser['full_name']; $aUser['user_id'] = $aUser['page_user_id']; $aUser['server_id'] = $aUser['image_server_id']; $aUser['full_name'] = $aUser['title']; $aUser['user_name'] = !empty($aUser['vanity_url']) ? $aUser['vanity_url'] : $aUser['title']; $aUser['user_group_id'] = 2; $this->template()->assign(array('aUser' => $aUser)); } $aUserInfo = array('title' => $aUser['full_name'], 'path' => 'core.url_user', 'file' => $aUser['user_image'], 'suffix' => '_200_square', 'max_width' => 200, 'no_default' => Phpfox::getUserId() == $aUser['user_id'] ? false : true, 'thickbox' => true, 'class' => 'profile_user_image', 'no_link' => true); ($sPlugin = Phpfox_Plugin::get('profile.component_block_pic_process')) ? eval($sPlugin) : false; $sImage = Phpfox::getLib('image.helper')->display(array_merge(array('user' => Phpfox::getService('user')->getUserFields(true, $aUser)), $aUserInfo)); $this->template()->assign(array('sProfileImage' => $sImage)); $bCanSendPoke = Phpfox::isModule('poke') && Phpfox::getService('poke')->canSendPoke($aUser['user_id']); $aCoverPhoto = Phpfox::getService('photo')->getCoverPhoto($aUser['cover_photo']); $this->template()->assign(array('bCanPoke' => $bCanSendPoke, 'aCoverPhoto' => $aCoverPhoto, 'aUser' => $aUser)); }
/** * Controller */ public function process() { $aRow = $this->getParam('aUser'); if (!isset($aRow['user_id'])) { return false; } if (!isset($aRow['has_rated'])) { $aRow['has_rated'] = false; } if ($this->request()->get('req3') == 'design') { define('PHPFOX_PROFILE_INFO_PAGE', true); $this->template()->setHeader(array('sort.js' => 'module_theme', 'design.js' => 'module_theme', '<script type="text/javascript"> $Behavior.profile_controller_design_init = function() { $Core.design.init({type_id: "profile", special: "user_info"}); function designOnUpdate() {$Core.design.updateSorting();} };</script>')); } $this->template()->setTitle(Profile_Service_Profile::instance()->getProfileTitle($aRow)); if (Phpfox::isModule('rate')) { $this->template()->setPhrase(array('rate.thanks_for_rating'))->setHeader('cache', array('jquery/plugin/star/jquery.rating.js' => 'static_script', 'jquery.rating.css' => 'style_css', 'rate.js' => 'module_rate'))->setHeader(array('<script type="text/javascript">$Behavior.userProfileRating = function() { $Core.rate.init({module: \'user\', display: ' . ($aRow['has_rated'] ? 'false' : ($aRow['user_id'] == Phpfox::getUserId() ? 'false' : 'true')) . ', error_message: \'' . ($aRow['has_rated'] ? Phpfox::getPhrase('profile.you_have_already_rated_this_user', array('phpfox_squote' => true)) : Phpfox::getPhrase('profile.you_cannot_rate_yourself', array('phpfox_squote' => true))) . '\'}); }</script>')); } $this->template()->setEditor(); }
public function processAjax($iId) { $oAjax = Phpfox_Ajax::instance(); $aFeeds = Feed_Service_Feed::instance()->get(Phpfox::getUserId(), $iId); if (!isset($aFeeds[0])) { $oAjax->alert(Phpfox::getPhrase('feed.this_item_has_successfully_been_submitted')); $oAjax->call('$Core.resetActivityFeedForm();'); return; } if (isset($aFeeds[0]['type_id'])) { Phpfox_Template::instance()->assign(array('aFeed' => $aFeeds[0], 'aFeedCallback' => array('module' => str_replace('_comment', '', $aFeeds[0]['type_id']), 'item_id' => $aFeeds[0]['item_id'])))->getTemplate(Profile_Service_Profile::instance()->timeline() ? 'feed.block.timeline' : 'feed.block.entry'); } else { Phpfox_Template::instance()->assign(array('aFeed' => $aFeeds[0]))->getTemplate('feed.block.entry'); } $sId = 'js_tmp_comment_' . md5('feed_' . uniqid() . Phpfox::getUserId()) . ''; $sNewContent = '<div id="' . $sId . '" class="js_temp_new_feed_entry js_feed_view_more_entry_holder">' . $oAjax->getContent(false) . '</div>'; if (Profile_Service_Profile::instance()->timeline()) { $oAjax->prepend('.timeline_left_new', '<div class="timeline_feed_row"><div class="timeline_arrow_left">0</div><div class="timeline_float_left">0</div>' . $sNewContent . '</div>'); } else { $oAjax->prepend('#js_new_feed_comment', $sNewContent); } // $oAjax->call('$(\'#' . $sId . '\').highlightFade();'); $oAjax->removeClass('.js_user_feed', 'row_first'); $oAjax->call("iCnt = 0; \$('.js_user_feed').each(function(){ iCnt++; if (iCnt == 1) { \$(this).addClass('row_first'); } });"); if ($oAjax->get('force_form')) { $oAjax->call('tb_remove();'); $oAjax->show('#js_main_feed_holder'); $oAjax->call('$Core.resetActivityFeedForm();'); } else { $oAjax->call('$Core.resetActivityFeedForm();'); } $oAjax->call('$Core.loadInit();'); }
/** * 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, '?') ? '&' : '?'; 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&s=' . $sStylePath . '&f=' . rtrim($sStyleCacheData, ',') . '&v=' . $iVersion . '" />'; } if (!empty($sJsCacheData)) { $sCacheData .= "\n\t\t" . '<script type="text/javascript" src="' . Phpfox::getParam('core.url_static') . 'gzip.php?t=js&f=' . rtrim($sJsCacheData, ',') . '&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('<', '>', '$'); $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; }
public function getActivityFeed($aItem, $aCallback = null, $bIsChildItem = false) { $sThickbox = ''; if (Phpfox::getUserParam('photo.can_view_photos')) { $sThickbox = ''; } if ($aCallback === null) { $this->database()->select(Phpfox::getUserField('u', 'parent_') . ', ')->leftJoin(Phpfox::getT('user'), 'u', 'u.user_id = photo.parent_user_id'); } if ($bIsChildItem) { $this->database()->select(Phpfox::getUserField('u2') . ', ')->join(Phpfox::getT('user'), 'u2', 'u2.user_id = photo.user_id'); } $sSelect = 'photo.*, pi.description, pfeed.photo_id AS extra_photo_id, pa.album_id, pa.name'; if (Phpfox::isModule('like')) { $sSelect .= ', l.like_id AS is_liked'; $this->database()->leftJoin(Phpfox::getT('like'), 'l', 'l.type_id = \'photo\' AND l.item_id = photo.photo_id AND l.user_id = ' . Phpfox::getUserId()); } $aRow = $this->database()->select($sSelect)->from($this->_sTable, 'photo')->join(Phpfox::getT('photo_info'), 'pi', 'pi.photo_id = photo.photo_id')->leftJoin(Phpfox::getT('photo_feed'), 'pfeed', 'pfeed.feed_id = ' . (int) $aItem['feed_id'])->leftJoin(Phpfox::getT('photo_album'), 'pa', 'pa.album_id = photo.album_id')->where('photo.photo_id = ' . (int) $aItem['item_id'])->execute('getSlaveRow'); if ($bIsChildItem) { $aItem = $aRow; } if (!isset($aRow['photo_id'])) { return false; } if (Phpfox::getUserParam('photo.can_view_photos')) { $sThickbox .= ' js_photo_item_' . $aRow['photo_id'] . ' '; } if (defined('PHPFOX_IS_PAGES_VIEW') && !Phpfox::getService('pages')->hasPerm(null, 'photo.view_browse_photos') || !defined('PHPFOX_IS_PAGES_VIEW') && $aRow['module_id'] == 'pages' && !Phpfox::getService('pages')->hasPerm($aRow['group_id'], 'photo.view_browse_photos')) { return false; } $bIsPhotoAlbum = false; if ($aRow['album_id']) { $bIsPhotoAlbum = true; } $sLink = Phpfox::permalink('photo', $aRow['photo_id'], $aRow['title']) . ($bIsPhotoAlbum ? 'albumid_' . $aRow['album_id'] : 'userid_' . $aRow['user_id']) . '/'; $sCustomCss = ''; $sFeedImageOnClick = ''; if ($aRow['mature'] == 0 || ($aRow['mature'] == 1 || $aRow['mature'] == 2) && Phpfox::getUserId() && Phpfox::getUserParam('photo.photo_mature_age_limit') <= Phpfox::getUserBy('age') || $aRow['user_id'] == Phpfox::getUserId()) { $iImageMaxSuffix = Profile_Service_Profile::instance()->timeline() ? '1024' : '1024'; $sCustomCss = '' . $sThickbox . ' photo_holder_image'; $sImage = Phpfox::getLib('image.helper')->display(array('server_id' => $aRow['server_id'], 'path' => 'photo.url_photo', 'file' => Phpfox::getService('photo')->getPhotoUrl(array_merge($aRow, array('full_name' => $aItem['full_name']))), 'suffix' => '_' . $iImageMaxSuffix, 'class' => 'photo_holder', 'defer' => true)); } else { $sImage = Phpfox::getLib('image.helper')->display(array('theme' => 'misc/no_access.png')); $sFeedImageOnClick = ' onclick="tb_show(\'' . Phpfox::getPhrase('photo.warning') . '\', $.ajaxBox(\'photo.warning\', \'height=300&width=350&link=' . $sLink . '\')); return false;" '; $sCustomCss = 'no_ajax_link'; } $aListPhotos = array(); if ($aRow['extra_photo_id'] > 0) { $aPhotos = $this->database()->select('p.photo_id, p.album_id, p.user_id, p.title, p.server_id, p.destination, p.mature')->from(Phpfox::getT('photo_feed'), 'pfeed')->join(Phpfox::getT('photo'), 'p', 'p.photo_id = pfeed.photo_id' . (!empty($aRow['module_id']) ? ' AND p.module_id = \'' . $this->database()->escape($aRow['module_id']) . '\'' : ''))->where('pfeed.feed_id = ' . (int) $aItem['feed_id'])->limit(2)->order('p.time_stamp DESC')->execute('getSlaveRows'); foreach ($aPhotos as $aPhoto) { if ($aPhoto['mature'] == 0 || ($aPhoto['mature'] == 1 || $aPhoto['mature'] == 2) && Phpfox::getUserId() && Phpfox::getUserParam('photo.photo_mature_age_limit') <= Phpfox::getUserBy('age') || $aPhoto['user_id'] == Phpfox::getUserId()) { $aListPhotos[] = '<a href="' . Phpfox::permalink('photo', $aPhoto['photo_id'], $aPhoto['title']) . ($bIsPhotoAlbum ? 'albumid_' . $aRow['album_id'] : 'userid_' . $aRow['user_id']) . '/" class="' . $sThickbox . ' photo_holder_image" rel="' . $aPhoto['photo_id'] . '">' . Phpfox::getLib('image.helper')->display(array('server_id' => $aPhoto['server_id'], 'path' => 'photo.url_photo', 'file' => Phpfox::getService('photo')->getPhotoUrl(array_merge($aPhoto, array('full_name' => $aItem['full_name']))), 'suffix' => '_500', 'class' => 'photo_holder', 'userid' => isset($aItem['user_id']) ? $aItem['user_id'] : '', 'defer' => true)) . '</a>'; } else { $aListPhotos[] = '<a href="#" class="no_ajax_link" onclick="tb_show(\'' . Phpfox::getPhrase('photo.warning') . '\', $.ajaxBox(\'photo.warning\', \'height=300&width=350&link=' . Phpfox::permalink('photo', $aPhoto['photo_id'], $aPhoto['title']) . ($bIsPhotoAlbum ? 'albumid_' . $aRow['album_id'] : 'userid_' . $aRow['user_id']) . '/\')); return false;">' . $sImage . '</a>'; } } $aListPhotos = array_merge(array('<a href="' . Phpfox::permalink('photo', $aRow['photo_id'], $aRow['title']) . ($bIsPhotoAlbum ? 'albumid_' . $aRow['album_id'] : 'userid_' . $aRow['user_id']) . '/" ' . (empty($sFeedImageOnClick) ? ' class="' . $sThickbox . ' photo_holder_image" rel="' . $aRow['photo_id'] . '" ' : $sFeedImageOnClick . ' class="no_ajax_link"') . '>' . $sImage . '</a><br />'), $aListPhotos); } $aReturn = array('feed_title' => '', 'feed_image' => count($aListPhotos) ? $aListPhotos : $sImage, 'feed_status' => $aRow['description'], 'feed_link' => $sLink, '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' => 'module/photo.png', 'return_url' => true)), 'time_stamp' => $aRow['time_stamp'], 'enable_like' => true, 'comment_type_id' => 'photo', 'like_type_id' => 'photo', 'custom_css' => $sCustomCss, 'custom_rel' => $aRow['photo_id'], 'custom_js' => $sFeedImageOnClick, 'no_target_blank' => true, 'custom_data_cache' => $aRow); if ($aRow['module_id'] == 'pages' || $aRow['module_id'] == 'event') { $aRow['parent_user_id'] = ''; $aRow['parent_user_name'] = ''; } if (empty($aRow['parent_user_id'])) { if ($aRow['album_id']) { $aReturn['feed_status'] = ''; $aReturn['feed_info'] = Phpfox::getPhrase('feed.added_new_photos_to_gender_album_a_href_link_name_a', array('gender' => Phpfox::getService('user')->gender($aItem['gender'], 1), 'link' => Phpfox::permalink('photo.album', $aRow['album_id'], $aRow['name']), 'name' => Phpfox_Locale::instance()->convert(Phpfox::getLib('parse.output')->shorten($aRow['name'], Phpfox::isModule('notification') ? Phpfox::getParam('notification.total_notification_title_length') : $this->_iFallbackLength, '...')))); } else { $aReturn['feed_info'] = count($aListPhotos) ? Phpfox::getPhrase('feed.shared_a_few_photos') : Phpfox::getPhrase('feed.shared_a_photo'); } } if ($aCallback === null) { if (!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'] != Profile_Service_Profile::instance()->getProfileUserId()) { $aReturn['feed_mini'] = true; $aReturn['feed_mini_content'] = Phpfox::getPhrase('photo.full_name_posted_a_href_link_photo_a_photo_a_on_a_href_link_user_parent_full_name_a_s_a_href_link_wall_wall_a', array('full_name' => Phpfox::getService('user')->getFirstName($aItem['full_name']), 'link_photo' => Phpfox::permalink('photo', $aRow['photo_id'], $aRow['title']), 'link_user' => Phpfox_Url::instance()->makeUrl($aRow['parent_user_name']), 'parent_full_name' => $aRow['parent_full_name'], 'link_wall' => Phpfox_Url::instance()->makeUrl($aRow['parent_user_name']))); unset($aReturn['feed_status'], $aReturn['feed_image'], $aReturn['feed_content']); } } if ($bIsChildItem) { $aReturn = array_merge($aReturn, $aItem); } ($sPlugin = Phpfox_Plugin::get('photo.component_service_callback_getactivityfeed__1')) ? eval($sPlugin) : false; return $aReturn; }
/** * Process the AJAX request * * @return bool If we can load the component we return true, false on failure */ public function process() { Phpfox::getService('log.session')->verifyToken(); if (empty($this->_aRequest)) { return false; } $aParts = explode('.', $this->_aRequest['call']); $sModule = $aParts[0]; if (isset($aParts[2])) { $sModule .= '.' . $aParts[1] . '.ajax'; $sMethod = $aParts[2]; } else { $sMethod = $aParts[1]; } foreach ($this->_oReq->getRequests() as $sKey => $mValue) { self::$_aParams[$sKey] = $mValue; if (isset($mValue['call']) && strpos($mValue['call'], '.') !== false) { $aParts = explode('.', $mValue['call']); if (isset($aParts[1]) && $aParts[1] == 'moderation') { $this->bIsModeration = true; } } } if ($sModule == 'im' && ($sMethod == 'getRooms' || $sMethod == 'getMessages')) { $sMethod = 'getUpdate'; } ($sPlugin = Phpfox_Plugin::get('ajax_process')) ? eval($sPlugin) : false; $this->template()->assign('aGlobalUser', Phpfox::isUser() ? Phpfox::getUserBy(null) : array()); $this->template()->assign('aGlobalProfilePageLogin', Phpfox::getUserBy('profile_page_id') ? Phpfox::getService('pages')->getLastLogin() : false); if (isset($this->_aRequest['is_user_profile']) && $this->_aRequest['is_user_profile'] && !defined('PHPFOX_IS_USER_PROFILE') && isset($this->_aRequest['profile_user_id'])) { define('PHPFOX_IS_USER_PROFILE', true); Profile_Service_Profile::instance()->setUserId($this->_aRequest['profile_user_id']); } $bCache = false; // Should we cache the data? if (isset(self::$_aParams[Phpfox::getTokenName()]['cache']) && self::$_aParams[Phpfox::getTokenName()]['cache']) { $bCache = true; $oCache = Phpfox::getLib('cache'); $sCacheId = $oCache->set('ajax_' . strtolower($sModule) . '_' . strtolower($sMethod)); if ($sContent = $oCache->get($sCacheId)) { echo $sContent; return true; } } // Lets get the Ajax component for this module if ($oObject = Phpfox::getComponent($sModule, array(), 'ajax')) { // Call the method for this component $oObject->{$sMethod}(); if ($bCache) { $oCache->save($sCacheId, ob_get_contents()); } return true; } // Since this is now an invalid call lets clear out the error message ob_clean(); // Lets tell the dev that its an invalid call // $this->debug('Invalid Component: ' . $sModule . 'ajax'); return false; }
/** * Controller */ public function process() { $aParentModule = $this->getParam('aParentModule'); if ($aParentModule === null && $this->request()->getInt('req2') > 0) { if ($this->request()->get('req1') == 'pages' && Phpfox::isModule('pages') == false || $aParentModule['module_id'] == 'pages' && Phpfox::getService('pages')->hasPerm($aParentModule['item_id'], 'blog.view_browse_blog') == false) { return Phpfox_Error::display(Phpfox::getPhrase('blog.cannot_display_due_to_privacy')); } return Phpfox_Module::instance()->setController('blog.view'); } if (defined('PHPFOX_IS_USER_PROFILE') && ($sLegacyTitle = $this->request()->get('req3')) && !empty($sLegacyTitle)) { Phpfox::getService('core')->getLegacyItem(array('field' => array('blog_id', 'title'), 'table' => 'blog', 'redirect' => 'blog', 'title' => $sLegacyTitle, 'search' => 'title')); } if ($this->request()->get('req2') == 'main') { return Phpfox_Module::instance()->setController('error.404'); } ($sPlugin = Phpfox_Plugin::get('blog.component_controller_index_process_start')) ? eval($sPlugin) : false; if (($iRedirectId = $this->request()->get('redirect')) && ($aRedirectBlog = Phpfox::getService('blog')->getBlogForEdit($iRedirectId))) { Phpfox::permalink('blog', $aRedirectBlog['blog_id'], $aRedirectBlog['title'], true); } Phpfox::getUserParam('blog.view_blogs', true); if (defined('PHPFOX_IS_AJAX_CONTROLLER')) { $bIsProfile = true; $aUser = Phpfox::getService('user')->get($this->request()->get('profile_id')); $this->setParam('aUser', $aUser); } else { $bIsProfile = $this->getParam('bIsProfile'); if ($bIsProfile === true) { $aUser = $this->getParam('aUser'); $this->search()->setCondition('AND blog.user_id = ' . $aUser['user_id']); } } /** * Check if we are going to view an actual blog instead of the blog index page. * The 2nd URL param needs to be numeric. */ if (!Phpfox::isAdminPanel()) { if ($this->request()->getInt('req2') > 0 && !isset($aParentModule['module_id'])) { /** * Since we are going to be viewing a blog lets reset the controller and get out of this one. */ return Phpfox_Module::instance()->setController('blog.view'); } } if ($this->request()->get('req2') == 'category' && ($sLegacyTitle = $this->request()->get('req3')) && !empty($sLegacyTitle) && !is_numeric($sLegacyTitle)) { $aLegacyItem = Phpfox::getService('core')->getLegacyItem(array('field' => array('category_id', 'name'), 'table' => 'blog_category', 'redirect' => 'blog.category', 'title' => $sLegacyTitle, 'search' => 'name_url')); } /** * This creates a global variable that can be used in other components. This is a good way to * pass information to other components. */ $this->setParam('sTagType', 'blog'); $this->template()->setTitle($bIsProfile ? Phpfox::getPhrase('blog.full_name_s_blogs', array('full_name' => $aUser['full_name'])) : Phpfox::getPhrase('blog.blog_title'))->setBreadCrumb($bIsProfile ? Phpfox::getPhrase('blog.blogs') : Phpfox::getPhrase('blog.blog_title'), $bIsProfile ? $this->url()->makeUrl($aUser['user_name'], 'blog') : $this->url()->makeUrl('blog')); $sView = $this->request()->get('view'); $this->search()->set(array('type' => 'blog', 'field' => 'blog.blog_id', 'search_tool' => array('table_alias' => 'blog', 'search' => array('action' => $bIsProfile === true ? $this->url()->makeUrl($aUser['user_name'], array('blog', 'view' => $this->request()->get('view'))) : $this->url()->makeUrl('blog', array('view' => $this->request()->get('view'))), 'default_value' => Phpfox::getPhrase('blog.search_blogs_dot'), 'name' => 'search', 'field' => array('blog.title')), 'sort' => array('latest' => array('blog.time_stamp', Phpfox::getPhrase('blog.latest')), 'most-viewed' => array('blog.total_view', Phpfox::getPhrase('blog.most_viewed')), 'most-liked' => array('blog.total_like', Phpfox::getPhrase('blog.most_liked')), 'most-talked' => array('blog.total_comment', Phpfox::getPhrase('blog.most_discussed'))), 'show' => array(5, 10, 15)))); $aBrowseParams = array('module_id' => 'blog', 'alias' => 'blog', 'field' => 'blog_id', 'table' => Phpfox::getT('blog'), 'hide_view' => array('pending', 'my')); $aFilterMenu = array(); if (!defined('PHPFOX_IS_USER_PROFILE') && !isset($aParentModule['module_id'])) { $aFilterMenu = array(Phpfox::getPhrase('blog.all_blogs') => '', Phpfox::getPhrase('blog.my_blogs') => 'my'); if (!Phpfox::getParam('core.friends_only_community') && Phpfox::isModule('friend')) { $aFilterMenu[Phpfox::getPhrase('blog.friends_blogs')] = 'friend'; } if (Phpfox::getUserParam('blog.can_approve_blogs')) { $iPendingTotal = Phpfox::getService('blog')->getPendingTotal(); if ($iPendingTotal) { $aFilterMenu[Phpfox::getPhrase('blog.pending_blogs') . (Phpfox::getUserParam('blog.can_approve_blogs') ? '<span class="pending">' . $iPendingTotal . '</span>' : 0)] = 'pending'; } } } ($sPlugin = Phpfox_Plugin::get('blog.component_controller_index_process_search')) ? eval($sPlugin) : false; $this->template()->buildSectionMenu('blog', $aFilterMenu); switch ($sView) { case 'spam': Phpfox::isUser(true); if (Phpfox::getUserParam('blog.can_approve_blogs')) { $this->search()->setCondition('AND blog.is_approved = 9'); } break; case 'pending': Phpfox::isUser(true); if (Phpfox::getUserParam('blog.can_approve_blogs')) { $this->search()->setCondition('AND blog.is_approved = 0'); } break; case 'my': Phpfox::isUser(true); $this->search()->setCondition('AND blog.user_id = ' . Phpfox::getUserId()); break; case 'draft': Phpfox::isUser(true); $this->search()->setCondition("AND blog.user_id = " . $aUser['user_id'] . " AND blog.is_approved IN(" . ($aUser['user_id'] == Phpfox::getUserId() ? '0,1' : '1') . ") AND blog.privacy IN(" . (Phpfox::getParam('core.section_privacy_item_browsing') ? '%PRIVACY%' : Phpfox::getService('core')->getForBrowse($aUser)) . ") AND blog.post_status = 2"); break; default: $aPage = $this->getParam('aPage'); $sCondition = "AND blog.is_approved = 1 AND blog.post_status = 1" . (Phpfox::getUserParam('privacy.can_comment_on_all_items') ? "" : " AND blog.privacy IN(%PRIVACY%)"); if (isset($aPage['privacy']) && $aPage['privacy'] == 1) { $sCondition = "AND blog.is_approved = 1 AND blog.privacy IN(%PRIVACY%, 1) AND blog.post_status = 1"; } $this->search()->setCondition($sCondition); break; } if ($this->request()->get($bIsProfile === true ? 'req3' : 'req2') == 'category') { if ($aBlogCategory = Phpfox::getService('blog.category')->getCategory($this->request()->getInt($bIsProfile === true ? 'req4' : 'req3'))) { $this->template()->setBreadCrumb(Phpfox::getPhrase('blog.category')); $this->search()->setCondition('AND blog_category.category_id = ' . $this->request()->getInt($bIsProfile === true ? 'req4' : 'req3') . ' AND blog_category.user_id = ' . ($bIsProfile ? (int) $aUser['user_id'] : 0)); $this->template()->setTitle(Phpfox_Locale::instance()->convert($aBlogCategory['name'])); $this->template()->setBreadCrumb(Phpfox_Locale::instance()->convert($aBlogCategory['name']), $this->url()->makeUrl('current'), true); $this->search()->setFormUrl($this->url()->permalink(array('blog.category', 'view' => $this->request()->get('view')), $aBlogCategory['category_id'], $aBlogCategory['name'])); $bIsValidCategory = true; } } elseif ($this->request()->get(defined('PHPFOX_IS_PAGES_VIEW') ? 'req4' : ($bIsProfile === true ? 'req3' : 'req2')) == 'tag') { if ($aTag = Tag_Service_Tag::instance()->getTagInfo('blog', $this->request()->get(defined('PHPFOX_IS_PAGES_VIEW') ? 'req5' : ($bIsProfile === true ? 'req4' : 'req3')))) { $this->template()->setBreadCrumb(Phpfox::getPhrase('tag.topic') . ': ' . $aTag['tag_text'] . '', $this->url()->makeUrl('current'), true); $this->search()->setCondition('AND tag.tag_text = \'' . Phpfox_Database::instance()->escape($aTag['tag_text']) . '\''); $bIsValidTag = true; } } if (isset($aParentModule) && isset($aParentModule['module_id'])) { /* Only get items without a parent (not belonging to pages) */ $this->search()->setCondition('AND blog.module_id = \'' . $aParentModule['module_id'] . '\' AND blog.item_id = ' . (int) $aParentModule['item_id']); } else { if ($aParentModule === null) { if (($sView == 'pending' || $sView == 'draft') && Phpfox::getUserParam('blog.can_approve_blogs')) { } else { $this->search()->setCondition('AND blog.module_id = \'blog\''); } } } // http://www.phpfox.com/tracker/view/15375/ if (defined('PHPFOX_IS_PAGES_VIEW') && Phpfox::getService('pages')->hasPerm(null, 'blog.view_browse_blogs') || !defined('PHPFOX_IS_PAGES_VIEW') && $aParentModule['module_id'] == 'pages' && Phpfox::getService('pages')->hasPerm($aParentModule['item_id'], 'blog.view_browse_blogs')) { if (Phpfox::getService('pages')->isAdmin($aParentModule['item_id'])) { $this->request()->set('view', 'pages_admin'); } elseif (Phpfox::getService('pages')->isMember($aParentModule['item_id'])) { $this->request()->set('view', 'pages_member'); } } // http://www.phpfox.com/tracker/view/15445/ if (Profile_Service_Profile::instance()->timeline() && ($bIsProfile || defined('PHPFOX_IS_PAGES_VIEW'))) { // Should we set the special menu? $bSpecialMenu = !defined('PHPFOX_IS_AJAX_CONTROLLER'); // Are we viewing the content of the special menu? $bIsActive = $sView == 'draft' ? true : false; $aDrafts = array('phrase' => Phpfox::getPhrase('profile.drafts'), 'url' => Phpfox_Url::instance()->makeUrl('profile.blog.view_draft'), 'total' => Phpfox::getService('blog')->getTotalDrafts($aUser['user_id']), 'active' => $bIsActive); $this->template()->setHeader(array('profile.css' => 'module_blog'))->assign(array('bSpecialMenu' => $bSpecialMenu, 'aDrafts' => $aDrafts)); } // END $this->search()->browse()->params($aBrowseParams)->execute(); $aItems = $this->search()->browse()->getRows(); Phpfox_Pager::instance()->set(array('page' => $this->search()->getPage(), 'size' => $this->search()->getDisplay(), 'count' => $this->search()->browse()->getCount())); Blog_Service_Blog::instance()->getExtra($aItems, 'user_profile'); ($sPlugin = Phpfox_Plugin::get('blog.component_controller_index_process_middle')) ? eval($sPlugin) : false; $this->template()->setMeta('keywords', Phpfox::getParam('blog.blog_meta_keywords')); $this->template()->setMeta('description', Phpfox::getParam('blog.blog_meta_description')); if ($bIsProfile) { $this->template()->setMeta('description', '' . $aUser['full_name'] . ' has ' . $this->search()->browse()->getCount() . ' blogs.'); } foreach ($aItems as $aItem) { $this->template()->setMeta('keywords', $this->template()->getKeywords($aItem['title'])); if (!empty($aItem['tag_list'])) { $this->template()->setMeta('keywords', Tag_Service_Tag::instance()->getKeywords($aItem['tag_list'])); } } /** * Here we assign the needed variables we plan on using in the template. This is used to pass * on any information that needs to be used with the specific template for this component. */ $cnt = $this->search()->browse()->getCount(); $this->template()->assign(array('iCnt' => $cnt, 'aBlogs' => $aItems, 'sSearchBlock' => Phpfox::getPhrase('blog.search_blogs_'), 'bIsProfile' => $bIsProfile, 'sTagType' => $bIsProfile === true ? 'blog_profile' : 'blog', 'sBlogStatus' => $this->request()->get('status'), 'iShorten' => Phpfox::getParam('blog.length_in_index'), 'sView' => $sView))->setHeader('cache', array('quick_submit.js' => 'module_blog', 'jquery/plugin/jquery.highlightFade.js' => 'static_script', 'quick_edit.js' => 'static_script', 'comment.css' => 'style_css', 'pager.css' => 'style_css', 'feed.js' => 'module_feed')); $this->setParam('global_moderation', array('name' => 'blog', 'ajax' => 'blog.moderation', 'menu' => array(array('phrase' => Phpfox::getPhrase('blog.delete'), 'action' => 'delete'), array('phrase' => Phpfox::getPhrase('blog.approve'), 'action' => 'approve')))); ($sPlugin = Phpfox_Plugin::get('blog.component_controller_index_process_end')) ? eval($sPlugin) : false; }
public function getActivityFeedComment($aItem) { /* if (!empty($aItem['feed_reference'])) { $aItem['item_id'] = $aItem['feed_reference']; return Phpfox::getService('user.callback')->getActivityFeedStatus($aItem); } */ // http://www.phpfox.com/tracker/view/15336/ if ($aItem['user_id'] == Profile_Service_Profile::instance()->getProfileUserId()) { return false; } if (Phpfox::isModule('like')) { $this->database()->select('l.like_id AS is_liked, ')->leftJoin(Phpfox::getT('like'), 'l', 'l.type_id = \'feed_comment\' AND l.item_id = fc.feed_comment_id AND l.user_id = ' . Phpfox::getUserId()); } $aRow = $this->database()->select('fc.*, ' . Phpfox::getUserField('u', 'parent_'))->from(Phpfox::getT('feed_comment'), 'fc')->leftJoin(Phpfox::getT('user'), 'u', 'u.user_id = fc.parent_user_id')->where('fc.feed_comment_id = ' . (int) $aItem['item_id'])->execute('getSlaveRow'); $sLink = Phpfox_Url::instance()->makeUrl($aRow['parent_user_name'], array('comment-id' => $aRow['feed_comment_id'])); $aReturn = array('no_share' => true, 'feed_status' => $aRow['content'], 'feed_link' => $sLink, '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' => 'misc/comment.png', 'return_url' => true)), 'time_stamp' => $aRow['time_stamp'], 'enable_like' => true, 'comment_type_id' => 'feed', 'like_type_id' => 'feed_comment'); if (!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'] != Profile_Service_Profile::instance()->getProfileUserId()) { $aReturn['feed_info'] = Phpfox::getPhrase('feed.posted_on_parent_full_names_wall', array('parent_user_name' => Phpfox_Url::instance()->makeUrl($aRow['parent_user_name']), 'parent_full_name' => $aRow['parent_full_name'])); $aReturn['feed_status'] = $aRow['content']; // http://www.phpfox.com/tracker/view/15025/ $aReturn['parent_user_id'] = $aRow['user_id']; /* if (Profile_Service_Profile::instance()->timeline()) { $aReturn['feed_info'] = Phpfox::getPhrase('feed.posted_on_parent_full_names_wall', array('parent_user_name' => Phpfox_Url::instance()->makeUrl($aRow['parent_user_name']), 'parent_full_name' => $aRow['parent_full_name'])); $aReturn['feed_status'] = $aRow['content']; } else { if (empty($_POST)) { $aReturn['parent_user'] = Phpfox::getService('user')->getUserFields(true, $aRow, 'parent_'); } $aRow['content'] = strip_tags($aRow['content']); $aRow['content'] = Phpfox::getLib('parse.output')->replaceUserTag($aRow['content']); $aReturn['feed_mini'] = true; $aReturn['feed_mini_content'] = Phpfox::getPhrase('feed.content_on_a_href_link_parent_full_name_a_s_a_href_wall_link_wall_a', array('content' => $aRow['content'], 'link' => Phpfox_Url::instance()->makeUrl($aRow['parent_user_name']), 'parent_full_name' => $aRow['parent_full_name'], 'wall_link' => $sLink)); unset($aReturn['feed_status']); } */ } return $aReturn; }
/** * Get ads based on the block positioning. * * @param int $iId Block ID#. * @return mixed NULL returned if ads cannot be viewed by the user. FALSE is returned if no ads exists. An ARRAY of ads are returned of ads exist for the specific block. */ public function getForBlock($iId, $bAll = false, $bUpdateCounter = true) { static $aCacheAd = array(); if (Phpfox::getParam('ad.multi_ad')) { if ($iId != 3 && $iId != 50) { return false; } $iId = 50; } if (isset($aCacheAd[$iId])) { return $aCacheAd[$iId]; } if (Profile_Service_Profile::instance()->timeline() && $iId == '1') { $aCacheAd[$iId] = array(); return $aCacheAd[$iId]; } ($sPlugin = Phpfox_Plugin::get('ad.service_ad_getforblock__start')) ? eval($sPlugin) : false; $sCacheId = $this->cache()->set('ad_' . (int) $iId); if (Phpfox::getUserGroupParam(Phpfox::getUserBy('user_group_id'), 'ad.show_ads') == false) { $aCacheAd[$iId] = array(); return array(); } if (!($aAds = $this->cache()->get($sCacheId, Phpfox::getParam('ad.ad_cache_limit')))) { $aRows = $this->database()->select('a.*, ac.child_id, ac.country_id')->from($this->_sTable, 'a')->leftjoin(Phpfox::getT('ad_country'), 'ac', 'ac.ad_id = a.ad_id')->where('a.is_active = 1 AND a.location = \'' . $this->database()->escape($iId) . '\'')->execute('getRows'); $aAds = array(); $aIn = array(); foreach ($aRows as $iKey => $aAd) { if (!isset($aAds[$aAd['ad_id']])) { $aAds[$aAd['ad_id']] = $aAd; $aAds[$aAd['ad_id']]['country_child_id'] = array(); $aAds[$aAd['ad_id']]['countries_list'] = array(); unset($aAds[$aAd['ad_id']]['country_id']); } if (isset($aAd['child_id']) && !empty($aAd['child_id'])) { $aAds[$aAd['ad_id']]['country_child_id'][] = $aAd['child_id']; unset($aAds[$aAd['ad_id']]['child_id']); } if (isset($aAd['country_id']) && !empty($aAd['country_id'])) { $aAds[$aAd['ad_id']]['countries_list'][$aAd['country_id']] = $aAd['country_id']; } if ($aAd['location'] == 50) { $aContent = json_decode($aAd['html_code'], true); $aAds[$aAd['ad_id']]['body'] = $aContent['body']; $aAds[$aAd['ad_id']]['title'] = $aContent['title']; $aAds[$aAd['ad_id']]['trimmed_url'] = str_replace('http://', '', $aAd['url_link']); } // http://www.phpfox.com/tracker/view/15397/ if (!empty($aAd['disallow_controller'])) { $sControllerName = Phpfox_Module::instance()->getFullControllerName(); $aParts = explode(',', $aAd['disallow_controller']); foreach ($aParts as $sPart) { $sPart = trim($sPart); // str_replace for marketplace.invoice/index // str_replace for music.browse/album if ($sControllerName == $sPart || str_replace('/index', '', $sControllerName) == $sPart || str_replace('/', '.', $sControllerName) == $sPart) { unset($aAds[$aAd['ad_id']]); } } } } $this->cache()->save($sCacheId, $aAds); } if ($sPlugin = Phpfox_Plugin::get('ad.service_ad_getforblock__1')) { eval($sPlugin); } if (!is_array($aAds) || is_array($aAds) && !count($aAds)) { $aCacheAd[$iId] = array(); return array(); } foreach ($aAds as $iKey => $aAd) { // Check for Postal Code and for City if (Phpfox::getParam('ad.advanced_ad_filters') && Phpfox::getUserBy('postal_code') != '' && !empty($aAd['postal_code']) && strpos($aAd['postal_code'], Phpfox::getUserBy('postal_code')) === false) { unset($aAds[$iKey]); } if (Phpfox::getParam('ad.advanced_ad_filters') && !empty($aAd['postal_code']) && Phpfox::getUserBy('postal_code') == '') { unset($aAds[$iKey]); } if (Phpfox::getParam('ad.advanced_ad_filters') && !empty($aAd['country_iso']) && (isset($aAd['city_location']) && !empty($aAd['city_location']) && Phpfox::getUserBy('city_location') != false && strpos($aAd['city_location'], Phpfox::getUserBy('city_location')) === false || isset($aAd['postal_code']) && !empty($aAd['postal_code']) && Phpfox::getUserBy('postal_code') != false && strpos($aAd['postal_code'], Phpfox::getUserBy('postal_code')) === false)) { unset($aAds[$iKey]); } else { if (Phpfox::getParam('ad.advanced_ad_filters') && isset($aAd['city_location']) && !empty($aAd['city_location']) && Phpfox::getUserBy('city_location') == false) { unset($aAds[$iKey]); } } if ($aAd['is_cpm'] == 1 && $aAd['total_view'] > 0 && $aAd['count_view'] >= $aAd['total_view']) { unset($aAds[$iKey]); } if ($aAd['is_cpm'] != 1 && $aAd['total_click'] > 0 && $aAd['count_click'] >= $aAd['total_click']) { unset($aAds[$iKey]); } if (!empty($aAd['country_iso']) && Phpfox::isUser() && $aAd['country_iso'] != Phpfox::getUserBy('country_iso') && Phpfox::getUserBy('country_iso') != '') { unset($aAds[$iKey]); } if (isset($aAd['countries_list']) && !empty($aAd['countries_list']) && Phpfox::isUser()) { $bKeep = false; $iCountryChildId = Phpfox::getUserBy('country_child_id'); foreach ($aAd['countries_list'] as $sCountry) { if ($sCountry == Phpfox::getUserBy('country_iso') && empty($aAd['country_child_id'])) { $bKeep = true; break; } if ($sCountry == Phpfox::getUserBy('country_iso') && (!empty($aAd['country_child_id']) && Phpfox::getParam('ad.advanced_ad_filters') && in_array($iCountryChildId, $aAd['country_child_id']))) { $bKeep = true; break; } } if ($bKeep != true) { unset($aAds[$iKey]); } } if (!empty($aAd['gender']) && Phpfox::isUser() && $aAd['gender'] != Phpfox::getUserBy('gender')) { unset($aAds[$iKey]); } if (!empty($aAd['age_from']) && !empty($aAd['age_to']) && Phpfox::isUser() && ($aAd['age_from'] > Phpfox::getUserBy('age') || $aAd['age_to'] < Phpfox::getUserBy('age'))) { unset($aAds[$iKey]); } if (!empty($aAd['user_group']) && Phpfox::getLib('parse.format')->isSerialized($aAd['user_group'])) { if (!in_array(Phpfox::getUserBy('user_group_id'), unserialize($aAd['user_group']))) { unset($aAds[$iKey]); } } if (!empty($aAd['module_access']) && $aAd['module_access'] != Phpfox_Module::instance()->getModuleName()) { unset($aAds[$iKey]); } if ($aAd['start_date'] > PHPFOX_TIME) { unset($aAds[$iKey]); } if (!empty($aAd['end_date']) && $aAd['end_date'] < PHPFOX_TIME) { unset($aAds[$iKey]); } // This requires more code so its best to be put at the end $sCityInDB = strtolower($aAd['city_location']); $sCityUser = strtolower(Phpfox::getUserBy('city_location')); if (Phpfox::getParam('ad.advanced_ad_filters') && !empty($aAd['country_iso']) && !empty($sCityInDB) && !empty($sCityUser) && strpos($sCityInDB, $sCityUser) === false) { unset($aAds[$iKey]); } if (Phpfox::getParam('ad.advanced_ad_filters') && !empty($aAd['country_iso']) && !empty($sCityInDB) && empty($sCityUser)) { unset($aAds[$iKey]); } } if (!count($aAds)) { $aCacheAd[$iId] = array(); return array(); } $iTotal = Phpfox::getParam('ad.how_many_ads_per_location') > count($aAds) ? count($aAds) : Phpfox::getParam('ad.how_many_ads_per_location'); if (Phpfox::getParam('ad.multi_ad') != true && $iTotal < count($aAds) && Phpfox::getParam('ad.how_many_ads_per_location') > 0) { shuffle($aAds); $aAds = array_slice($aAds, 0, $iTotal); } else { if (Phpfox::getParam('ad.multi_ad') && count($aAds) > Phpfox::getParam('ad.ad_multi_ad_count')) { shuffle($aAds); $aAds = array_slice($aAds, 0, Phpfox::getParam('ad.ad_multi_ad_count')); } } if ($bAll) { foreach ($aAds as $aAd) { if ($bUpdateCounter) { $this->database()->updateCounter('ad', 'count_view', 'ad_id', $aAd['ad_id']); if ($aAd['is_cpm'] == 1 && $aAd['count_view'] >= $aAd['total_view'] && $aAd['total_view'] != 0 || $aAd['is_cpm'] != 1 && $aAd['count_click'] >= $aAd['total_click'] && $aAd['total_click'] != 0) { $this->database()->update(Phpfox::getT('ad'), array('is_active' => '0'), 'ad_id = ' . (int) $aAd['ad_id']); } } } $aCacheAd[$iId] = $aAds; return $aAds; } sort($aAds); shuffle($aAds); $aAd = $aAds[mt_rand(0, count($aAds) - 1)]; if ($bUpdateCounter) { $this->database()->updateCounter('ad', 'count_view', 'ad_id', $aAd['ad_id']); } ($sPlugin = Phpfox_Plugin::get('ad.service_ad_getforblock__end')) ? eval($sPlugin) : false; return $aAd; }
/** * Controller */ public function process() { // Dealing with legacy versions if ($sReg2Legacy = $this->request()->get('req2')) { switch ($sReg2Legacy) { case 'gallery': $sLegacySend = 'photo'; break; case 'blogs': $sLegacySend = 'blog'; break; case 'guestbook': $sLegacySend = '#comment'; break; case 'friends': $sLegacySend = 'friend'; break; case 'favorites': $sLegacySend = 'favorite'; break; case 'videos': $sLegacySend = 'video'; break; } if (isset($sLegacySend)) { header('HTTP/1.1 301 Moved Permanently'); $this->url()->send($this->request()->get('req1'), $sLegacySend); } } $mUser = $this->request()->get('req1'); $sSection = $this->request()->get('req2'); if (!empty($sSection)) { $sSection = $this->url()->reverseRewrite($sSection); } ($sPlugin = Phpfox_Plugin::get('profile.component_controller_index_process_after_requests')) ? eval($sPlugin) : false; $bIsSubSection = false; if (!empty($sSection) && Phpfox::isModule($sSection) && $sSection != 'designer') { $bIsSubSection = true; } if (!$mUser) { if (Phpfox::isUser()) { $this->url()->send('profile'); } else { Phpfox::isUser(true); } } // If we are unable to find a user lets make sure we return a 404 page not found error $aRow = Phpfox::getService('user')->get($mUser, false); if (!isset($aRow['user_id']) || isset($aRow['user_id']) && $aRow['profile_page_id'] > 0) { if (empty($aRow['profile_page_id']) && $this->request()->get('req2') != '' && Phpfox::isModule($this->request()->get('req2'))) { if (preg_match('/profile-(.*)/i', $this->request()->get('req1'), $aProfileMatches)) { if (isset($aProfileMatches[1]) && is_numeric($aProfileMatches[1])) { $aActualUser = Phpfox::getService('user')->getUser($aProfileMatches[1]); if (isset($aActualUser['user_id'])) { $aAllRequests = $this->request()->getRequests(); $aActualRequests = array(); foreach ($aAllRequests as $mKey => $mValue) { if ($mKey == PHPFOX_GET_METHOD || $mValue == $this->request()->get('req1')) { continue; } if (substr($mKey, 0, 3) == 'req') { $aActualRequests[] = $mValue; } else { $aActualRequests[$mKey] = $mValue; } } header('HTTP/1.1 301 Moved Permanently'); $this->url()->send($aActualUser['user_name'], $aActualRequests); } } } // $this->url()->send(Phpfox::getUserBy('user_name'), $this->request()->get('req2')); } if (Phpfox::isModule('pages') && Phpfox::getService('pages')->isPage($this->request()->get('req1'))) { return Phpfox_Module::instance()->setController('pages.view'); } return Phpfox_Module::instance()->setController('error.404'); } if (($sSection == 'info' && $this->request()->get('req3') == 'design' || $sSection == 'designer') && $aRow['user_id'] == Phpfox::getUserId() && Phpfox::getUserParam('profile.can_custom_design_own_profile')) { define('PHPFOX_IN_DESIGN_MODE', true); define('PHPFOX_CAN_MOVE_BLOCKS', true); } $oUser = Phpfox::getService('user'); if (empty($aRow['dob_setting'])) { switch (Phpfox::getParam('user.default_privacy_brithdate')) { case 'month_day': $aRow['dob_setting'] = '1'; break; case 'show_age': $aRow['dob_setting'] = '2'; break; case 'hide': $aRow['dob_setting'] = '3'; break; } } $aRow['gender_name'] = $oUser->gender($aRow['gender']); $aRow['birthday_time_stamp'] = $aRow['birthday']; $aRow['birthday'] = $oUser->age($aRow['birthday']); $aRow['location'] = Phpfox::getPhraseT(Phpfox::getService('core.country')->getCountry($aRow['country_iso']), 'country'); if (isset($aRow['country_child_id']) && $aRow['country_child_id'] > 0) { $aRow['location_child'] = Phpfox::getService('core.country')->getChild($aRow['country_child_id']); } $aRow['birthdate_display'] = Phpfox::getService('user')->getProfileBirthDate($aRow); $aRow['is_user_birthday'] = empty($aRow['birthday_time_stamp']) ? false : (int) floor(Phpfox::getLib('date')->daysToDate($aRow['birthday_time_stamp'], null, false)) === 0 ? true : false; if (empty($aRow['landing_page'])) { $aRow['landing_page'] = 'wall'; } $this->setParam('aUser', $aRow); define('PHPFOX_CURRENT_TIMELINE_PROFILE', $aRow['user_id']); $this->template()->setHeader('cache', array('profile.css' => 'style_css'))->assign(array('aUser' => $aRow, 'aProfileLinks' => Profile_Service_Profile::instance()->getProfileMenu($aRow), 'bIsBlocked' => Phpfox::isUser() ? Phpfox::getService('user.block')->isBlocked(Phpfox::getUserId(), $aRow['user_id']) : false, 'bOwnProfile' => $aRow['user_id'] == Phpfox::getUserId())); if (Phpfox::getService('user.block')->isBlocked($aRow['user_id'], Phpfox::getUserId()) && !Phpfox::getUserParam('user.can_override_user_privacy')) { return Phpfox_Module::instance()->setController('profile.private'); } Phpfox::getUserParam('profile.can_view_users_profile', true); // Set it globaly that we are viewing a users profile, sometimes variables don't help. if (!defined('PHPFOX_IS_USER_PROFILE')) { define('PHPFOX_IS_USER_PROFILE', true); } if ($aRow['designer_style_id']) { $this->template()->setHeader('<script type="text/javascript">bCanByPassClick = true; sClickProfileName = \'' . $aRow['user_name'] . '\';</script>')->setStyle(array('style_id' => $aRow['designer_style_id'], 'style_folder_name' => $aRow['designer_style_folder'], 'theme_folder_name' => $aRow['designer_theme_folder'], 'theme_parent_id' => $aRow['theme_parent_id'], 'total_column' => $aRow['total_column'], 'l_width' => $aRow['l_width'], 'c_width' => $aRow['c_width'], 'r_width' => $aRow['r_width'])); } if (!empty($aRow['css_hash'])) { define('PHPFOX_TEMPLATE_CSS_FILE', Theme_Service_Theme::instance()->getCss(array('table' => 'user_css', 'field' => 'user_id', 'value' => $aRow['user_id'], 'hash' => $aRow['css_hash'], 'table_code' => 'user_css_code'))); } ($sPlugin = Phpfox_Plugin::get('profile.component_controller_index_process_is_sub_section')) ? eval($sPlugin) : false; if (Phpfox::isModule('friend') && Phpfox::getParam('friend.friends_only_profile') && empty($aRow['is_friend']) && !Phpfox::getUserParam('user.can_override_user_privacy') && $aRow['user_id'] != Phpfox::getUserId()) { return Phpfox_Module::instance()->setController('profile.private'); } if ($bIsSubSection === true) { $this->template()->setUrl(Phpfox::callback($sSection . '.getProfileLink')); return Phpfox_Module::instance()->setController($sSection . '.profile'); } if (!Phpfox::getService('user.privacy')->hasAccess($aRow['user_id'], 'profile.view_profile')) { return Phpfox_Module::instance()->setController('profile.private'); } Profile_Service_Profile::instance()->setUserId($aRow['user_id']); ($sPlugin = Phpfox_Plugin::get('profile.component_controller_index_process_start')) ? eval($sPlugin) : false; if (!isset($aRow['is_viewed'])) { $aRow['is_viewed'] = 0; } if (Phpfox::getParam('profile.profile_caches') != true && (Phpfox::isUser() && Phpfox::getUserId() != $aRow['user_id'] && !$aRow['is_viewed'] && !Phpfox::getUserBy('is_invisible'))) { if (Phpfox::isModule('track')) { Phpfox::getService('track.process')->add('profile', $aRow['user_id']); } Phpfox::getService('user.field.process')->update($aRow['user_id'], 'total_view', $aRow['total_view'] + 1); } if (Phpfox::getParam('profile.profile_caches') != true && isset($aRow['is_viewed']) && Phpfox::isUser() && Phpfox::isModule('track') && Phpfox::getUserId() != $aRow['user_id'] && $aRow['is_viewed'] && !Phpfox::getUserBy('is_invisible')) { Phpfox::getService('track.process')->update('user_track', $aRow['user_id']); } $this->setParam(array('sTrackType' => 'profile', 'iTrackId' => $aRow['user_id'], 'iTrackUserId' => $aRow['user_id'])); $this->template()->assign(array('bIsUserProfileIndexPage' => true)); Phpfox_Module::instance()->setCacheBlockData(array('table' => 'user_design_order', 'field' => 'user_id', 'item_id' => $aRow['user_id'], 'controller' => 'profile.' . ($this->request()->get('req2') == 'info' ? 'info' : 'index'))); if (Phpfox::isModule('rss') && Phpfox::getService('user.privacy')->hasAccess($aRow['user_id'], 'rss.can_subscribe_profile')) { $this->template()->setHeader('<link rel="alternate" type="application/rss+xml" title="' . Phpfox::getPhrase('profile.updates_from') . ': ' . Phpfox::getLib('parse.output')->clean($aRow['full_name']) . '" href="' . $this->url()->makeUrl($aRow['user_name'], array('rss')) . '" />'); $this->template()->assign('bShowRssFeedForUser', true); } ($sPlugin = Phpfox_Plugin::get('profile.component_controller_index_process_section')) ? eval($sPlugin) : false; //define('PHPFOX_CAN_MOVE_BLOCKS', true); $this->setParam(array('bIsProfileIndex' => true, 'sType' => 'profile', 'iItemId' => $aRow['user_id'], 'iTotal' => $aRow['total_comment'], 'user_id' => $aRow['user_id'], 'user_group_id' => $aRow['user_group_id'], 'edit_user_id' => $aRow['user_id'], 'item_id' => $aRow['user_id'])); if ($this->request()->get('req2') == 'info' || !Phpfox::getService('user.privacy')->hasAccess($aRow['user_id'], 'feed.view_wall') || $aRow['landing_page'] == 'info' && empty($sSection)) { if (!$this->request()->get('status-id') && !$this->request()->get('comment-id') && !$this->request()->get('link-id') && !$this->request()->get('plink-id') && !$this->request()->get('poke-id') && !$this->request()->get('feed')) { return Phpfox_Module::instance()->setController('profile.info'); } } $sPageTitle = Profile_Service_Profile::instance()->getProfileTitle($aRow); if (!defined('PHPFOX_IS_USER_PROFILE_INDEX')) { define('PHPFOX_IS_USER_PROFILE_INDEX', true); } if ($aRow['user_id'] == Phpfox::getUserId()) { define('PHPFOX_FEED_CAN_DELETE', true); } define('PHPFOX_CURRENT_USER_PROFILE', $aRow['user_id']); $sDescription = Phpfox::getPhrase('profile.full_name_is_on_site_title', array('full_name' => $aRow['full_name'], 'location' => $aRow['location'] . (empty($aRow['location_child']) ? '' : ', ' . $aRow['location_child']), 'site_title' => Phpfox::getParam('core.site_title'), 'meta_description_profile' => Phpfox::getParam('core.meta_description_profile'), 'total_friend' => $aRow['total_friend'])); if (($iLinkId = $this->request()->get('link-id')) && ($aLinkShare = Link_Service_Link::instance()->getLinkById($iLinkId)) && isset($aLinkShare['link_id'])) { $sPageTitle = $aLinkShare['title']; $sDescription = $aLinkShare['description']; $this->template()->setMeta('og:image', $aLinkShare['image']); } $this->template()->setTitle($sPageTitle)->setMeta('description', $sDescription)->setEditor(array('load' => 'simple', 'wysiwyg' => Phpfox::isModule('comment') && Phpfox::getParam('comment.wysiwyg_comments') && Phpfox::getUserParam('comment.wysiwyg_on_comments')))->setUrl('profile')->setHeader('cache', array('feed.js' => 'module_feed', 'comment.css' => 'style_css', 'pager.css' => 'style_css', 'jquery/plugin/jquery.scrollTo.js' => 'static_script', 'quick_edit.js' => 'static_script', 'jquery/plugin/jquery.highlightFade.js' => 'static_script')); ($sPlugin = Phpfox_Plugin::get('profile.component_controller_index_set_header')) ? eval($sPlugin) : false; if (Phpfox::isModule('video')) { $this->template()->setHeader('cache', array('video.css' => 'module_video')); } if ($sSection == 'designer') { if ($aRow['user_id'] == Phpfox::getUserId() && Phpfox::getUserParam('profile.can_custom_design_own_profile')) { if ($iTestStyle = $this->request()->get('test_style_id')) { if (Phpfox_Template::instance()->testStyle($iTestStyle)) { } } $aDesigner = array('current_style_id' => $aRow['designer_style_id'], 'design_header' => Phpfox::getPhrase('profile.profile_designer'), 'current_page' => $this->url()->makeUrl($aRow['user_name']), 'design_page' => $this->url()->makeUrl($aRow['user_name'], 'designer'), 'block' => 'profile.index', 'item_id' => $aRow['user_id'], 'type_id' => 'profile', 'css_code' => Theme_Service_Theme::instance()->getCssCode(array('table_code' => 'user_css_code', 'field' => 'user_id', 'value' => $aRow['user_id']))); $this->setParam('aDesigner', $aDesigner); ($sCmd = Phpfox_Template::instance()->getXml('design_css')) ? eval($sCmd) : null; if (isset($aAdvanced)) { Theme_Service_Theme::instance()->getDesignValues($aAdvanced, array('table' => 'user_css', 'field' => 'user_id', 'value' => $aRow['user_id'])); } $this->template()->setPhrase(array('theme.are_you_sure'))->setImage(array('css_edit_background' => 'layout/css_edit_background.png'))->setHeader('cache', array('jquery/ui.js' => 'static_script', 'style.css' => 'style_css', 'select.js' => 'module_theme', 'design.js' => 'module_theme', 'colorpicker.js' => 'static_script', 'colorpicker.css' => 'style_css', 'colorpicker/js/colorpicker.js' => 'static_script', 'switch_legend.js' => 'static_script', 'switch_menu.js' => 'static_script', 'designer.js' => 'module_profile'))->setHeader('cache', array('design.js' => 'style_script'))->setHeader(array(Phpfox::getLib('parse.css')->getJavaScript())); if (isset($aAdvanced)) { $this->template()->assign(array('aAdvanced' => $aAdvanced)); } if (Phpfox::getParam('profile.can_drag_drop_blocks_on_profile')) { $this->template()->setHeader('cache', array('sort.js' => 'module_theme')); } } } else { if (Phpfox::getParam('profile.can_drag_drop_blocks_on_profile') && $aRow['user_id'] == Phpfox::getUserId() && Phpfox::getUserParam('profile.can_custom_design_own_profile')) { $this->template()->setHeader(array('jquery/ui.js' => 'static_script', 'sort.js' => 'module_theme', 'design.js' => 'module_theme', '<script type="text/javascript">$Behavior.profile_controller_designonupdate_3 = function() { function designOnUpdate() { $Core.design.updateSorting(); } };</script>', '<script type="text/javascript">$Behavior.profile_controller_init_3 = function() { $Core.design.init({type_id: \'profile\'}); };</script>')); } } }
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, ' . 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')->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/15456/ if ($aRow['module_id'] == 'pages') { $aPage = Phpfox::getService('pages')->getForView($aRow['parent_user_id']); $aNewUser = Phpfox::getService('user')->getUser($aPage['page_user_id']); // Override the values $aRow['parent_profile_page_id'] = $aNewUser['profile_page_id']; $aRow['user_parent_server_id'] = $aNewUser['server_id']; $aRow['parent_user_name'] = !empty($aNewUser['user_name']) ? $aNewUser['user_name'] : ''; $aRow['parent_full_name'] = $aNewUser['full_name']; $aRow['parent_gender'] = $aNewUser['gender']; $aRow['parent_user_image'] = $aNewUser['user_image']; $aRow['parent_is_invisible'] = $aNewUser['is_invisible']; $aRow['parent_user_group_id'] = $aNewUser['user_group_id']; $aRow['parent_language_id'] = $aNewUser['language_id']; $aRow['parent_last_activity'] = $aNewUser['last_activity']; // Remove the no longer needed variables unset($aPage); unset($aNewUser); } // 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_Url::instance()->makeUrl($aRow['parent_user_name']); $aReturn = array('feed_title' => $aRow['title'], 'feed_status' => $aRow['status_info'], 'feed_link_comment' => Phpfox_Url::instance()->makeUrl($aItem['user_name'], array('link-id' => $aRow['link_id'])), 'feed_link' => Phpfox_Url::instance()->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'], '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_Url::instance()->makeUrl('core.redirect', array('url' => Phpfox_Url::instance()->encode($aRow['link']))); $aReturn['feed_title_extra_link'] = Phpfox_Url::instance()->makeUrl('core.redirect', array('url' => Phpfox_Url::instance()->encode($aReturn['feed_title_extra_link']))); } } if (!empty($aRow['image'])) { $aReturn['feed_image'] = '<img src="' . $aRow['image'] . '" alt="" />'; } 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_'); } // http://www.phpfox.com/tracker/view/15456/ if ($aRow['module_id'] == 'pages' && empty($aRow['parent_user_name']) && Phpfox_Request::instance()->get('link-id') > 0) { $sLink = Phpfox_Url::instance()->makeUrl('pages', $aRow['parent_user_id']); $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' => $sLink, 'parent_full_name' => $aRow['parent_full_name'])); unset($aReturn['feed_status'], $aReturn['feed_image'], $aReturn['feed_title'], $aReturn['feed_content']); } elseif (!PHPFOX_IS_AJAX && defined('PHPFOX_IS_USER_PROFILE') && !empty($aRow['parent_user_name']) && $aRow['parent_user_id'] != Profile_Service_Profile::instance()->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_Url::instance()->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'] . '&feed_id=' . $aItem['feed_id'] . '&popup=true\', \'GET\'); return false;'; } } ($sPlugin = Phpfox_Plugin::get('link.component_service_callback_getactivityfeed__1')) ? eval($sPlugin) : false; return $aReturn; }