Sveiki,
Taigi reikia iš search.php pašalinti:
Articles
Custom Pages
Downloads
FAQs
Forum Posts testTestavimas
Members
News
Photos
Web Links
Bet pačiam faile nelabai randu, gal kas galit padėt?
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2010 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: search.php
| Author: Robert Gaudyn (Wooya)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "maincore.php";
require_once THEMES."templates/header.php";
include LOCALE.LOCALESET."search.php";
add_to_title($locale['global_202']);
if (!isset($_GET['rowstart']) || !isnum($_GET['rowstart'])) { $_GET['rowstart'] = 0; }
if (isset($_GET['stext'])) {
if (is_array($_GET['stext'])) {
redirect(FUSION_SELF);
} else {
$_GET['stext'] = urlencode(stripinput($_GET['stext']));
}
} else {
$_GET['stext'] = "";
}
if (isset($_GET['method'])) { $_GET['method'] = ($_GET['method']=="OR" || $_GET['method']=="AND") ? $_GET['method'] : "OR"; }
else { $_GET['method'] = "OR"; }
if (isset($_GET['datelimit'])) { $_GET['datelimit'] = isnum($_GET['datelimit']) ? $_GET['datelimit'] : 0; }
else { $_GET['datelimit'] = 0; }
if (isset($_GET['fields'])) { $_GET['fields'] = isnum($_GET['fields']) ? $_GET['fields'] : 2; }
else { $_GET['fields'] = 2; }
if (isset($_GET['sort'])) { $_GET['sort'] = in_array($_GET['sort'], array("datestamp", "subject", "author")) ? $_GET['sort'] : "datestamp"; }
else { $_GET['sort'] = "datestamp"; }
if (isset($_GET['order'])) { $_GET['order'] = isnum($_GET['order']) ? $_GET['order'] : 0; }
else { $_GET['order'] = 0; }
if (isset($_GET['chars'])) { $_GET['chars'] = isnum($_GET['chars']) ? ($_GET['chars'] > 200 ? 200 : $_GET['chars']) : 50; }
else { $_GET['chars'] = 50; }
if (isset($_GET['forum_id'])) { $_GET['forum_id'] = isnum($_GET['forum_id']) ? $_GET['forum_id'] : 0; }
else { $_GET['forum_id'] = 0; }
$radio_button = array();
$form_elements = array();
$available = array();
$dh = opendir(INCLUDES."search");
while (false !== ($entry = readdir($dh))) {
if ($entry != "." && $entry != ".." && preg_match("/include_button.php/i", $entry)) {
$available[] = str_replace("search_", "", str_replace("_include_button.php", "", $entry));
}
}
closedir($dh);
$available[] = "all";
if (isset($_GET['stype'])) { $_GET['stype'] = in_array($_GET['stype'], $available) ? $_GET['stype'] : "all"; }
if (!isset($_GET['stype'])) { $_GET['stype'] = $settings['default_search']; }
for ($i = 0; $i < count($available) - 1; $i++) {
include (INCLUDES."search/search_".$available[$i]."_include_button.php");
}
sort($radio_button);
opentable($locale['400']);
echo "<script type='text/javascript'>\n<!--\n";
echo "function display(val) {\nswitch (val) {\n";
foreach ($form_elements as $type => $array1) {
echo "case '".$type."':\n";
foreach ($array1 as $what => $array2) {
foreach ($array2 as $elements => $value) {
if ($what=="enabled") {
echo "document.getElementById('".$value."').disabled = false;\n";
} else if ($what=="disabled") {
echo "document.getElementById('".$value."').disabled = true;\n";
} else if ($what=="display") {
echo "document.getElementById('".$value."').style.display = 'block';\n";
} else if ($what=="nodisplay") {
echo "document.getElementById('".$value."').style.display = 'none';\n";
}
}
}
echo "break;\n";
}
echo "case 'all':\n";
echo "break;\n}\n}\n-->\n</script>\n";
echo "<form id='searchform' name='searchform' method='get' action='".FUSION_SELF."'>\n";
echo "<table width='100%' cellpadding='0' cellspacing='1' class='tbl-border'>\n<tr>\n";
echo "<td class='tbl2' colspan='2'><strong>".$locale['401']."</strong></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl1' style='width:50%;'>\n";
echo "<input type='text' name='stext' value='".urldecode($_GET['stext'])."' class='textbox' style='width:200px' />\n";
echo "<input type='submit' name='search' value='".$locale['402']."' class='button' />\n</td>\n";
echo "</tr>\n<tr>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl1'>\n";
echo "<table width='100%' cellpadding='0' cellspacing='0'>\n";
foreach ($radio_button as $key => $value) {
echo "<tr>\n<td>".$value."</td>\n</tr>\n";
}
echo "<tr>\n";
echo "</tr>\n</table>\n";
echo "</td>\n</tr>\n</table>\n</form>\n";
closetable();
function search_striphtmlbbcodes($text) {
$text = preg_replace("[\[(.*?)\]]", "", $text);
$text = preg_replace("<\<(.*?)\>>", "", $text);
return $text;
}
function search_textfrag($text) {
if ($_GET['chars'] != 0) {
$text = nl2br(stripslashes(substr($text, 0, $_GET['chars'])."..."));
} else {
$text = nl2br(stripslashes($text));
}
return $text;
}
function search_stringscount($text) {
global $swords;
$count = 0;
for ($i = 0; $i < sizeof($swords); $i++) {
$count += substr_count(strtolower($text), strtolower($swords[$i]));
}
return $count;
}
function search_querylike($field) {
global $swords;
$querylike = "";
for ($i = 0; $i < sizeof($swords); $i++) {
$querylike .= $field." LIKE '%".$swords[$i]."%'".($i < sizeof($swords) - 1 ? " ".$_GET['method']." " : "");
}
return $querylike;
}
function search_fieldsvar() {
$fieldsvar = "(";
$numargs = func_num_args();
for ($i = 0; $i < $numargs; $i++) {
$fieldsvar .= func_get_arg($i).($i < $numargs - 1 ? " || " : "");
}
$fieldsvar .= ")";
return $fieldsvar;
}
function search_globalarray($search_result) {
global $search_result_array, $global_string_count, $memory_limit;
$global_string_count += strlen($search_result);
if ($memory_limit > $global_string_count) {
$search_result_array[] = $search_result;
$memory_exhaused = false;
} else {
$memory_exhaused = true;
}
return $memory_exhaused;
}
function search_navigation($rows) {
global $site_search_count, $composevars;
$site_search_count += $rows;
$navigation_result = "<div align='center' style='margin-top:5px;'>\n".makePageNav($_GET['rowstart'], 10, ($site_search_count > 100 || search_globalarray("") ? 100 : $site_search_count), 3, FUSION_SELF."?stype=".$_GET['stype']."&stext=".urlencode($_GET['stext'])."&".$composevars)."\n</div>\n";
return $navigation_result;
}
$composevars = "method=".$_GET['method']."&datelimit=".$_GET['datelimit']."&fields=".$_GET['fields']."&sort=".$_GET['sort']."&order=".$_GET['order']."&chars=".$_GET['chars']."&forum_id=".$_GET['forum_id']."&";
$memory_limit = str_replace("m", "", strtolower(ini_get("memory_limit"))) * 1024 * 1024;
$memory_limit = !isnum($memory_limit) ? 8 * 1024 * 1024 : $memory_limit < 8 * 1024 * 1024 ? 8 * 1024 * 1024 : $memory_limit;
$memory_limit = $memory_limit - ceil($memory_limit / 4);
$global_string_count = 0;
$site_search_count = 0;
$search_result_array = array();
$navigation_result = "";
$items_count = "";
$_GET['stext'] = urldecode($_GET['stext']);
if ($_GET['stext'] != "" && strlen($_GET['stext']) >= 3) {
add_to_title($locale['global_201'].$locale['408']);
opentable($locale['408']);
$fswords = explode(" ", $_GET['stext']);
$swords = array();
$iwords = array();
for ($i = 0; $i < sizeof($fswords); $i++) {
if (strlen($fswords[$i]) >= 3) {
$swords[] = $fswords[$i];
} else {
$iwords[] = $fswords[$i];
}
}
unset($fswords);
if (sizeof($swords) == 0) { redirect(FUSION_SELF); }
if ($_GET['stype'] == "all") {
$dh = opendir(INCLUDES."search");
while (false !== ($entry=readdir($dh))) {
if ($entry != "." && $entry != ".." && preg_match("/include.php/i", $entry)) {
include (INCLUDES."search/".$entry);
}
}
closedir($dh);
} else {
include INCLUDES."search/search_".$_GET['stype']."_include.php";
}
if (count($iwords)) {
$txt = "";
for ($i = 0; $i < count($iwords); $i++) {
$txt .= $iwords[$i].($i < count($iwords) - 1 ? ", " : "");
}
}
if ($_GET['stype'] == "all") {
$navigation_result = search_navigation(0);
} else {
echo $items_count."<hr />";
echo (($site_search_count>100 || search_globalarray("")) ? "<strong>".sprintf($locale['530'], $site_search_count)."</strong><hr />" : "");
}
if ($_GET['stype'] == "all") {
$from = $_GET['rowstart'];
$to = (count($search_result_array) - ($_GET['rowstart'] + 10)) <= 0 ? count($search_result_array) : $_GET['rowstart'] + 10;
} else {
$from = 0;
$to = count($search_result_array) < 10 ? count($search_result_array) : 10;
}
for ($i = $from; $i < $to; $i++) {
echo $search_result_array[$i];
}
echo $navigation_result;
closetable();
} elseif (isset($_GET['stext'])) {
add_to_title($locale['global_201'].$locale['408']);
opentable($locale['408']);
echo $locale['501'];
closetable();
}
require_once THEMES."templates/footer.php";
?>
|