зеркало из https://github.com/mozilla/pjs.git
Search modifications.
This commit is contained in:
Родитель
5129662272
Коммит
9328a8c8e2
|
@ -9,7 +9,6 @@
|
|||
// Array to store clean inputs.
|
||||
$clean = array();
|
||||
$sql = array();
|
||||
$html = array();
|
||||
|
||||
// Category.
|
||||
if (isset($_GET['cat'])&&ctype_alpha($_GET['cat'])) {
|
||||
|
@ -49,13 +48,12 @@ if (isset($_GET['sort'])&&ctype_alpha($_GET['sort'])) {
|
|||
}
|
||||
|
||||
// Query.
|
||||
if (isset($_GET['q'])&&preg_match("/^[a-zA-Z0-9'\.-]*$/",$_GET['q'])) {
|
||||
if (isset($_GET['q'])&&preg_match("/[a-zA-Z0-9'\.-]*/",$_GET['q'])) {
|
||||
$clean['q'] = $_GET['q'];
|
||||
}
|
||||
|
||||
// Prepared verified inputs for their destinations.
|
||||
foreach ($clean as $key=>$val) {
|
||||
$html[$key] = strip_tags(htmlentities($val));
|
||||
$sql[$key] = mysql_real_escape_string($val);
|
||||
}
|
||||
|
||||
|
@ -63,10 +61,15 @@ foreach ($clean as $key=>$val) {
|
|||
|
||||
$tpl->assign(
|
||||
array(
|
||||
'content' =>'search.tpl',
|
||||
'title' =>'Search',
|
||||
'clean' => $clean,
|
||||
'content' => 'search.tpl',
|
||||
'title' => 'Search',
|
||||
)
|
||||
);
|
||||
|
||||
$wrapper = 'inc/wrappers/nonav.tpl';
|
||||
|
||||
echo '<pre>';
|
||||
print_r($clean);
|
||||
echo '</pre>';
|
||||
?>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<form id="search-side" action="{$smarty.server.PHP_SELF}" method="get">
|
||||
|
||||
<input type="text" name="q">
|
||||
<input type="text" name="q" value="{$clean[q]}">
|
||||
<input type="submit" value="Search"><br><br>
|
||||
|
||||
<fieldset>
|
||||
|
@ -82,6 +82,7 @@
|
|||
<!-- end side -->
|
||||
|
||||
<div id="mainContent">
|
||||
|
||||
<h2>Addon Search</h2>
|
||||
{if $results}
|
||||
{else}
|
||||
|
@ -89,4 +90,5 @@
|
|||
{/if}
|
||||
|
||||
</div>
|
||||
<!-- end mainContent -->
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче