version 1.1, 2007/11/02 20:55:00
|
version 1.1.1.1.2.4, 2007/11/16 23:03:38
|
Line 24
|
Line 24
|
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
# SUCH DAMAGE. |
# SUCH DAMAGE. |
# |
# |
|
# $Paefchen: FreeBSD/tinderbox/webui/index.php,v 1.1.1.1.2.3 2007/11/16 22:52:43 as Exp $ |
# $MCom: portstools/tinderbox/webui/index.php,v 1.22 2007/10/13 02:28:47 ade Exp $ |
# $MCom: portstools/tinderbox/webui/index.php,v 1.22 2007/10/13 02:28:47 ade Exp $ |
# |
# |
|
|
$starttimer = explode( ' ', microtime() ); | define('STARTTIME', microtime(true)); |
|
|
require_once 'module/moduleBuilds.php'; | if ((int)PHP_VERSION < 5) |
require_once 'module/moduleBuildPorts.php'; | die ("Error: TB-WebUI needs PHP5!\n"); |
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'; | |
|
|
require_once $templatesdir.'/messages.inc'; | foreach (array('pcre') as $phpmodule) |
| if (! extension_loaded($phpmodule)) |
| die (sprintf("Error: TB-WebUI needs PHP-Module '%s'\n", |
| $phpmodule)); |
|
|
$moduleBuilds = new moduleBuilds(); | if (! is_readable('inc_ds.php')) |
$moduleBuildPorts = new moduleBuildPorts(); | die ("Error: Configuration File not found (inc_ds.php)\n"); |
$moduleConfig = new moduleConfig(); | require_once 'inc_ds.php'; |
$modulePorts = new modulePorts(); | |
$modulePortFailureReasons = new modulePortFailureReasons(); | |
$moduleSession = new moduleSession(); | |
$moduleTinderd = new moduleTinderd(); | |
$moduleUsers = new moduleUsers(); | |
|
|
$moduleSession->start(); | if (is_readable('inc_tinderbox.php')) |
if( isset($_POST['do_login']) ) { | require_once 'inc_tinderbox.php'; |
$moduleUsers->do_login( $_POST['User_Name'], $_POST['User_Password'] ); | |
} elseif( isset($_POST['do_logout']) || ( $moduleUsers->is_logged_in() && !$moduleUsers->get_www_enabled() ) ) { | /* ...defaults && compat... */ |
$moduleUsers->do_logout(); | if (! defined('MODULES')) define('MODULES', 'Builds, BuildPorts, Config, Ports, PortFailureReasons, Tinderd, Users'); |
header( 'Location: index.php' ); | if (! defined('TB_NAME')) define('TB_NAME', isset($tinderbox_name) ? $tinderbox_name : 'Example Tinderbox'); |
| if (! defined('TB_TITLE')) define('TB_TITLE', isset($tinderbox_title) ? $tinderbox_title : 'Example Tinderbox'); |
| if (! defined('WWWROOT')) define('WWWROOT', isset($wwwrooturi) ? $wwwrooturi : dirname(__FILE__)); |
| if (! defined('TBROOT')) define('TBROOT', isset($rootdir) ? $rootdir : realpath(WWWROOT.'/../..')); |
| if (! defined('TEMPLATE')) define('TEMPLATE', isset($template_dir) ? $template_dir : 'default'); |
| if (! defined('URLROOT')) define('URLROOT', dirname($_SERVER['SCRIPT_NAME'])); |
| if (! defined('PROTOCOL')) define('PROTOCOL', isset($_SERVER['HTTPS'])?'https':'http'); |
| if (! defined('HOSTNAME')) define('HOSTNAME', $_SERVER['SERVER_NAME']); |
| if (! defined('PORT')) define('PORT', $_SERVER['SERVER_PORT']); |
| if (! defined('URL')) define('URL', PROTOCOL.'://'.HOSTNAME.(PORT!=80?':80':'').URLROOT); |
| if (! defined('PKGURL')) define('PKGURL', isset($pkguri) ? $pkguri : URL.'/packages'); |
| if (! defined('PKGDIR')) define('PKGDIR', isset($pkgdir) ? $pkgdir : TBROOT.'/packages'); |
| if (! defined('LOGURL')) define('LOGURL', isset($loguri) ? $loguri : URL.'/logs'); |
| if (! defined('LOGDIR')) define('LOGDIR', isset($lodir) ? $logdir : TBROOT.'/logs'); |
| if (! defined('ERRORLOGURL')) define('ERRORLOGURL', isset($errorloguri) ? $errorloguri : URL.'/errors'); |
| if (! defined('ERRORLOGDIR')) define('ERRORLOGDIR', isset($errorlogdir) ? $errorlogdir : TBROOT.'/errors'); |
| if (! defined('TEMPLATESURL')) define('TEMPLATESURL', isset($templatesuri) ? $templatesuri : URL.'/templates/'.TEMPLATE); |
| if (! defined('TEMPLATESDIR')) define('TEMPLATESDIR', isset($templatesdir) ? $templatesdir : WWWROOT.'/templates/'.TEMPLATE); |
| if (! defined('SHOWTIMER')) define('SHOWTIMER', false); |
| |
| foreach (array('WWWROOT', 'TBROOT', 'TEMPLATESDIR') as $dir) |
| if (! is_dir(constant($dir))) |
| die(sprintf("Error => config: dir %s not found (%s)\n", |
| constant($dir), $dir)); |
| |
| set_include_path(get_include_path().PATH_SEPARATOR.'module' |
| .PATH_SEPARATOR.'core'); |
| |
| require_once 'functions.php'; |
| require_once TEMPLATESDIR.'/messages.inc'; |
| |
| foreach (module_list() as $moduleName) { |
| $className = 'module' . $moduleName; |
| |
| if (! is_readable('module/'.$className.'.php')) |
| die (sprintf("Error: Module not found (%s)\n", |
| $moduleName)); |
| |
| define('MODULE_'.strtoupper($moduleName), $className); |
| /* as xxx */ |
| $$className = new $className; |
} |
} |
|
|
$display_login = $moduleUsers->display_login(); | if (defined('MODULE_USERS')) { |
| $moduleUsers->start(); |
|
|
|
if (isset($_POST['do_login'])) { |
|
$moduleUsers->do_login( $_POST['User_Name'], $_POST['User_Password']); |
|
} |
|
else if(isset($_POST['do_logout']) |
|
|| ($moduleUsers->is_logged_in() && ! $moduleUsers->get_www_enabled())) { |
|
$moduleUsers->do_logout(); |
|
header('Location: index.php'); |
|
exit; |
|
} |
|
} |
|
|
|
/* as xxx */ |
|
#$display_login = $moduleUsers->display_login(); |
|
|
$action = $_REQUEST['action']; |
$action = $_REQUEST['action']; |
|
|
switch( $action ) { |
switch( $action ) { |
Line 143 switch( $action ) {
|
Line 191 switch( $action ) {
|
|
|
echo $display; |
echo $display; |
|
|
if( isset( $with_timer ) && $with_timer == 1 ) { | if (isset($with_timer) && $with_timer) |
$endtimer = explode( ' ', microtime() ); | printf('<p style="color:#FF0000;font-size:10px;">elapsed: %03.6f seconds, </p>', microtime(true) - $starttimer); |
$timer = ( $endtimer[1]-$starttimer[1] )+( $endtimer[0]-$starttimer[0] ); | |
printf( '<p style="color:#FF0000;font-size:10px;">elapsed: %03.6f seconds, %s', $timer, ' </p>' ); | |
} | |
echo '<p style="font-size:10px;"><b>Note:</b> The Tinderbox web interface requires cookies to be enable.</p>'; |
echo '<p style="font-size:10px;"><b>Note:</b> The Tinderbox web interface requires cookies to be enable.</p>'; |
?> |
?> |