Update version.php to 3.3.0
[isso.git] / Installer.php
index 5d23daba832456501c8ac2dd07bb418d36cb8710..24348af9a94bcb5bc75027405d03385233f7deac 100644 (file)
@@ -2,11 +2,11 @@
 /*=====================================================================*\
 || ###################################################################
 || # Blue Static ISSO Framework
-|| # Copyright ©2002-[#]year[#] Blue Static
+|| # Copyright (c)2005-2009 Blue Static
 || #
 || # 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; version [#]gpl[#] of the License.
+|| # the Free Software Foundation; version 2 of the License.
 || #
 || # This program is distributed in the hope that it will be useful, but
 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 \*=====================================================================*/
 
 /**
-* Installer creator (Install.php)
-*
-* @package     ISSO
-*/
+ * Installer creator (Install.php)
+ *
+ * @package    ISSO
+ */
 
 /**
-* Installer
-*
-* Installer modules should extend this class. In the install module router,
-* instantiate the right module. Methods beginning with step*() will be executed
-* in numerical order.
-*
-* @author              Blue Static
-* @copyright   Copyright (c)2002 - [#]year[#], Blue Static
-* @version             $Revision$
-* @package             ISSO
-*
-*/
+ * Installer
+ *
+ * Installer modules should extend this class. In the install module router,
+ * instantiate the right module. Methods beginning with step*() will be executed
+ * in numerical order.
+ *
+ * @author             Blue Static
+ * @copyright  Copyright (c)2005 - 2009, Blue Static
+ * @package            ISSO
+ *
+ */
 abstract class BSInstaller
 {
        /**
-       * All the method steps
-       * @var array
-       */
+        * All the method steps
+        * @var array
+        */
        private $steps = array();
        
        /**
-       * The file name of this module
-       * @var string
-       */
+        * The file name of this module
+        * @var string
+        */
        protected $fileName;
        
        /**
-       * Constructor: set up the steps
-       *
-       * @param        string  The file name for this module
-       */
+        * Constructor: set up the steps
+        *
+        * @param       string  The file name for this module
+        */
        public function __construct($fileName)
        {
                $this->fileName = $fileName;
                
-               BSRegister::RequiredModules(array('Input'));
+               if (!BSApp::$input instanceof BSInput)
+               {
+                       throw new Exception('BSApp::$input is not an instance of BSInput');
+               }
                
                $methods = get_class_methods($this);
-               foreach ($methods AS $name)
+               foreach ($methods as $name)
                {
-                       if (preg_match('#step([0-9]+)#', $name))
+                       if (preg_match('/step([0-9]+)/', $name))
                        {
                                $this->steps[] = $name;
                        }
                }
                natsort($this->steps);
-               
-               $this->_runStep(BSRegister::GetType('Input')->inputClean('step', TYPE_UINT));
+                               
+               $this->_runStep(BSApp::$input->inputClean('step', TYPE_UINT));
        }
        
-       // ###################################################################
        /**
-       * An abstract method that needs to be overridden by a subclass that
-       * populates the page title
-       *
-       * @return       string  Returns the page title
-       */
+        * An abstract method that needs to be overridden by a subclass that
+        * populates the page title
+        *
+        * @return      string  Returns the page title
+        */
        protected abstract function _pageTitle();
        
-       // ###################################################################
        /**
-       * Abstract method that will return link to the page after all the
-       * steps are completed. This needs to provide it's own <a>
-       *
-       * @return       string  Final page link
-       */
+        * Abstract method that will return link to the page after all the
+        * steps are completed. This needs to provide it's own <a>
+        *
+        * @return      string  Final page link
+        */
        protected abstract function _finalLink();
        
-       // ###################################################################
        /**
-       * Abstract method that prints out the first welcome screen that the
-       * user sees when no step has been selected
-       */
+        * Abstract method that prints out the first welcome screen that the
+        * user sees when no step has been selected
+        */
        protected abstract function _welcomePage();
                        
-       // ###################################################################
        /**
-       * Prints out the page header... you really don't do this more than
-       * once
-       */
+        * Prints out the page header... you really don't do this more than
+        * once
+        */
        protected function _setUp()
        {
                ?>
@@ -157,13 +155,12 @@ abstract class BSInstaller
                <?php
        }
        
-       // ###################################################################
        /**
-       * Runs the specific step method; if it does not exist, it will throw
-       * an error
-       *
-       * @param        integer Step number
-       */
+        * Runs the specific step method; if it does not exist, it will throw
+        * an error
+        *
+        * @param       integer Step number
+        */
        protected function _runStep($step)
        {
                if ($step == 0)
@@ -184,13 +181,12 @@ abstract class BSInstaller
                }
        }
        
-       // ###################################################################
        /**
-       * Prints out the footer part of the page, and the appropriate forwarding
-       * action button
-       *
-       * @param        integer Step number
-       */
+        * Prints out the footer part of the page, and the appropriate forwarding
+        * action button
+        *
+        * @param       integer Step number
+        */
        protected function _setDown($step)
        {
                // this is the last step, print the final button
@@ -211,10 +207,4 @@ abstract class BSInstaller
        }
 }
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file