X-Git-Url: https://jasonwoof.com/gitweb/?p=wfpl.git;a=blobdiff_plain;f=main.php;h=eae4de9471deded93ef3954bb77e5267b7da9c9b;hp=f5be944510c45597430754b61bca164047922336;hb=062d46e16429f2e55573567518cb01c83b319ac4;hpb=fe9a487e1b5ed0700481aee4609055dc6c47505d diff --git a/main.php b/main.php index f5be944..eae4de9 100644 --- a/main.php +++ b/main.php @@ -40,7 +40,7 @@ function wfpl_main($dest = false) { # if it starts with './' then it's a relative URL, redirect if(substr($dest, 0, 2) == './') { - redirect(ereg_replace('/[^/]*$', substr($dest, 1), this_url())); + redirect(preg_replace('|/[^/]*$|', substr($dest, 1), this_url())); exit(); } @@ -49,8 +49,8 @@ function wfpl_main($dest = false) { } else { # no dest arg $basename = $_SERVER['REDIRECT_URL']; - $basename = ereg_replace('.*/', '', $basename); - $basename = ereg_replace('\.html?$', '', $basename); + $basename = preg_replace('|.*/|', '', $basename); + $basename = preg_replace('|\.html?$|', '', $basename); if($basename == '') { $basename = 'index'; } @@ -121,12 +121,12 @@ function wfpl_main($dest = false) { } # Check for $GLOBALS['wfpl_template'] because it might have been set (or unset) by the php script. - if($GLOBALS['wfpl_template'] || $GLOBALS['wfpl_main_template']) { - if($GLOBALS['wfpl_main_template']) { + if(isset($GLOBALS['wfpl_template']) || isset($GLOBALS['wfpl_main_template'])) { + if(isset($GLOBALS['wfpl_main_template'])) { # if there was a template for that page, and one for the whole # site, copy all template sections that have been show()n to the # site-wide template - if($GLOBALS['wfpl_template']) { + if(isset($GLOBALS['wfpl_template'])) { $GLOBALS['wfpl_main_template']->merge($GLOBALS['wfpl_template']); }