[Picfinity-commit] SF.net SVN: picfinity: [68] trunk/index.php
Status: Beta
Brought to you by:
espadav8
From: <esp...@us...> - 2007-09-06 10:26:33
|
Revision: 68 http://picfinity.svn.sourceforge.net/picfinity/?rev=68&view=rev Author: espadav8 Date: 2007-09-06 03:26:33 -0700 (Thu, 06 Sep 2007) Log Message: ----------- Move all the config options to the top Add the option 'rescan_folders' if this is set to false, and the gallery.xml file exists, then just load the xml file to pass to the xsl if set to false, or the gallery.xml file doesn't exist, run as normal and recreate the whole xml, saving it if needed Add 'default_theme' as a option as well, to save having to look for the right place to change the string Modified Paths: -------------- trunk/index.php Modified: trunk/index.php =================================================================== --- trunk/index.php 2007-09-02 17:52:28 UTC (rev 67) +++ trunk/index.php 2007-09-06 10:26:33 UTC (rev 68) @@ -2,6 +2,37 @@ // site options $site_name = "Picfinity"; + // default theme + $deault_theme = "clean"; + + // create thumbnails for images that don't have one already + $create_thumbnails = true; + + // create a flat HTML version of the page + $create_html = false; + + // rescan the folders (and thus recreate the XML for each page request) + $rescan_folders = false; + + // create the gallery.xml file (for use by themes) + $create_xml = true; + + // Allow the users to change the theme + // this needs the PHP version of the page + $enable_themes = true; + + // thumbnail sizes + $thumbnail_width = 100; + $thumbnail_height = 100; + + // use the database + $use_db = true; + + // valid images to be shown + $valid_image_formats = array('png', 'gif', 'jpg', 'jpeg', 'bmp'); + + + // here we either get the theme posted in // or if there's one stored in the cookie use that one // otherwise use the default one @@ -17,7 +48,7 @@ else { // set the name of the default theme here - $theme = "db" ; + $theme = $deault_theme; } if ($_GET['id']) @@ -29,72 +60,63 @@ $post_id = 0; } - // create thumbnails for images that don't have one already - $create_thumbnails = true; - - // create a flat HTML version of the page - $create_html = false; - - // create the gallery.xml file (for use by themes - $create_xml = true; - - // Allow the users to change the theme - // this needs the PHP version of the page - $enable_themes = true; - - // thumbnail sizes - $thumbnail_width = 100; - $thumbnail_height = 100; - - // use the database - $use_db = true; - - if ($use_db) + if (($rescan_folders) || !file_exists("gallery.xml")) { - require_once ('db.inc'); - if (!$db_connection) + if ($use_db) { - $use_db = false; - } - else - { - if ($selected_table) + require_once ('db.inc'); + if (!$db_connection) { - $result = mysql_query("SELECT image_md5 FROM images"); - if (!$result) + $use_db = false; + } + else + { + if ($selected_table) { - echo 'Invalid query: ' . mysql_error() . "\n"; - echo 'Whole query: ' . $query; - $use_db = false; + $result = mysql_query("SELECT image_md5 FROM images"); + if (!$result) + { + echo 'Invalid query: ' . mysql_error() . "\n"; + echo 'Whole query: ' . $query; + $use_db = false; + } + else + { + $current_images = array(); + while ($row = mysql_fetch_row($result)) + { + $current_images[] = $row[0]; + } + mysql_free_result($result); + } } else { - $current_images = array(); - while ($row = mysql_fetch_row($result)) - { - $current_images[] = $row[0]; - } - mysql_free_result($result); + $use_db = false; } } - else - { - $use_db = false; - } } - } - // valid images to be shown - $valid_image_formats = array('png', 'gif', 'jpg', 'jpeg', 'bmp'); + // get the layout of the current dir + $site_layout_xml = create_folder_layout('.'); - // get the layout of the current dir - $site_layout_xml = create_folder_layout('.'); + // create the XML file if we've been told to + if ($create_xml) + { + $fh = fopen("gallery.xml", "w"); + fwrite($fh, $site_layout_xml); + fclose($fh); + } - // create the XML file if we've been told to - if ($create_xml) + if ($use_db) + { + mysql_close($db_connection); + } + } + else { - $fh = fopen("gallery.xml", "w"); - fwrite($fh, $site_layout_xml); + $fh = fopen("gallery.xml", "r"); + $site_layout_xml = fread($fh, filesize("gallery.xml")); fclose($fh); } @@ -109,11 +131,6 @@ fclose($fh); } - if ($use_db) - { - mysql_close($db_connection); - } - // echo the HTML to the screen echo $html; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |