--- FreeBSD/tinderbox/webui/index.php 2007/11/02 20:55:00 1.1 +++ FreeBSD/tinderbox/webui/index.php 2007/11/13 07:39:25 1.1.1.1.2.1 @@ -24,31 +24,29 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # +# $Paefchen$ # $MCom: portstools/tinderbox/webui/index.php,v 1.22 2007/10/13 02:28:47 ade Exp $ # -$starttimer = explode( ' ', microtime() ); +$starttimer = microtime(true); -require_once 'module/moduleBuilds.php'; -require_once 'module/moduleBuildPorts.php'; -require_once 'module/moduleConfig.php'; -require_once 'module/modulePorts.php'; -require_once 'module/modulePortFailureReasons.php'; -require_once 'module/moduleSession.php'; -require_once 'module/moduleTinderd.php'; -require_once 'module/moduleUsers.php'; +$cfg_modules = array('Builds', 'BuildPorts', 'Config', 'Ports', + 'PortFailureReasons', 'Session', 'Tinderd', 'Users'); -require_once $templatesdir.'/messages.inc'; +set_include_path(get_include_path() . PATH_SEPARATOR . 'module' + . PATH_SEPARATOR . 'core'); -$moduleBuilds = new moduleBuilds(); -$moduleBuildPorts = new moduleBuildPorts(); -$moduleConfig = new moduleConfig(); -$modulePorts = new modulePorts(); -$modulePortFailureReasons = new modulePortFailureReasons(); -$moduleSession = new moduleSession(); -$moduleTinderd = new moduleTinderd(); -$moduleUsers = new moduleUsers(); +function __autoload($class) { + require_once $class . '.php'; +} +foreach ($cfg_modules as $module) { + $className = 'module' . $module; + $$className = new $className; +} + +require_once $templatesdir.'/messages.inc'; + $moduleSession->start(); if( isset($_POST['do_login']) ) { $moduleUsers->do_login( $_POST['User_Name'], $_POST['User_Password'] ); @@ -143,10 +141,8 @@ switch( $action ) { echo $display; -if( isset( $with_timer ) && $with_timer == 1 ) { - $endtimer = explode( ' ', microtime() ); - $timer = ( $endtimer[1]-$starttimer[1] )+( $endtimer[0]-$starttimer[0] ); - printf( '
elapsed: %03.6f seconds, %s', $timer, '
' ); -} +if (isset($with_timer) && $with_timer) + printf('elapsed: %03.6f seconds,
', microtime(true) - $starttimer); + echo 'Note: The Tinderbox web interface requires cookies to be enable.
'; ?>