Overview

Packages

  • None
  • PHPShopArray
  • PHPShopClass
    • Helper
  • PHPShopCore
  • PHPShopElements
  • PHPShopGUI
  • PHPShopInc
  • PHPShopObj
  • PHPShopParser
  • PHPShopTest

Classes

  • fase4_rdf
  • PHPShopAdminRule
  • PHPShopArray
  • PHPShopBannerElement
  • PHPShopBase
  • PHPShopBaseXml
  • PHPShopCatalogElement
  • PHPShopCategory
  • PHPShopCategoryArray
  • PHPShopCloudElement
  • PHPShopCore
  • PHPShopCoretest
  • PHPShopCssParser
  • PHPShopDate
  • PHPShopDebug
  • PHPShopDoc
  • PHPShopElements
  • PHPShopFile
  • PHPShopForma
  • PHPShopFrontInterface
  • PHPShopGbook
  • PHPShopGbookElement
  • PHPShopGUI
  • PHPShopIndex
  • PHPShopInterface
  • PHPShopLang
  • PHPShopLinks
  • PHPShopMail
  • PHPShopMailFile
  • PHPShopMap
  • PHPShopModules
  • PHPShopNav
  • PHPShopNews
  • PHPShopNewsElement
  • PHPShopObj
  • PHPShopOpros
  • PHPShopOprosElement
  • PHPShopOrm
  • PHPShopPage
  • PHPShopPageCategory
  • PHPShopPageCategoryArray
  • PHPShopPages
  • PHPShopParser
  • PHPShopPhoto
  • PHPShopPhotoCategory
  • PHPShopPhotoCategoryArray
  • PHPShopPhotoElement
  • PHPShopReadCsv
  • PHPShopReadCsvNative
  • PHPShopReadCsvPro
  • PHPShopRestore
  • PHPShopRssParser
  • PHPShopSearch
  • PHPShopSecurity
  • PHPShopSkinElement
  • PHPShopSkinmarket
  • PHPShopSliderElement
  • PHPShopString
  • PHPShopSystem
  • PHPShopText
  • PHPShopTextElement
  • PHPShopUpdate
  • XMLparser

Functions

  • __
  • allowedFunctions
  • array2iconv
  • CheckCanGzip
  • debug
  • evalstr
  • GzDocOut
  • Open
  • output_handler
  • parseDatabase
  • Parser
  • ParseTemplate
  • ParseTemplateReturn
  • PHPShopAutoLoadClass
  • phpshopparserevalstr
  • preExtractCallBack
  • readDatabase
  • stripslashes_deep
  • SysValueReturn
  • timer
  • tmpGetFile
  • utf8_win1251
  • writeLangFile
  • xml2array
  • Overview
  • Package
  • Class
  1:   2:   3:   4:   5:   6:   7:   8:   9:  10:  11:  12:  13:  14:  15:  16:  17:  18:  19:  20:  21:  22:  23:  24:  25:  26:  27:  28:  29:  30:  31:  32:  33:  34:  35:  36:  37:  38:  39:  40:  41:  42:  43:  44:  45:  46:  47:  48:  49:  50:  51:  52:  53:  54:  55:  56:  57:  58:  59:  60:  61:  62:  63:  64:  65:  66:  67:  68:  69:  70:  71:  72:  73:  74:  75:  76:  77:  78:  79:  80:  81:  82:  83:  84:  85:  86:  87:  88:  89:  90:  91:  92:  93:  94:  95:  96:  97:  98:  99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 
<?php

/**

 * @author PHPShop Software
 * @version 1.3
 * @package PHPShopCore
 */
class PHPShopSearch extends PHPShopCore {

    /**

     */
    function __construct() {

        //
        $this->debug = false;

        //
        $this->action = array("post" => "words", "nav" => "index");
        parent::__construct();

        $this->title = __('') . " - " . $this->PHPShopSystem->getValue("name");

        //
        $this->target();
    }

    /**

     */
    function index() {
        //
        $this->parseTemplate($this->getValue('templates.search_page_list'));
    }

    //
    function searchpage() {

        //
        $hook = $this->setHook(__CLASS__, __FUNCTION__, false, 'START');
        if ($hook)
            return $hook;

        $this->set('pageFrom', "page");
        $this->set('pageDomen', $_SERVER['SERVER_NAME'] . "/page/");
        $j = 0;
        $i = 0;

        $PHPShopOrm = new PHPShopOrm($this->getValue('base.table_name11'));
        $PHPShopOrm->debug = $this->debug;
        $dataArray = $PHPShopOrm->select(array('*'), array('content' => " LIKE '%" . $this->words . "%'", "enabled" => "!='0'"), array('order' => 'link'), array('limit' => 100));
        if (is_array($dataArray))
            foreach ($dataArray as $row) {

                //
                $this->set('productName', $row['name']);
                $this->set('pageWords', $this->words);
                $this->set('productKey', substr(strip_tags($row['content']), 0, 300) . "...");
                $this->set('pageLink', $row['link'] . ".html");
                $i++;
                $this->set('productNum', $i);

                if ($j == 0) {
                    $this->set('pageTitle', $this->PHPShopSystem->getParam('name') . ' / ' . __(''));
                    $this->set('pageNumN', __("") . " " . __('') . " - " . count($dataArray));
                } else {
                    $this->set('pageTitle', false);
                    $this->set('pageNumN', false);
                }

                $j++;

                //
                $this->setHook(__CLASS__, __FUNCTION__, $row, 'MIDDLE');

                //
                $this->addToTemplate($this->getValue('templates.main_search_forma'));
            }

        //
        $this->setHook(__CLASS__, __FUNCTION__, false, 'END');

        $this->add('<p><br></p>', true);

        return $i;
    }

    //
    function searchnews() {
        global $PHPShopModules;

        $this->set('pageFrom', "news");
        $this->set('pageDomen', $_SERVER['SERVER_NAME'] . "/news/");
        $j = 0;

        $PHPShopOrm = new PHPShopOrm($this->getValue('base.table_name8'));
        $PHPShopOrm->debug = $this->debug;
        $PHPShopOrm->Option['where'] = " or ";
        $dataArray = $PHPShopOrm->select(array('*'), array('description' => " LIKE '%" . $this->words . "%'", 'title' => " LIKE '%" . $this->words . "%'",
            'content' => " LIKE '%" . $this->words . "%'"), array('order' => 'id desc'), array('limit' => 100));
        if (is_array($dataArray))
            foreach ($dataArray as $row) {

                //
                $this->set('productName', $row['title']);
                $this->set('pageWords', $this->words);
                $this->set('productKey', substr(strip_tags($row['description']), 0, 300) . "...");
                $this->set('pageLink', "ID_" . $row['id'] . ".html");
                $i++;
                $this->set('productNum', $i);

                if ($j == 0) {
                    $this->set('pageTitle', $this->PHPShopSystem->getParam('name') . ' / ' . __(''));
                    $this->set('pageNumN', __("") . ": " . __('') . " - " . count($dataArray));
                } else {
                    $this->set('pageTitle', false);
                    $this->set('pageNumN', false);
                }

                $j++;

                //
                $this->setHook(__CLASS__, __FUNCTION__, $row, 'MIDDLE');

                //
                $this->addToTemplate($this->getValue('templates.main_search_forma'));
            }

        //
        $this->setHook(__CLASS__, __FUNCTION__, false, 'END');

        return $i;
    }

    /**


     */
    function words() {

        //
        $this->words = PHPShopSecurity::TotalClean($_POST['words'], 4);

        switch ($_POST['target']) {

            case 'a':
                $i = $this->searchpage() + $this->searchnews();
                break;

            case 'b':
                $i = $this->searchpage();
                break;

            case 'c':
                $i = $this->searchnews();
                break;

            default:
                $i = $this->searchpage() + $this->searchnews();
        }

        $this->set('searchString', $this->words);

        //
        if ($i == 0) {
            $message = PHPShopText::h3(__(''));
            $message.=PHPShopText::div(__('') . ' ' .
                            PHPShopText::a('../map/', __(''), __('')), $align = "left", $style = "padding:5;border-style: dashed;border-width: 1px;border-color:#D3D3D3");
            $this->add($message, true);
        }

        //
        $this->title = __("") . " - " . $this->PHPShopSystem->getValue("name");

        $this->parseTemplate($this->getValue('templates.search_page_list'));
    }

    function target() {
        if (isset($_POST['target'])) {
            $$_POST['target'] = 'selected';
        }
        else
            $a = 'selected';

        $value[] = array(__(''), 'a', $a);
        $value[] = array(__(''), 'b', $b);
        $value[] = array(__(''), 'c', $c);
        $this->set('searchTarget', PHPShopText::select('target', $value, 100));
    }

}

?>
API documentation generated by ApiGen