[ Index ] |
|
Code source de CMS made simple 1.0.5 |
1 <?php 2 #(c)2004 by Ted Kulp (wishy@users.sf.net) 3 #This project's homepage is: http://cmsmadesimple.sf.net 4 # 5 #This program is free software; you can redistribute it and/or modify 6 #it under the terms of the GNU General Public License as published by 7 #the Free Software Foundation; either version 2 of the License, or 8 #(at your option) any later version. 9 # 10 #This program is distributed in the hope that it will be useful, 11 #but WITHOUT ANY WARRANTY; without even the implied warranty of 12 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 #GNU General Public License for more details. 14 #You should have received a copy of the GNU General Public License 15 #along with this program; if not, write to the Free Software 16 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 # 18 #$Id: class.global.inc.php 3745 2007-01-13 20:14:47Z dittmann $ 19 20 /** 21 * Global class for easy access to all important variables. 22 * 23 * @package CMS 24 */ 25 26 /** 27 * Simple global object to hold references to other objects 28 * 29 * Global object that holds references to various data sctructures 30 * needed by classes/functions in CMS. Initialized in include.php 31 * as $gCms for use in every page. 32 * 33 * @since 0.5 34 */ 35 class CmsObject { 36 37 /** 38 * Config object - hash containing variables from config.php 39 */ 40 var $config; 41 42 /** 43 * Database object - adodb reference to the current database 44 */ 45 var $db; 46 47 /** 48 * Variables object - various objects and strings needing to be passed 49 */ 50 var $variables; 51 52 /** 53 * Modules object - holds references to all registered modules 54 */ 55 var $cmsmodules; 56 57 /** 58 * System Modules - a list (hardcoded) of all system modules 59 */ 60 var $cmssystemmodules; 61 62 /** 63 * Plugins object - holds list of all registered plugins 64 */ 65 var $cmsplugins; 66 67 /** 68 * User Plugins object - holds list and function pointers of all registered user plugins 69 */ 70 var $userplugins; 71 72 /** 73 * BBCode object - for use in bbcode parsing 74 */ 75 var $bbcodeparser; 76 77 /** 78 * Site Preferences object - holds all current site preferences so they're only loaded once 79 */ 80 var $siteprefs; 81 82 /** 83 * User Preferences object - holds user preferences as they're loaded so they're only loaded once 84 */ 85 var $userprefs; 86 87 /** 88 * Smarty object - holds reference to the current smarty object -- will not be set in the admin 89 */ 90 var $smarty; 91 92 /** 93 * Internal error array - So functions/modules can store up debug info and spit it all out at once 94 */ 95 var $errors; 96 97 /** 98 * nls array - This holds all of the nls information for different languages 99 */ 100 var $nls; 101 102 /** 103 * template cache array - If something's called LoadTemplateByID, we keep a copy around 104 */ 105 var $TemplateCache; 106 107 /** 108 * template cache array - If something's called LoadTemplateByID, we keep a copy around 109 */ 110 var $StylesheetCache; 111 112 /** 113 * html blob cache array - If something's called LoadHtmlBlobByID, we keep a copy around 114 */ 115 var $HtmlBlobCache; 116 117 /** 118 * content types array - List of available content types 119 */ 120 var $contenttypes; 121 122 /** 123 * Constructor 124 */ 125 function CmsObject() 126 { 127 $this->cmssystemmodules = 128 array( 'nuSOAP', 'MenuManager', 'ModuleManager' ); 129 $this->modules = array(); 130 $this->errors = array(); 131 $this->nls = array(); 132 $this->contenttypes = array(); 133 $this->TemplateCache = array(); 134 $this->StylesheetCache = array(); 135 $this->variables['content-type'] = 'text/html'; 136 $this->variables['modulenum'] = 1; 137 $this->variables['routes'] = array(); 138 139 #Setup hash for storing all modules and plugins 140 $this->cmsmodules = array(); 141 $this->userplugins = array(); 142 $this->userpluginfunctions = array(); 143 $this->cmsplugins = array(); 144 $this->siteprefs = array(); 145 146 register_shutdown_function(array(&$this, 'dbshutdown')); 147 } 148 149 function & GetDb() 150 { 151 #static $dbinstance; 152 153 //Check to see if it hasn't been 154 //instantiated yet. If not, connect 155 //and return it 156 #if (!isset($dbinstance) && !isset($this->db)) 157 global $DONT_LOAD_DB; 158 if (!isset($this->db) && !isset($DONT_LOAD_DB)) 159 { 160 $this->db =& adodb_connect(); 161 } 162 163 #return $dbinstance; 164 $db =& $this->db; 165 return ($db); 166 } 167 168 function & GetConfig() 169 { 170 if (!isset($this->config)) 171 { 172 $configinstance = cms_config_load(true); 173 $this->config = &$configinstance; 174 } 175 176 return $this->config; 177 } 178 179 function & GetModuleLoader() 180 { 181 if (!isset($this->moduleloader)) 182 { 183 require_once(cms_join_path(dirname(__FILE__), 'class.moduleloader.inc.php')); 184 $moduleloader =& new ModuleLoader(); 185 $this->moduleloader = &$moduleloader; 186 } 187 188 return $this->moduleloader; 189 } 190 191 function & GetModuleOperations() 192 { 193 if (!isset($this->moduleoperations)) 194 { 195 require_once(cms_join_path(dirname(__FILE__), 'class.moduleoperations.inc.php')); 196 $moduleoperations =& new ModuleOperations(); 197 $this->moduleoperations = &$moduleoperations; 198 } 199 200 return $this->moduleoperations; 201 } 202 203 function & GetUserOperations() 204 { 205 if (!isset($this->useroperations)) 206 { 207 require_once(cms_join_path(dirname(__FILE__), 'class.useroperations.inc.php')); 208 $useroperations =& new UserOperations(); 209 $this->useroperations = &$useroperations; 210 } 211 212 return $this->useroperations; 213 } 214 215 function & GetContentOperations() 216 { 217 if (!isset($this->contentoperations)) 218 { 219 debug_buffer('', 'Load Content Operations'); 220 require_once(cms_join_path(dirname(__FILE__), 'class.contentoperations.inc.php')); 221 $contentoperations =& new ContentOperations(); 222 $this->contentoperations = &$contentoperations; 223 debug_buffer('', 'End Load Content Operations'); 224 } 225 226 return $this->contentoperations; 227 } 228 229 function & GetBookmarkOperations() 230 { 231 if (!isset($this->bookmarkoperations)) 232 { 233 require_once(cms_join_path(dirname(__FILE__), 'class.bookmarkoperations.inc.php')); 234 $bookmarkoperations =& new BookmarkOperations(); 235 $this->bookmarkoperations = &$bookmarkoperations; 236 } 237 238 return $this->bookmarkoperations; 239 } 240 241 function & GetTemplateOperations() 242 { 243 if (!isset($this->templateoperations)) 244 { 245 require_once(cms_join_path(dirname(__FILE__), 'class.templateoperations.inc.php')); 246 $templateoperations =& new TemplateOperations(); 247 $this->templateoperations = &$templateoperations; 248 } 249 250 return $this->templateoperations; 251 } 252 253 function & GetStylesheetOperations() 254 { 255 if (!isset($this->stylesheetoperations)) 256 { 257 require_once(cms_join_path(dirname(__FILE__), 'class.stylesheetoperations.inc.php')); 258 $stylesheetoperations =& new StylesheetOperations(); 259 $this->stylesheetoperations = &$stylesheetoperations; 260 } 261 262 return $this->stylesheetoperations; 263 } 264 265 function & GetGroupOperations() 266 { 267 if (!isset($this->groupoperations)) 268 { 269 require_once(cms_join_path(dirname(__FILE__), 'class.groupoperations.inc.php')); 270 $groupoperations =& new GroupOperations(); 271 $this->groupoperations = &$groupoperations; 272 } 273 274 return $this->groupoperations; 275 } 276 277 function & GetGlobalContentOperations() 278 { 279 if (!isset($this->globalcontentoperations)) 280 { 281 require_once(cms_join_path(dirname(__FILE__), 'class.globalcontentoperations.inc.php')); 282 $globalcontentoperations =& new GlobalContentOperations(); 283 $this->globalcontentoperations = &$globalcontentoperations; 284 } 285 286 return $this->globalcontentoperations; 287 } 288 289 function & GetUserTagOperations() 290 { 291 if (!isset($this->usertagoperations)) 292 { 293 require_once(cms_join_path(dirname(__FILE__), 'class.usertagoperations.inc.php')); 294 $usertagoperations =& new UserTagOperations(); 295 $this->usertagoperations = &$usertagoperations; 296 } 297 298 return $this->usertagoperations; 299 } 300 301 function & GetSmarty() 302 { 303 //Check to see if it hasn't been 304 //instantiated yet. If not, connect 305 //and return it 306 if (!isset($this->smarty)) 307 { 308 $conf =& $this->GetConfig(); 309 310 if (!defined('SMARTY_DIR')) 311 { 312 define('SMARTY_DIR', cms_join_path($dirname,'lib','smarty') . DIRECTORY_SEPARATOR); 313 } 314 315 #Setup global smarty object 316 $this->smarty =& new Smarty_CMS($conf); 317 } 318 319 return $this->smarty; 320 } 321 322 function & GetHierarchyManager() 323 { 324 //Check to see if it hasn't been 325 //instantiated yet. If not, connect 326 //and return it 327 if (!isset($this->hrinstance)) 328 { 329 debug_buffer('', 'Start Loading Hierarchy Manager'); 330 #require_once(dirname(__FILE__).'/class.contenthierarchymanager.inc.php'); 331 332 #Setup global smarty object 333 $contentops =& $this->GetContentOperations(); 334 $this->hrinstance =& $contentops->GetAllContentAsHierarchy(false, array()); 335 debug_buffer('', 'End Loading Hierarchy Manager'); 336 } 337 338 return $this->hrinstance; 339 } 340 341 function dbshutdown() 342 { 343 if (isset($this->db)) 344 { 345 $db =& $this->db; 346 if ($db->IsConnected()) 347 $db->Close(); 348 } 349 } 350 } 351 352 class CmsRoute 353 { 354 var $module; 355 var $regex; 356 var $defaults; 357 } 358 359 class CmsContentTypePlaceholder 360 { 361 var $type; 362 var $filename; 363 var $friendlyname; 364 var $loaded; 365 } 366 367 # vim:ts=4 sw=4 noet 368 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Tue Apr 3 18:50:37 2007 | par Balluche grâce à PHPXref 0.7 |