Skip to content
Permalink
Browse files

just adding all the files so i can work from laptop

  • Loading branch information...
danielkerr committed Jul 19, 2015
1 parent 4b8d842 commit 758c19cc46a81824f63f2ea1bba26b40de72086b
@@ -347,21 +347,23 @@ protected function getList() {
}
// Check if IP is allowed
$data['ip'] = $this->request->server['REMOTE_ADDR'];
$ip_data = array();
$results = $this->model_user_api->getApiIps($this->config->get('config_api_id'));
foreach ($results as $result) {
$ip_data[] = $result['ip'];
if ($this->request->server['REMOTE_ADDR'] == $result['ip']) {
$data['total_api'] = $result['ip'];
break;
}
}
if (!in_array($this->request->server['REMOTE_ADDR'], $ip_data)) {
if (!in_array()) {
$data['total_api'] = $this->model_user_api->getApiIps($this->config->get('config_api_id'));
break;
}
$data['ip'] = $this->request->server['REMOTE_ADDR'];
$data['store'] = HTTPS_CATALOG;
@@ -50,15 +50,15 @@
$log = new Log($config->get('config_error_filename'));
$registry->set('log', $log);
function error_handler($errno, $errstr, $errfile, $errline) {
function error_handler($code, $message, $file, $line) {
global $log, $config;
// error suppressed with @
if (error_reporting() === 0) {
return false;
}
switch ($errno) {
switch ($code) {
case E_NOTICE:
case E_USER_NOTICE:
$error = 'Notice';
@@ -77,11 +77,11 @@ function error_handler($errno, $errstr, $errfile, $errline) {
}
if ($config->get('config_error_display')) {
echo '<b>' . $error . '</b>: ' . $errstr . ' in <b>' . $errfile . '</b> on line <b>' . $errline . '</b>';
echo '<b>' . $error . '</b>: ' . $message . ' in <b>' . $file . '</b> on line <b>' . $line . '</b>';
}
if ($config->get('config_error_log')) {
$log->write('PHP ' . $error . ': ' . $errstr . ' in ' . $errfile . ' on line ' . $errline);
$log->write('PHP ' . $error . ': ' . $message . ' in ' . $file . ' on line ' . $line);
}
return true;
@@ -30,7 +30,6 @@ public function index() {
$this->session->close();
//setcookie('PHPSESSID_' . uniqid(), );
$session = new Session();
@@ -68,7 +68,7 @@
$log = new Log($config->get('config_error_filename'));
$registry->set('log', $log);
function error_handler($code, $error, $file, $line) {
function error_handler($code, $message, $file, $line) {
global $log, $config;
// error suppressed with @
@@ -95,11 +95,11 @@ function error_handler($code, $error, $file, $line) {
}
if ($config->get('config_error_display')) {
echo '<b>' . $code . '</b>: ' . $error . ' in <b>' . $file . '</b> on line <b>' . $line . '</b>';
echo '<b>' . $error . '</b>: ' . $message . ' in <b>' . $file . '</b> on line <b>' . $line . '</b>';
}
if ($config->get('config_error_log')) {
$log->write('PHP ' . $code . ': ' . $error . ' in ' . $file . ' on line ' . $line);
$log->write('PHP ' . $error . ': ' . $message . ' in ' . $file . ' on line ' . $line);
}
return true;
@@ -134,6 +134,8 @@ function error_handler($code, $error, $file, $line) {
if ($query->num_row) {
$session->setId($query->row['session_id']);
$session->setName($query->row['session_name']);
$db->query("UPDATE `" . DB_PREFIX . "api_session` SET date_modified = NOW() WHERE api_session_id = '" . $query->row['api_session_id'] . "'");
}
}
@@ -2,46 +2,23 @@
class Session {
public $data = array();
public function __construct($session_id = '') {
public function __construct($prefix = 'default') {
if (!session_id()) {
ini_set('session.use_only_cookies', 'On');
ini_set('session.use_cookies', 'On');
ini_set('session.use_trans_sid', 'Off');
ini_set('session.cookie_httponly', 'On');
ini_set('session.hash_function', 1);
ini_set('session.hash_bits_per_character', 4);
session_set_cookie_params(0, '/');
session_start();
}
$this->data =& $_SESSION;
}
function php_combined_lcg() {
$tv = gettimeofday();
$lcg['s1'] = $tv['sec'] ^ (~$tv['usec']);
$lcg['s2'] = posix_getpid();
$q = (int) ($lcg['s1'] / 53668);
$lcg['s1'] = (int) (40014 * ($lcg['s1'] - 53668 * $q) - 12211 * $q);
if ($lcg['s1'] < 0)
$lcg['s1'] += 2147483563;
$q = (int) ($lcg['s2'] / 52774);
$lcg['s2'] = (int) (40692 * ($lcg['s2'] - 52774 * $q) - 3791 * $q);
if ($lcg['s2'] < 0)
$lcg['s2'] += 2147483399;
$z = (int) ($lcg['s1'] - $lcg['s2']);
if ($z < 1) {
$z += 2147483562;
}
return $z * 4.656613e-10;
$this->data =& $_SESSION[$prefix];
}
function session_regenerate_id() {
$tv = gettimeofday();
@@ -54,7 +31,6 @@ function session_regenerate_id() {
return TRUE;
}
public function getId() {
return session_id();
}
@@ -0,0 +1,39 @@
<?php
class Template {
private $data = array();
public function __construct($driver) {
$class = 'Template\\' . $driver;
if (class_exists($class)) {
$this->template = new $class($expire);
} else {
exit('Error: Could not load template driver ' . $driver . ' cache!');
}
}
public function set($key, $value) {
$this->data[$key] = $value;
}
public function render() {
$file = DIR_TEMPLATE . $template;
if (file_exists($file)) {
extract($data);
ob_start();
require($file);
$output = ob_get_contents();
ob_end_clean();
return $output;
} else {
trigger_error('Error: Could not load template ' . $file . '!');
exit();
}
}
}
@@ -0,0 +1,29 @@
<?php
class Template {
private $data = array();
public function set($key, $value) {
$this->data[$key] = $value;
}
public function render() {
$file = DIR_TEMPLATE . $template;
if (file_exists($file)) {
extract($data);
ob_start();
require($file);
$output = ob_get_contents();
ob_end_clean();
return $output;
} else {
trigger_error('Error: Could not load template ' . $file . '!');
exit();
}
}
}

0 comments on commit 758c19c

Please sign in to comment.
You can’t perform that action at this time.