[Linpha-cvs] SF.net SVN: linpha: [4841] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2008-01-30 21:09:04
|
Revision: 4841 http://linpha.svn.sourceforge.net/linpha/?rev=4841&view=rev Author: fangehrn Date: 2008-01-30 13:08:44 -0800 (Wed, 30 Jan 2008) Log Message: ----------- 2008-01-30 flo * installer - improved layout moved title down because of banner blindness - improved error handling in rm_rf() * linpha.filesys.class.php - improved error handling also in the same function here Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/install/header_html.php trunk/linpha2/install/layout.css trunk/linpha2/install/lib.install.php trunk/linpha2/install/look.css trunk/linpha2/install/step2_requirements.php trunk/linpha2/install/step4_selectdirectories.php trunk/linpha2/install/step6_selectdatabase.php trunk/linpha2/lib/classes/linpha.filesys.class.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-01-30 20:24:33 UTC (rev 4840) +++ trunk/linpha2/ChangeLog 2008-01-30 21:08:44 UTC (rev 4841) @@ -1,3 +1,13 @@ + +2008-01-30 flo + * installer + - improved layout + moved title down because of banner blindness + - improved error handling in rm_rf() + + * linpha.filesys.class.php + - improved error handling also in the same function here + 2008-01-30 bzrudi * Split out GPS meta/geodata from meta_exif into a seperate relation within the maps plugin. The relation is created when admin enables the maps plugin Modified: trunk/linpha2/install/header_html.php =================================================================== --- trunk/linpha2/install/header_html.php 2008-01-30 20:24:33 UTC (rev 4840) +++ trunk/linpha2/install/header_html.php 2008-01-30 21:08:44 UTC (rev 4841) @@ -23,132 +23,102 @@ * linpha installer * @package Installation */ + +$end = count($files)-1; +$step = $key+1; +$finalstep = $end+1; + +$strStep = i18n_install("Step %d of %d"); +$strStep = sprintf($strStep, $step, $finalstep); + +switch($step) +{ + case 1: + $icon = './graphics/start.png'; + $title = i18n_install("Welcome To LinPHA2 Installation Wizzard"); + break; + + case 2: + $icon = './graphics/gnu.png'; + $title = i18n_install("Accept The GNU General Public License GPL"); + break; + + case 3: + $icon = './graphics/important.png'; + $title = i18n_install("Checking For Required Software"); + break; + + case 4: + $icon = './graphics/phppg.png'; + $title = i18n_install("Select Type Of Database To Use"); + break; + + case 5: + $icon = './graphics/directories.png'; + $title = i18n_install("Define LinPHA Storage And Album Directories"); + break; + + case 6: + $icon = './graphics/login.png'; + $title = i18n_install("Directories Testing And Database Login"); + break; + + case 7: + $icon = './graphics/phppg.png'; + $title = i18n_install("Connection Test And Database Selection"); + break; + + case 8: + $icon = './graphics/phppg.png'; + $title = i18n_install("Database Table Prefix Selection"); + break; + + case 9: + $icon = './graphics/phppg.png'; + $title = i18n_install("Running Database Tests And Checking Permissions"); + break; + + case 10: + $icon = './graphics/createtables.png'; + $title = i18n_install("Creating Database Tables And Writing Config Files"); + break; + + case 11: + $icon = './graphics/settings.png'; + $title = i18n_install("Setup LinPHA Admin And Initial Settings"); + break; + + case 12: + $icon = './graphics/finish.png'; + $title = i18n_install("Finishing LinPHA2 Setup"); + break; +} ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html lang="de"> +<html> <head> <title><?php echo i18n_install("LinPHA2 Install Wizzard"); ?></title> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /> <meta http-equiv="Content-Style-Type" content="text/css" /> -<link rel="stylesheet" type="text/css" href="layout.css"> -<link rel="stylesheet" type="text/css" href="look.css"> +<link rel="stylesheet" type="text/css" href="layout.css" /> +<link rel="stylesheet" type="text/css" href="look.css" /> </head> <body> <div class="main"> -<div class="header"> + <div class="header"> + <div class="header_left"> + <img class='header_icons' src='./graphics/start.png' /> + </div> + <div class="header_right"> + <h1 class="header_title"><?php echo i18n_install("Linpha 2 Installation Wizzard"); ?></h1> + <p class='header_subinfo'><?php echo $strStep; ?></p> + </div> + </div> + <div class="leftside"> <?php -$end = count($files)-1; -$step = $key+1; -$finalstep = $end+1; -switch($step) -{ - case '1': - - echo "<img class='header_icons' src='./graphics/start.png'>"; - echo "<p class='header_info'>"; - echo i18n_install("Welcome To LinPHA2 Installation Wizzard"); - echo "</p><p class='header_subinfo'>"; - echo i18n_install("Step $step of $finalstep"); - echo "</p>"; - break; - case '2': - echo "<img class='header_icons' src='./graphics/gnu.png'>"; - echo "<p class='header_info'>"; - echo i18n_install("Accept The GNU General Public License GPL"); - echo "</p><p class='header_subinfo'>"; - echo i18n_install("Step $step of $finalstep"); - echo "</p>"; - break; - case '3': - echo "<img class='header_icons' src='./graphics/important.png'>"; - echo "<p class='header_info'>"; - echo i18n_install("Checking For Required Software"); - echo "</p><p class='header_subinfo'>"; - echo i18n_install("Step $step of $finalstep"); - echo "</p>"; - break; - case '4': - echo "<img class='header_icons' src='./graphics/phppg.png'>"; - echo "<p class='header_info'>"; - echo i18n_install("Select Type Of Database To Use"); - echo "</p><p class='header_subinfo'>"; - echo i18n_install("Step $step of $finalstep"); - echo "</p>"; - break; - case '5': - echo "<img class='header_icons' src='./graphics/directories.png'>"; - echo "<p class='header_info'>"; - echo i18n_install("Define LinPHA Storage And Album Directories"); - echo "</p><p class='header_subinfo'>"; - echo i18n_install("Step $step of $finalstep"); - echo "</p>"; - break; - case '6': - echo "<img class='header_icons' src='./graphics/login.png'>"; - echo "<p class='header_info'>"; - echo i18n_install("Directories Testing And Database Login"); - echo "</p><p class='header_subinfo'>"; - echo i18n_install("Step $step of $finalstep"); - echo "</p>"; - break; - case '7': - echo "<img class='header_icons' src='./graphics/phppg.png'>"; - echo "<p class='header_info'>"; - echo i18n_install("Connection Test And Database Selection"); - echo "</p><p class='header_subinfo'>"; - echo i18n_install("Step $step of $finalstep"); - echo "</p>"; - break; - case '8': - echo "<img class='header_icons' src='./graphics/phppg.png'>"; - echo "<p class='header_info'>"; - echo i18n_install("Database Table Prefix Selection"); - echo "</p><p class='header_subinfo'>"; - echo i18n_install("Step $step of $finalstep"); - echo "</p>"; - break; - case '9': - echo "<img class='header_icons' src='./graphics/phppg.png'>"; - echo "<p class='header_info'>"; - echo i18n_install("Running Database Tests And Checking Permissions"); - echo "</p><p class='header_subinfo'>"; - echo i18n_install("Step $step of $finalstep"); - echo "</p>"; - break; - case '10': - echo "<img class='header_icons' src='./graphics/createtables.png'>"; - echo "<p class='header_info'>"; - echo i18n_install("Creating Database Tables And Writing Config Files"); - echo "</p><p class='header_subinfo'>"; - echo i18n_install("Step $step of $finalstep"); - echo "</p>"; - break; - case '11': - echo "<img class='header_icons' src='./graphics/settings.png'>"; - echo "<p class='header_info'>"; - echo i18n_install("Setup LinPHA Admin And Initial Settings"); - echo "</p><p class='header_subinfo'>"; - echo i18n_install("Step $step of $finalstep"); - echo "</p>"; - break; - case '12': - echo "<img class='header_icons' src='./graphics/finish.png'>"; - echo "<p class='header_info'>"; - echo i18n_install("Finishing LinPHA2 Setup"); - echo "</p><p class='header_subinfo'>"; - echo i18n_install("Step $step of $finalstep"); - echo "</p>"; - break; - -} -?> -</div> -<div class="leftside"> -<?php - for($i = 0; $i <= $end; $i++ ) { if($i == $key) @@ -190,7 +160,17 @@ </div> <div class="rightside"> - + + <div class="title_left"> + <img src="<?php echo $icon; ?>" /> + </div> + <div class="header_right"> + <br /> + <h1 class="title"><?php echo $title; ?></h1> + </div> + <div style="clear: both"></div> + <br /> + <?php if($show_next_button) Modified: trunk/linpha2/install/layout.css =================================================================== --- trunk/linpha2/install/layout.css 2008-01-30 20:24:33 UTC (rev 4840) +++ trunk/linpha2/install/layout.css 2008-01-30 21:08:44 UTC (rev 4841) @@ -27,55 +27,60 @@ margin-right: auto; } -.header { +div.header { background-image: url('./graphics/header_bg.jpg'); - position: absolute; - width: 780px; height: 80px; - float: left; border: 1px solid #000000; margin: 0px; padding: 0px; - } +} -.header_icons { -float: left; - position: absolute; - margin-top: 8px; - margin-left: 45px; -} +div.header_left { + float: left; + width: 65px; + padding: 7px; +} -.header_info { - position: absolute; - margin-top: 8px; - margin-left: 160px; -} +div.header_right { + float: left; +} -.header_subinfo { - position: absolute; - margin-top: 45px; - margin-left: 160px; +h1.header_title { + margin-top: 3px; + margin-bottom: 3px; } +p.header_subinfo { +} + + +div.title_left { + float: left; + width: 65px; + padding: 0px; + margin-right: 5px; +} + + .leftside { - position: absolute; + position: relative; width: 150px; height: 430px; float: left; text-align: center; - margin-top: 82px; + /*margin-top: 82px;*/ padding: 5px; } .rightside { - position: absolute; - width: 610px; + position: relative; + width: 607px; min-height: 427px; height: expression( "427px" ); /* ie hack */ float: left; text-align: left; - margin-top: 82px; - margin-left: 160px; + /*margin-top: 82px;*/ + /*margin-left: 160px;*/ padding: 5px; padding-top: 8px; } Modified: trunk/linpha2/install/lib.install.php =================================================================== --- trunk/linpha2/install/lib.install.php 2008-01-30 20:24:33 UTC (rev 4840) +++ trunk/linpha2/install/lib.install.php 2008-01-30 21:08:44 UTC (rev 4841) @@ -74,20 +74,22 @@ */ function installRm_rf($path,$followLinks=false) { - $dir = opendir($path) ; - while (false !== ($entry = readdir($dir))) - { - if ( is_file( "$path/$entry" ) || ((!$followLinks) && is_link("$path/$entry")) ) - { - unlink( "$path/$entry" ); - } - elseif ( is_dir( "$path/$entry" ) && $entry!='.' && $entry!='..' ) - { - installRm_rf( "$path/$entry" ); - } - } - closedir($dir) ; - return @rmdir($path); + $dir = @opendir($path); + if ($dir) { + while (false !== ($entry = @readdir($dir))) + { + if ( is_file( "$path/$entry" ) || ((!$followLinks) && is_link("$path/$entry")) ) + { + unlink( "$path/$entry" ); + } + elseif ( is_dir( "$path/$entry" ) && $entry!='.' && $entry!='..' ) + { + installRm_rf( "$path/$entry" ); + } + } + @closedir($dir) ; + } + return @rmdir($path); } /** @@ -330,7 +332,7 @@ { try { - $init_ok = true; + $init_ok = true; echo "<h1>".i18n_install("Checking Directory Permissions")."</h1><hr>"; /** @@ -348,20 +350,19 @@ { echo warning_msg(); //echo '<br /> ('.$_SESSION['album_dir'].' => '.installLinRealpath( $dirs['album'] ).')'; - echo "<br />".i18n_install("Album Directory Not Writable. Some Features May Not Work")."<br />"; + echo "<br /><strong>".i18n_install("Album Directory Not Writable. Some Features May Not Work")."</strong><br />"; } } else { - throw new Exception(failed_msg()."<br />".$_SESSION['album_dir']."<br />".i18n_install("No Valid Directory Found!")); + throw new Exception(failed_msg()."<br />".$_SESSION['album_dir']."<br /><strong>".i18n_install("No Valid Directory Found!")."</strong>"); } //echo "<br />"; //echo i18n_install("Creating Required Directories...").' '; - $array = array('sql','cache','tmp'); - foreach($array AS $value) + foreach( array('sql','cache','tmp') as $value) { echo "<br />".i18n_install("Checking Directory:")." ".$value."..."." "; @@ -371,7 +372,7 @@ * oh oh, pay attention, only try to delete the folder on default values! * if the users choose wrongly the albums folder, all images would be deleted.!!!! */ - if( $_SESSION[$value.'_dir'] == 'var/'.$value) + if( $_SESSION[$value.'_dir'] == $_SESSION['default_'.$value.'_dir']) { //echo warning_msg(); //echo "<br />".i18n_install("Directory Already Exists - Trying To Delete...").' '; @@ -381,12 +382,12 @@ } else { - throw new Exception(failed_msg()."<br />".i18n_install("Please Delete Folder Manually!")); + throw new Exception(failed_msg()."<br /><strong>".i18n_install("Please Delete Folder Manually!")."</strong>"); } } else { - throw new Exception(failed_msg()."<br />".i18n_install("Directory Allready Exists, Please Delete Folder Manually!")); + throw new Exception(failed_msg()."<br /><strong>".i18n_install("Directory Allready Exists, Please Delete Folder Manually!")."</strong>"); } } Modified: trunk/linpha2/install/look.css =================================================================== --- trunk/linpha2/install/look.css 2008-01-30 20:24:33 UTC (rev 4840) +++ trunk/linpha2/install/look.css 2008-01-30 21:08:44 UTC (rev 4841) @@ -1,16 +1,17 @@ body { - font-size: 10pt; + font-size: 0.7em; color: #000000; text-decoration: none; + font-family: Verdana, Arial, Helvetica, sans-serif; } h1 { - font-size: 14pt; + font-size: 1.3em; font-weight: bold; } h2 { - font-size: 12pt; + font-size: 1.2em; font-weight: bold; } @@ -31,25 +32,35 @@ .main { } -.header_info { - font-size: 14pt; - font-weight: bold; +img.header_icon { +} + +h1.header_title { + font-size: 2em; + font-weight: bold; color: #CCCCCC; } -.header_subinfo { - font-size: 10pt; - font-weight: bold; +p.header_subinfo { + font-size: 1em; + font-weight: bold; color: #CCCCCC; } + + +h1.title { + font-size: 1.5em; +} + + .leftside { - background: #e2e2e2; + background: #F3F3F3; /*#e2e2e2;*/ border-right: 0px; } .rightside { - background: #eeeeee; + background: #F3F3F3; /*#eeeeee;*/ } .button { @@ -63,13 +74,15 @@ } .leftsidebox { - background: #cccccc; - color: #000033; + background: #DBEAF5; /*#ffffff;*/ + color: #000000; + font-weight: bold; } .leftsideboxactive { - background: #ffffff; - color: #0000ff; + background: #335DB3; /*#cccccc;*/ + color: #DBEAF5; /*#000033;*/ + font-weight: bold; } .box2 { Modified: trunk/linpha2/install/step2_requirements.php =================================================================== --- trunk/linpha2/install/step2_requirements.php 2008-01-30 20:24:33 UTC (rev 4840) +++ trunk/linpha2/install/step2_requirements.php 2008-01-30 21:08:44 UTC (rev 4841) @@ -418,7 +418,7 @@ print_line_middle( i18n_install("Yes") ); print_line_right(success_msg()); print_line_info( - i18n_install("The /albums folder is protected from outside."). + i18n_install("The /albums folder is protected from outside.").' '. i18n_install("Please see <a href=\"http://linpha.sourceforge.net/wiki/index.php/Secure_LinPHA\">here</a> for more details.") ); } Modified: trunk/linpha2/install/step4_selectdirectories.php =================================================================== --- trunk/linpha2/install/step4_selectdirectories.php 2008-01-30 20:24:33 UTC (rev 4840) +++ trunk/linpha2/install/step4_selectdirectories.php 2008-01-30 21:08:44 UTC (rev 4841) @@ -26,10 +26,16 @@ include_once(LINPHA_DIR.'/lib/include/common.php'); include_once(LINPHA_DIR.'/install/header.php'); +if (!isset($_SESSION['default_sql_dir']) ) { // save for later use in initInitialDirectories() + $_SESSION['default_sql_dir'] = 'var/sql-'.random_password(10); + $_SESSION['default_cache_dir'] = 'var/cache-'.random_password(10); + $_SESSION['default_tmp_dir'] = 'var/tmp-'.random_password(10); +} + $album_dir = (isset($_SESSION['album_dir']) ? $_SESSION['album_dir'] : 'albums'); -$sql_dir = (isset($_SESSION['sql_dir']) ? $_SESSION['sql_dir'] : 'var/sql-'.random_password(10)); -$cache_dir = (isset($_SESSION['cache_dir']) ? $_SESSION['cache_dir'] : 'var/cache-'.random_password(10)); -$tmp_dir = (isset($_SESSION['tmp_dir']) ? $_SESSION['tmp_dir'] : 'var/tmp-'.random_password(10)); +$sql_dir = (isset($_SESSION['sql_dir']) ? $_SESSION['sql_dir'] : $_SESSION['default_sql_dir']); +$cache_dir = (isset($_SESSION['cache_dir']) ? $_SESSION['cache_dir'] : $_SESSION['default_cache_dir']); +$tmp_dir = (isset($_SESSION['tmp_dir']) ? $_SESSION['tmp_dir'] : $_SESSION['default_tmp_dir']); /** @@ -64,9 +70,12 @@ include_once(LINPHA_DIR.'/install/header_html.php'); ?> +<div class="boxalign"> +<?php +echo '<b>'.i18n_install("For maximum security place all these folders outside of the www root!") . + '</b><br />('.i18n_install("Relative or absolute paths allowed.").')<br /><br />'; -<div class="boxalign"> -<?php echo i18n_install("Album Directory").":"; ?> +echo i18n_install("Album Directory").":"; ?> <input class="boxalignelement" type="text" id="check01" onKeyup="checkForm()" name="album_dir" size="30" value="<?php echo $album_dir; ?>"> </div> @@ -74,7 +83,10 @@ <br /><br /> <br /> -<h2 style="color: red;"><?php echo i18n_install("Note: For security reasons folders were named random!"); ?></h2><hr> +<h2 style="color: red;"><?php +echo i18n_install("Warning: All directories below will be deleted if they exist!").'<br />'; +?></h2> +<hr /> <br /> <div class="boxalign"> @@ -100,6 +112,12 @@ </div> (-> <?php echo installLinRealpath( installGetFullPath($tmp_dir) ); ?>) <br /><br /> + +<?php +echo i18n_install("For security reasons folders were named random."); +?> + + <input type="hidden" name="cmd_step4" value="save"> Modified: trunk/linpha2/install/step6_selectdatabase.php =================================================================== --- trunk/linpha2/install/step6_selectdatabase.php 2008-01-30 20:24:33 UTC (rev 4840) +++ trunk/linpha2/install/step6_selectdatabase.php 2008-01-30 21:08:44 UTC (rev 4841) @@ -129,7 +129,7 @@ <hr> <br /> <?php -if($_SESSION['allowed_to_create_db'] == true) +if ($_SESSION['allowed_to_create_db'] == true) { /** * search a valid database name (which doesn't already exists) @@ -169,30 +169,45 @@ $checked_dontcreate = ''; } - echo i18n_install("Create A New Database (Recommended)"); - ?> - <br /> + echo i18n_install("Create A New Database (Recommended)").'<br />'; +} + +if ($_SESSION['allowed_to_create_db'] == true && isset($databases)) +{ + ?> + <label for="radio_db1"> <input type="radio" id="radio_db1" name="create_database" value="create"<?php echo $checked_create; ?>> + <?php +} - <?php echo i18n_install("New Database Name").": "; ?> +if ($_SESSION['allowed_to_create_db'] == true) +{ + echo i18n_install("New Database Name").": "; ?> + </label> <input type="text" name="sql_dbname_create" value="<?php echo isset($_SESSION['sql_dbname']) ? $_SESSION['sql_dbname'] : $dbname ; ?>" onKeyup="document.getElementById('radio_db1').checked = true;"> <br /><br /> - <?php echo i18n_install("Or").","; ?><br /> + <?php +} + +if ($_SESSION['allowed_to_create_db'] == true && isset($databases)) +{ +?> + <label for="radio_db2"><?php echo i18n_install("Or").","; ?><br /> <input type="radio" id="radio_db2" name="create_database" value="false"<?php echo $checked_dontcreate; ?>> <?php } -if(isset($databases)) +if (isset($databases)) { echo i18n_install("Install Into Existing Database:").' '; ?> - + </label> <select name="sql_dbname_installinto"<?php if($_SESSION['allowed_to_create_db'] == true) { Modified: trunk/linpha2/lib/classes/linpha.filesys.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.filesys.class.php 2008-01-30 20:24:33 UTC (rev 4840) +++ trunk/linpha2/lib/classes/linpha.filesys.class.php 2008-01-30 21:08:44 UTC (rev 4841) @@ -65,19 +65,22 @@ } else { - $dir = opendir($path) ; - while (false !== ($entry = readdir($dir))) + $dir = @opendir($path); + if ($dir) { - if ( is_file( "$path/$entry" ) || ((!$followLinks) && is_link("$path/$entry")) ) - { - @unlink( "$path/$entry" ); - } - elseif ( is_dir( "$path/$entry" ) && $entry!='.' && $entry!='..' ) - { - LinFilesys::rm_rf( "$path/$entry" ); - } - } - closedir($dir) ; + while (false !== ($entry = @readdir($dir))) + { + if ( is_file( "$path/$entry" ) || ((!$followLinks) && is_link("$path/$entry")) ) + { + @unlink( "$path/$entry" ); + } + elseif ( is_dir( "$path/$entry" ) && $entry!='.' && $entry!='..' ) + { + LinFilesys::rm_rf( "$path/$entry" ); + } + } + @closedir($dir); + } return @rmdir($path); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |