Skip to content

Commit

Permalink
Migrate crumbs to a function
Browse files Browse the repository at this point in the history
  • Loading branch information
Quy committed Feb 22, 2019
1 parent f82e65d commit 51b3f7a
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions search.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -500,9 +500,9 @@
if ($search_type[0] == 'action') if ($search_type[0] == 'action')
{ {
if ($search_type[1] == 'show_user_topics') if ($search_type[1] == 'show_user_topics')
$crumbs_text['search_type'] = '<a href="search.php?action=show_user_topics&amp;user_id='.$search_type[2].'">'.sprintf($lang_search['Quick search show_user_topics'], pun_htmlspecialchars($search_set[0]['poster'])).'</a>'; $crumbs_text['search_type'] = array(sprintf($lang_search['Quick search show_user_topics'], pun_htmlspecialchars($search_set[0]['poster'])), 'search.php?action=show_user_topics&amp;user_id='.$search_type[2]);
else if ($search_type[1] == 'show_user_posts') else if ($search_type[1] == 'show_user_posts')
$crumbs_text['search_type'] = '<a href="search.php?action=show_user_posts&amp;user_id='.$search_type[2].'">'.sprintf($lang_search['Quick search show_user_posts'], pun_htmlspecialchars($search_set[0]['pposter'])).'</a>'; $crumbs_text['search_type'] = array(sprintf($lang_search['Quick search show_user_posts'], pun_htmlspecialchars($search_set[0]['pposter'])), 'search.php?action=show_user_posts&amp;user_id='.$search_type[2]);
else if ($search_type[1] == 'show_subscriptions') else if ($search_type[1] == 'show_subscriptions')
{ {
// Fetch username of subscriber // Fetch username of subscriber
Expand All @@ -514,10 +514,10 @@
else else
message($lang_common['Bad request'], false, '404 Not Found'); message($lang_common['Bad request'], false, '404 Not Found');


$crumbs_text['search_type'] = '<a href="search.php?action=show_subscriptions&amp;user_id='.$subscriber_id.'">'.sprintf($lang_search['Quick search show_subscriptions'], pun_htmlspecialchars($subscriber_name)).'</a>'; $crumbs_text['search_type'] = array(sprintf($lang_search['Quick search show_subscriptions'], pun_htmlspecialchars($subscriber_name)), 'search.php?action=show_subscriptions&amp;user_id='.$subscriber_id);
} }
else else
$crumbs_text['search_type'] = '<a href="search.php?action='.$search_type[1].'">'.$lang_search['Quick search '.$search_type[1]].'</a>'; $crumbs_text['search_type'] = array($lang_search['Quick search '.$search_type[1]], 'search.php?action='.$search_type[1]);
} }
else else
{ {
Expand All @@ -539,21 +539,23 @@
$crumbs_text['search_type'] = sprintf($lang_search['By user show as '.$show_as], pun_htmlspecialchars($author)); $crumbs_text['search_type'] = sprintf($lang_search['By user show as '.$show_as], pun_htmlspecialchars($author));
} }


$crumbs_text['search_type'] = '<a href="search.php?action=search&amp;keywords='.urlencode($keywords).'&amp;author='.urlencode($author).'&amp;forums='.$search_type[2].'&amp;search_in='.$search_type[3].'&amp;sort_by='.$sort_by.'&amp;sort_dir='.$sort_dir.'&amp;show_as='.$show_as.'">'.$crumbs_text['search_type'].'</a>'; $crumbs_text['search_type'] = array($crumbs_text['search_type'], 'search.php?action=search&amp;keywords='.urlencode($keywords).'&amp;author='.urlencode($author).'&amp;forums='.$search_type[2].'&amp;search_in='.$search_type[3].'&amp;sort_by='.$sort_by.'&amp;sort_dir='.$sort_dir.'&amp;show_as='.$show_as);
} }


$crumbs = generate_crumbs(array(
array($lang_common['Index'], 'index.php'),
array($crumbs_text['show_as'], 'search.php'),
$crumbs_text['search_type'],
));

$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_search['Search results']); $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_search['Search results']);
define('PUN_ACTIVE_PAGE', 'search'); define('PUN_ACTIVE_PAGE', 'search');
require PUN_ROOT.'header.php'; require PUN_ROOT.'header.php';


?> ?>
<div class="linkst"> <div class="linkst">
<div class="inbox crumbsplus"> <div class="inbox crumbsplus">
<ul class="crumbs"> <?php echo $crumbs ?>
<li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li>
<li><span>»&#160;</span><a href="search.php"><?php echo $crumbs_text['show_as'] ?></a></li>
<li><span>»&#160;</span><strong><?php echo $crumbs_text['search_type'] ?></strong></li>
</ul>
<div class="pagepost"> <div class="pagepost">
<p class="pagelink"><?php echo $paging_links ?></p> <p class="pagelink"><?php echo $paging_links ?></p>
</div> </div>
Expand Down Expand Up @@ -750,11 +752,7 @@
<div class="pagepost"> <div class="pagepost">
<p class="pagelink"><?php echo $paging_links ?></p> <p class="pagelink"><?php echo $paging_links ?></p>
</div> </div>
<ul class="crumbs"> <?php echo $crumbs ?>
<li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li>
<li><span>»&#160;</span><a href="search.php"><?php echo $crumbs_text['show_as'] ?></a></li>
<li><span>»&#160;</span><strong><?php echo $crumbs_text['search_type'] ?></strong></li>
</ul>
<?php echo (!empty($forum_actions) ? "\t\t".'<p class="subscribelink clearb">'.implode(' - ', $forum_actions).'</p>'."\n" : '') ?> <?php echo (!empty($forum_actions) ? "\t\t".'<p class="subscribelink clearb">'.implode(' - ', $forum_actions).'</p>'."\n" : '') ?>
<div class="clearer"></div> <div class="clearer"></div>
</div> </div>
Expand Down

0 comments on commit 51b3f7a

Please sign in to comment.