* 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/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ include("documentation.php"); /************************************************************************** * SETUP INFORMATION - THIS IS CHANGABLE DURING INITIAL SETUP OF THE SITE! ***************************************************************************/ // Basic information about the owner of the system (used in many places) { $owner_name = "Dan Jensen"; $owner_email = "admin@NOSPAMleinir.dk"; // Basic information about the owner of the system (used in many places) } // This is where the setup files are to be put { $setup_folder = "setup"; // This is where the setup files are to be put } // If this is set to true, all users can delete themselves as user { $let_users_delete_self = false; // If this is set to true, all users can delete themselves as user } // Set the default language // Values are standard ISO two-letter language definitions // // For example: // en = English // dk = Danish // de = German // es = Spanish $default_language = "en"; /************************************************************************** * SETUP INFORMATION ENDS HERE - NO USER SETUP BELLOW THIS POINT! ***************************************************************************/ // Script execution timer start { $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; // Script execution timer start } // Bad form, but it's needed for the thumbnailer to work with largeish pictures ini_set( "memory_limit","64M" ); ini_set( "date.timezone", "UTC" ); // Set the language $language = ""; if(array_key_exists("language", $_REQUEST)) { $language = $_REQUEST['language']; } if ($language == "") $language = $default_language; // Define variables determining where stuff goes... { $password_file = "$setup_folder/password.txt"; $recent_file = "$setup_folder/recent_pages.txt"; $page_folder = "$setup_folder/pages"; $menu_folder = "$setup_folder/menus"; $module_folder = "$setup_folder/modules"; $files_folder = "$setup_folder/files"; $userinfo_folder = "$setup_folder/userinfo"; // Define variables determining where stuff goes... } //Setup folders must exist /* This does not, for some reason, work on some servers... (Security issues I suppose...) if (!file_exists($setup_folder)) mkdir($setup_folder,0777); if (!file_exists($page_folder)) mkdir($page_folder,0777); if (!file_exists($menu_folder)) mkdir($menu_folder,0777); if (!file_exists($files_folder)) mkdir($files_folder,0777); touch($recent_file); */ // Update scripts { //include("update.php"); //updateTo020(); //updateTo030(); // Update scripts } //The person who made the system $creator_name = "Dan Jensen"; $creator_email = "admin@NOSPAMleinir.dk"; //$usergroups_global_default = ""; // Set the system options defaults, then include them system options $systemOptions = array( "locked" => 0, "timeformat" => "M j Y G:i", "rewrite" => 0, "humanurls" => 0, "permissionmessages" => 1 ); if( file_exists( "$setup_folder/systemOptions.php" ) ) include( "$setup_folder/systemOptions.php" ); if( ! array_key_exists( "permissionmessages", $systemOptions ) ) $systemOptions["permissionmessages"] = 1; // A bunch of shared functions, also loads profile options include("shared.php"); // Internationalisation stuff include("i18n-functions.php"); include("i18n.php"); include("page.class.php"); // Page functions $pagectl = new Page; // Create a page control to work with // Get list of recently changed pages include("recentchanges.php"); // Get list over theme names and folders include("theme_list.php"); // Authentication subsystem include("auth.php"); if (array_key_exists("logout", $_REQUEST) && $_REQUEST["logout"] == "true") unauth(); $usermanager = new Userman; if ((array_key_exists("username", $_REQUEST) && $_REQUEST["username"] != "") && $_REQUEST["password"] != "" && !$_REQUEST["new_user"] && $_REQUEST["logout"] != "true") { auth($_REQUEST['username'], $_REQUEST['password']); } else { auth(); } // Comments handling functionality include("comment_handler.php"); // Messaging and subscription subsystem include "messages.php"; $subscriptions = new subscriptionsManager; // Get the current page_id and get the data that goes with it { $page_id = ""; if(array_key_exists("page_id", $_REQUEST)) { $page_id = $_REQUEST["page_id"]; } if(!$page_id){ //If we didn't get a page_id if( array_key_exists("page", $_REQUEST) ) //if $page is present $page_id = getpage_id($setup_folder, $_REQUEST["page"]); //get $page_id by backtracing the $page else if( array_key_exists("globalID", $_REQUEST) ) // If we have a global ID { $globalID = $_REQUEST["globalID"]; $page_id = handleGlobalID(); } else $page_id = 0; } // Get the current page_id and get the data that goes with it } // Are we adding a new user, or is this a user profile? { if (array_key_exists("user_id", $_REQUEST) && $_REQUEST["user_id"] != "") $page_id = 13; if (array_key_exists("new_user", $_REQUEST) && $_REQUEST["new_user"]) header("Location: " . globalIDtoURL("user/" . i18n("username") . "/new") ); // Are we adding a new user, or is this a user profile? } // Language links // Needs to be here (we need the page_id, and we don't have that before now) include("languagelinks.php"); // Formatting toolbar used for editing page data. include("formattingtoolbar.php"); /****************************************************************************** * Figure out which page we are showing and present the user with the result! * ******************************************************************************/ if ($page_id > 99) { // Specific pages created by the user $page_temp = $pagectl->fetchPageData($page_id, $language, $page_folder); $page_author = $page_temp["author"]; $page_author_email = $page_temp["email"]; $page_menu = $page_temp["menu"]; $page_date = $page_temp["date"]; $page_title = $page_temp["title"]; if ((array_key_exists("username", $_REQUEST) && $_REQUEST['username'] != "" && $_REQUEST['password'] != "") && !auth($_REQUEST['username'], $_REQUEST['password'])) { $page_content = "

" . i18n("You have reached a restricted area of the website. If you are allowed to view this part of the site, please log in below.") . "

" . loginform($language, globalIDtoURL("content/$language/" . $page_temp["title"])); } else if (isAllowed("menu_" . $page_menu . "_view")) { $page_content = $page_temp["content"]; //only parse the page content if it isn't already html if (!strpos($page_content, "<") === true) $page_content = parse_page_data($page_content); } else $page_content = "

" . i18n("You have reached a restricted area of the website. If you are allowed to view this part of the site, please log in below.") . "

" . loginform($language, globalIDtoURL("content/$language/" . $page_temp["title"])); } else if (is_array($page_id)) {//this means that the search for pages returned more than one $page_id, and that it is now an array. $page_author = $owner_name; $page_author_email = $owner_email; $page_menu = 0; $page_date = formatTime( time() ); $page_title = i18n("Found pages"); $page_content = "

" . i18n("The following pages were found with a title which includes "##0##". Click on any of them to see the entire contents.", array($_REQUEST['page'])) . "

\n\n
"; if( isauth() ) $page_content .= "\n

" . i18n("Click here to make a new page with this title") . ".

"; } else { /*List of $page_ids 0 = Front page 1 = About the system, and who has made it 2 = Tag wall 3 = Site setup (links to editing pages, menu menus, users, themes) 4 = User setup (make, delete users, change password) 5 = Manage pages (delete, update $page-to-$page_id backwards lookup index (setup/page_backwards.txt)) 6 = Edit page (include $edit_id (or an $edit_title for creating a new). Update recentchanges.php on exit (rotate_recent($new_id) function in recentchanges.php) 7 = Manage the menu menus 8 = Edit $menu_menu (include $menu_id) 9 = Theme management 10 = List of all pages 11 = File management (downloads...) 12 = Module setup 13 = Profile 14 = Help 15 = Request password 16 = System options 17 = Updates */ switch( $page_id ) { case 0: include ("frontpage.php"); if ((array_key_exists("username", $_REQUEST) && $_REQUEST['username'] != "" && $_REQUEST['password'] != "") && !auth($_REQUEST['username'], $_REQUEST['password'])) { $page_content = "

" . i18n("Access to this website is restricted. If you are allowed to view this site, please log in below.") . "

" . loginform($language, globalIDtoURL("content/$language/0") ); } else if (isAllowed("global_frontpage_view")) { //only parse the page content if it isn't already html if (!strpos($page_content, "<") === true) $page_content = parse_page_data($page_content); } else $page_content = "

" . i18n("Access to this website is restricted. If you are allowed to view this site, please log in below.") . "

" . loginform($language, globalIDtoURL("content/$language/0") ); break; case 1: include ("about.php"); break; case 2: include ("tagwall.php"); break; case 3: include ("setup.php"); break; case 4: include ("usersetup.php"); break; case 5: include ("pagesetup.php"); break; case 6: include ("pageedit.php"); break; case 7: include ("menusetup.php"); break; case 8: include ("menuedit.php"); break; case 9: include ("themesetup.php"); break; case 10: include ("allpages.php"); break; case 11: include ("filesetup.php"); break; case 12: include ("modulesetup.php"); break; case 13: include ("profiles.php"); break; case 14: $_REQUEST["theme"] = "empty"; $page_title = i18n("Page Layout Help"); $page_content = "" . i18n("Page Layout Help") . "

" . i18n("Page Layout Help") . "

" . generate_pagehelp() . ""; break; case 15: include ("requestpassword.php"); break; case 16: include ("systemoptions.php"); break; case 17: include ("subscriptionupdates.php"); break; case -1: $page_author = $owner_name; $page_author_email = $owner_email; $page_title = htmlspecialchars($_REQUEST["page"]); $page_menu = 0; if( !isauth() ) $page_content = parse_page_data(i18n("The page (##0##) was not found on the system. Please return to the ((Front page)) and try again.", array($page_title))); else $page_content = parse_page_data(i18n("The page (##0##) was not found on the system. Please return to the ((Front page)) and try again.", array($page_title)) . "
" . i18n("Click here to make a new page with this title") . ""); $page_date = formatTime( time() ); break; default: //Something is broken, this should NEVER happen! $page_title = "THIS SHOULD NOT HAPPEN!!"; } } //Theming is the last thing to be done include("theming.php"); // Script execution timer end { $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $endtime = $mtime; $totaltime = ($endtime - $starttime); // echo "
This page was created in ".$totaltime." seconds
"; // Script execution timer end } ?>