DirectoryIndex disabled
AddDefaultCharset UTF-8
RewriteEngine on
-RewriteRule ^[^/.]*$ /run.php [L]
+RewriteRule ^[^/.]*$ /config.php [L]
<FilesMatch "\.(css|jpg|png)$">
ExpiresActive On
+++ /dev/null
-Subproject commit 749be886bb4b0ebf70be13397f2279d5446cd0c8
+++ /dev/null
-<?php
-
-function cms_display($basename, &$tem) {
- if(preg_match('/([.]l(ocal)?$)|^192[.]168[.]|^127.0.0.1$|^10[.]/', $_SERVER['HTTP_HOST'])) {
- $GLOBALS['wfpl_main_template']->set('$running_locally');
- }
- $tem->set('$host', this_host());
- $nav_items = db_get_assocs('cms_pages', "coalesce(nullif(nav_title,''), title) as title,filename", 'where navbar!=0 order by navbar');
- if($nav_items) {
- foreach($nav_items as &$item) {
- $item['basename'] = $item['filename']; # for nav-links as images
- if($item['filename'] == $basename) {
- $item['current'] = true;
- }
- if($item['filename'] == 'index') {
- $item['filename'] = './';
- }
- if($item['title'] == '') {
- $item['title'] = '(untitled)';
- }
- }
- $tem->set('$navbar_items', $nav_items);
- }
-
- $cms_page_id = cms_display_content($tem, 'where filename=%"', $basename);
-
- if(logged_in_as_admin()) {
- $admin_links = array();
- if($cms_page_id) {
- $admin_links['id'] = $cms_page_id;
- }
- $tem->set('$admin_links', $admin_links);
- }
-
- if($cms_page_id) {
- return true;
- } else {
- return false;
- }
-}
-
-function cms_display_content(&$tem /*, 'where clause %", %i', string, int */) {
- $args = array_slice(func_get_args(), 1);
- $args = array_merge(array('cms_pages', 'id,title,keywords,description,content'), $args);
- $row = call_user_func_array('db_get_assoc', $args);
- if($row) {
- $tem->set('$cms_title', $row['title']);
- $tem->set('$meta_keywords', $row['keywords']);
- $tem->set('$meta_description', $row['description']);
- $tem->set('$cms_body', $row['content']);
- return $row['id'];
- }
- return false;
-}
+++ /dev/null
-<?php
-
-define('WFPL_DB', 'fixme');
-define('WFPL_DB_USER', 'fixme');
-define('WFPL_DB_PASS', 'fixme');
-# CMS login passwords are stored in the database. See admin_admins.php
-date_default_timezone_set('America/New_York');
-
-
-require_once('code/wfpl/format.php');
-require_once('code/wfpl/db.php');
-require_once('code/wfpl/session_messages.php');
-require_once('code/cms.php');
-
-db_connect(WFPL_DB, WFPL_DB_USER, WFPL_DB_PASS);
+++ /dev/null
-Subproject commit c2f95486e25b8fb95aa1b070189815487eadc276
--- /dev/null
+<?php
+
+# Settings
+define('WFPL_DB', 'fixme');
+define('WFPL_DB_USER', 'fixme');
+define('WFPL_DB_PASS', 'fixme');
+# CMS login passwords are stored in the database. See admin_admins.php
+date_default_timezone_set('America/New_York');
+
+# Enable features, auto-includes
+require_once(__DIR__.'/'.'inc/wfpl/format.php');
+require_once(__DIR__.'/'.'inc/wfpl/db.php');
+require_once(__DIR__.'/'.'inc/wfpl/session_messages.php');
+require_once(__DIR__.'/'.'inc/cms.php');
+
+# Connect to the database
+db_connect(WFPL_DB, WFPL_DB_USER, WFPL_DB_PASS);
+
+# Load the requested page (php and/or html)
+require_once(__DIR__.'/'.'inc/wfpl/main.php');
+wfpl_main();
--- /dev/null
+Subproject commit 749be886bb4b0ebf70be13397f2279d5446cd0c8
--- /dev/null
+<?php
+
+# This function (which loads the navbar and page content from the database) is
+# called automatically by wfpl_main()
+function cms_display($basename, &$tem) {
+ if(preg_match('/([.]l(ocal)?$)|^192[.]168[.]|^127.0.0.1$|^10[.]/', $_SERVER['HTTP_HOST'])) {
+ $GLOBALS['wfpl_main_template']->set('$running_locally');
+ }
+ $tem->set('$host', this_host());
+ $nav_items = db_get_assocs('cms_pages', "coalesce(nullif(nav_title,''), title) as title,filename", 'where navbar!=0 order by navbar');
+ if($nav_items) {
+ foreach($nav_items as &$item) {
+ $item['basename'] = $item['filename']; # for nav-links as images
+ if($item['filename'] == $basename) {
+ $item['current'] = true;
+ }
+ if($item['filename'] == 'index') {
+ $item['filename'] = './';
+ }
+ if($item['title'] == '') {
+ $item['title'] = '(untitled)';
+ }
+ }
+ $tem->set('$navbar_items', $nav_items);
+ }
+
+ $cms_page_id = cms_display_content($tem, 'where filename=%"', $basename);
+
+ if(logged_in_as_admin()) {
+ $admin_links = array();
+ if($cms_page_id) {
+ $admin_links['id'] = $cms_page_id;
+ }
+ $tem->set('$admin_links', $admin_links);
+ }
+
+ if($cms_page_id) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+function cms_display_content(&$tem /*, 'where clause %", %i', string, int */) {
+ $args = array_slice(func_get_args(), 1);
+ $args = array_merge(array('cms_pages', 'id,title,keywords,description,content'), $args);
+ $row = call_user_func_array('db_get_assoc', $args);
+ if($row) {
+ $tem->set('$cms_title', $row['title']);
+ $tem->set('$meta_keywords', $row['keywords']);
+ $tem->set('$meta_description', $row['description']);
+ $tem->set('$cms_body', $row['content']);
+ return $row['id'];
+ }
+ return false;
+}
--- /dev/null
+Subproject commit 23dfbcc20fc6d20fb5be211e5af50cdcb8565c8e
+++ /dev/null
-<?php
-
-require_once(__DIR__ . '/code/wfpl/run.php');