Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace:

Diff

332
 
333
 
333
 
modules.php
_> 1010   Released under the GNU General Public License
  1111 */
  1212 
<> 13 -  class osC_Boxes {
  14 -    var $_boxes,
   13+  class osC_Modules {
   14+    var $_modules,
1515         $_code,
  1616         $_title,
  1717         $_title_link,
  1818         $_content,
  1919         $_author_name,
  2020         $_author_www,
  2121         $_keys,
<> 22 -        $_module_group;
   22+        $_group;
2323 
<> 24 -    function osC_Boxes($module_group) {
  25 -      $this->_module_group = $module_group;
  26 -
   24+    function osC_Modules($group) {
2725       global $osC_Database, $osC_Template, $osC_Cache;
  2826 
<> 29 -      if ($osC_Cache->read('templates_' . $this->_module_group . '_layout-' . $osC_Template->getTemplate() . '-' . $osC_Template->getGroup() . '-' . $osC_Template->getPageContentsFilename())) {
   27+      $this->_group = $group;
   28+
   29+      if ($osC_Cache->read('templates_' . $this->_group . '_layout-' . $osC_Template->getTemplate() . '-' . $osC_Template->getGroup() . '-' . $osC_Template->getPageContentsFilename())) {
3030         $data = $osC_Cache->getCache();
  3131       } else {
  3232         $data = array();
     
 !
3737         $Qspecific->bindTable(':table_templates', TABLE_TEMPLATES);
  3838         $Qspecific->bindInt(':templates_id', 1);
  3939         $Qspecific->bindRaw(':content_page', '"*", "' . $osC_Template->getGroup() . '/*", "' . $osC_Template->getGroup() . '/' . substr($osC_Template->getPageContentsFilename(), 0, strrpos($osC_Template->getPageContentsFilename(), '.')) . '"');
<> 40 -        $Qspecific->bindValue(':modules_group', $this->_module_group);
   40+        $Qspecific->bindValue(':modules_group', $this->_group);
4141         $Qspecific->execute();
  4242 
  4343         if ($Qspecific->numberOfRows()) {
  4444           while ($Qspecific->next()) {
  4545             $data[$Qspecific->value('boxes_group')][] = $Qspecific->value('code');
  4646           }
  4747         } else {
<> 48 -          $Qboxes = $osC_Database->query('select b2p.boxes_group, b2p.content_page, b.code from :table_templates_boxes_to_pages b2p, :table_templates_boxes b, :table_templates t where b2p.templates_id = :templates_id and b2p.content_page in (:content_page) and b2p.templates_boxes_id = b.id and b.modules_group = :modules_group and b2p.templates_id = t.id order by b2p.boxes_group, b2p.sort_order');
  49 -          $Qboxes->bindTable(':table_templates_boxes_to_pages', TABLE_TEMPLATES_BOXES_TO_PAGES);
  50 -          $Qboxes->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES);
  51 -          $Qboxes->bindTable(':table_templates', TABLE_TEMPLATES);
  52 -          $Qboxes->bindInt(':templates_id', 1);
  53 -          $Qboxes->bindRaw(':content_page', '"*", "' . $osC_Template->getGroup() . '/*", "' . $osC_Template->getGroup() . '/' . substr($osC_Template->getPageContentsFilename(), 0, strrpos($osC_Template->getPageContentsFilename(), '.')) . '"');
  54 -          $Qboxes->bindValue(':modules_group', $this->_module_group);
  55 -          $Qboxes->execute();
   48+          $_data = array();
5649 
<> 57 -          while ($Qboxes->next()) {
  58 -            $_data[$Qboxes->value('boxes_group')][] = array('code' => $Qboxes->value('code'),
  59 -                                                            'page' => $Qboxes->value('content_page'));
   50+          $Qmodules = $osC_Database->query('select b2p.boxes_group, b2p.content_page, b.code from :table_templates_boxes_to_pages b2p, :table_templates_boxes b, :table_templates t where b2p.templates_id = :templates_id and b2p.content_page in (:content_page) and b2p.templates_boxes_id = b.id and b.modules_group = :modules_group and b2p.templates_id = t.id order by b2p.boxes_group, b2p.sort_order');
   51+          $Qmodules->bindTable(':table_templates_boxes_to_pages', TABLE_TEMPLATES_BOXES_TO_PAGES);
   52+          $Qmodules->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES);
   53+          $Qmodules->bindTable(':table_templates', TABLE_TEMPLATES);
   54+          $Qmodules->bindInt(':templates_id', 1);
   55+          $Qmodules->bindRaw(':content_page', '"*", "' . $osC_Template->getGroup() . '/*", "' . $osC_Template->getGroup() . '/' . substr($osC_Template->getPageContentsFilename(), 0, strrpos($osC_Template->getPageContentsFilename(), '.')) . '"');
   56+          $Qmodules->bindValue(':modules_group', $this->_group);
   57+          $Qmodules->execute();
   58+
   59+          while ($Qmodules->next()) {
   60+            $_data[$Qmodules->value('boxes_group')][] = array('code' => $Qmodules->value('code'),
   61+                                                              'page' => $Qmodules->value('content_page'));
6062           }
  6163 
<> 62 -          foreach ($_data as $groups => $boxes) {
   64+          foreach ($_data as $groups => $modules) {
6365             $clean = array();
  6466 
<> 65 -            foreach ($boxes as $box) {
  66 -              if (isset($clean[$box['code']])) {
  67 -                if (substr_count($box['page'], '/') > substr_count($clean[$box['code']]['page'], '/')) {
  68 -                  unset($clean[$box['code']]);
   67+            foreach ($modules as $module) {
   68+              if (isset($clean[$module['code']])) {
   69+                if (substr_count($module['page'], '/') > substr_count($clean[$module['code']]['page'], '/')) {
   70+                  unset($clean[$module['code']]);
6971                 }
  7072               }
  7173 
<> 72 -              $clean[$box['code']] = $box;
   74+              $clean[$module['code']] = $module;
7375             }
  7476 
  7577             $_data[$groups] = $clean;
  7678           }
  7779 
<> 78 -          foreach ($_data as $groups => $boxes) {
  79 -            foreach ($boxes as $box) {
  80 -              $data[$groups][] = $box['code'];
   80+          foreach ($_data as $groups => $modules) {
   81+            foreach ($modules as $module) {
   82+              $data[$groups][] = $module['code'];
8183             }
  8284           }
  8385         }
  8486 
  8587         $osC_Cache->writeBuffer($data);
  8688       }
  8789 
<> 88 -      $this->_boxes = $data;
   90+      $this->_modules = $data;
8991     }
  9092 
  9193     function getCode() {
     
 !
112114       return !empty($this->_content);
  113115     }
  114116 
<>  117+    function getAuthorName() {
   118+      return $this->_author_name;
   119+    }
   120+
   121+    function getAuthorAddress() {
   122+      return $this->_author_www;
   123+    }
   124+
115125     function getGroup($group) {
<> 116 -      $boxes = array();
   126+      $modules = array();
117127 
<> 118 -      if (isset($this->_boxes[$group])) {
  119 -        foreach ($this->_boxes[$group] as $box) {
  120 -          if (file_exists('includes/modules/' . $this->_module_group . '/' . $box . '.php')) {
  121 -            $box_class = 'osC_' . ucfirst($this->_module_group) . '_' . $box;
   128+      if (isset($this->_modules[$group])) {
   129+        foreach ($this->_modules[$group] as $module) {
   130+          if (file_exists('includes/modules/' . $this->_group . '/' . $module . '.php')) {
   131+            $class = 'osC_' . ucfirst($this->_group) . '_' . $module;
122132 
<> 123 -            if (class_exists($box_class) === false) {
  124 -              include('includes/modules/' . $this->_module_group . '/' . $box . '.php');
   133+            if (class_exists($class) === false) {
   134+              include('includes/modules/' . $this->_group . '/' . $module . '.php');
125135             }
  126136 
<> 127 -            $boxes[] = $box_class;
   137+            $modules[] = $class;
128138           }
  129139         }
  130140       }
  131141 
<> 132 -      return $boxes;
   142+      return $modules;
133143     }
  134144 
  135145     function isInstalled() {
     
 !
141151         $Qcheck = $osC_Database->query('select id from :table_templates_boxes where code = :code and modules_group = :modules_group');
  142152         $Qcheck->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES);
  143153         $Qcheck->bindValue(':code', $this->_code);
<> 144 -        $Qcheck->bindValue(':modules_group', $this->_module_group);
   154+        $Qcheck->bindValue(':modules_group', $this->_group);
145155         $Qcheck->execute();
  146156 
  147157         $is_installed = ($Qcheck->numberOfRows()) ? true : false;
     
 !
161171     }
  162172 
  163173     function getKeys() {
<> 164 -      if (!isset($this->_keys)) {
   174+      if (isset($this->_keys) === false) {
165175         $this->_keys = array();
  166176       }
  167177 
     
 !
175185     function remove() {
  176186       global $osC_Database;
  177187 
<> 178 -      $Qbox = $osC_Database->query('select id from :table_templates_boxes where code = :code and modules_group = :modules_group');
  179 -      $Qbox->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES);
  180 -      $Qbox->bindValue(':code', $this->_code);
  181 -      $Qbox->bindValue(':modules_group', $this->_module_group);
  182 -      $Qbox->execute();
   188+      $Qmodule = $osC_Database->query('select id from :table_templates_boxes where code = :code and modules_group = :modules_group');
   189+      $Qmodule->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES);
   190+      $Qmodule->bindValue(':code', $this->_code);
   191+      $Qmodule->bindValue(':modules_group', $this->_group);
   192+      $Qmodule->execute();
183193 
  184194       $Qdel = $osC_Database->query('delete from :table_templates_boxes_to_pages where templates_boxes_id = :templates_boxes_id');
  185195       $Qdel->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES);
<> 186 -      $Qdel->bindValue(':templates_boxes_id', $Qbox->valueInt('id'));
   196+      $Qdel->bindValue(':templates_boxes_id', $Qmodule->valueInt('id'));
187197       $Qdel->execute();
  188198 
  189199       $Qdel = $osC_Database->query('delete from :table_templates_boxes where code = :code and modules_group = :modules_group');
  190200       $Qdel->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES);
  191201       $Qdel->bindValue(':code', $this->_code);
<> 192 -      $Qdel->bindValue(':modules_group', $this->_module_group);
   202+      $Qdel->bindValue(':modules_group', $this->_group);
193203       $Qdel->execute();
  194204 
  195205       if ($this->hasKeys()) {
     
 !
199209         $Qdel->execute();
  200210       }
  201211     }
<> 202 -
  203 -    function getAuthorName() {
  204 -      return $this->_author_name;
  205 -    }
  206 -
  207 -    function getAuthorAddress() {
  208 -      return $this->_author_www;
  209 -    }
<_ 210212   }
  211213 ?>