OSDN Git Service

sync with UTF-8
[nucleus-jp/nucleus-jp-ancient.git] / euc / nucleus / index.php
1 <?php
2 /*
3  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
4  * Copyright (C) 2002-2007 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-2007 The Nucleus Group
15  * @version $Id: index.php,v 1.4 2007-03-27 12:13:47 kimitake Exp $
16  * $NucleusJP: index.php,v 1.8 2007/02/04 06:28:45 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' => 'install.sql should be deleted',
30                         '../install.php' => 'install.php should be deleted',
31                         'upgrades' => 'nucleus/upgrades directory should be deleted',
32                         'convert' => 'nucleus/convert directory should be deleted'
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                                 '<p>One or more of the Nucleus installation files are still present on the webserver, or are writable.</p><p>You should remove these files or change their permissions to ensure security. Here are the files that were found by Nucleus</p> <ul><li>'. implode($aFound, '</li><li>').'</li></ul><p>If you don\'t want to see this error message again, without solving the problem, set <code>$CONF[\'alertOnSecurityRisk\']</code> in <code>globalfunctions.php</code> to <code>0</code>, or do this at the end of <code>config.php</code>.</p>',
47                                 'Security Risk'
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('application/xhtml+xml', 'admin-' . $action);
74
75         $admin = new ADMIN();
76         $admin->action($action);
77 ?>