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