diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/comanche.php | 66 | ||||
-rw-r--r-- | include/dir_fns.php | 26 | ||||
-rw-r--r-- | include/widgets.php | 3 |
3 files changed, 59 insertions, 36 deletions
diff --git a/include/comanche.php b/include/comanche.php index e8d3ca5a1..1ddabb693 100644 --- a/include/comanche.php +++ b/include/comanche.php @@ -43,7 +43,7 @@ function pdl_selector($uid, $current="") { -function comanche_parser(&$a, $s) { +function comanche_parser(&$a, $s, $pass = 0) { $matches = array(); $cnt = preg_match_all("/\[comment\](.*?)\[\/comment\]/ism", $s, $matches, PREG_SET_ORDER); @@ -53,43 +53,47 @@ function comanche_parser(&$a, $s) { } } - $cnt = preg_match("/\[layout\](.*?)\[\/layout\]/ism", $s, $matches); - if($cnt) - $a->page['template'] = trim($matches[1]); + if($pass == 0) { + $cnt = preg_match("/\[layout\](.*?)\[\/layout\]/ism", $s, $matches); + if($cnt) + $a->page['template'] = trim($matches[1]); - $cnt = preg_match("/\[template=(.*?)\](.*?)\[\/template\]/ism", $s, $matches); - if($cnt) { - $a->page['template'] = trim($matches[2]); - $a->page['template_style'] = trim($matches[2]) . '_' . $matches[1]; - } + $cnt = preg_match("/\[template=(.*?)\](.*?)\[\/template\]/ism", $s, $matches); + if($cnt) { + $a->page['template'] = trim($matches[2]); + $a->page['template_style'] = trim($matches[2]) . '_' . $matches[1]; + } - $cnt = preg_match("/\[template\](.*?)\[\/template\]/ism", $s, $matches); - if($cnt) { - $a->page['template'] = trim($matches[1]); - } + $cnt = preg_match("/\[template\](.*?)\[\/template\]/ism", $s, $matches); + if($cnt) { + $a->page['template'] = trim($matches[1]); + } - $cnt = preg_match("/\[theme=(.*?)\](.*?)\[\/theme\]/ism", $s, $matches); - if($cnt) { - $a->layout['schema'] = trim($matches[1]); - $a->layout['theme'] = trim($matches[2]); - } + $cnt = preg_match("/\[theme=(.*?)\](.*?)\[\/theme\]/ism", $s, $matches); + if($cnt) { + $a->layout['schema'] = trim($matches[1]); + $a->layout['theme'] = trim($matches[2]); + } - $cnt = preg_match("/\[theme\](.*?)\[\/theme\]/ism", $s, $matches); - if($cnt) - $a->layout['theme'] = trim($matches[1]); + $cnt = preg_match("/\[theme\](.*?)\[\/theme\]/ism", $s, $matches); + if($cnt) + $a->layout['theme'] = trim($matches[1]); - $cnt = preg_match_all("/\[region=(.*?)\](.*?)\[\/region\]/ism", $s, $matches, PREG_SET_ORDER); - if($cnt) { - foreach($matches as $mtch) { - $a->layout['region_' . $mtch[1]] = comanche_region($a,$mtch[2]); - } } + else { + $cnt = preg_match_all("/\[region=(.*?)\](.*?)\[\/region\]/ism", $s, $matches, PREG_SET_ORDER); + if($cnt) { + foreach($matches as $mtch) { + $a->layout['region_' . $mtch[1]] = comanche_region($a,$mtch[2]); + } + } - $cnt = preg_match_all("/\[webpage\](.*?)\[\/webpage\]/ism", $s, $matches, PREG_SET_ORDER); - if($cnt) { - // only the last webpage definition is used if there is more than one - foreach($matches as $mtch) { - $a->layout['webpage'] = comanche_webpage($a,$mtch[1]); + $cnt = preg_match_all("/\[webpage\](.*?)\[\/webpage\]/ism", $s, $matches, PREG_SET_ORDER); + if($cnt) { + // only the last webpage definition is used if there is more than one + foreach($matches as $mtch) { + $a->layout['webpage'] = comanche_webpage($a,$mtch[1]); + } } } diff --git a/include/dir_fns.php b/include/dir_fns.php index 37a7c04e7..468e28ae5 100644 --- a/include/dir_fns.php +++ b/include/dir_fns.php @@ -74,7 +74,26 @@ function check_upstream_directory() { function dir_sort_links() { - // Build urls without order and pubforums so it's easy to tack on the changed value + $safe_mode = 1; + + $observer = get_observer_hash(); + + if ($observer) + $safe_mode = get_xconfig($observer,'directory','safe_mode'); + if($safe_mode === false) + $safe_mode = 1; + + if(! $safe_mode) + $toggle = t('Enable Safe Search'); + else + $toggle = t('Disable Safe Search'); + + if($observer) + $globaldir = get_xconfig($observer,'directory','globaldir'); + else + $globaldir = ((array_key_exists('globaldir',$_SESSION)) ? intval($_SESSION['globaldir']) : false); + + // Build urls without order and pubforums so it's easy to tack on the changed value // Probably there's an easier way to do this $current_order = (($_REQUEST['order']) ? $_REQUEST['order'] : 'normal'); @@ -104,7 +123,10 @@ function dir_sort_links() { '$selected_sort' => $current_order, '$sorturl' => $sorturl, '$forumsurl' => $forumsurl, - + '$safemode' => t('Safe Mode'), + '$toggle' => $toggle, + '$globaldir' => $globaldir, + '$localdir' => t('This Website Only'), )); return $o; } diff --git a/include/widgets.php b/include/widgets.php index fbbc74224..17c740967 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -605,9 +605,6 @@ function widget_vcard($arr) { * The following directory widgets are only useful on the directory page */ -function widget_dirsafemode($arr) { - return dir_safe_mode(); -} function widget_dirsort($arr) { return dir_sort_links(); |