| 1 |  |  | <?php | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  * XOOPS Kernel Object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * You may not change or alter any portion of this comment or credits | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * of supporting developers from this source code or any supporting source code | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * which is considered copyrighted (c) material of the original comment or credit authors. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * This program is distributed in the hope that it will be useful, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  * @copyright       (c) 2000-2016 XOOPS Project (www.xoops.org) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  * @license             GNU GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  * @package             kernel | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  * @since               2.0.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  * @author              Kazumi Ono (AKA onokazu) http://www.myweb.ne.jp/, http://jp.xoops.org/ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  * @author              Taiwen Jiang <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  * @version             $Id: object.php 13091 2015-06-16 21:08:34Z beckmi $ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | defined('XOOPS_ROOT_PATH') || exit('Restricted access'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |  * YOU SHOULD NOT USE ANY OF THE UNICODE TYPES, THEY WILL BE REMOVED | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |  * *#@+ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |  * Xoops object datatype | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | define('XOBJ_DTYPE_TXTBOX', 1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | define('XOBJ_DTYPE_TXTAREA', 2); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | define('XOBJ_DTYPE_INT', 3); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | define('XOBJ_DTYPE_URL', 4); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  | define('XOBJ_DTYPE_EMAIL', 5); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  | define('XOBJ_DTYPE_ARRAY', 6); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  | define('XOBJ_DTYPE_OTHER', 7); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  | define('XOBJ_DTYPE_SOURCE', 8); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  | define('XOBJ_DTYPE_STIME', 9); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  | define('XOBJ_DTYPE_MTIME', 10); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  | define('XOBJ_DTYPE_LTIME', 11); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  | define('XOBJ_DTYPE_FLOAT', 13); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  | define('XOBJ_DTYPE_DECIMAL', 14); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  | define('XOBJ_DTYPE_ENUM', 15); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  | // YOU SHOULD NEVER USE THE FOLLOWING TYPES, THEY WILL BE REMOVED | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | define('XOBJ_DTYPE_UNICODE_TXTBOX', 16); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  | define('XOBJ_DTYPE_UNICODE_TXTAREA', 17); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  | define('XOBJ_DTYPE_UNICODE_URL', 18); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  | define('XOBJ_DTYPE_UNICODE_EMAIL', 19); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  | define('XOBJ_DTYPE_UNICODE_ARRAY', 20); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  | define('XOBJ_DTYPE_UNICODE_OTHER', 21); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  | // Addition for 2.5.5 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  | define('XOBJ_DTYPE_DATE', 22); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  | define('XOBJ_DTYPE_TIME', 23); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  | define('XOBJ_DTYPE_TIMESTAMP', 24); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |  * Base class for all objects in the Xoops kernel (and beyond) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  | class XoopsObject | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |      * holds all variables(properties) of an object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |      * @var array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |      * @access protected | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |     public $vars = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |      * variables cleaned for store in DB | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |      * @var array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |      * @access protected | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |     public $cleanVars = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |      * is it a newly created object? | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |      * @var bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |      * @access private | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |     public $_isNew = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |      * has any of the values been modified? | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |      * @var bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |      * @access private | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |     public $_isDirty = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |      * errors | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |      * @var array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |      * @access private | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |     public $_errors = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |      * additional filters registered dynamically by a child class object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |      * @access private | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |     public $_filters = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |      * constructor | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |      * normally, this is called from child classes only | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |      * @access public | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |     public function __construct() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |      * PHP 4 style constructor compatibility shim | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |      * @deprecated all callers should be using parent::__construct() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |     public function XoopsObject() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |         $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |         trigger_error("Should call parent::__construct in {$trace[0]['file']} line {$trace[0]['line']},"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |         self::__construct(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |      * *#@+ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |      * used for new/clone objects | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |      * @access public | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |     public function setNew() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |         $this->_isNew = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |     public function unsetNew() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |         $this->_isNew = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |     public function isNew() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |         return $this->_isNew; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |      * *#@+ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |      * mark modified objects as dirty | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |      * used for modified objects only | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |      * @access public | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |     public function setDirty() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |         $this->_isDirty = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |     public function unsetDirty() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |         $this->_isDirty = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |     public function isDirty() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |         return $this->_isDirty; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |      * initialize variables for the object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |      * YOU SHOULD NOT USE THE $enumeration PARAMETER | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |      * @access   public | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |      * @param string $key | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |      * @param int    $data_type set to one of XOBJ_DTYPE_XXX constants (set to XOBJ_DTYPE_OTHER if no data type ckecking nor text sanitizing is required) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |      * @param null   $value | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |      * @param bool   $required  require html form input? | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |      * @param int    $maxlength for XOBJ_DTYPE_TXTBOX type only | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |      * @param string $options | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |      * @param string $enumerations | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |      * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |     public function initVar($key, $data_type, $value = null, $required = false, $maxlength = null, $options = '', $enumerations = '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |         $this->vars[$key] = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |             'value'       => $value, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |             'required'    => $required, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |             'data_type'   => $data_type, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |             'maxlength'   => $maxlength, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |             'changed'     => false, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |             'options'     => $options, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |             'enumeration' => $enumerations); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |      * assign a value to a variable | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |      * @access public | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |      * @param string $key   name of the variable to assign | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |      * @param mixed  $value value to assign | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |     public function assignVar($key, $value) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |         if (isset($key) && isset($this->vars[$key])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |             switch ($this->vars[$key]['data_type']) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |                 case XOBJ_DTYPE_UNICODE_ARRAY: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |                     if (is_array($value)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  |                         $this->vars[$key]['value'] =& array_walk($value, "xoops_aw_decode"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |                     } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |                         $this->vars[$key]['value'] =& xoops_convert_decode($value); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |                     break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |                 case XOBJ_DTYPE_UNICODE_URL: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |                 case XOBJ_DTYPE_UNICODE_EMAIL: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  |                 case XOBJ_DTYPE_UNICODE_OTHER: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  |                 case XOBJ_DTYPE_UNICODE_TXTBOX: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  |                 case XOBJ_DTYPE_UNICODE_TXTAREA: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  |                     $this->vars[$key]['value'] =& xoops_convert_decode($value); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |                     break; | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 234 |  | View Code Duplication |                 case XOBJ_DTYPE_DATE: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |                     if (!is_string($value) && is_numeric($value)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  |                         $this->vars[$key]['value'] =& date(_DBDATESTRING, $value); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  |                     } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  |                         $this->vars[$key]['value'] =& date(_DBDATESTRING, strtotime($value)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  |                     break; | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 241 |  | View Code Duplication |                 case XOBJ_DTYPE_TIME: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |                     if (!is_string($value) && is_numeric($value)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  |                         $this->vars[$key]['value'] =& date(_DBTIMESTRING, $value); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  |                     } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |                         $this->vars[$key]['value'] =& date(_DBTIMESTRING, strtotime($value)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  |                     break; | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 248 |  | View Code Duplication |                 case XOBJ_DTYPE_TIMESTAMP: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  |                     if (!is_string($value) && is_numeric($value)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  |                         $this->vars[$key]['value'] =& date(_DBTIMESTAMPSTRING, $value); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  |                     } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  |                         $this->vars[$key]['value'] =& date(_DBTIMESTAMPSTRING, strtotime($value)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |                     break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  |                 // YOU SHOULD NOT USE THE ABOVE TYPES, THEY WILL BE REMOVED | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |                 default: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  |                     $this->vars[$key]['value'] =& $value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  |      * assign values to multiple variables in a batch | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |      * @access   private | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |      * @param $var_arr | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  |      * @internal param array $var_array associative array of values to assign | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |     public function assignVars($var_arr) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  |         foreach ($var_arr as $key => $value) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  |             $this->assignVar($key, $value); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  |      * assign a value to a variable | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |      * @access public | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |      * @param string $key   name of the variable to assign | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  |      * @param mixed  $value value to assign | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  |      * @param bool   $not_gpc | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  |     public function setVar($key, $value, $not_gpc = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  |         if (!empty($key) && isset($value) && isset($this->vars[$key])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  |             $this->vars[$key]['value']   =& $value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |             $this->vars[$key]['not_gpc'] = $not_gpc; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  |             $this->vars[$key]['changed'] = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  |             $this->setDirty(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  |      * assign values to multiple variables in a batch | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  |      * @access private | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  |      * @param array $var_arr associative array of values to assign | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 |  |  |      * @param bool  $not_gpc | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 |  |  |     public function setVars($var_arr, $not_gpc = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 |  |  |         foreach ($var_arr as $key => $value) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 |  |  |             $this->setVar($key, $value, $not_gpc); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 |  |  |      * unset variable(s) for the object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 |  |  |      * @access public | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 |  |  |      * @param mixed $var | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  |     public function destroyVars($var) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 |  |  |         if (empty($var)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  |             return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  |         $var = !is_array($var) ? array($var) : $var; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 |  |  |         foreach ($var as $key) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  |             if (!isset($this->vars[$key])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  |                 continue; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  |             $this->vars[$key]['changed'] = null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  |         return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 |  |  |      * @deprecated use destroyVars() instead | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 |  |  |      * @param $var | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  |     public function destoryVars($var) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  |         return $this->destroyVars($var); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 |  |  |      * Assign values to multiple variables in a batch | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 |  |  |      * Meant for a CGI contenxt: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 347 |  |  |      * - prefixed CGI args are considered save | 
            
                                                                                                            
                            
            
                                    
            
            
                | 348 |  |  |      * - avoids polluting of namespace with CGI args | 
            
                                                                                                            
                            
            
                                    
            
            
                | 349 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 |  |  |      * @access private | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 |  |  |      * @param array  $var_arr associative array of values to assign | 
            
                                                                                                            
                            
            
                                    
            
            
                | 352 |  |  |      * @param string $pref    prefix (only keys starting with the prefix will be set) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 353 |  |  |      * @param bool   $not_gpc | 
            
                                                                                                            
                            
            
                                    
            
            
                | 354 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 355 |  |  |     public function setFormVars($var_arr = null, $pref = 'xo_', $not_gpc = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 356 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 357 |  |  |         $len = strlen($pref); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 358 |  |  |         foreach ($var_arr as $key => $value) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 359 |  |  |             if ($pref == substr($key, 0, $len)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 360 |  |  |                 $this->setVar(substr($key, $len), $value, $not_gpc); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 361 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 362 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 363 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 364 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 365 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 366 |  |  |      * returns all variables for the object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 367 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 368 |  |  |      * @access public | 
            
                                                                                                            
                            
            
                                    
            
            
                | 369 |  |  |      * @return array associative array of key->value pairs | 
            
                                                                                                            
                            
            
                                    
            
            
                | 370 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 371 |  |  |     public function &getVars() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 372 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 373 |  |  |         return $this->vars; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 374 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 375 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 376 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 377 |  |  |      * Returns the values of the specified variables | 
            
                                                                                                            
                            
            
                                    
            
            
                | 378 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 379 |  |  |      * @param  mixed  $keys     An array containing the names of the keys to retrieve, or null to get all of them | 
            
                                                                                                            
                            
            
                                    
            
            
                | 380 |  |  |      * @param  string $format   Format to use (see getVar) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 381 |  |  |      * @param  int    $maxDepth Maximum level of recursion to use if some vars are objects themselves | 
            
                                                                                                            
                            
            
                                    
            
            
                | 382 |  |  |      * @return array  associative array of key->value pairs | 
            
                                                                                                            
                            
            
                                    
            
            
                | 383 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 384 |  |  |     public function getValues($keys = null, $format = 's', $maxDepth = 1) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 385 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 386 |  |  |         if (!isset($keys)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 387 |  |  |             $keys = array_keys($this->vars); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 388 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 389 |  |  |         $vars = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 390 |  |  |         foreach ($keys as $key) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 391 |  |  |             if (isset($this->vars[$key])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 392 |  |  |                 if (is_object($this->vars[$key]) && is_a($this->vars[$key], 'XoopsObject')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 393 |  |  |                     if ($maxDepth) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 394 |  |  |                         $vars[$key] = $this->vars[$key]->getValues(null, $format, $maxDepth - 1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 395 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 396 |  |  |                 } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 397 |  |  |                     $vars[$key] = $this->getVar($key, $format); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 398 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 399 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 400 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 401 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 402 |  |  |         return $vars; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 403 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 404 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 405 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 406 |  |  |      * returns a specific variable for the object in a proper format | 
            
                                                                                                            
                            
            
                                    
            
            
                | 407 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 408 |  |  |      * YOU SHOULD NOT USE ANY OF THE UNICODE TYPES, THEY WILL BE REMOVED | 
            
                                                                                                            
                            
            
                                    
            
            
                | 409 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 410 |  |  |      * @access public | 
            
                                                                                                            
                            
            
                                    
            
            
                | 411 |  |  |      * @param  string $key    key of the object's variable to be returned | 
            
                                                                                                            
                            
            
                                    
            
            
                | 412 |  |  |      * @param  string $format format to use for the output | 
            
                                                                                                            
                            
            
                                    
            
            
                | 413 |  |  |      * @return mixed  formatted value of the variable | 
            
                                                                                                            
                            
            
                                    
            
            
                | 414 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 415 |  |  |     public function getVar($key, $format = 's') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 416 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 417 |  |  |         $ret = null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 418 |  |  |         if (!isset($this->vars[$key])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 419 |  |  |             return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 420 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 421 |  |  |         $ret = $this->vars[$key]['value']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 422 |  |  |         $ts  = MyTextSanitizer::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 423 |  |  |         switch ($this->vars[$key]['data_type']) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 424 |  |  |             case XOBJ_DTYPE_UNICODE_TXTBOX: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 425 |  |  |             case XOBJ_DTYPE_TXTBOX: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 426 |  |  |                 switch (strtolower($format)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 427 |  |  |                     case 's': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 428 |  |  |                     case 'show': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 429 |  |  |                     case 'e': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 430 |  |  |                     case 'edit': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 431 |  |  |                         return $ts->htmlSpecialChars($ret); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 432 |  |  |                         break 1; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 433 |  |  |                     case 'p': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 434 |  |  |                     case 'preview': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 435 |  |  |                     case 'f': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 436 |  |  |                     case 'formpreview': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 437 |  |  |                         return $ts->htmlSpecialChars($ts->stripSlashesGPC($ret)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 438 |  |  |                         break 1; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 439 |  |  |                     case 'n': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 440 |  |  |                     case 'none': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 441 |  |  |                     default: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 442 |  |  |                         break 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 443 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 444 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 445 |  |  |             case XOBJ_DTYPE_UNICODE_TXTAREA: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 446 |  |  |             case XOBJ_DTYPE_TXTAREA: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 447 |  |  |                 switch (strtolower($format)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 448 |  |  |                     case 's': | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 449 |  | View Code Duplication |                     case 'show': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 450 |  |  |                         $html   = !empty($this->vars['dohtml']['value']) ? 1 : 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 451 |  |  |                         $xcode  = (!isset($this->vars['doxcode']['value']) || $this->vars['doxcode']['value'] == 1) ? 1 : 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 452 |  |  |                         $smiley = (!isset($this->vars['dosmiley']['value']) || $this->vars['dosmiley']['value'] == 1) ? 1 : 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 453 |  |  |                         $image  = (!isset($this->vars['doimage']['value']) || $this->vars['doimage']['value'] == 1) ? 1 : 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 454 |  |  |                         $br     = (!isset($this->vars['dobr']['value']) || $this->vars['dobr']['value'] == 1) ? 1 : 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 455 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 456 |  |  |                         return $ts->displayTarea($ret, $html, $smiley, $xcode, $image, $br); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 457 |  |  |                         break 1; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 458 |  |  |                     case 'e': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 459 |  |  |                     case 'edit': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 460 |  |  |                         return htmlspecialchars($ret, ENT_QUOTES); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 461 |  |  |                         break 1; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 462 |  |  |                     case 'p': | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 463 |  | View Code Duplication |                     case 'preview': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 464 |  |  |                         $html   = !empty($this->vars['dohtml']['value']) ? 1 : 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 465 |  |  |                         $xcode  = (!isset($this->vars['doxcode']['value']) || $this->vars['doxcode']['value'] == 1) ? 1 : 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 466 |  |  |                         $smiley = (!isset($this->vars['dosmiley']['value']) || $this->vars['dosmiley']['value'] == 1) ? 1 : 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 467 |  |  |                         $image  = (!isset($this->vars['doimage']['value']) || $this->vars['doimage']['value'] == 1) ? 1 : 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 468 |  |  |                         $br     = (!isset($this->vars['dobr']['value']) || $this->vars['dobr']['value'] == 1) ? 1 : 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 469 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 470 |  |  |                         return $ts->previewTarea($ret, $html, $smiley, $xcode, $image, $br); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 471 |  |  |                         break 1; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 472 |  |  |                     case 'f': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 473 |  |  |                     case 'formpreview': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 474 |  |  |                         return htmlspecialchars($ts->stripSlashesGPC($ret), ENT_QUOTES); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 475 |  |  |                         break 1; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 476 |  |  |                     case 'n': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 477 |  |  |                     case 'none': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 478 |  |  |                     default: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 479 |  |  |                         break 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 480 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 481 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 482 |  |  |             case XOBJ_DTYPE_UNICODE_ARRAY: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 483 |  |  |                 switch (strtolower($format)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 484 |  |  |                     case 'n': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 485 |  |  |                     case 'none': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 486 |  |  |                         break 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 487 |  |  |                     default: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 488 |  |  |                         if (!is_array($ret)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 489 |  |  |                             if ($ret != '') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 490 |  |  |                                 $ret = unserialize($ret); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 491 |  |  |                             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 492 |  |  |                             $ret = is_array($ret) ? $ret : array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 493 |  |  |                             if (is_array($ret)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 494 |  |  |                                 $ret = array_walk($ret, "xoops_aw_decode"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 495 |  |  |                             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 496 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 497 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 498 |  |  |                         return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 499 |  |  |                         break 1; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 500 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 501 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 502 |  |  |             case XOBJ_DTYPE_ARRAY: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 503 |  |  |                 switch (strtolower($format)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 504 |  |  |                     case 'n': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 505 |  |  |                     case 'none': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 506 |  |  |                         break 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 507 |  |  |                     default: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 508 |  |  |                         if (!is_array($ret)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 509 |  |  |                             if ($ret != '') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 510 |  |  |                                 $ret = unserialize($ret); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 511 |  |  |                             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 512 |  |  |                             $ret = is_array($ret) ? $ret : array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 513 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 514 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 515 |  |  |                         return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 516 |  |  |                         break 1; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 517 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 518 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 519 |  |  |             case XOBJ_DTYPE_SOURCE: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 520 |  |  |                 switch (strtolower($format)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 521 |  |  |                     case 's': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 522 |  |  |                     case 'show': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 523 |  |  |                         break 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 524 |  |  |                     case 'e': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 525 |  |  |                     case 'edit': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 526 |  |  |                         return htmlspecialchars($ret, ENT_QUOTES); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 527 |  |  |                         break 1; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 528 |  |  |                     case 'p': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 529 |  |  |                     case 'preview': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 530 |  |  |                         return $ts->stripSlashesGPC($ret); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 531 |  |  |                         break 1; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 532 |  |  |                     case 'f': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 533 |  |  |                     case 'formpreview': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 534 |  |  |                         return htmlspecialchars($ts->stripSlashesGPC($ret), ENT_QUOTES); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 535 |  |  |                         break 1; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 536 |  |  |                     case 'n': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 537 |  |  |                     case 'none': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 538 |  |  |                     default: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 539 |  |  |                         break 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 540 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 541 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 542 |  | View Code Duplication |             case XOBJ_DTYPE_DATE: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 543 |  |  |                 switch (strtolower($format)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 544 |  |  |                     case 's': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 545 |  |  |                     case 'show': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 546 |  |  |                         if (is_string($ret) && !is_numeric($ret)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 547 |  |  |                             return date(_DBDATESTRING, strtotime($ret)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 548 |  |  |                         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 549 |  |  |                             return date(_DBDATESTRING, $ret); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 550 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 551 |  |  |                         break 1; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 552 |  |  |                     case 'e': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 553 |  |  |                     case 'edit': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 554 |  |  |                         if (is_string($ret) && !is_numeric($ret)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 555 |  |  |                             return htmlspecialchars(date(_DBDATESTRING, strtotime($ret)), ENT_QUOTES); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 556 |  |  |                         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 557 |  |  |                             return htmlspecialchars(date(_DBDATESTRING, $ret), ENT_QUOTES); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 558 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 559 |  |  |                         break 1; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 560 |  |  |                     case 'p': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 561 |  |  |                     case 'preview': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 562 |  |  |                         if (is_string($ret) && !is_numeric($ret)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 563 |  |  |                             return $ts->stripSlashesGPC(date(_DBDATESTRING, strtotime($ret))); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 564 |  |  |                         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 565 |  |  |                             return $ts->stripSlashesGPC(date(_DBDATESTRING, $ret)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 566 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 567 |  |  |                         break 1; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 568 |  |  |                     case 'f': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 569 |  |  |                     case 'formpreview': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 570 |  |  |                         if (is_string($ret) && !is_numeric($ret)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 571 |  |  |                             return htmlspecialchars($ts->stripSlashesGPC(date(_DBDATESTRING, strtotime($ret))), ENT_QUOTES); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 572 |  |  |                         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 573 |  |  |                             return htmlspecialchars($ts->stripSlashesGPC(date(_DBDATESTRING, $ret)), ENT_QUOTES); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 574 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 575 |  |  |                         break 1; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 576 |  |  |                     case 'n': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 577 |  |  |                     case 'none': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 578 |  |  |                     default: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 579 |  |  |                         break 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 580 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 581 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 582 |  | View Code Duplication |             case XOBJ_DTYPE_TIME: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 583 |  |  |                 switch (strtolower($format)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 584 |  |  |                     case 's': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 585 |  |  |                     case 'show': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 586 |  |  |                         if (is_string($ret) && !is_numeric($ret)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 587 |  |  |                             return date(_DBTIMESTRING, strtotime($ret)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 588 |  |  |                         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 589 |  |  |                             return date(_DBTIMESTRING, $ret); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 590 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 591 |  |  |                         break 1; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 592 |  |  |                     case 'e': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 593 |  |  |                     case 'edit': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 594 |  |  |                         if (is_string($ret) && !is_numeric($ret)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 595 |  |  |                             return htmlspecialchars(date(_DBTIMESTRING, strtotime($ret)), ENT_QUOTES); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 596 |  |  |                         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 597 |  |  |                             return htmlspecialchars(date(_DBTIMESTRING, $ret), ENT_QUOTES); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 598 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 599 |  |  |                         break 1; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 600 |  |  |                     case 'p': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 601 |  |  |                     case 'preview': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 602 |  |  |                         if (is_string($ret) && !is_numeric($ret)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 603 |  |  |                             return $ts->stripSlashesGPC(date(_DBTIMESTRING, strtotime($ret))); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 604 |  |  |                         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 605 |  |  |                             return $ts->stripSlashesGPC(date(_DBTIMESTRING, $ret)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 606 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 607 |  |  |                         break 1; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 608 |  |  |                     case 'f': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 609 |  |  |                     case 'formpreview': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 610 |  |  |                         if (is_string($ret) && !is_numeric($ret)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 611 |  |  |                             return htmlspecialchars($ts->stripSlashesGPC(date(_DBTIMESTRING, strtotime($ret))), ENT_QUOTES); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 612 |  |  |                         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 613 |  |  |                             return htmlspecialchars($ts->stripSlashesGPC(date(_DBTIMESTRING, $ret)), ENT_QUOTES); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 614 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 615 |  |  |                         break 1; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 616 |  |  |                     case 'n': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 617 |  |  |                     case 'none': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 618 |  |  |                     default: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 619 |  |  |                         break 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 620 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 621 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 622 |  | View Code Duplication |             case XOBJ_DTYPE_TIMESTAMP: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 623 |  |  |                 switch (strtolower($format)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 624 |  |  |                     case 's': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 625 |  |  |                     case 'show': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 626 |  |  |                         if (is_string($ret) && !is_numeric($ret)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 627 |  |  |                             return date(_DBTIMESTAMPSTRING, strtotime($ret)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 628 |  |  |                         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 629 |  |  |                             return date(_DBTIMESTAMPSTRING, $ret); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 630 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 631 |  |  |                         break 1; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 632 |  |  |                     case 'e': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 633 |  |  |                     case 'edit': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 634 |  |  |                         if (is_string($ret) && !is_numeric($ret)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 635 |  |  |                             return htmlspecialchars(date(_DBTIMESTAMPSTRING, strtotime($ret)), ENT_QUOTES); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 636 |  |  |                         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 637 |  |  |                             return htmlspecialchars(date(_DBTIMESTAMPSTRING, $ret), ENT_QUOTES); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 638 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 639 |  |  |                         break 1; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 640 |  |  |                     case 'p': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 641 |  |  |                     case 'preview': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 642 |  |  |                         if (is_string($ret) && !is_numeric($ret)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 643 |  |  |                             return $ts->stripSlashesGPC(date(_DBTIMESTAMPSTRING, strtotime($ret))); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 644 |  |  |                         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 645 |  |  |                             return $ts->stripSlashesGPC(date(_DBTIMESTAMPSTRING, $ret)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 646 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 647 |  |  |                         break 1; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 648 |  |  |                     case 'f': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 649 |  |  |                     case 'formpreview': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 650 |  |  |                         if (is_string($ret) && !is_numeric($ret)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 651 |  |  |                             return htmlspecialchars($ts->stripSlashesGPC(date(_DBTIMESTAMPSTRING, strtotime($ret))), ENT_QUOTES); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 652 |  |  |                         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 653 |  |  |                             return htmlspecialchars($ts->stripSlashesGPC(date(_DBTIMESTAMPSTRING, $ret)), ENT_QUOTES); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 654 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 655 |  |  |                         break 1; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 656 |  |  |                     case 'n': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 657 |  |  |                     case 'none': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 658 |  |  |                     default: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 659 |  |  |                         break 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 660 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 661 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 662 |  |  |             default: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 663 |  |  |                 if ($this->vars[$key]['options'] != '' && $ret != '') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 664 |  |  |                     switch (strtolower($format)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 665 |  |  |                         case 's': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 666 |  |  |                         case 'show': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 667 |  |  |                             $selected = explode('|', $ret); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 668 |  |  |                             $options  = explode('|', $this->vars[$key]['options']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 669 |  |  |                             $i        = 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 670 |  |  |                             $ret      = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 671 |  |  |                             foreach ($options as $op) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 672 |  |  |                                 if (in_array($i, $selected)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 673 |  |  |                                     $ret[] = $op; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 674 |  |  |                                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 675 |  |  |                                 ++$i; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 676 |  |  |                             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 677 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 678 |  |  |                             return implode(', ', $ret); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 679 |  |  |                         case 'e': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 680 |  |  |                         case 'edit': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 681 |  |  |                             $ret = explode('|', $ret); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 682 |  |  |                             break 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 683 |  |  |                         default: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 684 |  |  |                             break 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 685 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 686 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 687 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 688 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 689 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 690 |  |  |         return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 691 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 692 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 693 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 694 |  |  |      * clean values of all variables of the object for storage. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 695 |  |  |      * also add slashes wherever needed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 696 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 697 |  |  |      * YOU SHOULD NOT USE ANY OF THE UNICODE TYPES, THEY WILL BE REMOVED | 
            
                                                                                                            
                            
            
                                    
            
            
                | 698 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 699 |  |  |      * @return bool true if successful | 
            
                                                                                                            
                            
            
                                    
            
            
                | 700 |  |  |      * @access public | 
            
                                                                                                            
                            
            
                                    
            
            
                | 701 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 702 |  |  |     public function cleanVars() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 703 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 704 |  |  |         $ts              = MyTextSanitizer::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 705 |  |  |         $existing_errors = $this->getErrors(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 706 |  |  |         $this->_errors   = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 707 |  |  |         foreach ($this->vars as $k => $v) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 708 |  |  |             $cleanv = $v['value']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 709 |  |  |             if (!$v['changed']) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 710 |  |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 711 |  |  |                 $cleanv = is_string($cleanv) ? trim($cleanv) : $cleanv; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 712 |  |  |                 switch ($v['data_type']) { | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 713 |  | View Code Duplication |                     case XOBJ_DTYPE_TIMESTAMP: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 714 |  |  |                         $cleanv = !is_string($cleanv) && is_numeric($cleanv) ? date(_DBTIMESTAMPSTRING, $cleanv) : date(_DBTIMESTAMPSTRING, strtotime($cleanv)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 715 |  |  |                         break; | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 716 |  | View Code Duplication |                     case XOBJ_DTYPE_TIME: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 717 |  |  |                         $cleanv = !is_string($cleanv) && is_numeric($cleanv) ? date(_DBTIMESTRING, $cleanv) : date(_DBTIMESTRING, strtotime($cleanv)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 718 |  |  |                         break; | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 719 |  | View Code Duplication |                     case XOBJ_DTYPE_DATE: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 720 |  |  |                         $cleanv = !is_string($cleanv) && is_numeric($cleanv) ? date(_DBDATESTRING, $cleanv) : date(_DBDATESTRING, strtotime($cleanv)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 721 |  |  |                         break; | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 722 |  | View Code Duplication |                     case XOBJ_DTYPE_TXTBOX: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 723 |  |  |                         if ($v['required'] && $cleanv != '0' && $cleanv == '') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 724 |  |  |                             $this->setErrors(sprintf(_XOBJ_ERR_REQUIRED, $k)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 725 |  |  |                             continue 2; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 726 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 727 |  |  |                         if (isset($v['maxlength']) && strlen($cleanv) > (int)($v['maxlength'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 728 |  |  |                             $this->setErrors(sprintf(_XOBJ_ERR_SHORTERTHAN, $k, (int)($v['maxlength']))); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 729 |  |  |                             continue 2; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 730 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 731 |  |  |                         if (!$v['not_gpc']) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 732 |  |  |                             $cleanv = $ts->stripSlashesGPC($ts->censorString($cleanv)); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 733 |  |  |                         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 734 |  |  |                             $cleanv = $ts->censorString($cleanv); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 735 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 736 |  |  |                         break; | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 737 |  | View Code Duplication |                     case XOBJ_DTYPE_TXTAREA: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 738 |  |  |                         if ($v['required'] && $cleanv != '0' && $cleanv == '') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 739 |  |  |                             $this->setErrors(sprintf(_XOBJ_ERR_REQUIRED, $k)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 740 |  |  |                             continue 2; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 741 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 742 |  |  |                         if (!$v['not_gpc']) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 743 |  |  |                             $cleanv = $ts->stripSlashesGPC($ts->censorString($cleanv)); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 744 |  |  |                         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 745 |  |  |                             $cleanv = $ts->censorString($cleanv); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 746 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 747 |  |  |                         break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 748 |  |  |                     case XOBJ_DTYPE_SOURCE: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 749 |  |  |                         if (!$v['not_gpc']) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 750 |  |  |                             $cleanv = $ts->stripSlashesGPC($cleanv); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 751 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 752 |  |  |                         break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 753 |  |  |                     case XOBJ_DTYPE_INT: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 754 |  |  |                         $cleanv = (int)($cleanv); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 755 |  |  |                         break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 756 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 757 |  |  |                     case XOBJ_DTYPE_EMAIL: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 758 |  |  |                         if ($v['required'] && $cleanv == '') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 759 |  |  |                             $this->setErrors(sprintf(_XOBJ_ERR_REQUIRED, $k)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 760 |  |  |                             continue 2; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 761 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 762 |  |  |                         if ($cleanv != '' && !preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$/i", $cleanv)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 763 |  |  |                             $this->setErrors("Invalid Email"); //_XOBJ_ERR_INVALID_EMAIL | 
            
                                                                                                            
                            
            
                                    
            
            
                | 764 |  |  |                             continue 2; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 765 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 766 |  |  |                         if (!$v['not_gpc']) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 767 |  |  |                             $cleanv = $ts->stripSlashesGPC($cleanv); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 768 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 769 |  |  |                         break; | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 770 |  | View Code Duplication |                     case XOBJ_DTYPE_URL: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 771 |  |  |                         if ($v['required'] && $cleanv == '') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 772 |  |  |                             $this->setErrors(sprintf(_XOBJ_ERR_REQUIRED, $k)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 773 |  |  |                             continue 2; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 774 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 775 |  |  |                         if ($cleanv != '' && !preg_match("/^http[s]*:\/\//i", $cleanv)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 776 |  |  |                             $cleanv = 'http://' . $cleanv; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 777 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 778 |  |  |                         if (!$v['not_gpc']) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 779 |  |  |                             $cleanv =& $ts->stripSlashesGPC($cleanv); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 780 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 781 |  |  |                         break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 782 |  |  |                     case XOBJ_DTYPE_ARRAY: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 783 |  |  |                         $cleanv = (array)$cleanv; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 784 |  |  |                         $cleanv = serialize($cleanv); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 785 |  |  |                         break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 786 |  |  |                     case XOBJ_DTYPE_STIME: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 787 |  |  |                     case XOBJ_DTYPE_MTIME: | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 788 |  | View Code Duplication |                     case XOBJ_DTYPE_LTIME: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 789 |  |  |                         $cleanv = !is_string($cleanv) ? (int)($cleanv) : strtotime($cleanv); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 790 |  |  |                         break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 791 |  |  |                     case XOBJ_DTYPE_FLOAT: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 792 |  |  |                         $cleanv = (float)($cleanv); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 793 |  |  |                         break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 794 |  |  |                     case XOBJ_DTYPE_DECIMAL: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 795 |  |  |                         $cleanv = (float)($cleanv); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 796 |  |  |                         break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 797 |  |  |                     case XOBJ_DTYPE_ENUM: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 798 |  |  |                         if (!in_array($cleanv, $v['enumeration'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 799 |  |  |                             $this->setErrors("Invalid Enumeration");//_XOBJ_ERR_INVALID_ENUMERATION | 
            
                                                                                                            
                            
            
                                    
            
            
                | 800 |  |  |                             continue 2; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 801 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 802 |  |  |                         break; | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 803 |  | View Code Duplication |                     case XOBJ_DTYPE_UNICODE_TXTBOX: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 804 |  |  |                         if ($v['required'] && $cleanv != '0' && $cleanv == '') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 805 |  |  |                             $this->setErrors(sprintf(_XOBJ_ERR_REQUIRED, $k)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 806 |  |  |                             continue 2; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 807 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 808 |  |  |                         $cleanv = xoops_convert_encode($cleanv); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 809 |  |  |                         if (isset($v['maxlength']) && strlen($cleanv) > (int)($v['maxlength'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 810 |  |  |                             $this->setErrors(sprintf(_XOBJ_ERR_SHORTERTHAN, $k, (int)($v['maxlength']))); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 811 |  |  |                             continue 2; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 812 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 813 |  |  |                         if (!$v['not_gpc']) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 814 |  |  |                             $cleanv = $ts->stripSlashesGPC($ts->censorString($cleanv)); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 815 |  |  |                         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 816 |  |  |                             $cleanv = $ts->censorString($cleanv); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 817 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 818 |  |  |                         break; | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 819 |  | View Code Duplication |                     case XOBJ_DTYPE_UNICODE_TXTAREA: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 820 |  |  |                         if ($v['required'] && $cleanv != '0' && $cleanv == '') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 821 |  |  |                             $this->setErrors(sprintf(_XOBJ_ERR_REQUIRED, $k)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 822 |  |  |                             continue 2; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 823 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 824 |  |  |                         $cleanv = xoops_convert_encode($cleanv); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 825 |  |  |                         if (!$v['not_gpc']) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 826 |  |  |                             $cleanv = $ts->stripSlashesGPC($ts->censorString($cleanv)); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 827 |  |  |                         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 828 |  |  |                             $cleanv = $ts->censorString($cleanv); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 829 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 830 |  |  |                         break; | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 831 |  | View Code Duplication |                     case XOBJ_DTYPE_UNICODE_EMAIL: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 832 |  |  |                         if ($v['required'] && $cleanv == '') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 833 |  |  |                             $this->setErrors(sprintf(_XOBJ_ERR_REQUIRED, $k)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 834 |  |  |                             continue 2; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 835 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 836 |  |  |                         if ($cleanv != '' && !preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$/i", $cleanv)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 837 |  |  |                             $this->setErrors("Invalid Email"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 838 |  |  |                             continue 2; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 839 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 840 |  |  |                         $cleanv = xoops_convert_encode($cleanv); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 841 |  |  |                         if (!$v['not_gpc']) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 842 |  |  |                             $cleanv = $ts->stripSlashesGPC($cleanv); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 843 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 844 |  |  |                         break; | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 845 |  | View Code Duplication |                     case XOBJ_DTYPE_UNICODE_URL: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 846 |  |  |                         if ($v['required'] && $cleanv == '') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 847 |  |  |                             $this->setErrors(sprintf(_XOBJ_ERR_REQUIRED, $k)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 848 |  |  |                             continue 2; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 849 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 850 |  |  |                         if ($cleanv != '' && !preg_match("/^http[s]*:\/\//i", $cleanv)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 851 |  |  |                             $cleanv = 'http://' . $cleanv; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 852 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 853 |  |  |                         $cleanv = xoops_convert_encode($cleanv); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 854 |  |  |                         if (!$v['not_gpc']) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 855 |  |  |                             $cleanv =& $ts->stripSlashesGPC($cleanv); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 856 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 857 |  |  |                         break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 858 |  |  |                     case XOBJ_DTYPE_UNICODE_ARRAY: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 859 |  |  |                         $cleanv = serialize(array_walk($cleanv, 'xoops_aw_encode')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 860 |  |  |                         break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 861 |  |  |                     default: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 862 |  |  |                         break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 863 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 864 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 865 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 866 |  |  |             $this->cleanVars[$k] = str_replace('\\"', '"', $cleanv); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 867 |  |  |             unset($cleanv); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 868 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 869 |  |  |         if (count($this->_errors) > 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 870 |  |  |             $this->_errors = array_merge($existing_errors, $this->_errors); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 871 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 872 |  |  |             return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 873 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 874 |  |  |         $this->_errors = array_merge($existing_errors, $this->_errors); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 875 |  |  |         $this->unsetDirty(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 876 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 877 |  |  |         return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 878 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 879 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 880 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 881 |  |  |      * dynamically register additional filter for the object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 882 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 883 |  |  |      * @param string $filtername name of the filter | 
            
                                                                                                            
                            
            
                                    
            
            
                | 884 |  |  |      * @access public | 
            
                                                                                                            
                            
            
                                    
            
            
                | 885 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 886 |  |  |     public function registerFilter($filtername) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 887 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 888 |  |  |         $this->_filters[] = $filtername; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 889 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 890 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 891 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 892 |  |  |      * load all additional filters that have been registered to the object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 893 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 894 |  |  |      * @access private | 
            
                                                                                                            
                            
            
                                    
            
            
                | 895 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 896 |  |  |     public function _loadFilters() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 897 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 898 |  |  |         static $loaded; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 899 |  |  |         if (isset($loaded)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 900 |  |  |             return null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 901 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 902 |  |  |         $loaded = 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 903 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 904 |  |  |         $path = empty($this->plugin_path) ? __DIR__ . '/filters' : $this->plugin_path; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 905 |  |  |         if (file_exists($file = $path . '/filter.php')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 906 |  |  |             include_once $file; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 907 |  |  |             foreach ($this->_filters as $f) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 908 |  |  |                 if (file_exists($file = $path . '/' . strtolower($f) . 'php')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 909 |  |  |                     include_once $file; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 910 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 911 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 912 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 913 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 914 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 915 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 916 |  |  |      * load all local filters for the object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 917 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 918 |  |  |      * Filter distribution: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 919 |  |  |      * In each module folder there is a folder "filter" containing filter files with, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 920 |  |  |      * filename: [name_of_target_class][.][function/action_name][.php]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 921 |  |  |      * function name: [dirname][_][name_of_target_class][_][function/action_name]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 922 |  |  |      * parameter: the target object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 923 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 924 |  |  |      * @param string $method function or action name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 925 |  |  |      * @access public | 
            
                                                                                                            
                            
            
                                    
            
            
                | 926 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 927 |  |  |     public function loadFilters($method) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 928 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 929 |  |  |         $this->_loadFilters(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 930 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 931 |  |  |         xoops_load('XoopsCache'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 932 |  |  |         $class = get_class($this); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 933 |  |  |         if (!$modules_active = XoopsCache::read('system_modules_active')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 934 |  |  |             $module_handler = xoops_getHandler('module'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 935 |  |  |             $modules_obj    = $module_handler->getObjects(new Criteria('isactive', 1)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 936 |  |  |             $modules_active = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 937 |  |  |             foreach (array_keys($modules_obj) as $key) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 938 |  |  |                 $modules_active[] = $modules_obj[$key]->getVar('dirname'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 939 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 940 |  |  |             unset($modules_obj); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 941 |  |  |             XoopsCache::write('system_modules_active', $modules_active); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 942 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 943 |  |  |         foreach ($modules_active as $dirname) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 944 |  |  |             if (file_exists($file = XOOPS_ROOT_PATH . '/modules/' . $dirname . '/filter/' . $class . '.' . $method . '.php')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 945 |  |  |                 include_once $file; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 946 |  |  |                 if (function_exists($class . '_' . $method)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 947 |  |  |                     call_user_func_array($dirname . '_' . $class . '_' . $method, array(&$this)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 948 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 949 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 950 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 951 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 952 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 953 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 954 |  |  |      * create a clone(copy) of the current object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 955 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 956 |  |  |      * @access public | 
            
                                                                                                            
                            
            
                                    
            
            
                | 957 |  |  |      * @return object clone | 
            
                                                                                                            
                            
            
                                    
            
            
                | 958 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 959 |  |  |     public function &xoopsClone() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 960 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 961 |  |  |         $class = get_class($this); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 962 |  |  |         $clone = null; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 963 |  |  |         $clone = new $class(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 964 |  |  |         foreach ($this->vars as $k => $v) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 965 |  |  |             $clone->assignVar($k, $v['value']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 966 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 967 |  |  |         // need this to notify the handler class that this is a newly created object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 968 |  |  |         $clone->setNew(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 969 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 970 |  |  |         return $clone; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 971 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 972 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 973 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 974 |  |  |      * add an error | 
            
                                                                                                            
                            
            
                                    
            
            
                | 975 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 976 |  |  |      * @param $err_str | 
            
                                                                                                            
                            
            
                                    
            
            
                | 977 |  |  |      * @internal param string $value error to add | 
            
                                                                                                            
                            
            
                                    
            
            
                | 978 |  |  |      * @access   public | 
            
                                                                                                            
                            
            
                                    
            
            
                | 979 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 980 |  |  |     public function setErrors($err_str) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 981 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 982 |  |  |         if (is_array($err_str)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 983 |  |  |             $this->_errors = array_merge($this->_errors, $err_str); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 984 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 985 |  |  |             $this->_errors[] = trim($err_str); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 986 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 987 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 988 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 989 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 990 |  |  |      * return the errors for this object as an array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 991 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 992 |  |  |      * @return array an array of errors | 
            
                                                                                                            
                            
            
                                    
            
            
                | 993 |  |  |      * @access public | 
            
                                                                                                            
                            
            
                                    
            
            
                | 994 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 995 |  |  |     public function getErrors() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 996 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 997 |  |  |         return $this->_errors; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 998 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 999 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1000 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1001 |  |  |      * return the errors for this object as html | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1002 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1003 |  |  |      * @return string html listing the errors | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1004 |  |  |      * @access public | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1005 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1006 |  |  |     public function getHtmlErrors() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1007 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1008 |  |  |         $ret = '<h4>Errors</h4>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1009 |  |  |         if (!empty($this->_errors)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1010 |  |  |             foreach ($this->_errors as $error) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1011 |  |  |                 $ret .= $error . '<br />'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1012 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1013 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1014 |  |  |             $ret .= 'None<br />'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1015 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1016 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1017 |  |  |         return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1018 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1019 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1020 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1021 |  |  |      * Returns an array representation of the object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1022 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1023 |  |  |      * Deprecated, use getValues() directly | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1024 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1025 |  |  |      * @return array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1026 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1027 |  |  |     public function toArray() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1028 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1029 |  |  |         return $this->getValues(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1030 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1031 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1032 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1033 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1034 |  |  |  * XOOPS object handler class. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1035 |  |  |  * This class is an abstract class of handler classes that are responsible for providing | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1036 |  |  |  * data access mechanisms to the data source of its corresponsing data objects | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1037 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1038 |  |  |  * @package             kernel | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1039 |  |  |  * @abstract | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1040 |  |  |  * @author              Kazumi Ono <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1041 |  |  |  * @copyright       (c) 2000-2016 XOOPS Project (www.xoops.org) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1042 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1043 |  |  | class XoopsObjectHandler | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1044 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1045 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1046 |  |  |      * XoopsDatabase holds referenced to {@link XoopsDatabase} class object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1047 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1048 |  |  |      * @var XoopsDatabase | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1049 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1050 |  |  |     public $db; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1051 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1052 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1053 |  |  |      * called from child classes only | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1054 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1055 |  |  |      * @param XoopsDatabase $db reference to the {@link XoopsDatabase} object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1056 |  |  |      * @access protected | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1057 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1058 |  |  |     public function __construct(XoopsDatabase $db) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1059 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1060 |  |  |         $this->db = $db; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1061 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1062 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1063 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1064 |  |  |      * PHP 4 style constructor compatibility shim | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1065 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1066 |  |  |      * @param XoopsDatabase $db database object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1067 |  |  |      * @deprecated all callers should be using parent::__construct() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1068 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1069 |  |  |     public function XoopsObjectHandler($db) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1070 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1071 |  |  |         $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1072 |  |  |         trigger_error("Should call parent::__construct in {$trace[0]['file']} line {$trace[0]['line']},"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1073 |  |  |         self::__construct($db); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1074 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1075 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1076 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1077 |  |  |      * creates a new object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1078 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1079 |  |  |      * @abstract | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1080 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1081 |  |  |     public function create() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1082 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1083 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1084 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1085 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1086 |  |  |      * gets a value object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1087 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1088 |  |  |      * @param int $int_id | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1089 |  |  |      * @abstract | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 1090 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 1091 |  |  |     public function get($int_id) | 
            
                                                                        
                            
            
                                    
            
            
                | 1092 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 1093 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1094 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1095 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1096 |  |  |      * insert/update object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1097 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1098 |  |  |      * @param XoopsObject $object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1099 |  |  |      * @abstract | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1100 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1101 |  |  |     public function insert(XoopsObject $object) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1102 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1103 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1104 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1105 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1106 |  |  |      * delete object from database | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1107 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1108 |  |  |      * @param XoopsObject $object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1109 |  |  |      * @abstract | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1110 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1111 |  |  |     public function delete(XoopsObject $object) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1112 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1113 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1114 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1115 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1116 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1117 |  |  |  * Persistable Object Handler class. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1118 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1119 |  |  |  * @author              Taiwen Jiang <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1120 |  |  |  * @author              Jan Keller Pedersen <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1121 |  |  |  * @copyright       (c) 2000-2016 XOOPS Project (www.xoops.org) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1122 |  |  |  * @package             Kernel | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1123 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1124 |  |  | class XoopsPersistableObjectHandler extends XoopsObjectHandler | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1125 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1126 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1127 |  |  |      * holds reference to custom extended object handler | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1128 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1129 |  |  |      * var object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1130 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1131 |  |  |      * @access private | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1132 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1133 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1134 |  |  |      * static protected | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1135 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1136 |  |  |     public $handler; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1137 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1138 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1139 |  |  |      * holds reference to predefined extended object handlers: read, stats, joint, write, sync | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1140 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1141 |  |  |      * The handlers hold methods for different purposes, which could be all put together inside of current class. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1142 |  |  |      * However, load codes only if they are necessary, thus they are now splitted out. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1143 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1144 |  |  |      * var array of objects | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1145 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1146 |  |  |      * @access private | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1147 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1148 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1149 |  |  |      * static protected | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1150 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1151 |  |  |     public $handlers = array('read' => null, 'stats' => null, 'joint' => null, 'write' => null, 'sync' => null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1152 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1153 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1154 |  |  |      * *#@+ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1155 |  |  |      * Information about the class, the handler is managing | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1156 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1157 |  |  |      * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1158 |  |  |      * @access public | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1159 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1160 |  |  |     public $table; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1161 |  |  |     public $keyName; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1162 |  |  |     public $className; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1163 |  |  |     public $identifierName; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1164 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1165 |  |  |      * *#@- | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1166 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1167 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1168 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1169 |  |  |      * Constructor | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1170 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1171 |  |  |      * @param null|XoopsDatabase $db             database connection | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1172 |  |  |      * @param string             $table          Name of database table | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1173 |  |  |      * @param string             $className      Name of the XoopsObject class this handler manages | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1174 |  |  |      * @param string             $keyName        Name of the property holding the key | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1175 |  |  |      * @param string             $identifierName Name of the property holding an identifier | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1176 |  |  |      *                                            name (title, name ...), used on getList() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1177 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1178 |  |  |     public function __construct(XoopsDatabase $db = null, $table = '', $className = '', $keyName = '', $identifierName = '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1179 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1180 |  |  |         $db    = XoopsDatabaseFactory::getDatabaseConnection(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1181 |  |  |         $table = $db->prefix($table); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1182 |  |  |         parent::__construct($db); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1183 |  |  |         $this->table     = $table; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1184 |  |  |         $this->keyName   = $keyName; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1185 |  |  |         $this->className = $className; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1186 |  |  |         if ($identifierName) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1187 |  |  |             $this->identifierName = $identifierName; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1188 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1189 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1190 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1191 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1192 |  |  |      * PHP 4 style constructor compatibility shim | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1193 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1194 |  |  |      * @param null|XoopsDatabase $db             database connection | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1195 |  |  |      * @param string             $table          Name of database table | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1196 |  |  |      * @param string             $className      Name of the XoopsObject class this handler manages | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1197 |  |  |      * @param string             $keyName        Name of the property holding the key | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1198 |  |  |      * @param string             $identifierName Name of the property holding an identifier | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1199 |  |  |      *                                            name (title, name ...), used on getList() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1200 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1201 |  |  |      * @deprecated all callers should be using parent::__construct() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1202 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1203 |  |  |     public function XoopsPersistableObjectHandler(XoopsDatabase $db = null, $table = '', $className = '', $keyName = '', $identifierName = '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1204 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1205 |  |  |         $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1206 |  |  |         trigger_error("Should call parent::__construct in {$trace[0]['file']} line {$trace[0]['line']},"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1207 |  |  |         self::__construct($db, $table, $className, $keyName, $identifierName); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1208 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1209 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1210 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1211 |  |  |      * Set custom handler | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1212 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1213 |  |  |      * @access   protected | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1214 |  |  |      * @param null   $handler | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1215 |  |  |      * @param null   $args | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1216 |  |  |      * @param string $path path to class | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1217 |  |  |      * @internal param object $handler | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1218 |  |  |      * @internal param mixed  $args | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1219 |  |  |      * @return object of handler | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1220 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1221 |  |  |     public function setHandler($handler = null, $args = null, $path = null) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1222 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1223 |  |  |         $this->handler = null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1224 |  |  |         if (is_object($handler)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1225 |  |  |             $this->handler = $handler; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1226 |  |  |         } elseif (is_string($handler)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1227 |  |  |             xoops_load('XoopsModelFactory'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1228 |  |  |             $this->handler = XoopsModelFactory::loadHandler($this, $handler, $args); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1229 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1230 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1231 |  |  |         return $this->handler; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1232 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1233 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1234 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1235 |  |  |      * Load predefined handler | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1236 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1237 |  |  |      * @access protected | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1238 |  |  |      * @param  string $name handler name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1239 |  |  |      * @param  mixed  $args args | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1240 |  |  |      * @return XoopsModelAbstract of handler {@link XoopsModelAbstract} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1241 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1242 |  |  |     public function loadHandler($name, $args = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1243 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1244 |  |  |         static $handlers; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1245 |  |  |         if (!isset($handlers[$name])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1246 |  |  |             xoops_load('XoopsModelFactory'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1247 |  |  |             $handlers[$name] = XoopsModelFactory::loadHandler($this, $name, $args); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1248 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1249 |  |  |             $handlers[$name]->setHandler($this); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1250 |  |  |             $handlers[$name]->setVars($args); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1251 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1252 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1253 |  |  |         return $handlers[$name]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1254 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1255 |  |  |         /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1256 |  |  |          * // Following code just kept as placeholder for PHP5 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1257 |  |  |          * if (!isset(self::$handlers[$name])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1258 |  |  |          * self::$handlers[$name] = XoopsModelFactory::loadHandler($this, $name, $args); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1259 |  |  |          * } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1260 |  |  |          * self::$handlers[$name]->setHandler($this); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1261 |  |  |          * self::$handlers[$name]->setVars($args); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1262 |  |  |          * } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1263 |  |  |          * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1264 |  |  |          * return self::$handlers[$name]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1265 |  |  |          */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1266 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1267 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1268 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1269 |  |  |      * Magic method for overloading of delegation | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1270 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1271 |  |  |      * To be enabled in XOOPS 3.0 with PHP 5 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1272 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1273 |  |  |      * @access protected | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1274 |  |  |      * @param  string $name method name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1275 |  |  |      * @param  array  $args arguments | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1276 |  |  |      * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1277 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1278 |  |  |     public function __call($name, $args) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1279 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1280 |  |  |         if (is_object($this->handler) && is_callable(array($this->handler, $name))) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1281 |  |  |             return call_user_func_array(array($this->handler, $name), $args); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1282 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1283 |  |  |         foreach (array_keys($this->handlers) as $_handler) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1284 |  |  |             $handler = $this->loadHandler($_handler); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1285 |  |  |             if (is_callable(array($handler, $name))) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1286 |  |  |                 return call_user_func_array(array($handler, $name), $args); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1287 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1288 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1289 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1290 |  |  |         return null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1291 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1292 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1293 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1294 |  |  |      * *#@+ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1295 |  |  |      * Methods of native handler {@link XoopsPersistableObjectHandler} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1296 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1297 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1298 |  |  |      * create a new object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1299 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1300 |  |  |      * @param  bool $isNew Flag the new objects as new | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1301 |  |  |      * @return XoopsObject {@link XoopsObject} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1302 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1303 |  |  |     public function create($isNew = true) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1304 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1305 |  |  |         $obj = new $this->className(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1306 |  |  |         if ($isNew === true) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1307 |  |  |             $obj->setNew(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1308 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1309 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1310 |  |  |         return $obj; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1311 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1312 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1313 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1314 |  |  |      * Load a {@link XoopsObject} object from the database | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1315 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1316 |  |  |      * @access protected | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1317 |  |  |      * @param  mixed $id     ID | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1318 |  |  |      * @param  array $fields fields to fetch | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1319 |  |  |      * @return XoopsObject {@link XoopsObject} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1320 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1321 |  |  |     public function get($id = null, $fields = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1322 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1323 |  |  |         $object = null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1324 |  |  |         if (empty($id)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1325 |  |  |             $object = $this->create(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1326 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1327 |  |  |             return $object; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1328 |  |  |         } | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 1329 |  | View Code Duplication |         if (is_array($fields) && count($fields) > 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1330 |  |  |             $select = implode(',', $fields); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1331 |  |  |             if (!in_array($this->keyName, $fields)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1332 |  |  |                 $select .= ', ' . $this->keyName; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1333 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1334 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1335 |  |  |             $select = '*'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1336 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1337 |  |  |         $sql = sprintf('SELECT %s FROM %s WHERE %s = %s', $select, $this->table, $this->keyName, $this->db->quote($id)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1338 |  |  |         //$sql = "SELECT {$select} FROM {$this->table} WHERE {$this->keyName} = " . $this->db->quote($id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1339 |  |  |         if (!$result = $this->db->query($sql)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1340 |  |  |             return $object; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1341 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1342 |  |  |         if (!$this->db->getRowsNum($result)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1343 |  |  |             return $object; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1344 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1345 |  |  |         $object = $this->create(false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1346 |  |  |         $object->assignVars($this->db->fetchArray($result)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1347 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1348 |  |  |         return $object; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1349 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1350 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1351 |  |  |      * *#@- | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1352 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1353 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1354 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1355 |  |  |      * *#@+ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1356 |  |  |      * Methods of write handler {@link XoopsObjectWrite} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1357 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1358 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1359 |  |  |      * insert an object into the database | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1360 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1361 |  |  |      * @param  XoopsObject $object {@link XoopsObject} reference to object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1362 |  |  |      * @param  bool        $force  flag to force the query execution despite security settings | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1363 |  |  |      * @return mixed       object ID | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1364 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1365 |  |  |     public function insert(XoopsObject $object, $force = true) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1366 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1367 |  |  |         $handler = $this->loadHandler('write'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1368 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1369 |  |  |         return $handler->insert($object, $force); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1370 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1371 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1372 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1373 |  |  |      * delete an object from the database | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1374 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1375 |  |  |      * @param  XoopsObject $object {@link XoopsObject} reference to the object to delete | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1376 |  |  |      * @param  bool        $force | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1377 |  |  |      * @return bool        FALSE if failed. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1378 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1379 |  |  |     public function delete(XoopsObject $object, $force = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1380 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1381 |  |  |         $handler = $this->loadHandler('write'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1382 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1383 |  |  |         return $handler->delete($object, $force); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1384 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1385 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1386 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1387 |  |  |      * delete all objects matching the conditions | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1388 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1389 |  |  |      * @param  CriteriaElement $criteria {@link CriteriaElement} with conditions to meet | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1390 |  |  |      * @param  bool            $force    force to delete | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1391 |  |  |      * @param  bool            $asObject delete in object way: instantiate all objects and delete one by one | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1392 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1393 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1394 |  |  |     public function deleteAll(CriteriaElement $criteria = null, $force = true, $asObject = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1395 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1396 |  |  |         $handler = $this->loadHandler('write'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1397 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1398 |  |  |         return $handler->deleteAll($criteria, $force, $asObject); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1399 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1400 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1401 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1402 |  |  |      * Change a field for objects with a certain criteria | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1403 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1404 |  |  |      * @param  string          $fieldname  Name of the field | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1405 |  |  |      * @param  mixed           $fieldvalue Value to write | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1406 |  |  |      * @param  CriteriaElement $criteria   {@link CriteriaElement} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1407 |  |  |      * @param  bool            $force      force to query | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1408 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1409 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1410 |  |  |     public function updateAll($fieldname, $fieldvalue, CriteriaElement $criteria = null, $force = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1411 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1412 |  |  |         $handler = $this->loadHandler('write'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1413 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1414 |  |  |         return $handler->updateAll($fieldname, $fieldvalue, $criteria, $force); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1415 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1416 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1417 |  |  |      * *#@- | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1418 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1419 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1420 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1421 |  |  |      * *#@+ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1422 |  |  |      * Methods of read handler {@link XoopsObjectRead} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1423 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1424 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1425 |  |  |      * Retrieve objects from the database | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1426 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1427 |  |  |      * @param  CriteriaElement $criteria  {@link CriteriaElement} conditions to be met | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1428 |  |  |      * @param  bool            $id_as_key use the ID as key for the array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1429 |  |  |      * @param  bool            $as_object return an array of objects | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1430 |  |  |      * @return array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1431 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1432 |  |  |     public function &getObjects(CriteriaElement $criteria = null, $id_as_key = false, $as_object = true) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1433 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1434 |  |  |         $handler = $this->loadHandler('read'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1435 |  |  |         $ret     = $handler->getObjects($criteria, $id_as_key, $as_object); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1436 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1437 |  |  |         return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1438 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1439 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1440 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1441 |  |  |      * get all objects matching a condition | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1442 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1443 |  |  |      * @param  CriteriaElement $criteria  {@link CriteriaElement} to match | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1444 |  |  |      * @param  array           $fields    variables to fetch | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1445 |  |  |      * @param  bool            $asObject  flag indicating as object, otherwise as array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1446 |  |  |      * @param  bool            $id_as_key use the ID as key for the array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1447 |  |  |      * @return array           of objects/array {@link XoopsObject} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1448 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 1449 |  | View Code Duplication |     public function &getAll(CriteriaElement $criteria = null, $fields = null, $asObject = true, $id_as_key = true) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1450 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1451 |  |  |         $handler = $this->loadHandler('read'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1452 |  |  |         $ret     = $handler->getAll($criteria, $fields, $asObject, $id_as_key); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1453 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1454 |  |  |         return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1455 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1456 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1457 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1458 |  |  |      * Retrieve a list of objects data | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1459 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1460 |  |  |      * @param  CriteriaElement $criteria {@link CriteriaElement} conditions to be met | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1461 |  |  |      * @param  int             $limit    Max number of objects to fetch | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1462 |  |  |      * @param  int             $start    Which record to start at | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1463 |  |  |      * @return array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1464 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1465 |  |  |     public function getList(CriteriaElement $criteria = null, $limit = 0, $start = 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1466 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1467 |  |  |         $handler = $this->loadHandler('read'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1468 |  |  |         $ret     = $handler->getList($criteria, $limit, $start); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1469 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1470 |  |  |         return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1471 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1472 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1473 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1474 |  |  |      * get IDs of objects matching a condition | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1475 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1476 |  |  |      * @param  CriteriaElement $criteria {@link CriteriaElement} to match | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1477 |  |  |      * @return array           of object IDs | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1478 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1479 |  |  |     public function &getIds(CriteriaElement $criteria = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1480 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1481 |  |  |         $handler = $this->loadHandler('read'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1482 |  |  |         $ret     = $handler->getIds($criteria); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1483 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1484 |  |  |         return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1485 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1486 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1487 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1488 |  |  |      * get a limited list of objects matching a condition | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1489 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1490 |  |  |      * {@link CriteriaCompo} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1491 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1492 |  |  |      * @param  int             $limit    Max number of objects to fetch | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1493 |  |  |      * @param  int             $start    Which record to start at | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1494 |  |  |      * @param  CriteriaElement $criteria {@link CriteriaElement} to match | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1495 |  |  |      * @param  array           $fields   variables to fetch | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1496 |  |  |      * @param  bool            $asObject flag indicating as object, otherwise as array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1497 |  |  |      * @return array           of objects     {@link XoopsObject} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1498 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1499 |  |  |     public function &getByLimit($limit = 0, $start = 0, CriteriaElement $criteria = null, $fields = null, $asObject = true) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1500 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1501 |  |  |         $handler = $this->loadHandler('read'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1502 |  |  |         $ret     = $handler->getByLimit($limit, $start, $criteria, $fields, $asObject); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1503 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1504 |  |  |         return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1505 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1506 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1507 |  |  |      * *#@- | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1508 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1509 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1510 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1511 |  |  |      * *#@+ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1512 |  |  |      * Methods of stats handler {@link XoopsObjectStats} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1513 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1514 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1515 |  |  |      * count objects matching a condition | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1516 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1517 |  |  |      * @param  CriteriaElement $criteria {@link CriteriaElement} to match | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1518 |  |  |      * @return int             count of objects | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1519 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1520 |  |  |     public function getCount(CriteriaElement $criteria = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1521 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1522 |  |  |         $handler = $this->loadHandler('stats'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1523 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1524 |  |  |         return $handler->getCount($criteria); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1525 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1526 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1527 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1528 |  |  |      * Get counts of objects matching a condition | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1529 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1530 |  |  |      * @param  CriteriaElement $criteria {@link CriteriaElement} to match | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1531 |  |  |      * @return array           of conunts | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1532 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1533 |  |  |     public function getCounts(CriteriaElement $criteria = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1534 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1535 |  |  |         $handler = $this->loadHandler('stats'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1536 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1537 |  |  |         return $handler->getCounts($criteria); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1538 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1539 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1540 |  |  |      * *#@- | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1541 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1542 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1543 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1544 |  |  |      * *#@+ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1545 |  |  |      * Methods of joint handler {@link XoopsObjectJoint} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1546 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1547 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1548 |  |  |      * get a list of objects matching a condition joint with another related object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1549 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1550 |  |  |      * @param  CriteriaElement $criteria     {@link CriteriaElement} to match | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1551 |  |  |      * @param  array           $fields       variables to fetch | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1552 |  |  |      * @param  bool            $asObject     flag indicating as object, otherwise as array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1553 |  |  |      * @param  string          $field_link   field of linked object for JOIN | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1554 |  |  |      * @param  string          $field_object field of current object for JOIN | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1555 |  |  |      * @return array           of objects {@link XoopsObject} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1556 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 1557 |  | View Code Duplication |     public function &getByLink(CriteriaElement $criteria = null, $fields = null, $asObject = true, $field_link = null, $field_object = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1558 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1559 |  |  |         $handler = $this->loadHandler('joint'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1560 |  |  |         $ret     = $handler->getByLink($criteria, $fields, $asObject, $field_link, $field_object); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1561 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1562 |  |  |         return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1563 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1564 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1565 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1566 |  |  |      * Count of objects matching a condition | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1567 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1568 |  |  |      * @param  CriteriaElement $criteria {@link CriteriaElement} to match | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1569 |  |  |      * @return int             count of objects | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1570 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1571 |  |  |     public function getCountByLink(CriteriaElement $criteria = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1572 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1573 |  |  |         $handler = $this->loadHandler('joint'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1574 |  |  |         $ret     = $handler->getCountByLink($criteria); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1575 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1576 |  |  |         return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1577 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1578 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1579 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1580 |  |  |      * array of count of objects matching a condition of, groupby linked object keyname | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1581 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1582 |  |  |      * @param  CriteriaElement $criteria {@link CriteriaElement} to match | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1583 |  |  |      * @return int             count of objects | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1584 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1585 |  |  |     public function getCountsByLink(CriteriaElement $criteria = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1586 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1587 |  |  |         $handler = $this->loadHandler('joint'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1588 |  |  |         $ret     = $handler->getCountsByLink($criteria); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1589 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1590 |  |  |         return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1591 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1592 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1593 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1594 |  |  |      * update objects matching a condition against linked objects | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1595 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1596 |  |  |      * @param  array           $data     array of key => value | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1597 |  |  |      * @param  CriteriaElement $criteria {@link CriteriaElement} to match | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1598 |  |  |      * @return int             count of objects | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1599 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1600 |  |  |     public function updateByLink($data, CriteriaElement $criteria = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1601 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1602 |  |  |         $handler = $this->loadHandler('joint'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1603 |  |  |         $ret     = $handler->updateByLink($data, $criteria); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1604 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1605 |  |  |         return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1606 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1607 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1608 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1609 |  |  |      * Delete objects matching a condition against linked objects | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1610 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1611 |  |  |      * @param  CriteriaElement $criteria {@link CriteriaElement} to match | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1612 |  |  |      * @return int             count of objects | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1613 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1614 |  |  |     public function deleteByLink(CriteriaElement $criteria = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1615 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1616 |  |  |         $handler = $this->loadHandler('joint'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1617 |  |  |         $ret     = $handler->deleteByLink($criteria); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1618 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1619 |  |  |         return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1620 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1621 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1622 |  |  |      * *#@- | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1623 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1624 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1625 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1626 |  |  |      * *#@+ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1627 |  |  |      * Methods of sync handler {@link XoopsObjectSync} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1628 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1629 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1630 |  |  |      * Clean orphan objects against linked objects | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1631 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1632 |  |  |      * @param  string $table_link   table of linked object for JOIN | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1633 |  |  |      * @param  string $field_link   field of linked object for JOIN | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1634 |  |  |      * @param  string $field_object field of current object for JOIN | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1635 |  |  |      * @return bool   true on success | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1636 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1637 |  |  |     public function cleanOrphan($table_link = '', $field_link = '', $field_object = '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1638 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1639 |  |  |         $handler = $this->loadHandler('sync'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1640 |  |  |         $ret     = $handler->cleanOrphan($table_link, $field_link, $field_object); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1641 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1642 |  |  |         return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1643 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1644 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1645 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1646 |  |  |      * Synchronizing objects | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1647 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1648 |  |  |      * @return bool true on success | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1649 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1650 |  |  |     public function synchronization() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1651 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1652 |  |  |         $retval = $this->cleanOrphan(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1653 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1654 |  |  |         return $retval; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1655 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1656 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1657 |  |  |      * *#@- | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1658 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1659 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1660 |  |  |     /**#@+ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1661 |  |  |      * @deprecated | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1662 |  |  |      * @param      $result | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1663 |  |  |      * @param bool $id_as_key | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1664 |  |  |      * @param bool $as_object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1665 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1666 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1667 |  |  |     public function convertResultSet($result, $id_as_key = false, $as_object = true) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1668 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1669 |  |  |         trigger_error(__CLASS__ . "::" . __FUNCTION__ . ' is deprecated', E_USER_WARNING); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1670 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1671 |  |  |         return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1672 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1673 |  |  |     /**#@-*/ | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 1674 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 1675 |  |  |  | 
            
                        
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.