| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  * XOOPS Kernel Class | 
            
                                                                                                            
                            
            
                                    
            
            
                | 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 (https://www.gnu.org/licenses/gpl-2.0.html) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  * @package             kernel | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  * @since               2.0.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | defined('XOOPS_ROOT_PATH') || exit('Restricted access'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  * A Module | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |  * @package kernel | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |  * @author  Kazumi Ono <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | class XoopsModule extends XoopsObject | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |      * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |     public $modinfo; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |      * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |     public $adminmenu; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |      * @var array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |     public $_msg; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |      * Constructor | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |     public function __construct() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |         parent::__construct(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |         $this->initVar('mid', XOBJ_DTYPE_INT, null, false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |         $this->initVar('name', XOBJ_DTYPE_TXTBOX, null, true, 150); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |         $this->initVar('version', XOBJ_DTYPE_TXTBOX, null, false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |         $this->initVar('last_update', XOBJ_DTYPE_INT, null, false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |         $this->initVar('weight', XOBJ_DTYPE_INT, 0, false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |         $this->initVar('isactive', XOBJ_DTYPE_INT, 1, false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |         $this->initVar('dirname', XOBJ_DTYPE_OTHER, null, true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |         $this->initVar('hasmain', XOBJ_DTYPE_INT, 0, false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |         $this->initVar('hasadmin', XOBJ_DTYPE_INT, 0, false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |         $this->initVar('hassearch', XOBJ_DTYPE_INT, 0, false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |         $this->initVar('hasconfig', XOBJ_DTYPE_INT, 0, false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |         $this->initVar('hascomments', XOBJ_DTYPE_INT, 0, false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |         // RMV-NOTIFY | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |         $this->initVar('hasnotification', XOBJ_DTYPE_INT, 0, false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |      * Load module info | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |      * @param string  $dirname Directory Name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |      * @param boolean $verbose | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |     public function loadInfoAsVar($dirname, $verbose = true) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |         $dirname = basename($dirname); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |         if (!isset($this->modinfo)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |             $this->loadInfo($dirname, $verbose); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |         $this->setVar('name', $this->modinfo['name'], true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |         $this->setVar('version', $this->modinfo['version'], true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |         $this->setVar('dirname', $this->modinfo['dirname'], true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |         $hasmain     = (isset($this->modinfo['hasMain']) && $this->modinfo['hasMain'] == 1) ? 1 : 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |         $hasadmin    = (isset($this->modinfo['hasAdmin']) && $this->modinfo['hasAdmin'] == 1) ? 1 : 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |         $hassearch   = (isset($this->modinfo['hasSearch']) && $this->modinfo['hasSearch'] == 1) ? 1 : 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |         $hasconfig   = ((isset($this->modinfo['config']) && is_array($this->modinfo['config'])) || !empty($this->modinfo['hasComments'])) ? 1 : 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |         $hascomments = (isset($this->modinfo['hasComments']) && $this->modinfo['hasComments'] == 1) ? 1 : 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |         // RMV-NOTIFY | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |         $hasnotification = (isset($this->modinfo['hasNotification']) && $this->modinfo['hasNotification'] == 1) ? 1 : 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |         $this->setVar('hasmain', $hasmain); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |         $this->setVar('hasadmin', $hasadmin); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |         $this->setVar('hassearch', $hassearch); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |         $this->setVar('hasconfig', $hasconfig); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |         $this->setVar('hascomments', $hascomments); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |         // RMV-NOTIFY | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |         $this->setVar('hasnotification', $hasnotification); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |      * add a message | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |      * @param string $str message to add | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |      * @access public | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |     public function setMessage($str) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |         $this->_msg[] = trim($str); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |      * return the messages for this object as an array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |      * @return array an array of messages | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |      * @access public | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |     public function getMessages() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |         return $this->_msg; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |      * Set module info | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |      * @param  string $name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |      * @param  mixed  $value | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |      **/ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |     public function setInfo($name, $value) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |         if (empty($name)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |             $this->modinfo = $value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |             $this->modinfo[$name] = $value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |         return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |      * Get module info | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |      * @param  string $name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |      * @return array|string    Array of module information. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |      *                     If {@link $name} is set, returns a single module information item as string. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |     public function &getInfo($name = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |         if (!isset($this->modinfo)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |             $this->loadInfo($this->getVar('dirname')); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |         if (isset($name)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |             if (isset($this->modinfo[$name])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |                 return $this->modinfo[$name]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |             $return = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |             return $return; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |         return $this->modinfo; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  | 	 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |      * Get statut | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |     public function getStatus() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  | 		if (isset($this->modinfo['version'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  | 			return substr(strrchr($this->modinfo['version'], '-'), 1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  | 		} else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |             $return = ''; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  | 	 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |      * Compares two "XOOPS-standardized" version number strings. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  | 	 * @param  string $version1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |      * @param  string $version2 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |      * @param  string $operator | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |      * @return boolean The function will return true if the relationship is the one specified by the operator, false otherwise. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |     public function versionCompare($version1 = '',$version2 = '', $operator = '<') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  | 		$version1 = strtolower($version1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  | 		$version2 = strtolower($version2); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  | 		if (true == strpos($version2, '-stable')){ | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  | 			$version2 = substr($version2, 0, strpos($version2, '-stable')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  | 		if (true == strpos($version1, '-stable')){ | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  | 			$version1 = substr($version1, 0, strpos($version1, '-stable')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  | 		return version_compare($version1, $version2, $operator); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |      * Get a link to the modules main page | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |      * @return string FALSE on fail | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |     public function mainLink() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |         if ($this->getVar('hasmain') == 1) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |             $ret = '<a href="' . XOOPS_URL . '/modules/' . $this->getVar('dirname') . '/">' . $this->getVar('name') . '</a>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |             return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |         return false; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |      * Get links to the subpages | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |     public function subLink() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |         $ret = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |         if ($this->getInfo('sub') && is_array($this->getInfo('sub'))) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |             foreach ($this->getInfo('sub') as $submenu) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |                 $ret[] = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  |                     'name' => $submenu['name'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |                     'url'  => $submenu['url']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |         return $ret; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  |      * Load the admin menu for the module | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |     public function loadAdminMenu() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |         if ($this->getInfo('adminmenu') && $this->getInfo('adminmenu') != '' && file_exists(XOOPS_ROOT_PATH . '/modules/' . $this->getVar('dirname') . '/' . $this->getInfo('adminmenu'))) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  |             $adminmenu = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  |             include XOOPS_ROOT_PATH . '/modules/' . $this->getVar('dirname') . '/' . $this->getInfo('adminmenu'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  |             $this->adminmenu =& $adminmenu; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  |      * Get the admin menu for the module | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  |     public function &getAdminMenu() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  |         if (!isset($this->adminmenu)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  |             $this->loadAdminMenu(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  |         return $this->adminmenu; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  |      * Load the module info for this module | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  |      * @param string $dirname Module directory | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  |      * @param bool   $verbose Give an error on fail? | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |      * @return bool true if loaded | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  |     public function loadInfo($dirname, $verbose = true) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |         static $modVersions; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  |         $dirname = basename($dirname); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  |         if (isset($modVersions[$dirname])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |             $this->modinfo = $modVersions[$dirname]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  |             return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |         global $xoopsConfig; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  |         if (file_exists($file = $GLOBALS['xoops']->path('modules/' . $dirname . '/language/' . $xoopsConfig['language'] . '/modinfo.php'))) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  |             include_once $file; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  |         } elseif (file_exists($file = $GLOBALS['xoops']->path('modules/' . $dirname . '/language/english/modinfo.php'))) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  |             include_once $file; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |         if (!file_exists($file = $GLOBALS['xoops']->path('modules/' . $dirname . '/xoops_version.php'))) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  |             if (false !== (bool)$verbose) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  |                 echo "Module File for $dirname Not Found!"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  |             return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  |         include $file; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |         $modVersions[$dirname] = $modversion; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  |         $this->modinfo         = $modVersions[$dirname]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  |         return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  |      * Search contents within a module | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  |      * @param  string  $term | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  |      * @param  string  $andor 'AND' or 'OR' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 |  |  |      * @param  integer $limit | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  |      * @param  integer $offset | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 |  |  |      * @param  integer $userid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 |  |  |      * @return mixed   Search result. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 |  |  |     public function search($term = '', $andor = 'AND', $limit = 0, $offset = 0, $userid = 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 |  |  |         if ($this->getVar('hassearch') != 1) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 |  |  |             return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 |  |  |         $search =& $this->getInfo('search'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  |         if ($this->getVar('hassearch') != 1 || !isset($search['file']) || !isset($search['func']) || $search['func'] == '' || $search['file'] == '') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 |  |  |             return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 |  |  |         if (file_exists($file = $GLOBALS['xoops']->path('modules/' . $this->getVar('dirname') . '/' . $search['file']))) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  |             include_once $file; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  |             return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  |         if (function_exists($search['func'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 |  |  |             $func = $search['func']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  |             return $func($term, $andor, $limit, $offset, $userid); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  |         return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 |  |  |      * Returns Class Base Variable mid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  |      * @param  string $format | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  |      * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  |     public function id($format = 'N') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 |  |  |         return $this->getVar('mid', $format); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  |      * Returns Class Base Variable mid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 |  |  |      * @param  string $format | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  |      * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 |  |  |     public function mid($format = '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 |  |  |         return $this->getVar('mid', $format); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 347 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 348 |  |  |      * Returns Class Base Variable name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 349 |  |  |      * @param  string $format | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 |  |  |      * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 352 |  |  |     public function name($format = '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 353 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 354 |  |  |         return $this->getVar('name', $format); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 355 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 356 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 357 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 358 |  |  |      * Returns Class Base Variable version | 
            
                                                                                                            
                            
            
                                    
            
            
                | 359 |  |  |      * @param  string $format | 
            
                                                                                                            
                            
            
                                    
            
            
                | 360 |  |  |      * @return mixed | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 361 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 362 |  |  |     public function version($format = '') | 
            
                                                                        
                            
            
                                    
            
            
                | 363 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 364 |  |  |         return $this->getVar('version', $format); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 365 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 366 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 367 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 368 |  |  |      * Returns Class Base Variable last_update | 
            
                                                                                                            
                            
            
                                    
            
            
                | 369 |  |  |      * @param  string $format | 
            
                                                                                                            
                            
            
                                    
            
            
                | 370 |  |  |      * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 371 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 372 |  |  |     public function last_update($format = '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 373 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 374 |  |  |         return $this->getVar('last_update', $format); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 375 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 376 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 377 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 378 |  |  |      * Returns Class Base Variable weight | 
            
                                                                                                            
                            
            
                                    
            
            
                | 379 |  |  |      * @param  string $format | 
            
                                                                                                            
                            
            
                                    
            
            
                | 380 |  |  |      * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 381 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 382 |  |  |     public function weight($format = '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 383 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 384 |  |  |         return $this->getVar('weight', $format); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 385 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 386 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 387 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 388 |  |  |      * Returns Class Base Variable isactive | 
            
                                                                                                            
                            
            
                                    
            
            
                | 389 |  |  |      * @param  string $format | 
            
                                                                                                            
                            
            
                                    
            
            
                | 390 |  |  |      * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 391 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 392 |  |  |     public function isactive($format = '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 393 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 394 |  |  |         return $this->getVar('isactive', $format); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 395 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 396 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 397 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 398 |  |  |      * Returns Class Base Variable dirname | 
            
                                                                                                            
                            
            
                                    
            
            
                | 399 |  |  |      * @param  string $format | 
            
                                                                                                            
                            
            
                                    
            
            
                | 400 |  |  |      * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 401 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 402 |  |  |     public function dirname($format = '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 403 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 404 |  |  |         return $this->getVar('dirname', $format); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 405 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 406 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 407 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 408 |  |  |      * Returns Class Base Variable hasmain | 
            
                                                                                                            
                            
            
                                    
            
            
                | 409 |  |  |      * @param  string $format | 
            
                                                                                                            
                            
            
                                    
            
            
                | 410 |  |  |      * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 411 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 412 |  |  |     public function hasmain($format = '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 413 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 414 |  |  |         return $this->getVar('hasmain', $format); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 415 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 416 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 417 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 418 |  |  |      * Returns Class Base Variable hasadmin | 
            
                                                                                                            
                            
            
                                    
            
            
                | 419 |  |  |      * @param  string $format | 
            
                                                                                                            
                            
            
                                    
            
            
                | 420 |  |  |      * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 421 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 422 |  |  |     public function hasadmin($format = '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 423 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 424 |  |  |         return $this->getVar('hasadmin', $format); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 425 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 426 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 427 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 428 |  |  |      * Returns Class Base Variable hassearch | 
            
                                                                                                            
                            
            
                                    
            
            
                | 429 |  |  |      * @param  string $format | 
            
                                                                                                            
                            
            
                                    
            
            
                | 430 |  |  |      * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 431 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 432 |  |  |     public function hassearch($format = '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 433 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 434 |  |  |         return $this->getVar('hassearch', $format); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 435 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 436 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 437 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 438 |  |  |      * Returns Class Base Variable hasconfig | 
            
                                                                                                            
                            
            
                                    
            
            
                | 439 |  |  |      * @param  string $format | 
            
                                                                                                            
                            
            
                                    
            
            
                | 440 |  |  |      * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 441 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 442 |  |  |     public function hasconfig($format = '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 443 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 444 |  |  |         return $this->getVar('hasconfig', $format); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 445 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 446 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 447 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 448 |  |  |      * Returns Class Base Variable hascomments | 
            
                                                                                                            
                            
            
                                    
            
            
                | 449 |  |  |      * @param  string $format | 
            
                                                                                                            
                            
            
                                    
            
            
                | 450 |  |  |      * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 451 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 452 |  |  |     public function hascomments($format = '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 453 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 454 |  |  |         return $this->getVar('hascomments', $format); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 455 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 456 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 457 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 458 |  |  |      * Returns Class Base Variable hasnotification | 
            
                                                                                                            
                            
            
                                    
            
            
                | 459 |  |  |      * @param  string $format | 
            
                                                                                                            
                            
            
                                    
            
            
                | 460 |  |  |      * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 461 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 462 |  |  |     public function hasnotification($format = '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 463 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 464 |  |  |         return $this->getVar('hasnotification', $format); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 465 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 466 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 467 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 468 |  |  |      * @param $dirname | 
            
                                                                                                            
                            
            
                                    
            
            
                | 469 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 470 |  |  |      * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 471 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 472 |  |  |     public static function getByDirname($dirname) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 473 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 474 |  |  |         /* @var XoopsModuleHandler $modhandler */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 475 |  |  |         $modhandler = xoops_getHandler('module'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 476 |  |  |         $inst       = $modhandler->getByDirname($dirname); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 477 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 478 |  |  |         return $inst; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 479 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 480 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 481 |  |  |     ##################### Deprecated Methods ###################### | 
            
                                                                                                            
                            
            
                                    
            
            
                | 482 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 483 |  |  |     /**#@+ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 484 |  |  |      * @deprecated | 
            
                                                                                                            
                            
            
                                    
            
            
                | 485 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 486 |  |  |     public function checkAccess() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 487 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 488 |  |  |         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 489 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 490 |  |  |         return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 491 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 492 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 493 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 494 |  |  |      * @param string $type | 
            
                                                                                                            
                            
            
                                    
            
            
                | 495 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 496 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 497 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 498 |  |  |     public function loadLanguage($type = 'main') | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 499 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 500 |  |  |         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 501 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 502 |  |  |         return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 503 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 504 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 505 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 506 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 507 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 508 |  |  |     public function loadErrorMessages() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 509 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 510 |  |  |         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 511 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 512 |  |  |         return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 513 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 514 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 515 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 516 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 517 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 518 |  |  |     public function getCurrentPage() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 519 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 520 |  |  |         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 521 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 522 |  |  |         return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 523 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 524 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 525 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 526 |  |  |      * @param array $admingroups | 
            
                                                                                                            
                            
            
                                    
            
            
                | 527 |  |  |      * @param array $accessgroups | 
            
                                                                                                            
                            
            
                                    
            
            
                | 528 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 529 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 530 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 531 |  |  |     public function install($admingroups = array(), $accessgroups = array()) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 532 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 533 |  |  |         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 534 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 535 |  |  |         return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 536 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 537 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 538 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 539 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 540 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 541 |  |  |     public function update() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 542 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 543 |  |  |         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 544 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 545 |  |  |         return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 546 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 547 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 548 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 549 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 550 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 551 |  |  |     public function insert() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 552 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 553 |  |  |         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 554 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 555 |  |  |         return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 556 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 557 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 558 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 559 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 560 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 561 |  |  |     public function executeSQL() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 562 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 563 |  |  |         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 564 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 565 |  |  |         return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 566 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 567 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 568 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 569 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 570 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 571 |  |  |     public function insertTemplates() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 572 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 573 |  |  |         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 574 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 575 |  |  |         return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 576 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 577 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 578 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 579 |  |  |      * @param      $template | 
            
                                                                                                            
                            
            
                                    
            
            
                | 580 |  |  |      * @param bool $block | 
            
                                                                                                            
                            
            
                                    
            
            
                | 581 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 582 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 583 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 584 |  |  |     public function gettemplate($template, $block = false) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 585 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 586 |  |  |         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 587 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 588 |  |  |         return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 589 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 590 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 591 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 592 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 593 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 594 |  |  |     public function insertBlocks() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 595 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 596 |  |  |         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 597 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 598 |  |  |         return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 599 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 600 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 601 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 602 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 603 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 604 |  |  |     public function insertConfigCategories() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 605 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 606 |  |  |         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 607 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 608 |  |  |         return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 609 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 610 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 611 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 612 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 613 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 614 |  |  |     public function insertConfig() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 615 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 616 |  |  |         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 617 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 618 |  |  |         return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 619 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 620 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 621 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 622 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 623 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 624 |  |  |     public function insertProfileFields() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 625 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 626 |  |  |         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 627 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 628 |  |  |         return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 629 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 630 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 631 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 632 |  |  |      * @param     $type | 
            
                                                                                                            
                            
            
                                    
            
            
                | 633 |  |  |      * @param int $state | 
            
                                                                                                            
                            
            
                                    
            
            
                | 634 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 635 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 636 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 637 |  |  |     public function executeScript($type, $state = 2) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 638 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 639 |  |  |         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 640 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 641 |  |  |         return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 642 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 643 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 644 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 645 |  |  |      * @param $groups | 
            
                                                                                                            
                            
            
                                    
            
            
                | 646 |  |  |      * @param $type | 
            
                                                                                                            
                            
            
                                    
            
            
                | 647 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 648 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 649 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 650 |  |  |     public function insertGroupPermissions($groups, $type) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 651 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 652 |  |  |         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 653 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 654 |  |  |         return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 655 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 656 |  |  |     /**#@-*/ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 657 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 658 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 659 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 660 |  |  |  * XOOPS module handler class. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 661 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 662 |  |  |  * This class is responsible for providing data access mechanisms to the data source | 
            
                                                                                                            
                            
            
                                    
            
            
                | 663 |  |  |  * of XOOPS module class objects. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 664 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 665 |  |  |  * @package       kernel | 
            
                                                                                                            
                            
            
                                    
            
            
                | 666 |  |  |  * @author        Kazumi Ono <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 667 |  |  |  * @copyright (c) 2000-2016 XOOPS Project - www.xoops.org | 
            
                                                                                                            
                            
            
                                    
            
            
                | 668 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 669 |  |  |  * @todo Why is this not a XoopsPersistableObjectHandler? | 
            
                                                                                                            
                            
            
                                    
            
            
                | 670 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 671 |  |  | class XoopsModuleHandler extends XoopsObjectHandler | 
            
                                                                                                            
                            
            
                                    
            
            
                | 672 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 673 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 674 |  |  |      * holds an array of cached module references, indexed by module id | 
            
                                                                                                            
                            
            
                                    
            
            
                | 675 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 676 |  |  |      * @var array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 677 |  |  |      * @access private | 
            
                                                                                                            
                            
            
                                    
            
            
                | 678 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 679 |  |  |     public $_cachedModule_mid = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 680 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 681 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 682 |  |  |      * holds an array of cached module references, indexed by module dirname | 
            
                                                                                                            
                            
            
                                    
            
            
                | 683 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 684 |  |  |      * @var array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 685 |  |  |      * @access private | 
            
                                                                                                            
                            
            
                                    
            
            
                | 686 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 687 |  |  |     public $_cachedModule_dirname = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 688 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 689 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 690 |  |  |      * Create a new {@link XoopsModule} object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 691 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 692 |  |  |      * @param  boolean $isNew Flag the new object as "new" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 693 |  |  |      * @return XoopsModule | 
            
                                                                                                            
                            
            
                                    
            
            
                | 694 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 695 |  |  |     public function create($isNew = true) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 696 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 697 |  |  |         $module = new XoopsModule(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 698 |  |  |         if ($isNew) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 699 |  |  |             $module->setNew(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 700 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 701 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 702 |  |  |         return $module; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 703 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 704 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 705 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 706 |  |  |      * Load a module from the database | 
            
                                                                                                            
                            
            
                                    
            
            
                | 707 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 708 |  |  |      * @param  int $id ID of the module | 
            
                                                                                                            
                            
            
                                    
            
            
                | 709 |  |  |      * @return object FALSE on fail | 
            
                                                                                                            
                            
            
                                    
            
            
                | 710 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 711 |  |  |     public function get($id) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 712 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 713 |  |  |         static $_cachedModule_dirname; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 714 |  |  |         static $_cachedModule_mid; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 715 |  |  |         $id     = (int)$id; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 716 |  |  |         $module = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 717 |  |  |         if ($id > 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 718 |  |  |             if (!empty($_cachedModule_mid[$id])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 719 |  |  |                 return $_cachedModule_mid[$id]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 720 |  |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 721 |  |  |                 $sql = 'SELECT * FROM ' . $this->db->prefix('modules') . ' WHERE mid = ' . $id; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 722 |  |  |                 if (!$result = $this->db->query($sql)) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 723 |  |  |                     return $module; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 724 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 725 |  |  |                 $numrows = $this->db->getRowsNum($result); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 726 |  |  |                 if ($numrows == 1) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 727 |  |  |                     $module = new XoopsModule(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 728 |  |  |                     $myrow  = $this->db->fetchArray($result); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 729 |  |  |                     $module->assignVars($myrow); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 730 |  |  |                     $_cachedModule_mid[$id]                            = &$module; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 731 |  |  |                     $_cachedModule_dirname[$module->getVar('dirname')] = &$module; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 732 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 733 |  |  |                     return $module; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 734 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 735 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 736 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 737 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 738 |  |  |         return $module; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 739 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 740 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 741 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 742 |  |  |      * Load a module by its dirname | 
            
                                                                                                            
                            
            
                                    
            
            
                | 743 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 744 |  |  |      * @param  string $dirname | 
            
                                                                                                            
                            
            
                                    
            
            
                | 745 |  |  |      * @return XoopsModule|FALSE on fail | 
            
                                                                                                            
                            
            
                                    
            
            
                | 746 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 747 |  |  |     public function getByDirname($dirname) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 748 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 749 |  |  |         $dirname = basename($dirname); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 750 |  |  |         //could not we check for spaces instead?? | 
            
                                                                                                            
                            
            
                                    
            
            
                | 751 |  |  |         if (strpos(strtolower($dirname), ' union ')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 752 |  |  |             return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 753 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 754 |  |  |         static $_cachedModule_mid; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 755 |  |  |         static $_cachedModule_dirname; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 756 |  |  |         if (!empty($_cachedModule_dirname[$dirname])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 757 |  |  |             return $_cachedModule_dirname[$dirname]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 758 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 759 |  |  |             $module = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 760 |  |  |             $sql    = 'SELECT * FROM ' . $this->db->prefix('modules') . " WHERE dirname = '" . trim($dirname) . "'"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 761 |  |  |             if (!$result = $this->db->query($sql)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 762 |  |  |                 return $module; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 763 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 764 |  |  |             $numrows = $this->db->getRowsNum($result); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 765 |  |  |             if ($numrows == 1) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 766 |  |  |                 $module = new XoopsModule(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 767 |  |  |                 $myrow  = $this->db->fetchArray($result); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 768 |  |  |                 $module->assignVars($myrow); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 769 |  |  |                 $_cachedModule_dirname[$dirname]           =& $module; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 770 |  |  |                 $_cachedModule_mid[$module->getVar('mid')] =& $module; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 771 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 772 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 773 |  |  |             return $module; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 774 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 775 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 776 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 777 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 778 |  |  |      * Write a module to the database | 
            
                                                                                                            
                            
            
                                    
            
            
                | 779 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 780 |  |  |      * @param  XoopsObject|XoopsModule $module a XoopsModule object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 781 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 782 |  |  |      * @return bool true on success, otherwise false | 
            
                                                                                                            
                            
            
                                    
            
            
                | 783 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 784 |  |  |     public function insert(XoopsObject $module) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 785 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 786 |  |  |         $className = 'XoopsModule'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 787 |  |  |         if (!($module instanceof $className)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 788 |  |  |             return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 789 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 790 |  |  |         if (!$module->isDirty()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 791 |  |  |             return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 792 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 793 |  |  |         if (!$module->cleanVars()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 794 |  |  |             return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 795 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 796 |  |  |         foreach ($module->cleanVars as $k => $v) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 797 |  |  |             ${$k} = $v; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 798 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 799 |  |  |         if ($module->isNew()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 800 |  |  |             $mid = $this->db->genId('modules_mid_seq'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 801 |  |  |             $sql = sprintf('INSERT INTO %s (mid, name, version, last_update, weight, isactive, dirname, hasmain, hasadmin, hassearch, hasconfig, hascomments, hasnotification) VALUES (%u, %s, %s, %u, %u, %u, %s, %u, %u, %u, %u, %u, %u)', $this->db->prefix('modules'), $mid, $this->db->quoteString($name), $this->db->quoteString($version), time(), $weight, 1, $this->db->quoteString($dirname), $hasmain, $hasadmin, $hassearch, $hasconfig, $hascomments, $hasnotification); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                            
                                                                                            
                                                                                            
                                                                                            
                                                                                            
                                                                                            
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 802 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 803 |  |  |             $sql = sprintf('UPDATE %s SET name = %s, dirname = %s, version = %s, last_update = %u, weight = %u, isactive = %u, hasmain = %u, hasadmin = %u, hassearch = %u, hasconfig = %u, hascomments = %u, hasnotification = %u WHERE mid = %u', $this->db->prefix('modules'), $this->db->quoteString($name), $this->db->quoteString($dirname), $this->db->quoteString($version), time(), $weight, $isactive, $hasmain, $hasadmin, $hassearch, $hasconfig, $hascomments, $hasnotification, $mid); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 804 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 805 |  |  |         if (!$result = $this->db->query($sql)) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 806 |  |  |             return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 807 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 808 |  |  |         if (empty($mid)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 809 |  |  |             $mid = $this->db->getInsertId(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 810 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 811 |  |  |         $module->assignVar('mid', $mid); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 812 |  |  |         if (!empty($this->_cachedModule_dirname[$dirname])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 813 |  |  |             unset($this->_cachedModule_dirname[$dirname]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 814 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 815 |  |  |         if (!empty($this->_cachedModule_mid[$mid])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 816 |  |  |             unset($this->_cachedModule_mid[$mid]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 817 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 818 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 819 |  |  |         return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 820 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 821 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 822 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 823 |  |  |      * Delete a module from the database | 
            
                                                                                                            
                            
            
                                    
            
            
                | 824 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 825 |  |  |      * @param  XoopsObject|XoopsModule $module a XoopsModule object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 826 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 827 |  |  |      * @return bool true on success, otherwise false | 
            
                                                                                                            
                            
            
                                    
            
            
                | 828 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 829 |  |  |     public function delete(XoopsObject $module) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 830 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 831 |  |  |         $className = 'XoopsModule'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 832 |  |  |         if (!($module instanceof $className)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 833 |  |  |             return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 834 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 835 |  |  |         $sql = sprintf('DELETE FROM %s WHERE mid = %u', $this->db->prefix('modules'), $module->getVar('mid')); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 836 |  |  |         if (!$result = $this->db->query($sql)) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 837 |  |  |             return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 838 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 839 |  |  |         // delete admin permissions assigned for this module | 
            
                                                                                                            
                            
            
                                    
            
            
                | 840 |  |  |         $sql = sprintf("DELETE FROM %s WHERE gperm_name = 'module_admin' AND gperm_itemid = %u", $this->db->prefix('group_permission'), $module->getVar('mid')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 841 |  |  |         $this->db->query($sql); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 842 |  |  |         // delete read permissions assigned for this module | 
            
                                                                                                            
                            
            
                                    
            
            
                | 843 |  |  |         $sql = sprintf("DELETE FROM %s WHERE gperm_name = 'module_read' AND gperm_itemid = %u", $this->db->prefix('group_permission'), $module->getVar('mid')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 844 |  |  |         $this->db->query($sql); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 845 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 846 |  |  |         $sql = sprintf('SELECT block_id FROM %s WHERE module_id = %u', $this->db->prefix('block_module_link'), $module->getVar('mid')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 847 |  |  |         if ($result = $this->db->query($sql)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 848 |  |  |             $block_id_arr = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 849 |  |  |             while (false !== ($myrow = $this->db->fetchArray($result))) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 850 |  |  |                 $block_id_arr[] = $myrow['block_id']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 851 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 852 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 853 |  |  |         // loop through block_id_arr | 
            
                                                                                                            
                            
            
                                    
            
            
                | 854 |  |  |         if (isset($block_id_arr)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 855 |  |  |             foreach ($block_id_arr as $i) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 856 |  |  |                 $sql = sprintf('SELECT block_id FROM %s WHERE module_id != %u AND block_id = %u', $this->db->prefix('block_module_link'), $module->getVar('mid'), $i); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 857 |  |  |                 if ($result2 = $this->db->query($sql)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 858 |  |  |                     if (0 < $this->db->getRowsNum($result2)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 859 |  |  |                         // this block has other entries, so delete the entry for this module | 
            
                                                                                                            
                            
            
                                    
            
            
                | 860 |  |  |                         $sql = sprintf('DELETE FROM %s WHERE (module_id = %u) AND (block_id = %u)', $this->db->prefix('block_module_link'), $module->getVar('mid'), $i); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 861 |  |  |                         $this->db->query($sql); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 862 |  |  |                     } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 863 |  |  |                         // this block doesnt have other entries, so disable the block and let it show on top page only. otherwise, this block will not display anymore on block admin page! | 
            
                                                                                                            
                            
            
                                    
            
            
                | 864 |  |  |                         $sql = sprintf('UPDATE %s SET visible = 0 WHERE bid = %u', $this->db->prefix('newblocks'), $i); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 865 |  |  |                         $this->db->query($sql); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 866 |  |  |                         $sql = sprintf('UPDATE %s SET module_id = -1 WHERE module_id = %u', $this->db->prefix('block_module_link'), $module->getVar('mid')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 867 |  |  |                         $this->db->query($sql); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 868 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 869 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 870 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 871 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 872 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 873 |  |  |         if (!empty($this->_cachedModule_dirname[$module->getVar('dirname')])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 874 |  |  |             unset($this->_cachedModule_dirname[$module->getVar('dirname')]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 875 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 876 |  |  |         if (!empty($this->_cachedModule_mid[$module->getVar('mid')])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 877 |  |  |             unset($this->_cachedModule_mid[$module->getVar('mid')]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 878 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 879 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 880 |  |  |         return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 881 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 882 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 883 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 884 |  |  |      * Load some modules | 
            
                                                                                                            
                            
            
                                    
            
            
                | 885 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 886 |  |  |      * @param  CriteriaElement|CriteriaCompo $criteria  {@link CriteriaElement} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 887 |  |  |      * @param  boolean         $id_as_key Use the ID as key into the array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 888 |  |  |      * @return array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 889 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 890 |  |  |     public function getObjects(CriteriaElement $criteria = null, $id_as_key = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 891 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 892 |  |  |         $ret   = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 893 |  |  |         $limit = $start = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 894 |  |  |         $sql   = 'SELECT * FROM ' . $this->db->prefix('modules'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 895 |  |  |         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 896 |  |  |             $sql .= ' ' . $criteria->renderWhere(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 897 |  |  |             $sql .= ' ORDER BY weight ' . $criteria->getOrder() . ', mid ASC'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 898 |  |  |             $limit = $criteria->getLimit(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 899 |  |  |             $start = $criteria->getStart(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 900 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 901 |  |  |         $result = $this->db->query($sql, $limit, $start); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 902 |  |  |         if (!$result) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 903 |  |  |             return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 904 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 905 |  |  |         while (false !== ($myrow = $this->db->fetchArray($result))) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 906 |  |  |             $module = new XoopsModule(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 907 |  |  |             $module->assignVars($myrow); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 908 |  |  |             if (!$id_as_key) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 909 |  |  |                 $ret[] =& $module; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 910 |  |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 911 |  |  |                 $ret[$myrow['mid']] =& $module; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 912 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 913 |  |  |             unset($module); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 914 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 915 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 916 |  |  |         return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 917 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 918 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 919 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 920 |  |  |      * Count some modules | 
            
                                                                                                            
                            
            
                                    
            
            
                | 921 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 922 |  |  |      * @param  CriteriaElement|CriteriaCompo $criteria {@link CriteriaElement} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 923 |  |  |      * @return int | 
            
                                                                                                            
                            
            
                                    
            
            
                | 924 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 925 |  |  |     public function getCount(CriteriaElement $criteria = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 926 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 927 |  |  |         $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('modules'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 928 |  |  |         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 929 |  |  |             $sql .= ' ' . $criteria->renderWhere(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 930 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 931 |  |  |         if (!$result = $this->db->query($sql)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 932 |  |  |             return 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 933 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 934 |  |  |         list($count) = $this->db->fetchRow($result); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 935 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 936 |  |  |         return $count; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 937 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 938 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 939 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 940 |  |  |      * returns an array of module names | 
            
                                                                                                            
                            
            
                                    
            
            
                | 941 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 942 |  |  |      * @param  CriteriaElement $criteria | 
            
                                                                                                            
                            
            
                                    
            
            
                | 943 |  |  |      * @param  boolean         $dirname_as_key if true, array keys will be module directory names | 
            
                                                                                                            
                            
            
                                    
            
            
                | 944 |  |  |      *                                         if false, array keys will be module id | 
            
                                                                                                            
                            
            
                                    
            
            
                | 945 |  |  |      * @return array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 946 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 947 |  |  |     public function getList(CriteriaElement $criteria = null, $dirname_as_key = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 948 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 949 |  |  |         $ret     = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 950 |  |  |         $modules = $this->getObjects($criteria, true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 951 |  |  |         foreach (array_keys($modules) as $i) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 952 |  |  |             if (!$dirname_as_key) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 953 |  |  |                 $ret[$i] = $modules[$i]->getVar('name'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 954 |  |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 955 |  |  |                 $ret[$modules[$i]->getVar('dirname')] = $modules[$i]->getVar('name'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 956 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 957 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 958 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 959 |  |  |         return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 960 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 961 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 962 |  |  |  |