-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
598a461
commit 02c0a11
Showing
5 changed files
with
258 additions
and
258 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 |
---|---|---|
|
@@ -14,50 +14,50 @@ | |
* @author 713uk13m <[email protected]> | ||
* @copyright 713uk13m <[email protected]> | ||
* | ||
* @property CI_Benchmark $benchmark This class enables you to mark points and calculate the time difference between them. Memory consumption can also be displayed. | ||
* @property CI_Calendar $calendar This class enables the creation of calendars | ||
* @property CI_Cache $cache Caching Class | ||
* @property CI_Cart $cart Shopping Cart Class | ||
* @property CI_Config $config This class contains functions that enable config files to be managed | ||
* @property CI_Controller $controller This class object is the super class that every library in CodeIgniter will be assigned to | ||
* @property CI_DB_forge $dbforge Database Forge Class | ||
* @property CI_DB_pdo_driver|CI_DB_mysqli_driver|CI_DB_query_builder $db This is the platform-independent base Query Builder implementation class | ||
* @property CI_DB_utility $dbutil Database Utility Class | ||
* @property CI_Driver_Library $driver Driver Library Class | ||
* @property CI_Email $email Permits email to be sent using Mail, Sendmail, or SMTP | ||
* @property CI_Encrypt $encrypt Provides two-way keyed encoding using Mcrypt | ||
* @property CI_Encryption $encryption Provides two-way keyed encryption via PHP's MCrypt and/or OpenSSL extensions | ||
* @property CI_Exceptions $exceptions Exceptions Class | ||
* @property CI_Form_validation $form_validation Form Validation Class | ||
* @property CI_FTP $ftp FTP Class | ||
* @property CI_Hooks $hooks Provides a mechanism to extend the base system without hacking | ||
* @property CI_Image_lib $image_lib Image Manipulation class | ||
* @property CI_Input $input Pre-processes global input data for security | ||
* @property CI_Javascript $javascript Javascript Class | ||
* @property CI_Jquery $jquery Jquery Class | ||
* @property CI_Lang $lang Language Class | ||
* @property CI_Loader $load Loads framework components | ||
* @property CI_Log $log Logging Class | ||
* @property CI_Migration $migration All migrations should implement this, forces up() and down() and gives access to the CI super-global | ||
* @property CI_Model $model CodeIgniter Model Class | ||
* @property CI_Output $output Responsible for sending final output to the browser | ||
* @property CI_Pagination $pagination Pagination Class | ||
* @property CI_Parser $parser Parser Class | ||
* @property CI_Profiler $profiler This class enables you to display benchmark, query, and other data in order to help with debugging and optimization. | ||
* @property CI_Router $router Parses URIs and determines routing | ||
* @property CI_Security $security Security Class | ||
* @property CI_Session $session Session Class | ||
* @property CI_Table $table Lets you create tables manually or from database result objects, or arrays | ||
* @property CI_Trackback $trackback Trackback Sending/Receiving Class | ||
* @property CI_Typography $typography Typography Class | ||
* @property CI_Unit_test $unit Simple testing class | ||
* @property CI_Upload $upload File Uploading Class | ||
* @property CI_URI $uri Parses URIs and determines routing | ||
* @property CI_User_agent $agent Identifies the platform, browser, robot, or mobile device of the browsing agent | ||
* @property CI_Xmlrpc $xmlrpc XML-RPC request handler class | ||
* @property CI_Xmlrpcs $xmlrpcs XML-RPC server class | ||
* @property CI_Zip $zip Zip Compression Class | ||
* @property CI_Utf8 $utf8 Provides support for UTF-8 environments | ||
* @property CI_Benchmark $benchmark This class enables you to mark points and calculate the time difference between them. Memory consumption can also be displayed. | ||
* @property CI_Calendar $calendar This class enables the creation of calendars | ||
* @property CI_Cache $cache Caching Class | ||
* @property CI_Cart $cart Shopping Cart Class | ||
* @property CI_Config $config This class contains functions that enable config files to be managed | ||
* @property CI_Controller $controller This class object is the super class that every library in CodeIgniter will be assigned to | ||
* @property CI_DB_forge $dbforge Database Forge Class | ||
* @property CI_DB_pdo_driver|CI_DB_mysqli_driver|CI_DB_query_builder|CI_DB_driver $db This is the platform-independent base Query Builder implementation class | ||
* @property CI_DB_utility $dbutil Database Utility Class | ||
* @property CI_Driver_Library $driver Driver Library Class | ||
* @property CI_Email $email Permits email to be sent using Mail, Sendmail, or SMTP | ||
* @property CI_Encrypt $encrypt Provides two-way keyed encoding using Mcrypt | ||
* @property CI_Encryption $encryption Provides two-way keyed encryption via PHP's MCrypt and/or OpenSSL extensions | ||
* @property CI_Exceptions $exceptions Exceptions Class | ||
* @property CI_Form_validation $form_validation Form Validation Class | ||
* @property CI_FTP $ftp FTP Class | ||
* @property CI_Hooks $hooks Provides a mechanism to extend the base system without hacking | ||
* @property CI_Image_lib $image_lib Image Manipulation class | ||
* @property CI_Input $input Pre-processes global input data for security | ||
* @property CI_Javascript $javascript Javascript Class | ||
* @property CI_Jquery $jquery Jquery Class | ||
* @property CI_Lang $lang Language Class | ||
* @property CI_Loader $load Loads framework components | ||
* @property CI_Log $log Logging Class | ||
* @property CI_Migration $migration All migrations should implement this, forces up() and down() and gives access to the CI super-global | ||
* @property CI_Model $model CodeIgniter Model Class | ||
* @property CI_Output $output Responsible for sending final output to the browser | ||
* @property CI_Pagination $pagination Pagination Class | ||
* @property CI_Parser $parser Parser Class | ||
* @property CI_Profiler $profiler This class enables you to display benchmark, query, and other data in order to help with debugging and optimization. | ||
* @property CI_Router $router Parses URIs and determines routing | ||
* @property CI_Security $security Security Class | ||
* @property CI_Session $session Session Class | ||
* @property CI_Table $table Lets you create tables manually or from database result objects, or arrays | ||
* @property CI_Trackback $trackback Trackback Sending/Receiving Class | ||
* @property CI_Typography $typography Typography Class | ||
* @property CI_Unit_test $unit Simple testing class | ||
* @property CI_Upload $upload File Uploading Class | ||
* @property CI_URI $uri Parses URIs and determines routing | ||
* @property CI_User_agent $agent Identifies the platform, browser, robot, or mobile device of the browsing agent | ||
* @property CI_Xmlrpc $xmlrpc XML-RPC request handler class | ||
* @property CI_Xmlrpcs $xmlrpcs XML-RPC server class | ||
* @property CI_Zip $zip Zip Compression Class | ||
* @property CI_Utf8 $utf8 Provides support for UTF-8 environments | ||
*/ | ||
class HungNG_CI_Base_Controllers extends CI_Controller | ||
{ | ||
|
@@ -113,10 +113,10 @@ protected function defaultJsonResponseInfo() | |
*/ | ||
protected function renderOutput($response) | ||
{ | ||
$method = $this->input->method(true); | ||
$ip = getIPAddress(); | ||
$method = $this->input->method(true); | ||
$ip = getIPAddress(); | ||
$userAgent = $this->input->user_agent(true); | ||
$message = 'Received ' . $method . ' Request from IP: ' . $ip . ' - With User Agent: ' . $userAgent; | ||
$message = 'Received ' . $method . ' Request from IP: ' . $ip . ' - With User Agent: ' . $userAgent; | ||
if (method_exists($this, 'log')) { | ||
$this->log('RequestAPI', $message, $response); | ||
} | ||
|
@@ -135,10 +135,10 @@ protected function renderOutput($response) | |
*/ | ||
protected function renderOutputPretty($response) | ||
{ | ||
$method = $this->input->method(true); | ||
$ip = getIPAddress(); | ||
$method = $this->input->method(true); | ||
$ip = getIPAddress(); | ||
$userAgent = $this->input->user_agent(true); | ||
$message = 'Received ' . $method . ' Request from IP: ' . $ip . ' - With User Agent: ' . $userAgent; | ||
$message = 'Received ' . $method . ' Request from IP: ' . $ip . ' - With User Agent: ' . $userAgent; | ||
if (method_exists($this, 'log')) { | ||
$this->log('RequestAPI', $message, $response); | ||
} | ||
|
@@ -157,10 +157,10 @@ protected function renderOutputPretty($response) | |
*/ | ||
protected function jsonResponse($response = array(), $status = 200) | ||
{ | ||
$method = $this->input->method(true); | ||
$ip = getIPAddress(); | ||
$method = $this->input->method(true); | ||
$ip = getIPAddress(); | ||
$userAgent = $this->input->user_agent(true); | ||
$message = 'Received ' . $method . ' Request from IP: ' . $ip . ' - With User Agent: ' . $userAgent; | ||
$message = 'Received ' . $method . ' Request from IP: ' . $ip . ' - With User Agent: ' . $userAgent; | ||
log_message('debug', $message); | ||
if (is_array($response) || is_object($response)) { | ||
$response = json_encode($response); | ||
|
@@ -180,10 +180,10 @@ protected function jsonResponse($response = array(), $status = 200) | |
*/ | ||
protected function jsonResponsePretty($response = array(), $status = 200) | ||
{ | ||
$method = $this->input->method(true); | ||
$ip = getIPAddress(); | ||
$method = $this->input->method(true); | ||
$ip = getIPAddress(); | ||
$userAgent = $this->input->user_agent(true); | ||
$message = 'Received ' . $method . ' Request from IP: ' . $ip . ' - With User Agent: ' . $userAgent; | ||
$message = 'Received ' . $method . ' Request from IP: ' . $ip . ' - With User Agent: ' . $userAgent; | ||
log_message('debug', $message); | ||
if (is_array($response) || is_object($response)) { | ||
$response = json_encode($response, JSON_PRETTY_PRINT); | ||
|
@@ -208,8 +208,8 @@ protected function errorExceptionResponse($exception) | |
log_message('error', $errorMessage); | ||
log_message('error', $exception->getTraceAsString()); | ||
|
||
$response = array(); | ||
$response['code'] = StatusCodes::HTTP_BAD_REQUEST; | ||
$response = array(); | ||
$response['code'] = StatusCodes::HTTP_BAD_REQUEST; | ||
$response['message'] = StatusCodes::$statusTexts[StatusCodes::HTTP_BAD_REQUEST]; | ||
if ( | ||
( | ||
|
@@ -243,9 +243,9 @@ protected function errorExceptionResponse($exception) | |
*/ | ||
protected function errorResponse($message = '') | ||
{ | ||
$response = array(); | ||
$response['code'] = StatusCodes::HTTP_BAD_REQUEST; | ||
$response['message'] = StatusCodes::$statusTexts[StatusCodes::HTTP_BAD_REQUEST]; | ||
$response = array(); | ||
$response['code'] = StatusCodes::HTTP_BAD_REQUEST; | ||
$response['message'] = StatusCodes::$statusTexts[StatusCodes::HTTP_BAD_REQUEST]; | ||
$response['errorMessage'] = $message; | ||
|
||
return $response; | ||
|
@@ -298,8 +298,8 @@ protected function errorCredentialsResponse($message = '') | |
*/ | ||
protected function errorSignatureResponse($validSignature = array()) | ||
{ | ||
$response = array(); | ||
$response['code'] = StatusCodes::HTTP_FORBIDDEN; | ||
$response = array(); | ||
$response['code'] = StatusCodes::HTTP_FORBIDDEN; | ||
$response['message'] = StatusCodes::$statusTexts[StatusCodes::HTTP_FORBIDDEN]; | ||
if ((defined('_PROCESS_TEST_') && _PROCESS_TEST_ === true) || in_array(getIPAddress(), config_item('whitelist_ip'), true)) { | ||
$response['validSignature'] = $validSignature; | ||
|
@@ -350,9 +350,9 @@ protected function log($name = '', $message = '', $context = array(), $inputLeve | |
default: | ||
$keyLevel = Monolog\Logger::INFO; | ||
} | ||
$fileName = __DIR__ . '/../../storage/logs/Log-' . date('Y-m-d') . '.log'; | ||
$fileName = __DIR__ . '/../../storage/logs/Log-' . date('Y-m-d') . '.log'; | ||
$formatter = new Monolog\Formatter\LineFormatter("[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n", "Y-m-d H:i:s u"); | ||
$stream = new Monolog\Handler\StreamHandler($fileName, $keyLevel, true, 0777); | ||
$stream = new Monolog\Handler\StreamHandler($fileName, $keyLevel, true, 0777); | ||
$stream->setFormatter($formatter); | ||
$logger = new Monolog\Logger(trim($name)); | ||
$logger->pushHandler($stream); | ||
|
Oops, something went wrong.