"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/lib_search.php3" between
mythreads-links_1.2.0.tar.gz and mythreads-links_1.2.1.tar.gz

About: MyThreads-Links is a web based links manager (using PHP and MySQL).

lib_search.php3  (mythreads-links_1.2.0):lib_search.php3  (mythreads-links_1.2.1)
<? <?
#-----------------------------------------------------------------> #----------------------------------------------------------------->
# $Id: lib_search.php3,v 1.33 2012/03/06 08:26:46 ldrolez Exp $ # $Id: lib_search.php3,v 1.34 2016/06/26 09:20:51 ldrolez Exp $
# #
# Website: http://mythreads.sourceforge.net # Website: http://mythreads.sourceforge.net
# #
# Desc: lib_search.php3. all the search functions...... # Desc: lib_search.php3. all the search functions......
# #
# #
# License: This code is released under the terms of the GNU GPL # License: This code is released under the terms of the GNU GPL
# version 2 or later. Please refer to www.gnu.org for a copy # version 2 or later. Please refer to www.gnu.org for a copy
# of this license. # of this license.
# #
skipping to change at line 53 skipping to change at line 53
$content = $tpl->subst("prevnext"); $content = $tpl->subst("prevnext");
return $content; return $content;
} }
# search function # search function
function Search($search,$view) function Search($search,$view)
{ {
global $tpl; global $tpl;
global $config, $nomore, $view_start, $start_script, $start_script_t, $up date_link; global $config, $nomore, $view_start, $start_script, $start_script_t, $up date_link;
global $custom, $buttons; global $custom, $buttons, $mylink;
$enc_search = urlencode("$search"); $enc_search = urlencode("$search");
$search = htmlspecialchars("$search"); $search = htmlspecialchars("$search");
# find which fields to search : text fields # find which fields to search : text fields
$fields = array( "title", "message" ); $fields = array( "title", "message" );
while(list($f,$type) = each($custom)) { while(list($f,$type) = each($custom)) {
if ($type == "text") { if ($type == "text") {
$fields[] = $f; $fields[] = $f;
} }
skipping to change at line 104 skipping to change at line 104
$sqlcommand .= ") AND status=0"; $sqlcommand .= ") AND status=0";
# $view hold the from for LIMIT. Must not be 0 # $view hold the from for LIMIT. Must not be 0
if (! isset($view)){ $view='0';} if (! isset($view)){ $view='0';}
$view_start = $view; $view_start = $view;
$view_stop = $view + $config["max_displayed_links"]; $view_stop = $view + $config["max_displayed_links"];
######### #########
# count how many and not go over the max... # count how many and not go over the max...
$af = mysql_query("SELECT COUNT(*) FROM ".$config["pre"]."links $sqlcomma $af = mysqli_query($mylink, "SELECT COUNT(*) FROM ".$config["pre"]."links
nd") or die (mysql_error()); $sqlcommand") or die (mysqli_error($mylink));
$howmany = mysql_fetch_array($af) or die (mysql_error()); $howmany = mysqli_fetch_array($af) or die (mysqli_error($mylink));
$total_links = $howmany[0]; $total_links = $howmany[0];
if ($howmany[0] <= $view_stop) if ($howmany[0] <= $view_stop)
{ {
$view_stop = $howmany[0]; $view_stop = $howmany[0];
$nomore=1; $nomore=1;
} }
$cat_links = Message ("total_links_found", $cat_links = Message ("total_links_found",
array ( "TOTAL" => "$total_links")); array ( "TOTAL" => "$total_links"));
$link_prev_next = Search_showNext($enc_search,$view_stop,$view_start,$nom ore); $link_prev_next = Search_showNext($enc_search,$view_stop,$view_start,$nom ore);
$cat_links .= $link_prev_next; $cat_links .= $link_prev_next;
$result = mysql_query("SELECT * FROM ".$config["pre"]."links $sqlcommand order by title LIMIT $view_start,".$config["max_displayed_links"]) or die (mysql _error()); $result = mysqli_query($mylink, "SELECT * FROM ".$config["pre"]."links $s qlcommand order by title LIMIT $view_start,".$config["max_displayed_links"]) or die (mysqli_error($mylink));
if (mysql_numrows($result)) if (mysqli_num_rows($result))
{ {
$tpl->set_var("link_rows", ""); $tpl->set_var("link_rows", "");
while ($list = mysql_fetch_array($result) ) while ($list = mysqli_fetch_array($result) )
{ {
# limit the "message" field
if (strlen($list["message"]) > $config["limit_message_length"
]) {
$list["message"] = substr($list["message"], 0,
$config["limit_message_length"]). "...";
}
$idx = $list["idx"]; $idx = $list["idx"];
$tpl->set_var( array( $tpl->set_var( array(
"LINK_TITLE" => $list["title"], "LINK_TITLE" => $list["title"],
"LINK_MESSAGE" => $list["message"], "LINK_MESSAGE" => $list["message"],
"LINK_ADDED" => $list["date"], "LINK_ADDED" => $list["date"],
"LINK_HITS" => $list["hits"], "LINK_HITS" => $list["hits"],
"LINK_GO" => $start_script_t."count=$idx", "LINK_GO" => $start_script_t."count=$idx",
"LINK_MORE" => $start_script_t."more=$idx", "LINK_MORE" => $start_script_t."more=$idx",
"LINK_EDIT" => "$update_link&link=$idx" "LINK_EDIT" => "$update_link&link=$idx"
)); ));
skipping to change at line 165 skipping to change at line 170
# #
if (isset($_POST['search_help'])) if (isset($_POST['search_help']))
{ {
$content = Message ("search_help_text"); $content = Message ("search_help_text");
$tpl->set_var( array( $tpl->set_var( array(
"CATEGORY_TITLE" => Message ("search_help"), "CATEGORY_TITLE" => Message ("search_help"),
"CONTENT" => $content "CONTENT" => $content
)); ));
showStartTemplate(); showStartTemplate();
} }
else if($_POST['search'] != "" or $_GET['search'] != "") else if($_POST['search'] != "" or $_GET['search'] != "")
{ {
$view = 0; $view = 0;
if (isset($_GET['search'])) if (isset($_GET['search']))
{ {
$search_string = $_GET['search']; $search_string = $_GET['search'];
if (isset ($_GET['view'])) if (isset ($_GET['view']))
$view = intval($_GET['view']); $view = intval($_GET['view']);
} }
 End of changes. 8 change blocks. 
9 lines changed or deleted 14 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)