[Linpha-cvs] SF.net SVN: linpha: [4726] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <bz...@us...> - 2007-07-05 14:53:32
|
Revision: 4726 http://svn.sourceforge.net/linpha/?rev=4726&view=rev Author: bzrudi Date: 2007-07-05 07:53:30 -0700 (Thu, 05 Jul 2007) Log Message: ----------- "Added Exiftool configuration support to Installer." Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/install/layout.css trunk/linpha2/install/lib.requirements.php trunk/linpha2/install/step10_postsettings.php trunk/linpha2/install/step11_finish.php trunk/linpha2/install/step2_requirements.php trunk/linpha2/install/step3_dbtype.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-07-04 15:52:20 UTC (rev 4725) +++ trunk/linpha2/ChangeLog 2007-07-05 14:53:30 UTC (rev 4726) @@ -1,3 +1,8 @@ +2007-07-04 bzrudi + * Added Exiftool configuration support to Installer. Checks also for Perl and + OS. Needs Windows testing! + TODO: Save path to perl in DB + 2007-07-03 bzrudi * Added support for ignored filetypes stored in DB * Some fixes to make embedded thumbnails work better using exiftool Modified: trunk/linpha2/install/layout.css =================================================================== --- trunk/linpha2/install/layout.css 2007-07-04 15:52:20 UTC (rev 4725) +++ trunk/linpha2/install/layout.css 2007-07-05 14:53:30 UTC (rev 4726) @@ -72,9 +72,14 @@ .box3 { float: left; - width: 30%; + width: 33%; } +.box4 { + float: left; + width: 95%; + text-align: left; +} .license { width: 95%; height: 360px; Modified: trunk/linpha2/install/lib.requirements.php =================================================================== --- trunk/linpha2/install/lib.requirements.php 2007-07-04 15:52:20 UTC (rev 4725) +++ trunk/linpha2/install/lib.requirements.php 2007-07-05 14:53:30 UTC (rev 4726) @@ -22,6 +22,123 @@ /** * @package Installation */ + +function installCheckPerl() +{ + +$array_path = installGetPATH('PATH'); +$array_lookfor = installGetPATH(Array('/bin','/usr/bin','/usr/local/bin','/sw/bin')); + + /** + * need a special check if safe_mode is on + * because we can't check anymore with file_exists() since php 4.3.9 even if the file is in + * allowed dirs (see http://bugs.php.net/bug.php?id=30259) + * + * try to execute in every location + */ + if(ini_get('safe_mode')) + { + foreach($array_path AS $value) + { + if( !isset($array) ) + { + $arr=array(); $return_var=''; // do not this directly in exec() ! + exec($value.'/perl -help',$arr,$return_var); + + if(isset($return_var) && $return_var == 0) + { + $array = Array(1, '', ''); + } + } + } + + // search file in other locations + foreach($array_lookfor AS $value) + { + if( !isset($array) ) + { + $arr=array(); + $return_var=''; // don't do this directly in exec() ! + exec($value.'/perl -help',$arr,$return_var); + + if(isset($return_var) && $return_var == 0) + { + $array = Array(1, '', ''); + } + } + } + } + else + { + /** + * search file in PATH + * + * if convert is found in the path variable, don't store the full path + * because if the path changes, we get problems (for example under windows: + * c:/program files/imagemagick-5.8.... changes to c:/program files/imagemagick-6.0.0) + */ + foreach($array_path AS $value) + { + if( !isset($array) && file_exists($value.'/perl') ) + { + $array = Array(1, '',''); + } + } + + // search file in other locations + foreach($array_lookfor AS $value) + { + if( !isset($array) && file_exists($value.'/perl') ) + { + $array = Array(1, $value.'/',''); + } + } + } + + if(!isset($array) ) + { + $array = Array(0,'',''); + return $array; + } + + /** + * now, we do an improved check + */ + $arr=array(); + $return_var=''; // don't do this directly in exec() ! + exec($array[1].'perl --version',$arr,$return_var); + + if(isset($return_var) && $return_var == 0) + { + $needle = 'perl, '; + $pos = strpos($arr[1],$needle); + + if($pos === false) + { + /** + * wrong convert found ?! + * @todo we should now set use_convert to '0' ?! + */ + $version = ''; + } + else + { + $version = substr($arr[1],$pos+strlen($needle),6); + } + + $array[2] = $version; + } + else + { + /** + * convert not found... + */ + $array = array(0,'',''); + } + + return $array; +} + function installCheckConvert() { if( LIN_OS == 'win' ) { Modified: trunk/linpha2/install/step10_postsettings.php =================================================================== --- trunk/linpha2/install/step10_postsettings.php 2007-07-04 15:52:20 UTC (rev 4725) +++ trunk/linpha2/install/step10_postsettings.php 2007-07-05 14:53:30 UTC (rev 4726) @@ -51,13 +51,13 @@ $linpha = new Linpha(); $linpha->sql->dbConnect(); -echo success_msg(); +echo success_msg(); // TODO: we should check for success before stating it ;-) /** * add new linpha admin user */ echo "<br /><br />"; -echo "<h2>".i18n_install("Setup Linpha Admin User")."</h2>"; +echo "<h2>".i18n_install("Setup Linpha Admin User")."</h2><hr>"; ?> <div class="boxalign"> <?php echo i18n_install("Admin Username").":"; ?> @@ -77,17 +77,16 @@ name="admin_email"> </div> <br /> -<br /> + <?php - $query = $linpha->db->Execute("SELECT option_value FROM ".LIN_PREFIX."config " . "WHERE option_name='sys_im_use_imagemagick'"); $data = $query->FetchRow(ADODB_FETCH_NUM); if(false === $data[0]) { - echo "<h2>".i18n_install("Please Choose Thumbnail Quality")."</h2>"; + echo "<h2>".i18n_install("Please Choose Thumbnail Quality")."</h2><hr>"; ?> <div align="center"> <div class="box2"> @@ -101,12 +100,13 @@ </div> </div> <?php - echo i18n_install("Warning: High Quality Requires CPU > 1 GHz"); + echo i18n_install("Warning: High Quality Requires CPU > 1 GHz")."<br />"; } ?> -<br /><br /> +<br /> + <?php -echo "<h2>".i18n_install("Please Choose Default Thumbnail Size")."</h2>"; +echo "<h2>".i18n_install("Please Choose Default Thumbnail Size")."</h2><hr>"; ?> <div align="center"> @@ -125,12 +125,41 @@ <div class="box3"> <input type='radio' name='sys_style_tn_size' value='150'> 150 pixel<br /> - <img src='./graphics/thumb150px.jpg' /> + <img src='./graphics/thumb150px.jpg'> </div> </div> -<br /><br /><br /><br /> +<br /> + <?php +if($_SESSION['sys_import_has_perl'] || LIN_OS == 'win') +{ +echo "<h2>".i18n_install("Make Use Of Exiftool?")."</h2><hr>"; +echo i18n_install("Exiftool is an advanced manipulaion library for MetaData information like XMP/IPTC and friends.")." "; +echo i18n_install("If you are unsure what it's all about, it's save to say no here.")."<br /><br />"; +?> +<div align="center"> + <div class="box4"> + <input type='radio' name='sys_import_use_exiftool' value='1'> + <?php echo i18n_install("Yes"); ?> + <input type='radio' name='sys_import_use_exiftool' value='0' checked=checked> + <?php echo i18n_install("No"); ?> + <?php echo i18n_install("Enable Exiftool"); ?> + </div> + + <div class="box4"> + <input type='radio' name='sys_import_use_emb_thumb' value='1'> + <?php echo i18n_install("Yes"); ?> + <input type='radio' name='sys_import_use_emb_thumb' value='0' checked=checked> + <?php echo i18n_install("No"); ?> + <?php echo i18n_install("Extract Embedded Thumbnails"); ?> + + </div> +</div> +<br /><br /><br /> +<?php } ?> + +<?php $array_check = array( 'check01' => 'text', 'check02' => 'text' Modified: trunk/linpha2/install/step11_finish.php =================================================================== --- trunk/linpha2/install/step11_finish.php 2007-07-04 15:52:20 UTC (rev 4725) +++ trunk/linpha2/install/step11_finish.php 2007-07-05 14:53:30 UTC (rev 4726) @@ -105,6 +105,50 @@ $error_nr = 1; } +/** + * exiftool + */ + if( isset( $_POST['sys_import_use_exiftool'] ) ) + { + echo "<br />".i18n_install("Saving Exiftool Options...").' '; + $result = $linpha->db->Execute("UPDATE ".LIN_PREFIX."config " . + "SET option_value = '".LinSql::linAddslashes($_POST['sys_import_use_exiftool'])."' " . + "WHERE option_name = 'sys_import_use_exiftool'"); + if(!$result) + { + echo failed_msg(); + $error_nr = 1; + } + else + { + echo success_msg(); + } + + if($_POST['sys_import_use_exiftool'] == true && $result == true) + { + $result = $linpha->db->Execute("UPDATE ".LIN_PREFIX."config " . + "SET option_value = '".LinSql::linAddslashes($_POST['sys_import_use_emb_thumb'])."' " . + "WHERE option_name = 'sys_import_use_emb_thumb'"); + if(!$result) + { + echo failed_msg(); + $error_nr = 1; + } + else + { + echo success_msg(); + } + } + } + else + { + echo failed_msg(); + echo "<br />".i18n_install("Error - Wrong Value For Exiftool Received!"); + $error_nr = 1; + } + + + if(isset($error_nr)) { echo "</form>"; Modified: trunk/linpha2/install/step2_requirements.php =================================================================== --- trunk/linpha2/install/step2_requirements.php 2007-07-04 15:52:20 UTC (rev 4725) +++ trunk/linpha2/install/step2_requirements.php 2007-07-05 14:53:30 UTC (rev 4726) @@ -118,6 +118,7 @@ /** * checking imagemagick */ + print_line_left("ImageMagick"); list($convert_avail, $convert_path, $convert_version) = installCheckConvert(); @@ -201,7 +202,33 @@ } +/** + * checking for perl (only on UNIX like OS) We need it for Exiftool, but + * not on M$ OS, so silently ignore it. + */ + if( LIN_OS != 'win' ) + { + print_line_left("Perl"); + list($perl_avail, $perl_path, $perl_version) = installCheckPerl(); + if($perl_avail) + { + print_line_middle($perl_version); + print_line_right(success_msg()); + $perl_ok = 1; + } + else + { + print_line_middle( i18n_install("Not Found") ); + print_line_right(warning_msg()); + print_line_info( i18n_install("Perl was NOT found on this server. However, no need to panic as LinPHA will even work without.") ); + $perl_ok = 0; + } + + echo "\t".'<input type="hidden" name="sys_import_has_perl" value="'.$perl_ok.'">'."\n"; + // @TODO make perl path avail in config + //echo "\t".'<input type="hidden" name="sys_import_perl_path" value="'.$perl_path.'">'."\n"; + } /** * check GD only if IM not available */ @@ -397,7 +424,7 @@ print_line_right(warning_msg()); print_line_info( i18n_install("Cannot determine wether the /albums and /var folders are protected from outside!"). - i18n_install("Please see <a href=\"http://linpha.sourceforge.net/wiki/index.php/Secure_LinPHA\">here</a> for more details.") + i18n_install("Please see <a href=\"http://linpha.sourceforge.net/wiki/index.php/Secure_LinPHA\" target=\"_blank\">here</a> for more details.") ); } @@ -462,7 +489,7 @@ function print_line_middle($str) { ?> - <td width="50"><?php echo $str; ?></td> + <td width="70"><?php echo $str; ?></td> <?php } Modified: trunk/linpha2/install/step3_dbtype.php =================================================================== --- trunk/linpha2/install/step3_dbtype.php 2007-07-04 15:52:20 UTC (rev 4725) +++ trunk/linpha2/install/step3_dbtype.php 2007-07-05 14:53:30 UTC (rev 4726) @@ -34,7 +34,7 @@ $_SESSION['language'] = $_POST['language']; } -$array = array('sys_im_bracket_support','sys_im_use_convert','sys_im_convert_path'); +$array = array('sys_im_bracket_support','sys_im_use_convert','sys_im_convert_path','sys_import_has_perl'); foreach($array AS $value) { if(isset($_POST[$value])) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |