Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion textpattern/lib/txplib_misc.php
Original file line number Diff line number Diff line change
Expand Up @@ -5026,7 +5026,7 @@ function txp_die($msg, $status = '503', $url = '')
if ($url && in_array($code, array(301, 302, 303, 307))) {
ob_end_clean();
header("Location: $url", true, $code);
die('<html><head><meta http-equiv="refresh" content="0;URL='.txpspecialchars($url).'"></head><body></body></html>');
die('<html><head><meta http-equiv="refresh" content="0;URL='.txpspecialchars($url).'"></head><body><p>Document has <a href="'.txpspecialchars($url).'">moved here</a>.</p></body></html>');
}

if ($connected && @txpinterface == 'public') {
Expand Down
14 changes: 5 additions & 9 deletions textpattern/lib/txplib_publish.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ function parse($thing, $condition = null)

if (isset($condition)) {
if ($production_status === 'debug') {
$trace->log("[$txp_current_tag: ".($condition ? 'true' : 'false').']');
$trace->log('['.($condition ? 'true' : 'false').']');
}
} else {
$condition = true;
Expand Down Expand Up @@ -453,10 +453,6 @@ function parse($thing, $condition = null)
}

// Auto-closing
/*
$txp_parsed[$hash] = $count[0] > 0 ? $tags[0] : false;
$txp_else[$hash] = array($else[0] > 0 ? $else[0] : $count[0] + 2, $count[0]);
*/
while ($level >= 0) {
$sha = $level ? sha1($inside[$level]) : $hash;
$count[$level] += 2;
Expand Down Expand Up @@ -492,7 +488,10 @@ function parse($thing, $condition = null)

for ($out = $tag[$first - 1]; $first <= $last; $first++) {
$t = $tag[$first];
$old_tag = $txp_current_tag;
$txp_current_tag = $t[0].$t[3].$t[4];
$out .= processTags($t[1], $t[2], $t[3]).$tag[++$first];
$txp_current_tag = $old_tag;
}

return $out;
Expand Down Expand Up @@ -538,9 +537,7 @@ function processTags($tag, $atts, $thing = null)
}

if ($production_status !== 'live') {
$old_tag = $txp_current_tag;
$txp_current_tag = '<txp:'.$tag.$atts.(isset($thing) ? '>' : '/>');
$trace->start($txp_current_tag);
$trace->start('<txp:'.$tag.$atts.(isset($thing) ? '>' : '/>'));
}

if ($registry === null) {
Expand All @@ -561,7 +558,6 @@ function processTags($tag, $atts, $thing = null)

if ($production_status !== 'live') {
$trace->stop(isset($thing) ? "</txp:{$tag}>" : null);
$txp_current_tag = $old_tag;
}

return $out;
Expand Down
25 changes: 21 additions & 4 deletions textpattern/publish/taghandlers.php
Original file line number Diff line number Diff line change
Expand Up @@ -1733,7 +1733,11 @@ function link_to_home($atts, $thing = null)

function newer($atts, $thing = null)
{
global $thispage, $pretext, $m;
global $thispage, $pretext, $m, $txp_current_tag;

if (empty($thispage)) {
return empty($pretext['secondpass']) ? $txp_current_tag : '';
}

extract(lAtts(array(
'showalways' => 0,
Expand Down Expand Up @@ -1787,7 +1791,11 @@ function newer($atts, $thing = null)

function older($atts, $thing = null)
{
global $thispage, $pretext, $m;
global $thispage, $pretext, $m, $txp_current_tag;

if (empty($thispage)) {
return empty($pretext['secondpass']) ? $txp_current_tag : '';
}

extract(lAtts(array(
'showalways' => 0,
Expand Down Expand Up @@ -3266,7 +3274,12 @@ function search_result_date($atts)

function search_result_count($atts)
{
global $thispage;
global $pretext, $thispage, $txp_current_tag;

if (empty($thispage)) {
return empty($pretext['secondpass']) ? $txp_current_tag : '';
}

$t = @$thispage['grand_total'];

extract(lAtts(array(
Expand Down Expand Up @@ -4050,12 +4063,16 @@ function if_search($atts, $thing = null)

function if_search_results($atts, $thing = null)
{
global $thispage, $pretext;
global $thispage, $pretext, $txp_current_tag;

if (empty($pretext['q'])) {
return '';
}

if (empty($thispage)) {
return empty($pretext['secondpass']) ? $txp_current_tag : '';
}

extract(lAtts(array(
'min' => 1,
'max' => 0,
Expand Down