public function query($sQuery, $iPage, $iTotalShow, $sView = null) { if ($sView !== null && Phpfox::isModule($sView)) { $aModuleResults = Phpfox::callback($sView . '.globalUnionSearch', $this->preParse()->clean($sQuery)); } else { $aModuleResults = Phpfox::massCallback('globalUnionSearch', $this->preParse()->clean($sQuery)); } $iOffset = ($iPage * $iTotalShow); $aRows = $this->database()->select('item.*, ' . Phpfox::getUserField()) ->unionFrom('item') ->join(Phpfox::getT('user'), 'u', 'u.user_id = item.item_user_id') ->limit($iOffset, $iTotalShow) ->order('item_time_stamp DESC') ->execute('getSlaveRows'); $aResults = array(); foreach ($aRows as $iKey => $aRow) { $aResults[] = array_merge($aRow, (array) Phpfox::callback($aRow['item_type_id'] . '.getSearchInfo', $aRow)); } return $aResults; }
public function getAll() { $aInputs = $this->database()->select('i.*')->from(Phpfox::getT('input_field'), 'i')->order('i.ordering ASC')->execute('getSlaveRows'); $aOut = array(); $aCallbacks = Phpfox::massCallback('getEnabledInputField'); foreach ($aInputs as $aInput) { $sName = ''; foreach ($aCallbacks as $sModule => $aVals) { foreach ($aVals as $aVal) { if ($aVal['action'] == $aInput['action']) { $sName = $aVal['module_phrase']; break 2; } } } if (empty($sName)) { continue; } if (!isset($aOut[$sName])) { $aOut[$sName] = array(); } if (!isset($aOut[$sName][$aInput['action']])) { $aOut[$sName][$aInput['action']] = array(); } // we need to add the phrase to this $aOut[$sName][$aInput['action']][] = $aInput; } return $aOut; }
public function getSiteStatsForAdmin($iStartTime, $iEndTime) { $aStats = array(); $iTime = 0; $aCallback = Phpfox::massCallback('getSiteStatsForAdmin', $iStartTime, $iEndTime); $sSetting = Phpfox::getParam('core.official_launch_of_site'); $aParams = explode('/', $sSetting); if (isset($aParams[0]) && isset($aParams[1])) { $iDiff = round(abs(mktime(0, 0, 0, $aParams[0], $aParams[1], $aParams[2]) - PHPFOX_TIME) / 86400); } foreach ($aCallback as $iKey => $aValue) { if (isset($aValue[0])) { foreach ($aValue as $aSubValue) { $aCallback[] = $aSubValue; } unset($aCallback[$iKey]); } } foreach ($aCallback as $aValue) { if (empty($aValue['total'])) { continue; } if (isset($iDiff)) { $aValue['average'] = round((int) $aValue['total'] / ($iDiff == 0 ? 1 : $iDiff), 2); } $aStats[] = $aValue; } return $aStats; }
public function get($iUserId = null) { $aUserPrivacy = Phpfox::getService('user.privacy')->getUserSettings($iUserId); $aNotifications = Phpfox::massCallback('getNotificationSettings'); $aProfiles = Phpfox::massCallback('getProfileSettings'); $aItems = Phpfox::massCallback('getGlobalPrivacySettings'); if (is_array($aNotifications)) { foreach ($aNotifications as $sModule => $aModules) { if (!is_array($aModules)) { continue; } foreach ($aModules as $sKey => $aNotification) { if (isset($aUserPrivacy['notification'][$sKey])) { $aNotifications[$sModule][$sKey]['default'] = 0; } } } } foreach ($aProfiles as $sModule => $aModules) { foreach ($aModules as $sKey => $aProfile) { if (isset($aUserPrivacy['privacy'][$sKey])) { $aProfiles[$sModule][$sKey]['default'] = $aUserPrivacy['privacy'][$sKey]; } else { $aProfiles[$sModule][$sKey]['default'] = isset($aProfiles[$sModule][$sKey]['default']) ? $aProfiles[$sModule][$sKey]['default'] : 0; } } } foreach ($aItems as $sModule => $aModules) { foreach ($aModules as $sKey => $aItem) { $aItems[$sModule][$sKey]['custom_id'] = str_replace('.', '_', $sKey); } } return array($aUserPrivacy, $aNotifications, $aProfiles, $aItems); }
/** * Class process method wnich is used to execute this component. */ public function process() { if ($this->request()->get('update')) { $aModules = Phpfox::massCallback('getSqlTitleField'); $aParseTables = array(); if (is_array($aModules) && count($aModules)) { foreach ($aModules as $aModule) { if (isset($aModule['table'])) { $aModule = array($aModule); } foreach ($aModule as $aInfo) { $aParseTables[] = $aInfo; } } } $oDb = Phpfox::getLib('database'); foreach ($aParseTables as $aParseTable) { if (isset($aParseTable['has_index'])) { $aIndexes = Phpfox::getLib('database.support')->getIndexes(Phpfox::getT($aParseTable['table']), null, $oDb, true); foreach ($aIndexes as $aIndex) { if ($aIndex['Column_name'] == $aParseTable['has_index']) { $oDb->query('ALTER TABLE ' . Phpfox::getT($aParseTable['table']) . ' DROP INDEX ' . $aIndex['Key_name']); } } } Phpfox::getLib('database')->query('ALTER TABLE ' . Phpfox::getT($aParseTable['table']) . ' CHANGE ' . $aParseTable['field'] . ' ' . $aParseTable['field'] . ' text'); } $this->url()->send('admincp.sql.title', null, Phpfox::getPhrase('admincp.database_tables_updated')); } $this->template()->setTitle(Phpfox::getPhrase('admincp.alter_title_fields'))->setBreadcrumb(Phpfox::getPhrase('admincp.alter_title_fields'))->assign(array()); }
public function update() { Phpfox::massCallback('getGlobalNotifications'); if ($sPlugin = Phpfox_Plugin::get('notification.component_ajax_update_1')) { eval($sPlugin); } $this->call('$Core.notification.setTitle();'); }
/** * 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'))); }
/** * Controller */ public function process() { $aUser = Phpfox::getService('user')->get(Phpfox::getUserId(), true); $aModules = Phpfox::massCallback('getDashboardActivity'); $aActivites = array(Phpfox::getPhrase('core.total_items') => $aUser['activity_total'], Phpfox::getPhrase('core.activity_points') => $aUser['activity_points'] . (Phpfox::getParam('user.can_purchase_activity_points') ? '<span id="purchase_points_link">(<a href="#" onclick="$Core.box(\'user.purchasePoints\', 500); return false;">' . Phpfox::getPhrase('user.purchase_points') . '</a>)</span>' : '')); foreach ($aModules as $aModule) { foreach ($aModule as $sPhrase => $sLink) { $aActivites[$sPhrase] = $sLink; } } $this->template()->assign(array('aActivites' => $aActivites)); }
public function getMenu() { $aMenus = array(); $aCallback = Phpfox::massCallback('mobileMenu'); foreach ($aCallback as $sModule => $aReturn) { $aMenus[] = $aReturn; } return $aMenus; }
/** * Controller */ public function process() { $aModules = Phpfox::massCallback('reparserList'); foreach ($aModules as $iKey => $aModule) { if (!isset($aModule['name'])) { unset($aModules[$iKey]); $iCnt = 0; foreach ($aModule as $iModuleKey => $aCacheModule) { $iCnt++; $aModules = array_merge($aModules, array('custom' . $iCnt => $aCacheModule)); } } } foreach ($aModules as $iKey => $aModule) { if (!isset($aModule['name'])) { foreach ($aModule as $iSubKey => $aSub) { $aModules[$iKey . '_' . $iSubKey] = $aSub; } unset($aModules[$iKey]); } if (is_array($aModule['table'])) { $aModule['table'] = $aModule['table'][0]; } $aModules[$iKey]['total_record'] = Phpfox_Database::instance()->select('COUNT(*)')->from(Phpfox::getT($aModule['table']))->execute('getSlaveField'); if ($aModules[$iKey]['total_record'] == 0) { unset($aModules[$iKey]); } } $iPage = $this->request()->get('page'); $iLimit = 200; if (($sModule = $this->request()->get('module')) && isset($aModules[$sModule])) { $iCnt = Phpfox::getService('admincp.maintain')->reParseText($aModules[$sModule], $iPage, $iLimit); Phpfox_Pager::instance()->set(array('page' => $iPage, 'size' => $iLimit, 'count' => $iCnt)); $iTotalPages = (int) Phpfox_Pager::instance()->getTotalPages(); $iCurrentPage = (int) Phpfox_Pager::instance()->getCurrentPage(); $iPage = (int) Phpfox_Pager::instance()->getNextPage(); if ($iTotalPages === $iCurrentPage || $iTotalPages === 0) { $this->url()->send('admincp.maintain.reparser', null, Phpfox::getPhrase('admincp.parsing_completed')); } else { $this->template()->assign(array('bInProcess' => true, 'iCurrentPage' => $iCurrentPage, 'iTotalPages' => $iTotalPages))->setHeader(array('<meta http-equiv="refresh" content="2;url=' . Phpfox_Url::instance()->makeUrl('admincp.maintain.reparser', array('module' => $sModule, 'page' => $iPage)) . '" />')); } } $this->template()->setTitle(Phpfox::getPhrase('admincp.text_reparser'))->setSectionTitle('Content Re-Parser')->assign(array('aReparserLists' => $aModules)); }
public function getTagCloud($sCategory, $iUserId = null, $mMaxDisplay = null) { ($sPlugin = Phpfox_Plugin::get('tag.service_tag_gettagcloud_start')) ? eval($sPlugin) : false; if ($sCategory === null) { $aParams = Phpfox::massCallback('getTagCloud'); } else { $aParams = Phpfox::callback($sCategory . '.getTagCloud'); } $aTempTags = array(); $sCacheId = $this->cache()->set('tag_cloud_' . ($sCategory === null ? 'global' : str_replace('/', '_', $aParams['link'])) . ($iUserId !== null ? '_' . $iUserId : '') . (defined('TAG_ITEM_ID') ? '_' . TAG_ITEM_ID : '')); if (defined('PHPFOX_IS_GROUP_INDEX')) { $sCategory = 'video_group'; } if (!($aTempTags = $this->cache()->get($sCacheId, Phpfox::getParam('tag.tag_cache_tag_cloud')))) { $aWhere = array(); if (defined('TAG_ITEM_ID')) { $aWhere[] = 'AND item_id = ' . (int) TAG_ITEM_ID; } if ($sCategory !== null) { $aWhere[] = "AND category_id = '" . $this->database()->escape($aParams['category']) . "'" . ($iUserId !== null ? ' AND user_id = ' . (int) $iUserId : ''); } if (!defined('TAG_ITEM_ID')) { $aWhere[] = 'AND added > ' . (PHPFOX_TIME - 86400 * Phpfox::getParam('tag.tag_days_treading')); } $aRows = $this->database()->select('category_id, tag_text AS tag, tag_url, COUNT(item_id) AS total')->from(Phpfox::getT('tag'))->where($aWhere)->group('tag_text, tag_url')->having('total > ' . (int) Phpfox::getParam('tag.tag_min_display'))->order('total DESC')->limit(Phpfox::getParam('tag.tag_trend_total_display'))->execute('getSlaveRows'); if (!count($aRows)) { return array(); } if ($sCategory === null) { $aParams['link'] = 'search'; } $aTempTags = array(); foreach ($aRows as $aRow) { $aTempTags[] = array('value' => $aRow['total'], 'key' => $aRow['tag'], 'url' => $aRow['tag_url'], 'link' => $sCategory === null && Phpfox::getParam('tag.enable_hashtag_support') ? Phpfox::getLib('url')->makeUrl('hashtag', array($aRow['tag_url'])) : Phpfox::getLib('url')->makeUrl($aParams['link'], array('tag', $aRow['tag_url']))); } if (!count($aTempTags)) { return array(); } $this->cache()->save($sCacheId, $aTempTags); } ($sPlugin = Phpfox_Plugin::get('tag.service_tag_gettagcloud_end')) ? eval($sPlugin) : false; return $aTempTags; }
/** * Class process method wnich is used to execute this component. */ public function process() { $aMethods = array(); $aCallbacks = Phpfox::massCallback('getApiSupportedMethods'); foreach ($aCallbacks as $sModule => $aCallback) { foreach ($aCallback['methods'] as $iKey => $aMethod) { $aCallback['methods'][$iKey]['response'] = str_replace('[DOMAIN_REPLACE]', Phpfox::getParam('core.host'), str_replace('stdClass ', '', highlight_string(print_r(json_decode($aMethod['response']), true), true))); $sUrl = '/api.php?method=' . $aCallback['module'] . '.' . $aMethod['call'] . ''; if (isset($aMethod['requires']) && is_array($aMethod['requires'])) { foreach ($aMethod['requires'] as $sRequireKey => $sRequireType) { $sUrl .= '&' . $sRequireKey . '=#{' . strtoupper($sRequireType) . '}'; } } $aCallback['methods'][$iKey]['url'] = $sUrl; } $aMethods[] = $aCallback; } $sTokenResponse = str_replace('stdClass ', '', highlight_string(print_r(json_decode('{"token":"LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUc4d0RRWUpLb1pJaHZjTkFRRUJCUUFEWGdBd1d3SlVBdHFZdmVWOXFEdDd6NFhXTXYzS3VZM2JyWXpUKzR0VgpBbERrN1dQWjhqRVpoVzBNWjE1Z3lHdGNlNm5ueFRNenp4SXpHM29BRVIzc0JVRCtYdStHb21JeVV4UE1RN1NtCkVPdFg0ZTNwekp6R081cUxBZ01CQUFFPQotLS0tLUVORCBQVUJMSUMgS0VZLS0tLS0K"}'), true), true)); $this->template()->setTitle(Phpfox::getPhrase('apps.app_developers'))->setBreadcrumb(Phpfox::getPhrase('apps.apps'), $this->url()->makeUrl('apps'))->setBreadcrumb(Phpfox::getPhrase('apps.developers'), $this->url()->makeUrl('apps.developer'), true)->setFullSite()->setHeader(array('apps.css' => 'style_css', 'apps.js' => 'module_apps'))->assign(array('sSiteName' => Phpfox::getParam('core.site_title'), 'aMethods' => $aMethods, 'sSampleCall' => Phpfox::getParam('core.path') . 'api.php?token=#{TOKEN}&method=#{METHOD_NAME}', 'sTokenSampleCall' => Phpfox::getParam('core.path') . 'token.php?key=$_GET[\'key\']', 'sTokenResponse' => $sTokenResponse, 'sAppLink' => $this->url()->makeUrl('apps.add'))); }
/** * Controller */ public function process() { $bIsEdit = false; if ($iEditId = $this->request()->getInt('id')) { Phpfox::getUserParam('custom.can_manage_custom_fields', true); if (($aGroup = Phpfox::getService('custom.group')->getForEdit($iEditId)) && isset($aGroup['group_id'])) { $bIsEdit = true; $this->template()->assign(array('aForms' => $aGroup)); } } else { Phpfox::getUserParam('custom.can_add_custom_fields_group', true); } $aGroupValidation = array('product_id' => Phpfox::getPhrase('custom.select_a_product_this_custom_field_will_belong_to'), 'module_id' => Phpfox::getPhrase('custom.select_a_module_this_custom_field_will_belong_to'), 'type_id' => Phpfox::getPhrase('custom.select_where_this_custom_field_should_be_located')); $oGroupValidator = Phpfox_Validator::instance()->set(array('sFormName' => 'js_group_field', 'aParams' => $aGroupValidation, 'bParent' => true)); $aGroupTypes = array(); foreach (Phpfox::massCallback('getCustomGroups') as $sModule => $aCustomGroups) { foreach ($aCustomGroups as $sKey => $sPhrase) { $aGroupTypes[$sKey] = $sPhrase; } } if ($aVals = $this->request()->getArray('val')) { if ($oGroupValidator->isValid($aVals)) { if ($bIsEdit === true) { if (Phpfox::getService('custom.group.process')->update($aGroup['group_id'], $aVals)) { $this->url()->send('admincp.custom.group.add', array('id' => $aGroup['group_id']), Phpfox::getPhrase('custom.group_successfully_updated')); } } else { if (Phpfox::getService('custom.group.process')->add($aVals)) { $this->url()->send('admincp.custom.group.add', null, Phpfox::getPhrase('custom.group_successfully_added')); } } } } $aUserGroups = Phpfox::getService('user.group')->get(); foreach ($aUserGroups as $iKey => $aUserGroup) { if (!Phpfox::getUserGroupParam($aUserGroup['user_group_id'], 'custom.has_special_custom_fields')) { unset($aUserGroups[$iKey]); } } $this->template()->setTitle(Phpfox::getPhrase('custom.add_a_new_custom_group'))->setBreadcrumb(Phpfox::getPhrase('custom.add_a_new_custom_group'))->assign(array('sGroupCreateJs' => $oGroupValidator->createJS(), 'sGroupGetJsForm' => $oGroupValidator->getJsForm(), 'aGroupTypes' => $aGroupTypes, 'bIsEdit' => $bIsEdit, 'aUserGroups' => $aUserGroups)); }
/** * Controller */ public function process() { $aModules = Phpfox::massCallback('removeDuplicateList'); $sCheck = $this->request()->get('table'); $aLists = array(); foreach ($aModules as $sModule => $aList) { if (isset($aList['name'])) { $aList = array($aList); } foreach ($aList as $iKey => $aRow) { if (!empty($sCheck) && $aRow['table'] == $sCheck) { $mReturn = Phpfox::getService('admincp.maintain')->removeDuplicates($aRow); if ($mReturn === true) { $this->url()->send('admincp.maintain.duplicate', null, Phpfox::getPhrase('admincp.successfully_removed_duplicate_entries')); } break; } } $aLists = array_merge($aLists, $aList); } $this->template()->setTitle(Phpfox::getPhrase('admincp.remove_duplicates'))->setSectionTitle(Phpfox::getPhrase('admincp.remove_duplicates'))->assign(array('aLists' => $aLists)); }
/** * Class process method wnich is used to execute this component. */ public function process() { $aModulesEnabled = Phpfox::massCallback('getEnabledInputField'); $jLanguages = json_encode(Phpfox::getService('language')->getForAdminCp()); $bIsEdit = false; $aUserGroups = Phpfox::getService('user.group')->get(); $sJsAction = 'prepareAdd();'; $aOut = array(); foreach ($aModulesEnabled as $aInput) { if (isset($aInput['module_id'])) { $aOut[] = $aInput; } else { foreach ($aInput as $aSub) { $aOut[] = $aSub; } } } $aModulesEnabled = $aOut; if ($iId = $this->request()->getInt('id')) { if ($aVals = $this->request()->getArray('val')) { if (Phpfox::getService('input.process')->update(array_merge($aVals, array('field_id' => $iId)))) { $this->url()->send('admincp.input.add', array('id' => $iId), 'Field updated successfully'); } else { Phpfox_Error::set('Oops'); } } $aInput = Phpfox::getService('input')->getForEdit($iId); $sJsAction = 'prepareEdit(\'' . json_encode($aInput) . '\');'; $bIsEdit = $iId; $this->template()->setHeader(array('drag.js' => 'static_script', 'jquery/ui.js' => 'static_script', '<script type="text/javascript">$Behavior.addSort = function(){Core_drag.init({table: \'.js_drag_drop\', ajax: \'input.optionsOrdering\'});}</script>')); } if ($aVal = $this->request()->get('val')) { if (Phpfox::getService('input.process')->add($aVal)) { $this->url()->send('admincp.input.add', null, 'New field added successfully'); } } $this->template()->setTitle(Phpfox::getPhrase('input.add_input_field'))->setBreadcrumb(Phpfox::getPhrase('input.add_input_field'), null, true)->setHeader(array('admin.js' => 'module_input', 'admin.css' => 'module_input', '<script type="text/javascript"> $Behavior.initInput = function(){$Core.input.setLanguages(\'' . $jLanguages . '\'); $Core.input.' . $sJsAction . ' }</script>'))->assign(array('bIsEdit' => $bIsEdit, 'aModulesEnabled' => $aModulesEnabled, 'aUserGroups' => $aUserGroups)); }
/** * Class process method wnich is used to execute this component. */ public function process() { $aUser = Phpfox::getService('user')->get(Phpfox::getUserId(), true); $aModules = Phpfox::massCallback('getDashboardActivity'); $aActivites = array( Phpfox::getPhrase('core.total_items') => $aUser['activity_total'], Phpfox::getPhrase('core.activity_points') => $aUser['activity_points'], ); foreach ($aModules as $aModule) { foreach ($aModule as $sPhrase => $sLink) { $aActivites[$sPhrase] = $sLink; } } $this->template()->assign(array( 'aActivites' => $aActivites ) ); }
/** * Get all the buttons for an editor. * * @return array Returns ARRAY of buttons. */ public function getButtons() { if (defined('PHPFOX_INSTALLER')) { return $this->_aButtons; } $aModuleButtons = Phpfox::massCallback('wysiwyg'); if (is_array($aModuleButtons) && count($aModuleButtons)) { foreach ($aModuleButtons as $sModule => $aModuleButton) { $this->_aButtons[] = $aModuleButton; } } foreach ($this->_aButtons as $iKey => $aValue) { if (isset($aValue['image'])) { $this->_aButtons[$iKey]['image'] = Phpfox::getLib('template')->getStyle('image', 'editor/' . $aValue['image']); } if (isset($aValue['phrase'])) { if (strpos($aValue['phrase'], '.')) { $this->_aButtons[$iKey]['phrase'] = Phpfox::getPhrase($aValue['phrase']); } } } return $this->_aButtons; }
/** * Class process method wnich is used to execute this component. */ public function process() { $aModules = Phpfox::massCallback('updateCounterList'); $iLimit = 100; $iPage = $this->request()->getInt('page'); $bRefresh = false; $iTotalPages = 0; $iCurrentPage = 0; if ($sModule = $this->request()->get('module')) { $iCnt = Phpfox::callback($sModule . '.updateCounter', $this->request()->get('id'), $iPage, $iLimit); if ($iCnt !== false) { Phpfox::getLib('pager')->set(array('page' => $iPage, 'size' => $iLimit, 'count' => $iCnt)); $iTotalPages = (int) Phpfox::getLib('pager')->getTotalPages(); $iCurrentPage = (int) Phpfox::getLib('pager')->getCurrentPage(); $iPage = (int) Phpfox::getLib('pager')->getNextPage(); if ($iTotalPages === $iCurrentPage || $iTotalPages === 0) { $this->url()->send('admincp.maintain.counter', null, Phpfox::getPhrase('admincp.update_of_counter_successfully_completed')); } else { $bRefresh = true; $this->template()->setHeader('<meta http-equiv="refresh" content="2;url=' . $this->url()->makeUrl('admincp.maintain.counter', array('module' => $sModule, 'page' => $iPage, 'id' => $this->request()->get('id'))) . '">'); } } } $aLists = array(); $iSubCount = 0; foreach ($aModules as $sModule => $aList) { if (isset($aList['name'])) { $aList = array($aList); } foreach ($aList as $mKey => $aItem) { $iSubCount++; $aList[$mKey]['count'] = $iSubCount; } $aLists[$sModule] = $aList; } $this->template()->setTitle(Phpfox::getPhrase('admincp.update_counters'))->setBreadcrumb(Phpfox::getPhrase('admincp.update_counters'))->assign(array('aLists' => $aLists, 'bRefresh' => $bRefresh, 'iTotalPages' => $iTotalPages, 'iCurrentPage' => $iCurrentPage)); }
public function query($sQuery, $iPage, $iTotalShow, $sView = null) { if ($sView !== null && Phpfox::isModule($sView)) { $aModuleResults = Phpfox::callback($sView . '.globalUnionSearch', $this->preParse()->clean($sQuery)); } else { $aModuleResults = Phpfox::massCallback('globalUnionSearch', $this->preParse()->clean($sQuery)); } $iOffset = $iPage * $iTotalShow; $aRows = $this->database()->select('item.*, ' . Phpfox::getUserField())->unionFrom('item')->join(Phpfox::getT('user'), 'u', 'u.user_id = item.item_user_id')->limit($iOffset, $iTotalShow)->order('item_time_stamp DESC')->execute('getSlaveRows'); $aResults = array(); foreach ($aRows as $iKey => $aRow) { $aResults[] = array_merge($aRow, (array) Phpfox::callback($aRow['item_type_id'] . '.getSearchInfo', $aRow)); } if (Phpfox::getParam('core.section_privacy_item_browsing') && !empty($aResults)) { // Check for special filters $aToParse = array(); // Group results by their module foreach ($aResults as $aResult) { $aToParse[$aResult['item_type_id']][] = $aResult['item_id']; } foreach ($aToParse as $sModule => $aItems) { if (Phpfox::hasCallback($sModule, 'filterSearchResults')) { $aNotAllowed = Phpfox::callback($sModule . '.filterSearchResults', $aItems); if (!empty($aNotAllowed)) { foreach ($aNotAllowed as $aItem) { foreach ($aResults as $iKey => $aResult) { if ($aResult['item_type_id'] == $aItem['item_type_id'] && $aResult['item_id'] == $aItem['item_id']) { unset($aResults[$iKey]); } } } } } } } return $aResults; }
/** * Class process method wnich is used to execute this component. */ public function process() { return false; if (!Phpfox::isUser()) { return false; } $aMessages = array(); $aMessages = Phpfox::massCallback('getRequestLink'); ($sPlugin = Phpfox_Plugin::get('request.component_block_feed_process')) ? eval($sPlugin) : false; if (!is_array($aMessages)) { return false; } $iCnt = 0; foreach (array_values($aMessages) as $sValue) { if (!empty($sValue)) { $iCnt++; } } if (!$iCnt && !Phpfox::getParam('request.display_request_box_on_empty')) { return false; } $this->template()->assign(array('sHeader' => Phpfox::getPhrase('request.requests'), 'aMessages' => $aMessages, 'sDeleteBlock' => 'dashboard')); return 'block'; }
public function exportForModules($sProductId = 'phpfox', $bCore = true, $aModuleCache = null, $sDirectoryId = null) { $oFile = Phpfox::getLib('file'); $oDatabaseSupport = Phpfox::getLib('database.support'); $oXmlBuilder = Phpfox::getLib('xml.builder'); $aFiles = array(); if (!defined('PHPFOX_XML_SKIP_STAMP')) { define('PHPFOX_XML_SKIP_STAMP', true); } $aRows = $this->database()->select('*') ->from($this->_sTable) ->execute('getRows'); if (!count($aRows)) { return false; } $sData = ''; foreach ($aRows as $aRow) { $sDir = PHPFOX_DIR_MODULE . $aRow['module_id']; $oXmlBuilder->addGroup('module'); $oXmlBuilder->addGroup('data'); foreach ($aRow as $sKey => $sValue) { $oXmlBuilder->addTag($sKey, $sValue); } if ($sProductId == 'phpfox') { $aWritableFiles = Phpfox::getLib('module')->init($aRow['module_id'], 'aInstallWritable'); $oXmlBuilder->addTag('writable', ((count($aWritableFiles) && is_array($aWritableFiles)) ? serialize($aWritableFiles) : '')); } $oXmlBuilder->closeGroup(); $iCnt = 0; $aModuleCallback = Phpfox::massCallback('exportModule', $sProductId, $aRow['module_id'], $bCore); foreach ($aModuleCallback as $sModuleCallback => $mReturn) { if ($mReturn === true) { $iCnt++; } } if ($bCore === true && is_dir($sDir)) { $aTables = Phpfox::getLib('module')->init($aRow['module_id'], 'aTables'); if (count($aTables) > 0) { $oXmlBuilder->addTag('tables', serialize($oDatabaseSupport->prepareSchema($aTables))); } $sInstallFile = $sDir . PHPFOX_DIR_MODULE_XML . PHPFOX_DS . 'version' . PHPFOX_DS . 'install' . PHPFOX_XML_SUFFIX; if (file_exists($sInstallFile)) { $aInstallData = Phpfox::getLib('xml.parser')->parse(file_get_contents($sInstallFile)); if (isset($aInstallData['install'])) { $oXmlBuilder->addTag('install', $aInstallData['install']); } } } if ($bCore === false && $aModuleCache !== null && is_dir($sDir) && isset($aModuleCache[$aRow['module_id']])) { $aSourceFiles = Phpfox::getLib('file')->getAllFiles($sDir); if (count($aSourceFiles)) { foreach ($aSourceFiles as $sFile) { $sNewFile = str_replace(PHPFOX_DIR, '', $sFile); $aParts = explode(PHPFOX_DS, $sNewFile); unset($aParts[(count($aParts) - 1)]); $sActualPath = implode(PHPFOX_DS, $aParts) . PHPFOX_DS; Phpfox::getLib('file')->mkdir(PHPFOX_DIR_CACHE . $sDirectoryId . PHPFOX_DS . $sActualPath, true); copy($sFile, PHPFOX_DIR_CACHE . $sDirectoryId . PHPFOX_DS . $sNewFile); } } } $oXmlBuilder->closeGroup(); if ($iCnt) { if ($bCore === true) { $oFile->write($sDir . PHPFOX_DIR_MODULE_XML . PHPFOX_DS . 'phpfox' . PHPFOX_XML_SUFFIX, $oXmlBuilder->output()); } else { Phpfox::getLib('file')->mkdir(PHPFOX_DIR_CACHE . $sDirectoryId . PHPFOX_DS . 'module' . PHPFOX_DS . $aRow['module_id'] . PHPFOX_DS, true); Phpfox::getLib('file')->write(PHPFOX_DIR_CACHE . $sDirectoryId . PHPFOX_DS . 'module' . PHPFOX_DS . $aRow['module_id'] . PHPFOX_DS . 'phpfox.xml', $oXmlBuilder->output()); } } else { $oXmlBuilder->output(); } } return true; }
/** * Gets a list of activity points for editing. * Things to consider: * There are default values (phpfox_user_group_setting) * Changes to the default values are stored in phpfox_user_setting * For custom user groups there may not be current values as they inherit from another user group * This function works like this: * Get a list of the default activity points to use their setting_id to find any override values * if an override value is found then update the $aOut array * return $aOut * @param int $iUserGroup * @return array */ public function getActivityPoints($iUserGroup) { $mValid = Phpfox::getService('user.group')->get(array('user_group_id = ' . (int) $iUserGroup)); if (empty($mValid)) { return Phpfox_Error::set(Phpfox::getPhrase('user.invalid_user_group')); } $mValid = $mValid[0]; $aModules = Phpfox::massCallback('getDashboardActivity'); $sGroup = ''; /* if this user group inherits then take the default value of the parent user group*/ switch ($mValid['inherit_id'] != 0 ? $mValid['inherit_id'] : $iUserGroup) { case 1: $sGroup = 'default_admin'; break; case 2: $sGroup = 'default_user'; break; case 3: $sGroup = 'default_guest'; break; case 4: $sGroup = 'default_staff'; break; } $aOut = array(); /* get default values */ $sIn = ''; foreach ($aModules as $sModule => $aModule) { $sIn .= '"points_' . $sModule . '",'; } $sIn = rtrim($sIn, ','); $aDefaultSettings = $this->database()->select('*')->from(Phpfox::getT('user_group_setting'), 'ugs')->where('ugs.name IN (' . $sIn . ')')->execute('getSlaveRows'); /* get the current values */ $sIn = ''; foreach ($aDefaultSettings as $iKey => $aSetting) { $sIn .= $aSetting['setting_id'] . ','; } $sIn = rtrim($sIn, ','); $aCurrentSettings = $this->database()->select('*')->from(Phpfox::getT('user_setting'))->where('setting_id IN (' . $sIn . ') AND user_group_id = ' . (int) $iUserGroup)->execute('getSlaveRows'); /* Merge arrays */ foreach ($aDefaultSettings as $iKey => $aDefault) { $aOut[$iKey] = array('setting_id' => $aDefault['setting_id'], 'name' => $aDefault['name'], 'module' => $aDefault['module_id'], 'value_actual' => $aDefault[$sGroup]); /* if theres a current setting, override the default value*/ foreach ($aCurrentSettings as $aCurrent) { if ($aCurrent['setting_id'] == $aDefault['setting_id']) { $aOut[$iKey]['value_actual'] = $aCurrent['value_actual']; } } } return $aOut; }
public function getProfileMenu($aUser) { $aMenus = array(); /* if (Phpfox::getService('user.privacy')->hasAccess($aUser['user_id'], 'feed.view_wall')) { $aMenus[] = array( 'phrase' => 'Profile', 'url' => 'profile' . ($aUser['landing_page'] == 'info' ? '.wall' : ''), 'icon' => 'misc/comment.png' ); } $aMenus[] = array( 'phrase' => Phpfox::getPhrase('profile.info'), 'url' => 'profile' . ($aUser['landing_page'] == 'info' ? '' : '.info' . (defined('PHPFOX_IN_DESIGN_MODE') ? '.design' : '')), 'icon' => 'misc/application_view_list.png' ); */ if (!Phpfox::getUserBy('profile_page_id') && !defined('PHPFOX_IN_DESIGN_MODE')) { $aModuleCalls = Phpfox::massCallback('getProfileMenu', $aUser); foreach ($aModuleCalls as $sModule => $aModuleCall) { if (!is_array($aModuleCall)) { continue; } if ($sModule == 'friend') { continue; } // $aMenus[] = $aModuleCall[0]; $aMenus = array_merge($aMenus, $aModuleCall); } } foreach ($aMenus as $iKey => $aMenu) { if (isset($aMenu['total']) && !$aMenu['total']) { unset($aMenus[$iKey]); continue; } $bSubIsSelected = false; if (isset($aMenu['sub_menu'])) { foreach ((array) $aMenu['sub_menu'] as $iSubKey => $aSubMenu) { if ($this->request()->get('view')) { $sCurrent = 'profile.' . $this->request()->get('req2') . '.view_' . $this->request()->get('view'); } else { $sCurrent = 'profile.' . $this->request()->get('req2') . '.' . $this->request()->get('req3'); } if ($sCurrent == $aSubMenu['url']) { $aMenus[$iKey]['sub_menu'][$iSubKey]['is_selected'] = true; $bSubIsSelected = true; break; } } } if ($bSubIsSelected === false && ($aMenu['url'] == 'profile' . (Phpfox_Request::instance()->get('req2') ? '.' . Phpfox_Request::instance()->get('req2') : '') . (Phpfox_Request::instance()->get('req3') ? '.' . Phpfox_Request::instance()->get('req3') : '') || Phpfox_Request::instance()->get('req2') == '' && $iKey === 0 && !Phpfox::getService('user.privacy')->hasAccess($aUser['user_id'], 'feed.view_wall'))) { $aMenus[$iKey]['is_selected'] = true; } if ($aMenu['url'] == 'profile.photo' && Phpfox_Request::instance()->get('req2') == 'photo' && (Phpfox_Request::instance()->get('req3') == 'albums' || Phpfox_Request::instance()->get('req3') == 'photos')) { $aMenus[$iKey]['is_selected'] = true; } $aMenus[$iKey]['actual_url'] = str_replace('.', '_', $aMenu['url']); if ($aMenu['url'] == 'profile') { $aMenus[$iKey]['url'] = $aUser['user_name']; } else { $aMenus[$iKey]['url'] = $aUser['user_name'] . '.' . Phpfox_Url::instance()->doRewrite(preg_replace("/^profile\\.(.*)\$/i", "\\1", $aMenu['url'])); } } /* Reminder for purefan add a hook here */ if ($sPlugin = Phpfox_Plugin::get('profile.service_profile_get_profile_menu')) { eval($sPlugin); } return $aMenus; }
/** * Cancels a user account by deleting all the information related to them. * @param array $aVal * @return Phpfox_Error if password doesnt match | false if user does not have enough permissions or password is not set */ public function cancelAccount($aVal) { Phpfox::isUser(true); define('PHPFOX_CANCEL_ACCOUNT', true); if (!isset($aVal['password']) && !Phpfox::getUserBy('fb_user_id') && !Phpfox::getUserBy('janrain_user_id')) { return Phpfox_Error::set(Phpfox::getPhrase('user.please_enter_your_password')); } if (!Phpfox::getUserParam('user.can_delete_own_account')) { return Phpfox_Error::set(Phpfox::getPhrase('user.you_are_not_allowed_to_delete_your_own_account')); } // confirm $aVal[password] == user password // get user's data $aRow = $this->database()->select('password_salt, password')->from(Phpfox::getT('user'))->where('user_id = ' . Phpfox::getUserId())->execute('getSlaveRow'); if (!Phpfox::getUserBy('fb_user_id') && !Phpfox::getUserBy('janrain_user_id') && Phpfox::getLib('hash')->setHash($aVal['password'], $aRow['password_salt']) != $aRow['password']) { if ($sPlugin = Phpfox_Plugin::get('user.service_cancellations_process_cancelaccount_invalid_password')) { eval($sPlugin); } return Phpfox_Error::set(Phpfox::getPhrase('user.invalid_password')); } Phpfox::getService('user.cancellations.process')->feedbackCancellation($aVal); // mass callback Phpfox::massCallback('onDeleteUser', Phpfox::getUserId()); // log out adter having deleted all the info Phpfox::getService('user.auth')->logout(); Phpfox_Url::instance()->send('', null, Phpfox::getPhrase('user.your_account_has_been_deleted')); return true; }
/** * Class process method wnich is used to execute this component. */ public function process() { Phpfox::getUserParam('group.can_access_groups', true); define('PHPFOX_IS_GROUP_VIEW', true); $iGroup = $this->request()->get('req2'); if (!($aGroup = Phpfox::getService('group')->getGroup($iGroup))) { return Phpfox_Error::display(Phpfox::getPhrase('group.the_group_you_are_looking_for_does_not_exist_or_has_been_removed')); } if ($this->request()->get('approve') && Phpfox::getPhrase('group.pending_approval')) { if (Phpfox::getService('group.process')->approve($aGroup['group_id'])) { $this->url()->send('group', $aGroup['title_url'], Phpfox::getPhrase('group.group_successfully_approved')); } } if ($aGroup['is_public'] == '1') { if (Phpfox::getUserId() != $aGroup['user_id']) { if (!Phpfox::getUserParam('group.can_approve_groups')) { return Phpfox_Error::display(Phpfox::getPhrase('group.the_group_you_are_looking_for_does_not_exist_or_has_been_removed')); } } } if ($this->request()->get('req3') == 'join') { if (Phpfox::getService('group.process')->joinGroup($aGroup['group_id'], Phpfox::getUserId())) { $this->url()->send('group', array($aGroup['title_url']), $aGroup['view_id'] == '1' && $aGroup['auto_approve'] == '0' ? Phpfox::getPhrase('group.thank_you_for_your_request_to_join_our_group_your_membership_will_first_have_to_be_approved') : Phpfox::getPhrase('group.you_have_successfully_joined_this_group')); } } elseif ($this->request()->get('req3') == 'leave') { if (Phpfox::getService('group.process')->leaveGroup($aGroup['group_id'], Phpfox::getUserId())) { $this->url()->send('group', array($aGroup['title_url']), Phpfox::getPhrase('group.you_have_successfully_left_this_group')); } } Phpfox::getLib('module')->setCacheBlockData(array('table' => 'group_design_order', 'field' => 'group_id', 'item_id' => $aGroup['group_id'], 'controller' => 'group.view')); $this->setParam('aGroup', $aGroup); if ($aGroup['designer_style_id']) { $this->template()->setStyle(array('style_id' => $aGroup['designer_style_id'], 'style_folder_name' => $aGroup['designer_style_folder'], 'theme_folder_name' => $aGroup['designer_theme_folder'])); } $sModule = 'group'; $aMenus1['group'] = array(Phpfox::getPhrase('group.home') => array('active' => 'group', 'url' => $this->url()->makeUrl('group', $aGroup['title_url']))); $aMenus2 = Phpfox::massCallback('groupMenu', $aGroup['title_url'], $aGroup['group_id']); $aMenus = array_merge($aMenus1, $aMenus2); $aSubMenus = array(); foreach ($aMenus as $sModule => $aMenu) { if ($aMenu === false) { continue; } $aKey = array_keys($aMenu); $aValue = array_values($aMenu); $aSubMenus[$aKey[0]] = $aValue[0]; } $this->template()->setTitle($aGroup['title'])->setHeader('cache', array('profile.css' => 'module_group'))->assign(array('aGroup' => $aGroup, 'aGroupMenus' => $aSubMenus, 'sGroupMenuActive' => 'group')); Phpfox::getLib('module')->addModuleBlock('group.header', 7); if ($aGroup['view_id'] == '2' && (!$aGroup['invite_id'] || $aGroup['invite_id'] && $aGroup['member_id'] == '0') && !Phpfox::getUserParam('group.can_view_secret_group')) { return Phpfox::getLib('module')->setController('group.secret'); } if (($sModule = $this->request()->get('req3')) && Phpfox::isModule($this->url()->reverseRewrite($sModule))) { if ($aGroup['view_id'] == '1' && !Phpfox::getUserParam('group.can_view_secret_group') && (!$aGroup['invite_id'] || $aGroup['invite_id'] && $aGroup['member_id'] == '2')) { return Phpfox_Error::display(Phpfox::getPhrase('group.this_group_is_open_only_to_its_members')); } if ($aGroup['is_public'] == '1') { return Phpfox_Error::display(Phpfox::getPhrase('group.this_group_is_still_pending_an_admins_approval_and_this_feature_cannot_be_used_yet')); } $this->setParam('bHideGroupBlocks', true); $this->template()->assign(array('sGroupMenuActive' => $this->url()->reverseRewrite($sModule))); return Phpfox::getLib('module')->setController($this->url()->reverseRewrite($sModule) . '.group'); } define('PHPFOX_CAN_MOVE_BLOCKS', true); if ($this->request()->get('req3') == 'designer') { if ($aGroup['user_id'] == Phpfox::getUserId() && Phpfox::getUserParam('group.can_edit_own_group') || Phpfox::getUserParam('group.can_edit_other_group') || Phpfox::getService('group')->isAdmin($aGroup['group_id'])) { define('PHPFOX_IN_DESIGN_MODE', true); if ($iTestStyle = $this->request()->get('test_style_id')) { if (Phpfox::getLib('template')->testStyle($iTestStyle)) { } } $aDesigner = array('current_style_id' => $aGroup['designer_style_id'], 'design_header' => Phpfox::getPhrase('group.customize_group'), 'current_page' => $this->url()->makeUrl('group', array($aGroup['title_url'])), 'design_page' => $this->url()->makeUrl('group', array($aGroup['title_url'], 'designer')), 'block' => 'group.view', 'item_id' => $aGroup['group_id'], 'type_id' => 'group'); $this->setParam('aDesigner', $aDesigner); $this->template()->setHeader('cache', array('jquery/ui.js' => 'static_script', 'sort.js' => 'module_theme', 'style.css' => 'style_css', 'select.js' => 'module_theme', 'design.js' => 'module_theme'))->setHeader(array('<script type="text/javascript">function designOnUpdate() { $Core.design.updateSorting(); }</script>', '<script type="text/javascript">$Core.design.init({type_id: \'group\', item_id: \'' . $aGroup['group_id'] . '\'});</script>')); } } elseif ($this->request()->get('req3') == 'member') { $this->setParam('aCallback', array('module' => 'group', 'item' => $aGroup['group_id'], 'query' => true, 'url_home' => 'group.' . $aGroup['title_url'] . '.member', 'url' => array('group', array($aGroup['title_url'], 'member')), 'no_member_message' => Phpfox::getPhrase('group.no_users_have_joined_this_group'))); $this->template()->assign(array('sGroupMenuActive' => 'member')); return Phpfox::getLib('module')->setController('user.browse'); } else { if ($aGroup['user_id'] == Phpfox::getUserId() && Phpfox::getUserParam('group.can_edit_own_group') || Phpfox::getUserParam('group.can_edit_other_group') || Phpfox::getService('group')->isAdmin($aGroup['group_id'])) { $this->template()->setHeader('cache', array('jquery/ui.js' => 'static_script', 'sort.js' => 'module_theme', 'select.js' => 'module_theme', 'design.js' => 'module_theme'))->setHeader(array('<script type="text/javascript">function designOnUpdate() { $Core.design.updateSorting(); }</script>', '<script type="text/javascript">$Core.design.init({type_id: \'group\', item_id: \'' . $aGroup['group_id'] . '\'});</script>')); } } $this->setParam('aEventParent', array('module' => 'group', 'item' => $aGroup['group_id'], 'url' => array('group', array($aGroup['title_url'], 'event')))); $this->setParam('aCallbackVideo', array('module' => 'group', 'item' => $aGroup['group_id'], 'url' => array('group', array($aGroup['title_url'], 'video')))); $this->setParam('aCallbackShoutbox', array('module' => 'group', 'item' => $aGroup['group_id'])); $this->setParam(array('iItemId' => $aGroup['group_id'], 'iTotal' => $aGroup['total_comment'], 'sType' => 'group')); define('PHPFOX_IS_GROUP_INDEX', true); if (Phpfox::isModule('notification') && $aGroup['user_id'] == Phpfox::getUserId()) { Phpfox::getService('notification.process')->delete('group_notifyLike', $aGroup['group_id'], Phpfox::getUserId()); } Phpfox::getService('feed')->setTable(Phpfox::getT('group_feed')); $this->template()->assign(array('bFeedIsParentItem' => true, 'sFeedIsParentItemModule' => 'group'))->setPhrase(array('theme.are_you_sure'))->setBreadCrumb(Phpfox::getPhrase('group.group_name'), $this->url()->makeUrl('group'))->setBreadCrumb($aGroup['title'], $this->url()->permalink('group', $aGroup['group_id'], $aGroup['title']), true)->setMeta('description', $aGroup['description'])->setMeta('keywords', $this->template()->getKeywords($aGroup['title']))->setHeader('cache', array('jquery/plugin/jquery.highlightFade.js' => 'static_script', 'jquery/plugin/jquery.scrollTo.js' => 'static_script', 'quick_edit.js' => 'static_script', 'comment.css' => 'style_css', 'pager.css' => 'style_css', 'switch_legend.js' => 'static_script', 'switch_menu.js' => 'static_script', 'feed.js' => 'module_feed'))->setHeader(array('<script type="text/javascript">$(function(){$(\'.js_mp_fix_width\').each(function(){$(this).parents(\'.js_mp_fix_holder:first\').width(this.width);});});</script>'))->setEditor(array('load' => 'simple')); if ($this->request()->get('update')) { $this->template()->setHeader('<script type="text/javascript">window.parent.tb_remove();</script>'); } }
public function confirmedDelete() { Phpfox::isUser(true); Phpfox::getUserParam('admincp.has_admin_access', true); $iUser = (int) $this->get('iUser'); if (!Phpfox::getService('user')->isAdminUser($iUser)) { Phpfox::getService('user.auth')->setUserId($iUser); Phpfox::massCallback('onDeleteUser', $iUser); Phpfox::getService('user.auth')->setUserId(null); $this->call('$("#js_user_' . $iUser . '").remove();'); $this->setMessage('User ' . $iUser . ' deleted.'); } else { Phpfox_Error::set(Phpfox::getPhrase('user.you_are_unable_to_delete_a_site_administrator')); } }
public function getPerms($iPage) { $aCallbacks = Phpfox::massCallback('getPagePerms'); $aPerms = array(); $aUserPerms = $this->getPermsForPage($iPage); foreach ($aCallbacks as $aCallback) { foreach ($aCallback as $sId => $sPhrase) { $aPerms[] = array( 'id' => $sId, 'phrase' => $sPhrase, 'is_active' => (isset($aUserPerms[$sId]) ? $aUserPerms[$sId] : '0') ); } } return $aPerms; }
/** * Controller */ public function process() { $bHideOptions = true; $iDefaultSelect = 4; $bIsEdit = false; if ($iEditId = $this->request()->getInt('id')) { Phpfox::getUserParam('custom.can_manage_custom_fields', true); $aField = Phpfox::getService('custom')->getForCustomEdit($iEditId); if (isset($aField['field_id'])) { $bIsEdit = true; $this->template()->assign(array('aForms' => $aField)); if (isset($aField['option']) && $aField['var_type'] == 'select') { $bHideOptions = false; } } } else { Phpfox::getUserParam('custom.can_add_custom_fields', true); $this->template()->assign(array('aForms' => array())); } $aFieldValidation = array('product_id' => Phpfox::getPhrase('custom.select_a_product_this_custom_field_will_belong_to'), 'type_id' => Phpfox::getPhrase('custom.select_a_module_this_custom_field_will_belong_to'), 'var_type' => Phpfox::getPhrase('custom.select_what_type_of_custom_field_this_is')); $oCustomValidator = Phpfox_Validator::instance()->set(array('sFormName' => 'js_custom_field', 'aParams' => $aFieldValidation, 'bParent' => true)); $this->template()->assign(array('sCustomCreateJs' => $oCustomValidator->createJS(), 'sCustomGetJsForm' => $oCustomValidator->getJsForm())); if ($aVals = $this->request()->getArray('val')) { if ($oCustomValidator->isValid($aVals)) { if ($bIsEdit) { if (Phpfox::getService('custom.process')->update($aField['field_id'], $aVals)) { $this->url()->send('admincp.custom.add', array('id' => $aField['field_id']), Phpfox::getPhrase('custom.field_successfully_updated')); } } else { if (Phpfox::getService('custom.process')->add($aVals)) { $this->url()->send('admincp.custom.add', null, Phpfox::getPhrase('custom.field_successfully_added')); } } } if (isset($aVals['var_type']) && $aVals['var_type'] == 'select') { $bHideOptions = false; $iCnt = 0; $sOptionPostJs = ''; foreach ($aVals['option'] as $iKey => $aOptions) { if (!$iKey) { continue; } $aValues = array_values($aOptions); if (!empty($aValues[0])) { $iCnt++; } foreach ($aOptions as $sLang => $mValue) { $sOptionPostJs .= 'option_' . $iKey . '_' . $sLang . ': \'' . str_replace("'", "\\'", $mValue) . '\','; } } $sOptionPostJs = rtrim($sOptionPostJs, ','); $iDefaultSelect = $iCnt; } } $aTypes = array(); foreach (Phpfox::massCallback('getCustomFieldLocations') as $sModule => $aCustomFields) { foreach ($aCustomFields as $sKey => $sPhrase) { $aTypes[$sKey] = $sPhrase; } } $aGroupTypes = array(); foreach (Phpfox::massCallback('getCustomGroups') as $sModule => $aCustomGroups) { foreach ($aCustomGroups as $sKey => $sPhrase) { $aGroupTypes[$sKey] = $sPhrase; } } $aGroupValidation = array('product_id' => Phpfox::getPhrase('custom.select_a_product_this_custom_field_will_belong_to'), 'module_id' => Phpfox::getPhrase('custom.select_a_module_this_custom_field_will_belong_to'), 'type_id' => Phpfox::getPhrase('custom.select_where_this_custom_field_should_be_located')); $oGroupValidator = Phpfox_Validator::instance()->set(array('sFormName' => 'js_group_field', 'aParams' => $aGroupValidation, 'bParent' => true)); $this->template()->assign(array('sGroupCreateJs' => $oGroupValidator->createJS(), 'sGroupGetJsForm' => $oGroupValidator->getJsForm(false))); $aUserGroups = Phpfox::getService('user.group')->get(); foreach ($aUserGroups as $iKey => $aUserGroup) { if (!Phpfox::getUserGroupParam($aUserGroup['user_group_id'], 'custom.has_special_custom_fields')) { unset($aUserGroups[$iKey]); } } // only show the input if there are custom fields $this->template()->assign(array('bShowUserGroups' => count($aUserGroups) > 0)); $this->template()->setSectionTitle('Custom Fields')->setTitle(Phpfox::getPhrase('custom.add_a_new_custom_field'))->setBreadcrumb($bIsEdit ? 'Edit Custom Field' : Phpfox::getPhrase('custom.add_a_new_custom_field'), $this->url()->current(), true)->setPhrase(array('custom.are_you_sure_you_want_to_delete_this_custom_option'))->setHeader(array('<script type="text/javascript"> var bIsEdit = ' . ($bIsEdit ? 'true' : 'false') . '</script>', 'admin.js' => 'module_custom', '<script type="text/javascript">$Behavior.custom_admin_add_init = function(){$Core.custom.init(' . ($bIsEdit == true ? 1 : $iDefaultSelect) . '' . (isset($sOptionPostJs) ? ', {' . $sOptionPostJs . '}' : '') . ');};</script>'))->assign(array('aTypes' => $aTypes, 'aLanguages' => Phpfox::getService('language')->getAll(), 'aGroupTypes' => $aGroupTypes, 'aGroups' => Phpfox::getService('custom.group')->get(), 'bHideOptions' => $bHideOptions, 'bIsEdit' => $bIsEdit, 'aUserGroups' => $aUserGroups)); }
/** * Class process method wnich is used to execute this component. */ public function process() { 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::getLib('module')->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::getLib('locale')->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.full_name'; $sDefaultSort = 'ASC'; 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, 'add_any' => true), 'to' => array('type' => 'select', 'options' => $aAge, 'add_any' => true), 'country' => array('type' => 'select', 'options' => Phpfox::getService('core.country')->get(), 'search' => 'AND u.country_iso = \'[VALUE]\'', 'add_any' => true, 'style' => 'width:150px;', '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::getLib('search')->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::getLib('database')->escape($sLocation) . '\''); } if ($sGender = $this->request()->getInt('gender')) { $oFilter->setCondition('AND u.gender = \'' . Phpfox::getLib('database')->escape($sGender) . '\''); } if ($sLocationChild = $this->request()->getInt('state')) { $oFilter->setCondition('AND ufield.country_child_id = \'' . Phpfox::getLib('database')->escape($sLocationChild) . '\''); } if ($sLocationCity = $this->request()->get('city-name')) { $oFilter->setCondition('AND ufield.city_location = \'' . Phpfox::getLib('database')->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); } list($iCnt, $aUsers) = Phpfox::getService('user.browse')->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(); /* 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::getLib('pager')->set(array('page' => $iPage, 'size' => $iPageSize, 'count' => $iCnt, 'ajax' => 'user.mainBrowse')); Phpfox::getLib('pager')->set(array('page' => $iPage, 'size' => $iPageSize, 'count' => $iCnt, 'ajax' => 'user.mainBrowse', 'aParams' => $aNewCustomValues)); } else { Phpfox::getLib('pager')->set(array('page' => $iPage, 'size' => $iPageSize, 'count' => $iCnt)); } Phpfox::getLib('url')->setParam('page', $iPage); // http://www.phpfox.com/tracker/view/15277/ if ($iPage > Phpfox::getLib('pager')->getTotalPages()) { Phpfox::getLib('url')->send('error.404'); } 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('pager.css' => 'style_css', '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('browse.css' => 'style_css')); 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'); } }
/** * Class process method wnich is used to execute this component. */ public function process() { $aStats = array(); $aOnline = Phpfox::getService('log.session')->getOnlineStats(); $aStats[Phpfox::getPhrase('admincp.online')] = array(array('phrase' => Phpfox::getPhrase('admincp.members'), 'value' => $aOnline['members'], 'link' => $this->url()->makeUrl('admincp.user.browse', array('view' => 'online')))); if (Phpfox::getParam('core.log_site_activity')) { $aStats[Phpfox::getPhrase('admincp.online')][] = array('phrase' => Phpfox::getPhrase('admincp.guests'), 'value' => $aOnline['guests'], 'link' => $this->url()->makeUrl('admincp.core.online-guest')); } $aPendingCallback = Phpfox::massCallback('pendingApproval'); $aStats[Phpfox::getPhrase('admincp.pending_approval')] = array(); $iTotalApprove = 0; foreach ($aPendingCallback as $sModule => $aPendings) { if (isset($aPendings['value'])) { if (!$aPendings['value']) { continue; } $iTotalApprove++; $aStats[Phpfox::getPhrase('admincp.pending_approval')][] = $aPendings; } else { foreach ($aPendings as $sKey => $aValue) { if (!$aValue['value']) { continue; } $iTotalApprove++; $aStats[Phpfox::getPhrase('admincp.pending_approval')][] = $aValue; } } } if ($iTotalApprove === 0) { unset($aStats[Phpfox::getPhrase('admincp.pending_approval')]); } if (Phpfox::isModule('report')) { $aReports = Phpfox::getService('report')->getActiveReports(); if (count($aReports)) { $aStats[Phpfox::getPhrase('admincp.reported_items_users')] = array(); foreach ($aReports as $aReport) { $aStats[Phpfox::getPhrase('admincp.reported_items_users')][] = $aReport; } } } $aSpamCallback = Phpfox::massCallback('spamCheck'); $aStats[Phpfox::getPhrase('admincp.spam')] = array(); $iTotalSpam = 0; foreach ($aSpamCallback as $sModule => $aSpam) { if (!$aSpam['value']) { continue; } $iTotalSpam++; $aStats[Phpfox::getPhrase('admincp.spam')][] = $aSpam; } if ($iTotalSpam === 0) { unset($aStats[Phpfox::getPhrase('admincp.spam')]); } $aSiteStatsForAdmins = Phpfox::massCallback('getSiteStatsForAdmins'); $aStats[Phpfox::getPhrase('admincp.today_s_site_stats')] = array(); $iTotalStats = 0; foreach ($aSiteStatsForAdmins as $sModule => $aSiteStatsForAdmin) { if (!$aSiteStatsForAdmin['value']) { continue; } $iTotalStats++; $aStats[Phpfox::getPhrase('admincp.today_s_site_stats')][] = $aSiteStatsForAdmin; } if ($iTotalStats === 0) { unset($aStats[Phpfox::getPhrase('admincp.today_s_site_stats')]); } /* if (defined('PHPFOX_IS_HOSTED_SCRIPT')) { $this->template()->assign(Phpfox::getService('admincp')->getHostingStats()); } */ $this->template()->assign(array('sHeader' => Phpfox::getPhrase('admincp.site_statistics'), 'aStats' => $aStats)); return 'block'; }