function textpattern() { global $pretext, $microstart, $prefs, $qcount, $qtime, $production_status, $txptrace, $siteurl, $has_article_tag; $has_article_tag = false; callback_event('textpattern'); if ($pretext['status'] == '404') { txp_die(gTxt('404_not_found'), '404'); } if ($pretext['status'] == '410') { txp_die(gTxt('410_gone'), '410'); } $html = safe_field('user_html', 'txp_page', "name='" . doSlash($pretext['page']) . "'"); if (!$html) { txp_die(gTxt('unknown_section'), '404'); } // useful for clean urls with error-handlers txp_status_header('200 OK'); trace_add('[' . gTxt('page') . ': ' . $pretext['page'] . ']'); set_error_handler("tagErrorHandler"); $pretext['secondpass'] = false; $html = parse($html); $pretext['secondpass'] = true; trace_add('[ ~~~ ' . gTxt('secondpass') . ' ~~~ ]'); $html = parse($html); // the function so nice, he ran it twice if ($prefs['allow_page_php_scripting']) { $html = evalString($html); } // make sure the page has an article tag if necessary if (!$has_article_tag and $production_status != 'live' and (!empty($pretext['id']) or !empty($pretext['c']) or !empty($pretext['q']) or !empty($pretext['pg']))) { trigger_error(gTxt('missing_article_tag', array('{page}' => $pretext['page']))); } restore_error_handler(); header("Content-type: text/html; charset=utf-8"); echo $html; if (in_array($production_status, array('debug', 'testing'))) { $microdiff = getmicrotime() - $microstart; echo n, comment('Runtime: ' . substr($microdiff, 0, 6)); echo n, comment('Query time: ' . sprintf('%02.6f', $qtime)); echo n, comment('Queries: ' . $qcount); echo maxMemUsage('end of textpattern()', 1); if (!empty($txptrace) and is_array($txptrace)) { echo n, comment('txp tag trace: ' . n . str_replace('--', '­­', join(n, $txptrace)) . n); } // '­­' is *no* tribute to Kajagoogoo, but an attempt to avoid prematurely terminating HTML comments } callback_event('textpattern_end'); }
function textpattern() { global $pretext, $microstart, $prefs, $qcount, $production_status, $txptrace, $siteurl; callback_event('textpattern'); if ($pretext['status'] == '404') { txp_die(gTxt('404_not_found'), '404'); } $html = safe_field('user_html', 'txp_page', "name='" . doSlash($pretext['page']) . "'"); if (!$html) { txp_die(gTxt('unknown_section'), '404'); } set_error_handler("tagErrorHandler"); $GLOBALS['pretext']['secondpass'] = false; $html = parse($html); $GLOBALS['pretext']['secondpass'] = true; $GLOBALS['txptrace'][] = " secondpass \r\n"; $html = parse($html); // the function so nice, he ran it twice restore_error_handler(); $html = $prefs['allow_page_php_scripting'] ? evalString($html) : $html; header("Content-type: text/html; charset=utf-8"); echo $html; if (in_array($production_status, array('debug', 'testing'))) { $microdiff = getmicrotime() - $microstart; echo n, comment('Runtime: ' . substr($microdiff, 0, 6)); echo n, comment('Queries: ' . $qcount); echo maxMemUsage('end of textpattern()', 1); if (!empty($txptrace) and is_array($txptrace)) { echo n, comment('txp tag trace: ' . n . join(n, $txptrace) . n); } } }
function textpattern() { global $pretext, $microstart, $txpac; $segment = gps('segment'); extract($pretext); $html = safe_field('user_html', 'txp_page', "name='{$page}'"); if (!$html) { exit('no page template specified for section ' . $s); } $html = parse($html); $html = parse($html); $html = !$segment ? $html : segmentPage($html); $html = $txpac['allow_page_php_scripting'] ? evalString($html) : $html; header("Content-type: text/html; charset=utf-8"); echo $html; $microdiff = getmicrotime() - $microstart; echo n, comment('Runtime: ' . substr($microdiff, 0, 6)); }
function textpattern() { global $pretext, $microstart, $prefs, $qcount, $production_status, $txptrace; $segment = gps('segment'); extract($pretext); $html = safe_field('user_html', 'txp_page', "name='{$page}'"); if (!$html) { exit(gTxt('unknown_section') . ' ' . $s); } $html = parse($html); $html = parse($html); // the function so nice, he ran it twice $html = !$segment ? $html : segmentPage($html); $html = $prefs['allow_page_php_scripting'] ? evalString($html) : $html; header("Content-type: text/html; charset=utf-8"); echo $html; if (in_array($production_status, array('debug', 'testing'))) { $microdiff = getmicrotime() - $microstart; echo n, comment('Runtime: ' . substr($microdiff, 0, 6)); echo n, comment('Queries: ' . $qcount); echo maxMemUsage('end of textpattern()', 1); if (!empty($txptrace) and is_array($txptrace)) { echo n, comment('txp tag trace: ' . n . join(n, $txptrace) . n); } } }
function textpattern() { global $pretext, $microstart, $prefs, $qcount, $production_status, $txptrace, $siteurl; $segment = gps('segment'); extract($pretext); callback_event('textpattern'); if ($pretext['status'] == '404') { txp_die(gTxt('404_not_found') . br . br . tag($siteurl, 'a', ' href="http://' . $siteurl . '"'), '404 Not Found'); } $html = safe_field('user_html', 'txp_page', "name='" . doSlash($page) . "'"); if (!$html) { txp_die(gTxt('unknown_section') . ' ' . $s . br . br . tag($siteurl, 'a', ' href="http://' . $siteurl . '"'), '404 Not Found'); } $html = parse($html); $html = parse($html); // the function so nice, he ran it twice $html = !$segment ? $html : segmentPage($html); $html = $prefs['allow_page_php_scripting'] ? evalString($html) : $html; header("Content-type: text/html; charset=utf-8"); echo $html; if (in_array($production_status, array('debug', 'testing'))) { $microdiff = getmicrotime() - $microstart; echo n, comment('Runtime: ' . substr($microdiff, 0, 6)); echo n, comment('Queries: ' . $qcount); echo maxMemUsage('end of textpattern()', 1); if (!empty($txptrace) and is_array($txptrace)) { echo n, comment('txp tag trace: ' . n . join(n, $txptrace) . n); } } }