This repository has been archived by the owner on Mar 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Özel Hata Sayfaları İçin Whoops Kullanıldı
- Loading branch information
1 parent
3740d0f
commit 0ab2cd4
Showing
49 changed files
with
4,923 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
|
||
namespace App\Classes; | ||
|
||
|
||
class ErrorHandler | ||
{ | ||
public function handleErrors($error_number,$error_message,$error_file,$error_line) | ||
{ | ||
$error ="[{$error_number}] Bir Hata Oluştu | ||
{$error_file} dosyasında $error_line : $error_message"; | ||
|
||
$environment = getenv('APP_ENV'); | ||
if ($environment === 'local') { | ||
$whoops = new \Whoops\Run; | ||
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler); | ||
$whoops->register(); | ||
} else { | ||
$data = [ | ||
'to' => getenv('ADMIN_EMAIL'), | ||
'subject' => 'Sistem Hatası', | ||
'view'=>'errors', | ||
'name'=> 'Admin', | ||
'body'=> 'Test Ediyoruz Email Şablonunu' | ||
|
||
]; | ||
|
||
ErrorHandler::emailAdmin($data)->outputFriendlyError(); | ||
} | ||
} | ||
public function outputFriendlyError() | ||
{ | ||
ob_end_clean(); | ||
view('errors/generic'); | ||
exit(); | ||
} | ||
public static function emailAdmin($data) | ||
{ | ||
$mail = new Mail; | ||
$mail->send($data); | ||
return new static; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,19 +11,16 @@ class IndexController extends BaseController | |
public function show() | ||
{ | ||
echo 'Burası Ana Baba Günü'; | ||
$mail = new Mail(); | ||
$data = [ | ||
'to' => '[email protected]', | ||
'subject' => 'Hoşgeldiniz Biladerim', | ||
'view'=>'welcome', | ||
'body'=> 'Test Ediyoruz Email Şablonunu' | ||
|
||
]; | ||
|
||
/** | ||
* Özel Hata Sayfası İçin Mail Fonksiyonu Eksik Yazıldı | ||
* Test Edildi : Whoops | ||
*/ | ||
/* $mail = new Mail(); | ||
if ($mail->send($data)) { | ||
echo 'email Başarıyla Gönderildi'; | ||
} else { | ||
echo 'email Gönderilemedi'; | ||
} | ||
}*/ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
<?php | ||
|
||
// Oturum Başlamadıysa Başlatıyoruz | ||
if (!isset($_SESSION)) session_start(); | ||
// Environment Ayarları | ||
require_once __DIR__ . '/../app/config/_env.php'; | ||
//VeriTabanı Sınıfı Yükleme | ||
new \App\Classes\Database(); | ||
// Özel Hata Sayfaları : Whoops | ||
set_error_handler([new \App\Classes\ErrorHandler(),'handleErrors']); | ||
// Routing & Url Sınıfı | ||
require_once __DIR__ . '/../app/routing/routes.php'; | ||
new \App\RouteDispatcher($router); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html lang="tr"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Title</title> | ||
</head> | ||
<body> | ||
<div style="width: 500px; padding: 15px; margin: 0 auto; background-color: darkred;color: #ffffff;"> | ||
<img width="150px" height="75px" src="https://yt3.ggpht.com/a-/AAuE7mAzi4VaiH3-qZFpvB93AcQQVuq7Rq90ohCb9Q=s900-mo-c-c0xffffffff-rj-k-no" alt="BabaFinger"> | ||
<?php echo "HATA : {$data};"?> | ||
</div> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div style="padding: 15px; width: 80%; margin: 0 auto; border: 1px solid darkgray; border-radius: 5px;"> | ||
<h1>Bir Hata Oluştu, Daha Sonra Tekrar Denemeyin : )</h1> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# 2.3.1 | ||
|
||
* Prevent exception in Whoops when caught exception frame is not related to real file | ||
|
||
# 2.3.0 | ||
|
||
* Show previous exception messages. | ||
|
||
# 2.2.0 | ||
|
||
* Support PHP 7.2 | ||
|
||
# 2.1.0 | ||
|
||
* Add a `SystemFacade` to allow clients to override Whoops behavior. | ||
* Show frame arguments in `PrettyPageHandler`. | ||
* Highlight the line with the error. | ||
* Add icons to search on Google and Stack Overflow. | ||
|
||
# 2.0.0 | ||
|
||
Backwards compatibility breaking changes: | ||
|
||
* `Run` class is now `final`. If you inherited from `Run`, please now instead use a custom `SystemFacade` injected into the `Run` constructor, or contribute your changes to our core. | ||
* PHP < 5.5 support dropped. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# The MIT License | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
Oops, something went wrong.