/** * Controller */ public function process() { ($sPlugin = Phpfox_Plugin::get('ad.component_controller_admincp_process__start')) ? eval($sPlugin) : false; $iPage = $this->request()->getInt('page'); if ($iId = $this->request()->getInt('approve')) { if (Phpfox::getService('ad.process')->approve($iId)) { $this->url()->send('admincp.ad', null, Phpfox::getPhrase('ad.ad_successfully_approved')); } } if ($iId = $this->request()->getInt('deny')) { if (Phpfox::getService('ad.process')->deny($iId)) { $this->url()->send('admincp.ad', null, Phpfox::getPhrase('ad.ad_successfully_denied')); } } if ($iId = $this->request()->getInt('delete')) { if (Phpfox::getService('ad.process')->delete($iId)) { $this->url()->send('admincp.ad', null, Phpfox::getPhrase('ad.ad_successfully_deleted')); } } if ($aVals = $this->request()->getArray('val')) { if (Phpfox::getService('ad.process')->updateActivity($aVals)) { $this->url()->send('admincp.ad', null, Phpfox::getPhrase('ad.ad_s_successfully_updated')); } } $aPages = array(5, 10, 15, 20); $aDisplays = array(); foreach ($aPages as $iPageCnt) { $aDisplays[$iPageCnt] = Phpfox::getPhrase('core.per_page', array('total' => $iPageCnt)); } $aSorts = array('ad_id' => Phpfox::getPhrase('ad.recently_added')); $aFilters = array('status' => array('type' => 'select', 'options' => array('1' => Phpfox::getPhrase('ad.pending_approval'), '2' => Phpfox::getPhrase('ad.pending_payment'), '4' => Phpfox::getPhrase('ad.denied')), 'add_any' => true), 'display' => array('type' => 'select', 'options' => $aDisplays, 'default' => '10'), 'sort' => array('type' => 'select', 'options' => $aSorts, 'default' => 'ad_id'), 'sort_by' => array('type' => 'select', 'options' => array('DESC' => Phpfox::getPhrase('core.descending'), 'ASC' => Phpfox::getPhrase('core.ascending')), 'default' => 'DESC')); $oSearch = Phpfox_Search::instance()->set(array('type' => 'campaigns', 'filters' => $aFilters, 'search' => 'search')); $sStatus = $oSearch->get('status'); $sView = $this->request()->get('view'); $iLocation = $this->request()->getInt('location'); if ($sStatus == '1') { $oSearch->setCondition('is_custom = 2'); } elseif ($sStatus == '2') { $oSearch->setCondition('is_custom = 1'); } elseif ($sStatus == '4') { $oSearch->setCondition('is_custom = 4'); } else { switch ($sView) { case 'pending': $oSearch->setCondition('is_custom = 2'); break; default: // $oSearch->setCondition('is_custom IN(0,2,3)'); break; } } if ($iLocation > 0) { $oSearch->setCondition('AND location = ' . (int) $iLocation); } $iLimit = $oSearch->getDisplay(); list($iCnt, $aAds) = Ad_Service_Ad::instance()->get($oSearch->getConditions(), $oSearch->getSort(), $oSearch->getPage(), $iLimit); Phpfox_Pager::instance()->set(array('page' => $iPage, 'size' => $iLimit, 'count' => $oSearch->getSearchTotal($iCnt))); $this->template()->setTitle(Phpfox::getPhrase('ad.manage_ad_campaigns'))->setBreadcrumb(Phpfox::getPhrase('ad.manage_ad_campaigns'), $this->url()->makeUrl('admincp.ad'))->assign(array('aAds' => $aAds, 'iPendingCount' => (int) Ad_Service_Ad::instance()->getPendingCount(), 'sPendingLink' => Phpfox_Url::instance()->makeUrl('admincp.ad', array('view' => 'pending')), 'bIsSearch' => $this->request()->get('search-id') ? true : false, 'sView' => $sView)); ($sPlugin = Phpfox_Plugin::get('ad.component_controller_admincp_process__end')) ? eval($sPlugin) : false; }
/** * Controller */ public function process() { return Phpfox_Error::display('This section has been depreciated'); Phpfox::getUserParam('comment.can_moderate_comments', true); if ($aIds = $this->request()->getArray('id')) { if ($this->request()->get('approve')) { foreach ($aIds as $iId) { Phpfox::getService('feed.process')->approve($iId); } $this->url()->send('admincp.feed', array('view' => 'approval'), Phpfox::getPhrase('feed.profile_comment_s_successfully_approved')); } else { foreach ($aIds as $iId) { Phpfox::getService('feed.process')->deleteFeed($iId); } $this->url()->send('admincp.feed', array('view' => 'approval'), Phpfox::getPhrase('feed.profile_comment_s_successfully_deleted')); } } $iPage = $this->request()->getInt('page'); $aPages = array(20, 30, 40, 50); $aDisplays = array(); foreach ($aPages as $iPageCnt) { $aDisplays[$iPageCnt] = Phpfox::getPhrase('core.per_page', array('total' => $iPageCnt)); } $aFilters = array('search' => array('type' => 'input:text', 'search' => "AND ls.name LIKE '%[VALUE]%'"), 'display' => array('type' => 'select', 'options' => $aDisplays, 'default' => '20'), 'sort' => array('type' => 'select', 'options' => array('time_stamp' => Phpfox::getPhrase('comment.last_activity'), 'rating ' => Phpfox::getPhrase('comment.rating')), 'default' => 'time_stamp', 'alias' => 'feed'), 'sort_by' => array('type' => 'select', 'options' => array('DESC' => Phpfox::getPhrase('core.descending'), 'ASC' => Phpfox::getPhrase('core.ascending')), 'default' => 'DESC')); $oSearch = Phpfox_Search::instance()->set(array('type' => 'feeds', 'filters' => $aFilters, 'search' => 'search')); $oSearch->setCondition('AND feed.view_id = 1'); list($iCnt, $aFeeds) = Feed_Service_Feed::instance()->getForBrowse($oSearch->getConditions(), $oSearch->getSort(), $oSearch->getPage(), $oSearch->getDisplay()); Phpfox_Pager::instance()->set(array('page' => $iPage, 'size' => $oSearch->getDisplay(), 'count' => $oSearch->getSearchTotal($iCnt))); $this->template()->setTitle(Phpfox::getPhrase('comment.comment_title'))->setBreadcrumb(Phpfox::getPhrase('comment.comment_title'), $this->url()->makeUrl('admincp.comment'))->setHeader('cache', array('comment.css' => 'style_css', 'pager.css' => 'style_css'))->assign(array('aFeeds' => $aFeeds, 'bIsCommentAdminPanel' => true)); }
/** * Controller */ public function process() { Phpfox::getUserParam('comment.can_moderate_comments', true); $iPage = $this->request()->getInt('page'); $aPages = array(20, 30, 40, 50); $aDisplays = array(); foreach ($aPages as $iPageCnt) { $aDisplays[$iPageCnt] = Phpfox::getPhrase('core.per_page', array('total' => $iPageCnt)); } $aFilters = array('search' => array('type' => 'input:text', 'search' => "AND ls.name LIKE '%[VALUE]%'"), 'display' => array('type' => 'select', 'options' => $aDisplays, 'default' => '20'), 'sort' => array('type' => 'select', 'options' => array('time_stamp' => Phpfox::getPhrase('comment.last_activity'), 'rating ' => Phpfox::getPhrase('comment.rating')), 'default' => 'time_stamp', 'alias' => 'cmt'), 'sort_by' => array('type' => 'select', 'options' => array('DESC' => Phpfox::getPhrase('core.descending'), 'ASC' => Phpfox::getPhrase('core.ascending')), 'default' => 'DESC')); $oSearch = Phpfox_Search::instance()->set(array('type' => 'comments', 'filters' => $aFilters, 'search' => 'search')); if ($this->request()->get('view') == 'approval') { $oSearch->setCondition('AND cmt.view_id = 1'); } else { $oSearch->setCondition('AND cmt.view_id = 9'); } list($iCnt, $aComments) = Phpfox::getService('comment')->get('cmt.*', $oSearch->getConditions(), $oSearch->getSort(), $oSearch->getPage(), $oSearch->getDisplay(), null, true); foreach ($aComments as $iKey => $aComment) { if (Phpfox::hasCallback($aComment['type_id'], 'getItemName')) { $aComments[$iKey]['item_name'] = Phpfox::callback($aComment['type_id'] . '.getItemName', $aComment['comment_id'], $aComment['owner_full_name']); } } Phpfox_Pager::instance()->set(array('page' => $iPage, 'size' => $oSearch->getDisplay(), 'count' => $oSearch->getSearchTotal($iCnt))); $this->template()->setTitle(Phpfox::getPhrase('comment.comment_title'))->setBreadcrumb(Phpfox::getPhrase('comment.comment_title'), $this->url()->makeUrl('admincp.comment'))->setHeader('cache', array('comment.css' => 'style_css', 'pager.css' => 'style_css'))->assign(array('aComments' => $aComments, 'bIsCommentAdminPanel' => true)); }
/** * Controller */ public function process() { if ($iId = $this->request()->getInt('view')) { if ($sRedirect = Phpfox::getService('report')->getRedirect($iId)) { $this->url()->forward($sRedirect); } } if ($aIds = $this->request()->getArray('id')) { if ($this->request()->get('ignore')) { foreach ($aIds as $iId) { if (!is_numeric($iId)) { continue; } Phpfox::getService('report.data.process')->ignore($iId); } $this->url()->send('admincp.report', null, Phpfox::getPhrase('report.report_s_successfully_ignored')); } } $iPage = $this->request()->getInt('page'); $aPages = array(5, 10, 15, 20); $aDisplays = array(); foreach ($aPages as $iPageCnt) { $aDisplays[$iPageCnt] = Phpfox::getPhrase('core.per_page', array('total' => $iPageCnt)); } $aSorts = array('added' => Phpfox::getPhrase('core.time')); $aFilters = array('search' => array('type' => 'input:text', 'search' => "AND c.name LIKE '%[VALUE]%'"), 'user' => array('type' => 'input:text', 'search' => "AND u.user_name LIKE '%[VALUE]%'"), 'display' => array('type' => 'select', 'options' => $aDisplays, 'default' => '10'), 'sort' => array('type' => 'select', 'options' => $aSorts, 'default' => 'added', 'alias' => 'rd'), 'sort_by' => array('type' => 'select', 'options' => array('DESC' => Phpfox::getPhrase('core.descending'), 'ASC' => Phpfox::getPhrase('core.ascending')), 'default' => 'DESC')); $oSearch = Phpfox_Search::instance()->set(array('type' => 'reports', 'filters' => $aFilters, 'search' => 'search')); $iLimit = $oSearch->getDisplay(); list($iCnt, $aReports) = Phpfox::getService('report')->get($oSearch->getConditions(), $oSearch->getSort(), $oSearch->getPage(), $iLimit); Phpfox_Pager::instance()->set(array('page' => $iPage, 'size' => $iLimit, 'count' => $oSearch->getSearchTotal($iCnt))); $this->template()->setTitle(Phpfox::getPhrase('report.reports'))->setBreadcrumb(Phpfox::getPhrase('report.reports'), $this->url()->makeUrl('admincp.report'))->assign(array('aReports' => $aReports)); }
/** * Controller */ public function process() { if ($iId = $this->request()->getInt('delete')) { if (Phpfox::getService('ad.process')->deleteInvoice($iId)) { $this->url()->send('admincp.ad.invoice', null, Phpfox::getPhrase('ad.invoice_successfully_deleted')); } } $iPage = $this->request()->getInt('page'); $aPages = array(5, 10, 15, 20); $aDisplays = array(); foreach ($aPages as $iPageCnt) { $aDisplays[$iPageCnt] = Phpfox::getPhrase('core.per_page', array('total' => $iPageCnt)); } $aSorts = array('time_stamp' => Phpfox::getPhrase('ad.recently_added')); $aFilters = array('status' => array('type' => 'select', 'options' => array('1' => Phpfox::getPhrase('ad.paid'), '2' => Phpfox::getPhrase('ad.pending_payment'), '3' => Phpfox::getPhrase('ad.cancelled')), 'add_any' => true), 'display' => array('type' => 'select', 'options' => $aDisplays, 'default' => '10'), 'sort' => array('type' => 'select', 'options' => $aSorts, 'default' => 'ad_id'), 'sort_by' => array('type' => 'select', 'options' => array('DESC' => Phpfox::getPhrase('core.descending'), 'ASC' => Phpfox::getPhrase('core.ascending')), 'default' => 'DESC')); $oSearch = Phpfox_Search::instance()->set(array('type' => 'invoices', 'filters' => $aFilters, 'search' => 'search')); $sStatus = $oSearch->get('status'); switch ($sStatus) { case '1': $oSearch->setCondition('ai.status = \'completed\''); break; case '2': $oSearch->setCondition('(ai.status = \'pending\' OR ' . Phpfox_Database::instance()->isNull('ai.status') . ')'); break; case '3': $oSearch->setCondition('ai.status = \'cancel\''); break; default: break; } $iLimit = $oSearch->getDisplay(); list($iCnt, $aInvoices) = Ad_Service_Ad::instance()->getInvoices($oSearch->getConditions(), $oSearch->getSort(), $oSearch->getPage(), $iLimit); $this->template()->setTitle(Phpfox::getPhrase('ad.ad_invoices'))->setBreadcrumb(Phpfox::getPhrase('ad.invoices'))->assign(array('aInvoices' => $aInvoices)); }
/** * Controller */ public function process() { if (($sLegacyTitle = $this->request()->get('req2')) && !empty($sLegacyTitle)) { if (($sLegacyThread = $this->request()->get('req3')) && !empty($sLegacyThread) && !is_numeric($sLegacyTitle)) { $aLegacyItem = Phpfox::getService('core')->getLegacyItem(array('field' => array('thread_id', 'title'), 'table' => 'forum_thread', 'redirect' => 'forum.thread', 'title' => $sLegacyThread)); } else { $aForumParts = explode('-', $sLegacyTitle); if (isset($aForumParts[1])) { $aLegacyItem = Phpfox::getService('core')->getLegacyItem(array('field' => array('forum_id', 'name'), 'table' => 'forum', 'redirect' => 'forum', 'search' => 'forum_id', 'title' => $aForumParts[1])); } } } Phpfox::getUserParam('forum.can_view_forum', true); $aParentModule = $this->getParam('aParentModule'); if (Phpfox::getParam('core.phpfox_is_hosted') && empty($aParentModule)) { $this->url()->send(''); } else { if (empty($aParentModule) && $this->request()->get('view') == 'new') { $aDo = explode('/', $this->request()->get('do')); if ($aDo[0] == 'mobile' || isset($aDo[1]) && $aDo[1] == 'mobile') { Phpfox_Module::instance()->getComponent('forum.forum', array('bNoTemplate' => true), 'controller'); return; } } } if ($this->request()->get('req2') == 'topics' || $this->request()->get('req2') == 'posts') { return Phpfox_Module::instance()->setController('error.404'); } $this->template()->setBreadcrumb(Phpfox::getPhrase('forum.forum'), $this->url()->makeUrl('forum'))->setPhrase(array('forum.provide_a_reply', 'forum.adding_your_reply', 'forum.are_you_sure', 'forum.post_successfully_deleted', 'forum.reply_multi_quoting'))->setHeader('cache', array('forum.js' => 'module_forum')); if ($aParentModule !== null) { Phpfox_Module::instance()->getComponent('forum.forum', array('bNoTemplate' => true), 'controller'); return; } if ($this->request()->getInt('req2') > 0) { return Phpfox_Module::instance()->setController('forum.forum'); } if ($aParentModule === null) { Phpfox_Search::instance()->set(array('type' => 'forum', 'search_tool' => array('table_alias' => 'ft', 'search' => array('action' => $this->url()->makeUrl('forum.search'), 'default_value' => 'Search...', 'name' => 'search', 'field' => array('ft.title')), 'sort' => array('latest' => array('ft.time_stamp', Phpfox::getPhrase('blog.latest'))), 'show' => array(5, 10, 15)), 'field' => array('depend' => 'result', 'fields' => array('fp.post_id', 'ft.thread_id')))); } $this->setParam('bIsForum', true); // Phpfox::getService('forum')->buildMenu(); $aIds = []; $aForums = Phpfox::getService('forum')->live()->getForums(); foreach ($aForums as $aForum) { $aIds[] = $aForum['forum_id']; $aChilds = (array) Phpfox::getService('forum')->id($aForum['forum_id'])->getChildren(); foreach ($aChilds as $iId) { $aIds[] = $iId; } } Phpfox::getService('forum')->id(null); /* list($iCnt, $aThreads) = Forum_Service_Thread_Thread::instance() ->get('ft.forum_id IN(' . implode(',', $aIds) . ') AND ft.group_id = 0 AND ft.view_id >= 0 AND ft.is_announcement = 0', 'ft.order_id DESC', '', 0, 20); */ $this->template()->setTitle(Phpfox::getPhrase('forum.forum'))->assign(array('aForums' => Phpfox::getService('forum')->live()->getForums(), 'bHasCategory' => Phpfox::getService('forum')->hasCategory(), 'aCallback' => null)); Phpfox::getService('forum')->buildMenu(); }
/** * Controller */ public function process() { $iPage = $this->request()->getInt('page'); $aPages = array(20, 30, 40, 50); $aDisplays = array(); foreach ($aPages as $iPageCnt) { $aDisplays[$iPageCnt] = Phpfox::getPhrase('core.per_page', array('total' => $iPageCnt)); } $aFilters = array('search' => array('type' => 'input:text', 'search' => "ANDal.name LIKE '%[VALUE]%'"), 'display' => array('type' => 'select', 'options' => $aDisplays, 'default' => '20'), 'sort' => array('type' => 'select', 'options' => array('time_stamp' => Phpfox::getPhrase('admincp.login_time_stamp'), 'ip_address ' => Phpfox::getPhrase('admincp.ip_address')), 'default' => 'time_stamp', 'alias' => 'al'), 'sort_by' => array('type' => 'select', 'options' => array('DESC' => Phpfox::getPhrase('core.descending'), 'ASC' => Phpfox::getPhrase('core.ascending')), 'default' => 'DESC')); $oSearch = Phpfox_Search::instance()->set(array('type' => 'onlineguests', 'filters' => $aFilters, 'search' => 'search')); list($iCnt, $aUsers) = Phpfox::getService('core.admincp')->getAdminLogins($oSearch->getConditions(), $oSearch->getSort(), $oSearch->getPage(), $oSearch->getDisplay()); Phpfox_Pager::instance()->set(array('page' => $iPage, 'size' => $oSearch->getDisplay(), 'count' => $oSearch->getSearchTotal($iCnt))); $this->template()->setTitle(Phpfox::getPhrase('admincp.admincp_logins'))->setBreadcrumb(Phpfox::getPhrase('admincp.admincp_logins'))->assign(array('aUsers' => $aUsers)); }
/** * Controller */ public function process() { if (defined('PHPFOX_IS_AJAX_CONTROLLER')) { $aUser = Phpfox::getService('user')->get($this->request()->get('profile_id')); $this->setParam('aUser', $aUser); } $iPageSize = 12; $iPage = $this->request()->getInt('page'); $aUser = $this->getParam('aUser'); $bMutual = $this->request()->get('req3') == 'mutual' ? true : false; if (!Phpfox::getService('user.privacy')->hasAccess($aUser['user_id'], 'friend.view_friend')) { return Phpfox_Error::display('<div class="extra_info">' . Phpfox::getService('user')->getFirstName($aUser['full_name']) . ' has closed ' . Phpfox::getService('user')->gender($aUser['gender'], true) . ' friends section.</div>'); } $aFilters = array('sort' => array('type' => 'select', 'options' => array(), 'default' => 'full_name', 'alias' => 'u'), 'sort_by' => array('type' => 'select', 'options' => array('DESC' => Phpfox::getPhrase('core.descending'), 'ASC' => Phpfox::getPhrase('core.ascending')), 'default' => 'ASC'), 'search' => array('type' => 'input:text', 'search' => '(u.full_name LIKE \'%[VALUE]%\' OR u.email LIKE \'%[VALUE]%\') AND', 'size' => '15', 'onclick' => 'Search')); $oFilter = Phpfox_Search::instance()->set(array('type' => 'friend', 'filters' => $aFilters, 'search' => 'search')); if ($bMutual === true) { $oFilter->setCondition('friend.is_page = 0 AND friend.user_id = ' . Phpfox::getUserId()); $this->template()->setBreadcrumb(Phpfox::getPhrase('friend.mutual_friends'), null, true); } else { $oFilter->setCondition('friend.is_page = 0 AND friend.user_id = ' . (int) $aUser['user_id']); if ($this->request()->get('view')) { $this->template()->setBreadcrumb(Phpfox::getPhrase('friend.friends_online'), null, true); } } if (($iListId = $this->request()->getInt('list')) && ($aList = Phpfox::getService('friend.list')->getList($iListId, Phpfox::getUserId())) && isset($aList['list_id'])) { $this->search()->setCondition('AND fld.list_id = ' . (int) $aList['list_id'] . ' AND friend.user_id = ' . $aUser['user_id']); // $this->template()->setTitle($aList['name'])->setBreadcrumb($aList['name'], $this->url()->makeUrl('friend', array('view' => 'list', 'id' => $iListId)), true); } list($iCnt, $aFriends) = Friend_Service_Friend::instance()->get($oFilter->getConditions(), $oFilter->getSort(), $oFilter->getPage(), $iPageSize, true, true, $this->request()->get('view') ? true : false, $bMutual === true ? $aUser['user_id'] : null); $iCnt = $oFilter->getSearchTotal($iCnt); Phpfox_Pager::instance()->set(array('page' => $iPage, 'size' => $iPageSize, 'count' => $iCnt)); $this->setParam('aTotalFriends', $iCnt); $this->template()->setMeta('keywords', Phpfox::getPhrase('friend.full_name_s_friends', array('full_name' => $aUser['full_name']))); $this->template()->setMeta('keywords', Phpfox::getParam('friend.friend_meta_keywords')); $this->template()->setMeta('description', Phpfox::getPhrase('friend.full_name_is_on_site_title_and_has_total_friends', array('full_name' => $aUser['full_name'], 'site_title' => Phpfox::getParam('core.site_title'), 'total' => $iCnt))); if ($iCnt) { $sCustomFriends = ''; foreach ($aFriends as $aFriend) { $sCustomFriends .= $aFriend['full_name'] . ', '; } $sCustomFriends = rtrim($sCustomFriends, ', '); $this->template()->setMeta('description', Phpfox::getPhrase('friend.full_name_is_connected_with_friends', array('full_name' => $aUser['full_name'], 'friends' => $sCustomFriends))); } $this->template()->setMeta('description', Phpfox::getPhrase('friend.sign_up_on_site_title_and_connect_with_full_name_message_full_name_or_add_full_name_as_you', array('site_title' => Phpfox::getParam('core.site_title'), 'full_name' => $aUser['full_name']))); if (Phpfox::getUserId() == $aUser['user_id']) { // $this->template()->assign('lists', Friend_Service_List_List::instance()->get()); $this->template()->menu('Manage Friends', $this->url()->makeUrl('friend')); } $this->template()->setTitle(Phpfox::getPhrase('friend.full_name_s_friends', array('full_name' => $aUser['full_name'])))->setBreadcrumb(Phpfox::getPhrase('friend.friends'))->setHeader('cache', array('pager.css' => 'style_css', 'friend.css' => 'style_css'))->assign(array('aFriends' => $aFriends, 'sFriendView' => $this->request()->get('view'), 'activeList' => $this->request()->get('list'))); }
/** * Controller */ public function process() { $iPage = $this->request()->getInt('page'); $aPages = array(20, 30, 40, 50); $aDisplays = array(); foreach ($aPages as $iPageCnt) { $aDisplays[$iPageCnt] = Phpfox::getPhrase('core.per_page', array('total' => $iPageCnt)); } $aFilters = array('search' => array('type' => 'input:text', 'search' => "AND ls.name LIKE '%[VALUE]%'"), 'display' => array('type' => 'select', 'options' => $aDisplays, 'default' => '20'), 'sort' => array('type' => 'select', 'options' => array('last_activity' => Phpfox::getPhrase('admincp.last_activity'), 'ip_address ' => Phpfox::getPhrase('admincp.ip_address')), 'default' => 'last_activity', 'alias' => 'ls'), 'sort_by' => array('type' => 'select', 'options' => array('DESC' => Phpfox::getPhrase('core.descending'), 'ASC' => Phpfox::getPhrase('core.ascending')), 'default' => 'DESC')); $oSearch = Phpfox_Search::instance()->set(array('type' => 'onlineguests', 'filters' => $aFilters, 'search' => 'search')); $oSearch->setCondition('AND ls.user_id = 0'); // The following condition was added to match the function log.session->getOnlineStats $oSearch->setCondition('AND ls.last_activity > ' . (PHPFOX_TIME - Phpfox::getParam('log.active_session') * 60)); list($iCnt, $aGuests) = Phpfox::getService('log')->getOnlineGuests($oSearch->getConditions(), $oSearch->getSort(), $oSearch->getPage(), $oSearch->getDisplay()); Phpfox_Pager::instance()->set(array('page' => $iPage, 'size' => $oSearch->getDisplay(), 'count' => $oSearch->getSearchTotal($iCnt))); $this->template()->setTitle(Phpfox::getPhrase('admincp.online_guests'))->setBreadcrumb(Phpfox::getPhrase('admincp.online'), $this->url()->makeUrl('admincp.core.online-guest'))->setBreadcrumb(Phpfox::getPhrase('admincp.guests_bots'), null, true)->assign(array('aGuests' => $aGuests)); }
/** * Controller */ public function process() { Phpfox::getUserParam('admincp.can_clear_site_cache', true); if ($this->request()->get('unlock')) { Phpfox::getLib('cache')->unlock(); $this->url()->send('admincp.maintain.cache', null, Phpfox::getPhrase('admincp.cache_system_unlocked')); } if ($this->request()->get('all')) { Phpfox_Database::instance()->update(Phpfox::getT('setting'), array('value_actual' => (int) Phpfox::getParam('core.css_edit_id') + 1), 'var_name = \'css_edit_id\''); Phpfox::getLib('cache')->remove(); Phpfox::getLib('template.cache')->remove(); Phpfox::getLib('cache')->removeStatic(); $aParams = array('maintain', 'cache', 'clear' => 'done'); if ($sPlugin = Phpfox_Plugin::get('admincp.component_controller_maintain_1')) { eval($sPlugin); } // $this->url()->send('admincp', $aParams, Phpfox::getPhrase('admincp.cached_cleared')); return ['content' => Phpfox::getPhrase('admincp.cached_cleared')]; } if ($aIds = $this->request()->getArray('id')) { foreach ($aIds as $sKey => $aItems) { foreach ($aItems as $sId) { Phpfox::getLib('cache')->remove($sId, 'path'); } } $this->url()->send('admincp', array('maintain', 'cache'), Phpfox::getPhrase('admincp.cached_cleared')); } $iPage = $this->request()->getInt('page'); $aPages = array(20, 30, 40, 50); $aDisplays = array(); foreach ($aPages as $iPageCnt) { $aDisplays[$iPageCnt] = Phpfox::getPhrase('core.per_page', array('total' => $iPageCnt)); } $aSorts = array('time_stamp' => Phpfox::getPhrase('admincp.timestamp'), 'file_name' => Phpfox::getPhrase('admincp.cache_name'), 'data_size' => Phpfox::getPhrase('admincp.data_size')); $aFilters = array('search' => array('type' => 'input:text', 'search' => "AND file_name LIKE '%[VALUE]%'"), 'display' => array('type' => 'select', 'options' => $aDisplays, 'default' => '20'), 'sort' => array('type' => 'select', 'options' => $aSorts, 'default' => 'time_stamp'), 'sort_by' => array('type' => 'select', 'options' => array('DESC' => Phpfox::getPhrase('core.descending'), 'ASC' => Phpfox::getPhrase('core.ascending')), 'default' => 'DESC')); $oSearch = Phpfox_Search::instance()->set(array('type' => 'cache', 'filters' => $aFilters, 'search' => 'search')); $iLimit = $oSearch->getDisplay(); list($iCnt, $aCaches) = Phpfox::getLib('cache')->getCachedFiles($oSearch->getConditions(), $oSearch->getSort(), $oSearch->getPage(), $iLimit); Phpfox_Pager::instance()->set(array('page' => $iPage, 'size' => $iLimit, 'count' => $oSearch->getSearchTotal($iCnt))); if ($this->request()->get('clear')) { $aCaches = array(); $iCnt = 0; } $this->template()->setTitle('Cache Manager')->setSectionTitle('Cache Manager')->setActionMenu(['Clear Cache' => ['url' => $this->url()->makeUrl('admincp.maintain.cache', ['all' => true]), 'class' => 'popup']])->assign(array('iCacheCnt' => $iCnt, 'aCaches' => $aCaches, 'aStats' => Phpfox::getLib('cache')->getStats(), 'bCacheLocked' => file_exists(PHPFOX_DIR_CACHE . 'cache.lock') ? true : false, 'sUnlockCache' => $this->url()->makeUrl('admincp.maintain.cache', array('unlock' => 'true')))); }
/** * Controller */ public function process() { if ($aDeleteIds = $this->request()->getArray('id')) { if (Phpfox::getService('blog.category.process')->deleteMultiple($aDeleteIds)) { $this->url()->send('admincp.blog', null, Phpfox::getPhrase('blog.categories_successfully_deleted')); } } $iPage = $this->request()->getInt('page'); $aPages = array(5, 10, 15, 20); $aDisplays = array(); foreach ($aPages as $iPageCnt) { $aDisplays[$iPageCnt] = Phpfox::getPhrase('core.per_page', array('total' => $iPageCnt)); } $aSorts = array('added' => Phpfox::getPhrase('core.time'), 'used' => Phpfox::getPhrase('blog.most_used')); $aFilters = array('search' => array('type' => 'input:text', 'search' => "AND c.name LIKE '%[VALUE]%'"), 'user' => array('type' => 'input:text', 'search' => "AND u.user_name LIKE '%[VALUE]%'"), 'display' => array('type' => 'select', 'options' => $aDisplays, 'default' => '10'), 'created_by' => array('type' => 'select', 'options' => array(array(Phpfox::getPhrase('blog.users'), "AND c.user_id != 0"), array(Phpfox::getPhrase('blog.system'), "AND c.user_id = 0")), 'add_select' => true), 'sort' => array('type' => 'select', 'options' => $aSorts, 'default' => 'added', 'alias' => 'c'), 'sort_by' => array('type' => 'select', 'options' => array('DESC' => Phpfox::getPhrase('core.descending'), 'ASC' => Phpfox::getPhrase('core.ascending')), 'default' => 'DESC')); $oSearch = Phpfox_Search::instance()->set(array('type' => 'categories', 'filters' => $aFilters, 'search' => 'search')); $iLimit = $oSearch->getDisplay(); list($iCnt, $aCategories) = Phpfox::getService('blog.category')->get($oSearch->getConditions(), $oSearch->getSort(), $oSearch->getPage(), $iLimit); Phpfox_Pager::instance()->set(array('page' => $iPage, 'size' => $iLimit, 'count' => $oSearch->getSearchTotal($iCnt))); $this->template()->setTitle(Phpfox::getPhrase('blog.blog'))->setBreadcrumb(Phpfox::getPhrase('blog.blog'), $this->url()->makeUrl('admincp.blog'))->assign(array('aCategories' => $aCategories))->setHeader('cache', array('quick_edit.js' => 'static_script')); }
/** * Controller */ public function process() { if ($iDeleteId = $this->request()->getInt('delete')) { if (Phpfox::getService('subscribe.purchase.process')->delete($iDeleteId)) { $this->url()->send('admincp.subscribe.list', null, Phpfox::getPhrase('subscribe.purchase_order_successfully_deleted')); } } $aPages = array(20, 30, 40, 50); $aDisplays = array(); foreach ($aPages as $iPageCnt) { $aDisplays[$iPageCnt] = Phpfox::getPhrase('core.per_page', array('total' => $iPageCnt)); } $sStatus = $this->request()->get('status'); $aSorts = array('time_stamp' => Phpfox::getPhrase('subscribe.time'), 'status' => Phpfox::getPhrase('subscribe.status'), 'price' => Phpfox::getPhrase('subscribe.price')); $aFilters = array('package' => array('type' => 'input:text', 'search' => 'AND sp.package_id = \'[VALUE]\''), 'status' => array('type' => 'select', 'options' => array('completed' => Phpfox::getPhrase('subscribe.active'), 'cancel' => Phpfox::getPhrase('subscribe.canceled'), 'pending' => Phpfox::getPhrase('subscribe.pending_payment'), 'pendingaction' => Phpfox::getPhrase('subscribe.pending_action')), 'add_any' => true, 'search' => $sStatus == 'pendingaction' ? 'AND (sp.status IS NULL OR sp.status = \'\')' : 'AND sp.status = \'[VALUE]\''), 'display' => array('type' => 'select', 'options' => $aDisplays, 'default' => '12'), 'sort' => array('type' => 'select', 'options' => $aSorts, 'default' => 'time_stamp', 'alias' => 'sp'), 'sort_by' => array('type' => 'select', 'options' => array('DESC' => Phpfox::getPhrase('core.descending'), 'ASC' => Phpfox::getPhrase('core.ascending')), 'default' => 'DESC')); $oFilter = Phpfox_Search::instance()->live()->setRequests()->set(array('type' => 'subscribe', 'filters' => $aFilters, 'redirect' => true, 'redirect_url' => 'admincp.subscribe.list')); $iPage = $this->request()->getInt('page'); $iPageSize = $oFilter->getDisplay(); list($iCnt, $aPurchases) = Phpfox::getService('subscribe.purchase')->getSearch($oFilter->getConditions(), $oFilter->getSort(), $oFilter->getPage(), $iPageSize); $iCnt = $oFilter->getSearchTotal($iCnt); Phpfox_Pager::instance()->set(array('page' => $iPage, 'size' => $iPageSize, 'count' => $iCnt)); $this->template()->setTitle(Phpfox::getPhrase('subscribe.subscription_purchase_orders'))->setBreadcrumb(Phpfox::getPhrase('subscribe.subscription_packages'), $this->url()->makeUrl('admincp.subscribe'))->setBreadcrumb(Phpfox::getPhrase('subscribe.purchase_orders'), $this->url()->makeUrl('admincp.subscribe.list'), true)->assign(array('aPurchases' => $aPurchases, 'bIsSearching' => $oFilter->isSearching())); }
public function process() { Phpfox::getUserParam('mail.can_read_private_messages', true); if ($iDeleteId = $this->request()->getInt('delete')) { if (Mail_Service_Process::instance()->adminDelete($iDeleteId)) { $this->url()->send('admincp.mail.private', null, Phpfox::getPhrase('mail.message_successfully_deleted')); } } $aPages = array(12, 15, 18, 21); $aDisplays = array(); foreach ($aPages as $iPageCnt) { $aDisplays[$iPageCnt] = Phpfox::getPhrase('core.per_page', array('total' => $iPageCnt)); } $aUserGroups = array(); foreach (Phpfox::getService('user.group')->get() as $aUserGroup) { $aUserGroups[$aUserGroup['user_group_id']] = $aUserGroup['title']; } $aAge = array(); for ($i = 18; $i <= 68; $i++) { $aAge[$i] = $i; } if (Phpfox::getParam('mail.threaded_mail_conversation')) { $aOptions = array('1' => array(Phpfox::getPhrase('mail.text'), "AND mt.text LIKE '%[VALUE]%'")); } else { $aOptions = array('1' => array(Phpfox::getPhrase('mail.subject_amp_text'), "AND (m.subject LIKE '%[VALUE]%' OR mt.text_parsed LIKE '%[VALUE]%')"), '2' => array(Phpfox::getPhrase('mail.subject'), "AND m.subject LIKE '%[VALUE]%'"), '3' => array(Phpfox::getPhrase('mail.text'), "AND mt.text LIKE '%[VALUE]%'")); } $iDay = date('d'); $iMonth = date('m'); $iYear = date('Y'); $aFilters = array('display' => array('type' => 'select', 'options' => $aDisplays, 'default' => '12'), 'sort' => array('type' => 'select', 'options' => array(), 'default' => 'time_updated', 'alias' => 'm'), 'sort_by' => array('type' => 'select', 'options' => array('DESC' => Phpfox::getPhrase('core.descending'), 'ASC' => Phpfox::getPhrase('core.ascending')), 'default' => 'DESC'), 'keyword' => array('type' => 'input:text', 'size' => 20), 'type' => array('type' => 'input:radio', 'default_view' => '1', 'prefix' => '<div>', 'suffix' => '</div>', 'options' => $aOptions, 'depend' => 'keyword'), 'group' => array('type' => 'select', 'options' => $aUserGroups, 'add_any' => true, 'search' => 'AND sender.user_group_id = \'[VALUE]\''), 'status' => array('type' => 'select', 'options' => array('1' => Phpfox::getPhrase('mail.all_members'), '2' => Phpfox::getPhrase('mail.featured_members')), 'default_view' => '1', 'search' => 'FEATURED_[VALUE]'), 'view' => array('type' => 'input:radio', 'options' => array('online' => Phpfox::getPhrase('mail.online'), 'updated' => Phpfox::getPhrase('mail.updated'))), 'show' => array('type' => 'select', 'options' => array('1' => Phpfox::getPhrase('mail.name_and_photo_only'), '2' => Phpfox::getPhrase('mail.name_photo_and_users_details')), 'default_view' => Phpfox::getParam('user.user_browse_display_results_default') == 'name_photo_detail' ? '2' : '1'), 'sender' => array('type' => 'input:text', 'size' => 20, 'search' => 'SENDER=\'[VALUE]\''), 'receiver' => array('type' => 'input:text', 'size' => 20, 'search' => 'RECEIVER=\'[VALUE]\'')); $oFilter = Phpfox_Search::instance()->set(array('type' => 'browse', 'filters' => $aFilters, 'search' => 'keyword')); $iPage = $this->request()->getInt('page', 1); define('PHPFOX_IS_PRIVATE_MAIL', true); list($aMessages, $iCnt) = Mail_Service_Mail::instance()->getPrivate($oFilter->getConditions(), 10, $oFilter->getSort(), $iPage); Phpfox_Pager::instance()->set(array('page' => $iPage, 'size' => 10, 'count' => $oFilter->getSearchTotal($iCnt))); $this->template()->setTitle(Phpfox::getPhrase('mail.private_messages'))->setHeader('cache', array('mail.css' => 'style_css'))->setBreadCrumb(Phpfox::getPhrase('mail.private_messages'))->setBreadcrumb(Phpfox::getPhrase('mail.view_private_messages'), null, true)->assign(array('aMessages' => $aMessages)); }
/** * Extends the search class and returns its class object. * * @see Phpfox_Search * @return Phpfox_Search */ protected function search() { return Phpfox_Search::instance(); }
public function getQueryJoins($bIsCount = false, $bNoQueryFriend = false) { if (Phpfox_Search::instance()->isSearch() && $bIsCount) { $this->database()->leftJoin(Phpfox::getT('marketplace_text'), 'mt', 'mt.listing_id = l.listing_id'); } if (Phpfox::isModule('friend') && Friend_Service_Friend::instance()->queryJoin($bNoQueryFriend)) { $this->database()->join(Phpfox::getT('friend'), 'friends', 'friends.user_id = l.user_id AND friends.friend_user_id = ' . Phpfox::getUserId()); } if ($this->_sCategory !== null) { $this->database()->select('mc.name AS category_name, ')->innerJoin(Phpfox::getT('marketplace_category_data'), 'mcd', 'mcd.listing_id = l.listing_id')->join(Phpfox::getT('marketplace_category'), 'mc', 'mc.category_id = mcd.category_id'); if (!$bIsCount) { $this->database()->group('l.listing_id'); } } else { $this->database()->select('mc.name AS category_name, ')->leftJoin(Phpfox::getT('marketplace_category_data'), 'mcd', 'mcd.listing_id = l.listing_id')->leftJoin(Phpfox::getT('marketplace_category'), 'mc', 'mc.category_id = mcd.category_id'); } if ($this->_bIsSeen !== false) { $this->database()->join(Phpfox::getT('marketplace_invite'), 'mi', 'mi.listing_id = l.listing_id AND mi.visited_id = 0 AND mi.invited_user_id = ' . Phpfox::getUserId()); } }
/** * Get the title for the current page beind displayed. * All titles are added earlier in the script using self::setTitle(). * Each title is split with a delimiter specificed from the Admin CP. * * @see setTitle() * @return string $sData Full page title including delimiter */ public function getTitle() { $oFilterOutput = Phpfox::getLib('parse.output'); ($sPlugin = Phpfox_Plugin::get('template_gettitle')) ? eval($sPlugin) : false; if (isset($this->_meta['title'])) { return $this->_meta['title']; } $sData = ''; /* // Display the user name in the title in case we are developing with many browsers if (defined('PHPFOX_ADD_USER_TITLE') && PHPFOX_ADD_USER_TITLE && Phpfox::getUserId()) { $sData = Phpfox::getUserBy('full_name') . ' (#' . Phpfox::getUserId() . '): '; } */ foreach ($this->_aTitles as $sTitle) { $sData .= $oFilterOutput->clean($sTitle) . ' ' . Phpfox::getParam('core.title_delim') . ' '; } if (!Phpfox::getParam('core.include_site_title_all_pages')) { $sData .= defined('PHPFOX_INSTALLER') ? Phpfox::getParam('core.global_site_title') : Phpfox_Locale::instance()->convert(Phpfox::getParam('core.global_site_title')); } else { $sData = trim(rtrim(trim($sData), Phpfox::getParam('core.title_delim'))); if (empty($sData)) { $sData = defined('PHPFOX_INSTALLER') ? Phpfox::getParam('core.global_site_title') : Phpfox_Locale::instance()->convert(Phpfox::getParam('core.global_site_title')); } } $sSort = Phpfox_Request::instance()->get('sort'); if (!empty($sSort)) { $mSortName = Phpfox_Search::instance()->getPhrase('sort', $sSort); if ($mSortName !== false) { $sData .= ' ' . Phpfox::getParam('core.title_delim') . ' ' . $mSortName[1]; } } if (!Phpfox::getParam('core.branding')) { $sData .= ' - ' . PhpFox::link(false, false) . ''; } return $sData; }
public function getSearchFilter($bIsSearchQuery = false) { $aPages = array(20, 25, 30, 35, 40, 45, 50); $aDisplays = array(); foreach ($aPages as $iPageCnt) { $aDisplays[$iPageCnt] = Phpfox::getPhrase('core.per_page', array('total' => $iPageCnt)); } $aSorts = array('ft.time_update' => Phpfox::getPhrase('forum.post_time'), 'u.full_name' => Phpfox::getPhrase('forum.author'), 'ft.total_post' => Phpfox::getPhrase('forum.replies'), 'ft.title' => Phpfox::getPhrase('forum.subject'), 'ft.total_view' => Phpfox::getPhrase('forum.views')); $aFilters = array('display' => array('type' => 'select', 'options' => $aDisplays, 'default' => '20'), 'sort' => array('type' => 'select', 'options' => $aSorts, 'default' => 'ft.time_update'), 'sort_by' => array('type' => 'select', 'options' => array('DESC' => Phpfox::getPhrase('core.descending'), 'ASC' => Phpfox::getPhrase('core.ascending')), 'default' => 'DESC'), 'keyword' => array('type' => 'input:text', 'size' => '40'), 'user' => array('type' => 'input:text', 'size' => '40'), 'result' => array('type' => 'input:radio', 'options' => array('0' => Phpfox::getPhrase('forum.threads'), '1' => Phpfox::getPhrase('forum.posts'))), 'days_prune' => array('type' => 'select', 'options' => array('1' => Phpfox::getPhrase('forum.last_day'), '2' => Phpfox::getPhrase('forum.last_2_days'), '7' => Phpfox::getPhrase('forum.last_week'), '10' => Phpfox::getPhrase('forum.last_10_days'), '14' => Phpfox::getPhrase('forum.last_2_weeks'), '30' => Phpfox::getPhrase('forum.last_month'), '45' => Phpfox::getPhrase('forum.last_45_days'), '60' => Phpfox::getPhrase('forum.last_2_months'), '75' => Phpfox::getPhrase('forum.last_75_days'), '100' => Phpfox::getPhrase('forum.last_100_days'), '365' => Phpfox::getPhrase('forum.last_year'), '-1' => Phpfox::getPhrase('forum.beginning')), 'default_view' => '-1')); $aSettings = array('type' => 'forum', 'search_tool' => array('table_alias' => 'ft', 'search' => array('action' => '', 'default_value' => 'Search this forum...', 'name' => 'search', 'field' => array('ft.title')), 'sort' => array('latest' => array('ft.time_update', Phpfox::getPhrase('blog.latest'))), 'show' => array(20)), 'field' => array('depend' => 'result', 'fields' => array('fp.post_id', 'ft.thread_id'))); if ($bIsSearchQuery) { $aSettings['search'] = array('keyword', 'user'); } return Phpfox_Search::instance()->set($aSettings); }
public function get($mConditions = array(), $sOrder = 'ft.time_update DESC', $iPage = '', $iPageSize = '', $bCount = true) { $aPosts = array(); $iCnt = $bCount ? $this->database()->select('COUNT(*)')->from($this->_sTable, 'fp')->where($mConditions)->execute('getSlaveField') : true; if ($iCnt) { $aPosts = $this->database()->select('f.forum_id, f.name AS forum_name, f.name_url AS forum_url, ft.title AS thread_title, ft.group_id, ft.thread_id, ft.title_url AS thread_title_url, fp.post_id, fp.view_id, fp.time_stamp, fp.title, ' . (Phpfox::getParam('core.allow_html') ? 'fpt.text_parsed' : 'fpt.text') . ' AS text, ' . Phpfox::getUserField())->from(Phpfox::getT('forum_post'), 'fp')->join(Phpfox::getT('forum_thread'), 'ft', 'ft.thread_id = fp.thread_id')->join(Phpfox::getT('user'), 'u', 'u.user_id = fp.user_id')->leftJoin(Phpfox::getT('forum'), 'f', 'f.forum_id = ft.forum_id')->join(Phpfox::getT('forum_post_text'), 'fpt', 'fpt.post_id = fp.post_id')->where($mConditions)->order($sOrder)->limit($iPage, $iPageSize, $iCnt)->execute('getSlaveRows'); $iTotal = $iPage > 1 ? $iPageSize * $iPage - $iPageSize : 0; foreach ($aPosts as $iKey => $aPost) { $iTotal++; if (isset($this->_aCallback['group_id'])) { $sLink = Phpfox_Url::instance()->makeUrl($this->_aCallback['url_home'], array($aPost['thread_title_url'], 'post' => $aPost['post_id'])); } else { $sLink = Phpfox_Url::instance()->makeUrl('forum', array($aPost['forum_url'] . '-' . $aPost['forum_id'], $aPost['thread_title_url'], 'post' => $aPost['post_id'])); } $aPosts[$iKey]['count'] = $iTotal; $aPosts[$iKey]['text'] = Phpfox_Search::instance()->highlight('keyword', $aPost['text']); $aPosts[$iKey]['forum_info_phrase'] = Phpfox::getPhrase('forum.title_posted_in_forum_name', array('link' => $sLink, 'title' => Phpfox::getLib('parse.output')->clean($aPost['thread_title']), 'forum_link' => isset($this->_aCallback['group_id']) ? Phpfox_Url::instance()->makeUrl($this->_aCallback['url_home']) : Phpfox_Url::instance()->makeUrl('forum', array($aPost['forum_url'] . '-' . $aPost['forum_id'])), 'forum_name' => isset($this->_aCallback['group_id']) ? $this->_aCallback['title'] : $aPost['forum_name'])); } } if (!$bCount) { return $aPosts; } return array($iCnt, $aPosts); }
/** * Reset the search * */ public function reset() { $this->_aRows = array(); $this->_iCnt = 0; $this->_aConditions = array(); $this->_aParams = array(); Phpfox_Search::instance()->reset(); }
/** * Controller */ public function process() { if ($this->request()->get('featured') || $this->request()->get('recommend')) { return function () { $users = []; if ($this->request()->get('recommend')) { $title = Phpfox::getPhrase('user.recommended_users'); $users = Friend_Service_Suggestion::instance()->get(); if (!$users) { $users = User_Service_Featured_Featured::instance()->getOtherGender(); } } else { $title = Phpfox::getPhrase('user.recently_active'); $users = User_Service_Featured_Featured::instance()->getRecentActiveUsers(); } if (is_array($users) && !$users || $users === true) { return ''; } echo '<div class="block_clear"><div class="title">' . $title . '</div><div class="content">'; foreach ($users as $user) { $this->template()->assign('aUser', $user)->getTemplate('user.block.rows'); } echo '</div></div>'; }; } if ($sPlugin = Phpfox_Plugin::get('user.component_controller_browse__1')) { eval($sPlugin); if (isset($aPluginReturn)) { return $aPluginReturn; } } $aCallback = $this->getParam('aCallback', false); if ($aCallback !== false) { if (!Phpfox::getService('group')->hasAccess($aCallback['item'], 'can_view_members')) { return Phpfox_Error::display(Phpfox::getPhrase('user.members_section_is_closed')); } } if (defined('PHPFOX_IS_ADMIN_SEARCH')) { $aIds = $this->request()->getArray('id'); if (($aIds = $this->request()->getArray('id')) && count((array) $aIds)) { Phpfox::getUserParam('user.can_delete_others_account', true); if ($this->request()->get('delete')) { foreach ($aIds as $iId) { if (Phpfox::getService('user')->isAdminUser($iId)) { $this->url()->send('current', null, Phpfox::getPhrase('user.you_are_unable_to_delete_a_site_administrator')); } Phpfox::getService('user.auth')->setUserId($iId); Phpfox::massCallback('onDeleteUser', $iId); Phpfox::getService('user.auth')->setUserId(null); } $this->url()->send('current', null, Phpfox::getPhrase('user.user_s_successfully_deleted')); } elseif ($this->request()->get('ban') || $this->request()->get('unban')) { foreach ($aIds as $iId) { if (Phpfox::getService('user')->isAdminUser($iId)) { $this->url()->send('current', null, Phpfox::getPhrase('user.you_are_unable_to_ban_a_site_administrator')); } Phpfox::getService('user.process')->ban($iId, $this->request()->get('ban') ? 1 : 0); } $this->url()->send('current', null, $this->request()->get('ban') ? Phpfox::getPhrase('user.user_s_successfully_banned') : Phpfox::getPhrase('user.user_s_successfully_un_banned')); } elseif ($this->request()->get('resend-verify')) { foreach ($aIds as $iId) { Phpfox::getService('user.verify.process')->sendMail($iId); } $this->url()->send('current', null, Phpfox::getPhrase('user.email_verification_s_sent')); } elseif ($this->request()->get('verify')) { foreach ($aIds as $iId) { Phpfox::getService('user.verify.process')->adminVerify($iId); } $this->url()->send('current', null, Phpfox::getPhrase('user.user_s_verified')); } elseif ($this->request()->get('approve')) { foreach ($aIds as $iId) { Phpfox::getService('user.process')->userPending($iId, '1'); } $this->url()->send('current', null, Phpfox::getPhrase('user.user_s_successfully_approved')); } } } else { $aCheckParams = array('url' => $this->url()->makeUrl('user.browse'), 'start' => 2, 'reqs' => array('2' => array('browse'))); if (Phpfox::getParam('core.force_404_check') && !PHPFOX_IS_AJAX && !Phpfox::getService('core.redirect')->check404($aCheckParams)) { return Phpfox_Module::instance()->setController('error.404'); } } $aPages = Phpfox::isMobile() ? array(10) : array(21, 31, 41, 51); $aDisplays = array(); foreach ($aPages as $iPageCnt) { $aDisplays[$iPageCnt] = Phpfox::getPhrase('core.per_page', array('total' => $iPageCnt)); } $aSorts = array('u.full_name' => Phpfox::getPhrase('user.name'), 'u.joined' => Phpfox::getPhrase('user.joined'), 'u.last_login' => Phpfox::getPhrase('user.last_login'), 'ufield.total_rating' => Phpfox::getPhrase('user.rating')); $aAge = array(); for ($i = Phpfox::getService('user')->age(Phpfox::getService('user')->buildAge(1, 1, Phpfox::getParam('user.date_of_birth_end'))); $i <= Phpfox::getService('user')->age(Phpfox::getService('user')->buildAge(1, 1, Phpfox::getParam('user.date_of_birth_start'))); $i++) { $aAge[$i] = $i; } $iDay = date('d'); $iMonth = date('m'); $iYear = date('Y'); $aUserGroups = array(); foreach (Phpfox::getService('user.group')->get() as $aUserGroup) { $aUserGroups[$aUserGroup['user_group_id']] = Phpfox_Locale::instance()->convert($aUserGroup['title']); } $aGenders = Phpfox::getService('core')->getGenders(); $aGenders[''] = count($aGenders) == '2' ? Phpfox::getPhrase('user.both') : Phpfox::getPhrase('core.all'); if ($sPlugin = Phpfox_Plugin::get('user.component_controller_browse_genders')) { eval($sPlugin); } $sDefaultOrderName = 'u.last_login'; $sDefaultSort = 'DESC'; if (Phpfox::getParam('user.user_browse_default_result') == 'last_login') { $sDefaultOrderName = 'u.last_login'; $sDefaultSort = 'DESC'; } $aFilters = array('display' => array('type' => 'select', 'options' => $aDisplays, 'default' => 21), 'sort' => array('type' => 'select', 'options' => $aSorts, 'default' => $sDefaultOrderName), 'sort_by' => array('type' => 'select', 'options' => array('DESC' => Phpfox::getPhrase('core.descending'), 'ASC' => Phpfox::getPhrase('core.ascending')), 'default' => $sDefaultSort), 'keyword' => array('type' => 'input:text', 'size' => 15, 'class' => 'txt_input'), 'type' => array('type' => 'select', 'options' => array('0' => array(Phpfox::getPhrase('user.email_name'), 'AND ((u.full_name LIKE \'%[VALUE]%\' OR (u.email LIKE \'%[VALUE]@%\' OR u.email = \'[VALUE]\'))' . (defined('PHPFOX_IS_ADMIN_SEARCH') ? ' OR u.email LIKE \'%[VALUE]\'' : '') . ')'), '1' => array(Phpfox::getPhrase('user.email'), 'AND ((u.email LIKE \'%[VALUE]@%\' OR u.email = \'[VALUE]\'' . (defined('PHPFOX_IS_ADMIN_SEARCH') ? ' OR u.email LIKE \'%[VALUE]%\'' : '') . '))'), '2' => array(Phpfox::getPhrase('user.name'), 'AND (u.full_name LIKE \'%[VALUE]%\')')), 'depend' => 'keyword'), 'group' => array('type' => 'select', 'options' => $aUserGroups, 'add_any' => true, 'search' => 'AND u.user_group_id = \'[VALUE]\''), 'gender' => array('type' => 'input:radio', 'options' => $aGenders, 'default_view' => '', 'search' => 'AND u.gender = \'[VALUE]\'', 'suffix' => '<br />'), 'from' => array('type' => 'select', 'options' => $aAge, 'select_value' => 'From'), 'to' => array('type' => 'select', 'options' => $aAge, 'select_value' => 'To'), 'country' => array('type' => 'select', 'options' => Phpfox::getService('core.country')->get(), 'search' => 'AND u.country_iso = \'[VALUE]\'', 'add_any' => true, 'id' => 'country_iso'), 'country_child_id' => array('type' => 'select', 'search' => 'AND ufield.country_child_id = \'[VALUE]\'', 'clone' => true), 'status' => array('type' => 'select', 'options' => array('2' => Phpfox::getPhrase('user.all_members'), '1' => Phpfox::getPhrase('user.featured_members'), '4' => Phpfox::getPhrase('user.online'), '3' => Phpfox::getPhrase('user.pending_verification_members'), '5' => Phpfox::getPhrase('user.pending_approval'), '6' => Phpfox::getPhrase('user.not_approved')), 'default_view' => '2'), 'city' => array('type' => 'input:text', 'size' => 15, 'search' => 'AND ufield.city_location LIKE \'%[VALUE]%\''), 'zip' => array('type' => 'input:text', 'size' => 10, 'search' => 'AND ufield.postal_code = \'[VALUE]\''), 'show' => array('type' => 'select', 'options' => array('1' => Phpfox::getPhrase('user.name_and_photo_only'), '2' => Phpfox::getPhrase('user.name_photo_and_users_details')), 'default_view' => Phpfox::getParam('user.user_browse_display_results_default') == 'name_photo_detail' ? '2' : '1'), 'ip' => array('type' => 'input:text', 'size' => 10)); if (!Phpfox::getUserParam('user.can_search_by_zip')) { unset($aFilters['zip']); } if ($sPlugin = Phpfox_Plugin::get('user.component_controller_browse_filter')) { eval($sPlugin); } $aSearchParams = array('type' => 'browse', 'filters' => $aFilters, 'search' => 'keyword', 'custom_search' => true); if (!defined('PHPFOX_IS_ADMIN_SEARCH')) { $aSearchParams['no_session_search'] = true; } $oFilter = Phpfox_Search::instance()->set($aSearchParams); $sStatus = $oFilter->get('status'); $sView = $this->request()->get('view'); $aCustomSearch = $oFilter->getCustom(); $bIsOnline = false; $bPendingMail = false; $mFeatured = false; $bIsGender = false; switch ((int) $sStatus) { case 1: $mFeatured = true; break; case 3: if (defined('PHPFOX_IS_ADMIN_SEARCH')) { $oFilter->setCondition('AND u.status_id = 1'); } break; case 4: $bIsOnline = true; break; case 5: if (defined('PHPFOX_IS_ADMIN_SEARCH')) { $oFilter->setCondition('AND u.view_id = 1'); } break; case 6: if (defined('PHPFOX_IS_ADMIN_SEARCH')) { $oFilter->setCondition('AND u.view_id = 2'); } break; default: break; } $this->template()->setTitle(Phpfox::getPhrase('user.browse_members'))->setBreadcrumb(Phpfox::getPhrase('user.browse_members'), $aCallback !== false ? $this->url()->makeUrl($aCallback['url_home']) : $this->url()->makeUrl((defined('PHPFOX_IS_ADMIN_SEARCH') ? 'admincp.' : '') . 'user.browse')); if (!empty($sView)) { switch ($sView) { case 'online': $bIsOnline = true; break; case 'featured': $mFeatured = true; break; case 'spam': $oFilter->setCondition('u.total_spam > ' . (int) Phpfox::getParam('core.auto_deny_items')); break; case 'pending': if (defined('PHPFOX_IS_ADMIN_SEARCH')) { $oFilter->setCondition('u.view_id = 1'); } break; case 'top': $bExtendContent = true; $oFilter->setSort('ufield.total_rating'); $oFilter->setCondition('AND ufield.total_rating > ' . Phpfox::getParam('user.min_count_for_top_rating')); if ($iUserGenderTop = $this->request()->getInt('topgender')) { $oFilter->setCondition('AND u.gender = ' . (int) $iUserGenderTop); } $iFilterCount = 0; $aFilterMenuCache = array(); $aFilterMenu = array(Phpfox::getPhrase('user.all') => '', Phpfox::getPhrase('user.male') => '1', Phpfox::getPhrase('user.female') => '2'); if ($sPlugin = Phpfox_Plugin::get('user.component_controller_browse_genders_top_users')) { eval($sPlugin); } $this->template()->setTitle(Phpfox::getPhrase('user.top_rated_members'))->setBreadcrumb(Phpfox::getPhrase('user.top_rated_members'), $this->url()->makeUrl('user.browse', array('view' => 'top'))); foreach ($aFilterMenu as $sMenuName => $sMenuLink) { $iFilterCount++; $aFilterMenuCache[] = array('name' => $sMenuName, 'link' => $this->url()->makeUrl('user.browse', array('view' => 'top', 'topgender' => $sMenuLink)), 'active' => $this->request()->get('topgender') == $sMenuLink ? true : false, 'last' => count($aFilterMenu) === $iFilterCount ? true : false); if ($this->request()->get('topgender') == $sMenuLink) { $this->template()->setTitle($sMenuName)->setBreadcrumb($sMenuName, null, true); } } $this->template()->assign(array('aFilterMenus' => $aFilterMenuCache)); break; default: break; } } if (($iFrom = $oFilter->get('from')) || ($iFrom = $this->request()->getInt('from'))) { $oFilter->setcondition('AND u.birthday_search <= \'' . Phpfox::getLib('date')->mktime(0, 0, 0, 1, 1, $iYear - $iFrom) . '\'' . (defined('PHPFOX_IS_ADMIN_SEARCH') && Phpfox::getUserParam('user.remove_users_hidden_age') ? '' : ' AND ufield.dob_setting IN(0,1,2)')); $bIsGender = true; } if (($iTo = $oFilter->get('to')) || ($iTo = $this->request()->getInt('to'))) { $oFilter->setcondition('AND u.birthday_search >= \'' . Phpfox::getLib('date')->mktime(0, 0, 0, 1, 1, $iYear - $iTo) . '\'' . (defined('PHPFOX_IS_ADMIN_SEARCH') && Phpfox::getUserParam('user.remove_users_hidden_age') ? '' : ' AND ufield.dob_setting IN(0,1,2)')); $bIsGender = true; } if ($sLocation = $this->request()->get('location')) { $oFilter->setCondition('AND u.country_iso = \'' . Phpfox_Database::instance()->escape($sLocation) . '\''); } if ($sGender = $this->request()->getInt('gender')) { $oFilter->setCondition('AND u.gender = \'' . Phpfox_Database::instance()->escape($sGender) . '\''); } if ($sLocationChild = $this->request()->getInt('state')) { $oFilter->setCondition('AND ufield.country_child_id = \'' . Phpfox_Database::instance()->escape($sLocationChild) . '\''); } if ($sLocationCity = $this->request()->get('city-name')) { $oFilter->setCondition('AND ufield.city_location = \'' . Phpfox_Database::instance()->escape(Phpfox::getLib('parse.input')->convert($sLocationCity)) . '\''); } if (!defined('PHPFOX_IS_ADMIN_SEARCH')) { $oFilter->setCondition('AND u.status_id = 0 AND u.view_id = 0'); } else { $oFilter->setCondition('AND u.profile_page_id = 0'); } if (defined('PHPFOX_IS_ADMIN_SEARCH') && ($sIp = $oFilter->get('ip'))) { Phpfox::getService('user.browse')->ip($sIp); } $bExtend = defined('PHPFOX_IS_ADMIN_SEARCH') ? true : ($oFilter->get('show') && $oFilter->get('show') == '2' || !$oFilter->get('show') && Phpfox::getParam('user.user_browse_display_results_default') == 'name_photo_detail' ? true : false); $iPage = $this->request()->getInt('page'); $iPageSize = $oFilter->getDisplay(); if ($sPlugin = Phpfox_Plugin::get('user.component_controller_browse_filter_process')) { eval($sPlugin); } $iCnt = 0; $aUsers = []; if ($oFilter->isSearch() || defined('PHPFOX_IS_ADMIN_SEARCH')) { list($iCnt, $aUsers) = User_Service_Browse::instance()->conditions($oFilter->getConditions())->callback($aCallback)->sort($oFilter->getSort())->page($oFilter->getPage())->limit($iPageSize)->online($bIsOnline)->extend(isset($bExtendContent) ? true : $bExtend)->featured($mFeatured)->pending($bPendingMail)->custom($aCustomSearch)->gender($bIsGender)->get(); } else { // $aFeatured = User_Service_Featured_Featured::instance()->get(); $this->template()->assign(['highlightUsers' => 1]); } /* foreach ($aUsers as $iIndex => $aUser) { $aUsers[$iIndex]['full_name'] = substr($aUser['full_name'], 0, Phpfox::getParam('user.maximum_length_for_full_name')); } */ $iCnt = $oFilter->getSearchTotal($iCnt); $aNewCustomValues = array(); if ($aCustomValues = $this->request()->get('custom')) { foreach ($aCustomValues as $iKey => $sCustomValue) { $aNewCustomValues['custom[' . $iKey . ']'] = $sCustomValue; } } else { $aCustomValues = array(); } if (!defined('PHPFOX_IS_ADMIN_SEARCH')) { //Phpfox_Pager::instance()->set(array('page' => $iPage, 'size' => $iPageSize, 'count' => $iCnt, 'ajax' => 'user.mainBrowse')); Phpfox_Pager::instance()->set(array('page' => $iPage, 'size' => $iPageSize, 'count' => $iCnt, 'ajax' => 'user.mainBrowse', 'aParams' => $aNewCustomValues)); } else { Phpfox_Pager::instance()->set(array('page' => $iPage, 'size' => $iPageSize, 'count' => $iCnt)); } Phpfox_Url::instance()->setParam('page', $iPage); if ($this->request()->get('featured') == 1) { $this->template()->setHeader(array('drag.js' => 'static_script', '<script type="text/javascript">$Behavior.coreDragInit = function() { Core_drag.init({table: \'#js_drag_drop\', ajax: \'user.setFeaturedOrder\'}); }</script>'))->assign(array('bShowFeatured' => 1)); } foreach ($aUsers as $iKey => $aUser) { if (!isset($aUser['user_group_id']) || empty($aUser['user_group_id']) || $aUser['user_group_id'] < 1) { $aUser['user_group_id'] = $aUsers[$iKey]['user_group_id'] = 5; Phpfox::getService('user.process')->updateUserGroup($aUser['user_id'], 5); $aUsers[$iKey]['user_group_title'] = Phpfox::getPhrase('user.user_banned'); } $aBanned = Phpfox::getService('ban')->isUserBanned($aUser); $aUsers[$iKey]['is_banned'] = $aBanned['is_banned']; } $aCustomFields = Phpfox::getService('custom')->getForPublic('user_profile'); $this->template()->setHeader('cache', array('country.js' => 'module_core'))->assign(array('aUsers' => $aUsers, 'bExtend' => $bExtend, 'aCallback' => $aCallback, 'bIsSearch' => $oFilter->isSearch(), 'bIsInSearchMode' => $this->request()->getInt('search-id') ? true : false, 'aForms' => $aCustomSearch, 'aCustomFields' => $aCustomFields, 'sView' => $sView)); // add breadcrumb if its in the featured members page and not in admin if (!defined('PHPFOX_IS_ADMIN_SEARCH')) { Phpfox::getUserParam('user.can_browse_users_in_public', true); $this->template()->setHeader('cache', array()); if (!Phpfox::isMobile()) { $this->template()->setHeader('cache', array('browse.js' => 'module_user')); } if ($this->request()->get('view') == 'featured') { $this->template()->setBreadCrumb(Phpfox::getPhrase('user.featured_members'), null, true); $sTitle = Phpfox::getPhrase('user.title_featured_members'); if (!empty($sTitle)) { $this->template()->setTitle($sTitle); } } elseif ($this->request()->get('view') == 'online') { $this->template()->setBreadCrumb(Phpfox::getPhrase('user.menu_who_s_online'), null, true); $sTitle = Phpfox::getPhrase('user.title_who_s_online'); if (!empty($sTitle)) { $this->template()->setTitle($sTitle); } } } if ($aCallback !== false) { $this->template()->rebuildMenu('user.browse', $aCallback['url'])->removeUrl('user.browse', 'user.browse.view_featured'); } }
/** * Controller */ public function process() { Phpfox::getUserParam('language.can_manage_lang_packs', true); $iPage = $this->request()->getInt('page'); $oPhraseProcess = Phpfox::getService('language.phrase.process'); $oCache = Phpfox::getLib('cache'); if ($this->request()->get('save') && ($aTexts = $this->request()->getArray('text'))) { foreach ($aTexts as $iKey => $sText) { $oPhraseProcess->update($iKey, $sText); } $oCache->remove('locale', 'substr'); $this->url()->send('current', null, Phpfox::getPhrase('language.phrase_s_updated')); } if ($this->request()->get('save_selected') && ($aTexts = $this->request()->getArray('text')) && ($aIds = $this->request()->getArray('id'))) { foreach ($aTexts as $iKey => $sText) { if (!in_array($iKey, $aIds)) { continue; } $oPhraseProcess->update($iKey, $sText); } $oCache->remove('locale', 'substr'); $this->url()->send('current', null, Phpfox::getPhrase('language.phrase_s_updated')); } if ($this->request()->get('revert_selected') && ($aIds = $this->request()->getArray('id'))) { if ($oPhraseProcess->revert($aIds)) { $oCache->remove('locale', 'substr'); $this->url()->send('current', null, Phpfox::getPhrase('language.selected_phrase_s_successfully_reverted')); } } if ($this->request()->get('delete') && ($aIds = $this->request()->getArray('id'))) { foreach ($aIds as $iId) { $oPhraseProcess->delete($iId); } $oCache->remove('locale', 'substr'); $this->url()->send('current', null, Phpfox::getPhrase('language.selected_phrase_s_successfully_deleted')); } $aModules = Phpfox::getService('admincp.module')->getModules(); $aModules = array_flip($aModules); $aLanguages = Phpfox::getService('language')->get(); $aLangs = array(); foreach ($aLanguages as $aLanguage) { $aLangs[$aLanguage['language_id']] = $aLanguage['title']; } $aPages = array(20, 40, 60, 80, 100); $aDisplays = array(); foreach ($aPages as $iPageCnt) { $aDisplays[$iPageCnt] = Phpfox::getPhrase('core.per_page', array('total' => $iPageCnt)); } $aSorts = array('added' => Phpfox::getPhrase('core.time'), 'phrase_id' => Phpfox::getPhrase('language.phrase_id')); $aFilters = array('display' => array('type' => 'select', 'options' => $aDisplays, 'default' => '20'), 'sort' => array('type' => 'select', 'options' => $aSorts, 'default' => 'added', 'alias' => 'lp'), 'sort_by' => array('type' => 'select', 'options' => array('DESC' => Phpfox::getPhrase('core.descending'), 'ASC' => Phpfox::getPhrase('core.ascending')), 'default' => 'DESC'), 'module_id' => array('type' => 'select', 'options' => $aModules, 'add_select' => true, 'search' => "AND lp.module_id = '[VALUE]'"), 'language_id' => array('type' => 'select', 'options' => $aLangs, 'add_select' => true, 'search' => "AND lp.language_id = '[VALUE]'", 'id' => 'js_language_id'), 'translate_type' => array('type' => 'select', 'options' => array('0' => Phpfox::getPhrase('language.all_phrases'), '1' => Phpfox::getPhrase('language.not_translated'), '2' => Phpfox::getPhrase('language.translated_only'))), 'search' => array('type' => 'input:text'), 'search_type' => array('type' => 'input:radio', 'options' => array('0' => array(Phpfox::getPhrase('language.phrase_text_only'), "AND lp.text LIKE '%[VALUE]%'"), '1' => array(Phpfox::getPhrase('language.phrase_variable_name_only'), "AND lp.var_name LIKE '%[VALUE]%'"), '2' => array(Phpfox::getPhrase('language.phrase_text_and_phrase_variable_name'), "AND (lp.text LIKE '%[VALUE]%' OR lp.var_name LIKE '%[VALUE]%')")), 'depend' => 'search', 'prefix' => '<div>', 'suffix' => '</div>', 'default' => '0')); $oSearch = Phpfox_Search::instance()->set(array('type' => 'phrases', 'filters' => $aFilters, 'cache' => true, 'field' => 'lp.phrase_id', 'search' => 'search')); if ($oSearch->isSearch()) { $aResults = Phpfox::getService('language.phrase')->getSearch($oSearch->getConditions(), $oSearch->getSort()); if (count($aResults)) { $oSearch->cacheResults('search', $aResults); } } $bIsForceLanguagePackage = false; if ($iLangId = $this->request()->get('lang-id')) { $bIsForceLanguagePackage = true; $oSearch->setCondition('AND lp.language_id = \'' . Phpfox_Database::instance()->escape($iLangId) . '\''); $this->template()->setHeader('<script type="text/javascript">$Behavior.language_admincp_phrase = function(){ $(\'#js_language_id\').val(\'' . $iLangId . '\'); };</script>'); } if (empty($iLangId) && ($iLangId = $oSearch->get('language_id'))) { } if ($sTranslate = $oSearch->get('translate_type')) { if ($sTranslate == '1') { $oSearch->setCondition('AND lp.text = lp.text_default'); } elseif ($sTranslate == '2') { $oSearch->setCondition('AND lp.text != lp.text_default'); } } $iPageSize = $oSearch->getDisplay(); list($iCnt, $aRows) = Phpfox::getService('language.phrase')->get($oSearch->getConditions(), $oSearch->getSort(), $oSearch->getPage(), $iPageSize); $oSearchOutput = Phpfox::getLib('parse.output'); $aOut = array(); foreach ($aRows as $iKey => $aRow) { $aOut[$aRow['phrase_id']] = $aRow; $aOut[$aRow['phrase_id']]['sample_text'] = $oSearch->highlight('search', $oSearchOutput->htmlspecialchars($aRow['text_default'])); $aOut[$aRow['phrase_id']]['is_translated'] = md5($aRow['text_default']) != md5($aRow['text']) ? true : false; } $aRows = $aOut; Phpfox_Pager::instance()->set(array('page' => $iPage, 'size' => $iPageSize, 'count' => $oSearch->getSearchTotal($iCnt))); if (PHPFOX_IS_TECHIE) { $this->template()->setActionMenu(['New Phrase' => ['url' => $this->url()->makeUrl('admincp.language.phrase.add'), 'class' => 'popup']]); } $this->template()->assign(array('aRows' => $aRows, 'iPage' => $iPage, 'sSearchId' => $this->request()->get('search-rid'), 'sSearchIdNormal' => $this->request()->get('search-id'), 'iLangId' => $iLangId, 'bIsForceLanguagePackage' => $bIsForceLanguagePackage))->setSectionTitle('Phrases')->setTitle(Phpfox::getPhrase('language.phrase_manager')); }