/** * Controller */ public function process() { list($aGroups, $aModules, $aProductGroups) = Phpfox::getService('admincp.setting.group')->get(); $aCond = array(); $aUrl = array(); $sSettingTitle = ''; if ($sSettingId = $this->request()->get('setting-id')) { $aCond[] = " AND setting.setting_id = " . (int) $sSettingId; $aUrl = array('setting', 'edit', 'setting-id' => $sSettingId); } if ($sGroupId = $this->request()->get('group-id')) { $aCond[] = " AND setting.group_id = '" . Phpfox_Database::instance()->escape($sGroupId) . "' AND setting.is_hidden = 0 "; $aUrl = array('setting', 'edit', 'group-id' => $sGroupId); foreach ($aGroups as $aGroup) { if ($aGroup['group_id'] == $sGroupId) { $sSettingTitle = $aGroup['var_name']; break; } } } if ($iModuleId = $this->request()->get('module-id')) { $aCond[] = " AND setting.module_id = '" . Phpfox_Database::instance()->escape($iModuleId) . "' AND setting.is_hidden = 0 "; $aUrl = array('setting', 'edit', 'module-id' => $iModuleId); foreach ($aModules as $aModule) { if ($aModule['module_id'] == $iModuleId) { $sSettingTitle = $aModule['module_id']; break; } } } if ($sProductId = $this->request()->get('product-id')) { $aCond[] = " AND setting.product_id = '" . Phpfox_Database::instance()->escape($sProductId) . "' AND setting.is_hidden = 0 "; $aUrl = array('setting', 'edit', 'product-id' => $sProductId); foreach ($aProductGroups as $aProduct) { if ($aProduct['product_id'] == $sProductId) { $sSettingTitle = $aProduct['var_name']; break; } } } $aSettings = Phpfox::getService('admincp.setting')->get($aCond); if ($aVals = $this->request()->getArray('val')) { if (Phpfox::getService('admincp.setting.process')->update($aVals)) { // $this->url()->send('admincp', $aUrl, Phpfox::getPhrase('admincp.updated')); return ['updated' => true]; } } $sWatermarkImage = Phpfox::getParam('core.url_watermark') . sprintf(Phpfox::getParam('core.watermark_image'), '') . '?v=' . uniqid(); if (!file_exists(Phpfox::getParam('core.dir_watermark') . sprintf(Phpfox::getParam('core.watermark_image'), '')) && Phpfox::getParam('core.allow_cdn')) { $sWatermarkImage = Phpfox::getLib('cdn')->getUrl(str_replace(PHPFOX_DIR, '', $sWatermarkImage)); } if (Phpfox::isModule($sSettingTitle)) { $sSettingTitle = Phpfox_Locale::instance()->translate($sSettingTitle, 'module'); } $this->template()->setSectionTitle($sSettingTitle); $this->template()->setBreadCrumb(Phpfox::getPhrase('admincp.manage_settings'), $this->url()->makeUrl('admincp.setting'))->setBreadCrumb(Phpfox::getPhraseT($sSettingTitle, 'module'), null, true)->setTitle(Phpfox::getPhrase('admincp.manage_settings'))->assign(array('aGroups' => $aGroups, 'aModules' => $aModules, 'aProductGroups' => $aProductGroups, 'aSettings' => $aSettings, 'sSettingTitle' => $sSettingTitle, 'sWatermarkImage' => $sWatermarkImage)); ($sPlugin = Phpfox_Plugin::get('admincp.component_controller_setting_edit_process')) ? eval($sPlugin) : false; }
/** * Class process method wnich is used to execute this component. */ public function process() { $oUser = Phpfox::getService('user'); $aUser = $oUser->getByUserName($this->request()->get('user_name')); $bIsPage = $aUser['profile_page_id'] > 0 ? true : false; if ($bIsPage) { $aUser['page'] = Phpfox::getService('pages')->getPage($aUser['profile_page_id']); // list($iTotalMembers, $aMembers) = Phpfox::getService('pages')->getMembers($aUser['page']['page_id']); // $aUser['page_members'] = $aMembers; } $aUser['birthday_time_stamp'] = $aUser['birthday']; $aUser['birthday'] = $oUser->age($aUser['birthday']); $aUser['gender_name'] = $oUser->gender($aUser['gender']); $aUser['birthdate_display'] = $oUser->getProfileBirthDate($aUser); $aUser['location'] = Phpfox::getPhraseT(Phpfox::getService('core.country')->getCountry($aUser['country_iso']), 'country'); if (isset($aUser['country_child_id']) && $aUser['country_child_id'] > 0) { $aUser['location_child'] = Phpfox::getService('core.country')->getChild($aUser['country_child_id']); } $aUser['is_friend'] = false; $iTotal = 0; $aMutual = array(); if ($aUser['user_id'] != Phpfox::getUserId() && !$bIsPage) { if (Phpfox::isUser() && Phpfox::isModule('friend')) { $aUser['is_friend'] = Phpfox::getService('friend')->isFriend(Phpfox::getUserId(), $aUser['user_id']); if (!$aUser['is_friend']) { $aUser['is_friend'] = Phpfox::getService('friend.request')->isRequested(Phpfox::getUserId(), $aUser['user_id']) ? 2 : false; } } list($iTotal, $aMutual) = Phpfox::getService('friend')->getMutualFriends($aUser['user_id'], 4); } $bShowBDayInput = false; if (!empty($aUser['birthday'])) { $iDays = Phpfox::getLib('date')->daysToDate($aUser['birthday'], null, false); } else { $iDays = 999; } if ($iDays < 1 && $iDays > 0) { $bShowBDayInput = true; } if (empty($aUser['dob_setting'])) { switch (Phpfox::getParam('user.default_privacy_brithdate')) { case 'month_day': $aUser['dob_setting'] = '1'; break; case 'show_age': $aUser['dob_setting'] = '2'; break; case 'hide': $aUser['dob_setting'] = '3'; break; } } ($sPlugin = Phpfox_Plugin::get('user.component_block_tooltip_1')) ? eval($sPlugin) : false; $this->template()->assign(array('bIsPage' => $bIsPage, 'aUser' => $aUser, 'iMutualTotal' => $iTotal, 'aMutualFriends' => $aMutual, 'bShowBDay' => $bShowBDayInput)); }
public function getChild($iChildId) { static $bIsChecked = false; if ($bIsChecked === false) { $sCacheId = $this->cache()->set('country_child_' . Phpfox_Locale::instance()->getLangId()); if (!($this->_aChildren = $this->cache()->get($sCacheId))) { $aRows = $this->database()->select('child_id, name')->from(Phpfox::getT('country_child'))->execute('getRows'); foreach ($aRows as $aRow) { $this->_aChildren[$aRow['child_id']] = Phpfox_Locale::instance()->isPhrase('core.translate_country_child_' . strtolower($aRow['child_id'])) ? Phpfox::getPhrase('core.translate_country_child_' . strtolower($aRow['child_id'])) : $aRow['name']; } $this->cache()->save($sCacheId, $this->_aChildren); } $bIsChecked = true; } return isset($this->_aChildren[$iChildId]) ? Phpfox::getPhraseT($this->_aChildren[$iChildId], 'country_child') : ''; }
/** * Controller */ public function process() { $aUser = Phpfox::getService('user')->get($this->request()->get('req1'), false); if (!isset($aUser['user_id'])) { return Phpfox_Module::instance()->setController('error.404'); } define('PHPFOX_IS_USER_PROFILE', true); $sImage = Phpfox::getLib('image.helper')->display(array_merge(array('user' => Phpfox::getService('user')->getUserFields(true, $aUser)), array('title' => $aUser['full_name'], 'path' => 'core.url_user', 'file' => $aUser['user_image'], 'suffix' => '_120', 'max_width' => 120, 'max_height' => 120, 'no_default' => Phpfox::getUserId() == $aUser['user_id'] ? false : true, 'no_link' => true))); $oUser = Phpfox::getService('user'); $aUser['gender_name'] = $oUser->gender($aUser['gender']); $aUser['birthday_time_stamp'] = $aUser['birthday']; $aUser['birthday'] = $oUser->age($aUser['birthday']); $aUser['location'] = Phpfox::getPhraseT(Phpfox::getService('core.country')->getCountry($aUser['country_iso']), 'country'); if (isset($aUser['country_child_id']) && $aUser['country_child_id'] > 0) { $aUser['location_child'] = Phpfox::getService('core.country')->getChild($aUser['country_child_id']); } $this->setParam('aUser', $aUser); $this->template()->setMobileHeader(array('profile.css' => 'style_css')); if (!Phpfox::getService('user.privacy')->hasAccess($aUser['user_id'], 'profile.view_profile')) { return Phpfox_Module::instance()->setController('profile.private'); } Phpfox::getUserParam('profile.can_view_users_profile', true); $aProfileMenu = array($this->url()->makeUrl($aUser['user_name']) => Phpfox::getPhrase('profile.wall')); if (Phpfox::getService('user.privacy')->hasAccess($aUser['user_id'], 'profile.basic_info')) { $aProfileMenu[$this->url()->makeUrl($aUser['user_name'], 'info')] = Phpfox::getPhrase('profile.info'); } $this->template()->assign(array('aUser' => $aUser, 'sProfileImage' => $sImage, 'bMobileProfileIsActive' => true, 'aMobileSubMenus' => $aProfileMenu, 'sActiveMobileSubMenu' => $this->url()->makeUrl($aUser['user_name'], $this->request()->get('req2') == '' ? null : $this->request()->get('req2')))); if ($this->request()->get('req2') == 'info') { return Phpfox_Module::instance()->setController('profile.info-mobile'); } if ($aVals = $this->request()->getArray('val')) { Phpfox::isUser(true); if (isset($aVals['status'])) { if (!empty($aVals['status'])) { if ($iId = Phpfox::getService('user.process')->updateStatus(Phpfox::getUserId(), $aVals['status'])) { $this->url()->send($aUser['user_name']); } } } else { Phpfox::getUserParam('comment.can_post_comments', true); if (!Phpfox::getService('user.privacy')->hasAccess($aVals['item_id'], 'comment.add_comment')) { Phpfox_Error::set(Phpfox::getPhrase('feed.you_do_not_have_permission_to_add_a_comment_on_this_persons_profile')); } if (($iFlood = Phpfox::getUserParam('comment.comment_post_flood_control')) !== 0) { $aFlood = array('action' => 'last_post', 'params' => array('field' => 'time_stamp', 'table' => Phpfox::getT('feed'), 'condition' => 'type_id = \'comment_profile_my\' AND user_id = ' . Phpfox::getUserId(), 'time_stamp' => $iFlood * 60)); // actually check if flooding if (Phpfox::getLib('spam')->check($aFlood)) { Phpfox_Error::set(Phpfox::getPhrase('feed.posting_a_comment_a_little_too_soon') . ' ' . Phpfox::getLib('spam')->getWaitTime()); } } if (Phpfox::getLib('parse.format')->isEmpty($aVals['feed_text'])) { Phpfox_Error::set(Phpfox::getPhrase('feed.add_some_text_to_your_comment')); } if (Phpfox_Error::isPassed() && ($iId = Phpfox::getService('feed.process')->addComment($aVals))) { $this->url()->send($aUser['user_name']); } } } $bHideFeedOnProfile = false; if (Phpfox::isModule('feed')) { $iFeedPage = $this->request()->get('page', 1); list($iFeedCount, $aFeeds) = Feed_Service_Feed::instance()->get($aUser['user_id'], null, $iFeedPage); if (!Phpfox::getService('user.privacy')->hasAccess($aUser['user_id'], 'feed.display_on_profile')) { $iFeedCount = 0; $aFeeds = array(); $bHideFeedOnProfile = true; } $iTotalFeeds = (int) Phpfox::getComponentSetting(Phpfox::getUserId(), 'feed.feed_display_limit_dashboard', Phpfox::getParam('feed.feed_display_limit')); Phpfox_Pager::instance()->set(array('page' => $iFeedPage, 'size' => $iTotalFeeds, 'count' => $iFeedCount)); $this->template()->setMobileHeader(array('feed.css' => 'module_feed'))->assign(array('aFeeds' => $aFeeds)); } $this->template()->assign(array('bHideFeedOnProfile' => $bHideFeedOnProfile)); }
/** * Class process method wnich is used to execute this component. */ 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::getLib('module')->setController('pages.view'); } return Phpfox::getLib('module')->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'] = Phpfox::getParam('profile.profile_default_landing_page'); } $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' => Phpfox::getService('profile')->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::getLib('module')->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', Phpfox::getService('theme')->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::getLib('module')->setController('profile.private'); } if ($bIsSubSection === true) { $this->template()->setUrl(Phpfox::callback($sSection . '.getProfileLink')); return Phpfox::getLib('module')->setController($sSection . '.profile'); } if (!Phpfox::getService('user.privacy')->hasAccess($aRow['user_id'], 'profile.view_profile')) { return Phpfox::getLib('module')->setController('profile.private'); } Phpfox::getService('profile')->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::getLib('module')->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::getLib('module')->setController('profile.info'); } } $sPageTitle = Phpfox::getService('profile')->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 = Phpfox::getService('link')->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', 'player/flowplayer/flowplayer.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::getLib('template')->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' => Phpfox::getService('theme')->getCssCode(array('table_code' => 'user_css_code', 'field' => 'user_id', 'value' => $aRow['user_id']))); $this->setParam('aDesigner', $aDesigner); ($sCmd = Phpfox::getLib('template')->getXml('design_css')) ? eval($sCmd) : null; if (isset($aAdvanced)) { Phpfox::getService('theme')->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>')); } } if ($sSection != 'designer' && $sSection != 'design' && Phpfox::isModule('music') && (Phpfox::getUserGroupParam($aRow['user_group_id'], 'music.can_upload_music_public') || $aRow['total_profile_song'])) { $this->template()->setHeader(array('player/' . Phpfox::getParam('core.default_music_player') . '/core.js' => 'static_script', '<script type="text/javascript">$Behavior.profile_index_load_player = function() { $Core.player.load({id: \'js_music_player\', type: \'music\'}); $Core.player.load({id: \'js_music_favorite_player\', type: \'music\'}); };</script>')); } if (Phpfox::getParam('video.convert_servers_enable')) { $this->template()->setHeader('<script type="text/javascript">document.domain = "' . Phpfox::getParam('video.convert_js_parent') . '";</script>'); } }
/** * Class process method wnich is used to execute this component. */ public function process() { // $aUser = (PHPFOX_IS_AJAX ? Phpfox::getService('user')->get(Phpfox::getUserId(), true) : $this->getParam('aUser')); $aUser = $this->getParam('aUser'); /* if (PHPFOX_IS_AJAX) { $aUser['gender_name'] = Phpfox::getService('user')->gender($aUser['gender']); $aUser['birthday_time_stamp'] = $aUser['birthday']; $aUser['birthday'] = Phpfox::getService('user')->age($aUser['birthday']); $aUser['location'] = Phpfox::getService('core.country')->getCountry($aUser['country_iso']); $this->template()->assign('aUser', $aUser); } */ if (!Phpfox::getService('user.privacy')->hasAccess($aUser['user_id'], 'profile.basic_info')) { return false; } $aUser['bRelationshipHeader'] = true; $sRelationship = Phpfox::getService('custom')->getRelationshipPhrase($aUser); $aUserDetails = array(); if (!empty($aUser['gender'])) { $aUserDetails[Phpfox::getPhrase('profile.gender')] = '<a href="' . $this->url()->makeUrl('user.browse', array('gender' => $aUser['gender'])) . '">' . $aUser['gender_name'] . '</a>'; } $aUserDetails = array_merge($aUserDetails, $aUser['birthdate_display']); $sExtraLocation = ''; if (!empty($aUser['city_location'])) { $sExtraLocation .= '<div class="p_2"><a href="' . $this->url()->makeUrl('user.browse', array('location' => $aUser['country_iso'], 'state' => $aUser['country_child_id'], 'city-name' => $aUser['city_location'])) . '">' . Phpfox::getLib('parse.output')->clean($aUser['city_location']) . '</a> »</div>'; } if ($aUser['country_child_id'] > 0) { $sExtraLocation .= '<div class="p_2"><a href="' . $this->url()->makeUrl('user.browse', array('location' => $aUser['country_iso'], 'state' => $aUser['country_child_id'])) . '">' . Phpfox::getService('core.country')->getChild($aUser['country_child_id']) . '</a> »</div>'; } if (!empty($aUser['country_iso'])) { $aUserDetails[Phpfox::getPhrase('profile.location')] = $sExtraLocation . '<a href="' . $this->url()->makeUrl('user.browse', array('location' => $aUser['country_iso'])) . '">' . Phpfox::getPhraseT($aUser['location'], 'country') . '</a>'; } if ((int) $aUser['last_login'] > 0 && (!$aUser['is_invisible'] || Phpfox::getUserParam('user.can_view_if_a_user_is_invisible') && $aUser['is_invisible'])) { $aUserDetails[Phpfox::getPhrase('profile.last_login')] = Phpfox::getLib('date')->convertTime($aUser['last_login'], 'core.profile_time_stamps'); } if ((int) $aUser['joined'] > 0) { $aUserDetails[Phpfox::getPhrase('profile.member_since')] = Phpfox::getLib('date')->convertTime($aUser['joined'], 'core.profile_time_stamps'); } if (Phpfox::getUserGroupParam($aUser['user_group_id'], 'profile.display_membership_info')) { $aUserDetails[Phpfox::getPhrase('profile.membership')] = (empty($aUser['icon_ext']) ? '' : '<img src="' . Phpfox::getParam('core.url_icon') . $aUser['icon_ext'] . '" class="v_middle" alt="' . Phpfox::getLib('locale')->convert($aUser['title']) . '" title="' . Phpfox::getLib('locale')->convert($aUser['title']) . '" /> ') . $aUser['prefix'] . Phpfox::getLib('locale')->convert($aUser['title']) . $aUser['suffix']; } $aUserDetails[Phpfox::getPhrase('profile.profile_views')] = $aUser['total_view']; if (Phpfox::isModule('rss') && Phpfox::getParam('rss.display_rss_count_on_profile') && Phpfox::getService('user.privacy')->hasAccess($aUser['user_id'], 'rss.display_on_profile')) { $aUserDetails[Phpfox::getPhrase('profile.rss_subscribers')] = $aUser['rss_count']; } $sEditLink = ''; if ($aUser['user_id'] == Phpfox::getUserId()) { $sEditLink = '<div class="js_edit_header_bar">'; $sEditLink .= '<span id="js_user_basic_info" style="display:none;"><img src="' . $this->template()->getStyle('image', 'ajax/small.gif') . '" alt="" class="v_middle" /></span>'; $sEditLink .= '<a href="' . Phpfox::getLib('url')->makeUrl('user.profile') . '" id="js_user_basic_edit_link">'; $sEditLink .= '<img src="' . $this->template()->getStyle('image', 'misc/page_white_edit.png') . '" alt="" class="v_middle" />'; $sEditLink .= '</a>'; $sEditLink .= '</div>'; } // Get the Smoker and Drinker details $aUserPanel = Phpfox::getService('custom')->getUserPanelForUser($aUser['user_id']); foreach ($aUserPanel as $sName => $aField) { //$aUserDetails[Phpfox::getPhrase($aField['phrase_var_name'])] = Phpfox::getPhrase($aField['phrase_chosen']); } $this->template()->assign(array('aUserDetails' => $aUserDetails, 'sBlockJsId' => 'profile_basic_info', 'sRelationship' => $sRelationship)); $this->setParam('aRatingCallback', array('type' => 'user', 'total_rating' => Phpfox::getPhrase('profile.total_rating_ratings', array('total_rating' => $aUser['total_rating'])), 'default_rating' => $aUser['total_score'], 'item_id' => $aUser['user_id'], 'stars' => range(1, 10))); ($sPlugin = Phpfox_Plugin::get('profile.component_block_info')) ? eval($sPlugin) : false; if (!Phpfox::isMobile()) { $this->template()->assign(array('sHeader' => $sEditLink . Phpfox::getPhrase('profile.basic_info'), 'sEditLink' => $sEditLink)); return 'block'; } }
/** * Class process method wnich is used to execute this component. */ public function process() { $oUser = Phpfox::getService('user'); $aUser = $oUser->getByUserName($this->request()->get('user_name')); $bIsPage = ($aUser['profile_page_id'] > 0 ? true : false); if ($bIsPage) { $aUser['page'] = Phpfox::getService('pages')->getPage($aUser['profile_page_id']); // list($iTotalMembers, $aMembers) = Phpfox::getService('pages')->getMembers($aUser['page']['page_id']); // $aUser['page_members'] = $aMembers; } $aUser['birthday_time_stamp'] = $aUser['birthday']; $aUser['birthday'] = $oUser->age($aUser['birthday']); $aUser['gender_name'] = $oUser->gender($aUser['gender']); $aUser['birthdate_display'] = $oUser->getProfileBirthDate($aUser); $aUser['location'] = Phpfox::getPhraseT(Phpfox::getService('core.country')->getCountry($aUser['country_iso']), 'country'); if (isset($aUser['country_child_id']) && $aUser['country_child_id'] > 0) { $aUser['location_child'] = Phpfox::getService('core.country')->getChild($aUser['country_child_id']); } $aUser['is_friend'] = false; $iTotal = 0; $aMutual = array(); if ($aUser['user_id'] != Phpfox::getUserId() && !$bIsPage) { if (Phpfox::isUser() && Phpfox::isModule('friend')) { $aUser['is_friend'] = Phpfox::getService('friend')->isFriend(Phpfox::getUserId(), $aUser['user_id']); if (!$aUser['is_friend']) { $aUser['is_friend'] = (Phpfox::getService('friend.request')->isRequested(Phpfox::getUserId(), $aUser['user_id']) ? 2 : false); } } list($iTotal, $aMutual) = Phpfox::getService('friend')->getMutualFriends($aUser['user_id'], 4); } $bShowBDayInput = false; if (!empty($aUser['birthday'])) { $iDays = Phpfox::getLib('date')->daysToDate($aUser['birthday'], null, false); } else { $iDays = 999; } if ($iDays < 1 && $iDays > 0) { $bShowBDayInput = true; } $this->template()->assign(array( 'bIsPage' => $bIsPage, 'aUser' => $aUser, 'iMutualTotal' => $iTotal, 'aMutualFriends' => $aMutual, 'bShowBDay' => $bShowBDayInput ) ); }