예제 #1
0
파일: admin_config.php 프로젝트: vobinh/PHP
 public function del_logo()
 {
     $msg = array('error' => '', 'success' => '');
     $path_file = DOCROOT . 'uploads/site/' . $this->site['site_logo'];
     if (is_file($path_file) && file_exists($path_file)) {
         if (@unlink($path_file)) {
             $msg['success'] = Kohana::lang('errormsg_lang.msg_file_del');
         } else {
             $msg['error'] = Kohana::lang('errormsg_lang.error_del_file');
         }
     } else {
         $msg['error'] = Kohana::lang('errormsg_lang.error_file_not_exist');
     }
     if (Site_Model::update(array('site_logo' => ''))) {
         $msg['success'] .= Kohana::lang('errormsg_lang.msg_data_update');
     } else {
         $msg['error'] .= Kohana::lang('errormsg_lang.error_data_update');
     }
     if ($msg['error'] !== '') {
         $this->session->set_flash('error_msg', $msg['error']);
     }
     if ($msg['success'] !== '') {
         $this->session->set_flash('success_msg', $msg['success']);
     }
     url::redirect('admin_config');
     die;
 }