// Copyright: Matthias Steffens and the file's // original author(s). // // This code is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY. Please see the GNU General Public // License for more details. // // File: ./index.php // Repository: $HeadURL: https://refbase.svn.sourceforge.net/svnroot/refbase/trunk/index.php $ // Author(s): Matthias Steffens // // Created: 29-Jul-02, 16:45 // Modified: $Date: 2008-11-18 13:13:00 -0800 (Tue, 18 Nov 2008) $ // $Author: msteffens $ // $Revision: 1321 $ // This script builds the main page. // It provides login and quick search forms // as well as links to various search forms. // Incorporate some include files: include 'initialize/db.inc.php'; // 'db.inc.php' is included to hide username and password include 'includes/header.inc.php'; // include header include 'includes/footer.inc.php'; // include footer include 'includes/include.inc.php'; // include common functions include 'initialize/ini.inc.php'; // include common variables // -------------------------------------------------------------------- // START A SESSION: // call the 'start_session()' function (from 'include.inc.php') which will also read out available session variables: start_session(true); // -------------------------------------------------------------------- // Initialize preferred display language: // (note that 'locales.inc.php' has to be included *after* the call to the 'start_session()' function) include 'includes/locales.inc.php'; // include the locales // -------------------------------------------------------------------- // If there's no stored message available: if (!isset($_SESSION['HeaderString'])) $HeaderString = $loc["Default Welcome Message"]; // Provide the default welcome message else { $HeaderString = $_SESSION['HeaderString']; // extract 'HeaderString' session variable (only necessary if register globals is OFF!) // Note: though we clear the session variable, the current message is still available to this script via '$HeaderString': deleteSessionVariable("HeaderString"); // function 'deleteSessionVariable()' is defined in 'include.inc.php' } // Extract the view type requested by the user (either 'Mobile', 'Print', 'Web' or ''): // ('' will produce the default 'Web' output style) if (isset($_REQUEST['viewType'])) $viewType = $_REQUEST['viewType']; else $viewType = ""; // Setup an array of arrays holding URL and title information for all RSS feeds available on this page: // (appropriate tags will be included in the HTML header for every URL specified) $rssURLArray = array(); if (isset($_SESSION['user_permissions']) AND ereg("allow_rss_feeds", $_SESSION['user_permissions'])) // if the 'user_permissions' session variable contains 'allow_rss_feeds'... { $showRows = $_SESSION['userRecordsPerPage']; // get the default number of records per page preferred by the current user $rssURLArray[] = array("href" => generateURL("show.php", $defaultFeedFormat, array("where" => 'serial RLIKE ".+"'), true, $showRows), // function 'generateURL()' is defined in 'include.inc.php', variable '$defaultFeedFormat' is defined in 'ini.inc.php' "title" => "records added most recently"); $rssURLArray[] = array("href" => generateURL("show.php", $defaultFeedFormat, array("where" => 'created_date = CURDATE()'), true, $showRows), "title" => "records added today"); $rssURLArray[] = array("href" => generateURL("show.php", $defaultFeedFormat, array("where" => 'modified_date = CURDATE()'), true, $showRows), "title" => "records edited today"); } // -------------------------------------------------------------------- // Adjust the width of the right-hand column according to the calling user agent: // NOTE: strictly, this isn't really necessary but it helps to achieve a similar appearance of the login form on Firefox/Gecko & Safari/WebKit browsers (with all supported GUI languages) // TODO: figure out a better way (which isn't based on user agent sniffing); the problem could also be avoided by simply stacking fields & their labels on top of each other if (isset($_SERVER['HTTP_USER_AGENT']) AND eregi("AppleWebKit", $_SERVER['HTTP_USER_AGENT'])) $rightColumnWidth = "215"; else $rightColumnWidth = "225"; // Get the total number of records: $recordCount = getTotalNumberOfRecords(); // function 'getTotalNumberOfRecords()' is defined in 'include.inc.php' // Show the login status: showLogin(); // (function 'showLogin()' is defined in 'include.inc.php') // (4) DISPLAY header: // call the 'displayHTMLhead()' and 'showPageHeader()' functions (which are defined in 'header.inc.php'): displayHTMLhead(encodeHTML($officialDatabaseName) . " -- " . $loc["Home"], "index,follow", "Search the " . encodeHTML($officialDatabaseName), "", true, "", $viewType, $rssURLArray); showPageHeader($HeaderString); // Define variables holding common drop-down elements, i.e. build properly formatted