OSDN Git Service

FIX: super-admin disallowed from uploading files if not on any teamlists.
[nucleus-jp/nucleus-jp-ancient.git] / utf8 / nucleus / index.php
1 <?php
2 /*
3  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
4  * Copyright (C) 2002-2009 The Nucleus Group
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  * (see nucleus/documentation/index.html#license for more info)
11  */
12 /**
13  * @license http://nucleuscms.org/license.txt GNU General Public License
14  * @copyright Copyright (C) 2002-2009 The Nucleus Group
15  * @version $Id$
16  * $NucleusJP: index.php,v 1.8.2.1 2007/09/07 07:36:09 kimitake Exp $
17  */
18         // we are using admin stuff:
19         $CONF = array();
20         $CONF['UsingAdminArea'] = 1;
21
22         // include the admin code
23         include('../config.php');
24
25         if ($CONF['alertOnSecurityRisk'] == 1) {
26                 // check if files exist and generate an error if so
27                 $aFiles = array(
28                         '../install.sql' => _ERRORS_INSTALLSQL,\r
29                         '../install.php' => _ERRORS_INSTALLPHP,\r
30                         'upgrades'       => _ERRORS_UPGRADESDIR,\r
31                         'convert'        => _ERRORS_CONVERTDIR\r
32                 );
33                 $aFound = array();
34                 foreach($aFiles as $fileName => $fileDesc) {
35                         if (@file_exists($fileName))
36                                 array_push($aFound, $fileDesc);
37                 }
38                 if (@is_writable('../config.php')) {
39                         array_push($aFound, _ERRORS_CONFIGPHP);
40                 }
41                 if (sizeof($aFound) > 0) {
42                         startUpError(
43                                 _ERRORS_STARTUPERROR1. implode($aFound, '</li><li>')._ERRORS_STARTUPERROR2,\r
44                                 _ERRORS_STARTUPERROR3\r
45                         );
46                 }
47         }
48
49         $bNeedsLogin   = false;
50         $bIsActivation = in_array($action, array('activate', 'activatesetpwd'));
51
52         if ($action == 'logout') {
53                 $bNeedsLogin = true;\r
54         }
55
56         if (!$member->isLoggedIn() && !$bIsActivation) {
57                 $bNeedsLogin = true;\r
58         }
59
60         // show error if member cannot login to admin
61         if ($member->isLoggedIn() && !$member->canLogin() && !$bIsActivation) {
62                 $error       = _ERROR_LOGINDISALLOWED;
63                 $bNeedsLogin = true;
64         }
65
66         if ($bNeedsLogin) {
67                 setOldAction($action);  // see ADMIN::login() (sets old action in POST vars)
68                 $action = 'showlogin';
69         }
70
71         sendContentType('text/html', 'admin-' . $action);
72
73         $admin = new ADMIN();
74         $admin->action($action);
75 ?>