OSDN Git Service

スタートアップエラーの文字化けを解消するコードを追加
[nucleus-jp/nucleus-next.git] / nucleus / index.php
1 <?php
2 /*
3  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
4  * Copyright (C) 2002-2012 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-2012 The Nucleus Group
15  * @version $Id: index.php 1638 2012-01-29 08:07:27Z sakamocchi $
16  */
17
18 // we are using admin stuff:
19 $CONF = array();
20 $CONF['UsingAdminArea'] = 1;
21
22 // include the admin code
23 require_once('../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,
30 //              '../install.php' => _ERRORS_INSTALLPHP,
31                 '../install' => _ERRORS_INSTALLDIR,
32                 'upgrades' => _ERRORS_UPGRADESDIR,
33                 'convert' => _ERRORS_CONVERTDIR
34         );
35         $aFound = array();
36         foreach($aFiles as $fileName => $fileDesc)
37         {
38                 if ( @file_exists($fileName) )
39                 {
40                         array_push($aFound, $fileDesc);
41                 }
42         }
43         if ( @is_writable('../config.php') ) {
44                 array_push($aFound, _ERRORS_CONFIGPHP);
45         }
46         if (sizeof($aFound) > 0)
47         {
48                 sendContentType('text/html', 'startUpError');
49                 startUpError(
50                         _ERRORS_STARTUPERROR1 . implode($aFound, '</li><li>') . _ERRORS_STARTUPERROR2,
51                         _ERRORS_STARTUPERROR3
52                 );
53         }
54 }
55
56 $bNeedsLogin   = false;
57 $bIsActivation = in_array($action, array('activate', 'activatesetpwd'));
58
59 if ( $action == 'logout' )
60 {
61         $bNeedsLogin = true;
62 }
63
64 if ( !$member->isLoggedIn() && !$bIsActivation )
65 {
66         $bNeedsLogin = true;
67 }
68
69 // show error if member cannot login to admin
70 if ( $member->isLoggedIn() && !$member->canLogin() && !$bIsActivation )
71 {
72         $error = _ERROR_LOGINDISALLOWED;
73         $bNeedsLogin = true;
74 }
75
76 if ( $bNeedsLogin )
77 {
78         // see Admin::login() (sets old action in POST vars)
79         setOldAction($action);
80         $action = 'showlogin';
81 }
82
83 sendContentType('text/html', 'admin-' . $action);
84
85 $admin = new Admin();
86 $admin->action($action);