示例#1
0
 public function pano_del()
 {
     $id = $id = $this->input->post('id');
     $this->db->select('file');
     $this->db->where('id', $id);
     $query = $this->db->get('panorams');
     if ($query->num_rows() > 0) {
         $row = $query->row_array();
         unlink("uploads/" . $row['file']);
         //unlink("uploads/dir_".$row['file']) or die ("Can not remove dir");
         $dir = "uploads/dir_" . $row['file'];
         if ($objs = glob($dir . "/*")) {
             foreach ($objs as $obj) {
                 is_dir($obj) ? removeDirRec($obj) : unlink($obj);
             }
         }
         rmdir($dir);
         $this->db->where('id', $id);
         $this->db->delete('panorams');
         $this->db->where('panorama_id', $id);
         $this->db->or_where('panorama_id_to_link', $id);
         $this->db->delete('links');
     }
     header('Content-Type: application/json');
     echo '{success:true}';
     exit;
 }
示例#2
0
文件: util.php 项目: Niqpue/zippyerp
 /**
  * удаляет  рекурсивно  каталог
  * 
  * @param mixed $dir
  */
 public static function removeDirRec($dir)
 {
     if ($objs = glob($dir . "/*")) {
         foreach ($objs as $obj) {
             is_dir($obj) ? removeDirRec($obj) : unlink($obj);
         }
     }
     @rmdir($dir);
 }
 public function pano_del()
 {
     $id = mysql_real_escape_string($_GET['id']);
     $this->db->select('file');
     $this->db->where('id', $id);
     $query = $this->db->get('panorams');
     if ($query->num_rows() > 0) {
         $row = $query->row_array();
         unlink("uploads/" . $row['file']) or die("Can not remove file");
         //unlink("uploads/dir_".$row['file']) or die ("Can not remove dir");
         $dir = "uploads/dir_" . $row['file'];
         if ($objs = glob($dir . "/*")) {
             foreach ($objs as $obj) {
                 is_dir($obj) ? removeDirRec($obj) : unlink($obj);
             }
         }
         rmdir($dir);
         $this->db->where('id', $id);
         $this->db->delete('panorams');
         $this->db->where('panorama_id', $id);
         $this->db->or_where('panorama_id_to_link', $id);
         $this->db->delete('links');
     }
     $select_array = $this->Pano_model->get_pano_array();
     $data['select_array'] = $select_array;
     $this->db->select('instructions');
     $query = $this->db->get('config');
     $result = $query->row_array();
     $data['instructions'] = $result['instructions'];
     $this->load->view('select_pano', $data);
 }