OSDN Git Service

コピーライトを2007から2009に変更
[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: index.php,v 1.9 2008-02-08 09:31:22 kimitake Exp $
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         {
27                 // check if files exist and generate an error if so
28                 $aFiles = array(
29                         '../install.sql' => _ERRORS_INSTALLSQL,\r
30                         '../install.php' => _ERRORS_INSTALLPHP,\r
31                         'upgrades' => _ERRORS_UPGRADESDIR,\r
32                         'convert' => _ERRORS_CONVERTDIR\r
33                 );
34                 $aFound = array();
35                 foreach($aFiles as $fileName => $fileDesc)
36                 {
37                         if (@file_exists($fileName))
38                                 array_push($aFound, $fileDesc);
39                 }
40                 if (@is_writable('../config.php')) {
41                         array_push($aFound, 'config.php should be non-writable (chmod to 444)');
42                 }
43                 if (sizeof($aFound) > 0)
44                 {
45                         startUpError(
46                                 _ERRORS_STARTUPERROR1. implode($aFound, '</li><li>')._ERRORS_STARTUPERROR2,\r
47                                 _ERRORS_STARTUPERROR3\r
48                         );
49                 }
50         }
51
52         $bNeedsLogin = false;
53         $bIsActivation = in_array($action, array('activate', 'activatesetpwd'));
54
55         if ($action == 'logout')
56                 $bNeedsLogin = true;
57
58         if (!$member->isLoggedIn() && !$bIsActivation)
59                 $bNeedsLogin = true;
60
61         // show error if member cannot login to admin
62         if ($member->isLoggedIn() && !$member->canLogin() && !$bIsActivation) {
63                 $error = _ERROR_LOGINDISALLOWED;
64                 $bNeedsLogin = true;
65         }
66
67         if ($bNeedsLogin)
68         {
69                 setOldAction($action);  // see ADMIN::login() (sets old action in POST vars)
70                 $action = 'showlogin';
71         }
72
73         sendContentType('text/html', 'admin-' . $action);
74
75         $admin = new ADMIN();
76         $admin->action($action);
77 ?>