Cheetah
index.php
Go to the documentation of this file.
1 <?php
2 
8 require_once('../inc/header.inc.php');
9 require_once(CH_DIRECTORY_PATH_INC . 'profiles.inc.php');
10 require_once(CH_DIRECTORY_PATH_INC . 'design.inc.php');
11 require_once(CH_DIRECTORY_PATH_INC . 'admin_design.inc.php');
12 require_once(CH_DIRECTORY_PATH_INC . 'utils.inc.php');
13 ch_import('ChRSS');
14 ch_import('ChWsbAdminDashboard');
15 
16 define('CH_WSB_ADMIN_INDEX', 1);
17 
19 
20 if (isset($_POST['ID']) && isset($_POST['Password'])) {
21  $iId = getID($_POST['ID']);
22  $sPassword = process_pass_data($_POST['Password']);
23 
24  if (!$bLogged) {
25  $oZ = new ChWsbAlerts('profile', 'before_login', 0, 0, array('login' => $iId, 'password' => $sPassword, 'ip' => getVisitorIP()));
26  $oZ->alert();
27  }
28 
29  if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
30  echo check_password($iId, $sPassword, CH_WSB_ROLE_ADMIN, false) ? 'OK' : 'Fail';
32  ch_login($iId, (bool)$_POST['rememberMe']);
33  header('Location: ' . $sUrlRelocate);
34  }
35  exit;
36 }
37 
38 if (!isAdmin()) {
40  login_form("", 1);
41  exit();
42 }
43 
44 if (ch_get('cheetah_news') !== false) {
45  setParam("news_enable", (int)ch_get('cheetah_news'));
46 }
47 
48 $logged['admin'] = member_auth(1, true, true);
49 
50 if (ch_get('cat') !== false) {
51  PageCategoryCode(ch_get('cat'));
52 } else {
53  PageMainCode();
54 }
55 
57 
58 function PageMainCode()
59 {
60  $oDashboard = new ChWsbAdminDashboard();
61  $sResult = $oDashboard->getCode();
62 
63  $iNameIndex = 1;
64  $GLOBALS['_page'] = array(
65  'name_index' => $iNameIndex,
66  'css_name' => array('index.css'),
67  'header' => _t('_adm_page_cpt_dashboard')
68  );
69 
70  $GLOBALS['_page_cont'][$iNameIndex]['page_main_code'] = $sResult;
71  if (getParam('news_enable') == 'on') {
72  $GLOBALS['_page_cont'][$iNameIndex]['page_main_code'] .= DesignBoxAdmin(_t('_adm_box_cpt_cheetah_news'), '
73  <div class="RSSAggrCont" rssid="cheetah_news" rssnum="5" member="0">' . $GLOBALS['oFunctions']->loadingBoxInline() . '</div>');
74  }
75 
76  if (getParam('feeds_enable') == 'on') {
77  $GLOBALS['_page_cont'][$iNameIndex]['page_main_code'] .= DesignBoxAdmin(_t('_adm_box_cpt_featured_modules'), '
78  <div class="RSSAggrCont" rssid="cheetah_market_featured" rssnum="5" member="0">' . $GLOBALS['oFunctions']->loadingBoxInline() . '</div>');
79  }
80 }
81 
82 function PageCategoryCode($sCategoryName)
83 {
84  global $oAdmTemplate, $MySQL;
85 
86  $aItems = $MySQL->getAll("SELECT `tma1`.`title` AS `title`, `tma1`.`url` AS `url`, `tma1`.`description` AS `description`, `tma1`.`icon` AS `icon`, `tma1`.`check` AS `check`
87  FROM `sys_menu_admin` AS `tma1` LEFT JOIN `sys_menu_admin` AS `tma2` ON `tma1`.`parent_id`=`tma2`.`id` WHERE `tma2`.`name`= ? ORDER BY `tma1`.`Order`", [$sCategoryName]);
88 
89  foreach ($aItems as $aItem) {
90  if (strlen($aItem['check']) > 0) {
91  $oFunction = function () use ($aItem) {
92  return eval($aItem['check']);
93  };
94 
95  if (!$oFunction()) {
96  continue;
97  }
98  }
99 
100  $aItem['url'] = str_replace(array('{siteUrl}', '{siteAdminUrl}'), array(CH_WSB_URL_ROOT, CH_WSB_URL_ADMIN), $aItem['url']);
101  list($sLink, $sOnClick) = ChWsbAdminMenu::getMainMenuLink($aItem['url']);
102 
103  $aVariables[] = array(
104  'ch_if:icon' => array(
105  'condition' => false !== strpos($aItem['icon'], '.'),
106  'content' => array(
107  'icon' => $oAdmTemplate->getIconUrl($aItem['icon'])
108  )
109  ),
110  'ch_if:texticon' => array(
111  'condition' => false === strpos($aItem['icon'], '.'),
112  'content' => array(
113  'icon' => $aItem['icon']
114  )
115  ),
116  'link' => $sLink,
117  'onclick' => $sOnClick,
118  'title' => _t($aItem['title']),
119  'description' => $aItem['description']
120  );
121  }
122 
123  $iNameIndex = 0;
124  $sPageTitle = _t($MySQL->getOne("SELECT `title` FROM `sys_menu_admin` WHERE `name`='" . $sCategoryName . "' LIMIT 1"));
125  $sPageContent = $oAdmTemplate->parseHtmlByName('categories.html', array('ch_repeat:items' => $aVariables));
126 
127  $GLOBALS['_page'] = array(
128  'name_index' => $iNameIndex,
129  'css_name' => array('index.css'),
130  'header' => $sPageTitle,
131  'header_text' => $sPageTitle
132  );
133  $GLOBALS['_page_cont'][$iNameIndex]['page_main_code'] = $sPageContent;
134 }
header
</code > Be careful enabling this directive if you have a redirector script that does not use the< code > Location</code > HTTP header
Definition: URI.MungeResources.txt:10
getVisitorIP
getVisitorIP($isProxyCheck=true)
Definition: utils.inc.php:643
$oAdmTemplate
$oAdmTemplate
Definition: admin_design.inc.php:18
ch_login
ch_login($iId, $bRememberMe=false, $bAlert=true)
Definition: profiles.inc.php:514
$sPageContent
if(0===strcasecmp($_SERVER['REQUEST_METHOD'], 'POST')) $sPageContent
Definition: mobileBuilder.php:105
$sPageTitle
$sPageTitle
Definition: antispam.php:374
$sResult
$sResult
Definition: advanced_settings.php:26
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
ch_get
ch_get($sName)
Definition: utils.inc.php:1664
use
GNU LESSER GENERAL PUBLIC LICENSE February Free Software Inc Franklin Fifth MA USA Everyone is permitted to copy and distribute verbatim copies of this license but changing it is not allowed[This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it By the GNU General Public Licenses are intended to guarantee your freedom to share and change free software to make sure the software is free for all its users This the Lesser General Public applies to some specially designated software packages typically libraries of the Free Software Foundation and other authors who decide to use it You can use it but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular based on the explanations below When we speak of free we are referring to freedom of use
Definition: license.txt:27
check_password
check_password($sUsername, $sPassword, $iRole=CH_WSB_ROLE_MEMBER, $error_handle=true)
Definition: admin.inc.php:296
php
$oZ
$oZ
Definition: db.php:20
$iId
$iId
Definition: license.php:15
login_form
login_form($text="", $member=0, $bAjaxMode=false, $sLoginFormParams='')
Definition: admin.inc.php:13
isLogged
isLogged()
Definition: profiles.inc.php:24
send_headers_page_changed
send_headers_page_changed()
Definition: design.inc.php:99
isAdmin
isAdmin()
Definition: index.php:649
PageCategoryCode
PageCategoryCode($sCategoryName)
Definition: index.php:82
DesignBoxAdmin
DesignBoxAdmin($sTitle, $sContent, $mixedTopItems='', $sBottomItems='', $iIndex=1)
Definition: admin_design.inc.php:50
$sPassword
$sPassword
Definition: actions.inc.php:10
ChWsbAlerts
Definition: ChWsbAlerts.php:39
getParam
getParam($sParamName, $bUseCache=true)
Definition: db.inc.php:130
$logged
if(isset($_POST['ID']) &&isset($_POST['Password'])) if(!isAdmin()) if(ch_get('cheetah_news') !==false) $logged['admin']
Definition: index.php:48
$GLOBALS
$GLOBALS['aRequest']
Definition: index.php:10
exit
if(secureCheckWidgetName($sModule) &&file_exists($sRayHeaderPath) &&!empty($sModule) &&!empty($sApp) &&secureCheckWidgetName($sApp)) else exit
Definition: index.php:20
global
if(!defined("GLOBAL_MODULE")) define("GLOBAL_MODULE" global
Definition: header.inc.php:25
PageCodeAdmin
PageCodeAdmin($oTemplate=null)
Definition: admin_design.inc.php:45
PageMainCode
PageMainCode()
Definition: index.php:58
_t
_t($key, $arg0="", $arg1="", $arg2="")
Definition: languages.inc.php:509
member_auth
member_auth($member=0, $error_handle=true, $bAjx=false)
Definition: admin.inc.php:262
setParam
setParam($sParamName, $sParamValue)
Definition: db.inc.php:149
process_pass_data
process_pass_data($text, $strip_tags=0)
Definition: utils.inc.php:290
getID
getID( $str, $with_email=1)
Definition: admin.inc.php:139
$bLogged
$bLogged
Definition: index.php:18
ChWsbAdminDashboard
Definition: ChWsbAdminDashboard.php:23
as
as
Definition: Filter.ExtractStyleBlocks.Escaping.txt:10
$iNameIndex
$iNameIndex
Definition: admin_tools.php:39
ChWsbAdminMenu\getMainMenuLink
static getMainMenuLink($sUrl)
Definition: ChWsbAdminMenu.php:116
CH_WSB_ROLE_ADMIN
const CH_WSB_ROLE_ADMIN
Definition: profiles.inc.php:17