From ab12f1e9be3f6a71745b859463376b8b5fed951f Mon Sep 17 00:00:00 2001 From: Jason Clemons Date: Sat, 14 Dec 2013 22:22:58 -0500 Subject: [PATCH] ! Removed access logging, version 1.0 code Signed-off-by: Jason Clemons --- api/includes/bootloader.php | 23 +++------- api/includes/classes/base.class.php | 71 +++++++---------------------- api/includes/kernel.php | 1 - 3 files changed, 22 insertions(+), 73 deletions(-) diff --git a/api/includes/bootloader.php b/api/includes/bootloader.php index 8cc1214..1b566cf 100644 --- a/api/includes/bootloader.php +++ b/api/includes/bootloader.php @@ -26,19 +26,9 @@ */ $accounts = array( array( - 'email' => '', - 'password' => '', - 'gamertag' => '' - ), - array( - 'email' => '', - 'password' => '', - 'gamertag' => '' - ), - array( - 'email' => '', - 'password' => '', - 'gamertag' => '' + 'email' => 'john@example.com', + 'password' => 'Password123', + 'gamertag' => 'Major Nelson' ) ); @@ -61,10 +51,9 @@ /*! * Define some log file locations. */ -define('COOKIE_FILE', '../includes/cookies/' . XBOX_EMAIL . '.jar'); // path to cookie file -define('DEBUG_FILE', '../includes/logs/debug.log'); // path to debug log -define('STACK_TRACE_FILE', '../includes/logs/stack_trace.log'); // path to stack trace -define('ACCESS_FILE', '../includes/logs/access.log'); // path to access log +define('COOKIE_FILE', '../includes/cookies/' . XBOX_EMAIL . '.jar'); +define('DEBUG_FILE', '../includes/logs/debug.log'); +define('STACK_TRACE_FILE', '../includes/logs/stack_trace.log'); /*! * Initiate the caching engine. diff --git a/api/includes/classes/base.class.php b/api/includes/classes/base.class.php index 68408d8..34abea2 100644 --- a/api/includes/classes/base.class.php +++ b/api/includes/classes/base.class.php @@ -25,7 +25,6 @@ class Base public $cookie_file = ''; // cookie jar path public $debug_file = ''; // debug file path public $stack_trace_file = ''; // stack trace file path - public $access_file = ''; // access log file path public $runtime = null; // current runtime public $ip = null; // ip address to use for session, generated in __construct() public $format = 'xml'; // default response format @@ -106,23 +105,12 @@ public function output_headers() */ public function output_payload($data) { - //!!! Version 1.0 being deprecated soon! - if ($this->version == '1.0') { - $payload = array( - 'Data' => $data, - 'In' => round(microtime(true) - $this->runtime, 3), - 'Stat' => 'ok', - 'Authed' => 'false', - 'AuthedAs' => null - ); - } else { - $payload = array( - 'status' => 'success', - 'version' => $this->version, - 'data' => $data, - 'runtime' => round(microtime(true) - $this->runtime, 3) - ); - } + $payload = array( + 'status' => 'success', + 'version' => $this->version, + 'data' => $data, + 'runtime' => round(microtime(true) - $this->runtime, 3) + ); // Output the data in the desired format. switch ($this->format) { @@ -147,26 +135,15 @@ public function output_error($code) http_response_code((int) $code); } - //!!! Version 1.0 being deprecated soon! - if ($this->version == '1.0') { - $payload = array( - 'Error' => $this->errors[$code], - 'In' => round(microtime(true) - $this->runtime, 3), - 'Stat' => 'fail', - 'Authed' => 'false', - 'AuthedAs' => null - ); - } else { - $payload = array( - 'status' => 'error', - 'version' => $this->version, - 'data' => array( - 'code' => $code, - 'message' => $this->errors[$code] - ), - 'runtime' => round(microtime(true) - $this->runtime, 3) - ); - } + $payload = array( + 'status' => 'error', + 'version' => $this->version, + 'data' => array( + 'code' => $code, + 'message' => $this->errors[$code] + ), + 'runtime' => round(microtime(true) - $this->runtime, 3) + ); // Output the data in the desired format. switch ($this->format) { @@ -490,22 +467,6 @@ protected function empty_cookie_file() } } - /*! - * Saves access data to access log, if enabled - */ - public function save_to_access($string) - { - if ($this->debug) { - $file = fopen($this->access_file, 'a+'); - if (!$file) { - $this->error = 608; - } else { - fwrite($file, '[' . date('Y-m-d H:i:s') . '] (' . $this->version . ') ' . $string . "\n"); - fclose($file); - } - } - } - /*! * Save items to the debug log */ @@ -578,7 +539,7 @@ function output_pretty_jsonp($json, $callback) function output_pretty_xml($mixed, $xml = false) { if ($xml === false) { - $xml = new SimpleXMLElement(''); + $xml = new SimpleXMLElement(''); } foreach ($mixed as $key => $value) { diff --git a/api/includes/kernel.php b/api/includes/kernel.php index f83152e..647f486 100644 --- a/api/includes/kernel.php +++ b/api/includes/kernel.php @@ -26,5 +26,4 @@ $api->debug_file = DEBUG_FILE; $api->stack_trace_file = STACK_TRACE_FILE; $api->access_file = ACCESS_FILE; -$api->save_to_access($_SERVER['REMOTE_ADDR'] . ' ' . $_SERVER['REQUEST_URI']); $api->init(XBOX_EMAIL, XBOX_PASSWORD);