Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace:

Diff

368
 
410
 
410
 
modules.php
_> 142142       return $modules;
  143143     }
  144144 
<> 145 -    function isInstalled() {
   145+    function isInstalled($code = '', $group = '') {
146146       global $osC_Database;
  147147 
<> 148 -      static $is_installed;
   148+      if (empty($code) && empty($group)) {
   149+        static $is_installed;
149150 
<>  151+        $code = $this->_code;
   152+        $group = $this->_group;
   153+      }
   154+
150155       if (isset($is_installed) === false) {
  151156         $Qcheck = $osC_Database->query('select id from :table_templates_boxes where code = :code and modules_group = :modules_group');
  152157         $Qcheck->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES);
<> 153 -        $Qcheck->bindValue(':code', $this->_code);
  154 -        $Qcheck->bindValue(':modules_group', $this->_group);
   158+        $Qcheck->bindValue(':code', $code);
   159+        $Qcheck->bindValue(':modules_group', $group);
155160         $Qcheck->execute();
  156161 
  157162         $is_installed = ($Qcheck->numberOfRows()) ? true : false;
     
 !
183188     }
  184189 
  185190     function install() {
<> 186 -      global $osC_Database;
   191+      global $osC_Database, $osC_Language;
187192 
  188193       $Qinstall = $osC_Database->query('insert into :table_templates_boxes (title, code, author_name, author_www, modules_group) values (:title, :code, :author_name, :author_www, :modules_group)');
  189194       $Qinstall->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES);
     
 !
193198       $Qinstall->bindValue(':author_www', $this->_author_www);
  194199       $Qinstall->bindValue(':modules_group', $this->_group);
  195200       $Qinstall->execute();
<>  201+
   202+      foreach ($osC_Language->getAll() as $key => $value) {
   203+        if (file_exists(dirname(__FILE__) . '/../languages/' . $key . '/modules/' . $this->_group . '/' . $this->_code . '.xml')) {
   204+          foreach ($osC_Language->extractDefinitions($key . '/modules/' . $this->_group . '/' . $this->_code . '.xml') as $def) {
   205+            $Qcheck = $osC_Database->query('select id from :table_languages_definitions where definition_key = :definition_key and content_group = :content_group and languages_id = :languages_id limit 1');
   206+            $Qcheck->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
   207+            $Qcheck->bindValue(':definition_key', $def['key']);
   208+            $Qcheck->bindValue(':content_group', $def['group']);
   209+            $Qcheck->bindInt(':languages_id', $value['id']);
   210+            $Qcheck->execute();
   211+
   212+            if ($Qcheck->numberOfRows() === 1) {
   213+              $Qdef = $osC_Database->query('update :table_languages_definitions set definition_value = :definition_value where definition_key = :definition_key and content_group = :content_group and languages_id = :languages_id');
   214+            } else {
   215+              $Qdef = $osC_Database->query('insert into :table_languages_definitions (languages_id, content_group, definition_key, definition_value) values (:languages_id, :content_group, :definition_key, :definition_value)');
   216+            }
   217+            $Qdef->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
   218+            $Qdef->bindInt(':languages_id', $value['id']);
   219+            $Qdef->bindValue(':content_group', $def['group']);
   220+            $Qdef->bindValue(':definition_key', $def['key']);
   221+            $Qdef->bindValue(':definition_value', $def['value']);
   222+            $Qdef->execute();
   223+          }
   224+        }
   225+      }
   226+
   227+      osC_Cache::clear('languages');
196228     }
  197229 
  198230     function remove() {
<> 199 -      global $osC_Database;
   231+      global $osC_Database, $osC_Language;
200232 
  201233       $Qmodule = $osC_Database->query('select id from :table_templates_boxes where code = :code and modules_group = :modules_group');
  202234       $Qmodule->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES);
     
 !
221253         $Qdel->bindRaw(':configuration_key', implode('", "', $this->getKeys()));
  222254         $Qdel->execute();
  223255       }
<>  256+
   257+      if (file_exists(dirname(__FILE__) . '/../languages/' . $osC_Language->getCode() . '/modules/' . $this->_group . '/' . $this->_code . '.xml')) {
   258+        foreach ($osC_Language->extractDefinitions($osC_Language->getCode() . '/modules/' . $this->_group . '/' . $this->_code . '.xml') as $def) {
   259+          $Qdel = $osC_Database->query('delete from :table_languages_definitions where definition_key = :definition_key and content_group = :content_group');
   260+          $Qdel->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
   261+          $Qdel->bindValue(':definition_key', $def['key']);
   262+          $Qdel->bindValue(':content_group', $def['group']);
   263+          $Qdel->execute();
   264+        }
   265+
   266+        osC_Cache::clear('languages');
   267+      }
<_ 224268     }
  225269   }
  226270 ?>