コード例 #1
0
ファイル: Settings.php プロジェクト: xolodok373/tit.biz
 public function getSetting($filename)
 {
     try {
         if (!file_exists($filename)) {
             throw new Exception("Неверный путь к файлу конфигурации или его не существует");
         }
         $ini_array = parse_ini_file($filename);
         return $ini_array;
     } catch (Exception $e) {
         MyException::ErrorLog($e->getMessage() . " " . $link->connect_error, $e->getFile(), $e->getLine());
     }
 }
コード例 #2
0
ファイル: File.php プロジェクト: xolodok373/tit.biz
 public function Download($file)
 {
     try {
         if (file_exists($file)) {
             header('Content-Description: File Transfer');
             header('Content-Type: image/*');
             header('Content-Disposition: attachment; filename=' . basename($file));
             header('Expires: 0');
             header('Cache-Control: must-revalidate');
             header('Pragma: public');
             header('Content-Length: ' . filesize($file));
             if (!readfile($file)) {
                 throw new Exception("Не удалось скачать файл");
             }
         } else {
             throw new Exception("Файла для загрузки не существует");
         }
     } catch (Exception $e) {
         $log = new MyException();
         $log->ErrorLog($e->getMessage(), $e->getFile(), $e->getLine());
     }
 }
コード例 #3
0
ファイル: database.php プロジェクト: xolodok373/tit.biz
 public function update($link, $table, $rows, $where = null)
 {
     $query = "UPDATE " . $table . " SET ";
     foreach ($rows as $key => $row) {
         $query .= $key . "='" . $row . "', ";
     }
     $query = substr($query, 0, -2);
     if ($where != null) {
         $query .= " WHERE " . $where;
     }
     try {
         if (!$link->query("set character_set_client='utf8'")) {
             throw new Exception("Невозможно выполнить запрос");
         }
         if (!$link->query("set character_set_results='utf8'")) {
             throw new Exception("Невозможно выполнить запрос");
         }
         if (!$link->query("set collation_connection='utf8_general_ci'")) {
             throw new Exception("Невозможно выполнить запрос");
         }
         $result = $link->query($query);
         if (!$result) {
             throw new Exception("Невозможно выполнить запрос");
         }
         return $result;
     } catch (Exception $e) {
         MyException::ErrorLog($e->getMessage() . " " . $link->error, $e->getFile(), $e->getLine());
     }
 }
コード例 #4
0
ファイル: database.php プロジェクト: xolodok373/tit.biz
 public function delete($link, $table, $where)
 {
     $query = "DELETE FROM " . $table . " WHERE " . $where;
     try {
         if (!$link->query($query)) {
             throw new Exception("Невозможно выполнить запрос");
         }
         return true;
     } catch (Exception $e) {
         //$log = new MyException();
         MyException::ErrorLog($e->getMessage() . " " . $link->error, $e->getFile(), $e->getLine());
     }
 }