OSDN Git Service

Merge branch 'skinnable-master'
[nucleus-jp/nucleus-next.git] / nucleus / index.php
index b564d50..fed8f8d 100644 (file)
  */
 /**
  * @license http://nucleuscms.org/license.txt GNU General Public License
+<<<<<<< HEAD
+ * @copyright Copyright (C) 2002-2012 The Nucleus Group
+ * @version $Id: index.php 1748 2012-04-13 13:27:57Z sakamocchi $
+=======
  * @copyright Copyright (C) 2002-2009 The Nucleus Group
- * @version $Id: index.php 1638 2012-01-29 08:07:27Z sakamocchi $
+ * @version $Id: index.php 1888 2012-06-17 08:38:54Z sakamocchi $
+>>>>>>> skinnable-master
  */
 
 // we are using admin stuff:
@@ -22,25 +27,27 @@ $CONF['UsingAdminArea'] = 1;
 // include the admin code
 require_once('../config.php');
 
-if ($CONF['alertOnSecurityRisk'] == 1)
+if ( $CONF['alertOnSecurityRisk'] == 1 )
 {
        // check if files exist and generate an error if so
        $aFiles = array(
-               '../install.sql' => _ERRORS_INSTALLSQL,
-               '../install.php' => _ERRORS_INSTALLPHP,
-               'upgrades' => _ERRORS_UPGRADESDIR,
-               'convert' => _ERRORS_CONVERTDIR
+               '../install'    => _ERRORS_INSTALLDIR,
+               'upgrades'              => _ERRORS_UPGRADESDIR,
+               'convert'               => _ERRORS_CONVERTDIR
        );
        $aFound = array();
-       foreach($aFiles as $fileName => $fileDesc)
+       foreach ( $aFiles as $fileName => $fileDesc )
        {
-               if (@file_exists($fileName))
+               if ( @file_exists($fileName) )
+               {
                        array_push($aFound, $fileDesc);
+               }
        }
-       if (@is_writable('../config.php')) {
+       if ( @is_writable('../config.php') )
+       {
                array_push($aFound, _ERRORS_CONFIGPHP);
        }
-       if (sizeof($aFound) > 0)
+       if ( sizeof($aFound) > 0 )
        {
                startUpError(
                        _ERRORS_STARTUPERROR1. implode($aFound, '</li><li>')._ERRORS_STARTUPERROR2,
@@ -49,34 +56,54 @@ if ($CONF['alertOnSecurityRisk'] == 1)
        }
 }
 
-$bNeedsLogin = false;
-$bIsActivation = in_array($action, array('activate', 'activatesetpwd'));
+$bNeedsLogin   = FALSE;
+$bIsActivation = in_array($action, array('activate', 'activatesetpwd'));
 
 if ( $action == 'logout' )
 {
-       $bNeedsLogin = true;
+       $bNeedsLogin = TRUE;
 }
 
 if ( !$member->isLoggedIn() && !$bIsActivation )
 {
-       $bNeedsLogin = true;
+       $bNeedsLogin = TRUE;
 }
 
 // show error if member cannot login to admin
 if ( $member->isLoggedIn() && !$member->canLogin() && !$bIsActivation )
 {
        $error = _ERROR_LOGINDISALLOWED;
-       $bNeedsLogin = true;
+       $bNeedsLogin = TRUE;
 }
 
 if ( $bNeedsLogin )
 {
-       // see ADMIN::login() (sets old action in POST vars)
+       // see Admin::login() (sets old action in POST vars)
        setOldAction($action);
        $action = 'showlogin';
 }
 
-sendContentType('text/html', 'admin-' . $action);
+if ( !Admin::initialize() )
+{
+       /* TODO: this is a bad way... */
+       sendContentType('text/html', 'admin-' . $action);
+       
+       $skin =& $manager->getSkin(0, 'AdminActions', 'AdminSkin');
+       if ( $bNeedsLogin )
+       {
+               $skin->parse('fileparse', $DIR_SKINS . 'admin/showlogin.skn');
+       }
+       else if ($action == 'adminskinieimport' )
+       {
+               Admin::action($action);
+       }
+       else
+       {
+               $skin->parse('importAdmin', $DIR_SKINS . 'admin/defaultimporter.skn');
+       }
+       /* TODO: something to handling errors */
+       exit;
+}
 
-$admin = new ADMIN();
-$admin->action($action);
+Admin::action($action);
+exit;