X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=run.php;h=3d0b1d4d5e2bbe66a7d9b7dc1a6d7bef69e349c9;hb=27f182546d729a9d297091799fcf1a1922da0c5e;hp=bbf2ce691ba71e781317be0064cc569691df4f21;hpb=de71c4c4768f8f464ff61cfda3f8e31d20d2b0b0;p=wfpl.git diff --git a/run.php b/run.php index bbf2ce6..3d0b1d4 100644 --- a/run.php +++ b/run.php @@ -54,7 +54,7 @@ if(file_exists('code/config.php')) { # pass http://foo.com/bar.html to redirect to a full directory function run_php($dest = false) { if($dest) { - # if it's got a : it must be a full URL, redirect + # if it has a : it must be a full URL, redirect if(strpos($dest, ':')) { redirect($dest); exit(); @@ -78,60 +78,22 @@ function run_php($dest = false) { } } - $GLOBALS['basename'] = $basename; - $html_file = "$basename.html"; $php_file = "$basename.php"; $html_exists = file_exists($html_file); $php_exists = file_exists($php_file); - if(file_exists('template.html')) { - $GLOBALS['wfpl_main_template'] = new tem(); - $GLOBALS['wfpl_main_template']->load("template.html"); - $GLOBALS['wfpl_main_template']->set('basename', $basename); - - # This helps put in a stylesheet link if you have pages with custom css - if(file_exists("$basename.css")) { - $GLOBALS['wfpl_main_template']->set('css_link', "$basename.css"); - $GLOBALS['wfpl_main_template']->sub('css_links'); - } - } - # cms_get can return one of: # 1) false to indicate that there's no cms content for this basename - # 2) a string to indicate a soft/full redirect just as foo_main() - # 3) a hash of key/value pairs to be tem_set(key,value) on the template - if(function_exists('cms_display')) { - $cms_content = cms_display($basename, $GLOBALS['wfpl_main_template']); + # 2) a string to request a soft/full redirect just like foo_main() + # 3) a hash of key/value pairs to be added to the template + if(function_exists('cms_get')) { + $cms_content = cms_get($basename); if(is_string($cms_content)) { run_php($cms_content); return; } - } else { - $cms_content = false; - } - - if(!$php_exists && !$html_exists && !$cms_content) { - header('HTTP/1.0 404 File Not Found'); - if(file_exists('error_404.php') || file_exists('error_404.html')) { - $GLOBALS['error_basename'] = $basename; - run_php('error_404'); - return; - } else { - echo '