// $Id: daily.php,v 1.2 2004/07/29 20:57:53 fuitad Exp $ // +---------------------------------------------------------------------------+ // | Comic Update Script for PHP (CUSP) - Written by Pierre-Luc Brunet | // +---------------------------------------------------------------------------+ // | This software is provided 'as-is', without any express or implied | // | warranty. In no event will the authors be held liable for any damages | // | arising from the use of this software. | // | | // | Permission is granted to anyone to use this software for any purpose, | // | including commercial applications, and to alter it and redistribute it | // | freely, subject to the following restrictions: | // | | // | 1. The origin of this software must not be misrepresented; you must not | // | claim that you wrote the original software. If you use this software in | // | a product, an acknowledgment in the product documentation would be | // | appreciated but is not required. | // | | // | 2. Altered source versions must be plainly marked as such, and must not | // | be misrepresented as being the original software. | // | | // | 3. This notice may not be removed or altered from any source distribution.| // | | // +---------------------------------------------------------------------------+ // | Support: http://cusp.sourceforge.net | // +---------------------------------------------------------------------------+ require_once("/home/vespid/public_html/cusp/_inc/core.php"); if (!$_GET['r']){ $r=0; } else { $r=$_GET['r']; } if (!$_GET['c']){ $c=0; } else { $c=1; } // First thing, determine what date we're showing if (!$_GET['date']) { // Let's make our time part-way through today... $x_date = date("ymd", time() - (60 * 60 * 6)); $x_year = substr($x_date, 0, 2); $x_month = substr($x_date, 2, 2); $x_day = substr($x_date, 4, 2); $today_time = mktime(12, 0, 0, $x_month, $x_day, $x_year); $fulldate=$x_date; $_GET['date'] = date("ymd", $today_time); } else { $year = substr($_GET['date'], 0, 2); $month = substr($_GET['date'], 2, 2); $day = substr($_GET['date'], 4, 2); $fulldate = ($_GET['date']); $today_time = mktime(12, 0, 0, $month, $day, $year); $x_date = ($_GET['date']); } // if ($date<1) // { // // Let's make our time part-way through today... // $x_date = date("ymd"); // $x_year = substr($x_date, 0, 2); // $x_month = substr($x_date, 2, 2); // $x_day = substr($x_date, 4, 2); // $today_time = mktime(12, 0, 0, $x_month, $x_day, $x_year); // $fulldate=$x_date; // $date=$fulldate; // $_GET['date'] = date("ymd", $today_time); // } if (!$mode) { $mode = "daily"; } // Have we already generated this date's page? If so, use that! // $cached_file = $arrCuspVars['output_directory'] . date("ymd", $today_time) . "-$mode.html"; if (file_exists($cached_file) && ($arrCuspVars['filecaching'] == 1)) { // Read our file for the contents $fp = fopen( $cached_file, "r" ); $main_file = fread( $fp, 50000 ); fclose( $fp ); } else { // Determine if we have a special YYMMDDdaily.html file to use // Check the skeleton directory for the special file if ($mode=="daily") { /* $special = date("ymd", $today_time) . 'daily']; $full_path = $arrCuspVars['templates_directory'] . $special; if (file_exists($full_path)) { $source_file = $special; } else { $source_file = $daily_template; } */ // Now, open and read our default page $main_file = organize($fulldate); $main_file = parse_template('daily_with_counter'); // Standardize formatting in our html $main_file = tweak_html( $main_file ); // Let's replace our title... $main_file = replace_title( $main_file, $today_time, $mode); // Replace the URL... $main_file = replace_url( $main_file, $today_time ); // Replace our "Comic for such and such a date" line $main_file = replace_date( $main_file, $today_time ); // Replace our comic panel(s) $main_file = replace_comic( $main_file, $today_time); // Replace our sidebar $main_file = replace_sidebar( $main_file, $fulldate); // Replace our navigation buttons $main_file = replace_navigation( $main_file, $today_time, $mode); $main_file = replace_wiki( $main_file, $x_date ); $main_file = replace_news( $main_file, $x_date, $mode ); $main_file = replace_comments( $main_file, $x_date, $c, $r ); $main_file = replace_tags ($main_file, $x_date); $main_file = replace_version( $main_file, $today_time, $mode); if ($arrCuspVars['filecaching'] == 1) { // Write out our result $fp = fopen($cached_file, "w"); fwrite( $fp, $main_file ); fclose( $fp ); } } // end of page-from-scratch code } // Now echo out our result! echo $main_file; echo("!"); ?>