Large diffs are not rendered by default.

@@ -1,6 +1,6 @@
<html>
<head>
<title>403 Forbidden</title>
<title>403 Forbidden</title>
</head>
<body>

0 system/.htaccess 100644 → 100755
Empty file.
0 system/core/Benchmark.php 100644 → 100755
Empty file.
24 system/core/CodeIgniter.php 100644 → 100755
@@ -32,7 +32,7 @@
* Define the CodeIgniter Version
* ------------------------------------------------------
*/
define('CI_VERSION', '2.0.3');
define('CI_VERSION', '2.0.2');

/*
* ------------------------------------------------------
@@ -46,20 +46,20 @@
* Load the global functions
* ------------------------------------------------------
*/
require(BASEPATH.'core/Common.php');
require(BASEPATH.'core/Common'.EXT);

/*
* ------------------------------------------------------
* Load the framework constants
* ------------------------------------------------------
*/
if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants.php'))
if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants'.EXT))
{
require(APPPATH.'config/'.ENVIRONMENT.'/constants.php');
require(APPPATH.'config/'.ENVIRONMENT.'/constants'.EXT);
}
else
{
require(APPPATH.'config/constants.php');
require(APPPATH.'config/constants'.EXT);
}

/*
@@ -224,28 +224,28 @@
*
*/
// Load the base controller class
require BASEPATH.'core/Controller.php';
require BASEPATH.'core/Controller'.EXT;

function &get_instance()
{
return CI_Controller::get_instance();
}


if (file_exists(APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php'))
if (file_exists(APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller'.EXT))
{
require APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php';
require APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller'.EXT;
}

// Load the local application controller
// Note: The Router class automatically validates the controller path using the router->_validate_request().
// If this include fails it means that the default controller in the Routes.php file is not resolving to something valid.
if ( ! file_exists(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php'))
if ( ! file_exists(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().EXT))
{
show_error('Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid.');
}

include(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php');
include(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().EXT);

// Set a mark point for benchmarking
$BM->mark('loading_time:_base_classes_end');
@@ -318,12 +318,12 @@ function &get_instance()
$method = (isset($x[1]) ? $x[1] : 'index');
if ( ! class_exists($class))
{
if ( ! file_exists(APPPATH.'controllers/'.$class.'.php'))
if ( ! file_exists(APPPATH.'controllers/'.$class.EXT))
{
show_404("{$class}/{$method}");
}

include_once(APPPATH.'controllers/'.$class.'.php');
include_once(APPPATH.'controllers/'.$class.EXT);
unset($CI);
$CI = new $class();
}
75 system/core/Common.php 100644 → 100755
@@ -39,8 +39,6 @@
* @param string
* @return bool TRUE if the current version is $version or higher
*/
if ( ! function_exists('is_php'))
{
function is_php($version = '5.0.0')
{
static $_is_php;
@@ -53,7 +51,6 @@ function is_php($version = '5.0.0')

return $_is_php[$version];
}
}

// ------------------------------------------------------------------------

@@ -67,8 +64,6 @@ function is_php($version = '5.0.0')
* @access private
* @return void
*/
if ( ! function_exists('is_really_writable'))
{
function is_really_writable($file)
{
// If we're on a Unix server with safe_mode off we call is_writable
@@ -101,7 +96,6 @@ function is_really_writable($file)
fclose($fp);
return TRUE;
}
}

// ------------------------------------------------------------------------

@@ -118,8 +112,6 @@ function is_really_writable($file)
* @param string the class name prefix
* @return object
*/
if ( ! function_exists('load_class'))
{
function &load_class($class, $directory = 'libraries', $prefix = 'CI_')
{
static $_classes = array();
@@ -136,27 +128,27 @@ function &load_class($class, $directory = 'libraries', $prefix = 'CI_')
// thenin the local application/libraries folder
foreach (array(BASEPATH, APPPATH) as $path)
{
if (file_exists($path.$directory.'/'.$class.'.php'))
if (file_exists($path.$directory.'/'.$class.EXT))
{
$name = $prefix.$class;

if (class_exists($name) === FALSE)
{
require($path.$directory.'/'.$class.'.php');
require($path.$directory.'/'.$class.EXT);
}

break;
}
}

// Is the request a class extension? If so we load it too
if (file_exists(APPPATH.$directory.'/'.config_item('subclass_prefix').$class.'.php'))
if (file_exists(APPPATH.$directory.'/'.config_item('subclass_prefix').$class.EXT))
{
$name = config_item('subclass_prefix').$class;

if (class_exists($name) === FALSE)
{
require(APPPATH.$directory.'/'.config_item('subclass_prefix').$class.'.php');
require(APPPATH.$directory.'/'.config_item('subclass_prefix').$class.EXT);
}
}

@@ -165,7 +157,7 @@ function &load_class($class, $directory = 'libraries', $prefix = 'CI_')
{
// Note: We use exit() rather then show_error() in order to avoid a
// self-referencing loop with the Excptions class
exit('Unable to locate the specified class: '.$class.'.php');
exit('Unable to locate the specified class: '.$class.EXT);
}

// Keep track of what we just loaded
@@ -174,7 +166,6 @@ function &load_class($class, $directory = 'libraries', $prefix = 'CI_')
$_classes[$class] = new $name();
return $_classes[$class];
}
}

// --------------------------------------------------------------------

@@ -185,8 +176,6 @@ function &load_class($class, $directory = 'libraries', $prefix = 'CI_')
* @access public
* @return array
*/
if ( ! function_exists('is_loaded'))
{
function is_loaded($class = '')
{
static $_is_loaded = array();
@@ -198,7 +187,6 @@ function is_loaded($class = '')

return $_is_loaded;
}
}

// ------------------------------------------------------------------------

@@ -211,8 +199,6 @@ function is_loaded($class = '')
* @access private
* @return array
*/
if ( ! function_exists('get_config'))
{
function &get_config($replace = array())
{
static $_config;
@@ -223,9 +209,9 @@ function &get_config($replace = array())
}

// Is the config file in the environment folder?
if ( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php'))
if ( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config'.EXT))
{
$file_path = APPPATH.'config/config.php';
$file_path = APPPATH.'config/config'.EXT;
}

// Fetch the config file
@@ -256,7 +242,6 @@ function &get_config($replace = array())

return $_config[0] =& $config;
}
}

// ------------------------------------------------------------------------

@@ -266,8 +251,6 @@ function &get_config($replace = array())
* @access public
* @return mixed
*/
if ( ! function_exists('config_item'))
{
function config_item($item)
{
static $_config_item = array();
@@ -285,7 +268,6 @@ function config_item($item)

return $_config_item[$item];
}
}

// ------------------------------------------------------------------------

@@ -301,15 +283,12 @@ function config_item($item)
* @access public
* @return void
*/
if ( ! function_exists('show_error'))
{
function show_error($message, $status_code = 500, $heading = 'An Error Was Encountered')
{
$_error =& load_class('Exceptions', 'core');
echo $_error->show_error($heading, $message, 'error_general', $status_code);
exit;
}
}

// ------------------------------------------------------------------------

@@ -323,15 +302,12 @@ function show_error($message, $status_code = 500, $heading = 'An Error Was Encou
* @access public
* @return void
*/
if ( ! function_exists('show_404'))
{
function show_404($page = '', $log_error = TRUE)
{
$_error =& load_class('Exceptions', 'core');
$_error->show_404($page, $log_error);
exit;
}
}

// ------------------------------------------------------------------------

@@ -344,8 +320,6 @@ function show_404($page = '', $log_error = TRUE)
* @access public
* @return void
*/
if ( ! function_exists('log_message'))
{
function log_message($level = 'error', $message, $php_error = FALSE)
{
static $_log;
@@ -358,7 +332,6 @@ function log_message($level = 'error', $message, $php_error = FALSE)
$_log =& load_class('Log');
$_log->write_log($level, $message, $php_error);
}
}

// ------------------------------------------------------------------------

@@ -370,8 +343,6 @@ function log_message($level = 'error', $message, $php_error = FALSE)
* @param string
* @return void
*/
if ( ! function_exists('set_status_header'))
{
function set_status_header($code = 200, $text = '')
{
$stati = array(
@@ -446,7 +417,6 @@ function set_status_header($code = 200, $text = '')
header("HTTP/1.1 {$code} {$text}", TRUE, $code);
}
}
}

// --------------------------------------------------------------------

@@ -464,8 +434,6 @@ function set_status_header($code = 200, $text = '')
* @access private
* @return void
*/
if ( ! function_exists('_exception_handler'))
{
function _exception_handler($severity, $message, $filepath, $line)
{
// We don't bother with "strict" notices since they tend to fill up
@@ -495,22 +463,19 @@ function _exception_handler($severity, $message, $filepath, $line)

$_error->log_exception($severity, $message, $filepath, $line);
}
}

// --------------------------------------------------------------------

/**
* Remove Invisible Characters
*
* This prevents sandwiching null characters
* between ascii characters, like Java\0script.
*
* @access public
* @param string
* @return string
*/
if ( ! function_exists('remove_invisible_characters'))
{
// --------------------------------------------------------------------

/**
* Remove Invisible Characters
*
* This prevents sandwiching null characters
* between ascii characters, like Java\0script.
*
* @access public
* @param string
* @return string
*/
function remove_invisible_characters($str, $url_encoded = TRUE)
{
$non_displayables = array();
@@ -534,7 +499,7 @@ function remove_invisible_characters($str, $url_encoded = TRUE)

return $str;
}
}


/* End of file Common.php */
/* Location: ./system/core/Common.php */
66 system/core/Config.php 100644 → 100755
@@ -80,7 +80,7 @@ function __construct()
*/
function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
{
$file = ($file == '') ? 'config' : str_replace('.php', '', $file);
$file = ($file == '') ? 'config' : str_replace(EXT, '', $file);
$found = FALSE;
$loaded = FALSE;

@@ -92,7 +92,7 @@ function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)

foreach ($check_locations as $location)
{
$file_path = $path.'config/'.$location.'.php';
$file_path = $path.'config/'.$location.EXT;

if (in_array($file_path, $this->is_loaded, TRUE))
{
@@ -153,7 +153,7 @@ function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
{
return FALSE;
}
show_error('The configuration file '.$file.'.php'.' does not exist.');
show_error('The configuration file '.$file.EXT.' does not exist.');
}

return TRUE;
@@ -203,7 +203,10 @@ function item($item, $index = '')
// --------------------------------------------------------------------

/**
* Fetch a config file item - adds slash after item (if item is not empty)
* Fetch a config file item - adds slash after item
*
* The second parameter allows a slash to be added to the end of
* the item, in the case of a path.
*
* @access public
* @param string the config item name
@@ -216,10 +219,6 @@ function slash_item($item)
{
return FALSE;
}
if( trim($this->config[$item]) == '')
{
return '';
}

return rtrim($this->config[$item], '/').'/';
}
@@ -228,7 +227,6 @@ function slash_item($item)

/**
* Site URL
* Returns base_url . index_page [. uri_string]
*
* @access public
* @param string the URI string
@@ -241,50 +239,16 @@ function site_url($uri = '')
return $this->slash_item('base_url').$this->item('index_page');
}

if ($this->item('enable_query_strings') == FALSE)
{
$suffix = ($this->item('url_suffix') == FALSE) ? '' : $this->item('url_suffix');
return $this->slash_item('base_url').$this->slash_item('index_page').$this->_uri_string($uri).$suffix;
}
else
{
return $this->slash_item('base_url').$this->item('index_page').'?'.$this->_uri_string($uri);
}
}

// -------------------------------------------------------------

/**
* Base URL
* Returns base_url [. uri_string]
*
* @access public
* @param string $uri
* @return string
*/
function base_url($uri = '')
{
return $this->slash_item('base_url').ltrim($this->_uri_string($uri),'/');
}

// -------------------------------------------------------------

/**
* Build URI string for use in Config::site_url() and Config::base_url()
*
* @access protected
* @param $uri
* @return string
*/
protected function _uri_string($uri)
{
if ($this->item('enable_query_strings') == FALSE)
{
if (is_array($uri))
{
$uri = implode('/', $uri);
}
$uri = trim($uri, '/');

$index = $this->item('index_page') == '' ? '' : $this->slash_item('index_page');
$suffix = ($this->item('url_suffix') == FALSE) ? '' : $this->item('url_suffix');
return $this->slash_item('base_url').$index.trim($uri, '/').$suffix;
}
else
{
@@ -298,14 +262,16 @@ protected function _uri_string($uri)
$str .= $prefix.$key.'='.$val;
$i++;
}

$uri = $str;
}

return $this->slash_item('base_url').$this->item('index_page').'?'.$uri;
}
return $uri;
}

// --------------------------------------------------------------------

/**
* System URL
*
@@ -361,4 +327,4 @@ function _assign_to_config($items = array())
// END CI_Config class

/* End of file Config.php */
/* Location: ./system/core/Config.php */
/* Location: ./system/core/Config.php */
7 system/core/Controller.php 100644 → 100755
@@ -48,9 +48,12 @@ public function __construct()

$this->load =& load_class('Loader', 'core');

$this->load->set_base_classes()->ci_autoloader();

$this->load->_base_classes =& is_loaded();

$this->load->_ci_autoloader();

log_message('debug', "Controller Class Initialized");

}

public static function &get_instance()
4 system/core/Exceptions.php 100644 → 100755
@@ -128,7 +128,7 @@ function show_error($heading, $message, $template = 'error_general', $status_cod
ob_end_flush();
}
ob_start();
include(APPPATH.'errors/'.$template.'.php');
include(APPPATH.'errors/'.$template.EXT);
$buffer = ob_get_contents();
ob_end_clean();
return $buffer;
@@ -164,7 +164,7 @@ function show_php_error($severity, $message, $filepath, $line)
ob_end_flush();
}
ob_start();
include(APPPATH.'errors/error_php.php');
include(APPPATH.'errors/error_php'.EXT);
$buffer = ob_get_contents();
ob_end_clean();
echo $buffer;
8 system/core/Hooks.php 100644 → 100755
@@ -65,13 +65,13 @@ function _initialize()
// Grab the "hooks" definition file.
// If there are no hooks, we're done.

if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/hooks.php'))
if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/hooks'.EXT))
{
include(APPPATH.'config/'.ENVIRONMENT.'/hooks.php');
include(APPPATH.'config/'.ENVIRONMENT.'/hooks'.EXT);
}
elseif (is_file(APPPATH.'config/hooks.php'))
elseif (is_file(APPPATH.'config/hooks'.EXT))
{
include(APPPATH.'config/hooks.php');
include(APPPATH.'config/hooks'.EXT);
}


2 system/core/Input.php 100644 → 100755
@@ -672,7 +672,7 @@ public function is_ajax_request()
*/
public function is_cli_request()
{
return (php_sapi_name() == 'cli') or defined('STDIN');
return (bool) defined('STDIN');
}

}
12 system/core/Lang.php 100644 → 100755
@@ -51,14 +51,14 @@ function __construct()
*/
function load($langfile = '', $idiom = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '')
{
$langfile = str_replace('.php', '', $langfile);
$langfile = str_replace(EXT, '', $langfile);

if ($add_suffix == TRUE)
{
$langfile = str_replace('_lang.', '', $langfile).'_lang';
}

$langfile .= '.php';
$langfile .= EXT;

if (in_array($langfile, $this->is_loaded, TRUE))
{
@@ -129,19 +129,19 @@ function load($langfile = '', $idiom = '', $return = FALSE, $add_suffix = TRUE,
*/
function line($line = '')
{
$value = ($line == '' OR ! isset($this->language[$line])) ? FALSE : $this->language[$line];
$line = ($line == '' OR ! isset($this->language[$line])) ? FALSE : $this->language[$line];

// Because killer robots like unicorns!
if ($value === FALSE)
if ($line === FALSE)
{
log_message('error', 'Could not find the language line "'.$line.'"');
}

return $value;
return $line;
}

}
// END Language Class

/* End of file Lang.php */
/* Location: ./system/core/Lang.php */
/* Location: ./system/core/Lang.php */
270 system/core/Loader.php 100644 → 100755

Large diffs are not rendered by default.

0 system/core/Model.php 100644 → 100755
Empty file.
6 system/core/Output.php 100644 → 100755
@@ -42,13 +42,13 @@ function __construct()
$this->_zlib_oc = @ini_get('zlib.output_compression');

// Get mime types for later
if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'))
if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT))
{
include APPPATH.'config/'.ENVIRONMENT.'/mimes.php';
include APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT;
}
else
{
include APPPATH.'config/mimes.php';
include APPPATH.'config/mimes'.EXT;
}


14 system/core/Router.php 100644 → 100755
@@ -87,13 +87,13 @@ function _set_routing()
}

// Load the routes.php file.
if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/routes.php'))
if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/routes'.EXT))
{
include(APPPATH.'config/'.ENVIRONMENT.'/routes.php');
include(APPPATH.'config/'.ENVIRONMENT.'/routes'.EXT);
}
elseif (is_file(APPPATH.'config/routes.php'))
elseif (is_file(APPPATH.'config/routes'.EXT))
{
include(APPPATH.'config/routes.php');
include(APPPATH.'config/routes'.EXT);
}

$this->routes = ( ! isset($route) OR ! is_array($route)) ? array() : $route;
@@ -227,7 +227,7 @@ function _validate_request($segments)
}

// Does the requested controller exist in the root folder?
if (file_exists(APPPATH.'controllers/'.$segments[0].'.php'))
if (file_exists(APPPATH.'controllers/'.$segments[0].EXT))
{
return $segments;
}
@@ -242,7 +242,7 @@ function _validate_request($segments)
if (count($segments) > 0)
{
// Does the requested controller exist in the sub-folder?
if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$segments[0].'.php'))
if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$segments[0].EXT))
{
show_404($this->fetch_directory().$segments[0]);
}
@@ -264,7 +264,7 @@ function _validate_request($segments)
}

// Does the default controller exist in the sub-folder?
if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$this->default_controller.'.php'))
if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$this->default_controller.EXT))
{
$this->directory = '';
return array();
18 system/core/Security.php 100644 → 100755
@@ -58,20 +58,8 @@ class CI_Security {
*/
public function __construct()
{
// CSRF config
foreach(array('csrf_expire', 'csrf_token_name', 'csrf_cookie_name') as $key)
{
if (FALSE !== ($val = config_item($key)))
{
$this->{'_'.$key} = $val;
}
}

// Append application specific cookie prefix
if (config_item('cookie_prefix'))
{
$this->_csrf_cookie_name = config_item('cookie_prefix').$this->_csrf_cookie_name;
}
// Append application specific cookie prefix to token name
$this->_csrf_cookie_name = (config_item('cookie_prefix')) ? config_item('cookie_prefix').$this->_csrf_token_name : $this->_csrf_token_name;

// Set the CSRF hash
$this->_csrf_set_hash();
@@ -829,4 +817,4 @@ protected function _csrf_set_hash()
// END Security Class

/* End of file Security.php */
/* Location: ./system/libraries/Security.php */
/* Location: ./system/libraries/Security.php */
12 system/core/URI.php 100644 → 100755
@@ -62,7 +62,7 @@ function _fetch_uri_string()
if (strtoupper($this->config->item('uri_protocol')) == 'AUTO')
{
// Is the request coming from the command line?
if (php_sapi_name() == 'cli' or defined('STDIN'))
if (defined('STDIN'))
{
$this->_set_uri_string($this->_parse_cli_args());
return;
@@ -120,7 +120,7 @@ function _fetch_uri_string()
$path = (isset($_SERVER[$uri])) ? $_SERVER[$uri] : @getenv($uri);
$this->_set_uri_string($path);
}

// --------------------------------------------------------------------

/**
@@ -133,7 +133,7 @@ function _set_uri_string($str)
{
// Filter out control characters
$str = remove_invisible_characters($str, FALSE);

// If the URI contains only a slash we'll kill it
$this->uri_string = ($str == '/') ? '' : $str;
}
@@ -151,7 +151,7 @@ function _set_uri_string($str)
*/
private function _detect_uri()
{
if ( ! isset($_SERVER['REQUEST_URI']) OR ! isset($_SERVER['SCRIPT_NAME']))
if ( ! isset($_SERVER['REQUEST_URI']))
{
return '';
}
@@ -184,12 +184,12 @@ private function _detect_uri()
$_SERVER['QUERY_STRING'] = '';
$_GET = array();
}

if ($uri == '/' || empty($uri))
{
return '/';
}

$uri = parse_url($uri, PHP_URL_PATH);

// Do some final cleaning of the URI and return it
0 system/core/Utf8.php 100644 → 100755
Empty file.
0 system/core/index.html 100644 → 100755
Empty file.
12 system/database/DB.php 100644 → 100755
@@ -28,11 +28,11 @@ function &DB($params = '', $active_record_override = NULL)
if (is_string($params) AND strpos($params, '://') === FALSE)
{
// Is the config file in the environment folder?
if ( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/database.php'))
if ( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/database'.EXT))
{
if ( ! file_exists($file_path = APPPATH.'config/database.php'))
if ( ! file_exists($file_path = APPPATH.'config/database'.EXT))
{
show_error('The configuration file database.php does not exist.');
show_error('The configuration file database'.EXT.' does not exist.');
}
}

@@ -116,11 +116,11 @@ function &DB($params = '', $active_record_override = NULL)
$active_record = $active_record_override;
}

require_once(BASEPATH.'database/DB_driver.php');
require_once(BASEPATH.'database/DB_driver'.EXT);

if ( ! isset($active_record) OR $active_record == TRUE)
{
require_once(BASEPATH.'database/DB_active_rec.php');
require_once(BASEPATH.'database/DB_active_rec'.EXT);

if ( ! class_exists('CI_DB'))
{
@@ -135,7 +135,7 @@ function &DB($params = '', $active_record_override = NULL)
}
}

require_once(BASEPATH.'database/drivers/'.$params['dbdriver'].'/'.$params['dbdriver'].'_driver.php');
require_once(BASEPATH.'database/drivers/'.$params['dbdriver'].'/'.$params['dbdriver'].'_driver'.EXT);

// Instantiate the DB adapter
$driver = 'CI_DB_'.$params['dbdriver'].'_driver';
300 system/database/DB_active_rec.php 100644 → 100755

Large diffs are not rendered by default.

0 system/database/DB_cache.php 100644 → 100755
Empty file.
6 system/database/DB_driver.php 100644 → 100755
@@ -424,8 +424,8 @@ function load_rdriver()

if ( ! class_exists($driver))
{
include_once(BASEPATH.'database/DB_result.php');
include_once(BASEPATH.'database/drivers/'.$this->dbdriver.'/'.$this->dbdriver.'_result.php');
include_once(BASEPATH.'database/DB_result'.EXT);
include_once(BASEPATH.'database/drivers/'.$this->dbdriver.'/'.$this->dbdriver.'_result'.EXT);
}

return $driver;
@@ -1115,7 +1115,7 @@ function _cache_init()

if ( ! class_exists('CI_DB_Cache'))
{
if ( ! @include(BASEPATH.'database/DB_cache.php'))
if ( ! @include(BASEPATH.'database/DB_cache'.EXT))
{
return $this->cache_off();
}
0 system/database/DB_forge.php 100644 → 100755
Empty file.
97 system/database/DB_result.php 100644 → 100755
@@ -28,14 +28,14 @@
*/
class CI_DB_result {

var $conn_id = NULL;
var $result_id = NULL;
var $result_array = array();
var $result_object = array();
var $custom_result_object = array();
var $current_row = 0;
var $num_rows = 0;
var $row_data = NULL;
var $conn_id = NULL;
var $result_id = NULL;
var $result_array = array();
var $result_object = array();
var $custom_result_object = array();
var $current_row = 0;
var $num_rows = 0;
var $row_data = NULL;


/**
@@ -47,52 +47,47 @@ class CI_DB_result {
*/
function result($type = 'object')
{
if ($type == 'array') return $this->result_array();
else if ($type == 'object') return $this->result_object();
else return $this->custom_result_object($type);
if ($type == 'array') return $this->result_array();
else if ($type == 'object') return $this->result_object();
else return $this->custom_result_object($type);
}

// --------------------------------------------------------------------

/**
* Custom query result.
*
* @param class_name A string that represents the type of object you want back
* @return array of objects
*/
function custom_result_object($class_name)
{
if (array_key_exists($class_name, $this->custom_result_object))
{
return $this->custom_result_object[$class_name];
}

if ($this->result_id === FALSE OR $this->num_rows() == 0)
{
return array();
}

// add the data to the object
$this->_data_seek(0);
$result_object = array();

/**
* Custom query result.
*
* @param class_name A string that represents the type of object you want back
* @return array of objects
*/
function custom_result_object($class_name)
{
if (array_key_exists($class_name, $this->custom_result_object))
{
return $this->custom_result_object[$class_name];
}

if ($this->result_id === FALSE OR $this->num_rows() == 0)
{
return array();
}

// add the data to the object
$this->_data_seek(0);
$result_object = array();
while ($row = $this->_fetch_object())
{
$object = new $class_name();

foreach ($row as $key => $value)
{
$object->$key = $value;
}

{
$object = new $class_name();
foreach ($row as $key => $value)
{
$object->$key = $value;
}
$result_object[] = $object;
}

// return the array
return $this->custom_result_object[$class_name] = $result_object;
}

// --------------------------------------------------------------------
// return the array
return $this->custom_result_object[$class_name] = $result_object;
}

/**
* Query result. "object" version.
@@ -185,9 +180,9 @@ function row($n = 0, $type = 'object')
$n = 0;
}

if ($type == 'object') return $this->row_object($n);
else if ($type == 'array') return $this->row_array($n);
else return $this->custom_row_object($n, $type);
if ($type == 'object') return $this->row_object($n);
else if ($type == 'array') return $this->row_array($n);
else return $this->custom_row_object($n, $type);
}

// --------------------------------------------------------------------
@@ -224,7 +219,7 @@ function set_row($key, $value = NULL)

// --------------------------------------------------------------------

/**
/**
* Returns a single result row - custom object version
*
* @access public
@@ -247,7 +242,7 @@ function custom_row_object($n, $type)
return $result[$this->current_row];
}

/**
/**
* Returns a single result row - object version
*
* @access public
0 system/database/DB_utility.php 100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
@@ -132,22 +132,7 @@ function db_select()
*/
function db_set_charset($charset, $collation)
{
static $use_set_names;

if ( ! isset($use_set_names))
{
// mysql_set_charset() requires PHP >= 5.2.3 and MySQL >= 5.0.7, use SET NAMES as fallback
$use_set_names = (version_compare(PHP_VERSION, '5.2.3', '>=') && version_compare(mysql_get_server_info(), '5.0.7', '>=')) ? FALSE : TRUE;
}

if ($use_set_names)
{
return @mysql_query("SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'", $this->conn_id);
}
else
{
return @mysql_set_charset($charset, $this->conn_id);
}
return @mysql_query("SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'", $this->conn_id);
}

// --------------------------------------------------------------------
@@ -119,13 +119,9 @@ function _process_fields($fields)
$sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\'';
}

if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE)
if (array_key_exists('NULL', $attributes))
{
$sql .= ' NULL';
}
else
{
$sql .= ' NOT NULL';
$sql .= ($attributes['NULL'] === TRUE) ? ' NULL' : ' NOT NULL';
}

if (array_key_exists('AUTO_INCREMENT', $attributes) && $attributes['AUTO_INCREMENT'] === TRUE)
Empty file.
Empty file.
Empty file.
@@ -132,22 +132,7 @@ function db_select()
*/
function _db_set_charset($charset, $collation)
{
static $use_set_names;

if ( ! isset($use_set_names))
{
// mysqli_set_charset() requires MySQL >= 5.0.7, use SET NAMES as fallback
$use_set_names = (version_compare(mysqli_get_server_info($this->conn_id), '5.0.7', '>=')) ? FALSE : TRUE;
}

if ($use_set_names)
{
return @mysqli_query($this->conn_id, "SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'");
}
else
{
return @mysqli_set_charset($this->conn_id, $charset);
}
return @mysqli_query($this->conn_id, "SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'");
}

// --------------------------------------------------------------------
@@ -104,13 +104,9 @@ function _process_fields($fields)
$sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\'';
}

if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE)
if (array_key_exists('NULL', $attributes))
{
$sql .= ' NULL';
}
else
{
$sql .= ' NOT NULL';
$sql .= ($attributes['NULL'] === TRUE) ? ' NULL' : ' NOT NULL';
}

if (array_key_exists('AUTO_INCREMENT', $attributes) && $attributes['AUTO_INCREMENT'] === TRUE)
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
@@ -553,24 +553,6 @@ function _insert($table, $keys, $values)

// --------------------------------------------------------------------

/**
* Insert_batch statement
*
* Generates a platform-specific insert string from the supplied data
*
* @access public
* @param string the table name
* @param array the insert keys
* @param array the insert values
* @return string
*/
function _insert_batch($table, $keys, $values)
{
return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES ".implode(', ', $values);
}

// --------------------------------------------------------------------

/**
* Update statement
*
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 system/database/index.html 100644 → 100755
Empty file.
0 system/fonts/index.html 100644 → 100755
Empty file.
BIN +8.95 KB (110%) system/fonts/texb.ttf 100644 → 100755
Binary file not shown.
0 system/helpers/array_helper.php 100644 → 100755
Empty file.
0 system/helpers/captcha_helper.php 100644 → 100755
Empty file.
0 system/helpers/cookie_helper.php 100644 → 100755
Empty file.
0 system/helpers/date_helper.php 100644 → 100755
Empty file.
Empty file.
@@ -58,13 +58,13 @@ function force_download($filename = '', $data = '')
$extension = end($x);

// Load the mime types
if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'))
if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT))
{
include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php');
include(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT);
}
elseif (is_file(APPPATH.'config/mimes.php'))
elseif (is_file(APPPATH.'config/mimes'.EXT))
{
include(APPPATH.'config/mimes.php');
include(APPPATH.'config/mimes'.EXT);
}

// Set a default mime if we can't find it
0 system/helpers/email_helper.php 100644 → 100755
Empty file.
8 system/helpers/file_helper.php 100644 → 100755
@@ -352,13 +352,13 @@ function get_mime_by_extension($file)

if ( ! is_array($mimes))
{
if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'))
if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT))
{
include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php');
include(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT);
}
elseif (is_file(APPPATH.'config/mimes.php'))
elseif (is_file(APPPATH.'config/mimes'.EXT))
{
include(APPPATH.'config/mimes.php');
include(APPPATH.'config/mimes'.EXT);
}

if ( ! is_array($mimes))
28 system/helpers/form_helper.php 100644 → 100755
@@ -72,7 +72,7 @@ function form_open($action = '', $attributes = '', $hidden = array())

if (is_array($hidden) AND count($hidden) > 0)
{
$form .= sprintf("<div style=\"display:none\">%s</div>", form_hidden($hidden));
$form .= sprintf("\n<div class=\"hidden\">%s</div>", form_hidden($hidden));
}

return $form;
@@ -1032,23 +1032,25 @@ function &_get_validation_object()
{
$CI =& get_instance();

// We set this as a variable since we're returning by reference.
// We set this as a variable since we're returning by reference
$return = FALSE;
if (FALSE !== ($object = $CI->load->is_loaded('form_validation')))

if ( ! isset($CI->load->_ci_classes) OR ! isset($CI->load->_ci_classes['form_validation']))
{
if ( ! isset($CI->$object) OR ! is_object($CI->$object))
{
return $return;
}

return $CI->$object;
return $return;
}

$object = $CI->load->_ci_classes['form_validation'];

if ( ! isset($CI->$object) OR ! is_object($CI->$object))
{
return $return;
}
return $return;

return $CI->$object;
}
}


/* End of file form_helper.php */
/* Location: ./system/helpers/form_helper.php */
/* Location: ./system/helpers/form_helper.php */
17 system/helpers/html_helper.php 100644 → 100755
@@ -40,10 +40,9 @@
*/
if ( ! function_exists('heading'))
{
function heading($data = '', $h = '1', $attributes = '')
function heading($data = '', $h = '1')
{
$attributes = ($attributes != '') ? ' '.$attributes : $attributes;
return "<h".$h.$attributes.">".$data."</h".$h.">";
return "<h".$h.">".$data."</h".$h.">";
}
}

@@ -124,10 +123,6 @@ function _list($type = 'ul', $list, $attributes = '', $depth = 0)
}
$attributes = $atts;
}
elseif (is_string($attributes) AND strlen($attributes) > 0)
{
$attributes = ' '. $attributes;
}

// Write the opening list tag
$out .= "<".$type.$attributes.">\n";
@@ -263,13 +258,13 @@ function doctype($type = 'xhtml1-strict')

if ( ! is_array($_doctypes))
{
if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/doctypes.php'))
if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/doctypes'.EXT))
{
include(APPPATH.'config/'.ENVIRONMENT.'/doctypes.php');
include(APPPATH.'config/'.ENVIRONMENT.'/doctypes'.EXT);
}
elseif (is_file(APPPATH.'config/doctypes.php'))
elseif (is_file(APPPATH.'config/doctypes'.EXT))
{
include(APPPATH.'config/doctypes.php');
include(APPPATH.'config/doctypes'.EXT);
}

if ( ! is_array($_doctypes))
0 system/helpers/index.html 100644 → 100755
Empty file.
115 system/helpers/inflector_helper.php 100644 → 100755
@@ -41,48 +41,30 @@
{
function singular($str)
{
$result = strval($str);

$singular_rules = array(
'/(matr)ices$/' => '\1ix',
'/(vert|ind)ices$/' => '\1ex',
'/^(ox)en/' => '\1',
'/(alias)es$/' => '\1',
'/([octop|vir])i$/' => '\1us',
'/(cris|ax|test)es$/' => '\1is',
'/(shoe)s$/' => '\1',
'/(o)es$/' => '\1',
'/(bus|campus)es$/' => '\1',
'/([m|l])ice$/' => '\1ouse',
'/(x|ch|ss|sh)es$/' => '\1',
'/(m)ovies$/' => '\1\2ovie',
'/(s)eries$/' => '\1\2eries',
'/([^aeiouy]|qu)ies$/' => '\1y',
'/([lr])ves$/' => '\1f',
'/(tive)s$/' => '\1',
'/(hive)s$/' => '\1',
'/([^f])ves$/' => '\1fe',
'/(^analy)ses$/' => '\1sis',
'/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/' => '\1\2sis',
'/([ti])a$/' => '\1um',
'/(p)eople$/' => '\1\2erson',
'/(m)en$/' => '\1an',
'/(s)tatuses$/' => '\1\2tatus',
'/(c)hildren$/' => '\1\2hild',
'/(n)ews$/' => '\1\2ews',
'/([^u])s$/' => '\1',
);

foreach ($singular_rules as $rule => $replacement)
$str = trim($str);
$end = substr($str, -3);

$str = preg_replace('/(.*)?([s|c]h)es/i','$1$2',$str);

if (strtolower($end) == 'ies')
{
if (preg_match($rule, $result))
$str = substr($str, 0, strlen($str)-3).(preg_match('/[a-z]/',$end) ? 'y' : 'Y');
}
elseif (strtolower($end) == 'ses')
{
$str = substr($str, 0, strlen($str)-2);
}
else
{
$end = strtolower(substr($str, -1));

if ($end == 's')
{
$result = preg_replace($rule, $replacement, $result);
break;
$str = substr($str, 0, strlen($str)-1);
}
}

return $result;
return $str;
}
}

@@ -101,41 +83,40 @@ function singular($str)
if ( ! function_exists('plural'))
{
function plural($str, $force = FALSE)
{
$result = strval($str);

$plural_rules = array(
'/^(ox)$/' => '\1\2en', // ox
'/([m|l])ouse$/' => '\1ice', // mouse, louse
'/(matr|vert|ind)ix|ex$/' => '\1ices', // matrix, vertex, index
'/(x|ch|ss|sh)$/' => '\1es', // search, switch, fix, box, process, address
'/([^aeiouy]|qu)y$/' => '\1ies', // query, ability, agency
'/(hive)$/' => '\1s', // archive, hive
'/(?:([^f])fe|([lr])f)$/' => '\1\2ves', // half, safe, wife
'/sis$/' => 'ses', // basis, diagnosis
'/([ti])um$/' => '\1a', // datum, medium
'/(p)erson$/' => '\1eople', // person, salesperson
'/(m)an$/' => '\1en', // man, woman, spokesman
'/(c)hild$/' => '\1hildren', // child
'/(buffal|tomat)o$/' => '\1\2oes', // buffalo, tomato
'/(bu|campu)s$/' => '\1\2ses', // bus, campus
'/(alias|status|virus)/' => '\1es', // alias
'/(octop)us$/' => '\1i', // octopus
'/(ax|cris|test)is$/' => '\1es', // axis, crisis
'/s$/' => 's', // no change (compatibility)
'/$/' => 's',
);

foreach ($plural_rules as $rule => $replacement)
{
$str = trim($str);
$end = substr($str, -1);

if (preg_match('/y/i',$end))
{
// Y preceded by vowel => regular plural
$vowels = array('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U');
$str = in_array(substr($str, -2, 1), $vowels) ? $str.'s' : substr($str, 0, -1).'ies';
}
elseif (preg_match('/h/i',$end))
{
if (preg_match($rule, $result))
if(preg_match('/^[c|s]h$/i',substr($str, -2)))
{
$result = preg_replace($rule, $replacement, $result);
break;
$str .= 'es';
}
else
{
$str .= 's';
}
}
elseif (preg_match('/s/i',$end))
{
if ($force == TRUE)
{
$str .= 'es';
}
}
else
{
$str .= 's';
}

return $result;
return $str;
}
}

Empty file.
0 system/helpers/number_helper.php 100644 → 100755
Empty file.
0 system/helpers/path_helper.php 100644 → 100755
Empty file.
Empty file.
8 system/helpers/smiley_helper.php 100644 → 100755
@@ -229,13 +229,13 @@ function parse_smileys($str = '', $image_url = '', $smileys = NULL)
{
function _get_smiley_array()
{
if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys.php'))
if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys'.EXT))
{
include(APPPATH.'config/'.ENVIRONMENT.'/smileys.php');
include(APPPATH.'config/'.ENVIRONMENT.'/smileys'.EXT);
}
elseif (file_exists(APPPATH.'config/smileys.php'))
elseif (file_exists(APPPATH.'config/smileys'.EXT))
{
include(APPPATH.'config/smileys.php');
include(APPPATH.'config/smileys'.EXT);
}

if (isset($smileys) AND is_array($smileys))
0 system/helpers/string_helper.php 100644 → 100755
Empty file.
8 system/helpers/text_helper.php 100644 → 100755
@@ -366,13 +366,13 @@ function highlight_phrase($str, $phrase, $tag_open = '<strong>', $tag_close = '<
{
function convert_accented_characters($str)
{
if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php'))
if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars'.EXT))
{
include(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php');
include(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars'.EXT);
}
elseif (is_file(APPPATH.'config/foreign_chars.php'))
elseif (is_file(APPPATH.'config/foreign_chars'.EXT))
{
include(APPPATH.'config/foreign_chars.php');
include(APPPATH.'config/foreign_chars'.EXT);
}

if ( ! isset($foreign_characters))
Empty file.
11 system/helpers/url_helper.php 100644 → 100755
@@ -50,21 +50,18 @@ function site_url($uri = '')

/**
* Base URL
*
* Create a local URL based on your basepath.
* Segments can be passed in as a string or an array, same as site_url
* or a URL to a file can be passed in, e.g. to an image file.
*
* Returns the "base_url" item from your config file
*
* @access public
* @param string
* @return string
*/
if ( ! function_exists('base_url'))
{
function base_url($uri = '')
function base_url()
{
$CI =& get_instance();
return $CI->config->base_url($uri);
return $CI->config->slash_item('base_url');
}
}

0 system/helpers/xml_helper.php 100644 → 100755
Empty file.
0 system/index.html 100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
@@ -9,7 +9,6 @@
$lang['profiler_uri_string'] = 'URI STRING';
$lang['profiler_memory_usage'] = 'MEMORY USAGE';
$lang['profiler_config'] = 'CONFIG VARIABLES';
$lang['profiler_session_data'] = 'SESSION DATA';
$lang['profiler_headers'] = 'HTTP HEADERS';
$lang['profiler_no_db'] = 'Database driver is not currently loaded';
$lang['profiler_no_queries'] = 'No queries were run';
@@ -18,8 +17,6 @@
$lang['profiler_no_uri'] = 'No URI data exists';
$lang['profiler_no_memory'] = 'Memory Usage Unavailable';
$lang['profiler_no_profiles'] = 'No Profile data - all Profiler sections have been disabled.';
$lang['profiler_section_hide'] = 'Hide';
$lang['profiler_section_show'] = 'Show';

/* End of file profiler_lang.php */
/* Location: ./system/language/english/profiler_lang.php */
Empty file.
Empty file.
0 system/language/index.html 100644 → 100755
Empty file.
0 system/libraries/Cache/Cache.php 100644 → 100755
Empty file.
Empty file.
@@ -10,38 +10,38 @@
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 2.0
* @filesource
* @filesource
*/

// ------------------------------------------------------------------------

/**
* CodeIgniter Dummy Caching Class
* CodeIgniter Dummy Caching Class
*
* @package CodeIgniter
* @subpackage Libraries
* @category Core
* @author ExpressionEngine Dev Team
* @link
* @link
*/

class CI_Cache_dummy extends CI_Driver {

/**
* Get
* Get
*
* Since this is the dummy class, it's always going to return FALSE.
*
* @param string
* @param string
* @return Boolean FALSE
*/
public function get($id)
{
return FALSE;
}

// ------------------------------------------------------------------------

// ------------------------------------------------------------------------
/**
* Cache Save
*
@@ -55,7 +55,7 @@ public function save($id, $data, $ttl = 60)
{
return TRUE;
}

// ------------------------------------------------------------------------

/**
@@ -112,7 +112,7 @@ public function get_metadata($id)
/**
* Is this caching driver supported on the system?
* Of course this one is.
*
*
* @return TRUE;
*/
public function is_supported()
@@ -121,9 +121,9 @@ public function is_supported()
}

// ------------------------------------------------------------------------

}
// End Class

/* End of file Cache_dummy.php */
/* Location: ./system/libraries/Cache/drivers/Cache_dummy.php */
/* End of file Cache_apc.php */
/* Location: ./system/libraries/Cache/drivers/Cache_apc.php */
Empty file.
Empty file.
2 system/libraries/Calendar.php 100644 → 100755
@@ -47,7 +47,7 @@ public function __construct($config = array())
{
$this->CI =& get_instance();

if ( ! in_array('calendar_lang.php', $this->CI->lang->is_loaded, TRUE))
if ( ! in_array('calendar_lang'.EXT, $this->CI->lang->is_loaded, TRUE))
{
$this->CI->lang->load('calendar');
}
4 system/libraries/Cart.php 100644 → 100755
@@ -374,7 +374,6 @@ function _save_cart()

// Lets add up the individual prices and set the cart sub-total
$total = 0;
$items = 0;
foreach ($this->_cart_contents as $key => $val)
{
// We make sure the array contains the proper indexes
@@ -384,14 +383,13 @@ function _save_cart()
}

$total += ($val['price'] * $val['qty']);
$items += $val['qty'];

// Set the subtotal
$this->_cart_contents[$key]['subtotal'] = ($this->_cart_contents[$key]['price'] * $this->_cart_contents[$key]['qty']);
}

// Set the cart total and total items.
$this->_cart_contents['total_items'] = $items;
$this->_cart_contents['total_items'] = count($this->_cart_contents);
$this->_cart_contents['cart_total'] = $total;

// Is our cart empty? If so we delete it from the session
12 system/libraries/Driver.php 100644 → 100755
@@ -43,11 +43,11 @@ function __get($child)

// The class will be prefixed with the parent lib
$child_class = $this->lib_name.'_'.$child;

// Remove the CI_ prefix and lowercase
$lib_name = ucfirst(strtolower(str_replace('CI_', '', $this->lib_name)));
$driver_name = strtolower(str_replace('CI_', '', $child_class));
$lib_name = strtolower(preg_replace('/^CI_/', '', $this->lib_name));
$driver_name = strtolower(preg_replace('/^CI_/', '', $child_class));

if (in_array($driver_name, array_map('strtolower', $this->valid_drivers)))
{
// check and see if the driver is in a separate file
@@ -59,7 +59,7 @@ function __get($child)
// loves me some nesting!
foreach (array(ucfirst($driver_name), $driver_name) as $class)
{
$filepath = $path.'libraries/'.$lib_name.'/drivers/'.$class.'.php';
$filepath = $path.'libraries/'.$lib_name.'/drivers/'.$class.EXT;

if (file_exists($filepath))
{
@@ -226,4 +226,4 @@ public function __set($var, $val)
// END CI_Driver CLASS

/* End of file Driver.php */
/* Location: ./system/libraries/Driver.php */
/* Location: ./system/libraries/Driver.php */
46 system/libraries/Email.php 100644 → 100755
@@ -395,7 +395,7 @@ public function message($body)
public function attach($filename, $disposition = 'attachment')
{
$this->_attach_name[] = $filename;
$this->_attach_type[] = $this->_mime_types(pathinfo($filename, PATHINFO_EXTENSION));
$this->_attach_type[] = $this->_mime_types(next(explode('.', basename($filename))));
$this->_attach_disp[] = $disposition; // Can also be 'inline' Not sure if it matters
return $this;
}
@@ -722,15 +722,15 @@ public function validate_email($email)
{
if ( ! is_array($email))
{
$this->_set_error_message('lang:email_must_be_array');
$this->_set_error_message('email_must_be_array');
return FALSE;
}

foreach ($email as $val)
{
if ( ! $this->valid_email($val))
{
$this->_set_error_message('lang:email_invalid_address', $val);
$this->_set_error_message('email_invalid_address', $val);
return FALSE;
}
}
@@ -1131,7 +1131,7 @@ private function _build_message()

if ( ! file_exists($filename))
{
$this->_set_error_message('lang:email_attachment_missing', $filename);
$this->_set_error_message('email_attachment_missing', $filename);
return FALSE;
}

@@ -1146,7 +1146,7 @@ private function _build_message()

if ( ! $fp = fopen($filename, FOPEN_READ))
{
$this->_set_error_message('lang:email_attachment_unreadable', $filename);
$this->_set_error_message('email_attachment_unreadable', $filename);
return FALSE;
}

@@ -1353,7 +1353,7 @@ public function send()
( ! isset($this->_bcc_array) AND ! isset($this->_headers['Bcc'])) AND
( ! isset($this->_headers['Cc'])))
{
$this->_set_error_message('lang:email_no_recipients');
$this->_set_error_message('email_no_recipients');
return FALSE;
}

@@ -1484,30 +1484,30 @@ private function _spool_email()

if ( ! $this->_send_with_mail())
{
$this->_set_error_message('lang:email_send_failure_phpmail');
$this->_set_error_message('email_send_failure_phpmail');
return FALSE;
}
break;
case 'sendmail' :

if ( ! $this->_send_with_sendmail())
{
$this->_set_error_message('lang:email_send_failure_sendmail');
$this->_set_error_message('email_send_failure_sendmail');
return FALSE;
}
break;
case 'smtp' :

if ( ! $this->_send_with_smtp())
{
$this->_set_error_message('lang:email_send_failure_smtp');
$this->_set_error_message('email_send_failure_smtp');
return FALSE;
}
break;

}

$this->_set_error_message('lang:email_sent', $this->_get_protocol());
$this->_set_error_message('email_sent', $this->_get_protocol());
return TRUE;
}

@@ -1578,8 +1578,8 @@ private function _send_with_sendmail()

if ($status != 0)
{
$this->_set_error_message('lang:email_exit_status', $status);
$this->_set_error_message('lang:email_no_socket');
$this->_set_error_message('email_exit_status', $status);
$this->_set_error_message('email_no_socket');
return FALSE;
}

@@ -1598,7 +1598,7 @@ private function _send_with_smtp()
{
if ($this->smtp_host == '')
{
$this->_set_error_message('lang:email_no_hostname');
$this->_set_error_message('email_no_hostname');
return FALSE;
}

@@ -1647,7 +1647,7 @@ private function _send_with_smtp()

if (strncmp($reply, '250', 3) != 0)
{
$this->_set_error_message('lang:email_smtp_error', $reply);
$this->_set_error_message('email_smtp_error', $reply);
return FALSE;
}

@@ -1674,7 +1674,7 @@ private function _smtp_connect()

if ( ! is_resource($this->_smtp_connect))
{
$this->_set_error_message('lang:email_smtp_error', $errno." ".$errstr);
$this->_set_error_message('email_smtp_error', $errno." ".$errstr);
return FALSE;
}

@@ -1737,7 +1737,7 @@ private function _send_command($cmd, $data = '')

if (substr($reply, 0, 3) != $resp)
{
$this->_set_error_message('lang:email_smtp_error', $reply);
$this->_set_error_message('email_smtp_error', $reply);
return FALSE;
}

@@ -1766,7 +1766,7 @@ private function _smtp_authenticate()

if ($this->smtp_user == "" AND $this->smtp_pass == "")
{
$this->_set_error_message('lang:email_no_smtp_unpw');
$this->_set_error_message('email_no_smtp_unpw');
return FALSE;
}

@@ -1776,7 +1776,7 @@ private function _smtp_authenticate()

if (strncmp($reply, '334', 3) != 0)
{
$this->_set_error_message('lang:email_failed_smtp_login', $reply);
$this->_set_error_message('email_failed_smtp_login', $reply);
return FALSE;
}

@@ -1786,7 +1786,7 @@ private function _smtp_authenticate()

if (strncmp($reply, '334', 3) != 0)
{
$this->_set_error_message('lang:email_smtp_auth_un', $reply);
$this->_set_error_message('email_smtp_auth_un', $reply);
return FALSE;
}

@@ -1796,7 +1796,7 @@ private function _smtp_authenticate()

if (strncmp($reply, '235', 3) != 0)
{
$this->_set_error_message('lang:email_smtp_auth_pw', $reply);
$this->_set_error_message('email_smtp_auth_pw', $reply);
return FALSE;
}

@@ -1815,7 +1815,7 @@ private function _send_data($data)
{
if ( ! fwrite($this->_smtp_connect, $data . $this->newline))
{
$this->_set_error_message('lang:email_smtp_data_failure', $data);
$this->_set_error_message('email_smtp_data_failure', $data);
return FALSE;
}
else
@@ -1942,7 +1942,7 @@ private function _set_error_message($msg, $val = '')
$CI =& get_instance();
$CI->lang->load('email');

if (substr($msg, 0, 5) != 'lang:' || FALSE === ($line = $CI->lang->line(substr($msg, 5))))
if (FALSE === ($line = $CI->lang->line($msg)))
{
$this->_debug_msg[] = str_replace('%s', $val, $msg)."<br />";
}
@@ -2059,4 +2059,4 @@ private function _mime_types($ext = "")
// END CI_Email class

/* End of file Email.php */
/* Location: ./system/libraries/Email.php */
/* Location: ./system/libraries/Email.php */
2 system/libraries/Encrypt.php 100644 → 100755
@@ -524,7 +524,7 @@ function sha1($str)
{
if ( ! function_exists('mhash'))
{
require_once(BASEPATH.'libraries/Sha1.php');
require_once(BASEPATH.'libraries/Sha1'.EXT);
$SH = new CI_SHA;
return $SH->generate($str);
}
@@ -628,10 +628,6 @@ function _execute($row, $rules, $postdata = NULL, $cycles = 0)
$this->_field_data[$row['field']]['postdata'] = (is_bool($result)) ? $postdata : $result;
}
}
else
{
log_message('debug', "Unable to find validation rule: ".$rule);
}

continue;
}
@@ -1361,4 +1357,4 @@ function encode_php_tags($str)
// END Form Validation Class

/* End of file Form_validation.php */
/* Location: ./system/libraries/Form_validation.php */
/* Location: ./system/libraries/Form_validation.php */
0 system/libraries/Ftp.php 100644 → 100755
Empty file.
0 system/libraries/Image_lib.php 100644 → 100755
Empty file.
0 system/libraries/Javascript.php 100644 → 100755
Empty file.
2 system/libraries/Log.php 100644 → 100755
@@ -83,7 +83,7 @@ public function write_log($level = 'error', $msg, $php_error = FALSE)
return FALSE;
}

$filepath = $this->_log_path.'log-'.date('Y-m-d').'.php';
$filepath = $this->_log_path.'log-'.date('Y-m-d').EXT;
$message = '';

if ( ! file_exists($filepath))
2 system/libraries/Pagination.php 100644 → 100755
@@ -30,7 +30,7 @@ class CI_Pagination {
var $prefix = ''; // A custom prefix added to the path.
var $suffix = ''; // A custom suffix added to the path.

var $total_rows = 0; // Total number of items (database results)
var $total_rows = ''; // Total number of items (database results)
var $per_page = 10; // Max number of items you want shown per page
var $num_links = 2; // Number of "digit" links to show before/after the currently viewed page
var $cur_page = 0; // The current page being viewed
0 system/libraries/Parser.php 100644 → 100755
Empty file.
78 system/libraries/Profiler.php 100644 → 100755
@@ -32,6 +32,8 @@
*/
class CI_Profiler {

var $CI;

protected $_available_sections = array(
'benchmarks',
'get',
@@ -41,27 +43,14 @@ class CI_Profiler {
'controller_info',
'queries',
'http_headers',
'session_data',
'config'
);

protected $_query_toggle_count = 25;

protected $CI;

// --------------------------------------------------------------------

public function __construct($config = array())
{
$this->CI =& get_instance();
$this->CI->load->language('profiler');

if (isset($config['query_toggle_count']))
{
$this->_query_toggle_count = (int) $config['query_toggle_count'];
unset($config['query_toggle_count']);
}

// default all sections to display
foreach ($this->_available_sections as $section)
{
@@ -173,7 +162,7 @@ protected function _compile_queries()
$output .= "\n";
$output .= '<legend style="color:#0000FF;">&nbsp;&nbsp;'.$this->CI->lang->line('profiler_queries').'&nbsp;&nbsp;</legend>';
$output .= "\n";
$output .= "\n\n<table style='border:none; width:100%;'>\n";
$output .= "\n\n<table style='border:none; width:100%'>\n";
$output .="<tr><td style='width:100%;color:#0000FF;font-weight:normal;background-color:#eee;padding:5px'>".$this->CI->lang->line('profiler_no_db')."</td></tr>\n";
$output .= "</table>\n";
$output .= "</fieldset>";
@@ -189,26 +178,13 @@ protected function _compile_queries()

$output = "\n\n";

$count = 0;

foreach ($dbs as $db)
{
$count++;

$hide_queries = (count($db->queries) > $this->_query_toggle_count) ? ' display:none' : '';

$show_hide_js = '(<span style="cursor: pointer;" onclick="var s=document.getElementById(\'ci_profiler_queries_db_'.$count.'\').style;s.display=s.display==\'none\'?\'\':\'none\';this.innerHTML=this.innerHTML==\''.$this->CI->lang->line('profiler_section_hide').'\'?\''.$this->CI->lang->line('profiler_section_show').'\':\''.$this->CI->lang->line('profiler_section_hide').'\';">'.$this->CI->lang->line('profiler_section_hide').'</span>)';

if ($hide_queries != '')
{
$show_hide_js = '(<span style="cursor: pointer;" onclick="var s=document.getElementById(\'ci_profiler_queries_db_'.$count.'\').style;s.display=s.display==\'none\'?\'\':\'none\';this.innerHTML=this.innerHTML==\''.$this->CI->lang->line('profiler_section_show').'\'?\''.$this->CI->lang->line('profiler_section_hide').'\':\''.$this->CI->lang->line('profiler_section_show').'\';">'.$this->CI->lang->line('profiler_section_show').'</span>)';
}

$output .= '<fieldset style="border:1px solid #0000FF;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee">';
$output .= "\n";
$output .= '<legend style="color:#0000FF;">&nbsp;&nbsp;'.$this->CI->lang->line('profiler_database').':&nbsp; '.$db->database.'&nbsp;&nbsp;&nbsp;'.$this->CI->lang->line('profiler_queries').': '.count($db->queries).'&nbsp;&nbsp;'.$show_hide_js.'</legend>';
$output .= '<legend style="color:#0000FF;">&nbsp;&nbsp;'.$this->CI->lang->line('profiler_database').':&nbsp; '.$db->database.'&nbsp;&nbsp;&nbsp;'.$this->CI->lang->line('profiler_queries').': '.count($db->queries).'&nbsp;&nbsp;&nbsp;</legend>';
$output .= "\n";
$output .= "\n\n<table style='width:100%;{$hide_queries}' id='ci_profiler_queries_db_{$count}'>\n";
$output .= "\n\n<table style='width:100%;'>\n";

if (count($db->queries) == 0)
{
@@ -412,7 +388,7 @@ protected function _compile_memory_usage()
}
else
{
$output .= "<div style='color:#5a0099;font-weight:normal;padding:4px 0 4px 0'>".$this->CI->lang->line('profiler_no_memory')."</div>";
$output .= "<div style='color:#5a0099;font-weight:normal;padding:4px 0 4px 0'>".$this->CI->lang->line('profiler_no_memory_usage')."</div>";
}

$output .= "</fieldset>";
@@ -434,10 +410,10 @@ protected function _compile_http_headers()
$output = "\n\n";
$output .= '<fieldset id="ci_profiler_http_headers" style="border:1px solid #000;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee">';
$output .= "\n";
$output .= '<legend style="color:#000;">&nbsp;&nbsp;'.$this->CI->lang->line('profiler_headers').'&nbsp;&nbsp;(<span style="cursor: pointer;" onclick="var s=document.getElementById(\'ci_profiler_httpheaders_table\').style;s.display=s.display==\'none\'?\'\':\'none\';this.innerHTML=this.innerHTML==\''.$this->CI->lang->line('profiler_section_show').'\'?\''.$this->CI->lang->line('profiler_section_hide').'\':\''.$this->CI->lang->line('profiler_section_show').'\';">'.$this->CI->lang->line('profiler_section_show').'</span>)</legend>';
$output .= '<legend style="color:#000;">&nbsp;&nbsp;'.$this->CI->lang->line('profiler_headers').'&nbsp;&nbsp;</legend>';
$output .= "\n";

$output .= "\n\n<table style='width:100%;display:none' id='ci_profiler_httpheaders_table'>\n";
$output .= "\n\n<table style='width:100%'>\n";

foreach (array('HTTP_ACCEPT', 'HTTP_USER_AGENT', 'HTTP_CONNECTION', 'SERVER_PORT', 'SERVER_NAME', 'REMOTE_ADDR', 'SERVER_SOFTWARE', 'HTTP_ACCEPT_LANGUAGE', 'SCRIPT_NAME', 'REQUEST_METHOD',' HTTP_HOST', 'REMOTE_HOST', 'CONTENT_TYPE', 'SERVER_PROTOCOL', 'QUERY_STRING', 'HTTP_ACCEPT_ENCODING', 'HTTP_X_FORWARDED_FOR') as $header)
{
@@ -465,10 +441,10 @@ protected function _compile_config()
$output = "\n\n";
$output .= '<fieldset id="ci_profiler_config" style="border:1px solid #000;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee">';
$output .= "\n";
$output .= '<legend style="color:#000;">&nbsp;&nbsp;'.$this->CI->lang->line('profiler_config').'&nbsp;&nbsp;(<span style="cursor: pointer;" onclick="var s=document.getElementById(\'ci_profiler_config_table\').style;s.display=s.display==\'none\'?\'\':\'none\';this.innerHTML=this.innerHTML==\''.$this->CI->lang->line('profiler_section_show').'\'?\''.$this->CI->lang->line('profiler_section_hide').'\':\''.$this->CI->lang->line('profiler_section_show').'\';">'.$this->CI->lang->line('profiler_section_show').'</span>)</legend>';
$output .= '<legend style="color:#000;">&nbsp;&nbsp;'.$this->CI->lang->line('profiler_config').'&nbsp;&nbsp;</legend>';
$output .= "\n";

$output .= "\n\n<table style='width:100%; display:none' id='ci_profiler_config_table'>\n";
$output .= "\n\n<table style='width:100%'>\n";

foreach ($this->CI->config->config as $config=>$val)
{
@@ -488,39 +464,6 @@ protected function _compile_config()

// --------------------------------------------------------------------

/**
* Compile session userdata
*
* @return string
*/
private function _compile_session_data()
{
if ( ! isset($this->CI->session))
{
return;
}

$output = '<fieldset id="ci_profiler_csession" style="border:1px solid #000;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee">';
$output .= '<legend style="color:#000;">&nbsp;&nbsp;'.$this->CI->lang->line('profiler_session_data').'&nbsp;&nbsp;(<span style="cursor: pointer;" onclick="var s=document.getElementById(\'ci_profiler_session_data\').style;s.display=s.display==\'none\'?\'\':\'none\';this.innerHTML=this.innerHTML==\''.$this->CI->lang->line('profiler_section_show').'\'?\''.$this->CI->lang->line('profiler_section_hide').'\':\''.$this->CI->lang->line('profiler_section_show').'\';">'.$this->CI->lang->line('profiler_section_show').'</span>)</legend>';
$output .= "<table style='width:100%;display:none' id='ci_profiler_session_data'>";

foreach ($this->CI->session->all_userdata() as $key => $val)
{
if (is_array($val))
{
$val = print_r($val, TRUE);
}

$output .= "<tr><td style='padding:5px; vertical-align: top;color:#900;background-color:#ddd;'>".$key."&nbsp;&nbsp;</td><td style='padding:5px; color:#000;background-color:#ddd;'>".htmlspecialchars($val)."</td></tr>\n";
}

$output .= '</table>';
$output .= "</fieldset>";
return $output;
}

// --------------------------------------------------------------------

/**
* Run the Profiler
*
@@ -550,6 +493,7 @@ public function run()

return $output;
}

}

// END CI_Profiler class
8 system/libraries/Session.php 100644 → 100755
@@ -189,7 +189,7 @@ function sess_read()
}

// Does the User Agent Match?
if ($this->sess_match_useragent == TRUE AND trim($session['user_agent']) != trim(substr($this->CI->input->user_agent(), 0, 120)))
if ($this->sess_match_useragent == TRUE AND trim($session['user_agent']) != trim(substr($this->CI->input->user_agent(), 0, 50)))
{
$this->sess_destroy();
return FALSE;
@@ -316,7 +316,7 @@ function sess_create()
$this->userdata = array(
'session_id' => md5(uniqid($sessid, TRUE)),
'ip_address' => $this->CI->input->ip_address(),
'user_agent' => substr($this->CI->input->user_agent(), 0, 120),
'user_agent' => substr($this->CI->input->user_agent(), 0, 50),
'last_activity' => $this->now
);

@@ -435,11 +435,11 @@ function userdata($item)
* Fetch all session data
*
* @access public
* @return array
* @return mixed
*/
function all_userdata()
{
return $this->userdata;
return ( ! isset($this->userdata)) ? FALSE : $this->userdata;
}

// --------------------------------------------------------------------
0 system/libraries/Sha1.php 100644 → 100755
Empty file.
0 system/libraries/Table.php 100644 → 100755
Empty file.
0 system/libraries/Trackback.php 100644 → 100755
Empty file.
0 system/libraries/Typography.php 100644 → 100755
Empty file.
0 system/libraries/Unit_test.php 100644 → 100755
Empty file.
8 system/libraries/Upload.php 100644 → 100755
@@ -945,13 +945,13 @@ public function mimes_types($mime)

if (count($this->mimes) == 0)
{
if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'))
if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT))
{
include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php');
include(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT);
}
elseif (is_file(APPPATH.'config/mimes.php'))
elseif (is_file(APPPATH.'config/mimes'.EXT))
{
include(APPPATH.'config//mimes.php');
include(APPPATH.'config//mimes'.EXT);
}
else
{
8 system/libraries/User_agent.php 100644 → 100755
@@ -84,13 +84,13 @@ public function __construct()
*/
private function _load_agent_file()
{
if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/user_agents.php'))
if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/user_agents'.EXT))
{
include(APPPATH.'config/'.ENVIRONMENT.'/user_agents.php');
include(APPPATH.'config/'.ENVIRONMENT.'/user_agents'.EXT);
}
elseif (is_file(APPPATH.'config/user_agents.php'))
elseif (is_file(APPPATH.'config/user_agents'.EXT))
{
include(APPPATH.'config/user_agents.php');
include(APPPATH.'config/user_agents'.EXT);
}
else
{
0 system/libraries/Xmlrpc.php 100644 → 100755
Empty file.
2 system/libraries/Xmlrpcs.php 100644 → 100755
@@ -422,6 +422,7 @@ function listMethods($m)
function methodSignature($m)
{
$parameters = $m->output_parameters();

$method_name = $parameters[0];

if (isset($this->methods[$method_name]))
@@ -467,6 +468,7 @@ function methodSignature($m)
function methodHelp($m)
{
$parameters = $m->output_parameters();

$method_name = $parameters[0];

if (isset($this->methods[$method_name]))
0 system/libraries/Zip.php 100644 → 100755
Empty file.
0 system/libraries/index.html 100644 → 100755
Empty file.
Empty file.
@@ -0,0 +1 @@
2.0.3

Large diffs are not rendered by default.

@@ -6,94 +6,94 @@

class Spark_source {

function __construct($url)
{
$this->url = $url;
}
function __construct($url)
{
$this->url = $url;
}

function get_url()
{
return $this->url;
}
function get_url()
{
return $this->url;
}

// get details on an individual spark
function get_spark_detail($spark_name, $version = 'HEAD')
{
$this->warn_if_outdated();
// get details on an individual spark
function get_spark_detail($spark_name, $version = 'HEAD')
{
$this->warn_if_outdated();

$json_data = @file_get_contents("http://$this->url/api/packages/$spark_name/versions/$version/spec");
if (!$json_data) return null; // no such spark here
$data = json_decode($json_data);
// if we don't succeed - throw an error
if ($data == null || !$data->success)
{
$message = "Error retrieving spark detail from source: $this->url";
if ($data != null) $message .= " ($data->message)";
throw new Spark_exception($message);
}
// Get the detail for this spark
return $this->get_spark($data->spec);
}
$json_data = @file_get_contents("http://$this->url/api/packages/$spark_name/versions/$version/spec");
if (!$json_data) return null; // no such spark here
$data = json_decode($json_data);
// if we don't succeed - throw an error
if ($data == null || !$data->success)
{
$message = "Error retrieving spark detail from source: $this->url";
if ($data != null) $message .= " ($data->message)";
throw new Spark_exception($message);
}
// Get the detail for this spark
return $this->get_spark($data->spec);
}

// get details on multiple sparks by search term
function search($term)
{
$this->warn_if_outdated();
// get details on multiple sparks by search term
function search($term)
{
$this->warn_if_outdated();

$json_data = @file_get_contents("http://$this->url/api/packages/search?q=" . urlencode($term));
$data = json_decode($json_data);
// if the data isn't around of success is false, return a warning for this source
if ($data == null || !$data->success)
{
$message = "Error searching source: $this->url";
if ($data != null) $message .= " ($data->message)";
Spark_utils::warning($message);
return array();
}
// Get sparks for each one
$results = array();
foreach($data->results as $data)
{
$results[] = $this->get_spark($data);
}
return $results;
}
$json_data = @file_get_contents("http://$this->url/api/packages/search?q=" . urlencode($term));
$data = json_decode($json_data);
// if the data isn't around of success is false, return a warning for this source
if ($data == null || !$data->success)
{
$message = "Error searching source: $this->url";
if ($data != null) $message .= " ($data->message)";
Spark_utils::warning($message);
return array();
}
// Get sparks for each one
$results = array();
foreach($data->results as $data)
{
$results[] = $this->get_spark($data);
}
return $results;
}

private function warn_if_outdated()
{
if ($source_version_data = $this->outdated())
{
Spark_utils::warning("Your installed version of spark is outdated (current version: $source_version_data->spark_manager)");
Spark_utils::warning("To upgrade now, use `tools/spark upgrade-system`");
}
}
private function warn_if_outdated()
{
if ($source_version_data = $this->outdated())
{
Spark_utils::warning("Your installed version of spark is outdated (current version: $source_version_data->spark_manager)");
Spark_utils::warning("To upgrade now, use `tools/spark upgrade-system`");
}
}

function outdated() {
// Get the version for this source
$source_version_data = @file_get_contents("http://$this->url/api/system/latest");
if (!$source_version_data) return; // no version found
$source_version_data = json_decode($source_version_data);
$source_version = $source_version_data->spark_manager;
function outdated() {
// Get the version for this source
$source_version_data = @file_get_contents("http://$this->url/api/system/latest");
if (!$source_version_data) return; // no version found
$source_version_data = json_decode($source_version_data);
$source_version = $source_version_data->spark_manager;

// Split versions
list($self_major, $self_minor, $self_patch) = explode('.', SPARK_VERSION);
list($source_major, $source_minor, $source_patch) = explode('.', $source_version);
// Split versions
list($self_major, $self_minor, $self_patch) = explode('.', SPARK_VERSION);
list($source_major, $source_minor, $source_patch) = explode('.', $source_version);

// Compare
if ($self_major < $source_major ||
$self_major == $source_major && $self_minor < $source_minor ||
$self_major == $source_major && $self_minor == $source_minor && $self_patch < $source_patch)
{
return $source_version_data;
}
}
private function get_spark($data)
{
if ($data->repository_type == 'hg') return Mercurial_spark::get_spark($data);
else if ($data->repository_type == 'git') return Git_spark::get_spark($data);
else if ($data->repository_type == 'zip') return new Zip_spark($data);
else throw new Exception('Unknown repository type: ' . $data->repository_type);
}
// Compare
if ($self_major < $source_major ||
$self_major == $source_major && $self_minor < $source_minor ||
$self_major == $source_major && $self_minor == $source_minor && $self_patch < $source_patch)
{
return $source_version_data;
}
}

private function get_spark($data)
{
if ($data->repository_type == 'hg') return Mercurial_spark::get_spark($data);
else if ($data->repository_type == 'git') return Git_spark::get_spark($data);
else if ($data->repository_type == 'zip') return new Zip_spark($data);
else throw new Exception('Unknown repository type: ' . $data->repository_type);
}

}
@@ -2,137 +2,137 @@

class Spark_type {

function __construct($data)
{
$this->data = $data;
$this->name = $this->data->name;
$this->spark_id = property_exists($this->data, 'id') ? $this->data->id : null;
$this->version = property_exists($this->data, 'version') ? $this->data->version : null;
$this->tag = property_exists($this->data, 'tag') ? $this->data->tag : $this->version;
$this->base_location = property_exists($this->data, 'base_location') ? $this->data->base_location : null;
function __construct($data)
{
$this->data = $data;
$this->name = $this->data->name;
$this->spark_id = property_exists($this->data, 'id') ? $this->data->id : null;
$this->version = property_exists($this->data, 'version') ? $this->data->version : null;
$this->tag = property_exists($this->data, 'tag') ? $this->data->tag : $this->version;
$this->base_location = property_exists($this->data, 'base_location') ? $this->data->base_location : null;

// Load the dependencies
$this->dependencies = property_exists($this->data, 'dependencies') ? $this->data->dependencies : array();
// Load the dependencies
$this->dependencies = property_exists($this->data, 'dependencies') ? $this->data->dependencies : array();

// Assign other data we don't have
foreach ($this->data as $k=>$v)
{
if (!property_exists($this, $k)) $this->$k = $v;
}
// used internally
$this->temp_token = 'spark-' . $this->spark_id . '-' . time();
$this->temp_path = sys_get_temp_dir() . '/' . $this->temp_token;
}
// Assign other data we don't have
foreach ($this->data as $k=>$v)
{
if (!property_exists($this, $k)) $this->$k = $v;
}
// used internally
$this->temp_token = 'spark-' . $this->spark_id . '-' . time();
$this->temp_path = sys_get_temp_dir() . '/' . $this->temp_token;
}

final function installed_path()
{
return $this->installed_path;
}
final function installed_path()
{
return $this->installed_path;
}

function location_detail() { }
function retrieve() { }
function location_detail() { }
function retrieve() { }

function install()
{
foreach ($this->dependencies as $dependency)
{
if ($dependency->is_direct)
{
$this->install_dependency($dependency);
}
}
function install()
{
foreach ($this->dependencies as $dependency)
{
if ($dependency->is_direct)
{
$this->install_dependency($dependency);
}
}

@mkdir(SPARK_PATH); // Two steps for windows
@mkdir(SPARK_PATH . "/$this->name");
$this->recurseMove($this->temp_path, $this->installation_path);
$this->rrmdir($this->temp_path);
$this->installed_path = $this->installation_path;
}
@mkdir(SPARK_PATH); // Two steps for windows
@mkdir(SPARK_PATH . "/$this->name");
$this->recurseMove($this->temp_path, $this->installation_path);
$this->rrmdir($this->temp_path);
$this->installed_path = $this->installation_path;
}

private function recurseMove($src,$dst)
{
$dir = opendir($src);
@mkdir($dst);
while(false !== ( $file = readdir($dir)) ) {
if (( $file != '.' ) && ( $file != '..' )) {
if ( is_dir($src . '/' . $file) ) {
$this->recurseMove($src . '/' . $file,$dst . '/' . $file);
}
else {
rename($src . '/' . $file,$dst . '/' . $file);
}
}
}
closedir($dir);
}

private function rrmdir($dir)
{
if (is_dir($dir)) {
$files = scandir($dir);
foreach ($files as $file) {
if ($file != "." && $file != "..") {
if (is_dir($dir . "/" . $file)) {
$this->rrmdir($dir . "/" . $file);
}
else {
unlink($dir . "/" . $file);
}
}
}
reset($files);
rmdir($dir);
}
}
private function recurseMove($src,$dst)
{
$dir = opendir($src);
@mkdir($dst);
while(false !== ( $file = readdir($dir)) ) {
if (( $file != '.' ) && ( $file != '..' )) {
if ( is_dir($src . '/' . $file) ) {
$this->recurseMove($src . '/' . $file,$dst . '/' . $file);
}
else {
rename($src . '/' . $file,$dst . '/' . $file);
}
}
}
closedir($dir);
}

function install_dependency($dependency_data) {
// Get the spark object
$spark = null;
if ($dependency_data->repository_type == 'hg') $spark = Mercurial_spark::get_spark($dependency_data);
else if ($dependency_data->repository_type == 'git') $spark = Git_spark::get_spark($dependency_data);
else if ($dependency_data->repository_type == 'zip') $spark = new Zip_spark($dependency_data);
else throw new Exception('Unknown repository type: ' . $dependency_data->repository_type);
// Install the spark
if ($spark->verify(false)) { // if not installed, install
$spark->retrieve();
$spark->install();
Spark_utils::notice("Installed dependency: $spark->name to " . $spark->installed_path());
}
else {
Spark_utils::warning("Dependency $spark->name is already installed.");
}
}

function verify($break_on_already_installed = true)
{
// see if this is deactivated
if ($this->data->is_deactivated)
{
$msg = 'Woah there - it seems the spark you want has been deactivated';
if ($this->data->spark_home) $msg .= "\nLook for different versions at: " . $this->data->spark_home;
throw new Spark_exception($msg);
}
// see if this is unsupported
if ($this->data->is_unsupported)
{
Spark_utils::warning('This spark is no longer supported.');
Spark_utils::warning('You can keep using it, or look for an alternate');
}
// tell the user if its already installed and throw an error
$this->installation_path = SPARK_PATH . "/$this->name/$this->version";
if (is_dir($this->installation_path))
{
if ($break_on_already_installed)
{
throw new Spark_exception("Already installed. Try `php tools/spark reinstall $this->name`");
}
return false;
}
else
{
return true;
}
}
private function rrmdir($dir)
{
if (is_dir($dir)) {
$files = scandir($dir);
foreach ($files as $file) {
if ($file != "." && $file != "..") {
if (is_dir($dir . "/" . $file)) {
$this->rrmdir($dir . "/" . $file);
}
else {
unlink($dir . "/" . $file);
}
}
}
reset($files);
rmdir($dir);
}
}

function install_dependency($dependency_data) {
// Get the spark object
$spark = null;
if ($dependency_data->repository_type == 'hg') $spark = Mercurial_spark::get_spark($dependency_data);
else if ($dependency_data->repository_type == 'git') $spark = Git_spark::get_spark($dependency_data);
else if ($dependency_data->repository_type == 'zip') $spark = new Zip_spark($dependency_data);
else throw new Exception('Unknown repository type: ' . $dependency_data->repository_type);
// Install the spark
if ($spark->verify(false)) { // if not installed, install
$spark->retrieve();
$spark->install();
Spark_utils::notice("Installed dependency: $spark->name to " . $spark->installed_path());
}
else {
Spark_utils::warning("Dependency $spark->name is already installed.");
}
}

function verify($break_on_already_installed = true)
{
// see if this is deactivated
if ($this->data->is_deactivated)
{
$msg = 'Woah there - it seems the spark you want has been deactivated';
if ($this->data->spark_home) $msg .= "\nLook for different versions at: " . $this->data->spark_home;
throw new Spark_exception($msg);
}
// see if this is unsupported
if ($this->data->is_unsupported)
{
Spark_utils::warning('This spark is no longer supported.');
Spark_utils::warning('You can keep using it, or look for an alternate');
}
// tell the user if its already installed and throw an error
$this->installation_path = SPARK_PATH . "/$this->name/$this->version";
if (is_dir($this->installation_path))
{
if ($break_on_already_installed)
{
throw new Spark_exception("Already installed. Try `php tools/spark reinstall $this->name`");
}
return false;
}
else
{
return true;
}
}

}