| Server IP : 23.111.136.34 / Your IP : 216.73.216.136 Web Server : Apache System : Linux servidor.eurohost.com.br 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : meusitei ( 1072) PHP Version : 5.6.40 Disable Function : show_source, system, shell_exec, passthru, proc_open MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/meusitei/public_html/central/ajuda/ |
Upload File : |
<?php
/******************************************************************************
* Search <search.php>
*
* This file preforms a search based on the _GET variable and returns the result
*
* Author: Michael McMullen <michael.mcmullen@tutelagesystems.com>
******************************************************************************/
require_once '../System/configuration.php';
class SearchPage extends MasterTemplate
{
var $template = '_search.html';
var $output = array();
// Processing Variables
var $term = '';
function SearchPage()
{
// Call the Master Template Constructor
parent::__construct();
// Add a Crumb
$this->AddBreadCrumb('Welcome', 'index.php');
$this->AddBreadCrumb('Search Results', null);
// Search the Database
$this->output['results'] = $this->Search();
// Render the Template
$this->RenderTemplate();
}
// Renders the index template (called from master)
function outputBody()
{
$body = new HTML_Template_Flexy($this->config['flexy']);
$body->compile($this->template);
$body->outputObject($this);
}
function Search()
{
$articles = array();
$this->term = $_GET['txtSearchTerms'];
$article_db = DB_DataObject::factory('articles');
$article_db->article_active = 1;
$article_db->whereAdd("lower(article_text) like '%". $article_db->escape($this->term) ."%'", 'or');
$article_db->whereAdd("lower(article_name) like '%". $article_db->escape($this->term) ."%'", 'or');
$article_db->find();
while($article_db->fetch())
{
$category_db = DB_DataObject::factory('categories');
$category_db->category_id = $article_db->article_category_id;
$category_db->category_active = 1;
if($category_db->find(true))
{
$article = $article_db->toArray();
$article['category'] = $category_db->toArray();
$articles[] = $article;
}
}
return $articles;
}
}
new SearchPage();