Changeset 1306
- Timestamp:
- 11/05/07 14:44:57 (1 year ago)
- Files:
-
- trunk/wifidog-auth/CHANGELOG (modified) (1 diff)
- trunk/wifidog-auth/wifidog/classes/Dependency.php (modified) (6 diffs)
- trunk/wifidog-auth/wifidog/install.php (modified) (38 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wifidog-auth/CHANGELOG
r1304 r1306 1 1 # $Id$ 2 2007-11-05 Benoit Grégoire <bock@step.polymtl.ca> 3 * Commit most of Robin Jones install script improvements. 4 2 5 2007-10-22 Benoit Grégoire <bock@step.polymtl.ca> 3 6 * Major security fix: Fix the authenticator for a security breach where a user could get Internet access using an empty username. LocalUser and LDAP were definitely vulnerable, RADIUS may have been. trunk/wifidog-auth/wifidog/classes/Dependency.php
r1294 r1306 37 37 * @package WiFiDogAuthServer 38 38 * @author Philippe April 39 * @author Max Horv áth <max.horvath@freenet.de>40 * @author Benoit Gr égoire <bock@step.polymtl.ca>39 * @author Max Horváth <max.horvath@freenet.de> 40 * @author Benoit Grégoire <bock@step.polymtl.ca> 41 41 * @copyright 2005-2007 Philippe April 42 * @copyright 2005-2007 Max Horv áth, Horvath Web Consulting43 * @copyright 2006-2007 Benoit Gr égoire, Technologies Coeus inc.42 * @copyright 2005-2007 Max Horváth, Horvath Web Consulting 43 * @copyright 2006-2007 Benoit Grégoire, Technologies Coeus inc. 44 44 * @version Subversion $Id$ 45 45 * @link http://www.wifidog.org/ … … 64 64 * @package WiFiDogAuthServer 65 65 * @author Philippe April 66 * @author Max Horv áth <max.horvath@freenet.de>67 * @author Benoit Gr égoire <bock@step.polymtl.ca>66 * @author Max Horváth <max.horvath@freenet.de> 67 * @author Benoit Grégoire <bock@step.polymtl.ca> 68 68 * @copyright 2005-2007 Philippe April 69 * @copyright 2005-2007 Max Horv áth, Horvath Web Consulting70 * @copyright 2006-2007 Benoit Gr égoire, Technologies Coeus inc.69 * @copyright 2005-2007 Max Horváth, Horvath Web Consulting 70 * @copyright 2006-2007 Benoit Grégoire, Technologies Coeus inc. 71 71 */ 72 72 class Dependency … … 123 123 'installDestination' => "/" 124 124 ), 125 125 126 /* PHP extensions (optional) */ 127 "simplepie" => array ( 128 "type" => "localLib", 129 "detectFiles" => "lib/simplepie/simplepie.inc", 130 'description' => "SimplePie is a dependency that provides an RSS parser in PHP. It is required for RssPressReview. It is is recommended to install it, if you do not, RSS feed options will be disabled.", 131 'website' => "http://simplepie.org/", 132 'installSourceUrl' => "http://svn.simplepie.org/simplepie/branches/1.0/", 133 'installMethod' => "svn", 134 'installDestination' => "simplepie" 135 ), 136 'jpgraph' => array ( 137 "type" => "localLib", 138 "detectFiles" => "lib/jpgraph-1.22/src/jpgraph.php", 139 'description' => "JpGraph is a Object-Oriented Graph creating library for PHP. 140 JpGraph is not currently used by Wifidog (it will be use for statistic graphs in a later version). You can skip this installation if your not a developper.", 141 'website' => "http://www.aditus.nu/jpgraph/", 142 'installSourceUrl' => "http://hem.bredband.net/jpgraph/jpgraph-1.22.tar.gz", 143 'installMethod' => "tarball", 144 'installDestination' => "/" 145 ), 146 'feedpressreview' => array ( 147 "type" => "localLib", 148 "detectFiles" => "lib/feedpressreview/FeedPressReview.inc", 149 'description' => "Feed Press Review allows your athentication server to produce RSS Feeds. It is recommended that it is installed. If it is not installed, the RSS feed options will be disabled.", 150 'website' => "http://projects.coeus.ca/feedpressreview/", 151 'installSourceUrl' => "http://projects.coeus.ca/svn/feedpressreview/trunk/", 152 'installMethod' => "svn", 153 'installDestination' => "feedpressreview" 154 ), 126 155 'gettext' => array ( 127 156 "type" => "phpExtension", … … 282 311 283 312 /** Use PHP internal functions to execute a command 284 @return: Return value of the command*/313  @return: Return value of the command*/ 285 314 function execVerbose($command, & $output, & $return_var, &$errMsg = null) { 286 315 $errMsg .= "Executing: $command <br/>"; … … 469 498 break; 470 499 case "localLib": 471 if($this->getInstallSourceUrl()) {472 $name = $this->getId().'_install';473 $value = sprintf(_("Install %s"), $this->getId());474 $html .= sprintf("<input type='submit' name='%s' value='%s'/>", $name, $value);500 if($this->getInstallSourceUrl()) { 501 $name = $this->getId().'_install'; 502 $value = sprintf(_("Install %s"), $this->getId()); 503 $html .= sprintf("<input type='submit' name='%s' value='%s'/>", $name, $value); 475 504 476 505 } 477 506 else { 478 $html .= sprintf(_("Sorry, i couldn't find the source for %s in installSourceUrl"), $this->getId()); 507 $html .= sprintf(_("Sorry, i couldn't find the source for %s in installSourceUrl"), 508 $this->getId()); 479 509 } 480 510 … … 657 687 } 658 688 else { 659 $installDestinationPath = WIFIDOG_ABS_FILE_PATH . "lib/" ;$installDestinationPathOrig.689 $installDestinationPath = WIFIDOG_ABS_FILE_PATH . "lib/" .$installDestinationPathOrig; 660 690 $installMethod = $this->getInstallMethod(); 661 691 switch($installMethod) { 692 case "svn": 693 self::execVerbose("svn co ".escapeshellarg($installSourceUrl)." ".escapeshellarg ($installDestinationPath), $output, $return, $errorMsg); 694 695 696 break; 697 662 698 case "tarball": 663 699 $downloadPath = WIFIDOG_ABS_FILE_PATH . "tmp/"; trunk/wifidog-auth/wifidog/install.php
r1296 r1306 1 1 <?php 2 3 2 4 3 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ … … 39 38 * 40 39 * @package WiFiDogAuthServer 41 * @author Pascal Leclerc <isf@plec.ca> 42 * @copyright 2005-2006 Pascal Leclerc 40 * @author Pascal Leclerc <isf@plec.ca>, Robin Jones and Benoit Grégoire 41 * @copyright 2005-2006 Pascal Leclerc, 2006-2007 Technologies Coeus inc., 2007 Robin Jones 43 42 * @version Subversion $Id$ 44 43 * @link http://www.wifidog.org/ … … 71 70 } 72 71 73 # Read password file72 #Read password file 74 73 $fd = fopen($password_file, "rb"); 75 74 $password = trim(fread($fd, filesize($password_file))); … … 88 87 $auth = true; 89 88 90 if (!$auth) { # Ask user for the passorwd89 if (!$auth) { # Ask user for the password 91 90 header('WWW-Authenticate: Basic realm="Private"'); 92 91 header('HTTP/1.0 401 Unauthorized'); 93 echo " Authorization Required!";92 echo "Restricted Access - Authorisation Required!"; 94 93 exit; 95 94 } 96 95 # End of Security validation 97 96 97 98 /************************************************************************************ 99 * Begin Dynamic HTML Page Header 100 ************************************************************************************/ 98 101 print<<<EndHTML 99 102 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 100 103 <HTML> 101 104 <HEAD> 102 <TITLE>$page - Wifidog Auth-server configuration</TITLE>105 <TITLE>$page - Wifidog Auth-server installation and configuration</TITLE> 103 106 104 107 <SCRIPT type="text/javascript"> 105 // This function add new configuration value to the "config" hidden input106 // On submit, config will be parsed and value saved toconfig.php file108 // This function adds a new configuration value to the "config" hidden input 109 // On submit, the config will be parsed and the value saved to the config.php file 107 110 function newConfig(dataAdd) { 108 111 // TODO : Validate input data … … 116 119 } 117 120 </SCRIPT> 118 121 122 <link rel="stylesheet" type="text/css" href="/media/base_theme/stylesheet.css" /> 119 123 </HEAD> 120 <BODY text="black" bgcolor="#CFCFCF">124 <BODY id='page' class='{$page}'> 121 125 122 126 <style type="text/css"> 123 127 <!-- 124 .button 128 129 .submit 125 130 { 126 font-size: 12pt; 127 font-weight: bold; 128 color: black; 129 background: #D4D0C8; 131 font-size: 14pt; 130 132 text-decoration: none; 131 border-top: 1px solid white;132 border-right: 2px solid gray;133 border-bottom: 2px solid gray;134 border-left: 1px solid white;135 133 padding: 3px 5px 3px 5px; 134 background-color: #ccccff; 136 135 } 137 136 138 body 139 { 140 background-color: white; 137 table { 138 border-collapse: collapse; 141 139 } 142 140 143 td144 {145 padding: 1px 4px 1px 4px;146 }147 141 --> 148 142 </style> 143 149 144 150 145 <FORM NAME="myform" METHOD="post"> … … 152 147 <INPUT TYPE="HIDDEN" NAME="debug"> 153 148 <INPUT TYPE="HIDDEN" NAME="config"> 154 149 <div id="page_body"> 150 <div id="left_area"> 151 <div id="left_area_top"> 152 <h1>Installation status</h1> 153 154 EndHTML; 155 $pageindex = array("Welcome"=>"Welcome", 156 "Prerequisites"=>"Prerequisites", 157 "Permissions"=>"Permissions", 158 "Dependencies"=> "Dependencies", 159 "Database Access"=> "Database", 160 "Database Connection"=>"testdatabase", 161 "Database Initialisation"=>"dbinit", 162 "Global Options"=>"options", 163 "Language Locale"=>"languages", 164 "User Creation"=>"admin", 165 "Review"=>"Review", 166 "Finish"=>"finish",); 167 foreach($pageindex as $pagekey => $pagevalue){ 168 if ($pagevalue != $page){ 169 print "$pagekey <br>"; 170 } 171 else { 172 print "<strong>$pagekey</strong> <br>"; 173 } 174 } 175 print<<<EndHTML 176 </div> 177 <div id="left_area_bottom"> 178 <p><a href="../CHANGELOG">Change Log</a><BR> 179 <a href="http://dev.wifidog.org/report/10">Known issues</a></p> 180 </div> 181 </div> 182 <div id="main_area"> 183 184 <div id="main_area_top"> 185 <table align="center"><tr><td><img src="/media/base_theme/images/wifidog_logo_banner.png" /></td></tr></table> 186 </div> 187 <div id="main_area_middle"> 155 188 EndHTML; 156 189 … … 161 194 #exit(); 162 195 163 # Needed files/directories with write access196 #Begin Perquisite Array (Needed files/directories with write access) 164 197 $dir_array = array ( 165 198 'tmp', … … 173 206 'config.php' 174 207 ); 175 176 $smarty_full_url = 'http://smarty.php.net/do_download.php?download_file=Smarty-2.6.14.tar.gz'; 177 178 $neededPackages = array ( 179 'smarty' => array ( 180 'needed' => 1, 181 'available' => 0, 182 'message' => '', 183 'file' => 'lib/smarty/Smarty.class.php' 208 #end perquisite array 209 210 211 #Begin Global Options Array 212 $optionsInfo = array ( 213 /********************************************************************************************* 214 TODO: SSL is now configured in the DB, but should still be handled by the install script 215 'SSL_AVAILABLE' => array ( 216 'title' => 'SSL Support', 217 'depend' => 'return 1;', 218 'message' => ' ' 184 219 ), 185 'simplepie' => array ( 186 'needed' => 0, 187 'available' => 0, 188 'message' => '', 189 'file' => 'lib/simplepie/simplepie.inc', 190 'svn_source' => 'http://svn.simplepie.org/simplepie/branches/1.0/' 191 ), 192 'feedpressreview' => array ( 193 'needed' => 0, 194 'available' => 0, 195 'message' => '', 196 'file' => 'lib/feedpressreview/FeedPressReview.inc', 197 'svn_source' => 'http://projects.coeus.ca/svn/feedpressreview/trunk/' 198 ) 199 ); 200 201 $optionsInfo = array ( 202 /* TODO: SSL is now configured in the DB, but should still be handled by the install script 203 'SSL_AVAILABLE' => array ( 204 'title' => 'SSL Support', 205 'depend' => 'return 1;', 206 'message' => ' ' 207 ), 208 */ 220 ************************************************************************/ 209 221 'CONF_USE_CRON_FOR_DB_CLEANUP' => array ( 210 222 'title' => 'Use cron for DB cleanup', … … 219 231 ); 220 232 221 foreach ($neededPackages as $key => $value) { # Detect installed libraries (smarty, ...) 222 if (file_exists(WIFIDOG_ABS_FILE_PATH . $neededPackages[$key]['file'])) 223 $neededPackages[$key]['available'] = 1; 224 } 233 225 234 226 235 $CONFIG_FILE = 'config.php'; … … 268 277 ################################### 269 278 # array (array1(name1, page1), array2(name2, page2), ..., arrayN(nameN, pageN)); 270 # Todo : Supporter HTTP_REFERER (j'me comprends)271 279 function navigation($dataArray) { 272 280 $SERVER = $_SERVER['HTTP_HOST']; 273 281 $SCRIPT = $_SERVER['SCRIPT_NAME']; 274 print " \n<p>";282 print "<p><br></p>"; 275 283 foreach ($dataArray as $num => $navArray) { 276 284 $title = $navArray['title']; … … 278 286 empty ($navArray['action']) ? $action = '' : $action = $navArray['action']; 279 287 print<<<EndHTML 280 <A HREF="#" ONCLICK="document.myform.page.value = '$page'; document.myform.action.value = '$action'; document.myform.submit();" CLASS=" button">$title</A>288 <A HREF="#" ONCLICK="document.myform.page.value = '$page'; document.myform.action.value = '$action'; document.myform.submit();" CLASS="submit">$title</A> 281 289 282 290 EndHTML; 283 291 if (array_key_exists($num +1, $dataArray)) 284 print " - ";292 print " "; 285 293 } 286 print "</p>\n"; 294 287 295 } 288 296 … … 292 300 print<<<EndHTML 293 301 294 <p><A HREF="#" ONCLICK="javascript: window.location.reload(true);" CLASS=" button">Refresh</A></p>302 <p><A HREF="#" ONCLICK="javascript: window.location.reload(true);" CLASS="submit">Refresh</A></p> 295 303 EndHTML; 296 304 } … … 304 312 EndHTML; 305 313 } */ 306 307 ###################################308 # In development309 /*function installPackage($pkg_name, $full_url, $copy) {310 print "<h1>$pkg_name installation</h1>\n";311 chdir(WIFIDOG_ABS_FILE_PATH."tmp");312 list($url, $filename) = split ("=", $full_url);313 314 print "Download source code ($filename) : ";315 if (!file_exists($filename))316 Dependency::execVerbose("wget \"$url\"", $output, $return);317 if (!file_exists($filename)) // wget success if file exists318 Dependency::execVerbose("wget \"$full_url\" 2>&1", $output_array, $return);319 if (!file_exists($filename)) {320 print "<B STYLE=\"color:red\">Error</b><p>Current working directory : <em>$basepath/tmp/smarty</em>";321 $output = implode("\n", $output_array);322 print "<pre><em>wget \"$full_url\"</em>\n$output</pre>";323 exit();324 } else {325 print "OK<BR>";326 }327 328 print "Uncompressing : ";329 $dirname = array_shift(split(".tar.gz", $filename));330 331 if (!file_exists($dirname))332 Dependency::execVerbose("tar -xzf $dirname.tar.gz", $output, $return);333 print "OK<BR>";334 print "Copying : ";335 if (!file_exists('../../lib/smarty/Smarty.class.php'));336 Dependency::execVerbose("cp -r $dirname/libs/* ../../lib/smarty", $output, $return);337 Dependency::execVerbose("cp -r $dirname/libs/* ../../lib/smarty", $output, $return);338 $copy339 print "OK<BR>";340 }*/341 314 342 315 ################################### … … 399 372 } 400 373 401 ################################### 402 # MAIN 374 375 376 /******************************************************************************** 377 * MAIN PROCEDURE * 378 * case statement to navigate through install script 379 * * 380 *********************************************************************************/ 403 381 switch ($page) { 404 case ' permission' :382 case 'Permissions' : 405 383 print "<h1>Permissions</h1>"; 406 384 … … 428 406 print "<p><em>HTTP daemon UNIX username/group</em>: $process_username/$process_group</p>"; 429 407 # print "<p><em>HTTPD group</em>: $process_group<BR</p>"; 430 print "<p><table BORDER=\"1\"><tr><td>< em>Directory</em></td></td><td><em>Owner</em></td><td><em>Writable</em></td></tr>\n";408 print "<p><table BORDER=\"1\"><tr><td><b>Directory</b></td></td><td><b>Owner</b></td><td><b>Writable</b></td></tr>\n"; 431 409 432 410 foreach ($dir_array as $dir) { … … 465 443 navigation(array ( 466 444 array ( 445 "title" => "Back", 446 "page" => "Prerequisites" 447 ), 448 array ( 467 449 "title" => "Next", 468 "page" => " version"450 "page" => "Dependencies" 469 451 ) 470 452 )); … … 472 454 else { 473 455 refreshButton(); 474 print "<p>You need to allow UNIX user <em>$process_username</em> to write to these directories (mkdir, chown or chmod)</p>"; 475 if (!empty ($cmd_mkdir) || !empty ($cmd_mkdir)) 476 print "<p><b>For instance, you may want to use the following commands</b> :</p>\n"; 477 if (!empty ($cmd_mkdir)) 478 print "mkdir $cmd_mkdir <br />"; 479 if (!empty ($cmd_chown)) 480 print "chgrp -R $process_group $cmd_chown;<br/>chmod g+wx $cmd_chown;<br/>"; 481 print "<p>After permissions modification done, hit the REFRESH button to see the NEXT button and continue with the installation"; 456 navigation(array ( 457 array ( 458 "title" => "Back", 459 "page" => "Prerequisites" 460 ) 461 )); 462 print "<p>UNIX user <em>$process_username</em> must be able to write to these directories (mkdir, chown or chmod)</p>"; 463 if (!empty ($cmd_mkdir) || !empty ($cmd_mkdir)) 464 print "<p><b>For instance, you may want to use the following commands</b> :</p>\n"; 465 if (!empty ($cmd_mkdir)) 466 print "mkdir $cmd_mkdir <br />"; 467 if (!empty ($cmd_chown)) 468 print "chgrp -R $process_group $cmd_chown;<br/>chmod g+wx $cmd_chown;<br/>"; 469 print "<p>After permission modifications have been preformed, click the REFRESH button to check they have been completed successfully. The NEXT button will then appear to continue with the installation."; 482 470 } 483 471 break; 484 ################################### 485 case ' version' :486 print "<h1>Checking Dependenc y</h1>";472 ########################################### 473 case 'Dependencies' : 474 print "<h1>Checking Dependencies</h1>"; 487 475 $error = 0; 488 476 $userData['error']=&$error; … … 494 482 array ( 495 483 "title" => "Back", 496 "page" => " permission"484 "page" => "Permissions" 497 485 ), 498 486 array ( 499 487 "title" => "Next", 500 "page" => " simplepie"488 "page" => "Database" 501 489 ) 502 490 )); … … 504 492 505 493 break; 506 ################################### 507 case 'simplepie' : // Download, uncompress and install SimplePie 508 print "<h1>SimplePie installation</h1>\n"; 509 510 if ($neededPackages['simplepie']['available']) { 511 print "Already installed !<BR>"; 512 navigation(array ( 513 array ( 514 "title" => "Back", 515 "page" => "smarty" 516 ), 517 array ( 518 "title" => "Next", 519 "page" => "feedpressreview" 520 ) 521 )); 522 } 523 elseif ($action == 'install') { 524 require_once (dirname(__FILE__) . '/include/common.php'); 525 print "Download source code frpm svn($filename) : "; 526 Dependency::execVerbose("svn co ".escapeshellarg($neededPackages['simplepie']['svn_source'])." ".escapeshellarg(WIFIDOG_ABS_FILE_PATH."lib/simplepie"), $output, $return); 527 #Dependency::execVerbose("locale", $output, $return); 528 529 refreshButton(); 530 navigation(array ( 531 array ( 532 "title" => "Back", 533 "page" => "smarty" 534 ), 535 array ( 536 "title" => "Next", 537 "page" => "feedpressreview" 538 ) 539 )); 540 } 541 else { 542 print<<< EndHTML 543 <p><A HREF="http://simplepie.org/">SimplePie</A> is a dependency of provides an RSS parser in PHP. It is required for RssPressReview. It's is recommended to install it, if you don't, RSS feeds options will be disabled. 544 545 <p>Do you want to install SimplePie ? 546 EndHTML; 547 navigation(array ( 548 array ( 549 "title" => "Back", 550 "page" => "smarty" 551 ), 552 array ( 553 "title" => "Install", 554 "page" => "simplepie", 555 "action" => "install" 556 ), 557 array ( 558 "title" => "Next", 559 "page" => "feedpressreview" 560 ) 561 )); 562 } 563 break; 564 ################################### 565 case 'feedpressreview' : // Download, uncompress and install feedpressreview 566 print "<h1>Feed press review installation</h1>\n"; 567 568 if ($neededPackages['feedpressreview']['available']) { 569 print "Already installed !<BR>"; 570 navigation(array ( 571 array ( 572 "title" => "Back", 573 "page" => "simplepie" 574 ), 575 array ( 576 "title" => "Next", 577 "page" => "database" 578 ) 579 )); 580 } 581 elseif ($action == 'install') { 582 require_once (dirname(__FILE__) . '/include/common.php'); 583 print "Download source code frpm svn($filename) : "; 584 Dependency::execVerbose("svn co ".escapeshellarg($neededPackages['feedpressreview']['svn_source'])." ".escapeshellarg(WIFIDOG_ABS_FILE_PATH."lib/feedpressreview"), $output, $return); 585 #Dependency::execVerbose("locale", $output, $return); 586 587 refreshButton(); 588 navigation(array ( 589 array ( 590 "title" => "Back", 591 "page" => "smarty" 592 ), 593 array ( 594 "title" => "Next", 595 "page" => "database" 596 ) 597 )); 598 } 599 else { 600 print<<< EndHTML 601 <p><A HREF="http://projects.coeus.ca/feedpressreview/">Feed press review</A> is a dependency that provides a Feed aggregator in PHP. It is recommended to install it. If you don't, RSS feeds options will be disabled. 602 603 <p>Do you want to install FeedPressReview ? 604 EndHTML; 605 navigation(array ( 606 array ( 607 "title" => "Back", 608 "page" => "simplepie" 609 ), 610 array ( 611 "title" => "Install", 612 "page" => "feedpressreview", 613 "action" => "install" 614 ), 615 array ( 616 "title" => "Next", 617 "page" => "database" 618 ) 619 )); 620 } 621 break; 622 ################################### 623 case 'jpgraph' : // Download, uncompress and install JpGraph library 624 print "<h1>JpGraph installation</h1>\n"; 625 626 if ($neededPackages['jpgraph']['available']) { 627 print "Already installed !<BR>"; 628 navigation(array ( 629 array ( 630 "title" => "Back", 631 "page" => "feedpressreview" 632 ), 633 array ( 634 "title" => "Next", 635 "page" => "database" 636 ) 637 )); 638 } 639 elseif ($action == 'install') { 640 chdir(WIFIDOG_ABS_FILE_PATH . "tmp"); 641 $filename = array_pop(preg_split("/\//", $jpgraph_full_url)); 642 643 print "Download source code ($filename) : "; 644 if (!file_exists($filename)) 645 Dependency::execVerbose("wget \"$jpgraph_full_url\" 2>&1", $output, $return); 646 if (!file_exists($filename)) { # Error occured, print output of wget 647 print "<B STYLE=\"color:red\">Error</b><p>Current working directory : <em>$basepath/tmp</em>"; 648 $output = implode("\n", $output); 649 print "<pre><em>wget \"$jpgraph_full_url\"</em>\n$output</pre>"; 650 exit (); 651 } 652 else { 653 print "OK<BR>"; 654 } 655 656 print "Uncompressing : "; 657 $dirname = array_shift(split(".tar.gz", $filename)); 658 if (!file_exists($dirname)) 659 Dependency::execVerbose("tar -xzf $dirname.tar.gz", $output, $return); 660 print "OK<BR>"; 661 662 print "Copying : "; 663 if (!file_exists(WIFIDOG_ABS_FILE_PATH."lib/jpgraph/jpgraph.php")) 664 Dependency::execVerbose("cp $dirname/src/* ".WIFIDOG_ABS_FILE_PATH."lib/jpgraph", $output, $return); # TODO : Utiliser JPGRAPH_REL_PATH 665 666 print "OK<BR>"; 667 668 refreshButton(); 669 navigation(array ( 670 array ( 671 "title" => "Back", 672 "page" => "feedpressreview" 673 ), 674 array ( 675 "title" => "Next", 676 "page" => "database" 677 ) 678 )); 679 } 680 else { 681 print<<< EndHTML 682 <p><A HREF="http://www.aditus.nu/jpgraph/">JpGraph</A> is a Object-Oriented Graph creating library for PHP. 683 JpGraph is not currently use by Wifidog (will be use for statistique graph in a later version). You can skip this installation if your not a developper. 684 685 <p>Do you want to install JpGraph ? 686 EndHTML; 687 navigation(array ( 688 array ( 689 "title" => "Back", 690 "page" => "feedpressreview" 691 ), 692 array ( 693 "title" => "Install", 694 "page" => "jpgraph", 695 "action" => "install" 696 ), 697 array ( 698 "title" => "Next", 699 "page" => "database" 700 ) 701 )); 702 } 703 break; 704 ################################### 705 case 'database' : 494 495 ########################################### 496 case 'Database' : 706 497 ### TODO : Valider en javascript que les champs soumit ne sont pas vide 707 498 # Pouvoir choisir le port de la DB ??? 708 499 print<<< EndHTML 709 <h1>Database access configuration</h1>500 <h1>Database Access Configuration</h1> 710 501 <BR> 711 502 <table border="1"> … … 716 507 </table> 717 508 718 <p>By clicking Next, your configuration will be automatical y saved509 <p>By clicking Next, your configuration will be automatically saved.</p> 719 510 720 511 <script type="text/javascript"> … … 732 523 array ( 733 524 "title" => "Back", 734 "page" => " simplepie"735 ) 525 "page" => "Dependencies" 526 ), 736 527 )); #, array("title" => "Next", "page" => "testdatabase"))); 737 528 print<<< EndHTML 738 < p><A HREF="#" ONCLICK="javascript: document.myform.page.value='testdatabase'; submitDatabaseValue(); document.myform.submit();" CLASS="button">Next</A></p>529 <A HREF="#" ONCLICK="javascript: document.myform.page.value='testdatabase'; submitDatabaseValue(); document.myform.submit();" CLASS="submit">Next</A> 739 530 740 531 EndHTML; 741 532 742 533 break; 743 ################################### 534 ########################################### 744 535 case 'testdatabase' : 745 536 print "<h1>Database connection</h1>"; … … 755 546 } 756 547 else { 757 printf ("<p>Unable to connect ! The server has to be online, the database \"%s\" must exist, and the postgresql.conf and pg_hba.conf must allow the user \"%s\" to open a connection to it on host \"%s\" to continue. See the error above for hints on what the problem may be.", $CONF_DATABASE_NAME, $CONF_DATABASE_USER, $CONF_DATABASE_HOST);548 printf ("<p>Unable to connect to database! Please make sure the server is online and the database \"%s\" exists. Also 'postgresql.conf' and 'pg_hba.conf' must allow the user \"%s\" to open a connection to it on host \"%s\" to continue. See the error above for clues on what the problem may be.</p>", $CONF_DATABASE_NAME, $CONF_DATABASE_USER, $CONF_DATABASE_HOST); 758 549 print "<p>Please go back and retry with correct values, or fix your server configuration.</p>"; 759 550 refreshButton(); 760 navigation(array(array("title" => "Back", "page" => " database")));551 navigation(array(array("title" => "Back", "page" => "Database"))); 761 552 die(); 762 553 } 763 554 print "</li>"; 764 print "<li>";555 print "<li>"; 765 556 $postgresql_info = pg_version(); 766 557 printf ("PostgreSQL server version: %s", $postgresql_info['server']); print "</li>"; 767 558 768 559 # if ($postgresql_info['server'] > $requiredPostgeSQLVersion) { Todo : Do something } 769 560 … … 774 565 array ( 775 566 "title" => "Back", 776 "page" => " database"567 "page" => "Database" 777 568 ), 778 569 array ( … … 782 573 )); 783 574 break; 784 ################################### 575 ########################################### 785 576 case 'dbinit' : 786 print "<h1>Database initialisation</h1>";577 print "<h1>Database Initialisation</h1>"; 787 578 # SQL are executed with PHP, some lines need to be commented out. 788 579 $file_db_version = 'UNKNOW'; … … 867 658 else { 868 659 print "Error : Unexpected result"; 869 exit ();660 exit (); 870 661 } 871 662 … … 875 666 array ( 876 667 "title" => "Back", 877 "page" => " database"668 "page" => "testdatabase" 878 669 ), 879 670 array ( … … 883 674 )); 884 675 break; 885 886 ################################### 676 ########################################### 887 677 case 'options' : 888 678 # TODO : Tester que la connection SSL est fonctionnelle 889 679 # Options avancees : Supporter les define de [SMARTY|PHLICKR|JPGRAPH]_REL_PATH 890 680 print<<< EndHTML 891 <h1>Available options</h1>681 <h1>Available Options</h1> 892 682 <table border="1"> 893 683 … … 898 688 $value = $configArray[$name]; # Value of option in config.php 899 689 $title = $optionsInfo[$name]['title']; # Field Title 900 $message = $optionsInfo[$name]['message']; # Message why option is disable 690 $message = $optionsInfo[$name]['message']; # Message why option is disabled 901 691 if(empty($value)) 902 692 $message .= ", ERROR: unable to find the '$name' directive in the config file"; 903 693 $depend = @ eval ($optionsInfo[$name]['depend']); # Evaluate the dependencie 904 694 $selectedTrue = ''; 905 $selectedFalse = ''; # Initiali ze value695 $selectedFalse = ''; # Initialise value 906 696 $value == 'true' ? $selectedTrue = 'SELECTED' : $selectedFalse = 'SELECTED'; # Use to select the previous saved option 907 697 $depend == 1 ? $disabled = '' : $disabled = 'DISABLED'; # Disable <SELECT> if dependencie is not satisfied … … 951 741 )); 952 742 953 print<<< EndHTML954 < p><A HREF="#" ONCLICK="javascript: document.myform.page.value='languages'; submitOptionsValue(); document.myform.submit();" CLASS="button">Next</A></p>743 print<<<EndHTML 744 <A HREF="#" ONCLICK="javascript: document.myform.page.value='languages'; submitOptionsValue(); document.myform.submit();" CLASS="submit">Next</A> 955 745 EndHTML; 956 746 957 747 break; 958 959 ################################### 748 ########################################### 960 749 case 'languages' : 961 print "<h1>Languages configuration</h1>"; 962 print<<< EndHTML 963 <p>Not yet implemented ...</p> 964 <p>Will allow selecting language to use.</p> 965 <em>Error message example</em> : <BR> 750 751 require_once('classes/LocaleList.php'); 752 753 #check for current language code in config.php 754 $CURRENT_LOCALE = $configArray['DEFAULT_LANG']; 755 756 #pull a list of all available languages (codes and real friendly names) 757 $AVAIL_LOCALE_ARRAY = LocaleList::getAvailableLanguageArray(); 758 759 760 print "<h1>Languages Configuration</h1>"; 761 762 763 764 print<<<EndHTML 765 766 <p>Please select the Authentication Servers default language and locale</p> 767 768 <div class="language"> 769 <form class="language" name="lang_form" method="post" action="{$formAction}"> 770 <div>Default Server Locale: 771 <select name="default_locale" onchange="newConfig('DEFAULT_LANG=' + this.options[this.selectedIndex].value);"> 772 EndHTML; 773 #for each language in the array get the language code and the friendly name 774 foreach ($AVAIL_LOCALE_ARRAY as $_langIds => $_langNames) { 775 #if the current local in config.php is the same as the current member of the array, select it as default 776 if ($CURRENT_LOCALE == $_langIds) { 777 $_selected = (' selected="selected"'); 778 } else {#else leave it alone 779 $_selected = ""; 780 } 781 #add the options to the combobox (hidden value= language code, user friendly name [0]multilingual [1]English 782 echo'<option value="' . $_langIds . '"' . $_selected . '>'.$_langNames[1].'</option>'; 783 } 784 print<<<EndHTML 785 </select> 786 </div> 787 </form> 788 </div> 789 790 791 792 793 <br><br><br><br> 794 <strong>Common Error message:</strong> <BR> 795 <p>This is an example of message you may see in the top of your working auth-server IF the languagepacks on your server have not been installed. In most Unix/Linux system, you could use locale -a to list all available locales on the server and run "apt-get install locales-all" for full language support</p> 796 966 797 <DIV style="border:solid black;">Warning: language.php: Unable to setlocale() to fr, return value: , current locale: LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C; [...]</DIV> 967 <p><em>I repeat</em> : This is an example of message you can see in the top of your working auth-server if language are not set correctly. To change these values please edit <em>config.php</em> in auth-server install directory. Look for "Available locales" and "Default language" header in config.php. 968 EndHTML; 969 // Dependency::execVerbose("locale -a 2>&1", $output, $return);798 799 800 EndHTML; 970 801 971 802 navigation(array ( … … 980 811 )); 981 812 break; 982 ################################### 813 ########################################### 983 814 case 'admin' : 984 print "<h1>Administration account </h1>";815 print "<h1>Administration account<
