00001 <?php
00002 # streber - a php5 based project management system (c) 2005-2007 / www.streber-pm.org
00003 # Distributed under the terms and conditions of the GPL as stated in lang/license.html
00004
00013 global $g_form_fields;
00014 $g_form_fields=array(
00015 'db_type'=>array(
00016 'id' =>'db_type',
00017 'label' =>'Type database',
00018 'options' =>$g_supported_db_types,
00019 'type' =>'option',
00020
00021 ),'hostname'=>array(
00022 'id' =>'hostname',
00023 'default' =>'localhost',
00024 'label' =>' Hostname (for Database Server)',
00025 'required' => true,
00026 ),
00027 'db_username'=>array(
00028 'id' =>'db_username',
00029 'default' =>'root',
00030 'label' =>'Username (for Database)',
00031 'required' => true,
00032 ),
00033 'db_password'=>array(
00034 'id' =>'db_password',
00035 'default' =>'',
00036 'label' =>'Password (for Database)',
00037 'type' =>'password',
00038 ),
00039 'db_name'=>array(
00040 'id' =>'db_name',
00041 'default' =>'streber',
00042 'label' =>'Name of database',
00043 'required' => true,
00044 ),
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056 'db_table_prefix'=>array(
00057 'id' =>'db_table_prefix',
00058 'default' =>'',
00059 'label' =>'SQL Table prefix (e.g. "streb_")',
00060 'comment' =>'',
00061 ),
00062 'user_admin_name'=>array(
00063 'id' =>'user_admin_name',
00064 'default' =>'admin',
00065 'label' =>'Streber administrator name',
00066 'comment' =>'',
00067 'required' => true,
00068 ),
00069 'user_admin_password'=>array(
00070 'id' =>'user_admin_password',
00071 'default' =>'',
00072 'label' =>'Streber administrator password',
00073 'comment' =>'',
00074 'type' =>'password'
00075 ),
00076 'continue_on_sql_errors'=>array(
00077 'id' =>'continue_on_sql_errors',
00078 'default' =>'on',
00079 'label' =>'Continue Upgrade on sql errors',
00080 'comment' =>'',
00081 'type' =>'checkbox',
00082 ),
00083 );
00084
00085
00086
00087
00088 #========================================================================================================
00089
00093 function print_InstallationHTMLOpen() {
00094 echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
00095 <html>
00096 <head>
00097 <meta content="text/html; charset=utf-8" http-equiv="content-type">
00098 <meta content="Streber, pm, project management, tool, php, php5, oop, tasks, projects, users, teams, online, web-based, free, open source, gpl"
00099 name="KEYWORDS">
00100 <meta content="3 days" name="REVISIT-AFTER">
00101 <meta content="en" http-equiv="content-language">
00102 <title>Streber pm - a web based free open source project management tool with php 5 mysql</title>
00103 <link href="styles.css" rel="stylesheet" type="text/css">
00104 </head>
00105 <body>';
00106
00107 }
00108
00109
00113 function print_InstallationHTMLClose() {
00114 echo "</html>";
00115 }
00116
00117
00118
00119
00120
00127 function print_setup_form(){
00128
00129 global $g_form_fields;
00130
00131
00132 ### create form ###
00133 {
00134 echo "<h2>Settings</h2>";
00135 echo '<form method=GET action="./install.php"><div class=form>';
00136
00137 foreach($g_form_fields as $key=>$value) {
00138 $f=& $g_form_fields[$key];
00139
00140 if(!$value=get($f['id'])) {
00141 $value="";
00142 if(isset( $f['value'])) {
00143 $value= $f['value'];
00144 }
00145 else if(isset($f['default'])){
00146 $value= $f['default'];
00147 }
00148 }
00149
00150 $class_additional= "";
00151 if(isset($f['required']) && $f['required']) {
00152 $class_additional.=" required";
00153 }
00154 if(isset($f['error'])) {
00155 $class_additional.=" error";
00156 }
00157 ### checkboxes ###
00158 if(isset($f['type']) && ($f['type'] == 'checkbox')) {
00159 $str_checked="";
00160 if( isset($value) && $value) {
00161 $str_checked="checked";
00162 }
00163 echo "<p><label for name='{$f['id']}' class=checkbox><input type=checkbox $str_checked name='{$f['id']}' value='{$f['id']}'></label>{$f['label']}:</p>";
00164 }
00165 ### options ###
00166 else if(isset($f['type']) && ($f['type'] == 'option')) {
00167
00168 ### only display if there is more than one option ###
00169 if(count($f['options']) > 1) {
00170 echo "<p><label>{$f['label']}:</label><select class='inp$class_additional' name='{$f['id']}'>";
00171 foreach($f['options'] as $o) {
00172 $selected= ($o == $value)
00173 ? 'selected'
00174 : '';
00175
00176 echo "<option value='$o'>$o</option>";
00177 }
00178 echo "</select></p>";
00179 }else{
00180 echo "<input type='hidden' class='inp$class_additional' name='{$f['id']}' value='{$f['options'][0]}'>";
00181 }
00182 }
00183 ### password fields ###
00184 else if(isset($f['type']) && ($f['type'] == 'password')) {
00185 echo "<p><label>{$f['label']}:</label><input type=password class='inp$class_additional' name='{$f['id']}' value='$value'></p>";
00186 }
00187 ### input fields ###
00188 else {
00189 echo "<p><label>{$f['label']}:</label><input class='inp$class_additional' name='{$f['id']}' value='$value'></p>";
00190 }
00191 }
00192 echo "<input class=button_submit type=submit value='install / upgrade'>";
00193 echo "<input type=hidden name=install_step value=form_submit>";
00194 echo "</div></form>";
00195 }
00196 }
00197
00198
00199
00200
00201 DEFINE('RESULT_GOOD',0);
00202 DEFINE('RESULT_FAILED',1);
00203 DEFINE('RESULT_PROBLEM',2);
00204
00205 function print_testStart($p_message=NULL)
00206 {
00207
00208 if(!$p_message) {
00209 trigger_error("print_testStart called without message",E_USER_NOTICE);
00210 $p_message="";
00211 }
00212
00213 echo "<div class='test_start'>$p_message</div>";
00214 }
00215
00216 function print_testResult($p_result, $p_message="")
00217 {
00218
00219 $style= '';
00220 $msg= '?';
00221 if($p_result== RESULT_FAILED) {
00222 $style='failed';
00223 $msg='FAILED';
00224 }
00225 else if ($p_result == RESULT_GOOD) {
00226 $style='good';
00227 $msg='GOOD';
00228 }
00229 else if ($p_result == RESULT_PROBLEM) {
00230 $style='problem';
00231 $msg='POTENTIAL PROBLEM';
00232 }
00233 echo "<div class='test_result $style'><b>$msg</b><br>$p_message</div><br>";
00234 }
00235
00236
00237
00238 ?>
00239