Beispiel #1
0
 /**
  * Delete an empty folder
  */
 public function delete_folder()
 {
     // this is just a safeguard if they circumvent the JS permissions
     if (!in_array('delete_folder', Files::allowed_actions())) {
         show_error(lang('files:no_permissions'));
     }
     if ($id = $this->input->post('folder_id')) {
         $result = Files::delete_folder($id);
         $result['status'] and Events::trigger('file_folder_deleted', $id);
         echo json_encode($result);
     }
 }
 /**
  * Deletes a product, the images and Files folder related to it.
  *
  * @param integer $id The Product ID to delete
  * @return boolean TRUE or FALSE on success of failure
  * @access public
  */
 public function delete_product($id)
 {
     $product = $this->get_product($id);
     if ($this->db->delete('firesale_products', array('id' => $id))) {
         // Remove files folder
         if ($product !== FALSE) {
             $folder = $this->get_file_folder_by_slug($product->slug);
             if ($folder != FALSE) {
                 $images = Files::folder_contents($folder->id);
                 $images = $images['data']['file'];
                 foreach ($images as $image) {
                     Files::delete_file($image->id);
                 }
                 Files::delete_folder($folder->id);
             }
         }
         return TRUE;
     } else {
         return FALSE;
     }
 }
Beispiel #3
0
 public function uninstall()
 {
     $this->load->driver('Streams');
     $this->load->library('files/files');
     // Delete the Uploads folder and remove its ID in the settings table
     Files::delete_folder(Settings::get($this->module_name . '_folder'));
     $this->db->delete('settings', array('module' => $this->module_name));
     // Remove Streams News
     $this->streams->utilities->remove_namespace($this->module_name);
     return true;
 }
Beispiel #4
0
 public function uninstall()
 {
     // Load required items
     $this->load->driver('Streams');
     $this->load->model('firesale/categories_m');
     $this->load->model('firesale/products_m');
     $this->load->library('files/files');
     // Remove settings
     $this->settings('remove');
     // Remove email templates
     $this->templates('remove');
     // Remove products
     $this->products_m->delete_all_products();
     // Remove files folder
     $folder = $this->products_m->get_file_folder_by_slug('product-images');
     if ($folder != FALSE) {
         Files::delete_folder($folder->id);
     }
     // Remove streams
     $this->streams->utilities->remove_namespace('firesale_categories');
     $this->streams->utilities->remove_namespace('firesale_products');
     $this->streams->utilities->remove_namespace('firesale_gateways');
     $this->streams->utilities->remove_namespace('firesale_addresses');
     $this->streams->utilities->remove_namespace('firesale_orders');
     $this->streams->utilities->remove_namespace('firesale_orders_items');
     // Drop the payment gateway tables
     $this->dbforge->drop_table('firesale_products_firesale_categories');
     // Streams doesn't auto-remove it =/
     $this->dbforge->drop_table('firesale_gateway_settings');
     $this->dbforge->drop_table('firesale_order_items');
     $this->dbforge->drop_table('firesale_transactions');
     // Return
     return TRUE;
 }
Beispiel #5
0
 /**
  * Delete an empty folder
  */
 public function delete_folder()
 {
     // this is just a safeguard if they circumvent the JS permissions
     if (!in_array('delete_folder', Files::allowed_actions())) {
         show_error(lang('files:no_permissions'));
     }
     if ($id = $this->input->post('folder_id')) {
         echo json_encode(Files::delete_folder($id));
     }
 }