From: garvinhicking Date: Fri, 17 Feb 2006 10:05:15 +0000 (+0000) Subject: Make plugins be able to define 'NO_EXIT' and thus not bypass embedded blogs. X-Git-Tag: 1.0~87 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=d2a98331774c5ebfcc679bab746a5123e9d86dd2;p=s9y.git Make plugins be able to define 'NO_EXIT' and thus not bypass embedded blogs. --- diff --git a/index.php b/index.php index 424a73a..62075ff 100644 --- a/index.php +++ b/index.php @@ -123,12 +123,12 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range $serendipity['GET']['action'] = null; $serendipity['GET']['hidefooter'] = null; } - + switch($serendipity['calendar']) { case 'gregorian': default: $gday = 1; - + if ($week) { $tm = strtotime('+ '. ($week-2) .' WEEKS monday', mktime(0, 0, 0, 1, 1, $year)); $ts = mktime(0, 0, 0, date('m', $tm), date('j', $tm), $year); @@ -149,7 +149,7 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range } } break; - + case 'jalali-utf8': require_once S9Y_INCLUDE_PATH . 'include/functions_calendars.inc.php'; $gday = 1; @@ -158,11 +158,11 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range $week *= 7; ++$week; $day = $week; - + // convert day number of year to day number of month AND month number of year $j_days_in_month = array(0, 31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29); if(($g_y % 4) == 3) $j_days_in_month[12]++; - + for($i=1; isset($j_days_in_month[$i]); ++$i){ if(($day-$j_days_in_month[$i])>0){ $day -= $j_days_in_month[$i]; @@ -170,7 +170,7 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range break; } } - + $tm = jalali_mktime(0, 0, 0, $i, $day, $year); $ts = jalali_mktime(0, 0, 0, jalali_date_utf('m', $tm), jalali_date_utf('j', $tm), $year); $te = jalali_mktime(23, 59, 59, jalali_date_utf('m', $tm), jalali_date_utf('j', $tm)+7, $year); @@ -189,7 +189,7 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range $date = serendipity_formatTime('%B %Y', $ts, false); } } - + list($year, $month, $day) = j2g ($year, $month, $day); break; } @@ -287,7 +287,7 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range } } } - + ob_start(); include_once(S9Y_INCLUDE_PATH . 'rss.php'); $data = ob_get_contents(); @@ -331,7 +331,9 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php'); } else if (preg_match(PAT_PLUGIN, $uri, $matches)) { serendipity_plugin_api::hook_event('external_plugin', $matches[2]); - exit; + if (!defined('NO_EXIT')) { + exit; + } } else if ($is_multicat || preg_match(PAT_PERMALINK_CATEGORIES, $uri, $matches)) { if ($is_multicat) { @@ -458,16 +460,18 @@ if ($track_referer) { serendipity_track_referrer(); } -$raw_data = ob_get_contents(); -ob_end_clean(); -$serendipity['smarty']->assign('raw_data', $raw_data); -if (empty($serendipity['smarty_file'])) { - $serendipity['smarty_file'] = '404.tpl'; -} +if (!defined('NO_EXIT')) { + $raw_data = ob_get_contents(); + ob_end_clean(); + $serendipity['smarty']->assign('raw_data', $raw_data); + if (empty($serendipity['smarty_file'])) { + $serendipity['smarty_file'] = '404.tpl'; + } -serendipity_gzCompression(); + serendipity_gzCompression(); -$serendipity['smarty']->display(serendipity_getTemplateFile($serendipity['smarty_file'], 'serendipityPath')); + $serendipity['smarty']->display(serendipity_getTemplateFile($serendipity['smarty_file'], 'serendipityPath')); +} if ($global_debug) { /* TODO: Remove (hide) this debug */