/** * Setup for the Joom!Fish database connectors, overwriting the original instances of Joomla! * Which connector is used and which technique is based on the extension configuration * @return void */ function _setupJFDatabase() { if ($this->_config["adapter"] == "decorator") { if (file_exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_joomfish' . DS . 'jfdatabase_decorator.class.php')) { require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_joomfish' . DS . 'jfdatabase_decorator.class.php'; $db =& JFactory::getDBO(); $db = new JFDatabase(); $conf =& JFactory::getConfig(); $conf->setValue('config.mbf_content', 1); $conf->setValue('config.multilingual_support', 1); // TODO: check on legacy mode on or off $GLOBALS['database'] = $db; } } else { if (file_exists(dirname(__FILE__) . DS . 'jfdatabase' . DS . 'jfdatabase_inherit.php')) { require_once dirname(__FILE__) . DS . 'jfdatabase' . DS . 'jfdatabase_inherit.php'; $conf =& JFactory::getConfig(); $host = $conf->getValue('config.host'); $user = $conf->getValue('config.user'); $password = $conf->getValue('config.password'); $db = $conf->getValue('config.db'); $dbprefix = $conf->getValue('config.dbprefix'); $dbtype = $conf->getValue('config.dbtype'); $debug = $conf->getValue('config.debug'); $driver = $conf->getValue('config.dbtype'); $options = array("driver" => $driver, "host" => $host, "user" => $user, "password" => $password, "database" => $db, "prefix" => $dbprefix, "select" => true); $db =& JFactory::getDBO(); $db = new JFDatabase($options); $debug = $conf->getValue('config.debug'); $db->debug($debug); if ($db->getErrorNum() > 2) { JError::raiseError('joomla.library:' . $db->getErrorNum(), 'JDatabase::getInstance: Could not connect to database <br/>' . $db->getErrorMsg()); } $conf->setValue('config.mbf_content', 1); $conf->setValue('config.multilingual_support', 1); // legacy mode only // check on legacy mode on/off by testing existence of $database global if (defined('_JLEGACY') && array_key_exists('database', $GLOBALS)) { $GLOBALS['database'] = new mldatabase($options); $GLOBALS['database']->debug($conf->getValue('config.debug')); } //echo phpinfo(); } } }
/** * private function to handle the requirement to call different loadObject version based on class * * @param boolran $translate * @param string $language */ function _loadObject($translate = true, $language = null) { return parent::loadObject($translate, $language); }
/** * Setup for the Joom!Fish database connectors, overwriting the original instances of Joomla! * Which connector is used and which technique is based on the extension configuration * @return void */ protected function setupJFDatabase() { if (file_exists(dirname(__FILE__) . DS . 'jfdatabase_inherit.php')) { require_once dirname(__FILE__) . DS . 'jfdatabase_inherit.php'; // make sure jfManager is initialised before we switch db handler $jfManager = JoomFishManager::getInstance(); $conf = JFactory::getConfig(); $host = $conf->getValue('config.host'); $user = $conf->getValue('config.user'); $password = $conf->getValue('config.password'); $db = $conf->getValue('config.db'); $dbprefix = $conf->getValue('config.dbprefix'); $dbtype = $conf->getValue('config.dbtype'); $debug = $conf->getValue('config.debug'); $driver = $conf->getValue('config.dbtype'); $options = array("driver" => $driver, "host" => $host, "user" => $user, "password" => $password, "database" => $db, "prefix" => $dbprefix, "select" => true); $db = new JFDatabase($options); $debug = $conf->getValue('config.debug'); $db->debug($debug); if ($db->getErrorNum() > 2) { JError::raiseError('joomla.library:' . $db->getErrorNum(), 'JDatabase::getInstance: Could not connect to database <br/>' . $db->getErrorMsg()); } // replace the database handle in the factory JFactory::$database = null; JFactory::$database = $db; $conf->setValue('config.mbf_content', 1); $conf->setValue('config.multilingual_support', 1); } }