shop.balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

extension.php (1507B)


      1 <?php
      2 /*
      3  *  location: admin/model/extension/d_opencart_patch/extension.php
      4  *
      5  */
      6 
      7 class ModelExtensionDOpencartPatchExtension extends Model {
      8 
      9     public function getInstalled($type) {
     10         $extension_data = array();
     11 
     12         $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "extension WHERE `type` = '" . $this->db->escape($type) . "' ORDER BY code");
     13 
     14         foreach ($query->rows as $result) {
     15             $extension_data[] = $result['code'];
     16         }
     17 
     18         return $extension_data;
     19     }
     20 
     21     public function isInstalled($code, $type = false) {
     22         $sql = "SELECT * FROM " . DB_PREFIX . "extension WHERE ";
     23 
     24         if($type){
     25             $sql .= "`type` = '" . $this->db->escape($type) . "' AND ";
     26         }
     27 
     28         $sql .= "`code` = '" . $this->db->escape($code) . "'";
     29         
     30         $query = $this->db->query($sql);
     31         if(!empty($query->row)){
     32             return true;
     33         }
     34         
     35         return false;
     36     }
     37 
     38     public function install($type, $code) {
     39         $this->db->query("INSERT INTO " . DB_PREFIX . "extension SET `type` = '" . $this->db->escape($type) . "', `code` = '" . $this->db->escape($code) . "'");
     40     }
     41 
     42     public function uninstall($type, $code) {
     43         $this->db->query("DELETE FROM " . DB_PREFIX . "extension WHERE `type` = '" . $this->db->escape($type) . "' AND `code` = '" . $this->db->escape($code) . "'");
     44         $this->db->query("DELETE FROM " . DB_PREFIX . "setting WHERE `code` = '" . $this->db->escape($code) . "'");
     45     }
     46 
     47     
     48 }