panel admina
[watermeloncms.git] / admin.php
bloba14b7d5d98af8d468770925898e73073ef0c3034
1 <?php
2 /********************************************************************
4 Watermelon CMS
6 Copyright 2008-2009 Radosław Pietruszewski
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 version 2 as published by the Free Software Foundation.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 ********************************************************************/
23 $_w_startTime = microtime();
24 $_w_startTime = explode(' ', $_w_startTime);
25 $_w_startTime_msec = substr($_w_startTime[0],2);
26 $_w_startTime_sec = $_w_startTime[1];
27 $_w_startTime = $_w_startTime_sec . $_w_startTime_msec;
28 $_w_startTime = substr($_w_startTime, 0, -2);
30 session_start();
31 ob_start();
32 session_regenerate_id();
34 header("Content-Type: text/html; charset=UTF-8");
36 ##
37 ## magic quotes - odwracamy skutki działań magic quotes
38 ##
40 if(get_magic_quotes_gpc())
42 function stripslashes_deep($value)
44 $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
45 return $value;
47 $_POST = array_map('stripslashes_deep', $_POST);
48 $_GET = array_map('stripslashes_deep', $_GET);
49 $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
50 $_REQUEST = array_map('stripslashes_deep', $_REQUEST);
53 ##
54 ## wczytujemy plik z konfiguracją
55 ##
57 if(file_exists('config.php'))
59 include 'config.php';
61 if(!isset($_w_baseURL))
63 header('Location: wtrmln/install/index.php');
64 exit;
67 else
69 header('Location: wtrmln/install/index.php');
70 exit;
73 ##
74 ## definiowanie podstawowych stałych
75 ##
77 $_w_basePath = str_replace('\\', '/', realpath(dirname(__FILE__))) . '/';
79 define('WTRMLN_BASEURL' , $_w_baseURL );
80 define('WTRMLN_MAINURL' , $_w_siteURL );
81 define('WTRMLN_SITEURL' , $_w_adminURL );
82 define('WTRMLN_CMSDIR' , $_w_cmsDir );
83 define('WTRMLN_THEME' , $_w_adminTheme );
84 define('WTRMLN_DEFAULTCNT' , $_w_PAdCnt );
85 define('WTRMLN_SITENAME' , $_w_siteName );
86 define('WTRMLN_SITESLOGAN' , $_w_siteSlogan );
88 define('WTRMLN_CMSURL' , $_w_baseURL . WTRMLN_CMSDIR );
89 define('WTRMLN_CMSPATH' , $_w_basePath . WTRMLN_CMSDIR );
90 define('WTRMLN_APPPATH' , WTRMLN_CMSPATH . 'modules/' );
92 define('WTRMLN_THEMEURL' , WTRMLN_CMSURL . 'themes_admin/' . WTRMLN_THEME . '/');
93 define('WTRMLN_THEMEPATH' , WTRMLN_CMSPATH . 'themes_admin/' . WTRMLN_THEME . '/');
94 define('WTRMLN_LIBS' , WTRMLN_CMSPATH . 'libs/' );
95 define('WTRMLN_ADMINLIBS' , WTRMLN_CMSPATH . 'admin/libs/' );
96 define('WTRMLN_HELPERS' , WTRMLN_CMSPATH . 'helpers/' );
97 define('WTRMLN_CACHE' , WTRMLN_CMSPATH . 'cache/' );
98 define('WTRMLN_FILES' , WTRMLN_CMSURL . 'files/' );
99 define('WTRMLN_ACINFO' , WTRMLN_APPPATH . 'acinfo/' );
100 define('WTRMLN_CONTROLLERS' , WTRMLN_APPPATH . 'admin/' );
101 define('WTRMLN_VIEWS' , WTRMLN_APPPATH . 'views/' );
102 define('WTRMLN_MODELS' , WTRMLN_APPPATH . 'models/' );
103 define('WTRMLN_BLOCKS' , WTRMLN_APPPATH . 'blocks/' );
104 define('WTRMLN_PLUGINS' , WTRMLN_APPPATH . 'plugins/' );
106 define('ADMIN_MODE', '');
108 include WTRMLN_LIBS . 'config.php';
110 Config::$theme = $_w_adminTheme;
111 Config::$defaultController = $_w_PAdCnt;
112 Config::$hashAlgo = $_w_hashAlgo;
113 Config::$defaultHashAlgo = $_w_dHashAlgo;
114 Config::$siteName = $_w_siteName;
115 Config::$siteSlogan = $_w_siteSlogan;
116 Config::setSuperusers($_w_superusers);
119 ## odpalamy główny plik CMS-a
122 include WTRMLN_CMSPATH . 'system_admin.php';