diff options
Diffstat (limited to 'system')
90 files changed, 2274 insertions, 2275 deletions
diff --git a/system/application/config/config.php b/system/application/config/config.php index ab4f445f2..0ed58d940 100644 --- a/system/application/config/config.php +++ b/system/application/config/config.php @@ -5,7 +5,7 @@ | Base Site URL |-------------------------------------------------------------------------- | -| URL to your Code Igniter root. Typically this will be your base URL, +| URL to your Code Igniter root. Typically this will be your base URL, | WITH a trailing slash: | | http://www.your-site.com/ @@ -18,8 +18,8 @@ $config['base_url'] = "http://127.0.0.1/CodeIgniter/"; | Index File |-------------------------------------------------------------------------- | -| Typically this will be your index.php file, unless you've renamed it to -| something else. If you are using mod_rewrite to remove the page set this +| Typically this will be your index.php file, unless you've renamed it to +| something else. If you are using mod_rewrite to remove the page set this | variable so that it is blank. | */ @@ -30,15 +30,15 @@ $config['index_page'] = "index.php"; | URI PROTOCOL |-------------------------------------------------------------------------- | -| This item determines which server global should be used to retrieve the +| This item determines which server global should be used to retrieve the | URI string. The default setting of "AUTO" works for most servers. | If your links do not seem to work, try one of the other delicious flavors: -| +| | 'AUTO' Default - auto detects -| 'PATH_INFO' Uses the PATH_INFO +| 'PATH_INFO' Uses the PATH_INFO | 'QUERY_STRING' Uses the QUERY_STRING | 'REQUEST_URI' Uses the REQUEST_URI -| 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO +| 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO | */ $config['uri_protocol'] = "AUTO"; @@ -50,7 +50,7 @@ $config['uri_protocol'] = "AUTO"; | | This option allows you to add a suffix to all URLs generated by Code Igniter. | For more information please see the user guide: -| +| | http://www.codeigniter.com/user_guide/general/urls.html */ @@ -61,7 +61,7 @@ $config['url_suffix'] = ""; | Default Language |-------------------------------------------------------------------------- | -| This determines which set of language files should be used. Make sure +| This determines which set of language files should be used. Make sure | there is an available translation if you intend to use something other | than english. | @@ -88,7 +88,7 @@ $config['enable_hooks'] = TRUE; | | This item allows you to set the filename/classname prefix when extending | native libraries. For more information please see the user guide: -| +| | http://www.codeigniter.com/user_guide/general/core_classes.html | http://www.codeigniter.com/user_guide/general/creating_libraries.html | @@ -109,7 +109,7 @@ $config['subclass_prefix'] = 'MY_'; | as few characters as possible. By default only these are allowed: a-z 0-9~%.:_- | | Leave blank to allow all characters -- but only if you are insane. -| +| | DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!! | */ @@ -147,7 +147,7 @@ $config['function_trigger'] = 'm'; | Error Logging |-------------------------------------------------------------------------- | -| You can enable error logging by setting a threshold over zero. The +| You can enable error logging by setting a threshold over zero. The | threshold determines what gets logged. Threshold options are: | | 0 = Error logging TURNED OFF @@ -156,7 +156,7 @@ $config['function_trigger'] = 'm'; | 3 = Informational Messages | 4 = All Messages | -| For a live site you'll usually only enable Errors (1) to be logged otherwise +| For a live site you'll usually only enable Errors (1) to be logged otherwise | your log files will fill up very fast. | */ @@ -200,7 +200,7 @@ $config['cache_path'] = ''; | Encryption Key |-------------------------------------------------------------------------- | -| If you use the Encryption class or the Sessions class with encryption +| If you use the Encryption class or the Sessions class with encryption | enabled you MUST set an encryption key. See the user guide for info. | */ @@ -229,14 +229,14 @@ $config['sess_match_useragent'] = TRUE; |-------------------------------------------------------------------------- | Cookie Related Variables |-------------------------------------------------------------------------- -| +| | 'cookie_prefix' = Set a prefix if you need to avoid collisions | 'cookie_domain' = Set to .your-domain.com for site-wide cookies | 'cookie_path' = Typically will be a forward slash | */ $config['cookie_prefix'] = ""; -$config['cookie_domain'] = ""; +$config['cookie_domain'] = ""; $config['cookie_path'] = "/"; /* @@ -244,7 +244,7 @@ $config['cookie_path'] = "/"; | Global XSS Filtering |-------------------------------------------------------------------------- | -| Determines whether the XSS filter is always active when GET, POST or +| Determines whether the XSS filter is always active when GET, POST or | COOKIE data is encountered | */ @@ -256,13 +256,13 @@ $config['global_xss_filtering'] = FALSE; |-------------------------------------------------------------------------- | | Enables Gzip output compression for faster page loads. When enabled, -| the output class will test whether your server supports Gzip. +| the output class will test whether your server supports Gzip. | Even if it does, however, not all browsers support compression | so enable only if you are reasonably sure your visitors can handle it. | | VERY IMPORTANT: If you are getting a blank page when compression is enabled it | means you are prematurely outputting something to your browser. It could -| even be a line of whitespace at the end of one of your scripts. For +| even be a line of whitespace at the end of one of your scripts. For | compression to work, nothing can be sent before the output buffer is called | by the output class. Do not "echo" any values with compression enabled. | @@ -274,9 +274,9 @@ $config['compress_output'] = FALSE; | Master Time Reference |-------------------------------------------------------------------------- | -| Options are "local" or "gmt". This pref tells the system whether to use -| your server's local time as the master "now" reference, or convert it to -| GMT. See the "date helper" page of the user guide for information +| Options are "local" or "gmt". This pref tells the system whether to use +| your server's local time as the master "now" reference, or convert it to +| GMT. See the "date helper" page of the user guide for information | regarding date handling. | */ diff --git a/system/application/config/database.php b/system/application/config/database.php index 9d8c77831..b3246b6ec 100644 --- a/system/application/config/database.php +++ b/system/application/config/database.php @@ -13,12 +13,12 @@ | ------------------------------------------------------------------- | | ['hostname'] The hostname of your database server. -| ['username'] The username used to connect to the database -| ['password'] The password used to connect to the database +| ['username'] The username used to connect to the database +| ['password'] The password used to connect to the database | ['database'] The name of the database you want to connect to | ['dbdriver'] The database type. ie: mysql. Currently supported: mysql, mysqli, postgre, odbc, mssql -| ['dbprefix'] You can add an optional prefix, which will be added +| ['dbprefix'] You can add an optional prefix, which will be added | to the table name when using the Active Record class | ['pconnect'] TRUE/FALSE - Whether to use a persistent connection | ['db_debug'] TRUE/FALSE - Whether database errors should be displayed. diff --git a/system/application/config/routes.php b/system/application/config/routes.php index 8fa167803..1702e4f4b 100644 --- a/system/application/config/routes.php +++ b/system/application/config/routes.php @@ -3,9 +3,9 @@ | ------------------------------------------------------------------------- | URI ROUTING | ------------------------------------------------------------------------- -| This file lets you re-map URI requests to specific controller functions. +| This file lets you re-map URI requests to specific controller functions. | -| Typically there is a one-to-one relationship between a URL string +| Typically there is a one-to-one relationship between a URL string | and its corresponding controller class/method. The segments in a | URL normally follow this pattern: | @@ -13,7 +13,7 @@ | | In some instances, however, you may want to remap this relationship | so that a different class/function is called than the one -| corresponding to the URL. +| corresponding to the URL. | | Please see the user guide for complete details: | @@ -33,8 +33,8 @@ | | $route['scaffolding_trigger'] = 'scaffolding'; | -| This route lets you se t a "secret" word that will trigger the -| scaffolding feature for added security. Note: Scaffolding must be +| This route lets you se t a "secret" word that will trigger the +| scaffolding feature for added security. Note: Scaffolding must be | enabled in the controller in which you intend to use it. | */ diff --git a/system/application/config/user_agents.php b/system/application/config/user_agents.php index a799f06bd..6fa7b4a7e 100644 --- a/system/application/config/user_agents.php +++ b/system/application/config/user_agents.php @@ -4,7 +4,7 @@ | USER AGENT TYPES | ------------------------------------------------------------------- | This file contains four arrays of user agent data. It is used by the -| User Agent Class to help identify browser, platform, robot, and +| User Agent Class to help identify browser, platform, robot, and | mobile device data. The array keys are used to identify the device | and the array values are used to set the actual name of the item. | diff --git a/system/application/errors/error_404.php b/system/application/errors/error_404.php index e5fa8f9db..bfe9444b2 100644 --- a/system/application/errors/error_404.php +++ b/system/application/errors/error_404.php @@ -4,9 +4,9 @@ <title>404 Page Not Found</title> <style type="text/css"> -body { -background-color: #fff; -margin: 40px; +body { +background-color: #fff; +margin: 40px; font-family: Lucida Grande, Verdana, Sans-serif; font-size: 12px; color: #000; diff --git a/system/application/errors/error_db.php b/system/application/errors/error_db.php index 5aab89074..1ce52dfc9 100644 --- a/system/application/errors/error_db.php +++ b/system/application/errors/error_db.php @@ -3,9 +3,9 @@ <title>Database Error</title> <style type="text/css"> -body { -background-color: #fff; -margin: 40px; +body { +background-color: #fff; +margin: 40px; font-family: Lucida Grande, Verdana, Sans-serif; font-size: 12px; color: #000; diff --git a/system/application/errors/error_general.php b/system/application/errors/error_general.php index 213b8353a..d8610702b 100644 --- a/system/application/errors/error_general.php +++ b/system/application/errors/error_general.php @@ -3,9 +3,9 @@ <title>Error</title> <style type="text/css"> -body { -background-color: #fff; -margin: 40px; +body { +background-color: #fff; +margin: 40px; font-family: Lucida Grande, Verdana, Sans-serif; font-size: 12px; color: #000; diff --git a/system/application/views/welcome_message.php b/system/application/views/welcome_message.php index 815bef4db..393fb56e1 100644 --- a/system/application/views/welcome_message.php +++ b/system/application/views/welcome_message.php @@ -4,9 +4,9 @@ <style type="text/css"> -body { - background-color: #fff; - margin: 40px; +body { + background-color: #fff; + margin: 40px; font-family: Lucida Grande, Verdana, Sans-serif; font-size: 14px; color: #4F5155; diff --git a/system/codeigniter/Base4.php b/system/codeigniter/Base4.php index 2793317e7..b2713b660 100644 --- a/system/codeigniter/Base4.php +++ b/system/codeigniter/Base4.php @@ -7,31 +7,31 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.3 * @filesource */ - + // ------------------------------------------------------------------------ /** * CI_BASE - For PHP 4 - * + * * This file is used only when Code Igniter is being run under PHP 4. - * - * In order to allow CI to work under PHP 4 we had to make the Loader class + * + * In order to allow CI to work under PHP 4 we had to make the Loader class * the parent of the Controller Base class. It's the only way we can - * enable functions like $this->load->library('email') to instantiate + * enable functions like $this->load->library('email') to instantiate * classes that can then be used within controllers as $this->email->send() * - * PHP 4 also has trouble referencing the CI super object within application + * PHP 4 also has trouble referencing the CI super object within application * constructors since objects do not exist until the class is fully * instantiated. Basically PHP 4 sucks... * - * Since PHP 5 doesn't suffer from this problem so we load one of + * Since PHP 5 doesn't suffer from this problem so we load one of * two files based on the version of PHP being run. - * + * * @package CodeIgniter * @subpackage codeigniter * @category front-controller @@ -56,7 +56,7 @@ function &get_instance() { global $CI, $OBJ; - if (is_object($CI)) + if (is_object($CI)) { return $CI; } diff --git a/system/codeigniter/Base5.php b/system/codeigniter/Base5.php index e37c257af..0d036fae2 100644 --- a/system/codeigniter/Base5.php +++ b/system/codeigniter/Base5.php @@ -7,22 +7,22 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.3 * @filesource */ - - + + // ------------------------------------------------------------------------ /** * CI_BASE - For PHP 5 - * + * * This file contains some code used only when Code Igniter is being * run under PHP 5. It allows us to manage the CI super object more * gracefully than what is possible with PHP 4. - * + * * @package CodeIgniter * @subpackage codeigniter * @category front-controller @@ -32,22 +32,22 @@ class CI_Base { - private static $instance; - - public function CI_Base() - { - self::$instance =& $this; - } - - public static function &get_instance() - { - return self::$instance; - } + private static $instance; + + public function CI_Base() + { + self::$instance =& $this; + } + + public static function &get_instance() + { + return self::$instance; + } } function &get_instance() { - return CI_Base::get_instance(); + return CI_Base::get_instance(); } diff --git a/system/codeigniter/CodeIgniter.php b/system/codeigniter/CodeIgniter.php index 409cf7765..fb27191ce 100644 --- a/system/codeigniter/CodeIgniter.php +++ b/system/codeigniter/CodeIgniter.php @@ -7,26 +7,26 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * System Front Controller * - * Loads the base classes and executes the request. - * + * Loads the base classes and executes the request. + * * @package CodeIgniter * @subpackage codeigniter * @category Front-controller * @author Rick Ellis * @link http://www.codeigniter.com/user_guide/ */ - + define('APPVER', '1.5.0'); /* @@ -84,7 +84,7 @@ $OUT =& load_class('Output'); * Is there a valid cache file? If so, we're done... * ------------------------------------------------------ */ - + if ($EXT->_call_hook('cache_override') === FALSE) { if ($OUT->_display_cache($CFG, $RTR) == TRUE) @@ -107,17 +107,17 @@ $LANG =& load_class('Language'); * ------------------------------------------------------ * Load the app controller and local controller * ------------------------------------------------------ - * + * * Note: Due to the poor object handling in PHP 4 we'll * conditionally load different versions of the base * class. Retaining PHP 4 compatibility requires a bit of a hack. * * Note: The Loader class needs to be included first - * + * */ - -load_class('Loader', FALSE); - + +load_class('Loader', FALSE); + if (floor(phpversion()) < 5) { require(BASEPATH.'codeigniter/Base4'.EXT); @@ -127,7 +127,7 @@ else require(BASEPATH.'codeigniter/Base5'.EXT); } -load_class('Controller', FALSE); +load_class('Controller', FALSE); require(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().EXT); @@ -139,9 +139,9 @@ $BM->mark('loading_time_base_classes_end'); * ------------------------------------------------------ * Security check * ------------------------------------------------------ - * + * * None of the functions in the app controller or the - * loader class can be called via the URI, nor can + * loader class can be called via the URI, nor can * controller functions that begin with an underscore */ $class = $RTR->fetch_class(); @@ -150,7 +150,7 @@ $method = $RTR->fetch_method(); if ( ! class_exists($class) OR $method == 'controller' - OR substr($method, 0, 1) == '_' + OR substr($method, 0, 1) == '_' OR in_array($method, get_class_methods('Controller'), TRUE) ) { @@ -205,7 +205,7 @@ else show_404(); } - // Call the requested method. + // Call the requested method. // Any URI segments present (besides the class/function) will be passed to the method for convenience call_user_func_array(array(&$CI, $method), array_slice($RTR->rsegments, (($RTR->fetch_directory() == '') ? 2 : 3))); } @@ -226,7 +226,7 @@ $EXT->_call_hook('post_controller'); * Send the final rendered output to the browser * ------------------------------------------------------ */ - + if ($EXT->_call_hook('display_override') === FALSE) { $OUT->_display(); diff --git a/system/codeigniter/Common.php b/system/codeigniter/Common.php index a82d486e6..c8078bf65 100644 --- a/system/codeigniter/Common.php +++ b/system/codeigniter/Common.php @@ -7,26 +7,26 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * Common Functions * - * Loads the base classes and executes the request. - * + * Loads the base classes and executes the request. + * * @package CodeIgniter * @subpackage codeigniter * @category Common Functions * @author Rick Ellis * @link http://www.codeigniter.com/user_guide/ */ - + // ------------------------------------------------------------------------ /** @@ -35,7 +35,7 @@ * This function acts as a singleton. If the requested class does not * exist it is instantiated and set to a static variable. If it has * previously been instantiated the variable is returned. -* +* * @access public * @param string the class name being requested * @param bool optional flag that lets classes get loaded but not instantiated @@ -150,9 +150,9 @@ function &config_item($item) * Error Handler * * This function lets us invoke the exception class and -* display errors using the standard error template located +* display errors using the standard error template located * in application/errors/errors.php -* This function will send the error page directly to the +* This function will send the error page directly to the * browser and exit. * * @access public @@ -185,7 +185,7 @@ function show_404($page = '') /** -* Error Logging Interface +* Error Logging Interface * * We use this as a simple mechanism to access the logging * class and send messages to be logged. @@ -212,8 +212,8 @@ function log_message($level = 'error', $message, $php_error = FALSE) * Exception Handler * * This is the custom exception handler we defined at the -* top of this file. The main reason we use this is permit -* PHP errors to be logged in our own log files since we may +* top of this file. The main reason we use this is permit +* PHP errors to be logged in our own log files since we may * not have access to server logs. Since this function * effectively intercepts PHP errors, however, we also need * to display errors based on the current error_reporting level. @@ -230,7 +230,7 @@ function _exception_handler($severity, $message, $filepath, $line) // use version 4 style class functions (without prefixes // like "public", "private", etc.) you'll get notices telling // you that these have been deprecated. - + if ($severity == E_STRICT) { return; @@ -238,7 +238,7 @@ function _exception_handler($severity, $message, $filepath, $line) $error =& load_class('Exceptions'); - // Should we display the error? + // Should we display the error? // We'll get the current error_reporting level and add its bits // with the severity bits to find out. diff --git a/system/database/DB.php b/system/database/DB.php index d2afce982..c6bd365d9 100644 --- a/system/database/DB.php +++ b/system/database/DB.php @@ -7,7 +7,7 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource @@ -46,7 +46,7 @@ function &DB($params = '', $active_record = FALSE) } // Load the DB classes. Note: Since the active record class is optional - // we need to dynamically create a class that extends proper parent class + // we need to dynamically create a class that extends proper parent class // based on whether we're using the active record class or not. // Kudos to Paul for discovering this clever use of eval() @@ -57,7 +57,7 @@ function &DB($params = '', $active_record = FALSE) require_once(BASEPATH.'database/DB_driver'.EXT); - if ( ! isset($params['active_r']) OR $params['active_r'] == TRUE) + if ( ! isset($params['active_r']) OR $params['active_r'] == TRUE) { require_once(BASEPATH.'database/DB_active_rec'.EXT); diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php index 8db6161af..b41b929d7 100644 --- a/system/database/DB_active_rec.php +++ b/system/database/DB_active_rec.php @@ -7,17 +7,17 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * Active Record Class - * + * * This is the platform-independent base Active Record implementation class. * * @package CodeIgniter @@ -547,11 +547,11 @@ class CI_DB_active_record extends CI_DB_driver { if (count($this->ar_set) == 0) { - if ($this->db_debug) - { + if ($this->db_debug) + { return $this->display_error('db_must_use_set'); - } - return FALSE; + } + return FALSE; } if ($table == '') @@ -596,11 +596,11 @@ class CI_DB_active_record extends CI_DB_driver { if (count($this->ar_set) == 0) { - if ($this->db_debug) - { + if ($this->db_debug) + { return $this->display_error('db_must_use_set'); - } - return FALSE; + } + return FALSE; } if ($table == '') @@ -663,11 +663,11 @@ class CI_DB_active_record extends CI_DB_driver { if (count($this->ar_where) == 0) { - if ($this->db_debug) - { + if ($this->db_debug) + { return $this->display_error('db_del_must_use_where'); - } - return FALSE; + } + return FALSE; } $sql = $this->_delete($this->dbprefix.$table, $this->ar_where); @@ -679,7 +679,7 @@ class CI_DB_active_record extends CI_DB_driver { // -------------------------------------------------------------------- /** - * Use Table - DEPRECATED + * Use Table - DEPRECATED * * @deprecated use $this->db->from instead */ @@ -726,7 +726,7 @@ class CI_DB_active_record extends CI_DB_driver { /** * Compile the SELECT statement * - * Generates a query string based on which functions were used. + * Generates a query string based on which functions were used. * Should not be called directly. The get() function calls it. * * @access private diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index b469b0e1e..53425d1d9 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -7,7 +7,7 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index 8a7b88f18..ab8a6a8e2 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -7,17 +7,17 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * Database Driver Class - * + * * This is the platform-independent base DB implementation class. * This class will not be called directly. Rather, the adapter * class for the specific database will extend and instantiate it. @@ -64,10 +64,10 @@ class CI_DB_driver { /** * Constructor. Accepts one parameter containing the database - * connection settings. + * connection settings. * - * Database settings can be passed as discreet - * parameters or as a data source name in the first + * Database settings can be passed as discreet + * parameters or as a data source name in the first * parameter. DSNs must have this prototype: * $dsn = 'driver://username:password@hostname/database'; * @@ -93,16 +93,16 @@ class CI_DB_driver { if (is_array($params)) { $defaults = array( - 'hostname' => '', - 'username' => '', - 'password' => '', - 'database' => '', - 'dbdriver' => 'mysql', - 'dbprefix' => '', - 'port' => '', - 'pconnect' => FALSE, - 'db_debug' => FALSE, - 'cachedir' => '', + 'hostname' => '', + 'username' => '', + 'password' => '', + 'database' => '', + 'dbdriver' => 'mysql', + 'dbprefix' => '', + 'port' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cachedir' => '', 'cache_on' => FALSE ); @@ -132,9 +132,9 @@ class CI_DB_driver { // Connect to the database $this->conn_id = ($this->pconnect == FALSE) ? $this->db_connect() : $this->db_pconnect(); - + if ( ! $this->conn_id) - { + { log_message('error', 'Unable to connect to the database'); if ($this->db_debug) @@ -162,7 +162,7 @@ class CI_DB_driver { * The name of the platform in use (mysql, mssql, etc...) * * @access public - * @return string + * @return string */ function platform() { @@ -172,7 +172,7 @@ class CI_DB_driver { // -------------------------------------------------------------------- /** - * Database Version Number. Returns a string containing the + * Database Version Number. Returns a string containing the * version of the database being used * * @access public @@ -204,16 +204,16 @@ class CI_DB_driver { /** * Execute the query * - * Accepts an SQL string as input and returns a result object upon - * successful execution of a "read" type query. Returns boolean TRUE - * upon successful execution of a "write" type query. Returns boolean - * FALSE upon failure, and if the $db_debug variable is set to TRUE + * Accepts an SQL string as input and returns a result object upon + * successful execution of a "read" type query. Returns boolean TRUE + * upon successful execution of a "write" type query. Returns boolean + * FALSE upon failure, and if the $db_debug variable is set to TRUE * will raise an error. - * + * * @access public * @param string An SQL query string * @param array An array of binding data - * @return mixed + * @return mixed */ function query($sql, $binds = FALSE, $return_object = TRUE) { @@ -227,8 +227,8 @@ class CI_DB_driver { return FALSE; } - // Is query caching enabled? If the query is a "read type" - // we will load the caching class and return the previously + // Is query caching enabled? If the query is a "read type" + // we will load the caching class and return the previously // cached query if it exists if ($this->cache_on == TRUE AND stristr($sql, 'SELECT')) { @@ -253,10 +253,10 @@ class CI_DB_driver { // Start the Query Timer $time_start = list($sm, $ss) = explode(' ', microtime()); - + // Run the Query if (FALSE === ($this->result_id = $this->simple_query($sql))) - { + { // This will trigger a rollback if transactions are being used $this->_trans_failure = TRUE; @@ -265,13 +265,13 @@ class CI_DB_driver { log_message('error', 'Query error: '.$this->_error_message()); return $this->display_error( array( - 'Error Number: '.$this->_error_number(), + 'Error Number: '.$this->_error_number(), $this->_error_message(), $sql ) ); } - + return FALSE; } @@ -296,7 +296,7 @@ class CI_DB_driver { return TRUE; } - // Return TRUE if we don't need to create a result object + // Return TRUE if we don't need to create a result object // Currently only the Oracle driver uses this when stored // procedures are used if ($return_object !== TRUE) @@ -318,7 +318,7 @@ class CI_DB_driver { $RES->limit_used = $this->limit_used; } - // Is query caching enabled? If so, we'll serialize the + // Is query caching enabled? If so, we'll serialize the // result object and save it to a cache file. if ($this->cache_on == TRUE AND $this->_cache_init()) { @@ -347,9 +347,9 @@ class CI_DB_driver { /** * Load the result drivers - * + * * @access public - * @return string the name of the result class + * @return string the name of the result class */ function load_rdriver() { @@ -367,14 +367,14 @@ class CI_DB_driver { // -------------------------------------------------------------------- /** - * Simple Query + * Simple Query * This is a simplified version of the query() function. Internally * we only use it when running transaction commands since they do * not require all the features of the main query() function. - * + * * @access public * @param string the sql query - * @return mixed + * @return mixed */ function simple_query($sql) { @@ -391,9 +391,9 @@ class CI_DB_driver { /** * Disable Transactions * This permits transactions to be disabled at run-time. - * + * * @access public - * @return void + * @return void */ function trans_off() { @@ -404,9 +404,9 @@ class CI_DB_driver { /** * Start Transaction - * + * * @access public - * @return void + * @return void */ function trans_start($test_mode = FALSE) { @@ -429,9 +429,9 @@ class CI_DB_driver { /** * Complete Transaction - * + * * @access public - * @return bool + * @return bool */ function trans_complete() { @@ -467,9 +467,9 @@ class CI_DB_driver { /** * Lets you retrieve the transaction flag to determine if it has failed - * + * * @access public - * @return bool + * @return bool */ function trans_status() { @@ -480,11 +480,11 @@ class CI_DB_driver { /** * Compile Bindings - * + * * @access public * @param string the sql statement * @param array an array of bind data - * @return string + * @return string */ function compile_binds($sql, $binds) { @@ -514,15 +514,15 @@ class CI_DB_driver { // -------------------------------------------------------------------- /** - * Determines if a query is a "write" type. - * + * Determines if a query is a "write" type. + * * @access public * @param string An SQL query string - * @return boolean + * @return boolean */ function is_write_type($sql) { - if ( ! preg_match('/^\s*"?(INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|LOAD DATA|COPY|ALTER|GRANT|REVOKE|LOCK|UNLOCK)\s+/i', $sql)) + if ( ! preg_match('/^\s*"?(INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|LOAD DATA|COPY|ALTER|GRANT|REVOKE|LOCK|UNLOCK)\s+/i', $sql)) { return FALSE; } @@ -532,11 +532,11 @@ class CI_DB_driver { // -------------------------------------------------------------------- /** - * Calculate the aggregate query elapsed time - * + * Calculate the aggregate query elapsed time + * * @access public * @param integer The number of decimal places - * @return integer + * @return integer */ function elapsed_time($decimals = 6) { @@ -547,9 +547,9 @@ class CI_DB_driver { /** * Returns the total number of queries - * + * * @access public - * @return integer + * @return integer */ function total_queries() { @@ -560,9 +560,9 @@ class CI_DB_driver { /** * Returns the last query that was executed - * + * * @access public - * @return void + * @return void */ function last_query() { @@ -576,10 +576,10 @@ class CI_DB_driver { * * Escapes data based on type * Sets boolean and null types - * + * * @access public * @param string - * @return integer + * @return integer */ function escape($str) { @@ -605,10 +605,10 @@ class CI_DB_driver { * * Retrieves the primary key. It assumes that the row in the first * position is the primary key - * + * * @access public * @param string the table name - * @return string + * @return string */ function primary($table = '') { @@ -626,9 +626,9 @@ class CI_DB_driver { /** * Returns an array of table names - * + * * @access public - * @return array + * @return array */ function list_tables() { @@ -688,7 +688,7 @@ class CI_DB_driver { * * @access public * @param string the table name - * @return array + * @return array */ function list_fields($table = '') { @@ -754,7 +754,7 @@ class CI_DB_driver { /** * DEPRECATED - use list_fields() */ - function field_names($table = '') + function field_names($table = '') { return $this->list_fields($table); } @@ -763,10 +763,10 @@ class CI_DB_driver { /** * Returns an object with field data - * + * * @access public * @param string the table name - * @return object + * @return object */ function field_data($table = '') { @@ -787,18 +787,18 @@ class CI_DB_driver { /** * Generate an insert string - * + * * @access public * @param string the table upon which the query will be performed * @param array an associative array data of key/values - * @return string + * @return string */ function insert_string($table, $data) { - $fields = array(); + $fields = array(); $values = array(); - foreach($data as $key => $val) + foreach($data as $key => $val) { $fields[] = $key; $values[] = $this->escape($val); @@ -811,12 +811,12 @@ class CI_DB_driver { /** * Generate an update string - * + * * @access public * @param string the table upon which the query will be performed * @param array an associative array data of key/values * @param mixed the "where" statement - * @return string + * @return string */ function update_string($table, $data, $where) { @@ -824,7 +824,7 @@ class CI_DB_driver { return false; $fields = array(); - foreach($data as $key => $val) + foreach($data as $key => $val) { $fields[$key] = $this->escape($val); } @@ -861,11 +861,11 @@ class CI_DB_driver { /** * Enables a native PHP function to be run, using a platform agnostic wrapper. - * + * * @access public * @param string the function name * @param mixed any parameters needed by the function - * @return mixed + * @return mixed */ function call_function($function) { @@ -877,7 +877,7 @@ class CI_DB_driver { } if ( ! function_exists($function)) - { + { if ($this->db_debug) { return $this->display_error('db_unsupported_function'); @@ -888,7 +888,7 @@ class CI_DB_driver { { $args = (func_num_args() > 1) ? array_splice(func_get_args(), 1) : null; - return call_user_func_array($function, $args); + return call_user_func_array($function, $args); } } @@ -999,16 +999,16 @@ class CI_DB_driver { /** * Close DB Connection - * + * * @access public - * @return void + * @return void */ function close() { if (is_resource($this->conn_id)) { $this->_close($this->conn_id); - } + } $this->conn_id = FALSE; } @@ -1016,14 +1016,14 @@ class CI_DB_driver { /** * Display an error message - * + * * @access public * @param string the error message * @param string any "swap" values * @param boolean whether to localize the message - * @return string sends the application/error_db.php template + * @return string sends the application/error_db.php template */ - function display_error($error = '', $swap = '', $native = FALSE) + function display_error($error = '', $swap = '', $native = FALSE) { $LANG = new CI_Language(); $LANG->load('db'); @@ -1048,7 +1048,7 @@ class CI_DB_driver { echo $error->show_error('An Error Was Encountered', $message, 'error_db'); exit; - } + } } diff --git a/system/database/DB_result.php b/system/database/DB_result.php index d02bfb96e..44f166d21 100644 --- a/system/database/DB_result.php +++ b/system/database/DB_result.php @@ -7,17 +7,17 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * Database Result Class - * + * * This is the platform-independent result class. * This class will not be called directly. Rather, the adapter * class for the specific database will extend and instantiate it. @@ -38,10 +38,10 @@ class CI_DB_result { /** * Query result. Acts as a wrapper function for the following functions. - * + * * @access public * @param string can be "object" or "array" - * @return mixed either a result object or array + * @return mixed either a result object or array */ function result($type = 'object') { @@ -52,9 +52,9 @@ class CI_DB_result { /** * Query result. "object" version. - * + * * @access public - * @return object + * @return object */ function result_object() { @@ -70,7 +70,7 @@ class CI_DB_result { $this->_data_seek(0); while ($row = $this->_fetch_object()) - { + { $this->result_object[] = $row; } @@ -81,9 +81,9 @@ class CI_DB_result { /** * Query result. "array" version. - * + * * @access public - * @return array + * @return array */ function result_array() { @@ -110,10 +110,10 @@ class CI_DB_result { /** * Query result. Acts as a wrapper function for the following functions. - * + * * @access public * @param string can be "object" or "array" - * @return mixed either a result object or array + * @return mixed either a result object or array */ function row($n = 0, $type = 'object') { @@ -124,9 +124,9 @@ class CI_DB_result { /** * Returns a single result row - object version - * + * * @access public - * @return object + * @return object */ function row_object($n = 0) { @@ -149,9 +149,9 @@ class CI_DB_result { /** * Returns a single result row - array version - * + * * @access public - * @return array + * @return array */ function row_array($n = 0) { @@ -175,9 +175,9 @@ class CI_DB_result { /** * Returns the "first" row - * + * * @access public - * @return object + * @return object */ function first_row($type = 'object') { @@ -194,9 +194,9 @@ class CI_DB_result { /** * Returns the "last" row - * + * * @access public - * @return object + * @return object */ function last_row($type = 'object') { @@ -213,9 +213,9 @@ class CI_DB_result { /** * Returns the "next" row - * + * * @access public - * @return object + * @return object */ function next_row($type = 'object') { @@ -238,9 +238,9 @@ class CI_DB_result { /** * Returns the "previous" row - * + * * @access public - * @return object + * @return object */ function previous_row($type = 'object') { @@ -261,11 +261,11 @@ class CI_DB_result { // -------------------------------------------------------------------- /** - * The following functions are normally overloaded by the identically named + * The following functions are normally overloaded by the identically named * methods in the platform-specific driver -- except when query caching * is used. When caching is enabled we do not load the other driver. * These functions are primarily here to prevent undefined function errors - * when a cached result object is in use. They are not otherwise fully + * when a cached result object is in use. They are not otherwise fully * operational due to the unavailability of the database resource IDs with * cached results. */ diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php index 13fcaa5c9..e64e008bc 100644 --- a/system/database/DB_utility.php +++ b/system/database/DB_utility.php @@ -7,7 +7,7 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource @@ -302,7 +302,7 @@ class CI_DB_utility { } $xml .= $tab."</{$element}>".$newline; } - $xml .= "</$root>".$newline; + $xml .= "</$root>".$newline; return $xml; } @@ -371,13 +371,13 @@ class CI_DB_utility { // Is the encoder supported? If not, we'll either issue an // error or use plain text depending on the debug settings - if (($prefs['format'] == 'gzip' AND ! @function_exists('gzencode')) - OR ($prefs['format'] == 'zip' AND ! @function_exists('gzcompress'))) + if (($prefs['format'] == 'gzip' AND ! @function_exists('gzencode')) + OR ($prefs['format'] == 'zip' AND ! @function_exists('gzcompress'))) { - if ($this->db->db_debug) - { + if ($this->db->db_debug) + { return $this->db->display_error('db_unsuported_compression'); - } + } $prefs['format'] = 'txt'; } diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php index 4dc8792ca..a1d7d29ed 100644 --- a/system/database/drivers/mssql/mssql_driver.php +++ b/system/database/drivers/mssql/mssql_driver.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -106,18 +106,18 @@ class CI_DB_mssql_driver extends CI_DB { * @param string an SQL query * @return string */ - function _prep_query($sql) - { + function _prep_query($sql) + { return $sql; - } + } // -------------------------------------------------------------------- /** * Begin Transaction - * + * * @access public - * @return bool + * @return bool */ function trans_begin($test_mode = FALSE) { @@ -133,8 +133,8 @@ class CI_DB_mssql_driver extends CI_DB { } // Reset the transaction failure flag. - // If the $test_mode flag is set to TRUE transactions will be rolled back - // even if the queries produce a successful result. + // If the $test_mode flag is set to TRUE transactions will be rolled back + // even if the queries produce a successful result. $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE; $this->simple_query('BEGIN TRAN'); @@ -145,9 +145,9 @@ class CI_DB_mssql_driver extends CI_DB { /** * Commit Transaction - * + * * @access public - * @return bool + * @return bool */ function trans_commit() { @@ -170,9 +170,9 @@ class CI_DB_mssql_driver extends CI_DB { /** * Rollback Transaction - * + * * @access public - * @return bool + * @return bool */ function trans_rollback() { diff --git a/system/database/drivers/mssql/mssql_result.php b/system/database/drivers/mssql/mssql_result.php index 0ba0b8c57..230c1b55b 100644 --- a/system/database/drivers/mssql/mssql_result.php +++ b/system/database/drivers/mssql/mssql_result.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -65,7 +65,7 @@ class CI_DB_mssql_result extends CI_DB_result { $field_names = array(); while ($field = mssql_fetch_field($this->result_id)) { - $field_names[] = $field->name; + $field_names[] = $field->name; } return $field_names; @@ -116,8 +116,8 @@ class CI_DB_mssql_result extends CI_DB_result { { if (is_resource($this->result_id)) { - mssql_free_result($this->result_id); - $this->result_id = FALSE; + mssql_free_result($this->result_id); + $this->result_id = FALSE; } } diff --git a/system/database/drivers/mssql/mssql_utility.php b/system/database/drivers/mssql/mssql_utility.php index 24ff1e13c..4a49f533e 100644 --- a/system/database/drivers/mssql/mssql_utility.php +++ b/system/database/drivers/mssql/mssql_utility.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -74,7 +74,7 @@ class CI_DB_mssql_utility extends CI_DB_utility { */ function _list_databases() { - return "EXEC sp_helpdb"; // Can also be: EXEC sp_databases + return "EXEC sp_helpdb"; // Can also be: EXEC sp_databases } // -------------------------------------------------------------------- diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php index 20311ffa0..be7c672f7 100644 --- a/system/database/drivers/mysql/mysql_driver.php +++ b/system/database/drivers/mysql/mysql_driver.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -32,10 +32,10 @@ class CI_DB_mysql_driver extends CI_DB { /** * Whether to use the MySQL "delete hack" which allows the number - * of affected rows to be shown. Uses a preg_replace when enabled, + * of affected rows to be shown. Uses a preg_replace when enabled, * adding a bit more processing to all queries. */ - var $delete_hack = TRUE; + var $delete_hack = TRUE; /** * Non-persistent database connection @@ -113,28 +113,28 @@ class CI_DB_mysql_driver extends CI_DB { * @param string an SQL query * @return string */ - function _prep_query($sql) - { - // "DELETE FROM TABLE" returns 0 affected rows This hack modifies + function _prep_query($sql) + { + // "DELETE FROM TABLE" returns 0 affected rows This hack modifies // the query so that it returns the number of affected rows if ($this->delete_hack === TRUE) { - if (preg_match('/^\s*DELETE\s+FROM\s+(\S+)\s*$/i', $sql)) + if (preg_match('/^\s*DELETE\s+FROM\s+(\S+)\s*$/i', $sql)) { $sql = preg_replace("/^\s*DELETE\s+FROM\s+(\S+)\s*$/", "DELETE FROM \\1 WHERE 1=1", $sql); } } return $sql; - } - + } + // -------------------------------------------------------------------- /** * Begin Transaction - * + * * @access public - * @return bool + * @return bool */ function trans_begin($test_mode = FALSE) { @@ -150,8 +150,8 @@ class CI_DB_mysql_driver extends CI_DB { } // Reset the transaction failure flag. - // If the $test_mode flag is set to TRUE transactions will be rolled back - // even if the queries produce a successful result. + // If the $test_mode flag is set to TRUE transactions will be rolled back + // even if the queries produce a successful result. $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE; $this->simple_query('SET AUTOCOMMIT=0'); @@ -163,9 +163,9 @@ class CI_DB_mysql_driver extends CI_DB { /** * Commit Transaction - * + * * @access public - * @return bool + * @return bool */ function trans_commit() { @@ -189,9 +189,9 @@ class CI_DB_mysql_driver extends CI_DB { /** * Rollback Transaction - * + * * @access public - * @return bool + * @return bool */ function trans_rollback() { @@ -227,8 +227,8 @@ class CI_DB_mysql_driver extends CI_DB { return $str; } - if (function_exists('mysql_real_escape_string')) - { + if (function_exists('mysql_real_escape_string')) + { return mysql_real_escape_string($str, $this->conn_id); } elseif (function_exists('mysql_escape_string')) @@ -237,8 +237,8 @@ class CI_DB_mysql_driver extends CI_DB { } else { - return addslashes($str); - } + return addslashes($str); + } } // -------------------------------------------------------------------- diff --git a/system/database/drivers/mysql/mysql_result.php b/system/database/drivers/mysql/mysql_result.php index 1cf6ff188..4bfaf54a4 100644 --- a/system/database/drivers/mysql/mysql_result.php +++ b/system/database/drivers/mysql/mysql_result.php @@ -7,7 +7,7 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource @@ -65,7 +65,7 @@ class CI_DB_mysql_result extends CI_DB_result { $field_names = array(); while ($field = mysql_fetch_field($this->result_id)) { - $field_names[] = $field->name; + $field_names[] = $field->name; } return $field_names; @@ -116,8 +116,8 @@ class CI_DB_mysql_result extends CI_DB_result { { if (is_resource($this->result_id)) { - mysql_free_result($this->result_id); - $this->result_id = FALSE; + mysql_free_result($this->result_id); + $this->result_id = FALSE; } } diff --git a/system/database/drivers/mysql/mysql_utility.php b/system/database/drivers/mysql/mysql_utility.php index b387ace9e..b0a7dfea7 100644 --- a/system/database/drivers/mysql/mysql_utility.php +++ b/system/database/drivers/mysql/mysql_utility.php @@ -7,7 +7,7 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource @@ -129,39 +129,39 @@ class CI_DB_mysql_utility extends CI_DB_utility { // Build the output $output = ''; - foreach ((array)$tables as $table) - { - // Is the table in the "ignore" list? + foreach ((array)$tables as $table) + { + // Is the table in the "ignore" list? if (in_array($table, (array)$ignore, TRUE)) { - continue; - } + continue; + } - // Get the table schema + // Get the table schema $query = $this->db->query("SHOW CREATE TABLE `".$this->db->database.'`.'.$table); // No result means the table name was invalid - if ($query === FALSE) - { - continue; - } - - // Write out the table schema - $output .= '#'.$newline.'# TABLE STRUCTURE FOR: '.$table.$newline.'#'.$newline.$newline; - + if ($query === FALSE) + { + continue; + } + + // Write out the table schema + $output .= '#'.$newline.'# TABLE STRUCTURE FOR: '.$table.$newline.'#'.$newline.$newline; + if ($add_drop == TRUE) { - $output .= 'DROP TABLE IF EXISTS '.$table.';'.$newline.$newline; + $output .= 'DROP TABLE IF EXISTS '.$table.';'.$newline.$newline; } $i = 0; $result = $query->result_array(); foreach ($result[0] as $val) { - if ($i++ % 2) - { - $output .= $val.';'.$newline.$newline; - } + if ($i++ % 2) + { + $output .= $val.';'.$newline.$newline; + } } // If inserts are not needed we're done... @@ -179,7 +179,7 @@ class CI_DB_mysql_utility extends CI_DB_utility { } // Fetch the field names and determine if the field is an - // integer type. We use this info to decide whether to + // integer type. We use this info to decide whether to // surround the data with quotes or not $i = 0; @@ -188,13 +188,13 @@ class CI_DB_mysql_utility extends CI_DB_utility { while ($field = mysql_fetch_field($query->result_id)) { $is_int[$i] = (in_array( - strtolower(mysql_field_type($query->result_id, $i)), - array('tinyint', 'smallint', 'mediumint', 'int', 'bigint', 'timestamp'), + strtolower(mysql_field_type($query->result_id, $i)), + array('tinyint', 'smallint', 'mediumint', 'int', 'bigint', 'timestamp'), TRUE) ) ? TRUE : FALSE; // Create a string of field names - $field_str .= $field->name.', '; + $field_str .= $field->name.', '; $i++; } @@ -211,8 +211,8 @@ class CI_DB_mysql_utility extends CI_DB_utility { foreach ($row as $v) { // Do a little formatting... - $v = str_replace(array("\x00", "\x0a", "\x0d", "\x1a"), array('\0', '\n', '\r', '\Z'), $v); - $v = str_replace(array("\n", "\r", "\t"), array('\n', '\r', '\t'), $v); + $v = str_replace(array("\x00", "\x0a", "\x0d", "\x1a"), array('\0', '\n', '\r', '\Z'), $v); + $v = str_replace(array("\n", "\r", "\t"), array('\n', '\r', '\t'), $v); $v = str_replace('\\', '\\\\', $v); $v = str_replace('\'', '\\\'', $v); $v = str_replace('\\\n', '\n', $v); diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index ea2adbea9..59420912f 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -32,10 +32,10 @@ class CI_DB_mysqli_driver extends CI_DB { /** * Whether to use the MySQL "delete hack" which allows the number - * of affected rows to be shown. Uses a preg_replace when enabled, + * of affected rows to be shown. Uses a preg_replace when enabled, * adding a bit more processing to all queries. */ - var $delete_hack = TRUE; + var $delete_hack = TRUE; // -------------------------------------------------------------------- @@ -116,28 +116,28 @@ class CI_DB_mysqli_driver extends CI_DB { * @param string an SQL query * @return string */ - function _prep_query($sql) - { - // "DELETE FROM TABLE" returns 0 affected rows This hack modifies + function _prep_query($sql) + { + // "DELETE FROM TABLE" returns 0 affected rows This hack modifies // the query so that it returns the number of affected rows if ($this->delete_hack === TRUE) { - if (preg_match('/^\s*DELETE\s+FROM\s+(\S+)\s*$/i', $sql)) + if (preg_match('/^\s*DELETE\s+FROM\s+(\S+)\s*$/i', $sql)) { $sql = preg_replace("/^\s*DELETE\s+FROM\s+(\S+)\s*$/", "DELETE FROM \\1 WHERE 1=1", $sql); } } return $sql; - } + } // -------------------------------------------------------------------- /** * Begin Transaction - * + * * @access public - * @return bool + * @return bool */ function trans_begin($test_mode = FALSE) { @@ -153,8 +153,8 @@ class CI_DB_mysqli_driver extends CI_DB { } // Reset the transaction failure flag. - // If the $test_mode flag is set to TRUE transactions will be rolled back - // even if the queries produce a successful result. + // If the $test_mode flag is set to TRUE transactions will be rolled back + // even if the queries produce a successful result. $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE; $this->simple_query('SET AUTOCOMMIT=0'); @@ -166,9 +166,9 @@ class CI_DB_mysqli_driver extends CI_DB { /** * Commit Transaction - * + * * @access public - * @return bool + * @return bool */ function trans_commit() { @@ -192,9 +192,9 @@ class CI_DB_mysqli_driver extends CI_DB { /** * Rollback Transaction - * + * * @access public - * @return bool + * @return bool */ function trans_rollback() { diff --git a/system/database/drivers/mysqli/mysqli_result.php b/system/database/drivers/mysqli/mysqli_result.php index 215403e9d..5e4e65ff7 100644 --- a/system/database/drivers/mysqli/mysqli_result.php +++ b/system/database/drivers/mysqli/mysqli_result.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -65,7 +65,7 @@ class CI_DB_mysqli_result extends CI_DB_result { $field_names = array(); while ($field = mysql_fetch_field($this->result_id)) { - $field_names[] = $field->name; + $field_names[] = $field->name; } return $field_names; @@ -116,8 +116,8 @@ class CI_DB_mysqli_result extends CI_DB_result { { if (is_resource($this->result_id)) { - mysqli_free_result($this->result_id); - $this->result_id = FALSE; + mysqli_free_result($this->result_id); + $this->result_id = FALSE; } } diff --git a/system/database/drivers/mysqli/mysqli_utility.php b/system/database/drivers/mysqli/mysqli_utility.php index 17af40b76..a7bdb708e 100644 --- a/system/database/drivers/mysqli/mysqli_utility.php +++ b/system/database/drivers/mysqli/mysqli_utility.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -129,39 +129,39 @@ class CI_DB_mysqli_utility extends CI_DB_utility { // Build the output $output = ''; - foreach ((array)$tables as $table) - { - // Is the table in the "ignore" list? + foreach ((array)$tables as $table) + { + // Is the table in the "ignore" list? if (in_array($table, (array)$ignore, TRUE)) { - continue; - } + continue; + } - // Get the table schema + // Get the table schema $query = $this->db->query("SHOW CREATE TABLE `".$this->db->database.'`.'.$table); // No result means the table name was invalid - if ($query === FALSE) - { - continue; - } - - // Write out the table schema - $output .= '#'.$newline.'# TABLE STRUCTURE FOR: '.$table.$newline.'#'.$newline.$newline; - + if ($query === FALSE) + { + continue; + } + + // Write out the table schema + $output .= '#'.$newline.'# TABLE STRUCTURE FOR: '.$table.$newline.'#'.$newline.$newline; + if ($add_drop == TRUE) { - $output .= 'DROP TABLE IF EXISTS '.$table.';'.$newline.$newline; + $output .= 'DROP TABLE IF EXISTS '.$table.';'.$newline.$newline; } $i = 0; $result = $query->result_array(); foreach ($result[0] as $val) { - if ($i++ % 2) - { - $output .= $val.';'.$newline.$newline; - } + if ($i++ % 2) + { + $output .= $val.';'.$newline.$newline; + } } // If inserts are not needed we're done... @@ -179,7 +179,7 @@ class CI_DB_mysqli_utility extends CI_DB_utility { } // Fetch the field names and determine if the field is an - // integer type. We use this info to decide whether to + // integer type. We use this info to decide whether to // surround the data with quotes or not $i = 0; @@ -188,13 +188,13 @@ class CI_DB_mysqli_utility extends CI_DB_utility { while ($field = mysqli_fetch_field($query->result_id)) { $is_int[$i] = (in_array( - strtolower(mysql_field_type($query->result_id, $i)), - array('tinyint', 'smallint', 'mediumint', 'int', 'bigint', 'timestamp'), + strtolower(mysql_field_type($query->result_id, $i)), + array('tinyint', 'smallint', 'mediumint', 'int', 'bigint', 'timestamp'), TRUE) ) ? TRUE : FALSE; // Create a string of field names - $field_str .= $field->name.', '; + $field_str .= $field->name.', '; $i++; } @@ -211,8 +211,8 @@ class CI_DB_mysqli_utility extends CI_DB_utility { foreach ($row as $v) { // Do a little formatting... - $v = str_replace(array("\x00", "\x0a", "\x0d", "\x1a"), array('\0', '\n', '\r', '\Z'), $v); - $v = str_replace(array("\n", "\r", "\t"), array('\n', '\r', '\t'), $v); + $v = str_replace(array("\x00", "\x0a", "\x0d", "\x1a"), array('\0', '\n', '\r', '\Z'), $v); + $v = str_replace(array("\n", "\r", "\t"), array('\n', '\r', '\t'), $v); $v = str_replace('\\', '\\\\', $v); $v = str_replace('\'', '\\\'', $v); $v = str_replace('\\\n', '\n', $v); diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index 4f5470c1a..c091edf64 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -4,12 +4,12 @@ * * An open source application development framework for PHP 4.3.2 or newer * - * @package CodeIgniter - * @author Rick Ellis + * @package CodeIgniter + * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html - * @link http://www.codeigniter.com - * @since Version 1.0 + * @license http://www.codeignitor.com/user_guide/license.html + * @link http://www.codeigniter.com + * @since Version 1.0 * @filesource */ @@ -22,182 +22,182 @@ * creates dynamically based on whether the active record * class is being used or not. * - * @package CodeIgniter + * @package CodeIgniter * @subpackage Drivers - * @category Database - * @author Rick Ellis - * @link http://www.codeigniter.com/user_guide/database/ + * @category Database + * @author Rick Ellis + * @link http://www.codeigniter.com/user_guide/database/ */ /** * oci8 Database Adapter Class * - * This is a modification of the DB_driver class to + * This is a modification of the DB_driver class to * permit access to oracle databases * * NOTE: this uses the PHP 4 oci methods * - * @author Kelly McArdle + * @author Kelly McArdle * */ class CI_DB_oci8_driver extends CI_DB { // Set "auto commit" by default - var $_commit = OCI_COMMIT_ON_SUCCESS; - - // need to track statement id and cursor id - var $stmt_id; - var $curs_id; - - // if we use a limit, we will add a field that will - // throw off num_fields later - var $limit_used; - - /** - * Non-persistent database connection - * - * @access private called by the base class - * @return resource - */ - function db_connect() - { - return ocilogon($this->username, $this->password, $this->hostname); - } - - // -------------------------------------------------------------------- - - /** - * Persistent database connection - * - * @access private called by the base class - * @return resource - */ - function db_pconnect() - { - return ociplogon($this->username, $this->password, $this->hostname); - } - - // -------------------------------------------------------------------- - - /** - * Select the database - * - * @access private called by the base class - * @return resource - */ - function db_select() - { - return TRUE; - } + var $_commit = OCI_COMMIT_ON_SUCCESS; + + // need to track statement id and cursor id + var $stmt_id; + var $curs_id; + + // if we use a limit, we will add a field that will + // throw off num_fields later + var $limit_used; + + /** + * Non-persistent database connection + * + * @access private called by the base class + * @return resource + */ + function db_connect() + { + return ocilogon($this->username, $this->password, $this->hostname); + } + + // -------------------------------------------------------------------- + + /** + * Persistent database connection + * + * @access private called by the base class + * @return resource + */ + function db_pconnect() + { + return ociplogon($this->username, $this->password, $this->hostname); + } + + // -------------------------------------------------------------------- + + /** + * Select the database + * + * @access private called by the base class + * @return resource + */ + function db_select() + { + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Version number query string + * + * @access public + * @return string + */ + function _version() + { + return ociserverversion($this->conn_id); + } // -------------------------------------------------------------------- - /** - * Version number query string - * - * @access public - * @return string - */ - function _version() - { - return ociserverversion($this->conn_id); - } - - // -------------------------------------------------------------------- - - /** - * Execute the query - * - * @access private called by the base class - * @param string an SQL query - * @return resource - */ - function _execute($sql) - { - // oracle must parse the query before it is run. All of the actions with - // the query are based on the statement id returned by ociparse - $this->_set_stmt_id($sql); - ocisetprefetch($this->stmt_id, 1000); - return @ociexecute($this->stmt_id, $this->_commit); - } - - /** - * Generate a statement ID - * - * @access private - * @param string an SQL query - * @return none - */ - function _set_stmt_id($sql) - { - if ( ! is_resource($this->stmt_id)) - { + /** + * Execute the query + * + * @access private called by the base class + * @param string an SQL query + * @return resource + */ + function _execute($sql) + { + // oracle must parse the query before it is run. All of the actions with + // the query are based on the statement id returned by ociparse + $this->_set_stmt_id($sql); + ocisetprefetch($this->stmt_id, 1000); + return @ociexecute($this->stmt_id, $this->_commit); + } + + /** + * Generate a statement ID + * + * @access private + * @param string an SQL query + * @return none + */ + function _set_stmt_id($sql) + { + if ( ! is_resource($this->stmt_id)) + { $this->stmt_id = ociparse($this->conn_id, $this->_prep_query($sql)); - } - } - - // -------------------------------------------------------------------- - - /** - * Prep the query - * - * If needed, each database adapter can prep the query string - * - * @access private called by execute() - * @param string an SQL query - * @return string - */ - function _prep_query($sql) - { - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * getCursor. Returns a cursor from the datbase - * - * @access public - * @return cursor id - */ - function get_cursor() - { + } + } + + // -------------------------------------------------------------------- + + /** + * Prep the query + * + * If needed, each database adapter can prep the query string + * + * @access private called by execute() + * @param string an SQL query + * @return string + */ + function _prep_query($sql) + { + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * getCursor. Returns a cursor from the datbase + * + * @access public + * @return cursor id + */ + function get_cursor() + { $this->curs_id = ocinewcursor($this->conn_id); return $this->curs_id; - } - - // -------------------------------------------------------------------- - - /** - * Stored Procedure. Executes a stored procedure - * - * @access public - * @param package package stored procedure is in - * @param procedure stored procedure to execute - * @param params array of parameters - * @return array - * - * params array keys - * - * KEY OPTIONAL NOTES - * name no the name of the parameter should be in :<param_name> format - * value no the value of the parameter. If this is an OUT or IN OUT parameter, - * this should be a reference to a variable - * type yes the type of the parameter - * length yes the max size of the parameter - */ - function stored_procedure($package, $procedure, $params) - { - if ($package == '' OR $procedure == '' OR ! is_array($params)) - { - if ($this->db_debug) - { - log_message('error', 'Invalid query: '.$package.'.'.$procedure); - return $this->display_error('db_invalid_query'); - } - return FALSE; - } + } + + // -------------------------------------------------------------------- + + /** + * Stored Procedure. Executes a stored procedure + * + * @access public + * @param package package stored procedure is in + * @param procedure stored procedure to execute + * @param params array of parameters + * @return array + * + * params array keys + * + * KEY OPTIONAL NOTES + * name no the name of the parameter should be in :<param_name> format + * value no the value of the parameter. If this is an OUT or IN OUT parameter, + * this should be a reference to a variable + * type yes the type of the parameter + * length yes the max size of the parameter + */ + function stored_procedure($package, $procedure, $params) + { + if ($package == '' OR $procedure == '' OR ! is_array($params)) + { + if ($this->db_debug) + { + log_message('error', 'Invalid query: '.$package.'.'.$procedure); + return $this->display_error('db_invalid_query'); + } + return FALSE; + } // build the query string $sql = "begin $package.$procedure("; @@ -216,18 +216,18 @@ class CI_DB_oci8_driver extends CI_DB { $this->stmt_id = FALSE; $this->_set_stmt_id($sql); - $this->_bind_params($params); + $this->_bind_params($params); $this->query($sql, FALSE, $have_cursor); } - // -------------------------------------------------------------------- - - /** - * Bind parameters - * - * @access private - * @return none - */ + // -------------------------------------------------------------------- + + /** + * Bind parameters + * + * @access private + * @return none + */ function _bind_params($params) { if ( ! is_array($params) OR ! is_resource($this->stmt_id)) @@ -235,27 +235,27 @@ class CI_DB_oci8_driver extends CI_DB { return; } - foreach ($params as $param) - { + foreach ($params as $param) + { foreach (array('name', 'value', 'type', 'length') as $val) - { - if ( ! isset($param[$val])) - { - $param[$val] = ''; - } - } - + { + if ( ! isset($param[$val])) + { + $param[$val] = ''; + } + } + ocibindbyname($this->stmt_id, $param['name'], $param['value'], $param['length'], $param['type']); - } + } } // -------------------------------------------------------------------- /** * Begin Transaction - * + * * @access public - * @return bool + * @return bool */ function trans_begin($test_mode = FALSE) { @@ -271,8 +271,8 @@ class CI_DB_oci8_driver extends CI_DB { } // Reset the transaction failure flag. - // If the $test_mode flag is set to TRUE transactions will be rolled back - // even if the queries produce a successful result. + // If the $test_mode flag is set to TRUE transactions will be rolled back + // even if the queries produce a successful result. $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE; $this->_commit = OCI_DEFAULT; @@ -283,9 +283,9 @@ class CI_DB_oci8_driver extends CI_DB { /** * Commit Transaction - * + * * @access public - * @return bool + * @return bool */ function trans_commit() { @@ -309,9 +309,9 @@ class CI_DB_oci8_driver extends CI_DB { /** * Rollback Transaction - * + * * @access public - * @return bool + * @return bool */ function trans_rollback() { @@ -331,272 +331,272 @@ class CI_DB_oci8_driver extends CI_DB { return $ret; } - // -------------------------------------------------------------------- - - /** - * Escape String - * - * @access public - * @param string - * @return string - */ - function escape_str($str) - { - return $str; - } - - // -------------------------------------------------------------------- - - /** - * Affected Rows - * - * @access public - * @return integer - */ - function affected_rows() - { - return @ocirowcount($this->stmt_id); - } - - // -------------------------------------------------------------------- - - /** - * Insert ID - * - * @access public - * @return integer - */ - function insert_id() - { - // not supported in oracle - return 0; - } - - // -------------------------------------------------------------------- - - /** - * "Count All" query - * - * Generates a platform-specific query string that counts all records in - * the specified database - * - * @access public - * @param string - * @return string - */ - function count_all($table = '') - { - if ($table == '') - return '0'; - - $query = $this->query("SELECT COUNT(1) AS numrows FROM ".$table); - - if ($query == FALSE) - { - return 0; - } - - $row = $query->row(); - return $row->NUMROWS; - } - - // -------------------------------------------------------------------- - - /** - * Show table query - * - * Generates a platform-specific query string so that the table names can be fetched - * - * @access private - * @return string - */ - function _list_tables() - { - return "SELECT TABLE_NAME FROM ALL_TABLES"; - } - - // -------------------------------------------------------------------- - - /** - * Show column query - * - * Generates a platform-specific query string so that the column names can be fetched - * - * @access public - * @param string the table name - * @return string - */ - function _list_columns($table = '') - { - return "SELECT COLUMN_NAME FROM all_tab_columns WHERE table_name = '$table'"; - } - - // -------------------------------------------------------------------- - - /** - * Field data query - * - * Generates a platform-specific query so that the column data can be retrieved - * - * @access public - * @param string the table name - * @return object - */ - function _field_data($table) - { + // -------------------------------------------------------------------- + + /** + * Escape String + * + * @access public + * @param string + * @return string + */ + function escape_str($str) + { + return $str; + } + + // -------------------------------------------------------------------- + + /** + * Affected Rows + * + * @access public + * @return integer + */ + function affected_rows() + { + return @ocirowcount($this->stmt_id); + } + + // -------------------------------------------------------------------- + + /** + * Insert ID + * + * @access public + * @return integer + */ + function insert_id() + { + // not supported in oracle + return 0; + } + + // -------------------------------------------------------------------- + + /** + * "Count All" query + * + * Generates a platform-specific query string that counts all records in + * the specified database + * + * @access public + * @param string + * @return string + */ + function count_all($table = '') + { + if ($table == '') + return '0'; + + $query = $this->query("SELECT COUNT(1) AS numrows FROM ".$table); + + if ($query == FALSE) + { + return 0; + } + + $row = $query->row(); + return $row->NUMROWS; + } + + // -------------------------------------------------------------------- + + /** + * Show table query + * + * Generates a platform-specific query string so that the table names can be fetched + * + * @access private + * @return string + */ + function _list_tables() + { + return "SELECT TABLE_NAME FROM ALL_TABLES"; + } + + // -------------------------------------------------------------------- + + /** + * Show column query + * + * Generates a platform-specific query string so that the column names can be fetched + * + * @access public + * @param string the table name + * @return string + */ + function _list_columns($table = '') + { + return "SELECT COLUMN_NAME FROM all_tab_columns WHERE table_name = '$table'"; + } + + // -------------------------------------------------------------------- + + /** + * Field data query + * + * Generates a platform-specific query so that the column data can be retrieved + * + * @access public + * @param string the table name + * @return object + */ + function _field_data($table) + { return "SELECT * FROM ".$this->_escape_table($table)." where rownum = 1"; - } - - // -------------------------------------------------------------------- - - /** - * The error message string - * - * @access private - * @return string - */ - function _error_message() - { - $error = ocierror($this->conn_id); - return $error['message']; - } - - // -------------------------------------------------------------------- - - /** - * The error message number - * - * @access private - * @return integer - */ - function _error_number() - { - $error = ocierror($this->conn_id); - return $error['code']; - } - - // -------------------------------------------------------------------- - - /** - * Escape Table Name - * - * This function adds backticks if the table name has a period - * in it. Some DBs will get cranky unless periods are escaped - * - * @access private - * @param string the table name - * @return string - */ - function _escape_table($table) - { - if (stristr($table, '.')) - { - $table = preg_replace("/\./", "`.`", $table); - } - - return $table; - } - - // -------------------------------------------------------------------- - - /** - * Insert 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($table, $keys, $values) - { - return "INSERT INTO ".$this->_escape_table($table)." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; - } - - // -------------------------------------------------------------------- - - /** - * Update statement - * - * Generates a platform-specific update string from the supplied data - * - * @access public - * @param string the table name - * @param array the update data - * @param array the where clause - * @return string - */ - function _update($table, $values, $where) - { - foreach($values as $key => $val) - { - $valstr[] = $key." = ".$val; - } - - return "UPDATE ".$this->_escape_table($table)." SET ".implode(', ', $valstr)." WHERE ".implode(" ", $where); - } - - // -------------------------------------------------------------------- - - /** - * Delete statement - * - * Generates a platform-specific delete string from the supplied data - * - * @access public - * @param string the table name - * @param array the where clause - * @return string - */ - function _delete($table, $where) - { - return "DELETE FROM ".$this->_escape_table($table)." WHERE ".implode(" ", $where); - } - - // -------------------------------------------------------------------- - - /** - * Limit string - * - * Generates a platform-specific LIMIT clause - * - * @access public - * @param string the sql query string - * @param integer the number of rows to limit the query to - * @param integer the offset value - * @return string - */ - function _limit($sql, $limit, $offset) - { - $limit = $offset + $limit; - $newsql = "SELECT * FROM (select inner_query.*, rownum rnum FROM ($sql) inner_query WHERE rownum < $limit)"; - - if ($offset != 0) - { - $newsql .= " WHERE rnum >= $offset"; - } - - // remember that we used limits - $this->limit_used = TRUE; - - return $newsql; - } - - // -------------------------------------------------------------------- - - /** - * Close DB Connection - * - * @access public - * @param resource - * @return void - */ - function _close($conn_id) - { - ocilogoff($conn_id); - } + } + + // -------------------------------------------------------------------- + + /** + * The error message string + * + * @access private + * @return string + */ + function _error_message() + { + $error = ocierror($this->conn_id); + return $error['message']; + } + + // -------------------------------------------------------------------- + + /** + * The error message number + * + * @access private + * @return integer + */ + function _error_number() + { + $error = ocierror($this->conn_id); + return $error['code']; + } + + // -------------------------------------------------------------------- + + /** + * Escape Table Name + * + * This function adds backticks if the table name has a period + * in it. Some DBs will get cranky unless periods are escaped + * + * @access private + * @param string the table name + * @return string + */ + function _escape_table($table) + { + if (stristr($table, '.')) + { + $table = preg_replace("/\./", "`.`", $table); + } + + return $table; + } + + // -------------------------------------------------------------------- + + /** + * Insert 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($table, $keys, $values) + { + return "INSERT INTO ".$this->_escape_table($table)." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; + } + + // -------------------------------------------------------------------- + + /** + * Update statement + * + * Generates a platform-specific update string from the supplied data + * + * @access public + * @param string the table name + * @param array the update data + * @param array the where clause + * @return string + */ + function _update($table, $values, $where) + { + foreach($values as $key => $val) + { + $valstr[] = $key." = ".$val; + } + + return "UPDATE ".$this->_escape_table($table)." SET ".implode(', ', $valstr)." WHERE ".implode(" ", $where); + } + + // -------------------------------------------------------------------- + + /** + * Delete statement + * + * Generates a platform-specific delete string from the supplied data + * + * @access public + * @param string the table name + * @param array the where clause + * @return string + */ + function _delete($table, $where) + { + return "DELETE FROM ".$this->_escape_table($table)." WHERE ".implode(" ", $where); + } + + // -------------------------------------------------------------------- + + /** + * Limit string + * + * Generates a platform-specific LIMIT clause + * + * @access public + * @param string the sql query string + * @param integer the number of rows to limit the query to + * @param integer the offset value + * @return string + */ + function _limit($sql, $limit, $offset) + { + $limit = $offset + $limit; + $newsql = "SELECT * FROM (select inner_query.*, rownum rnum FROM ($sql) inner_query WHERE rownum < $limit)"; + + if ($offset != 0) + { + $newsql .= " WHERE rnum >= $offset"; + } + + // remember that we used limits + $this->limit_used = TRUE; + + return $newsql; + } + + // -------------------------------------------------------------------- + + /** + * Close DB Connection + * + * @access public + * @param resource + * @return void + */ + function _close($conn_id) + { + ocilogoff($conn_id); + } } diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php index ab13a3935..947a76109 100644 --- a/system/database/drivers/oci8/oci8_result.php +++ b/system/database/drivers/oci8/oci8_result.php @@ -4,12 +4,12 @@ * * An open source application development framework for PHP 4.3.2 or newer * - * @package CodeIgniter - * @author Rick Ellis + * @package CodeIgniter + * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html - * @link http://www.codeigniter.com - * @since Version 1.0 + * @license http://www.codeignitor.com/user_guide/license.html + * @link http://www.codeigniter.com + * @since Version 1.0 * @filesource */ @@ -20,59 +20,59 @@ * * This class extends the parent result class: CI_DB_result * - * @category Database - * @author Rick Ellis - * @link http://www.codeigniter.com/user_guide/database/ + * @category Database + * @author Rick Ellis + * @link http://www.codeigniter.com/user_guide/database/ */ class CI_DB_oci8_result extends CI_DB_result { - var $stmt_id; - var $curs_id; - var $limit_used; - - /** - * Number of rows in the result set - * - * @access public - * @return integer - */ - function num_rows() - { - // get the results, count them, - // rerun query - otherwise we - // won't have data after calling - // num_rows() - $this->result_array(); - $rowcount = count($this->result_array); - @ociexecute($this->stmt_id); - if ($this->curs_id) + var $stmt_id; + var $curs_id; + var $limit_used; + + /** + * Number of rows in the result set + * + * @access public + * @return integer + */ + function num_rows() + { + // get the results, count them, + // rerun query - otherwise we + // won't have data after calling + // num_rows() + $this->result_array(); + $rowcount = count($this->result_array); + @ociexecute($this->stmt_id); + if ($this->curs_id) { @ociexecute($this->curs_id); } - return $rowcount; - } - - // -------------------------------------------------------------------- - - /** - * Number of fields in the result set - * - * @access public - * @return integer - */ - function num_fields() - { - $count = @ocinumcols($this->stmt_id); - - // if we used a limit, we added a field, - // subtract it out - if ($this->limit_used) - { - $count = $count - 1; - } - - return $count; - } + return $rowcount; + } + + // -------------------------------------------------------------------- + + /** + * Number of fields in the result set + * + * @access public + * @return integer + */ + function num_fields() + { + $count = @ocinumcols($this->stmt_id); + + // if we used a limit, we added a field, + // subtract it out + if ($this->limit_used) + { + $count = $count - 1; + } + + return $count; + } // -------------------------------------------------------------------- @@ -87,11 +87,11 @@ class CI_DB_oci8_result extends CI_DB_result { function list_fields() { $field_names = array(); - $fieldCount = $this->num_fields(); - for ($c = 1; $c <= $fieldCount; $c++) - { - $field_names[] = ocicolumnname($this->stmt_id, $c); - } + $fieldCount = $this->num_fields(); + for ($c = 1; $c <= $fieldCount; $c++) + { + $field_names[] = ocicolumnname($this->stmt_id, $c); + } return $field_names; } @@ -101,32 +101,32 @@ class CI_DB_oci8_result extends CI_DB_result { return $this->list_fields(); } - // -------------------------------------------------------------------- - - /** - * Field data - * - * Generates an array of objects containing field meta-data - * - * @access public - * @return array - */ - function field_data() - { - $retval = array(); - $fieldCount = $this->num_fields(); - for ($c = 1; $c <= $fieldCount; $c++) - { - $F = new stdClass(); - $F->name = ocicolumnname($this->stmt_id, $c); - $F->type = ocicolumntype($this->stmt_id, $c); - $F->max_length = ocicolumnsize($this->stmt_id, $c); - - $retval[] = $F; - } - - return $retval; - } + // -------------------------------------------------------------------- + + /** + * Field data + * + * Generates an array of objects containing field meta-data + * + * @access public + * @return array + */ + function field_data() + { + $retval = array(); + $fieldCount = $this->num_fields(); + for ($c = 1; $c <= $fieldCount; $c++) + { + $F = new stdClass(); + $F->name = ocicolumnname($this->stmt_id, $c); + $F->type = ocicolumntype($this->stmt_id, $c); + $F->max_length = ocicolumnsize($this->stmt_id, $c); + + $retval[] = $F; + } + + return $retval; + } // -------------------------------------------------------------------- @@ -139,25 +139,25 @@ class CI_DB_oci8_result extends CI_DB_result { { if (is_resource($this->result_id)) { - OCIFreeStatement($this->result_id); - $this->result_id = FALSE; + OCIFreeStatement($this->result_id); + $this->result_id = FALSE; } } - // -------------------------------------------------------------------- - - /** - * Result - associative array - * - * Returns the result set as an array - * - * @access private - * @return array - */ - function _fetch_assoc(&$row) - { - // if pulling from a cursor, use curs_id - if ($this->curs_id) + // -------------------------------------------------------------------- + + /** + * Result - associative array + * + * Returns the result set as an array + * + * @access private + * @return array + */ + function _fetch_assoc(&$row) + { + // if pulling from a cursor, use curs_id + if ($this->curs_id) { return ocifetchinto($this->curs_id, $row, OCI_ASSOC + OCI_RETURN_NULLS); } @@ -165,7 +165,7 @@ class CI_DB_oci8_result extends CI_DB_result { { return ocifetchinto($this->stmt_id, $row, OCI_ASSOC + OCI_RETURN_NULLS); } - } + } // -------------------------------------------------------------------- @@ -184,25 +184,25 @@ class CI_DB_oci8_result extends CI_DB_result { return FALSE; } - // -------------------------------------------------------------------- - - /** - * Result - object - * - * Returns the result set as an object - * - * @access private - * @return object - */ - function _fetch_object() - { - // the PHP 4 version of the oracle functions do not - // have a fetch method so we call the array version - // and build an object from that - - $row = array(); - $res = $this->_fetch_assoc($row); - if ($res != FALSE) + // -------------------------------------------------------------------- + + /** + * Result - object + * + * Returns the result set as an object + * + * @access private + * @return object + */ + function _fetch_object() + { + // the PHP 4 version of the oracle functions do not + // have a fetch method so we call the array version + // and build an object from that + + $row = array(); + $res = $this->_fetch_assoc($row); + if ($res != FALSE) { $obj = new stdClass(); foreach ($row as $key => $value) @@ -212,41 +212,41 @@ class CI_DB_oci8_result extends CI_DB_result { $res = $obj; } - return $res; - } - - // -------------------------------------------------------------------- - - /** - * Query result. "array" version. - * - * @access public - * @return array - */ - function result_array() - { - if (count($this->result_array) > 0) - { - return $this->result_array; - } - - // oracle's fetch functions do not - // return arrays, the information - // is returned in reference parameters - // - $row = NULL; - while ($this->_fetch_assoc($row)) - { - $this->result_array[] = $row; - } - - if (count($this->result_array) == 0) - { - return FALSE; - } - - return $this->result_array; - } + return $res; + } + + // -------------------------------------------------------------------- + + /** + * Query result. "array" version. + * + * @access public + * @return array + */ + function result_array() + { + if (count($this->result_array) > 0) + { + return $this->result_array; + } + + // oracle's fetch functions do not + // return arrays, the information + // is returned in reference parameters + // + $row = NULL; + while ($this->_fetch_assoc($row)) + { + $this->result_array[] = $row; + } + + if (count($this->result_array) == 0) + { + return FALSE; + } + + return $this->result_array; + } } diff --git a/system/database/drivers/oci8/oci8_utility.php b/system/database/drivers/oci8/oci8_utility.php index f4e912183..1d83af1fe 100644 --- a/system/database/drivers/oci8/oci8_utility.php +++ b/system/database/drivers/oci8/oci8_utility.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php index 17a6dfbd0..09ca07ee4 100644 --- a/system/database/drivers/odbc/odbc_driver.php +++ b/system/database/drivers/odbc/odbc_driver.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -21,7 +21,7 @@ * Note: _DB is an extender class that the app controller * creates dynamically based on whether the active record * class is being used or not. - * + * * @package CodeIgniter * @subpackage Drivers * @category Database @@ -107,18 +107,18 @@ class CI_DB_odbc_driver extends CI_DB { * @param string an SQL query * @return string */ - function _prep_query($sql) - { + function _prep_query($sql) + { return $sql; - } + } // -------------------------------------------------------------------- /** * Begin Transaction - * + * * @access public - * @return bool + * @return bool */ function trans_begin($test_mode = FALSE) { @@ -134,8 +134,8 @@ class CI_DB_odbc_driver extends CI_DB { } // Reset the transaction failure flag. - // If the $test_mode flag is set to TRUE transactions will be rolled back - // even if the queries produce a successful result. + // If the $test_mode flag is set to TRUE transactions will be rolled back + // even if the queries produce a successful result. $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE; return odbc_autocommit($this->conn_id, FALSE); @@ -145,9 +145,9 @@ class CI_DB_odbc_driver extends CI_DB { /** * Commit Transaction - * + * * @access public - * @return bool + * @return bool */ function trans_commit() { @@ -171,9 +171,9 @@ class CI_DB_odbc_driver extends CI_DB { /** * Rollback Transaction - * + * * @access public - * @return bool + * @return bool */ function trans_rollback() { diff --git a/system/database/drivers/odbc/odbc_result.php b/system/database/drivers/odbc/odbc_result.php index ea834f9b4..47fb103b3 100644 --- a/system/database/drivers/odbc/odbc_result.php +++ b/system/database/drivers/odbc/odbc_result.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -116,8 +116,8 @@ class CI_DB_odbc_result extends CI_DB_result { { if (is_resource($this->result_id)) { - odbc_free_result($this->result_id); - $this->result_id = FALSE; + odbc_free_result($this->result_id); + $this->result_id = FALSE; } } diff --git a/system/database/drivers/odbc/odbc_utility.php b/system/database/drivers/odbc/odbc_utility.php index dc62df9f0..8af463b13 100644 --- a/system/database/drivers/odbc/odbc_utility.php +++ b/system/database/drivers/odbc/odbc_utility.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -34,7 +34,7 @@ class CI_DB_odbc_utility extends CI_DB_utility { */ function _create_database() { - // ODBC has no "create database" command since it's + // ODBC has no "create database" command since it's // designed to connect to an existing database if ($this->db->db_debug) { @@ -54,7 +54,7 @@ class CI_DB_odbc_utility extends CI_DB_utility { */ function _drop_database($name) { - // ODBC has no "drop database" command since it's + // ODBC has no "drop database" command since it's // designed to connect to an existing database if ($this->db->db_debug) { diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php index f74e652d5..81aaafe14 100644 --- a/system/database/drivers/postgre/postgre_driver.php +++ b/system/database/drivers/postgre/postgre_driver.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -111,18 +111,18 @@ class CI_DB_postgre_driver extends CI_DB { * @param string an SQL query * @return string */ - function _prep_query($sql) - { + function _prep_query($sql) + { return $sql; - } + } // -------------------------------------------------------------------- /** * Begin Transaction - * + * * @access public - * @return bool + * @return bool */ function trans_begin($test_mode = FALSE) { @@ -138,8 +138,8 @@ class CI_DB_postgre_driver extends CI_DB { } // Reset the transaction failure flag. - // If the $test_mode flag is set to TRUE transactions will be rolled back - // even if the queries produce a successful result. + // If the $test_mode flag is set to TRUE transactions will be rolled back + // even if the queries produce a successful result. $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE; return @pg_exec($this->conn_id, "begin"); @@ -149,9 +149,9 @@ class CI_DB_postgre_driver extends CI_DB { /** * Commit Transaction - * + * * @access public - * @return bool + * @return bool */ function trans_commit() { @@ -173,9 +173,9 @@ class CI_DB_postgre_driver extends CI_DB { /** * Rollback Transaction - * + * * @access public - * @return bool + * @return bool */ function trans_rollback() { @@ -298,7 +298,7 @@ class CI_DB_postgre_driver extends CI_DB { * @return string */ function _list_tables() - { + { return "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'"; } diff --git a/system/database/drivers/postgre/postgre_result.php b/system/database/drivers/postgre/postgre_result.php index e792544ae..76bd60187 100644 --- a/system/database/drivers/postgre/postgre_result.php +++ b/system/database/drivers/postgre/postgre_result.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -116,8 +116,8 @@ class CI_DB_postgre_result extends CI_DB_result { { if (is_resource($this->result_id)) { - pg_free_result($this->result_id); - $this->result_id = FALSE; + pg_free_result($this->result_id); + $this->result_id = FALSE; } } diff --git a/system/database/drivers/postgre/postgre_utility.php b/system/database/drivers/postgre/postgre_utility.php index b08b879d7..478e74276 100644 --- a/system/database/drivers/postgre/postgre_utility.php +++ b/system/database/drivers/postgre/postgre_utility.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -90,7 +90,7 @@ class CI_DB_postgre_utility extends CI_DB_utility { */ function _optimize_table($table) { - return FALSE; + return FALSE; } // -------------------------------------------------------------------- diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index fd9fd2c50..ce3c57935 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ @@ -44,10 +44,10 @@ class CI_DB_sqlite_driver extends CI_DB { { log_message('error', $error); - if ($this->db_debug) - { + if ($this->db_debug) + { $this->display_error($error, '', TRUE); - } + } } return $conn_id; @@ -67,10 +67,10 @@ class CI_DB_sqlite_driver extends CI_DB { { log_message('error', $error); - if ($this->db_debug) - { + if ($this->db_debug) + { $this->display_error($error, '', TRUE); - } + } } return $conn_id; @@ -128,18 +128,18 @@ class CI_DB_sqlite_driver extends CI_DB { * @param string an SQL query * @return string */ - function _prep_query($sql) - { + function _prep_query($sql) + { return $sql; - } + } // -------------------------------------------------------------------- /** * Begin Transaction - * + * * @access public - * @return bool + * @return bool */ function trans_begin($test_mode = FALSE) { @@ -155,8 +155,8 @@ class CI_DB_sqlite_driver extends CI_DB { } // Reset the transaction failure flag. - // If the $test_mode flag is set to TRUE transactions will be rolled back - // even if the queries produce a successful result. + // If the $test_mode flag is set to TRUE transactions will be rolled back + // even if the queries produce a successful result. $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE; $this->simple_query('BEGIN TRANSACTION'); @@ -167,9 +167,9 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Commit Transaction - * + * * @access public - * @return bool + * @return bool */ function trans_commit() { @@ -192,9 +192,9 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Rollback Transaction - * + * * @access public - * @return bool + * @return bool */ function trans_rollback() { diff --git a/system/database/drivers/sqlite/sqlite_result.php b/system/database/drivers/sqlite/sqlite_result.php index 55364bb24..00045d06c 100644 --- a/system/database/drivers/sqlite/sqlite_result.php +++ b/system/database/drivers/sqlite/sqlite_result.php @@ -7,19 +7,19 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * SQLite Result Class * * This class extends the parent result class: CI_DB_result - * + * * @category Database * @author Rick Ellis * @link http://www.codeigniter.com/user_guide/database/ diff --git a/system/database/drivers/sqlite/sqlite_utility.php b/system/database/drivers/sqlite/sqlite_utility.php index ecce5be40..91649c78d 100644 --- a/system/database/drivers/sqlite/sqlite_utility.php +++ b/system/database/drivers/sqlite/sqlite_utility.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -68,7 +68,7 @@ class CI_DB_sqlite_utility extends CI_DB_utility { * * I don't believe you can do a database listing with SQLite * since each database is its own file. I suppose we could - * try reading a directory looking for SQLite files, but + * try reading a directory looking for SQLite files, but * that doesn't seem like a terribly good idea * * @access private diff --git a/system/fonts/texb.ttf b/system/fonts/texb.ttf Binary files differindex 383c88b86..a7aa6469a 100644 --- a/system/fonts/texb.ttf +++ b/system/fonts/texb.ttf diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php index 8adbd8548..491c61577 100644 --- a/system/helpers/array_helper.php +++ b/system/helpers/array_helper.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php index 8985fae2e..b117816e2 100644 --- a/system/helpers/cookie_helper.php +++ b/system/helpers/cookie_helper.php @@ -7,17 +7,17 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * Code Igniter Cookie Helpers - * + * * @package CodeIgniter * @subpackage Helpers * @category Helpers @@ -30,7 +30,7 @@ /** * Set cookie * - * Accepts six parameter, or you can submit an associative + * Accepts six parameter, or you can submit an associative * array in the first parameter containing all the values. * * @access public @@ -43,7 +43,7 @@ * @return void */ function set_cookie($name = '', $value = '', $expire = '', $domain = '', $path = '/', $prefix = '') -{ +{ if (is_array($name)) { foreach (array('value', 'expire', 'domain', 'path', 'prefix', 'name') as $item) diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index 911862423..b8df03edb 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -39,10 +39,10 @@ function now() { $CI =& get_instance(); - if (strtolower($CI->config->item('time_reference')) == 'gmt') + if (strtolower($CI->config->item('time_reference')) == 'gmt') { - $now = time(); - $system_time = mktime(gmdate("H", $now), gmdate("i", $now), gmdate("s", $now), gmdate("m", $now), gmdate("d", $now), gmdate("Y", $now)); + $now = time(); + $system_time = mktime(gmdate("H", $now), gmdate("i", $now), gmdate("s", $now), gmdate("m", $now), gmdate("d", $now), gmdate("Y", $now)); if (strlen($system_time) < 10) { @@ -130,7 +130,7 @@ function standard_date($fmt = 'DATE_RFC822', $time = '') /** * Timespan * - * Returns a span of seconds in this format: + * Returns a span of seconds in this format: * 10 days 14 hours 36 minutes 47 seconds * * @access public @@ -244,7 +244,7 @@ function timespan($seconds = 1, $time = '') /** * Number of days in a month * - * Takes a month/year as input and returns the number of days + * Takes a month/year as input and returns the number of days * for the given month/year. Takes leap years into consideration. * * @access public @@ -265,7 +265,7 @@ function days_in_month($month = 0, $year = '') } if ($month == 2) - { + { if ($year % 400 == 0 OR ($year % 4 == 0 AND $year % 100 != 0)) { return 29; @@ -290,7 +290,7 @@ function local_to_gmt($time = '') if ($time == '') $time = time(); - return mktime( gmdate("H", $time), gmdate("i", $time), gmdate("s", $time), gmdate("m", $time), gmdate("d", $time), gmdate("Y", $time)); + return mktime( gmdate("H", $time), gmdate("i", $time), gmdate("s", $time), gmdate("m", $time), gmdate("d", $time), gmdate("Y", $time)); } // ------------------------------------------------------------------------ @@ -335,7 +335,7 @@ function gmt_to_local($time = '', $timezone = 'UTC', $dst = FALSE) * @return integer */ function mysql_to_unix($time = '') -{ +{ // We'll remove certain characters for backward compatibility // since the formatting changed with MySQL 4.1 // YYYY-MM-DD HH:MM:SS @@ -345,7 +345,7 @@ function mysql_to_unix($time = '') $time = str_replace(' ', '', $time); // YYYYMMDDHHMMSS - return mktime( + return mktime( substr($time, 8, 2), substr($time, 10, 2), substr($time, 12, 2), @@ -422,13 +422,13 @@ function human_to_unix($datestr = '') $split = preg_split("/\040/", $datestr); - $ex = explode("-", $split['0']); + $ex = explode("-", $split['0']); $year = (strlen($ex['0']) == 2) ? '20'.$ex['0'] : $ex['0']; $month = (strlen($ex['1']) == 1) ? '0'.$ex['1'] : $ex['1']; $day = (strlen($ex['2']) == 1) ? '0'.$ex['2'] : $ex['2']; - $ex = explode(":", $split['1']); + $ex = explode(":", $split['1']); $hour = (strlen($ex['0']) == 1) ? '0'.$ex['0'] : $ex['0']; $min = (strlen($ex['1']) == 1) ? '0'.$ex['1'] : $ex['1']; @@ -515,10 +515,10 @@ function timezone_menu($default = 'UTC', $class = "", $name = 'timezones') */ function timezones($tz = '') { - // Note: Don't change the order of these even though + // Note: Don't change the order of these even though // some items appear to be in the wrong order - $zones = array( + $zones = array( 'UM12' => -12, 'UM11' => -11, 'UM10' => -10, @@ -548,7 +548,7 @@ function timezones($tz = '') 'UP85' => +8.5, 'UP10' => +10, 'UP11' => +11, - 'UP12' => +12 + 'UP12' => +12 ); if ($tz == '') diff --git a/system/helpers/directory_helper.php b/system/helpers/directory_helper.php index 4b7a383b2..e6ed47fd8 100644 --- a/system/helpers/directory_helper.php +++ b/system/helpers/directory_helper.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -45,14 +45,14 @@ function directory_map($source_dir, $top_level_only = FALSE) $filedata = array(); if ($fp = @opendir($source_dir)) - { + { while (FALSE !== ($file = readdir($fp))) { - if (@is_dir($source_dir.$file) && substr($file, 0, 1) != '.' AND $top_level_only == FALSE) - { + if (@is_dir($source_dir.$file) && substr($file, 0, 1) != '.' AND $top_level_only == FALSE) + { $temp_array = array(); - - $temp_array = directory_map($source_dir.$file."/"); + + $temp_array = directory_map($source_dir.$file."/"); $filedata[$file] = $temp_array; } @@ -60,9 +60,9 @@ function directory_map($source_dir, $top_level_only = FALSE) { $filedata[] = $file; } - } - return $filedata; - } + } + return $filedata; + } } diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 8d9fee478..dbedd8722 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -78,8 +78,8 @@ function force_download($filename = '', $data = '') header("Content-Transfer-Encoding: binary"); header('Pragma: public'); header("Content-Length: ".strlen($data)); - } - else + } + else { header('Content-Type: "'.$mime.'"'); header('Content-Disposition: attachment; filename="'.$filename.'"'); diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index 7a04324e4..c9c21380d 100644 --- a/system/helpers/file_helper.php +++ b/system/helpers/file_helper.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -56,13 +56,13 @@ function read_file($file) flock($fp, LOCK_SH); $data = ''; - if (filesize($file) > 0) + if (filesize($file) > 0) { - $data =& fread($fp, filesize($file)); + $data =& fread($fp, filesize($file)); } flock($fp, LOCK_UN); - fclose($fp); + fclose($fp); return $data; } @@ -72,7 +72,7 @@ function read_file($file) /** * Write File * - * Writes data to the file specified in the path. + * Writes data to the file specified in the path. * Creates a new file if non-existent. * * @access public @@ -119,7 +119,7 @@ function delete_files($path, $del_dir = FALSE, $level = 0) return; while(FALSE !== ($filename = @readdir($current_dir))) - { + { if ($filename != "." and $filename != "..") { if (is_dir($path.'/'.$filename)) diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index e12d89319..6d10a9862 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -53,7 +53,7 @@ function form_open($action = '', $attributes = array(), $hidden = array()) { foreach ($attributes as $key => $val) { - $form .= ' '.$key.'="'.$val.'"'; + $form .= ' '.$key.'="'.$val.'"'; } } @@ -100,7 +100,7 @@ function form_open_multipart($action, $attributes = array(), $hidden = array()) * @return string */ function form_hidden($name, $value = '') -{ +{ if ( ! is_array($name)) { return '<input type="hidden" name="'.$name.'" value="'.form_prep($value).'" />'; @@ -251,7 +251,7 @@ function form_checkbox($data = '', $value = '', $checked = TRUE, $extra = '') { $checked = $data['checked']; - if ($checked == FALSE) + if ($checked == FALSE) unset($data['checked']); } diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index 1c97dda53..5ba1df990 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index 3d8d3e0ca..666ec40b8 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php index 34386ffea..06228468f 100644 --- a/system/helpers/security_helper.php +++ b/system/helpers/security_helper.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -60,7 +60,7 @@ function dohash($str, $type = 'sha1') { require_once(BASEPATH.'libraries/Sha1'.EXT); $SH = new CI_SHA; - return $SH->generate($str); + return $SH->generate($str); } else { @@ -88,7 +88,7 @@ function dohash($str, $type = 'sha1') * @return string */ function strip_image_tags($str) -{ +{ $str = preg_replace("#<img\s+.*?src\s*=\s*[\"'](.+?)[\"'].*?\>#", "\\1", $str); $str = preg_replace("#<img\s+.*?src\s*=\s*(.+?).*?\>#", "\\1", $str); diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php index d5a3591f9..ba704df9e 100644 --- a/system/helpers/string_helper.php +++ b/system/helpers/string_helper.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -67,7 +67,7 @@ function trim_slashes($str) */ function reduce_double_slashes($str) { - return preg_replace("#([^:])//+#", "\\1/", $str); + return preg_replace("#([^:])//+#", "\\1/", $str); } // ------------------------------------------------------------------------ @@ -101,15 +101,15 @@ function random_string($type = 'alnum', $len = 8) } $str = ''; - for ($i=0; $i < $len; $i++) - { - $str .= substr($pool, mt_rand(0, strlen($pool) -1), 1); + for ($i=0; $i < $len; $i++) + { + $str .= substr($pool, mt_rand(0, strlen($pool) -1), 1); } - return $str; + return $str; break; - case 'unique' : return md5(uniqid(mt_rand())); - break; - } + case 'unique' : return md5(uniqid(mt_rand())); + break; + } } // ------------------------------------------------------------------------ diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php index e2da32746..fbc63a9b4 100644 --- a/system/helpers/text_helper.php +++ b/system/helpers/text_helper.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -35,12 +35,12 @@ * @access public * @param string * @param integer - * @param string the end character. Usually an ellipsis + * @param string the end character. Usually an ellipsis * @return string */ function word_limiter($str, $n = 100, $end_char = '…') { - if (strlen($str) < $n) + if (strlen($str) < $n) { return $str; } @@ -53,12 +53,12 @@ function word_limiter($str, $n = 100, $end_char = '…') } $str = ''; - for ($i = 0; $i < $n; $i++) + for ($i = 0; $i < $n; $i++) { $str .= $words[$i].' '; } - return trim($str).$end_char; + return trim($str).$end_char; } // ------------------------------------------------------------------------ @@ -72,12 +72,12 @@ function word_limiter($str, $n = 100, $end_char = '…') * @access public * @param string * @param integer - * @param string the end character. Usually an ellipsis + * @param string the end character. Usually an ellipsis * @return string */ function character_limiter($str, $n = 500, $end_char = '…') { - if (strlen($str) < $n) + if (strlen($str) < $n) { return $str; } @@ -95,7 +95,7 @@ function character_limiter($str, $n = 500, $end_char = '…') $out .= $val.' '; if (strlen($out) >= $n) { - return trim($out).$end_char; + return trim($out).$end_char; } } } @@ -116,14 +116,14 @@ function ascii_to_entities($str) $count = 1; $out = ''; $temp = array(); - + for ($i = 0, $s = strlen($str); $i < $s; $i++) { $ordinal = ord($str[$i]); - + if ($ordinal < 128) { - $out .= $str[$i]; + $out .= $str[$i]; } else { @@ -131,9 +131,9 @@ function ascii_to_entities($str) { $count = ($ordinal < 224) ? 2 : 3; } - + $temp[] = $ordinal; - + if (count($temp) == $count) { $number = ($count == 3) ? (($temp['0'] % 16) * 4096) + (($temp['1'] % 64) * 64) + ($temp['2'] % 64) : (($temp['0'] % 32) * 64) + ($temp['1'] % 64); @@ -141,10 +141,10 @@ function ascii_to_entities($str) $out .= '&#'.$number.';'; $count = 1; $temp = array(); - } - } + } + } } - + return $out; } @@ -169,35 +169,35 @@ function entities_to_ascii($str, $all = TRUE) $digits = $matches['1'][$i]; $out = ''; - + if ($digits < 128) { $out .= chr($digits); - - } + + } elseif ($digits < 2048) { $out .= chr(192 + (($digits - ($digits % 64)) / 64)); $out .= chr(128 + ($digits % 64)); - } + } else { $out .= chr(224 + (($digits - ($digits % 4096)) / 4096)); $out .= chr(128 + ((($digits % 4096) - ($digits % 64)) / 64)); $out .= chr(128 + ($digits % 64)); } - + $str = str_replace($matches['0'][$i], $out, $str); } } - + if ($all) { $str = str_replace(array("&", "<", ">", """, "'", "-"), array("&","<",">","\"", "'", "-"), $str); } - + return $str; } @@ -252,8 +252,8 @@ function word_censor($str, $censored, $replacement = '') */ function highlight_code($str) { - // The highlight string function encodes and highlights - // brackets so we need them to start raw + // The highlight string function encodes and highlights + // brackets so we need them to start raw $str = str_replace(array('<', '>'), array('<', '>'), $str); // Replace any existing PHP tags to temporary markers so they don't accidentally @@ -340,15 +340,15 @@ function word_wrap($str, $chars = '76') $lines = split("\n", $str); $output = ""; - while (list(, $thisline) = each($lines)) + while (list(, $thisline) = each($lines)) { if (strlen($thisline) > $chars) { $line = ""; $words = split(" ", $thisline); - while(list(, $thisword) = each($words)) + while(list(, $thisword) = each($words)) { - while((strlen($thisword)) > $chars) + while((strlen($thisword)) > $chars) { $cur_pos = 0; for($i=0; $i < $chars - 1; $i++) @@ -361,20 +361,20 @@ function word_wrap($str, $chars = '76') $thisword = substr($thisword, $cur_pos, (strlen($thisword) - $cur_pos)); } - if ((strlen($line) + strlen($thisword)) > $chars) + if ((strlen($line) + strlen($thisword)) > $chars) { $output .= $line."\n"; $line = $thisword." "; - } - else + } + else { $line .= $thisword." "; } } $output .= $line."\n"; - } - else + } + else { $output .= $thisline."\n"; } diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php index fe9e3bb92..1681fa37c 100644 --- a/system/helpers/typography_helper.php +++ b/system/helpers/typography_helper.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -46,12 +46,12 @@ function nl2br_except_pre($str) { $newstr .= nl2br($ex[$i]); } - else + else { $newstr .= $ex[$i]; } - if ($ct - 1 != $i) + if ($ct - 1 != $i) $newstr .= "pre>"; } @@ -62,7 +62,7 @@ function nl2br_except_pre($str) /** * Auto Typography Wrapper Function - * + * * * @access public * @param string @@ -78,7 +78,7 @@ function auto_typography($str) /** * Auto Typography Class - * + * * * @access private * @category Helpers @@ -117,7 +117,7 @@ class Auto_typography { /* * Reduce line breaks * - * If there are more than two consecutive line + * If there are more than two consecutive line * breaks we'll compress them down to a maximum * of two since there's no benefit to more. * @@ -127,8 +127,8 @@ class Auto_typography { /* * Convert quotes within tags to temporary marker * - * We don't want quotes converted within - * tags so we'll temporarily convert them to + * We don't want quotes converted within + * tags so we'll temporarily convert them to * {@DQ} and {@SQ} * */ @@ -136,7 +136,7 @@ class Auto_typography { { for ($i = 0; $i < count($matches['0']); $i++) { - $str = str_replace($matches['0'][$i], + $str = str_replace($matches['0'][$i], str_replace(array("'",'"'), array('{@SQ}', '{@DQ}'), $matches['0'][$i]), $str); } @@ -159,7 +159,7 @@ class Auto_typography { * Convert "ignore" tags to temporary marker * * The parser splits out the string at every tag - * it encounters. Certain inline tags, like image + * it encounters. Certain inline tags, like image * tags, links, span tags, etc. will be adversely * affected if they are split out so we'll convert * the opening < temporarily to: {@TAG} @@ -202,7 +202,7 @@ class Auto_typography { * to skip <pre> tags and a few other things. * */ - if (preg_match("#<(/*)(".$this->block_elements.").*?\>#", $chunk, $match)) + if (preg_match("#<(/*)(".$this->block_elements.").*?\>#", $chunk, $match)) { if (preg_match("#".$this->skip_elements."#", $match['2'])) { @@ -244,7 +244,7 @@ class Auto_typography { // Fix an artifact that happens during the paragraph replacement $str = preg_replace('#(<p>\n*</p>)#', '', $str); - // If the user submitted their own paragraph tags with class data + // If the user submitted their own paragraph tags with class data // in them we will retain them instead of using our tags. $str = preg_replace('#(<p.*?>)<p>#', "\\1", $str); @@ -444,8 +444,8 @@ class Auto_typography { } // Ellipsis - $str = preg_replace("#(\w)\.\.\.(\s|<br />|</p>)#", "\\1…\\2", $str); - $str = preg_replace("#(\s|<br />|</p>)\.\.\.(\w)#", "\\1…\\2", $str); + $str = preg_replace("#(\w)\.\.\.(\s|<br />|</p>)#", "\\1…\\2", $str); + $str = preg_replace("#(\s|<br />|</p>)\.\.\.(\w)#", "\\1…\\2", $str); // Run the translation array we defined above $str = str_replace(array_keys($table), array_values($table), $str); @@ -536,5 +536,5 @@ class Auto_typography { } } - + ?>
\ No newline at end of file diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 2f93bcfbf..cd628c6ae 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -30,7 +30,7 @@ /** * Site URL * - * Create a local URL based on your basepath. Segments can be passed via the + * Create a local URL based on your basepath. Segments can be passed via the * first parameter either as a string or an array. * * @access public @@ -38,7 +38,7 @@ * @return string */ function site_url($uri = '') -{ +{ $CI =& get_instance(); return $CI->config->site_url($uri); } @@ -54,7 +54,7 @@ function site_url($uri = '') * @return string */ function base_url() -{ +{ $CI =& get_instance(); return $CI->config->slash_item('base_url'); } @@ -70,7 +70,7 @@ function base_url() * @return string */ function index_page() -{ +{ $CI =& get_instance(); return $CI->config->item('index_page'); } @@ -173,7 +173,7 @@ function anchor_popup($uri = '', $title = '', $attributes = FALSE) */ function mailto($email, $title = '', $attributes = '') { - if ($title == "") + if ($title == "") { $title = $email; } @@ -201,7 +201,7 @@ function mailto($email, $title = '', $attributes = '') */ function safe_mailto($email, $title = '', $attributes = '') { - if ($title == "") + if ($title == "") { $title = $email; } @@ -216,7 +216,7 @@ function safe_mailto($email, $title = '', $attributes = '') $x[] = "|".ord(substr($email, $i, 1)); } - $x[] = '"'; + $x[] = '"'; if ($attributes != '') { @@ -250,7 +250,7 @@ function safe_mailto($email, $title = '', $attributes = '') if ($ordinal < 128) { - $x[] = "|".$ordinal; + $x[] = "|".$ordinal; } else { @@ -266,7 +266,7 @@ function safe_mailto($email, $title = '', $attributes = '') $x[] = "|".$number; $count = 1; $temp = array(); - } + } } } @@ -282,15 +282,15 @@ var l=new Array(); $i = 0; foreach ($x as $val){ ?>l[<?php echo $i++; ?>]='<?php echo $val; ?>';<?php } ?> -for (var i = l.length-1; i >= 0; i=i-1){ -if (l[i].substring(0, 1) == '|') document.write("&#"+unescape(l[i].substring(1))+";"); +for (var i = l.length-1; i >= 0; i=i-1){ +if (l[i].substring(0, 1) == '|') document.write("&#"+unescape(l[i].substring(1))+";"); else document.write(unescape(l[i]));} //]]> </script><?php $buffer = ob_get_contents(); - ob_end_clean(); - return $buffer; + ob_end_clean(); + return $buffer; } // ------------------------------------------------------------------------ @@ -305,7 +305,7 @@ else document.write(unescape(l[i]));} * * @access public * @param string the string - * @param string the type: email, url, or both + * @param string the type: email, url, or both * @param bool whether to create pop-up links * @return string */ @@ -427,7 +427,7 @@ function url_title($str, $separator = 'dash') foreach ($trans as $key => $val) { $str = preg_replace("#".$key."#", $val, $str); - } + } return trim(stripslashes($str)); } @@ -445,12 +445,12 @@ function url_title($str, $separator = 'dash') * @return string */ function redirect($uri = '', $method = 'location') -{ +{ switch($method) { case 'refresh' : header("Refresh:0;url=".site_url($uri)); break; - default : header("location:".site_url($uri)); + default : header("location:".site_url($uri)); break; } exit; diff --git a/system/helpers/xml_helper.php b/system/helpers/xml_helper.php index ee3fc289b..4cc91f4ef 100644 --- a/system/helpers/xml_helper.php +++ b/system/helpers/xml_helper.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -49,7 +49,7 @@ function xml_convert($str) $str = preg_replace("/$temp(\w+);/","&\\1;", $str); return $str; -} +} ?>
\ No newline at end of file diff --git a/system/libraries/Benchmark.php b/system/libraries/Benchmark.php index 44c32a874..66e8a24cf 100644 --- a/system/libraries/Benchmark.php +++ b/system/libraries/Benchmark.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -43,18 +43,18 @@ class CI_Benchmark { * @param string $name name of the marker * @return void */ - function mark($name) - { - $this->marker[$name] = microtime(); - } + function mark($name) + { + $this->marker[$name] = microtime(); + } // -------------------------------------------------------------------- /** * Calculates the time difference between two marked points. * - * If the first parameter is empty this function instead returns the - * {elapsed_time} pseudo-variable. This permits the full system + * If the first parameter is empty this function instead returns the + * {elapsed_time} pseudo-variable. This permits the full system * execution time to be shown in a template. The output class will * swap the real value for this variable. * @@ -64,28 +64,28 @@ class CI_Benchmark { * @param integer the number of decimal places * @return mixed */ - function elapsed_time($point1 = '', $point2 = '', $decimals = 4) - { - if ($point1 == '') - { + function elapsed_time($point1 = '', $point2 = '', $decimals = 4) + { + if ($point1 == '') + { return '{elapsed_time}'; - } - - if ( ! isset($this->marker[$point1])) - { - return ''; - } - - if ( ! isset($this->marker[$point2])) - { - $this->marker[$point2] = microtime(); - } - - list($sm, $ss) = explode(' ', $this->marker[$point1]); - list($em, $es) = explode(' ', $this->marker[$point2]); - - return number_format(($em + $es) - ($sm + $ss), $decimals); - } + } + + if ( ! isset($this->marker[$point1])) + { + return ''; + } + + if ( ! isset($this->marker[$point2])) + { + $this->marker[$point2] = microtime(); + } + + list($sm, $ss) = explode(' ', $this->marker[$point1]); + list($em, $es) = explode(' ', $this->marker[$point2]); + + return number_format(($em + $es) - ($sm + $ss), $decimals); + } // -------------------------------------------------------------------- @@ -93,8 +93,8 @@ class CI_Benchmark { * Memory Usage * * This function returns the {memory_usage} pseudo-variable. - * This permits it to be put it anywhere in a template - * without the memory being calculated until the end. + * This permits it to be put it anywhere in a template + * without the memory being calculated until the end. * The output class will swap the real value for this variable. * * @access public diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php index ec355d24f..84b096c8b 100644 --- a/system/libraries/Calendar.php +++ b/system/libraries/Calendar.php @@ -7,25 +7,25 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * Code Igniter Calendar Class * - * This class enables the creation of calendars + * This class enables the creation of calendars * * @package CodeIgniter * @subpackage Libraries * @category Libraries * @author Rick Ellis * @link http://www.codeigniter.com/user_guide/libraries/calendar.html - */ + */ class CI_Calendar { var $CI; @@ -78,7 +78,7 @@ class CI_Calendar { $this->$key = $val; } } - } + } // -------------------------------------------------------------------- @@ -91,13 +91,13 @@ class CI_Calendar { * @param array the data to be shown in the calendar cells * @return string */ - function generate($year = '', $month = '', $data = array()) - { + function generate($year = '', $month = '', $data = array()) + { // Set and validate the supplied month/year - if ($year == '') - $year = date("Y", $this->local_time); - - if ($month == '') + if ($year == '') + $year = date("Y", $this->local_time); + + if ($month == '') $month = date("m", $this->local_time); if (strlen($year) == 1) @@ -112,10 +112,10 @@ class CI_Calendar { $adjusted_date = $this->adjust_date($month, $year); $month = $adjusted_date['month']; - $year = $adjusted_date['year']; + $year = $adjusted_date['year']; // Determine the total days in the month - $total_days = $this->get_total_days($month, $year); + $total_days = $this->get_total_days($month, $year); // Set the starting day of the week $start_days = array('sunday' => 0, 'monday' => 1, 'tuesday' => 2, 'wednesday' => 3, 'thursday' => 4, 'friday' => 5, 'saturday' => 6); @@ -194,7 +194,7 @@ class CI_Calendar { $out .= $this->temp['week_row_end']; $out .= "\n"; - // Build the main body of the calendar + // Build the main body of the calendar while ($day <= $total_days) { $out .= "\n"; @@ -202,7 +202,7 @@ class CI_Calendar { $out .= "\n"; for ($i = 0; $i < 7; $i++) - { + { $out .= ($is_current_month == TRUE AND $day == $cur_day) ? $this->temp['cal_cell_start_today'] : $this->temp['cal_cell_start']; if ($day > 0 AND $day <= $total_days) @@ -226,27 +226,27 @@ class CI_Calendar { $out .= $this->temp['cal_cell_blank']; } - $out .= ($is_current_month == TRUE AND $day == $cur_day) ? $this->temp['cal_cell_end_today'] : $this->temp['cal_cell_end']; - $day++; + $out .= ($is_current_month == TRUE AND $day == $cur_day) ? $this->temp['cal_cell_end_today'] : $this->temp['cal_cell_end']; + $day++; } - $out .= "\n"; + $out .= "\n"; $out .= $this->temp['cal_row_end']; - $out .= "\n"; + $out .= "\n"; } - $out .= "\n"; + $out .= "\n"; $out .= $this->temp['table_close']; return $out; - } + } // -------------------------------------------------------------------- /** * Get Month Name * - * Generates a textual month name based on the numeric + * Generates a textual month name based on the numeric * month provided. * * @access public @@ -275,12 +275,12 @@ class CI_Calendar { } // -------------------------------------------------------------------- - + /** * Get Day Names * * Returns an array of day names (Sunday, Monday, etc.) based - * on the type. Options: long, short, abrev + * on the type. Options: long, short, abrev * * @access public * @param string @@ -327,32 +327,32 @@ class CI_Calendar { * @param integer the year * @return array */ - function adjust_date($month, $year) - { - $date = array(); - - $date['month'] = $month; - $date['year'] = $year; - - while ($date['month'] > 12) - { - $date['month'] -= 12; - $date['year']++; - } - - while ($date['month'] <= 0) - { - $date['month'] += 12; - $date['year']--; - } - - if (strlen($date['month']) == 1) - { - $date['month'] = '0'.$date['month']; - } - - return $date; - } + function adjust_date($month, $year) + { + $date = array(); + + $date['month'] = $month; + $date['year'] = $year; + + while ($date['month'] > 12) + { + $date['month'] -= 12; + $date['year']++; + } + + while ($date['month'] <= 0) + { + $date['month'] += 12; + $date['year']--; + } + + if (strlen($date['month']) == 1) + { + $date['month'] = '0'.$date['month']; + } + + return $date; + } // -------------------------------------------------------------------- @@ -364,26 +364,26 @@ class CI_Calendar { * @param integer the year * @return integer */ - function get_total_days($month, $year) - { - $days_in_month = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); - - if ($month < 1 OR $month > 12) - { - return 0; - } - - // Is the year a leap year? - if ($month == 2) - { + function get_total_days($month, $year) + { + $days_in_month = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); + + if ($month < 1 OR $month > 12) + { + return 0; + } + + // Is the year a leap year? + if ($month == 2) + { if ($year % 400 == 0 OR ($year % 4 == 0 AND $year % 100 != 0)) { return 29; } - } - - return $days_in_month[$month - 1]; - } + } + + return $days_in_month[$month - 1]; + } // -------------------------------------------------------------------- diff --git a/system/libraries/Config.php b/system/libraries/Config.php index ef6d46a25..aa26c9203 100644 --- a/system/libraries/Config.php +++ b/system/libraries/Config.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -36,12 +36,12 @@ class CI_Config { * * Sets the $config data from the primary config.php file as a class variable * - * @access public - * @param string the config file name - * @param boolean if configuration values should be loaded into their own section - * @param boolean true if errors should just return false, false if an error message should be displayed - * @return boolean if the file was successfully loaded or not - */ + * @access public + * @param string the config file name + * @param boolean if configuration values should be loaded into their own section + * @param boolean true if errors should just return false, false if an error message should be displayed + * @return boolean if the file was successfully loaded or not + */ function CI_Config() { $this->config = get_config(); @@ -62,7 +62,7 @@ class CI_Config { $file = ($file == '') ? 'config' : str_replace(EXT, '', $file); if (in_array($file, $this->is_loaded, TRUE)) - { + { return TRUE; } @@ -125,7 +125,7 @@ class CI_Config { { if ($index == '') { - if ( ! isset($this->config[$item])) + if ( ! isset($this->config[$item])) { return FALSE; } @@ -134,7 +134,7 @@ class CI_Config { } else { - if ( ! isset($this->config[$index])) + if ( ! isset($this->config[$index])) { return FALSE; } @@ -147,7 +147,7 @@ class CI_Config { $pref = $this->config[$index][$item]; } - return $pref; + return $pref; } // -------------------------------------------------------------------- @@ -165,7 +165,7 @@ class CI_Config { */ function slash_item($item) { - if ( ! isset($this->config[$item])) + if ( ! isset($this->config[$item])) { return FALSE; } @@ -179,8 +179,8 @@ class CI_Config { $pref .= '/'; } } - - return $pref; + + return $pref; } // -------------------------------------------------------------------- @@ -195,7 +195,7 @@ class CI_Config { function site_url($uri = '') { if (is_array($uri)) - { + { $uri = implode('/', $uri); } diff --git a/system/libraries/Controller.php b/system/libraries/Controller.php index 3db408bec..b1feee86c 100644 --- a/system/libraries/Controller.php +++ b/system/libraries/Controller.php @@ -7,18 +7,18 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * Code Igniter Application Controller Class * - * This class object is the super class the every library in + * This class object is the super class the every library in * Code Igniter will be assigned to. * * @package CodeIgniter @@ -45,7 +45,7 @@ class Controller extends CI_Base { $this->_ci_initialize(); log_message('debug', "Controller Class Initialized"); } - + // -------------------------------------------------------------------- /** @@ -56,17 +56,17 @@ class Controller extends CI_Base { * * @access private * @return void - */ + */ function _ci_initialize() { // Assign all the class objects that were instantiated by the - // front controller to local class variables so that CI can be + // front controller to local class variables so that CI can be // run as one big super object. $classes = array( - 'config' => 'Config', - 'input' => 'Input', - 'benchmark' => 'Benchmark', - 'uri' => 'URI', + 'config' => 'Config', + 'input' => 'Input', + 'benchmark' => 'Benchmark', + 'uri' => 'URI', 'output' => 'Output', 'lang' => 'Language' ); @@ -76,7 +76,7 @@ class Controller extends CI_Base { $this->$var =& load_class($class); } - // In PHP 5 the Controller class is run as a discreet + // In PHP 5 the Controller class is run as a discreet // class. In PHP 4 it extends the Controller if (floor(phpversion()) >= 5) { @@ -97,8 +97,8 @@ class Controller extends CI_Base { * @access private * @return void */ - function _ci_scaffolding() - { + function _ci_scaffolding() + { if ($this->_ci_scaffolding === FALSE OR $this->_ci_scaff_table === FALSE) { show_404('Scaffolding unavailable'); @@ -109,8 +109,8 @@ class Controller extends CI_Base { require_once(BASEPATH.'scaffolding/Scaffolding'.EXT); $scaff = new Scaffolding($this->_ci_scaff_table); $scaff->$method(); - } - + } + } // END _Controller class diff --git a/system/libraries/Email.php b/system/libraries/Email.php index eb04ae9dc..92f2e73fa 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -87,7 +87,7 @@ class CI_Email { log_message('debug', "Email Class Initialized"); } - + // -------------------------------------------------------------------- /** @@ -116,7 +116,7 @@ class CI_Email { } } } - $this->_smtp_auth = ($this->smtp_user == '' AND $this->smtp_pass == '') ? FALSE : TRUE; + $this->_smtp_auth = ($this->smtp_user == '' AND $this->smtp_pass == '') ? FALSE : TRUE; $this->_safe_mode = (@ini_get("safe_mode") == 0) ? FALSE : TRUE; } @@ -142,12 +142,12 @@ class CI_Email { $this->_set_header('User-Agent', $this->useragent); $this->_set_header('Date', $this->_set_date()); - if ($clear_attachments !== FALSE) - { - $this->_attach_name = array(); - $this->_attach_type = array(); - $this->_attach_disp = array(); - } + if ($clear_attachments !== FALSE) + { + $this->_attach_name = array(); + $this->_attach_type = array(); + $this->_attach_disp = array(); + } } // -------------------------------------------------------------------- @@ -344,9 +344,9 @@ class CI_Email { { $this->_attach_name[] = $filename; $this->_attach_type[] = $this->_mime_types(next(explode('.', basename($filename)))); - $this->_attach_disp[] = $disposition; // Can also be 'inline' Not sure if it matters + $this->_attach_disp[] = $disposition; // Can also be 'inline' Not sure if it matters } - + // -------------------------------------------------------------------- /** @@ -450,7 +450,7 @@ class CI_Email { * @return void */ function set_protocol($protocol = 'mail') - { + { $this->protocol = ( ! in_array($protocol, $this->_protocols, TRUE)) ? 'mail' : strtolower($protocol); } @@ -528,7 +528,7 @@ class CI_Email { $from = str_replace(">", "", $from); $from = str_replace("<", "", $from); - return "<".uniqid('').strstr($from, '@').">"; + return "<".uniqid('').strstr($from, '@').">"; } // -------------------------------------------------------------------- @@ -545,7 +545,7 @@ class CI_Email { $this->protocol = strtolower($this->protocol); $this->protocol = ( ! in_array($this->protocol, $this->_protocols, TRUE)) ? 'mail' : $this->protocol; - if ($return == true) + if ($return == true) return $this->protocol; } @@ -562,13 +562,13 @@ class CI_Email { { $this->_encoding = ( ! in_array($this->_encoding, $this->_bit_depths)) ? '7bit' : $this->_encoding; - if ( ! in_array($this->charset, $this->_base_charsets, TRUE)) + if ( ! in_array($this->charset, $this->_base_charsets, TRUE)) $this->_encoding = "8bit"; - if ($return == true) + if ($return == true) return $this->_encoding; } - + // -------------------------------------------------------------------- /** @@ -641,7 +641,7 @@ class CI_Email { foreach ($email as $val) { - if ( ! $this->valid_email($val)) + if ( ! $this->valid_email($val)) { $this->_set_error_message('email_invalid_address', $val); return FALSE; @@ -662,7 +662,7 @@ class CI_Email { { if ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $address)) return FALSE; - else + else return TRUE; } @@ -680,19 +680,19 @@ class CI_Email { if ( ! is_array($email)) { if (preg_match('/\<(.*)\>/', $email, $match)) - return $match['1']; - else - return $email; + return $match['1']; + else + return $email; } $clean_email = array(); - for ($i=0; $i < count($email); $i++) + for ($i=0; $i < count($email); $i++) { if (preg_match( '/\<(.*)\>/', $email[$i], $match)) - $clean_email[] = $match['1']; - else - $clean_email[] = $email[$i]; + $clean_email[] = $match['1']; + else + $clean_email[] = $email[$i]; } return $clean_email; @@ -705,7 +705,7 @@ class CI_Email { * * This function provides the raw message for use * in plain-text headers of HTML-formatted emails. - * If the user hasn't specified his own alternative message + * If the user hasn't specified his own alternative message * it creates one by stripping the HTML * * @access private @@ -764,7 +764,7 @@ class CI_Email { $output = ""; - while (list(, $thisline) = each($lines)) + while (list(, $thisline) = each($lines)) { if (strlen($thisline) > $chars) { @@ -772,9 +772,9 @@ class CI_Email { $words = split(" ", $thisline); - while(list(, $thisword) = each($words)) + while(list(, $thisword) = each($words)) { - while((strlen($thisword)) > $chars) + while((strlen($thisword)) > $chars) { if (stristr($thisword, '{unwrap}') !== FALSE OR stristr($thisword, '{/unwrap}') !== FALSE) { @@ -794,21 +794,21 @@ class CI_Email { $thisword = substr($thisword, $cur_pos, (strlen($thisword) - $cur_pos)); } - if ((strlen($line) + strlen($thisword)) > $chars) + if ((strlen($line) + strlen($thisword)) > $chars) { $output .= $line."\n"; $line = $thisword." "; - } - else + } + else { $line .= $thisword." "; } } $output .= $line."\n"; - } - else + } + else { $output .= $thisline."\n"; } @@ -854,7 +854,7 @@ class CI_Email { reset($this->_headers); $this->_header_str = ""; - foreach($this->_headers as $key => $val) + foreach($this->_headers as $key => $val) { $val = trim($val); @@ -972,7 +972,7 @@ class CI_Email { { $this->_header_str .= $hdr; - $body = $this->_body . $this->newline . $this->newline; + $body = $this->_body . $this->newline . $this->newline; $body .= "--" . $this->_alt_boundary . "--" . $this->newline . $this->newline; } @@ -995,7 +995,7 @@ class CI_Email { if ( ! file_exists($filename)) { - $this->_set_error_message('email_attachment_missing', $filename); + $this->_set_error_message('email_attachment_missing', $filename); return FALSE; } @@ -1010,7 +1010,7 @@ class CI_Email { if ( ! $fp = fopen($filename, 'r')) { - $this->_set_error_message('email_attachment_unredable', $filename); + $this->_set_error_message('email_attachment_unredable', $filename); return FALSE; } @@ -1128,10 +1128,10 @@ class CI_Email { * @access private * @return void */ - function _unwrap_specials() - { - $this->_finalbody = preg_replace_callback("/\{unwrap\}(.*?)\{\/unwrap\}/si", array($this, '_remove_nl_callback'), $this->_finalbody); - } + function _unwrap_specials() + { + $this->_finalbody = preg_replace_callback("/\{unwrap\}(.*?)\{\/unwrap\}/si", array($this, '_remove_nl_callback'), $this->_finalbody); + } // -------------------------------------------------------------------- @@ -1141,10 +1141,10 @@ class CI_Email { * @access private * @return string */ - function _remove_nl_callback($matches) - { - return preg_replace("/(\r\n)|(\r)|(\n)/", "", $matches['1']); - } + function _remove_nl_callback($matches) + { + return preg_replace("/(\r\n)|(\r)|(\n)/", "", $matches['1']); + } // -------------------------------------------------------------------- @@ -1156,7 +1156,7 @@ class CI_Email { */ function _spool_email() { - $this->_unwrap_specials(); + $this->_unwrap_specials(); switch ($this->_get_protocol()) { @@ -1168,7 +1168,7 @@ class CI_Email { return FALSE; } break; - case 'sendmail' : + case 'sendmail' : if ( ! $this->_send_with_sendmail()) { @@ -1176,7 +1176,7 @@ class CI_Email { return FALSE; } break; - case 'smtp' : + case 'smtp' : if ( ! $this->_send_with_smtp()) { @@ -1252,8 +1252,8 @@ class CI_Email { */ function _send_with_smtp() { - if ($this->smtp_host == '') - { + if ($this->smtp_host == '') + { $this->_set_error_message('email_no_hostname'); return FALSE; } @@ -1316,10 +1316,10 @@ class CI_Email { function _smtp_connect() { - $this->_smtp_connect = fsockopen($this->smtp_host, + $this->_smtp_connect = fsockopen($this->smtp_host, $this->smtp_port, - $errno, - $errstr, + $errno, + $errstr, $this->smtp_timeout); if( ! is_resource($this->_smtp_connect)) @@ -1478,17 +1478,17 @@ class CI_Email { */ function _get_smtp_data() { - $data = ""; - - while ($str = fgets($this->_smtp_connect, 512)) - { + $data = ""; + + while ($str = fgets($this->_smtp_connect, 512)) + { $data .= $str; if (substr($str, 3, 1) == " ") break; - } - - return $data; + } + + return $data; } // -------------------------------------------------------------------- @@ -1567,7 +1567,6 @@ class CI_Email { $msg .= "<pre>".$this->_header_str."\n".$this->_subject."\n".$this->_finalbody.'</pre>'; return $msg; } - // print_debugger() // -------------------------------------------------------------------- diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php index b7dba2523..0f860a967 100644 --- a/system/libraries/Encrypt.php +++ b/system/libraries/Encrypt.php @@ -7,7 +7,7 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource @@ -98,12 +98,12 @@ class CI_Encrypt { /** * Encode * - * Encodes the message string using bitwise XOR encoding. - * The key is combined with a random hash, and then it - * too gets converted using XOR. The whole thing is then run - * through mcrypt (if supported) using the randomized key. - * The end result is a double-encrypted message string - * that is randomized with each call to this function, + * Encodes the message string using bitwise XOR encoding. + * The key is combined with a random hash, and then it + * too gets converted using XOR. The whole thing is then run + * through mcrypt (if supported) using the randomized key. + * The end result is a double-encrypted message string + * that is randomized with each call to this function, * even if the supplied message and key are the same. * * @access public @@ -169,8 +169,8 @@ class CI_Encrypt { function _xor_encode($string, $key) { $rand = ''; - while (strlen($rand) < 32) - { + while (strlen($rand) < 32) + { $rand .= mt_rand(0, mt_getrandmax()); } @@ -190,7 +190,7 @@ class CI_Encrypt { /** * XOR Decode * - * Takes an encoded string and key as input and generates the + * Takes an encoded string and key as input and generates the * plain-text original message * * @access private @@ -245,7 +245,7 @@ class CI_Encrypt { * @param string * @return string */ - function mcrypt_encode($data, $key) + function mcrypt_encode($data, $key) { $init_size = mcrypt_get_iv_size($this->_get_cipher(), $this->_get_mode()); $init_vect = mcrypt_create_iv($init_size, MCRYPT_RAND); @@ -262,7 +262,7 @@ class CI_Encrypt { * @param string * @return string */ - function mcrypt_decode($data, $key) + function mcrypt_decode($data, $key) { $init_size = mcrypt_get_iv_size($this->_get_cipher(), $this->_get_mode()); $init_vect = mcrypt_create_iv($init_size, MCRYPT_RAND); @@ -307,7 +307,7 @@ class CI_Encrypt { */ function _get_cipher() { - if ($this->_mcrypt_cipher == '') + if ($this->_mcrypt_cipher == '') { $this->_mcrypt_cipher = MCRYPT_RIJNDAEL_256; } @@ -325,7 +325,7 @@ class CI_Encrypt { */ function _get_mode() { - if ($this->_mcrypt_mode == '') + if ($this->_mcrypt_mode == '') { $this->_mcrypt_mode = MCRYPT_MODE_ECB; } @@ -378,7 +378,7 @@ class CI_Encrypt { { require_once(BASEPATH.'libraries/Sha1'.EXT); $SH = new CI_SHA; - return $SH->generate($str); + return $SH->generate($str); } else { @@ -389,7 +389,7 @@ class CI_Encrypt { { return sha1($str); } - } + } } diff --git a/system/libraries/Exceptions.php b/system/libraries/Exceptions.php index a0591e4e5..6d58ee6b9 100644 --- a/system/libraries/Exceptions.php +++ b/system/libraries/Exceptions.php @@ -7,17 +7,17 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * Exceptions Class - * + * * @package CodeIgniter * @subpackage Libraries * @category Exceptions @@ -48,7 +48,7 @@ class CI_Exceptions { /** - * Constructor + * Constructor * */ function CI_Exceptions() @@ -76,7 +76,7 @@ class CI_Exceptions { log_message('error', 'Severity: '.$severity.' '.$severity.' --> '.$message. ' '.$filepath.' '.$line, TRUE); } - + // -------------------------------------------------------------------- /** @@ -89,7 +89,7 @@ class CI_Exceptions { function show_404($page = '') { $heading = "404 Page Not Found"; - $message = "The page you requested was not found."; + $message = "The page you requested was not found."; log_message('error', '404 Page Not Found --> '.$page); echo $this->show_error($heading, $message, 'error_404'); @@ -125,7 +125,7 @@ class CI_Exceptions { ob_end_clean(); return $buffer; } - + // -------------------------------------------------------------------- /** diff --git a/system/libraries/Hooks.php b/system/libraries/Hooks.php index 6f48723f6..99d2e3e30 100644 --- a/system/libraries/Hooks.php +++ b/system/libraries/Hooks.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -132,7 +132,7 @@ class CI_Hooks { // Safety - Prevents run-away loops // ----------------------------------- - // If the script being called happens to have the same + // If the script being called happens to have the same // hook call within it a loop can happen if ($this->in_progress == TRUE) @@ -164,17 +164,17 @@ class CI_Hooks { $function = FALSE; $params = ''; - if (isset($data['class']) AND $data['class'] != '') + if (isset($data['class']) AND $data['class'] != '') { $class = $data['class']; } - if (isset($data['function'])) + if (isset($data['function'])) { $function = $data['function']; } - if (isset($data['params'])) + if (isset($data['params'])) { $params = $data['params']; } diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index f8c05f834..561c5c03a 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -7,17 +7,17 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * Image Manipulation class - * + * * @package CodeIgniter * @subpackage Libraries * @category Image_lib @@ -77,7 +77,7 @@ class CI_Image_lib { var $wm_use_truetype = FALSE; /** - * Constructor + * Constructor * * @access public * @param string @@ -123,7 +123,7 @@ class CI_Image_lib { * @return void */ function initialize($props = array()) - { + { /* * Convert array elements into class variables */ @@ -144,7 +144,7 @@ class CI_Image_lib { if ($this->source_image == '') { $this->set_error('imglib_source_image_required'); - return FALSE; + return FALSE; } /* @@ -155,7 +155,7 @@ class CI_Image_lib { * properties using ImageMagick and NetPBM * */ - if ( ! function_exists('getimagesize')) + if ( ! function_exists('getimagesize')) { $this->set_error('imglib_gd_required_for_props'); return FALSE; @@ -173,7 +173,7 @@ class CI_Image_lib { */ if (function_exists('realpath') AND @realpath($this->source_image) !== FALSE) { - $full_source_path = str_replace("\\", "/", realpath($this->source_image)); + $full_source_path = str_replace("\\", "/", realpath($this->source_image)); } else { @@ -187,7 +187,7 @@ class CI_Image_lib { // Set the Image Properties if ( ! $this->get_image_properties($this->source_folder.$this->source_image)) { - return FALSE; + return FALSE; } /* @@ -215,11 +215,11 @@ class CI_Image_lib { { if (function_exists('realpath') AND @realpath($this->new_image) !== FALSE) { - $full_dest_path = str_replace("\\", "/", realpath($this->new_image)); + $full_dest_path = str_replace("\\", "/", realpath($this->new_image)); } else { - $full_dest_path = $this->new_image; + $full_dest_path = $this->new_image; } // Is there a file name? @@ -257,7 +257,7 @@ class CI_Image_lib { $filename = $xp['name']; $file_ext = $xp['ext']; - $this->full_src_path = $this->source_folder.$this->source_image; + $this->full_src_path = $this->source_folder.$this->source_image; $this->full_dst_path = $this->dest_folder.$filename.$this->thumb_marker.$file_ext; /* @@ -316,7 +316,7 @@ class CI_Image_lib { if ($this->wm_overlay_path != '') { - $this->wm_overlay_path = str_replace("\\", "/", realpath($this->wm_overlay_path)); + $this->wm_overlay_path = str_replace("\\", "/", realpath($this->wm_overlay_path)); } if ($this->wm_shadow_color != '') @@ -330,7 +330,7 @@ class CI_Image_lib { } return TRUE; - } + } // -------------------------------------------------------------------- @@ -397,7 +397,7 @@ class CI_Image_lib { if ($this->rotation_angle == '' OR ! in_array($this->rotation_angle, $degs, TRUE)) { $this->set_error('imglib_rotation_angle_required'); - return FALSE; + return FALSE; } // Reassign the width and height @@ -454,7 +454,7 @@ class CI_Image_lib { // We'll return true so the user thinks the process succeeded. // It'll be our little secret... - return TRUE; + return TRUE; } // Reassign the source width/height if cropping @@ -478,7 +478,7 @@ class CI_Image_lib { if ( ! @copy($this->full_src_path, $this->full_dst_path)) { $this->set_error('imglib_copy_failed'); - return FALSE; + return FALSE; } @chmod($this->full_dst_path, 0777); @@ -508,12 +508,12 @@ class CI_Image_lib { $copy = 'imagecopyresized'; } - $dst_img = $create($this->width, $this->height); - $copy($dst_img, $src_img, 0, 0, $this->x_axis, $this->y_axis, $this->width, $this->height, $this->orig_width, $this->orig_height); + $dst_img = $create($this->width, $this->height); + $copy($dst_img, $src_img, 0, 0, $this->x_axis, $this->y_axis, $this->width, $this->height, $this->orig_width, $this->orig_height); // Show the image if ($this->dynamic_output == TRUE) - { + { $this->image_display_gd($dst_img); } else @@ -526,11 +526,11 @@ class CI_Image_lib { } // Kill the file handles - imagedestroy($dst_img); + imagedestroy($dst_img); imagedestroy($src_img); // Set the file to 777 - @chmod($this->full_dst_path, 0777); + @chmod($this->full_dst_path, 0777); return TRUE; } @@ -555,7 +555,7 @@ class CI_Image_lib { return FALSE; } - if ( ! eregi("convert$", $this->library_path)) + if ( ! eregi("convert$", $this->library_path)) { if ( ! eregi("/$", $this->library_path)) $this->library_path .= "/"; @@ -593,14 +593,14 @@ class CI_Image_lib { @exec($cmd, $output, $retval); // Did it work? - if ($retval > 0) + if ($retval > 0) { $this->set_error('imglib_image_process_failed'); return FALSE; } // Set the file to 777 - @chmod($this->full_dst_path, 0777); + @chmod($this->full_dst_path, 0777); return TRUE; } @@ -675,7 +675,7 @@ class CI_Image_lib { @exec($cmd, $output, $retval); // Did it work? - if ($retval > 0) + if ($retval > 0) { $this->set_error('imglib_image_process_failed'); return FALSE; @@ -686,7 +686,7 @@ class CI_Image_lib { // we have to rename the temp file. copy ($this->dest_folder.'netpbm.tmp', $this->full_dst_path); unlink ($this->dest_folder.'netpbm.tmp'); - @chmod($dst_image, 0777); + @chmod($dst_image, 0777); return TRUE; } @@ -704,7 +704,7 @@ class CI_Image_lib { // Is Image Rotation Supported? // this function is only supported as of PHP 4.3 if ( ! function_exists('imagerotate')) - { + { $this->set_error('imglib_rotate_unsupported'); return FALSE; } @@ -727,7 +727,7 @@ class CI_Image_lib { // Save the Image if ($this->dynamic_output == TRUE) - { + { $this->image_display_gd($dst_img); } else @@ -740,12 +740,12 @@ class CI_Image_lib { } // Kill the file handles - imagedestroy($dst_img); + imagedestroy($dst_img); imagedestroy($src_img); // Set the file to 777 - @chmod($this->full_dst_path, 0777); + @chmod($this->full_dst_path, 0777); return true; } @@ -773,47 +773,47 @@ class CI_Image_lib { if ($this->rotation_angle == 'hor') { for ($i = 0; $i < $height; $i++) - { - $left = 0; - $right = $width-1; + { + $left = 0; + $right = $width-1; while ($left < $right) - { - $cl = imagecolorat($src_img, $left, $i); + { + $cl = imagecolorat($src_img, $left, $i); $cr = imagecolorat($src_img, $right, $i); - imagesetpixel($src_img, $left, $i, $cr); - imagesetpixel($src_img, $right, $i, $cl); + imagesetpixel($src_img, $left, $i, $cr); + imagesetpixel($src_img, $right, $i, $cl); - $left++; - $right--; - } + $left++; + $right--; + } } } else { for ($i = 0; $i < $width; $i++) - { - $top = 0; - $bot = $height-1; + { + $top = 0; + $bot = $height-1; while ($top < $bot) - { + { $ct = imagecolorat($src_img, $i, $top); $cb = imagecolorat($src_img, $i, $bot); - imagesetpixel($src_img, $i, $top, $cb); - imagesetpixel($src_img, $i, $bot, $ct); + imagesetpixel($src_img, $i, $top, $cb); + imagesetpixel($src_img, $i, $bot, $ct); - $top++; - $bot--; - } + $top++; + $bot--; + } } } // Show the image if ($this->dynamic_output == TRUE) - { + { $this->image_display_gd($src_img); } else @@ -829,7 +829,7 @@ class CI_Image_lib { imagedestroy($src_img); // Set the file to 777 - @chmod($this->full_dst_path, 0777); + @chmod($this->full_dst_path, 0777); return TRUE; } @@ -930,8 +930,8 @@ class CI_Image_lib { } // Build the finalized image - if ($wm_img_type == 3 AND function_exists('imagealphablending')) - { + if ($wm_img_type == 3 AND function_exists('imagealphablending')) + { @imagealphablending($src_img, TRUE); } @@ -941,7 +941,7 @@ class CI_Image_lib { // Output the image if ($this->dynamic_output == TRUE) - { + { $this->image_display_gd($src_img); } else @@ -966,7 +966,7 @@ class CI_Image_lib { * @access public * @return bool */ - function text_watermark() + function text_watermark() { if ( ! ($src_img = $this->image_create_gd())) { @@ -1039,7 +1039,7 @@ class CI_Image_lib { $this->wm_vrt_alignment = strtoupper(substr($this->wm_vrt_alignment, 0, 1)); $this->wm_hor_alignment = strtoupper(substr($this->wm_hor_alignment, 0, 1)); - switch ($this->wm_vrt_alignment) + switch ($this->wm_vrt_alignment) { case "T" : break; @@ -1053,7 +1053,7 @@ class CI_Image_lib { $y_shad = $y_axis + $this->wm_shadow_distance; // Set horizontal alignment - switch ($this->wm_hor_alignment) + switch ($this->wm_hor_alignment) { case "L": break; @@ -1085,7 +1085,7 @@ class CI_Image_lib { // Output the final image if ($this->dynamic_output == TRUE) - { + { $this->image_display_gd($src_img); } else @@ -1160,7 +1160,7 @@ class CI_Image_lib { /** * Write image file to disk - GD * - * Takes an image resource as input and writes the file + * Takes an image resource as input and writes the file * to the specified destination * * @access public @@ -1226,7 +1226,7 @@ class CI_Image_lib { header("Content-Disposition: filename={$this->source_image};"); header("Content-Type: {$this->mime_type}"); header('Content-Transfer-Encoding: binary'); - header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT'); + header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT'); switch ($this->image_type) { @@ -1247,9 +1247,9 @@ class CI_Image_lib { * Re-proportion Image Width/Height * * When creating thumbs, the desired width/height - * can end up warping the image due to an incorrect - * ratio between the full-sized image and the thumb. - * + * can end up warping the image due to an incorrect + * ratio between the full-sized image and the thumb. + * * This function lets us re-proportion the width/height * if users choose to maintain the aspect ratio when resizing. * @@ -1323,7 +1323,7 @@ class CI_Image_lib { $v['width'] = $vals['0']; $v['height'] = $vals['1']; $v['image_type'] = $vals['2']; - $v['size_str'] = $vals['3']; + $v['size_str'] = $vals['3']; $v['mime_type'] = $mime; return $v; @@ -1332,8 +1332,8 @@ class CI_Image_lib { $this->orig_width = $vals['0']; $this->orig_height = $vals['1']; $this->image_type = $vals['2']; - $this->size_str = $vals['3']; - $this->mime_type = $mime; + $this->size_str = $vals['3']; + $this->mime_type = $mime; return TRUE; } @@ -1352,7 +1352,7 @@ class CI_Image_lib { * 'height' => $height, * 'new_width' => 40, * 'new_height' => '' - * ); + * ); * * @access public * @param array diff --git a/system/libraries/Input.php b/system/libraries/Input.php index 57696c8a2..8408b16fc 100644 --- a/system/libraries/Input.php +++ b/system/libraries/Input.php @@ -7,17 +7,17 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * Input Class - * + * * Pre-processes global input data for security * * @package CodeIgniter @@ -103,7 +103,7 @@ class CI_Input { if (is_array($_COOKIE) AND count($_COOKIE) > 0) { foreach($_COOKIE as $key => $val) - { + { $_COOKIE[$this->_clean_input_keys($key)] = $this->_clean_input_data($val); } } @@ -116,7 +116,7 @@ class CI_Input { /** * Clean Input Data * - * This is a helper function. It escapes data and + * This is a helper function. It escapes data and * standardizes newline characters to \n * * @access private @@ -149,8 +149,8 @@ class CI_Input { /** * Clean Keys * - * This is a helper function. To prevent malicious users - * from trying to exploit keys we make sure that keys are + * This is a helper function. To prevent malicious users + * from trying to exploit keys we make sure that keys are * only named with alpha-numeric text and a few other items. * * @access private @@ -160,7 +160,7 @@ class CI_Input { function _clean_input_keys($str) { if ( ! preg_match("/^[a-z0-9:_\/-]+$/i", $str)) - { + { exit('Disallowed Key Characters: '.$str); } @@ -378,7 +378,7 @@ class CI_Input { * got from Bitflux: http://blog.bitflux.ch/wiki/XSS_Prevention * * To help develop this script I used this great list of - * vulnerabilities along with a few other hacks I've + * vulnerabilities along with a few other hacks I've * harvested from examining vulnerabilities in other programs: * http://ha.ckers.org/xss.html * @@ -408,7 +408,7 @@ class CI_Input { $str = preg_replace('#(&\#*\w+)[\x00-\x20]+;#u',"\\1;",$str); /* - * Validate UTF16 two byte encoding (x00) + * Validate UTF16 two byte encoding (x00) * * Just as above, adds a semicolon if missing. * @@ -429,20 +429,20 @@ class CI_Input { $str = preg_replace("/%([a-z0-9]{2})/i", "&#x\\1;", $str); /* - * Convert character entities to ASCII + * Convert character entities to ASCII * * This permits our tests below to work reliably. * We only convert entities that are within tags since * these are the ones that will pose security problems. * */ - + if (preg_match_all("/<(.+?)>/si", $str, $matches)) { for ($i = 0; $i < count($matches['0']); $i++) { - $str = str_replace($matches['1'][$i], - $this->_html_entity_decode($matches['1'][$i], $charset), + $str = str_replace($matches['1'][$i], + $this->_html_entity_decode($matches['1'][$i], $charset), $str); } } @@ -500,7 +500,7 @@ class CI_Input { * Remove JavaScript Event Handlers * * Note: This code is a little blunt. It removes - * the event handler and anything up to the closing >, + * the event handler and anything up to the closing >, * but it's unlikely to be a problem. * */ @@ -509,7 +509,7 @@ class CI_Input { /* * Sanitize naughty HTML elements * - * If a tag containing any of the words in the list + * If a tag containing any of the words in the list * below is found, the tag gets converted to entities. * * So this: <blink> @@ -552,7 +552,7 @@ class CI_Input { foreach ($bad as $key => $val) { - $str = preg_replace("#".$key."#i", $val, $str); + $str = preg_replace("#".$key."#i", $val, $str); } @@ -582,11 +582,11 @@ class CI_Input { /* -------------------------------------------------*/ /* - NOTE: html_entity_decode() has a bug in some PHP versions when UTF-8 is the + NOTE: html_entity_decode() has a bug in some PHP versions when UTF-8 is the character set, and the PHP developers said they were not back porting the fix to versions other than PHP 5.x. */ - function _html_entity_decode($str, $charset='ISO-8859-1') + function _html_entity_decode($str, $charset='ISO-8859-1') { if (stristr($str, '&') === FALSE) return $str; diff --git a/system/libraries/Language.php b/system/libraries/Language.php index 825080745..37a5c7e99 100644 --- a/system/libraries/Language.php +++ b/system/libraries/Language.php @@ -7,17 +7,17 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * Language Class - * + * * @package CodeIgniter * @subpackage Libraries * @category Language @@ -30,7 +30,7 @@ class CI_Language { var $is_loaded = array(); /** - * Constructor + * Constructor * * @access public */ @@ -83,7 +83,7 @@ class CI_Language { } } - + if ( ! isset($lang)) { log_message('error', 'Language file contains no data: language/'.$idiom.'/'.$langfile); diff --git a/system/libraries/Loader.php b/system/libraries/Loader.php index 849ee731a..7a1fd6802 100644 --- a/system/libraries/Loader.php +++ b/system/libraries/Loader.php @@ -7,17 +7,17 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * Loader Class - * + * * Loads views and files * * @package CodeIgniter @@ -192,7 +192,7 @@ class CI_Loader { * Load the Utilities Class * * @access public - * @return string + * @return string */ function dbutil() { @@ -550,9 +550,9 @@ class CI_Loader { /* * Extract and cache variables * - * You can either set variables using the dedicated $this->load_vars() - * function or via the second parameter of this function. We'll merge - * the two types and cache them so that views that are embedded within + * You can either set variables using the dedicated $this->load_vars() + * function or via the second parameter of this function. We'll merge + * the two types and cache them so that views that are embedded within * other views can have access to these variables. */ if (is_array($vars)) @@ -579,9 +579,9 @@ class CI_Loader { * * We buffer the output for two reasons: * 1. Speed. You get a significant speed boost. - * 2. So that the final rendered template can be + * 2. So that the final rendered template can be * post-processed by the output class. Why do we - * need post processing? For one thing, in order to + * need post processing? For one thing, in order to * show the elapsed page load time. Unless we * can intercept the content right before it's sent to * the browser and then stop the timer it won't be accurate. @@ -612,7 +612,7 @@ class CI_Loader { if ($return === TRUE) { $buffer = ob_get_contents(); - ob_end_clean(); + ob_end_clean(); return $buffer; } @@ -621,9 +621,9 @@ class CI_Loader { * Flush the buffer... or buff the flusher? * * In order to permit views to be nested within - * other views, we need to flush the content back out whenever - * we are beyond the first level of output buffering so that - * it can be seen and included properly by the first included + * other views, we need to flush the content back out whenever + * we are beyond the first level of output buffering so that + * it can be seen and included properly by the first included * template and any subsequent ones. Oy! * */ @@ -702,7 +702,7 @@ class CI_Loader { { // Is there an associated config file for this class? if ($config !== NULL) - { + { $cong = NULL; if (file_exists(APPPATH.'config/'.$class.EXT)) { @@ -740,7 +740,7 @@ class CI_Loader { /** * Autoloader * - * The config/autoload.php file contains an array that permits sub-systems, + * The config/autoload.php file contains an array that permits sub-systems, * libraries, plugins, and helpers to be loaded automatically. * * @access private @@ -785,14 +785,14 @@ class CI_Loader { // Load libraries if (isset($autoload['libraries']) AND count($autoload['libraries']) > 0) { - // Load the database driver. + // Load the database driver. if (in_array('database', $autoload['libraries'])) { $this->database(); $autoload['libraries'] = array_diff($autoload['libraries'], array('database')); } - // Load the model class. + // Load the model class. if (in_array('model', $autoload['libraries'])) { $this->model(); diff --git a/system/libraries/Log.php b/system/libraries/Log.php index 09538fa0b..03dc64005 100644 --- a/system/libraries/Log.php +++ b/system/libraries/Log.php @@ -7,17 +7,17 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * Logging Class - * + * * @package CodeIgniter * @subpackage Libraries * @category Logging @@ -78,7 +78,7 @@ class CI_Log { function write_log($level = 'error', $msg, $php_error = FALSE) { if ($this->_enabled === FALSE) - { + { return FALSE; } diff --git a/system/libraries/Model.php b/system/libraries/Model.php index 017a9c6d8..240db4397 100644 --- a/system/libraries/Model.php +++ b/system/libraries/Model.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -41,7 +41,7 @@ class Model { * Assign Libraries * * Creates local references to all currently instantiated objects - * so that any syntax that can be legally used in a controller + * so that any syntax that can be legally used in a controller * can be used within models. * * @access private diff --git a/system/libraries/Output.php b/system/libraries/Output.php index 9c48bbb84..0c2620df7 100644 --- a/system/libraries/Output.php +++ b/system/libraries/Output.php @@ -7,19 +7,19 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * Output Class * * Responsible for sending final output to browser - * + * * @package CodeIgniter * @subpackage Libraries * @category Output @@ -42,7 +42,7 @@ class CI_Output { // -------------------------------------------------------------------- /** - * Get Output + * Get Output * * Returns the current output string * @@ -57,7 +57,7 @@ class CI_Output { // -------------------------------------------------------------------- /** - * Set Output + * Set Output * * Sets the output string * @@ -73,7 +73,7 @@ class CI_Output { // -------------------------------------------------------------------- /** - * Set Header + * Set Header * * Lets you set a server header which will be outputted with the final display. * @@ -92,7 +92,7 @@ class CI_Output { // -------------------------------------------------------------------- /** - * Enable/disable Profiler + * Enable/disable Profiler * * @access public * @param bool @@ -106,7 +106,7 @@ class CI_Output { // -------------------------------------------------------------------- /** - * Set Cache + * Set Cache * * @access public * @param integer @@ -135,8 +135,8 @@ class CI_Output { */ function _display($output = '') { - // Note: We use globals because we can't use $CI =& get_instance() - // since this function is sometimes called by the caching mechanism, + // Note: We use globals because we can't use $CI =& get_instance() + // since this function is sometimes called by the caching mechanism, // which happens before the CI super object is available. global $BM, $CFG; @@ -158,7 +158,7 @@ class CI_Output { // -------------------------------------------------------------------- - // Parse out the elapsed time and memory usage, + // Parse out the elapsed time and memory usage, // then swap the pseudo-variables with the data $elapsed = $BM->elapsed_time('total_execution_time_start', 'total_execution_time_end'); @@ -249,7 +249,7 @@ class CI_Output { // -------------------------------------------------------------------- /** - * Write a Cache File + * Write a Cache File * * @access public * @return void @@ -272,19 +272,19 @@ class CI_Output { $cache_path .= md5($uri); - if ( ! $fp = @fopen($cache_path, 'wb')) - { + if ( ! $fp = @fopen($cache_path, 'wb')) + { log_message('error', "Unable to write ache file: ".$cache_path); - return; + return; } $expire = time() + ($this->cache_expiration * 60); - flock($fp, LOCK_EX); - fwrite($fp, $expire.'TS--->'.$output); - flock($fp, LOCK_UN); - fclose($fp); - @chmod($cache_path, 0777); + flock($fp, LOCK_EX); + fwrite($fp, $expire.'TS--->'.$output); + flock($fp, LOCK_UN); + fclose($fp); + @chmod($cache_path, 0777); log_message('debug', "Cache file written: ".$cache_path); } @@ -292,7 +292,7 @@ class CI_Output { // -------------------------------------------------------------------- /** - * Update/serve a cached file + * Update/serve a cached file * * @access public * @return void @@ -329,13 +329,13 @@ class CI_Output { flock($fp, LOCK_SH); $cache = ''; - if (filesize($filepath) > 0) + if (filesize($filepath) > 0) { - $cache = fread($fp, filesize($filepath)); + $cache = fread($fp, filesize($filepath)); } flock($fp, LOCK_UN); - fclose($fp); + fclose($fp); // Strip out the embedded timestamp if ( ! preg_match("/(\d+TS--->)/", $cache, $match)) diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index 26fb93ee4..a004419d6 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -7,7 +7,7 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource @@ -28,13 +28,13 @@ class CI_Pagination { var $base_url = ''; // The page we are linking to 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 + 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 var $first_link = '‹ First'; var $next_link = '>'; var $prev_link = '<'; - var $last_link = 'Last ›'; + var $last_link = 'Last ›'; var $uri_segment = 3; var $full_tag_open = ''; var $full_tag_close = ''; @@ -57,15 +57,15 @@ class CI_Pagination { * @access public * @param array initialization parameters */ - function CI_Pagination($params = array()) - { + function CI_Pagination($params = array()) + { if (count($params) > 0) { $this->initialize($params); } log_message('debug', "Pagination Class Initialized"); - } + } // -------------------------------------------------------------------- @@ -76,8 +76,8 @@ class CI_Pagination { * @param array initialization parameters * @return void */ - function initialize($params = array()) - { + function initialize($params = array()) + { if (count($params) > 0) { foreach ($params as $key => $val) @@ -88,7 +88,7 @@ class CI_Pagination { } } } - } + } // -------------------------------------------------------------------- @@ -98,34 +98,34 @@ class CI_Pagination { * @access public * @return string */ - function create_links() - { + function create_links() + { // If our item count or per-page total is zero there is no need to continue. - if ($this->total_rows == 0 OR $this->per_page == 0) - { - return ''; - } + if ($this->total_rows == 0 OR $this->per_page == 0) + { + return ''; + } // Calculate the total number of pages - $num_pages = ceil($this->total_rows / $this->per_page); + $num_pages = ceil($this->total_rows / $this->per_page); - /* + /* // Calculate the total number of pages $num_pages = intval($this->total_rows / $this->per_page); // Use modulus to see if our division has a remainder. If so, add one to our page number. - if ($this->total_rows % $this->per_page) + if ($this->total_rows % $this->per_page) { $num_pages++; } */ - - // Is there only one page? Hm... nothing more to do here then. - if ($num_pages == 1) - { - return ''; - } - + + // Is there only one page? Hm... nothing more to do here then. + if ($num_pages == 1) + { + return ''; + } + // Determine the current page number. $CI =& get_instance(); if ($CI->uri->segment($this->uri_segment) != 0) @@ -140,35 +140,35 @@ class CI_Pagination { $uri_page_number = $this->cur_page; $this->cur_page = floor(($this->cur_page/$this->per_page) + 1); - + // Calculate the start and end numbers. These determine // which number to start and end the digit links with - $start = (($this->cur_page - $this->num_links) > 0) ? $this->cur_page - ($this->num_links - 1) : 1; - $end = (($this->cur_page + $this->num_links) < $num_pages) ? $this->cur_page + $this->num_links : $num_pages; - + $start = (($this->cur_page - $this->num_links) > 0) ? $this->cur_page - ($this->num_links - 1) : 1; + $end = (($this->cur_page + $this->num_links) < $num_pages) ? $this->cur_page + $this->num_links : $num_pages; + // Add a trailing slash to the base URL if needed $this->base_url = preg_replace("/(.+?)\/*$/", "\\1/", $this->base_url); // And here we go... - $output = ''; - + $output = ''; + // Render the "First" link - if ($this->cur_page > $this->num_links) - { - $output .= $this->first_tag_open.'<a href="'.$this->base_url.'">'.$this->first_link.'</a>'.$this->first_tag_close; - } - + if ($this->cur_page > $this->num_links) + { + $output .= $this->first_tag_open.'<a href="'.$this->base_url.'">'.$this->first_link.'</a>'.$this->first_tag_close; + } + // Render the "previous" link - if (($this->cur_page - $this->num_links) >= 0) - { - $i = $uri_page_number - $this->per_page; - if ($i == 0) $i = ''; - $output .= $this->prev_tag_open.'<a href="'.$this->base_url.$i.'">'.$this->prev_link.'</a>'.$this->prev_tag_close; - } - + if (($this->cur_page - $this->num_links) >= 0) + { + $i = $uri_page_number - $this->per_page; + if ($i == 0) $i = ''; + $output .= $this->prev_tag_open.'<a href="'.$this->base_url.$i.'">'.$this->prev_link.'</a>'.$this->prev_tag_close; + } + // Write the digit links - for ($loop = $start -1; $loop <= $end; $loop++) - { + for ($loop = $start -1; $loop <= $end; $loop++) + { $i = ($loop * $this->per_page) - $this->per_page; if ($i >= 0) @@ -183,30 +183,30 @@ class CI_Pagination { $output .= $this->num_tag_open.'<a href="'.$this->base_url.$n.'">'.$loop.'</a>'.$this->num_tag_close; } } - } + } // Render the "next" link - if ($this->cur_page < $num_pages) - { - $output .= $this->next_tag_open.'<a href="'.$this->base_url.($this->cur_page * $this->per_page).'">'.$this->next_link.'</a>'.$this->next_tag_close; - } + if ($this->cur_page < $num_pages) + { + $output .= $this->next_tag_open.'<a href="'.$this->base_url.($this->cur_page * $this->per_page).'">'.$this->next_link.'</a>'.$this->next_tag_close; + } // Render the "Last" link - if (($this->cur_page + $this->num_links) < $num_pages) - { - $i = (($num_pages * $this->per_page) - $this->per_page); - $output .= $this->last_tag_open.'<a href="'.$this->base_url.$i.'">'.$this->last_link.'</a>'.$this->last_tag_close; - } - - // Kill double slashes. Note: Sometimes we can end up with a double slash + if (($this->cur_page + $this->num_links) < $num_pages) + { + $i = (($num_pages * $this->per_page) - $this->per_page); + $output .= $this->last_tag_open.'<a href="'.$this->base_url.$i.'">'.$this->last_link.'</a>'.$this->last_tag_close; + } + + // Kill double slashes. Note: Sometimes we can end up with a double slash // in the penultimate link so we'll kill all double slashes. - $output = preg_replace("#([^:])//+#", "\\1/", $output); + $output = preg_replace("#([^:])//+#", "\\1/", $output); // Add the wrapper HTML if exists $output = $this->full_tag_open.$output.$this->full_tag_close; return $output; - } + } } // END Pagination Class ?>
\ No newline at end of file diff --git a/system/libraries/Parser.php b/system/libraries/Parser.php index ebf7644ac..760d5d4d3 100644 --- a/system/libraries/Parser.php +++ b/system/libraries/Parser.php @@ -7,7 +7,7 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource @@ -17,7 +17,7 @@ /** * Parser Class - * + * * @package CodeIgniter * @subpackage Libraries * @category Parser @@ -33,7 +33,7 @@ class CI_Parser { /** * Parse a template * - * Parses pseudo-variables contained in the specified template, + * Parses pseudo-variables contained in the specified template, * replacing them with the data in the second param * * @access public diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index 6e6fb675f..e03097ab6 100644 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** diff --git a/system/libraries/Router.php b/system/libraries/Router.php index 6002027d6..17a441c77 100644 --- a/system/libraries/Router.php +++ b/system/libraries/Router.php @@ -7,17 +7,17 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * Router Class - * + * * Parses URIs and determines routing * * @package CodeIgniter @@ -44,7 +44,7 @@ class CI_Router { /** * Constructor * - * Runs the route mapping function. + * Runs the route mapping function. */ function CI_Router() { @@ -94,7 +94,7 @@ class CI_Router { // If the URI contains only a slash we'll kill it if ($this->uri_string == '/') - { + { $this->uri_string = ''; } @@ -243,7 +243,7 @@ class CI_Router { * Re-index Segments * * This function re-indexes the $this->segment array so that it - * starts at 1 rather then 0. Doing so makes it simpler to + * starts at 1 rather then 0. Doing so makes it simpler to * use functions like $this->uri->segment(n) since there is * a 1:1 relationship between the segment array and the actual segments. * @@ -320,9 +320,9 @@ class CI_Router { return $path; } - // OK, how about REQUEST_URI? + // OK, how about REQUEST_URI? // Note: REQUEST_URI is not supplied in a consistent manner with all platforms so it's - // a difficult variable to use. We'll try to parse it out correctly. Hopefully one + // a difficult variable to use. We'll try to parse it out correctly. Hopefully one // of the other variables above was available. $path = $this->_parse_request_uri(); if ($path != "") @@ -352,7 +352,7 @@ class CI_Router { * Parse the REQUEST_URI * * Due to the way REQUEST_URI works it usually contains path info - * that makes it unusable as URI data. We'll trim off the unnecessary + * that makes it unusable as URI data. We'll trim off the unnecessary * data, hopefully arriving at a valid URI that we can use. * * @access private @@ -413,7 +413,7 @@ class CI_Router { if ($this->config->item('permitted_uri_chars') != '') { if ( ! preg_match("|^[".preg_quote($this->config->item('permitted_uri_chars'))."]+$|i", $str)) - { + { exit('The URI you submitted has disallowed characters: '.$str); } } @@ -426,7 +426,7 @@ class CI_Router { * Parse Routes * * This function matches any routes that may exist in - * the config/routes.php file against the URI to + * the config/routes.php file against the URI to * determine if the class/method need to be remapped. * * @access private @@ -472,7 +472,7 @@ class CI_Router { } } - // If we got this far it means we didn't encounter a + // If we got this far it means we didn't encounter a // matching route so we'll set the site default route $this->_compile_segments($this->segments); } diff --git a/system/libraries/Session.php b/system/libraries/Session.php index a47599d12..96a0c43b2 100644 --- a/system/libraries/Session.php +++ b/system/libraries/Session.php @@ -7,7 +7,7 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource @@ -17,7 +17,7 @@ /** * Session Class - * + * * @package CodeIgniter * @subpackage Libraries * @category Sessions @@ -26,16 +26,16 @@ */ class CI_Session { - var $CI; + var $CI; var $now; var $encryption = TRUE; var $use_database = FALSE; var $session_table = FALSE; - var $sess_length = 7200; - var $sess_cookie = 'ci_session'; + var $sess_length = 7200; + var $sess_cookie = 'ci_session'; var $userdata = array(); - var $gc_probability = 5; - + var $gc_probability = 5; + /** * Session Constructor @@ -66,7 +66,7 @@ class CI_Session { * * It can either set to GMT or time(). The pref * is set in the config file. If the developer - * is doing any sort of time localization they + * is doing any sort of time localization they * might want to set the session time to GMT so * they can offset the "last_activity" and * "last_visit" times based on each user's locale. @@ -75,7 +75,7 @@ class CI_Session { if (strtolower($this->CI->config->item('time_reference')) == 'gmt') { $now = time(); - $this->now = mktime(gmdate("H", $now), gmdate("i", $now), gmdate("s", $now), gmdate("m", $now), gmdate("d", $now), gmdate("Y", $now)); + $this->now = mktime(gmdate("H", $now), gmdate("i", $now), gmdate("s", $now), gmdate("m", $now), gmdate("d", $now), gmdate("Y", $now)); if (strlen($this->now) < 10) { @@ -92,7 +92,7 @@ class CI_Session { * Set the session length * * If the session expiration is set to zero in - * the config file we'll set the expiration + * the config file we'll set the expiration * two years from now. * */ @@ -191,7 +191,7 @@ class CI_Session { } // Is the session current? - if (($session['last_activity'] + $this->sess_length) < $this->now) + if (($session['last_activity'] + $this->sess_length) < $this->now) { $this->sess_destroy(); return FALSE; @@ -236,7 +236,7 @@ class CI_Session { else { $row = $query->row(); - if (($row->last_activity + $this->sess_length) < $this->now) + if (($row->last_activity + $this->sess_length) < $this->now) { $this->CI->db->where('session_id', $session['session_id']); $this->CI->db->delete($this->session_table); @@ -271,11 +271,11 @@ class CI_Session { } setcookie( - $this->sess_cookie, - $cookie_data, - $this->sess_length + $this->now, - $this->CI->config->item('cookie_path'), - $this->CI->config->item('cookie_domain'), + $this->sess_cookie, + $cookie_data, + $this->sess_length + $this->now, + $this->CI->config->item('cookie_path'), + $this->CI->config->item('cookie_domain'), 0 ); } @@ -291,8 +291,8 @@ class CI_Session { function sess_create() { $sessid = ''; - while (strlen($sessid) < 32) - { + while (strlen($sessid) < 32) + { $sessid .= mt_rand(0, mt_getrandmax()); } @@ -325,10 +325,10 @@ class CI_Session { */ function sess_update() { - if (($this->userdata['last_activity'] + $this->sess_length) < $this->now) - { + if (($this->userdata['last_activity'] + $this->sess_length) < $this->now) + { $this->userdata['last_visit'] = $this->userdata['last_activity']; - } + } $this->userdata['last_activity'] = $this->now; @@ -353,11 +353,11 @@ class CI_Session { function sess_destroy() { setcookie( - $this->sess_cookie, - addslashes(serialize(array())), - ($this->now - 31500000), - $this->CI->config->item('cookie_path'), - $this->CI->config->item('cookie_domain'), + $this->sess_cookie, + addslashes(serialize(array())), + ($this->now - 31500000), + $this->CI->config->item('cookie_path'), + $this->CI->config->item('cookie_domain'), 0 ); } @@ -373,19 +373,19 @@ class CI_Session { * @access public * @return void */ - function sess_gc() - { + function sess_gc() + { srand(time()); - if ((rand() % 100) < $this->gc_probability) - { + if ((rand() % 100) < $this->gc_probability) + { $expire = $this->now - $this->sess_length; $this->CI->db->where("last_activity < {$expire}"); $this->CI->db->delete($this->session_table); log_message('debug', 'Session garbage collection performed.'); - } - } + } + } // -------------------------------------------------------------------- @@ -398,7 +398,7 @@ class CI_Session { */ function userdata($item) { - return ( ! isset($this->userdata[$item])) ? FALSE : $this->userdata[$item]; + return ( ! isset($this->userdata[$item])) ? FALSE : $this->userdata[$item]; } // -------------------------------------------------------------------- @@ -426,7 +426,7 @@ class CI_Session { } } - $this->sess_write(); + $this->sess_write(); } // -------------------------------------------------------------------- @@ -452,7 +452,7 @@ class CI_Session { } } - $this->sess_write(); + $this->sess_write(); } // -------------------------------------------------------------------- @@ -464,21 +464,21 @@ class CI_Session { * @param mixed * @return mixed */ - function strip_slashes($vals) - { - if (is_array($vals)) - { - foreach ($vals as $key=>$val) - { - $vals[$key] = $this->strip_slashes($val); - } - } - else - { - $vals = stripslashes($vals); - } - - return $vals; + function strip_slashes($vals) + { + if (is_array($vals)) + { + foreach ($vals as $key=>$val) + { + $vals[$key] = $this->strip_slashes($val); + } + } + else + { + $vals = stripslashes($vals); + } + + return $vals; } } diff --git a/system/libraries/Sha1.php b/system/libraries/Sha1.php index 971c091ad..4dde04038 100644 --- a/system/libraries/Sha1.php +++ b/system/libraries/Sha1.php @@ -7,35 +7,35 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * SHA1 Encoding Class * - * Purpose: Provides 160 bit hashing using The Secure Hash Algorithm - * developed at the National Institute of Standards and Technology. The 40 + * Purpose: Provides 160 bit hashing using The Secure Hash Algorithm + * developed at the National Institute of Standards and Technology. The 40 * character SHA1 message hash is computationally infeasible to crack. - * - * This class is a fallback for servers that are not running PHP greater than + * + * This class is a fallback for servers that are not running PHP greater than * 4.3, or do not have the MHASH library. * * This class is based on two scripts: - * - * Marcus Campbell's PHP implementation (GNU license) + * + * Marcus Campbell's PHP implementation (GNU license) * http://www.tecknik.net/sha-1/ * - * ...which is based on Paul Johnston's JavaScript version + * ...which is based on Paul Johnston's JavaScript version * (BSD license). http://pajhome.org.uk/ - * + * * I encapsulated the functions and wrote one additional method to fix * a hex conversion bug. - Rick Ellis - * + * * @package CodeIgniter * @subpackage Libraries * @category Encryption @@ -56,67 +56,67 @@ class CI_SHA { * @param string * @return string */ - function generate($str) - { - $n = ((strlen($str) + 8) >> 6) + 1; - - for ($i = 0; $i < $n * 16; $i++) - { - $x[$i] = 0; - } - - for ($i = 0; $i < strlen($str); $i++) - { - $x[$i >> 2] |= ord(substr($str, $i, 1)) << (24 - ($i % 4) * 8); - } - - $x[$i >> 2] |= 0x80 << (24 - ($i % 4) * 8); - - $x[$n * 16 - 1] = strlen($str) * 8; - - $a = 1732584193; - $b = -271733879; - $c = -1732584194; - $d = 271733878; - $e = -1009589776; - - for ($i = 0; $i < sizeof($x); $i += 16) - { - $olda = $a; - $oldb = $b; - $oldc = $c; - $oldd = $d; - $olde = $e; - - for($j = 0; $j < 80; $j++) - { - if ($j < 16) - { - $w[$j] = $x[$i + $j]; - } - else - { - $w[$j] = $this->_rol($w[$j - 3] ^ $w[$j - 8] ^ $w[$j - 14] ^ $w[$j - 16], 1); - } - - $t = $this->_safe_add($this->_safe_add($this->_rol($a, 5), $this->_ft($j, $b, $c, $d)), $this->_safe_add($this->_safe_add($e, $w[$j]), $this->_kt($j))); - - $e = $d; - $d = $c; - $c = $this->_rol($b, 30); - $b = $a; - $a = $t; - } - - $a = $this->_safe_add($a, $olda); - $b = $this->_safe_add($b, $oldb); - $c = $this->_safe_add($c, $oldc); - $d = $this->_safe_add($d, $oldd); - $e = $this->_safe_add($e, $olde); - } - - return $this->_hex($a).$this->_hex($b).$this->_hex($c).$this->_hex($d).$this->_hex($e); - } + function generate($str) + { + $n = ((strlen($str) + 8) >> 6) + 1; + + for ($i = 0; $i < $n * 16; $i++) + { + $x[$i] = 0; + } + + for ($i = 0; $i < strlen($str); $i++) + { + $x[$i >> 2] |= ord(substr($str, $i, 1)) << (24 - ($i % 4) * 8); + } + + $x[$i >> 2] |= 0x80 << (24 - ($i % 4) * 8); + + $x[$n * 16 - 1] = strlen($str) * 8; + + $a = 1732584193; + $b = -271733879; + $c = -1732584194; + $d = 271733878; + $e = -1009589776; + + for ($i = 0; $i < sizeof($x); $i += 16) + { + $olda = $a; + $oldb = $b; + $oldc = $c; + $oldd = $d; + $olde = $e; + + for($j = 0; $j < 80; $j++) + { + if ($j < 16) + { + $w[$j] = $x[$i + $j]; + } + else + { + $w[$j] = $this->_rol($w[$j - 3] ^ $w[$j - 8] ^ $w[$j - 14] ^ $w[$j - 16], 1); + } + + $t = $this->_safe_add($this->_safe_add($this->_rol($a, 5), $this->_ft($j, $b, $c, $d)), $this->_safe_add($this->_safe_add($e, $w[$j]), $this->_kt($j))); + + $e = $d; + $d = $c; + $c = $this->_rol($b, 30); + $b = $a; + $a = $t; + } + + $a = $this->_safe_add($a, $olda); + $b = $this->_safe_add($b, $oldb); + $c = $this->_safe_add($c, $oldc); + $d = $this->_safe_add($d, $oldd); + $e = $this->_safe_add($e, $olde); + } + + return $this->_hex($a).$this->_hex($b).$this->_hex($c).$this->_hex($d).$this->_hex($e); + } // -------------------------------------------------------------------- @@ -127,17 +127,17 @@ class CI_SHA { * @param string * @return string */ - function _hex($str) - { - $str = dechex($str); - - if (strlen($str) == 7) - { - $str = '0'.$str; - } - - return $str; - } + function _hex($str) + { + $str = dechex($str); + + if (strlen($str) == 7) + { + $str = '0'.$str; + } + + return $str; + } // -------------------------------------------------------------------- @@ -147,18 +147,18 @@ class CI_SHA { * @access private * @return string */ - function _ft($t, $b, $c, $d) - { - if ($t < 20) - return ($b & $c) | ((~$b) & $d); - if ($t < 40) - return $b ^ $c ^ $d; - if ($t < 60) - return ($b & $c) | ($b & $d) | ($c & $d); - - return $b ^ $c ^ $d; - } - + function _ft($t, $b, $c, $d) + { + if ($t < 20) + return ($b & $c) | ((~$b) & $d); + if ($t < 40) + return $b ^ $c ^ $d; + if ($t < 60) + return ($b & $c) | ($b & $d) | ($c & $d); + + return $b ^ $c ^ $d; + } + // -------------------------------------------------------------------- /** @@ -167,25 +167,25 @@ class CI_SHA { * @access private * @return string */ - function _kt($t) - { - if ($t < 20) - { - return 1518500249; - } - else if ($t < 40) - { - return 1859775393; - } - else if ($t < 60) - { - return -1894007588; - } - else - { - return -899497514; - } - } + function _kt($t) + { + if ($t < 20) + { + return 1518500249; + } + else if ($t < 40) + { + return 1859775393; + } + else if ($t < 60) + { + return -1894007588; + } + else + { + return -899497514; + } + } // -------------------------------------------------------------------- @@ -195,13 +195,13 @@ class CI_SHA { * @access private * @return string */ - function _safe_add($x, $y) - { - $lsw = ($x & 0xFFFF) + ($y & 0xFFFF); - $msw = ($x >> 16) + ($y >> 16) + ($lsw >> 16); - - return ($msw << 16) | ($lsw & 0xFFFF); - } + function _safe_add($x, $y) + { + $lsw = ($x & 0xFFFF) + ($y & 0xFFFF); + $msw = ($x >> 16) + ($y >> 16) + ($lsw >> 16); + + return ($msw << 16) | ($lsw & 0xFFFF); + } // -------------------------------------------------------------------- @@ -211,11 +211,11 @@ class CI_SHA { * @access private * @return integer */ - function _rol($num, $cnt) - { - return ($num << $cnt) | $this->_zero_fill($num, 32 - $cnt); - } - + function _rol($num, $cnt) + { + return ($num << $cnt) | $this->_zero_fill($num, 32 - $cnt); + } + // -------------------------------------------------------------------- /** @@ -224,26 +224,26 @@ class CI_SHA { * @access private * @return string */ - function _zero_fill($a, $b) - { - $bin = decbin($a); - - if (strlen($bin) < $b) - { - $bin = 0; - } - else - { - $bin = substr($bin, 0, strlen($bin) - $b); - } - - for ($i=0; $i < $b; $i++) - { - $bin = "0".$bin; - } - - return bindec($bin); - } + function _zero_fill($a, $b) + { + $bin = decbin($a); + + if (strlen($bin) < $b) + { + $bin = 0; + } + else + { + $bin = substr($bin, 0, strlen($bin) - $b); + } + + for ($i=0; $i < $b; $i++) + { + $bin = "0".$bin; + } + + return bindec($bin); + } } // END CI_SHA ?>
\ No newline at end of file diff --git a/system/libraries/Table.php b/system/libraries/Table.php index c40c85e17..f3f9b32f6 100644 --- a/system/libraries/Table.php +++ b/system/libraries/Table.php @@ -7,17 +7,17 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.3.1 * @filesource */ - + // ------------------------------------------------------------------------ /** * HTML Table Generating Class - * + * * Lets you create tables manually or from database result objects, or arrays. * * @package CodeIgniter diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 74649151d..6d5e206ff 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -7,7 +7,7 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource @@ -19,7 +19,7 @@ * Trackback Class * * Trackback Sending/Receiving Class - * + * * @package CodeIgniter * @subpackage Libraries * @category Trackbacks @@ -57,7 +57,7 @@ class CI_Trackback { function send($tb_data) { if ( ! is_array($tb_data)) - { + { $this->set_error('The send() method must be passed an array'); return FALSE; } @@ -66,7 +66,7 @@ class CI_Trackback { foreach (array('url', 'title', 'excerpt', 'blog_name', 'ping_url') as $item) { if ( ! isset($tb_data[$item])) - { + { $this->set_error('Required item missing: '.$item); return FALSE; } @@ -104,7 +104,7 @@ class CI_Trackback { // Build the Trackback data string $charset = ( ! isset($tb_data['charset'])) ? $this->charset : $tb_data['charset']; - $data = "url=".rawurlencode($url)."&title=".rawurlencode($title)."&blog_name=".rawurlencode($blog_name)."&excerpt=".rawurlencode($excerpt)."&charset=".rawurlencode($charset); + $data = "url=".rawurlencode($url)."&title=".rawurlencode($title)."&blog_name=".rawurlencode($blog_name)."&excerpt=".rawurlencode($excerpt)."&charset=".rawurlencode($charset); // Send Trackback(s) $return = TRUE; @@ -170,7 +170,7 @@ class CI_Trackback { /** * Send Trackback Error Message * - * Allows custom errors to be set. By default it + * Allows custom errors to be set. By default it * sends the "incomplete information" error, as that's * the most common one. * @@ -220,7 +220,7 @@ class CI_Trackback { /** * Process Trackback * - * Opens a socket connection and passes the data to + * Opens a socket connection and passes the data to * the server. Returns true on success, false on failure * * @access public @@ -249,22 +249,22 @@ class CI_Trackback { { $data = "tb_id=".$id."&".$data; } - + // Transfer the data - fputs ($fp, "POST " . $path . " HTTP/1.0\r\n" ); - fputs ($fp, "Host: " . $target['host'] . "\r\n" ); - fputs ($fp, "Content-type: application/x-www-form-urlencoded\r\n" ); - fputs ($fp, "Content-length: " . strlen($data) . "\r\n" ); - fputs ($fp, "Connection: close\r\n\r\n" ); + fputs ($fp, "POST " . $path . " HTTP/1.0\r\n" ); + fputs ($fp, "Host: " . $target['host'] . "\r\n" ); + fputs ($fp, "Content-type: application/x-www-form-urlencoded\r\n" ); + fputs ($fp, "Content-length: " . strlen($data) . "\r\n" ); + fputs ($fp, "Connection: close\r\n\r\n" ); fputs ($fp, $data); - + // Was it successful? $this->response = ""; while(!feof($fp)) { $this->response .= fgets($fp, 128); - } + } @fclose($fp); if ( ! eregi("<error>0</error>", $this->response)) @@ -297,7 +297,7 @@ class CI_Trackback { * @return string */ function extract_urls($urls) - { + { // Remove the pesky white space and replace with a comma. $urls = preg_replace("/\s*(\S+)\s*/", "\\1,", $urls); @@ -316,7 +316,7 @@ class CI_Trackback { // Removes duplicates $urls = array_unique($urls); - array_walk($urls, array($this, 'validate_url')); + array_walk($urls, array($this, 'validate_url')); return $urls; } @@ -384,7 +384,7 @@ class CI_Trackback { } } - if ( ! preg_match ("/^([0-9]+)$/", $tb_id)) + if ( ! preg_match ("/^([0-9]+)$/", $tb_id)) { return false; } @@ -435,7 +435,7 @@ class CI_Trackback { */ function limit_characters($str, $n = 500, $end_char = '…') { - if (strlen($str) < $n) + if (strlen($str) < $n) { return $str; } @@ -453,7 +453,7 @@ class CI_Trackback { $out .= $val.' '; if (strlen($out) >= $n) { - return trim($out).$end_char; + return trim($out).$end_char; } } } @@ -475,11 +475,11 @@ class CI_Trackback { $count = 1; $out = ''; $temp = array(); - + for ($i = 0, $s = strlen($str); $i < $s; $i++) { $ordinal = ord($str[$i]); - + if ($ordinal < 128) { $out .= $str[$i]; @@ -490,9 +490,9 @@ class CI_Trackback { { $count = ($ordinal < 224) ? 2 : 3; } - + $temp[] = $ordinal; - + if (count($temp) == $count) { $number = ($count == 3) ? (($temp['0'] % 16) * 4096) + (($temp['1'] % 64) * 64) + ($temp['2'] % 64) : (($temp['0'] % 32) * 64) + ($temp['1'] % 64); @@ -500,10 +500,10 @@ class CI_Trackback { $out .= '&#'.$number.';'; $count = 1; $temp = array(); - } - } + } + } } - + return $out; } diff --git a/system/libraries/URI.php b/system/libraries/URI.php index fcf6afe4b..10654a69c 100644 --- a/system/libraries/URI.php +++ b/system/libraries/URI.php @@ -7,17 +7,17 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * URI Class - * + * * Parses URIs and determines routing * * @package CodeIgniter @@ -36,7 +36,7 @@ class CI_URI { * * Simply globalizes the $RTR object. The front * loads the Router class early on so it's not available - * normally as other classes are. + * normally as other classes are. * * @access public */ @@ -51,7 +51,7 @@ class CI_URI { /** * Fetch a URI Segment * - * This function returns the URI segment based on the number provided. + * This function returns the URI segment based on the number provided. * * @access public * @param integer @@ -87,7 +87,7 @@ class CI_URI { /** * Generate a key value pair from the URI string * - * This function generates and associative array of URI data starting + * This function generates and associative array of URI data starting * at the supplied segment. For example, if this is your URI: * * www.your-site.com/user/search/name/joe/location/UK/gender/male @@ -99,7 +99,7 @@ class CI_URI { * location => UK * gender => male * ) - * + * * @access public * @param integer the starting segment number * @param array an array of default values @@ -122,7 +122,7 @@ class CI_URI { /** * Generate a key value pair from the URI string or Re-routed URI string - * + * * @access private * @param integer the starting segment number * @param array an array of default values @@ -206,7 +206,7 @@ class CI_URI { /** * Generate a URI string from an associative array * - * + * * @access public * @param array an associative array of key/values * @return array diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 6bfc59dc3..f68f69e71 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -7,17 +7,17 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.3.1 * @filesource */ - + // ------------------------------------------------------------------------ /** * Unit Testing Class - * + * * Simple testing class * * @package CodeIgniter @@ -148,7 +148,7 @@ class CI_Unit_test { /** * Make Unit testing active * - * Enables/disables unit testing + * Enables/disables unit testing * * @access public * @param bool @@ -233,14 +233,14 @@ class CI_Unit_test { /** * Generate a backtrace * - * This lets us show file names and line numbers + * This lets us show file names and line numbers * * @access private * @return array */ - function _backtrace() + function _backtrace() { - if (function_exists('debug_backtrace')) + if (function_exists('debug_backtrace')) { $back = debug_backtrace(); @@ -314,7 +314,7 @@ class CI_Unit_test { /** * Helper functions to test boolean true/false - * + * * * @access private * @return bool diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index 09a479431..1a0b0fc8f 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -7,7 +7,7 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource @@ -17,7 +17,7 @@ /** * File Uploading Class - * + * * @package CodeIgniter * @subpackage Libraries * @category Uploads @@ -43,7 +43,7 @@ class CI_Upload { var $image_width = ''; var $image_height = ''; var $image_type = ''; - var $image_size_str = ''; + var $image_size_str = ''; var $error_msg = array(); var $mimes = array(); var $remove_spaces = TRUE; @@ -75,7 +75,7 @@ class CI_Upload { * @return void */ function initialize($config = array()) - { + { foreach ($config as $key => $val) { $method = 'set_'.$key; @@ -98,41 +98,41 @@ class CI_Upload { * @access public * @return bool */ - function do_upload($field = 'userfile') - { + function do_upload($field = 'userfile') + { // Is $_FILES[$field] set? If not, no reason to continue. - if ( ! isset($_FILES[$field])) - { + if ( ! isset($_FILES[$field])) + { $this->set_error('upload_userfile_not_set'); return FALSE; - } - + } + // Is the upload path valid? if ( ! $this->validate_upload_path()) { return FALSE; } - + // Was the file able to be uploaded? If not, determine the reason why. - if ( ! is_uploaded_file($_FILES[$field]['tmp_name'])) - { - $error = ( ! isset($_FILES[$field]['error'])) ? 4 : $_FILES[$field]['error']; - - switch($error) - { - case 1 : $this->set_error('upload_file_exceeds_limit'); - break; - case 3 : $this->set_error('upload_file_partial'); - break; - case 4 : $this->set_error('upload_no_file_selected'); - break; - default : $this->set_error('upload_no_file_selected'); - break; - } - - return FALSE; - } - + if ( ! is_uploaded_file($_FILES[$field]['tmp_name'])) + { + $error = ( ! isset($_FILES[$field]['error'])) ? 4 : $_FILES[$field]['error']; + + switch($error) + { + case 1 : $this->set_error('upload_file_exceeds_limit'); + break; + case 3 : $this->set_error('upload_file_partial'); + break; + case 4 : $this->set_error('upload_no_file_selected'); + break; + default : $this->set_error('upload_no_file_selected'); + break; + } + + return FALSE; + } + // Set the uploaded data as class variables $this->file_temp = $_FILES[$field]['tmp_name']; $this->file_name = $_FILES[$field]['name']; @@ -148,36 +148,36 @@ class CI_Upload { } // Is the file type allowed to be uploaded? - if ( ! $this->is_allowed_filetype()) - { + if ( ! $this->is_allowed_filetype()) + { $this->set_error('upload_invalid_filetype'); return FALSE; - } + } // Is the file size within the allowed maximum? - if ( ! $this->is_allowed_filesize()) - { + if ( ! $this->is_allowed_filesize()) + { $this->set_error('upload_invalid_filesize'); - return FALSE; - } - + return FALSE; + } + // Are the image dimensions within the allowed size? // Note: This can fail if the server has an open_basdir restriction. - if ( ! $this->is_allowed_dimensions()) - { + if ( ! $this->is_allowed_dimensions()) + { $this->set_error('upload_invalid_dimensions'); - return FALSE; - } - + return FALSE; + } + // Sanitize the file name for security - $this->file_name = $this->clean_file_name($this->file_name); - + $this->file_name = $this->clean_file_name($this->file_name); + // Remove white spaces in the name - if ($this->remove_spaces == TRUE) - { - $this->file_name = preg_replace("/\s+/", "_", $this->file_name); - } - + if ($this->remove_spaces == TRUE) + { + $this->file_name = preg_replace("/\s+/", "_", $this->file_name); + } + /* * Validate the file name * This function appends an number onto the end of @@ -195,7 +195,7 @@ class CI_Upload { return FALSE; } } - + /* * Move the file to the final destination * To deal with different server configurations @@ -204,42 +204,42 @@ class CI_Upload { * reliably work in most environments */ if ( ! @copy($this->file_temp, $this->file_path.$this->file_name)) - { + { if ( ! @move_uploaded_file($this->file_temp, $this->file_path.$this->file_name)) { $this->set_error('upload_destination_error'); return FALSE; } - } + } /* * Run the file through the XSS hacking filter * This helps prevent malicious code from being - * embedded within a file. Scripts can easily + * embedded within a file. Scripts can easily * be disguised as images or other file types. */ if ($this->xss_clean == TRUE) { $this->do_xss_clean(); } - + /* * Set the finalized image dimensions * This sets the image width/height (assuming the * file was an image). We use this information * in the "data" function. */ - $this->set_image_properties($this->file_path.$this->file_name); - + $this->set_image_properties($this->file_path.$this->file_name); + return TRUE; - } + } // -------------------------------------------------------------------- /** - * Finalized Data Array + * Finalized Data Array * - * Returns an associative array containing all of the information + * Returns an associative array containing all of the information * related to the upload, allowing the developer easy access in one array. * * @access public @@ -267,24 +267,24 @@ class CI_Upload { // -------------------------------------------------------------------- /** - * Set Upload Path + * Set Upload Path * * @access public * @param string * @return void */ - function set_upload_path($path) - { + function set_upload_path($path) + { $this->file_path = $path; } // -------------------------------------------------------------------- /** - * Set the file name + * Set the file name * - * This function takes a filename/path as input and looks for the - * existence of a file with the same name. If found, it will append a + * This function takes a filename/path as input and looks for the + * existence of a file with the same name. If found, it will append a * number to the end of the filename to avoid overwriting a pre-existing file. * * @access public @@ -331,58 +331,58 @@ class CI_Upload { // -------------------------------------------------------------------- /** - * Set Maximum File Size + * Set Maximum File Size * * @access public * @param integer * @return void */ - function set_max_filesize($n) - { - $this->max_size = ( ! eregi("^[[:digit:]]+$", $n)) ? 0 : $n; - } + function set_max_filesize($n) + { + $this->max_size = ( ! eregi("^[[:digit:]]+$", $n)) ? 0 : $n; + } // -------------------------------------------------------------------- /** - * Set Maximum Image Width + * Set Maximum Image Width * * @access public * @param integer * @return void */ - function set_max_width($n) - { - $this->max_width = ( ! eregi("^[[:digit:]]+$", $n)) ? 0 : $n; - } + function set_max_width($n) + { + $this->max_width = ( ! eregi("^[[:digit:]]+$", $n)) ? 0 : $n; + } // -------------------------------------------------------------------- /** - * Set Maximum Image Height + * Set Maximum Image Height * * @access public * @param integer * @return void */ - function set_max_height($n) - { - $this->max_height = ( ! eregi("^[[:digit:]]+$", $n)) ? 0 : $n; - } + function set_max_height($n) + { + $this->max_height = ( ! eregi("^[[:digit:]]+$", $n)) ? 0 : $n; + } // -------------------------------------------------------------------- /** - * Set Allowed File Types + * Set Allowed File Types * * @access public * @param string * @return void */ - function set_allowed_types($types) - { - $this->allowed_types = explode('|', $types); - } + function set_allowed_types($types) + { + $this->allowed_types = explode('|', $types); + } // -------------------------------------------------------------------- @@ -395,26 +395,26 @@ class CI_Upload { * @param string * @return void */ - function set_image_properties($path = '') - { - if ( ! $this->is_image()) - { - return; - } - - if (function_exists('getimagesize')) - { - if (FALSE !== ($D = @getimagesize($path))) - { + function set_image_properties($path = '') + { + if ( ! $this->is_image()) + { + return; + } + + if (function_exists('getimagesize')) + { + if (FALSE !== ($D = @getimagesize($path))) + { $types = array(1 => 'gif', 2 => 'jpeg', 3 => 'png'); - + $this->image_width = $D['0']; $this->image_height = $D['1']; $this->image_type = ( ! isset($types[$D['2']])) ? 'unknown' : $types[$D['2']]; $this->image_size_str = $D['3']; // string containing height and width } - } - } + } + } // -------------------------------------------------------------------- @@ -441,21 +441,21 @@ class CI_Upload { * @access public * @return bool */ - function is_image() - { - $img_mimes = array( - 'image/gif', - 'image/jpg', - 'image/jpe', - 'image/jpeg', - 'image/pjpeg', - 'image/png', - 'image/x-png' - ); - + function is_image() + { + $img_mimes = array( + 'image/gif', + 'image/jpg', + 'image/jpe', + 'image/jpeg', + 'image/pjpeg', + 'image/png', + 'image/x-png' + ); + return (in_array($this->file_type, $img_mimes, TRUE)) ? TRUE : FALSE; - } + } // -------------------------------------------------------------------- @@ -465,36 +465,36 @@ class CI_Upload { * @access public * @return bool */ - function is_allowed_filetype() - { - if (count($this->allowed_types) == 0) - { + function is_allowed_filetype() + { + if (count($this->allowed_types) == 0) + { $this->set_error('upload_no_file_types'); return FALSE; - } - - foreach ($this->allowed_types as $val) - { - $mime = $this->mimes_types(strtolower($val)); - - if (is_array($mime)) - { - if (in_array($this->file_type, $mime, TRUE)) - { - return TRUE; - } - } - else - { + } + + foreach ($this->allowed_types as $val) + { + $mime = $this->mimes_types(strtolower($val)); + + if (is_array($mime)) + { + if (in_array($this->file_type, $mime, TRUE)) + { + return TRUE; + } + } + else + { if ($mime == $this->file_type) { return TRUE; } - } - } - - return FALSE; - } + } + } + + return FALSE; + } // -------------------------------------------------------------------- @@ -504,17 +504,17 @@ class CI_Upload { * @access public * @return bool */ - function is_allowed_filesize() - { - if ($this->max_size != 0 AND $this->file_size > $this->max_size) - { - return FALSE; - } - else - { - return TRUE; - } - } + function is_allowed_filesize() + { + if ($this->max_size != 0 AND $this->file_size > $this->max_size) + { + return FALSE; + } + else + { + return TRUE; + } + } // -------------------------------------------------------------------- @@ -524,37 +524,37 @@ class CI_Upload { * @access public * @return bool */ - function is_allowed_dimensions() - { - if ( ! $this->is_image()) - { - return TRUE; - } - - if (function_exists('getimagesize')) - { - $D = @getimagesize($this->file_temp); - - if ($this->max_width > 0 AND $D['0'] > $this->max_width) - { - return FALSE; - } - - if ($this->max_height > 0 AND $D['1'] > $this->max_height) - { - return FALSE; - } - - return TRUE; - } - - return TRUE; - } + function is_allowed_dimensions() + { + if ( ! $this->is_image()) + { + return TRUE; + } + + if (function_exists('getimagesize')) + { + $D = @getimagesize($this->file_temp); + + if ($this->max_width > 0 AND $D['0'] > $this->max_width) + { + return FALSE; + } + + if ($this->max_height > 0 AND $D['1'] > $this->max_height) + { + return FALSE; + } + + return TRUE; + } + + return TRUE; + } // -------------------------------------------------------------------- /** - * Validate Upload Path + * Validate Upload Path * * Verifies that it is a valid upload path with proper permissions. * @@ -562,34 +562,34 @@ class CI_Upload { * @access public * @return bool */ - function validate_upload_path() - { - if ($this->file_path == '') - { + function validate_upload_path() + { + if ($this->file_path == '') + { $this->set_error('upload_no_filepath'); return FALSE; - } - + } + if (function_exists('realpath') AND @realpath($this->file_path) !== FALSE) { - $this->file_path = str_replace("\\", "/", realpath($this->file_path)); + $this->file_path = str_replace("\\", "/", realpath($this->file_path)); } - - if ( ! @is_dir($this->file_path)) - { + + if ( ! @is_dir($this->file_path)) + { $this->set_error('upload_no_filepath'); return FALSE; - } - - if ( ! is_writable($this->file_path)) - { + } + + if ( ! is_writable($this->file_path)) + { $this->set_error('upload_not_writable'); return FALSE; - } - + } + $this->file_path = preg_replace("/(.+?)\/*$/", "\\1/", $this->file_path); return TRUE; - } + } // -------------------------------------------------------------------- @@ -617,7 +617,7 @@ class CI_Upload { */ function clean_file_name($filename) { - $bad = array( + $bad = array( "<!--", "-->", "'", @@ -636,21 +636,21 @@ class CI_Upload { "%253c", // < "%3e", // > "%0e", // > - "%28", // ( - "%29", // ) + "%28", // ( + "%29", // ) "%2528", // ( "%26", // & "%24", // $ "%3f", // ? "%3b", // ; "%3d" // = - ); - - foreach ($bad as $val) - { - $filename = str_replace($val, '', $filename); - } - + ); + + foreach ($bad as $val) + { + $filename = str_replace($val, '', $filename); + } + return $filename; } @@ -659,7 +659,7 @@ class CI_Upload { /** * Runs the file through the XSS clean function * - * This prevents people from embedding malicious code in their files. + * This prevents people from embedding malicious code in their files. * I'm not sure that it won't negatively affect certain files in unexpected ways, * but so far I haven't found that it causes trouble. * @@ -670,7 +670,7 @@ class CI_Upload { { $file = $this->file_path.$this->file_name; - if (filesize($file) == 0) + if (filesize($file) == 0) { return FALSE; } @@ -680,16 +680,16 @@ class CI_Upload { return FALSE; } - flock($fp, LOCK_EX); + flock($fp, LOCK_EX); - $data = fread($fp, filesize($file)); + $data = fread($fp, filesize($file)); $CI =& get_instance(); $data = $CI->input->xss_clean($data); - fwrite($fp, $data); - flock($fp, LOCK_UN); - fclose($fp); + fwrite($fp, $data); + flock($fp, LOCK_UN); + fclose($fp); } // -------------------------------------------------------------------- diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php index 11c2baa68..b217367fe 100644 --- a/system/libraries/User_agent.php +++ b/system/libraries/User_agent.php @@ -7,17 +7,17 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * User Agent Class - * + * * Identifies the platform, browser, robot, or mobile devise of the browsing agent * * @package CodeIgniter @@ -155,9 +155,9 @@ class CI_User_agent { { if (is_array($this->platforms) AND count($this->platforms) > 0) { - foreach ($this->platforms as $key => $val) + foreach ($this->platforms as $key => $val) { - if (preg_match("|".preg_quote($key)."|i", $this->agent)) + if (preg_match("|".preg_quote($key)."|i", $this->agent)) { $this->platform = $val; return TRUE; @@ -179,9 +179,9 @@ class CI_User_agent { { if (is_array($this->browsers) AND count($this->browsers) > 0) { - foreach ($this->browsers as $key => $val) + foreach ($this->browsers as $key => $val) { - if (preg_match("|".preg_quote($key).".*?([0-9\.]+)|i", $this->agent, $match)) + if (preg_match("|".preg_quote($key).".*?([0-9\.]+)|i", $this->agent, $match)) { $this->is_browser = TRUE; $this->version = $match[1]; @@ -205,9 +205,9 @@ class CI_User_agent { { if (is_array($this->robots) AND count($this->robots) > 0) { - foreach ($this->robots as $key => $val) + foreach ($this->robots as $key => $val) { - if (preg_match("|".preg_quote($key)."|i", $this->agent)) + if (preg_match("|".preg_quote($key)."|i", $this->agent)) { $this->is_robot = TRUE; $this->robot = $val; @@ -230,7 +230,7 @@ class CI_User_agent { { if (is_array($this->mobiles) AND count($this->mobiles) > 0) { - foreach ($this->mobiles as $key => $val) + foreach ($this->mobiles as $key => $val) { if (FALSE !== (strpos(strtolower($this->agent), $key))) { diff --git a/system/libraries/Validation.php b/system/libraries/Validation.php index 07ca35a33..ec7e412c6 100644 --- a/system/libraries/Validation.php +++ b/system/libraries/Validation.php @@ -7,7 +7,7 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource @@ -17,7 +17,7 @@ /** * Validation Class - * + * * @package CodeIgniter * @subpackage Libraries * @category Validation @@ -40,7 +40,7 @@ class CI_Validation { /** - * Constructor + * Constructor * */ function CI_Validation() @@ -102,7 +102,7 @@ class CI_Validation { /** * Set Rules * - * This function takes an array of field names and validation + * This function takes an array of field names and validation * rules as input ad simply stores is for use later. * * @access public @@ -131,7 +131,7 @@ class CI_Validation { /** * Set Error Message * - * Lets users set their own error messages on the fly. Note: The key + * Lets users set their own error messages on the fly. Note: The key * name has to match the function name that it corresponds to. * * @access public @@ -216,7 +216,7 @@ class CI_Validation { { if (in_array('isset', $ex, TRUE) OR in_array('required', $ex)) { - if ( ! isset($this->_error_messages['isset'])) + if ( ! isset($this->_error_messages['isset'])) { if (FALSE === ($line = $this->CI->lang->line('isset'))) { @@ -308,7 +308,7 @@ class CI_Validation { // Did the rule test negatively? If so, grab the error. if ($result === FALSE) { - if ( ! isset($this->_error_messages[$rule])) + if ( ! isset($this->_error_messages[$rule])) { if (FALSE === ($line = $this->CI->lang->line($rule))) { @@ -352,7 +352,7 @@ class CI_Validation { } $this->set_fields(); - + // Did we end up with any errors? if ($total_errors == 0) { @@ -653,15 +653,15 @@ class CI_Validation { * @param string * @return string */ - function prep_for_form($str = '') - { - if ($this->_safe_form_data == FALSE OR $str == '') - { - return $str; - } - + function prep_for_form($str = '') + { + if ($this->_safe_form_data == FALSE OR $str == '') + { + return $str; + } + return str_replace(array("'", '"', '<', '>'), array("'", """, '<', '>'), stripslashes($str)); - } + } // -------------------------------------------------------------------- @@ -672,8 +672,8 @@ class CI_Validation { * @param string * @return string */ - function prep_url($str = '') - { + function prep_url($str = '') + { if ($str == 'http://' OR $str == '') { $_POST[$this->_current_field] = ''; @@ -686,7 +686,7 @@ class CI_Validation { } $_POST[$this->_current_field] = $str; - } + } // -------------------------------------------------------------------- @@ -697,10 +697,10 @@ class CI_Validation { * @param string * @return string */ - function strip_image_tags($str) - { - $_POST[$this->_current_field] = $this->input->strip_image_tags($str); - } + function strip_image_tags($str) + { + $_POST[$this->_current_field] = $this->input->strip_image_tags($str); + } // -------------------------------------------------------------------- @@ -725,9 +725,9 @@ class CI_Validation { * @param string * @return string */ - function encode_php_tags($str) - { - $_POST[$this->_current_field] = str_replace(array('<?php', '<?PHP', '<?', '?>'), array('<?php', '<?PHP', '<?', '?>'), $str); + function encode_php_tags($str) + { + $_POST[$this->_current_field] = str_replace(array('<?php', '<?PHP', '<?', '?>'), array('<?php', '<?PHP', '<?', '?>'), $str); } } diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index 0a3dedae1..2d9a4c11b 100644 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -7,15 +7,15 @@ * @package CodeIgniter * @author Rick Ellis, Paul Burdick * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + if ( ! function_exists('xml_parser_create')) { - show_error('Your PHP installation does not support XML'); + show_error('Your PHP installation does not support XML'); } @@ -23,7 +23,7 @@ if ( ! function_exists('xml_parser_create')) /** * XML-RPC request handler class - * + * * @package CodeIgniter * @subpackage Libraries * @category XML-RPC @@ -33,7 +33,7 @@ if ( ! function_exists('xml_parser_create')) class CI_Xmlrpc { var $debug = FALSE; // Debugging on or off - var $xmlrpcI4 = 'i4'; + var $xmlrpcI4 = 'i4'; var $xmlrpcInt = 'int'; var $xmlrpcBoolean = 'boolean'; var $xmlrpcDouble = 'double'; @@ -65,10 +65,10 @@ class CI_Xmlrpc { //------------------------------------- - // VALUES THAT MULTIPLE CLASSES NEED - //------------------------------------- + // VALUES THAT MULTIPLE CLASSES NEED + //------------------------------------- - function CI_Xmlrpc ($config = array()) + function CI_Xmlrpc ($config = array()) { $this->xmlrpcName = $this->xmlrpcName; @@ -76,14 +76,14 @@ class CI_Xmlrpc { // Types for info sent back and forth $this->xmlrpcTypes = array( - $this->xmlrpcI4 => '1', - $this->xmlrpcInt => '1', + $this->xmlrpcI4 => '1', + $this->xmlrpcInt => '1', $this->xmlrpcBoolean => '1', $this->xmlrpcString => '1', $this->xmlrpcDouble => '1', $this->xmlrpcDateTime => '1', $this->xmlrpcBase64 => '1', - $this->xmlrpcArray => '2', + $this->xmlrpcArray => '2', $this->xmlrpcStruct => '3' ); @@ -129,10 +129,10 @@ class CI_Xmlrpc { //------------------------------------- - // Initialize Prefs - //------------------------------------- + // Initialize Prefs + //------------------------------------- - function initialize($config = array()) + function initialize($config = array()) { if (sizeof($config) > 0) { @@ -148,10 +148,10 @@ class CI_Xmlrpc { // END //------------------------------------- - // Take URL and parse it - //------------------------------------- + // Take URL and parse it + //------------------------------------- - function server($url, $port=80) + function server($url, $port=80) { if (substr($url, 0, 4) != "http") { @@ -173,9 +173,9 @@ class CI_Xmlrpc { //------------------------------------- // Set Timeout - //------------------------------------- + //------------------------------------- - function timeout($seconds=5) + function timeout($seconds=5) { if ( ! is_null($this->client) && is_int($seconds)) { @@ -186,9 +186,9 @@ class CI_Xmlrpc { //------------------------------------- // Set Methods - //------------------------------------- + //------------------------------------- - function method($function) + function method($function) { $this->method = $function; } @@ -196,9 +196,9 @@ class CI_Xmlrpc { //------------------------------------- // Take Array of Data and Create Objects - //------------------------------------- + //------------------------------------- - function request($incoming) + function request($incoming) { if ( ! is_array($incoming)) { @@ -215,7 +215,7 @@ class CI_Xmlrpc { //------------------------------------- // Set Debug - //------------------------------------- + //------------------------------------- function set_debug($flag = TRUE) { @@ -224,7 +224,7 @@ class CI_Xmlrpc { //------------------------------------- // Values Parsing - //------------------------------------- + //------------------------------------- function values_parsing($value, $return = FALSE) { @@ -260,9 +260,9 @@ class CI_Xmlrpc { //------------------------------------- // Sends XML-RPC Request - //------------------------------------- + //------------------------------------- - function send_request() + function send_request() { $this->message = new XML_RPC_Message($this->method,$this->data); $this->message->debug = $this->debug; @@ -286,9 +286,9 @@ class CI_Xmlrpc { //------------------------------------- // Returns Error - //------------------------------------- + //------------------------------------- - function display_error() + function display_error() { return $this->error; } @@ -296,9 +296,9 @@ class CI_Xmlrpc { //------------------------------------- // Returns Remote Server Response - //------------------------------------- + //------------------------------------- - function display_response() + function display_response() { return $this->response; } @@ -306,7 +306,7 @@ class CI_Xmlrpc { //------------------------------------- // Sends an Error Message for Server Request - //------------------------------------- + //------------------------------------- function send_error_message($number, $message) { @@ -317,7 +317,7 @@ class CI_Xmlrpc { //------------------------------------- // Send Response for Server Request - //------------------------------------- + //------------------------------------- function send_response($response) { @@ -336,7 +336,7 @@ class CI_Xmlrpc { /** * XML-RPC Client class - * + * * @category XML-RPC * @author Paul Burdick * @link http://www.codeigniter.com/user_guide/libraries/xmlrpc.html @@ -355,8 +355,8 @@ class XML_RPC_Client extends CI_Xmlrpc { parent::CI_Xmlrpc(); - $this->port = $port; - $this->server = $server; + $this->port = $port; + $this->server = $server; $this->path = $path; } @@ -414,7 +414,7 @@ class XML_RPC_Client extends CI_Xmlrpc /** * XML-RPC Response class - * + * * @category XML-RPC * @author Paul Burdick * @link http://www.codeigniter.com/user_guide/libraries/xmlrpc.html @@ -432,7 +432,7 @@ class XML_RPC_Response { // error $this->errno = $code; - $this->errstr = htmlentities($fstr); + $this->errstr = htmlentities($fstr); } else if (!is_object($val)) { @@ -484,7 +484,7 @@ class XML_RPC_Response else { $result .= "<params>\n<param>\n" . - $this->val->serialize_class() . + $this->val->serialize_class() . "</param>\n</params>"; } $result .= "\n</methodResponse>"; @@ -532,7 +532,7 @@ class XML_RPC_Response //------------------------------------- // XML-RPC Object to PHP Types - //------------------------------------- + //------------------------------------- function xmlrpc_decoder($xmlrpc_val) { @@ -554,7 +554,7 @@ class XML_RPC_Response { $arr[] = $this->xmlrpc_decoder($xmlrpc_val->me['array'][$i]); } - return $arr; + return $arr; } elseif($kind == 'struct') { @@ -572,7 +572,7 @@ class XML_RPC_Response //------------------------------------- // ISO-8601 time to server or UTC time - //------------------------------------- + //------------------------------------- function iso8601_decode($time, $utc=0) { @@ -584,7 +584,7 @@ class XML_RPC_Response $t = gmmktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]); else $t = mktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]); - } + } return $t; } @@ -594,7 +594,7 @@ class XML_RPC_Response /** * XML-RPC Message class - * + * * @category XML-RPC * @author Paul Burdick * @link http://www.codeigniter.com/user_guide/libraries/xmlrpc.html @@ -623,7 +623,7 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- // Create Payload to Send - //------------------------------------- + //------------------------------------- function createPayload() { @@ -643,7 +643,7 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- // Parse External XML-RPC Server's Response - //------------------------------------- + //------------------------------------- function parseResponse($fp) { @@ -667,7 +667,7 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- // Check for data - //------------------------------------- + //------------------------------------- if($data == "") { @@ -679,7 +679,7 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- // Check for HTTP 200 Response - //------------------------------------- + //------------------------------------- if(ereg("^HTTP",$data) && !ereg("^HTTP/[0-9\.]+ 200 ", $data)) { @@ -690,7 +690,7 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- // Create and Set Up XML Parser - //------------------------------------- + //------------------------------------- $parser = xml_parser_create($this->xmlrpc_defencoding); @@ -711,7 +711,7 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- // GET HEADERS - //------------------------------------- + //------------------------------------- $lines = explode("\r\n", $data); while (($line = array_shift($lines))) @@ -790,7 +790,7 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- // SEND RESPONSE - //------------------------------------- + //------------------------------------- $v = $this->xh[$parser]['value']; @@ -825,7 +825,7 @@ class XML_RPC_Message extends CI_Xmlrpc // ac - used to accumulate values // isf - used to indicate a fault // lv - used to indicate "looking for a value": implements - // the logic to allow values with no types to be strings + // the logic to allow values with no types to be strings // params - used to store parameters in method calls // method - used to store method name // stack - array with parent tree of the xml element, @@ -833,7 +833,7 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- // Start Element Handler - //------------------------------------- + //------------------------------------- function open_tag($the_parser, $name, $attrs) { @@ -870,7 +870,7 @@ class XML_RPC_Message extends CI_Xmlrpc $cur_val = array('value' => array(), 'type' => $name); - + array_unshift($this->xh[$the_parser]['valuestack'], $cur_val); break; case 'METHODNAME': @@ -935,7 +935,7 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- // End Element Handler - //------------------------------------- + //------------------------------------- function closing_tag($the_parser, $name) { @@ -974,7 +974,7 @@ class XML_RPC_Message extends CI_Xmlrpc } elseif ($name=='DATETIME.ISO8601') { - $this->xh[$the_parser]['vt'] = $this->xmlrpcDateTime; + $this->xh[$the_parser]['vt'] = $this->xmlrpcDateTime; $this->xh[$the_parser]['value'] = $this->xh[$the_parser]['ac']; } elseif ($name=='BASE64') @@ -1041,7 +1041,7 @@ class XML_RPC_Message extends CI_Xmlrpc else { // Struct - $this->xh[$the_parser]['value'] = $temp; + $this->xh[$the_parser]['value'] = $temp; } break; case 'MEMBER': @@ -1079,7 +1079,7 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- // Parses Character Data - //------------------------------------- + //------------------------------------- function character_data($the_parser, $data) { @@ -1130,21 +1130,21 @@ class XML_RPC_Message extends CI_Xmlrpc $parameters = array(); for ($i = 0; $i < sizeof($this->params); $i++) - { - $a_param = $this->decode_message($this->params[$i]); - - if (is_array($a_param)) - { - $parameters[] = $this->output_parameters($a_param); - } - else - { - $parameters[] = $CI->input->xss_clean($a_param); - } - } - } - - return $parameters; + { + $a_param = $this->decode_message($this->params[$i]); + + if (is_array($a_param)) + { + $parameters[] = $this->output_parameters($a_param); + } + else + { + $parameters[] = $CI->input->xss_clean($a_param); + } + } + } + + return $parameters; } @@ -1168,7 +1168,7 @@ class XML_RPC_Message extends CI_Xmlrpc $arr[] = $this->decode_message($param->me['array'][$i]); } - return $arr; + return $arr; } elseif($kind == 'struct') { @@ -1191,7 +1191,7 @@ class XML_RPC_Message extends CI_Xmlrpc /** * XML-RPC Values class - * + * * @category XML-RPC * @author Paul Burdick * @link http://www.codeigniter.com/user_guide/libraries/xmlrpc.html @@ -1387,7 +1387,7 @@ class XML_RPC_Values extends CI_Xmlrpc //------------------------------------- // Encode time in ISO-8601 form. - //------------------------------------- + //------------------------------------- // Useful for sending time in XML-RPC diff --git a/system/libraries/Xmlrpcs.php b/system/libraries/Xmlrpcs.php index e4d3cffde..bdb058e82 100644 --- a/system/libraries/Xmlrpcs.php +++ b/system/libraries/Xmlrpcs.php @@ -7,7 +7,7 @@ * @package CodeIgniter * @author Rick Ellis, Paul Burdick * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource @@ -15,19 +15,19 @@ if ( ! function_exists('xml_parser_create')) { - show_error('Your PHP installation does not support XML'); + show_error('Your PHP installation does not support XML'); } if ( ! class_exists('CI_Xmlrpc')) { - show_error('You must load the Xmlrpc class before loading the Xmlrpcs class in order to create a server.'); + show_error('You must load the Xmlrpc class before loading the Xmlrpcs class in order to create a server.'); } // ------------------------------------------------------------------------ /** * XML-RPC server class - * + * * @package CodeIgniter * @subpackage Libraries * @category XML-RPC @@ -44,7 +44,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Constructor, more or less - //------------------------------------- + //------------------------------------- function CI_Xmlrpcs($config=array()) { @@ -61,7 +61,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Initialize Prefs and Serve - //------------------------------------- + //------------------------------------- function initialize($config=array()) { @@ -78,7 +78,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Setting of System Methods - //------------------------------------- + //------------------------------------- function set_system_methods () { @@ -105,7 +105,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Main Server Function - //------------------------------------- + //------------------------------------- function serve() { @@ -121,7 +121,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Add Method to Class - //------------------------------------- + //------------------------------------- function add_to_map($methodname,$function,$sig,$doc) { @@ -135,7 +135,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Parse Server Request - //------------------------------------- + //------------------------------------- function parseRequest($data='') { @@ -143,7 +143,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Get Data - //------------------------------------- + //------------------------------------- if ($data == '') { @@ -153,7 +153,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Set up XML Parser - //------------------------------------- + //------------------------------------- $parser = xml_parser_create($this->xmlrpc_defencoding); $parser_object = new XML_RPC_Message("filler"); @@ -221,7 +221,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc // SET DEBUGGING MESSAGE //------------------------------------- - if ($this->debug === TRUE) + if ($this->debug === TRUE) { $this->debug_msg = "<!-- DEBUG INFO:\n\n".$plist."\n END DEBUG-->\n"; } @@ -231,7 +231,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Executes the Method - //------------------------------------- + //------------------------------------- function _execute($m) { @@ -244,7 +244,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Check for Function - //------------------------------------- + //------------------------------------- if (!isset($methods[$methName]['function'])) { @@ -275,7 +275,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Checking Methods Signature - //------------------------------------- + //------------------------------------- if (isset($methods[$methName]['signature'])) { @@ -298,7 +298,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc return new XML_RPC_Response(0, $this->xmlrpcerr['incorrect_params'], - $this->xmlrpcstr['incorrect_params'] . + $this->xmlrpcstr['incorrect_params'] . ": Wanted {$wanted}, got {$pt} at param {$pno})"); } } @@ -308,7 +308,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Calls the Function - //------------------------------------- + //------------------------------------- if ($objectCall) { @@ -334,7 +334,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Server Function: List Methods - //------------------------------------- + //------------------------------------- function listMethods($m) { @@ -356,7 +356,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Server Function: Return Signature for Method - //------------------------------------- + //------------------------------------- function methodSignature($m) { @@ -398,7 +398,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Server Function: Doc String for Method - //------------------------------------- + //------------------------------------- function methodHelp($m) { @@ -421,7 +421,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Server Function: Multi-call - //------------------------------------- + //------------------------------------- function multicall($m) { @@ -441,7 +441,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Multi-call Function: Error Handling - //------------------------------------- + //------------------------------------- function multicall_error($err) { @@ -457,7 +457,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Multi-call Function: Processes method - //------------------------------------- + //------------------------------------- function do_multicall($call) { @@ -469,7 +469,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc list($scalar_type,$scalar_value)=each($methName->me); $scalar_type = $scalar_type == $this->xmlrpcI4 ? $this->xmlrpcInt : $scalar_type; - if ($methName->kindOf() != 'scalar' || $scalar_type != 'string') + if ($methName->kindOf() != 'scalar' || $scalar_type != 'string') return $this->multicall_error('notstring'); elseif ($scalar_value == 'system.multicall') return $this->multicall_error('recursion'); diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index 6af1ca979..092f9f378 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -21,16 +21,16 @@ * This class is based on a library I found at Zend: * http://www.zend.com/codex.php?id=696&single=1 * - * The original library is a little rough around the edges so I + * The original library is a little rough around the edges so I * refactored it and added several additional methods -- Rick Ellis - * + * * @package CodeIgniter * @subpackage Libraries * @category Encryption * @author Rick Ellis * @link http://www.codeigniter.com/user_guide/general/encryption.html */ -class CI_Zip { +class CI_Zip { var $zipfile = ''; var $zipdata = array(); @@ -53,7 +53,7 @@ class CI_Zip { * @param mixed the directory name. Can be string or array * @return void */ - function add_dir($directory) + function add_dir($directory) { foreach ((array)$directory as $dir) { @@ -75,9 +75,9 @@ class CI_Zip { * @param string the directory name * @return void */ - function _add_dir($dir) + function _add_dir($dir) { - $dir = str_replace("\\", "/", $dir); + $dir = str_replace("\\", "/", $dir); $this->zipdata[] = "\x50\x4b\x03\x04\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00" .pack('V', 0) @@ -88,7 +88,7 @@ class CI_Zip { .$dir .pack('V', 0) .pack('V', 0) - .pack('V', 0); + .pack('V', 0); $newoffset = strlen(implode('', $this->zipdata)); @@ -106,7 +106,7 @@ class CI_Zip { .$dir; $this->offset = $newoffset; - $this->directory[] = $record; + $this->directory[] = $record; } // -------------------------------------------------------------------- @@ -150,14 +150,14 @@ class CI_Zip { */ function _add_data($filepath, $data) { - $filepath = str_replace("\\", "/", $filepath); + $filepath = str_replace("\\", "/", $filepath); - $oldlen = strlen($data); - $crc32 = crc32($data); + $oldlen = strlen($data); + $crc32 = crc32($data); $gzdata = gzcompress($data); $gzdata = substr(substr($gzdata, 0, strlen($gzdata) - 4), 2); - $newlen = strlen($gzdata); + $newlen = strlen($gzdata); $this->zipdata[] = "\x50\x4b\x03\x04\x14\x00\x00\x00\x08\x00\x00\x00\x00\x00" .pack('V', $crc32) @@ -169,7 +169,7 @@ class CI_Zip { .$gzdata .pack('V', $crc32) .pack('V', $newlen) - .pack('V', $oldlen); + .pack('V', $oldlen); $newoffset = strlen(implode("", $this->zipdata)); @@ -183,10 +183,10 @@ class CI_Zip { .pack('v', 0) .pack('v', 0) .pack('V', 32) - .pack('V', $this->offset); + .pack('V', $this->offset); $this->offset = $newoffset; - $this->directory[] = $record.$filepath; + $this->directory[] = $record.$filepath; } // -------------------------------------------------------------------- @@ -198,7 +198,7 @@ class CI_Zip { * @return binary string */ function get_zip() - { + { // We cache the zip data so multiple calls // do not require recompiling if ($this->zipfile != '') @@ -212,8 +212,8 @@ class CI_Zip { return FALSE; } - $data = implode('', $this->zipdata); - $dir = implode('', $this->directory); + $data = implode('', $this->zipdata); + $dir = implode('', $this->directory); $this->zipfile = $data.$dir."\x50\x4b\x05\x06\x00\x00\x00\x00" .pack('v', sizeof($this->directory)) @@ -278,8 +278,8 @@ class CI_Zip { header("Content-Transfer-Encoding: binary"); header('Pragma: public'); header("Content-Length: ".strlen($this->get_zip())); - } - else + } + else { header('Content-Type: application/x-zip'); header('Content-Disposition: attachment; filename="'.$filename.'"'); @@ -297,7 +297,7 @@ class CI_Zip { /** * Initialize Data * - * Lets you clear current zip data. Useful if you need to create + * Lets you clear current zip data. Useful if you need to create * multiple zips with different data. * * @access public diff --git a/system/plugins/captcha_pi.php b/system/plugins/captcha_pi.php index 54944b823..b3c22f092 100644 --- a/system/plugins/captcha_pi.php +++ b/system/plugins/captcha_pi.php @@ -7,19 +7,19 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /* Instructions: Load the plugin using: - + $this->load->plugin('captcha'); Once loaded you can generate a captcha like this: @@ -42,9 +42,9 @@ NOTES: The captcha function requires the GD image library. - Only the img_path and img_url are required. + Only the img_path and img_url are required. - If a "word" is not supplied, the function will generate a random + If a "word" is not supplied, the function will generate a random ASCII string. You might put together your own word library that you can draw randomly from. @@ -56,11 +56,11 @@ NOTES: The "expiration" (in seconds) signifies how long an image will remain in the captcha folder before it will be deleted. The default is two hours. - + RETURNED DATA The create_captcha() function returns an associative array with this data: - + [array] ( 'image' => IMAGE TAG @@ -68,10 +68,10 @@ The create_captcha() function returns an associative array with this data: 'word' => CAPTCHA WORD ) -The "image" is the actual image tag: +The "image" is the actual image tag: <img src="http://your-site.com/captcha/12345.jpg" width="140" height="50" /> -The "time" is the micro timestamp used as the image name without the file +The "time" is the micro timestamp used as the image name without the file extension. It will be a number like this: 1139612155.3422 The "word" is the word that appears in the captcha image, which if not @@ -81,12 +81,12 @@ supplied to the function, will be a random string. ADDING A DATABASE In order for the captcha function to prevent someone from posting, you will need -to add the information returned from create_captcha() function to your database. -Then, when the data from the form is submitted by the user you will need to verify +to add the information returned from create_captcha() function to your database. +Then, when the data from the form is submitted by the user you will need to verify that the data exists in the database and has not expired. Here is a table prototype: - + CREATE TABLE captcha ( captcha_id bigint(13) unsigned NOT NULL auto_increment, captcha_time int(10) unsigned NOT NULL, @@ -98,7 +98,7 @@ Here is a table prototype: Here is an example of usage with a DB. - + On the page where the captcha will be shown you'll have something like this: $this->load->plugin('captcha'); @@ -110,10 +110,10 @@ On the page where the captcha will be shown you'll have something like this: $cap = create_captcha($vals); $data = array( - 'captcha_id' => '', - 'captcha_time' => $cap['time'], + 'captcha_id' => '', + 'captcha_time' => $cap['time'], 'ip_address' => $this->input->ip_address(), - 'word' => $cap['word'] + 'word' => $cap['word'] ); $query = $this->db->insert_string('captcha', $data); @@ -127,7 +127,7 @@ On the page where the captcha will be shown you'll have something like this: Then, on the page that accepts the submission you'll have something like this: // First, delete old captchas - $expiration = time()-7200; // Two hour limit + $expiration = time()-7200; // Two hour limit $DB->query("DELETE FROM captcha WHERE captcha_time < ".$expiration); // Then see if a captcha exists: @@ -175,7 +175,7 @@ function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = return FALSE; } - if ( ! @is_dir($img_path)) + if ( ! @is_dir($img_path)) { return FALSE; } @@ -200,7 +200,7 @@ function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = $current_dir = @opendir($img_path); while($filename = @readdir($current_dir)) - { + { if ($filename != "." and $filename != ".." and $filename != "index.html") { $name = str_replace(".jpg", "", $filename); @@ -223,13 +223,13 @@ function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $str = ''; - for ($i = 0; $i < 8; $i++) - { - $str .= substr($pool, mt_rand(0, strlen($pool) -1), 1); + for ($i = 0; $i < 8; $i++) + { + $str .= substr($pool, mt_rand(0, strlen($pool) -1), 1); } $word = $str; - } + } // ----------------------------------- // Determine angle and position @@ -267,12 +267,12 @@ function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = // ----------------------------------- $theta = 1; - $thetac = 7; - $radius = 16; - $circles = 20; + $thetac = 7; + $radius = 16; + $circles = 20; $points = 32; - for ($i = 0; $i < ($circles * $points) - 1; $i++) + for ($i = 0; $i < ($circles * $points) - 1; $i++) { $theta = $theta + $thetac; $rad = $radius * ($i / $points ); diff --git a/system/plugins/js_calendar_pi.php b/system/plugins/js_calendar_pi.php index 16c3f4136..987bd49ed 100644 --- a/system/plugins/js_calendar_pi.php +++ b/system/plugins/js_calendar_pi.php @@ -7,19 +7,19 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /* Instructions: Load the plugin using: - + $this->load->plugin('js_calendar'); Once loaded you'll add the calendar script to the <head> of your page like this: @@ -123,13 +123,13 @@ Lastly, you'll need some CSS for your calendar: */ - + function js_calendar_script($form_name = 'entryform') -{ +{ ob_start(); ?> -<script type="text/javascript"> +<script type="text/javascript"> <!-- var form_name = "<?php echo $form_name; ?>"; var format = 'us'; // eu or us @@ -167,7 +167,7 @@ function calendar(id, d, highlight, adjusted) } else { - this.selected_date = this.year + '' + this.month + '' + this.date; + this.selected_date = this.year + '' + this.month + '' + this.date; } // Set the "selected date" @@ -253,7 +253,7 @@ function total_days() if (( this.date_obj.getFullYear() % 4 == 0 && this.date_obj.getFullYear() % 100 != 0) || this.date_obj.getFullYear() % 400 == 0) - return 29; + return 29; else return 28; case 3: @@ -361,7 +361,7 @@ function update_calendar(id, dateValue) if (dateParts.length < 3) return; var newYear = dateParts[0]; var newMonth = dateParts[1]; - var newDay = dateParts[2]; + var newDay = dateParts[2]; if (isNaN(newDay) || newDay < 1 || (newDay.length != 1 && newDay.length != 2)) return; if (isNaN(newYear) || newYear < 1 || newYear.length != 4) return; @@ -376,7 +376,7 @@ function update_calendar(id, dateValue) case 1: // Check for leap year if ((newYear % 4 == 0 && newYear % 100 != 0) || newYear % 400 == 0) { - if (newDay > 29) newDay = 29; + if (newDay > 29) newDay = 29; } else { @@ -500,7 +500,7 @@ function change_month(mo, cal) var newMonth = cal.date_obj.getMonth() + mo; var newDate = cal.date_obj.getDate(); - if (newMonth == 12) + if (newMonth == 12) { cal.date_obj.setYear(cal.date_obj.getFullYear() + 1) newMonth = 0; @@ -520,7 +520,7 @@ function change_month(mo, cal) case 1: // Check for leap year if ((newYear % 4 == 0 && newYear % 100 != 0) || newYear % 400 == 0) { - if (newDate > 29) newDate = 29; + if (newDate > 29) newDate = 29; } else { @@ -584,7 +584,7 @@ function date_str(time) <?php $r = ob_get_contents(); -ob_end_clean(); +ob_end_clean(); return $r; } diff --git a/system/scaffolding/Scaffolding.php b/system/scaffolding/Scaffolding.php index 6c4b3a537..60b608d6c 100644 --- a/system/scaffolding/Scaffolding.php +++ b/system/scaffolding/Scaffolding.php @@ -7,17 +7,17 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * Scaffolding Class - * + * * Provides the Scaffolding framework * * @package CodeIgniter @@ -55,7 +55,7 @@ class Scaffolding { * We'll manually override the "view" path so that * the load->view function knows where to look. */ - + $this->CI->load->_ci_view_path = BASEPATH.'scaffolding/views/'; // Set the base URL diff --git a/system/scaffolding/views/stylesheet.css b/system/scaffolding/views/stylesheet.css index 55c8d9e59..e2e3aa574 100644 --- a/system/scaffolding/views/stylesheet.css +++ b/system/scaffolding/views/stylesheet.css @@ -106,7 +106,7 @@ form { height: 2em; padding: 0; margin: 0; -} +} .textarea { font-family: Lucida Grande, Verdana, Geneva, Sans-serif; |