Exemple #1
0
 public function __construct($subject, $config = array())
 {
     // Require the library loader
     if (self::canEnable()) {
         require_once JPATH_PLUGINS . DS . 'system' . DS . 'koowa' . DS . 'koowa.php';
         require_once JPATH_PLUGINS . DS . 'system' . DS . 'koowa' . DS . 'loader.php';
         // Proxy the application object
         $app =& JFactory::getApplication();
         $app = new KProxyJoomlaApplication($app);
         // Proxy the database object
         $db =& JFactory::getDBO();
         $db = new KDatabase($db);
         //ACL uses the unwrapped DBO
         $acl = JFactory::getACL();
         $acl->_db = $db->getObject();
         // getObject returns the unwrapped DBO
         //Load the koowa plugins
         JPluginHelper::importPlugin('koowa', null, true, KFactory::get('lib.koowa.event.dispatcher'));
     }
     parent::__construct($subject, $config = array());
 }
Exemple #2
0
 public function __construct($subject, $config = array())
 {
     require_once JPATH_PLUGINS . DS . 'system' . DS . 'koowa' . DS . 'koowa.php';
     require_once JPATH_PLUGINS . DS . 'system' . DS . 'koowa' . DS . 'loader.php';
     // Proxy the application object
     $app =& JFactory::getApplication();
     $app = new KProxyJoomlaApplication($app);
     // Don't proxy the dataase if we are in com_installer
     if (KInput::get('option', array('get', 'post'), 'cmd') != 'com_installer') {
         // Proxy the database object
         $db =& JFactory::getDBO();
         $db = new KDatabase($db);
         //ACL uses the unwrapped DBO
         $acl = JFactory::getACL();
         $acl->_db = $db->getObject();
         // getObject returns the unwrapped DBO
     }
     //Load the koowa plugins
     JPluginHelper::importPlugin('koowa', null, true, KFactory::get('lib.koowa.event.dispatcher'));
     parent::__construct($subject, $config = array());
 }
 /**
  * Used for syncing INSERT, UPDATE, DELETE, and other queries that don't return rows.
  * Returns number of affected rows.
  *
  * @param  string 	$sql 		The query to run.
  * @return integer 	The number of rows affected by $sql.
  */
 public function sync($sql)
 {
     // Match all of the database tables in the query using the prefix modifier
     if (preg_match($this->_tables_regex, $sql, $tName)) {
         if ($this->isTableTranslatable($tName[1])) {
             foreach (array_keys($this->_languages) as $language) {
                 if ($language == $this->_lang_primary) {
                     continue;
                 }
                 $query = str_replace($tName[0], $this->_object->nameQuote('#__' . strtolower($language) . '_' . $tName[1]) . $tName[2], $sql);
                 if (parent::execute($query) === false) {
                     $this->setError($this->getErrorMsg());
                     return false;
                 }
             }
         }
     }
     return 0;
 }