本文整理汇总了PHP中Phpfox_Locale::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Phpfox_Locale::instance方法的具体用法?PHP Phpfox_Locale::instance怎么用?PHP Phpfox_Locale::instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phpfox_Locale
的用法示例。
在下文中一共展示了Phpfox_Locale::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setController
/**
* Sets the controller for the page we are on. This method controlls what component to load, which
* will be used to display the content on that page.
*
* @param string $sController (Optional) We find the controller by default, however you can override our default findings by passing the name of the controller with this argument.
*/
public function setController($sController = '')
{
if ($sController) {
$aParts = explode('.', $sController);
$this->_sModule = $aParts[0];
$this->_sController = substr_replace($sController, '', 0, strlen($this->_sModule . '_'));
($sPlugin = Phpfox_Plugin::get('set_defined_controller')) ? eval($sPlugin) : false;
$this->getController();
return null;
}
if ($View = (new Core\Route\Controller())->get()) {
return $View;
}
($sPlugin = Phpfox_Plugin::get('module_setcontroller_start')) ? eval($sPlugin) : false;
$oReq = Phpfox_Request::instance();
$oPage = Phpfox::getService('page');
$this->_sModule = ($sReq1 = $oReq->get('req1')) ? strtolower($sReq1) : Phpfox::getParam('core.module_core');
if (($sFrame = $oReq->get('frame')) && in_array($sFrame, $this->_aFrames)) {
$aFrameParts = explode('-', $sFrame);
$this->_sModule = strtolower($aFrameParts[0]);
$this->_sController = strtolower($aFrameParts[1]);
}
$this->_aPages = $oPage->getCache();
if (isset($this->_aPages[$oReq->get('req1')])) {
$this->_sModule = 'page';
$this->_sController = 'view';
}
$sDir = PHPFOX_DIR_MODULE . $this->_sModule . PHPFOX_DS;
if ($oReq->get('req2') == Phpfox::getParam('admincp.admin_cp')) {
Phpfox_Url::instance()->send($oReq->get('req2') . '.' . $oReq->get('req1'));
}
if ($oReq->get('req1') == 'admincp' && Phpfox::getParam('admincp.admin_cp') != 'admincp') {
Phpfox_Url::instance()->send('error.404');
}
if ($oReq->get('req2') && file_exists($sDir . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . strtolower($oReq->get('req2')) . '.class.php')) {
$this->_sController = strtolower($oReq->get('req2'));
} elseif (strtolower($this->_sModule) != Phpfox::getParam('admincp.admin_cp') && $oReq->get('req3') && file_exists($sDir . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . strtolower($oReq->get('req2')) . PHPFOX_DS . strtolower($oReq->get('req3')) . '.class.php')) {
$this->_sController = strtolower($oReq->get('req2') . '.' . $oReq->get('req3'));
} elseif (strtolower($this->_sModule) != Phpfox::getParam('admincp.admin_cp') && $oReq->get('req2') && file_exists($sDir . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . strtolower($oReq->get('req2')) . PHPFOX_DS . 'index.class.php')) {
$this->_sController = strtolower($oReq->get('req2')) . '.index';
} else {
// Over-ride the index page to display the content for guests or members
if ($this->_sModule == Phpfox::getParam('core.module_core') && $this->_sController == 'index' && Phpfox::getParam('core.module_core') == PHPFOX_MODULE_CORE) {
$this->_sController = Phpfox::isUser() ? 'index-member' : 'index-visitor';
}
if (!file_exists($sDir . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . $this->_sController . '.class.php')) {
$this->_sModule = 'profile';
}
($sPlugin = Phpfox_Plugin::get('set_controller_else_end')) ? eval($sPlugin) : false;
}
if ($this->_sModule == 'theme') {
if (preg_match('/^(.*?)\\.(jpg|jpeg|gif|png|css|js)$/i', $_GET[PHPFOX_GET_METHOD])) {
$this->_sModule = 'error';
$this->_sController = '404';
}
}
if ($this->_sModule != 'profile' && !isset($this->_aModules[$this->_sModule])) {
$this->_sModule = 'error';
$this->_sController = '404';
}
if (Phpfox::getParam('admincp.admin_cp') != 'admincp' && $oReq->get('req1') == Phpfox::getParam('admincp.admin_cp')) {
$this->_sModule = 'admincp';
}
/*
if (Phpfox::isUser() && Phpfox::getParam('core.is_auto_hosted') && Phpfox::getService('log.session')->getOnlineMembers() > Phpfox::getParam('core.phpfox_max_users_online'))
{
$this->_sModule = 'core';
$this->_sController = 'full';
}
*/
if ($oReq->segment(1) == 'hashtag') {
$this->_sModule = 'core';
$this->_sController = Phpfox::isUser() ? 'index-member' : 'index-visitor';
}
($sPlugin = Phpfox_Plugin::get('module_setcontroller_end')) ? eval($sPlugin) : false;
// Set the language pack cache
if (Phpfox::getParam('language.cache_phrases')) {
Phpfox_Locale::instance()->setCache();
}
$bCookie = Phpfox::getCookie('page_login') && Phpfox::getUserBy('profile_page_id') > 0;
if (Phpfox::isUser() && $bCookie != 1 && Phpfox::getUserParam('user.require_profile_image') && Phpfox::getUserBy('user_image') == '' && !($this->_sModule == 'user' && $this->_sController == 'photo' || $this->_sModule == 'user' && $this->_sController == 'logout' || $this->_sModule == 'subscribe')) {
Phpfox_Url::instance()->send('user.photo', null, Phpfox::getPhrase('user.you_are_required_to_upload_a_profile_image'));
}
if (Phpfox::getParam('core.force_https_secure_pages')) {
$sController = str_replace('mobile.', '', $this->getFullControllerName());
if ($sController == 'core.index-member' || $sController == 'core.index-visitor') {
// fixes 14276
$sController = '';
}
if (in_array(str_replace('mobile.', '', $this->getFullControllerName()), Phpfox::getService('core')->getSecurePages())) {
if (!isset($_SERVER['HTTPS'])) {
Phpfox_Url::instance()->send($sController);
}
} else {
//.........这里部分代码省略.........
示例2: all
/**
* @return App\Object[]
*/
public function all($includeModules = false)
{
$apps = [];
if ($includeModules) {
$modules = \Phpfox_Module::instance()->all();
$skip = ['friend', 'like', 'announcement', 'notification', 'poke', 'poll', 'quiz', 'egift', 'newsletter', 'subscribe', 'comment', 'captcha', 'attachment', 'admincp', 'api', 'apps', 'ban', 'core', 'custom', 'emoticon', 'error', 'favorite', 'help', 'im', 'input', 'invite', 'language', 'link', 'log', 'mobile', 'page', 'privacy', 'profile', 'rate', 'report', 'request', 'rss', 'search', 'share', 'tag', 'theme', 'track', 'user'];
foreach ($modules as $module_id) {
if (in_array($module_id, $skip)) {
continue;
}
$coreFile = PHPFOX_DIR_MODULE . $module_id . '/install/version/v3.phpfox';
// p($coreFile);
if ($includeModules == '__core') {
if (!file_exists($coreFile)) {
continue;
}
} else {
if ($includeModules == '__not_core' || $includeModules == '__remove_core') {
if (file_exists($coreFile)) {
continue;
}
}
}
$app = ['id' => '__module_' . $module_id, 'name' => \Phpfox_Locale::instance()->translate($module_id, 'module'), 'path' => null, 'is_module' => true];
$apps[] = new App\Object($app);
}
// exit;
if ($includeModules == '__core' || $includeModules == '__not_core') {
return $apps;
}
}
foreach ($this->_apps as $app) {
$apps[] = new App\Object($app);
}
return $apps;
}
示例3: process
/**
* Controller
*/
public function process()
{
$bIsUserProfile = $this->getParam('bIsProfile');
if ($bIsUserProfile) {
$aUser = $this->getParam('aUser');
}
Phpfox::getUserParam('pages.can_view_browse_pages', true);
if ($this->request()->getInt('req2') > 0) {
/*
Phpfox_Module::instance()->setCacheBlockData(array(
'table' => 'pages_design_order',
'field' => 'page_id',
'item_id' => $this->request()->getInt('req2'),
'controller' => 'pages.view'
)
);
*/
return Phpfox_Module::instance()->setController('pages.view');
}
if (($iDeleteId = $this->request()->getInt('delete')) && Phpfox::getService('pages.process')->delete($iDeleteId)) {
$this->url()->send('pages', array(), Phpfox::getPhrase('pages.page_successfully_deleted'));
}
$sView = $this->request()->get('view');
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');
}
}
if ($bIsProfile) {
$this->template()->setTitle(Phpfox::getPhrase('pages.full_name_s_pages', array('full_name' => $aUser['full_name'])))->setBreadcrumb(Phpfox::getPhrase('pages.pages'), $this->url()->makeUrl($aUser['user_name'], array('pages')));
} else {
$this->template()->setTitle(Phpfox::getPhrase('pages.pages'))->setBreadcrumb(Phpfox::getPhrase('pages.pages'), $this->url()->makeUrl('pages'));
}
$this->search()->set(array('type' => 'pages', 'field' => 'pages.page_id', 'search_tool' => array('table_alias' => 'pages', 'search' => array('action' => $bIsProfile === true ? $this->url()->makeUrl($aUser['user_name'], array('pages', 'view' => $this->request()->get('view'))) : $this->url()->makeUrl('pages', array('view' => $this->request()->get('view'))), 'default_value' => Phpfox::getPhrase('pages.search_pages'), 'name' => 'search', 'field' => 'pages.title'), 'sort' => array('latest' => array('pages.time_stamp', Phpfox::getPhrase('pages.latest')), 'most-liked' => array('pages.total_like', Phpfox::getPhrase('pages.most_liked'))), 'show' => array(10, 15, 20))));
$aBrowseParams = array('module_id' => 'pages', 'alias' => 'pages', 'field' => 'page_id', 'table' => Phpfox::getT('pages'), 'hide_view' => array('pending', 'my'));
$aFilterMenu = array();
if (!defined('PHPFOX_IS_USER_PROFILE')) {
$aFilterMenu = array(Phpfox::getPhrase('pages.all_pages') => '', Phpfox::getPhrase('pages.my_pages') => 'my');
if (!Phpfox::getParam('core.friends_only_community') && Phpfox::isModule('friend') && !Phpfox::getUserBy('profile_page_id')) {
$aFilterMenu[Phpfox::getPhrase('pages.friends_pages')] = 'friend';
}
if (Phpfox::getUserParam('pages.can_moderate_pages')) {
$iPendingTotal = Phpfox::getService('pages')->getPendingTotal();
if ($iPendingTotal) {
$aFilterMenu['' . Phpfox::getPhrase('pages.pending_pages') . '<span class="pending">' . $iPendingTotal . '</span>'] = 'pending';
}
}
}
switch ($sView) {
case 'my':
Phpfox::isUser(true);
$this->search()->setCondition('AND pages.app_id = 0 AND pages.view_id IN(0,1) AND pages.user_id = ' . Phpfox::getUserId());
break;
case 'pending':
Phpfox::isUser(true);
if (Phpfox::getUserParam('pages.can_moderate_pages')) {
$this->search()->setCondition('AND pages.app_id = 0 AND pages.view_id = 1');
}
break;
default:
if (Phpfox::getUserParam('privacy.can_view_all_items')) {
$this->search()->setCondition('AND pages.app_id = 0 ');
} else {
$this->search()->setCondition('AND pages.app_id = 0 AND pages.view_id = 0 AND pages.privacy IN(%PRIVACY%)');
}
break;
}
// $this->template()->buildSectionMenu('pages', $aFilterMenu);
$bIsValidCategory = false;
if ($this->request()->get('req2') == 'category' && ($iCategoryId = $this->request()->getInt('req3')) && ($aType = Phpfox::getService('pages.type')->getById($iCategoryId))) {
$bIsValidCategory = true;
$this->setParam('iCategory', $iCategoryId);
$this->template()->setBreadcrumb(Phpfox_Locale::instance()->convert($aType['name']), Phpfox::permalink('pages.category', $aType['type_id'], $aType['name']) . ($sView ? 'view_' . $sView . '/' . '' : ''), true);
}
if ($this->request()->get('req2') == 'sub-category' && ($iSubCategoryId = $this->request()->getInt('req3')) && ($aCategory = Phpfox::getService('pages.category')->getById($iSubCategoryId))) {
$bIsValidCategory = true;
$this->setParam('iCategory', $aCategory['type_id']);
$this->template()->setBreadcrumb(Phpfox_Locale::instance()->convert($aCategory['type_name']), Phpfox::permalink('pages.category', $aCategory['type_id'], $aCategory['type_name']) . ($sView ? 'view_' . $sView . '/' . '' : ''));
$this->template()->setBreadcrumb(Phpfox_Locale::instance()->convert($aCategory['name']), Phpfox::permalink('pages.sub-category', $aCategory['category_id'], $aCategory['name']) . ($sView ? 'view_' . $sView . '/' . '' : ''), true);
}
if (isset($aType['type_id'])) {
$this->search()->setCondition('AND pages.type_id = ' . (int) $aType['type_id']);
}
if (isset($aType['category_id'])) {
$this->search()->setCondition('AND pages.category_id = ' . (int) $aType['category_id']);
} elseif (isset($aCategory['category_id'])) {
$this->search()->setCondition('AND pages.category_id = ' . (int) $aCategory['category_id']);
}
if ($bIsUserProfile) {
$this->search()->setCondition('AND pages.user_id = ' . (int) $aUser['user_id']);
}
$aPages = [];
//.........这里部分代码省略.........
示例4: process
/**
* Controller
*/
public function process()
{
if (!($aPurchase = Phpfox::getService('subscribe.purchase')->getInvoice($this->request()->getInt('id')))) {
return Phpfox_Error::display(Phpfox::getPhrase('subscribe.unable_to_find_this_invoice'));
}
$this->template()->setTitle(Phpfox::getPhrase('subscribe.membership_packages'))->setBreadcrumb(Phpfox::getPhrase('subscribe.membership_packages'), $this->url()->makeUrl('subscribe'))->setBreadcrumb(Phpfox::getPhrase('subscribe.subscriptions'), $this->url()->makeUrl('subscribe.list'))->setBreadcrumb(Phpfox::getPhrase('subscribe.order_purchase_id_title', array('purchase_id' => $aPurchase['purchase_id'], 'title' => Phpfox_Locale::instance()->convert($aPurchase['title']))), null, true)->assign(array('aPurchase' => $aPurchase));
}
示例5: process
/**
* Controller
*/
public function process()
{
$aBanFilter = $this->getParam('aBanFilter');
if ($iDeleteId = $this->request()->getInt('delete')) {
if (Phpfox::getService('ban.process')->delete($iDeleteId)) {
$this->url()->send($aBanFilter['url'], null, Phpfox::getPhrase('ban.filter_successfully_deleted'));
}
}
if ($sBanValue = $this->request()->get('find_value')) {
$aBan = $this->request()->getArray('aBan');
$aVals = array_merge(array('type_id' => $aBanFilter['type'], 'find_value' => $sBanValue, 'replacement' => $this->request()->get('replacement', null)), $aBan);
if (Phpfox::getService('ban.process')->add($aVals, $aBanFilter)) {
$this->url()->send($aBanFilter['url'], null, Phpfox::getPhrase('ban.filter_successfully_added'));
}
}
$aFilters = Phpfox::getService('ban')->getFilters($aBanFilter['type']);
foreach ($aFilters as $iKey => $aFilter) {
$aFilters[$iKey]['s_user_groups_affected'] = '';
if (is_array($aFilter['user_groups_affected'])) {
foreach ($aFilter['user_groups_affected'] as $aGroup) {
$aFilters[$iKey]['s_user_groups_affected'] .= Phpfox_Locale::instance()->convert($aGroup['title']) . ', ';
}
$aFilters[$iKey]['s_user_groups_affected'] = rtrim($aFilters[$iKey]['s_user_groups_affected'], ', ');
}
}
$this->template()->setTitle(Phpfox::getPhrase('ban.ban') . ': ' . $aBanFilter['title'])->setBreadcrumb(Phpfox::getPhrase('ban.ban_filters'))->setSectionTitle('Ban: ' . $aBanFilter['title'])->assign(array('aFilters' => $aFilters, 'aBanFilter' => $aBanFilter));
}
示例6: process
/**
* Controller
*/
public function process()
{
$bIsEdit = false;
if ($iId = $this->request()->getInt('id')) {
if ($aPackage = Phpfox::getService('subscribe')->getForEdit($iId)) {
$bIsEdit = true;
$this->template()->assign('aForms', $aPackage);
$this->setParam('currency_value_val[cost]', unserialize($aPackage['cost']));
if (!empty($aPackage['recurring_cost'])) {
$this->setParam('currency_value_val[recurring_cost]', unserialize($aPackage['recurring_cost']));
}
}
}
if ($aVals = $this->request()->getArray('val')) {
if ($bIsEdit) {
if (Phpfox::getService('subscribe.process')->update($aPackage['package_id'], $aVals)) {
$this->url()->send('admincp.subscribe.add', array('id' => $aPackage['package_id']), Phpfox::getPhrase('subscribe.package_successfully_update'));
}
} else {
if (Phpfox::getService('subscribe.process')->add($aVals)) {
$this->url()->send('admincp.subscribe', null, Phpfox::getPhrase('subscribe.package_successfully_added'));
}
}
}
$this->template()->setTitle($bIsEdit ? Phpfox::getPhrase('subscribe.editing_subscription_package') . ': ' . $aPackage['title'] : Phpfox::getPhrase('subscribe.create_new_subscription_package'))->setBreadcrumb(Phpfox::getPhrase('subscribe.subscription_packages'), $this->url()->makeUrl('admincp.subscribe'))->setBreadcrumb($bIsEdit ? Phpfox::getPhrase('subscribe.editing') . ': ' . Phpfox_Locale::instance()->convert($aPackage['title']) : Phpfox::getPhrase('subscribe.create_new_subscription_package'), null, true)->assign(array('aUserGroups' => Phpfox::getService('user.group')->get(), 'bIsEdit' => $bIsEdit));
}
示例7: process
/**
* 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;
}
示例8: process
/**
* Controller
*/
public function process()
{
$aUser = Phpfox::getService('user')->get(Phpfox::getUserId(), true);
$aGroup = Phpfox::getService('user.group')->getGroup($aUser['user_group_id']);
$aInfo = array(Phpfox::getPhrase('core.membership') => (empty($aGroup['icon_ext']) ? '' : '<img src="' . Phpfox::getParam('core.url_icon') . $aGroup['icon_ext'] . '" class="v_middle" alt="' . Phpfox_Locale::instance()->convert($aGroup['title']) . '" title="' . Phpfox_Locale::instance()->convert($aGroup['title']) . '" /> ') . $aGroup['prefix'] . Phpfox_Locale::instance()->convert($aGroup['title']) . $aGroup['suffix'], Phpfox::getPhrase('core.activity_points') => $aUser['activity_points'], Phpfox::getPhrase('core.profile_views') => $aUser['total_view'], Phpfox::getPhrase('core.space_used') => Phpfox::getUserParam('user.total_upload_space') === 0 ? Phpfox::getPhrase('user.space_total_out_of_unlimited', array('space_total' => Phpfox_File::instance()->filesize($aUser['space_total']))) : Phpfox::getPhrase('user.space_total_out_of_total', array('space_total' => Phpfox_File::instance()->filesize($aUser['space_total']), 'total' => Phpfox::getUserParam('user.total_upload_space'))), Phpfox::getPhrase('core.member_since') => Phpfox::getLib('date')->convertTime($aUser['joined'], 'core.profile_time_stamps'));
if (Phpfox::isModule('rss')) {
$aInfo[Phpfox::getPhrase('rss.rss_subscribers')] = '<a href="#" onclick="tb_show(\'' . Phpfox::getPhrase('rss.rss_subscribers_log') . '\', $.ajaxBox(\'rss.log\', \'height=500&width=500\')); return false;">' . $aUser['rss_count'] . '</a>';
}
$this->template()->assign(array('aInfos' => $aInfo));
}
示例9: process
/**
* Controller
*/
public function process()
{
$this->_setMenuName('admincp.user.browse');
$bIsEdit = false;
if ($iId = $this->request()->getInt('id')) {
if ($aUser = Phpfox::getService('user')->getForEdit($iId)) {
$bIsEdit = true;
if (!empty($aUser['birthday'])) {
$aUser = array_merge($aUser, Phpfox::getService('user')->getAgeArray($aUser['birthday']));
}
$this->template()->assign('aForms', $aUser);
if (Phpfox::getService('user')->isAdminUser($aUser['user_id'])) {
return Phpfox_Error::display(Phpfox::getPhrase('user.you_are_unable_to_edit_a_site_administrators_account'));
}
}
}
if (!isset($aUser)) {
$this->url()->send('admincp', null, 'This section requires that you select.');
}
if ($aVals = $this->request()->getArray('val')) {
if ($bIsEdit) {
if (Phpfox::getService('user.process')->updateAdvanced($aUser['user_id'], $aVals)) {
Phpfox::getService('custom.process')->updateFields($aUser['user_id'], Phpfox::getUserId(), $this->request()->getArray('custom'));
if (Phpfox::getUserParam('user.can_edit_other_user_privacy')) {
Phpfox::getService('user.privacy.process')->update($aVals, $aUser['user_id']);
}
$this->url()->send('admincp.user.add', array('id' => $aUser['user_id']), Phpfox::getPhrase('user.user_successfully_updated'));
}
} else {
}
}
$aUserGroups = array();
foreach (Phpfox::getService('user.group')->get() as $aUserGroup) {
$aUserGroups[$aUserGroup['user_group_id']] = Phpfox_Locale::instance()->convert($aUserGroup['title']);
}
$aLanguages = array();
foreach (Phpfox::getService('language')->get(array('l.user_select = 1')) as $aLanguage) {
$aLanguages[$aLanguage['language_id']] = Phpfox::getLib('parse.output')->clean($aLanguage['title']);
}
$aEditForm = array('basic' => array('title' => Phpfox::getPhrase('user.basic_information'), 'data' => array(array('title' => Phpfox::getPhrase('user.display_name'), 'value' => isset($aVals['full_name']) ? $aVals['full_name'] : (isset($aUser['full_name']) ? $aUser['full_name'] : ''), 'type' => 'input:text', 'id' => 'full_name', 'required' => true), array('title' => Phpfox::getPhrase('user.username'), 'value' => isset($aVals['user_name']) ? $aVals['user_name'] : (isset($aUser['user_name']) ? $aUser['user_name'] : ''), 'type' => 'input:text:check', 'id' => 'user_name', 'required' => true), array('title' => Phpfox::getPhrase('user.password'), 'value' => '', 'type' => 'input:password:check', 'id' => 'password', 'required' => true), array('title' => Phpfox::getPhrase('user.email'), 'value' => isset($aVals['email']) ? $aVals['email'] : (isset($aUser['email']) ? $aUser['email'] : ''), 'type' => 'input:text:check', 'id' => 'email', 'required' => true), array('title' => Phpfox::getPhrase('user.user_group'), 'value' => isset($aVals['user_group_id']) ? $aVals['user_group_id'] : (isset($aUser['user_group_id']) ? $aUser['user_group_id'] : ''), 'type' => 'select', 'id' => 'user_group_id', 'options' => $aUserGroups, 'required' => true), array('title' => Phpfox::getPhrase('user.location'), 'value' => isset($aVals['country_iso']) ? $aVals['country_iso'] : (isset($aUser['country_iso']) ? $aUser['country_iso'] : ''), 'type' => 'select', 'id' => 'country_iso', 'options' => Phpfox::getService('core.country')->get()), array('title' => Phpfox::getPhrase('user.city'), 'value' => isset($aVals['city_location']) ? $aVals['city_location'] : (isset($aUser['city_location']) ? $aUser['city_location'] : ''), 'type' => 'input:text', 'id' => 'city_location'), array('title' => Phpfox::getPhrase('user.zip_postal_code'), 'value' => isset($aVals['postal_code']) ? $aVals['postal_code'] : (isset($aUser['postal_code']) ? $aUser['postal_code'] : ''), 'type' => 'input:text', 'id' => 'postal_code'), array('title' => Phpfox::getPhrase('user.gender'), 'value' => isset($aVals['gender']) ? $aVals['gender'] : (isset($aUser['gender']) ? $aUser['gender'] : ''), 'type' => 'select', 'id' => 'gender', 'options' => Phpfox::getService('core')->getGenders(), 'required' => true), array('title' => Phpfox::getPhrase('user.date_of_birth'), 'type' => 'date_of_birth'), array('title' => Phpfox::getPhrase('user.time_zone'), 'value' => isset($aVals['time_zone']) ? $aVals['time_zone'] : (isset($aUser['time_zone']) ? $aUser['time_zone'] : ''), 'type' => 'select', 'id' => 'time_zone', 'options' => Phpfox::getService('core')->getTimeZones()), array('title' => Phpfox::getPhrase('user.status'), 'value' => isset($aVals['status']) ? $aVals['status'] : (isset($aUser['status']) ? $aUser['status'] : ''), 'type' => 'input:text', 'id' => 'status'), array('title' => Phpfox::getPhrase('user.spam_count'), 'value' => isset($aVals['total_spam']) ? $aVals['total_spam'] : (isset($aUser['total_spam']) ? $aUser['total_spam'] : ''), 'type' => 'input:text', 'id' => 'total_spam'), array('title' => Phpfox::getPhrase('user.primary_language'), 'value' => isset($aVals['language_id']) ? $aVals['language_id'] : (isset($aUser['language_id']) ? $aUser['language_id'] : ''), 'type' => 'select', 'id' => 'language_id', 'options' => $aLanguages), array('title' => Phpfox::getPhrase('user.forum_signature'), 'value' => isset($aVals['signature']) ? $aVals['signature'] : (isset($aUser['signature']) ? $aUser['signature'] : ''), 'type' => 'input:textarea', 'id' => 'signature'))));
($sPlugin = Phpfox_Plugin::get('user.component_controller_admincp_add')) ? eval($sPlugin) : false;
list($aUserPrivacy, $aNotifications, $aProfiles) = Phpfox::getService('user.privacy')->get($aUser['user_id']);
$this->setParam('aUser', $aUser);
$aActivityPoints = array();
$aActivityPoints['activity_total'] = array(Phpfox::getPhrase('user.total_activity') => $aUser['activity_total']);
$aActivityPoints['activity_points'] = array(Phpfox::getPhrase('user.total_activity_points') => $aUser['activity_points']);
$aMassActivityCallback = Phpfox::massCallback('getActivityPointField');
foreach ($aMassActivityCallback as $aMassActivityCallbackModules) {
foreach ($aMassActivityCallbackModules as $sName => $sValue) {
$aActivityPoints[$sValue] = array($sName => $aUser[$sValue]);
}
}
$aSettings = Phpfox::getService('custom')->getForEdit(array('user_main', 'user_panel', 'profile_panel'), $aUser['user_id'], $aUser['user_group_id'], false, $aUser['user_id']);
$this->template()->setSectionTitle('Members')->setTitle(Phpfox::getPhrase('user.editing_member'))->setBreadcrumb(Phpfox::getPhrase('user.browse_members'), $this->url()->makeUrl('admincp.user.browse'))->setBreadcrumb($bIsEdit ? Phpfox::getPhrase('user.editing_member') . ': ' . $aUser['full_name'] . ' (#' . $aUser['user_id'] . ')' : Phpfox::getPhrase('user.add_new_member'), null, true)->setPhrase(array('user.loading_custom_fields'))->setHeader('cache', array('country.js' => 'module_core'))->assign(array('bIsEdit' => $bIsEdit, 'iFormUserId' => $bIsEdit ? $aUser['user_id'] : '', 'aEditForm' => $aEditForm, 'aSettings' => $aSettings, 'aUser' => $aUser, 'aPrivacyNotifications' => $aNotifications, 'aProfiles' => $aProfiles, 'aUserPrivacy' => $aUserPrivacy, 'aActivityPoints' => $aActivityPoints, 'sDobStart' => Phpfox::getParam('user.date_of_birth_start'), 'sDobEnd' => Phpfox::getParam('user.date_of_birth_end')));
}
示例10: getGroup
/**
* @todo Cache ME
*
* @param unknown_type $iId
* @return unknown
*/
public function getGroup($iId)
{
static $aCache = array();
if (!isset($aCache[$iId])) {
$aCache[$iId] = $this->database()->select('user_group.*')->from($this->_sTable, 'user_group')->where('user_group_id = ' . (int) $iId)->execute('getRow');
}
$sPhraseVar = 'user.' . str_replace(' ', '_', strtolower($aCache[$iId]['title']));
if (Phpfox_Locale::instance()->isPhrase($sPhraseVar)) {
$aCache[$iId]['title'] = Phpfox::getPhrase($sPhraseVar);
}
return $aCache[$iId];
}
示例11: getGroups
public function getGroups()
{
$aRows = $this->database()->select('setting_group.group_id, language_phrase.text AS language_var_name')->from($this->_sTable, 'setting_group')->leftJoin(Phpfox::getT('product'), 'product', 'product.product_id = setting_group.product_id AND product.is_active = 1')->leftJoin(Phpfox::getT('language_phrase'), 'language_phrase', array("language_phrase.language_id = '" . $this->database()->escape(Phpfox_Locale::instance()->getLangId()) . "'", "AND language_phrase.var_name = setting_group.var_name"))->execute('getSlaveRows');
foreach ($aRows as $iKey => $aRow) {
if (!empty($aRow['language_var_name'])) {
$aParts = explode('</title><info>', $aRow['language_var_name']);
$aRows[$iKey]['var_name'] = str_replace('<title>', '', $aParts[0]);
$aRows[$iKey]['setting_info'] = str_replace(array("\n", '</info>'), array("<br />", ''), $aParts[1]);
}
}
return $aRows;
}
示例12: process
/**
* Controller
*/
public function process()
{
if ($this->template()->getThemeFolder() == 'nebula' || $this->template()->getParentThemeFolder() == 'nebula') {
return false;
}
// If the user is not a member don't display this block
if (!Phpfox::isUser()) {
return false;
}
$sUserProfileImage = Phpfox::getLib('image.helper')->display(array_merge(array('user' => Phpfox::getService('user')->getUserFields(true)), array('path' => 'core.url_user', 'file' => Phpfox::getUserBy('user_image'), 'suffix' => '_50_square', 'max_width' => 50, 'max_height' => 50)));
$aGroup = Phpfox::getService('user.group')->getGroup(Phpfox::getUserBy('user_group_id'));
// Assign template vars
$this->template()->assign(array('sUserProfileImage' => $sUserProfileImage, 'sUserProfileUrl' => $this->url()->makeUrl('profile', Phpfox::getUserBy('user_name')), 'sCurrentUserName' => Phpfox::getLib('parse.output')->shorten(Phpfox::getLib('parse.output')->clean(Phpfox::getUserBy('full_name')), Phpfox::getParam('user.max_length_for_username'), '...'), 'sCurrentTimeStamp' => Phpfox::getTime(Phpfox::getParam('core.global_welcome_time_stamp'), PHPFOX_TIME), 'iTotalActivityPoints' => (int) Phpfox::getUserBy('activity_points'), 'iTotalProfileViews' => (int) Phpfox::getUserBy('total_view'), 'sUserGroupFullName' => Phpfox_Locale::instance()->convert($aGroup['title'])));
}
示例13: updateSetting
public function updateSetting($aVals)
{
$aModules = explode('|', $aVals['module']);
$aVals['name'] = strtolower(preg_replace("/\\W/i", "_", $aVals['name']));
$this->database()->update($this->_sTable, array('module_id' => $aModules[0], 'product_id' => $aVals['product_id'], 'name' => $aVals['name'], 'type_id' => $aVals['type'], 'default_admin' => $aVals['user_group'][ADMIN_USER_ID], 'default_user' => $aVals['user_group'][NORMAL_USER_ID], 'default_guest' => $aVals['user_group'][GUEST_USER_ID], 'default_staff' => $aVals['user_group'][STAFF_USER_ID]), 'setting_id = ' . (int) $aVals['setting_id']);
if (Phpfox_Locale::instance()->isPhrase('admincp.user_setting_' . $aVals['name'])) {
foreach ($aVals['text'] as $sLang => $sValue) {
Phpfox::getService('language.phrase.process')->updateVarName($sLang, 'admincp.user_setting_' . $aVals['name'], $sValue);
}
} else {
Phpfox::getService('language.phrase.process')->add(array('var_name' => 'user_setting_' . $aVals['name'], 'product_id' => $aVals['product_id'], 'module' => $aVals['module'], 'text' => $aVals['text']));
}
$this->cache()->remove('user_group_setting', 'substr');
return true;
}
示例14: sendContactMessage
/**
* Cleans the values and calls the sending function
*
* @param array $aValues
* @return unknown
*/
public function sendContactMessage($aValues)
{
$sSiteEmail = Phpfox::getParam('contact.contact_staff_emails');
if (empty($sSiteEmail)) {
$sSiteEmail = Phpfox::getParam('core.email_from_email');
}
if (empty($sSiteEmail)) {
return false;
}
// its better if we instantiate here instead of dynamic calling the lib every time
$oParser = Phpfox::getLib('parse.input');
// Remove all tags to make it plain text
$sText = '';
if (Phpfox::getUserId()) {
$sText .= Phpfox::getPhrase('contact.full_name') . ': ' . Phpfox::getUserBy('full_name') . '<br />';
$sText .= Phpfox::getPhrase('contact.user_id') . ': ' . Phpfox::getUserId() . '<br />';
$sText .= Phpfox::getPhrase('contact.profile') . ': ' . Phpfox_Url::instance()->makeUrl(Phpfox::getUserBy('user_name')) . '<br />';
}
$sText .= Phpfox::getPhrase('contact.email') . ': ' . $aValues['email'] . '<br />';
$sText .= '------------------------------------------------------------<br />';
if (!empty($aValues['category_id']) && $aValues['category_id'] == 'phpfox_sales_ticket') {
$sText = $oParser->clean($aValues['text']);
} else {
$sText .= Phpfox::getParam('contact.allow_html_in_contact') == true ? $oParser->prepare($aValues['text']) : $oParser->clean($aValues['text']);
}
// check if the user is logged in to include
if (Phpfox::getUserId() > 0) {
$aValues['full_name'] .= ' (user id:' . Phpfox::getUserId() . ')';
}
// send the mail
$aMails = explode(',', $sSiteEmail);
if (!empty($aValues['category_id']) && $aValues['category_id'] == 'phpfox_sales_ticket') {
$aValues['category_id'] = '';
}
$bResult = true;
foreach ($aMails as $sMail) {
$sMail = trim($sMail);
$bSend = Phpfox::getLib('mail')->to($sMail)->messageHeader(false)->subject((!empty($aValues['category_id']) ? Phpfox_Locale::instance()->convert($aValues['category_id']) . ': ' : '') . $aValues['subject'])->message($sText)->fromName($aValues['full_name'])->fromEmail(Phpfox::getParam('core.email_from_email'))->send();
$bResult = $bResult && $bSend;
}
if (isset($aValues['copy'])) {
Phpfox::getLib('mail')->to($aValues['email'])->messageHeader(false)->subject((!empty($aValues['category_id']) ? Phpfox_Locale::instance()->convert($aValues['category_id']) . ': ' : '') . $aValues['subject'])->message($sText)->fromName(Phpfox::getParam('core.mail_from_name'))->fromEmail(Phpfox::getParam('core.email_from_email'))->send();
}
if (Phpfox::getParam('contact.enable_auto_responder')) {
Phpfox::getLib('mail')->to($aValues['email'])->messageHeader(false)->subject(Phpfox::getParam('contact.auto_responder_subject'))->message(Phpfox::getParam('contact.auto_responder_message'))->fromEmail(Phpfox::getParam('core.email_from_email'))->fromName(Phpfox::getParam('core.site_title'))->send();
}
return $bResult;
}
示例15: process
/**
* Controller
*/
public function process()
{
Phpfox::getUserParam('admincp.can_add_new_block', true);
$bIsEdit = false;
if (($iEditId = $this->request()->getInt('id')) || ($iEditId = $this->request()->getInt('block_id'))) {
$aRow = Admincp_Service_Block_Block::instance()->getForEdit($iEditId);
$bIsEdit = true;
$this->template()->assign(array('aForms' => $aRow, 'aAccess' => empty($aRow['disallow_access']) ? null : unserialize($aRow['disallow_access'])));
}
$aValidation = array('product_id' => Phpfox::getPhrase('admincp.select_product'), 'location' => Phpfox::getPhrase('admincp.select_block_placement'), 'is_active' => Phpfox::getPhrase('admincp.specify_block_active'));
$oValid = Phpfox_Validator::instance()->set(array('sFormName' => 'js_form', 'aParams' => $aValidation));
if ($aVals = $this->request()->getArray('val')) {
if ($oValid->isValid($aVals)) {
if ($bIsEdit) {
$sMessage = Phpfox::getPhrase('admincp.successfully_updated');
$aUrl = array('block', 'add', 'id' => $aRow['block_id']);
Phpfox::getService('admincp.block.process')->update($aRow['block_id'], $aVals);
} else {
$sMessage = Phpfox::getPhrase('admincp.block_successfully_added');
$aUrl = array('block');
Phpfox::getService('admincp.block.process')->add($aVals);
}
$this->url()->send('admincp', $aUrl, $sMessage);
}
}
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: "source_code"
,start_highlight: true
,allow_resize: "both"
,allow_toggle: false
,word_wrap: false
,language: "en"
,syntax: "php"
});
</script>'));
}
$aStyles = Theme_Service_Style_Style::instance()->getStyles();
if ($bIsEdit) {
foreach ($aStyles as $iKey => $aStyle) {
if (isset($aRow['style_id']) && isset($aRow['style_id'][$aStyle['style_id']])) {
$aStyles[$iKey]['block_is_selected'] = $aRow['style_id'][$aStyle['style_id']];
}
}
}
$this->template()->assign(array('aProducts' => Admincp_Service_Product_Product::instance()->get(), 'aControllers' => Phpfox::getService('admincp.component')->get(true), 'aComponents' => Phpfox::getService('admincp.component')->get(), 'aUserGroups' => Phpfox::getService('user.group')->get(), 'sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm(), 'bIsEdit' => $bIsEdit, 'aStyles' => $aStyles))->setTitle(Phpfox::getPhrase('admincp.block_manager'))->setBreadcrumb(Phpfox::getPhrase('admincp.block_manager'), $this->url()->makeUrl('admincp.block'))->setBreadcrumb($bIsEdit ? Phpfox::getPhrase('admincp.editing') . ': ' . (empty($aRow['m_connection']) ? Phpfox::getPhrase('admincp.site_wide') : $aRow['m_connection']) . (empty($aRow['component']) ? '' : '::' . rtrim(str_replace('|', '::', $aRow['component']), '::')) . (empty($aRow['title']) ? '' : ' (' . Phpfox_Locale::instance()->convert($aRow['title']) . ')') : Phpfox::getPhrase('admincp.add_new_block'), $this->url()->makeUrl('admincp.block.add'), true)->setTitle(Phpfox::getPhrase('admincp.add_new_block'));
}