Topic: search box problem
Why my search folders show always criterias I previusly used. I can't delete them! http://www.pasqualemarinelli.com/indexb.php?do=search
Dear CuteNews Users! Please feel free to contact us via our new Feedback Form and please send information about bugs to our bug tracker.
You are not logged in. Please login or register.
CutePHP Forums → Problem Solving / Help & Support → search box problem
Why my search folders show always criterias I previusly used. I can't delete them! http://www.pasqualemarinelli.com/indexb.php?do=search
this is my search.php page
<?php
$NotHeaders = true;
require_once ('core/init.php');
include ('core/loadenv.php');
// plugin tells us: he is fork, stop
if ( hook('fork_search', false) ) return;
// Check including
$Uri = '//'.dirname( $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
if (strpos($config_http_script_dir, $Uri) !== false && strpos($PHP_SELF, 'search.php') !== false)
die_stat(403, 'Wrong including search.php! Check manual to get more information about this issue.');
// Autodate
if ( empty($from_date_day) ) $from_date_day = intval(date('d'));
if ( empty($from_date_month) ) $from_date_month = date('m');
if ( empty($from_date_year) ) $from_date_year = 2008;
if ( empty($to_date_day) ) $to_date_day = intval(date('d', time() + 3600*24));
if ( empty($to_date_month) ) $to_date_month = date('m');
if ( empty($to_date_year) ) $to_date_year = date('Y');
$files_arch = array();
// check for bad _GET and _POST
$user_post_query = cute_query_string($QUERY_STRING, array("archives", "start_from", "archive", "subaction", "id", "cnshow", "ucat", "dosearch", "story", "title", "user", "from_date_day", "from_date_month", "from_date_year", "to_date_day", "to_date_month", "to_date_year"), "post");
$date_from = mktime(0, 0, 0, intval($from_date_month), intval($from_date_day), intval($from_date_year));
$date_to = mktime(0, 0, 0, intval($to_date_month), intval($to_date_day), intval($to_date_year));
if ( empty($search_form_hide) || isset($search_form_hide) && empty($dosearch) )
{
// Make parameters -----------------------------------------------------------------------------------------------------
list($day_from, $month_from, $year_from) = make_postponed_date($date_from);
list($day_to, $month_to, $year_to) = make_postponed_date($date_to);
$selected_search_arch = empty($archives) ? false : "checked='checked'";
$story = htmlspecialchars( urldecode($story) );
$title = htmlspecialchars( urldecode($title) );
$author = htmlspecialchars( urldecode($author) );
$hide = ($title or $author or !empty($archives) ) ? false: true;
echo proc_tpl('search');
}
// Do Search -------------------------------------------------------------------------------------------------------
if ($dosearch == "yes")
{
$mc_start = microtime(true);
// In active news anyway
$listing = array( time() => '/cdata/news.txt' );
// Also, search in archive if present (sort it)
if ( !empty($archives) )
{
$dir = read_dir(SERVDIR.'/cdata/archives');
foreach ($dir as $vs)
if (preg_match('~(d+).news.arch$~i', $vs, $c))
$listing[ $c[1] ] = $vs;
}
krsort($listing);
// Init searching
$preg_story = '.*?';
$preg_author = '.*?';
$preg_title = '.*?';
if ( !empty($story) ) $preg_story = '.*?('.preg_replace('/s/', '|', preg_sanitize($story)).').*?';
if ( !empty($user) ) $preg_author = '.*?('.preg_replace('/s/', '|', preg_sanitize($user)).').*?';
if ( !empty($title) ) $preg_title = '.*?('.preg_replace('/s/', '|', preg_sanitize($title)).').*?';
// Search in files
$found = array();
foreach ($listing as $id => $newsfile)
{
// Old archives do not touch
if ($id && ($id < $date_from) ) break;
$news = join('', file(SERVDIR . $newsfile));
$strs = '~^d+|'.$preg_author.'|'.$preg_title.'|'.$preg_story.'$~im';
if ( preg_match_all($strs, $news, $c, PREG_SET_ORDER) )
{
foreach ($c as $a => $b)
{
$item = explode("|", $b[0]);
if ($item[NEW_ID] < $date_from or $item[NEW_ID] > $date_to)
continue;
// Actually in story?
if (!preg_match("~$preg_story~i", $item[NEW_SHORT]) and !preg_match("~$preg_story~i", $item[NEW_FULL]))
continue;
$found[] = array
(
'id' => $item[NEW_ID],
'src' => $newsfile,
'title' => $item[NEW_TITLE],
'cat' => $item[NEW_CAT]
);
}
}
}
if (count($found))
{
$itemid = 0;
// Show results
foreach ($found as $i => $resline)
{
$itemid++;
if ($start_from > $itemid) continue;
$id = $resline['id'];
$title = htmlspecialchars( $resline['title'] );
$title = $config_useutf8? UTF8ToEntities( $title ) : $title;
$ucat = $resline['cat'];
$archive = 0;
if (preg_match('~(d+).news.arch$~i', $resline['src'], $arc)) $archive = $arc[1];
$URL = $PHP_SELF . build_uri('subaction,id,archive,ucat', array('showfull'));
$url = RWU( 'readmore', $URL );
echo "<div class='cutenews_search_item'>$itemid [b][url=$url]$title[/url][/b] (". date("d F, Y", $id) .")</div>";
}
echo "<p class='cutenews_founded'>[b]".lang('Post trovati')." [". count($found)."][/b] ";
echo str_replace(array('%1','%2'), array( date("d/m/Y", $date_from), date("d/m/Y", $date_to)), lang("dal [b]%1[/b] al [b]%2[/b]</p>", 'search'));
}
else echo "<div class='cutenews_not_match'>".lang('Nessun post è stato trovato')."</div>";
echo '<div class="cutenews_search_results">[i]'.lang('Ricerca effettuata in').' '.round(microtime(true) - $mc_start, 4).' s.[/i]</div>';
}
// if user wants to search
elseif ( ($misc == "search") and ($subaction == "showfull" or $subaction == "showcomments" or $_POST["subaction"] == "addcomment" or $subaction == "addcomment"))
{
require_once(SERVDIR."/show_news.php");
unset ($action, $subaction);
}
unset($search_form_hide, $dosearch);
and this is my search.tpl page:
<script type="text/javascript">
function mySelect(form) { form.select(); }
function ShowOrHide(d1, d2)
{
var i;
if (d1 != '') for(i = 1; i < d2; i++) DoDiv(d1+'_'+i);
}
function DoDiv(id)
{
var item = null;
if (document.getElementById) item = document.getElementById(id);
else if (document.all) item = document.all[id];
else if (document.layers) item = document.layers[id];
if (item.style) {
if (item.style.display == "none") item.style.display = "";
else item.style.display = "none";
} else item.visibility = "show";
}
</script>
<form method=get action="{$PHP_SELF}?subaction=search">
<input type=hidden name=dosearch value=yes>
{$user_post_query}
<table>
<tr><td align="right">Post</td><td><input type=text value="{$story}" name=story size="24"></td></tr>
<tr id="advance_1" {if $hide}style='display:none; z-index:1;{/if}'><td align="right">Titolo</td><td><input type=text value="{$title}" name=title size="24"></td></tr>
<tr id="advance_2" {if $hide}style='display:none; z-index:1;{/if}'><td align="right">Autore</td><td><input type=text value="{$user}" name=user size="24"></td></tr>
<tr id="advance_3" {if $hide}style='display:none; z-index:1;{/if}'>
<td align="right">dal</td>
<td>
<select name=from_date_day> <option value=""></option> {$day_from} </select>
<select name=from_date_month> <option value=""></option> {$month_from} </select>
<select name=from_date_year> <option value=""></option> {$year_from} </select>
</td>
</tr>
<tr id="advance_4" {if $hide} style='display:none; z-index:1;'{/if}>
<td align="right">al</td>
<td>
<select name=to_date_day> <option value=""></option> {$day_to} </select>
<select name=to_date_month> <option value=""></option> {$month_to} </select>
<select name=to_date_year> <option value=""></option> {$year_to} </select>
</td>
</tr>
<tr id="advance_5" {if $hide}style='display:none; z-index:1;'{/if}>
<td align="right">Cerca e archivia</td><td><input type=checkbox {$selected_search_arch} name="archives" value="Y"> </td>
</tr>
<tr>
<td>[url=java script:ShowOrHide(]Ricerca avanzata[/url]</td>
<td><input type=submit value=Cerca></td>
</tr>
</table>
</form>
What and how I have to modify to fix this issue? Please note that data folders show the same problem!!!
As Filou83 has explained, the problem is the include and input in indexb.php
So this is the main include:
<?php
$start_from = isset($_GET['start_from']) ? $_GET['start_from'] : 0;
$subaction = isset($_GET['subaction']) ? $_GET['subaction'] : '';
$category = "1,2,3,4,9";
$template="Default";
$number = "5";
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here we decide what page to include
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
if($_POST['do'] == "search" or $_GET['dosearch'] == "yes"){ $subaction = "search"; $dosearch = "yes"; include("./b/search.php"); }
elseif($_GET['do'] == "archives"){ include("./b/show_archives.php"); }
elseif($_GET['do'] == "search"){ include("./b/search.php"); }
elseif($_GET['do'] == "stats"){ echo"You can download the stats addon and include it here to show how many news, comments ... you have"; /* include("$path/stats.php"); */ }
else{ include("./b/show_news.php"); }
?>
and this is the side include:
<?php
$start_from = 0;
$subaction = '';
$number=5;
$template="Headlines2";
$category=9;
$static=TRUE;
include("/home/pasqu0/public_html/b/show_news.php");
?>
What I have to do?
On the page search for where you have
<input type=text value="Italia fuori dallÂ’euro"
It is where you have the search selection.
On the page search for where you have
It is where you have the search selection.
but I can't read what you say on the script (look above). I read in search.tpl this:
<input type=text value="{$title}" name=title size="24">
If you mean you just want a blank search field
Remove {$title}:
<input type=text value="" name=title size="24">
If you mean you just want a blank search field
Remove {$title}:
<input type=text value="" name=title size="24">
and about the date fields?
and about the date fields?
What do you want the date fields to show?
What do you want the date fields to show?
I want to show blank date fields. Now it isn't so, look http://www.pasqualemarinelli.com/indexb.php?do=search
I want to show blank date fields. Now it isn't so, look http://www.pasqualemarinelli.com/indexb.php?do=search
Why show blank dates? It is currently dynamic and changes to the current day and goes back 4 years. Why would you want to change it to make it more difficult for users?
Why show blank dates? It is currently dynamic and changes to the current day and goes back 4 years. Why would you want to change it to make it more difficult for users?
Maybe I could not explain very well the issue! Now date fields show dates about a previously research and they can't modify for a new research...
Maybe I could not explain very well the issue! Now date fields show dates about a previously research and they can't modify for a new research...
It works fine here. I've just changed the date to 14/11/2012, got 0 results, then changed the date to 14/11/2008, and got a list of results. The default dates are not a previous date, but they change to whatever the date is.
It works fine here. I've just changed the date to 14/11/2012, got 0 results, then changed the date to 14/11/2008, and got a list of results. The default dates are not a previous date, but they change to whatever the date is.
I've done what you had say. But:
- inserting criteria in title field it show also news that doesn't have that criteria in their title
- I noted that using latest comments script, the search is performed just about the post belonging to the categories which comments are shown (in my case: category number 9). So it let me show only the posts belong to the category number 9, and not all news.
How to fix?
I've done what you had say. But:
- inserting criteria in title field it show also news that doesn't have that criteria in their title
- I noted that using latest comments script, the search is performed just about the post belonging to the categories which comments are shown (in my case: category number 9). So it let me show only the posts belong to the category number 9, and not all news.
How to fix?
I'VE NOTED THAT LATEST COMMENTS SCRIPT IS VERY FAULTY FOR SEARCH MALFUNCTION.
Anyway, deleting letest comments script, the following problem remains:
inserting criteria in TITLE field, it show also news that doesn't have that criteria in their title
Any suggestion?
I'VE NOTED THAT LATEST COMMENTS SCRIPT IS VERY FAULTY FOR SEARCH MALFUNCTION.
Anyway, deleting letest comments script, the following problem remains:Any suggestion?
On my computer it still has Italia fuori dall’euro in the title.
On my computer it still has Italia fuori dall’euro in the title.
because I've added latest comments script in indexb.php. If I delete it, you haven't "Italia fuori dall'euro" anymore!
Anyway, I can solve the issue deleting latest comments script. Now, what I want to fix is thi problem:
- inserting criteria in TITLE and AUTHOR fields, it show also news that don't have that criteria only in their TITLE or only in the name of their AUTHOR. It seems that they work like NEWS field, because it search post have that criteria also in the text of the story...
How to fix, please?
It seems that they work like NEWS field, because it search post have that criteria also in the text of the story...
Yes, it does.
This needs to be fixed by the script author. Support_Team.
CutePHP Forums → Problem Solving / Help & Support → search box problem
Powered by PunBB, supported by Informer Technologies, Inc.
The pun_antispam official extension is installed. Copyright © 2003–2009 PunBB.