*/ function &core_object($object){ static $objects = array(); // if object loaded already return reference if($objects[$object]){ return $objects[$object]; } if(!@is_readable(PAIKIKI_BASE.'inc/core/'.$object.'.class.php')){ die('Core object '.hsc($object).' does not exist'); } require_once(PAIKIKI_BASE.'inc/core/'.$object.'.class.php'); $objects[$object] = new $object(); return $objects[$object]; } /** * Get one of the core objects. Always returns a new one. * * @return an object reference or null on error * @author Andreas Gohr */ function &core_factory($object){ if(!@is_readable(PAIKIKI_BASE.'inc/core/'.$object.'.class.php')){ die('Core object '.hsc($object).' does not exist'); } require_once(PAIKIKI_BASE.'inc/core/'.$object.'.class.php'); $obj = new $object(); return $obj; } /** * Bootstrap Conf and DB objects * * They have some kind of circular reference, so we boot them manually * here. * * @author Andreas Gohr */ function core_bootstrap(){ $Conf =& core_object('Conf'); $DB =& core_object('DB'); $Conf->load(); $Login =& core_object('Login'); if($_REQUEST['logout']){ $Login->logout(); }else{ $Login->checkcookie(); } } //Setup VIM: ex: et ts=4 enc=utf-8 :