1: <?php
2: /**
3: * This file contains the base class for content search.
4: *
5: * @package Core
6: * @subpackage Frontend_Search
7: * @version SVN Revision $Rev:$
8: *
9: * @author Willi Man
10: * @copyright four for business AG <www.4fb.de>
11: * @license http://www.contenido.org/license/LIZENZ.txt
12: * @link http://www.4fb.de
13: * @link http://www.contenido.org
14: */
15: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
16:
17: cInclude('includes', 'functions.encoding.php');
18:
19: /**
20: * Abstract base search class.
21: * Provides general properties and functions
22: * for child implementations.
23: *
24: * @author Murat Purc <murat@purc.de>
25: *
26: * @package Core
27: * @subpackage Frontend_Search
28: */
29: abstract class cSearchBaseAbstract {
30:
31: /**
32: * CONTENIDO database object
33: *
34: * @var cDb
35: */
36: protected $oDB;
37:
38: /**
39: * CONTENIDO configuration data
40: *
41: * @var array
42: */
43: protected $cfg;
44:
45: /**
46: * Language id of a client
47: *
48: * @var int
49: */
50: protected $lang;
51:
52: /**
53: * Client id
54: *
55: * @var int
56: */
57: protected $client;
58:
59: /**
60: * Initialises some properties
61: *
62: * @param cDb $oDB Optional database instance
63: * @param bool $bDebug Optional, flag to enable debugging (no longer needed)
64: */
65: protected function __construct($oDB = NULL, $bDebug = false) {
66: global $cfg, $lang, $client;
67:
68: $this->cfg = $cfg;
69: $this->lang = $lang;
70: $this->client = $client;
71:
72: $this->bDebug = $bDebug;
73:
74: if ($oDB == NULL || !is_object($oDB)) {
75: $this->db = cRegistry::getDb();
76: } else {
77: $this->db = $oDB;
78: }
79: }
80:
81: /**
82: * Main debug function, prints dumps parameter if debugging is enabled
83: *
84: * @param string $msg Some text
85: * @param mixed $var The variable to dump
86: */
87: protected function _debug($msg, $var) {
88: $dump = $msg . ': ';
89: if (is_array($var) || is_object($var)) {
90: $dump .= print_r($var, true);
91: } else {
92: $dump .= $var;
93: }
94: cDebug::out($dump);
95: }
96: }
97: