/** * Controller */ public function process() { if (Phpfox::getParam('core.phpfox_is_hosted')) { $this->url()->send('admincp'); } if ($aVals = $this->request()->getArray('val')) { if (Phpfox::getService('theme.template.process')->add($aVals)) { $this->url()->send('admincp.theme.template.add', null, Phpfox::getPhrase('theme.template_successfully_added')); } } if (Phpfox::getParam('core.enabled_edit_area')) { $this->template()->setHeader(array('editarea/edit_area_full.js' => 'static_script', '<script type="text/javascript"> editAreaLoader.init({ id: "js_template_content" ,start_highlight: true ,allow_resize: "both" ,allow_toggle: false ,word_wrap: false ,language: "en" ,syntax: "html" }); </script>')); } $this->template()->setTitle(Phpfox::getPhrase('theme.create_a_new_template'))->setBreadcrumb(Phpfox::getPhrase('theme.create_new_template'))->assign(array('aThemes' => Theme_Service_Theme::instance()->get(), 'aModules' => Phpfox_Module::instance()->getModules())); }
/** * Controller */ public function process() { $bIsEdit = false; if ($iId = $this->request()->getInt('id')) { if ($aStyle = Theme_Service_Style_Style::instance()->getForEdit($iId)) { $bIsEdit = true; $this->template()->assign(array('aForms' => $aStyle)); } } $this->template()->setTitle($bIsEdit ? Phpfox::getPhrase('theme.editing_style') . ': ' . $aStyle['name'] : Phpfox::getPhrase('theme.create_new_style'))->setBreadcrumb(Phpfox::getPhrase('theme.themes'), $this->url()->makeUrl('admincp.theme')); if ($aVals = $this->request()->getArray('val')) { if ($bIsEdit) { if (Theme_Service_Style_Process::instance()->updateStyle($aStyle['style_id'], $aVals)) { $this->url()->send('admincp.theme.style.add', array('id' => $aStyle['style_id']), Phpfox::getPhrase('theme.style_successfully_updated')); } } else { if (Theme_Service_Style_Process::instance()->addStyle($aVals)) { $this->url()->send('admincp.theme.style.add', null, Phpfox::getPhrase('theme.style_successfully_added')); } } } if ($iThemeId = $this->request()->getInt('theme')) { if ($aTheme = Theme_Service_Theme::instance()->getTheme($iThemeId)) { $this->template()->setBreadcrumb($aTheme['name'], $this->url()->makeUrl('admincp.theme'))->assign(array('aForms' => array('theme_id' => $aTheme['theme_id']))); } } $this->template()->setBreadcrumb($bIsEdit ? Phpfox::getPhrase('theme.editing_style') . ': ' . $aStyle['name'] : Phpfox::getPhrase('theme.create_style'), null, true)->assign(array('bIsEdit' => $bIsEdit, 'aStyles' => Theme_Service_Style_Style::instance()->get(), 'aThemes' => Theme_Service_Theme::instance()->get())); }
/** * Shows the block to add an existing block to the current controller * by letting the user drag and drop it where he wants it * This feature requires user group permission core.can_design_dnd */ public function addBlockDnD() { if (Theme_Service_Theme::instance()->isInDnDMode() == false) { return $this->alert(Phpfox::getPhrase('theme.please_enable_designdnd_first')); } $this->setTitle(Phpfox::getPhrase('theme.add_new_block')); Phpfox::getBlock('theme.addBlockDnD', array()); }
/** * Controller */ public function process() { $aPage = $this->getParam('aPage'); list($iTotalMembers, $aMembers) = Phpfox::getService('pages')->getMembers($aPage['page_id'], 12); $this->template()->assign(array('sHeader' => '<a href="#" onclick="return $Core.box(\'like.browse\', 400, \'type_id=pages&item_id=' . $aPage['page_id'] . '' . ($aPage['page_type'] != '1' ? '&force_like=1' : '') . '\');">' . ($aPage['page_type'] == '1' ? Phpfox::getPhrase('pages.members_total', array('total' => $iTotalMembers)) : $iTotalMembers . ' Followers') . '</a>', 'aMembers' => $aMembers)); if (!PHPFOX_IS_AJAX || defined("PHPFOX_IN_DESIGN_MODE") || Theme_Service_Theme::instance()->isInDndMode()) { return 'block'; } }
public function get($aCond = array()) { $aRows = $this->database()->select('*')->from($this->_sTable)->where($aCond)->execute('getRows'); $aDefaultTheme = Theme_Service_Theme::instance()->getTheme('default', true); $aDefaultStyle = Theme_Service_Style_Style::instance()->getStyleParent($aDefaultTheme['theme_id'], 'default'); foreach ($aRows as $iKey => $aRow) { $aRows[$iKey]['is_default_style'] = isset($aDefaultStyle['style_id']) && $aDefaultStyle['style_id'] == $aRow['style_id'] ? true : false; } return $aRows; }
/** * Controller */ public function process() { $aWidgetBlocks = Phpfox::getService('pages')->getWidgetBlocks(); if (!count($aWidgetBlocks)) { return false; } $this->template()->assign(array('aWidgetBlocks' => $aWidgetBlocks)); if (defined("PHPFOX_IN_DESIGN_MODE") || Theme_Service_Theme::instance()->isInDndMode()) { return 'block'; } }
/** * Controller */ public function process() { $aTheme = Theme_Service_Theme::instance()->getTheme($this->request()->getInt('theme')); if (!isset($aTheme['theme_id'])) { return Phpfox_Error::display(Phpfox::getPhrase('theme.theme_is_not_valid')); } $oArchiveExport = Phpfox::getLib('archive.export')->set(array('zip')); if ($aVals = $this->request()->get('val')) { if ($aData = Theme_Service_Theme::instance()->export($aVals)) { $oArchiveExport->download('phpfox-theme-' . $aData['name'] . '', 'zip', $aData['folder']); } } $this->template()->setTitle(Phpfox::getPhrase('theme.export_theme'))->setBreadcrumb(Phpfox::getPhrase('theme.themes'), $this->url()->makeUrl('admincp.theme'))->setBreadCrumb(Phpfox::getPhrase('theme.export_theme'), $this->url()->makeUrl('current'))->setBreadcrumb($aTheme['name'], null, true)->assign(array('aStyles' => Theme_Service_Style_Style::instance()->get(array('theme_id = ' . $aTheme['theme_id'])), 'aTheme' => $aTheme)); }
/** * Controller */ public function process() { $this->_setMenuName('admincp.theme'); $iId = $this->request()->getInt('id'); $aTheme = Theme_Service_Theme::instance()->getTheme($iId); if (!isset($aTheme['theme_id'])) { return Phpfox_Error::display(Phpfox::getPhrase('theme.not_a_valid_theme')); } if ($iDeleteId = $this->request()->getInt('delete')) { if (Theme_Service_Style_Process::instance()->delete($iDeleteId)) { $this->url()->send('admincp.theme.style', array('id' => $aTheme['theme_id']), Phpfox::getPhrase('theme.style_successfully_deleted')); } } $this->template()->setTitle(Phpfox::getPhrase('theme.managing_styles_for') . ': ' . $aTheme['name'])->setBreadcrumb(Phpfox::getPhrase('theme.themes'), $this->url()->makeUrl('admincp.theme'))->setBreadcrumb($aTheme['name'], $this->url()->makeUrl('admincp.theme'))->setBreadcrumb(Phpfox::getPhrase('theme.styles'), null, true)->assign(array('aStyles' => Theme_Service_Style_Style::instance()->get('theme_id = ' . $this->request()->getInt('id')), 'aTheme' => $aTheme)); }
/** * Controller */ public function process() { $iId = $this->request()->getInt('id'); $aTheme = Theme_Service_Theme::instance()->getTheme($iId); if (Phpfox::getParam('core.enabled_edit_area')) { $this->template()->setHeader(array('editarea/edit_area_full.js' => 'static_script', '<script type="text/javascript"> editAreaLoader.init({ id: "js_template_content" ,start_highlight: true ,allow_resize: "both" ,allow_toggle: false ,word_wrap: false ,language: "en" ,syntax: "html" ,plugins: "phpfox" }); </script>')); } $this->template()->setTitle(Phpfox::getPhrase('theme.themes'))->setTitle(Phpfox::getPhrase('theme.templates'))->setTitle($aTheme['name'])->setBreadcrumb(Phpfox::getPhrase('theme.themes'), $this->url()->makeUrl('admincp.theme'))->setBreadcrumb($aTheme['name'], $this->url()->makeUrl('admincp.theme'))->setBreadcrumb(Phpfox::getPhrase('theme.templates'), null, true)->setHeader('cache', array('template.js' => 'module_theme', 'template.css' => 'style_css', 'jquery/plugin/jquery.scrollTo.js' => 'static_script', 'jquery/plugin/jquery.highlightFade.js' => 'static_script'))->assign(array('aTemplates' => Phpfox::getService('theme.template')->get($aTheme['folder']), 'aTheme' => $aTheme, 'aProducts' => Admincp_Service_Product_Product::instance()->get())); }
public function installThemeFromFolder($sTheme, $mForce = false) { if (!$mForce) { $sDir = PHPFOX_DIR_THEME . 'frontend' . PHPFOX_DS . $sTheme . PHPFOX_DS; if (!file_exists($sDir . 'phpfox.xml')) { return Phpfox_Error::set('Not a valid theme to install.'); } } $iInstalled = (int) $this->database()->select('COUNT(*)')->from(Phpfox::getT('theme'))->where('folder = \'' . $this->database()->escape($sTheme) . '\'')->execute('getField'); if ($iInstalled) { return Phpfox_Error::set('This theme is already installed.'); } $aParams = Phpfox::getLib('xml.parser')->parse(file_get_contents($mForce ? PHPFOX_DIR_CACHE . $mForce . PHPFOX_DS . 'upload/theme/frontend/' . $sTheme . '/phpfox.xml' : $sDir . 'phpfox.xml')); $aForm = array('name' => array('type' => 'string:required', 'message' => Phpfox::getPhrase('theme.theme_requires_a_name')), 'folder' => array('type' => 'string:required', 'message' => Phpfox::getPhrase('theme.theme_requires_a_folder_name')), 'created' => array('type' => 'int'), 'creator' => array('type' => 'string'), 'website' => array('type' => 'string'), 'version' => array('type' => 'string'), 'parent_id' => array('type' => 'string')); $aParams['parent_id'] = 0; if (!empty($aParams['parent'])) { $aParent = Theme_Service_Theme::instance()->getTheme($aParams['parent'], true); if (isset($aParent['theme_id'])) { $aParams['parent_id'] = $aParent['theme_id']; } } $aParams = $this->validator()->process($aForm, $aParams); if (!empty($aParams['creator'])) { $aParams['creator'] = $this->preParse()->clean($aParams['creator'], 255); } if (!Phpfox_Error::isPassed()) { return false; } $aParams['is_active'] = 1; $aParams['is_default'] = 0; $iId = $this->database()->insert(Phpfox::getT('theme'), $aParams); // I dont think we need to clear cache for profiles here, seems to be working fine without doing this -Purefan if ($mForce && Phpfox::getParam('core.phpfox_is_hosted')) { $sStyleDir = PHPFOX_DIR_CACHE . $mForce . PHPFOX_DS . 'upload' . PHPFOX_DS . 'theme' . PHPFOX_DS . 'frontend' . PHPFOX_DS . $aParams['folder'] . PHPFOX_DS . 'style' . PHPFOX_DS; } else { $sStyleDir = PHPFOX_DIR_THEME . 'frontend' . PHPFOX_DS . $aParams['folder'] . PHPFOX_DS . 'style' . PHPFOX_DS; } $hDir = opendir($sStyleDir); while ($sFolder = readdir($hDir)) { if ($sFolder == '.' || $sFolder == '..') { continue; } if (!file_exists($sStyleDir . $sFolder . PHPFOX_DS . 'phpfox.xml')) { continue; } $iInstalled = (int) $this->database()->select('COUNT(*)')->from(Phpfox::getT('theme_style'))->where('theme_id = ' . (int) $iId . ' AND folder = \'' . $this->database()->escape($sFolder) . '\'')->execute('getField'); if (!$iInstalled) { Theme_Service_Style_Process::instance()->installStyleFromFolder($aParams['folder'], $sFolder, $mForce); } } closedir($hDir); if ($mForce && Phpfox::getParam('core.phpfox_is_hosted')) { $aFiles = Phpfox_File::instance()->getAllFiles(PHPFOX_DIR_CACHE . $mForce . PHPFOX_DS); $aCssContent = array(); foreach ($aFiles as $sFile) { if ($sFile == '.' || $sFile == '..' || empty($sFile)) { continue; } if (substr($sFile, -4) == '.css') { preg_match('/(.*)\\/style\\/(.*)\\/css\\/(.*)/i', $sFile, $aMatches); if (isset($aMatches[2])) { if (!isset($aCssContent[$aMatches[2]])) { $aCssContent[$aMatches[2]] = ''; } $aCssContent[$aMatches[2]] .= file_get_contents($sFile); } } elseif (substr($sFile, -9) == '.html.php') { $sTypeId = 'layout'; $sModuleId = null; $aNameParts = explode('/', $sFile); $sTemplateName = $aNameParts[count($aNameParts) - 1]; $sTemplateContent = file_get_contents($sFile); $this->database()->insert(Phpfox::getT('theme_template'), array('is_custom' => '1', 'folder' => $sTheme, 'type_id' => $sTypeId, 'product_id' => 'phpfox', 'module_id' => $sModuleId, 'name' => $sTemplateName, 'html_data' => $sTemplateContent, 'time_stamp' => PHPFOX_TIME)); } } if (!empty($sFile)) { foreach ($aCssContent as $sStyleName => $sStyleContent) { $this->_sStyleDir = $sStyleDir . $sStyleName; $sStyleContent = preg_replace_callback('/url\\((.*)\\)/i', array($this, 'replaceCdnImages'), $sStyleContent); $iStyleId = $this->database()->select('style_id')->from(Phpfox::getT('theme_style'))->where('folder = \'' . $this->database()->escape($sStyleName) . '\'')->execute('getSlaveField'); if ($iStyleId) { $sName = md5(PHPFOX_IS_HOSTED_SCRIPT . uniqid()) . '.css'; $sTempFile = PHPFOX_DIR_CACHE . $sName; $hFile = fopen($sTempFile, 'w+'); fwrite($hFile, $sStyleContent); fclose($hFile); Phpfox::getLib('cdn')->put($sTempFile, 'file/static/' . $sName); unlink($sTempFile); $this->database()->delete(Phpfox::getT('theme_css'), 'style_id = ' . (int) $iStyleId); $this->database()->insert(Phpfox::getT('theme_css'), array('module_id' => null, 'product_id' => null, 'style_id' => $iStyleId, 'file_name' => 'custom.css', 'css_data' => $sStyleContent, 'css_data_original' => $sName, 'full_name' => null, 'time_stamp' => PHPFOX_TIME)); } } } Phpfox_File::instance()->delete_directory(PHPFOX_DIR_CACHE . $mForce . PHPFOX_DS); } return $iId; }
/** * Sets the cache blocks data. * * @param array $aCacheBlockData ARRAY of information to cache. */ public function setCacheBlockData($aCacheBlockData) { if (Theme_Service_Theme::instance()->isInDnDMode()) { return; } if (!isset($this->_aModuleBlocks[$aCacheBlockData['controller']])) { return; } if (Phpfox::getParam('profile.cache_blocks_design')) { $sCacheTable = 'user_design'; $oCache = Phpfox::getLib('cache'); if ($aCacheBlockData['table'] == 'pages_design_order') { $sCacheTable = 'pages_design'; } else { if ($aCacheBlockData['table'] == 'user_dashboard') { $sCacheTable = 'user_dashboard'; } } $sCacheId = $oCache->set(array($sCacheTable, $aCacheBlockData['item_id'])); if ($aCache = $oCache->get($sCacheId)) { if (!is_array($aCache)) { $aCache = array(); } $aCustomOrder = $aCache; } } if (!isset($aCustomOrder)) { $aCustomOrder = Phpfox_Database::instance()->select('*')->from(Phpfox::getT($aCacheBlockData['table']))->where($aCacheBlockData['field'] . ' = ' . $aCacheBlockData['item_id'])->order('ordering ASC')->execute('getSlaveRows'); if (Phpfox::getParam('profile.cache_blocks_design') && isset($sCacheTable)) { $sCacheId = $oCache->set(array($sCacheTable, $aCacheBlockData['item_id'])); $oCache->save($sCacheId, $aCustomOrder); } } $aNewVar = $this->_aModuleBlocks[$aCacheBlockData['controller']]; $aNewestVar = array(); $aTemp = array(); foreach ($aNewVar as $iLocation => $aBlocks) { if ($iLocation > 3) { continue; } foreach ($aBlocks as $sName => $aBlock) { $aNewestVar[] = $sName; $aTemp[$sName] = $iLocation; } } if (count($aCustomOrder)) { $this->_aModuleBlocks[$aCacheBlockData['controller']][1] = array(); $this->_aModuleBlocks[$aCacheBlockData['controller']][2] = array(); $this->_aModuleBlocks[$aCacheBlockData['controller']][3] = array(); } foreach ($aCustomOrder as $iKey => $aBlock) { $sBlockName = str_replace('js_block_border_', '', $aBlock['cache_id']); $sBlockName = str_replace('_', '.', $sBlockName); if (preg_match('/custom\\.cf\\.(.*)/i', $sBlockName, $aMatches) && isset($aMatches[1])) { $sBlockName = 'custom.cf_' . str_replace('.', '_', $aMatches[1]); } if (empty($aBlock['block_id']) && isset($aTemp[$sBlockName])) { $aBlock['block_id'] = $aTemp[$sBlockName]; } if ($aBlock['is_hidden'] != 1) { if (!in_array($sBlockName, $aNewestVar)) { continue; } $this->_aModuleBlocks[$aCacheBlockData['controller']][$aBlock['block_id']][$sBlockName] = ''; } foreach ($aNewestVar as $iSub => $sBlock) { if ($sBlock == $sBlockName) { unset($aNewestVar[$iSub]); break; } } } foreach ($aNewestVar as $sBlockName) { $this->_aModuleBlocks[$aCacheBlockData['controller']][$aTemp[$sBlockName]][$sBlockName] = ''; } }
public function installStyleFromFolder($sTheme, $sStyle, $mForce = false) { if ($mForce && Phpfox::getParam('core.phpfox_is_hosted')) { $sDir = PHPFOX_DIR_CACHE . $mForce . PHPFOX_DS . 'upload' . PHPFOX_DS . 'theme' . PHPFOX_DS . 'frontend' . PHPFOX_DS . $sTheme . PHPFOX_DS . 'style' . PHPFOX_DS . $sStyle . PHPFOX_DS; } else { $sDir = PHPFOX_DIR_THEME . 'frontend' . PHPFOX_DS . $sTheme . PHPFOX_DS . 'style' . PHPFOX_DS . $sStyle . PHPFOX_DS; } if (!file_exists($sDir . 'phpfox.xml')) { return Phpfox_Error::set('Not a valid theme to install.'); } $aParams = Phpfox::getLib('xml.parser')->parse(file_get_contents($sDir . 'phpfox.xml')); $aForm = array('name' => array('type' => 'string:required', 'message' => Phpfox::getPhrase('theme.style_requires_a_name')), 'folder' => array('type' => 'string:required', 'message' => Phpfox::getPhrase('theme.style_requires_a_folder_name')), 'theme_id' => array('type' => 'int:required', 'message' => Phpfox::getPhrase('theme.select_a_parent_theme_for_this_style')), 'parent_id' => array('type' => 'int'), 'created' => array('type' => 'int'), 'creator' => array('type' => 'string'), 'website' => array('type' => 'string'), 'version' => array('type' => 'string'), 'logo_image' => array('type' => 'string:required', 'message' => Phpfox::getPhrase('theme.provide_a_default_logo_name'))); $aTheme = Theme_Service_Theme::instance()->getTheme($sTheme, true); $aParams['theme_id'] = isset($aTheme['theme_id']) ? $aTheme['theme_id'] : 0; $aParams['parent_id'] = 0; if (!empty($aParams['parent_style'])) { $aStyleParentParts = explode('::', $aParams['parent_style']); $aTheme = Theme_Service_Theme::instance()->getTheme($aStyleParentParts[0], true); if (isset($aTheme['theme_id'])) { $aStyleParent = Theme_Service_Style_Style::instance()->getStyleParent($aTheme['theme_id'], $aStyleParentParts[1]); if (isset($aStyleParent['style_id'])) { $aParams['parent_id'] = $aStyleParent['style_id']; } } } $aParams = $this->validator()->process($aForm, $aParams); if (!Phpfox_Error::isPassed()) { return false; } $aParams['is_active'] = 1; $aParams['is_default'] = 0; $iId = $this->database()->insert(Phpfox::getT('theme_style'), $aParams); return $iId; }
/** * 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>')); } } }
/** * This function removes a block when in DnD mode */ public function removeBlockDnD() { if (!Theme_Service_Theme::instance()->isInDnDMode()) { return $this->alert(Phpfox::getPhrase('friend.you_must_enable_dnd_mode')); } if (Phpfox::getService('theme.process')->removeBlockDnD($this->get('sController'), $this->get('block_id'))) { $this->softNotice(Phpfox::getPhrase('friend.block_was_deleted')); } else { $this->alert(Phpfox::getPhrase('friend.cant_delete_it')); } }