Subversion Repositories travelsized

Rev

Rev 3 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?PHP
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * This file is part of Uberghey CMS
 *              A content management system with modules, based on wiki syntax
 *
 * Author: Dan Jensen <admin@leinir.dk>
 * Copyright 2003/2004
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * The GNU General Public License is available at: http://www.gnu.org/copyleft/
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */


function rotate_recent($new_id, $new_title, $new_language, $new_date, $recent_file) {
        $fp = fopen($recent_file, "r");
        $recent_contents_2 = fread($fp, filesize($recent_file));
        $recent_contents_2 = unserialize($recent_contents_2);
        fclose($fp);
        $recent_contents_2[0] = $recent_contents_2[1];
        $recent_contents_2[1] = $recent_contents_2[2];
        $recent_contents_2[2] = $recent_contents_2[3];
        $recent_contents_2[3] = $recent_contents_2[4];
        $recent_contents_2[4] = $recent_contents_2[5];
        $recent_contents_2[5] = $recent_contents_2[6];
        $recent_contents_2[6] = $recent_contents_2[7];
        $recent_contents_2[7] = $recent_contents_2[8];
        $recent_contents_2[8] = $recent_contents_2[9];
        $recent_contents_2[9] = array("id" => $new_id, "title" => $new_title, "language" => $new_language, "date" => $new_date);
        if (file_exists($recent_file)) unlink($recent_file);
        $recent_contents_2 = serialize($recent_contents_2);
        $fp = fopen($recent_file, "a");
        if ($fp) {
                $fp = fwrite($fp, $recent_contents_2); // . chr(0)
                return true;
        } else {
                $this->ERRORS = "Could not update backwards page_id lookup index.";
                return false;
        }
        fclose($fp);
}

//Load the recent list here and put it into $newest_pages
        $fp = fopen($recent_file, "r");
        $newest_pages = fread($fp, filesize($recent_file));
        $newest_pages = unserialize($newest_pages);
        fclose($fp);

?>