Annotation of FreeBSD/tinderbox/webui/index.php, revision 1.1.1.1.2.1
1.1 as 1: <?php
2: #-
3: # Copyright (c) 2005 Oliver Lehmann <oliver@FreeBSD.org>
4: # All rights reserved.
5: #
6: # Redistribution and use in source and binary forms, with or without
7: # modification, are permitted provided that the following conditions
8: # are met:
9: # 1. Redistributions of source code must retain the above copyright
10: # notice, this list of conditions and the following disclaimer
11: # 2. Redistributions in binary form must reproduce the above copyright
12: # notice, this list of conditions and the following disclaimer in the
13: # documentation and/or other materials provided with the distribution.
14: #
15: # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16: # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17: # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18: # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19: # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20: # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21: # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22: # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23: # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24: # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25: # SUCH DAMAGE.
26: #
1.1.1.1.2.1! as 27: # $Paefchen$
1.1 as 28: # $MCom: portstools/tinderbox/webui/index.php,v 1.22 2007/10/13 02:28:47 ade Exp $
29: #
30:
1.1.1.1.2.1! as 31: $starttimer = microtime(true);
1.1 as 32:
1.1.1.1.2.1! as 33: $cfg_modules = array('Builds', 'BuildPorts', 'Config', 'Ports',
! 34: 'PortFailureReasons', 'Session', 'Tinderd', 'Users');
1.1 as 35:
1.1.1.1.2.1! as 36: set_include_path(get_include_path() . PATH_SEPARATOR . 'module'
! 37: . PATH_SEPARATOR . 'core');
! 38:
! 39: function __autoload($class) {
! 40: require_once $class . '.php';
! 41: }
! 42:
! 43: foreach ($cfg_modules as $module) {
! 44: $className = 'module' . $module;
! 45: $$className = new $className;
! 46: }
1.1 as 47:
1.1.1.1.2.1! as 48: require_once $templatesdir.'/messages.inc';
1.1 as 49:
50: $moduleSession->start();
51: if( isset($_POST['do_login']) ) {
52: $moduleUsers->do_login( $_POST['User_Name'], $_POST['User_Password'] );
53: } elseif( isset($_POST['do_logout']) || ( $moduleUsers->is_logged_in() && !$moduleUsers->get_www_enabled() ) ) {
54: $moduleUsers->do_logout();
55: header( 'Location: index.php' );
56: }
57:
58: $display_login = $moduleUsers->display_login();
59:
60: $action = $_REQUEST['action'];
61:
62: switch( $action ) {
63: case 'describe_port': $port_id = $_REQUEST['id'];
64: $display = $modulePorts->display_describe_port( $port_id );
65: break;
66: case 'failed_buildports': $build = $_REQUEST['build'];
67: $maintainer = $_REQUEST['maintainer'];
68: $display = $moduleBuildPorts->display_failed_buildports( $build, $maintainer, null );
69: break;
70: case 'bad_buildports': $build = $_REQUEST['build'];
71: $maintainer = $_REQUEST['maintainer'];
72: $display = $moduleBuildPorts->display_failed_buildports( $build, $maintainer, 'foo' );
73: break;
74: case 'latest_buildports': $build = $_REQUEST['build'];
75: $display = $moduleBuildPorts->display_latest_buildports( $build );
76: break;
77: case 'list_buildports': $build = $_REQUEST['build'];
78: $sort = '';
79: if (isset($_REQUEST['sort'])) {
80: $sort = $_REQUEST['sort'];
81: }
82: $display = $moduleBuildPorts->display_list_buildports( $build, $sort );
83: break;
84: case 'list_tinderd_queue': $build_id = $_REQUEST['filter_build_id'];
85: $display = $moduleTinderd->list_tinderd_queue( $build_id );
86: break;
87: case 'change_tinderd_queue': $ctinderdq = $_REQUEST['change_tinderd_queue'];
88: $entry_id = $_REQUEST['entry_id'];
89: $build_id = $_REQUEST['build_id'];
90: $priority = $_REQUEST['priority'];
91: $emailoc = $_REQUEST['email_on_completion'];
92: $moduleTinderd->change_tinderd_queue( $ctinderdq, $entry_id, $build_id, $priority, $emailoc );
93: $build_id = $_REQUEST['filter_build_id'];
94: $display = $moduleTinderd->list_tinderd_queue( $build_id );
95: break;
96: case 'add_tinderd_queue': $atinderdq = $_REQUEST['add_tinderd_queue'];
97: $build_id = $_REQUEST['new_build_id'];
98: $priority = $_REQUEST['new_priority'];
99: $directory = $_REQUEST['new_port_directory'];
100: $emailoc = $_REQUEST['new_email_on_completion'];
101: $moduleTinderd->add_tinderd_queue( $atinderdq, $build_id, $priority, $directory, $emailoc );
102: $build_id = $_REQUEST['filter_build_id'];
103: $display = $moduleTinderd->list_tinderd_queue( $build_id );
104: break;
105: case 'display_add_user': $display = $moduleUsers->display_add_user( '', '', '', '', array() );
106: break;
107: case 'add_user': $user_name = $_REQUEST['user_name'];
108: $user_email = $_REQUEST['user_email'];
109: $user_pwd = $_REQUEST['user_password'];
110: $wwwenabled = $_REQUEST['www_enabled'];
111: $display = $moduleUsers->action_user( 'add', '', $user_name, $user_email, $user_pwd, $wwwenabled );
112: switch( $display ) {
113: case '1': unset( $display ); header( 'Location: index.php' ); break;
114: case '0': $display = $moduleUsers->display_add_user( $user_name, $user_email, $user_pwd, $wwwenabled ); break;
115: }
116: break;
117: case 'display_modify_user': $user_id = $_REQUEST['modify_user_id'];
118: $display = $moduleUsers->display_modify_user( 1, $user_id, '', '', '', '', array() );
119: break;
120: case 'modify_user': $actionuser = $_REQUEST['action_user'];
121: $user_id = $_REQUEST['user_id'];
122: $user_name = $_REQUEST['user_name'];
123: $user_email = $_REQUEST['user_email'];
124: $user_pwd = $_REQUEST['user_password'];
125: $wwwenabled = $_REQUEST['www_enabled'];
126: $display = $moduleUsers->action_user( $actionuser, $user_id, $user_name, $user_email, $user_pwd, $wwwenabled );
127: switch( $display ) {
128: case '1': unset( $display ); header( 'Location: index.php' ); break;
129: case '0': $display = $moduleUsers->display_modify_user( 0, $user_id, $user_name, $user_email, $user_pwd, $www_enabled ); break;
130: }
131: break;
132: case 'display_failure_reasons': $failure_reason_tag = $_REQUEST['failure_reason_tag'];
133: $display = $modulePortFailureReasons->display_failure_reasons( $failure_reason_tag );
134: break;
135: case 'config': $display = $moduleConfig->display_config();
136: break;
137: case 'list_builds':
138: default: $display = $moduleBuilds->display_list_builds();
139: break;
140: }
141:
142: echo $display;
143:
1.1.1.1.2.1! as 144: if (isset($with_timer) && $with_timer)
! 145: printf('<p style="color:#FF0000;font-size:10px;">elapsed: %03.6f seconds, </p>', microtime(true) - $starttimer);
! 146:
1.1 as 147: echo '<p style="font-size:10px;"><b>Note:</b> The Tinderbox web interface requires cookies to be enable.</p>';
148: ?>