
andrew at morphoss
Jan 1, 2011, 3:03 AM
Post #3 of 3
(140 views)
Permalink
|
|
Changes to setup.php to eliminate a couple errors
[In reply to]
|
|
On Fri, 2010-12-31 at 15:45 -0500, Andy Fore wrote: > Hi, > > > I recently installed version 0.9.9.4 on my CentOS 5 server that I have > upgraded to PHP 5.3 using the iUS community project. I noticed on the > setup page that there were a couple of errors with the output. Hi Andy, Someone else pointed out the get_magic_quotes_gpc() and get_magic_quotes_runtime() functions to me which have solved this issue entirely. I've also signficantly refactored setup.php in the process of adding that, making it a bit more translatable and able to potentially display nicer 'how to fix the problem' messages. Cheers, Andrew. > > > The first two involved the correct parsing of the output for the > checks for the following ini variables: > > > - magic_quotes_gpc > - magic_quotes_runtime > > > The code in setup.php ( /usr/share/davical/htdocs/setup.php ) that > checks for this appears to be incorrect. On line 44 the check for > magic_quotes_gpc reads: > > > if ( ini_get('magic_quotes_gpc') == "0" ) > > > Instead of checking the value using a string comparison if found that > changing the line to read as follows returns the correct value: > > > if ( ini_get('magic_quotes_gpc') == 0 ) > > > Likewise, changing line 54 to read as follows does a correct check > on magic_quotes_runtime : > > > if ( ini_get('magic_quotes_runtime') == 0 ) > > > Another thing that I noticed is that the default value of the ini > variable allow_url_fopen is set to be Off. This plays havoc with the > check for the version string. I wrote an addition to the > function check_davical_version that uses the curl library that will > accomplish the same goal if allow_url_fopen is not set: > > > function check_davical_version() { > if ( ini_get('allow_url_fopen') == 0 ) > { > global $c; > $check = > "http://www.davical.org/current_davical_version?v=".$c->version_string; > $ch = > curl_init("http://www.davical.org/current_davical_version?v=".$c->version_string); > curl_setopt($ch, CURLOPT_HEADER, 0); > curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); > $url = curl_exec($ch); > curl_close($ch); > if ( ! $url ) return translate("Could not retrieve") . " '$check'"; > $current_version = trim($url); > return ( $c->version_string == $current_version ? true : > $current_version ); > } > else > { > global $c; > $url = > 'http://www.davical.org/current_davical_version?v='.$c->version_string; > $version_file = @fopen($url, 'r'); > if ( ! $version_file ) return translate("Could not retrieve") . " > '$url'"; > $current_version = trim(fread( $version_file,12)); > fclose($version_file); > return ( $c->version_string == $current_version ? true : > $current_version ); > } > } > > > I am unsure if this is all due to changes in the way that PHP 5.3 does > things, but I don't have much of a choice but run the latest release > due to some other projects I am involved in. > > > Thanks, > Andy > > > Andy Fore > andy.fore at arfore.com > > To see a world in a grain of sand, And a heaven in a wild flower, Hold > infinity in the palm of your hand, And eternity in an hour. > > -- William Blake, Auguries of Innocence > > > > _______________________________________________ > DAViCal-dev mailing list > DAViCal-dev at lists.davical.org > http://lists.davical.org/listinfo/davical-dev -- ------------------------------------------------------------------------ andrew (AT) morphoss (DOT) com +64(272)DEBIAN Powering the .NZ namespace with Open Source Software ------------------------------------------------------------------------ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part URL: <http://lists.davical.org/pipermail/davical-dev/attachments/20110101/f8c16806/attachment.pgp>
|