OSDN Git Service

translated by kitsune.info
[nucleus-jp/nucleus-jp-ancient.git] / euc / nucleus / index.php
index 98dad80..9ba1101 100755 (executable)
@@ -1,73 +1,65 @@
-<?php
-/**
-  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
-  * Copyright (C) 2002-2004 The Nucleus Group
-  *
-  * This program is free software; you can redistribute it and/or
-  * modify it under the terms of the GNU General Public License
-  * as published by the Free Software Foundation; either version 2
-  * of the License, or (at your option) any later version.
-  * (see nucleus/documentation/index.html#license for more info)
-  *
-  * $Id: index.php,v 1.1.1.1 2005-02-28 07:13:53 kimitake Exp $
-  */
-       // we are using admin stuff:
-       $CONF = array();
-       $CONF['UsingAdminArea'] = 1;
-
-       // include the admin code
-       include('../config.php');
-
-       if ($CONF['alertOnSecurityRisk'] == 1)
-       {
-               // check if files exist and generate an error if so
-               $aFiles = array(
-                       '../install.sql' => 'install.sql should be deleted',
-                       '../install.php' => 'install.php should be deleted',
-                       'upgrades' => 'nucleus/upgrades directory should be deleted',
-                       'convert' => 'nucleus/convert directory should be deleted'
-               );
-               $aFound = array();
-               foreach($aFiles as $fileName => $fileDesc)
-               {
-                       if (@file_exists($fileName))
-                               array_push($aFound, $fileDesc);
-               }
-               if (@is_writable('../config.php')) {
-                       array_push($aFound, 'config.php should be non-writable (chmod to 444)');
-               }
-               if (sizeof($aFound) > 0)
-               {
-                       startUpError(
-                               '<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>',
-                               'Security Risk'
-                       );
-               }
-       }
-
-       $bNeedsLogin = false;
-       $bIsActivation = in_array($action, array('activate', 'activatesetpwd'));
-       
-       if ($action == 'logout') 
-               $bNeedsLogin = true;    
-       
-       if (!$member->isLoggedIn() && !$bIsActivation)
-               $bNeedsLogin = true;
-
-       // show error if member cannot login to admin
-       if ($member->isLoggedIn() && !$member->canLogin() && !$bIsActivation) {
-               $error = _ERROR_LOGINDISALLOWED;
-               $bNeedsLogin = true;
-       }
-       
-       if ($bNeedsLogin)
-       {
-               setOldAction($action);  // see ADMIN::login() (sets old action in POST vars)
-               $action = 'showlogin';
-       }
-
-       sendContentType('application/xhtml+xml', 'admin-' . $action);
-       
-       $admin = new ADMIN();
-       $admin->action($action);
+<?php\r
+/**\r
+  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
+  * Copyright (C) 2002-2004 The Nucleus Group\r
+  *\r
+  * This program is free software; you can redistribute it and/or\r
+  * modify it under the terms of the GNU General Public License\r
+  * as published by the Free Software Foundation; either version 2\r
+  * of the License, or (at your option) any later version.\r
+  * (see nucleus/documentation/index.html#license for more info)\r
+  */\r
+       // we are using admin stuff:\r
+       $CONF = array();\r
+       $CONF['UsingAdminArea'] = 1;\r
+\r
+       // include the admin code\r
+       include('../config.php');\r
+\r
+       if ($CONF['alertOnSecurityRisk'] == 1)\r
+       {\r
+               // check if files exist and generate an error if so\r
+               $aFiles = array(\r
+                       '../install.sql' => 'install.sql should be deleted',\r
+                       '../install.php' => 'install.php should be deleted',\r
+                       'upgrades' => 'nucleus/upgrades directory should be deleted',\r
+                       'convert' => 'nucleus/convert directory should be deleted'\r
+               );\r
+               $aFound = array();\r
+               foreach($aFiles as $fileName => $fileDesc)\r
+               {\r
+                       if (@file_exists($fileName))\r
+                               array_push($aFound, $fileDesc);\r
+               }\r
+               if (@is_writable('../config.php')) {\r
+                       array_push($aFound, 'config.php should be non-writable (chmod to 444)');\r
+               }\r
+               if (sizeof($aFound) > 0)\r
+               {\r
+                       startUpError(\r
+                               '<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>',\r
+                               'Security Risk'\r
+                       );\r
+               }\r
+       }\r
+\r
+       if (!$member->isLoggedIn() || ($action == 'logout')) {\r
+               $HTTP_POST_VARS['oldaction'] = $action; // see ADMIN::login()\r
+               $_POST['oldaction'] = $action;\r
+               $action = "showlogin";\r
+       }\r
+\r
+       // show error if member cannot login to admin\r
+       if ($member->isLoggedIn() && !$member->canLogin()) {\r
+               $error = _ERROR_LOGINDISALLOWED;\r
+               $HTTP_POST_VARS['oldaction'] = $action; // see ADMIN::login()\r
+               $_POST['oldaction'] = $action;\r
+               $action = "showlogin";\r
+\r
+       }\r
+\r
+       sendContentType('application/xhtml+xml', 'admin-' . $action);\r
+       \r
+       $admin = new ADMIN();\r
+       $admin->action($action);\r
 ?>
\ No newline at end of file