RSS en ordre inverse (bug #1843853) + bugfix sous PHP5 (le fameux clone bug)

This commit is contained in:
nojhan 2008-02-04 14:24:17 +00:00
commit 1c84a36c69
3 changed files with 10 additions and 5 deletions

View file

@ -18,7 +18,7 @@ class configuration
/** /**
* URL of the website * URL of the website
*/ */
var $url = 'http://www.nojhan.net/geekscottes'; var $url = 'http://localhost/~nojhan/stripit/trunk';
/** /**
* Title of the website * Title of the website

12
rss.php
View file

@ -14,6 +14,12 @@ set_include_path(get_include_path() . PATH_SEPARATOR . getcwd());
require_once 'strip_manager.php'; require_once 'strip_manager.php';
require_once 'configuration.php'; require_once 'configuration.php';
// hack for passing objects by values instead of reference under PHP5 (but not PHP4)
// damn clone keyword !
if (version_compare(phpversion(), '5.0') < 0) {
eval('function clone($object) {return $object;}');
}
/** /**
* RSS manager * RSS manager
*/ */
@ -47,13 +53,13 @@ class rss_manager
$sm->strips_list_get(); $sm->strips_list_get();
for( $i = 0; $i < $sm->strips_count; $i++ ) { for( $i = $sm->strips_count-1; $i >= 0; $i-- ) { // reverser order
$sm->strip_info_get( $i ); $sm->strip_info_get( $i );
// conversion iso8601 -> RFC822 // conversion iso8601 -> RFC822
$sm->date = date('r', strtotime($sm->date)); $sm->date = date('r', strtotime($sm->date));
$this->items_list[] = $sm; $this->items_list[] = clone($sm); // hack for php4/5 compat
} }
} }

View file

@ -241,7 +241,6 @@ class strip_manager
* @param integer index of the file to parse in the {@link $strips_list} * @param integer index of the file to parse in the {@link $strips_list}
*/ */
function strip_info_get( $element_asked ) { function strip_info_get( $element_asked ) {
$this->current_id = $element_asked; $this->current_id = $element_asked;
$file = $this->strips_list[$element_asked]; $file = $this->strips_list[$element_asked];