function do_pull($formatter, $params = array()) { global $Config; $pagename = $formatter->page->name; if ($formatter->refresh) { $params['refresh'] = 1; } $ret = array(); $params['retval'] =& $ret; $params['call'] = true; if (!empty($Config['pull_ignore_re']) and preg_match('/' . $Config['pull_ignore_re'] . '/i', $pagename)) { $ret['error'] = 'protected from pull'; $ret['status'] = 404; // fake } else { macro_Pull($formatter, $pagename, $params); } if (!empty($params['check'])) { echo $params['retval']['status']; return; } if (!empty($ret['error'])) { if (!empty($Config['pull_fallback']) && ($plugin = getPlugin($Config['pull_fallback']))) { // FIXME if (!function_exists('do_' . $plugin)) { include_once "plugin/{$plugin}.php"; } if (function_exists('do_' . $plugin)) { call_user_func('do_' . $plugin, $formatter, $params); } return; } echo $ret['error']; } }
function do_pull($formatter, $params = array()) { global $Config; $pagename = $formatter->page->name; if ($formatter->refresh) { $params['refresh'] = 1; } $ret = array(); $params['retval'] =& $ret; $params['call'] = true; if (!empty($Config['pull_ignore_re']) and preg_match('/' . $Config['pull_ignore_re'] . '/i', $pagename)) { $ret['error'] = 'protected from pull'; $ret['status'] = 404; // fake } else { macro_Pull($formatter, $pagename, $params); } if (!empty($params['check'])) { $status = $params['retval']['status']; if (isset($status) && $status != 304) { header('Cache-Control: public, max-age=5, s-maxage=5'); #header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); #header("Pragma: no-cache"); #header('Cache-Control: no-store, no-cache, must-revalidate', false); } else { header('Cache-Control: public, max-age=60, s-maxage=60'); } header('Content-Type: text/plain'); if (in_array($status, array(200, 404, 304))) { header('Status: ' . $status); } echo $status; return; } if (!empty($ret['error'])) { if (!empty($Config['pull_fallback']) && ($plugin = getPlugin($Config['pull_fallback']))) { // FIXME if (!function_exists('do_' . $plugin)) { include_once "plugin/{$plugin}.php"; } if (function_exists('do_' . $plugin)) { call_user_func('do_' . $plugin, $formatter, $params); } return; } $status = $ret['status']; if (isset($status) && $status != 304) { header('Cache-Control: public, max-age=5, s-maxage=5'); #header("Pragma: no-cache"); #header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); #header('Cache-Control: no-store, no-cache, must-revalidate', false); } else { header('Cache-Control: public, max-age=60, s-maxage=60'); } header('Content-Type: text/plain'); echo $ret['error']; } }