summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBarry Mieny <barry@mieny.com>2010-10-04 16:33:58 +0200
committerBarry Mieny <barry@mieny.com>2010-10-04 16:33:58 +0200
commitdd6719738936be31cdaa1758ca86d5eb14dcab3d (patch)
treeb5ef66e31b2d0f4f2c1cbccc367bde92c156e1f9
parent3351fbc56cea19ec3dd603836beb0a420b1ded65 (diff)
Cleanup of stray spaces and tabs
-rw-r--r--application/config/autoload.php2
-rw-r--r--application/config/config.php12
-rw-r--r--application/config/constants.php12
-rw-r--r--application/config/foreign_chars.php74
-rw-r--r--application/config/routes.php2
-rw-r--r--application/config/smileys.php2
-rw-r--r--application/config/user_agents.php6
-rw-r--r--application/controllers/welcome.php4
-rw-r--r--application/errors/error_404.php2
-rw-r--r--application/errors/error_db.php2
-rw-r--r--application/errors/error_general.php2
-rw-r--r--index.php42
-rw-r--r--system/core/Base4.php8
-rw-r--r--system/core/Base5.php2
-rw-r--r--system/core/Benchmark.php4
-rw-r--r--system/core/CodeIgniter.php64
-rw-r--r--system/core/Common.php70
-rw-r--r--system/core/Compat.php10
-rw-r--r--system/core/Config.php48
-rw-r--r--system/core/Controller.php16
-rw-r--r--system/core/Exceptions.php26
-rw-r--r--system/core/Hooks.php16
-rw-r--r--system/core/Input.php8
-rw-r--r--system/core/Lang.php2
-rw-r--r--system/core/Loader.php298
-rw-r--r--system/core/Model.php14
-rw-r--r--system/core/Output.php142
-rw-r--r--system/core/Router.php156
-rw-r--r--system/core/URI.php6
-rw-r--r--system/core/Unicode.php28
-rw-r--r--system/database/DB.php46
-rw-r--r--system/database/DB_active_rec.php378
-rw-r--r--system/database/DB_cache.php54
-rw-r--r--system/database/DB_driver.php332
-rw-r--r--system/database/DB_forge.php72
-rw-r--r--system/database/DB_result.php80
-rw-r--r--system/database/DB_utility.php84
-rw-r--r--system/database/drivers/mssql/mssql_driver.php120
-rw-r--r--system/database/drivers/mssql/mssql_forge.php34
-rw-r--r--system/database/drivers/mssql/mssql_result.php24
-rw-r--r--system/database/drivers/mssql/mssql_utility.php2
-rw-r--r--system/database/drivers/mysql/mysql_driver.php144
-rw-r--r--system/database/drivers/mysql/mysql_forge.php30
-rw-r--r--system/database/drivers/mysql/mysql_result.php24
-rw-r--r--system/database/drivers/mysql/mysql_utility.php46
-rw-r--r--system/database/drivers/mysqli/mysqli_driver.php120
-rw-r--r--system/database/drivers/mysqli/mysqli_forge.php30
-rw-r--r--system/database/drivers/mysqli/mysqli_result.php24
-rw-r--r--system/database/drivers/mysqli/mysqli_utility.php4
-rw-r--r--system/database/drivers/oci8/oci8_driver.php104
-rw-r--r--system/database/drivers/oci8/oci8_forge.php32
-rw-r--r--system/database/drivers/oci8/oci8_result.php30
-rw-r--r--system/database/drivers/odbc/odbc_driver.php108
-rw-r--r--system/database/drivers/odbc/odbc_forge.php38
-rw-r--r--system/database/drivers/odbc/odbc_result.php18
-rw-r--r--system/database/drivers/odbc/odbc_utility.php6
-rw-r--r--system/database/drivers/postgre/postgre_driver.php116
-rw-r--r--system/database/drivers/postgre/postgre_forge.php32
-rw-r--r--system/database/drivers/postgre/postgre_result.php18
-rw-r--r--system/database/drivers/sqlite/sqlite_driver.php124
-rw-r--r--system/database/drivers/sqlite/sqlite_forge.php30
-rw-r--r--system/database/drivers/sqlite/sqlite_result.php20
-rw-r--r--system/fonts/texb.ttfbin143821 -> 152992 bytes
-rw-r--r--system/helpers/array_helper.php8
-rw-r--r--system/helpers/captcha_helper.php74
-rw-r--r--system/helpers/compatibility_helper.php96
-rw-r--r--system/helpers/cookie_helper.php8
-rw-r--r--system/helpers/date_helper.php170
-rw-r--r--system/helpers/directory_helper.php8
-rw-r--r--system/helpers/download_helper.php10
-rw-r--r--system/helpers/email_helper.php4
-rw-r--r--system/helpers/file_helper.php70
-rw-r--r--system/helpers/form_helper.php36
-rw-r--r--system/helpers/html_helper.php6
-rw-r--r--system/helpers/inflector_helper.php44
-rw-r--r--system/helpers/language_helper.php2
-rw-r--r--system/helpers/number_helper.php12
-rw-r--r--system/helpers/path_helper.php10
-rw-r--r--system/helpers/security_helper.php24
-rw-r--r--system/helpers/smiley_helper.php36
-rw-r--r--system/helpers/string_helper.php62
-rw-r--r--system/helpers/text_helper.php264
-rw-r--r--system/helpers/typography_helper.php12
-rw-r--r--system/helpers/url_helper.php24
-rw-r--r--system/helpers/xml_helper.php18
-rw-r--r--system/language/english/calendar_lang.php66
-rw-r--r--system/language/english/form_validation_lang.php8
-rw-r--r--system/language/english/profiler_lang.php2
-rw-r--r--system/libraries/Calendar.php156
-rw-r--r--system/libraries/Cart.php140
-rw-r--r--system/libraries/Driver.php44
-rw-r--r--system/libraries/Email.php124
-rw-r--r--system/libraries/Encrypt.php30
-rw-r--r--system/libraries/Form_validation.php436
-rw-r--r--system/libraries/Ftp.php14
-rw-r--r--system/libraries/Image_lib.php42
-rw-r--r--system/libraries/Javascript.php172
-rw-r--r--system/libraries/Log.php34
-rw-r--r--system/libraries/Pagination.php20
-rw-r--r--system/libraries/Parser.php26
-rw-r--r--system/libraries/Profiler.php184
-rw-r--r--system/libraries/Security.php142
-rw-r--r--system/libraries/Session.php24
-rw-r--r--system/libraries/Sha1.php22
-rw-r--r--system/libraries/Table.php156
-rw-r--r--system/libraries/Trackback.php246
-rw-r--r--system/libraries/Typography.php140
-rw-r--r--system/libraries/Unit_test.php110
-rw-r--r--system/libraries/Upload.php298
-rw-r--r--system/libraries/User_agent.php166
-rw-r--r--system/libraries/Xmlrpc.php326
-rw-r--r--system/libraries/Xmlrpcs.php152
-rw-r--r--system/libraries/Zip.php56
-rw-r--r--system/libraries/javascript/Jquery.php28
-rw-r--r--user_guide/changelog.html28
-rw-r--r--user_guide/database/active_record.html74
-rw-r--r--user_guide/database/call_function.html2
-rw-r--r--user_guide/database/fields.html2
-rw-r--r--user_guide/database/index.html2
-rw-r--r--user_guide/database/queries.html2
-rw-r--r--user_guide/database/results.html30
-rw-r--r--user_guide/database/table_data.html2
-rw-r--r--user_guide/doc_style/template.html2
-rw-r--r--user_guide/general/alternative_php.html4
-rw-r--r--user_guide/general/creating_libraries.html2
-rw-r--r--user_guide/general/credits.html4
-rw-r--r--user_guide/general/drivers.html2
-rw-r--r--user_guide/general/managing_apps.html6
-rw-r--r--user_guide/general/models.html2
-rw-r--r--user_guide/general/profiling.html4
-rw-r--r--user_guide/general/styleguide.html124
-rw-r--r--user_guide/general/views.html10
-rw-r--r--user_guide/helpers/captcha_helper.html18
-rw-r--r--user_guide/helpers/compatibility_helper.html2
-rw-r--r--user_guide/helpers/date_helper.html4
-rw-r--r--user_guide/helpers/directory_helper.html2
-rw-r--r--user_guide/helpers/form_helper.html6
-rw-r--r--user_guide/helpers/html_helper.html4
-rw-r--r--user_guide/helpers/smiley_helper.html14
-rw-r--r--user_guide/helpers/string_helper.html2
-rw-r--r--user_guide/helpers/text_helper.html2
-rw-r--r--user_guide/images/ci_logo.jpgbin5602 -> 9035 bytes
-rw-r--r--user_guide/images/ci_logo_flame.jpgbin8589 -> 13862 bytes
-rw-r--r--user_guide/images/ci_quick_ref.pngbin94476 -> 150187 bytes
-rw-r--r--user_guide/images/codeigniter_1.7.1_helper_reference.pngbin67388 -> 109471 bytes
-rw-r--r--user_guide/images/codeigniter_1.7.1_library_reference.pngbin111747 -> 182066 bytes
-rw-r--r--user_guide/images/nav_bg.jpgbin441 -> 503 bytes
-rw-r--r--user_guide/installation/downloads.html4
-rw-r--r--user_guide/installation/index.html2
-rw-r--r--user_guide/installation/upgrade_160.html2
-rw-r--r--user_guide/installation/upgrade_170.html4
-rw-r--r--user_guide/installation/upgrade_200.html6
-rw-r--r--user_guide/libraries/calendar.html2
-rw-r--r--user_guide/libraries/cart.html18
-rw-r--r--user_guide/libraries/email.html4
-rw-r--r--user_guide/libraries/file_uploading.html18
-rw-r--r--user_guide/libraries/form_validation.html30
-rw-r--r--user_guide/libraries/ftp.html12
-rw-r--r--user_guide/libraries/image_lib.html2
-rw-r--r--user_guide/libraries/loader.html6
-rw-r--r--user_guide/libraries/output.html4
-rw-r--r--user_guide/libraries/pagination.html2
-rw-r--r--user_guide/libraries/table.html8
-rw-r--r--user_guide/libraries/typography.html2
-rw-r--r--user_guide/libraries/unit_testing.html2
-rw-r--r--user_guide/libraries/xmlrpc.html32
-rwxr-xr-xuser_guide/nav/moo.fx.js4
-rwxr-xr-xuser_guide/nav/moo.fx.pack.js6
-rw-r--r--user_guide/overview/at_a_glance.html2
-rw-r--r--user_guide/overview/index.html2
-rw-r--r--user_guide/toc.html10
171 files changed, 4153 insertions, 4153 deletions
diff --git a/application/config/autoload.php b/application/config/autoload.php
index 35ad6288f..5e9740844 100644
--- a/application/config/autoload.php
+++ b/application/config/autoload.php
@@ -77,7 +77,7 @@ $autoload['config'] = array();
|
| $autoload['language'] = array('lang1', 'lang2');
|
-| NOTE: Do not include the "_lang" part of your file. For example
+| NOTE: Do not include the "_lang" part of your file. For example
| "codeigniter_lang.php" would be referenced as array('codeigniter');
|
*/
diff --git a/application/config/config.php b/application/config/config.php
index 3f2be480f..e318a2ab7 100644
--- a/application/config/config.php
+++ b/application/config/config.php
@@ -149,16 +149,16 @@ $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
|
*/
$config['enable_query_strings'] = FALSE;
-$config['controller_trigger'] = 'c';
-$config['function_trigger'] = 'm';
-$config['directory_trigger'] = 'd'; // experimental not currently in use
+$config['controller_trigger'] = 'c';
+$config['function_trigger'] = 'm';
+$config['directory_trigger'] = 'd'; // experimental not currently in use
/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
-| If you have enabled error logging, you can set an error threshold to
+| If you have enabled error logging, you can set an error threshold to
| determine what gets logged. Threshold options are:
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
@@ -225,7 +225,7 @@ $config['encryption_key'] = "";
|--------------------------------------------------------------------------
|
| 'sess_cookie_name' = the name you want for the cookie
-| 'sess_expiration' = the number of SECONDS you want the session to last.
+| 'sess_expiration' = the number of SECONDS you want the session to last.
| by default sessions last 7200 seconds (two hours). Set to zero for no expiration.
| 'sess_expire_on_close' = Whether to cause the session to expire automatically
| when the browser window is closed
@@ -245,7 +245,7 @@ $config['sess_use_database'] = FALSE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
-$config['sess_time_to_update'] = 300;
+$config['sess_time_to_update'] = 300;
/*
|--------------------------------------------------------------------------
diff --git a/application/config/constants.php b/application/config/constants.php
index 1551cbcab..4a879d360 100644
--- a/application/config/constants.php
+++ b/application/config/constants.php
@@ -27,13 +27,13 @@ define('DIR_WRITE_MODE', 0777);
|
*/
-define('FOPEN_READ', 'rb');
+define('FOPEN_READ', 'rb');
define('FOPEN_READ_WRITE', 'r+b');
-define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
-define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
-define('FOPEN_WRITE_CREATE', 'ab');
-define('FOPEN_READ_WRITE_CREATE', 'a+b');
-define('FOPEN_WRITE_CREATE_STRICT', 'xb');
+define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
+define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
+define('FOPEN_WRITE_CREATE', 'ab');
+define('FOPEN_READ_WRITE_CREATE', 'a+b');
+define('FOPEN_WRITE_CREATE_STRICT', 'xb');
define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
diff --git a/application/config/foreign_chars.php b/application/config/foreign_chars.php
index 59a7d234a..e106ad800 100644
--- a/application/config/foreign_chars.php
+++ b/application/config/foreign_chars.php
@@ -8,56 +8,56 @@
|
*/
$foreign_characters = array('223' => "ss", // ß
- '224' => "a",
- '225' => "a",
- '226' => "a",
+ '224' => "a",
+ '225' => "a",
+ '226' => "a",
'229' => "a",
- '227' => "ae",
- '230' => "ae",
+ '227' => "ae",
+ '230' => "ae",
'228' => "ae",
'231' => "c",
'232' => "e", // è
'233' => "e", // é
- '234' => "e", // ê
+ '234' => "e", // ê
'235' => "e", // ë
- '236' => "i",
- '237' => "i",
- '238' => "i",
- '239' => "i",
+ '236' => "i",
+ '237' => "i",
+ '238' => "i",
+ '239' => "i",
'241' => "n",
- '242' => "o",
- '243' => "o",
- '244' => "o",
+ '242' => "o",
+ '243' => "o",
+ '244' => "o",
'245' => "o",
'246' => "oe", // ö
- '249' => "u",
- '250' => "u",
- '251' => "u",
+ '249' => "u",
+ '250' => "u",
+ '251' => "u",
'252' => "ue", // ü
'255' => "y",
- '257' => "aa",
- '269' => "ch",
- '275' => "ee",
- '291' => "gj",
- '299' => "ii",
- '311' => "kj",
- '316' => "lj",
- '326' => "nj",
- '353' => "sh",
- '363' => "uu",
+ '257' => "aa",
+ '269' => "ch",
+ '275' => "ee",
+ '291' => "gj",
+ '299' => "ii",
+ '311' => "kj",
+ '316' => "lj",
+ '326' => "nj",
+ '353' => "sh",
+ '363' => "uu",
'382' => "zh",
- '256' => "aa",
- '268' => "ch",
- '274' => "ee",
- '290' => "gj",
- '298' => "ii",
- '310' => "kj",
- '315' => "lj",
- '325' => "nj",
- '352' => "sh",
- '362' => "uu",
+ '256' => "aa",
+ '268' => "ch",
+ '274' => "ee",
+ '290' => "gj",
+ '298' => "ii",
+ '310' => "kj",
+ '315' => "lj",
+ '325' => "nj",
+ '352' => "sh",
+ '362' => "uu",
'381' => "zh",
- );
+ );
/* End of file foreign_chars.php */
diff --git a/application/config/routes.php b/application/config/routes.php
index 57af9850b..614462fd9 100644
--- a/application/config/routes.php
+++ b/application/config/routes.php
@@ -9,7 +9,7 @@
| and its corresponding controller class/method. The segments in a
| URL normally follow this pattern:
|
-| example.com/class/method/id/
+| example.com/class/method/id/
|
| In some instances, however, you may want to remap this relationship
| so that a different class/function is called than the one
diff --git a/application/config/smileys.php b/application/config/smileys.php
index 31a60c656..25d28b2c4 100644
--- a/application/config/smileys.php
+++ b/application/config/smileys.php
@@ -7,7 +7,7 @@
| Individual images can be used to replace multiple simileys. For example:
| :-) and :) use the same image replacement.
|
-| Please see user guide for more info:
+| Please see user guide for more info:
| http://codeigniter.com/user_guide/helpers/smiley_helper.html
|
*/
diff --git a/application/config/user_agents.php b/application/config/user_agents.php
index 3be200942..985deed24 100644
--- a/application/config/user_agents.php
+++ b/application/config/user_agents.php
@@ -113,7 +113,7 @@ $mobiles = array(
'benq' => "BenQ",
'ipaq' => "HP iPaq",
'mot-' => "Motorola",
- 'playstation portable' => "PlayStation Portable",
+ 'playstation portable' => "PlayStation Portable",
'hiptop' => "Danger Hiptop",
'nec-' => "NEC",
'panasonic' => "Panasonic",
@@ -126,7 +126,7 @@ $mobiles = array(
// Operating Systems
'symbian' => "Symbian",
- 'SymbianOS' => "SymbianOS",
+ 'SymbianOS' => "SymbianOS",
'elaine' => "Palm",
'palm' => "Palm",
'series60' => "Symbian S60",
@@ -151,7 +151,7 @@ $mobiles = array(
// Fallback
'mobile' => "Generic Mobile",
- 'wireless' => "Generic Mobile",
+ 'wireless' => "Generic Mobile",
'j2me' => "Generic Mobile",
'midp' => "Generic Mobile",
'cldc' => "Generic Mobile",
diff --git a/application/controllers/welcome.php b/application/controllers/welcome.php
index bd134e7e6..2e4cff8ed 100644
--- a/application/controllers/welcome.php
+++ b/application/controllers/welcome.php
@@ -4,9 +4,9 @@ class Welcome extends Controller {
function Welcome()
{
- parent::Controller();
+ parent::Controller();
}
-
+
function index()
{
$this->load->view('welcome_message');
diff --git a/application/errors/error_404.php b/application/errors/error_404.php
index 1c513a205..a304f4561 100644
--- a/application/errors/error_404.php
+++ b/application/errors/error_404.php
@@ -21,7 +21,7 @@ h1 {
font-weight: normal;
font-size: 14px;
color: #990000;
-margin: 0 0 4px 0;
+margin: 0 0 4px 0;
}
</style>
</head>
diff --git a/application/errors/error_db.php b/application/errors/error_db.php
index 1ce52dfc9..181de960b 100644
--- a/application/errors/error_db.php
+++ b/application/errors/error_db.php
@@ -21,7 +21,7 @@ h1 {
font-weight: normal;
font-size: 14px;
color: #990000;
-margin: 0 0 4px 0;
+margin: 0 0 4px 0;
}
</style>
</head>
diff --git a/application/errors/error_general.php b/application/errors/error_general.php
index d8610702b..7734d34c7 100644
--- a/application/errors/error_general.php
+++ b/application/errors/error_general.php
@@ -21,7 +21,7 @@ h1 {
font-weight: normal;
font-size: 14px;
color: #990000;
-margin: 0 0 4px 0;
+margin: 0 0 4px 0;
}
</style>
</head>
diff --git a/index.php b/index.php
index 0eef7b895..6ac782215 100644
--- a/index.php
+++ b/index.php
@@ -30,7 +30,7 @@
*---------------------------------------------------------------
*
* If you want this front controller to use a different "application"
- * folder then the default one you can set its name here. The folder
+ * folder then the default one you can set its name here. The folder
* can also be renamed or relocated anywhere on your server. If
* you do, use a full server path. For more info please see the user guide:
* http://codeigniter.com/user_guide/general/managing_apps.html
@@ -46,9 +46,9 @@
* --------------------------------------------------------------------
*
* Normally you will set your default controller in the routes.php file.
- * You can, however, force a custom routing by hard-coding a
+ * You can, however, force a custom routing by hard-coding a
* specific controller class/function here. For most applications, you
- * WILL NOT set your routing here, but it's an option for those
+ * WILL NOT set your routing here, but it's an option for those
* special instances where you might want to override the standard
* routing in a specific front controller that shares a common CI installation.
*
@@ -60,14 +60,14 @@
* Un-comment the $routing array below to use this feature
*
*/
- // The directory name, relative to the "controllers" folder. Leave blank
- // if your controller is not in a sub-folder within the "controllers" folder
+ // The directory name, relative to the "controllers" folder. Leave blank
+ // if your controller is not in a sub-folder within the "controllers" folder
// $routing['directory'] = '';
-
+
// The controller class file name. Example: Mycontroller.php
// $routing['controller'] = '';
-
- // The controller function you wish to be called.
+
+ // The controller function you wish to be called.
// $routing['function'] = '';
@@ -77,10 +77,10 @@
* -------------------------------------------------------------------
*
* The $assign_to_config array below will be passed dynamically to the
- * config class when initialized. This allows you to set custom config
- * items or override any default config values found in the config.php file.
+ * config class when initialized. This allows you to set custom config
+ * items or override any default config values found in the config.php file.
* This can be handy as it permits you to share one application between
- * multiple front controller files, with each file containing different
+ * multiple front controller files, with each file containing different
* config values.
*
* Un-comment the $assign_to_config array below to use this feature
@@ -106,35 +106,35 @@
{
$system_path = realpath($system_path).'/';
}
-
+
// ensure there's a trailing slash
$system_path = rtrim($system_path, '/').'/';
// Is the system path correct?
if ( ! is_dir($system_path))
{
- exit("Your system folder path does not appear to be set correctly. Please open the following file and correct this: ".pathinfo(__FILE__, PATHINFO_BASENAME));
+ exit("Your system folder path does not appear to be set correctly. Please open the following file and correct this: ".pathinfo(__FILE__, PATHINFO_BASENAME));
}
/*
* -------------------------------------------------------------------
* Now that we know the path, set the main path constants
* -------------------------------------------------------------------
- */
+ */
// The name of THIS file
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
// The PHP file extension
define('EXT', '.php');
- // Path to the system folder
+ // Path to the system folder
define('BASEPATH', str_replace("\\", "/", $system_path));
-
+
// Path to the front controller (this file)
define('FCPATH', str_replace(SELF, '', __FILE__));
-
+
// Name of the "system folder"
- define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/'));
+ define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/'));
// The path to the "application" folder
@@ -143,12 +143,12 @@
define('APPPATH', $application_folder.'/');
}
else
- {
+ {
if ( ! is_dir(BASEPATH.$application_folder.'/'))
{
- exit("Your application folder path does not appear to be set correctly. Please open the following file and correct this: ".SELF);
+ exit("Your application folder path does not appear to be set correctly. Please open the following file and correct this: ".SELF);
}
-
+
define('APPPATH', BASEPATH.$application_folder.'/');
}
diff --git a/system/core/Base4.php b/system/core/Base4.php
index bd0434158..ef7838d69 100644
--- a/system/core/Base4.php
+++ b/system/core/Base4.php
@@ -32,7 +32,7 @@
* Since PHP 5 doesn't suffer from this problem so we load one of
* two files based on the version of PHP being run.
* @PHP4
- *
+ *
* @package CodeIgniter
* @subpackage codeigniter
* @category front-controller
@@ -46,7 +46,7 @@
// This allows syntax like $this->load->foo() to work
parent::CI_Loader();
$this->load =& $this;
-
+
// This allows resources used within controller constructors to work
global $OBJ;
$OBJ = $this->load; // Do NOT use a reference.
@@ -56,12 +56,12 @@
function &get_instance()
{
global $CI, $OBJ;
-
+
if (is_object($CI))
{
return $CI;
}
-
+
return $OBJ->load;
}
diff --git a/system/core/Base5.php b/system/core/Base5.php
index 6f2fbdab0..ac6c7f020 100644
--- a/system/core/Base5.php
+++ b/system/core/Base5.php
@@ -23,7 +23,7 @@
* run under PHP 5. It allows us to manage the CI super object more
* gracefully than what is possible with PHP 4.
* @PHP4 (no need for separate Bases after PHP 4 is gone)
- *
+ *
* @package CodeIgniter
* @subpackage codeigniter
* @category front-controller
diff --git a/system/core/Benchmark.php b/system/core/Benchmark.php
index 1149b7a76..80933f424 100644
--- a/system/core/Benchmark.php
+++ b/system/core/Benchmark.php
@@ -80,13 +80,13 @@ class CI_Benchmark {
{
$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);
}
-
+
// --------------------------------------------------------------------
/**
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php
index 295917c92..f67bb8c10 100644
--- a/system/core/CodeIgniter.php
+++ b/system/core/CodeIgniter.php
@@ -61,10 +61,10 @@
* ------------------------------------------------------
*/
set_error_handler('_exception_handler');
-
+
if ( ! is_php('5.3'))
{
- @set_magic_quotes_runtime(0); // Kill magic quotes
+ @set_magic_quotes_runtime(0); // Kill magic quotes
}
// Set a liberal script execution time limit
@@ -78,18 +78,18 @@
* Set the subclass_prefix
* ------------------------------------------------------
*
- * Normally the "subclass_prefix" is set in the config file.
- * The subclass prefix allows CI to know if a core class is
+ * Normally the "subclass_prefix" is set in the config file.
+ * The subclass prefix allows CI to know if a core class is
* being extended via a library in the local application
- * "libraries" folder. Since CI allows config items to be
- * overriden via data set in the main index. php file,
- * before proceeding we need to know if a subclass_prefix
+ * "libraries" folder. Since CI allows config items to be
+ * overriden via data set in the main index. php file,
+ * before proceeding we need to know if a subclass_prefix
* override exists. If so, we will set this value now,
* before any classes are loaded
- * Note: Since the config file data is cached it doesn't
+ * Note: Since the config file data is cached it doesn't
* hurt to load it here.
*/
- if (isset($assign_to_config['subclass_prefix']) AND $assign_to_config['subclass_prefix'] != '')
+ if (isset($assign_to_config['subclass_prefix']) AND $assign_to_config['subclass_prefix'] != '')
{
get_config(array('subclass_prefix' => $assign_to_config['subclass_prefix']));
}
@@ -121,12 +121,12 @@
* ------------------------------------------------------
* Instantiate the config class
* ------------------------------------------------------
- */
+ */
$CFG =& load_class('Config', 'core');
// Do we have any manually set config items in the index.php file?
if (isset($assign_to_config))
- {
+ {
$CFG->_assign_to_config($assign_to_config);
}
@@ -134,16 +134,16 @@
* ------------------------------------------------------
* Instantiate the Unicode class
* ------------------------------------------------------
- *
+ *
* Note: Order here is rather important as the Unicode
* class needs to be used very early on, but it cannot
- * properly determine if UTf-8 can be supported until
+ * properly determine if UTf-8 can be supported until
* after the Config class is instantiated.
- *
+ *
*/
$UNI =& load_class('Unicode', 'core');
-
+
/*
* ------------------------------------------------------
* Instantiate the URI class
@@ -155,10 +155,10 @@
* ------------------------------------------------------
* Instantiate the routing class and set the routing
* ------------------------------------------------------
- */
+ */
$RTR =& load_class('Router', 'core');
$RTR->_set_routing();
-
+
// Set any routing overrides that may exist in the main index file
if (isset($routing))
{
@@ -190,7 +190,7 @@
* Load the Input class and sanitize globals
* ------------------------------------------------------
*/
- $IN =& load_class('Input', 'core');
+ $IN =& load_class('Input', 'core');
/*
* ------------------------------------------------------
@@ -208,9 +208,9 @@
* conditionally load different versions of the base
* class. Retaining PHP 4 compatibility requires a bit of a hack.
* @PHP4
- *
+ *
*/
- if (is_php('5.0.0') == TRUE)
+ if (is_php('5.0.0') == TRUE)
{
require(BASEPATH.'core/Base5'.EXT);
}
@@ -220,25 +220,25 @@
load_class('Loader', 'core');
require(BASEPATH.'core/Base4'.EXT);
}
-
+
// Load the base controller class
require BASEPATH.'core/Controller'.EXT;
-
+
if (file_exists(APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller'.EXT))
{
require APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller'.EXT;
}
-
+
// Load the local application controller
- // Note: The Router class automatically validates the controller path using the router->_validate_request().
+ // Note: The Router class automatically validates the controller path using the router->_validate_request().
// If this include fails it means that the default controller in the Routes.php file is not resolving to something valid.
if ( ! file_exists(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().EXT))
{
show_error('Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid.');
}
-
+
include(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().EXT);
-
+
// Set a mark point for benchmarking
$BM->mark('loading_time:_base_classes_end');
@@ -253,7 +253,7 @@
*/
$class = $RTR->fetch_class();
$method = $RTR->fetch_method();
-
+
if ( ! class_exists($class)
OR $method == 'controller'
OR strncmp($method, '_', 1) == 0
@@ -277,7 +277,7 @@
*/
// Mark a start point so we can benchmark the controller
$BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_start');
-
+
$CI = new $class();
/*
@@ -307,11 +307,11 @@
}
// 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($URI->rsegments, 2));
+ // 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($URI->rsegments, 2));
}
-
+
// Mark a benchmark end point
$BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_end');
@@ -331,7 +331,7 @@
{
$OUT->_display();
}
-
+
/*
* ------------------------------------------------------
* Is there a "post_system" hook?
diff --git a/system/core/Common.php b/system/core/Common.php
index 2b8ad26b1..90ba7c963 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -43,7 +43,7 @@
{
static $_is_php;
$version = (string)$version;
-
+
if ( ! isset($_is_php[$version]))
{
$_is_php[$version] = (version_compare(PHP_VERSION, $version) < 0) ? FALSE : TRUE;
@@ -57,13 +57,13 @@
/**
* Tests for file writability
*
- * is_writable() returns TRUE on Windows servers when you really can't write to
+ * is_writable() returns TRUE on Windows servers when you really can't write to
* the file, based on the read-only attribute. is_writable() is also unreliable
* on Unix servers if safe_mode is on.
*
* @access private
* @return void
- */
+ */
function is_really_writable($file)
{
// If we're on a Unix server with safe_mode off we call is_writable
@@ -115,7 +115,7 @@
function &load_class($class, $directory = 'libraries', $prefix = 'CI_')
{
static $_classes = array();
-
+
// Does the class exist? If so, we're done...
if (isset($_classes[$class]))
{
@@ -127,25 +127,25 @@
// Look for the class first in the native system/libraries folder
// thenin the local application/libraries folder
foreach (array(BASEPATH, APPPATH) as $path)
- {
+ {
if (file_exists($path.$directory.'/'.$class.EXT))
{
$name = $prefix.$class;
-
+
if (class_exists($name) === FALSE)
{
require($path.$directory.'/'.$class.EXT);
}
-
+
break;
}
}
// Is the request a class extension? If so we load it too
if (file_exists(APPPATH.$directory.'/'.config_item('subclass_prefix').$class.EXT))
- {
+ {
$name = config_item('subclass_prefix').$class;
-
+
if (class_exists($name) === FALSE)
{
require(APPPATH.$directory.'/'.config_item('subclass_prefix').$class.EXT);
@@ -155,8 +155,8 @@
// Did we find the class?
if ($name === FALSE)
{
- // Note: We use exit() rather then show_error() in order to avoid a
- // self-referencing loop with the Excptions class
+ // Note: We use exit() rather then show_error() in order to avoid a
+ // self-referencing loop with the Excptions class
exit('Unable to locate the specified class: '.$class.EXT);
}
@@ -176,7 +176,7 @@
* Required to retain PHP 4 compatibility and also not make PHP 5.3 cry.
*
* Use: $obj =& instantiate_class(new Foo());
- *
+ *
* @access public
* @param object
* @return object
@@ -221,11 +221,11 @@
function &get_config($replace = array())
{
static $_config;
-
+
if (isset($_config))
{
return $_config[0];
- }
+ }
// Fetch the config file
if ( ! file_exists(APPPATH.'config/config'.EXT))
@@ -254,7 +254,7 @@
}
}
}
-
+
return $_config[0] =& $config;
}
@@ -269,18 +269,18 @@
function config_item($item)
{
static $_config_item = array();
-
+
if ( ! isset($_config_item[$item]))
{
$config =& get_config();
-
+
if ( ! isset($config[$item]))
{
return FALSE;
}
$_config_item[$item] = $config[$item];
}
-
+
return $_config_item[$item];
}
@@ -343,7 +343,7 @@
{
return;
}
-
+
$_log =& load_class('Log');
$_log->write_log($level, $message, $php_error);
}
@@ -354,10 +354,10 @@
* Set HTTP Status Header
*
* @access public
- * @param int the status code
- * @param string
+ * @param int the status code
+ * @param string
* @return void
- */
+ */
function set_status_header($code = 200, $text = '')
{
$stati = array(
@@ -408,15 +408,15 @@
}
if (isset($stati[$code]) AND $text == '')
- {
+ {
$text = $stati[$code];
}
-
+
if ($text == '')
{
show_error('No status text available. Please check your status code number or supply your own message text.', 500);
}
-
+
$server_protocol = (isset($_SERVER['SERVER_PROTOCOL'])) ? $_SERVER['SERVER_PROTOCOL'] : FALSE;
if (substr(php_sapi_name(), 0, 3) == 'cgi')
@@ -432,7 +432,7 @@
header("HTTP/1.1 {$code} {$text}", TRUE, $code);
}
}
-
+
// --------------------------------------------------------------------
/**
@@ -450,20 +450,20 @@
* @return void
*/
function _exception_handler($severity, $message, $filepath, $line)
- {
+ {
// We don't bother with "strict" notices since they tend to fill up
// the log file with excess information that isn't normally very helpful.
- // For example, if you are running PHP 5 and you use version 4 style
- // class functions (without prefixes like "public", "private", etc.)
+ // For example, if you are running PHP 5 and you 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;
}
-
+
$_error =& load_class('Exceptions', 'core');
-
- // Should we display the error? We'll get the current error_reporting
+
+ // Should we display the error? We'll get the current error_reporting
// level and add its bits with the severity bits to find out.
if (($severity & error_reporting()) == $severity)
{
@@ -475,12 +475,12 @@
{
return;
}
-
+
$_error->log_exception($severity, $message, $filepath, $line);
}
// --------------------------------------------------------------------
-
+
/**
* Remove Invisible Characters
*
@@ -494,7 +494,7 @@
function remove_invisible_characters($str)
{
static $non_displayables;
-
+
if ( ! isset($non_displayables))
{
// every control character except newline (dec 10), carriage return (dec 13), and horizontal tab (dec 09),
diff --git a/system/core/Compat.php b/system/core/Compat.php
index 088d5815a..bd11b9836 100644
--- a/system/core/Compat.php
+++ b/system/core/Compat.php
@@ -32,7 +32,7 @@
/*
* PHP versions prior to 5.0 don't support the E_STRICT constant
- * so we need to explicitly define it otherwise the Exception class
+ * so we need to explicitly define it otherwise the Exception class
* will generate errors when running under PHP 4
* @PHP4
*
@@ -61,9 +61,9 @@ if ( ! function_exists('ctype_digit'))
{
return FALSE;
}
-
+
return ! preg_match('/[^0-9]/', $str);
- }
+ }
}
// --------------------------------------------------------------------
@@ -87,9 +87,9 @@ if ( ! function_exists('ctype_alnum'))
{
return FALSE;
}
-
+
return ! preg_match('/[^0-9a-z]/i', $str);
- }
+ }
}
// --------------------------------------------------------------------
diff --git a/system/core/Config.php b/system/core/Config.php
index 7e0443c1f..24503ab5d 100644
--- a/system/core/Config.php
+++ b/system/core/Config.php
@@ -45,10 +45,10 @@ class CI_Config {
*/
function CI_Config()
{
- $this->config =& get_config();
+ $this->config =& get_config();
log_message('debug', "Config Class Initialized");
}
-
+
// --------------------------------------------------------------------
/**
@@ -57,16 +57,16 @@ class CI_Config {
* @access public
* @param string the config file name
* @return boolean if the file was loaded correctly
- */
+ */
function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
{
$file = ($file == '') ? 'config' : str_replace(EXT, '', $file);
$loaded = FALSE;
-
+
foreach($this->_config_paths as $path)
{
$file_path = $path.'config/'.$file.EXT;
-
+
if (in_array($file_path, $this->is_loaded, TRUE))
{
$loaded = TRUE;
@@ -77,7 +77,7 @@ class CI_Config {
{
continue;
}
-
+
include($file_path);
if ( ! isset($config) OR ! is_array($config))
@@ -88,7 +88,7 @@ class CI_Config {
}
show_error('Your '.$file_path.' file does not appear to contain a valid configuration array.');
}
-
+
if ($use_sections === TRUE)
{
if (isset($this->config[$file]))
@@ -104,14 +104,14 @@ class CI_Config {
{
$this->config = array_merge($this->config, $config);
}
-
+
$this->is_loaded[] = $file_path;
unset($config);
-
+
$loaded = TRUE;
log_message('debug', 'Config file loaded: '.$file_path);
}
-
+
if ($loaded === FALSE)
{
if ($fail_gracefully === TRUE)
@@ -123,7 +123,7 @@ class CI_Config {
return TRUE;
}
-
+
// --------------------------------------------------------------------
/**
@@ -137,9 +137,9 @@ class CI_Config {
* @return string
*/
function item($item, $index = '')
- {
+ {
if ($index == '')
- {
+ {
if ( ! isset($this->config[$item]))
{
return FALSE;
@@ -164,8 +164,8 @@ class CI_Config {
return $pref;
}
-
- // --------------------------------------------------------------------
+
+ // --------------------------------------------------------------------
/**
* Fetch a config file item - adds slash after item
@@ -188,13 +188,13 @@ class CI_Config {
$pref = $this->config[$item];
if ($pref != '' && substr($pref, -1) != '/')
- {
+ {
$pref .= '/';
}
return $pref;
}
-
+
// --------------------------------------------------------------------
/**
@@ -224,9 +224,9 @@ class CI_Config {
{
$uri = implode('/', $uri);
}
-
+
$suffix = ($this->item('url_suffix') == FALSE) ? '' : $this->item('url_suffix');
- return $this->slash_item('base_url').$this->slash_item('index_page').trim($uri, '/').$suffix;
+ return $this->slash_item('base_url').$this->slash_item('index_page').trim($uri, '/').$suffix;
}
else
{
@@ -254,7 +254,7 @@ class CI_Config {
}
}
}
-
+
// --------------------------------------------------------------------
/**
@@ -268,7 +268,7 @@ class CI_Config {
$x = explode("/", preg_replace("|/*(.+?)/*$|", "\\1", BASEPATH));
return $this->slash_item('base_url').end($x).'/';
}
-
+
// --------------------------------------------------------------------
/**
@@ -283,7 +283,7 @@ class CI_Config {
{
$this->config[$item] = $value;
}
-
+
// --------------------------------------------------------------------
/**
@@ -296,7 +296,7 @@ class CI_Config {
* @access private
* @param array
* @return void
- */
+ */
function _assign_to_config($items = array())
{
if (is_array($items))
@@ -305,7 +305,7 @@ class CI_Config {
{
$this->set_item($key, $val);
}
- }
+ }
}
}
diff --git a/system/core/Controller.php b/system/core/Controller.php
index c9d797ca2..9bd9912dc 100644
--- a/system/core/Controller.php
+++ b/system/core/Controller.php
@@ -28,18 +28,18 @@
* @link http://codeigniter.com/user_guide/general/controllers.html
*/
class Controller extends CI_Base {
-
+
/**
* Constructor
*
* Calls the initialize() function
*/
function Controller()
- {
+ {
parent::CI_Base();
// Assign all the class objects that were instantiated by the
- // bootstrap file (CodeIgniter.php) to local class variables
+ // bootstrap file (CodeIgniter.php) to local class variables
// so that CI can run as one big super object.
foreach (is_loaded() as $var => $class)
{
@@ -48,18 +48,18 @@ class Controller extends CI_Base {
// In PHP 5 the Loader class is run as a discreet
// class. In PHP 4 it extends the Controller @PHP4
- if (is_php('5.0.0') == TRUE)
+ if (is_php('5.0.0') == TRUE)
{
$this->load =& load_class('Loader', 'core');
-
+
$this->load->_base_classes =& is_loaded();
-
+
$this->load->_ci_autoloader();
}
else
{
$this->_ci_autoloader();
-
+
// sync up the objects since PHP4 was working from a copy
foreach (array_keys(get_object_vars($this)) as $attribute)
{
@@ -71,7 +71,7 @@ class Controller extends CI_Base {
}
log_message('debug', "Controller Class Initialized");
-
+
}
}
diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php
index 419ea2b61..108861de7 100644
--- a/system/core/Exceptions.php
+++ b/system/core/Exceptions.php
@@ -51,13 +51,13 @@ class CI_Exceptions {
/**
* Constructor
*
- */
+ */
function CI_Exceptions()
{
$this->ob_level = ob_get_level();
// Note: Do not log messages from this constructor.
}
-
+
// --------------------------------------------------------------------
/**
@@ -73,9 +73,9 @@ class CI_Exceptions {
* @return string
*/
function log_exception($severity, $message, $filepath, $line)
- {
+ {
$severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity];
-
+
log_message('error', 'Severity: '.$severity.' --> '.$message. ' '.$filepath.' '.$line, TRUE);
}
@@ -89,7 +89,7 @@ class CI_Exceptions {
* @return string
*/
function show_404($page = '', $log_error = TRUE)
- {
+ {
$heading = "404 Page Not Found";
$message = "The page you requested was not found.";
@@ -102,7 +102,7 @@ class CI_Exceptions {
echo $this->show_error($heading, $message, 'error_404', 404);
exit;
}
-
+
// --------------------------------------------------------------------
/**
@@ -121,12 +121,12 @@ class CI_Exceptions {
function show_error($heading, $message, $template = 'error_general', $status_code = 500)
{
set_status_header($status_code);
-
+
$message = '<p>'.implode('</p><p>', ( ! is_array($message)) ? array($message) : $message).'</p>';
if (ob_get_level() > $this->ob_level + 1)
{
- ob_end_flush();
+ ob_end_flush();
}
ob_start();
include(APPPATH.'errors/'.$template.EXT);
@@ -148,21 +148,21 @@ class CI_Exceptions {
* @return string
*/
function show_php_error($severity, $message, $filepath, $line)
- {
+ {
$severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity];
-
+
$filepath = str_replace("\\", "/", $filepath);
-
+
// For safety reasons we do not show the full file path
if (FALSE !== strpos($filepath, '/'))
{
$x = explode('/', $filepath);
$filepath = $x[count($x)-2].'/'.end($x);
}
-
+
if (ob_get_level() > $this->ob_level + 1)
{
- ob_end_flush();
+ ob_end_flush();
}
ob_start();
include(APPPATH.'errors/error_php'.EXT);
diff --git a/system/core/Hooks.php b/system/core/Hooks.php
index 3b063f792..9026a5eb6 100644
--- a/system/core/Hooks.php
+++ b/system/core/Hooks.php
@@ -28,8 +28,8 @@
*/
class CI_Hooks {
- var $enabled = FALSE;
- var $hooks = array();
+ var $enabled = FALSE;
+ var $hooks = array();
var $in_progress = FALSE;
/**
@@ -41,7 +41,7 @@ class CI_Hooks {
$this->_initialize();
log_message('debug', "Hooks Class Initialized");
}
-
+
// --------------------------------------------------------------------
/**
@@ -49,9 +49,9 @@ class CI_Hooks {
*
* @access private
* @return void
- */
- function _initialize()
- {
+ */
+ function _initialize()
+ {
$CFG =& load_class('Config', 'core');
// If hooks are not enabled in the config file
@@ -74,8 +74,8 @@ class CI_Hooks {
$this->hooks =& $hook;
$this->enabled = TRUE;
- }
-
+ }
+
// --------------------------------------------------------------------
/**
diff --git a/system/core/Input.php b/system/core/Input.php
index 2eef82458..df3be207c 100644
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -257,7 +257,7 @@ class CI_Input {
{
return $this->ip_address;
}
-
+
if (config_item('proxy_ips') != '' && $this->server('HTTP_X_FORWARDED_FOR') && $this->server('REMOTE_ADDR'))
{
$proxies = preg_split('/[\s,]/', config_item('proxy_ips'), -1, PREG_SPLIT_NO_EMPTY);
@@ -308,7 +308,7 @@ class CI_Input {
* Validate IP Address
*
* Updated version suggested by Geert De Deckere
- *
+ *
* @access public
* @param string
* @return string
@@ -330,7 +330,7 @@ class CI_Input {
// Check each segment
foreach ($ip_segments as $segment)
{
- // IP segments must be digits and can not be
+ // IP segments must be digits and can not be
// longer than 3 digits or greater then 255
if ($segment == '' OR preg_match("/[^0-9]/", $segment) OR $segment > 255 OR strlen($segment) > 3)
{
@@ -383,7 +383,7 @@ class CI_Input {
$protected = array('_SERVER', '_GET', '_POST', '_FILES', '_REQUEST', '_SESSION', '_ENV', 'GLOBALS', 'HTTP_RAW_POST_DATA',
'system_folder', 'application_folder', 'BM', 'EXT', 'CFG', 'URI', 'RTR', 'OUT', 'IN');
- // Unset globals for securiy.
+ // Unset globals for securiy.
// This is effectively the same as register_globals = off
foreach (array($_GET, $_POST, $_COOKIE) as $global)
{
diff --git a/system/core/Lang.php b/system/core/Lang.php
index e071495b8..cbd4e38b8 100644
--- a/system/core/Lang.php
+++ b/system/core/Lang.php
@@ -120,7 +120,7 @@ class CI_Lang {
* Fetch a single line of text from the language array
*
* @access public
- * @param string $line the language line
+ * @param string $line the language line
* @return string
*/
function line($line = '')
diff --git a/system/core/Loader.php b/system/core/Loader.php
index 292fdc955..69b3da0c9 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -34,7 +34,7 @@ class CI_Loader {
var $_ci_library_paths = array();
var $_ci_model_paths = array();
var $_ci_helper_paths = array();
- var $_ci_is_instance = FALSE; // Whether we should use $this or $CI =& get_instance()
+ var $_ci_is_instance = FALSE; // Whether we should use $this or $CI =& get_instance()
var $_base_classes = array(); // Set by the controller class
var $_ci_cached_vars = array();
var $_ci_classes = array();
@@ -42,7 +42,7 @@ class CI_Loader {
var $_ci_models = array();
var $_ci_helpers = array();
var $_ci_varmap = array('unit_test' => 'unit', 'user_agent' => 'agent');
-
+
/**
* Constructor
@@ -52,18 +52,18 @@ class CI_Loader {
* @access public
*/
function CI_Loader()
- {
+ {
$this->_ci_view_path = APPPATH.'views/';
$this->_ci_ob_level = ob_get_level();
$this->_ci_library_paths = array(APPPATH, BASEPATH);
$this->_ci_helper_paths = array(APPPATH, BASEPATH);
$this->_ci_model_paths = array(APPPATH);
-
+
log_message('debug', "Loader Class Initialized");
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Class Loader
*
@@ -75,7 +75,7 @@ class CI_Loader {
* @param mixed the optional parameters
* @param string an optional object name
* @return void
- */
+ */
function library($library = '', $params = NULL, $object_name = NULL)
{
if ($library == '' OR isset($this->_base_classes[$library]))
@@ -99,12 +99,12 @@ class CI_Loader {
{
$this->_ci_load_class($library, $params, $object_name);
}
-
+
$this->_ci_assign_to_models();
}
// --------------------------------------------------------------------
-
+
/**
* Model Loader
*
@@ -115,14 +115,14 @@ class CI_Loader {
* @param string name for the model
* @param bool database connection
* @return void
- */
+ */
function model($model, $name = '', $db_conn = FALSE)
- {
+ {
if (is_array($model))
{
foreach($model as $babe)
{
- $this->model($babe);
+ $this->model($babe);
}
return;
}
@@ -131,9 +131,9 @@ class CI_Loader {
{
return;
}
-
+
$path = '';
-
+
// Is the model in a sub-folder? If so, parse out the filename and path.
if (($last_slash = strrpos($model, '/')) !== FALSE)
{
@@ -143,23 +143,23 @@ class CI_Loader {
// And the model name behind it
$model = substr($model, $last_slash + 1);
}
-
+
if ($name == '')
{
$name = $model;
}
-
+
if (in_array($name, $this->_ci_models, TRUE))
{
return;
}
-
+
$CI =& get_instance();
if (isset($CI->$name))
{
show_error('The model name you are loading is the name of a resource that is already being used: '.$name);
}
-
+
$model = strtolower($model);
foreach ($this->_ci_model_paths as $mod_path)
@@ -192,13 +192,13 @@ class CI_Loader {
$this->_ci_models[] = $name;
return;
}
-
+
// couldn't find the model
show_error('Unable to locate the model you have specified: '.$model);
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Database Loader
*
@@ -207,57 +207,57 @@ class CI_Loader {
* @param bool whether to return the DB object
* @param bool whether to enable active record (this allows us to override the config setting)
* @return object
- */
+ */
function database($params = '', $return = FALSE, $active_record = NULL)
{
// Grab the super object
$CI =& get_instance();
-
+
// Do we even need to load the database class?
if (class_exists('CI_DB') AND $return == FALSE AND $active_record == NULL AND isset($CI->db) AND is_object($CI->db))
{
return FALSE;
- }
-
+ }
+
require_once(BASEPATH.'database/DB'.EXT);
if ($return === TRUE)
{
return DB($params, $active_record);
}
-
- // Initialize the db variable. Needed to prevent
+
+ // Initialize the db variable. Needed to prevent
// reference errors with some configurations
$CI->db = '';
-
+
// Load the DB class
- $CI->db =& DB($params, $active_record);
-
+ $CI->db =& DB($params, $active_record);
+
// Assign the DB object to any existing models
$this->_ci_assign_to_models();
}
-
+
// --------------------------------------------------------------------
/**
* Load the Utilities Class
*
* @access public
- * @return string
- */
+ * @return string
+ */
function dbutil()
{
if ( ! class_exists('CI_DB'))
{
$this->database();
}
-
+
$CI =& get_instance();
// for backwards compatibility, load dbforge so we can extend dbutils off it
// this use is deprecated and strongly discouraged
$CI->load->dbforge();
-
+
require_once(BASEPATH.'database/DB_utility'.EXT);
require_once(BASEPATH.'database/drivers/'.$CI->db->dbdriver.'/'.$CI->db->dbdriver.'_utility'.EXT);
$class = 'CI_DB_'.$CI->db->dbdriver.'_utility';
@@ -266,35 +266,35 @@ class CI_Loader {
$CI->load->_ci_assign_to_models();
}
-
+
// --------------------------------------------------------------------
/**
* Load the Database Forge Class
*
* @access public
- * @return string
- */
+ * @return string
+ */
function dbforge()
{
if ( ! class_exists('CI_DB'))
{
$this->database();
}
-
+
$CI =& get_instance();
-
+
require_once(BASEPATH.'database/DB_forge'.EXT);
require_once(BASEPATH.'database/drivers/'.$CI->db->dbdriver.'/'.$CI->db->dbdriver.'_forge'.EXT);
$class = 'CI_DB_'.$CI->db->dbdriver.'_forge';
$CI->dbforge = new $class();
-
+
$CI->load->_ci_assign_to_models();
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Load View
*
@@ -316,9 +316,9 @@ class CI_Loader {
{
return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return));
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Load File
*
@@ -333,9 +333,9 @@ class CI_Loader {
{
return $this->_ci_load(array('_ci_path' => $path, '_ci_return' => $return));
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Set Variables
*
@@ -352,9 +352,9 @@ class CI_Loader {
{
$vars = array($vars => $val);
}
-
+
$vars = $this->_ci_object_to_array($vars);
-
+
if (is_array($vars) AND count($vars) > 0)
{
foreach ($vars as $key => $val)
@@ -363,9 +363,9 @@ class CI_Loader {
}
}
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Load Helper
*
@@ -376,9 +376,9 @@ class CI_Loader {
* @return void
*/
function helper($helpers = array())
- {
+ {
foreach ($this->_ci_prep_filename($helpers, '_helper') as $helper)
- {
+ {
if (isset($this->_ci_helpers[$helper]))
{
continue;
@@ -386,33 +386,33 @@ class CI_Loader {
$ext_helper = APPPATH.'helpers/'.config_item('subclass_prefix').$helper.EXT;
- // Is this a helper extension request?
+ // Is this a helper extension request?
if (file_exists($ext_helper))
{
$base_helper = BASEPATH.'helpers/'.$helper.EXT;
-
+
if ( ! file_exists($base_helper))
{
show_error('Unable to load the requested file: helpers/'.$helper.EXT);
}
-
+
include_once($ext_helper);
include_once($base_helper);
-
+
$this->_ci_helpers[$helper] = TRUE;
log_message('debug', 'Helper loaded: '.$helper);
continue;
}
-
+
// Try to load the helper
foreach ($this->_ci_helper_paths as $path)
{
if (file_exists($path.'helpers/'.$helper.EXT))
- {
+ {
include_once($path.'helpers/'.$helper.EXT);
$this->_ci_helpers[$helper] = TRUE;
- log_message('debug', 'Helper loaded: '.$helper);
+ log_message('debug', 'Helper loaded: '.$helper);
break;
}
}
@@ -420,13 +420,13 @@ class CI_Loader {
// unable to load the helper
if ( ! isset($this->_ci_helpers[$helper]))
{
- show_error('Unable to load the requested file: helpers/'.$helper.EXT);
+ show_error('Unable to load the requested file: helpers/'.$helper.EXT);
}
- }
+ }
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Load Helpers
*
@@ -441,9 +441,9 @@ class CI_Loader {
{
$this->helper($helpers);
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Loads a language file
*
@@ -462,13 +462,13 @@ class CI_Loader {
}
foreach ($file as $langfile)
- {
+ {
$CI->lang->load($langfile, $lang);
}
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Loads a config file
*
@@ -477,7 +477,7 @@ class CI_Loader {
* @return void
*/
function config($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
- {
+ {
$CI =& get_instance();
$CI->config->load($file, $use_sections, $fail_gracefully);
}
@@ -501,19 +501,19 @@ class CI_Loader {
// we aren't instantiating an object here, that'll be done by the Library itself
require BASEPATH.'libraries/Driver'.EXT;
}
-
+
// We can save the loader some time since Drivers will *always* be in a subfolder,
// and typically identically named to the library
if ( ! strpos($library, '/'))
{
$library = ucfirst($library).'/'.$library;
}
-
+
return $this->library($library, $params, $object_name);
}
// --------------------------------------------------------------------
-
+
/**
* Add Package Path
*
@@ -528,7 +528,7 @@ class CI_Loader {
array_unshift($this->_ci_library_paths, $path);
array_unshift($this->_ci_model_paths, $path);
array_unshift($this->_ci_helper_paths, $path);
-
+
// Add config file path
$config =& $this->_ci_get_component('config');
array_unshift($config->_config_paths, $path);
@@ -549,7 +549,7 @@ class CI_Loader {
function remove_package_path($path = '', $remove_config_path = TRUE)
{
$config =& $this->_ci_get_component('config');
-
+
if ($path == '')
{
$void = array_shift($this->_ci_library_paths);
@@ -566,13 +566,13 @@ class CI_Loader {
unset($this->{$var}[$key]);
}
}
-
+
if (($key = array_search($path, $config->_config_paths)) !== FALSE)
{
unset($config->_config_paths[$key]);
}
}
-
+
// make sure the application default paths are still in the array
$this->_ci_library_paths = array_unique(array_merge($this->_ci_library_paths, array(APPPATH, BASEPATH)));
$this->_ci_helper_paths = array_unique(array_merge($this->_ci_helper_paths, array(APPPATH, BASEPATH)));
@@ -581,7 +581,7 @@ class CI_Loader {
}
// --------------------------------------------------------------------
-
+
/**
* Loader
*
@@ -613,16 +613,16 @@ class CI_Loader {
$_ci_x = explode('/', $_ci_path);
$_ci_file = end($_ci_x);
}
-
+
if ( ! file_exists($_ci_path))
{
show_error('Unable to load the requested file: '.$_ci_file);
}
-
+
// This allows anything loaded using $this->load (views, files, etc.)
// to become accessible from within the Controller and Model functions.
// Only needed when running PHP 5
-
+
if ($this->_ci_is_instance())
{
$_ci_CI =& get_instance();
@@ -642,13 +642,13 @@ class CI_Loader {
* 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($_ci_vars))
{
$this->_ci_cached_vars = array_merge($this->_ci_cached_vars, $_ci_vars);
}
extract($this->_ci_cached_vars);
-
+
/*
* Buffer the output
*
@@ -662,11 +662,11 @@ class CI_Loader {
* the browser and then stop the timer it won't be accurate.
*/
ob_start();
-
+
// If the PHP installation does not support short tags we'll
// do a little string replacement, changing the short tags
// to standard PHP echo statements.
-
+
if ((bool) @ini_get('short_open_tag') === FALSE AND config_item('rewrite_short_tags') == TRUE)
{
echo eval('?>'.preg_replace("/;*\s*\?>/", "; ?>", str_replace('<?=', '<?php echo ', file_get_contents($_ci_path))));
@@ -675,12 +675,12 @@ class CI_Loader {
{
include($_ci_path); // include() vs include_once() allows for multiple views with the same name
}
-
+
log_message('debug', 'File loaded: '.$_ci_path);
-
+
// Return the file data if requested
if ($_ci_return === TRUE)
- {
+ {
$buffer = ob_get_contents();
@ob_end_clean();
return $buffer;
@@ -695,7 +695,7 @@ class CI_Loader {
* it can be seen and included properly by the first included
* template and any subsequent ones. Oy!
*
- */
+ */
if (ob_get_level() > $this->_ci_ob_level + 1)
{
ob_end_flush();
@@ -717,18 +717,18 @@ class CI_Loader {
* This function loads the requested class.
*
* @access private
- * @param string the item that is being loaded
+ * @param string the item that is being loaded
* @param mixed any additional parameters
* @param string an optional object name
- * @return void
+ * @return void
*/
function _ci_load_class($class, $params = NULL, $object_name = NULL)
- {
- // Get the class name, and while we're at it trim any slashes.
- // The directory path can be included as part of the class name,
+ {
+ // Get the class name, and while we're at it trim any slashes.
+ // The directory path can be included as part of the class name,
// but we don't want a leading slash
$class = str_replace(EXT, '', trim($class, '/'));
-
+
// Was the path included with the class name?
// We look for a slash to determine this
$subdir = '';
@@ -736,7 +736,7 @@ class CI_Loader {
{
// Extract the path
$subdir = substr($class, 0, $last_slash + 1);
-
+
// Get the filename from the path
$class = substr($class, $last_slash + 1);
}
@@ -746,11 +746,11 @@ class CI_Loader {
{
$subclass = APPPATH.'libraries/'.$subdir.config_item('subclass_prefix').$class.EXT;
- // Is this a class extension request?
+ // Is this a class extension request?
if (file_exists($subclass))
{
$baseclass = BASEPATH.'libraries/'.ucfirst($class).EXT;
-
+
if ( ! file_exists($baseclass))
{
log_message('error', "Unable to load the requested class: ".$class);
@@ -768,22 +768,22 @@ class CI_Loader {
$CI =& get_instance();
if ( ! isset($CI->$object_name))
{
- return $this->_ci_init_class($class, config_item('subclass_prefix'), $params, $object_name);
+ return $this->_ci_init_class($class, config_item('subclass_prefix'), $params, $object_name);
}
}
-
+
$is_duplicate = TRUE;
log_message('debug', $class." class already loaded. Second attempt ignored.");
return;
}
-
- include_once($baseclass);
+
+ include_once($baseclass);
include_once($subclass);
$this->_ci_loaded_files[] = $subclass;
-
- return $this->_ci_init_class($class, config_item('subclass_prefix'), $params, $object_name);
+
+ return $this->_ci_init_class($class, config_item('subclass_prefix'), $params, $object_name);
}
-
+
// Lets search for the requested library file and load it.
$is_duplicate = FALSE;
foreach ($this->_ci_library_paths as $path)
@@ -795,7 +795,7 @@ class CI_Loader {
{
continue;
}
-
+
// Safety: Was the class already loaded by a previous call?
if (in_array($filepath, $this->_ci_loaded_files))
{
@@ -810,15 +810,15 @@ class CI_Loader {
return $this->_ci_init_class($class, '', $params, $object_name);
}
}
-
+
$is_duplicate = TRUE;
log_message('debug', $class." class already loaded. Second attempt ignored.");
return;
}
-
+
include_once($filepath);
$this->_ci_loaded_files[] = $filepath;
- return $this->_ci_init_class($class, '', $params, $object_name);
+ return $this->_ci_init_class($class, '', $params, $object_name);
}
} // END FOREACH
@@ -829,7 +829,7 @@ class CI_Loader {
$path = strtolower($class).'/'.$class;
return $this->_ci_load_class($path, $params);
}
-
+
// If we got this far we were unable to find the requested class.
// We do not issue errors if the load call failed due to a duplicate request
if ($is_duplicate == FALSE)
@@ -838,7 +838,7 @@ class CI_Loader {
show_error("Unable to load the requested class: ".$class);
}
}
-
+
// --------------------------------------------------------------------
/**
@@ -851,7 +851,7 @@ class CI_Loader {
* @return null
*/
function _ci_init_class($class, $prefix = '', $config = FALSE, $object_name = NULL)
- {
+ {
// Is there an associated config file for this class? Note: these should always be lowercase
if ($config === NULL)
{
@@ -860,20 +860,20 @@ class CI_Loader {
if (file_exists(APPPATH.'config/'.strtolower($class).EXT))
{
include_once(APPPATH.'config/'.strtolower($class).EXT);
- }
+ }
elseif (file_exists(APPPATH.'config/'.ucfirst(strtolower($class)).EXT))
{
include_once(APPPATH.'config/'.ucfirst(strtolower($class)).EXT);
}
}
-
+
if ($prefix == '')
- {
- if (class_exists('CI_'.$class))
+ {
+ if (class_exists('CI_'.$class))
{
$name = 'CI_'.$class;
}
- elseif (class_exists(config_item('subclass_prefix').$class))
+ elseif (class_exists(config_item('subclass_prefix').$class))
{
$name = config_item('subclass_prefix').$class;
}
@@ -886,18 +886,18 @@ class CI_Loader {
{
$name = $prefix.$class;
}
-
+
// Is the class name valid?
if ( ! class_exists($name))
{
log_message('error', "Non-existent class: ".$name);
show_error("Non-existent class: ".$class);
}
-
+
// Set the variable name we will assign the class to
// Was a custom class name supplied? If so we'll use it
$class = strtolower($class);
-
+
if (is_null($object_name))
{
$classvar = ( ! isset($this->_ci_varmap[$class])) ? $class : $this->_ci_varmap[$class];
@@ -907,23 +907,23 @@ class CI_Loader {
$classvar = $object_name;
}
- // Save the class name and object name
+ // Save the class name and object name
$this->_ci_classes[$class] = $classvar;
- // Instantiate the class
+ // Instantiate the class
$CI =& get_instance();
if ($config !== NULL)
{
$CI->$classvar = new $name($config);
}
else
- {
+ {
$CI->$classvar = new $name;
- }
- }
-
+ }
+ }
+
// --------------------------------------------------------------------
-
+
/**
* Autoloader
*
@@ -935,31 +935,31 @@ class CI_Loader {
* @return void
*/
function _ci_autoloader()
- {
+ {
include_once(APPPATH.'config/autoload'.EXT);
-
+
if ( ! isset($autoload))
{
return FALSE;
}
-
+
// Load any custom config file
if (count($autoload['config']) > 0)
- {
+ {
$CI =& get_instance();
foreach ($autoload['config'] as $key => $val)
{
$CI->config->load($val);
}
- }
+ }
// Autoload helpers and languages
foreach (array('helper', 'language') as $type)
- {
+ {
if (isset($autoload[$type]) AND count($autoload[$type]) > 0)
{
$this->$type($autoload[$type]);
- }
+ }
}
// A little tweak to remain backward compatible
@@ -968,7 +968,7 @@ class CI_Loader {
{
$autoload['libraries'] = $autoload['core'];
}
-
+
// Load libraries
if (isset($autoload['libraries']) AND count($autoload['libraries']) > 0)
{
@@ -978,13 +978,13 @@ class CI_Loader {
$this->database();
$autoload['libraries'] = array_diff($autoload['libraries'], array('database'));
}
-
+
// Load all other libraries
foreach ($autoload['libraries'] as $item)
{
$this->library($item);
}
- }
+ }
// Autoload models
if (isset($autoload['model']))
@@ -993,7 +993,7 @@ class CI_Loader {
}
}
-
+
// --------------------------------------------------------------------
/**
@@ -1012,13 +1012,13 @@ class CI_Loader {
{
return;
}
-
+
foreach($this->_ci_models as $model)
{
$model = $this->_ci_get_component($model);
$model->_assign_libraries();
}
- }
+ }
// --------------------------------------------------------------------
@@ -1041,7 +1041,7 @@ class CI_Loader {
/**
* Determines whether we should use the CI instance or $this
* @PHP4
- *
+ *
* @access private
* @return bool
*/
@@ -1051,11 +1051,11 @@ class CI_Loader {
{
return TRUE;
}
-
+
global $CI;
return (is_object($CI)) ? TRUE : FALSE;
}
-
+
// --------------------------------------------------------------------
/**
@@ -1078,7 +1078,7 @@ class CI_Loader {
}
// --------------------------------------------------------------------
-
+
/**
* Prep filename
*
@@ -1091,20 +1091,20 @@ class CI_Loader {
function _ci_prep_filename($filename, $extension)
{
if ( ! is_array($filename))
- {
- return array(strtolower(str_replace(EXT, '', str_replace($extension, '', $filename)).$extension));
+ {
+ return array(strtolower(str_replace(EXT, '', str_replace($extension, '', $filename)).$extension));
}
else
{
foreach ($filename as $key => $val)
{
- $filename[$key] = strtolower(str_replace(EXT, '', str_replace($extension, '', $val)).$extension);
+ $filename[$key] = strtolower(str_replace(EXT, '', str_replace($extension, '', $val)).$extension);
}
-
+
return $filename;
}
}
-
+
}
diff --git a/system/core/Model.php b/system/core/Model.php
index 16c4e7dd8..ebbb0fbe6 100644
--- a/system/core/Model.php
+++ b/system/core/Model.php
@@ -37,11 +37,11 @@ class CI_Model {
{
// If the magic __get() or __set() methods are used in a Model references can't be used.
$this->_assign_libraries( (method_exists($this, '__get') OR method_exists($this, '__set')) ? FALSE : TRUE );
-
+
// We don't want to assign the model object to itself when using the
// assign_libraries function below so we'll grab the name of the model parent
$this->_parent_name = ucfirst(get_class($this));
-
+
log_message('debug', "Model Class Initialized");
}
@@ -50,17 +50,17 @@ class CI_Model {
*
* Creates local references to all currently instantiated objects
* so that any syntax that can be legally used in a controller
- * can be used within models.
+ * can be used within models.
*
* @access private
- */
+ */
function _assign_libraries($use_reference = TRUE)
{
- $CI =& get_instance();
+ $CI =& get_instance();
foreach (array_keys(get_object_vars($CI)) as $key)
{
if ( ! isset($this->$key) AND $key != $this->_parent_name)
- {
+ {
// In some cases using references can cause
// problems so we'll conditionally use them
if ($use_reference == TRUE)
@@ -74,7 +74,7 @@ class CI_Model {
$this->$key = $CI->$key;
}
}
- }
+ }
}
}
diff --git a/system/core/Output.php b/system/core/Output.php
index ad9ffbabe..04e452d2c 100644
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -30,8 +30,8 @@ class CI_Output {
var $final_output;
var $cache_expiration = 0;
- var $headers = array();
- var $enable_profiler = FALSE;
+ var $headers = array();
+ var $enable_profiler = FALSE;
var $parse_exec_vars = TRUE; // whether or not to parse variables like {elapsed_time} and {memory_usage}
var $_zlib_oc = FALSE;
@@ -40,12 +40,12 @@ class CI_Output {
function CI_Output()
{
$this->_zlib_oc = @ini_get('zlib.output_compression');
-
+
log_message('debug', "Output Class Initialized");
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Get Output
*
@@ -53,14 +53,14 @@ class CI_Output {
*
* @access public
* @return string
- */
+ */
function get_output()
{
return $this->final_output;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Set Output
*
@@ -69,7 +69,7 @@ class CI_Output {
* @access public
* @param string
* @return void
- */
+ */
function set_output($output)
{
$this->final_output = $output;
@@ -85,7 +85,7 @@ class CI_Output {
* @access public
* @param string
* @return void
- */
+ */
function append_output($output)
{
if ($this->final_output == '')
@@ -111,52 +111,52 @@ class CI_Output {
* @access public
* @param string
* @return void
- */
+ */
function set_header($header, $replace = TRUE)
{
// If zlib.output_compression is enabled it will compress the output,
// but it will not modify the content-length header to compensate for
// the reduction, causing the browser to hang waiting for more data.
// We'll just skip content-length in those cases.
-
+
if ($this->_zlib_oc && strncasecmp($header, 'content-length', 14) == 0)
{
return;
}
-
+
$this->headers[] = array($header, $replace);
}
// --------------------------------------------------------------------
-
+
/**
* Set HTTP Status Header
* moved to Common procedural functions in 1.7.2
- *
+ *
* @access public
- * @param int the status code
- * @param string
+ * @param int the status code
+ * @param string
* @return void
- */
+ */
function set_status_header($code = 200, $text = '')
{
set_status_header($code, $text);
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Enable/disable Profiler
*
* @access public
* @param bool
* @return void
- */
+ */
function enable_profiler($val = TRUE)
{
$this->enable_profiler = (is_bool($val)) ? $val : TRUE;
}
-
+
// --------------------------------------------------------------------
/**
@@ -177,21 +177,21 @@ class CI_Output {
}
// --------------------------------------------------------------------
-
+
/**
* Set Cache
*
* @access public
* @param integer
* @return void
- */
+ */
function cache($time)
{
$this->cache_expiration = ( ! is_numeric($time)) ? 0 : $time;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Display Output
*
@@ -205,9 +205,9 @@ class CI_Output {
*
* @access public
* @return mixed
- */
+ */
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,
// which happens before the CI super object is available.
@@ -220,15 +220,15 @@ class CI_Output {
}
// --------------------------------------------------------------------
-
+
// Set the output data
if ($output == '')
{
$output =& $this->final_output;
}
-
+
// --------------------------------------------------------------------
-
+
// Do we need to write a cache file? Only if the controller does not have its
// own _output() method and we are not dealing with a cache file, which we
// can determine by the existence of the $CI object above
@@ -236,24 +236,24 @@ class CI_Output {
{
$this->_write_cache($output);
}
-
+
// --------------------------------------------------------------------
// 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');
+
+ $elapsed = $BM->elapsed_time('total_execution_time_start', 'total_execution_time_end');
if ($this->parse_exec_vars === TRUE)
{
$memory = ( ! function_exists('memory_get_usage')) ? '0' : round(memory_get_usage()/1024/1024, 2).'MB';
-
+
$output = str_replace('{elapsed_time}', $elapsed, $output);
$output = str_replace('{memory_usage}', $memory, $output);
}
// --------------------------------------------------------------------
-
+
// Is compression requested?
if ($CFG->item('compress_output') === TRUE && $this->_zlib_oc == FALSE)
{
@@ -267,7 +267,7 @@ class CI_Output {
}
// --------------------------------------------------------------------
-
+
// Are there any server headers to send?
if (count($this->headers) > 0)
{
@@ -275,10 +275,10 @@ class CI_Output {
{
@header($header[0], $header[1]);
}
- }
+ }
// --------------------------------------------------------------------
-
+
// Does the $CI object exist?
// If not we know we are dealing with a cache file so we'll
// simply echo out the data and exit.
@@ -289,19 +289,19 @@ class CI_Output {
log_message('debug', "Total execution time: ".$elapsed);
return TRUE;
}
-
+
// --------------------------------------------------------------------
-
+
// Do we need to generate profile data?
// If so, load the Profile class and run it.
if ($this->enable_profiler == TRUE)
{
- $CI->load->library('profiler');
-
+ $CI->load->library('profiler');
+
if ( ! empty($this->_profiler_sections))
{
$CI->profiler->set_sections($this->_profiler_sections);
- }
+ }
// If the output data contains closing </body> and </html> tags
// we will remove them and add them back after we insert the profile data
@@ -316,7 +316,7 @@ class CI_Output {
$output .= $CI->profiler->run();
}
}
-
+
// --------------------------------------------------------------------
// Does the controller contain a function named _output()?
@@ -329,36 +329,36 @@ class CI_Output {
{
echo $output; // Send it to the browser!
}
-
+
log_message('debug', "Final output sent to browser");
- log_message('debug', "Total execution time: ".$elapsed);
+ log_message('debug', "Total execution time: ".$elapsed);
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Write a Cache File
*
* @access public
* @return void
- */
+ */
function _write_cache($output)
{
- $CI =& get_instance();
+ $CI =& get_instance();
$path = $CI->config->item('cache_path');
-
+
$cache_path = ($path == '') ? BASEPATH.'cache/' : $path;
-
+
if ( ! is_dir($cache_path) OR ! is_really_writable($cache_path))
{
log_message('error', "Unable to write cache file: ".$cache_path);
return;
}
-
+
$uri = $CI->config->item('base_url').
$CI->config->item('index_page').
$CI->uri->uri_string();
-
+
$cache_path .= md5($uri);
if ( ! $fp = @fopen($cache_path, FOPEN_WRITE_CREATE_DESTRUCTIVE))
@@ -366,9 +366,9 @@ class CI_Output {
log_message('error', "Unable to write cache file: ".$cache_path);
return;
}
-
+
$expire = time() + ($this->cache_expiration * 60);
-
+
if (flock($fp, LOCK_EX))
{
fwrite($fp, $expire.'TS--->'.$output);
@@ -386,51 +386,51 @@ class CI_Output {
}
// --------------------------------------------------------------------
-
+
/**
* Update/serve a cached file
*
* @access public
* @return void
- */
+ */
function _display_cache(&$CFG, &$URI)
{
$cache_path = ($CFG->item('cache_path') == '') ? BASEPATH.'cache/' : $CFG->item('cache_path');
-
+
// Build the file path. The file name is an MD5 hash of the full URI
$uri = $CFG->item('base_url').
$CFG->item('index_page').
$URI->uri_string;
-
+
$filepath = $cache_path.md5($uri);
-
+
if ( ! @file_exists($filepath))
{
return FALSE;
}
-
+
if ( ! $fp = @fopen($filepath, FOPEN_READ))
{
return FALSE;
}
-
+
flock($fp, LOCK_SH);
-
+
$cache = '';
if (filesize($filepath) > 0)
{
$cache = fread($fp, filesize($filepath));
}
-
+
flock($fp, LOCK_UN);
fclose($fp);
-
- // Strip out the embedded timestamp
+
+ // Strip out the embedded timestamp
if ( ! preg_match("/(\d+TS--->)/", $cache, $match))
{
return FALSE;
}
-
+
// Has the file expired? If so we'll delete it.
if (time() >= trim(str_replace('TS--->', '', $match['1'])))
{
@@ -438,13 +438,13 @@ class CI_Output {
{
@unlink($filepath);
log_message('debug', "Cache file has expired. File deleted");
- return FALSE;
+ return FALSE;
}
}
// Display the cache
$this->_display(str_replace($match['0'], '', $cache));
- log_message('debug', "Cache file is current. Sending it to browser.");
+ log_message('debug', "Cache file is current. Sending it to browser.");
return TRUE;
}
diff --git a/system/core/Router.php b/system/core/Router.php
index b371d5241..1db1ad836 100644
--- a/system/core/Router.php
+++ b/system/core/Router.php
@@ -28,14 +28,14 @@
*/
class CI_Router {
- var $config;
- var $routes = array();
+ var $config;
+ var $routes = array();
var $error_routes = array();
var $class = '';
var $method = 'index';
var $directory = '';
var $default_controller;
-
+
/**
* Constructor
*
@@ -47,9 +47,9 @@ class CI_Router {
$this->uri =& load_class('URI', 'core');
log_message('debug', "Router Class Initialized");
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Set the route mapping
*
@@ -60,9 +60,9 @@ class CI_Router {
* @return void
*/
function _set_routing()
- {
+ {
// Are query strings enabled in the config file? Normally CI doesn't utilize query strings
- // since URI segments are more search-engine friendly, but they can optionally be used.
+ // since URI segments are more search-engine friendly, but they can optionally be used.
// If this feature is enabled, we will gather the directory/class/method a little differently
$segments = array();
if ($this->config->item('enable_query_strings') === TRUE AND isset($_GET[$this->config->item('controller_trigger')]))
@@ -72,65 +72,65 @@ class CI_Router {
$this->set_directory(trim($this->uri->_filter_uri($_GET[$this->config->item('directory_trigger')])));
$segments[] = $this->fetch_directory();
}
-
+
if (isset($_GET[$this->config->item('controller_trigger')]))
{
$this->set_class(trim($this->uri->_filter_uri($_GET[$this->config->item('controller_trigger')])));
$segments[] = $this->fetch_class();
}
-
+
if (isset($_GET[$this->config->item('function_trigger')]))
{
$this->set_method(trim($this->uri->_filter_uri($_GET[$this->config->item('function_trigger')])));
$segments[] = $this->fetch_method();
}
}
-
+
// Load the routes.php file.
@include(APPPATH.'config/routes'.EXT);
$this->routes = ( ! isset($route) OR ! is_array($route)) ? array() : $route;
unset($route);
-
+
// Set the default controller so we can display it in the event
// the URI doesn't correlated to a valid controller.
- $this->default_controller = ( ! isset($this->routes['default_controller']) OR $this->routes['default_controller'] == '') ? FALSE : strtolower($this->routes['default_controller']);
-
+ $this->default_controller = ( ! isset($this->routes['default_controller']) OR $this->routes['default_controller'] == '') ? FALSE : strtolower($this->routes['default_controller']);
+
// Were there any query string segments? If so, we'll validate them and bail out since we're done.
if (count($segments) > 0)
{
return $this->_validate_request($segments);
}
-
+
// Fetch the complete URI string
$this->uri->_fetch_uri_string();
-
+
// Is there a URI string? If not, the default controller specified in the "routes" file will be shown.
if ($this->uri->uri_string == '')
{
return $this->_set_default_controller();
}
-
+
// Do we need to remove the URL suffix?
$this->uri->_remove_url_suffix();
-
+
// Compile the segments into an array
$this->uri->_explode_segments();
-
+
// Parse any custom routing that may exist
- $this->_parse_routes();
-
+ $this->_parse_routes();
+
// Re-index the segment array so that it starts with 1 rather than 0
$this->uri->_reindex_segments();
}
// --------------------------------------------------------------------
-
+
/**
* Set the default controller
*
* @access private
* @return void
- */
+ */
function _set_default_controller()
{
if ($this->default_controller === FALSE)
@@ -141,26 +141,26 @@ class CI_Router {
if (strpos($this->default_controller, '/') !== FALSE)
{
$x = explode('/', $this->default_controller);
-
+
$this->set_class($x[0]);
$this->set_method($x[1]);
$this->_set_request(array($x[0], $x[1]));
- }
+ }
else
{
$this->set_class($this->default_controller);
$this->set_method('index');
$this->_set_request(array($this->default_controller, 'index'));
}
-
+
// re-index the routed segments array so it starts with 1 rather than 0
$this->uri->_reindex_segments();
-
+
log_message('debug', "No URI present. Default controller set.");
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Set the Route
*
@@ -173,16 +173,16 @@ class CI_Router {
* @return void
*/
function _set_request($segments = array())
- {
+ {
$segments = $this->_validate_request($segments);
-
+
if (count($segments) == 0)
{
return $this->_set_default_controller();
}
-
+
$this->set_class($segments[0]);
-
+
if (isset($segments[1]))
{
// A standard method request
@@ -194,15 +194,15 @@ class CI_Router {
// index method is being used.
$segments[1] = 'index';
}
-
+
// Update our "routed" segment array to contain the segments.
// Note: If there is no custom routing, this array will be
// identical to $this->uri->segments
$this->uri->rsegments = $segments;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Validates the supplied segments. Attempts to determine the path to
* the controller.
@@ -210,33 +210,33 @@ class CI_Router {
* @access private
* @param array
* @return array
- */
+ */
function _validate_request($segments)
{
if (count($segments) == 0)
{
return $segments;
}
-
+
// Does the requested controller exist in the root folder?
if (file_exists(APPPATH.'controllers/'.$segments[0].EXT))
{
return $segments;
}
-
+
// Is the controller in a sub-folder?
if (is_dir(APPPATH.'controllers/'.$segments[0]))
{
// Set the directory and remove it from the segment array
$this->set_directory($segments[0]);
$segments = array_slice($segments, 1);
-
+
if (count($segments) > 0)
{
// Does the requested controller exist in the sub-folder?
if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$segments[0].EXT))
{
- show_404($this->fetch_directory().$segments[0]);
+ show_404($this->fetch_directory().$segments[0]);
}
}
else
@@ -245,29 +245,29 @@ class CI_Router {
if (strpos($this->default_controller, '/') !== FALSE)
{
$x = explode('/', $this->default_controller);
-
+
$this->set_class($x[0]);
$this->set_method($x[1]);
- }
+ }
else
{
$this->set_class($this->default_controller);
$this->set_method('index');
}
-
+
// Does the default controller exist in the sub-folder?
if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$this->default_controller.EXT))
{
$this->directory = '';
return array();
}
-
+
}
-
+
return $segments;
}
-
-
+
+
// If we've gotten this far it means that the URI does not correlate to a valid
// controller class. We will now see if there is an override
if (isset($this->routes['404_override']) AND $this->routes['404_override'] != '')
@@ -275,20 +275,20 @@ class CI_Router {
if (strpos($this->routes['404_override'], '/') !== FALSE)
{
$x = explode('/', $this->routes['404_override']);
-
+
$this->set_class($x[0]);
$this->set_method($x[1]);
-
+
return $x;
- }
+ }
}
-
+
// Nothing else to do at this point but show a 404
- show_404($segments[0]);
+ show_404($segments[0]);
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Parse Routes
*
@@ -303,16 +303,16 @@ class CI_Router {
{
// Turn the segment array into a URI string
$uri = implode('/', $this->uri->segments);
-
+
// Is there a literal match? If so we're done
if (isset($this->routes[$uri]))
{
return $this->_set_request(explode('/', $this->routes[$uri]));
}
-
+
// Loop through the route array looking for wild-cards
foreach ($this->routes as $key => $val)
- {
+ {
// Convert wild-cards to RegEx
$key = str_replace(':any', '.+', str_replace(':num', '[0-9]+', $key));
@@ -324,8 +324,8 @@ class CI_Router {
{
$val = preg_replace('#^'.$key.'$#', $val, $uri);
}
-
- return $this->_set_request(explode('/', $val));
+
+ return $this->_set_request(explode('/', $val));
}
}
@@ -335,54 +335,54 @@ class CI_Router {
}
// --------------------------------------------------------------------
-
+
/**
* Set the class name
*
* @access public
* @param string
* @return void
- */
+ */
function set_class($class)
{
$this->class = $class;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Fetch the current class
*
* @access public
* @return string
- */
+ */
function fetch_class()
{
return $this->class;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Set the method name
*
* @access public
* @param string
* @return void
- */
+ */
function set_method($method)
{
$this->method = $method;
}
// --------------------------------------------------------------------
-
+
/**
* Fetch the current method
*
* @access public
* @return string
- */
+ */
function fetch_method()
{
if ($this->method == $this->fetch_class())
@@ -394,58 +394,58 @@ class CI_Router {
}
// --------------------------------------------------------------------
-
+
/**
* Set the directory name
*
* @access public
* @param string
* @return void
- */
+ */
function set_directory($dir)
{
$this->directory = trim($dir, '/').'/';
}
// --------------------------------------------------------------------
-
+
/**
* Fetch the sub-directory (if any) that contains the requested controller class
*
* @access public
* @return string
- */
+ */
function fetch_directory()
{
return $this->directory;
}
// --------------------------------------------------------------------
-
+
/**
* Set the controller overrides
*
* @access public
* @param array
* @return null
- */
+ */
function _set_overrides($routing)
{
if ( ! is_array($routing))
{
return;
}
-
+
if (isset($routing['directory']))
{
$this->set_directory($routing['directory']);
}
-
+
if (isset($routing['controller']) AND $routing['controller'] != '')
{
$this->set_class($routing['controller']);
}
-
+
if (isset($routing['function']))
{
$routing['function'] = ($routing['function'] == '') ? 'index' : $routing['function'];
diff --git a/system/core/URI.php b/system/core/URI.php
index cffffc20d..a3bd45091 100644
--- a/system/core/URI.php
+++ b/system/core/URI.php
@@ -195,7 +195,7 @@ class CI_URI {
}
// Convert programatic characters to entities
- $bad = array('$', '(', ')', '%28', '%29');
+ $bad = array('$', '(', ')', '%28', '%29');
$good = array('&#36;', '&#40;', '&#41;', '&#40;', '&#41;');
return str_replace($bad, $good, $str);
@@ -321,7 +321,7 @@ class CI_URI {
*/
function uri_to_assoc($n = 3, $default = array())
{
- return $this->_uri_to_assoc($n, $default, 'segment');
+ return $this->_uri_to_assoc($n, $default, 'segment');
}
/**
* Identical to above only it uses the re-routed segment array
@@ -329,7 +329,7 @@ class CI_URI {
*/
function ruri_to_assoc($n = 3, $default = array())
{
- return $this->_uri_to_assoc($n, $default, 'rsegment');
+ return $this->_uri_to_assoc($n, $default, 'rsegment');
}
// --------------------------------------------------------------------
diff --git a/system/core/Unicode.php b/system/core/Unicode.php
index c8f1203f7..ecc8d3042 100644
--- a/system/core/Unicode.php
+++ b/system/core/Unicode.php
@@ -30,14 +30,14 @@ class CI_Unicode {
/**
* Constructor
- *
+ *
* Determines if UTF-8 support is to be enabled
- *
+ *
*/
function CI_Unicode()
{
log_message('debug', "Unicode Class Initialized");
-
+
global $CFG;
if (
@@ -48,7 +48,7 @@ class CI_Unicode {
)
{
log_message('debug', "Unicode Class - UTF-8 Support Enabled");
-
+
define('UTF8_ENABLED', TRUE);
// set internal encoding for multibyte string functions if necessary
@@ -68,11 +68,11 @@ class CI_Unicode {
{
log_message('debug', "Unicode Class - UTF-8 Support Disabled");
define('UTF8_ENABLED', FALSE);
- }
+ }
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Clean UTF-8 strings
*
@@ -88,19 +88,19 @@ class CI_Unicode {
{
$str = @iconv('UTF-8', 'UTF-8//IGNORE', $str);
}
-
+
return $str;
}
// --------------------------------------------------------------------
-
+
/**
* Remove ASCII control characters
*
* Removes all ASCII control characters except horizontal tabs,
* line feeds, and carriage returns, as all others can cause
* problems in XML
- *
+ *
* @access public
* @param string
* @return string
@@ -111,7 +111,7 @@ class CI_Unicode {
}
// --------------------------------------------------------------------
-
+
/**
* Convert to UTF-8
*
@@ -136,12 +136,12 @@ class CI_Unicode {
{
return FALSE;
}
-
+
return $str;
}
// --------------------------------------------------------------------
-
+
/**
* Is ASCII?
*
@@ -157,7 +157,7 @@ class CI_Unicode {
}
// --------------------------------------------------------------------
-
+
}
// End Unicode Class
diff --git a/system/database/DB.php b/system/database/DB.php
index a91ca08fa..1b4eb8bec 100644
--- a/system/database/DB.php
+++ b/system/database/DB.php
@@ -28,39 +28,39 @@ function &DB($params = '', $active_record_override = NULL)
if (is_string($params) AND strpos($params, '://') === FALSE)
{
include(APPPATH.'config/database'.EXT);
-
+
if ( ! isset($db) OR count($db) == 0)
{
show_error('No database connection settings were found in the database config file.');
}
-
+
if ($params != '')
{
$active_group = $params;
}
-
+
if ( ! isset($active_group) OR ! isset($db[$active_group]))
{
show_error('You have specified an invalid database connection group.');
}
-
+
$params = $db[$active_group];
}
elseif (is_string($params))
{
-
+
/* parse the URL from the DSN string
- * 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';
- */
-
+ * 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';
+ */
+
if (($dns = @parse_url($params)) === FALSE)
{
show_error('Invalid DB Connection String');
}
-
+
$params = array(
'dbdriver' => $dns['scheme'],
'hostname' => (isset($dns['host'])) ? rawurldecode($dns['host']) : '',
@@ -68,7 +68,7 @@ function &DB($params = '', $active_record_override = NULL)
'password' => (isset($dns['pass'])) ? rawurldecode($dns['pass']) : '',
'database' => (isset($dns['path'])) ? rawurldecode(substr($dns['path'], 1)) : ''
);
-
+
// were additional config items set?
if (isset($dns['query']))
{
@@ -90,7 +90,7 @@ function &DB($params = '', $active_record_override = NULL)
}
}
}
-
+
// No DB specified yet? Beat them senseless...
if ( ! isset($params['dbdriver']) OR $params['dbdriver'] == '')
{
@@ -101,18 +101,18 @@ function &DB($params = '', $active_record_override = NULL)
// 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()
-
+
if ($active_record_override !== NULL)
{
$active_record = $active_record_override;
}
-
+
require_once(BASEPATH.'database/DB_driver'.EXT);
if ( ! isset($active_record) OR $active_record == TRUE)
{
require_once(BASEPATH.'database/DB_active_rec'.EXT);
-
+
if ( ! class_exists('CI_DB'))
{
eval('class CI_DB extends CI_DB_active_record { }');
@@ -125,25 +125,25 @@ function &DB($params = '', $active_record_override = NULL)
eval('class CI_DB extends CI_DB_driver { }');
}
}
-
+
require_once(BASEPATH.'database/drivers/'.$params['dbdriver'].'/'.$params['dbdriver'].'_driver'.EXT);
// Instantiate the DB adapter
$driver = 'CI_DB_'.$params['dbdriver'].'_driver';
$DB =& instantiate_class(new $driver($params));
-
+
if ($DB->autoinit == TRUE)
{
$DB->initialize();
}
-
+
if (isset($params['stricton']) && $params['stricton'] == TRUE)
{
- $DB->query('SET SESSION sql_mode="STRICT_ALL_TABLES"');
+ $DB->query('SET SESSION sql_mode="STRICT_ALL_TABLES"');
}
-
+
return $DB;
-}
+}
diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php
index 25645a050..ce50479cc 100644
--- a/system/database/DB_active_rec.php
+++ b/system/database/DB_active_rec.php
@@ -41,13 +41,13 @@ class CI_DB_active_record extends CI_DB_driver {
var $ar_offset = FALSE;
var $ar_order = FALSE;
var $ar_orderby = array();
- var $ar_set = array();
+ var $ar_set = array();
var $ar_wherein = array();
var $ar_aliased_tables = array();
var $ar_store_array = array();
-
+
// Active Record Caching variables
- var $ar_caching = FALSE;
+ var $ar_caching = FALSE;
var $ar_cache_exists = array();
var $ar_cache_select = array();
var $ar_cache_from = array();
@@ -57,7 +57,7 @@ class CI_DB_active_record extends CI_DB_driver {
var $ar_cache_groupby = array();
var $ar_cache_having = array();
var $ar_cache_orderby = array();
- var $ar_cache_set = array();
+ var $ar_cache_set = array();
// --------------------------------------------------------------------
@@ -73,12 +73,12 @@ class CI_DB_active_record extends CI_DB_driver {
*/
function select($select = '*', $escape = NULL)
{
- // Set the global value if this was sepecified
+ // Set the global value if this was sepecified
if (is_bool($escape))
{
$this->_protect_identifiers = $escape;
}
-
+
if (is_string($select))
{
$select = explode(',', $select);
@@ -118,7 +118,7 @@ class CI_DB_active_record extends CI_DB_driver {
{
return $this->_max_min_avg_sum($select, $alias, 'MAX');
}
-
+
// --------------------------------------------------------------------
/**
@@ -179,7 +179,7 @@ class CI_DB_active_record extends CI_DB_driver {
* select_min()
* select_avg()
* select_sum()
- *
+ *
* @access public
* @param string the field
* @param string an alias
@@ -191,29 +191,29 @@ class CI_DB_active_record extends CI_DB_driver {
{
$this->display_error('db_invalid_query');
}
-
+
$type = strtoupper($type);
-
+
if ( ! in_array($type, array('MAX', 'MIN', 'AVG', 'SUM')))
{
show_error('Invalid function type: '.$type);
}
-
+
if ($alias == '')
{
$alias = $this->_create_alias_from_table(trim($select));
}
-
+
$sql = $type.'('.$this->_protect_identifiers(trim($select)).') AS '.$alias;
$this->ar_select[] = $sql;
-
+
if ($this->ar_caching === TRUE)
{
$this->ar_cache_select[] = $sql;
$this->ar_cache_exists[] = 'select';
}
-
+
return $this;
}
@@ -232,7 +232,7 @@ class CI_DB_active_record extends CI_DB_driver {
{
return end(explode('.', $item));
}
-
+
return $item;
}
@@ -252,7 +252,7 @@ class CI_DB_active_record extends CI_DB_driver {
$this->ar_distinct = (is_bool($val)) ? $val : TRUE;
return $this;
}
-
+
// --------------------------------------------------------------------
/**
@@ -276,12 +276,12 @@ class CI_DB_active_record extends CI_DB_driver {
$this->_track_aliases($v);
$this->ar_from[] = $this->_protect_identifiers($v, TRUE, NULL, FALSE);
-
+
if ($this->ar_caching === TRUE)
{
$this->ar_cache_from[] = $this->_protect_identifiers($v, TRUE, NULL, FALSE);
$this->ar_cache_exists[] = 'from';
- }
+ }
}
}
@@ -290,11 +290,11 @@ class CI_DB_active_record extends CI_DB_driver {
$val = trim($val);
// Extract any aliases that might exist. We use this information
- // in the _protect_identifiers to know whether to add a table prefix
+ // in the _protect_identifiers to know whether to add a table prefix
$this->_track_aliases($val);
-
+
$this->ar_from[] = $this->_protect_identifiers($val, TRUE, NULL, FALSE);
-
+
if ($this->ar_caching === TRUE)
{
$this->ar_cache_from[] = $this->_protect_identifiers($val, TRUE, NULL, FALSE);
@@ -320,7 +320,7 @@ class CI_DB_active_record extends CI_DB_driver {
* @return object
*/
function join($table, $cond, $type = '')
- {
+ {
if ($type != '')
{
$type = strtoupper(trim($type));
@@ -336,7 +336,7 @@ class CI_DB_active_record extends CI_DB_driver {
}
// Extract any aliases that might exist. We use this information
- // in the _protect_identifiers to know whether to add a table prefix
+ // in the _protect_identifiers to know whether to add a table prefix
$this->_track_aliases($table);
// Strip apart the condition and protect the identifiers
@@ -344,10 +344,10 @@ class CI_DB_active_record extends CI_DB_driver {
{
$match[1] = $this->_protect_identifiers($match[1]);
$match[3] = $this->_protect_identifiers($match[3]);
-
- $cond = $match[1].$match[2].$match[3];
+
+ $cond = $match[1].$match[2].$match[3];
}
-
+
// Assemble the JOIN statement
$join = $type.'JOIN '.$this->_protect_identifiers($table, TRUE, NULL, FALSE).' ON '.$cond;
@@ -378,7 +378,7 @@ class CI_DB_active_record extends CI_DB_driver {
{
return $this->_where($key, $value, 'AND ', $escape);
}
-
+
// --------------------------------------------------------------------
/**
@@ -416,7 +416,7 @@ class CI_DB_active_record extends CI_DB_driver {
{
$key = array($key => $value);
}
-
+
// If the escape value was not set will will base it on the global setting
if ( ! is_bool($escape))
{
@@ -432,13 +432,13 @@ class CI_DB_active_record extends CI_DB_driver {
// value appears not to have been set, assign the test to IS NULL
$k .= ' IS NULL';
}
-
+
if ( ! is_null($v))
{
if ($escape === TRUE)
{
$k = $this->_protect_identifiers($k, FALSE, $escape);
-
+
$v = ' '.$this->escape($v);
}
@@ -449,19 +449,19 @@ class CI_DB_active_record extends CI_DB_driver {
}
else
{
- $k = $this->_protect_identifiers($k, FALSE, $escape);
+ $k = $this->_protect_identifiers($k, FALSE, $escape);
}
$this->ar_where[] = $prefix.$k.$v;
-
+
if ($this->ar_caching === TRUE)
{
$this->ar_cache_where[] = $prefix.$k.$v;
$this->ar_cache_exists[] = 'where';
}
-
+
}
-
+
return $this;
}
@@ -482,7 +482,7 @@ class CI_DB_active_record extends CI_DB_driver {
{
return $this->_where_in($key, $values);
}
-
+
// --------------------------------------------------------------------
/**
@@ -518,7 +518,7 @@ class CI_DB_active_record extends CI_DB_driver {
{
return $this->_where_in($key, $values, TRUE);
}
-
+
// --------------------------------------------------------------------
/**
@@ -548,7 +548,7 @@ class CI_DB_active_record extends CI_DB_driver {
* @param string The field to search
* @param array The values searched on
* @param boolean If the statement would be IN or NOT IN
- * @param string
+ * @param string
* @return object
*/
function _where_in($key = NULL, $values = NULL, $not = FALSE, $type = 'AND ')
@@ -557,12 +557,12 @@ class CI_DB_active_record extends CI_DB_driver {
{
return;
}
-
+
if ( ! is_array($values))
{
$values = array($values);
}
-
+
$not = ($not) ? ' NOT' : '';
foreach ($values as $value)
@@ -571,7 +571,7 @@ class CI_DB_active_record extends CI_DB_driver {
}
$prefix = (count($this->ar_where) == 0) ? '' : $type;
-
+
$where_in = $prefix . $this->_protect_identifiers($key) . $not . " IN (" . implode(", ", $this->ar_wherein) . ") ";
$this->ar_where[] = $where_in;
@@ -585,7 +585,7 @@ class CI_DB_active_record extends CI_DB_driver {
$this->ar_wherein = array();
return $this;
}
-
+
// --------------------------------------------------------------------
/**
@@ -621,7 +621,7 @@ class CI_DB_active_record extends CI_DB_driver {
{
return $this->_like($field, $match, 'AND ', $side, 'NOT');
}
-
+
// --------------------------------------------------------------------
/**
@@ -657,7 +657,7 @@ class CI_DB_active_record extends CI_DB_driver {
{
return $this->_like($field, $match, 'OR ', $side, 'NOT');
}
-
+
// --------------------------------------------------------------------
/**
@@ -677,7 +677,7 @@ class CI_DB_active_record extends CI_DB_driver {
{
$field = array($field => $match);
}
-
+
foreach ($field as $k => $v)
{
$k = $this->_protect_identifiers($k);
@@ -711,11 +711,11 @@ class CI_DB_active_record extends CI_DB_driver {
$this->ar_cache_like[] = $like_statement;
$this->ar_cache_exists[] = 'like';
}
-
+
}
return $this;
}
-
+
// --------------------------------------------------------------------
/**
@@ -731,15 +731,15 @@ class CI_DB_active_record extends CI_DB_driver {
{
$by = explode(',', $by);
}
-
+
foreach ($by as $val)
{
$val = trim($val);
-
+
if ($val != '')
{
$this->ar_groupby[] = $this->_protect_identifiers($val);
-
+
if ($this->ar_caching === TRUE)
{
$this->ar_cache_groupby[] = $this->_protect_identifiers($val);
@@ -766,7 +766,7 @@ class CI_DB_active_record extends CI_DB_driver {
{
return $this->_having($key, $value, 'AND ', $escape);
}
-
+
// --------------------------------------------------------------------
/**
@@ -783,7 +783,7 @@ class CI_DB_active_record extends CI_DB_driver {
{
return $this->_having($key, $value, 'OR ', $escape);
}
-
+
// --------------------------------------------------------------------
/**
@@ -802,7 +802,7 @@ class CI_DB_active_record extends CI_DB_driver {
{
$key = array($key => $value);
}
-
+
foreach ($key as $k => $v)
{
$prefix = (count($this->ar_having) == 0) ? '' : $type;
@@ -821,7 +821,7 @@ class CI_DB_active_record extends CI_DB_driver {
{
$v = ' '.$this->escape_str($v);
}
-
+
$this->ar_having[] = $prefix.$k.$v;
if ($this->ar_caching === TRUE)
{
@@ -829,10 +829,10 @@ class CI_DB_active_record extends CI_DB_driver {
$this->ar_cache_exists[] = 'having';
}
}
-
+
return $this;
}
-
+
// --------------------------------------------------------------------
/**
@@ -854,8 +854,8 @@ class CI_DB_active_record extends CI_DB_driver {
{
$direction = (in_array(strtoupper(trim($direction)), array('ASC', 'DESC'), TRUE)) ? ' '.$direction : ' ASC';
}
-
-
+
+
if (strpos($orderby, ',') !== FALSE)
{
$temp = array();
@@ -866,19 +866,19 @@ class CI_DB_active_record extends CI_DB_driver {
{
$part = $this->_protect_identifiers(trim($part));
}
-
+
$temp[] = $part;
}
-
- $orderby = implode(', ', $temp);
+
+ $orderby = implode(', ', $temp);
}
else if ($direction != $this->_random_keyword)
{
$orderby = $this->_protect_identifiers($orderby);
}
-
+
$orderby_statement = $orderby.$direction;
-
+
$this->ar_orderby[] = $orderby_statement;
if ($this->ar_caching === TRUE)
{
@@ -888,7 +888,7 @@ class CI_DB_active_record extends CI_DB_driver {
return $this;
}
-
+
// --------------------------------------------------------------------
/**
@@ -907,10 +907,10 @@ class CI_DB_active_record extends CI_DB_driver {
{
$this->ar_offset = $offset;
}
-
+
return $this;
}
-
+
// --------------------------------------------------------------------
/**
@@ -925,7 +925,7 @@ class CI_DB_active_record extends CI_DB_driver {
$this->ar_offset = $offset;
return $this;
}
-
+
// --------------------------------------------------------------------
/**
@@ -940,11 +940,11 @@ class CI_DB_active_record extends CI_DB_driver {
function set($key, $value = '', $escape = TRUE)
{
$key = $this->_object_to_array($key);
-
+
if ( ! is_array($key))
{
$key = array($key => $value);
- }
+ }
foreach ($key as $k => $v)
{
@@ -957,10 +957,10 @@ class CI_DB_active_record extends CI_DB_driver {
$this->ar_set[$this->_protect_identifiers($k)] = $this->escape($v);
}
}
-
+
return $this;
}
-
+
// --------------------------------------------------------------------
/**
@@ -982,12 +982,12 @@ class CI_DB_active_record extends CI_DB_driver {
$this->_track_aliases($table);
$this->from($table);
}
-
+
if ( ! is_null($limit))
{
$this->limit($limit, $offset);
}
-
+
$sql = $this->_compile_select();
$result = $this->query($sql);
@@ -998,7 +998,7 @@ class CI_DB_active_record extends CI_DB_driver {
/**
* "Count All Results" query
*
- * Generates a platform-specific query string that counts all records
+ * Generates a platform-specific query string that counts all records
* returned by an Active Record query.
*
* @access public
@@ -1012,12 +1012,12 @@ class CI_DB_active_record extends CI_DB_driver {
$this->_track_aliases($table);
$this->from($table);
}
-
+
$sql = $this->_compile_select($this->_count_string . $this->_protect_identifiers('numrows'));
$query = $this->query($sql);
$this->_reset_select();
-
+
if ($query->num_rows() == 0)
{
return '0';
@@ -1051,12 +1051,12 @@ class CI_DB_active_record extends CI_DB_driver {
{
$this->where($where);
}
-
+
if ( ! is_null($limit))
{
$this->limit($limit, $offset);
}
-
+
$sql = $this->_compile_select();
$result = $this->query($sql);
@@ -1077,17 +1077,17 @@ class CI_DB_active_record extends CI_DB_driver {
* @return object
*/
function insert_batch($table = '', $set = NULL)
- {
+ {
if ( ! is_null($set))
{
$this->set_insert_batch($set);
}
-
+
if (count($this->ar_set) == 0)
{
if ($this->db_debug)
{
- //No valid data array. Folds in cases where keys and values did not match up
+ //No valid data array. Folds in cases where keys and values did not match up
return $this->display_error('db_must_use_set');
}
return FALSE;
@@ -1103,25 +1103,25 @@ class CI_DB_active_record extends CI_DB_driver {
}
return FALSE;
}
-
+
$table = $this->ar_from[0];
}
// Batch this baby
for ($i = 0, $total = count($this->ar_set); $i < $total; $i = $i + 100)
{
-
+
$sql = $this->_insert_batch($this->_protect_identifiers($table, TRUE, NULL, FALSE), $this->ar_keys, array_slice($this->ar_set, $i, 100));
//echo $sql;
$this->query($sql);
}
-
+
$this->_reset_write();
- return TRUE;
+ return TRUE;
}
// --------------------------------------------------------------------
@@ -1139,26 +1139,26 @@ class CI_DB_active_record extends CI_DB_driver {
function set_insert_batch($key, $value = '', $escape = TRUE)
{
$key = $this->_object_to_array_batch($key);
-
+
if ( ! is_array($key))
{
$key = array($key => $value);
- }
+ }
$keys = array_keys(current($key));
sort($keys);
foreach ($key as $row)
{
- if (count(array_diff($keys, array_keys($row))) > 0 OR count(array_diff(array_keys($row), $keys)) > 0)
- {
- // batch function above returns an error on an empty array
- $this->ar_set[] = array();
- return;
- }
-
- ksort($row); // puts $row in the same order as our keys
+ if (count(array_diff($keys, array_keys($row))) > 0 OR count(array_diff(array_keys($row), $keys)) > 0)
+ {
+ // batch function above returns an error on an empty array
+ $this->ar_set[] = array();
+ return;
+ }
+ ksort($row); // puts $row in the same order as our keys
+
if ($escape === FALSE)
{
$this->ar_set[] = '('.implode(',', $row).')';
@@ -1169,18 +1169,18 @@ class CI_DB_active_record extends CI_DB_driver {
foreach($row as $value)
{
- $clean[] = $this->escape($value);
+ $clean[] = $this->escape($value);
}
- $this->ar_set[] = '('.implode(',', $clean).')';
- }
+ $this->ar_set[] = '('.implode(',', $clean).')';
+ }
}
foreach ($keys as $k)
{
$this->ar_keys[] = $this->_protect_identifiers($k);
}
-
+
return $this;
}
@@ -1197,12 +1197,12 @@ class CI_DB_active_record extends CI_DB_driver {
* @return object
*/
function insert($table = '', $set = NULL)
- {
+ {
if ( ! is_null($set))
{
$this->set($set);
}
-
+
if (count($this->ar_set) == 0)
{
if ($this->db_debug)
@@ -1222,23 +1222,23 @@ class CI_DB_active_record extends CI_DB_driver {
}
return FALSE;
}
-
+
$table = $this->ar_from[0];
}
$sql = $this->_insert($this->_protect_identifiers($table, TRUE, NULL, FALSE), array_keys($this->ar_set), array_values($this->ar_set));
-
+
$this->_reset_write();
- return $this->query($sql);
+ return $this->query($sql);
}
-
+
function replace($table = '', $set = NULL)
{
if ( ! is_null($set))
{
$this->set($set);
}
-
+
if (count($this->ar_set) == 0)
{
if ($this->db_debug)
@@ -1258,14 +1258,14 @@ class CI_DB_active_record extends CI_DB_driver {
}
return FALSE;
}
-
+
$table = $this->ar_from[0];
}
$sql = $this->_replace($this->_protect_identifiers($table, TRUE, NULL, FALSE), array_keys($this->ar_set), array_values($this->ar_set));
-
+
$this->_reset_write();
- return $this->query($sql);
+ return $this->query($sql);
}
// --------------------------------------------------------------------
@@ -1290,7 +1290,7 @@ class CI_DB_active_record extends CI_DB_driver {
{
$this->set($set);
}
-
+
if (count($this->ar_set) == 0)
{
if ($this->db_debug)
@@ -1310,10 +1310,10 @@ class CI_DB_active_record extends CI_DB_driver {
}
return FALSE;
}
-
+
$table = $this->ar_from[0];
}
-
+
if ($where != NULL)
{
$this->where($where);
@@ -1323,9 +1323,9 @@ class CI_DB_active_record extends CI_DB_driver {
{
$this->limit($limit);
}
-
+
$sql = $this->_update($this->_protect_identifiers($table, TRUE, NULL, FALSE), $this->ar_set, $this->ar_where, $this->ar_orderby, $this->ar_limit);
-
+
$this->_reset_write();
return $this->query($sql);
}
@@ -1348,7 +1348,7 @@ class CI_DB_active_record extends CI_DB_driver {
{
// Combine any cached components with the current statements
$this->_merge_cache();
-
+
if (is_null($index))
{
if ($this->db_debug)
@@ -1384,10 +1384,10 @@ class CI_DB_active_record extends CI_DB_driver {
}
return FALSE;
}
-
+
$table = $this->ar_from[0];
}
-
+
// Batch this baby
for ($i = 0, $total = count($this->ar_set); $i < $total; $i = $i + 100)
{
@@ -1395,7 +1395,7 @@ class CI_DB_active_record extends CI_DB_driver {
$this->query($sql);
}
-
+
$this->_reset_write();
}
@@ -1414,11 +1414,11 @@ class CI_DB_active_record extends CI_DB_driver {
function set_update_batch($key, $index = '', $escape = TRUE)
{
$key = $this->_object_to_array_batch($key);
-
+
if ( ! is_array($key))
{
// @todo error
- }
+ }
foreach ($key as $k => $v)
{
@@ -1442,7 +1442,7 @@ class CI_DB_active_record extends CI_DB_driver {
}
else
{
- $clean[$this->_protect_identifiers($k2)] = $this->escape($v2);
+ $clean[$this->_protect_identifiers($k2)] = $this->escape($v2);
}
}
@@ -1453,7 +1453,7 @@ class CI_DB_active_record extends CI_DB_driver {
$this->ar_set[] = $clean;
}
-
+
return $this;
}
@@ -1491,7 +1491,7 @@ class CI_DB_active_record extends CI_DB_driver {
$sql = $this->_delete($table);
$this->_reset_write();
-
+
return $this->query($sql);
}
@@ -1531,10 +1531,10 @@ class CI_DB_active_record extends CI_DB_driver {
$sql = $this->_truncate($table);
$this->_reset_write();
-
+
return $this->query($sql);
}
-
+
// --------------------------------------------------------------------
/**
@@ -1600,7 +1600,7 @@ class CI_DB_active_record extends CI_DB_driver {
}
return FALSE;
- }
+ }
$sql = $this->_delete($table, $this->ar_where, $this->ar_like, $this->ar_limit);
@@ -1608,7 +1608,7 @@ class CI_DB_active_record extends CI_DB_driver {
{
$this->_reset_write();
}
-
+
return $this->query($sql);
}
@@ -1643,7 +1643,7 @@ class CI_DB_active_record extends CI_DB_driver {
* @access private
* @param string The table to inspect
* @return string
- */
+ */
function _track_aliases($table)
{
if (is_array($table))
@@ -1654,23 +1654,23 @@ class CI_DB_active_record extends CI_DB_driver {
}
return;
}
-
+
// Does the string contain a comma? If so, we need to separate
// the string into discreet statements
if (strpos($table, ',') !== FALSE)
{
return $this->_track_aliases(explode(',', $table));
}
-
+
// if a table alias is used we can recognize it by a space
if (strpos($table, " ") !== FALSE)
{
// if the alias is written with the AS keyword, remove it
$table = preg_replace('/ AS /i', ' ', $table);
-
+
// Grab the alias
$table = trim(strrchr($table, " "));
-
+
// Store the alias, if it doesn't already exist
if ( ! in_array($table, $this->ar_aliased_tables))
{
@@ -1696,7 +1696,7 @@ class CI_DB_active_record extends CI_DB_driver {
$this->_merge_cache();
// ----------------------------------------------------------------
-
+
// Write the "select" portion of the query
if ($select_override !== FALSE)
@@ -1706,13 +1706,13 @@ class CI_DB_active_record extends CI_DB_driver {
else
{
$sql = ( ! $this->ar_distinct) ? 'SELECT ' : 'SELECT DISTINCT ';
-
+
if (count($this->ar_select) == 0)
{
- $sql .= '*';
+ $sql .= '*';
}
else
- {
+ {
// Cycle through the "select" portion of the query and prep each column name.
// The reason we protect identifiers here rather then in the select() function
// is because until the user calls the from() function we don't know if there are aliases
@@ -1720,13 +1720,13 @@ class CI_DB_active_record extends CI_DB_driver {
{
$this->ar_select[$key] = $this->_protect_identifiers($val);
}
-
+
$sql .= implode(', ', $this->ar_select);
}
}
// ----------------------------------------------------------------
-
+
// Write the "FROM" portion of the query
if (count($this->ar_from) > 0)
@@ -1737,7 +1737,7 @@ class CI_DB_active_record extends CI_DB_driver {
}
// ----------------------------------------------------------------
-
+
// Write the "JOIN" portion of the query
if (count($this->ar_join) > 0)
@@ -1748,7 +1748,7 @@ class CI_DB_active_record extends CI_DB_driver {
}
// ----------------------------------------------------------------
-
+
// Write the "WHERE" portion of the query
if (count($this->ar_where) > 0 OR count($this->ar_like) > 0)
@@ -1761,9 +1761,9 @@ class CI_DB_active_record extends CI_DB_driver {
$sql .= implode("\n", $this->ar_where);
// ----------------------------------------------------------------
-
+
// Write the "LIKE" portion of the query
-
+
if (count($this->ar_like) > 0)
{
if (count($this->ar_where) > 0)
@@ -1775,20 +1775,20 @@ class CI_DB_active_record extends CI_DB_driver {
}
// ----------------------------------------------------------------
-
+
// Write the "GROUP BY" portion of the query
-
+
if (count($this->ar_groupby) > 0)
{
$sql .= "\nGROUP BY ";
-
+
$sql .= implode(', ', $this->ar_groupby);
}
// ----------------------------------------------------------------
-
+
// Write the "HAVING" portion of the query
-
+
if (count($this->ar_having) > 0)
{
$sql .= "\nHAVING ";
@@ -1796,24 +1796,24 @@ class CI_DB_active_record extends CI_DB_driver {
}
// ----------------------------------------------------------------
-
+
// Write the "ORDER BY" portion of the query
if (count($this->ar_orderby) > 0)
{
$sql .= "\nORDER BY ";
$sql .= implode(', ', $this->ar_orderby);
-
+
if ($this->ar_order !== FALSE)
{
$sql .= ($this->ar_order == 'desc') ? ' DESC' : ' ASC';
- }
+ }
}
// ----------------------------------------------------------------
-
+
// Write the "LIMIT" portion of the query
-
+
if (is_numeric($this->ar_limit))
{
$sql .= "\n";
@@ -1840,7 +1840,7 @@ class CI_DB_active_record extends CI_DB_driver {
{
return $object;
}
-
+
$array = array();
foreach (get_object_vars($object) as $key => $val)
{
@@ -1853,7 +1853,7 @@ class CI_DB_active_record extends CI_DB_driver {
return $array;
}
-
+
// --------------------------------------------------------------------
/**
@@ -1871,7 +1871,7 @@ class CI_DB_active_record extends CI_DB_driver {
{
return $object;
}
-
+
$array = array();
$out = get_object_vars($object);
$fields = array_keys($out);
@@ -1893,7 +1893,7 @@ class CI_DB_active_record extends CI_DB_driver {
return $array;
}
-
+
// --------------------------------------------------------------------
/**
@@ -1903,7 +1903,7 @@ class CI_DB_active_record extends CI_DB_driver {
*
* @access public
* @return void
- */
+ */
function start_cache()
{
$this->ar_caching = TRUE;
@@ -1918,7 +1918,7 @@ class CI_DB_active_record extends CI_DB_driver {
*
* @access public
* @return void
- */
+ */
function stop_cache()
{
$this->ar_caching = FALSE;
@@ -1933,23 +1933,23 @@ class CI_DB_active_record extends CI_DB_driver {
*
* @access public
* @return void
- */
+ */
function flush_cache()
- {
+ {
$this->_reset_run(
array(
- 'ar_cache_select' => array(),
- 'ar_cache_from' => array(),
+ 'ar_cache_select' => array(),
+ 'ar_cache_from' => array(),
'ar_cache_join' => array(),
- 'ar_cache_where' => array(),
- 'ar_cache_like' => array(),
- 'ar_cache_groupby' => array(),
- 'ar_cache_having' => array(),
- 'ar_cache_orderby' => array(),
+ 'ar_cache_where' => array(),
+ 'ar_cache_like' => array(),
+ 'ar_cache_groupby' => array(),
+ 'ar_cache_having' => array(),
+ 'ar_cache_orderby' => array(),
'ar_cache_set' => array(),
'ar_cache_exists' => array()
)
- );
+ );
}
// --------------------------------------------------------------------
@@ -1957,7 +1957,7 @@ class CI_DB_active_record extends CI_DB_driver {
/**
* Merge Cache
*
- * When called, this function merges any cached AR arrays with
+ * When called, this function merges any cached AR arrays with
* locally called ones.
*
* @access private
@@ -2022,25 +2022,25 @@ class CI_DB_active_record extends CI_DB_driver {
function _reset_select()
{
$ar_reset_items = array(
- 'ar_select' => array(),
- 'ar_from' => array(),
- 'ar_join' => array(),
- 'ar_where' => array(),
- 'ar_like' => array(),
- 'ar_groupby' => array(),
- 'ar_having' => array(),
- 'ar_orderby' => array(),
- 'ar_wherein' => array(),
+ 'ar_select' => array(),
+ 'ar_from' => array(),
+ 'ar_join' => array(),
+ 'ar_where' => array(),
+ 'ar_like' => array(),
+ 'ar_groupby' => array(),
+ 'ar_having' => array(),
+ 'ar_orderby' => array(),
+ 'ar_wherein' => array(),
'ar_aliased_tables' => array(),
- 'ar_distinct' => FALSE,
- 'ar_limit' => FALSE,
- 'ar_offset' => FALSE,
+ 'ar_distinct' => FALSE,
+ 'ar_limit' => FALSE,
+ 'ar_offset' => FALSE,
'ar_order' => FALSE,
);
-
+
$this->_reset_run($ar_reset_items);
}
-
+
// --------------------------------------------------------------------
/**
@@ -2052,21 +2052,21 @@ class CI_DB_active_record extends CI_DB_driver {
* @return void
*/
function _reset_write()
- {
+ {
$ar_reset_items = array(
- 'ar_set' => array(),
- 'ar_from' => array(),
- 'ar_where' => array(),
+ 'ar_set' => array(),
+ 'ar_from' => array(),
+ 'ar_where' => array(),
'ar_like' => array(),
'ar_orderby' => array(),
- 'ar_keys' => array(),
- 'ar_limit' => FALSE,
+ 'ar_keys' => array(),
+ 'ar_limit' => FALSE,
'ar_order' => FALSE
);
$this->_reset_run($ar_reset_items);
}
-
+
}
/* End of file DB_active_rec.php */
diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php
index 2606df842..6eff5943e 100644
--- a/system/database/DB_cache.php
+++ b/system/database/DB_cache.php
@@ -32,14 +32,14 @@ class CI_DB_Cache {
*
* Grabs the CI super object instance so we can access it.
*
- */
+ */
function CI_DB_Cache(&$db)
{
// Assign the main CI object to $this->CI
// and load the file helper since we use it a lot
$this->CI =& get_instance();
$this->db =& $db;
- $this->CI->load->helper('file');
+ $this->CI->load->helper('file');
}
// --------------------------------------------------------------------
@@ -50,7 +50,7 @@ class CI_DB_Cache {
* @access public
* @param string the path to the cache directory
* @return bool
- */
+ */
function check_path($path = '')
{
if ($path == '')
@@ -59,10 +59,10 @@ class CI_DB_Cache {
{
return $this->db->cache_off();
}
-
+
$path = $this->db->cachedir;
}
-
+
// Add a trailing slash to the path if needed
$path = preg_replace("/(.+?)\/*$/", "\\1/", $path);
@@ -71,11 +71,11 @@ class CI_DB_Cache {
// If the path is wrong we'll turn off caching
return $this->db->cache_off();
}
-
+
$this->db->cachedir = $path;
return TRUE;
}
-
+
// --------------------------------------------------------------------
/**
@@ -95,18 +95,18 @@ class CI_DB_Cache {
}
$segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1);
-
+
$segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2);
-
- $filepath = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'.md5($sql);
-
+
+ $filepath = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'.md5($sql);
+
if (FALSE === ($cachedata = read_file($filepath)))
- {
+ {
return FALSE;
}
-
- return unserialize($cachedata);
- }
+
+ return unserialize($cachedata);
+ }
// --------------------------------------------------------------------
@@ -124,28 +124,28 @@ class CI_DB_Cache {
}
$segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1);
-
+
$segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2);
-
+
$dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/';
-
+
$filename = md5($sql);
-
+
if ( ! @is_dir($dir_path))
{
if ( ! @mkdir($dir_path, DIR_WRITE_MODE))
{
return FALSE;
}
-
- @chmod($dir_path, DIR_WRITE_MODE);
+
+ @chmod($dir_path, DIR_WRITE_MODE);
}
-
+
if (write_file($dir_path.$filename, serialize($object)) === FALSE)
{
return FALSE;
}
-
+
@chmod($dir_path.$filename, FILE_WRITE_MODE);
return TRUE;
}
@@ -159,19 +159,19 @@ class CI_DB_Cache {
* @return bool
*/
function delete($segment_one = '', $segment_two = '')
- {
+ {
if ($segment_one == '')
{
$segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1);
}
-
+
if ($segment_two == '')
{
$segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2);
}
-
+
$dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/';
-
+
delete_files($dir_path, TRUE);
}
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index 8e6f88801..cbfa33e78 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -71,13 +71,13 @@ class CI_DB_driver {
var $limit_used;
-
+
/**
* Constructor. Accepts one parameter containing the database
* connection settings.
*
* @param array
- */
+ */
function CI_DB_driver($params)
{
if (is_array($params))
@@ -90,7 +90,7 @@ class CI_DB_driver {
log_message('debug', 'Database Driver Class Initialized');
}
-
+
// --------------------------------------------------------------------
/**
@@ -99,7 +99,7 @@ class CI_DB_driver {
* @access private Called by the constructor
* @param mixed
* @return void
- */
+ */
function initialize()
{
// If an existing connection resource is available
@@ -108,9 +108,9 @@ class CI_DB_driver {
{
return TRUE;
}
-
+
// ----------------------------------------------------------------
-
+
// Connect to the database and set the connection ID
$this->conn_id = ($this->pconnect == FALSE) ? $this->db_connect() : $this->db_pconnect();
@@ -118,7 +118,7 @@ class CI_DB_driver {
if ( ! $this->conn_id)
{
log_message('error', 'Unable to connect to the database');
-
+
if ($this->db_debug)
{
$this->display_error('db_unable_to_connect');
@@ -134,12 +134,12 @@ class CI_DB_driver {
if ( ! $this->db_select())
{
log_message('error', 'Unable to select database: '.$this->database);
-
+
if ($this->db_debug)
{
$this->display_error('db_unable_to_select', $this->database);
}
- return FALSE;
+ return FALSE;
}
else
{
@@ -148,14 +148,14 @@ class CI_DB_driver {
{
return FALSE;
}
-
+
return TRUE;
}
}
return TRUE;
}
-
+
// --------------------------------------------------------------------
/**
@@ -171,26 +171,26 @@ class CI_DB_driver {
if ( ! $this->_db_set_charset($this->char_set, $this->dbcollat))
{
log_message('error', 'Unable to set database connection charset: '.$this->char_set);
-
+
if ($this->db_debug)
{
$this->display_error('db_unable_to_set_charset', $this->char_set);
}
-
+
return FALSE;
}
-
+
return TRUE;
}
-
+
// --------------------------------------------------------------------
/**
* The name of the platform in use (mysql, mssql, etc...)
*
* @access public
- * @return string
- */
+ * @return string
+ */
function platform()
{
return $this->dbdriver;
@@ -203,8 +203,8 @@ class CI_DB_driver {
* version of the database being used
*
* @access public
- * @return string
- */
+ * @return string
+ */
function version()
{
if (FALSE === ($sql = $this->_version()))
@@ -230,7 +230,7 @@ class CI_DB_driver {
return $query->row('ver');
}
}
-
+
// --------------------------------------------------------------------
/**
@@ -245,8 +245,8 @@ class CI_DB_driver {
* @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)
{
if ($sql == '')
@@ -279,7 +279,7 @@ class CI_DB_driver {
}
}
}
-
+
// Compile binds if needed
if ($binds !== FALSE)
{
@@ -291,10 +291,10 @@ class CI_DB_driver {
{
$this->queries[] = $sql;
}
-
+
// Start the Query Timer
$time_start = list($sm, $ss) = explode(' ', microtime());
-
+
// Run the Query
if (FALSE === ($this->result_id = $this->simple_query($sql)))
{
@@ -302,7 +302,7 @@ class CI_DB_driver {
{
$this->query_times[] = 0;
}
-
+
// This will trigger a rollback if transactions are being used
$this->_trans_status = FALSE;
@@ -312,10 +312,10 @@ class CI_DB_driver {
// additional queries before displaying the error
$error_no = $this->_error_number();
$error_msg = $this->_error_message();
-
+
// We call this function in order to roll-back queries
// if transactions are enabled. If we don't call this here
- // the error message will trigger an exit, causing the
+ // the error message will trigger an exit, causing the
// transactions to remain in limbo.
$this->trans_complete();
@@ -329,10 +329,10 @@ class CI_DB_driver {
)
);
}
-
+
return FALSE;
}
-
+
// Stop and aggregate the query time results
$time_end = list($em, $es) = explode(' ', microtime());
$this->benchmark += ($em + $es) - ($sm + $ss);
@@ -341,10 +341,10 @@ class CI_DB_driver {
{
$this->query_times[] = ($em + $es) - ($sm + $ss);
}
-
+
// Increment the query counter
$this->query_count++;
-
+
// Was the query a "write" type?
// If so we'll simply return true
if ($this->is_write_type($sql) === TRUE)
@@ -355,10 +355,10 @@ class CI_DB_driver {
{
$this->CACHE->delete();
}
-
+
return TRUE;
}
-
+
// Return TRUE if we don't need to create a result object
// Currently only the Oracle driver uses this when stored
// procedures are used
@@ -366,11 +366,11 @@ class CI_DB_driver {
{
return TRUE;
}
-
- // Load and instantiate the result driver
-
- $driver = $this->load_rdriver();
- $RES = new $driver();
+
+ // Load and instantiate the result driver
+
+ $driver = $this->load_rdriver();
+ $RES = new $driver();
$RES->conn_id = $this->conn_id;
$RES->result_id = $this->result_id;
@@ -381,10 +381,10 @@ class CI_DB_driver {
$RES->limit_used = $this->limit_used;
$this->stmt_id = FALSE;
}
-
+
// oci8 vars must be set before calling this
$RES->num_rows = $RES->num_rows();
-
+
// 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())
@@ -396,17 +396,17 @@ class CI_DB_driver {
// result object, so we'll have to compile the data
// and save it)
$CR = new CI_DB_result();
- $CR->num_rows = $RES->num_rows();
+ $CR->num_rows = $RES->num_rows();
$CR->result_object = $RES->result_object();
$CR->result_array = $RES->result_array();
-
+
// Reset these since cached objects can not utilize resource IDs.
$CR->conn_id = NULL;
$CR->result_id = NULL;
$this->CACHE->write($sql, $CR);
}
-
+
return $RES;
}
@@ -416,8 +416,8 @@ 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()
{
$driver = 'CI_DB_'.$this->dbdriver.'_result';
@@ -427,10 +427,10 @@ class CI_DB_driver {
include_once(BASEPATH.'database/DB_result'.EXT);
include_once(BASEPATH.'database/drivers/'.$this->dbdriver.'/'.$this->dbdriver.'_result'.EXT);
}
-
+
return $driver;
}
-
+
// --------------------------------------------------------------------
/**
@@ -441,8 +441,8 @@ class CI_DB_driver {
*
* @access public
* @param string the sql query
- * @return mixed
- */
+ * @return mixed
+ */
function simple_query($sql)
{
if ( ! $this->conn_id)
@@ -452,7 +452,7 @@ class CI_DB_driver {
return $this->_execute($sql);
}
-
+
// --------------------------------------------------------------------
/**
@@ -460,8 +460,8 @@ class CI_DB_driver {
* This permits transactions to be disabled at run-time.
*
* @access public
- * @return void
- */
+ * @return void
+ */
function trans_off()
{
$this->trans_enabled = FALSE;
@@ -477,23 +477,23 @@ class CI_DB_driver {
* a failure of one group will not affect any others
*
* @access public
- * @return void
- */
+ * @return void
+ */
function trans_strict($mode = TRUE)
{
$this->trans_strict = is_bool($mode) ? $mode : TRUE;
}
-
+
// --------------------------------------------------------------------
/**
* Start Transaction
*
* @access public
- * @return void
- */
+ * @return void
+ */
function trans_start($test_mode = FALSE)
- {
+ {
if ( ! $this->trans_enabled)
{
return FALSE;
@@ -505,7 +505,7 @@ class CI_DB_driver {
$this->_trans_depth += 1;
return;
}
-
+
$this->trans_begin($test_mode);
}
@@ -515,27 +515,27 @@ class CI_DB_driver {
* Complete Transaction
*
* @access public
- * @return bool
- */
+ * @return bool
+ */
function trans_complete()
{
if ( ! $this->trans_enabled)
{
return FALSE;
}
-
+
// When transactions are nested we only begin/commit/rollback the outermost ones
if ($this->_trans_depth > 1)
{
$this->_trans_depth -= 1;
return TRUE;
}
-
+
// The query() function will set this flag to FALSE in the event that a query failed
if ($this->_trans_status === FALSE)
{
$this->trans_rollback();
-
+
// If we are NOT running in strict mode, we will reset
// the _trans_status flag so that subsequent groups of transactions
// will be permitted.
@@ -547,7 +547,7 @@ class CI_DB_driver {
log_message('debug', 'DB Transaction Failure');
return FALSE;
}
-
+
$this->trans_commit();
return TRUE;
}
@@ -558,8 +558,8 @@ 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()
{
return $this->_trans_status;
@@ -573,20 +573,20 @@ class CI_DB_driver {
* @access public
* @param string the sql statement
* @param array an array of bind data
- * @return string
- */
+ * @return string
+ */
function compile_binds($sql, $binds)
{
if (strpos($sql, $this->bind_marker) === FALSE)
{
return $sql;
}
-
+
if ( ! is_array($binds))
{
$binds = array($binds);
}
-
+
// Get the sql segments around the bind markers
$segments = explode($this->bind_marker, $sql);
@@ -607,7 +607,7 @@ class CI_DB_driver {
return $result;
}
-
+
// --------------------------------------------------------------------
/**
@@ -615,8 +615,8 @@ class CI_DB_driver {
*
* @access public
* @param string An SQL query string
- * @return boolean
- */
+ * @return boolean
+ */
function is_write_type($sql)
{
if ( ! preg_match('/^\s*"?(SET|INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|TRUNCATE|LOAD DATA|COPY|ALTER|GRANT|REVOKE|LOCK|UNLOCK)\s+/i', $sql))
@@ -625,7 +625,7 @@ class CI_DB_driver {
}
return TRUE;
}
-
+
// --------------------------------------------------------------------
/**
@@ -633,34 +633,34 @@ class CI_DB_driver {
*
* @access public
* @param integer The number of decimal places
- * @return integer
- */
+ * @return integer
+ */
function elapsed_time($decimals = 6)
{
return number_format($this->benchmark, $decimals);
}
-
+
// --------------------------------------------------------------------
/**
* Returns the total number of queries
*
* @access public
- * @return integer
- */
+ * @return integer
+ */
function total_queries()
{
return $this->query_count;
}
-
+
// --------------------------------------------------------------------
/**
* Returns the last query that was executed
*
* @access public
- * @return void
- */
+ * @return void
+ */
function last_query()
{
return end($this->queries);
@@ -676,10 +676,10 @@ class CI_DB_driver {
*
* @access public
* @param string
- * @return mixed
- */
+ * @return mixed
+ */
function escape($str)
- {
+ {
if (is_string($str))
{
$str = "'".$this->escape_str($str)."'";
@@ -703,14 +703,14 @@ class CI_DB_driver {
*
* Calls the individual driver for platform
* specific escaping for LIKE conditions
- *
+ *
* @access public
* @param string
* @return mixed
*/
- function escape_like_str($str)
- {
- return $this->escape_str($str, TRUE);
+ function escape_like_str($str)
+ {
+ return $this->escape_str($str, TRUE);
}
// --------------------------------------------------------------------
@@ -723,12 +723,12 @@ class CI_DB_driver {
*
* @access public
* @param string the table name
- * @return string
- */
+ * @return string
+ */
function primary($table = '')
- {
+ {
$fields = $this->list_fields($table);
-
+
if ( ! is_array($fields))
{
return FALSE;
@@ -743,8 +743,8 @@ class CI_DB_driver {
* Returns an array of table names
*
* @access public
- * @return array
- */
+ * @return array
+ */
function list_tables($constrain_by_prefix = FALSE)
{
// Is there a cached result?
@@ -752,7 +752,7 @@ class CI_DB_driver {
{
return $this->data_cache['table_names'];
}
-
+
if (FALSE === ($sql = $this->_list_tables($constrain_by_prefix)))
{
if ($this->db_debug)
@@ -764,7 +764,7 @@ class CI_DB_driver {
$retval = array();
$query = $this->query($sql);
-
+
if ($query->num_rows() > 0)
{
foreach($query->result_array() as $row)
@@ -783,7 +783,7 @@ class CI_DB_driver {
$this->data_cache['table_names'] = $retval;
return $this->data_cache['table_names'];
}
-
+
// --------------------------------------------------------------------
/**
@@ -792,10 +792,10 @@ class CI_DB_driver {
* @return boolean
*/
function table_exists($table_name)
- {
+ {
return ( ! in_array($this->_protect_identifiers($table_name, TRUE, FALSE, FALSE), $this->list_tables())) ? FALSE : TRUE;
}
-
+
// --------------------------------------------------------------------
/**
@@ -803,7 +803,7 @@ class CI_DB_driver {
*
* @access public
* @param string the table name
- * @return array
+ * @return array
*/
function list_fields($table = '')
{
@@ -812,7 +812,7 @@ class CI_DB_driver {
{
return $this->data_cache['field_names'][$table];
}
-
+
if ($table == '')
{
if ($this->db_debug)
@@ -821,7 +821,7 @@ class CI_DB_driver {
}
return FALSE;
}
-
+
if (FALSE === ($sql = $this->_list_columns($table)))
{
if ($this->db_debug)
@@ -830,9 +830,9 @@ class CI_DB_driver {
}
return FALSE;
}
-
+
$query = $this->query($sql);
-
+
$retval = array();
foreach($query->result_array() as $row)
{
@@ -843,9 +843,9 @@ class CI_DB_driver {
else
{
$retval[] = current($row);
- }
+ }
}
-
+
$this->data_cache['field_names'][$table] = $retval;
return $this->data_cache['field_names'][$table];
}
@@ -860,10 +860,10 @@ class CI_DB_driver {
* @return boolean
*/
function field_exists($field_name, $table_name)
- {
+ {
return ( ! in_array($field_name, $this->list_fields($table_name))) ? FALSE : TRUE;
}
-
+
// --------------------------------------------------------------------
/**
@@ -871,8 +871,8 @@ class CI_DB_driver {
*
* @access public
* @param string the table name
- * @return object
- */
+ * @return object
+ */
function field_data($table = '')
{
if ($table == '')
@@ -883,36 +883,36 @@ class CI_DB_driver {
}
return FALSE;
}
-
+
$query = $this->query($this->_field_data($this->_protect_identifiers($table, TRUE, NULL, FALSE)));
return $query->field_data();
- }
+ }
// --------------------------------------------------------------------
-
+
/**
* 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();
$values = array();
-
+
foreach($data as $key => $val)
{
$fields[] = $this->_escape_identifiers($key);
$values[] = $this->escape($val);
}
-
+
return $this->_insert($this->_protect_identifiers($table, TRUE, NULL, FALSE), $fields, $values);
- }
-
+ }
+
// --------------------------------------------------------------------
/**
@@ -922,15 +922,15 @@ class CI_DB_driver {
* @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)
{
if ($where == '')
{
return false;
}
-
+
$fields = array();
foreach($data as $key => $val)
{
@@ -947,23 +947,23 @@ class CI_DB_driver {
foreach ($where as $key => $val)
{
$prefix = (count($dest) == 0) ? '' : ' AND ';
-
+
if ($val !== '')
{
if ( ! $this->_has_operator($key))
{
$key .= ' =';
}
-
+
$val = ' '.$this->escape($val);
}
-
+
$dest[] = $prefix.$key.$val;
}
- }
+ }
return $this->_update($this->_protect_identifiers($table, TRUE, NULL, FALSE), $fields, $dest);
- }
+ }
// --------------------------------------------------------------------
@@ -993,17 +993,17 @@ class CI_DB_driver {
* @access public
* @param string the function name
* @param mixed any parameters needed by the function
- * @return mixed
- */
+ * @return mixed
+ */
function call_function($function)
{
$driver = ($this->dbdriver == 'postgre') ? 'pg_' : $this->dbdriver.'_';
-
+
if (FALSE === strpos($driver, $function))
{
$function = $driver.$function;
}
-
+
if ( ! function_exists($function))
{
if ($this->db_debug)
@@ -1028,7 +1028,7 @@ class CI_DB_driver {
* @access public
* @param string the path to the cache directory
* @return void
- */
+ */
function cache_set_path($path = '')
{
$this->cachedir = $path;
@@ -1041,7 +1041,7 @@ class CI_DB_driver {
*
* @access public
* @return void
- */
+ */
function cache_on()
{
$this->cache_on = TRUE;
@@ -1055,13 +1055,13 @@ class CI_DB_driver {
*
* @access public
* @return void
- */
+ */
function cache_off()
{
$this->cache_on = FALSE;
return FALSE;
}
-
+
// --------------------------------------------------------------------
@@ -1070,7 +1070,7 @@ class CI_DB_driver {
*
* @access public
* @return void
- */
+ */
function cache_delete($segment_one = '', $segment_two = '')
{
if ( ! $this->_cache_init())
@@ -1087,7 +1087,7 @@ class CI_DB_driver {
*
* @access public
* @return void
- */
+ */
function cache_delete_all()
{
if ( ! $this->_cache_init())
@@ -1105,7 +1105,7 @@ class CI_DB_driver {
*
* @access private
* @return void
- */
+ */
function _cache_init()
{
if (is_object($this->CACHE) AND class_exists('CI_DB_Cache'))
@@ -1131,8 +1131,8 @@ class CI_DB_driver {
* Close DB Connection
*
* @access public
- * @return void
- */
+ * @return void
+ */
function close()
{
if (is_resource($this->conn_id) OR is_object($this->conn_id))
@@ -1141,7 +1141,7 @@ class CI_DB_driver {
}
$this->conn_id = FALSE;
}
-
+
// --------------------------------------------------------------------
/**
@@ -1151,8 +1151,8 @@ class CI_DB_driver {
* @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)
{
$LANG =& load_class('Lang', 'core');
@@ -1168,11 +1168,11 @@ class CI_DB_driver {
{
$message = ( ! is_array($error)) ? array(str_replace('%s', $swap, $LANG->line($error))) : $error;
}
-
+
// Find the most likely culprit of the error by going through
// the backtrace until the source file is no longer in the
// database folder.
-
+
$trace = debug_backtrace();
foreach($trace as $call)
@@ -1182,11 +1182,11 @@ class CI_DB_driver {
// Found it - use a relative path for safety
$message[] = 'Filename: '.str_replace(array(BASEPATH, APPPATH), '', $call['file']);
$message[] = 'Line Number: '.$call['line'];
-
+
break;
}
}
-
+
$error =& load_class('Exceptions', 'core');
echo $error->show_error($heading, $message, 'error_db');
exit;
@@ -1214,7 +1214,7 @@ class CI_DB_driver {
* Protect Identifiers
*
* This function is used extensively by the Active Record class, and by
- * a couple functions in this class.
+ * a couple functions in this class.
* It takes a column or table name (optionally with an alias) and inserts
* the table prefix onto it. Some logic is necessary in order to deal with
* column names that include the path. Consider a query like this:
@@ -1236,7 +1236,7 @@ class CI_DB_driver {
* @param mixed
* @param bool
* @return string
- */
+ */
function _protect_identifiers($item, $prefix_single = FALSE, $protect_identifiers = NULL, $field_exists = TRUE)
{
if ( ! is_bool($protect_identifiers))
@@ -1258,7 +1258,7 @@ class CI_DB_driver {
// Convert tabs or multiple spaces into single spaces
$item = preg_replace('/[\t ]+/', ' ', $item);
-
+
// If the item has an alias declaration we remove it and set it aside.
// Basically we remove everything to the right of the first space
$alias = '';
@@ -1269,7 +1269,7 @@ class CI_DB_driver {
}
// This is basically a bug fix for queries that use MAX, MIN, etc.
- // If a parenthesis is found we know that we do not need to
+ // If a parenthesis is found we know that we do not need to
// escape the data or add a prefix. There's probably a more graceful
// way to deal with this, but I'm not thinking of it -- Rick
if (strpos($item, '(') !== FALSE)
@@ -1283,7 +1283,7 @@ class CI_DB_driver {
if (strpos($item, '.') !== FALSE)
{
$parts = explode('.', $item);
-
+
// Does the first segment of the exploded item match
// one of the aliases previously identified? If so,
// we have nothing more to do other than escape the item
@@ -1298,12 +1298,12 @@ class CI_DB_driver {
$parts[$key] = $this->_escape_identifiers($val);
}
}
-
+
$item = implode('.', $parts);
- }
+ }
return $item.$alias;
}
-
+
// Is there a table prefix defined in the config file? If not, no need to do anything
if ($this->dbprefix != '')
{
@@ -1326,35 +1326,35 @@ class CI_DB_driver {
{
$i = 0;
}
-
+
// This flag is set when the supplied $item does not contain a field name.
// This can happen when this function is being called from a JOIN.
if ($field_exists == FALSE)
{
$i++;
}
-
+
// Verify table prefix and replace if necessary
if ($this->swap_pre != '' && strncmp($parts[$i], $this->swap_pre, strlen($this->swap_pre)) === 0)
{
$parts[$i] = preg_replace("/^".$this->swap_pre."(\S+?)/", $this->dbprefix."\\1", $parts[$i]);
}
-
+
// We only add the table prefix if it does not already exist
if (substr($parts[$i], 0, strlen($this->dbprefix)) != $this->dbprefix)
{
$parts[$i] = $this->dbprefix.$parts[$i];
}
-
+
// Put the parts back together
$item = implode('.', $parts);
}
-
+
if ($protect_identifiers === TRUE)
{
$item = $this->_escape_identifiers($item);
}
-
+
return $item.$alias;
}
@@ -1371,14 +1371,14 @@ class CI_DB_driver {
if ($prefix_single == TRUE AND substr($item, 0, strlen($this->dbprefix)) != $this->dbprefix)
{
$item = $this->dbprefix.$item;
- }
+ }
}
if ($protect_identifiers === TRUE AND ! in_array($item, $this->_reserved_identifiers))
{
$item = $this->_escape_identifiers($item);
}
-
+
return $item.$alias;
}
diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php
index 8be65e0d6..74aed8610 100644
--- a/system/database/DB_forge.php
+++ b/system/database/DB_forge.php
@@ -24,9 +24,9 @@
*/
class CI_DB_forge {
- var $fields = array();
+ var $fields = array();
var $keys = array();
- var $primary_keys = array();
+ var $primary_keys = array();
var $db_char_set = '';
/**
@@ -34,7 +34,7 @@ class CI_DB_forge {
*
* Grabs the CI super object instance so we can access it.
*
- */
+ */
function CI_DB_forge()
{
// Assign the main database object to $this->db
@@ -55,12 +55,12 @@ class CI_DB_forge {
function create_database($db_name)
{
$sql = $this->_create_database($db_name);
-
+
if (is_bool($sql))
{
return $sql;
}
-
+
return $this->db->query($sql);
}
@@ -76,12 +76,12 @@ class CI_DB_forge {
function drop_database($db_name)
{
$sql = $this->_drop_database($db_name);
-
+
if (is_bool($sql))
{
return $sql;
}
-
+
return $this->db->query($sql);
}
@@ -103,15 +103,15 @@ class CI_DB_forge {
{
$this->add_key($one, $primary);
}
-
+
return;
}
-
+
if ($key == '')
{
show_error('Key information is required for that operation.');
}
-
+
if ($primary === TRUE)
{
$this->primary_keys[] = $key;
@@ -137,7 +137,7 @@ class CI_DB_forge {
{
show_error('Field information is required.');
}
-
+
if (is_string($field))
{
if ($field == 'id')
@@ -157,16 +157,16 @@ class CI_DB_forge {
{
show_error('Field information is required for that operation.');
}
-
+
$this->fields[] = $field;
}
}
-
+
if (is_array($field))
{
$this->fields = array_merge($this->fields, $field);
}
-
+
}
// --------------------------------------------------------------------
@@ -179,19 +179,19 @@ class CI_DB_forge {
* @return bool
*/
function create_table($table = '', $if_not_exists = FALSE)
- {
+ {
if ($table == '')
{
show_error('A table name is required for that operation.');
}
-
+
if (count($this->fields) == 0)
- {
+ {
show_error('Field information is required.');
}
$sql = $this->_create_table($this->db->dbprefix.$table, $this->fields, $this->primary_keys, $this->keys, $if_not_exists);
-
+
$this->_reset();
return $this->db->query($sql);
}
@@ -208,12 +208,12 @@ class CI_DB_forge {
function drop_table($table_name)
{
$sql = $this->_drop_table($this->db->dbprefix.$table_name);
-
+
if (is_bool($sql))
{
return $sql;
}
-
+
return $this->db->query($sql);
}
@@ -233,7 +233,7 @@ class CI_DB_forge {
{
show_error('A table name is required for that operation.');
}
-
+
$sql = $this->_rename_table($table_name, $new_table_name);
return $this->db->query($sql);
}
@@ -259,25 +259,25 @@ class CI_DB_forge {
// add field info into field array, but we can only do one at a time
// so we cycle through
- foreach ($field as $k => $v)
- {
- $this->add_field(array($k => $field[$k]));
+ foreach ($field as $k => $v)
+ {
+ $this->add_field(array($k => $field[$k]));
if (count($this->fields) == 0)
- {
+ {
show_error('Field information is required.');
}
-
+
$sql = $this->_alter_table('ADD', $this->db->dbprefix.$table, $this->fields, $after_field);
$this->_reset();
-
+
if ($this->db->query($sql) === FALSE)
{
return FALSE;
}
}
-
+
return TRUE;
}
@@ -294,7 +294,7 @@ class CI_DB_forge {
*/
function drop_column($table = '', $column_name = '')
{
-
+
if ($table == '')
{
show_error('A table name is required for that operation.');
@@ -306,7 +306,7 @@ class CI_DB_forge {
}
$sql = $this->_alter_table('DROP', $this->db->dbprefix.$table, $column_name);
-
+
return $this->db->query($sql);
}
@@ -336,20 +336,20 @@ class CI_DB_forge {
$this->add_field(array($k => $field[$k]));
if (count($this->fields) == 0)
- {
+ {
show_error('Field information is required.');
}
-
+
$sql = $this->_alter_table('CHANGE', $this->db->dbprefix.$table, $this->fields);
$this->_reset();
-
+
if ($this->db->query($sql) === FALSE)
{
return FALSE;
}
}
-
+
return TRUE;
}
@@ -365,9 +365,9 @@ class CI_DB_forge {
*/
function _reset()
{
- $this->fields = array();
+ $this->fields = array();
$this->keys = array();
- $this->primary_keys = array();
+ $this->primary_keys = array();
}
}
diff --git a/system/database/DB_result.php b/system/database/DB_result.php
index b9e64feeb..406afb1b8 100644
--- a/system/database/DB_result.php
+++ b/system/database/DB_result.php
@@ -32,7 +32,7 @@ class CI_DB_result {
var $result_id = NULL;
var $result_array = array();
var $result_object = array();
- var $current_row = 0;
+ var $current_row = 0;
var $num_rows = 0;
var $row_data = NULL;
@@ -42,10 +42,10 @@ class CI_DB_result {
*
* @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')
- {
+ {
return ($type == 'object') ? $this->result_object() : $this->result_array();
}
@@ -56,16 +56,16 @@ class CI_DB_result {
*
* @access public
* @return object
- */
+ */
function result_object()
{
if (count($this->result_object) > 0)
{
return $this->result_object;
}
-
- // In the event that query caching is on the result_id variable
- // will return FALSE since there isn't a valid SQL resource so
+
+ // In the event that query caching is on the result_id variable
+ // will return FALSE since there isn't a valid SQL resource so
// we'll simply return an empty array.
if ($this->result_id === FALSE OR $this->num_rows() == 0)
{
@@ -77,10 +77,10 @@ class CI_DB_result {
{
$this->result_object[] = $row;
}
-
+
return $this->result_object;
}
-
+
// --------------------------------------------------------------------
/**
@@ -88,7 +88,7 @@ class CI_DB_result {
*
* @access public
* @return array
- */
+ */
function result_array()
{
if (count($this->result_array) > 0)
@@ -96,8 +96,8 @@ class CI_DB_result {
return $this->result_array;
}
- // In the event that query caching is on the result_id variable
- // will return FALSE since there isn't a valid SQL resource so
+ // In the event that query caching is on the result_id variable
+ // will return FALSE since there isn't a valid SQL resource so
// we'll simply return an empty array.
if ($this->result_id === FALSE OR $this->num_rows() == 0)
{
@@ -109,7 +109,7 @@ class CI_DB_result {
{
$this->result_array[] = $row;
}
-
+
return $this->result_array;
}
@@ -121,8 +121,8 @@ class CI_DB_result {
* @access public
* @param string
* @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')
{
if ( ! is_numeric($n))
@@ -132,16 +132,16 @@ class CI_DB_result {
{
$this->row_data = $this->row_array(0);
}
-
+
// array_key_exists() instead of isset() to allow for MySQL NULL values
if (array_key_exists($n, $this->row_data))
{
return $this->row_data[$n];
}
- // reset the $n variable if the result was not achieved
+ // reset the $n variable if the result was not achieved
$n = 0;
}
-
+
return ($type == 'object') ? $this->row_object($n) : $this->row_array($n);
}
@@ -152,7 +152,7 @@ class CI_DB_result {
*
* @access public
* @return object
- */
+ */
function set_row($key, $value = NULL)
{
// We cache the row data for subsequent uses
@@ -160,17 +160,17 @@ class CI_DB_result {
{
$this->row_data = $this->row_array(0);
}
-
+
if (is_array($key))
{
foreach ($key as $k => $v)
{
$this->row_data[$k] = $v;
}
-
+
return;
}
-
+
if ($key != '' AND ! is_null($value))
{
$this->row_data[$key] = $value;
@@ -184,11 +184,11 @@ class CI_DB_result {
*
* @access public
* @return object
- */
+ */
function row_object($n = 0)
{
$result = $this->result_object();
-
+
if (count($result) == 0)
{
return $result;
@@ -209,7 +209,7 @@ class CI_DB_result {
*
* @access public
* @return array
- */
+ */
function row_array($n = 0)
{
$result = $this->result_array();
@@ -218,16 +218,16 @@ class CI_DB_result {
{
return $result;
}
-
+
if ($n != $this->current_row AND isset($result[$n]))
{
$this->current_row = $n;
}
-
+
return $result[$this->current_row];
}
-
+
// --------------------------------------------------------------------
/**
@@ -235,7 +235,7 @@ class CI_DB_result {
*
* @access public
* @return object
- */
+ */
function first_row($type = 'object')
{
$result = $this->result($type);
@@ -246,7 +246,7 @@ class CI_DB_result {
}
return $result[0];
}
-
+
// --------------------------------------------------------------------
/**
@@ -254,7 +254,7 @@ class CI_DB_result {
*
* @access public
* @return object
- */
+ */
function last_row($type = 'object')
{
$result = $this->result($type);
@@ -264,7 +264,7 @@ class CI_DB_result {
return $result;
}
return $result[count($result) -1];
- }
+ }
// --------------------------------------------------------------------
@@ -273,7 +273,7 @@ class CI_DB_result {
*
* @access public
* @return object
- */
+ */
function next_row($type = 'object')
{
$result = $this->result($type);
@@ -287,10 +287,10 @@ class CI_DB_result {
{
++$this->current_row;
}
-
+
return $result[$this->current_row];
}
-
+
// --------------------------------------------------------------------
/**
@@ -298,7 +298,7 @@ class CI_DB_result {
*
* @access public
* @return object
- */
+ */
function previous_row($type = 'object')
{
$result = $this->result($type);
@@ -329,12 +329,12 @@ class CI_DB_result {
function num_rows() { return $this->num_rows; }
function num_fields() { return 0; }
function list_fields() { return array(); }
- function field_data() { return array(); }
+ function field_data() { return array(); }
function free_result() { return TRUE; }
function _data_seek() { return TRUE; }
- function _fetch_assoc() { return array(); }
+ function _fetch_assoc() { return array(); }
function _fetch_object() { return array(); }
-
+
}
// END DB_result class
diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php
index 124967a5a..2811d8802 100644
--- a/system/database/DB_utility.php
+++ b/system/database/DB_utility.php
@@ -25,20 +25,20 @@
class CI_DB_utility extends CI_DB_forge {
var $db;
- var $data_cache = array();
+ var $data_cache = array();
/**
* Constructor
*
* Grabs the CI super object instance so we can access it.
*
- */
+ */
function CI_DB_utility()
{
// Assign the main database object to $this->db
$CI =& get_instance();
$this->db =& $CI->db;
-
+
log_message('debug', "Database Utility Class Initialized");
}
@@ -51,13 +51,13 @@ class CI_DB_utility extends CI_DB_forge {
* @return bool
*/
function list_databases()
- {
+ {
// Is there a cached result?
if (isset($this->data_cache['db_names']))
{
return $this->data_cache['db_names'];
}
-
+
$query = $this->db->query($this->_list_databases());
$dbs = array();
if ($query->num_rows() > 0)
@@ -67,7 +67,7 @@ class CI_DB_utility extends CI_DB_forge {
$dbs[] = current($row);
}
}
-
+
$this->data_cache['db_names'] = $dbs;
return $this->data_cache['db_names'];
}
@@ -109,15 +109,15 @@ class CI_DB_utility extends CI_DB_forge {
function optimize_table($table_name)
{
$sql = $this->_optimize_table($table_name);
-
+
if (is_bool($sql))
{
show_error('db_must_use_set');
}
-
+
$query = $this->db->query($sql);
$res = $query->result_array();
-
+
// Note: Due to a bug in current() that affects some versions
// of PHP we can not pass function call directly into it
return current($res);
@@ -137,14 +137,14 @@ class CI_DB_utility extends CI_DB_forge {
foreach ($this->db->list_tables() as $table_name)
{
$sql = $this->_optimize_table($table_name);
-
+
if (is_bool($sql))
{
return $sql;
}
-
+
$query = $this->db->query($sql);
-
+
// Build the result array...
// Note: Due to a bug in current() that affects some versions
// of PHP we can not pass function call directly into it
@@ -153,7 +153,7 @@ class CI_DB_utility extends CI_DB_forge {
$key = str_replace($this->db->database.'.', '', current($res));
$keys = array_keys($res);
unset($res[$keys[0]]);
-
+
$result[$key] = $res;
}
@@ -172,20 +172,20 @@ class CI_DB_utility extends CI_DB_forge {
function repair_table($table_name)
{
$sql = $this->_repair_table($table_name);
-
+
if (is_bool($sql))
{
return $sql;
}
-
+
$query = $this->db->query($sql);
-
+
// Note: Due to a bug in current() that affects some versions
// of PHP we can not pass function call directly into it
$res = $query->result_array();
return current($res);
}
-
+
// --------------------------------------------------------------------
/**
@@ -203,25 +203,25 @@ class CI_DB_utility extends CI_DB_forge {
if ( ! is_object($query) OR ! method_exists($query, 'list_fields'))
{
show_error('You must submit a valid result object');
- }
-
+ }
+
$out = '';
-
+
// First generate the headings from the table column names
foreach ($query->list_fields() as $name)
{
$out .= $enclosure.str_replace($enclosure, $enclosure.$enclosure, $name).$enclosure.$delim;
}
-
+
$out = rtrim($out);
$out .= $newline;
-
+
// Next blast through the result array and build out the rows
foreach ($query->result_array() as $row)
{
foreach ($row as $item)
{
- $out .= $enclosure.str_replace($enclosure, $enclosure.$enclosure, $item).$enclosure.$delim;
+ $out .= $enclosure.str_replace($enclosure, $enclosure.$enclosure, $item).$enclosure.$delim;
}
$out = rtrim($out);
$out .= $newline;
@@ -229,7 +229,7 @@ class CI_DB_utility extends CI_DB_forge {
return $out;
}
-
+
// --------------------------------------------------------------------
/**
@@ -246,7 +246,7 @@ class CI_DB_utility extends CI_DB_forge {
{
show_error('You must submit a valid result object');
}
-
+
// Set our default values
foreach (array('root' => 'root', 'element' => 'element', 'newline' => "\n", 'tab' => "\t") as $key => $val)
{
@@ -255,10 +255,10 @@ class CI_DB_utility extends CI_DB_forge {
$params[$key] = $val;
}
}
-
+
// Create variables for convenience
extract($params);
-
+
// Load the xml helper
$CI =& get_instance();
$CI->load->helper('xml');
@@ -268,7 +268,7 @@ class CI_DB_utility extends CI_DB_forge {
foreach ($query->result_array() as $row)
{
$xml .= $tab."<{$element}>".$newline;
-
+
foreach ($row as $key => $val)
{
$xml .= $tab.$tab."<{$key}>".xml_convert($val)."</{$key}>".$newline;
@@ -276,7 +276,7 @@ class CI_DB_utility extends CI_DB_forge {
$xml .= $tab."</{$element}>".$newline;
}
$xml .= "</$root>".$newline;
-
+
return $xml;
}
@@ -297,9 +297,9 @@ class CI_DB_utility extends CI_DB_forge {
{
$params = array('tables' => $params);
}
-
+
// ------------------------------------------------------
-
+
// Set up our default preferences
$prefs = array(
'tables' => array(),
@@ -325,13 +325,13 @@ class CI_DB_utility extends CI_DB_forge {
// ------------------------------------------------------
- // Are we backing up a complete database or individual tables?
+ // Are we backing up a complete database or individual tables?
// If no table names were submitted we'll fetch the entire table list
if (count($prefs['tables']) == 0)
{
$prefs['tables'] = $this->db->list_tables();
}
-
+
// ------------------------------------------------------
// Validate the format
@@ -345,13 +345,13 @@ class CI_DB_utility extends CI_DB_forge {
// 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')))
+ OR ($prefs['format'] == 'zip' AND ! @function_exists('gzcompress')))
{
if ($this->db->db_debug)
{
return $this->db->display_error('db_unsuported_compression');
}
-
+
$prefs['format'] = 'txt';
}
@@ -365,7 +365,7 @@ class CI_DB_utility extends CI_DB_forge {
}
// ------------------------------------------------------
-
+
// Was a Gzip file requested?
if ($prefs['format'] == 'gzip')
{
@@ -373,7 +373,7 @@ class CI_DB_utility extends CI_DB_forge {
}
// ------------------------------------------------------
-
+
// Was a text file requested?
if ($prefs['format'] == 'txt')
{
@@ -382,7 +382,7 @@ class CI_DB_utility extends CI_DB_forge {
// ------------------------------------------------------
- // Was a Zip file requested?
+ // Was a Zip file requested?
if ($prefs['format'] == 'zip')
{
// If they included the .zip file extension we'll remove it
@@ -390,7 +390,7 @@ class CI_DB_utility extends CI_DB_forge {
{
$prefs['filename'] = str_replace('.zip', '', $prefs['filename']);
}
-
+
// Tack on the ".sql" file extension if needed
if ( ! preg_match("|.+?\.sql$|", $prefs['filename']))
{
@@ -398,13 +398,13 @@ class CI_DB_utility extends CI_DB_forge {
}
// Load the Zip class and output it
-
+
$CI =& get_instance();
$CI->load->library('zip');
- $CI->zip->add_data($prefs['filename'], $this->_backup($prefs));
+ $CI->zip->add_data($prefs['filename'], $this->_backup($prefs));
return $CI->zip->get_zip();
}
-
+
}
}
diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php
index 40900e832..63f9e9cc3 100644
--- a/system/database/drivers/mssql/mssql_driver.php
+++ b/system/database/drivers/mssql/mssql_driver.php
@@ -31,14 +31,14 @@
class CI_DB_mssql_driver extends CI_DB {
var $dbdriver = 'mssql';
-
+
// The character used for escaping
var $_escape_char = '';
// clause and character used for LIKE escape sequences
var $_like_escape_str = " ESCAPE '%s' ";
var $_like_escape_chr = '!';
-
+
/**
* The syntax to count rows is slightly different across different
* database engines, so this string appears in each driver and is
@@ -52,7 +52,7 @@ class CI_DB_mssql_driver extends CI_DB {
*
* @access private called by the base class
* @return resource
- */
+ */
function db_connect()
{
if ($this->port != '')
@@ -62,7 +62,7 @@ class CI_DB_mssql_driver extends CI_DB {
return @mssql_connect($this->hostname, $this->username, $this->password);
}
-
+
// --------------------------------------------------------------------
/**
@@ -70,7 +70,7 @@ class CI_DB_mssql_driver extends CI_DB {
*
* @access private called by the base class
* @return resource
- */
+ */
function db_pconnect()
{
if ($this->port != '')
@@ -80,9 +80,9 @@ class CI_DB_mssql_driver extends CI_DB {
return @mssql_pconnect($this->hostname, $this->username, $this->password);
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Reconnect
*
@@ -98,13 +98,13 @@ class CI_DB_mssql_driver extends CI_DB {
}
// --------------------------------------------------------------------
-
+
/**
* Select the database
*
* @access private called by the base class
* @return resource
- */
+ */
function db_select()
{
// Note: The brackets are required in the event that the DB name
@@ -113,7 +113,7 @@ class CI_DB_mssql_driver extends CI_DB {
}
// --------------------------------------------------------------------
-
+
/**
* Set client character set
*
@@ -129,20 +129,20 @@ class CI_DB_mssql_driver extends CI_DB {
}
// --------------------------------------------------------------------
-
+
/**
* Execute the query
*
* @access private called by the base class
* @param string an SQL query
* @return resource
- */
+ */
function _execute($sql)
{
$sql = $this->_prep_query($sql);
return @mssql_query($sql, $this->conn_id);
}
-
+
// --------------------------------------------------------------------
/**
@@ -153,7 +153,7 @@ class CI_DB_mssql_driver extends CI_DB {
* @access private called by execute()
* @param string an SQL query
* @return string
- */
+ */
function _prep_query($sql)
{
return $sql;
@@ -165,15 +165,15 @@ class CI_DB_mssql_driver extends CI_DB {
* Begin Transaction
*
* @access public
- * @return bool
- */
+ * @return bool
+ */
function trans_begin($test_mode = FALSE)
{
if ( ! $this->trans_enabled)
{
return TRUE;
}
-
+
// When transactions are nested we only begin/commit/rollback the outermost ones
if ($this->_trans_depth > 0)
{
@@ -195,8 +195,8 @@ class CI_DB_mssql_driver extends CI_DB {
* Commit Transaction
*
* @access public
- * @return bool
- */
+ * @return bool
+ */
function trans_commit()
{
if ( ! $this->trans_enabled)
@@ -220,8 +220,8 @@ class CI_DB_mssql_driver extends CI_DB {
* Rollback Transaction
*
* @access public
- * @return bool
- */
+ * @return bool
+ */
function trans_rollback()
{
if ( ! $this->trans_enabled)
@@ -238,7 +238,7 @@ class CI_DB_mssql_driver extends CI_DB {
$this->simple_query('ROLLBACK TRAN');
return TRUE;
}
-
+
// --------------------------------------------------------------------
/**
@@ -254,16 +254,16 @@ class CI_DB_mssql_driver extends CI_DB {
if (is_array($str))
{
foreach($str as $key => $val)
- {
+ {
$str[$key] = $this->escape_str($val, $like);
- }
-
- return $str;
- }
-
+ }
+
+ return $str;
+ }
+
// Escape single quotes
$str = str_replace("'", "''", remove_invisible_characters($str));
-
+
// escape LIKE condition wildcards
if ($like === TRUE)
{
@@ -271,10 +271,10 @@ class CI_DB_mssql_driver extends CI_DB {
array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr),
$str);
}
-
+
return $str;
}
-
+
// --------------------------------------------------------------------
/**
@@ -287,7 +287,7 @@ class CI_DB_mssql_driver extends CI_DB {
{
return @mssql_rows_affected($this->conn_id);
}
-
+
// --------------------------------------------------------------------
/**
@@ -312,7 +312,7 @@ class CI_DB_mssql_driver extends CI_DB {
/**
* Parse major version
*
- * Grabs the major version number from the
+ * Grabs the major version number from the
* database server version string passed in.
*
* @access private
@@ -382,14 +382,14 @@ class CI_DB_mssql_driver extends CI_DB {
function _list_tables($prefix_limit = FALSE)
{
$sql = "SELECT name FROM sysobjects WHERE type = 'U' ORDER BY name";
-
+
// for future compatibility
if ($prefix_limit !== FALSE AND $this->dbprefix != '')
{
//$sql .= " LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr);
return FALSE; // not currently supported
}
-
+
return $sql;
}
@@ -406,7 +406,7 @@ class CI_DB_mssql_driver extends CI_DB {
*/
function _list_columns($table = '')
{
- return "SELECT * FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = '".$table."'";
+ return "SELECT * FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = '".$table."'";
}
// --------------------------------------------------------------------
@@ -422,7 +422,7 @@ class CI_DB_mssql_driver extends CI_DB {
*/
function _field_data($table)
{
- return "SELECT TOP 1 * FROM ".$table;
+ return "SELECT TOP 1 * FROM ".$table;
}
// --------------------------------------------------------------------
@@ -437,7 +437,7 @@ class CI_DB_mssql_driver extends CI_DB {
{
return mssql_get_last_message();
}
-
+
// --------------------------------------------------------------------
/**
@@ -474,26 +474,26 @@ class CI_DB_mssql_driver extends CI_DB {
{
if (strpos($item, '.'.$id) !== FALSE)
{
- $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item);
-
+ $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item);
+
// remove duplicates if the user already included the escape
return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
- }
+ }
}
if (strpos($item, '.') !== FALSE)
{
- $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
+ $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
}
else
{
$str = $this->_escape_char.$item.$this->_escape_char;
}
-
+
// remove duplicates if the user already included the escape
return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
}
-
+
// --------------------------------------------------------------------
/**
@@ -512,12 +512,12 @@ class CI_DB_mssql_driver extends CI_DB {
{
$tables = array($tables);
}
-
+
return implode(', ', $tables);
}
// --------------------------------------------------------------------
-
+
/**
* Insert statement
*
@@ -530,10 +530,10 @@ class CI_DB_mssql_driver extends CI_DB {
* @return string
*/
function _insert($table, $keys, $values)
- {
+ {
return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")";
}
-
+
// --------------------------------------------------------------------
/**
@@ -555,21 +555,21 @@ class CI_DB_mssql_driver extends CI_DB {
{
$valstr[] = $key." = ".$val;
}
-
+
$limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
-
+
$orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):'';
-
+
$sql = "UPDATE ".$table." SET ".implode(', ', $valstr);
$sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : '';
$sql .= $orderby.$limit;
-
+
return $sql;
}
-
+
// --------------------------------------------------------------------
/**
@@ -582,12 +582,12 @@ class CI_DB_mssql_driver extends CI_DB {
* @access public
* @param string the table name
* @return string
- */
+ */
function _truncate($table)
{
return "TRUNCATE ".$table;
}
-
+
// --------------------------------------------------------------------
/**
@@ -600,7 +600,7 @@ class CI_DB_mssql_driver extends CI_DB {
* @param array the where clause
* @param string the limit clause
* @return string
- */
+ */
function _delete($table, $where = array(), $like = array(), $limit = FALSE)
{
$conditions = '';
@@ -618,7 +618,7 @@ class CI_DB_mssql_driver extends CI_DB {
}
$limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
-
+
return "DELETE FROM ".$table.$conditions.$limit;
}
@@ -638,8 +638,8 @@ class CI_DB_mssql_driver extends CI_DB {
function _limit($sql, $limit, $offset)
{
$i = $limit + $offset;
-
- return preg_replace('/(^\SELECT (DISTINCT)?)/i','\\1 TOP '.$i.' ', $sql);
+
+ return preg_replace('/(^\SELECT (DISTINCT)?)/i','\\1 TOP '.$i.' ', $sql);
}
// --------------------------------------------------------------------
@@ -654,7 +654,7 @@ class CI_DB_mssql_driver extends CI_DB {
function _close($conn_id)
{
@mssql_close($conn_id);
- }
+ }
}
diff --git a/system/database/drivers/mssql/mssql_forge.php b/system/database/drivers/mssql/mssql_forge.php
index f6a17811f..5aa4406b1 100644
--- a/system/database/drivers/mssql/mssql_forge.php
+++ b/system/database/drivers/mssql/mssql_forge.php
@@ -79,12 +79,12 @@ class CI_DB_mssql_forge extends CI_DB_forge {
function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists)
{
$sql = 'CREATE TABLE ';
-
+
if ($if_not_exists === TRUE)
{
$sql .= 'IF NOT EXISTS ';
}
-
+
$sql .= $this->db->_escape_identifiers($table)." (";
$current_field_count = 0;
@@ -100,41 +100,41 @@ class CI_DB_mssql_forge extends CI_DB_forge {
else
{
$attributes = array_change_key_case($attributes, CASE_UPPER);
-
+
$sql .= "\n\t".$this->db->_protect_identifiers($field);
-
+
$sql .= ' '.$attributes['TYPE'];
-
+
if (array_key_exists('CONSTRAINT', $attributes))
{
$sql .= '('.$attributes['CONSTRAINT'].')';
}
-
+
if (array_key_exists('UNSIGNED', $attributes) && $attributes['UNSIGNED'] === TRUE)
{
$sql .= ' UNSIGNED';
}
-
+
if (array_key_exists('DEFAULT', $attributes))
{
$sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\'';
}
-
+
if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE)
{
$sql .= ' NULL';
}
else
{
- $sql .= ' NOT NULL';
+ $sql .= ' NOT NULL';
}
-
+
if (array_key_exists('AUTO_INCREMENT', $attributes) && $attributes['AUTO_INCREMENT'] === TRUE)
{
$sql .= ' AUTO_INCREMENT';
}
}
-
+
// don't add a comma on the end of the last field
if (++$current_field_count < count($fields))
{
@@ -147,24 +147,24 @@ class CI_DB_mssql_forge extends CI_DB_forge {
$primary_keys = $this->db->_protect_identifiers($primary_keys);
$sql .= ",\n\tPRIMARY KEY (" . implode(', ', $primary_keys) . ")";
}
-
+
if (is_array($keys) && count($keys) > 0)
{
foreach ($keys as $key)
{
if (is_array($key))
{
- $key = $this->db->_protect_identifiers($key);
+ $key = $this->db->_protect_identifiers($key);
}
else
{
$key = array($this->db->_protect_identifiers($key));
}
-
+
$sql .= ",\n\tFOREIGN KEY (" . implode(', ', $key) . ")";
}
}
-
+
$sql .= "\n)";
return $sql;
@@ -218,9 +218,9 @@ class CI_DB_mssql_forge extends CI_DB_forge {
{
$sql .= ' AFTER ' . $this->db->_protect_identifiers($after_field);
}
-
+
return $sql;
-
+
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/mssql/mssql_result.php b/system/database/drivers/mssql/mssql_result.php
index e7b338045..09b1ec80b 100644
--- a/system/database/drivers/mssql/mssql_result.php
+++ b/system/database/drivers/mssql/mssql_result.php
@@ -25,7 +25,7 @@
* @link http://codeigniter.com/user_guide/database/
*/
class CI_DB_mssql_result extends CI_DB_result {
-
+
/**
* Number of rows in the result set
*
@@ -36,7 +36,7 @@ class CI_DB_mssql_result extends CI_DB_result {
{
return @mssql_num_rows($this->result_id);
}
-
+
// --------------------------------------------------------------------
/**
@@ -67,7 +67,7 @@ class CI_DB_mssql_result extends CI_DB_result {
{
$field_names[] = $field->name;
}
-
+
return $field_names;
}
@@ -85,17 +85,17 @@ class CI_DB_mssql_result extends CI_DB_result {
{
$retval = array();
while ($field = mssql_fetch_field($this->result_id))
- {
- $F = new stdClass();
- $F->name = $field->name;
- $F->type = $field->type;
+ {
+ $F = new stdClass();
+ $F->name = $field->name;
+ $F->type = $field->type;
$F->max_length = $field->max_length;
$F->primary_key = 0;
$F->default = '';
-
+
$retval[] = $F;
}
-
+
return $retval;
}
@@ -105,7 +105,7 @@ class CI_DB_mssql_result extends CI_DB_result {
* Free the result
*
* @return null
- */
+ */
function free_result()
{
if (is_resource($this->result_id))
@@ -131,7 +131,7 @@ class CI_DB_mssql_result extends CI_DB_result {
{
return mssql_data_seek($this->result_id, $n);
}
-
+
// --------------------------------------------------------------------
/**
@@ -146,7 +146,7 @@ class CI_DB_mssql_result extends CI_DB_result {
{
return mssql_fetch_assoc($this->result_id);
}
-
+
// --------------------------------------------------------------------
/**
diff --git a/system/database/drivers/mssql/mssql_utility.php b/system/database/drivers/mssql/mssql_utility.php
index 751be146c..e58c7e0c3 100644
--- a/system/database/drivers/mssql/mssql_utility.php
+++ b/system/database/drivers/mssql/mssql_utility.php
@@ -52,7 +52,7 @@ class CI_DB_mssql_utility extends CI_DB_utility {
}
// --------------------------------------------------------------------
-
+
/**
* Repair table query
*
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index d684c8a49..cb985a764 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -43,9 +43,9 @@ 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,
* adding a bit more processing to all queries.
- */
+ */
var $delete_hack = TRUE;
-
+
/**
* The syntax to count rows is slightly different across different
* database engines, so this string appears in each driver and is
@@ -59,17 +59,17 @@ class CI_DB_mysql_driver extends CI_DB {
*
* @access private called by the base class
* @return resource
- */
+ */
function db_connect()
{
if ($this->port != '')
{
$this->hostname .= ':'.$this->port;
}
-
+
return @mysql_connect($this->hostname, $this->username, $this->password, TRUE);
}
-
+
// --------------------------------------------------------------------
/**
@@ -77,7 +77,7 @@ class CI_DB_mysql_driver extends CI_DB {
*
* @access private called by the base class
* @return resource
- */
+ */
function db_pconnect()
{
if ($this->port != '')
@@ -87,7 +87,7 @@ class CI_DB_mysql_driver extends CI_DB {
return @mysql_pconnect($this->hostname, $this->username, $this->password);
}
-
+
// --------------------------------------------------------------------
/**
@@ -108,13 +108,13 @@ class CI_DB_mysql_driver extends CI_DB {
}
// --------------------------------------------------------------------
-
+
/**
* Select the database
*
* @access private called by the base class
* @return resource
- */
+ */
function db_select()
{
return @mysql_select_db($this->database, $this->conn_id);
@@ -136,7 +136,7 @@ class CI_DB_mysql_driver extends CI_DB {
}
// --------------------------------------------------------------------
-
+
/**
* Version number query string
*
@@ -156,13 +156,13 @@ class CI_DB_mysql_driver extends CI_DB {
* @access private called by the base class
* @param string an SQL query
* @return resource
- */
+ */
function _execute($sql)
{
$sql = $this->_prep_query($sql);
return @mysql_query($sql, $this->conn_id);
}
-
+
// --------------------------------------------------------------------
/**
@@ -173,7 +173,7 @@ class CI_DB_mysql_driver extends CI_DB {
* @access private called by execute()
* @param string an SQL query
* @return string
- */
+ */
function _prep_query($sql)
{
// "DELETE FROM TABLE" returns 0 affected rows This hack modifies
@@ -185,7 +185,7 @@ class CI_DB_mysql_driver extends CI_DB {
$sql = preg_replace("/^\s*DELETE\s+FROM\s+(\S+)\s*$/", "DELETE FROM \\1 WHERE 1=1", $sql);
}
}
-
+
return $sql;
}
@@ -195,15 +195,15 @@ class CI_DB_mysql_driver extends CI_DB {
* Begin Transaction
*
* @access public
- * @return bool
- */
+ * @return bool
+ */
function trans_begin($test_mode = FALSE)
{
if ( ! $this->trans_enabled)
{
return TRUE;
}
-
+
// When transactions are nested we only begin/commit/rollback the outermost ones
if ($this->_trans_depth > 0)
{
@@ -214,7 +214,7 @@ class CI_DB_mysql_driver extends CI_DB {
// 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');
$this->simple_query('START TRANSACTION'); // can also be BEGIN or BEGIN WORK
return TRUE;
@@ -226,8 +226,8 @@ class CI_DB_mysql_driver extends CI_DB {
* Commit Transaction
*
* @access public
- * @return bool
- */
+ * @return bool
+ */
function trans_commit()
{
if ( ! $this->trans_enabled)
@@ -252,8 +252,8 @@ class CI_DB_mysql_driver extends CI_DB {
* Rollback Transaction
*
* @access public
- * @return bool
- */
+ * @return bool
+ */
function trans_rollback()
{
if ( ! $this->trans_enabled)
@@ -271,7 +271,7 @@ class CI_DB_mysql_driver extends CI_DB {
$this->simple_query('SET AUTOCOMMIT=1');
return TRUE;
}
-
+
// --------------------------------------------------------------------
/**
@@ -282,17 +282,17 @@ class CI_DB_mysql_driver extends CI_DB {
* @param bool whether or not the string will be used in a LIKE condition
* @return string
*/
- function escape_str($str, $like = FALSE)
- {
+ function escape_str($str, $like = FALSE)
+ {
if (is_array($str))
{
foreach($str as $key => $val)
- {
+ {
$str[$key] = $this->escape_str($val, $like);
- }
-
- return $str;
- }
+ }
+
+ return $str;
+ }
if (function_exists('mysql_real_escape_string') AND is_resource($this->conn_id))
{
@@ -306,16 +306,16 @@ class CI_DB_mysql_driver extends CI_DB {
{
$str = addslashes($str);
}
-
+
// escape LIKE condition wildcards
if ($like === TRUE)
{
$str = str_replace(array('%', '_'), array('\\%', '\\_'), $str);
}
-
+
return $str;
}
-
+
// --------------------------------------------------------------------
/**
@@ -328,7 +328,7 @@ class CI_DB_mysql_driver extends CI_DB {
{
return @mysql_affected_rows($this->conn_id);
}
-
+
// --------------------------------------------------------------------
/**
@@ -360,7 +360,7 @@ class CI_DB_mysql_driver extends CI_DB {
{
return 0;
}
-
+
$query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE));
if ($query->num_rows() == 0)
@@ -385,7 +385,7 @@ class CI_DB_mysql_driver extends CI_DB {
*/
function _list_tables($prefix_limit = FALSE)
{
- $sql = "SHOW TABLES FROM ".$this->_escape_char.$this->database.$this->_escape_char;
+ $sql = "SHOW TABLES FROM ".$this->_escape_char.$this->database.$this->_escape_char;
if ($prefix_limit !== FALSE AND $this->dbprefix != '')
{
@@ -394,7 +394,7 @@ class CI_DB_mysql_driver extends CI_DB {
return $sql;
}
-
+
// --------------------------------------------------------------------
/**
@@ -439,7 +439,7 @@ class CI_DB_mysql_driver extends CI_DB {
{
return mysql_error($this->conn_id);
}
-
+
// --------------------------------------------------------------------
/**
@@ -475,26 +475,26 @@ class CI_DB_mysql_driver extends CI_DB {
{
if (strpos($item, '.'.$id) !== FALSE)
{
- $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item);
-
+ $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item);
+
// remove duplicates if the user already included the escape
return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
- }
+ }
}
-
+
if (strpos($item, '.') !== FALSE)
{
- $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
+ $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
}
else
{
$str = $this->_escape_char.$item.$this->_escape_char;
}
-
+
// remove duplicates if the user already included the escape
return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
}
-
+
// --------------------------------------------------------------------
/**
@@ -513,12 +513,12 @@ class CI_DB_mysql_driver extends CI_DB {
{
$tables = array($tables);
}
-
+
return '('.implode(', ', $tables).')';
}
// --------------------------------------------------------------------
-
+
/**
* Insert statement
*
@@ -531,13 +531,13 @@ class CI_DB_mysql_driver extends CI_DB {
* @return string
*/
function _insert($table, $keys, $values)
- {
+ {
return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")";
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Replace statement
*
@@ -550,10 +550,10 @@ class CI_DB_mysql_driver extends CI_DB {
* @return string
*/
function _replace($table, $keys, $values)
- {
+ {
return "REPLACE INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")";
}
-
+
// --------------------------------------------------------------------
/**
@@ -568,10 +568,10 @@ class CI_DB_mysql_driver extends CI_DB {
* @return string
*/
function _insert_batch($table, $keys, $values)
- {
+ {
return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES ".implode(', ', $values);
}
-
+
// --------------------------------------------------------------------
@@ -594,17 +594,17 @@ class CI_DB_mysql_driver extends CI_DB {
{
$valstr[] = $key." = ".$val;
}
-
+
$limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
-
+
$orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):'';
-
+
$sql = "UPDATE ".$table." SET ".implode(', ', $valstr);
$sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : '';
$sql .= $orderby.$limit;
-
+
return $sql;
}
@@ -630,16 +630,16 @@ class CI_DB_mysql_driver extends CI_DB {
foreach($values as $key => $val)
{
$ids[] = $val[$index];
-
+
foreach(array_keys($val) as $field)
- {
+ {
if ($field != $index)
{
$final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field];
}
}
}
-
+
$sql = "UPDATE ".$table." SET ";
$cases = '';
@@ -650,14 +650,14 @@ class CI_DB_mysql_driver extends CI_DB {
{
$cases .= $row."\n";
}
-
+
$cases .= 'ELSE '.$k.' END, ';
}
-
+
$sql .= substr($cases, 0, -2);
-
+
$sql .= ' WHERE '.$where.$index.' IN ('.implode(',', $ids).')';
-
+
return $sql;
}
@@ -674,12 +674,12 @@ class CI_DB_mysql_driver extends CI_DB {
* @access public
* @param string the table name
* @return string
- */
+ */
function _truncate($table)
{
return "TRUNCATE ".$table;
}
-
+
// --------------------------------------------------------------------
/**
@@ -692,7 +692,7 @@ class CI_DB_mysql_driver extends CI_DB {
* @param array the where clause
* @param string the limit clause
* @return string
- */
+ */
function _delete($table, $where = array(), $like = array(), $limit = FALSE)
{
$conditions = '';
@@ -710,7 +710,7 @@ class CI_DB_mysql_driver extends CI_DB {
}
$limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
-
+
return "DELETE FROM ".$table.$conditions.$limit;
}
@@ -728,7 +728,7 @@ class CI_DB_mysql_driver extends CI_DB {
* @return string
*/
function _limit($sql, $limit, $offset)
- {
+ {
if ($offset == 0)
{
$offset = '';
@@ -737,7 +737,7 @@ class CI_DB_mysql_driver extends CI_DB {
{
$offset .= ", ";
}
-
+
return $sql."LIMIT ".$offset.$limit;
}
@@ -754,7 +754,7 @@ class CI_DB_mysql_driver extends CI_DB {
{
@mysql_close($conn_id);
}
-
+
}
diff --git a/system/database/drivers/mysql/mysql_forge.php b/system/database/drivers/mysql/mysql_forge.php
index ccacf99f8..973f32dcb 100644
--- a/system/database/drivers/mysql/mysql_forge.php
+++ b/system/database/drivers/mysql/mysql_forge.php
@@ -23,7 +23,7 @@
* @link http://codeigniter.com/user_guide/database/
*/
class CI_DB_mysql_forge extends CI_DB_forge {
-
+
/**
* Create database
*
@@ -76,52 +76,52 @@ class CI_DB_mysql_forge extends CI_DB_forge {
else
{
$attributes = array_change_key_case($attributes, CASE_UPPER);
-
+
$sql .= "\n\t".$this->db->_protect_identifiers($field);
if (array_key_exists('NAME', $attributes))
{
$sql .= ' '.$this->db->_protect_identifiers($attributes['NAME']).' ';
}
-
+
if (array_key_exists('TYPE', $attributes))
{
$sql .= ' '.$attributes['TYPE'];
}
-
+
if (array_key_exists('CONSTRAINT', $attributes))
{
$sql .= '('.$attributes['CONSTRAINT'].')';
}
-
+
if (array_key_exists('UNSIGNED', $attributes) && $attributes['UNSIGNED'] === TRUE)
{
$sql .= ' UNSIGNED';
}
-
+
if (array_key_exists('DEFAULT', $attributes))
{
$sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\'';
}
-
+
if (array_key_exists('NULL', $attributes))
{
$sql .= ($attributes['NULL'] === TRUE) ? ' NULL' : ' NOT NULL';
}
-
+
if (array_key_exists('AUTO_INCREMENT', $attributes) && $attributes['AUTO_INCREMENT'] === TRUE)
{
$sql .= ' AUTO_INCREMENT';
}
}
-
+
// don't add a comma on the end of the last field
if (++$current_field_count < count($fields))
{
$sql .= ',';
}
}
-
+
return $sql;
}
@@ -141,12 +141,12 @@ class CI_DB_mysql_forge extends CI_DB_forge {
function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists)
{
$sql = 'CREATE TABLE ';
-
+
if ($if_not_exists === TRUE)
{
$sql .= 'IF NOT EXISTS ';
}
-
+
$sql .= $this->db->_escape_identifiers($table)." (";
$sql .= $this->_process_fields($fields);
@@ -165,14 +165,14 @@ class CI_DB_mysql_forge extends CI_DB_forge {
if (is_array($key))
{
$key_name = $this->db->_protect_identifiers(implode('_', $key));
- $key = $this->db->_protect_identifiers($key);
+ $key = $this->db->_protect_identifiers($key);
}
else
{
$key_name = $this->db->_protect_identifiers($key);
$key = array($key_name);
}
-
+
$sql .= ",\n\tKEY {$key_name} (" . implode(', ', $key) . ")";
}
}
@@ -226,7 +226,7 @@ class CI_DB_mysql_forge extends CI_DB_forge {
{
$sql .= ' AFTER ' . $this->db->_protect_identifiers($after_field);
}
-
+
return $sql;
}
diff --git a/system/database/drivers/mysql/mysql_result.php b/system/database/drivers/mysql/mysql_result.php
index acc586626..0140ec647 100644
--- a/system/database/drivers/mysql/mysql_result.php
+++ b/system/database/drivers/mysql/mysql_result.php
@@ -36,7 +36,7 @@ class CI_DB_mysql_result extends CI_DB_result {
{
return @mysql_num_rows($this->result_id);
}
-
+
// --------------------------------------------------------------------
/**
@@ -49,7 +49,7 @@ class CI_DB_mysql_result extends CI_DB_result {
{
return @mysql_num_fields($this->result_id);
}
-
+
// --------------------------------------------------------------------
/**
@@ -67,7 +67,7 @@ class CI_DB_mysql_result extends CI_DB_result {
{
$field_names[] = $field->name;
}
-
+
return $field_names;
}
@@ -85,27 +85,27 @@ class CI_DB_mysql_result extends CI_DB_result {
{
$retval = array();
while ($field = mysql_fetch_field($this->result_id))
- {
+ {
$F = new stdClass();
- $F->name = $field->name;
- $F->type = $field->type;
+ $F->name = $field->name;
+ $F->type = $field->type;
$F->default = $field->def;
$F->max_length = $field->max_length;
$F->primary_key = $field->primary_key;
-
+
$retval[] = $F;
}
-
+
return $retval;
}
-
+
// --------------------------------------------------------------------
/**
* Free the result
*
* @return null
- */
+ */
function free_result()
{
if (is_resource($this->result_id))
@@ -146,7 +146,7 @@ class CI_DB_mysql_result extends CI_DB_result {
{
return mysql_fetch_assoc($this->result_id);
}
-
+
// --------------------------------------------------------------------
/**
@@ -161,7 +161,7 @@ class CI_DB_mysql_result extends CI_DB_result {
{
return mysql_fetch_object($this->result_id);
}
-
+
}
diff --git a/system/database/drivers/mysql/mysql_utility.php b/system/database/drivers/mysql/mysql_utility.php
index c4a970cfd..3b574c6f4 100644
--- a/system/database/drivers/mysql/mysql_utility.php
+++ b/system/database/drivers/mysql/mysql_utility.php
@@ -84,7 +84,7 @@ class CI_DB_mysql_utility extends CI_DB_utility {
// Extract the prefs for simplicity
extract($params);
-
+
// Build the output
$output = '';
foreach ((array)$tables as $table)
@@ -97,31 +97,31 @@ class CI_DB_mysql_utility extends CI_DB_utility {
// 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 ($add_drop == TRUE)
- {
+ if ($add_drop == TRUE)
+ {
$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 inserts are not needed we're done...
if ($add_insert == FALSE)
{
@@ -130,16 +130,16 @@ class CI_DB_mysql_utility extends CI_DB_utility {
// Grab all the data from the current table
$query = $this->db->query("SELECT * FROM $table");
-
+
if ($query->num_rows() == 0)
{
continue;
}
-
+
// Fetch the field names and determine if the field is an
// integer type. We use this info to decide whether to
// surround the data with quotes or not
-
+
$i = 0;
$field_str = '';
$is_int = array();
@@ -148,24 +148,24 @@ class CI_DB_mysql_utility extends CI_DB_utility {
// Most versions of MySQL store timestamp as a string
$is_int[$i] = (in_array(
strtolower(mysql_field_type($query->result_id, $i)),
- array('tinyint', 'smallint', 'mediumint', 'int', 'bigint'), //, 'timestamp'),
+ array('tinyint', 'smallint', 'mediumint', 'int', 'bigint'), //, 'timestamp'),
TRUE)
) ? TRUE : FALSE;
-
+
// Create a string of field names
$field_str .= '`'.$field->name.'`, ';
$i++;
}
-
+
// Trim off the end comma
$field_str = preg_replace( "/, $/" , "" , $field_str);
-
-
+
+
// Build the insert string
foreach ($query->result_array() as $row)
{
$val_str = '';
-
+
$i = 0;
foreach ($row as $v)
{
@@ -184,21 +184,21 @@ class CI_DB_mysql_utility extends CI_DB_utility {
else
{
$val_str .= $v;
- }
- }
-
+ }
+ }
+
// Append a comma
$val_str .= ', ';
$i++;
}
-
+
// Remove the comma at the end of the string
$val_str = preg_replace( "/, $/" , "" , $val_str);
-
+
// Build the INSERT string
$output .= 'INSERT INTO '.$table.' ('.$field_str.') VALUES ('.$val_str.');'.$newline;
}
-
+
$output .= $newline.$newline;
}
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index d0e2defec..69e092839 100644
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
@@ -31,7 +31,7 @@
class CI_DB_mysqli_driver extends CI_DB {
var $dbdriver = 'mysqli';
-
+
// The character used for escaping
var $_escape_char = '`';
@@ -51,7 +51,7 @@ 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,
* adding a bit more processing to all queries.
- */
+ */
var $delete_hack = TRUE;
// --------------------------------------------------------------------
@@ -61,12 +61,12 @@ class CI_DB_mysqli_driver extends CI_DB {
*
* @access private called by the base class
* @return resource
- */
+ */
function db_connect()
{
if ($this->port != '')
{
- return @mysqli_connect($this->hostname, $this->username, $this->password, $this->database, $this->port);
+ return @mysqli_connect($this->hostname, $this->username, $this->password, $this->database, $this->port);
}
else
{
@@ -82,12 +82,12 @@ class CI_DB_mysqli_driver extends CI_DB {
*
* @access private called by the base class
* @return resource
- */
+ */
function db_pconnect()
{
return $this->db_connect();
}
-
+
// --------------------------------------------------------------------
/**
@@ -114,7 +114,7 @@ class CI_DB_mysqli_driver extends CI_DB {
*
* @access private called by the base class
* @return resource
- */
+ */
function db_select()
{
return @mysqli_select_db($this->conn_id, $this->database);
@@ -136,7 +136,7 @@ class CI_DB_mysqli_driver extends CI_DB {
}
// --------------------------------------------------------------------
-
+
/**
* Version number query string
*
@@ -156,14 +156,14 @@ class CI_DB_mysqli_driver extends CI_DB {
* @access private called by the base class
* @param string an SQL query
* @return resource
- */
+ */
function _execute($sql)
{
- $sql = $this->_prep_query($sql);
+ $sql = $this->_prep_query($sql);
$result = @mysqli_query($this->conn_id, $sql);
return $result;
}
-
+
// --------------------------------------------------------------------
/**
@@ -174,7 +174,7 @@ class CI_DB_mysqli_driver extends CI_DB {
* @access private called by execute()
* @param string an SQL query
* @return string
- */
+ */
function _prep_query($sql)
{
// "DELETE FROM TABLE" returns 0 affected rows This hack modifies
@@ -186,7 +186,7 @@ class CI_DB_mysqli_driver extends CI_DB {
$sql = preg_replace("/^\s*DELETE\s+FROM\s+(\S+)\s*$/", "DELETE FROM \\1 WHERE 1=1", $sql);
}
}
-
+
return $sql;
}
@@ -196,15 +196,15 @@ class CI_DB_mysqli_driver extends CI_DB {
* Begin Transaction
*
* @access public
- * @return bool
- */
+ * @return bool
+ */
function trans_begin($test_mode = FALSE)
{
if ( ! $this->trans_enabled)
{
return TRUE;
}
-
+
// When transactions are nested we only begin/commit/rollback the outermost ones
if ($this->_trans_depth > 0)
{
@@ -227,8 +227,8 @@ class CI_DB_mysqli_driver extends CI_DB {
* Commit Transaction
*
* @access public
- * @return bool
- */
+ * @return bool
+ */
function trans_commit()
{
if ( ! $this->trans_enabled)
@@ -253,8 +253,8 @@ class CI_DB_mysqli_driver extends CI_DB {
* Rollback Transaction
*
* @access public
- * @return bool
- */
+ * @return bool
+ */
function trans_rollback()
{
if ( ! $this->trans_enabled)
@@ -283,17 +283,17 @@ class CI_DB_mysqli_driver extends CI_DB {
* @param bool whether or not the string will be used in a LIKE condition
* @return string
*/
- function escape_str($str, $like = FALSE)
+ function escape_str($str, $like = FALSE)
{
if (is_array($str))
{
foreach($str as $key => $val)
- {
+ {
$str[$key] = $this->escape_str($val, $like);
- }
-
- return $str;
- }
+ }
+
+ return $str;
+ }
if (function_exists('mysqli_real_escape_string') AND is_object($this->conn_id))
{
@@ -307,16 +307,16 @@ class CI_DB_mysqli_driver extends CI_DB {
{
$str = addslashes($str);
}
-
+
// escape LIKE condition wildcards
if ($like === TRUE)
{
$str = str_replace(array('%', '_'), array('\\%', '\\_'), $str);
}
-
+
return $str;
}
-
+
// --------------------------------------------------------------------
/**
@@ -329,7 +329,7 @@ class CI_DB_mysqli_driver extends CI_DB {
{
return @mysqli_affected_rows($this->conn_id);
}
-
+
// --------------------------------------------------------------------
/**
@@ -386,13 +386,13 @@ class CI_DB_mysqli_driver extends CI_DB {
*/
function _list_tables($prefix_limit = FALSE)
{
- $sql = "SHOW TABLES FROM ".$this->_escape_char.$this->database.$this->_escape_char;
-
+ $sql = "SHOW TABLES FROM ".$this->_escape_char.$this->database.$this->_escape_char;
+
if ($prefix_limit !== FALSE AND $this->dbprefix != '')
{
$sql .= " LIKE '".$this->escape_like_str($this->dbprefix)."%'";
}
-
+
return $sql;
}
@@ -440,7 +440,7 @@ class CI_DB_mysqli_driver extends CI_DB {
{
return mysqli_error($this->conn_id);
}
-
+
// --------------------------------------------------------------------
/**
@@ -471,31 +471,31 @@ class CI_DB_mysqli_driver extends CI_DB {
{
return $item;
}
-
+
foreach ($this->_reserved_identifiers as $id)
{
if (strpos($item, '.'.$id) !== FALSE)
{
- $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item);
-
+ $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item);
+
// remove duplicates if the user already included the escape
return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
- }
+ }
}
-
+
if (strpos($item, '.') !== FALSE)
{
- $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
+ $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
}
else
{
$str = $this->_escape_char.$item.$this->_escape_char;
}
-
+
// remove duplicates if the user already included the escape
return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
}
-
+
// --------------------------------------------------------------------
/**
@@ -514,12 +514,12 @@ class CI_DB_mysqli_driver extends CI_DB {
{
$tables = array($tables);
}
-
+
return '('.implode(', ', $tables).')';
}
// --------------------------------------------------------------------
-
+
/**
* Insert statement
*
@@ -532,10 +532,10 @@ class CI_DB_mysqli_driver extends CI_DB {
* @return string
*/
function _insert($table, $keys, $values)
- {
+ {
return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")";
}
-
+
// --------------------------------------------------------------------
/**
@@ -557,21 +557,21 @@ class CI_DB_mysqli_driver extends CI_DB {
{
$valstr[] = $key." = ".$val;
}
-
+
$limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
-
+
$orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):'';
-
+
$sql = "UPDATE ".$table." SET ".implode(', ', $valstr);
-
+
$sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : '';
-
+
$sql .= $orderby.$limit;
-
+
return $sql;
}
-
+
// --------------------------------------------------------------------
/**
@@ -584,12 +584,12 @@ class CI_DB_mysqli_driver extends CI_DB {
* @access public
* @param string the table name
* @return string
- */
+ */
function _truncate($table)
{
return "TRUNCATE ".$table;
}
-
+
// --------------------------------------------------------------------
/**
@@ -602,7 +602,7 @@ class CI_DB_mysqli_driver extends CI_DB {
* @param array the where clause
* @param string the limit clause
* @return string
- */
+ */
function _delete($table, $where = array(), $like = array(), $limit = FALSE)
{
$conditions = '';
@@ -620,7 +620,7 @@ class CI_DB_mysqli_driver extends CI_DB {
}
$limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
-
+
return "DELETE FROM ".$table.$conditions.$limit;
}
@@ -638,14 +638,14 @@ class CI_DB_mysqli_driver extends CI_DB {
* @return string
*/
function _limit($sql, $limit, $offset)
- {
+ {
$sql .= "LIMIT ".$limit;
-
+
if ($offset > 0)
{
$sql .= " OFFSET ".$offset;
}
-
+
return $sql;
}
diff --git a/system/database/drivers/mysqli/mysqli_forge.php b/system/database/drivers/mysqli/mysqli_forge.php
index 262d491ed..85491a873 100644
--- a/system/database/drivers/mysqli/mysqli_forge.php
+++ b/system/database/drivers/mysqli/mysqli_forge.php
@@ -23,7 +23,7 @@
* @link http://codeigniter.com/user_guide/database/
*/
class CI_DB_mysqli_forge extends CI_DB_forge {
-
+
/**
* Create database
*
@@ -76,52 +76,52 @@ class CI_DB_mysqli_forge extends CI_DB_forge {
else
{
$attributes = array_change_key_case($attributes, CASE_UPPER);
-
+
$sql .= "\n\t".$this->db->_protect_identifiers($field);
if (array_key_exists('NAME', $attributes))
{
$sql .= ' '.$this->db->_protect_identifiers($attributes['NAME']).' ';
}
-
+
if (array_key_exists('TYPE', $attributes))
{
$sql .= ' '.$attributes['TYPE'];
}
-
+
if (array_key_exists('CONSTRAINT', $attributes))
{
$sql .= '('.$attributes['CONSTRAINT'].')';
}
-
+
if (array_key_exists('UNSIGNED', $attributes) && $attributes['UNSIGNED'] === TRUE)
{
$sql .= ' UNSIGNED';
}
-
+
if (array_key_exists('DEFAULT', $attributes))
{
$sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\'';
}
-
+
if (array_key_exists('NULL', $attributes))
{
$sql .= ($attributes['NULL'] === TRUE) ? ' NULL' : ' NOT NULL';
}
-
+
if (array_key_exists('AUTO_INCREMENT', $attributes) && $attributes['AUTO_INCREMENT'] === TRUE)
{
$sql .= ' AUTO_INCREMENT';
}
}
-
+
// don't add a comma on the end of the last field
if (++$current_field_count < count($fields))
{
$sql .= ',';
}
}
-
+
return $sql;
}
@@ -141,12 +141,12 @@ class CI_DB_mysqli_forge extends CI_DB_forge {
function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists)
{
$sql = 'CREATE TABLE ';
-
+
if ($if_not_exists === TRUE)
{
$sql .= 'IF NOT EXISTS ';
}
-
+
$sql .= $this->db->_escape_identifiers($table)." (";
$sql .= $this->_process_fields($fields);
@@ -165,14 +165,14 @@ class CI_DB_mysqli_forge extends CI_DB_forge {
if (is_array($key))
{
$key_name = $this->db->_protect_identifiers(implode('_', $key));
- $key = $this->db->_protect_identifiers($key);
+ $key = $this->db->_protect_identifiers($key);
}
else
{
$key_name = $this->db->_protect_identifiers($key);
$key = array($key_name);
}
-
+
$sql .= ",\n\tKEY {$key_name} (" . implode(', ', $key) . ")";
}
}
@@ -226,7 +226,7 @@ class CI_DB_mysqli_forge extends CI_DB_forge {
{
$sql .= ' AFTER ' . $this->db->_protect_identifiers($after_field);
}
-
+
return $sql;
}
diff --git a/system/database/drivers/mysqli/mysqli_result.php b/system/database/drivers/mysqli/mysqli_result.php
index 81d22cc9c..dd58ed878 100644
--- a/system/database/drivers/mysqli/mysqli_result.php
+++ b/system/database/drivers/mysqli/mysqli_result.php
@@ -25,7 +25,7 @@
* @link http://codeigniter.com/user_guide/database/
*/
class CI_DB_mysqli_result extends CI_DB_result {
-
+
/**
* Number of rows in the result set
*
@@ -36,7 +36,7 @@ class CI_DB_mysqli_result extends CI_DB_result {
{
return @mysqli_num_rows($this->result_id);
}
-
+
// --------------------------------------------------------------------
/**
@@ -67,7 +67,7 @@ class CI_DB_mysqli_result extends CI_DB_result {
{
$field_names[] = $field->name;
}
-
+
return $field_names;
}
@@ -85,17 +85,17 @@ class CI_DB_mysqli_result extends CI_DB_result {
{
$retval = array();
while ($field = mysqli_fetch_field($this->result_id))
- {
- $F = new stdClass();
- $F->name = $field->name;
- $F->type = $field->type;
+ {
+ $F = new stdClass();
+ $F->name = $field->name;
+ $F->type = $field->type;
$F->default = $field->def;
$F->max_length = $field->max_length;
$F->primary_key = ($field->flags & MYSQLI_PRI_KEY_FLAG) ? 1 : 0;
-
+
$retval[] = $F;
}
-
+
return $retval;
}
@@ -105,7 +105,7 @@ class CI_DB_mysqli_result extends CI_DB_result {
* Free the result
*
* @return null
- */
+ */
function free_result()
{
if (is_object($this->result_id))
@@ -146,7 +146,7 @@ class CI_DB_mysqli_result extends CI_DB_result {
{
return mysqli_fetch_assoc($this->result_id);
}
-
+
// --------------------------------------------------------------------
/**
@@ -161,7 +161,7 @@ class CI_DB_mysqli_result extends CI_DB_result {
{
return mysqli_fetch_object($this->result_id);
}
-
+
}
diff --git a/system/database/drivers/mysqli/mysqli_utility.php b/system/database/drivers/mysqli/mysqli_utility.php
index 3ba14d25a..e0dbca7c0 100644
--- a/system/database/drivers/mysqli/mysqli_utility.php
+++ b/system/database/drivers/mysqli/mysqli_utility.php
@@ -23,7 +23,7 @@
* @link http://codeigniter.com/user_guide/database/
*/
class CI_DB_mysqli_utility extends CI_DB_utility {
-
+
/**
* List databases
*
@@ -34,7 +34,7 @@ class CI_DB_mysqli_utility extends CI_DB_utility {
{
return "SHOW DATABASES";
}
-
+
// --------------------------------------------------------------------
/**
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php
index 6f317d2e6..fb65ad8a1 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 ExpressionEngine Dev Team
+ * @package CodeIgniter
+ * @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2008 - 2010, EllisLab, Inc.
- * @license http://codeigniter.com/user_guide/license.html
+ * @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
- * @since Version 1.0
+ * @since Version 1.0
* @filesource
*/
@@ -22,10 +22,10 @@
* creates dynamically based on whether the active record
* class is being used or not.
*
- * @package CodeIgniter
+ * @package CodeIgniter
* @subpackage Drivers
* @category Database
- * @author ExpressionEngine Dev Team
+ * @author ExpressionEngine Dev Team
* @link http://codeigniter.com/user_guide/database/
*/
@@ -44,14 +44,14 @@
class CI_DB_oci8_driver extends CI_DB {
var $dbdriver = 'oci8';
-
+
// The character used for excaping
var $_escape_char = '"';
-
+
// clause and character used for LIKE escape sequences
var $_like_escape_str = " escape '%s' ";
var $_like_escape_chr = '!';
-
+
/**
* The syntax to count rows is slightly different across different
* database engines, so this string appears in each driver and is
@@ -141,7 +141,7 @@ class CI_DB_oci8_driver extends CI_DB {
}
// --------------------------------------------------------------------
-
+
/**
* Version number query string
*
@@ -248,7 +248,7 @@ class CI_DB_oci8_driver extends CI_DB {
}
return FALSE;
}
-
+
// build the query string
$sql = "begin $package.$procedure(";
@@ -256,20 +256,20 @@ class CI_DB_oci8_driver extends CI_DB {
foreach($params as $param)
{
$sql .= $param['name'] . ",";
-
+
if (array_key_exists('type', $param) && ($param['type'] == OCI_B_CURSOR))
{
$have_cursor = TRUE;
}
}
$sql = trim($sql, ",") . "); end;";
-
+
$this->stmt_id = FALSE;
$this->_set_stmt_id($sql);
$this->_bind_params($params);
$this->query($sql, FALSE, $have_cursor);
}
-
+
// --------------------------------------------------------------------
/**
@@ -284,10 +284,10 @@ class CI_DB_oci8_driver extends CI_DB {
{
return;
}
-
+
foreach ($params as $param)
{
- foreach (array('name', 'value', 'type', 'length') as $val)
+ foreach (array('name', 'value', 'type', 'length') as $val)
{
if ( ! isset($param[$val]))
{
@@ -305,26 +305,26 @@ class CI_DB_oci8_driver extends CI_DB {
* Begin Transaction
*
* @access public
- * @return bool
- */
+ * @return bool
+ */
function trans_begin($test_mode = FALSE)
{
if ( ! $this->trans_enabled)
{
return TRUE;
}
-
+
// When transactions are nested we only begin/commit/rollback the outermost ones
if ($this->_trans_depth > 0)
{
return TRUE;
}
-
+
// 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.
$this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE;
-
+
$this->_commit = OCI_DEFAULT;
return TRUE;
}
@@ -335,8 +335,8 @@ class CI_DB_oci8_driver extends CI_DB {
* Commit Transaction
*
* @access public
- * @return bool
- */
+ * @return bool
+ */
function trans_commit()
{
if ( ! $this->trans_enabled)
@@ -361,8 +361,8 @@ class CI_DB_oci8_driver extends CI_DB {
* Rollback Transaction
*
* @access public
- * @return bool
- */
+ * @return bool
+ */
function trans_rollback()
{
if ( ! $this->trans_enabled)
@@ -396,15 +396,15 @@ class CI_DB_oci8_driver extends CI_DB {
if (is_array($str))
{
foreach($str as $key => $val)
- {
+ {
$str[$key] = $this->escape_str($val, $like);
- }
-
- return $str;
- }
+ }
+
+ return $str;
+ }
$str = remove_invisible_characters($str);
-
+
// escape LIKE condition wildcards
if ($like === TRUE)
{
@@ -412,7 +412,7 @@ class CI_DB_oci8_driver extends CI_DB {
array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr),
$str);
}
-
+
return $str;
}
@@ -492,7 +492,7 @@ class CI_DB_oci8_driver extends CI_DB {
{
$sql .= " WHERE TABLE_NAME LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr);
}
-
+
return $sql;
}
@@ -555,7 +555,7 @@ class CI_DB_oci8_driver extends CI_DB {
$error = ocierror($this->conn_id);
return $error['code'];
}
-
+
// --------------------------------------------------------------------
/**
@@ -578,26 +578,26 @@ class CI_DB_oci8_driver extends CI_DB {
{
if (strpos($item, '.'.$id) !== FALSE)
{
- $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item);
-
+ $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item);
+
// remove duplicates if the user already included the escape
return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
- }
+ }
}
-
+
if (strpos($item, '.') !== FALSE)
{
- $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
+ $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
}
else
{
$str = $this->_escape_char.$item.$this->_escape_char;
}
-
+
// remove duplicates if the user already included the escape
return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
}
-
+
// --------------------------------------------------------------------
/**
@@ -616,12 +616,12 @@ class CI_DB_oci8_driver extends CI_DB {
{
$tables = array($tables);
}
-
+
return implode(', ', $tables);
}
// --------------------------------------------------------------------
-
+
/**
* Insert statement
*
@@ -659,17 +659,17 @@ class CI_DB_oci8_driver extends CI_DB {
{
$valstr[] = $key." = ".$val;
}
-
+
$limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
-
+
$orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):'';
-
+
$sql = "UPDATE ".$table." SET ".implode(', ', $valstr);
$sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : '';
$sql .= $orderby.$limit;
-
+
return $sql;
}
@@ -685,12 +685,12 @@ class CI_DB_oci8_driver extends CI_DB {
* @access public
* @param string the table name
* @return string
- */
+ */
function _truncate($table)
{
return "TRUNCATE TABLE ".$table;
}
-
+
// --------------------------------------------------------------------
/**
@@ -703,7 +703,7 @@ class CI_DB_oci8_driver extends CI_DB {
* @param array the where clause
* @param string the limit clause
* @return string
- */
+ */
function _delete($table, $where = array(), $like = array(), $limit = FALSE)
{
$conditions = '';
@@ -721,7 +721,7 @@ class CI_DB_oci8_driver extends CI_DB {
}
$limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
-
+
return "DELETE FROM ".$table.$conditions.$limit;
}
@@ -752,7 +752,7 @@ class CI_DB_oci8_driver extends CI_DB {
$this->limit_used = TRUE;
return $newsql;
- }
+ }
// --------------------------------------------------------------------
diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php
index d77ed8de6..1d369ae32 100644
--- a/system/database/drivers/oci8/oci8_forge.php
+++ b/system/database/drivers/oci8/oci8_forge.php
@@ -66,12 +66,12 @@ class CI_DB_oci8_forge extends CI_DB_forge {
function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists)
{
$sql = 'CREATE TABLE ';
-
+
if ($if_not_exists === TRUE)
{
$sql .= 'IF NOT EXISTS ';
}
-
+
$sql .= $this->db->_escape_identifiers($table)." (";
$current_field_count = 0;
@@ -87,41 +87,41 @@ class CI_DB_oci8_forge extends CI_DB_forge {
else
{
$attributes = array_change_key_case($attributes, CASE_UPPER);
-
+
$sql .= "\n\t".$this->db->_protect_identifiers($field);
-
+
$sql .= ' '.$attributes['TYPE'];
-
+
if (array_key_exists('CONSTRAINT', $attributes))
{
$sql .= '('.$attributes['CONSTRAINT'].')';
}
-
+
if (array_key_exists('UNSIGNED', $attributes) && $attributes['UNSIGNED'] === TRUE)
{
$sql .= ' UNSIGNED';
}
-
+
if (array_key_exists('DEFAULT', $attributes))
{
$sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\'';
}
-
+
if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE)
{
$sql .= ' NULL';
}
else
{
- $sql .= ' NOT NULL';
+ $sql .= ' NOT NULL';
}
-
+
if (array_key_exists('AUTO_INCREMENT', $attributes) && $attributes['AUTO_INCREMENT'] === TRUE)
{
$sql .= ' AUTO_INCREMENT';
}
}
-
+
// don't add a comma on the end of the last field
if (++$current_field_count < count($fields))
{
@@ -141,17 +141,17 @@ class CI_DB_oci8_forge extends CI_DB_forge {
{
if (is_array($key))
{
- $key = $this->db->_protect_identifiers($key);
+ $key = $this->db->_protect_identifiers($key);
}
else
{
$key = array($this->db->_protect_identifiers($key));
}
-
+
$sql .= ",\n\tUNIQUE COLUMNS (" . implode(', ', $key) . ")";
}
}
-
+
$sql .= "\n)";
return $sql;
@@ -218,9 +218,9 @@ class CI_DB_oci8_forge extends CI_DB_forge {
{
$sql .= ' AFTER ' . $this->db->_protect_identifiers($after_field);
}
-
+
return $sql;
-
+
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php
index cab538e21..647ec6e43 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 ExpressionEngine Dev Team
+ * @package CodeIgniter
+ * @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2008 - 2010, EllisLab, Inc.
- * @license http://codeigniter.com/user_guide/license.html
+ * @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
- * @since Version 1.0
+ * @since Version 1.0
* @filesource
*/
@@ -21,7 +21,7 @@
* This class extends the parent result class: CI_DB_result
*
* @category Database
- * @author ExpressionEngine Dev Team
+ * @author ExpressionEngine Dev Team
* @link http://codeigniter.com/user_guide/database/
*/
class CI_DB_oci8_result extends CI_DB_result {
@@ -35,7 +35,7 @@ class CI_DB_oci8_result extends CI_DB_result {
*
* Oracle doesn't have a graceful way to retun the number of rows
* so we have to use what amounts to a hack.
- *
+ *
*
* @access public
* @return integer
@@ -111,7 +111,7 @@ class CI_DB_oci8_result extends CI_DB_result {
$fieldCount = $this->num_fields();
for ($c = 1; $c <= $fieldCount; $c++)
{
- $F = new stdClass();
+ $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);
@@ -128,12 +128,12 @@ class CI_DB_oci8_result extends CI_DB_result {
* Free the result
*
* @return null
- */
+ */
function free_result()
{
if (is_resource($this->result_id))
{
- ocifreestatement($this->result_id);
+ ocifreestatement($this->result_id);
$this->result_id = FALSE;
}
}
@@ -151,8 +151,8 @@ class CI_DB_oci8_result extends CI_DB_result {
function _fetch_assoc(&$row)
{
$id = ($this->curs_id) ? $this->curs_id : $this->stmt_id;
-
- return ocifetchinto($id, $row, OCI_ASSOC + OCI_RETURN_NULLS);
+
+ return ocifetchinto($id, $row, OCI_ASSOC + OCI_RETURN_NULLS);
}
// --------------------------------------------------------------------
@@ -166,17 +166,17 @@ class CI_DB_oci8_result extends CI_DB_result {
* @return object
*/
function _fetch_object()
- {
+ {
$result = array();
// If PHP 5 is being used we can fetch an result object
if (function_exists('oci_fetch_object'))
{
$id = ($this->curs_id) ? $this->curs_id : $this->stmt_id;
-
+
return @oci_fetch_object($id);
}
-
+
// If PHP 4 is being used we have to build our own result
foreach ($this->result_array() as $key => $val)
{
@@ -192,7 +192,7 @@ class CI_DB_oci8_result extends CI_DB_result {
{
$obj->$key = $val;
}
-
+
$result[] = $obj;
}
diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php
index 6e682313f..0e2c7de5f 100644
--- a/system/database/drivers/odbc/odbc_driver.php
+++ b/system/database/drivers/odbc/odbc_driver.php
@@ -31,14 +31,14 @@
class CI_DB_odbc_driver extends CI_DB {
var $dbdriver = 'odbc';
-
+
// the character used to excape - not necessary for ODBC
var $_escape_char = '';
-
+
// clause and character used for LIKE escape sequences
var $_like_escape_str = " {escape '%s'} ";
var $_like_escape_chr = '!';
-
+
/**
* The syntax to count rows is slightly different across different
* database engines, so this string appears in each driver and is
@@ -51,7 +51,7 @@ class CI_DB_odbc_driver extends CI_DB {
function CI_DB_odbc_driver($params)
{
parent::CI_DB($params);
-
+
$this->_random_keyword = ' RND('.time().')'; // database specific random keyword
}
@@ -60,12 +60,12 @@ class CI_DB_odbc_driver extends CI_DB {
*
* @access private called by the base class
* @return resource
- */
+ */
function db_connect()
{
return @odbc_connect($this->hostname, $this->username, $this->password);
}
-
+
// --------------------------------------------------------------------
/**
@@ -73,12 +73,12 @@ class CI_DB_odbc_driver extends CI_DB {
*
* @access private called by the base class
* @return resource
- */
+ */
function db_pconnect()
{
return @odbc_pconnect($this->hostname, $this->username, $this->password);
}
-
+
// --------------------------------------------------------------------
/**
@@ -102,7 +102,7 @@ class CI_DB_odbc_driver extends CI_DB {
*
* @access private called by the base class
* @return resource
- */
+ */
function db_select()
{
// Not needed for ODBC
@@ -126,7 +126,7 @@ class CI_DB_odbc_driver extends CI_DB {
}
// --------------------------------------------------------------------
-
+
/**
* Version number query string
*
@@ -146,13 +146,13 @@ class CI_DB_odbc_driver extends CI_DB {
* @access private called by the base class
* @param string an SQL query
* @return resource
- */
+ */
function _execute($sql)
{
$sql = $this->_prep_query($sql);
return @odbc_exec($this->conn_id, $sql);
}
-
+
// --------------------------------------------------------------------
/**
@@ -163,7 +163,7 @@ class CI_DB_odbc_driver extends CI_DB {
* @access private called by execute()
* @param string an SQL query
* @return string
- */
+ */
function _prep_query($sql)
{
return $sql;
@@ -175,15 +175,15 @@ class CI_DB_odbc_driver extends CI_DB {
* Begin Transaction
*
* @access public
- * @return bool
- */
+ * @return bool
+ */
function trans_begin($test_mode = FALSE)
{
if ( ! $this->trans_enabled)
{
return TRUE;
}
-
+
// When transactions are nested we only begin/commit/rollback the outermost ones
if ($this->_trans_depth > 0)
{
@@ -204,8 +204,8 @@ class CI_DB_odbc_driver extends CI_DB {
* Commit Transaction
*
* @access public
- * @return bool
- */
+ * @return bool
+ */
function trans_commit()
{
if ( ! $this->trans_enabled)
@@ -230,8 +230,8 @@ class CI_DB_odbc_driver extends CI_DB {
* Rollback Transaction
*
* @access public
- * @return bool
- */
+ * @return bool
+ */
function trans_rollback()
{
if ( ! $this->trans_enabled)
@@ -265,16 +265,16 @@ class CI_DB_odbc_driver extends CI_DB {
if (is_array($str))
{
foreach($str as $key => $val)
- {
+ {
$str[$key] = $this->escape_str($val, $like);
- }
-
- return $str;
- }
-
+ }
+
+ return $str;
+ }
+
// ODBC doesn't require escaping
$str = remove_invisible_characters($str);
-
+
// escape LIKE condition wildcards
if ($like === TRUE)
{
@@ -282,10 +282,10 @@ class CI_DB_odbc_driver extends CI_DB {
array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr),
$str);
}
-
+
return $str;
}
-
+
// --------------------------------------------------------------------
/**
@@ -298,7 +298,7 @@ class CI_DB_odbc_driver extends CI_DB {
{
return @odbc_num_rows($this->conn_id);
}
-
+
// --------------------------------------------------------------------
/**
@@ -362,10 +362,10 @@ class CI_DB_odbc_driver extends CI_DB {
//$sql .= " LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr);
return FALSE; // not currently supported
}
-
+
return $sql;
}
-
+
// --------------------------------------------------------------------
/**
@@ -410,7 +410,7 @@ class CI_DB_odbc_driver extends CI_DB {
{
return odbc_errormsg($this->conn_id);
}
-
+
// --------------------------------------------------------------------
/**
@@ -446,26 +446,26 @@ class CI_DB_odbc_driver extends CI_DB {
{
if (strpos($item, '.'.$id) !== FALSE)
{
- $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item);
-
+ $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item);
+
// remove duplicates if the user already included the escape
return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
- }
+ }
}
-
+
if (strpos($item, '.') !== FALSE)
{
- $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
+ $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
}
else
{
$str = $this->_escape_char.$item.$this->_escape_char;
}
-
+
// remove duplicates if the user already included the escape
return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
}
-
+
// --------------------------------------------------------------------
/**
@@ -484,12 +484,12 @@ class CI_DB_odbc_driver extends CI_DB {
{
$tables = array($tables);
}
-
+
return '('.implode(', ', $tables).')';
}
// --------------------------------------------------------------------
-
+
/**
* Insert statement
*
@@ -502,10 +502,10 @@ class CI_DB_odbc_driver extends CI_DB {
* @return string
*/
function _insert($table, $keys, $values)
- {
+ {
return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")";
}
-
+
// --------------------------------------------------------------------
/**
@@ -527,21 +527,21 @@ class CI_DB_odbc_driver extends CI_DB {
{
$valstr[] = $key." = ".$val;
}
-
+
$limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
-
+
$orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):'';
-
+
$sql = "UPDATE ".$table." SET ".implode(', ', $valstr);
$sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : '';
$sql .= $orderby.$limit;
-
+
return $sql;
}
-
+
// --------------------------------------------------------------------
/**
@@ -554,12 +554,12 @@ class CI_DB_odbc_driver extends CI_DB {
* @access public
* @param string the table name
* @return string
- */
+ */
function _truncate($table)
{
return $this->_delete($table);
}
-
+
// --------------------------------------------------------------------
/**
@@ -572,7 +572,7 @@ class CI_DB_odbc_driver extends CI_DB {
* @param array the where clause
* @param string the limit clause
* @return string
- */
+ */
function _delete($table, $where = array(), $like = array(), $limit = FALSE)
{
$conditions = '';
@@ -590,7 +590,7 @@ class CI_DB_odbc_driver extends CI_DB {
}
$limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
-
+
return "DELETE FROM ".$table.$conditions.$limit;
}
@@ -627,7 +627,7 @@ class CI_DB_odbc_driver extends CI_DB {
@odbc_close($conn_id);
}
-
+
}
diff --git a/system/database/drivers/odbc/odbc_forge.php b/system/database/drivers/odbc/odbc_forge.php
index 1ae559b6e..49a2401f1 100644
--- a/system/database/drivers/odbc/odbc_forge.php
+++ b/system/database/drivers/odbc/odbc_forge.php
@@ -54,7 +54,7 @@ class CI_DB_odbc_forge extends CI_DB_forge {
function _drop_database($name)
{
// ODBC has no "drop database" command since it's
- // designed to connect to an existing database
+ // designed to connect to an existing database
if ($this->db->db_debug)
{
return $this->db->display_error('db_unsuported_feature');
@@ -78,12 +78,12 @@ class CI_DB_odbc_forge extends CI_DB_forge {
function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists)
{
$sql = 'CREATE TABLE ';
-
+
if ($if_not_exists === TRUE)
{
$sql .= 'IF NOT EXISTS ';
}
-
+
$sql .= $this->db->_escape_identifiers($table)." (";
$current_field_count = 0;
@@ -99,41 +99,41 @@ class CI_DB_odbc_forge extends CI_DB_forge {
else
{
$attributes = array_change_key_case($attributes, CASE_UPPER);
-
+
$sql .= "\n\t".$this->db->_protect_identifiers($field);
-
+
$sql .= ' '.$attributes['TYPE'];
-
+
if (array_key_exists('CONSTRAINT', $attributes))
{
$sql .= '('.$attributes['CONSTRAINT'].')';
}
-
+
if (array_key_exists('UNSIGNED', $attributes) && $attributes['UNSIGNED'] === TRUE)
{
$sql .= ' UNSIGNED';
}
-
+
if (array_key_exists('DEFAULT', $attributes))
{
$sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\'';
}
-
+
if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE)
{
$sql .= ' NULL';
}
else
{
- $sql .= ' NOT NULL';
+ $sql .= ' NOT NULL';
}
-
+
if (array_key_exists('AUTO_INCREMENT', $attributes) && $attributes['AUTO_INCREMENT'] === TRUE)
{
$sql .= ' AUTO_INCREMENT';
}
}
-
+
// don't add a comma on the end of the last field
if (++$current_field_count < count($fields))
{
@@ -146,24 +146,24 @@ class CI_DB_odbc_forge extends CI_DB_forge {
$primary_keys = $this->db->_protect_identifiers($primary_keys);
$sql .= ",\n\tPRIMARY KEY (" . implode(', ', $primary_keys) . ")";
}
-
+
if (is_array($keys) && count($keys) > 0)
{
foreach ($keys as $key)
{
if (is_array($key))
{
- $key = $this->db->_protect_identifiers($key);
+ $key = $this->db->_protect_identifiers($key);
}
else
{
$key = array($this->db->_protect_identifiers($key));
}
-
+
$sql .= ",\n\tFOREIGN KEY (" . implode(', ', $key) . ")";
}
}
-
+
$sql .= "\n)";
return $sql;
@@ -179,7 +179,7 @@ class CI_DB_odbc_forge extends CI_DB_forge {
*/
function _drop_table($table)
{
- // Not a supported ODBC feature
+ // Not a supported ODBC feature
if ($this->db->db_debug)
{
return $this->db->display_error('db_unsuported_feature');
@@ -235,9 +235,9 @@ class CI_DB_odbc_forge extends CI_DB_forge {
{
$sql .= ' AFTER ' . $this->db->_protect_identifiers($after_field);
}
-
+
return $sql;
-
+
}
diff --git a/system/database/drivers/odbc/odbc_result.php b/system/database/drivers/odbc/odbc_result.php
index 5ae46df62..e2dc8415f 100644
--- a/system/database/drivers/odbc/odbc_result.php
+++ b/system/database/drivers/odbc/odbc_result.php
@@ -25,7 +25,7 @@
* @link http://codeigniter.com/user_guide/database/
*/
class CI_DB_odbc_result extends CI_DB_result {
-
+
/**
* Number of rows in the result set
*
@@ -36,7 +36,7 @@ class CI_DB_odbc_result extends CI_DB_result {
{
return @odbc_num_rows($this->result_id);
}
-
+
// --------------------------------------------------------------------
/**
@@ -65,9 +65,9 @@ class CI_DB_odbc_result extends CI_DB_result {
$field_names = array();
for ($i = 0; $i < $this->num_fields(); $i++)
{
- $field_names[] = odbc_field_name($this->result_id, $i);
+ $field_names[] = odbc_field_name($this->result_id, $i);
}
-
+
return $field_names;
}
@@ -86,16 +86,16 @@ class CI_DB_odbc_result extends CI_DB_result {
$retval = array();
for ($i = 0; $i < $this->num_fields(); $i++)
{
- $F = new stdClass();
- $F->name = odbc_field_name($this->result_id, $i);
- $F->type = odbc_field_type($this->result_id, $i);
+ $F = new stdClass();
+ $F->name = odbc_field_name($this->result_id, $i);
+ $F->type = odbc_field_type($this->result_id, $i);
$F->max_length = odbc_field_len($this->result_id, $i);
$F->primary_key = 0;
$F->default = '';
$retval[] = $F;
}
-
+
return $retval;
}
@@ -105,7 +105,7 @@ class CI_DB_odbc_result extends CI_DB_result {
* Free the result
*
* @return null
- */
+ */
function free_result()
{
if (is_resource($this->result_id))
diff --git a/system/database/drivers/odbc/odbc_utility.php b/system/database/drivers/odbc/odbc_utility.php
index 5b874d88f..deeb0320a 100644
--- a/system/database/drivers/odbc/odbc_utility.php
+++ b/system/database/drivers/odbc/odbc_utility.php
@@ -32,7 +32,7 @@ class CI_DB_odbc_utility extends CI_DB_utility {
*/
function _list_databases()
{
- // Not sure if ODBC lets you list all databases...
+ // Not sure if ODBC lets you list all databases...
if ($this->db->db_debug)
{
return $this->db->display_error('db_unsuported_feature');
@@ -53,7 +53,7 @@ class CI_DB_odbc_utility extends CI_DB_utility {
*/
function _optimize_table($table)
{
- // Not a supported ODBC feature
+ // Not a supported ODBC feature
if ($this->db->db_debug)
{
return $this->db->display_error('db_unsuported_feature');
@@ -74,7 +74,7 @@ class CI_DB_odbc_utility extends CI_DB_utility {
*/
function _repair_table($table)
{
- // Not a supported ODBC feature
+ // Not a supported ODBC feature
if ($this->db->db_debug)
{
return $this->db->display_error('db_unsuported_feature');
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index 9f991e4a0..cf865432b 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -31,7 +31,7 @@
class CI_DB_postgre_driver extends CI_DB {
var $dbdriver = 'postgre';
-
+
var $_escape_char = '"';
// clause and character used for LIKE escape sequences
@@ -51,7 +51,7 @@ class CI_DB_postgre_driver extends CI_DB {
*
* @access private
* @return string
- */
+ */
function _connect_string()
{
$components = array(
@@ -61,7 +61,7 @@ class CI_DB_postgre_driver extends CI_DB {
'username' => 'user',
'password' => 'password'
);
-
+
$connect_string = "";
foreach ($components as $key => $val)
{
@@ -80,9 +80,9 @@ class CI_DB_postgre_driver extends CI_DB {
*
* @access private called by the base class
* @return resource
- */
+ */
function db_connect()
- {
+ {
return @pg_connect($this->_connect_string());
}
@@ -93,12 +93,12 @@ class CI_DB_postgre_driver extends CI_DB {
*
* @access private called by the base class
* @return resource
- */
+ */
function db_pconnect()
{
return @pg_pconnect($this->_connect_string());
}
-
+
// --------------------------------------------------------------------
/**
@@ -125,7 +125,7 @@ class CI_DB_postgre_driver extends CI_DB {
*
* @access private called by the base class
* @return resource
- */
+ */
function db_select()
{
// Not needed for Postgre so we'll return TRUE
@@ -149,7 +149,7 @@ class CI_DB_postgre_driver extends CI_DB {
}
// --------------------------------------------------------------------
-
+
/**
* Version number query string
*
@@ -169,13 +169,13 @@ class CI_DB_postgre_driver extends CI_DB {
* @access private called by the base class
* @param string an SQL query
* @return resource
- */
+ */
function _execute($sql)
{
$sql = $this->_prep_query($sql);
return @pg_query($this->conn_id, $sql);
}
-
+
// --------------------------------------------------------------------
/**
@@ -186,7 +186,7 @@ class CI_DB_postgre_driver extends CI_DB {
* @access private called by execute()
* @param string an SQL query
* @return string
- */
+ */
function _prep_query($sql)
{
return $sql;
@@ -198,15 +198,15 @@ class CI_DB_postgre_driver extends CI_DB {
* Begin Transaction
*
* @access public
- * @return bool
- */
+ * @return bool
+ */
function trans_begin($test_mode = FALSE)
{
if ( ! $this->trans_enabled)
{
return TRUE;
}
-
+
// When transactions are nested we only begin/commit/rollback the outermost ones
if ($this->_trans_depth > 0)
{
@@ -227,8 +227,8 @@ class CI_DB_postgre_driver extends CI_DB {
* Commit Transaction
*
* @access public
- * @return bool
- */
+ * @return bool
+ */
function trans_commit()
{
if ( ! $this->trans_enabled)
@@ -251,8 +251,8 @@ class CI_DB_postgre_driver extends CI_DB {
* Rollback Transaction
*
* @access public
- * @return bool
- */
+ * @return bool
+ */
function trans_rollback()
{
if ( ! $this->trans_enabled)
@@ -284,15 +284,15 @@ class CI_DB_postgre_driver extends CI_DB {
if (is_array($str))
{
foreach($str as $key => $val)
- {
+ {
$str[$key] = $this->escape_str($val, $like);
- }
-
- return $str;
- }
+ }
+
+ return $str;
+ }
$str = pg_escape_string($str);
-
+
// escape LIKE condition wildcards
if ($like === TRUE)
{
@@ -300,10 +300,10 @@ class CI_DB_postgre_driver extends CI_DB {
array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr),
$str);
}
-
+
return $str;
}
-
+
// --------------------------------------------------------------------
/**
@@ -316,7 +316,7 @@ class CI_DB_postgre_driver extends CI_DB {
{
return @pg_affected_rows($this->result_id);
}
-
+
// --------------------------------------------------------------------
/**
@@ -329,10 +329,10 @@ class CI_DB_postgre_driver extends CI_DB {
{
$v = $this->_version();
$v = $v['server'];
-
+
$table = func_num_args() > 0 ? func_get_arg(0) : null;
$column = func_num_args() > 1 ? func_get_arg(1) : null;
-
+
if ($table == null && $v >= '8.1')
{
$sql='SELECT LASTVAL() as ins_id';
@@ -400,17 +400,17 @@ class CI_DB_postgre_driver extends CI_DB {
* @return string
*/
function _list_tables($prefix_limit = FALSE)
- {
- $sql = "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'";
-
+ {
+ $sql = "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'";
+
if ($prefix_limit !== FALSE AND $this->dbprefix != '')
{
$sql .= " AND table_name LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr);
}
-
+
return $sql;
}
-
+
// --------------------------------------------------------------------
/**
@@ -455,7 +455,7 @@ class CI_DB_postgre_driver extends CI_DB {
{
return pg_last_error($this->conn_id);
}
-
+
// --------------------------------------------------------------------
/**
@@ -491,26 +491,26 @@ class CI_DB_postgre_driver extends CI_DB {
{
if (strpos($item, '.'.$id) !== FALSE)
{
- $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item);
-
+ $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item);
+
// remove duplicates if the user already included the escape
return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
- }
+ }
}
-
+
if (strpos($item, '.') !== FALSE)
{
- $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
+ $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
}
else
{
$str = $this->_escape_char.$item.$this->_escape_char;
}
-
+
// remove duplicates if the user already included the escape
return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
}
-
+
// --------------------------------------------------------------------
/**
@@ -529,12 +529,12 @@ class CI_DB_postgre_driver extends CI_DB {
{
$tables = array($tables);
}
-
+
return implode(', ', $tables);
}
// --------------------------------------------------------------------
-
+
/**
* Insert statement
*
@@ -547,10 +547,10 @@ class CI_DB_postgre_driver extends CI_DB {
* @return string
*/
function _insert($table, $keys, $values)
- {
+ {
return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")";
}
-
+
// --------------------------------------------------------------------
/**
@@ -572,17 +572,17 @@ class CI_DB_postgre_driver extends CI_DB {
{
$valstr[] = $key." = ".$val;
}
-
+
$limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
-
+
$orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):'';
-
+
$sql = "UPDATE ".$table." SET ".implode(', ', $valstr);
$sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : '';
$sql .= $orderby.$limit;
-
+
return $sql;
}
@@ -598,12 +598,12 @@ class CI_DB_postgre_driver extends CI_DB {
* @access public
* @param string the table name
* @return string
- */
+ */
function _truncate($table)
{
return "TRUNCATE ".$table;
}
-
+
// --------------------------------------------------------------------
/**
@@ -616,7 +616,7 @@ class CI_DB_postgre_driver extends CI_DB {
* @param array the where clause
* @param string the limit clause
* @return string
- */
+ */
function _delete($table, $where = array(), $like = array(), $limit = FALSE)
{
$conditions = '';
@@ -634,7 +634,7 @@ class CI_DB_postgre_driver extends CI_DB {
}
$limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
-
+
return "DELETE FROM ".$table.$conditions.$limit;
}
@@ -651,14 +651,14 @@ class CI_DB_postgre_driver extends CI_DB {
* @return string
*/
function _limit($sql, $limit, $offset)
- {
+ {
$sql .= "LIMIT ".$limit;
-
+
if ($offset > 0)
{
$sql .= " OFFSET ".$offset;
}
-
+
return $sql;
}
diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php
index c98ef425d..12eef2923 100644
--- a/system/database/drivers/postgre/postgre_forge.php
+++ b/system/database/drivers/postgre/postgre_forge.php
@@ -66,12 +66,12 @@ class CI_DB_postgre_forge extends CI_DB_forge {
function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists)
{
$sql = 'CREATE TABLE ';
-
+
if ($if_not_exists === TRUE)
{
$sql .= 'IF NOT EXISTS ';
}
-
+
$sql .= $this->db->_escape_identifiers($table)." (";
$current_field_count = 0;
@@ -87,41 +87,41 @@ class CI_DB_postgre_forge extends CI_DB_forge {
else
{
$attributes = array_change_key_case($attributes, CASE_UPPER);
-
+
$sql .= "\n\t".$this->db->_protect_identifiers($field);
-
+
$sql .= ' '.$attributes['TYPE'];
-
+
if (array_key_exists('CONSTRAINT', $attributes))
{
$sql .= '('.$attributes['CONSTRAINT'].')';
}
-
+
if (array_key_exists('UNSIGNED', $attributes) && $attributes['UNSIGNED'] === TRUE)
{
$sql .= ' UNSIGNED';
}
-
+
if (array_key_exists('DEFAULT', $attributes))
{
$sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\'';
}
-
+
if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE)
{
$sql .= ' NULL';
}
else
{
- $sql .= ' NOT NULL';
+ $sql .= ' NOT NULL';
}
-
+
if (array_key_exists('AUTO_INCREMENT', $attributes) && $attributes['AUTO_INCREMENT'] === TRUE)
{
$sql .= ' AUTO_INCREMENT';
}
}
-
+
// don't add a comma on the end of the last field
if (++$current_field_count < count($fields))
{
@@ -134,20 +134,20 @@ class CI_DB_postgre_forge extends CI_DB_forge {
$primary_keys = $this->db->_protect_identifiers($primary_keys);
$sql .= ",\n\tPRIMARY KEY (" . implode(', ', $primary_keys) . ")";
}
-
+
if (is_array($keys) && count($keys) > 0)
{
foreach ($keys as $key)
{
if (is_array($key))
{
- $key = $this->db->_protect_identifiers($key);
+ $key = $this->db->_protect_identifiers($key);
}
else
{
$key = array($this->db->_protect_identifiers($key));
}
-
+
$sql .= ",\n\tFOREIGN KEY (" . implode(', ', $key) . ")";
}
}
@@ -218,9 +218,9 @@ class CI_DB_postgre_forge extends CI_DB_forge {
{
$sql .= ' AFTER ' . $this->db->_protect_identifiers($after_field);
}
-
+
return $sql;
-
+
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/postgre/postgre_result.php b/system/database/drivers/postgre/postgre_result.php
index 545f413e8..b60ad7dd3 100644
--- a/system/database/drivers/postgre/postgre_result.php
+++ b/system/database/drivers/postgre/postgre_result.php
@@ -36,7 +36,7 @@ class CI_DB_postgre_result extends CI_DB_result {
{
return @pg_num_rows($this->result_id);
}
-
+
// --------------------------------------------------------------------
/**
@@ -67,7 +67,7 @@ class CI_DB_postgre_result extends CI_DB_result {
{
$field_names[] = pg_field_name($this->result_id, $i);
}
-
+
return $field_names;
}
@@ -86,16 +86,16 @@ class CI_DB_postgre_result extends CI_DB_result {
$retval = array();
for ($i = 0; $i < $this->num_fields(); $i++)
{
- $F = new stdClass();
- $F->name = pg_field_name($this->result_id, $i);
- $F->type = pg_field_type($this->result_id, $i);
+ $F = new stdClass();
+ $F->name = pg_field_name($this->result_id, $i);
+ $F->type = pg_field_type($this->result_id, $i);
$F->max_length = pg_field_size($this->result_id, $i);
$F->primary_key = 0;
$F->default = '';
$retval[] = $F;
}
-
+
return $retval;
}
@@ -105,7 +105,7 @@ class CI_DB_postgre_result extends CI_DB_result {
* Free the result
*
* @return null
- */
+ */
function free_result()
{
if (is_resource($this->result_id))
@@ -146,7 +146,7 @@ class CI_DB_postgre_result extends CI_DB_result {
{
return pg_fetch_assoc($this->result_id);
}
-
+
// --------------------------------------------------------------------
/**
@@ -161,7 +161,7 @@ class CI_DB_postgre_result extends CI_DB_result {
{
return pg_fetch_object($this->result_id);
}
-
+
}
diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php
index c08ed2a56..ea0583e9e 100644
--- a/system/database/drivers/sqlite/sqlite_driver.php
+++ b/system/database/drivers/sqlite/sqlite_driver.php
@@ -33,14 +33,14 @@
class CI_DB_sqlite_driver extends CI_DB {
var $dbdriver = 'sqlite';
-
+
// The character used to escape with - not needed for SQLite
var $_escape_char = '';
// clause and character used for LIKE escape sequences
- var $_like_escape_str = " ESCAPE '%s' ";
+ var $_like_escape_str = " ESCAPE '%s' ";
var $_like_escape_chr = '!';
-
+
/**
* The syntax to count rows is slightly different across different
* database engines, so this string appears in each driver and is
@@ -54,24 +54,24 @@ class CI_DB_sqlite_driver extends CI_DB {
*
* @access private called by the base class
* @return resource
- */
+ */
function db_connect()
{
if ( ! $conn_id = @sqlite_open($this->database, FILE_WRITE_MODE, $error))
{
log_message('error', $error);
-
+
if ($this->db_debug)
{
$this->display_error($error, '', TRUE);
}
-
+
return FALSE;
}
-
+
return $conn_id;
}
-
+
// --------------------------------------------------------------------
/**
@@ -79,24 +79,24 @@ class CI_DB_sqlite_driver extends CI_DB {
*
* @access private called by the base class
* @return resource
- */
+ */
function db_pconnect()
{
if ( ! $conn_id = @sqlite_popen($this->database, FILE_WRITE_MODE, $error))
{
log_message('error', $error);
-
+
if ($this->db_debug)
{
$this->display_error($error, '', TRUE);
}
-
+
return FALSE;
}
-
+
return $conn_id;
}
-
+
// --------------------------------------------------------------------
/**
@@ -120,7 +120,7 @@ class CI_DB_sqlite_driver extends CI_DB {
*
* @access private called by the base class
* @return resource
- */
+ */
function db_select()
{
return TRUE;
@@ -143,7 +143,7 @@ class CI_DB_sqlite_driver extends CI_DB {
}
// --------------------------------------------------------------------
-
+
/**
* Version number query string
*
@@ -154,7 +154,7 @@ class CI_DB_sqlite_driver extends CI_DB {
{
return sqlite_libversion();
}
-
+
// --------------------------------------------------------------------
/**
@@ -163,13 +163,13 @@ class CI_DB_sqlite_driver extends CI_DB {
* @access private called by the base class
* @param string an SQL query
* @return resource
- */
+ */
function _execute($sql)
{
$sql = $this->_prep_query($sql);
return @sqlite_query($this->conn_id, $sql);
}
-
+
// --------------------------------------------------------------------
/**
@@ -180,7 +180,7 @@ class CI_DB_sqlite_driver extends CI_DB {
* @access private called by execute()
* @param string an SQL query
* @return string
- */
+ */
function _prep_query($sql)
{
return $sql;
@@ -192,15 +192,15 @@ class CI_DB_sqlite_driver extends CI_DB {
* Begin Transaction
*
* @access public
- * @return bool
- */
+ * @return bool
+ */
function trans_begin($test_mode = FALSE)
{
if ( ! $this->trans_enabled)
{
return TRUE;
}
-
+
// When transactions are nested we only begin/commit/rollback the outermost ones
if ($this->_trans_depth > 0)
{
@@ -222,8 +222,8 @@ class CI_DB_sqlite_driver extends CI_DB {
* Commit Transaction
*
* @access public
- * @return bool
- */
+ * @return bool
+ */
function trans_commit()
{
if ( ! $this->trans_enabled)
@@ -247,8 +247,8 @@ class CI_DB_sqlite_driver extends CI_DB {
* Rollback Transaction
*
* @access public
- * @return bool
- */
+ * @return bool
+ */
function trans_rollback()
{
if ( ! $this->trans_enabled)
@@ -265,7 +265,7 @@ class CI_DB_sqlite_driver extends CI_DB {
$this->simple_query('ROLLBACK');
return TRUE;
}
-
+
// --------------------------------------------------------------------
/**
@@ -281,15 +281,15 @@ class CI_DB_sqlite_driver extends CI_DB {
if (is_array($str))
{
foreach($str as $key => $val)
- {
+ {
$str[$key] = $this->escape_str($val, $like);
- }
-
- return $str;
- }
-
+ }
+
+ return $str;
+ }
+
$str = sqlite_escape_string($str);
-
+
// escape LIKE condition wildcards
if ($like === TRUE)
{
@@ -297,10 +297,10 @@ class CI_DB_sqlite_driver extends CI_DB {
array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr),
$str);
}
-
+
return $str;
}
-
+
// --------------------------------------------------------------------
/**
@@ -313,7 +313,7 @@ class CI_DB_sqlite_driver extends CI_DB {
{
return sqlite_changes($this->conn_id);
}
-
+
// --------------------------------------------------------------------
/**
@@ -347,7 +347,7 @@ class CI_DB_sqlite_driver extends CI_DB {
}
$query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE));
-
+
if ($query->num_rows() == 0)
{
return 0;
@@ -424,7 +424,7 @@ class CI_DB_sqlite_driver extends CI_DB {
{
return sqlite_error_string(sqlite_last_error($this->conn_id));
}
-
+
// --------------------------------------------------------------------
/**
@@ -460,26 +460,26 @@ class CI_DB_sqlite_driver extends CI_DB {
{
if (strpos($item, '.'.$id) !== FALSE)
{
- $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item);
-
+ $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item);
+
// remove duplicates if the user already included the escape
return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
- }
+ }
}
-
+
if (strpos($item, '.') !== FALSE)
{
- $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
+ $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
}
else
{
$str = $this->_escape_char.$item.$this->_escape_char;
}
-
+
// remove duplicates if the user already included the escape
return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
}
-
+
// --------------------------------------------------------------------
/**
@@ -498,12 +498,12 @@ class CI_DB_sqlite_driver extends CI_DB {
{
$tables = array($tables);
}
-
+
return '('.implode(', ', $tables).')';
}
// --------------------------------------------------------------------
-
+
/**
* Insert statement
*
@@ -516,10 +516,10 @@ class CI_DB_sqlite_driver extends CI_DB {
* @return string
*/
function _insert($table, $keys, $values)
- {
+ {
return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")";
}
-
+
// --------------------------------------------------------------------
/**
@@ -541,21 +541,21 @@ class CI_DB_sqlite_driver extends CI_DB {
{
$valstr[] = $key." = ".$val;
}
-
+
$limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
-
+
$orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):'';
-
+
$sql = "UPDATE ".$table." SET ".implode(', ', $valstr);
$sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : '';
$sql .= $orderby.$limit;
-
+
return $sql;
}
-
+
// --------------------------------------------------------------------
/**
@@ -568,12 +568,12 @@ class CI_DB_sqlite_driver extends CI_DB {
* @access public
* @param string the table name
* @return string
- */
+ */
function _truncate($table)
{
return $this->_delete($table);
}
-
+
// --------------------------------------------------------------------
/**
@@ -586,7 +586,7 @@ class CI_DB_sqlite_driver extends CI_DB {
* @param array the where clause
* @param string the limit clause
* @return string
- */
+ */
function _delete($table, $where = array(), $like = array(), $limit = FALSE)
{
$conditions = '';
@@ -604,10 +604,10 @@ class CI_DB_sqlite_driver extends CI_DB {
}
$limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
-
+
return "DELETE FROM ".$table.$conditions.$limit;
}
-
+
// --------------------------------------------------------------------
/**
@@ -622,7 +622,7 @@ class CI_DB_sqlite_driver extends CI_DB {
* @return string
*/
function _limit($sql, $limit, $offset)
- {
+ {
if ($offset == 0)
{
$offset = '';
@@ -631,7 +631,7 @@ class CI_DB_sqlite_driver extends CI_DB {
{
$offset .= ", ";
}
-
+
return $sql."LIMIT ".$offset.$limit;
}
diff --git a/system/database/drivers/sqlite/sqlite_forge.php b/system/database/drivers/sqlite/sqlite_forge.php
index 53b20a3c7..7b5c894f6 100644
--- a/system/database/drivers/sqlite/sqlite_forge.php
+++ b/system/database/drivers/sqlite/sqlite_forge.php
@@ -75,13 +75,13 @@ class CI_DB_sqlite_forge extends CI_DB_forge {
function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists)
{
$sql = 'CREATE TABLE ';
-
+
// IF NOT EXISTS added to SQLite in 3.3.0
if ($if_not_exists === TRUE && version_compare($this->db->_version(), '3.3.0', '>=') === TRUE)
{
$sql .= 'IF NOT EXISTS ';
}
-
+
$sql .= $this->db->_escape_identifiers($table)."(";
$current_field_count = 0;
@@ -97,41 +97,41 @@ class CI_DB_sqlite_forge extends CI_DB_forge {
else
{
$attributes = array_change_key_case($attributes, CASE_UPPER);
-
+
$sql .= "\n\t".$this->db->_protect_identifiers($field);
-
+
$sql .= ' '.$attributes['TYPE'];
-
+
if (array_key_exists('CONSTRAINT', $attributes))
{
$sql .= '('.$attributes['CONSTRAINT'].')';
}
-
+
if (array_key_exists('UNSIGNED', $attributes) && $attributes['UNSIGNED'] === TRUE)
{
$sql .= ' UNSIGNED';
}
-
+
if (array_key_exists('DEFAULT', $attributes))
{
$sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\'';
}
-
+
if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE)
{
$sql .= ' NULL';
}
else
{
- $sql .= ' NOT NULL';
+ $sql .= ' NOT NULL';
}
-
+
if (array_key_exists('AUTO_INCREMENT', $attributes) && $attributes['AUTO_INCREMENT'] === TRUE)
{
$sql .= ' AUTO_INCREMENT';
}
}
-
+
// don't add a comma on the end of the last field
if (++$current_field_count < count($fields))
{
@@ -151,13 +151,13 @@ class CI_DB_sqlite_forge extends CI_DB_forge {
{
if (is_array($key))
{
- $key = $this->db->_protect_identifiers($key);
+ $key = $this->db->_protect_identifiers($key);
}
else
{
$key = array($this->db->_protect_identifiers($key));
}
-
+
$sql .= ",\n\tUNIQUE (" . implode(', ', $key) . ")";
}
}
@@ -237,9 +237,9 @@ class CI_DB_sqlite_forge extends CI_DB_forge {
{
$sql .= ' AFTER ' . $this->db->_protect_identifiers($after_field);
}
-
+
return $sql;
-
+
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/sqlite/sqlite_result.php b/system/database/drivers/sqlite/sqlite_result.php
index 7b0631221..fd6d83d0c 100644
--- a/system/database/drivers/sqlite/sqlite_result.php
+++ b/system/database/drivers/sqlite/sqlite_result.php
@@ -25,7 +25,7 @@
* @link http://codeigniter.com/user_guide/database/
*/
class CI_DB_sqlite_result extends CI_DB_result {
-
+
/**
* Number of rows in the result set
*
@@ -36,7 +36,7 @@ class CI_DB_sqlite_result extends CI_DB_result {
{
return @sqlite_num_rows($this->result_id);
}
-
+
// --------------------------------------------------------------------
/**
@@ -67,7 +67,7 @@ class CI_DB_sqlite_result extends CI_DB_result {
{
$field_names[] = sqlite_field_name($this->result_id, $i);
}
-
+
return $field_names;
}
@@ -86,16 +86,16 @@ class CI_DB_sqlite_result extends CI_DB_result {
$retval = array();
for ($i = 0; $i < $this->num_fields(); $i++)
{
- $F = new stdClass();
- $F->name = sqlite_field_name($this->result_id, $i);
- $F->type = 'varchar';
+ $F = new stdClass();
+ $F->name = sqlite_field_name($this->result_id, $i);
+ $F->type = 'varchar';
$F->max_length = 0;
$F->primary_key = 0;
$F->default = '';
$retval[] = $F;
}
-
+
return $retval;
}
@@ -105,7 +105,7 @@ class CI_DB_sqlite_result extends CI_DB_result {
* Free the result
*
* @return null
- */
+ */
function free_result()
{
// Not implemented in SQLite
@@ -142,7 +142,7 @@ class CI_DB_sqlite_result extends CI_DB_result {
{
return sqlite_fetch_array($this->result_id);
}
-
+
// --------------------------------------------------------------------
/**
@@ -168,7 +168,7 @@ class CI_DB_sqlite_result extends CI_DB_result {
return $obj;
} else {
return NULL;
- }
+ }
}
}
diff --git a/system/fonts/texb.ttf b/system/fonts/texb.ttf
index a7aa6469a..6792342a3 100644
--- a/system/fonts/texb.ttf
+++ b/system/fonts/texb.ttf
Binary files differ
diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php
index b7289900f..bd30b7c16 100644
--- a/system/helpers/array_helper.php
+++ b/system/helpers/array_helper.php
@@ -38,7 +38,7 @@
* @param array
* @param mixed
* @return mixed depends on what the array contains
- */
+ */
if ( ! function_exists('element'))
{
function element($item, $array, $default = FALSE)
@@ -49,7 +49,7 @@ if ( ! function_exists('element'))
}
return $array[$item];
- }
+ }
}
// ------------------------------------------------------------------------
@@ -60,7 +60,7 @@ if ( ! function_exists('element'))
* @access public
* @param array
* @return mixed depends on what the array contains
- */
+ */
if ( ! function_exists('random_element'))
{
function random_element($array)
@@ -70,7 +70,7 @@ if ( ! function_exists('random_element'))
return $array;
}
return $array[array_rand($array)];
- }
+ }
}
diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php
index 67db50947..3c80bb756 100644
--- a/system/helpers/captcha_helper.php
+++ b/system/helpers/captcha_helper.php
@@ -40,9 +40,9 @@
if ( ! function_exists('create_captcha'))
{
function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = '')
- {
- $defaults = array('word' => '', 'img_path' => '', 'img_url' => '', 'img_width' => '150', 'img_height' => '30', 'font_path' => '', 'expiration' => 7200);
-
+ {
+ $defaults = array('word' => '', 'img_path' => '', 'img_url' => '', 'img_width' => '150', 'img_height' => '30', 'font_path' => '', 'expiration' => 7200);
+
foreach ($defaults as $key => $val)
{
if ( ! is_array($data))
@@ -53,11 +53,11 @@ if ( ! function_exists('create_captcha'))
}
}
else
- {
+ {
$$key = ( ! isset($data[$key])) ? $val : $data[$key];
}
}
-
+
if ($img_path == '' OR $img_url == '')
{
return FALSE;
@@ -67,45 +67,45 @@ if ( ! function_exists('create_captcha'))
{
return FALSE;
}
-
+
if ( ! is_writable($img_path))
{
return FALSE;
}
-
+
if ( ! extension_loaded('gd'))
{
return FALSE;
- }
-
+ }
+
// -----------------------------------
- // Remove old images
+ // Remove old images
// -----------------------------------
-
+
list($usec, $sec) = explode(" ", microtime());
$now = ((float)$usec + (float)$sec);
-
+
$current_dir = @opendir($img_path);
-
+
while($filename = @readdir($current_dir))
{
if ($filename != "." and $filename != ".." and $filename != "index.html")
{
$name = str_replace(".jpg", "", $filename);
-
+
if (($name + $expiration) < $now)
{
@unlink($img_path.$filename);
}
}
}
-
+
@closedir($current_dir);
// -----------------------------------
// Do we have a "word" yet?
// -----------------------------------
-
+
if ($word == '')
{
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
@@ -115,23 +115,23 @@ if ( ! function_exists('create_captcha'))
{
$str .= substr($pool, mt_rand(0, strlen($pool) -1), 1);
}
-
+
$word = $str;
}
-
+
// -----------------------------------
- // Determine angle and position
+ // Determine angle and position
// -----------------------------------
-
+
$length = strlen($word);
$angle = ($length >= 6) ? rand(-($length-6), ($length-6)) : 0;
- $x_axis = rand(6, (360/$length)-16);
+ $x_axis = rand(6, (360/$length)-16);
$y_axis = ($angle >= 0 ) ? rand($img_height, $img_width) : rand(6, $img_height);
-
+
// -----------------------------------
// Create image
// -----------------------------------
-
+
// PHP.net recommends imagecreatetruecolor(), but it isn't always available
if (function_exists('imagecreatetruecolor'))
{
@@ -141,11 +141,11 @@ if ( ! function_exists('create_captcha'))
{
$im = imagecreate($img_width, $img_height);
}
-
+
// -----------------------------------
// Assign colors
// -----------------------------------
-
+
$bg_color = imagecolorallocate ($im, 255, 255, 255);
$border_color = imagecolorallocate ($im, 153, 102, 102);
$text_color = imagecolorallocate ($im, 204, 153, 153);
@@ -155,13 +155,13 @@ if ( ! function_exists('create_captcha'))
// -----------------------------------
// Create the rectangle
// -----------------------------------
-
+
ImageFilledRectangle($im, 0, 0, $img_width, $img_height, $bg_color);
-
+
// -----------------------------------
// Create the spiral pattern
// -----------------------------------
-
+
$theta = 1;
$thetac = 7;
$radius = 16;
@@ -185,9 +185,9 @@ if ( ! function_exists('create_captcha'))
// -----------------------------------
// Write the text
// -----------------------------------
-
+
$use_font = ($font_path != '' AND file_exists($font_path) AND function_exists('imagettftext')) ? TRUE : FALSE;
-
+
if ($use_font == FALSE)
{
$font_size = 5;
@@ -210,32 +210,32 @@ if ( ! function_exists('create_captcha'))
$x += ($font_size*2);
}
else
- {
+ {
$y = rand($img_height/2, $img_height-3);
imagettftext($im, $font_size, $angle, $x, $y, $text_color, $font_path, substr($word, $i, 1));
$x += $font_size;
}
}
-
+
// -----------------------------------
// Create the border
// -----------------------------------
- imagerectangle($im, 0, 0, $img_width-1, $img_height-1, $border_color);
+ imagerectangle($im, 0, 0, $img_width-1, $img_height-1, $border_color);
// -----------------------------------
// Generate the image
// -----------------------------------
-
+
$img_name = $now.'.jpg';
ImageJPEG($im, $img_path.$img_name);
-
+
$img = "<img src=\"$img_url$img_name\" width=\"$img_width\" height=\"$img_height\" style=\"border:0;\" alt=\" \" />";
-
+
ImageDestroy($im);
-
+
return array('word' => $word, 'time' => $now, 'image' => $img);
}
}
diff --git a/system/helpers/compatibility_helper.php b/system/helpers/compatibility_helper.php
index 4d7d466f5..912eae6e2 100644
--- a/system/helpers/compatibility_helper.php
+++ b/system/helpers/compatibility_helper.php
@@ -20,13 +20,13 @@
*
* This helper contains some functions based on the PEAR PHP_Compat library
* http://pear.php.net/package/PHP_Compat
- *
+ *
* The PEAR compat library is a little bloated and the code doesn't harmonize
* well with CodeIgniter, so those functions have been refactored.
* We cheat a little and use CI's _exception_handler() to output our own PHP errors
* so that the behavior fully mimicks the PHP 5 counterparts. -- Derek Jones
* @PHP4
- *
+ *
* @package CodeIgniter
* @subpackage Helpers
* @category Helpers
@@ -39,7 +39,7 @@
if ( ! defined('PHP_EOL'))
{
define('PHP_EOL', (DIRECTORY_SEPARATOR == '/') ? "\n" : "\r\n");
-}
+}
// ------------------------------------------------------------------------
@@ -83,16 +83,16 @@ if ( ! function_exists('file_put_contents'))
}
$text = '';
-
+
while ( ! feof($data))
{
$text .= fread($data, 4096);
}
-
+
$data = $text;
unset($text);
}
-
+
// strings only please!
if (is_array($data))
{
@@ -108,7 +108,7 @@ if ( ! function_exists('file_put_contents'))
{
$mode = FOPEN_WRITE_CREATE_DESTRUCTIVE;
}
-
+
// Check if we're using the include path
if (($flags & 1) > 0) // 1 = FILE_USE_INCLUDE_PATH flag
{
@@ -118,16 +118,16 @@ if ( ! function_exists('file_put_contents'))
{
$use_include_path = FALSE;
}
-
+
$fp = @fopen($filename, $mode, $use_include_path);
-
+
if ($fp === FALSE)
{
$backtrace = debug_backtrace();
_exception_handler(E_USER_WARNING, 'file_put_contents('.htmlentities($filename).') failed to open stream', $backtrace[0]['file'], $backtrace[0]['line']);
return FALSE;
}
-
+
if (($flags & LOCK_EX) > 0)
{
if ( ! flock($fp, LOCK_EX))
@@ -137,17 +137,17 @@ if ( ! function_exists('file_put_contents'))
return FALSE;
}
}
-
+
// write it
if (($written = @fwrite($fp, $data)) === FALSE)
{
$backtrace = debug_backtrace();
_exception_handler(E_USER_WARNING, 'file_put_contents('.htmlentities($filename).') failed to write to '.htmlentities($filename), $backtrace[0]['file'], $backtrace[0]['line']);
}
-
+
// Close the handle
@fclose($fp);
-
+
// Return length
return $written;
}
@@ -179,7 +179,7 @@ if ( ! function_exists('fputcsv'))
_exception_handler(E_USER_WARNING, 'fputcsv() expects parameter 1 to be stream resource, '.gettype($handle).' given', $backtrace[0]['file'], $backtrace[0]['line']);
return FALSE;
}
-
+
// OK, it is a resource, but is it a stream?
if (get_resource_type($handle) !== 'stream')
{
@@ -187,7 +187,7 @@ if ( ! function_exists('fputcsv'))
_exception_handler(E_USER_WARNING, 'fputcsv() expects parameter 1 to be stream resource, '.get_resource_type($handle).' given', $backtrace[0]['file'], $backtrace[0]['line']);
return FALSE;
}
-
+
// Checking for an array of fields
if ( ! is_array($fields))
{
@@ -195,7 +195,7 @@ if ( ! function_exists('fputcsv'))
_exception_handler(E_USER_WARNING, 'fputcsv() expects parameter 2 to be array, '.gettype($fields).' given', $backtrace[0]['file'], $backtrace[0]['line']);
return FALSE;
}
-
+
// validate delimiter
if (strlen($delimiter) > 1)
{
@@ -203,7 +203,7 @@ if ( ! function_exists('fputcsv'))
$backtrace = debug_backtrace();
_exception_handler(E_NOTICE, 'fputcsv() delimiter must be one character long, "'.htmlentities($delimiter).'" used', $backtrace[0]['file'], $backtrace[0]['line']);
}
-
+
// validate enclosure
if (strlen($enclosure) > 1)
{
@@ -212,9 +212,9 @@ if ( ! function_exists('fputcsv'))
_exception_handler(E_NOTICE, 'fputcsv() enclosure must be one character long, "'.htmlentities($enclosure).'" used', $backtrace[0]['file'], $backtrace[0]['line']);
}
-
+
$out = '';
-
+
foreach ($fields as $cell)
{
$cell = str_replace($enclosure, $enclosure.$enclosure, $cell);
@@ -228,9 +228,9 @@ if ( ! function_exists('fputcsv'))
$out .= $cell.$delimiter;
}
}
-
+
$length = @fwrite($handle, substr($out, 0, -1)."\n");
-
+
return $length;
}
}
@@ -258,33 +258,33 @@ if ( ! function_exists('stripos'))
{
settype($haystack, 'STRING');
}
-
+
if ( ! is_string($haystack))
{
$backtrace = debug_backtrace();
_exception_handler(E_USER_WARNING, 'stripos() expects parameter 1 to be string, '.gettype($haystack).' given', $backtrace[0]['file'], $backtrace[0]['line']);
return FALSE;
}
-
+
if ( ! is_scalar($needle))
{
$backtrace = debug_backtrace();
_exception_handler(E_USER_WARNING, 'stripos() needle is not a string or an integer in '.$backtrace[0]['file'], $backtrace[0]['line']);
return FALSE;
}
-
+
if (is_float($offset))
{
$offset = (int)$offset;
}
-
+
if ( ! is_int($offset) && ! is_bool($offset) && ! is_null($offset))
{
$backtrace = debug_backtrace();
_exception_handler(E_USER_WARNING, 'stripos() expects parameter 3 to be long, '.gettype($offset).' given', $backtrace[0]['file'], $backtrace[0]['line']);
return NULL;
}
-
+
return strpos(strtolower($haystack), strtolower($needle), $offset);
}
}
@@ -314,7 +314,7 @@ if ( ! function_exists('str_ireplace'))
{
return $subject;
}
-
+
// Crazy arguments
if (is_scalar($search) && is_array($replace))
{
@@ -329,7 +329,7 @@ if ( ! function_exists('str_ireplace'))
_exception_handler(E_USER_NOTICE, 'Array to string conversion in '.$backtrace[0]['file'], $backtrace[0]['line']);
}
}
-
+
// Searching for an array
if (is_array($search))
{
@@ -360,28 +360,28 @@ if ( ! function_exists('str_ireplace'))
$search = array((string)$search);
$replace = array((string)$replace);
}
-
+
// Prepare the search array
foreach ($search as $search_key => $search_value)
{
$search[$search_key] = '/'.preg_quote($search_value, '/').'/i';
}
-
+
// Prepare the replace array (escape backreferences)
foreach ($replace as $k => $v)
{
$replace[$k] = str_replace(array(chr(92), '$'), array(chr(92).chr(92), '\$'), $v);
}
-
+
// do the replacement
$result = preg_replace($search, $replace, (array)$subject);
-
+
// Check if subject was initially a string and return it as a string
if ( ! is_array($subject))
{
return current($result);
}
-
+
// Otherwise, just return the array
return $result;
}
@@ -412,19 +412,19 @@ if ( ! function_exists('http_build_query'))
_exception_handler(E_USER_WARNING, 'http_build_query() Parameter 1 expected to be Array or Object. Incorrect value given', $backtrace[0]['file'], $backtrace[0]['line']);
return FALSE;
}
-
+
// Cast it as array
if (is_object($formdata))
{
$formdata = get_object_vars($formdata);
}
-
+
// If the array is empty, return NULL
if (empty($formdata))
{
return NULL;
}
-
+
// Argument separator
if ($separator === NULL)
{
@@ -435,7 +435,7 @@ if ( ! function_exists('http_build_query'))
$separator = '&';
}
}
-
+
// Start building the query
$tmp = array();
@@ -445,36 +445,36 @@ if ( ! function_exists('http_build_query'))
{
continue;
}
-
+
if (is_integer($key) && $numeric_prefix != NULL)
{
$key = $numeric_prefix.$key;
}
-
+
if (is_resource($val))
{
return NULL;
}
-
+
// hand it off to a recursive parser
$tmp[] = _http_build_query_helper($key, $val, $separator);
}
-
+
return implode($separator, $tmp);
}
-
-
+
+
// Helper helper. Remind anyone of college?
// Required to handle recursion in nested arrays.
- //
+ //
// You could shave fractions of fractions of a second by moving where
// the urlencoding takes place, but it's much less intuitive, and if
// your application has 10,000 form fields, well, you have other problems ;)
function _http_build_query_helper($key, $val, $separator = '&')
- {
+ {
if (is_scalar($val))
{
- return urlencode($key).'='.urlencode($val);
+ return urlencode($key).'='.urlencode($val);
}
else
{
@@ -483,13 +483,13 @@ if ( ! function_exists('http_build_query'))
{
$val = get_object_vars($val);
}
-
+
foreach ($val as $k => $v)
{
$tmp[] = _http_build_query_helper($key.'['.$k.']', $v, $separator);
}
}
-
+
return implode($separator, $tmp);
}
}
diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php
index 4be371efe..2821fadb1 100644
--- a/system/helpers/cookie_helper.php
+++ b/system/helpers/cookie_helper.php
@@ -51,7 +51,7 @@ if ( ! function_exists('set_cookie'))
$CI->input->set_cookie($name, $value, $expire, $domain, $path, $prefix);
}
}
-
+
// --------------------------------------------------------------------
/**
@@ -67,14 +67,14 @@ if ( ! function_exists('get_cookie'))
function get_cookie($index = '', $xss_clean = FALSE)
{
$CI =& get_instance();
-
+
$prefix = '';
-
+
if ( ! isset($_COOKIE[$index]) && config_item('cookie_prefix') != '')
{
$prefix = config_item('cookie_prefix');
}
-
+
return $CI->input->cookie($prefix.$index, $xss_clean);
}
}
diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php
index 2c60f0302..e762be007 100644
--- a/system/helpers/date_helper.php
+++ b/system/helpers/date_helper.php
@@ -34,24 +34,24 @@
*
* @access public
* @return integer
- */
+ */
if ( ! function_exists('now'))
{
function now()
{
$CI =& get_instance();
-
+
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));
-
+
if (strlen($system_time) < 10)
{
$system_time = time();
log_message('error', 'The Date class could not set a proper GMT timestamp so the local time() value was used.');
}
-
+
return $system_time;
}
else
@@ -60,7 +60,7 @@ if ( ! function_exists('now'))
}
}
}
-
+
// ------------------------------------------------------------------------
/**
@@ -79,22 +79,22 @@ if ( ! function_exists('now'))
* @param string
* @param integer
* @return integer
- */
+ */
if ( ! function_exists('mdate'))
{
function mdate($datestr = '', $time = '')
{
if ($datestr == '')
return '';
-
+
if ($time == '')
$time = now();
-
+
$datestr = str_replace('%\\', '', preg_replace("/([a-z]+?){1}/i", "\\\\\\1", $datestr));
return date($datestr, $time);
}
}
-
+
// ------------------------------------------------------------------------
/**
@@ -106,7 +106,7 @@ if ( ! function_exists('mdate'))
* @param string the chosen format
* @param integer Unix timestamp
* @return string
- */
+ */
if ( ! function_exists('standard_date'))
{
function standard_date($fmt = 'DATE_RFC822', $time = '')
@@ -127,11 +127,11 @@ if ( ! function_exists('standard_date'))
{
return FALSE;
}
-
+
return mdate($formats[$fmt], $time);
}
}
-
+
// ------------------------------------------------------------------------
/**
@@ -144,7 +144,7 @@ if ( ! function_exists('standard_date'))
* @param integer a number of seconds
* @param integer Unix timestamp
* @return integer
- */
+ */
if ( ! function_exists('timespan'))
{
function timespan($seconds = 1, $time = '')
@@ -156,12 +156,12 @@ if ( ! function_exists('timespan'))
{
$seconds = 1;
}
-
+
if ( ! is_numeric($time))
{
$time = time();
}
-
+
if ($time <= $seconds)
{
$seconds = 1;
@@ -170,85 +170,85 @@ if ( ! function_exists('timespan'))
{
$seconds = $time - $seconds;
}
-
+
$str = '';
$years = floor($seconds / 31536000);
-
+
if ($years > 0)
- {
+ {
$str .= $years.' '.$CI->lang->line((($years > 1) ? 'date_years' : 'date_year')).', ';
- }
-
+ }
+
$seconds -= $years * 31536000;
$months = floor($seconds / 2628000);
-
+
if ($years > 0 OR $months > 0)
{
if ($months > 0)
- {
+ {
$str .= $months.' '.$CI->lang->line((($months > 1) ? 'date_months' : 'date_month')).', ';
- }
-
+ }
+
$seconds -= $months * 2628000;
}
$weeks = floor($seconds / 604800);
-
+
if ($years > 0 OR $months > 0 OR $weeks > 0)
{
if ($weeks > 0)
- {
+ {
$str .= $weeks.' '.$CI->lang->line((($weeks > 1) ? 'date_weeks' : 'date_week')).', ';
}
-
+
$seconds -= $weeks * 604800;
- }
+ }
$days = floor($seconds / 86400);
-
+
if ($months > 0 OR $weeks > 0 OR $days > 0)
{
if ($days > 0)
- {
+ {
$str .= $days.' '.$CI->lang->line((($days > 1) ? 'date_days' : 'date_day')).', ';
}
-
+
$seconds -= $days * 86400;
}
-
+
$hours = floor($seconds / 3600);
-
+
if ($days > 0 OR $hours > 0)
{
if ($hours > 0)
{
$str .= $hours.' '.$CI->lang->line((($hours > 1) ? 'date_hours' : 'date_hour')).', ';
}
-
+
$seconds -= $hours * 3600;
}
-
+
$minutes = floor($seconds / 60);
-
+
if ($days > 0 OR $hours > 0 OR $minutes > 0)
{
if ($minutes > 0)
- {
+ {
$str .= $minutes.' '.$CI->lang->line((($minutes > 1) ? 'date_minutes' : 'date_minute')).', ';
}
-
+
$seconds -= $minutes * 60;
}
-
+
if ($str == '')
{
$str .= $seconds.' '.$CI->lang->line((($seconds > 1) ? 'date_seconds' : 'date_second')).', ';
}
-
+
return substr(trim($str), 0, -1);
}
}
-
+
// ------------------------------------------------------------------------
/**
@@ -261,7 +261,7 @@ if ( ! function_exists('timespan'))
* @param integer a numeric month
* @param integer a numeric year
* @return integer
- */
+ */
if ( ! function_exists('days_in_month'))
{
function days_in_month($month = 0, $year = '')
@@ -270,12 +270,12 @@ if ( ! function_exists('days_in_month'))
{
return 0;
}
-
+
if ( ! is_numeric($year) OR strlen($year) != 4)
{
$year = date('Y');
}
-
+
if ($month == 2)
{
if ($year % 400 == 0 OR ($year % 4 == 0 AND $year % 100 != 0))
@@ -297,18 +297,18 @@ if ( ! function_exists('days_in_month'))
* @access public
* @param integer Unix timestamp
* @return integer
- */
+ */
if ( ! function_exists('local_to_gmt'))
{
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));
}
}
-
+
// ------------------------------------------------------------------------
/**
@@ -323,23 +323,23 @@ if ( ! function_exists('local_to_gmt'))
* @param string timezone
* @param bool whether DST is active
* @return integer
- */
+ */
if ( ! function_exists('gmt_to_local'))
{
function gmt_to_local($time = '', $timezone = 'UTC', $dst = FALSE)
- {
+ {
if ($time == '')
{
return now();
}
-
+
$time += timezones($timezone) * 3600;
if ($dst == TRUE)
{
$time += 3600;
}
-
+
return $time;
}
}
@@ -352,7 +352,7 @@ if ( ! function_exists('gmt_to_local'))
* @access public
* @param integer Unix timestamp
* @return integer
- */
+ */
if ( ! function_exists('mysql_to_unix'))
{
function mysql_to_unix($time = '')
@@ -360,11 +360,11 @@ if ( ! function_exists('mysql_to_unix'))
// We'll remove certain characters for backward compatibility
// since the formatting changed with MySQL 4.1
// YYYY-MM-DD HH:MM:SS
-
+
$time = str_replace('-', '', $time);
$time = str_replace(':', '', $time);
$time = str_replace(' ', '', $time);
-
+
// YYYYMMDDHHMMSS
return mktime(
substr($time, 8, 2),
@@ -376,7 +376,7 @@ if ( ! function_exists('mysql_to_unix'))
);
}
}
-
+
// ------------------------------------------------------------------------
/**
@@ -389,13 +389,13 @@ if ( ! function_exists('mysql_to_unix'))
* @param bool whether to show seconds
* @param string format: us or euro
* @return string
- */
+ */
if ( ! function_exists('unix_to_human'))
{
function unix_to_human($time = '', $seconds = FALSE, $fmt = 'us')
{
$r = date('Y', $time).'-'.date('m', $time).'-'.date('d', $time).' ';
-
+
if ($fmt == 'us')
{
$r .= date('h', $time).':'.date('i', $time);
@@ -404,21 +404,21 @@ if ( ! function_exists('unix_to_human'))
{
$r .= date('H', $time).':'.date('i', $time);
}
-
+
if ($seconds)
{
$r .= ':'.date('s', $time);
}
-
+
if ($fmt == 'us')
{
$r .= ' '.date('A', $time);
}
-
+
return $r;
}
}
-
+
// ------------------------------------------------------------------------
/**
@@ -429,7 +429,7 @@ if ( ! function_exists('unix_to_human'))
* @access public
* @param string format: us or euro
* @return integer
- */
+ */
if ( ! function_exists('human_to_unix'))
{
function human_to_unix($datestr = '')
@@ -438,25 +438,25 @@ if ( ! function_exists('human_to_unix'))
{
return FALSE;
}
-
+
$datestr = trim($datestr);
$datestr = preg_replace("/\040+/", ' ', $datestr);
-
+
if ( ! preg_match('/^[0-9]{2,4}\-[0-9]{1,2}\-[0-9]{1,2}\s[0-9]{1,2}:[0-9]{1,2}(?::[0-9]{1,2})?(?:\s[AP]M)?$/i', $datestr))
{
return FALSE;
}
-
+
$split = explode(' ', $datestr);
$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']);
-
+
$hour = (strlen($ex['0']) == 1) ? '0'.$ex['0'] : $ex['0'];
$min = (strlen($ex['1']) == 1) ? '0'.$ex['1'] : $ex['1'];
@@ -469,25 +469,25 @@ if ( ! function_exists('human_to_unix'))
// Unless specified, seconds get set to zero.
$sec = '00';
}
-
+
if (isset($split['2']))
{
$ampm = strtolower($split['2']);
-
+
if (substr($ampm, 0, 1) == 'p' AND $hour < 12)
$hour = $hour + 12;
-
+
if (substr($ampm, 0, 1) == 'a' AND $hour == 12)
$hour = '00';
-
+
if (strlen($hour) == 1)
$hour = '0'.$hour;
}
-
+
return mktime($hour, $min, $sec, $month, $day, $year);
}
}
-
+
// ------------------------------------------------------------------------
/**
@@ -500,26 +500,26 @@ if ( ! function_exists('human_to_unix'))
* @param string classname
* @param string menu name
* @return string
- */
+ */
if ( ! function_exists('timezone_menu'))
{
function timezone_menu($default = 'UTC', $class = "", $name = 'timezones')
{
$CI =& get_instance();
$CI->lang->load('date');
-
+
if ($default == 'GMT')
$default = 'UTC';
$menu = '<select name="'.$name.'"';
-
+
if ($class != '')
{
$menu .= ' class="'.$class.'"';
}
-
+
$menu .= ">\n";
-
+
foreach (timezones() as $key => $val)
{
$selected = ($default == $key) ? " selected='selected'" : '';
@@ -531,7 +531,7 @@ if ( ! function_exists('timezone_menu'))
return $menu;
}
}
-
+
// ------------------------------------------------------------------------
/**
@@ -543,15 +543,15 @@ if ( ! function_exists('timezone_menu'))
* @access public
* @param string timezone
* @return string
- */
+ */
if ( ! function_exists('timezones'))
{
function timezones($tz = '')
{
// 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,
@@ -593,15 +593,15 @@ if ( ! function_exists('timezones'))
'UP13' => +13,
'UP14' => +14
);
-
+
if ($tz == '')
{
return $zones;
}
-
+
if ($tz == 'GMT')
$tz = 'UTC';
-
+
return ( ! isset($zones[$tz])) ? 0 : $zones[$tz];
}
}
diff --git a/system/helpers/directory_helper.php b/system/helpers/directory_helper.php
index 7de6a3c51..574a5d8b0 100644
--- a/system/helpers/directory_helper.php
+++ b/system/helpers/directory_helper.php
@@ -38,7 +38,7 @@
* @param string path to source
* @param int depth of directories to traverse (0 = fully recursive, 1 = current dir, etc)
* @return array
- */
+ */
if ( ! function_exists('directory_map'))
{
function directory_map($source_dir, $directory_depth = 0, $hidden = FALSE)
@@ -47,8 +47,8 @@ if ( ! function_exists('directory_map'))
{
$filedata = array();
$new_depth = $directory_depth - 1;
- $source_dir = rtrim($source_dir, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
-
+ $source_dir = rtrim($source_dir, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
+
while (FALSE !== ($file = readdir($fp)))
{
// Remove '.', '..', and hidden files [optional]
@@ -66,7 +66,7 @@ if ( ! function_exists('directory_map'))
$filedata[] = $file;
}
}
-
+
closedir($fp);
return $filedata;
}
diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php
index eac024fcb..4a17e519e 100644
--- a/system/helpers/download_helper.php
+++ b/system/helpers/download_helper.php
@@ -36,7 +36,7 @@
* @param string filename
* @param mixed the data to be downloaded
* @return void
- */
+ */
if ( ! function_exists('force_download'))
{
function force_download($filename = '', $data = '')
@@ -52,14 +52,14 @@ if ( ! function_exists('force_download'))
{
return FALSE;
}
-
+
// Grab the file extension
$x = explode('.', $filename);
$extension = end($x);
// Load the mime types
@include(APPPATH.'config/mimes'.EXT);
-
+
// Set a default mime if we can't find it
if ( ! isset($mimes[$extension]))
{
@@ -69,7 +69,7 @@ if ( ! function_exists('force_download'))
{
$mime = (is_array($mimes[$extension])) ? $mimes[$extension][0] : $mimes[$extension];
}
-
+
// Generate the server headers
if (strpos($_SERVER['HTTP_USER_AGENT'], "MSIE") !== FALSE)
{
@@ -90,7 +90,7 @@ if ( ! function_exists('force_download'))
header('Pragma: no-cache');
header("Content-Length: ".strlen($data));
}
-
+
exit($data);
}
}
diff --git a/system/helpers/email_helper.php b/system/helpers/email_helper.php
index 046562a91..7c8a610de 100644
--- a/system/helpers/email_helper.php
+++ b/system/helpers/email_helper.php
@@ -32,7 +32,7 @@
*
* @access public
* @return bool
- */
+ */
if ( ! function_exists('valid_email'))
{
function valid_email($address)
@@ -48,7 +48,7 @@ if ( ! function_exists('valid_email'))
*
* @access public
* @return bool
- */
+ */
if ( ! function_exists('send_email'))
{
function send_email($recipient, $subject = 'Test email', $message = 'Hello World')
diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php
index 448bf275f..c1ac167a0 100644
--- a/system/helpers/file_helper.php
+++ b/system/helpers/file_helper.php
@@ -35,7 +35,7 @@
* @access public
* @param string path to file
* @return string
- */
+ */
if ( ! function_exists('read_file'))
{
function read_file($file)
@@ -44,19 +44,19 @@ if ( ! function_exists('read_file'))
{
return FALSE;
}
-
+
if (function_exists('file_get_contents'))
{
- return file_get_contents($file);
+ return file_get_contents($file);
}
if ( ! $fp = @fopen($file, FOPEN_READ))
{
return FALSE;
}
-
+
flock($fp, LOCK_SH);
-
+
$data = '';
if (filesize($file) > 0)
{
@@ -69,7 +69,7 @@ if ( ! function_exists('read_file'))
return $data;
}
}
-
+
// ------------------------------------------------------------------------
/**
@@ -82,7 +82,7 @@ if ( ! function_exists('read_file'))
* @param string path to file
* @param string file data
* @return bool
- */
+ */
if ( ! function_exists('write_file'))
{
function write_file($path, $data, $mode = FOPEN_WRITE_CREATE_DESTRUCTIVE)
@@ -91,16 +91,16 @@ if ( ! function_exists('write_file'))
{
return FALSE;
}
-
+
flock($fp, LOCK_EX);
fwrite($fp, $data);
flock($fp, LOCK_UN);
- fclose($fp);
+ fclose($fp);
return TRUE;
}
}
-
+
// ------------------------------------------------------------------------
/**
@@ -115,19 +115,19 @@ if ( ! function_exists('write_file'))
* @param string path to file
* @param bool whether to delete any directories found in the path
* @return bool
- */
+ */
if ( ! function_exists('delete_files'))
{
function delete_files($path, $del_dir = FALSE, $level = 0)
- {
+ {
// Trim the trailing slash
$path = rtrim($path, DIRECTORY_SEPARATOR);
-
+
if ( ! $current_dir = @opendir($path))
{
- return FALSE;
+ return FALSE;
}
-
+
while(FALSE !== ($filename = @readdir($current_dir)))
{
if ($filename != "." and $filename != "..")
@@ -138,7 +138,7 @@ if ( ! function_exists('delete_files'))
if (substr($filename, 0, 1) != '.')
{
delete_files($path.DIRECTORY_SEPARATOR.$filename, $del_dir, $level + 1);
- }
+ }
}
else
{
@@ -147,12 +147,12 @@ if ( ! function_exists('delete_files'))
}
}
@closedir($current_dir);
-
+
if ($del_dir == TRUE AND $level > 0)
{
return @rmdir($path);
}
-
+
return TRUE;
}
}
@@ -162,7 +162,7 @@ if ( ! function_exists('delete_files'))
/**
* Get Filenames
*
- * Reads the specified directory and builds an array containing the filenames.
+ * Reads the specified directory and builds an array containing the filenames.
* Any sub-folders contained within the specified path are read as well.
*
* @access public
@@ -170,13 +170,13 @@ if ( ! function_exists('delete_files'))
* @param bool whether to include the path as part of the filename
* @param bool internal variable to determine recursion status - do not use in calls
* @return array
- */
+ */
if ( ! function_exists('get_filenames'))
{
function get_filenames($source_dir, $include_path = FALSE, $_recursion = FALSE)
{
static $_filedata = array();
-
+
if ($fp = @opendir($source_dir))
{
// reset the array and make sure $source_dir has a trailing slash on the initial call
@@ -185,12 +185,12 @@ if ( ! function_exists('get_filenames'))
$_filedata = array();
$source_dir = rtrim(realpath($source_dir), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
}
-
+
while (FALSE !== ($file = readdir($fp)))
{
if (@is_dir($source_dir.$file) && strncmp($file, '.', 1) !== 0)
{
- get_filenames($source_dir.$file.DIRECTORY_SEPARATOR, $include_path, TRUE);
+ get_filenames($source_dir.$file.DIRECTORY_SEPARATOR, $include_path, TRUE);
}
elseif (strncmp($file, '.', 1) !== 0)
{
@@ -211,7 +211,7 @@ if ( ! function_exists('get_filenames'))
/**
* Get Directory File Information
*
- * Reads the specified directory and builds an array containing the filenames,
+ * Reads the specified directory and builds an array containing the filenames,
* filesize, dates, and permissions
*
* Any sub-folders contained within the specified path are read as well.
@@ -221,7 +221,7 @@ if ( ! function_exists('get_filenames'))
* @param bool Look only at the top level directory specified?
* @param bool internal variable to determine recursion status - do not use in calls
* @return array
- */
+ */
if ( ! function_exists('get_dir_file_info'))
{
function get_dir_file_info($source_dir, $top_level_only = TRUE, $_recursion = FALSE)
@@ -243,10 +243,10 @@ if ( ! function_exists('get_dir_file_info'))
{
if (@is_dir($source_dir.$file) AND strncmp($file, '.', 1) !== 0 AND $top_level_only === FALSE)
{
- get_dir_file_info($source_dir.$file.DIRECTORY_SEPARATOR, $top_level_only, TRUE);
- }
- elseif (strncmp($file, '.', 1) !== 0)
- {
+ get_dir_file_info($source_dir.$file.DIRECTORY_SEPARATOR, $top_level_only, TRUE);
+ }
+ elseif (strncmp($file, '.', 1) !== 0)
+ {
$_filedata[$file] = get_file_info($source_dir.$file);
$_filedata[$file]['relative_path'] = $relative_path;
}
@@ -332,7 +332,7 @@ if ( ! function_exists('get_file_info'))
/**
* Get Mime by Extension
*
- * Translates a file extension into a mime type based on config/mimes.php.
+ * Translates a file extension into a mime type based on config/mimes.php.
* Returns FALSE if it can't determine the type, or open the mime config file
*
* Note: this is NOT an accurate way of determining file mime types, and is here strictly as a convenience
@@ -341,7 +341,7 @@ if ( ! function_exists('get_file_info'))
* @access public
* @param string path to file
* @return mixed
- */
+ */
if ( ! function_exists('get_mime_by_extension'))
{
function get_mime_by_extension($file)
@@ -388,11 +388,11 @@ if ( ! function_exists('get_mime_by_extension'))
* @access public
* @param int
* @return string
- */
+ */
if ( ! function_exists('symbolic_permissions'))
{
function symbolic_permissions($perms)
- {
+ {
if (($perms & 0xC000) == 0xC000)
{
$symbolic = 's'; // Socket
@@ -441,7 +441,7 @@ if ( ! function_exists('symbolic_permissions'))
$symbolic .= (($perms & 0x0002) ? 'w' : '-');
$symbolic .= (($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x' ) : (($perms & 0x0200) ? 'T' : '-'));
- return $symbolic;
+ return $symbolic;
}
}
@@ -456,7 +456,7 @@ if ( ! function_exists('symbolic_permissions'))
* @access public
* @param int
* @return string
- */
+ */
if ( ! function_exists('octal_permissions'))
{
function octal_permissions($perms)
diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php
index 42355df42..e722a0758 100644
--- a/system/helpers/form_helper.php
+++ b/system/helpers/form_helper.php
@@ -37,7 +37,7 @@
* @param array a key/value pair of attributes
* @param array a key/value pair hidden data
* @return string
- */
+ */
if ( ! function_exists('form_open'))
{
function form_open($action = '', $attributes = '', $hidden = array())
@@ -52,9 +52,9 @@ if ( ! function_exists('form_open'))
$action = ( strpos($action, '://') === FALSE) ? $CI->config->site_url($action) : $action;
$form = '<form action="'.$action.'"';
-
+
$form .= _attributes_to_string($attributes, TRUE);
-
+
$form .= '>';
// CSRF
@@ -143,7 +143,7 @@ if ( ! function_exists('form_hidden'))
{
foreach ($value as $k => $v)
{
- $k = (is_int($k)) ? '' : $k;
+ $k = (is_int($k)) ? '' : $k;
form_hidden($name.'['.$k.']', $v, TRUE);
}
}
@@ -250,10 +250,10 @@ if ( ! function_exists('form_textarea'))
}
else
{
- $val = $data['value'];
+ $val = $data['value'];
unset($data['value']); // textareas don't use the value attribute
}
-
+
$name = (is_array($data)) ? $data['name'] : $data;
return "<textarea "._parse_form_attributes($data, $defaults).$extra.">".form_prep($val, $name)."</textarea>";
}
@@ -279,7 +279,7 @@ if ( ! function_exists('form_multiselect'))
{
$extra .= ' multiple="multiple"';
}
-
+
return form_dropdown($name, $options, $selected, $extra);
}
}
@@ -414,7 +414,7 @@ if ( ! function_exists('form_radio'))
function form_radio($data = '', $value = '', $checked = FALSE, $extra = '')
{
if ( ! is_array($data))
- {
+ {
$data = array('name' => $data);
}
@@ -435,7 +435,7 @@ if ( ! function_exists('form_radio'))
* @return string
*/
if ( ! function_exists('form_submit'))
-{
+{
function form_submit($data = '', $value = '', $extra = '')
{
$defaults = array('type' => 'submit', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value);
@@ -512,7 +512,7 @@ if ( ! function_exists('form_label'))
if ($id != '')
{
- $label .= " for=\"$id\"";
+ $label .= " for=\"$id\"";
}
if (is_array($attributes) AND count($attributes) > 0)
@@ -610,7 +610,7 @@ if ( ! function_exists('form_prep'))
function form_prep($str = '', $field_name = '')
{
static $prepped_fields = array();
-
+
// if the field name is an array we do this recursively
if (is_array($str))
{
@@ -635,7 +635,7 @@ if ( ! function_exists('form_prep'))
{
return $str;
}
-
+
$str = htmlspecialchars($str);
// In case htmlspecialchars misses these.
@@ -645,7 +645,7 @@ if ( ! function_exists('form_prep'))
{
$prepped_fields[$field_name] = $field_name;
}
-
+
return $str;
}
}
@@ -757,7 +757,7 @@ if ( ! function_exists('set_checkbox'))
$OBJ =& _get_validation_object();
if ($OBJ === FALSE)
- {
+ {
if ( ! isset($_POST[$field]))
{
if (count($_POST) === 0 AND $default == TRUE)
@@ -768,7 +768,7 @@ if ( ! function_exists('set_checkbox'))
}
$field = $_POST[$field];
-
+
if (is_array($field))
{
if ( ! in_array($value, $field))
@@ -823,7 +823,7 @@ if ( ! function_exists('set_radio'))
}
$field = $_POST[$field];
-
+
if (is_array($field))
{
if ( ! in_array($value, $field))
@@ -933,7 +933,7 @@ if ( ! function_exists('_parse_form_attributes'))
}
$att = '';
-
+
foreach ($default as $key => $val)
{
if ($key == 'value')
@@ -978,7 +978,7 @@ if ( ! function_exists('_attributes_to_string'))
return ' '.$attributes;
}
-
+
if (is_object($attributes) AND count($attributes) > 0)
{
$attributes = (array)$attributes;
diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php
index cd7b4ce6b..1c8603dbc 100644
--- a/system/helpers/html_helper.php
+++ b/system/helpers/html_helper.php
@@ -388,9 +388,9 @@ if ( ! function_exists('meta'))
$str = '';
foreach ($name as $meta)
{
- $type = ( ! isset($meta['type']) OR $meta['type'] == 'name') ? 'name' : 'http-equiv';
- $name = ( ! isset($meta['name'])) ? '' : $meta['name'];
- $content = ( ! isset($meta['content'])) ? '' : $meta['content'];
+ $type = ( ! isset($meta['type']) OR $meta['type'] == 'name') ? 'name' : 'http-equiv';
+ $name = ( ! isset($meta['name'])) ? '' : $meta['name'];
+ $content = ( ! isset($meta['content'])) ? '' : $meta['content'];
$newline = ( ! isset($meta['newline'])) ? "\n" : $meta['newline'];
$str .= '<meta '.$type.'="'.$name.'" content="'.$content.'" />'.$newline;
diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php
index c4c530bc5..cd05c8d6d 100644
--- a/system/helpers/inflector_helper.php
+++ b/system/helpers/inflector_helper.php
@@ -36,14 +36,14 @@
* @access public
* @param string
* @return str
- */
+ */
if ( ! function_exists('singular'))
-{
+{
function singular($str)
{
$str = strtolower(trim($str));
$end = substr($str, -3);
-
+
if ($end == 'ies')
{
$str = substr($str, 0, strlen($str)-3).'y';
@@ -55,13 +55,13 @@ if ( ! function_exists('singular'))
else
{
$end = substr($str, -1);
-
+
if ($end == 's')
{
$str = substr($str, 0, strlen($str)-1);
}
}
-
+
return $str;
}
}
@@ -77,9 +77,9 @@ if ( ! function_exists('singular'))
* @param string
* @param bool
* @return str
- */
+ */
if ( ! function_exists('plural'))
-{
+{
function plural($str, $force = FALSE)
{
$str = strtolower(trim($str));
@@ -93,14 +93,14 @@ if ( ! function_exists('plural'))
}
elseif ($end == 'h')
{
- if (substr($str, -2) == 'ch' || substr($str, -2) == 'sh')
- {
- $str .= 'es';
- }
- else
- {
- $str .= 's';
- }
+ if (substr($str, -2) == 'ch' || substr($str, -2) == 'sh')
+ {
+ $str .= 'es';
+ }
+ else
+ {
+ $str .= 's';
+ }
}
elseif ($end == 's')
{
@@ -128,11 +128,11 @@ if ( ! function_exists('plural'))
* @access public
* @param string
* @return str
- */
+ */
if ( ! function_exists('camelize'))
-{
+{
function camelize($str)
- {
+ {
$str = 'x'.strtolower(trim($str));
$str = ucwords(preg_replace('/[\s_]+/', ' ', $str));
return substr(str_replace(' ', '', $str), 1);
@@ -149,7 +149,7 @@ if ( ! function_exists('camelize'))
* @access public
* @param string
* @return str
- */
+ */
if ( ! function_exists('underscore'))
{
function underscore($str)
@@ -168,15 +168,15 @@ if ( ! function_exists('underscore'))
* @access public
* @param string
* @return str
- */
+ */
if ( ! function_exists('humanize'))
-{
+{
function humanize($str)
{
return ucwords(preg_replace('/[_]+/', ' ', strtolower(trim($str))));
}
}
-
+
/* End of file inflector_helper.php */
/* Location: ./system/helpers/inflector_helper.php */ \ No newline at end of file
diff --git a/system/helpers/language_helper.php b/system/helpers/language_helper.php
index 442619c93..c6bbe8636 100644
--- a/system/helpers/language_helper.php
+++ b/system/helpers/language_helper.php
@@ -36,7 +36,7 @@
* @param string the language line
* @param string the id of the form element
* @return string
- */
+ */
if ( ! function_exists('lang'))
{
function lang($line, $id = '')
diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php
index f7979215c..e4535f620 100644
--- a/system/helpers/number_helper.php
+++ b/system/helpers/number_helper.php
@@ -40,23 +40,23 @@ if ( ! function_exists('byte_format'))
{
$CI =& get_instance();
$CI->lang->load('number');
-
- if ($num >= 1000000000000)
+
+ if ($num >= 1000000000000)
{
$num = round($num / 1099511627776, $precision);
$unit = $CI->lang->line('terabyte_abbr');
}
- elseif ($num >= 1000000000)
+ elseif ($num >= 1000000000)
{
$num = round($num / 1073741824, $precision);
$unit = $CI->lang->line('gigabyte_abbr');
}
- elseif ($num >= 1000000)
+ elseif ($num >= 1000000)
{
$num = round($num / 1048576, $precision);
$unit = $CI->lang->line('megabyte_abbr');
}
- elseif ($num >= 1000)
+ elseif ($num >= 1000)
{
$num = round($num / 1024, $precision);
$unit = $CI->lang->line('kilobyte_abbr');
@@ -68,7 +68,7 @@ if ( ! function_exists('byte_format'))
}
return number_format($num, $precision).' '.$unit;
- }
+ }
}
diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php
index 030b6bff1..556e8c9a2 100644
--- a/system/helpers/path_helper.php
+++ b/system/helpers/path_helper.php
@@ -34,7 +34,7 @@
* @param string
* @param bool checks to see if the path exists
* @return string
- */
+ */
if ( ! function_exists('set_realpath'))
{
function set_realpath($path, $check_existance = FALSE)
@@ -44,16 +44,16 @@ if ( ! function_exists('set_realpath'))
{
show_error('The path you submitted must be a local server path, not a URL');
}
-
+
// Resolve the path
if (function_exists('realpath') AND @realpath($path) !== FALSE)
{
$path = realpath($path).'/';
}
-
+
// Add a trailing slash
$path = preg_replace("#([^/])/*$#", "\\1/", $path);
-
+
// Make sure the path exists
if ($check_existance == TRUE)
{
@@ -62,7 +62,7 @@ if ( ! function_exists('set_realpath'))
show_error('Not a valid path: '.$path);
}
}
-
+
return $path;
}
}
diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php
index 63f0e9cdb..08dd48a85 100644
--- a/system/helpers/security_helper.php
+++ b/system/helpers/security_helper.php
@@ -34,7 +34,7 @@
* @param string
* @param bool whether or not the content is an image file
* @return string
- */
+ */
if ( ! function_exists('xss_clean'))
{
function xss_clean($str, $is_image = FALSE)
@@ -52,7 +52,7 @@ if ( ! function_exists('xss_clean'))
* @access public
* @param string
* @return string
- */
+ */
if ( ! function_exists('sanitize_filename'))
{
function sanitize_filename($filename)
@@ -71,7 +71,7 @@ if ( ! function_exists('sanitize_filename'))
* dohash() is now deprecated
*/
if ( ! function_exists('dohash'))
-{
+{
function dohash($str, $type = 'sha1')
{
return do_hash($str, $type);
@@ -86,9 +86,9 @@ if ( ! function_exists('dohash'))
* @access public
* @param string
* @return string
- */
+ */
if ( ! function_exists('do_hash'))
-{
+{
function do_hash($str, $type = 'sha1')
{
if ($type == 'sha1')
@@ -96,7 +96,7 @@ if ( ! function_exists('do_hash'))
if ( ! function_exists('sha1'))
{
if ( ! function_exists('mhash'))
- {
+ {
require_once(BASEPATH.'libraries/Sha1'.EXT);
$SH = new CI_SHA;
return $SH->generate($str);
@@ -109,7 +109,7 @@ if ( ! function_exists('do_hash'))
else
{
return sha1($str);
- }
+ }
}
else
{
@@ -117,7 +117,7 @@ if ( ! function_exists('do_hash'))
}
}
}
-
+
// ------------------------------------------------------------------------
/**
@@ -126,18 +126,18 @@ if ( ! function_exists('do_hash'))
* @access public
* @param string
* @return string
- */
+ */
if ( ! function_exists('strip_image_tags'))
{
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);
-
+
return $str;
}
}
-
+
// ------------------------------------------------------------------------
/**
@@ -146,7 +146,7 @@ if ( ! function_exists('strip_image_tags'))
* @access public
* @param string
* @return string
- */
+ */
if ( ! function_exists('encode_php_tags'))
{
function encode_php_tags($str)
diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php
index b9eb0a23e..3ebb61253 100644
--- a/system/helpers/smiley_helper.php
+++ b/system/helpers/smiley_helper.php
@@ -45,7 +45,7 @@ if ( ! function_exists('smiley_js'))
static $do_setup = TRUE;
$r = '';
-
+
if ($alias != '' && ! is_array($alias))
{
$alias = array($alias => $field_id);
@@ -54,9 +54,9 @@ if ( ! function_exists('smiley_js'))
if ($do_setup === TRUE)
{
$do_setup = FALSE;
-
+
$m = array();
-
+
if (is_array($alias))
{
foreach($alias as $name => $id)
@@ -64,22 +64,22 @@ if ( ! function_exists('smiley_js'))
$m[] = '"'.$name.'" : "'.$id.'"';
}
}
-
+
$m = '{'.implode(',', $m).'}';
-
+
$r .= <<<EOF
var smiley_map = {$m};
function insert_smiley(smiley, field_id) {
var el = document.getElementById(field_id), newStart;
-
+
if ( ! el && smiley_map[field_id]) {
el = document.getElementById(smiley_map[field_id]);
-
+
if ( ! el)
return false;
}
-
+
el.focus();
smiley = " " + smiley;
@@ -110,7 +110,7 @@ EOF;
if ($inline)
{
- return '<script type="text/javascript" charset="utf-8">/*<![CDATA[ */'.$r.'// ]]></script>';
+ return '<script type="text/javascript" charset="utf-8">/*<![CDATA[ */'.$r.'// ]]></script>';
}
else
{
@@ -124,8 +124,8 @@ EOF;
/**
* Get Clickable Smileys
*
- * Returns an array of image tag links that can be clicked to be inserted
- * into a form field.
+ * Returns an array of image tag links that can be clicked to be inserted
+ * into a form field.
*
* @access public
* @param string the URL to the folder containing the smiley images
@@ -136,12 +136,12 @@ if ( ! function_exists('get_clickable_smileys'))
function get_clickable_smileys($image_url, $alias = '', $smileys = NULL)
{
// For backward compatibility with js_insert_smiley
-
+
if (is_array($alias))
{
$smileys = $alias;
}
-
+
if ( ! is_array($smileys))
{
if (FALSE === ($smileys = _get_smiley_array()))
@@ -152,7 +152,7 @@ if ( ! function_exists('get_clickable_smileys'))
// Add a trailing slash to the file path if needed
$image_url = rtrim($image_url, '/').'/';
-
+
$used = array();
foreach ($smileys as $key => $val)
{
@@ -164,12 +164,12 @@ if ( ! function_exists('get_clickable_smileys'))
{
continue;
}
-
- $link[] = "<a href=\"javascript:void(0);\" onclick=\"insert_smiley('".$key."', '".$alias."')\"><img src=\"".$image_url.$smileys[$key][0]."\" width=\"".$smileys[$key][1]."\" height=\"".$smileys[$key][2]."\" alt=\"".$smileys[$key][3]."\" style=\"border:0;\" /></a>";
-
+
+ $link[] = "<a href=\"javascript:void(0);\" onclick=\"insert_smiley('".$key."', '".$alias."')\"><img src=\"".$image_url.$smileys[$key][0]."\" width=\"".$smileys[$key][1]."\" height=\"".$smileys[$key][2]."\" alt=\"".$smileys[$key][3]."\" style=\"border:0;\" /></a>";
+
$used[$smileys[$key][0]] = TRUE;
}
-
+
return $link;
}
}
diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php
index 60f6ed171..544b3b42b 100644
--- a/system/helpers/string_helper.php
+++ b/system/helpers/string_helper.php
@@ -41,12 +41,12 @@
* @access public
* @param string
* @return string
- */
+ */
if ( ! function_exists('trim_slashes'))
{
function trim_slashes($str)
{
- return trim($str, '/');
+ return trim($str, '/');
}
}
@@ -60,13 +60,13 @@ if ( ! function_exists('trim_slashes'))
* @access public
* @param mixed string or array
* @return mixed string or array
- */
+ */
if ( ! function_exists('strip_slashes'))
{
function strip_slashes($str)
{
if (is_array($str))
- {
+ {
foreach ($str as $key => $val)
{
$str[$key] = strip_slashes($val);
@@ -76,7 +76,7 @@ if ( ! function_exists('strip_slashes'))
{
$str = stripslashes($str);
}
-
+
return $str;
}
}
@@ -91,7 +91,7 @@ if ( ! function_exists('strip_slashes'))
* @access public
* @param string
* @return string
- */
+ */
if ( ! function_exists('strip_quotes'))
{
function strip_quotes($str)
@@ -110,11 +110,11 @@ if ( ! function_exists('strip_quotes'))
* @access public
* @param string
* @return string
- */
+ */
if ( ! function_exists('quotes_to_entities'))
{
function quotes_to_entities($str)
- {
+ {
return str_replace(array("\'","\"","'",'"'), array("&#39;","&quot;","&#39;","&quot;"), $str);
}
}
@@ -136,7 +136,7 @@ if ( ! function_exists('quotes_to_entities'))
* @access public
* @param string
* @return string
- */
+ */
if ( ! function_exists('reduce_double_slashes'))
{
function reduce_double_slashes($str)
@@ -163,7 +163,7 @@ if ( ! function_exists('reduce_double_slashes'))
* @param string the character you wish to reduce
* @param bool TRUE/FALSE - whether to trim the character from the beginning/end
* @return string
- */
+ */
if ( ! function_exists('reduce_multiples'))
{
function reduce_multiples($str, $character = ',', $trim = FALSE)
@@ -174,11 +174,11 @@ if ( ! function_exists('reduce_multiples'))
{
$str = trim($str, $character);
}
-
+
return $str;
}
}
-
+
// ------------------------------------------------------------------------
/**
@@ -187,23 +187,23 @@ if ( ! function_exists('reduce_multiples'))
* Useful for generating passwords or hashes.
*
* @access public
- * @param string type of random string. basic, alpha, alunum, numeric, nozero, unique, md5, encrypt and sha1
+ * @param string type of random string. basic, alpha, alunum, numeric, nozero, unique, md5, encrypt and sha1
* @param integer number of characters
* @return string
- */
+ */
if ( ! function_exists('random_string'))
{
function random_string($type = 'alnum', $len = 8)
- {
+ {
switch($type)
{
case 'basic' : return mt_rand();
- break;
+ break;
case 'alnum' :
case 'numeric' :
case 'nozero' :
case 'alpha' :
-
+
switch ($type)
{
case 'alpha' : $pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
@@ -222,20 +222,20 @@ if ( ! function_exists('random_string'))
$str .= substr($pool, mt_rand(0, strlen($pool) -1), 1);
}
return $str;
- break;
- case 'unique' :
- case 'md5' :
-
+ break;
+ case 'unique' :
+ case 'md5' :
+
return md5(uniqid(mt_rand()));
- break;
- case 'encrypt' :
- case 'sha1' :
-
+ break;
+ case 'encrypt' :
+ case 'sha1' :
+
$CI =& get_instance();
$CI->load->helper('security');
-
+
return do_hash(uniqid(mt_rand(), TRUE), 'sha1');
- break;
+ break;
}
}
}
@@ -250,12 +250,12 @@ if ( ! function_exists('random_string'))
* @access public
* @param string (as many parameters as needed)
* @return string
- */
+ */
if ( ! function_exists('alternator'))
{
function alternator()
{
- static $i;
+ static $i;
if (func_num_args() == 0)
{
@@ -276,13 +276,13 @@ if ( ! function_exists('alternator'))
* @param string
* @param integer number of repeats
* @return string
- */
+ */
if ( ! function_exists('repeater'))
{
function repeater($data, $num = 1)
{
return (($num > 0) ? str_repeat($data, $num) : '');
- }
+ }
}
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php
index b85e2aaef..8bc1cd5e5 100644
--- a/system/helpers/text_helper.php
+++ b/system/helpers/text_helper.php
@@ -37,7 +37,7 @@
* @param integer
* @param string the end character. Usually an ellipsis
* @return string
- */
+ */
if ( ! function_exists('word_limiter'))
{
function word_limiter($str, $limit = 100, $end_char = '&#8230;')
@@ -46,18 +46,18 @@ if ( ! function_exists('word_limiter'))
{
return $str;
}
-
+
preg_match('/^\s*+(?:\S++\s*+){1,'.(int) $limit.'}/', $str, $matches);
-
+
if (strlen($str) == strlen($matches[0]))
{
$end_char = '';
}
-
+
return rtrim($matches[0]).$end_char;
}
}
-
+
// ------------------------------------------------------------------------
/**
@@ -71,7 +71,7 @@ if ( ! function_exists('word_limiter'))
* @param integer
* @param string the end character. Usually an ellipsis
* @return string
- */
+ */
if ( ! function_exists('character_limiter'))
{
function character_limiter($str, $n = 500, $end_char = '&#8230;')
@@ -80,28 +80,28 @@ if ( ! function_exists('character_limiter'))
{
return $str;
}
-
+
$str = preg_replace("/\s+/", ' ', str_replace(array("\r\n", "\r", "\n"), ' ', $str));
if (strlen($str) <= $n)
{
return $str;
}
-
+
$out = "";
foreach (explode(' ', trim($str)) as $val)
{
$out .= $val.' ';
-
+
if (strlen($out) >= $n)
{
$out = trim($out);
return (strlen($out) == strlen($str)) ? $out : $out.$end_char;
- }
+ }
}
}
}
-
+
// ------------------------------------------------------------------------
/**
@@ -112,21 +112,21 @@ if ( ! function_exists('character_limiter'))
* @access public
* @param string
* @return string
- */
+ */
if ( ! function_exists('ascii_to_entities'))
{
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)
- {
+ $count = 1;
+ $out = '';
+ $temp = array();
+
+ for ($i = 0, $s = strlen($str); $i < $s; $i++)
+ {
+ $ordinal = ord($str[$i]);
+
+ if ($ordinal < 128)
+ {
/*
If the $temp array has a value but we have moved on, then it seems only
fair that we output that entity and restart $temp before continuing. -Paul
@@ -136,33 +136,33 @@ if ( ! function_exists('ascii_to_entities'))
$out .= '&#'.array_shift($temp).';';
$count = 1;
}
-
+
$out .= $str[$i];
- }
- else
- {
- if (count($temp) == 0)
- {
- $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);
-
- $out .= '&#'.$number.';';
- $count = 1;
- $temp = array();
- }
- }
- }
-
- return $out;
+ }
+ else
+ {
+ if (count($temp) == 0)
+ {
+ $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);
+
+ $out .= '&#'.$number.';';
+ $count = 1;
+ $temp = array();
+ }
+ }
+ }
+
+ return $out;
}
}
-
+
// ------------------------------------------------------------------------
/**
@@ -174,51 +174,51 @@ if ( ! function_exists('ascii_to_entities'))
* @param string
* @param bool
* @return string
- */
+ */
if ( ! function_exists('entities_to_ascii'))
{
function entities_to_ascii($str, $all = TRUE)
{
- if (preg_match_all('/\&#(\d+)\;/', $str, $matches))
- {
- for ($i = 0, $s = count($matches['0']); $i < $s; $i++)
- {
- $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("&amp;", "&lt;", "&gt;", "&quot;", "&apos;", "&#45;"),
- array("&","<",">","\"", "'", "-"),
- $str);
- }
-
- return $str;
+ if (preg_match_all('/\&#(\d+)\;/', $str, $matches))
+ {
+ for ($i = 0, $s = count($matches['0']); $i < $s; $i++)
+ {
+ $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("&amp;", "&lt;", "&gt;", "&quot;", "&apos;", "&#45;"),
+ array("&","<",">","\"", "'", "-"),
+ $str);
+ }
+
+ return $str;
}
}
-
+
// ------------------------------------------------------------------------
/**
@@ -233,7 +233,7 @@ if ( ! function_exists('entities_to_ascii'))
* @param string the array of censoered words
* @param string the optional replacement value
* @return string
- */
+ */
if ( ! function_exists('word_censor'))
{
function word_censor($str, $censored, $replacement = '')
@@ -242,8 +242,8 @@ if ( ! function_exists('word_censor'))
{
return $str;
}
-
- $str = ' '.$str.' ';
+
+ $str = ' '.$str.' ';
// \w, \b and a few others do not match on a unicode character
// set for performance reasons. As a result words like über
@@ -263,10 +263,10 @@ if ( ! function_exists('word_censor'))
}
}
- return trim($str);
+ return trim($str);
}
}
-
+
// ------------------------------------------------------------------------
/**
@@ -277,26 +277,26 @@ if ( ! function_exists('word_censor'))
* @access public
* @param string the text string
* @return string
- */
+ */
if ( ! function_exists('highlight_code'))
{
function highlight_code($str)
- {
+ {
// The highlight string function encodes and highlights
// brackets so we need them to start raw
$str = str_replace(array('&lt;', '&gt;'), array('<', '>'), $str);
-
+
// Replace any existing PHP tags to temporary markers so they don't accidentally
// break the string out of PHP, and thus, thwart the highlighting.
-
- $str = str_replace(array('<?', '?>', '<%', '%>', '\\', '</script>'),
+
+ $str = str_replace(array('<?', '?>', '<%', '%>', '\\', '</script>'),
array('phptagopen', 'phptagclose', 'asptagopen', 'asptagclose', 'backslashtmp', 'scriptclose'), $str);
// The highlight_string function requires that the text be surrounded
// by PHP tags, which we will remove later
$str = '<?php '.$str.' ?>'; // <?
- // All the magic happens here, baby!
+ // All the magic happens here, baby!
$str = highlight_string($str, TRUE);
// Prior to PHP 5, the highligh function used icky <font> tags
@@ -307,20 +307,20 @@ if ( ! function_exists('highlight_code'))
$str = str_replace(array('<font ', '</font>'), array('<span ', '</span>'), $str);
$str = preg_replace('#color="(.*?)"#', 'style="color: \\1"', $str);
}
-
+
// Remove our artificially added PHP, and the syntax highlighting that came with it
$str = preg_replace('/<span style="color: #([A-Z0-9]+)">&lt;\?php(&nbsp;| )/i', '<span style="color: #$1">', $str);
$str = preg_replace('/(<span style="color: #[A-Z0-9]+">.*?)\?&gt;<\/span>\n<\/span>\n<\/code>/is', "$1</span>\n</span>\n</code>", $str);
$str = preg_replace('/<span style="color: #[A-Z0-9]+"\><\/span>/i', '', $str);
-
+
// Replace our markers back to PHP tags.
$str = str_replace(array('phptagopen', 'phptagclose', 'asptagopen', 'asptagclose', 'backslashtmp', 'scriptclose'),
array('&lt;?', '?&gt;', '&lt;%', '%&gt;', '\\', '&lt;/script&gt;'), $str);
-
+
return $str;
}
}
-
+
// ------------------------------------------------------------------------
/**
@@ -334,7 +334,7 @@ if ( ! function_exists('highlight_code'))
* @param string the openging tag to precede the phrase with
* @param string the closing tag to end the phrase with
* @return string
- */
+ */
if ( ! function_exists('highlight_phrase'))
{
function highlight_phrase($str, $phrase, $tag_open = '<strong>', $tag_close = '</strong>')
@@ -343,7 +343,7 @@ if ( ! function_exists('highlight_phrase'))
{
return '';
}
-
+
if ($phrase != '')
{
return preg_replace('/('.preg_quote($phrase, '/').')/i', $tag_open."\\1".$tag_close, $str);
@@ -361,7 +361,7 @@ if ( ! function_exists('highlight_phrase'))
* @access public
* @param string the text string
* @return string
- */
+ */
if ( ! function_exists('convert_accented_characters'))
{
function convert_accented_characters($match)
@@ -370,16 +370,16 @@ if ( ! function_exists('convert_accented_characters'))
{
return $match;
}
-
+
include APPPATH.'config/foreign_chars'.EXT;
-
+
if ( ! isset($foreign_characters))
{
return $match;
}
-
+
$ord = ord($match['1']);
-
+
if (isset($foreign_characters[$ord]))
{
return $foreign_characters[$ord];
@@ -390,7 +390,7 @@ if ( ! function_exists('convert_accented_characters'))
}
}
}
-
+
// ------------------------------------------------------------------------
/**
@@ -404,7 +404,7 @@ if ( ! function_exists('convert_accented_characters'))
* @param string the text string
* @param integer the number of characters to wrap at
* @return string
- */
+ */
if ( ! function_exists('word_wrap'))
{
function word_wrap($str, $charlim = '76')
@@ -412,47 +412,47 @@ if ( ! function_exists('word_wrap'))
// Se the character limit
if ( ! is_numeric($charlim))
$charlim = 76;
-
+
// Reduce multiple spaces
$str = preg_replace("| +|", " ", $str);
-
+
// Standardize newlines
if (strpos($str, "\r") !== FALSE)
{
- $str = str_replace(array("\r\n", "\r"), "\n", $str);
+ $str = str_replace(array("\r\n", "\r"), "\n", $str);
}
-
- // If the current word is surrounded by {unwrap} tags we'll
+
+ // If the current word is surrounded by {unwrap} tags we'll
// strip the entire chunk and replace it with a marker.
$unwrap = array();
if (preg_match_all("|(\{unwrap\}.+?\{/unwrap\})|s", $str, $matches))
{
for ($i = 0; $i < count($matches['0']); $i++)
{
- $unwrap[] = $matches['1'][$i];
+ $unwrap[] = $matches['1'][$i];
$str = str_replace($matches['1'][$i], "{{unwrapped".$i."}}", $str);
}
}
-
- // Use PHP's native function to do the initial wordwrap.
- // We set the cut flag to FALSE so that any individual words that are
+
+ // Use PHP's native function to do the initial wordwrap.
+ // We set the cut flag to FALSE so that any individual words that are
// too long get left alone. In the next step we'll deal with them.
$str = wordwrap($str, $charlim, "\n", FALSE);
-
+
// Split the string into individual lines of text and cycle through them
$output = "";
- foreach (explode("\n", $str) as $line)
+ foreach (explode("\n", $str) as $line)
{
// Is the line within the allowed character count?
// If so we'll join it to the output and continue
if (strlen($line) <= $charlim)
{
- $output .= $line."\n";
+ $output .= $line."\n";
continue;
}
-
+
$temp = '';
- while((strlen($line)) > $charlim)
+ while((strlen($line)) > $charlim)
{
// If the over-length word is a URL we won't wrap it
if (preg_match("!\[url.+\]|://|wwww.!", $line))
@@ -464,12 +464,12 @@ if ( ! function_exists('word_wrap'))
$temp .= substr($line, 0, $charlim-1);
$line = substr($line, $charlim-1);
}
-
- // If $temp contains data it means we had to split up an over-length
+
+ // If $temp contains data it means we had to split up an over-length
// word into smaller chunks so we'll add it back to our current line
if ($temp != '')
{
- $output .= $temp."\n".$line;
+ $output .= $temp."\n".$line;
}
else
{
@@ -481,7 +481,7 @@ if ( ! function_exists('word_wrap'))
// Put our markers back
if (count($unwrap) > 0)
- {
+ {
foreach ($unwrap as $key => $val)
{
$output = str_replace("{{unwrapped".$key."}}", $val, $output);
@@ -491,10 +491,10 @@ if ( ! function_exists('word_wrap'))
// Remove the unwrap tags
$output = str_replace(array('{unwrap}', '{/unwrap}'), '', $output);
- return $output;
+ return $output;
}
}
-
+
// ------------------------------------------------------------------------
/**
@@ -502,10 +502,10 @@ if ( ! function_exists('word_wrap'))
*
* This function will strip tags from a string, split it at its max_length and ellipsize
*
- * @param string string to ellipsize
+ * @param string string to ellipsize
* @param integer max length of string
* @param mixed int (1|0) or float, .5, .2, etc for position to split
- * @param string ellipsis ; Default '...'
+ * @param string ellipsis ; Default '...'
* @return string ellipsized string
*/
if ( ! function_exists('ellipsize'))
@@ -534,7 +534,7 @@ if ( ! function_exists('ellipsize'))
$end = substr($str, -($max_length - strlen($beg)));
}
- return $beg.$ellipsis.$end;
+ return $beg.$ellipsis.$end;
}
}
diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php
index e45480e1a..1a71d1857 100644
--- a/system/helpers/typography_helper.php
+++ b/system/helpers/typography_helper.php
@@ -33,19 +33,19 @@
* @access public
* @param string
* @return string
- */
+ */
if ( ! function_exists('nl2br_except_pre'))
{
function nl2br_except_pre($str)
{
$CI =& get_instance();
-
+
$CI->load->library('typography');
-
+
return $CI->typography->nl2br_except_pre($str);
}
}
-
+
// ------------------------------------------------------------------------
/**
@@ -62,7 +62,7 @@ if ( ! function_exists('auto_typography'))
{
function auto_typography($str, $strip_js_event_handlers = TRUE, $reduce_linebreaks = FALSE)
{
- $CI =& get_instance();
+ $CI =& get_instance();
$CI->load->library('typography');
return $CI->typography->auto_typography($str, $strip_js_event_handlers, $reduce_linebreaks);
}
@@ -84,7 +84,7 @@ if ( ! function_exists('entity_decode'))
{
function entity_decode($str, $charset='UTF-8')
{
- $CI =& get_instance();
+ $CI =& get_instance();
$CI->load->library('security');
return $CI->security->entity_decode($str, $charset);
}
diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php
index dad761145..e59efffec 100644
--- a/system/helpers/url_helper.php
+++ b/system/helpers/url_helper.php
@@ -70,7 +70,7 @@ if ( ! function_exists('base_url'))
/**
* Current URL
*
- * Returns the full URL (including segments) of the page where this
+ * Returns the full URL (including segments) of the page where this
* function is placed
*
* @access public
@@ -224,7 +224,7 @@ if ( ! function_exists('anchor_popup'))
* @access public
* @param string the email address
* @param string the link title
- * @param mixed any attributes
+ * @param mixed any attributes
* @return string
*/
if ( ! function_exists('mailto'))
@@ -254,7 +254,7 @@ if ( ! function_exists('mailto'))
* @access public
* @param string the email address
* @param string the link title
- * @param mixed any attributes
+ * @param mixed any attributes
* @return string
*/
if ( ! function_exists('safe_mailto'))
@@ -320,7 +320,7 @@ if ( ! function_exists('safe_mailto'))
{
$count = ($ordinal < 224) ? 2 : 3;
}
-
+
$temp[] = $ordinal;
if (count($temp) == $count)
{
@@ -369,7 +369,7 @@ if ( ! function_exists('safe_mailto'))
* @access public
* @param string the string
* @param string the type: email, url, or both
- * @param bool whether to create pop-up links
+ * @param bool whether to create pop-up links
* @return string
*/
if ( ! function_exists('auto_link'))
@@ -381,7 +381,7 @@ if ( ! function_exists('auto_link'))
if (preg_match_all("#(^|\s|\()((http(s?)://)|(www\.))(\w+[^\s\)\<]+)#i", $str, $matches))
{
$pop = ($popup == TRUE) ? " target=\"_blank\" " : "";
-
+
for ($i = 0; $i < count($matches['0']); $i++)
{
$period = '';
@@ -390,7 +390,7 @@ if ( ! function_exists('auto_link'))
$period = '.';
$matches['6'][$i] = substr($matches['6'][$i], 0, -1);
}
-
+
$str = str_replace($matches['0'][$i],
$matches['1'][$i].'<a href="http'.
$matches['4'][$i].'://'.
@@ -416,7 +416,7 @@ if ( ! function_exists('auto_link'))
$period = '.';
$matches['3'][$i] = substr($matches['3'][$i], 0, -1);
}
-
+
$str = str_replace($matches['0'][$i], safe_mailto($matches['1'][$i].'@'.$matches['2'][$i].'.'.$matches['3'][$i]).$period, $str);
}
}
@@ -447,7 +447,7 @@ if ( ! function_exists('prep_url'))
}
$url = parse_url($str);
-
+
if ( ! $url OR ! isset($url['scheme']))
{
$str = 'http://'.$str;
@@ -495,7 +495,7 @@ if ( ! function_exists('url_title'))
$replace.'$' => $replace,
'^'.$replace => $replace,
'\.+$' => ''
- );
+ );
$str = strip_tags($str);
@@ -508,7 +508,7 @@ if ( ! function_exists('url_title'))
{
$str = strtolower($str);
}
-
+
return trim(stripslashes($str));
}
}
@@ -535,7 +535,7 @@ if ( ! function_exists('redirect'))
{
$uri = site_url($uri);
}
-
+
switch($method)
{
case 'refresh' : header("Refresh:0;url=".$uri);
diff --git a/system/helpers/xml_helper.php b/system/helpers/xml_helper.php
index 56f5e0112..dcfbbdf74 100644
--- a/system/helpers/xml_helper.php
+++ b/system/helpers/xml_helper.php
@@ -33,36 +33,36 @@
* @access public
* @param string
* @return string
- */
+ */
if ( ! function_exists('xml_convert'))
{
function xml_convert($str, $protect_all = FALSE)
{
$temp = '__TEMP_AMPERSANDS__';
- // Replace entities to temporary markers so that
- // ampersands won't get messed up
+ // Replace entities to temporary markers so that
+ // ampersands won't get messed up
$str = preg_replace("/&#(\d+);/", "$temp\\1;", $str);
-
+
if ($protect_all === TRUE)
{
$str = preg_replace("/&(\w+);/", "$temp\\1;", $str);
}
-
+
$str = str_replace(array("&","<",">","\"", "'", "-"),
array("&amp;", "&lt;", "&gt;", "&quot;", "&apos;", "&#45;"),
$str);
- // Decode the temp markers back to entities
+ // Decode the temp markers back to entities
$str = preg_replace("/$temp(\d+);/","&#\\1;",$str);
-
+
if ($protect_all === TRUE)
{
$str = preg_replace("/$temp(\w+);/","&\\1;", $str);
}
-
+
return $str;
- }
+ }
}
// ------------------------------------------------------------------------
diff --git a/system/language/english/calendar_lang.php b/system/language/english/calendar_lang.php
index e26f84930..3e6312361 100644
--- a/system/language/english/calendar_lang.php
+++ b/system/language/english/calendar_lang.php
@@ -1,19 +1,19 @@
<?php
$lang['cal_su'] = "Su";
-$lang['cal_mo'] = "Mo";
-$lang['cal_tu'] = "Tu";
-$lang['cal_we'] = "We";
-$lang['cal_th'] = "Th";
-$lang['cal_fr'] = "Fr";
-$lang['cal_sa'] = "Sa";
-$lang['cal_sun'] = "Sun";
-$lang['cal_mon'] = "Mon";
-$lang['cal_tue'] = "Tue";
-$lang['cal_wed'] = "Wed";
-$lang['cal_thu'] = "Thu";
-$lang['cal_fri'] = "Fri";
-$lang['cal_sat'] = "Sat";
+$lang['cal_mo'] = "Mo";
+$lang['cal_tu'] = "Tu";
+$lang['cal_we'] = "We";
+$lang['cal_th'] = "Th";
+$lang['cal_fr'] = "Fr";
+$lang['cal_sa'] = "Sa";
+$lang['cal_sun'] = "Sun";
+$lang['cal_mon'] = "Mon";
+$lang['cal_tue'] = "Tue";
+$lang['cal_wed'] = "Wed";
+$lang['cal_thu'] = "Thu";
+$lang['cal_fri'] = "Fri";
+$lang['cal_sat'] = "Sat";
$lang['cal_sunday'] = "Sunday";
$lang['cal_monday'] = "Monday";
$lang['cal_tuesday'] = "Tuesday";
@@ -21,30 +21,30 @@ $lang['cal_wednesday'] = "Wednesday";
$lang['cal_thursday'] = "Thursday";
$lang['cal_friday'] = "Friday";
$lang['cal_saturday'] = "Saturday";
-$lang['cal_jan'] = "Jan";
-$lang['cal_feb'] = "Feb";
-$lang['cal_mar'] = "Mar";
-$lang['cal_apr'] = "Apr";
-$lang['cal_may'] = "May";
-$lang['cal_jun'] = "Jun";
-$lang['cal_jul'] = "Jul";
-$lang['cal_aug'] = "Aug";
-$lang['cal_sep'] = "Sep";
-$lang['cal_oct'] = "Oct";
-$lang['cal_nov'] = "Nov";
-$lang['cal_dec'] = "Dec";
-$lang['cal_january'] = "January";
-$lang['cal_february'] = "February";
-$lang['cal_march'] = "March";
+$lang['cal_jan'] = "Jan";
+$lang['cal_feb'] = "Feb";
+$lang['cal_mar'] = "Mar";
+$lang['cal_apr'] = "Apr";
+$lang['cal_may'] = "May";
+$lang['cal_jun'] = "Jun";
+$lang['cal_jul'] = "Jul";
+$lang['cal_aug'] = "Aug";
+$lang['cal_sep'] = "Sep";
+$lang['cal_oct'] = "Oct";
+$lang['cal_nov'] = "Nov";
+$lang['cal_dec'] = "Dec";
+$lang['cal_january'] = "January";
+$lang['cal_february'] = "February";
+$lang['cal_march'] = "March";
$lang['cal_april'] = "April";
-$lang['cal_mayl'] = "May";
-$lang['cal_june'] = "June";
-$lang['cal_july'] = "July";
+$lang['cal_mayl'] = "May";
+$lang['cal_june'] = "June";
+$lang['cal_july'] = "July";
$lang['cal_august'] = "August";
$lang['cal_september'] = "September";
-$lang['cal_october'] = "October";
+$lang['cal_october'] = "October";
$lang['cal_november'] = "November";
-$lang['cal_december'] = "December";
+$lang['cal_december'] = "December";
/* End of file calendar_lang.php */
diff --git a/system/language/english/form_validation_lang.php b/system/language/english/form_validation_lang.php
index 8a123f4bd..99ed70a5c 100644
--- a/system/language/english/form_validation_lang.php
+++ b/system/language/english/form_validation_lang.php
@@ -1,11 +1,11 @@
<?php
-$lang['required'] = "The %s field is required.";
+$lang['required'] = "The %s field is required.";
$lang['isset'] = "The %s field must have a value.";
$lang['valid_email'] = "The %s field must contain a valid email address.";
-$lang['valid_emails'] = "The %s field must contain all valid email addresses.";
-$lang['valid_url'] = "The %s field must contain a valid URL.";
-$lang['valid_ip'] = "The %s field must contain a valid IP.";
+$lang['valid_emails'] = "The %s field must contain all valid email addresses.";
+$lang['valid_url'] = "The %s field must contain a valid URL.";
+$lang['valid_ip'] = "The %s field must contain a valid IP.";
$lang['min_length'] = "The %s field must be at least %s characters in length.";
$lang['max_length'] = "The %s field can not exceed %s characters in length.";
$lang['exact_length'] = "The %s field must be exactly %s characters in length.";
diff --git a/system/language/english/profiler_lang.php b/system/language/english/profiler_lang.php
index 7876331f9..b6460fb83 100644
--- a/system/language/english/profiler_lang.php
+++ b/system/language/english/profiler_lang.php
@@ -1,6 +1,6 @@
<?php
-$lang['profiler_database'] = 'DATABASE';
+$lang['profiler_database'] = 'DATABASE';
$lang['profiler_controller_info'] = 'CLASS/METHOD';
$lang['profiler_benchmarks'] = 'BENCHMARKS';
$lang['profiler_queries'] = 'QUERIES';
diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php
index 275bf2451..924333faa 100644
--- a/system/libraries/Calendar.php
+++ b/system/libraries/Calendar.php
@@ -33,7 +33,7 @@ class CI_Calendar {
var $local_time;
var $template = '';
var $start_day = 'sunday';
- var $month_type = 'long';
+ var $month_type = 'long';
var $day_type = 'abr';
var $show_next_prev = FALSE;
var $next_prev_url = '';
@@ -46,26 +46,26 @@ class CI_Calendar {
* @access public
*/
function CI_Calendar($config = array())
- {
+ {
$this->CI =& get_instance();
-
+
if ( ! in_array('calendar_lang'.EXT, $this->CI->lang->is_loaded, TRUE))
{
$this->CI->lang->load('calendar');
}
$this->local_time = time();
-
+
if (count($config) > 0)
{
$this->initialize($config);
}
-
+
log_message('debug', "Calendar Class Initialized");
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Initialize the user preferences
*
@@ -74,7 +74,7 @@ class CI_Calendar {
* @access public
* @param array config preferences
* @return void
- */
+ */
function initialize($config = array())
{
foreach ($config as $key => $val)
@@ -85,7 +85,7 @@ class CI_Calendar {
}
}
}
-
+
// --------------------------------------------------------------------
/**
@@ -102,66 +102,66 @@ class CI_Calendar {
// Set and validate the supplied month/year
if ($year == '')
$year = date("Y", $this->local_time);
-
+
if ($month == '')
$month = date("m", $this->local_time);
-
- if (strlen($year) == 1)
+
+ if (strlen($year) == 1)
$year = '200'.$year;
-
- if (strlen($year) == 2)
+
+ if (strlen($year) == 2)
$year = '20'.$year;
- if (strlen($month) == 1)
+ if (strlen($month) == 1)
$month = '0'.$month;
-
+
$adjusted_date = $this->adjust_date($month, $year);
-
+
$month = $adjusted_date['month'];
$year = $adjusted_date['year'];
-
+
// Determine the total days in the month
$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);
$start_day = ( ! isset($start_days[$this->start_day])) ? 0 : $start_days[$this->start_day];
-
+
// Set the starting day number
$local_date = mktime(12, 0, 0, $month, 1, $year);
$date = getdate($local_date);
$day = $start_day + 1 - $date["wday"];
-
+
while ($day > 1)
{
$day -= 7;
}
-
+
// Set the current month/year/day
// We use this to determine the "today" date
$cur_year = date("Y", $this->local_time);
$cur_month = date("m", $this->local_time);
$cur_day = date("j", $this->local_time);
-
+
$is_current_month = ($cur_year == $year AND $cur_month == $month) ? TRUE : FALSE;
-
+
// Generate the template data array
$this->parse_template();
-
- // Begin building the calendar output
+
+ // Begin building the calendar output
$out = $this->temp['table_open'];
- $out .= "\n";
+ $out .= "\n";
- $out .= "\n";
+ $out .= "\n";
$out .= $this->temp['heading_row_start'];
$out .= "\n";
-
+
// "previous" month link
if ($this->show_next_prev == TRUE)
{
// Add a trailing slash to the URL if needed
$this->next_prev_url = preg_replace("/(.+?)\/*$/", "\\1/", $this->next_prev_url);
-
+
$adjusted_date = $this->adjust_date($month - 1, $year);
$out .= str_replace('{previous_url}', $this->next_prev_url.$adjusted_date['year'].'/'.$adjusted_date['month'], $this->temp['heading_previous_cell']);
$out .= "\n";
@@ -169,26 +169,26 @@ class CI_Calendar {
// Heading containing the month/year
$colspan = ($this->show_next_prev == TRUE) ? 5 : 7;
-
+
$this->temp['heading_title_cell'] = str_replace('{colspan}', $colspan, $this->temp['heading_title_cell']);
$this->temp['heading_title_cell'] = str_replace('{heading}', $this->get_month_name($month)."&nbsp;".$year, $this->temp['heading_title_cell']);
-
+
$out .= $this->temp['heading_title_cell'];
$out .= "\n";
// "next" month link
if ($this->show_next_prev == TRUE)
- {
+ {
$adjusted_date = $this->adjust_date($month + 1, $year);
$out .= str_replace('{next_url}', $this->next_prev_url.$adjusted_date['year'].'/'.$adjusted_date['month'], $this->temp['heading_next_cell']);
}
- $out .= "\n";
+ $out .= "\n";
$out .= $this->temp['heading_row_end'];
$out .= "\n";
// Write the cells containing the days of the week
- $out .= "\n";
+ $out .= "\n";
$out .= $this->temp['week_row_start'];
$out .= "\n";
@@ -213,11 +213,11 @@ class CI_Calendar {
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)
- {
+ {
if (isset($data[$day]))
- {
+ {
// Cells with content
$temp = ($is_current_month == TRUE AND $day == $cur_day) ? $this->temp['cal_cell_content_today'] : $this->temp['cal_cell_content'];
$out .= str_replace('{day}', $day, str_replace('{content}', $data[$day], $temp));
@@ -234,22 +234,22 @@ class CI_Calendar {
// Blank cells
$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'];
+
+ $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;
}
-
+
// --------------------------------------------------------------------
/**
@@ -272,9 +272,9 @@ class CI_Calendar {
{
$month_names = array('01' => 'cal_january', '02' => 'cal_february', '03' => 'cal_march', '04' => 'cal_april', '05' => 'cal_mayl', '06' => 'cal_june', '07' => 'cal_july', '08' => 'cal_august', '09' => 'cal_september', '10' => 'cal_october', '11' => 'cal_november', '12' => 'cal_december');
}
-
+
$month = $month_names[$month];
-
+
if ($this->CI->lang->line($month) === FALSE)
{
return ucfirst(str_replace('cal_', '', $month));
@@ -282,7 +282,7 @@ class CI_Calendar {
return $this->CI->lang->line($month);
}
-
+
// --------------------------------------------------------------------
/**
@@ -299,7 +299,7 @@ class CI_Calendar {
{
if ($day_type != '')
$this->day_type = $day_type;
-
+
if ($this->day_type == 'long')
{
$day_names = array('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday');
@@ -312,16 +312,16 @@ class CI_Calendar {
{
$day_names = array('su', 'mo', 'tu', 'we', 'th', 'fr', 'sa');
}
-
+
$days = array();
foreach ($day_names as $val)
- {
+ {
$days[] = ($this->CI->lang->line('cal_'.$val) === FALSE) ? ucfirst($val) : $this->CI->lang->line('cal_'.$val);
}
-
+
return $days;
}
-
+
// --------------------------------------------------------------------
/**
@@ -362,7 +362,7 @@ class CI_Calendar {
return $date;
}
-
+
// --------------------------------------------------------------------
/**
@@ -393,7 +393,7 @@ class CI_Calendar {
return $days_in_month[$month - 1];
}
-
+
// --------------------------------------------------------------------
/**
@@ -407,17 +407,17 @@ class CI_Calendar {
function default_template()
{
return array (
- 'table_open' => '<table border="0" cellpadding="4" cellspacing="0">',
- 'heading_row_start' => '<tr>',
+ 'table_open' => '<table border="0" cellpadding="4" cellspacing="0">',
+ 'heading_row_start' => '<tr>',
'heading_previous_cell' => '<th><a href="{previous_url}">&lt;&lt;</a></th>',
- 'heading_title_cell' => '<th colspan="{colspan}">{heading}</th>',
- 'heading_next_cell' => '<th><a href="{next_url}">&gt;&gt;</a></th>',
- 'heading_row_end' => '</tr>',
- 'week_row_start' => '<tr>',
- 'week_day_cell' => '<td>{week_day}</td>',
- 'week_row_end' => '</tr>',
- 'cal_row_start' => '<tr>',
- 'cal_cell_start' => '<td>',
+ 'heading_title_cell' => '<th colspan="{colspan}">{heading}</th>',
+ 'heading_next_cell' => '<th><a href="{next_url}">&gt;&gt;</a></th>',
+ 'heading_row_end' => '</tr>',
+ 'week_row_start' => '<tr>',
+ 'week_day_cell' => '<td>{week_day}</td>',
+ 'week_row_end' => '</tr>',
+ 'cal_row_start' => '<tr>',
+ 'cal_cell_start' => '<td>',
'cal_cell_start_today' => '<td>',
'cal_cell_content' => '<a href="{content}">{day}</a>',
'cal_cell_content_today' => '<a href="{content}"><strong>{day}</strong></a>',
@@ -428,9 +428,9 @@ class CI_Calendar {
'cal_cell_end_today' => '</td>',
'cal_row_end' => '</tr>',
'table_close' => '</table>'
- );
+ );
}
-
+
// --------------------------------------------------------------------
/**
@@ -442,17 +442,17 @@ class CI_Calendar {
* @access public
* @return void
*/
- function parse_template()
- {
+ function parse_template()
+ {
$this->temp = $this->default_template();
-
- if ($this->template == '')
- {
- return;
- }
-
+
+ if ($this->template == '')
+ {
+ return;
+ }
+
$today = array('cal_cell_start_today', 'cal_cell_content_today', 'cal_cell_no_content_today', 'cal_cell_end_today');
-
+
foreach (array('table_open', 'table_close', 'heading_row_start', 'heading_previous_cell', 'heading_title_cell', 'heading_next_cell', 'heading_row_end', 'week_row_start', 'week_day_cell', 'week_row_end', 'cal_row_start', 'cal_cell_start', 'cal_cell_content', 'cal_cell_no_content', 'cal_cell_blank', 'cal_cell_end', 'cal_row_end', 'cal_cell_start_today', 'cal_cell_content_today', 'cal_cell_no_content_today', 'cal_cell_end_today') as $val)
{
if (preg_match("/\{".$val."\}(.*?)\{\/".$val."\}/si", $this->template, $match))
@@ -466,8 +466,8 @@ class CI_Calendar {
$this->temp[$val] = $this->temp[str_replace('_today', '', $val)];
}
}
- }
- }
+ }
+ }
}
diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php
index 643d2eca4..f3969ef2c 100644
--- a/system/libraries/Cart.php
+++ b/system/libraries/Cart.php
@@ -29,7 +29,7 @@ class CI_Cart {
// These are the regular expression rules that we use to validate the product ID and product name
var $product_id_rules = '\.a-z0-9_-'; // alpha-numeric, dashes, underscores, or periods
var $product_name_rules = '\.\:\-_ a-z0-9'; // alpha-numeric, dashes, underscores, colons or periods
-
+
// Private variables. Do not change!
var $CI;
var $_cart_contents = array();
@@ -39,12 +39,12 @@ class CI_Cart {
* Shopping Class Constructor
*
* The constructor loads the Session class, used to store the shopping cart contents.
- */
+ */
function CI_Cart($params = array())
- {
+ {
// Set the super object to a local variable for use later
$this->CI =& get_instance();
-
+
// Are any config settings being passed manually? If so, set them
$config = array();
if (count($params) > 0)
@@ -54,10 +54,10 @@ class CI_Cart {
$config[$key] = $val;
}
}
-
+
// Load the Sessions class
$this->CI->load->library('session', $config);
-
+
// Grab the shopping cart array from the session table, if it exists
if ($this->CI->session->userdata('cart_contents') !== FALSE)
{
@@ -66,15 +66,15 @@ class CI_Cart {
else
{
// No cart exists so we'll set some base values
- $this->_cart_contents['cart_total'] = 0;
- $this->_cart_contents['total_items'] = 0;
+ $this->_cart_contents['cart_total'] = 0;
+ $this->_cart_contents['total_items'] = 0;
}
-
+
log_message('debug', "Cart Class Initialized");
}
// --------------------------------------------------------------------
-
+
/**
* Insert items into the cart and save it to the session table
*
@@ -90,15 +90,15 @@ class CI_Cart {
log_message('error', 'The insert method must be passed an array containing data.');
return FALSE;
}
-
- // You can either insert a single product using a one-dimensional array,
+
+ // You can either insert a single product using a one-dimensional array,
// or multiple products using a multi-dimensional one. The way we
// determine the array type is by looking for a required array key named "id"
// at the top level. If it's not found, we will assume it's a multi-dimensional array.
-
- $save_cart = FALSE;
+
+ $save_cart = FALSE;
if (isset($items['id']))
- {
+ {
if ($this->_insert($items) == TRUE)
{
$save_cart = TRUE;
@@ -114,7 +114,7 @@ class CI_Cart {
{
$save_cart = TRUE;
}
- }
+ }
}
}
@@ -129,7 +129,7 @@ class CI_Cart {
}
// --------------------------------------------------------------------
-
+
/**
* Insert
*
@@ -145,9 +145,9 @@ class CI_Cart {
log_message('error', 'The insert method must be passed an array containing data.');
return FALSE;
}
-
+
// --------------------------------------------------------------------
-
+
// Does the $items array contain an id, quantity, price, and name? These are required
if ( ! isset($items['id']) OR ! isset($items['qty']) OR ! isset($items['price']) OR ! isset($items['name']))
{
@@ -156,7 +156,7 @@ class CI_Cart {
}
// --------------------------------------------------------------------
-
+
// Prep the quantity. It can only be a number. Duh...
$items['qty'] = trim(preg_replace('/([^0-9])/i', '', $items['qty']));
// Trim any leading zeros
@@ -167,9 +167,9 @@ class CI_Cart {
{
return FALSE;
}
-
+
// --------------------------------------------------------------------
-
+
// Validate the product ID. It can only be alpha-numeric, dashes, underscores or periods
// Not totally sure we should impose this rule, but it seems prudent to standardize IDs.
// Note: These can be user-specified by setting the $this->product_id_rules variable.
@@ -180,7 +180,7 @@ class CI_Cart {
}
// --------------------------------------------------------------------
-
+
// Validate the product name. It can only be alpha-numeric, dashes, underscores, colons or periods.
// Note: These can be user-specified by setting the $this->product_name_rules variable.
if ( ! preg_match("/^[".$this->product_name_rules."]+$/i", $items['name']))
@@ -195,7 +195,7 @@ class CI_Cart {
$items['price'] = trim(preg_replace('/([^0-9\.])/i', '', $items['price']));
// Trim any leading zeros
$items['price'] = trim(preg_replace('/(^[0]+)/i', '', $items['price']));
-
+
// Is the price a valid number?
if ( ! is_numeric($items['price']))
{
@@ -204,13 +204,13 @@ class CI_Cart {
}
// --------------------------------------------------------------------
-
+
// We now need to create a unique identifier for the item being inserted into the cart.
- // Every time something is added to the cart it is stored in the master cart array.
- // Each row in the cart array, however, must have a unique index that identifies not only
- // a particular product, but makes it possible to store identical products with different options.
- // For example, what if someone buys two identical t-shirts (same product ID), but in
- // different sizes? The product ID (and other attributes, like the name) will be identical for
+ // Every time something is added to the cart it is stored in the master cart array.
+ // Each row in the cart array, however, must have a unique index that identifies not only
+ // a particular product, but makes it possible to store identical products with different options.
+ // For example, what if someone buys two identical t-shirts (same product ID), but in
+ // different sizes? The product ID (and other attributes, like the name) will be identical for
// both sizes because it's the same shirt. The only difference will be the size.
// Internally, we need to treat identical submissions, but with different options, as a unique product.
// Our solution is to convert the options array to a string and MD5 it along with the product ID.
@@ -225,19 +225,19 @@ class CI_Cart {
// Technically, we don't need to MD5 the ID in this case, but it makes
// sense to standardize the format of array indexes for both conditions
$rowid = md5($items['id']);
- }
+ }
// --------------------------------------------------------------------
// Now that we have our unique "row ID", we'll add our cart items to the master array
-
+
// let's unset this first, just to make sure our index contains only the data from this submission
- unset($this->_cart_contents[$rowid]);
-
+ unset($this->_cart_contents[$rowid]);
+
// Create a new index with our new row ID
$this->_cart_contents[$rowid]['rowid'] = $rowid;
-
- // And add the new items to the cart array
+
+ // And add the new items to the cart array
foreach ($items as $key => $val)
{
$this->_cart_contents[$rowid][$key] = $val;
@@ -248,11 +248,11 @@ class CI_Cart {
}
// --------------------------------------------------------------------
-
+
/**
* Update the cart
*
- * This function permits the quantity of a given item to be changed.
+ * This function permits the quantity of a given item to be changed.
* Typically it is called from the "view cart" page if a user makes
* changes to the quantity before checkout. That array must contain the
* product ID and quantity for each item.
@@ -269,8 +269,8 @@ class CI_Cart {
{
return FALSE;
}
-
- // You can either update a single product using a one-dimensional array,
+
+ // You can either update a single product using a one-dimensional array,
// or multiple products using a multi-dimensional one. The way we
// determine the array type is by looking for a required array key named "id".
// If it's not found we assume it's a multi-dimensional array
@@ -292,7 +292,7 @@ class CI_Cart {
{
$save_cart = TRUE;
}
- }
+ }
}
}
@@ -307,11 +307,11 @@ class CI_Cart {
}
// --------------------------------------------------------------------
-
+
/**
* Update the cart
*
- * This function permits the quantity of a given item to be changed.
+ * This function permits the quantity of a given item to be changed.
* Typically it is called from the "view cart" page if a user makes
* changes to the quantity before checkout. That array must contain the
* product ID and quantity for each item.
@@ -319,7 +319,7 @@ class CI_Cart {
* @access private
* @param array
* @return bool
- */
+ */
function _update($items = array())
{
// Without these array indexes there is nothing we can do
@@ -327,7 +327,7 @@ class CI_Cart {
{
return FALSE;
}
-
+
// Prep the quantity
$items['qty'] = preg_replace('/([^0-9])/i', '', $items['qty']);
@@ -336,7 +336,7 @@ class CI_Cart {
{
return FALSE;
}
-
+
// Is the new quantity different than what is already saved in the cart?
// If it's the same there's nothing to do
if ($this->_cart_contents[$items['rowid']]['qty'] == $items['qty'])
@@ -348,18 +348,18 @@ class CI_Cart {
// If the quantity is greater than zero we are updating
if ($items['qty'] == 0)
{
- unset($this->_cart_contents[$items['rowid']]);
+ unset($this->_cart_contents[$items['rowid']]);
}
else
{
$this->_cart_contents[$items['rowid']]['qty'] = $items['qty'];
}
-
+
return TRUE;
}
// --------------------------------------------------------------------
-
+
/**
* Save the cart array to the session DB
*
@@ -383,20 +383,20 @@ class CI_Cart {
}
$total += ($val['price'] * $val['qty']);
-
+
// Set the subtotal
$this->_cart_contents[$key]['subtotal'] = ($this->_cart_contents[$key]['price'] * $this->_cart_contents[$key]['qty']);
}
// Set the cart total and total items.
- $this->_cart_contents['total_items'] = count($this->_cart_contents);
+ $this->_cart_contents['total_items'] = count($this->_cart_contents);
$this->_cart_contents['cart_total'] = $total;
-
+
// Is our cart empty? If so we delete it from the session
if (count($this->_cart_contents) <= 2)
{
$this->CI->session->unset_userdata('cart_contents');
-
+
// Nothing more to do... coffee time!
return FALSE;
}
@@ -406,11 +406,11 @@ class CI_Cart {
$this->CI->session->set_userdata(array('cart_contents' => $this->_cart_contents));
// Woot!
- return TRUE;
+ return TRUE;
}
// --------------------------------------------------------------------
-
+
/**
* Cart Total
*
@@ -423,7 +423,7 @@ class CI_Cart {
}
// --------------------------------------------------------------------
-
+
/**
* Total Items
*
@@ -438,7 +438,7 @@ class CI_Cart {
}
// --------------------------------------------------------------------
-
+
/**
* Cart Contents
*
@@ -450,16 +450,16 @@ class CI_Cart {
function contents()
{
$cart = $this->_cart_contents;
-
+
// Remove these so they don't create a problem when showing the cart table
unset($cart['total_items']);
unset($cart['cart_total']);
-
+
return $cart;
}
// --------------------------------------------------------------------
-
+
/**
* Has options
*
@@ -475,12 +475,12 @@ class CI_Cart {
{
return FALSE;
}
-
+
return TRUE;
}
// --------------------------------------------------------------------
-
+
/**
* Product options
*
@@ -500,7 +500,7 @@ class CI_Cart {
}
// --------------------------------------------------------------------
-
+
/**
* Format Number
*
@@ -515,15 +515,15 @@ class CI_Cart {
{
return '';
}
-
+
// Remove anything that isn't a number or decimal point.
$n = trim(preg_replace('/([^0-9\.])/i', '', $n));
-
+
return number_format($n, 2, '.', ',');
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Destroy the cart
*
@@ -535,9 +535,9 @@ class CI_Cart {
function destroy()
{
unset($this->_cart_contents);
-
- $this->_cart_contents['cart_total'] = 0;
- $this->_cart_contents['total_items'] = 0;
+
+ $this->_cart_contents['cart_total'] = 0;
+ $this->_cart_contents['total_items'] = 0;
$this->CI->session->unset_userdata('cart_contents');
}
diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php
index 07ef2e724..1261b4c72 100644
--- a/system/libraries/Driver.php
+++ b/system/libraries/Driver.php
@@ -25,25 +25,25 @@
* @subpackage Libraries
* @category Libraries
* @author EllisLab Dev Team
- * @link
+ * @link
*/
class CI_Driver_Library {
protected $valid_drivers = array();
protected static $lib_name;
-
+
// The first time a child is used it won't exist, so we instantiate it
// subsequents calls will go straight to the proper child.
function __get($child)
{
if (! isset($this->lib_name))
{
- $this->lib_name = get_class($this);
+ $this->lib_name = get_class($this);
}
// The class will be prefixed with the parent lib
$child_class = $this->lib_name.'_'.$child;
-
+
if (in_array(strtolower($child_class), array_map('strtolower', $this->valid_drivers)))
{
// check and see if the driver is in a separate file
@@ -64,11 +64,11 @@ class CI_Driver_Library {
{
include_once $filepath;
break;
- }
+ }
}
}
}
-
+
// it's a valid driver, but the file simply can't be found
if ( ! class_exists($child_class))
{
@@ -82,14 +82,14 @@ class CI_Driver_Library {
$this->$child = $obj;
return $this->$child;
}
-
+
// The requested driver isn't valid!
log_message('error', "Invalid driver requested: ".$child_class);
show_error("Invalid driver requested: ".$child_class);
}
-
+
// --------------------------------------------------------------------
-
+
}
// END CI_Driver_Library CLASS
@@ -104,11 +104,11 @@ class CI_Driver_Library {
* @subpackage Libraries
* @category Libraries
* @author EllisLab Dev Team
- * @link
+ * @link
*/
class CI_Driver {
protected $parent;
-
+
private $methods = array();
private $properties = array();
@@ -126,16 +126,16 @@ class CI_Driver {
function decorate($parent)
{
$this->parent = $parent;
-
+
// Lock down attributes to what is defined in the class
// and speed up references in magic methods
-
+
$class_name = get_class($parent);
-
+
if ( ! isset(self::$reflections[$class_name]))
{
$r = new ReflectionObject($parent);
-
+
foreach ($r->getMethods() as $method)
{
if ($method->isPublic())
@@ -151,7 +151,7 @@ class CI_Driver {
$this->properties[] = $prop->getName();
}
}
-
+
self::$reflections[$class_name] = array($this->methods, $this->properties);
}
else
@@ -159,9 +159,9 @@ class CI_Driver {
list($this->methods, $this->properties) = self::$reflections[$class_name];
}
}
-
+
// --------------------------------------------------------------------
-
+
/**
* __call magic method
*
@@ -185,7 +185,7 @@ class CI_Driver {
}
// --------------------------------------------------------------------
-
+
/**
* __get magic method
*
@@ -204,7 +204,7 @@ class CI_Driver {
}
// --------------------------------------------------------------------
-
+
/**
* __set magic method
*
@@ -222,9 +222,9 @@ class CI_Driver {
$this->parent->$var = $val;
}
}
-
+
// --------------------------------------------------------------------
-
+
}
// END CI_Driver CLASS
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index af48757bb..6c0309b0d 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -129,7 +129,7 @@ class CI_Email {
$this->_smtp_auth = ($this->smtp_user == '' AND $this->smtp_pass == '') ? FALSE : TRUE;
$this->_safe_mode = ((boolean)@ini_get("safe_mode") === FALSE) ? FALSE : TRUE;
}
-
+
// --------------------------------------------------------------------
/**
@@ -161,7 +161,7 @@ class CI_Email {
$this->_attach_disp = array();
}
}
-
+
// --------------------------------------------------------------------
/**
@@ -202,7 +202,7 @@ class CI_Email {
$this->_set_header('From', $name.' <'.$from.'>');
$this->_set_header('Return-Path', '<'.$from.'>');
}
-
+
// --------------------------------------------------------------------
/**
@@ -238,7 +238,7 @@ class CI_Email {
$this->_set_header('Reply-To', $name.' <'.$replyto.'>');
$this->_replyto_flag = TRUE;
}
-
+
// --------------------------------------------------------------------
/**
@@ -273,7 +273,7 @@ class CI_Email {
break;
}
}
-
+
// --------------------------------------------------------------------
/**
@@ -300,7 +300,7 @@ class CI_Email {
$this->_cc_array = $cc;
}
}
-
+
// --------------------------------------------------------------------
/**
@@ -336,7 +336,7 @@ class CI_Email {
$this->_set_header('Bcc', implode(", ", $bcc));
}
}
-
+
// --------------------------------------------------------------------
/**
@@ -351,7 +351,7 @@ class CI_Email {
$subject = $this->_prep_q_encoding($subject);
$this->_set_header('Subject', $subject);
}
-
+
// --------------------------------------------------------------------
/**
@@ -365,7 +365,7 @@ class CI_Email {
{
$this->_body = stripslashes(rtrim(str_replace("\r", "", $body)));
}
-
+
// --------------------------------------------------------------------
/**
@@ -396,7 +396,7 @@ class CI_Email {
{
$this->_headers[$header] = $value;
}
-
+
// --------------------------------------------------------------------
/**
@@ -422,7 +422,7 @@ class CI_Email {
}
return $email;
}
-
+
// --------------------------------------------------------------------
/**
@@ -436,7 +436,7 @@ class CI_Email {
{
$this->alt_message = ($str == '') ? '' : $str;
}
-
+
// --------------------------------------------------------------------
/**
@@ -450,7 +450,7 @@ class CI_Email {
{
$this->mailtype = ($type == 'html') ? 'html' : 'text';
}
-
+
// --------------------------------------------------------------------
/**
@@ -464,7 +464,7 @@ class CI_Email {
{
$this->wordwrap = ($wordwrap === FALSE) ? FALSE : TRUE;
}
-
+
// --------------------------------------------------------------------
/**
@@ -478,7 +478,7 @@ class CI_Email {
{
$this->protocol = ( ! in_array($protocol, $this->_protocols, TRUE)) ? 'mail' : strtolower($protocol);
}
-
+
// --------------------------------------------------------------------
/**
@@ -504,7 +504,7 @@ class CI_Email {
$this->priority = $n;
}
-
+
// --------------------------------------------------------------------
/**
@@ -524,7 +524,7 @@ class CI_Email {
$this->newline = $newline;
}
-
+
// --------------------------------------------------------------------
/**
@@ -544,7 +544,7 @@ class CI_Email {
$this->crlf = $crlf;
}
-
+
// --------------------------------------------------------------------
/**
@@ -558,7 +558,7 @@ class CI_Email {
$this->_alt_boundary = "B_ALT_".uniqid(''); // multipart/alternative
$this->_atc_boundary = "B_ATC_".uniqid(''); // attachment boundary
}
-
+
// --------------------------------------------------------------------
/**
@@ -575,7 +575,7 @@ class CI_Email {
return "<".uniqid('').strstr($from, '@').">";
}
-
+
// --------------------------------------------------------------------
/**
@@ -595,7 +595,7 @@ class CI_Email {
return $this->protocol;
}
}
-
+
// --------------------------------------------------------------------
/**
@@ -650,7 +650,7 @@ class CI_Email {
return 'plain';
}
}
-
+
// --------------------------------------------------------------------
/**
@@ -668,7 +668,7 @@ class CI_Email {
return sprintf("%s %s%04d", date("D, j M Y H:i:s"), $operator, $timezone);
}
-
+
// --------------------------------------------------------------------
/**
@@ -681,7 +681,7 @@ class CI_Email {
{
return "This is a multi-part message in MIME format.".$this->newline."Your email application may not support this format.";
}
-
+
// --------------------------------------------------------------------
/**
@@ -710,7 +710,7 @@ class CI_Email {
return TRUE;
}
-
+
// --------------------------------------------------------------------
/**
@@ -724,7 +724,7 @@ class CI_Email {
{
return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $address)) ? FALSE : TRUE;
}
-
+
// --------------------------------------------------------------------
/**
@@ -740,11 +740,11 @@ class CI_Email {
{
if (preg_match('/\<(.*)\>/', $email, $match))
{
- return $match['1'];
+ return $match['1'];
}
- else
+ else
{
- return $email;
+ return $email;
}
}
@@ -754,17 +754,17 @@ class CI_Email {
{
if (preg_match( '/\<(.*)\>/', $addy, $match))
{
- $clean_email[] = $match['1'];
+ $clean_email[] = $match['1'];
}
- else
+ else
{
- $clean_email[] = $addy;
+ $clean_email[] = $addy;
}
}
return $clean_email;
}
-
+
// --------------------------------------------------------------------
/**
@@ -804,7 +804,7 @@ class CI_Email {
for ($x = 1; $x <= $i; $x ++)
{
- $n .= "\n";
+ $n .= "\n";
}
$body = str_replace($n, "\n\n", $body);
@@ -812,7 +812,7 @@ class CI_Email {
return $this->word_wrap($body, '76');
}
-
+
// --------------------------------------------------------------------
/**
@@ -908,7 +908,7 @@ class CI_Email {
return $output;
}
-
+
// --------------------------------------------------------------------
/**
@@ -926,7 +926,7 @@ class CI_Email {
$this->_set_header('Message-ID', $this->_get_message_id());
$this->_set_header('Mime-Version', '1.0');
}
-
+
// --------------------------------------------------------------------
/**
@@ -961,7 +961,7 @@ class CI_Email {
$this->_header_str = rtrim($this->_header_str);
}
}
-
+
// --------------------------------------------------------------------
/**
@@ -1150,7 +1150,7 @@ class CI_Email {
return;
}
-
+
// --------------------------------------------------------------------
/**
@@ -1245,7 +1245,7 @@ class CI_Email {
}
// --------------------------------------------------------------------
-
+
/**
* Prep Q Encoding
*
@@ -1317,7 +1317,7 @@ class CI_Email {
}
// --------------------------------------------------------------------
-
+
/**
* Send Email
*
@@ -1358,7 +1358,7 @@ class CI_Email {
return TRUE;
}
}
-
+
// --------------------------------------------------------------------
/**
@@ -1416,7 +1416,7 @@ class CI_Email {
$this->_spool_email();
}
}
-
+
// --------------------------------------------------------------------
/**
@@ -1429,7 +1429,7 @@ class CI_Email {
{
$this->_finalbody = preg_replace_callback("/\{unwrap\}(.*?)\{\/unwrap\}/si", array($this, '_remove_nl_callback'), $this->_finalbody);
}
-
+
// --------------------------------------------------------------------
/**
@@ -1447,7 +1447,7 @@ class CI_Email {
return $matches[1];
}
-
+
// --------------------------------------------------------------------
/**
@@ -1492,7 +1492,7 @@ class CI_Email {
$this->_set_error_message('email_sent', $this->_get_protocol());
return TRUE;
}
-
+
// --------------------------------------------------------------------
/**
@@ -1528,7 +1528,7 @@ class CI_Email {
}
}
}
-
+
// --------------------------------------------------------------------
/**
@@ -1550,12 +1550,12 @@ class CI_Email {
fputs($fp, $this->_header_str);
fputs($fp, $this->_finalbody);
- $status = pclose($fp);
-
+ $status = pclose($fp);
+
if (version_compare(PHP_VERSION, '4.2.3') == -1)
{
$status = $status >> 8 & 0xFF;
- }
+ }
if ($status != 0)
{
@@ -1566,7 +1566,7 @@ class CI_Email {
return TRUE;
}
-
+
// --------------------------------------------------------------------
/**
@@ -1635,7 +1635,7 @@ class CI_Email {
$this->_send_command('quit');
return TRUE;
}
-
+
// --------------------------------------------------------------------
/**
@@ -1662,7 +1662,7 @@ class CI_Email {
$this->_set_error_message($this->_get_smtp_data());
return $this->_send_command('hello');
}
-
+
// --------------------------------------------------------------------
/**
@@ -1729,7 +1729,7 @@ class CI_Email {
return TRUE;
}
-
+
// --------------------------------------------------------------------
/**
@@ -1783,7 +1783,7 @@ class CI_Email {
return TRUE;
}
-
+
// --------------------------------------------------------------------
/**
@@ -1804,7 +1804,7 @@ class CI_Email {
return TRUE;
}
}
-
+
// --------------------------------------------------------------------
/**
@@ -1829,7 +1829,7 @@ class CI_Email {
return $data;
}
-
+
// --------------------------------------------------------------------
/**
@@ -1842,7 +1842,7 @@ class CI_Email {
{
return (isset($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : 'localhost.localdomain';
}
-
+
// --------------------------------------------------------------------
/**
@@ -1862,7 +1862,7 @@ class CI_Email {
$rip = (isset($_SERVER['REMOTE_ADDR']) AND $_SERVER['REMOTE_ADDR'] != "") ? $_SERVER['REMOTE_ADDR'] : FALSE;
$fip = (isset($_SERVER['HTTP_X_FORWARDED_FOR']) AND $_SERVER['HTTP_X_FORWARDED_FOR'] != "") ? $_SERVER['HTTP_X_FORWARDED_FOR'] : FALSE;
- if ($cip && $rip) $this->_IP = $cip;
+ if ($cip && $rip) $this->_IP = $cip;
elseif ($rip) $this->_IP = $rip;
elseif ($cip) $this->_IP = $cip;
elseif ($fip) $this->_IP = $fip;
@@ -1884,7 +1884,7 @@ class CI_Email {
return $this->_IP;
}
-
+
// --------------------------------------------------------------------
/**
@@ -1908,7 +1908,7 @@ class CI_Email {
$msg .= "<pre>".$this->_header_str."\n".htmlspecialchars($this->_subject)."\n".htmlspecialchars($this->_finalbody).'</pre>';
return $msg;
}
-
+
// --------------------------------------------------------------------
/**
@@ -1932,7 +1932,7 @@ class CI_Email {
$this->_debug_msg[] = str_replace('%s', $val, $line)."<br />";
}
}
-
+
// --------------------------------------------------------------------
/**
diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php
index b27847a55..b95dd999c 100644
--- a/system/libraries/Encrypt.php
+++ b/system/libraries/Encrypt.php
@@ -144,7 +144,7 @@ class CI_Encrypt {
function decode($string, $key = '')
{
$key = $this->get_key($key);
-
+
if (preg_match('/[^a-zA-Z0-9\/\+=]/', $string))
{
return FALSE;
@@ -163,12 +163,12 @@ class CI_Encrypt {
{
$dec = $this->_xor_decode($dec, $key);
}
-
+
return $dec;
}
// --------------------------------------------------------------------
-
+
/**
* Encode from Legacy
*
@@ -176,7 +176,7 @@ class CI_Encrypt {
* returns a newly encoded string using the improved method added in 2.0.0
* This allows for backwards compatibility and a method to transition to the
* new encryption algorithms.
- *
+ *
* For more details, see http://codeigniter.com/user_guide/installation/upgrade_200.html#encryption
*
* @access public
@@ -192,22 +192,22 @@ class CI_Encrypt {
log_message('error', 'Encoding from legacy is available only when Mcrypt is in use.');
return FALSE;
}
-
+
// decode it first
// set mode temporarily to what it was when string was encoded with the legacy
- // algorithm - typically MCRYPT_MODE_ECB
+ // algorithm - typically MCRYPT_MODE_ECB
$current_mode = $this->_get_mode();
$this->set_mode($legacy_mode);
-
+
$key = $this->get_key($key);
-
+
if (preg_match('/[^a-zA-Z0-9\/\+=]/', $string))
{
return FALSE;
}
$dec = base64_decode($string);
-
+
if (($dec = $this->mcrypt_decode($dec, $key)) === FALSE)
{
return FALSE;
@@ -223,7 +223,7 @@ class CI_Encrypt {
}
// --------------------------------------------------------------------
-
+
/**
* XOR Encode
*
@@ -247,7 +247,7 @@ class CI_Encrypt {
$enc = '';
for ($i = 0; $i < strlen($string); $i++)
- {
+ {
$enc .= substr($rand, ($i % strlen($rand)), 1).(substr($rand, ($i % strlen($rand)), 1) ^ substr($string, $i, 1));
}
@@ -410,7 +410,7 @@ class CI_Encrypt {
{
$temp = $temp + 256;
}
-
+
$str .= chr($temp);
}
@@ -418,7 +418,7 @@ class CI_Encrypt {
}
// --------------------------------------------------------------------
-
+
/**
* Set the Mcrypt Cipher
*
@@ -477,7 +477,7 @@ class CI_Encrypt {
{
$this->_mcrypt_mode = MCRYPT_MODE_CBC;
}
-
+
return $this->_mcrypt_mode;
}
@@ -503,7 +503,7 @@ class CI_Encrypt {
* @access public
* @param string
* @return string
- */
+ */
function hash($str)
{
return ($this->_hash_type == 'sha1') ? $this->sha1($str) : md5($str);
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index 64baaef25..566655b12 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -25,29 +25,29 @@
* @link http://codeigniter.com/user_guide/libraries/form_validation.html
*/
class CI_Form_validation {
-
+
var $CI;
- var $_field_data = array();
+ var $_field_data = array();
var $_config_rules = array();
var $_error_array = array();
- var $_error_messages = array();
+ var $_error_messages = array();
var $_error_prefix = '<p>';
var $_error_suffix = '</p>';
var $error_string = '';
- var $_safe_form_data = FALSE;
+ var $_safe_form_data = FALSE;
/**
* Constructor
*
- */
+ */
function CI_Form_validation($rules = array())
- {
+ {
$this->CI =& get_instance();
-
+
// Validation rules can be stored in a config file.
$this->_config_rules = $rules;
-
+
// Automatically load the form helper
$this->CI->load->helper('form');
@@ -56,12 +56,12 @@ class CI_Form_validation {
{
mb_internal_encoding($this->CI->config->item('charset'));
}
-
+
log_message('debug', "Form Validation Class Initialized");
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Set Rules
*
@@ -80,7 +80,7 @@ class CI_Form_validation {
{
return;
}
-
+
// If an array was passed via the first parameter instead of indidual string
// values we cycle through it and recursively call this function.
if (is_array($field))
@@ -101,7 +101,7 @@ class CI_Form_validation {
}
return;
}
-
+
// No fields? Nothing to do...
if ( ! is_string($field) OR ! is_string($rules) OR $field == '')
{
@@ -113,9 +113,9 @@ class CI_Form_validation {
// Is the field name an array? We test for the existence of a bracket "[" in
// the field name to determine this. If it is an array, we break it apart
- // into its components so that we can fetch the corresponding POST data later
+ // into its components so that we can fetch the corresponding POST data later
if (strpos($field, '[') !== FALSE AND preg_match_all('/\[(.*?)\]/', $field, $matches))
- {
+ {
// Note: Due to a bug in current() that affects some versions
// of PHP we can not pass function call directly into it
$x = explode('[', $field);
@@ -128,19 +128,19 @@ class CI_Form_validation {
$indexes[] = $matches['1'][$i];
}
}
-
+
$is_array = TRUE;
}
else
{
- $indexes = array();
- $is_array = FALSE;
+ $indexes = array();
+ $is_array = FALSE;
}
-
- // Build our master array
+
+ // Build our master array
$this->_field_data[$field] = array(
- 'field' => $field,
- 'label' => $label,
+ 'field' => $field,
+ 'label' => $label,
'rules' => $rules,
'is_array' => $is_array,
'keys' => $indexes,
@@ -150,7 +150,7 @@ class CI_Form_validation {
}
// --------------------------------------------------------------------
-
+
/**
* Set Error Message
*
@@ -168,12 +168,12 @@ class CI_Form_validation {
{
$lang = array($lang => $val);
}
-
+
$this->_error_messages = array_merge($this->_error_messages, $lang);
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Set The Error Delimiter
*
@@ -183,7 +183,7 @@ class CI_Form_validation {
* @param string
* @param string
* @return void
- */
+ */
function set_error_delimiters($prefix = '<p>', $suffix = '</p>')
{
$this->_error_prefix = $prefix;
@@ -191,7 +191,7 @@ class CI_Form_validation {
}
// --------------------------------------------------------------------
-
+
/**
* Get Error Message
*
@@ -200,14 +200,14 @@ class CI_Form_validation {
* @access public
* @param string the field name
* @return void
- */
+ */
function error($field = '', $prefix = '', $suffix = '')
- {
+ {
if ( ! isset($this->_field_data[$field]['error']) OR $this->_field_data[$field]['error'] == '')
{
return '';
}
-
+
if ($prefix == '')
{
$prefix = $this->_error_prefix;
@@ -222,7 +222,7 @@ class CI_Form_validation {
}
// --------------------------------------------------------------------
-
+
/**
* Error String
*
@@ -232,7 +232,7 @@ class CI_Form_validation {
* @param string
* @param string
* @return str
- */
+ */
function error_string($prefix = '', $suffix = '')
{
// No errrors, validation passes!
@@ -240,7 +240,7 @@ class CI_Form_validation {
{
return '';
}
-
+
if ($prefix == '')
{
$prefix = $this->_error_prefix;
@@ -250,7 +250,7 @@ class CI_Form_validation {
{
$suffix = $this->_error_suffix;
}
-
+
// Generate the error string
$str = '';
foreach ($this->_error_array as $val)
@@ -260,12 +260,12 @@ class CI_Form_validation {
$str .= $prefix.$val.$suffix."\n";
}
}
-
+
return $str;
}
// --------------------------------------------------------------------
-
+
/**
* Run the Validator
*
@@ -273,7 +273,7 @@ class CI_Form_validation {
*
* @access public
* @return bool
- */
+ */
function run($group = '')
{
// Do we even have any data to process? Mm?
@@ -281,7 +281,7 @@ class CI_Form_validation {
{
return FALSE;
}
-
+
// Does the _field_data array containing the validation rules exist?
// If not, we look to see if they were assigned via a config file
if (count($this->_field_data) == 0)
@@ -291,10 +291,10 @@ class CI_Form_validation {
{
return FALSE;
}
-
+
// Is there a validation rule for the particular URI being accessed?
$uri = ($group == '') ? trim($this->CI->uri->ruri_string(), '/') : $group;
-
+
if ($uri != '' AND isset($this->_config_rules[$uri]))
{
$this->set_rules($this->_config_rules[$uri]);
@@ -303,7 +303,7 @@ class CI_Form_validation {
{
$this->set_rules($this->_config_rules);
}
-
+
// We're we able to set the rules correctly?
if (count($this->_field_data) == 0)
{
@@ -311,17 +311,17 @@ class CI_Form_validation {
return FALSE;
}
}
-
+
// Load the language file containing error messages
$this->CI->lang->load('form_validation');
-
- // Cycle through the rules for each field, match the
+
+ // Cycle through the rules for each field, match the
// corresponding $_POST item and test for errors
foreach ($this->_field_data as $field => $row)
- {
+ {
// Fetch the data from the corresponding $_POST array and cache it in the _field_data array.
// Depending on whether the field name is an array or a string will determine where we get it from.
-
+
if ($row['is_array'] == TRUE)
{
$this->_field_data[$field]['postdata'] = $this->_reduce_array($_POST, $row['keys']);
@@ -333,8 +333,8 @@ class CI_Form_validation {
$this->_field_data[$field]['postdata'] = $_POST[$field];
}
}
-
- $this->_execute($row, explode('|', $row['rules']), $this->_field_data[$field]['postdata']);
+
+ $this->_execute($row, explode('|', $row['rules']), $this->_field_data[$field]['postdata']);
}
// Did we end up with any errors?
@@ -347,7 +347,7 @@ class CI_Form_validation {
// Now we need to re-set the POST data with the new, processed data
$this->_reset_post_array();
-
+
// No errors, validation passes!
if ($total_errors == 0)
{
@@ -359,7 +359,7 @@ class CI_Form_validation {
}
// --------------------------------------------------------------------
-
+
/**
* Traverse a multidimensional $_POST array index until the data is found
*
@@ -368,7 +368,7 @@ class CI_Form_validation {
* @param array
* @param integer
* @return mixed
- */
+ */
function _reduce_array($array, $keys, $i = 0)
{
if (is_array($array))
@@ -389,18 +389,18 @@ class CI_Form_validation {
return $array;
}
}
-
+
return $array;
}
// --------------------------------------------------------------------
-
+
/**
* Re-populate the _POST array with our finalized and processed data
*
* @access private
* @return null
- */
+ */
function _reset_post_array()
{
foreach ($this->_field_data as $field => $row)
@@ -418,7 +418,7 @@ class CI_Form_validation {
{
// start with a reference
$post_ref =& $_POST;
-
+
// before we assign values, make a reference to the right POST key
if (count($row['keys']) == 1)
{
@@ -452,7 +452,7 @@ class CI_Form_validation {
}
// --------------------------------------------------------------------
-
+
/**
* Executes the Validation routines
*
@@ -462,21 +462,21 @@ class CI_Form_validation {
* @param mixed
* @param integer
* @return mixed
- */
+ */
function _execute($row, $rules, $postdata = NULL, $cycles = 0)
{
// If the $_POST data is an array we will run a recursive call
if (is_array($postdata))
- {
+ {
foreach ($postdata as $key => $val)
{
$this->_execute($row, $rules, $val, $cycles);
$cycles++;
}
-
+
return;
}
-
+
// --------------------------------------------------------------------
// If the field is blank, but NOT required, no further tests are necessary
@@ -496,7 +496,7 @@ class CI_Form_validation {
}
// --------------------------------------------------------------------
-
+
// Isset Test. Typically this rule will only apply to checkboxes.
if (is_null($postdata) AND $callback == FALSE)
{
@@ -504,31 +504,31 @@ class CI_Form_validation {
{
// Set the message type
$type = (in_array('required', $rules)) ? 'required' : 'isset';
-
+
if ( ! isset($this->_error_messages[$type]))
{
if (FALSE === ($line = $this->CI->lang->line($type)))
{
$line = 'The field was not set';
- }
+ }
}
else
{
$line = $this->_error_messages[$type];
}
-
+
// Build the error message
$message = sprintf($line, $this->_translate_fieldname($row['label']));
// Save the error message
$this->_field_data[$row['field']]['error'] = $message;
-
+
if ( ! isset($this->_error_array[$row['field']]))
{
$this->_error_array[$row['field']] = $message;
}
}
-
+
return;
}
@@ -538,7 +538,7 @@ class CI_Form_validation {
foreach ($rules As $rule)
{
$_in_array = FALSE;
-
+
// We set the $postdata variable with the current data in our master array so that
// each cycle of the loop is dealing with the processed data from the last cycle
if ($row['is_array'] == TRUE AND is_array($this->_field_data[$row['field']]['postdata']))
@@ -549,7 +549,7 @@ class CI_Form_validation {
{
continue;
}
-
+
$postdata = $this->_field_data[$row['field']]['postdata'][$cycles];
$_in_array = TRUE;
}
@@ -559,15 +559,15 @@ class CI_Form_validation {
}
// --------------------------------------------------------------------
-
- // Is the rule a callback?
+
+ // Is the rule a callback?
$callback = FALSE;
if (substr($rule, 0, 9) == 'callback_')
{
$rule = substr($rule, 9);
$callback = TRUE;
}
-
+
// Strip the parameter (if exists) from the rule
// Rules can contain a parameter: max_length[5]
$param = FALSE;
@@ -576,15 +576,15 @@ class CI_Form_validation {
$rule = $match[1];
$param = $match[2];
}
-
+
// Call the function that corresponds to the rule
if ($callback === TRUE)
{
if ( ! method_exists($this->CI, $rule))
- {
+ {
continue;
}
-
+
// Run the function and grab the result
$result = $this->CI->$rule($postdata, $param);
@@ -597,7 +597,7 @@ class CI_Form_validation {
{
$this->_field_data[$row['field']]['postdata'] = (is_bool($result)) ? $postdata : $result;
}
-
+
// If the field isn't required and we just processed a callback we'll move on...
if ( ! in_array('required', $rules, TRUE) AND $result !== FALSE)
{
@@ -605,15 +605,15 @@ class CI_Form_validation {
}
}
else
- {
+ {
if ( ! method_exists($this, $rule))
{
- // If our own wrapper function doesn't exist we see if a native PHP function does.
+ // If our own wrapper function doesn't exist we see if a native PHP function does.
// Users can use any native PHP function call that has one param.
if (function_exists($rule))
{
$result = $rule($postdata);
-
+
if ($_in_array == TRUE)
{
$this->_field_data[$row['field']]['postdata'][$cycles] = (is_bool($result)) ? $postdata : $result;
@@ -623,7 +623,7 @@ class CI_Form_validation {
$this->_field_data[$row['field']]['postdata'] = (is_bool($result)) ? $postdata : $result;
}
}
-
+
continue;
}
@@ -638,54 +638,54 @@ class CI_Form_validation {
$this->_field_data[$row['field']]['postdata'] = (is_bool($result)) ? $postdata : $result;
}
}
-
+
// Did the rule test negatively? If so, grab the error.
if ($result === FALSE)
- {
+ {
if ( ! isset($this->_error_messages[$rule]))
{
if (FALSE === ($line = $this->CI->lang->line($rule)))
{
$line = 'Unable to access an error message corresponding to your field name.';
- }
+ }
}
else
{
$line = $this->_error_messages[$rule];
}
-
+
// Is the parameter we are inserting into the error message the name
// of another field? If so we need to grab its "field label"
if (isset($this->_field_data[$param]) AND isset($this->_field_data[$param]['label']))
{
$param = $this->_translate_fieldname($this->_field_data[$param]['label']);
}
-
+
// Build the error message
$message = sprintf($line, $this->_translate_fieldname($row['label']), $param);
// Save the error message
$this->_field_data[$row['field']]['error'] = $message;
-
+
if ( ! isset($this->_error_array[$row['field']]))
{
$this->_error_array[$row['field']] = $message;
}
-
+
return;
}
}
}
// --------------------------------------------------------------------
-
+
/**
* Translate a field name
*
* @access private
* @param string the field name
* @return string
- */
+ */
function _translate_fieldname($fieldname)
{
// Do we need to translate the field name?
@@ -693,8 +693,8 @@ class CI_Form_validation {
if (substr($fieldname, 0, 5) == 'lang:')
{
// Grab the variable
- $line = substr($fieldname, 5);
-
+ $line = substr($fieldname, 5);
+
// Were we able to translate the field name? If not we use $line
if (FALSE === ($fieldname = $this->CI->lang->line($line)))
{
@@ -706,7 +706,7 @@ class CI_Form_validation {
}
// --------------------------------------------------------------------
-
+
/**
* Get the value from a form
*
@@ -717,19 +717,19 @@ class CI_Form_validation {
* @param string the field name
* @param string
* @return void
- */
+ */
function set_value($field = '', $default = '')
{
if ( ! isset($this->_field_data[$field]))
{
return $default;
}
-
+
return $this->_field_data[$field]['postdata'];
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Set Select
*
@@ -740,9 +740,9 @@ class CI_Form_validation {
* @param string
* @param string
* @return string
- */
+ */
function set_select($field = '', $value = '', $default = FALSE)
- {
+ {
if ( ! isset($this->_field_data[$field]) OR ! isset($this->_field_data[$field]['postdata']))
{
if ($default === TRUE AND count($this->_field_data) === 0)
@@ -751,9 +751,9 @@ class CI_Form_validation {
}
return '';
}
-
+
$field = $this->_field_data[$field]['postdata'];
-
+
if (is_array($field))
{
if ( ! in_array($value, $field))
@@ -768,12 +768,12 @@ class CI_Form_validation {
return '';
}
}
-
+
return ' selected="selected"';
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Set Radio
*
@@ -784,7 +784,7 @@ class CI_Form_validation {
* @param string
* @param string
* @return string
- */
+ */
function set_radio($field = '', $value = '', $default = FALSE)
{
if ( ! isset($this->_field_data[$field]) OR ! isset($this->_field_data[$field]['postdata']))
@@ -795,9 +795,9 @@ class CI_Form_validation {
}
return '';
}
-
+
$field = $this->_field_data[$field]['postdata'];
-
+
if (is_array($field))
{
if ( ! in_array($value, $field))
@@ -812,12 +812,12 @@ class CI_Form_validation {
return '';
}
}
-
+
return ' checked="checked"';
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Set Checkbox
*
@@ -828,7 +828,7 @@ class CI_Form_validation {
* @param string
* @param string
* @return string
- */
+ */
function set_checkbox($field = '', $value = '', $default = FALSE)
{
if ( ! isset($this->_field_data[$field]) OR ! isset($this->_field_data[$field]['postdata']))
@@ -839,9 +839,9 @@ class CI_Form_validation {
}
return '';
}
-
+
$field = $this->_field_data[$field]['postdata'];
-
+
if (is_array($field))
{
if ( ! in_array($value, $field))
@@ -856,12 +856,12 @@ class CI_Form_validation {
return '';
}
}
-
+
return ' checked="checked"';
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Required
*
@@ -880,9 +880,9 @@ class CI_Form_validation {
return ( ! empty($str));
}
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Match one field to another
*
@@ -895,16 +895,16 @@ class CI_Form_validation {
{
if ( ! isset($_POST[$field]))
{
- return FALSE;
+ return FALSE;
}
-
+
$field = $_POST[$field];
return ($str !== $field) ? FALSE : TRUE;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Minimum Length
*
@@ -912,7 +912,7 @@ class CI_Form_validation {
* @param string
* @param value
* @return bool
- */
+ */
function min_length($str, $val)
{
if (preg_match("/[^0-9]/", $val))
@@ -922,14 +922,14 @@ class CI_Form_validation {
if (function_exists('mb_strlen'))
{
- return (mb_strlen($str) < $val) ? FALSE : TRUE;
+ return (mb_strlen($str) < $val) ? FALSE : TRUE;
}
-
+
return (strlen($str) < $val) ? FALSE : TRUE;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Max Length
*
@@ -937,7 +937,7 @@ class CI_Form_validation {
* @param string
* @param value
* @return bool
- */
+ */
function max_length($str, $val)
{
if (preg_match("/[^0-9]/", $val))
@@ -947,14 +947,14 @@ class CI_Form_validation {
if (function_exists('mb_strlen'))
{
- return (mb_strlen($str) > $val) ? FALSE : TRUE;
+ return (mb_strlen($str) > $val) ? FALSE : TRUE;
}
-
+
return (strlen($str) > $val) ? FALSE : TRUE;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Exact Length
*
@@ -962,7 +962,7 @@ class CI_Form_validation {
* @param string
* @param value
* @return bool
- */
+ */
function exact_length($str, $val)
{
if (preg_match("/[^0-9]/", $val))
@@ -972,42 +972,42 @@ class CI_Form_validation {
if (function_exists('mb_strlen'))
{
- return (mb_strlen($str) != $val) ? FALSE : TRUE;
+ return (mb_strlen($str) != $val) ? FALSE : TRUE;
}
-
+
return (strlen($str) != $val) ? FALSE : TRUE;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Valid Email
*
* @access public
* @param string
* @return bool
- */
+ */
function valid_email($str)
{
return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE;
}
// --------------------------------------------------------------------
-
+
/**
* Valid Emails
*
* @access public
* @param string
* @return bool
- */
+ */
function valid_emails($str)
{
if (strpos($str, ',') === FALSE)
{
return $this->valid_email(trim($str));
}
-
+
foreach(explode(',', $str) as $email)
{
if (trim($email) != '' && $this->valid_email(trim($email)) === FALSE)
@@ -1015,12 +1015,12 @@ class CI_Form_validation {
return FALSE;
}
}
-
+
return TRUE;
}
// --------------------------------------------------------------------
-
+
/**
* Validate IP Address
*
@@ -1034,56 +1034,56 @@ class CI_Form_validation {
}
// --------------------------------------------------------------------
-
+
/**
* Alpha
*
* @access public
* @param string
* @return bool
- */
+ */
function alpha($str)
{
return ( ! preg_match("/^([a-z])+$/i", $str)) ? FALSE : TRUE;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Alpha-numeric
*
* @access public
* @param string
* @return bool
- */
+ */
function alpha_numeric($str)
{
return ( ! preg_match("/^([a-z0-9])+$/i", $str)) ? FALSE : TRUE;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Alpha-numeric with underscores and dashes
*
* @access public
* @param string
* @return bool
- */
+ */
function alpha_dash($str)
{
return ( ! preg_match("/^([-a-z0-9_-])+$/i", $str)) ? FALSE : TRUE;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Numeric
*
* @access public
* @param string
* @return bool
- */
+ */
function numeric($str)
{
return (bool)preg_match( '/^[\-+]?[0-9]*\.?[0-9]+$/', $str);
@@ -1092,72 +1092,72 @@ class CI_Form_validation {
// --------------------------------------------------------------------
- /**
- * Is Numeric
- *
- * @access public
- * @param string
- * @return bool
- */
- function is_numeric($str)
- {
- return ( ! is_numeric($str)) ? FALSE : TRUE;
- }
+ /**
+ * Is Numeric
+ *
+ * @access public
+ * @param string
+ * @return bool
+ */
+ function is_numeric($str)
+ {
+ return ( ! is_numeric($str)) ? FALSE : TRUE;
+ }
// --------------------------------------------------------------------
-
+
/**
* Integer
*
* @access public
* @param string
* @return bool
- */
+ */
function integer($str)
{
return (bool)preg_match( '/^[\-+]?[0-9]+$/', $str);
}
-
+
// --------------------------------------------------------------------
- /**
- * Is a Natural number (0,1,2,3, etc.)
- *
- * @access public
- * @param string
- * @return bool
- */
- function is_natural($str)
- {
- return (bool)preg_match( '/^[0-9]+$/', $str);
- }
+ /**
+ * Is a Natural number (0,1,2,3, etc.)
+ *
+ * @access public
+ * @param string
+ * @return bool
+ */
+ function is_natural($str)
+ {
+ return (bool)preg_match( '/^[0-9]+$/', $str);
+ }
// --------------------------------------------------------------------
- /**
- * Is a Natural number, but not a zero (1,2,3, etc.)
- *
- * @access public
- * @param string
- * @return bool
- */
+ /**
+ * Is a Natural number, but not a zero (1,2,3, etc.)
+ *
+ * @access public
+ * @param string
+ * @return bool
+ */
function is_natural_no_zero($str)
- {
- if ( ! preg_match( '/^[0-9]+$/', $str))
- {
- return FALSE;
- }
-
- if ($str == 0)
- {
- return FALSE;
- }
-
- return TRUE;
- }
-
+ {
+ if ( ! preg_match( '/^[0-9]+$/', $str))
+ {
+ return FALSE;
+ }
+
+ if ($str == 0)
+ {
+ return FALSE;
+ }
+
+ return TRUE;
+ }
+
// --------------------------------------------------------------------
-
+
/**
* Valid Base64
*
@@ -1172,9 +1172,9 @@ class CI_Form_validation {
{
return (bool) ! preg_match('/[^a-zA-Z0-9\/\+=]/', $str);
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Prep data for form
*
@@ -1193,10 +1193,10 @@ class CI_Form_validation {
{
$data[$key] = $this->prep_for_form($val);
}
-
+
return $data;
}
-
+
if ($this->_safe_form_data == FALSE OR $data === '')
{
return $data;
@@ -1204,54 +1204,54 @@ class CI_Form_validation {
return str_replace(array("'", '"', '<', '>'), array("&#39;", "&quot;", '&lt;', '&gt;'), stripslashes($data));
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Prep URL
*
* @access public
* @param string
* @return string
- */
+ */
function prep_url($str = '')
{
if ($str == 'http://' OR $str == '')
{
return '';
}
-
+
if (substr($str, 0, 7) != 'http://' && substr($str, 0, 8) != 'https://')
{
$str = 'http://'.$str;
}
-
+
return $str;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Strip Image Tags
*
* @access public
* @param string
* @return string
- */
+ */
function strip_image_tags($str)
{
return $this->CI->input->strip_image_tags($str);
}
-
+
// --------------------------------------------------------------------
-
+
/**
* XSS Clean
*
* @access public
* @param string
* @return string
- */
+ */
function xss_clean($str)
{
if ( ! isset($this->CI->security))
@@ -1261,16 +1261,16 @@ class CI_Form_validation {
return $this->CI->security->xss_clean($str);
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Convert PHP tags to entities
*
* @access public
* @param string
* @return string
- */
+ */
function encode_php_tags($str)
{
return str_replace(array('<?php', '<?PHP', '<?', '?>'), array('&lt;?php', '&lt;?PHP', '&lt;?', '?&gt;'), $str);
diff --git a/system/libraries/Ftp.php b/system/libraries/Ftp.php
index 07f4b1ff3..fa2d3770b 100644
--- a/system/libraries/Ftp.php
+++ b/system/libraries/Ftp.php
@@ -295,7 +295,7 @@ class CI_FTP {
{
return FALSE;
}
-
+
// Set the mode if not specified
if ($mode == 'auto')
{
@@ -303,9 +303,9 @@ class CI_FTP {
$ext = $this->_getext($rempath);
$mode = $this->_settype($ext);
}
-
+
$mode = ($mode == 'ascii') ? FTP_ASCII : FTP_BINARY;
-
+
$result = @ftp_get($this->conn_id, $locpath, $rempath, $mode);
if ($result === FALSE)
@@ -314,11 +314,11 @@ class CI_FTP {
{
$this->_error('ftp_unable_to_download');
}
- return FALSE;
+ return FALSE;
}
-
+
return TRUE;
- }
+ }
// --------------------------------------------------------------------
@@ -454,7 +454,7 @@ class CI_FTP {
* Set file permissions
*
* @access public
- * @param string the file path
+ * @param string the file path
* @param string the permissions
* @return bool
*/
diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php
index 806d942ba..99225600f 100644
--- a/system/libraries/Image_lib.php
+++ b/system/libraries/Image_lib.php
@@ -26,7 +26,7 @@
*/
class CI_Image_lib {
- var $image_library = 'gd2'; // Can be: imagemagick, netpbm, gd, gd2
+ var $image_library = 'gd2'; // Can be: imagemagick, netpbm, gd, gd2
var $library_path = '';
var $dynamic_output = FALSE; // Whether to send to browser or write to disk
var $source_image = '';
@@ -36,7 +36,7 @@ class CI_Image_lib {
var $quality = '90';
var $create_thumb = FALSE;
var $thumb_marker = '_thumb';
- var $maintain_ratio = TRUE; // Whether to maintain aspect ratio when resizing or use hard values
+ var $maintain_ratio = TRUE; // Whether to maintain aspect ratio when resizing or use hard values
var $master_dim = 'auto'; // auto, height, or width. Determines what to use as the master dimension
var $rotation_angle = '';
var $x_axis = '';
@@ -54,11 +54,11 @@ class CI_Image_lib {
var $wm_hor_alignment = 'C'; // Horizontal alignment: L R C
var $wm_padding = 0; // Padding around text
var $wm_hor_offset = 0; // Lets you push text to the right
- var $wm_vrt_offset = 0; // Lets you push text down
+ var $wm_vrt_offset = 0; // Lets you push text down
var $wm_font_color = '#ffffff'; // Text color
var $wm_shadow_color = ''; // Dropshadow color
var $wm_shadow_distance = 2; // Dropshadow distance
- var $wm_opacity = 50; // Image opacity: 1 - 100 Only works with image
+ var $wm_opacity = 50; // Image opacity: 1 - 100 Only works with image
// Private Vars
var $source_folder = '';
@@ -147,7 +147,7 @@ class CI_Image_lib {
if ($this->source_image == '')
{
$this->set_error('imglib_source_image_required');
- return FALSE;
+ return FALSE;
}
/*
@@ -190,7 +190,7 @@ class CI_Image_lib {
// Set the Image Properties
if ( ! $this->get_image_properties($this->source_folder.$this->source_image))
{
- return FALSE;
+ return FALSE;
}
/*
@@ -400,7 +400,7 @@ class CI_Image_lib {
if ($this->rotation_angle == '' OR ! in_array($this->rotation_angle, $degs))
{
$this->set_error('imglib_rotation_angle_required');
- return FALSE;
+ return FALSE;
}
// Reassign the width and height
@@ -455,8 +455,8 @@ class CI_Image_lib {
{
if ($this->orig_width == $this->width AND $this->orig_height == $this->height)
{
- if ($this->source_image != $this->new_image)
- {
+ if ($this->source_image != $this->new_image)
+ {
if (@copy($this->full_src_path, $this->full_dst_path))
{
@chmod($this->full_dst_path, FILE_WRITE_MODE);
@@ -494,14 +494,14 @@ class CI_Image_lib {
return FALSE;
}
- // Create The Image
+ // Create The Image
//
// old conditional which users report cause problems with shared GD libs who report themselves as "2.0 or greater"
// it appears that this is no longer the issue that it was in 2004, so we've removed it, retaining it in the comment
// below should that ever prove inaccurate.
//
// if ($this->image_library == 'gd2' AND function_exists('imagecreatetruecolor') AND $v2_override == FALSE)
- if ($this->image_library == 'gd2' AND function_exists('imagecreatetruecolor'))
+ if ($this->image_library == 'gd2' AND function_exists('imagecreatetruecolor'))
{
$create = 'imagecreatetruecolor';
$copy = 'imagecopyresampled';
@@ -519,7 +519,7 @@ class CI_Image_lib {
imagealphablending($dst_img, FALSE);
imagesavealpha($dst_img, TRUE);
}
-
+
$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
@@ -584,9 +584,9 @@ class CI_Image_lib {
{
switch ($this->rotation_angle)
{
- case 'hor' : $angle = '-flop';
+ case 'hor' : $angle = '-flop';
break;
- case 'vrt' : $angle = '-flip';
+ case 'vrt' : $angle = '-flip';
break;
default : $angle = '-rotate '.$this->rotation_angle;
break;
@@ -664,7 +664,7 @@ class CI_Image_lib {
break;
case 180 : $angle = 'r180';
break;
- case 270 : $angle = 'r90';
+ case 270 : $angle = 'r90';
break;
case 'vrt' : $angle = 'tb';
break;
@@ -889,7 +889,7 @@ class CI_Image_lib {
$this->get_image_properties();
// Fetch watermark image properties
- $props = $this->get_image_properties($this->wm_overlay_path, TRUE);
+ $props = $this->get_image_properties($this->wm_overlay_path, TRUE);
$wm_img_type = $props['image_type'];
$wm_width = $props['width'];
$wm_height = $props['height'];
@@ -944,7 +944,7 @@ class CI_Image_lib {
if ($wm_img_type == 3 AND function_exists('imagealphablending'))
{
@imagealphablending($src_img, TRUE);
- }
+ }
// Set RGB values for text and shadow
$rgba = imagecolorat($wm_img, $this->wm_x_transp, $this->wm_y_transp);
@@ -1266,7 +1266,7 @@ class CI_Image_lib {
switch ($this->image_type)
{
- case 1 : imagegif($resource);
+ case 1 : imagegif($resource);
break;
case 2 : imagejpeg($resource, '', $this->quality);
break;
@@ -1384,8 +1384,8 @@ class CI_Image_lib {
* new variable needs to be known
*
* $props = array(
- * 'width' => $width,
- * 'height' => $height,
+ * 'width' => $width,
+ * 'height' => $height,
* 'new_width' => 40,
* 'new_height' => ''
* );
@@ -1446,7 +1446,7 @@ class CI_Image_lib {
{
$ext = strrchr($source_image, '.');
$name = ($ext === FALSE) ? $source_image : substr($source_image, 0, -strlen($ext));
-
+
return array('ext' => $ext, 'name' => $name);
}
diff --git a/system/libraries/Javascript.php b/system/libraries/Javascript.php
index efaaab4bf..b4f33e309 100644
--- a/system/libraries/Javascript.php
+++ b/system/libraries/Javascript.php
@@ -29,9 +29,9 @@ class CI_Javascript {
var $_javascript_location = 'js';
function CI_Javascript($params = array())
- {
+ {
$defaults = array('js_library_driver' => 'jquery', 'autoload' => TRUE);
-
+
foreach ($defaults as $key => $val)
{
if (isset($params[$key]) && $params[$key] !== "")
@@ -39,7 +39,7 @@ class CI_Javascript {
$defaults[$key] = $params[$key];
}
}
-
+
extract($defaults);
$this->CI =& get_instance();
@@ -48,13 +48,13 @@ class CI_Javascript {
$this->CI->load->library('javascript/'.$js_library_driver, array('autoload' => $autoload));
// make js to refer to current library
$this->js =& $this->CI->$js_library_driver;
-
+
log_message('debug', "Javascript Class Initialized and loaded. Driver used: $js_library_driver");
}
- // --------------------------------------------------------------------
- // Event Code
// --------------------------------------------------------------------
+ // Event Code
+ // --------------------------------------------------------------------
/**
* Blur
@@ -70,9 +70,9 @@ class CI_Javascript {
{
return $this->js->_blur($element, $js);
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Change
*
@@ -87,9 +87,9 @@ class CI_Javascript {
{
return $this->js->_change($element, $js);
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Click
*
@@ -107,7 +107,7 @@ class CI_Javascript {
}
// --------------------------------------------------------------------
-
+
/**
* Double Click
*
@@ -124,7 +124,7 @@ class CI_Javascript {
}
// --------------------------------------------------------------------
-
+
/**
* Error
*
@@ -141,7 +141,7 @@ class CI_Javascript {
}
// --------------------------------------------------------------------
-
+
/**
* Focus
*
@@ -158,7 +158,7 @@ class CI_Javascript {
}
// --------------------------------------------------------------------
-
+
/**
* Hover
*
@@ -168,7 +168,7 @@ class CI_Javascript {
* @param string - element
* @param string - Javascript code for mouse over
* @param string - Javascript code for mouse out
- * @return string
+ * @return string
*/
function hover($element = 'this', $over, $out)
{
@@ -176,7 +176,7 @@ class CI_Javascript {
}
// --------------------------------------------------------------------
-
+
/**
* Keydown
*
@@ -193,7 +193,7 @@ class CI_Javascript {
}
// --------------------------------------------------------------------
-
+
/**
* Keyup
*
@@ -207,10 +207,10 @@ class CI_Javascript {
function keyup($element = 'this', $js = '')
{
return $this->js->_keyup($element, $js);
- }
+ }
// --------------------------------------------------------------------
-
+
/**
* Load
*
@@ -224,10 +224,10 @@ class CI_Javascript {
function load($element = 'this', $js = '')
{
return $this->js->_load($element, $js);
- }
-
+ }
+
// --------------------------------------------------------------------
-
+
/**
* Mousedown
*
@@ -244,7 +244,7 @@ class CI_Javascript {
}
// --------------------------------------------------------------------
-
+
/**
* Mouse Out
*
@@ -261,7 +261,7 @@ class CI_Javascript {
}
// --------------------------------------------------------------------
-
+
/**
* Mouse Over
*
@@ -360,7 +360,7 @@ class CI_Javascript {
{
return $this->js->_scroll($element, $js);
}
-
+
// --------------------------------------------------------------------
/**
@@ -378,9 +378,9 @@ class CI_Javascript {
return $this->js->_unload($element, $js);
}
- // --------------------------------------------------------------------
- // Effects
// --------------------------------------------------------------------
+ // Effects
+ // --------------------------------------------------------------------
/**
@@ -391,14 +391,14 @@ class CI_Javascript {
* @access public
* @param string - element
* @param string - Class to add
- * @return string
+ * @return string
*/
function addClass($element = 'this', $class = '')
{
return $this->js->_addClass($element, $class);
}
- // --------------------------------------------------------------------
+ // --------------------------------------------------------------------
/**
* Animate
@@ -409,7 +409,7 @@ class CI_Javascript {
* @param string - element
* @param string - One of 'slow', 'normal', 'fast', or time in milliseconds
* @param string - Javascript callback function
- * @return string
+ * @return string
*/
function animate($element = 'this', $params = array(), $speed = '', $extra = '')
{
@@ -417,7 +417,7 @@ class CI_Javascript {
}
// --------------------------------------------------------------------
-
+
/**
* Fade In
*
@@ -427,15 +427,15 @@ class CI_Javascript {
* @param string - element
* @param string - One of 'slow', 'normal', 'fast', or time in milliseconds
* @param string - Javascript callback function
- * @return string
+ * @return string
*/
function fadeIn($element = 'this', $speed = '', $callback = '')
{
return $this->js->_fadeIn($element, $speed, $callback);
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Fade Out
*
@@ -445,14 +445,14 @@ class CI_Javascript {
* @param string - element
* @param string - One of 'slow', 'normal', 'fast', or time in milliseconds
* @param string - Javascript callback function
- * @return string
+ * @return string
*/
function fadeOut($element = 'this', $speed = '', $callback = '')
{
return $this->js->_fadeOut($element, $speed, $callback);
}
// --------------------------------------------------------------------
-
+
/**
* Slide Up
*
@@ -462,14 +462,14 @@ class CI_Javascript {
* @param string - element
* @param string - One of 'slow', 'normal', 'fast', or time in milliseconds
* @param string - Javascript callback function
- * @return string
+ * @return string
*/
function slideUp($element = 'this', $speed = '', $callback = '')
{
return $this->js->_slideUp($element, $speed, $callback);
}
-
+
// --------------------------------------------------------------------
/**
@@ -480,15 +480,15 @@ class CI_Javascript {
* @access public
* @param string - element
* @param string - Class to add
- * @return string
+ * @return string
*/
function removeClass($element = 'this', $class = '')
{
return $this->js->_removeClass($element, $class);
}
- // --------------------------------------------------------------------
-
+ // --------------------------------------------------------------------
+
/**
* Slide Down
*
@@ -498,7 +498,7 @@ class CI_Javascript {
* @param string - element
* @param string - One of 'slow', 'normal', 'fast', or time in milliseconds
* @param string - Javascript callback function
- * @return string
+ * @return string
*/
function slideDown($element = 'this', $speed = '', $callback = '')
{
@@ -506,7 +506,7 @@ class CI_Javascript {
}
// --------------------------------------------------------------------
-
+
/**
* Slide Toggle
*
@@ -516,14 +516,14 @@ class CI_Javascript {
* @param string - element
* @param string - One of 'slow', 'normal', 'fast', or time in milliseconds
* @param string - Javascript callback function
- * @return string
+ * @return string
*/
function slideToggle($element = 'this', $speed = '', $callback = '')
{
return $this->js->_slideToggle($element, $speed, $callback);
}
-
+
// --------------------------------------------------------------------
/**
@@ -535,15 +535,15 @@ class CI_Javascript {
* @param string - element
* @param string - One of 'slow', 'normal', 'fast', or time in milliseconds
* @param string - Javascript callback function
- * @return string
+ * @return string
*/
function hide($element = 'this', $speed = '', $callback = '')
{
return $this->js->_hide($element, $speed, $callback);
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Toggle
*
@@ -551,16 +551,16 @@ class CI_Javascript {
*
* @access public
* @param string - element
- * @return string
+ * @return string
*/
function toggle($element = 'this')
{
return $this->js->_toggle($element);
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Toggle Class
*
@@ -568,15 +568,15 @@ class CI_Javascript {
*
* @access public
* @param string - element
- * @return string
+ * @return string
*/
function toggleClass($element = 'this', $class='')
{
return $this->js->_toggleClass($element, $class);
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Show
*
@@ -586,7 +586,7 @@ class CI_Javascript {
* @param string - element
* @param string - One of 'slow', 'normal', 'fast', or time in milliseconds
* @param string - Javascript callback function
- * @return string
+ * @return string
*/
function show($element = 'this', $speed = '', $callback = '')
{
@@ -604,12 +604,12 @@ class CI_Javascript {
* @access public
* @param string The element to attach the event to
* @return string
- */
+ */
function compile($view_var = 'script_foot', $script_tags = TRUE)
{
$this->js->_compile($view_var, $script_tags);
}
-
+
/**
* Clear Compile
*
@@ -624,7 +624,7 @@ class CI_Javascript {
}
// --------------------------------------------------------------------
-
+
/**
* External
*
@@ -645,16 +645,16 @@ class CI_Javascript {
if ($this->CI->config->item('javascript_location') != '')
{
$this->_javascript_location = $this->CI->config->item('javascript_location');
- }
+ }
}
-
+
if ($relative === TRUE OR strncmp($external_file, 'http://', 7) == 0 OR strncmp($external_file, 'https://', 8) == 0)
{
- $str = $this->_open_script($external_file);
+ $str = $this->_open_script($external_file);
}
elseif (strpos($this->_javascript_location, 'http://') !== FALSE)
{
- $str = $this->_open_script($this->_javascript_location.$external_file);
+ $str = $this->_open_script($this->_javascript_location.$external_file);
}
else
{
@@ -664,13 +664,13 @@ class CI_Javascript {
$str .= $this->_close_script();
return $str;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Inline
*
- * Outputs a <script> tag
+ * Outputs a <script> tag
*
* @access public
* @param string The element to attach the event to
@@ -682,19 +682,19 @@ class CI_Javascript {
$str = $this->_open_script();
$str .= ($cdata) ? "\n// <![CDATA[\n{$script}\n// ]]>\n" : "\n{$script}\n";
$str .= $this->_close_script();
-
+
return $str;
}
-
- // --------------------------------------------------------------------
+ // --------------------------------------------------------------------
+
/**
* Open Script
*
- * Outputs an opening <script>
+ * Outputs an opening <script>
*
* @access private
- * @param string
+ * @param string
* @return string
*/
function _open_script($src = '')
@@ -705,22 +705,22 @@ class CI_Javascript {
}
// --------------------------------------------------------------------
-
+
/**
* Close Script
*
- * Outputs an closing </script>
+ * Outputs an closing </script>
*
* @access private
- * @param string
+ * @param string
* @return string
*/
function _close_script($extra = "\n")
{
return "</script>$extra";
}
-
-
+
+
// --------------------------------------------------------------------
// --------------------------------------------------------------------
// AJAX-Y STUFF - still a testbed
@@ -736,15 +736,15 @@ class CI_Javascript {
* @param string - element
* @param string - One of 'slow', 'normal', 'fast', or time in milliseconds
* @param string - Javascript callback function
- * @return string
+ * @return string
*/
function update($element = 'this', $speed = '', $callback = '')
{
return $this->js->_updater($element, $speed, $callback);
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Generate JSON
*
@@ -780,7 +780,7 @@ class CI_Javascript {
$json = array();
$_is_assoc = TRUE;
-
+
if ( ! is_array($json_result) AND empty($json_result))
{
show_error("Generate JSON Failed - Illegal key, value pair.");
@@ -805,11 +805,11 @@ class CI_Javascript {
$json = implode(',', $json);
return $_is_assoc ? "{".$json."}" : "[".$json."]";
-
+
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Is associative array
*
@@ -828,12 +828,12 @@ class CI_Javascript {
return TRUE;
}
}
-
+
return FALSE;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Prep Args
*
@@ -862,7 +862,7 @@ class CI_Javascript {
return $result;
}
}
-
+
// --------------------------------------------------------------------
}
// END Javascript Class
diff --git a/system/libraries/Log.php b/system/libraries/Log.php
index 4e6b3bc39..99ed126f4 100644
--- a/system/libraries/Log.php
+++ b/system/libraries/Log.php
@@ -40,27 +40,27 @@ class CI_Log {
function CI_Log()
{
$config =& get_config();
-
+
$this->log_path = ($config['log_path'] != '') ? $config['log_path'] : BASEPATH.'logs/';
-
+
if ( ! is_dir($this->log_path) OR ! is_really_writable($this->log_path))
{
$this->_enabled = FALSE;
}
-
+
if (is_numeric($config['log_threshold']))
{
$this->_threshold = $config['log_threshold'];
}
-
+
if ($config['log_date_format'] != '')
{
$this->_date_fmt = $config['log_date_format'];
}
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Write Log File
*
@@ -71,42 +71,42 @@ class CI_Log {
* @param string the error message
* @param bool whether the error is a native PHP error
* @return bool
- */
+ */
function write_log($level = 'error', $msg, $php_error = FALSE)
- {
+ {
if ($this->_enabled === FALSE)
{
return FALSE;
}
-
+
$level = strtoupper($level);
-
+
if ( ! isset($this->_levels[$level]) OR ($this->_levels[$level] > $this->_threshold))
{
return FALSE;
}
-
+
$filepath = $this->log_path.'log-'.date('Y-m-d').EXT;
$message = '';
-
+
if ( ! file_exists($filepath))
{
$message .= "<"."?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?".">\n\n";
}
-
+
if ( ! $fp = @fopen($filepath, FOPEN_WRITE_CREATE))
{
return FALSE;
}
$message .= $level.' '.(($level == 'INFO') ? ' -' : '-').' '.date($this->_date_fmt). ' --> '.$msg."\n";
-
- flock($fp, LOCK_EX);
+
+ flock($fp, LOCK_EX);
fwrite($fp, $message);
flock($fp, LOCK_UN);
fclose($fp);
-
- @chmod($filepath, FILE_WRITE_MODE);
+
+ @chmod($filepath, FILE_WRITE_MODE);
return TRUE;
}
diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php
index 3a0632d09..b3175f997 100644
--- a/system/libraries/Pagination.php
+++ b/system/libraries/Pagination.php
@@ -30,11 +30,11 @@ class CI_Pagination {
var $prefix = ''; // A custom prefix added to the path.
var $suffix = ''; // A custom suffix added to the path.
- var $total_rows = ''; // Total number of items (database results)
- var $per_page = 10; // Max number of items you want shown per page
+ 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 $first_link = '&lsaquo; First';
+ var $cur_page = 0; // The current page being viewed
+ var $first_link = '&lsaquo; First';
var $next_link = '&gt;';
var $prev_link = '&lt;';
var $last_link = 'Last &rsaquo;';
@@ -190,7 +190,7 @@ class CI_Pagination {
$this->base_url = rtrim($this->base_url, '/') .'/';
}
- // And here we go...
+ // And here we go...
$output = '';
// Render the "First" link
@@ -204,17 +204,17 @@ class CI_Pagination {
if ($this->prev_link !== FALSE AND $this->cur_page != 1)
{
$i = $uri_page_number - $this->per_page;
-
+
if ($i == 0 && $this->first_url != '')
{
- $output .= $this->prev_tag_open.'<a '.$this->anchor_class.'href="'.$this->first_url.'">'.$this->prev_link.'</a>'.$this->prev_tag_close;
+ $output .= $this->prev_tag_open.'<a '.$this->anchor_class.'href="'.$this->first_url.'">'.$this->prev_link.'</a>'.$this->prev_tag_close;
}
else
{
$i = ($i == 0) ? '' : $this->prefix.$i.$this->suffix;
$output .= $this->prev_tag_open.'<a '.$this->anchor_class.'href="'.$this->base_url.$i.'">'.$this->prev_link.'</a>'.$this->prev_tag_close;
}
-
+
}
// Render the pages
@@ -234,7 +234,7 @@ class CI_Pagination {
else
{
$n = ($i == 0) ? '' : $i;
-
+
if ($n == '' && $this->first_url != '')
{
$output .= $this->num_tag_open.'<a '.$this->anchor_class.'href="'.$this->first_url.'">'.$loop.'</a>'.$this->num_tag_close;
@@ -242,7 +242,7 @@ class CI_Pagination {
else
{
$n = ($n == '') ? '' : $this->prefix.$n.$this->suffix;
-
+
$output .= $this->num_tag_open.'<a '.$this->anchor_class.'href="'.$this->base_url.$n.'">'.$loop.'</a>'.$this->num_tag_close;
}
}
diff --git a/system/libraries/Parser.php b/system/libraries/Parser.php
index 41a438bac..b969ce4d4 100644
--- a/system/libraries/Parser.php
+++ b/system/libraries/Parser.php
@@ -94,7 +94,7 @@ class CI_Parser {
{
if (is_array($val))
{
- $template = $this->_parse_pair($key, $val, $template);
+ $template = $this->_parse_pair($key, $val, $template);
}
else
{
@@ -110,9 +110,9 @@ class CI_Parser {
return $template;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Set the left/right variable delimiters
*
@@ -126,9 +126,9 @@ class CI_Parser {
$this->l_delim = $l;
$this->r_delim = $r;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Parse a single key/value
*
@@ -142,9 +142,9 @@ class CI_Parser {
{
return str_replace($this->l_delim.$key.$this->r_delim, $val, $string);
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Parse a tag pair
*
@@ -157,7 +157,7 @@ class CI_Parser {
* @return string
*/
function _parse_pair($variable, $data, $string)
- {
+ {
if (FALSE === ($match = $this->_match_pair($string, $variable)))
{
return $string;
@@ -178,15 +178,15 @@ class CI_Parser {
$temp = $this->_parse_pair($key, $val, $temp);
}
}
-
+
$str .= $temp;
}
-
+
return str_replace($match['0'], $str, $string);
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Matches a variable pair
*
@@ -201,7 +201,7 @@ class CI_Parser {
{
return FALSE;
}
-
+
return $match;
}
diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php
index db179976b..796db2d6b 100644
--- a/system/libraries/Profiler.php
+++ b/system/libraries/Profiler.php
@@ -33,7 +33,7 @@
class CI_Profiler {
var $CI;
-
+
var $_available_sections = array(
'benchmarks',
'get',
@@ -46,11 +46,11 @@ class CI_Profiler {
'config'
);
- function CI_Profiler($config = array())
- {
- $this->CI =& get_instance();
- $this->CI->load->language('profiler');
-
+ function CI_Profiler($config = array())
+ {
+ $this->CI =& get_instance();
+ $this->CI->load->language('profiler');
+
// default all sections to display
foreach ($this->_available_sections as $section)
{
@@ -59,10 +59,10 @@ class CI_Profiler {
$this->_compile_{$section} = TRUE;
}
}
-
+
$this->set_sections($config);
- }
-
+ }
+
// --------------------------------------------------------------------
/**
@@ -80,13 +80,13 @@ class CI_Profiler {
{
if (in_array($method, $this->_available_sections))
{
- $this->_compile_{$method} = ($enable !== FALSE) ? TRUE : FALSE;
+ $this->_compile_{$method} = ($enable !== FALSE) ? TRUE : FALSE;
}
}
}
// --------------------------------------------------------------------
-
+
/**
* Auto Profiler
*
@@ -98,45 +98,45 @@ class CI_Profiler {
* @access private
* @return array
*/
- function _compile_benchmarks()
- {
- $profile = array();
- foreach ($this->CI->benchmark->marker as $key => $val)
- {
- // We match the "end" marker so that the list ends
- // up in the order that it was defined
- if (preg_match("/(.+?)_end/i", $key, $match))
- {
- if (isset($this->CI->benchmark->marker[$match[1].'_end']) AND isset($this->CI->benchmark->marker[$match[1].'_start']))
- {
- $profile[$match[1]] = $this->CI->benchmark->elapsed_time($match[1].'_start', $key);
- }
- }
- }
+ function _compile_benchmarks()
+ {
+ $profile = array();
+ foreach ($this->CI->benchmark->marker as $key => $val)
+ {
+ // We match the "end" marker so that the list ends
+ // up in the order that it was defined
+ if (preg_match("/(.+?)_end/i", $key, $match))
+ {
+ if (isset($this->CI->benchmark->marker[$match[1].'_end']) AND isset($this->CI->benchmark->marker[$match[1].'_start']))
+ {
+ $profile[$match[1]] = $this->CI->benchmark->elapsed_time($match[1].'_start', $key);
+ }
+ }
+ }
// Build a table containing the profile data.
// Note: At some point we should turn this into a template that can
// be modified. We also might want to make this data available to be logged
-
+
$output = "\n\n";
$output .= '<fieldset style="border:1px solid #900;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee">';
$output .= "\n";
$output .= '<legend style="color:#900;">&nbsp;&nbsp;'.$this->CI->lang->line('profiler_benchmarks').'&nbsp;&nbsp;</legend>';
- $output .= "\n";
+ $output .= "\n";
$output .= "\n\n<table cellpadding='4' cellspacing='1' border='0' width='100%'>\n";
-
+
foreach ($profile as $key => $val)
{
$key = ucwords(str_replace(array('_', '-'), ' ', $key));
$output .= "<tr><td style='width:50%;color:#000;font-weight:bold;background-color:#ddd;'>".$key."&nbsp;&nbsp;</td><td style='width:50%;color:#900;font-weight:normal;background-color:#ddd;'>".$val."</td></tr>\n";
}
-
+
$output .= "</table>\n";
$output .= "</fieldset>";
-
- return $output;
- }
-
+
+ return $output;
+ }
+
// --------------------------------------------------------------------
/**
@@ -144,7 +144,7 @@ class CI_Profiler {
*
* @access private
* @return string
- */
+ */
function _compile_queries()
{
$dbs = array();
@@ -157,22 +157,22 @@ class CI_Profiler {
$dbs[] = $CI_object;
}
}
-
+
if (count($dbs) == 0)
{
$output = "\n\n";
$output .= '<fieldset style="border:1px solid #0000FF;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee">';
$output .= "\n";
$output .= '<legend style="color:#0000FF;">&nbsp;&nbsp;'.$this->CI->lang->line('profiler_queries').'&nbsp;&nbsp;</legend>';
- $output .= "\n";
+ $output .= "\n";
$output .= "\n\n<table cellpadding='4' cellspacing='1' border='0' style='width:100%'>\n";
$output .="<tr><td style='width:100%;color:#0000FF;font-weight:normal;background-color:#eee;'>".$this->CI->lang->line('profiler_no_db')."</td></tr>\n";
$output .= "</table>\n";
$output .= "</fieldset>";
-
+
return $output;
}
-
+
// Load the text helper so we can highlight the SQL
$this->CI->load->helper('text');
@@ -180,45 +180,45 @@ class CI_Profiler {
$highlight = array('SELECT', 'DISTINCT', 'FROM', 'WHERE', 'AND', 'LEFT&nbsp;JOIN', 'ORDER&nbsp;BY', 'GROUP&nbsp;BY', 'LIMIT', 'INSERT', 'INTO', 'VALUES', 'UPDATE', 'OR&nbsp;', 'HAVING', 'OFFSET', 'NOT&nbsp;IN', 'IN', 'LIKE', 'NOT&nbsp;LIKE', 'COUNT', 'MAX', 'MIN', 'ON', 'AS', 'AVG', 'SUM', '(', ')');
$output = "\n\n";
-
+
foreach ($dbs as $db)
{
$output .= '<fieldset style="border:1px solid #0000FF;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee">';
$output .= "\n";
$output .= '<legend style="color:#0000FF;">&nbsp;&nbsp;'.$this->CI->lang->line('profiler_database').':&nbsp; '.$db->database.'&nbsp;&nbsp;&nbsp;'.$this->CI->lang->line('profiler_queries').': '.count($this->CI->db->queries).'&nbsp;&nbsp;&nbsp;</legend>';
- $output .= "\n";
+ $output .= "\n";
$output .= "\n\n<table cellpadding='4' cellspacing='1' border='0' style='width:100%;'>\n";
-
+
if (count($db->queries) == 0)
{
$output .= "<tr><td style='width:100%;color:#0000FF;font-weight:normal;background-color:#eee;'>".$this->CI->lang->line('profiler_no_queries')."</td></tr>\n";
}
else
- {
+ {
foreach ($db->queries as $key => $val)
- {
+ {
$time = number_format($db->query_times[$key], 4);
$val = highlight_code($val, ENT_QUOTES);
-
+
foreach ($highlight as $bold)
{
- $val = str_replace($bold, '<strong>'.$bold.'</strong>', $val);
+ $val = str_replace($bold, '<strong>'.$bold.'</strong>', $val);
}
-
+
$output .= "<tr><td valign='top' style='width:1%;color:#900;font-weight:normal;background-color:#ddd;'>".$time."&nbsp;&nbsp;</td><td style='color:#000;font-weight:normal;background-color:#ddd;'>".$val."</td></tr>\n";
}
}
-
+
$output .= "</table>\n";
$output .= "</fieldset>";
-
+
}
-
+
return $output;
}
-
+
// --------------------------------------------------------------------
/**
@@ -226,15 +226,15 @@ class CI_Profiler {
*
* @access private
* @return string
- */
+ */
function _compile_get()
- {
+ {
$output = "\n\n";
$output .= '<fieldset style="border:1px solid #cd6e00;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee">';
$output .= "\n";
$output .= '<legend style="color:#cd6e00;">&nbsp;&nbsp;'.$this->CI->lang->line('profiler_get_data').'&nbsp;&nbsp;</legend>';
$output .= "\n";
-
+
if (count($_GET) == 0)
{
$output .= "<div style='color:#cd6e00;font-weight:normal;padding:4px 0 4px 0'>".$this->CI->lang->line('profiler_no_get')."</div>";
@@ -242,14 +242,14 @@ class CI_Profiler {
else
{
$output .= "\n\n<table cellpadding='4' cellspacing='1' border='0' width='100%'>\n";
-
+
foreach ($_GET as $key => $val)
{
if ( ! is_numeric($key))
{
$key = "'".$key."'";
}
-
+
$output .= "<tr><td width='50%' style='color:#000;background-color:#ddd;'>&#36;_GET[".$key."]&nbsp;&nbsp; </td><td width='50%' style='color:#cd6e00;font-weight:normal;background-color:#ddd;'>";
if (is_array($val))
{
@@ -261,30 +261,30 @@ class CI_Profiler {
}
$output .= "</td></tr>\n";
}
-
+
$output .= "</table>\n";
}
$output .= "</fieldset>";
- return $output;
+ return $output;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Compile $_POST Data
*
* @access private
* @return string
- */
+ */
function _compile_post()
- {
+ {
$output = "\n\n";
$output .= '<fieldset style="border:1px solid #009900;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee">';
$output .= "\n";
$output .= '<legend style="color:#009900;">&nbsp;&nbsp;'.$this->CI->lang->line('profiler_post_data').'&nbsp;&nbsp;</legend>';
$output .= "\n";
-
+
if (count($_POST) == 0)
{
$output .= "<div style='color:#009900;font-weight:normal;padding:4px 0 4px 0'>".$this->CI->lang->line('profiler_no_post')."</div>";
@@ -292,14 +292,14 @@ class CI_Profiler {
else
{
$output .= "\n\n<table cellpadding='4' cellspacing='1' border='0' width='100%'>\n";
-
+
foreach ($_POST as $key => $val)
{
if ( ! is_numeric($key))
{
$key = "'".$key."'";
}
-
+
$output .= "<tr><td width='50%' style='color:#000;background-color:#ddd;'>&#36;_POST[".$key."]&nbsp;&nbsp; </td><td width='50%' style='color:#009900;font-weight:normal;background-color:#ddd;'>";
if (is_array($val))
{
@@ -311,70 +311,70 @@ class CI_Profiler {
}
$output .= "</td></tr>\n";
}
-
+
$output .= "</table>\n";
}
$output .= "</fieldset>";
- return $output;
+ return $output;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Show query string
*
* @access private
* @return string
- */
+ */
function _compile_uri_string()
- {
+ {
$output = "\n\n";
$output .= '<fieldset style="border:1px solid #000;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee">';
$output .= "\n";
$output .= '<legend style="color:#000;">&nbsp;&nbsp;'.$this->CI->lang->line('profiler_uri_string').'&nbsp;&nbsp;</legend>';
$output .= "\n";
-
+
if ($this->CI->uri->uri_string == '')
{
$output .= "<div style='color:#000;font-weight:normal;padding:4px 0 4px 0'>".$this->CI->lang->line('profiler_no_uri')."</div>";
}
else
{
- $output .= "<div style='color:#000;font-weight:normal;padding:4px 0 4px 0'>".$this->CI->uri->uri_string."</div>";
+ $output .= "<div style='color:#000;font-weight:normal;padding:4px 0 4px 0'>".$this->CI->uri->uri_string."</div>";
}
-
+
$output .= "</fieldset>";
- return $output;
+ return $output;
}
// --------------------------------------------------------------------
-
+
/**
* Show the controller and function that were called
*
* @access private
* @return string
- */
+ */
function _compile_controller_info()
- {
+ {
$output = "\n\n";
$output .= '<fieldset style="border:1px solid #995300;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee">';
$output .= "\n";
$output .= '<legend style="color:#995300;">&nbsp;&nbsp;'.$this->CI->lang->line('profiler_controller_info').'&nbsp;&nbsp;</legend>';
$output .= "\n";
-
- $output .= "<div style='color:#995300;font-weight:normal;padding:4px 0 4px 0'>".$this->CI->router->fetch_class()."/".$this->CI->router->fetch_method()."</div>";
-
+ $output .= "<div style='color:#995300;font-weight:normal;padding:4px 0 4px 0'>".$this->CI->router->fetch_class()."/".$this->CI->router->fetch_method()."</div>";
+
+
$output .= "</fieldset>";
- return $output;
+ return $output;
}
// --------------------------------------------------------------------
-
+
/**
* Compile memory usage
*
@@ -390,23 +390,23 @@ class CI_Profiler {
$output .= "\n";
$output .= '<legend style="color:#5a0099;">&nbsp;&nbsp;'.$this->CI->lang->line('profiler_memory_usage').'&nbsp;&nbsp;</legend>';
$output .= "\n";
-
+
if (function_exists('memory_get_usage') && ($usage = memory_get_usage()) != '')
{
$output .= "<div style='color:#5a0099;font-weight:normal;padding:4px 0 4px 0'>".number_format($usage).' bytes</div>';
}
else
{
- $output .= "<div style='color:#5a0099;font-weight:normal;padding:4px 0 4px 0'>".$this->CI->lang->line('profiler_no_memory_usage')."</div>";
+ $output .= "<div style='color:#5a0099;font-weight:normal;padding:4px 0 4px 0'>".$this->CI->lang->line('profiler_no_memory_usage')."</div>";
}
-
+
$output .= "</fieldset>";
return $output;
}
// --------------------------------------------------------------------
-
+
/**
* Compile header information
*
@@ -463,7 +463,7 @@ class CI_Profiler {
{
$val = print_r($val, TRUE);
}
-
+
$output .= "<tr><td valign='top' style='color:#900;background-color:#ddd;'>".$config."&nbsp;&nbsp;</td><td style='color:#000;background-color:#ddd;'>".htmlspecialchars($val)."</td></tr>\n";
}
@@ -474,18 +474,18 @@ class CI_Profiler {
}
// --------------------------------------------------------------------
-
+
/**
* Run the Profiler
*
* @access private
* @return string
- */
+ */
function run()
{
$output = "<div id='codeigniter_profiler' style='clear:both;background-color:#fff;padding:10px;'>";
$fields_displayed = 0;
-
+
foreach ($this->_available_sections as $section)
{
if ($this->_compile_{$section} !== FALSE)
@@ -500,7 +500,7 @@ class CI_Profiler {
{
$output .= '<p style="border:1px solid #5a0099;padding:10px;margin:20px 0;background-color:#eee">'.$this->CI->lang->line('profiler_no_profiles').'</p>';
}
-
+
$output .= '</div>';
return $output;
diff --git a/system/libraries/Security.php b/system/libraries/Security.php
index 9a1590b5c..2db8ee9b3 100644
--- a/system/libraries/Security.php
+++ b/system/libraries/Security.php
@@ -25,12 +25,12 @@
* @link http://codeigniter.com/user_guide/libraries/sessions.html
*/
class CI_Security {
- var $xss_hash = '';
- var $csrf_hash = '';
+ var $xss_hash = '';
+ var $csrf_hash = '';
var $csrf_expire = 7200; // Two hours (in seconds)
var $csrf_token_name = 'ci_csrf_token';
var $csrf_cookie_name = 'ci_csrf_token';
-
+
/* never allowed, string replacement */
var $never_allowed_str = array(
'document.cookie' => '[removed]',
@@ -63,7 +63,7 @@ class CI_Security {
}
// --------------------------------------------------------------------
-
+
/**
* Verify Cross Site Request Forgery Protection
*
@@ -92,7 +92,7 @@ class CI_Security {
// We kill this since we're done and we don't want to polute the _POST array
unset($_POST[$this->csrf_token_name]);
-
+
// Nothing should last forever
unset($_COOKIE[$this->csrf_cookie_name]);
$this->_csrf_set_hash();
@@ -100,9 +100,9 @@ class CI_Security {
log_message('debug', "CSRF token verified ");
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Set Cross Site Request Forgery Protection Cookie
*
@@ -114,12 +114,12 @@ class CI_Security {
$expire = time() + $this->csrf_expire;
setcookie($this->csrf_cookie_name, $this->csrf_hash, $expire, config_item('cookie_path'), config_item('cookie_domain'), 0);
-
- log_message('debug', "CRSF cookie Set");
+
+ log_message('debug', "CRSF cookie Set");
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Set Cross Site Request Forgery Protection Cookie
*
@@ -146,7 +146,7 @@ class CI_Security {
}
// --------------------------------------------------------------------
-
+
/**
* Show CSRF Error
*
@@ -159,7 +159,7 @@ class CI_Security {
}
// --------------------------------------------------------------------
-
+
/**
* XSS Clean
*
@@ -198,7 +198,7 @@ class CI_Security {
{
$str[$key] = $this->xss_clean($str[$key]);
}
-
+
return $str;
}
@@ -210,9 +210,9 @@ class CI_Security {
/*
* Protect GET variables in URLs
*/
-
+
// 901119URL5918AMP18930PROTECT8198
-
+
$str = preg_replace('|\&([a-z\_0-9\-]+)\=([a-z\_0-9\-]+)|i', $this->xss_hash()."\\1=\\2", $str);
/*
@@ -225,7 +225,7 @@ class CI_Security {
$str = preg_replace('#(&\#?[0-9a-z]{2,})([\x00-\x20])*;?#i', "\\1;\\2", $str);
/*
- * Validate UTF16 two byte encoding (x00)
+ * Validate UTF16 two byte encoding (x00)
*
* Just as above, adds a semicolon if missing.
*
@@ -248,9 +248,9 @@ class CI_Security {
*
*/
$str = rawurldecode($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
@@ -259,14 +259,14 @@ class CI_Security {
*/
$str = preg_replace_callback("/[a-z]+=([\'\"]).*?\\1/si", array($this, '_convert_attribute'), $str);
-
+
$str = preg_replace_callback("/<\w+.*?(?=>|<|$)/si", array($this, '_decode_entity'), $str);
/*
* Remove Invisible Characters Again!
*/
$str = remove_invisible_characters($str);
-
+
/*
* Convert all tabs to spaces
*
@@ -276,29 +276,29 @@ class CI_Security {
* so we use str_replace.
*
*/
-
+
if (strpos($str, "\t") !== FALSE)
{
$str = str_replace("\t", ' ', $str);
}
-
+
/*
* Capture converted string for later comparison
*/
$converted_string = $str;
-
+
/*
* Not Allowed Under Any Conditions
*/
-
+
foreach ($this->never_allowed_str as $key => $val)
{
- $str = str_replace($key, $val, $str);
+ $str = str_replace($key, $val, $str);
}
-
+
foreach ($this->never_allowed_regex as $key => $val)
{
- $str = preg_replace("#".$key."#i", $val, $str);
+ $str = preg_replace("#".$key."#i", $val, $str);
}
/*
@@ -321,7 +321,7 @@ class CI_Security {
{
$str = str_replace(array('<?', '?'.'>'), array('&lt;?', '?&gt;'), $str);
}
-
+
/*
* Compact any exploded words
*
@@ -333,7 +333,7 @@ class CI_Security {
foreach ($words as $word)
{
$temp = '';
-
+
for ($i = 0, $wordlen = strlen($word); $i < $wordlen; $i++)
{
$temp .= substr($word, $i, 1)."\s*";
@@ -343,7 +343,7 @@ class CI_Security {
// That way valid stuff like "dealer to" does not become "dealerto"
$str = preg_replace_callback('#('.substr($temp, 0, -3).')(\W)#is', array($this, '_compact_exploded_words'), $str);
}
-
+
/*
* Remove disallowed Javascript in links or img tags
* We used to do some version comparisons and use of stripos for PHP5, but it is dog slow compared
@@ -352,17 +352,17 @@ class CI_Security {
do
{
$original = $str;
-
+
if (preg_match("/<a/i", $str))
{
$str = preg_replace_callback("#<a\s+([^>]*?)(>|$)#si", array($this, '_js_link_removal'), $str);
}
-
+
if (preg_match("/<img/i", $str))
{
$str = preg_replace_callback("#<img\s+([^>]*?)(\s?/?>|$)#si", array($this, '_js_img_removal'), $str);
}
-
+
if (preg_match("/script/i", $str) OR preg_match("/xss/i", $str))
{
$str = preg_replace("#<(/*)(script|xss)(.*?)\>#si", '[removed]', $str);
@@ -385,14 +385,14 @@ class CI_Security {
if ($is_image === TRUE)
{
/*
- * Adobe Photoshop puts XML metadata into JFIF images, including namespacing,
+ * Adobe Photoshop puts XML metadata into JFIF images, including namespacing,
* so we have to allow this for images. -Paul
*/
unset($event_handlers[array_search('xmlns', $event_handlers)]);
}
$str = preg_replace("#<([^><]+?)(".implode('|', $event_handlers).")(\s*=\s*[^><]*)([><]*)#i", "<\\1\\4", $str);
-
+
/*
* Sanitize naughty HTML elements
*
@@ -420,7 +420,7 @@ class CI_Security {
*
*/
$str = preg_replace('#(alert|cmd|passthru|eval|exec|expression|system|fopen|fsockopen|file|file_get_contents|readfile|unlink)(\s*)\((.*?)\)#si', "\\1\\2&#40;\\3&#41;", $str);
-
+
/*
* Final clean up
*
@@ -430,9 +430,9 @@ class CI_Security {
*/
foreach ($this->never_allowed_str as $key => $val)
{
- $str = str_replace($key, $val, $str);
+ $str = str_replace($key, $val, $str);
}
-
+
foreach ($this->never_allowed_regex as $key => $val)
{
$str = preg_replace("#".$key."#i", $val, $str);
@@ -457,13 +457,13 @@ class CI_Security {
return FALSE;
}
}
-
+
log_message('debug', "XSS Filtering completed");
return $str;
}
// --------------------------------------------------------------------
-
+
/**
* Random Hash for protecting URLs
*
@@ -471,22 +471,22 @@ class CI_Security {
* @return string
*/
function xss_hash()
- {
+ {
if ($this->xss_hash == '')
{
if (phpversion() >= 4.2)
mt_srand();
else
mt_srand(hexdec(substr(md5(microtime()), -8)) & 0x7fffffff);
-
+
$this->xss_hash = md5(time() + mt_rand(0, 1999999999));
}
-
+
return $this->xss_hash;
}
// --------------------------------------------------------------------
-
+
/**
* Compact Exploded Words
*
@@ -501,9 +501,9 @@ class CI_Security {
{
return preg_replace('/\s+/s', '', $matches[1]).$matches[2];
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Sanitize Naughty HTML
*
@@ -517,15 +517,15 @@ class CI_Security {
{
// encode opening brace
$str = '&lt;'.$matches[1].$matches[2].$matches[3];
-
+
// encode captured opening or closing brace to prevent recursive vectors
$str .= str_replace(array('>', '<'), array('&gt;', '&lt;'), $matches[4]);
-
+
return $str;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* JS Link Removal
*
@@ -543,7 +543,7 @@ class CI_Security {
$attributes = $this->_filter_attributes(str_replace(array('<', '>'), '', $match[1]));
return str_replace($match[1], preg_replace("#href=.*?(alert\(|alert&\#40;|javascript\:|charset\=|window\.|document\.|\.cookie|<script|<xss|base64\s*,)#si", "", $attributes), $match[0]);
}
-
+
/**
* JS Image Removal
*
@@ -563,7 +563,7 @@ class CI_Security {
}
// --------------------------------------------------------------------
-
+
/**
* Attribute Conversion
*
@@ -577,7 +577,7 @@ class CI_Security {
{
return str_replace(array('>', '<', '\\'), array('&gt;', '&lt;', '\\\\'), $match[0]);
}
-
+
// --------------------------------------------------------------------
/**
@@ -644,35 +644,35 @@ class CI_Security {
function entity_decode($str, $charset='UTF-8')
{
if (stristr($str, '&') === FALSE) return $str;
-
+
// The reason we are not using html_entity_decode() by itself is because
// while it is not technically correct to leave out the semicolon
// at the end of an entity most browsers will still interpret the entity
// correctly. html_entity_decode() does not convert entities without
// semicolons, so we are left with our own little solution here. Bummer.
-
+
if (function_exists('html_entity_decode') && (strtolower($charset) != 'utf-8' OR is_php('5.0.0')))
{
$str = html_entity_decode($str, ENT_COMPAT, $charset);
$str = preg_replace('~&#x(0*[0-9a-f]{2,5})~ei', 'chr(hexdec("\\1"))', $str);
return preg_replace('~&#([0-9]{2,4})~e', 'chr(\\1)', $str);
}
-
+
// Numeric Entities
$str = preg_replace('~&#x(0*[0-9a-f]{2,5});{0,1}~ei', 'chr(hexdec("\\1"))', $str);
$str = preg_replace('~&#([0-9]{2,4});{0,1}~e', 'chr(\\1)', $str);
-
+
// Literal Entities - Slightly slow so we do another check
if (stristr($str, '&') === FALSE)
{
$str = strtr($str, array_flip(get_html_translation_table(HTML_ENTITIES)));
}
-
+
return $str;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Filename Security
*
@@ -705,16 +705,16 @@ class CI_Security {
"%20",
"%22",
"%3c", // <
- "%253c", // <
- "%3e", // >
- "%0e", // >
- "%28", // (
- "%29", // )
- "%2528", // (
- "%26", // &
- "%24", // $
- "%3f", // ?
- "%3b", // ;
+ "%253c", // <
+ "%3e", // >
+ "%0e", // >
+ "%28", // (
+ "%29", // )
+ "%2528", // (
+ "%26", // &
+ "%24", // $
+ "%3f", // ?
+ "%3b", // ;
"%3d" // =
);
diff --git a/system/libraries/Session.php b/system/libraries/Session.php
index fc3ee0542..342c301e3 100644
--- a/system/libraries/Session.php
+++ b/system/libraries/Session.php
@@ -39,7 +39,7 @@ class CI_Session {
var $cookie_domain = '';
var $sess_time_to_update = 300;
var $encryption_key = '';
- var $flashdata_key = 'flash';
+ var $flashdata_key = 'flash';
var $time_reference = 'time';
var $gc_probability = 5;
var $userdata = array();
@@ -96,7 +96,7 @@ class CI_Session {
{
$this->sess_expiration = (60*60*24*365*2);
}
-
+
// Set the cookie name
$this->sess_cookie_name = $this->cookie_prefix.$this->sess_cookie_name;
@@ -112,10 +112,10 @@ class CI_Session {
}
// Delete 'old' flashdata (from last request)
- $this->_flashdata_sweep();
+ $this->_flashdata_sweep();
// Mark all new flashdata as old (data will be deleted before next request)
- $this->_flashdata_mark();
+ $this->_flashdata_mark();
// Delete expired sessions if necessary
$this->_sess_gc();
@@ -313,9 +313,9 @@ class CI_Session {
$sessid .= $this->CI->input->ip_address();
$this->userdata = array(
- 'session_id' => md5(uniqid($sessid, TRUE)),
- 'ip_address' => $this->CI->input->ip_address(),
- 'user_agent' => substr($this->CI->input->user_agent(), 0, 50),
+ 'session_id' => md5(uniqid($sessid, TRUE)),
+ 'ip_address' => $this->CI->input->ip_address(),
+ 'user_agent' => substr($this->CI->input->user_agent(), 0, 50),
'last_activity' => $this->now
);
@@ -656,9 +656,9 @@ class CI_Session {
// if encryption is not used, we provide an md5 hash to prevent userside tampering
$cookie_data = $cookie_data.md5($cookie_data.$this->encryption_key);
}
-
+
$expire = ($this->sess_expire_on_close === TRUE) ? 0 : $this->sess_expiration + time();
-
+
// Set the cookie
setcookie(
$this->sess_cookie_name,
@@ -690,7 +690,7 @@ class CI_Session {
{
if (is_string($val))
{
- $data[$key] = str_replace('\\', '{{slash}}', $val);
+ $data[$key] = str_replace('\\', '{{slash}}', $val);
}
}
}
@@ -698,7 +698,7 @@ class CI_Session {
{
if (is_string($data))
{
- $data = str_replace('\\', '{{slash}}', $data);
+ $data = str_replace('\\', '{{slash}}', $data);
}
}
@@ -727,7 +727,7 @@ class CI_Session {
{
if (is_string($val))
{
- $data[$key] = str_replace('{{slash}}', '\\', $val);
+ $data[$key] = str_replace('{{slash}}', '\\', $val);
}
}
diff --git a/system/libraries/Sha1.php b/system/libraries/Sha1.php
index f9611a8a5..ff7e72033 100644
--- a/system/libraries/Sha1.php
+++ b/system/libraries/Sha1.php
@@ -55,7 +55,7 @@ class CI_SHA {
* @access public
* @param string
* @return string
- */
+ */
function generate($str)
{
$n = ((strlen($str) + 8) >> 6) + 1;
@@ -117,7 +117,7 @@ class CI_SHA {
return $this->_hex($a).$this->_hex($b).$this->_hex($c).$this->_hex($d).$this->_hex($e);
}
-
+
// --------------------------------------------------------------------
/**
@@ -126,7 +126,7 @@ class CI_SHA {
* @access private
* @param string
* @return string
- */
+ */
function _hex($str)
{
$str = dechex($str);
@@ -138,7 +138,7 @@ class CI_SHA {
return $str;
}
-
+
// --------------------------------------------------------------------
/**
@@ -146,7 +146,7 @@ class CI_SHA {
*
* @access private
* @return string
- */
+ */
function _ft($t, $b, $c, $d)
{
if ($t < 20)
@@ -166,7 +166,7 @@ class CI_SHA {
*
* @access private
* @return string
- */
+ */
function _kt($t)
{
if ($t < 20)
@@ -186,7 +186,7 @@ class CI_SHA {
return -899497514;
}
}
-
+
// --------------------------------------------------------------------
/**
@@ -194,7 +194,7 @@ class CI_SHA {
*
* @access private
* @return string
- */
+ */
function _safe_add($x, $y)
{
$lsw = ($x & 0xFFFF) + ($y & 0xFFFF);
@@ -202,7 +202,7 @@ class CI_SHA {
return ($msw << 16) | ($lsw & 0xFFFF);
}
-
+
// --------------------------------------------------------------------
/**
@@ -210,7 +210,7 @@ class CI_SHA {
*
* @access private
* @return integer
- */
+ */
function _rol($num, $cnt)
{
return ($num << $cnt) | $this->_zero_fill($num, 32 - $cnt);
@@ -223,7 +223,7 @@ class CI_SHA {
*
* @access private
* @return string
- */
+ */
function _zero_fill($a, $b)
{
$bin = decbin($a);
diff --git a/system/libraries/Table.php b/system/libraries/Table.php
index 1f920ea9e..2fc1b634d 100644
--- a/system/libraries/Table.php
+++ b/system/libraries/Table.php
@@ -30,13 +30,13 @@ class CI_Table {
var $rows = array();
var $heading = array();
- var $auto_heading = TRUE;
- var $caption = NULL;
- var $template = NULL;
+ var $auto_heading = TRUE;
+ var $caption = NULL;
+ var $template = NULL;
var $newline = "\n";
var $empty_cells = "";
var $function = FALSE;
-
+
function CI_Table()
{
log_message('debug', "Table Class Initialized");
@@ -57,7 +57,7 @@ class CI_Table {
{
return FALSE;
}
-
+
$this->template = $template;
}
@@ -97,21 +97,21 @@ class CI_Table {
{
return FALSE;
}
-
- // Turn off the auto-heading feature since it's doubtful we
+
+ // Turn off the auto-heading feature since it's doubtful we
// will want headings from a one-dimensional array
$this->auto_heading = FALSE;
-
+
if ($col_limit == 0)
{
return $array;
}
-
+
$new = array();
while(count($array) > 0)
- {
- $temp = array_splice($array, 0, $col_limit);
-
+ {
+ $temp = array_splice($array, 0, $col_limit);
+
if (count($temp) < $col_limit)
{
for ($i = count($temp); $i < $col_limit; $i++)
@@ -119,10 +119,10 @@ class CI_Table {
$temp[] = '&nbsp;';
}
}
-
+
$new[] = $temp;
}
-
+
return $new;
}
@@ -141,7 +141,7 @@ class CI_Table {
{
$this->empty_cells = $value;
}
-
+
// --------------------------------------------------------------------
/**
@@ -160,7 +160,7 @@ class CI_Table {
}
// --------------------------------------------------------------------
-
+
/**
* Prep Args
*
@@ -188,9 +188,9 @@ class CI_Table {
}
else
{
- $args[$key] = array('data' => $val);
+ $args[$key] = array('data' => $val);
}
- }
+ }
}
}
else
@@ -203,12 +203,12 @@ class CI_Table {
}
}
}
-
+
return $args;
}
// --------------------------------------------------------------------
-
+
/**
* Add a table caption
*
@@ -219,7 +219,7 @@ class CI_Table {
function set_caption($caption)
{
$this->caption = $caption;
- }
+ }
// --------------------------------------------------------------------
@@ -246,23 +246,23 @@ class CI_Table {
$this->_set_from_array($table_data, $set_heading);
}
}
-
+
// Is there anything to display? No? Smite them!
if (count($this->heading) == 0 AND count($this->rows) == 0)
{
return 'Undefined table data';
}
-
+
// Compile and validate the template date
$this->_compile_template();
-
+
// set a custom cell manipulation function to a locally scoped variable so its callable
$function = $this->function;
-
+
// Build the table!
-
+
$out = $this->template['table_open'];
- $out .= $this->newline;
+ $out .= $this->newline;
// Add any caption here
if ($this->caption)
@@ -283,16 +283,16 @@ class CI_Table {
foreach($this->heading as $heading)
{
$temp = $this->template['heading_cell_start'];
-
+
foreach ($heading as $key => $val)
{
if ($key != 'data')
{
$temp = str_replace('<th', "<th $key='$val'", $temp);
- }
+ }
}
- $out .= $temp;
+ $out .= $temp;
$out .= isset($heading['data']) ? $heading['data'] : '';
$out .= $this->template['heading_cell_end'];
}
@@ -302,13 +302,13 @@ class CI_Table {
$out .= $this->template['thead_close'];
$out .= $this->newline;
}
-
+
// Build the table rows
if (count($this->rows) > 0)
{
$out .= $this->template['tbody_open'];
$out .= $this->newline;
-
+
$i = 1;
foreach($this->rows as $row)
{
@@ -316,25 +316,25 @@ class CI_Table {
{
break;
}
-
+
// We use modulus to alternate the row colors
$name = (fmod($i++, 2)) ? '' : 'alt_';
-
+
$out .= $this->template['row_'.$name.'start'];
- $out .= $this->newline;
-
+ $out .= $this->newline;
+
foreach($row as $cell)
{
$temp = $this->template['cell_'.$name.'start'];
-
+
foreach ($cell as $key => $val)
{
if ($key != 'data')
{
$temp = str_replace('<td', "<td $key='$val'", $temp);
- }
+ }
}
-
+
$cell = isset($cell['data']) ? $cell['data'] : '';
$out .= $temp;
@@ -353,23 +353,23 @@ class CI_Table {
$out .= $cell;
}
}
-
+
$out .= $this->template['cell_'.$name.'end'];
}
-
+
$out .= $this->template['row_'.$name.'end'];
- $out .= $this->newline;
+ $out .= $this->newline;
}
-
+
$out .= $this->template['tbody_close'];
$out .= $this->newline;
}
$out .= $this->template['table_close'];
-
+
return $out;
}
-
+
// --------------------------------------------------------------------
/**
@@ -382,9 +382,9 @@ class CI_Table {
{
$this->rows = array();
$this->heading = array();
- $this->auto_heading = TRUE;
+ $this->auto_heading = TRUE;
}
-
+
// --------------------------------------------------------------------
/**
@@ -400,7 +400,7 @@ class CI_Table {
{
return FALSE;
}
-
+
// First generate the headings from the table column names
if (count($this->heading) == 0)
{
@@ -408,12 +408,12 @@ class CI_Table {
{
return FALSE;
}
-
+
$this->heading = $this->_prep_args($query->list_fields());
}
-
+
// Next blast through the result array and build out the rows
-
+
if ($query->num_rows() > 0)
{
foreach ($query->result_array() as $row)
@@ -438,10 +438,10 @@ class CI_Table {
{
return FALSE;
}
-
+
$i = 0;
foreach ($data as $row)
- {
+ {
// If a heading hasn't already been set we'll use the first row of the array as the heading
if ($i == 0 AND count($data) > 1 AND count($this->heading) == 0 AND $set_heading == TRUE)
{
@@ -451,7 +451,7 @@ class CI_Table {
{
$this->rows[] = $this->_prep_args($row);
}
-
+
$i++;
}
}
@@ -464,14 +464,14 @@ class CI_Table {
* @access private
* @return void
*/
- function _compile_template()
- {
- if ($this->template == NULL)
- {
- $this->template = $this->_default_template();
- return;
- }
-
+ function _compile_template()
+ {
+ if ($this->template == NULL)
+ {
+ $this->template = $this->_default_template();
+ return;
+ }
+
$this->temp = $this->_default_template();
foreach (array('table_open', 'thead_open', 'thead_close', 'heading_row_start', 'heading_row_end', 'heading_cell_start', 'heading_cell_end', 'tbody_open', 'tbody_close', 'row_start', 'row_end', 'cell_start', 'cell_end', 'row_alt_start', 'row_alt_end', 'cell_alt_start', 'cell_alt_end', 'table_close') as $val)
{
@@ -479,9 +479,9 @@ class CI_Table {
{
$this->template[$val] = $this->temp[$val];
}
- }
- }
-
+ }
+ }
+
// --------------------------------------------------------------------
/**
@@ -493,33 +493,33 @@ class CI_Table {
function _default_template()
{
return array (
- 'table_open' => '<table border="0" cellpadding="4" cellspacing="0">',
-
+ 'table_open' => '<table border="0" cellpadding="4" cellspacing="0">',
+
'thead_open' => '<thead>',
'thead_close' => '</thead>',
-
- 'heading_row_start' => '<tr>',
- 'heading_row_end' => '</tr>',
+
+ 'heading_row_start' => '<tr>',
+ 'heading_row_end' => '</tr>',
'heading_cell_start' => '<th>',
'heading_cell_end' => '</th>',
'tbody_open' => '<tbody>',
'tbody_close' => '</tbody>',
-
- 'row_start' => '<tr>',
- 'row_end' => '</tr>',
+
+ 'row_start' => '<tr>',
+ 'row_end' => '</tr>',
'cell_start' => '<td>',
'cell_end' => '</td>',
- 'row_alt_start' => '<tr>',
- 'row_alt_end' => '</tr>',
+ 'row_alt_start' => '<tr>',
+ 'row_alt_end' => '</tr>',
'cell_alt_start' => '<td>',
'cell_alt_end' => '</td>',
- 'table_close' => '</table>'
- );
+ 'table_close' => '</table>'
+ );
}
-
+
}
diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php
index a27914487..a8be8a877 100644
--- a/system/libraries/Trackback.php
+++ b/system/libraries/Trackback.php
@@ -27,7 +27,7 @@
* @link http://codeigniter.com/user_guide/libraries/trackback.html
*/
class CI_Trackback {
-
+
var $time_format = 'local';
var $charset = 'UTF-8';
var $data = array('url' => '', 'title' => '', 'excerpt' => '', 'blog_name' => '', 'charset' => '');
@@ -44,24 +44,24 @@ class CI_Trackback {
{
log_message('debug', "Trackback Class Initialized");
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Send Trackback
*
* @access public
* @param array
* @return bool
- */
+ */
function send($tb_data)
- {
+ {
if ( ! is_array($tb_data))
{
$this->set_error('The send() method must be passed an array');
return FALSE;
}
-
+
// Pre-process the Trackback Data
foreach (array('url', 'title', 'excerpt', 'blog_name', 'ping_url') as $item)
{
@@ -70,14 +70,14 @@ class CI_Trackback {
$this->set_error('Required item missing: '.$item);
return FALSE;
}
-
+
switch ($item)
{
case 'ping_url' : $$item = $this->extract_urls($tb_data[$item]);
break;
case 'excerpt' : $$item = $this->limit_characters($this->convert_xml(strip_tags(stripslashes($tb_data[$item]))));
break;
- case 'url' : $$item = str_replace('&#45;', '-', $this->convert_xml(strip_tags(stripslashes($tb_data[$item]))));
+ case 'url' : $$item = str_replace('&#45;', '-', $this->convert_xml(strip_tags(stripslashes($tb_data[$item]))));
break;
default : $$item = $this->convert_xml(strip_tags(stripslashes($tb_data[$item])));
break;
@@ -103,9 +103,9 @@ 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);
-
+
// Send Trackback(s)
$return = TRUE;
if (count($ping_url) > 0)
@@ -116,14 +116,14 @@ class CI_Trackback {
{
$return = FALSE;
}
- }
+ }
}
return $return;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Receive Trackback Data
*
@@ -134,9 +134,9 @@ class CI_Trackback {
*
* @access public
* @return bool
- */
+ */
function receive()
- {
+ {
foreach (array('url', 'title', 'blog_name', 'excerpt') as $val)
{
if ( ! isset($_POST[$val]) OR $_POST[$val] == '')
@@ -144,29 +144,29 @@ class CI_Trackback {
$this->set_error('The following required POST variable is missing: '.$val);
return FALSE;
}
-
+
$this->data['charset'] = ( ! isset($_POST['charset'])) ? 'auto' : strtoupper(trim($_POST['charset']));
-
+
if ($val != 'url' && function_exists('mb_convert_encoding'))
{
$_POST[$val] = mb_convert_encoding($_POST[$val], $this->charset, $this->data['charset']);
}
-
+
$_POST[$val] = ($val != 'url') ? $this->convert_xml(strip_tags($_POST[$val])) : strip_tags($_POST[$val]);
-
+
if ($val == 'excerpt')
{
$_POST['excerpt'] = $this->limit_characters($_POST['excerpt']);
}
-
+
$this->data[$val] = $_POST[$val];
}
return TRUE;
- }
-
+ }
+
// --------------------------------------------------------------------
-
+
/**
* Send Trackback Error Message
*
@@ -177,15 +177,15 @@ class CI_Trackback {
* @access public
* @param string
* @return void
- */
+ */
function send_error($message = 'Incomplete Information')
{
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?".">\n<response>\n<error>1</error>\n<message>".$message."</message>\n</response>";
exit;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Send Trackback Success Message
*
@@ -194,29 +194,29 @@ class CI_Trackback {
*
* @access public
* @return void
- */
+ */
function send_success()
{
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?".">\n<response>\n<error>0</error>\n</response>";
exit;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Fetch a particular item
*
* @access public
* @param string
* @return string
- */
+ */
function data($item)
{
return ( ! isset($this->data[$item])) ? '' : $this->data[$item];
}
// --------------------------------------------------------------------
-
+
/**
* Process Trackback
*
@@ -227,11 +227,11 @@ class CI_Trackback {
* @param string
* @param string
* @return bool
- */
+ */
function process($url, $data)
{
$target = parse_url($url);
-
+
// Open the socket
if ( ! $fp = @fsockopen($target['host'], 80))
{
@@ -241,7 +241,7 @@ class CI_Trackback {
// Build the path
$ppath = ( ! isset($target['path'])) ? $url : $target['path'];
-
+
$path = (isset($target['query']) && $target['query'] != "") ? $ppath.'?'.$target['query'] : $ppath;
// Add the Trackback ID to the data string
@@ -260,32 +260,32 @@ class CI_Trackback {
// Was it successful?
$this->response = "";
-
+
while( ! feof($fp))
{
$this->response .= fgets($fp, 128);
}
@fclose($fp);
-
-
+
+
if (stristr($this->response, '<error>0</error>') === FALSE)
{
$message = 'An unknown error was encountered';
-
+
if (preg_match("/<message>(.*?)<\/message>/is", $this->response, $match))
{
$message = trim($match['1']);
}
-
+
$this->set_error($message);
return FALSE;
}
return TRUE;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Extract Trackback URLs
*
@@ -296,34 +296,34 @@ class CI_Trackback {
* @access public
* @param string
* @return string
- */
+ */
function extract_urls($urls)
- {
+ {
// Remove the pesky white space and replace with a comma.
$urls = preg_replace("/\s*(\S+)\s*/", "\\1,", $urls);
-
+
// If they use commas get rid of the doubles.
$urls = str_replace(",,", ",", $urls);
-
+
// Remove any comma that might be at the end
if (substr($urls, -1) == ",")
{
$urls = substr($urls, 0, -1);
}
-
+
// Break into an array via commas
$urls = preg_split('/[,]/', $urls);
-
+
// Removes duplicates
$urls = array_unique($urls);
-
+
array_walk($urls, array($this, 'validate_url'));
-
+
return $urls;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Validate URL
*
@@ -332,7 +332,7 @@ class CI_Trackback {
* @access public
* @param string
* @return string
- */
+ */
function validate_url($url)
{
$url = trim($url);
@@ -342,46 +342,46 @@ class CI_Trackback {
$url = "http://".$url;
}
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Find the Trackback URL's ID
*
* @access public
* @param string
* @return string
- */
+ */
function get_id($url)
- {
+ {
$tb_id = "";
-
+
if (strpos($url, '?') !== FALSE)
{
$tb_array = explode('/', $url);
$tb_end = $tb_array[count($tb_array)-1];
-
+
if ( ! is_numeric($tb_end))
{
$tb_end = $tb_array[count($tb_array)-2];
}
-
+
$tb_array = explode('=', $tb_end);
$tb_id = $tb_array[count($tb_array)-1];
}
else
{
$url = rtrim($url, '/');
-
+
$tb_array = explode('/', $url);
$tb_id = $tb_array[count($tb_array)-1];
-
+
if ( ! is_numeric($tb_id))
{
$tb_id = $tb_array[count($tb_array)-2];
}
- }
-
+ }
+
if ( ! preg_match ("/^([0-9]+)$/", $tb_id))
{
return FALSE;
@@ -389,11 +389,11 @@ class CI_Trackback {
else
{
return $tb_id;
- }
+ }
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Convert Reserved XML characters to Entities
*
@@ -404,22 +404,22 @@ class CI_Trackback {
function convert_xml($str)
{
$temp = '__TEMP_AMPERSANDS__';
-
+
$str = preg_replace("/&#(\d+);/", "$temp\\1;", $str);
$str = preg_replace("/&(\w+);/", "$temp\\1;", $str);
-
+
$str = str_replace(array("&","<",">","\"", "'", "-"),
- array("&amp;", "&lt;", "&gt;", "&quot;", "&#39;", "&#45;"),
- $str);
-
+ array("&amp;", "&lt;", "&gt;", "&quot;", "&#39;", "&#45;"),
+ $str);
+
$str = preg_replace("/$temp(\d+);/","&#\\1;",$str);
$str = preg_replace("/$temp(\w+);/","&\\1;", $str);
-
+
return $str;
- }
-
+ }
+
// --------------------------------------------------------------------
-
+
/**
* Character limiter
*
@@ -437,27 +437,27 @@ class CI_Trackback {
{
return $str;
}
-
+
$str = preg_replace("/\s+/", ' ', str_replace(array("\r\n", "\r", "\n"), ' ', $str));
-
+
if (strlen($str) <= $n)
{
return $str;
}
-
+
$out = "";
foreach (explode(' ', trim($str)) as $val)
{
- $out .= $val.' ';
+ $out .= $val.' ';
if (strlen($out) >= $n)
{
return trim($out).$end_char;
- }
+ }
}
}
-
+
// --------------------------------------------------------------------
-
+
/**
* High ASCII to Entities
*
@@ -470,58 +470,58 @@ class CI_Trackback {
*/
function convert_ascii($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];
- }
- else
- {
- if (count($temp) == 0)
- {
- $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);
-
- $out .= '&#'.$number.';';
- $count = 1;
- $temp = array();
- }
- }
- }
-
- return $out;
+ $count = 1;
+ $out = '';
+ $temp = array();
+
+ for ($i = 0, $s = strlen($str); $i < $s; $i++)
+ {
+ $ordinal = ord($str[$i]);
+
+ if ($ordinal < 128)
+ {
+ $out .= $str[$i];
+ }
+ else
+ {
+ if (count($temp) == 0)
+ {
+ $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);
+
+ $out .= '&#'.$number.';';
+ $count = 1;
+ $temp = array();
+ }
+ }
+ }
+
+ return $out;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Set error message
*
* @access public
* @param string
* @return void
- */
+ */
function set_error($msg)
{
log_message('error', $msg);
$this->error_msg[] = $msg;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Show error messages
*
@@ -529,15 +529,15 @@ class CI_Trackback {
* @param string
* @param string
* @return string
- */
+ */
function display_errors($open = '<p>', $close = '</p>')
- {
+ {
$str = '';
foreach ($this->error_msg as $val)
{
$str .= $open.$val.$close;
}
-
+
return $str;
}
diff --git a/system/libraries/Typography.php b/system/libraries/Typography.php
index f058769ec..d8b295e7b 100644
--- a/system/libraries/Typography.php
+++ b/system/libraries/Typography.php
@@ -28,22 +28,22 @@ class CI_Typography {
// Block level elements that should not be wrapped inside <p> tags
var $block_elements = 'address|blockquote|div|dl|fieldset|form|h\d|hr|noscript|object|ol|p|pre|script|table|ul';
-
+
// Elements that should not have <p> and <br /> tags within them.
var $skip_elements = 'p|pre|ol|ul|dl|object|table|h\d';
-
+
// Tags we want the parser to completely ignore when splitting the string.
var $inline_elements = 'a|abbr|acronym|b|bdo|big|br|button|cite|code|del|dfn|em|i|img|ins|input|label|map|kbd|q|samp|select|small|span|strong|sub|sup|textarea|tt|var';
-
+
// array of block level elements that require inner content to be within another block level element
var $inner_block_required = array('blockquote');
-
+
// the last block element parsed
var $last_block_element = '';
-
+
// whether or not to protect quotes within { curly braces }
var $protect_braced_quotes = FALSE;
-
+
/**
* Nothing to do here...
*
@@ -56,11 +56,11 @@ class CI_Typography {
* Auto Typography
*
* This function converts text, making it typographically correct:
- * - Converts double spaces into paragraphs.
- * - Converts single line breaks into <br /> tags
- * - Converts single and double quotes into correctly facing curly quote entities.
- * - Converts three dots into ellipsis.
- * - Converts double dashes into em-dashes.
+ * - Converts double spaces into paragraphs.
+ * - Converts single line breaks into <br /> tags
+ * - Converts single and double quotes into correctly facing curly quote entities.
+ * - Converts three dots into ellipsis.
+ * - Converts double dashes into em-dashes.
* - Converts two spaces into entities
*
* @access public
@@ -78,15 +78,15 @@ class CI_Typography {
// Standardize Newlines to make matching easier
if (strpos($str, "\r") !== FALSE)
{
- $str = str_replace(array("\r\n", "\r"), "\n", $str);
+ $str = str_replace(array("\r\n", "\r"), "\n", $str);
}
-
+
// Reduce line breaks. If there are more than two consecutive linebreaks
// we'll compress them down to a maximum of two since there's no benefit to more.
if ($reduce_linebreaks === TRUE)
{
$str = preg_replace("/\n\n+/", "\n\n", $str);
- }
+ }
// HTML comment tags don't conform to patterns of normal tags, so pull them out separately, only if needed
$html_comments = array();
@@ -101,50 +101,50 @@ class CI_Typography {
}
}
}
-
+
// match and yank <pre> tags if they exist. It's cheaper to do this separately since most content will
// not contain <pre> tags, and it keeps the PCRE patterns below simpler and faster
if (strpos($str, '<pre') !== FALSE)
{
$str = preg_replace_callback("#<pre.*?>.*?</pre>#si", array($this, '_protect_characters'), $str);
}
-
+
// Convert quotes within tags to temporary markers.
$str = preg_replace_callback("#<.+?>#si", array($this, '_protect_characters'), $str);
// Do the same with braces if necessary
if ($this->protect_braced_quotes === TRUE)
{
- $str = preg_replace_callback("#\{.+?\}#si", array($this, '_protect_characters'), $str);
+ $str = preg_replace_callback("#\{.+?\}#si", array($this, '_protect_characters'), $str);
}
-
- // Convert "ignore" tags to temporary marker. The parser splits out the string at every tag
- // it encounters. Certain inline tags, like image tags, links, span tags, etc. will be
+
+ // Convert "ignore" tags to temporary marker. The parser splits out the string at every tag
+ // 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 bracket < temporarily to: {@TAG}
$str = preg_replace("#<(/*)(".$this->inline_elements.")([ >])#i", "{@TAG}\\1\\2\\3", $str);
// Split the string at every tag. This expression creates an array with this prototype:
- //
- // [array]
- // {
- // [0] = <opening tag>
- // [1] = Content...
- // [2] = <closing tag>
- // Etc...
- // }
+ //
+ // [array]
+ // {
+ // [0] = <opening tag>
+ // [1] = Content...
+ // [2] = <closing tag>
+ // Etc...
+ // }
$chunks = preg_split('/(<(?:[^<>]+(?:"[^"]*"|\'[^\']*\')?)+>)/', $str, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
-
- // Build our finalized string. We cycle through the array, skipping tags, and processing the contained text
+
+ // Build our finalized string. We cycle through the array, skipping tags, and processing the contained text
$str = '';
$process = TRUE;
$paragraph = FALSE;
$current_chunk = 0;
$total_chunks = count($chunks);
-
+
foreach ($chunks as $chunk)
- {
+ {
$current_chunk++;
-
+
// Are we dealing with a tag? If so, we'll skip the processing for this cycle.
// Well also set the "process" flag which allows us to skip <pre> tags and a few other things.
if (preg_match("#<(/*)(".$this->block_elements.").*?>#", $chunk, $match))
@@ -153,7 +153,7 @@ class CI_Typography {
{
$process = ($match[1] == '/') ? TRUE : FALSE;
}
-
+
if ($match[1] == '')
{
$this->last_block_element = $match[2];
@@ -162,32 +162,32 @@ class CI_Typography {
$str .= $chunk;
continue;
}
-
+
if ($process == FALSE)
{
$str .= $chunk;
continue;
}
-
+
// Force a newline to make sure end tags get processed by _format_newlines()
if ($current_chunk == $total_chunks)
{
- $chunk .= "\n";
+ $chunk .= "\n";
}
-
+
// Convert Newlines into <p> and <br /> tags
$str .= $this->_format_newlines($chunk);
}
-
+
// No opening block level tag? Add it if needed.
if ( ! preg_match("/^\s*<(?:".$this->block_elements.")/i", $str))
{
$str = preg_replace("/^(.*?)<(".$this->block_elements.")/i", '<p>$1</p><$2', $str);
}
-
+
// Convert quotes, elipsis, em-dashes, non-breaking spaces, and ampersands
$str = $this->format_characters($str);
-
+
// restore HTML comments
for ($i = 0, $total = count($html_comments); $i < $total; $i++)
{
@@ -196,18 +196,18 @@ class CI_Typography {
// if '<p>{@HC1}' then replace <p>{@HC1}</p> with the comment, else replace only {@HC1} with the comment
$str = preg_replace('#(?(?=<p>\{@HC'.$i.'\})<p>\{@HC'.$i.'\}(\s*</p>)|\{@HC'.$i.'\})#s', $html_comments[$i], $str);
}
-
+
// Final clean up
$table = array(
-
+
// If the user submitted their own paragraph tags within the text
// we will retain them instead of using our tags.
'/(<p[^>*?]>)<p>/' => '$1', // <?php BBEdit syntax coloring bug fix
-
+
// Reduce multiple instances of opening/closing paragraph tags to a single one
'#(</p>)+#' => '</p>',
'/(<p>\W*<p>)+/' => '<p>',
-
+
// Clean up stray paragraph tags that appear before block level elements
'#<p></p><('.$this->block_elements.')#' => '<$1',
@@ -223,15 +223,15 @@ class CI_Typography {
// An unintended consequence of the _format_newlines function is that
// some of the newlines get truncated, resulting in <p> tags
- // starting immediately after <block> tags on the same line.
+ // starting immediately after <block> tags on the same line.
// This forces a newline after such occurrences, which looks much nicer.
"/><p>\n/" => ">\n<p>",
-
+
// Similarly, there might be cases where a closing </block> will follow
// a closing </p> tag, so we'll correct it by adding a newline in between
"#</p></#" => "</p>\n</"
);
-
+
// Do we need to reduce empty lines?
if ($reduce_linebreaks === TRUE)
{
@@ -243,13 +243,13 @@ class CI_Typography {
// otherwise most browsers won't treat them as true paragraphs
$table['#<p></p>#'] = '<p>&nbsp;</p>';
}
-
+
return preg_replace(array_keys($table), $table, $str);
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Format Characters
*
@@ -264,10 +264,10 @@ class CI_Typography {
function format_characters($str)
{
static $table;
-
+
if ( ! isset($table))
{
- $table = array(
+ $table = array(
// nested smart quotes, opening and closing
// note that rules for grammar (English) allow only for two levels deep
// and that single quotes are _supposed_ to always be on the outside
@@ -313,7 +313,7 @@ class CI_Typography {
return preg_replace(array_keys($table), $table, $str);
}
-
+
// --------------------------------------------------------------------
/**
@@ -324,25 +324,25 @@ class CI_Typography {
* @access public
* @param string
* @return string
- */
+ */
function _format_newlines($str)
{
if ($str == '')
{
return $str;
}
-
+
if (strpos($str, "\n") === FALSE && ! in_array($this->last_block_element, $this->inner_block_required))
{
return $str;
}
-
+
// Convert two consecutive newlines to paragraphs
$str = str_replace("\n\n", "</p>\n\n<p>", $str);
-
+
// Convert single spaces to <br /> tags
$str = preg_replace("/([^\n])(\n)([^\n])/", "\\1<br />\\2\\3", $str);
-
+
// Wrap the whole enchilada in enclosing paragraphs
if ($str != "\n")
{
@@ -355,19 +355,19 @@ class CI_Typography {
// Remove empty paragraphs if they are on the first line, as this
// is a potential unintended consequence of the previous code
$str = preg_replace("/<p><\/p>(.*)/", "\\1", $str, 1);
-
+
return $str;
}
-
+
// ------------------------------------------------------------------------
-
+
/**
* Protect Characters
*
* Protects special characters from being formatted later
* We don't want quotes converted within tags so we'll temporarily convert them to {@DQ} and {@SQ}
- * and we don't want double dashes converted to emdash entities, so they are marked with {@DD}
- * likewise double spaces are converted to {@NBS} to prevent entity conversion
+ * and we don't want double dashes converted to emdash entities, so they are marked with {@DD}
+ * likewise double spaces are converted to {@NBS} to prevent entity conversion
*
* @access public
* @param array
@@ -379,19 +379,19 @@ class CI_Typography {
}
// --------------------------------------------------------------------
-
+
/**
* Convert newlines to HTML line breaks except within PRE tags
*
* @access public
* @param string
* @return string
- */
+ */
function nl2br_except_pre($str)
{
$ex = explode("pre>",$str);
$ct = count($ex);
-
+
$newstr = "";
for ($i = 0; $i < $ct; $i++)
{
@@ -403,14 +403,14 @@ class CI_Typography {
{
$newstr .= $ex[$i];
}
-
+
if ($ct - 1 != $i)
$newstr .= "pre>";
}
-
+
return $newstr;
}
-
+
}
// END Typography Class
diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php
index c47143637..9a90cb47c 100644
--- a/system/libraries/Unit_test.php
+++ b/system/libraries/Unit_test.php
@@ -29,9 +29,9 @@
class CI_Unit_test {
var $active = TRUE;
- var $results = array();
+ var $results = array();
var $strict = FALSE;
- var $_template = NULL;
+ var $_template = NULL;
var $_template_rows = NULL;
var $_test_items_visible = array();
@@ -82,32 +82,32 @@ class CI_Unit_test {
* @param mixed
* @param string
* @return string
- */
+ */
function run($test, $expected = TRUE, $test_name = 'undefined', $notes = '')
{
if ($this->active == FALSE)
{
return FALSE;
}
-
+
if (in_array($expected, array('is_object', 'is_string', 'is_bool', 'is_true', 'is_false', 'is_int', 'is_numeric', 'is_float', 'is_double', 'is_array', 'is_null'), TRUE))
{
$expected = str_replace('is_float', 'is_double', $expected);
- $result = ($expected($test)) ? TRUE : FALSE;
+ $result = ($expected($test)) ? TRUE : FALSE;
$extype = str_replace(array('true', 'false'), 'bool', str_replace('is_', '', $expected));
}
else
{
if ($this->strict == TRUE)
- $result = ($test === $expected) ? TRUE : FALSE;
+ $result = ($test === $expected) ? TRUE : FALSE;
else
- $result = ($test == $expected) ? TRUE : FALSE;
-
+ $result = ($test == $expected) ? TRUE : FALSE;
+
$extype = gettype($expected);
}
-
+
$back = $this->_backtrace();
-
+
$report[] = array (
'test_name' => $test_name,
'test_datatype' => gettype($test),
@@ -124,7 +124,7 @@ class CI_Unit_test {
}
// --------------------------------------------------------------------
-
+
/**
* Generate a report
*
@@ -175,9 +175,9 @@ class CI_Unit_test {
return $r;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Use strict comparison
*
@@ -191,9 +191,9 @@ class CI_Unit_test {
{
$this->strict = ($state == FALSE) ? FALSE : TRUE;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Make Unit testing active
*
@@ -207,9 +207,9 @@ class CI_Unit_test {
{
$this->active = ($state == FALSE) ? FALSE : TRUE;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Result Array
*
@@ -219,15 +219,15 @@ class CI_Unit_test {
* @return array
*/
function result($results = array())
- {
+ {
$CI =& get_instance();
$CI->load->language('unit_test');
-
+
if (count($results) == 0)
{
$results = $this->results;
}
-
+
$retval = array();
foreach ($results as $result)
{
@@ -246,8 +246,8 @@ class CI_Unit_test {
if (FALSE !== ($line = $CI->lang->line(strtolower('ut_'.$v))))
{
$v = $line;
- }
- $temp[$CI->lang->line('ut_'.$k)] = $v;
+ }
+ $temp[$CI->lang->line('ut_'.$k)] = $v;
}
}
else
@@ -255,19 +255,19 @@ class CI_Unit_test {
if (FALSE !== ($line = $CI->lang->line(strtolower('ut_'.$val))))
{
$val = $line;
- }
+ }
$temp[$CI->lang->line('ut_'.$key)] = $val;
}
}
-
+
$retval[] = $temp;
}
-
+
return $retval;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Set the template
*
@@ -276,14 +276,14 @@ class CI_Unit_test {
* @access public
* @param string
* @return void
- */
+ */
function set_template($template)
{
$this->_template = $template;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Generate a backtrace
*
@@ -297,17 +297,17 @@ class CI_Unit_test {
if (function_exists('debug_backtrace'))
{
$back = debug_backtrace();
-
+
$file = ( ! isset($back['1']['file'])) ? '' : $back['1']['file'];
$line = ( ! isset($back['1']['line'])) ? '' : $back['1']['line'];
-
+
return array('file' => $file, 'line' => $line);
}
return array('file' => 'Unknown', 'line' => 'Unknown');
}
// --------------------------------------------------------------------
-
+
/**
* Get Default Template
*
@@ -315,17 +315,17 @@ class CI_Unit_test {
* @return string
*/
function _default_template()
- {
+ {
$this->_template = "\n".'<table style="width:100%; font-size:small; margin:10px 0; border-collapse:collapse; border:1px solid #CCC;">';
$this->_template .= '{rows}';
$this->_template .= "\n".'</table>';
-
+
$this->_template_rows = "\n\t".'<tr>';
$this->_template_rows .= "\n\t\t".'<th style="text-align: left; border-bottom:1px solid #CCC;">{item}</th>';
$this->_template_rows .= "\n\t\t".'<td style="border-bottom:1px solid #CCC;">{result}</td>';
- $this->_template_rows .= "\n\t".'</tr>';
+ $this->_template_rows .= "\n\t".'</tr>';
}
-
+
// --------------------------------------------------------------------
/**
@@ -336,29 +336,29 @@ class CI_Unit_test {
* @access private
* @return void
*/
- function _parse_template()
- {
- if ( ! is_null($this->_template_rows))
- {
- return;
- }
-
- if (is_null($this->_template))
- {
- $this->_default_template();
- return;
- }
-
+ function _parse_template()
+ {
+ if ( ! is_null($this->_template_rows))
+ {
+ return;
+ }
+
+ if (is_null($this->_template))
+ {
+ $this->_default_template();
+ return;
+ }
+
if ( ! preg_match("/\{rows\}(.*?)\{\/rows\}/si", $this->_template, $match))
{
- $this->_default_template();
- return;
+ $this->_default_template();
+ return;
}
$this->_template_rows = $match['1'];
- $this->_template = str_replace($match['0'], '{rows}', $this->_template);
- }
-
+ $this->_template = str_replace($match['0'], '{rows}', $this->_template);
+ }
+
}
// END Unit_test Class
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php
index c18c178df..c83d0aeaa 100644
--- a/system/libraries/Upload.php
+++ b/system/libraries/Upload.php
@@ -25,7 +25,7 @@
* @link http://codeigniter.com/user_guide/libraries/file_uploading.html
*/
class CI_Upload {
-
+
var $max_size = 0;
var $max_width = 0;
var $max_height = 0;
@@ -51,9 +51,9 @@ class CI_Upload {
var $xss_clean = FALSE;
var $temp_prefix = "temp_file_";
var $client_name = '';
-
+
var $_file_name_override = ''; //@PHP4 (should be private)
-
+
/**
* Constructor
*
@@ -65,19 +65,19 @@ class CI_Upload {
{
$this->initialize($props);
}
-
+
log_message('debug', "Upload Class Initialized");
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Initialize preferences
*
* @access public
* @param array
* @return void
- */
+ */
function initialize($config = array())
{
@@ -107,9 +107,9 @@ class CI_Upload {
'xss_clean' => FALSE,
'temp_prefix' => "temp_file_",
'client_name' => ''
- );
-
-
+ );
+
+
foreach ($defaults as $key => $val)
{
if (isset($config[$key]))
@@ -122,27 +122,27 @@ class CI_Upload {
else
{
$this->$key = $config[$key];
- }
+ }
}
else
{
$this->$key = $val;
}
}
-
+
// if a file_name was provided in the config, use it instead of the user input
// supplied file name for all uploads until initialized again
$this->_file_name_override = $this->file_name;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Perform the file upload
*
* @access public
* @return bool
- */
+ */
function do_upload($field = 'userfile')
{
// Is $_FILES[$field] set? If not, no reason to continue.
@@ -151,7 +151,7 @@ class CI_Upload {
$this->set_error('upload_no_file_selected');
return FALSE;
}
-
+
// Is the upload path valid?
if ( ! $this->validate_upload_path())
{
@@ -173,10 +173,10 @@ class CI_Upload {
$this->set_error('upload_file_exceeds_form_limit');
break;
case 3: // UPLOAD_ERR_PARTIAL
- $this->set_error('upload_file_partial');
+ $this->set_error('upload_file_partial');
break;
case 4: // UPLOAD_ERR_NO_FILE
- $this->set_error('upload_no_file_selected');
+ $this->set_error('upload_no_file_selected');
break;
case 6: // UPLOAD_ERR_NO_TMP_DIR
$this->set_error('upload_no_temp_directory');
@@ -196,14 +196,14 @@ class CI_Upload {
// Set the uploaded data as class variables
- $this->file_temp = $_FILES[$field]['tmp_name'];
- $this->file_size = $_FILES[$field]['size'];
+ $this->file_temp = $_FILES[$field]['tmp_name'];
+ $this->file_size = $_FILES[$field]['size'];
$this->file_type = preg_replace("/^(.+?);.*$/", "\\1", $_FILES[$field]['type']);
$this->file_type = strtolower(trim(stripslashes($this->file_type), '"'));
$this->file_name = $this->_prep_filename($_FILES[$field]['name']);
$this->file_ext = $this->get_extension($this->file_name);
$this->client_name = $this->file_name;
-
+
// Is the file type allowed to be uploaded?
if ( ! $this->is_allowed_filetype())
{
@@ -220,10 +220,10 @@ class CI_Upload {
if ( ! $this->is_allowed_filetype(TRUE))
{
$this->set_error('upload_invalid_filetype');
- return FALSE;
+ return FALSE;
}
}
-
+
// Convert the file size to kilobytes
if ($this->file_size > 0)
{
@@ -247,7 +247,7 @@ class CI_Upload {
// Sanitize the file name for security
$this->file_name = $this->clean_file_name($this->file_name);
-
+
// Truncate the file name if it's too long
if ($this->max_filename > 0)
{
@@ -271,7 +271,7 @@ class CI_Upload {
if ($this->overwrite == FALSE)
{
$this->file_name = $this->set_filename($this->upload_path, $this->file_name);
-
+
if ($this->file_name === FALSE)
{
return FALSE;
@@ -304,8 +304,8 @@ class CI_Upload {
{
if ( ! @move_uploaded_file($this->file_temp, $this->upload_path.$this->file_name))
{
- $this->set_error('upload_destination_error');
- return FALSE;
+ $this->set_error('upload_destination_error');
+ return FALSE;
}
}
@@ -319,18 +319,18 @@ class CI_Upload {
return TRUE;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Finalized Data Array
- *
+ *
* Returns an associative array containing all of the information
* related to the upload, allowing the developer easy access in one array.
*
* @access public
* @return array
- */
+ */
function data()
{
return array (
@@ -350,24 +350,24 @@ class CI_Upload {
'image_size_str' => $this->image_size_str,
);
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Set Upload Path
*
* @access public
* @param string
* @return void
- */
+ */
function set_upload_path($path)
{
// Make sure it has a trailing slash
$this->upload_path = rtrim($path, '/').'/';
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Set the file name
*
@@ -379,25 +379,25 @@ class CI_Upload {
* @param string
* @param string
* @return string
- */
+ */
function set_filename($path, $filename)
{
if ($this->encrypt_name == TRUE)
- {
+ {
mt_srand();
- $filename = md5(uniqid(mt_rand())).$this->file_ext;
+ $filename = md5(uniqid(mt_rand())).$this->file_ext;
}
-
+
if ( ! file_exists($path.$filename))
{
return $filename;
}
-
+
$filename = str_replace($this->file_ext, '', $filename);
-
+
$new_filename = '';
for ($i = 1; $i < 100; $i++)
- {
+ {
if ( ! file_exists($path.$filename.$i.$this->file_ext))
{
$new_filename = $filename.$i.$this->file_ext;
@@ -415,72 +415,72 @@ class CI_Upload {
return $new_filename;
}
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Set Maximum File Size
*
* @access public
* @param integer
* @return void
- */
+ */
function set_max_filesize($n)
{
$this->max_size = ((int) $n < 0) ? 0: (int) $n;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Set Maximum File Name Length
*
* @access public
* @param integer
* @return void
- */
+ */
function set_max_filename($n)
{
$this->max_filename = ((int) $n < 0) ? 0: (int) $n;
}
// --------------------------------------------------------------------
-
+
/**
* Set Maximum Image Width
*
* @access public
* @param integer
* @return void
- */
+ */
function set_max_width($n)
{
$this->max_width = ((int) $n < 0) ? 0: (int) $n;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Set Maximum Image Height
*
* @access public
* @param integer
* @return void
- */
+ */
function set_max_height($n)
{
$this->max_height = ((int) $n < 0) ? 0: (int) $n;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Set Allowed File Types
*
* @access public
* @param string
* @return void
- */
+ */
function set_allowed_types($types)
{
if ( ! is_array($types) && $types == '*')
@@ -490,9 +490,9 @@ class CI_Upload {
}
$this->allowed_types = explode('|', $types);
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Set Image Properties
*
@@ -501,7 +501,7 @@ class CI_Upload {
* @access public
* @param string
* @return void
- */
+ */
function set_image_properties($path = '')
{
if ( ! $this->is_image())
@@ -512,7 +512,7 @@ class CI_Upload {
if (function_exists('getimagesize'))
{
if (FALSE !== ($D = @getimagesize($path)))
- {
+ {
$types = array(1 => 'gif', 2 => 'jpeg', 3 => 'png');
$this->image_width = $D['0'];
@@ -522,9 +522,9 @@ class CI_Upload {
}
}
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Set XSS Clean
*
@@ -539,15 +539,15 @@ class CI_Upload {
{
$this->xss_clean = ($flag == TRUE) ? TRUE : FALSE;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Validate the image
*
* @access public
* @return bool
- */
+ */
function is_image()
{
// IE will sometimes return odd mime-types during upload, so here we just standardize all
@@ -555,12 +555,12 @@ class CI_Upload {
$png_mimes = array('image/x-png');
$jpeg_mimes = array('image/jpg', 'image/jpe', 'image/jpeg', 'image/pjpeg');
-
+
if (in_array($this->file_type, $png_mimes))
{
$this->file_type = 'image/png';
}
-
+
if (in_array($this->file_type, $jpeg_mimes))
{
$this->file_type = 'image/jpeg';
@@ -570,80 +570,80 @@ class CI_Upload {
'image/gif',
'image/jpeg',
'image/png',
- );
+ );
return (in_array($this->file_type, $img_mimes, TRUE)) ? TRUE : FALSE;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Verify that the filetype is allowed
*
* @access public
* @return bool
- */
+ */
function is_allowed_filetype($ignore_mime = FALSE)
{
if ($this->allowed_types == '*')
{
return TRUE;
}
-
+
if (count($this->allowed_types) == 0 OR ! is_array($this->allowed_types))
{
$this->set_error('upload_no_file_types');
return FALSE;
}
-
+
$ext = strtolower(ltrim($this->file_ext, '.'));
-
+
if ( ! in_array($ext, $this->allowed_types))
{
return FALSE;
}
- // Images get some additional checks
+ // Images get some additional checks
$image_types = array('gif', 'jpg', 'jpeg', 'png', 'jpe');
-
+
if (in_array($ext, $image_types))
{
if (getimagesize($this->file_temp) === FALSE)
{
return FALSE;
- }
+ }
}
-
+
if ($ignore_mime === TRUE)
{
return TRUE;
}
-
+
$mime = $this->mimes_types($ext);
-
+
if (is_array($mime))
{
if (in_array($this->file_type, $mime, TRUE))
{
return TRUE;
- }
+ }
}
elseif ($mime == $this->file_type)
{
return TRUE;
}
-
+
return FALSE;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Verify that the file is within the allowed size
*
* @access public
* @return bool
- */
+ */
function is_allowed_filesize()
{
if ($this->max_size != 0 AND $this->file_size > $this->max_size)
@@ -655,15 +655,15 @@ class CI_Upload {
return TRUE;
}
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Verify that the image is within the allowed width/height
*
* @access public
* @return bool
- */
+ */
function is_allowed_dimensions()
{
if ( ! $this->is_image())
@@ -690,9 +690,9 @@ class CI_Upload {
return TRUE;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Validate Upload Path
*
@@ -701,7 +701,7 @@ class CI_Upload {
*
* @access public
* @return bool
- */
+ */
function validate_upload_path()
{
if ($this->upload_path == '')
@@ -709,7 +709,7 @@ class CI_Upload {
$this->set_error('upload_no_filepath');
return FALSE;
}
-
+
if (function_exists('realpath') AND @realpath($this->upload_path) !== FALSE)
{
$this->upload_path = str_replace("\\", "/", realpath($this->upload_path));
@@ -730,31 +730,31 @@ class CI_Upload {
$this->upload_path = preg_replace("/(.+?)\/*$/", "\\1/", $this->upload_path);
return TRUE;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Extract the file extension
*
* @access public
* @param string
* @return string
- */
+ */
function get_extension($filename)
{
$x = explode('.', $filename);
return '.'.end($x);
- }
-
+ }
+
// --------------------------------------------------------------------
-
+
/**
* Clean the file name for security
*
* @access public
* @param string
* @return string
- */
+ */
function clean_file_name($filename)
{
$bad = array(
@@ -773,40 +773,40 @@ class CI_Upload {
"%20",
"%22",
"%3c", // <
- "%253c", // <
- "%3e", // >
- "%0e", // >
- "%28", // (
- "%29", // )
- "%2528", // (
- "%26", // &
- "%24", // $
- "%3f", // ?
- "%3b", // ;
+ "%253c", // <
+ "%3e", // >
+ "%0e", // >
+ "%28", // (
+ "%29", // )
+ "%2528", // (
+ "%26", // &
+ "%24", // $
+ "%3f", // ?
+ "%3b", // ;
"%3d" // =
);
-
+
$filename = str_replace($bad, '', $filename);
return stripslashes($filename);
}
// --------------------------------------------------------------------
-
+
/**
* Limit the File Name Length
*
* @access public
* @param string
* @return string
- */
+ */
function limit_filename_length($filename, $length)
{
if (strlen($filename) < $length)
{
return $filename;
}
-
+
$ext = '';
if (strpos($filename, '.') !== FALSE)
{
@@ -814,12 +814,12 @@ class CI_Upload {
$ext = '.'.array_pop($parts);
$filename = implode('.', $parts);
}
-
+
return substr($filename, 0, ($length - strlen($ext))).$ext;
}
// --------------------------------------------------------------------
-
+
/**
* Runs the file through the XSS clean function
*
@@ -829,26 +829,26 @@ class CI_Upload {
*
* @access public
* @return void
- */
+ */
function do_xss_clean()
- {
+ {
$file = $this->file_temp;
-
+
if (filesize($file) == 0)
{
return FALSE;
}
-
+
if (function_exists('memory_get_usage') && memory_get_usage() && ini_get('memory_limit') != '')
{
$current = ini_get('memory_limit') * 1024 * 1024;
-
+
// There was a bug/behavioural change in PHP 5.2, where numbers over one million get output
// into scientific notation. number_format() ensures this number is an integer
// http://bugs.php.net/bug.php?id=43053
-
+
$new_memory = number_format(ceil(filesize($file) + $current), 0, '.', '');
-
+
ini_set('memory_limit', $new_memory); // When an integer is used, the value is measured in bytes. - PHP.net
}
@@ -856,18 +856,18 @@ class CI_Upload {
// IE can be fooled into mime-type detecting a malformed image as an html file, thus executing an XSS attack on anyone
// using IE who looks at the image. It does this by inspecting the first 255 bytes of an image. To get around this
// CI will itself look at the first 255 bytes of an image to determine its relative safety. This can save a lot of
- // processor power and time if it is actually a clean image, as it will be in nearly all instances _except_ an
+ // processor power and time if it is actually a clean image, as it will be in nearly all instances _except_ an
// attempted XSS attack.
if (function_exists('getimagesize') && @getimagesize($file) !== FALSE)
{
- if (($file = @fopen($file, 'rb')) === FALSE) // "b" to force binary
- {
+ if (($file = @fopen($file, 'rb')) === FALSE) // "b" to force binary
+ {
return FALSE; // Couldn't open the file, return FALSE
- }
+ }
- $opening_bytes = fread($file, 256);
- fclose($file);
+ $opening_bytes = fread($file, 256);
+ fclose($file);
// These are known to throw IE into mime-type detection chaos
// <a, <body, <head, <html, <img, <plaintext, <pre, <script, <table, <title
@@ -885,37 +885,37 @@ class CI_Upload {
}
$CI =& get_instance();
-
+
if ( ! isset($CI->security))
{
$CI->load->library('security');
}
-
+
return $CI->security->xss_clean($data, TRUE);
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Set an error message
*
* @access public
* @param string
* @return void
- */
+ */
function set_error($msg)
{
- $CI =& get_instance();
+ $CI =& get_instance();
$CI->lang->load('upload');
-
+
if (is_array($msg))
{
foreach ($msg as $val)
{
- $msg = ($CI->lang->line($val) == FALSE) ? $val : $CI->lang->line($val);
+ $msg = ($CI->lang->line($val) == FALSE) ? $val : $CI->lang->line($val);
$this->error_msg[] = $msg;
log_message('error', $msg);
- }
+ }
}
else
{
@@ -924,9 +924,9 @@ class CI_Upload {
log_message('error', $msg);
}
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Display the error message
*
@@ -934,7 +934,7 @@ class CI_Upload {
* @param string
* @param string
* @return string
- */
+ */
function display_errors($open = '<p>', $close = '</p>')
{
$str = '';
@@ -942,12 +942,12 @@ class CI_Upload {
{
$str .= $open.$val.$close;
}
-
+
return $str;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* List of Mime Types
*
@@ -957,11 +957,11 @@ class CI_Upload {
* @access public
* @param string
* @return string
- */
+ */
function mimes_types($mime)
{
global $mimes;
-
+
if (count($this->mimes) == 0)
{
if (@require_once(APPPATH.'config/mimes'.EXT))
@@ -970,12 +970,12 @@ class CI_Upload {
unset($mimes);
}
}
-
+
return ( ! isset($this->mimes[$mime])) ? FALSE : $this->mimes[$mime];
}
// --------------------------------------------------------------------
-
+
/**
* Prep Filename
*
@@ -1010,7 +1010,7 @@ class CI_Upload {
}
$filename .= '.'.$ext;
-
+
return $filename;
}
diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php
index a7c7a7609..00cbf6967 100644
--- a/system/libraries/User_agent.php
+++ b/system/libraries/User_agent.php
@@ -29,25 +29,25 @@
class CI_User_agent {
var $agent = NULL;
-
+
var $is_browser = FALSE;
var $is_robot = FALSE;
var $is_mobile = FALSE;
var $languages = array();
var $charsets = array();
-
+
var $platforms = array();
var $browsers = array();
var $mobiles = array();
var $robots = array();
-
+
var $platform = '';
var $browser = '';
var $version = '';
var $mobile = '';
var $robot = '';
-
+
/**
* Constructor
*
@@ -55,14 +55,14 @@ class CI_User_agent {
*
* @access public
* @return void
- */
+ */
function CI_User_agent()
{
if (isset($_SERVER['HTTP_USER_AGENT']))
{
$this->agent = trim($_SERVER['HTTP_USER_AGENT']);
}
-
+
if ( ! is_null($this->agent))
{
if ($this->_load_agent_file())
@@ -70,27 +70,27 @@ class CI_User_agent {
$this->_compile_data();
}
}
-
+
log_message('debug', "User Agent Class Initialized");
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Compile the User Agent Data
*
* @access private
* @return bool
- */
+ */
function _load_agent_file()
{
if ( ! @include(APPPATH.'config/user_agents'.EXT))
{
return FALSE;
}
-
+
$return = FALSE;
-
+
if (isset($platforms))
{
$this->platforms = $platforms;
@@ -111,7 +111,7 @@ class CI_User_agent {
unset($mobiles);
$return = TRUE;
}
-
+
if (isset($robots))
{
$this->robots = $robots;
@@ -121,36 +121,36 @@ class CI_User_agent {
return $return;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Compile the User Agent Data
*
* @access private
* @return bool
- */
+ */
function _compile_data()
{
$this->_set_platform();
-
+
foreach (array('_set_browser', '_set_robot', '_set_mobile') as $function)
{
if ($this->$function() === TRUE)
{
break;
}
- }
+ }
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Set the Platform
*
* @access private
* @return mixed
- */
+ */
function _set_platform()
{
if (is_array($this->platforms) AND count($this->platforms) > 0)
@@ -168,19 +168,19 @@ class CI_User_agent {
}
// --------------------------------------------------------------------
-
+
/**
* Set the Browser
*
* @access private
* @return bool
- */
+ */
function _set_browser()
{
if (is_array($this->browsers) AND count($this->browsers) > 0)
{
foreach ($this->browsers as $key => $val)
- {
+ {
if (preg_match("|".preg_quote($key).".*?([0-9\.]+)|i", $this->agent, $match))
{
$this->is_browser = TRUE;
@@ -193,19 +193,19 @@ class CI_User_agent {
}
return FALSE;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Set the Robot
*
* @access private
* @return bool
- */
+ */
function _set_robot()
{
if (is_array($this->robots) AND count($this->robots) > 0)
- {
+ {
foreach ($this->robots as $key => $val)
{
if (preg_match("|".preg_quote($key)."|i", $this->agent))
@@ -220,17 +220,17 @@ class CI_User_agent {
}
// --------------------------------------------------------------------
-
+
/**
* Set the Mobile Device
*
* @access private
* @return bool
- */
+ */
function _set_mobile()
{
if (is_array($this->mobiles) AND count($this->mobiles) > 0)
- {
+ {
foreach ($this->mobiles as $key => $val)
{
if (FALSE !== (strpos(strtolower($this->agent), $key)))
@@ -240,261 +240,261 @@ class CI_User_agent {
return TRUE;
}
}
- }
+ }
return FALSE;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Set the accepted languages
*
* @access private
* @return void
- */
+ */
function _set_languages()
{
if ((count($this->languages) == 0) AND isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) AND $_SERVER['HTTP_ACCEPT_LANGUAGE'] != '')
{
$languages = preg_replace('/(;q=[0-9\.]+)/i', '', strtolower(trim($_SERVER['HTTP_ACCEPT_LANGUAGE'])));
-
+
$this->languages = explode(',', $languages);
}
-
+
if (count($this->languages) == 0)
{
$this->languages = array('Undefined');
- }
+ }
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Set the accepted character sets
*
* @access private
* @return void
- */
+ */
function _set_charsets()
- {
+ {
if ((count($this->charsets) == 0) AND isset($_SERVER['HTTP_ACCEPT_CHARSET']) AND $_SERVER['HTTP_ACCEPT_CHARSET'] != '')
{
$charsets = preg_replace('/(;q=.+)/i', '', strtolower(trim($_SERVER['HTTP_ACCEPT_CHARSET'])));
-
+
$this->charsets = explode(',', $charsets);
}
-
+
if (count($this->charsets) == 0)
{
$this->charsets = array('Undefined');
- }
+ }
}
// --------------------------------------------------------------------
-
+
/**
* Is Browser
*
* @access public
* @return bool
- */
+ */
function is_browser()
{
return $this->is_browser;
}
// --------------------------------------------------------------------
-
+
/**
* Is Robot
*
* @access public
* @return bool
- */
+ */
function is_robot()
{
return $this->is_robot;
}
// --------------------------------------------------------------------
-
+
/**
* Is Mobile
*
* @access public
* @return bool
- */
+ */
function is_mobile()
{
return $this->is_mobile;
- }
+ }
// --------------------------------------------------------------------
-
+
/**
* Is this a referral from another site?
*
* @access public
* @return bool
- */
+ */
function is_referral()
{
return ( ! isset($_SERVER['HTTP_REFERER']) OR $_SERVER['HTTP_REFERER'] == '') ? FALSE : TRUE;
}
// --------------------------------------------------------------------
-
+
/**
* Agent String
*
* @access public
* @return string
- */
+ */
function agent_string()
{
return $this->agent;
}
// --------------------------------------------------------------------
-
+
/**
* Get Platform
*
* @access public
* @return string
- */
+ */
function platform()
{
return $this->platform;
}
// --------------------------------------------------------------------
-
+
/**
* Get Browser Name
*
* @access public
* @return string
- */
+ */
function browser()
{
return $this->browser;
}
// --------------------------------------------------------------------
-
+
/**
* Get the Browser Version
*
* @access public
* @return string
- */
+ */
function version()
{
return $this->version;
}
// --------------------------------------------------------------------
-
+
/**
* Get The Robot Name
*
* @access public
* @return string
- */
+ */
function robot()
{
return $this->robot;
}
// --------------------------------------------------------------------
-
+
/**
* Get the Mobile Device
*
* @access public
* @return string
- */
+ */
function mobile()
{
return $this->mobile;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Get the referrer
*
* @access public
* @return bool
- */
+ */
function referrer()
{
return ( ! isset($_SERVER['HTTP_REFERER']) OR $_SERVER['HTTP_REFERER'] == '') ? '' : trim($_SERVER['HTTP_REFERER']);
}
// --------------------------------------------------------------------
-
+
/**
* Get the accepted languages
*
* @access public
* @return array
- */
+ */
function languages()
{
if (count($this->languages) == 0)
{
$this->_set_languages();
}
-
+
return $this->languages;
}
// --------------------------------------------------------------------
-
+
/**
* Get the accepted Character Sets
*
* @access public
* @return array
- */
+ */
function charsets()
{
if (count($this->charsets) == 0)
{
$this->_set_charsets();
}
-
+
return $this->charsets;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Test for a particular language
*
* @access public
* @return bool
- */
+ */
function accept_lang($lang = 'en')
{
return (in_array(strtolower($lang), $this->languages(), TRUE)) ? TRUE : FALSE;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Test for a particular character set
*
* @access public
* @return bool
- */
+ */
function accept_charset($charset = 'utf-8')
{
return (in_array(strtolower($charset), $this->charsets(), TRUE)) ? TRUE : FALSE;
}
-
-
+
+
}
diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php
index ff03a503a..54ee70771 100644
--- a/system/libraries/Xmlrpc.php
+++ b/system/libraries/Xmlrpc.php
@@ -14,7 +14,7 @@
*/
if ( ! function_exists('xml_parser_create'))
-{
+{
show_error('Your PHP installation does not support XML');
}
@@ -32,34 +32,34 @@ if ( ! function_exists('xml_parser_create'))
*/
class CI_Xmlrpc {
- var $debug = FALSE; // Debugging on or off
+ var $debug = FALSE; // Debugging on or off
var $xmlrpcI4 = 'i4';
var $xmlrpcInt = 'int';
var $xmlrpcBoolean = 'boolean';
- var $xmlrpcDouble = 'double';
+ var $xmlrpcDouble = 'double';
var $xmlrpcString = 'string';
var $xmlrpcDateTime = 'dateTime.iso8601';
var $xmlrpcBase64 = 'base64';
var $xmlrpcArray = 'array';
var $xmlrpcStruct = 'struct';
-
+
var $xmlrpcTypes = array();
var $valid_parents = array();
var $xmlrpcerr = array(); // Response numbers
var $xmlrpcstr = array(); // Response strings
-
+
var $xmlrpc_defencoding = 'UTF-8';
var $xmlrpcName = 'XML-RPC for CodeIgniter';
var $xmlrpcVersion = '1.1';
var $xmlrpcerruser = 800; // Start of user errors
var $xmlrpcerrxml = 100; // Start of XML Parse errors
var $xmlrpc_backslash = ''; // formulate backslashes for escaping regexp
-
+
var $client;
var $method;
var $data;
var $message = '';
- var $error = ''; // Error string for request
+ var $error = ''; // Error string for request
var $result;
var $response = array(); // Response from remote server
@@ -71,22 +71,22 @@ class CI_Xmlrpc {
function CI_Xmlrpc ($config = array())
{
- $this->xmlrpcName = $this->xmlrpcName;
+ $this->xmlrpcName = $this->xmlrpcName;
$this->xmlrpc_backslash = chr(92).chr(92);
-
+
// Types for info sent back and forth
$this->xmlrpcTypes = array(
- $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->xmlrpcStruct => '3'
+ $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->xmlrpcStruct => '3'
);
-
+
// Array of Valid Parents for Various XML-RPC elements
$this->valid_parents = array('BOOLEAN' => array('VALUE'),
'I4' => array('VALUE'),
@@ -106,8 +106,8 @@ class CI_Xmlrpc {
'FAULT' => array('METHODRESPONSE'),
'VALUE' => array('MEMBER', 'DATA', 'PARAM', 'FAULT')
);
-
-
+
+
// XML-RPC Responses
$this->xmlrpcerr['unknown_method'] = '1';
$this->xmlrpcstr['unknown_method'] = 'This is not a known method for this XML-RPC Server';
@@ -121,13 +121,13 @@ class CI_Xmlrpc {
$this->xmlrpcstr['http_error'] = "Did not receive a '200 OK' response from remote server.";
$this->xmlrpcerr['no_data'] = '6';
$this->xmlrpcstr['no_data'] ='No data received from server.';
-
+
$this->initialize($config);
-
+
log_message('debug', "XML-RPC Class Initialized");
}
-
-
+
+
//-------------------------------------
// Initialize Prefs
//-------------------------------------
@@ -140,13 +140,13 @@ class CI_Xmlrpc {
{
if (isset($this->$key))
{
- $this->$key = $val;
+ $this->$key = $val;
}
}
}
}
// END
-
+
//-------------------------------------
// Take URL and parse it
//-------------------------------------
@@ -157,20 +157,20 @@ class CI_Xmlrpc {
{
$url = "http://".$url;
}
-
+
$parts = parse_url($url);
-
+
$path = ( ! isset($parts['path'])) ? '/' : $parts['path'];
-
+
if (isset($parts['query']) && $parts['query'] != '')
{
$path .= '?'.$parts['query'];
- }
-
+ }
+
$this->client = new XML_RPC_Client($path, $parts['host'], $port);
}
// END
-
+
//-------------------------------------
// Set Timeout
//-------------------------------------
@@ -183,7 +183,7 @@ class CI_Xmlrpc {
}
}
// END
-
+
//-------------------------------------
// Set Methods
//-------------------------------------
@@ -193,7 +193,7 @@ class CI_Xmlrpc {
$this->method = $function;
}
// END
-
+
//-------------------------------------
// Take Array of Data and Create Objects
//-------------------------------------
@@ -204,17 +204,17 @@ class CI_Xmlrpc {
{
// Send Error
}
-
+
$this->data = array();
-
+
foreach($incoming as $key => $value)
{
$this->data[$key] = $this->values_parsing($value);
}
}
// END
-
-
+
+
//-------------------------------------
// Set Debug
//-------------------------------------
@@ -223,7 +223,7 @@ class CI_Xmlrpc {
{
$this->debug = ($flag == TRUE) ? TRUE : FALSE;
}
-
+
//-------------------------------------
// Values Parsing
//-------------------------------------
@@ -249,7 +249,7 @@ class CI_Xmlrpc {
{
$value['0'][$k] = $this->values_parsing($value['0'][$k], TRUE);
}
-
+
$temp = new XML_RPC_Values($value['0'], $value['1']);
}
else
@@ -275,7 +275,7 @@ class CI_Xmlrpc {
{
$this->message = new XML_RPC_Message($this->method,$this->data);
$this->message->debug = $this->debug;
-
+
if ( ! $this->result = $this->client->send($this->message))
{
$this->error = $this->result->errstr;
@@ -286,13 +286,13 @@ class CI_Xmlrpc {
$this->error = $this->result->errstr;
return FALSE;
}
-
+
$this->response = $this->result->decode();
-
+
return TRUE;
}
// END
-
+
//-------------------------------------
// Returns Error
//-------------------------------------
@@ -302,7 +302,7 @@ class CI_Xmlrpc {
return $this->error;
}
// END
-
+
//-------------------------------------
// Returns Remote Server Response
//-------------------------------------
@@ -312,37 +312,37 @@ class CI_Xmlrpc {
return $this->response;
}
// END
-
+
//-------------------------------------
// Sends an Error Message for Server Request
//-------------------------------------
-
+
function send_error_message($number, $message)
{
return new XML_RPC_Response('0',$number, $message);
}
// END
-
-
+
+
//-------------------------------------
// Send Response for Server Request
//-------------------------------------
-
+
function send_response($response)
{
// $response should be array of values, which will be parsed
// based on their data and type into a valid group of XML-RPC values
-
+
$response = $this->values_parsing($response);
-
+
return new XML_RPC_Response($response);
}
// END
-
+
} // END XML_RPC Class
-
-
+
+
/**
* XML-RPC Client class
*
@@ -363,12 +363,12 @@ class XML_RPC_Client extends CI_Xmlrpc
function XML_RPC_Client($path, $server, $port=80)
{
parent::CI_Xmlrpc();
-
+
$this->port = $port;
$this->server = $server;
$this->path = $path;
}
-
+
function send($msg)
{
if (is_array($msg))
@@ -382,22 +382,22 @@ class XML_RPC_Client extends CI_Xmlrpc
}
function sendPayload($msg)
- {
+ {
$fp = @fsockopen($this->server, $this->port,$this->errno, $this->errstr, $this->timeout);
-
+
if ( ! is_resource($fp))
{
error_log($this->xmlrpcstr['http_error']);
$r = new XML_RPC_Response(0, $this->xmlrpcerr['http_error'],$this->xmlrpcstr['http_error']);
return $r;
}
-
+
if(empty($msg->payload))
{
// $msg = XML_RPC_Messages
$msg->createPayload();
}
-
+
$r = "\r\n";
$op = "POST {$this->path} HTTP/1.0$r";
$op .= "Host: {$this->server}$r";
@@ -405,7 +405,7 @@ class XML_RPC_Client extends CI_Xmlrpc
$op .= "User-Agent: {$this->xmlrpcName}$r";
$op .= "Content-Length: ".strlen($msg->payload). "$r$r";
$op .= $msg->payload;
-
+
if ( ! fputs($fp, $op, strlen($op)))
{
@@ -437,7 +437,7 @@ class XML_RPC_Response
var $xss_clean = TRUE;
function XML_RPC_Response($val, $code = 0, $fstr = '')
- {
+ {
if ($code != 0)
{
// error
@@ -470,7 +470,7 @@ class XML_RPC_Response
{
return $this->val;
}
-
+
function prepare_response()
{
$result = "<methodResponse>\n";
@@ -500,7 +500,7 @@ class XML_RPC_Response
$result .= "\n</methodResponse>";
return $result;
}
-
+
function decode($array=FALSE)
{
$CI =& get_instance();
@@ -523,13 +523,13 @@ class XML_RPC_Response
$array[$key] = ($this->xss_clean) ? $CI->security->xss_clean($array[$key]) : $array[$key];
}
}
-
+
$result = $array;
}
else
{
$result = $this->xmlrpc_decoder($this->val);
-
+
if (is_array($result))
{
$result = $this->decode($result);
@@ -539,12 +539,12 @@ class XML_RPC_Response
$result = ($this->xss_clean) ? $CI->security->xss_clean($result) : $result;
}
}
-
+
return $result;
}
-
-
+
+
//-------------------------------------
// XML-RPC Object to PHP Types
//-------------------------------------
@@ -562,7 +562,7 @@ class XML_RPC_Response
reset($xmlrpc_val->me);
list($a,$b) = each($xmlrpc_val->me);
$size = count($b);
-
+
$arr = array();
for($i = 0; $i < $size; $i++)
@@ -583,8 +583,8 @@ class XML_RPC_Response
return $arr;
}
}
-
-
+
+
//-------------------------------------
// ISO-8601 time to server or UTC time
//-------------------------------------
@@ -602,7 +602,7 @@ class XML_RPC_Response
}
return $t;
}
-
+
} // End Response Class
@@ -619,12 +619,12 @@ class XML_RPC_Message extends CI_Xmlrpc
var $payload;
var $method_name;
var $params = array();
- var $xh = array();
+ var $xh = array();
function XML_RPC_Message($method, $pars=0)
{
parent::CI_Xmlrpc();
-
+
$this->method_name = $method;
if (is_array($pars) && count($pars) > 0)
{
@@ -635,51 +635,51 @@ class XML_RPC_Message extends CI_Xmlrpc
}
}
}
-
+
//-------------------------------------
// Create Payload to Send
//-------------------------------------
-
+
function createPayload()
{
$this->payload = "<?xml version=\"1.0\"?".">\r\n<methodCall>\r\n";
$this->payload .= '<methodName>' . $this->method_name . "</methodName>\r\n";
$this->payload .= "<params>\r\n";
-
+
for($i=0; $i<count($this->params); $i++)
{
// $p = XML_RPC_Values
$p = $this->params[$i];
$this->payload .= "<param>\r\n".$p->serialize_class()."</param>\r\n";
}
-
+
$this->payload .= "</params>\r\n</methodCall>\r\n";
}
-
+
//-------------------------------------
// Parse External XML-RPC Server's Response
//-------------------------------------
-
+
function parseResponse($fp)
{
$data = '';
-
+
while($datum = fread($fp, 4096))
{
$data .= $datum;
}
-
+
//-------------------------------------
// DISPLAY HTTP CONTENT for DEBUGGING
//-------------------------------------
-
+
if ($this->debug === TRUE)
{
echo "<pre>";
echo "---DATA---\n" . htmlspecialchars($data) . "\n---END DATA---\n\n";
echo "</pre>";
}
-
+
//-------------------------------------
// Check for data
//-------------------------------------
@@ -690,32 +690,32 @@ class XML_RPC_Message extends CI_Xmlrpc
$r = new XML_RPC_Response(0, $this->xmlrpcerr['no_data'], $this->xmlrpcstr['no_data']);
return $r;
}
-
-
+
+
//-------------------------------------
// Check for HTTP 200 Response
//-------------------------------------
-
+
if (strncmp($data, 'HTTP', 4) == 0 && ! preg_match('/^HTTP\/[0-9\.]+ 200 /', $data))
{
$errstr= substr($data, 0, strpos($data, "\n")-1);
$r = new XML_RPC_Response(0, $this->xmlrpcerr['http_error'], $this->xmlrpcstr['http_error']. ' (' . $errstr . ')');
return $r;
}
-
+
//-------------------------------------
// Create and Set Up XML Parser
//-------------------------------------
-
+
$parser = xml_parser_create($this->xmlrpc_defencoding);
- $this->xh[$parser] = array();
- $this->xh[$parser]['isf'] = 0;
- $this->xh[$parser]['ac'] = '';
- $this->xh[$parser]['headers'] = array();
- $this->xh[$parser]['stack'] = array();
- $this->xh[$parser]['valuestack'] = array();
- $this->xh[$parser]['isf_reason'] = 0;
+ $this->xh[$parser] = array();
+ $this->xh[$parser]['isf'] = 0;
+ $this->xh[$parser]['ac'] = '';
+ $this->xh[$parser]['headers'] = array();
+ $this->xh[$parser]['stack'] = array();
+ $this->xh[$parser]['valuestack'] = array();
+ $this->xh[$parser]['isf_reason'] = 0;
xml_set_object($parser, $this);
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);
@@ -727,7 +727,7 @@ class XML_RPC_Message extends CI_Xmlrpc
//-------------------------------------
// GET HEADERS
//-------------------------------------
-
+
$lines = explode("\r\n", $data);
while (($line = array_shift($lines)))
{
@@ -738,11 +738,11 @@ class XML_RPC_Message extends CI_Xmlrpc
$this->xh[$parser]['headers'][] = $line;
}
$data = implode("\r\n", $lines);
-
-
+
+
//-------------------------------------
// PARSE XML DATA
- //-------------------------------------
+ //-------------------------------------
if ( ! xml_parse($parser, $data, count($data)))
{
@@ -755,11 +755,11 @@ class XML_RPC_Message extends CI_Xmlrpc
return $r;
}
xml_parser_free($parser);
-
+
// ---------------------------------------
// Got Ourselves Some Badness, It Seems
// ---------------------------------------
-
+
if ($this->xh[$parser]['isf'] > 1)
{
if ($this->debug === TRUE)
@@ -768,7 +768,7 @@ class XML_RPC_Message extends CI_Xmlrpc
echo $this->xh[$parser]['isf_reason'];
echo "---Invalid Return---\n\n";
}
-
+
$r = new XML_RPC_Response(0, $this->xmlrpcerr['invalid_return'],$this->xmlrpcstr['invalid_return'].' '.$this->xh[$parser]['isf_reason']);
return $r;
}
@@ -777,15 +777,15 @@ class XML_RPC_Message extends CI_Xmlrpc
$r = new XML_RPC_Response(0, $this->xmlrpcerr['invalid_return'],$this->xmlrpcstr['invalid_return'].' '.$this->xh[$parser]['isf_reason']);
return $r;
}
-
+
//-------------------------------------
// DISPLAY XML CONTENT for DEBUGGING
- //-------------------------------------
-
+ //-------------------------------------
+
if ($this->debug === TRUE)
{
echo "<pre>";
-
+
if (count($this->xh[$parser]['headers'] > 0))
{
echo "---HEADERS---\n";
@@ -795,20 +795,20 @@ class XML_RPC_Message extends CI_Xmlrpc
}
echo "---END HEADERS---\n\n";
}
-
+
echo "---DATA---\n" . htmlspecialchars($data) . "\n---END DATA---\n\n";
-
+
echo "---PARSED---\n" ;
var_dump($this->xh[$parser]['value']);
echo "\n---END PARSED---</pre>";
}
-
+
//-------------------------------------
// SEND RESPONSE
//-------------------------------------
-
+
$v = $this->xh[$parser]['value'];
-
+
if ($this->xh[$parser]['isf'])
{
$errno_v = $v->me['struct']['faultCode'];
@@ -831,11 +831,11 @@ class XML_RPC_Message extends CI_Xmlrpc
$r->headers = $this->xh[$parser]['headers'];
return $r;
}
-
+
// ------------------------------------
// Begin Return Message Parsing section
// ------------------------------------
-
+
// quick explanation of components:
// ac - used to accumulate values
// isf - used to indicate a fault
@@ -854,9 +854,9 @@ class XML_RPC_Message extends CI_Xmlrpc
{
// If invalid nesting, then return
if ($this->xh[$the_parser]['isf'] > 1) return;
-
+
// Evaluate and check for correct nesting of XML elements
-
+
if (count($this->xh[$the_parser]['stack']) == 0)
{
if ($name != 'METHODRESPONSE' && $name != 'METHODCALL')
@@ -876,16 +876,16 @@ class XML_RPC_Message extends CI_Xmlrpc
return;
}
}
-
+
switch($name)
{
case 'STRUCT':
case 'ARRAY':
// Creates array for child elements
-
+
$cur_val = array('value' => array(),
'type' => $name);
-
+
array_unshift($this->xh[$the_parser]['valuestack'], $cur_val);
break;
case 'METHODNAME':
@@ -917,13 +917,13 @@ class XML_RPC_Message extends CI_Xmlrpc
$this->xh[$the_parser]['isf_reason'] = "'Twas a $name element following a ".$this->xh[$the_parser]['vt']." element inside a single value";
return;
}
-
+
$this->xh[$the_parser]['ac'] = '';
break;
case 'MEMBER':
// Set name of <member> to nothing to prevent errors later if no <name> is found
$this->xh[$the_parser]['valuestack'][0]['name'] = '';
-
+
// Set NULL value to check to see if value passed for this param/member
$this->xh[$the_parser]['value'] = null;
break;
@@ -939,7 +939,7 @@ class XML_RPC_Message extends CI_Xmlrpc
$this->xh[$the_parser]['isf_reason'] = "Invalid XML-RPC element found: $name";
break;
}
-
+
// Add current element name to stack, to allow validation of nesting
array_unshift($this->xh[$the_parser]['stack'], $name);
@@ -955,14 +955,14 @@ class XML_RPC_Message extends CI_Xmlrpc
function closing_tag($the_parser, $name)
{
if ($this->xh[$the_parser]['isf'] > 1) return;
-
+
// Remove current element from stack and set variable
// NOTE: If the XML validates, then we do not have to worry about
// the opening and closing of elements. Nesting is checked on the opening
// tag so we be safe there as well.
-
+
$curr_elem = array_shift($this->xh[$the_parser]['stack']);
-
+
switch($name)
{
case 'STRUCT':
@@ -982,7 +982,7 @@ class XML_RPC_Message extends CI_Xmlrpc
case 'DATETIME.ISO8601':
case 'BASE64':
$this->xh[$the_parser]['vt'] = strtolower($name);
-
+
if ($name == 'STRING')
{
$this->xh[$the_parser]['value'] = $this->xh[$the_parser]['ac'];
@@ -1044,10 +1044,10 @@ class XML_RPC_Message extends CI_Xmlrpc
$this->xh[$the_parser]['value'] = $this->xh[$the_parser]['ac'];
$this->xh[$the_parser]['vt'] = $this->xmlrpcString;
}
-
+
// build the XML-RPC value out of the data received, and substitute it
$temp = new XML_RPC_Values($this->xh[$the_parser]['value'], $this->xh[$the_parser]['vt']);
-
+
if (count($this->xh[$the_parser]['valuestack']) && $this->xh[$the_parser]['valuestack'][0]['type'] == 'ARRAY')
{
// Array
@@ -1061,7 +1061,7 @@ class XML_RPC_Message extends CI_Xmlrpc
break;
case 'MEMBER':
$this->xh[$the_parser]['ac']='';
-
+
// If value add to array in the stack for the last element built
if ($this->xh[$the_parser]['value'])
{
@@ -1099,7 +1099,7 @@ class XML_RPC_Message extends CI_Xmlrpc
function character_data($the_parser, $data)
{
if ($this->xh[$the_parser]['isf'] > 1) return; // XML Fault found already
-
+
// If a value has not been found
if ($this->xh[$the_parser]['lv'] != 3)
{
@@ -1107,28 +1107,28 @@ class XML_RPC_Message extends CI_Xmlrpc
{
$this->xh[$the_parser]['lv'] = 2; // Found a value
}
-
+
if( ! @isset($this->xh[$the_parser]['ac']))
{
$this->xh[$the_parser]['ac'] = '';
}
-
+
$this->xh[$the_parser]['ac'] .= $data;
}
}
-
-
+
+
function addParam($par) { $this->params[]=$par; }
-
+
function output_parameters($array=FALSE)
{
- $CI =& get_instance();
+ $CI =& get_instance();
if ($this->xss_clean && ! isset($CI->security))
{
$CI->load->library('security');
}
-
+
if ($array !== FALSE && is_array($array))
{
while (list($key) = each($array))
@@ -1144,17 +1144,17 @@ class XML_RPC_Message extends CI_Xmlrpc
$array[$key] = ($key == 'bits' OR $this->xss_clean == FALSE) ? $array[$key] : $CI->security->xss_clean($array[$key]);
}
}
-
+
$parameters = $array;
}
else
{
$parameters = array();
-
+
for ($i = 0; $i < count($this->params); $i++)
{
$a_param = $this->decode_message($this->params[$i]);
-
+
if (is_array($a_param))
{
$parameters[] = $this->output_parameters($a_param);
@@ -1163,13 +1163,13 @@ class XML_RPC_Message extends CI_Xmlrpc
{
$parameters[] = ($this->xss_clean) ? $CI->security->xss_clean($a_param) : $a_param;
}
- }
+ }
}
-
+
return $parameters;
}
-
-
+
+
function decode_message($param)
{
$kind = $param->kindOf();
@@ -1182,31 +1182,31 @@ class XML_RPC_Message extends CI_Xmlrpc
{
reset($param->me);
list($a,$b) = each($param->me);
-
+
$arr = array();
for($i = 0; $i < count($b); $i++)
{
$arr[] = $this->decode_message($param->me['array'][$i]);
}
-
+
return $arr;
}
elseif($kind == 'struct')
{
reset($param->me['struct']);
-
+
$arr = array();
while(list($key,$value) = each($param->me['struct']))
{
$arr[$key] = $this->decode_message($value);
}
-
+
return $arr;
}
}
-
+
} // End XML_RPC_Messages class
@@ -1220,17 +1220,17 @@ class XML_RPC_Message extends CI_Xmlrpc
*/
class XML_RPC_Values extends CI_Xmlrpc
{
- var $me = array();
+ var $me = array();
var $mytype = 0;
function XML_RPC_Values($val=-1, $type='')
- {
+ {
parent::CI_Xmlrpc();
-
+
if ($val != -1 OR $type != '')
{
$type = $type == '' ? 'string' : $type;
-
+
if ($this->xmlrpcTypes[$type] == 1)
{
$this->addScalar($val,$type);
@@ -1249,13 +1249,13 @@ class XML_RPC_Values extends CI_Xmlrpc
function addScalar($val, $type='string')
{
$typeof = $this->xmlrpcTypes[$type];
-
+
if ($this->mytype==1)
{
echo '<strong>XML_RPC_Values</strong>: scalar can have only one value<br />';
return 0;
}
-
+
if ($typeof != 1)
{
echo '<strong>XML_RPC_Values</strong>: not a scalar type (${typeof})<br />';
@@ -1392,12 +1392,12 @@ class XML_RPC_Values extends CI_Xmlrpc
{
$ar = $o->me;
reset($ar);
-
+
list($typ, $val) = each($ar);
$rs = "<value>\n".$this->serializedata($typ, $val)."</value>\n";
return $rs;
}
-
+
function scalarval()
{
reset($this->me);
@@ -1409,11 +1409,11 @@ class XML_RPC_Values extends CI_Xmlrpc
//-------------------------------------
// Encode time in ISO-8601 form.
//-------------------------------------
-
+
// Useful for sending time in XML-RPC
function iso8601_encode($time, $utc=0)
- {
+ {
if ($utc == 1)
{
$t = strftime("%Y%m%dT%H:%M:%S", $time);
@@ -1427,7 +1427,7 @@ class XML_RPC_Values extends CI_Xmlrpc
}
return $t;
}
-
+
}
// END XML_RPC_Values Class
diff --git a/system/libraries/Xmlrpcs.php b/system/libraries/Xmlrpcs.php
index c1fe649f9..56fd655df 100644
--- a/system/libraries/Xmlrpcs.php
+++ b/system/libraries/Xmlrpcs.php
@@ -14,7 +14,7 @@
*/
if ( ! function_exists('xml_parser_create'))
-{
+{
show_error('Your PHP installation does not support XML');
}
@@ -36,11 +36,11 @@ if ( ! class_exists('CI_Xmlrpc'))
*/
class CI_Xmlrpcs extends CI_Xmlrpc
{
- var $methods = array(); //array of methods mapped to function names and signatures
+ var $methods = array(); //array of methods mapped to function names and signatures
var $debug_msg = ''; // Debug Message
- var $system_methods = array(); // XML RPC Server methods
+ var $system_methods = array(); // XML RPC Server methods
var $controller_obj;
-
+
var $object = FALSE;
@@ -49,49 +49,49 @@ class CI_Xmlrpcs extends CI_Xmlrpc
//-------------------------------------
function CI_Xmlrpcs($config=array())
- {
+ {
parent::CI_Xmlrpc();
$this->set_system_methods();
-
+
if (isset($config['functions']) && is_array($config['functions']))
{
$this->methods = array_merge($this->methods, $config['functions']);
}
-
+
log_message('debug', "XML-RPC Server Class Initialized");
}
-
+
//-------------------------------------
// Initialize Prefs and Serve
//-------------------------------------
-
+
function initialize($config=array())
- {
+ {
if (isset($config['functions']) && is_array($config['functions']))
{
$this->methods = array_merge($this->methods, $config['functions']);
}
-
+
if (isset($config['debug']))
{
$this->debug = $config['debug'];
}
-
+
if (isset($config['object']) && is_object($config['object']))
{
$this->object = $config['object'];
}
-
+
if (isset($config['xss_clean']))
{
$this->xss_clean = $config['xss_clean'];
}
}
-
+
//-------------------------------------
// Setting of System Methods
//-------------------------------------
-
+
function set_system_methods ()
{
$this->methods = array(
@@ -118,14 +118,14 @@ class CI_Xmlrpcs extends CI_Xmlrpc
//-------------------------------------
// Main Server Function
//-------------------------------------
-
+
function serve()
{
$r = $this->parseRequest();
$payload = '<?xml version="1.0" encoding="'.$this->xmlrpc_defencoding.'"?'.'>'."\n";
$payload .= $this->debug_msg;
$payload .= $r->prepare_response();
-
+
header("Content-Type: text/xml");
header("Content-Length: ".strlen($payload));
exit($payload);
@@ -134,7 +134,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc
//-------------------------------------
// Add Method to Class
//-------------------------------------
-
+
function add_to_map($methodname,$function,$sig,$doc)
{
$this->methods[$methodname] = array(
@@ -148,11 +148,11 @@ class CI_Xmlrpcs extends CI_Xmlrpc
//-------------------------------------
// Parse Server Request
//-------------------------------------
-
+
function parseRequest($data='')
{
global $HTTP_RAW_POST_DATA;
-
+
//-------------------------------------
// Get Data
//-------------------------------------
@@ -165,10 +165,10 @@ class CI_Xmlrpcs extends CI_Xmlrpc
//-------------------------------------
// Set up XML Parser
//-------------------------------------
-
+
$parser = xml_parser_create($this->xmlrpc_defencoding);
$parser_object = new XML_RPC_Message("filler");
-
+
$parser_object->xh[$parser] = array();
$parser_object->xh[$parser]['isf'] = 0;
$parser_object->xh[$parser]['isf_reason'] = '';
@@ -182,12 +182,12 @@ class CI_Xmlrpcs extends CI_Xmlrpc
xml_set_element_handler($parser, 'open_tag', 'closing_tag');
xml_set_character_data_handler($parser, 'character_data');
//xml_set_default_handler($parser, 'default_handler');
-
-
+
+
//-------------------------------------
// PARSE + PROCESS XML DATA
- //-------------------------------------
-
+ //-------------------------------------
+
if ( ! xml_parse($parser, $data, 1))
{
// return XML error as a faultCode
@@ -205,53 +205,53 @@ class CI_Xmlrpcs extends CI_Xmlrpc
else
{
xml_parser_free($parser);
-
+
$m = new XML_RPC_Message($parser_object->xh[$parser]['method']);
$plist='';
-
+
for($i=0; $i < count($parser_object->xh[$parser]['params']); $i++)
{
if ($this->debug === TRUE)
{
$plist .= "$i - " . print_r(get_object_vars($parser_object->xh[$parser]['params'][$i]), TRUE). ";\n";
}
-
+
$m->addParam($parser_object->xh[$parser]['params'][$i]);
}
-
+
if ($this->debug === TRUE)
{
echo "<pre>";
echo "---PLIST---\n" . $plist . "\n---PLIST END---\n\n";
echo "</pre>";
}
-
+
$r = $this->_execute($m);
}
-
+
//-------------------------------------
// SET DEBUGGING MESSAGE
- //-------------------------------------
-
+ //-------------------------------------
+
if ($this->debug === TRUE)
{
$this->debug_msg = "<!-- DEBUG INFO:\n\n".$plist."\n END DEBUG-->\n";
}
-
+
return $r;
}
//-------------------------------------
// Executes the Method
//-------------------------------------
-
+
function _execute($m)
{
$methName = $m->method_name;
-
+
// Check to see if it is a system call
$system_call = (strncmp($methName, 'system', 5) == 0) ? TRUE : FALSE;
-
+
if ($this->xss_clean == FALSE)
{
$m->xss_clean = FALSE;
@@ -260,19 +260,19 @@ class CI_Xmlrpcs extends CI_Xmlrpc
//-------------------------------------
// Valid Method
//-------------------------------------
-
+
if ( ! isset($this->methods[$methName]['function']))
{
return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']);
}
-
+
//-------------------------------------
// Check for Method (and Object)
//-------------------------------------
-
+
$method_parts = explode(".", $this->methods[$methName]['function']);
$objectCall = (isset($method_parts['1']) && $method_parts['1'] != "") ? TRUE : FALSE;
-
+
if ($system_call === TRUE)
{
if ( ! is_callable(array($this,$method_parts['1'])))
@@ -291,30 +291,30 @@ class CI_Xmlrpcs extends CI_Xmlrpc
return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']);
}
}
-
+
//-------------------------------------
// Checking Methods Signature
//-------------------------------------
-
+
if (isset($this->methods[$methName]['signature']))
{
$sig = $this->methods[$methName]['signature'];
for($i=0; $i<count($sig); $i++)
{
$current_sig = $sig[$i];
-
+
if (count($current_sig) == count($m->params)+1)
{
for($n=0; $n < count($m->params); $n++)
{
$p = $m->params[$n];
$pt = ($p->kindOf() == 'scalar') ? $p->scalarval() : $p->kindOf();
-
+
if ($pt != $current_sig[$n+1])
{
$pno = $n+1;
$wanted = $current_sig[$n+1];
-
+
return new XML_RPC_Response(0,
$this->xmlrpcerr['incorrect_params'],
$this->xmlrpcstr['incorrect_params'] .
@@ -354,22 +354,22 @@ class CI_Xmlrpcs extends CI_Xmlrpc
return call_user_func($this->methods[$methName]['function'], $m);
}
}
-
-
+
+
//-------------------------------------
// Server Function: List Methods
//-------------------------------------
-
+
function listMethods($m)
{
$v = new XML_RPC_Values();
$output = array();
-
+
foreach($this->methods as $key => $value)
{
$output[] = new XML_RPC_Values($key, 'string');
}
-
+
foreach($this->system_methods as $key => $value)
{
$output[]= new XML_RPC_Values($key, 'string');
@@ -378,23 +378,23 @@ class CI_Xmlrpcs extends CI_Xmlrpc
$v->addArray($output);
return new XML_RPC_Response($v);
}
-
+
//-------------------------------------
// Server Function: Return Signature for Method
//-------------------------------------
-
+
function methodSignature($m)
{
$parameters = $m->output_parameters();
$method_name = $parameters[0];
-
+
if (isset($this->methods[$method_name]))
{
if ($this->methods[$method_name]['signature'])
{
$sigs = array();
$signature = $this->methods[$method_name]['signature'];
-
+
for($i=0; $i < count($signature); $i++)
{
$cursig = array();
@@ -418,20 +418,20 @@ class CI_Xmlrpcs extends CI_Xmlrpc
}
return $r;
}
-
+
//-------------------------------------
// Server Function: Doc String for Method
//-------------------------------------
-
+
function methodHelp($m)
{
$parameters = $m->output_parameters();
$method_name = $parameters[0];
-
+
if (isset($this->methods[$method_name]))
{
$docstring = isset($this->methods[$method_name]['docstring']) ? $this->methods[$method_name]['docstring'] : '';
-
+
return new XML_RPC_Response(new XML_RPC_Values($docstring, 'string'));
}
else
@@ -448,7 +448,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc
{
// Disabled
return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']);
-
+
$parameters = $m->output_parameters();
$calls = $parameters[0];
@@ -457,15 +457,15 @@ class CI_Xmlrpcs extends CI_Xmlrpc
foreach ($calls as $value)
{
//$attempt = $this->_execute(new XML_RPC_Message($value[0], $value[1]));
-
+
$m = new XML_RPC_Message($value[0]);
$plist='';
-
+
for($i=0; $i < count($value[1]); $i++)
{
$m->addParam(new XML_RPC_Values($value[1][$i], 'string'));
}
-
+
$attempt = $this->_execute($m);
if ($attempt->faultCode() != 0)
@@ -478,8 +478,8 @@ class CI_Xmlrpcs extends CI_Xmlrpc
return new XML_RPC_Response(new XML_RPC_Values($result, 'array'));
}
-
-
+
+
//-------------------------------------
// Multi-call Function: Error Handling
//-------------------------------------
@@ -488,28 +488,28 @@ class CI_Xmlrpcs extends CI_Xmlrpc
{
$str = is_string($err) ? $this->xmlrpcstr["multicall_${err}"] : $err->faultString();
$code = is_string($err) ? $this->xmlrpcerr["multicall_${err}"] : $err->faultCode();
-
+
$struct['faultCode'] = new XML_RPC_Values($code, 'int');
$struct['faultString'] = new XML_RPC_Values($str, 'string');
-
+
return new XML_RPC_Values($struct, 'struct');
}
-
-
+
+
//-------------------------------------
// Multi-call Function: Processes method
//-------------------------------------
-
+
function do_multicall($call)
{
if ($call->kindOf() != 'struct')
return $this->multicall_error('notstruct');
elseif ( ! $methName = $call->me['struct']['methodName'])
return $this->multicall_error('nomethod');
-
+
list($scalar_type,$scalar_value)=each($methName->me);
$scalar_type = $scalar_type == $this->xmlrpcI4 ? $this->xmlrpcInt : $scalar_type;
-
+
if ($methName->kindOf() != 'scalar' OR $scalar_type != 'string')
return $this->multicall_error('notstring');
elseif ($scalar_value == 'system.multicall')
@@ -518,7 +518,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc
return $this->multicall_error('noparams');
elseif ($params->kindOf() != 'array')
return $this->multicall_error('notarray');
-
+
list($a,$b)=each($params->me);
$numParams = count($b);
@@ -536,8 +536,8 @@ class CI_Xmlrpcs extends CI_Xmlrpc
}
return new XML_RPC_Values(array($result->value()), 'array');
- }
-
+ }
+
}
// END XML_RPC_Server class
diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php
index 92dfc814d..da3e5eb63 100644
--- a/system/libraries/Zip.php
+++ b/system/libraries/Zip.php
@@ -32,17 +32,17 @@
*/
class CI_Zip {
- var $zipdata = '';
- var $directory = '';
- var $entries = 0;
- var $file_num = 0;
+ var $zipdata = '';
+ var $directory = '';
+ var $entries = 0;
+ var $file_num = 0;
var $offset = 0;
var $now;
function CI_Zip()
{
log_message('debug', "Zip Compression Class Initialized");
-
+
$this->now = time();
}
@@ -72,24 +72,24 @@ class CI_Zip {
}
}
- // --------------------------------------------------------------------
+ // --------------------------------------------------------------------
/**
* Get file/directory modification time
- *
+ *
* If this is a newly created file/dir, we will set the time to 'now'
*
* @param string path to file
- * @return array filemtime/filemdate
+ * @return array filemtime/filemdate
*/
function _get_mod_time($dir)
{
// filemtime() will return false, but it does raise an error.
- $date = (@filemtime($dir)) ? filemtime($dir) : getdate($this->now);
+ $date = (@filemtime($dir)) ? filemtime($dir) : getdate($this->now);
$time['file_mtime'] = ($date['hours'] << 11) + ($date['minutes'] << 5) + $date['seconds'] / 2;
$time['file_mdate'] = (($date['year'] - 1980) << 9) + ($date['mon'] << 5) + $date['mday'];
-
+
return $time;
}
@@ -103,7 +103,7 @@ class CI_Zip {
* @return void
*/
function _add_dir($dir, $file_mtime, $file_mdate)
- {
+ {
$dir = str_replace("\\", "/", $dir);
$this->zipdata .=
@@ -140,7 +140,7 @@ class CI_Zip {
$this->offset = strlen($this->zipdata);
$this->entries++;
}
-
+
// --------------------------------------------------------------------
/**
@@ -154,14 +154,14 @@ class CI_Zip {
* @param mixed
* @param string
* @return void
- */
+ */
function add_data($filepath, $data = NULL)
- {
+ {
if (is_array($filepath))
{
foreach ($filepath as $path => $data)
{
- $file_data = $this->_get_mod_time($path);
+ $file_data = $this->_get_mod_time($path);
$this->_add_data($path, $data, $file_data['file_mtime'], $file_data['file_mdate']);
}
@@ -169,7 +169,7 @@ class CI_Zip {
else
{
$file_data = $this->_get_mod_time($filepath);
-
+
$this->_add_data($filepath, $data, $file_data['file_mtime'], $file_data['file_mdate']);
}
}
@@ -183,7 +183,7 @@ class CI_Zip {
* @param string the file name/path
* @param string the data to be encoded
* @return void
- */
+ */
function _add_data($filepath, $data, $file_mtime, $file_mdate)
{
$filepath = str_replace("\\", "/", $filepath);
@@ -227,7 +227,7 @@ class CI_Zip {
$this->entries++;
$this->file_num++;
}
-
+
// --------------------------------------------------------------------
/**
@@ -235,7 +235,7 @@ class CI_Zip {
*
* @access public
* @return bool
- */
+ */
function read_file($path, $preserve_filepath = FALSE)
{
if ( ! file_exists($path))
@@ -246,7 +246,7 @@ class CI_Zip {
if (FALSE !== ($data = file_get_contents($path)))
{
$name = str_replace("\\", "/", $path);
-
+
if ($preserve_filepath === FALSE)
{
$name = preg_replace("|.*/(.+)|", "\\1", $name);
@@ -259,7 +259,7 @@ class CI_Zip {
}
// ------------------------------------------------------------------------
-
+
/**
* Read a directory and add it to the zip.
*
@@ -321,7 +321,7 @@ class CI_Zip {
*
* @access public
* @return binary string
- */
+ */
function get_zip()
{
// Is there any data to return?
@@ -340,7 +340,7 @@ class CI_Zip {
return $zip_data;
}
-
+
// --------------------------------------------------------------------
/**
@@ -351,7 +351,7 @@ class CI_Zip {
* @access public
* @param string the file name
* @return bool
- */
+ */
function archive($filepath)
{
if ( ! ($fp = @fopen($filepath, FOPEN_WRITE_CREATE_DESTRUCTIVE)))
@@ -359,12 +359,12 @@ class CI_Zip {
return FALSE;
}
- flock($fp, LOCK_EX);
+ flock($fp, LOCK_EX);
fwrite($fp, $this->get_zip());
flock($fp, LOCK_UN);
fclose($fp);
- return TRUE;
+ return TRUE;
}
// --------------------------------------------------------------------
@@ -404,7 +404,7 @@ class CI_Zip {
*
* @access public
* @return void
- */
+ */
function clear_data()
{
$this->zipdata = '';
@@ -413,7 +413,7 @@ class CI_Zip {
$this->file_num = 0;
$this->offset = 0;
}
-
+
}
/* End of file Zip.php */
diff --git a/system/libraries/javascript/Jquery.php b/system/libraries/javascript/Jquery.php
index f6b8dce69..db80c1428 100644
--- a/system/libraries/javascript/Jquery.php
+++ b/system/libraries/javascript/Jquery.php
@@ -173,7 +173,7 @@ class CI_Jquery extends CI_Javascript {
* @param string - element
* @param string - Javascript code for mouse over
* @param string - Javascript code for mouse out
- * @return string
+ * @return string
*/
function _hover($element = 'this', $over, $out)
{
@@ -390,7 +390,7 @@ class CI_Jquery extends CI_Javascript {
*
* @access private
* @param string - element
- * @return string
+ * @return string
*/
function _addClass($element = 'this', $class='')
{
@@ -410,7 +410,7 @@ class CI_Jquery extends CI_Javascript {
* @param string - element
* @param string - One of 'slow', 'normal', 'fast', or time in milliseconds
* @param string - Javascript callback function
- * @return string
+ * @return string
*/
function _animate($element = 'this', $params = array(), $speed = '', $extra = '')
{
@@ -452,7 +452,7 @@ class CI_Jquery extends CI_Javascript {
* @param string - element
* @param string - One of 'slow', 'normal', 'fast', or time in milliseconds
* @param string - Javascript callback function
- * @return string
+ * @return string
*/
function _fadeIn($element = 'this', $speed = '', $callback = '')
{
@@ -480,7 +480,7 @@ class CI_Jquery extends CI_Javascript {
* @param string - element
* @param string - One of 'slow', 'normal', 'fast', or time in milliseconds
* @param string - Javascript callback function
- * @return string
+ * @return string
*/
function _fadeOut($element = 'this', $speed = '', $callback = '')
{
@@ -508,7 +508,7 @@ class CI_Jquery extends CI_Javascript {
* @param string - element
* @param string - One of 'slow', 'normal', 'fast', or time in milliseconds
* @param string - Javascript callback function
- * @return string
+ * @return string
*/
function _hide($element = 'this', $speed = '', $callback = '')
{
@@ -534,7 +534,7 @@ class CI_Jquery extends CI_Javascript {
*
* @access private
* @param string - element
- * @return string
+ * @return string
*/
function _removeClass($element = 'this', $class='')
{
@@ -554,7 +554,7 @@ class CI_Jquery extends CI_Javascript {
* @param string - element
* @param string - One of 'slow', 'normal', 'fast', or time in milliseconds
* @param string - Javascript callback function
- * @return string
+ * @return string
*/
function _slideUp($element = 'this', $speed = '', $callback = '')
{
@@ -582,7 +582,7 @@ class CI_Jquery extends CI_Javascript {
* @param string - element
* @param string - One of 'slow', 'normal', 'fast', or time in milliseconds
* @param string - Javascript callback function
- * @return string
+ * @return string
*/
function _slideDown($element = 'this', $speed = '', $callback = '')
{
@@ -610,7 +610,7 @@ class CI_Jquery extends CI_Javascript {
* @param string - element
* @param string - One of 'slow', 'normal', 'fast', or time in milliseconds
* @param string - Javascript callback function
- * @return string
+ * @return string
*/
function _slideToggle($element = 'this', $speed = '', $callback = '')
{
@@ -636,7 +636,7 @@ class CI_Jquery extends CI_Javascript {
*
* @access private
* @param string - element
- * @return string
+ * @return string
*/
function _toggle($element = 'this')
{
@@ -654,7 +654,7 @@ class CI_Jquery extends CI_Javascript {
*
* @access private
* @param string - element
- * @return string
+ * @return string
*/
function _toggleClass($element = 'this', $class='')
{
@@ -674,7 +674,7 @@ class CI_Jquery extends CI_Javascript {
* @param string - element
* @param string - One of 'slow', 'normal', 'fast', or time in milliseconds
* @param string - Javascript callback function
- * @return string
+ * @return string
*/
function _show($element = 'this', $speed = '', $callback = '')
{
@@ -884,7 +884,7 @@ class CI_Jquery extends CI_Javascript {
}
// --------------------------------------------------------------------
-
+
/**
* Table Sorter Plugin
*
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 58fd78008..8a275dda2 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -95,7 +95,7 @@ Hg Tag: </p>
<li>The <a href="libraries/unit_testing.html">Unit Test Class</a> now has an optional "notes" field available to it, and allows for discrete display of test result items using <kbd>$this->unit->set_test_items()</kbd>.</li>
<li>Added a <kbd>$xss_clean</kbd> class variable to the XMLRPC library, enabling control over the use of the Security library's <kbd>xss_clean()</kbd> method.</li>
<li>Added a <kbd>download()</kbd> method to the <a href="libraries/ftp.html">FTP library</a></li>
- <li>Changed <kbd>do_xss_clean()</kbd> to return FALSE if the uploaded file fails XSS checks.</li>
+ <li>Changed <kbd>do_xss_clean()</kbd> to return FALSE if the uploaded file fails XSS checks.</li>
<li>Added stripslashes() and trim()ing of double quotes from $_FILES type value to standardize input in Upload library.</li>
<li>Added a second parameter (boolean) to <kbd>$this->zip->read_dir('/path/to/directory', FALSE)</kbd> to remove the preceding trail of empty folders when creating a Zip archive. This example would contain a zip with "directory" and all of its contents.</li>
<li>Added ability in the Image Library to handle PNG transparency for resize operations when using the GD lib.</li>
@@ -129,7 +129,7 @@ Hg Tag: </p>
<li>Non-backwards compatible change made to <kbd>get_dir_file_info()</kbd> in the <a href="helpers/file_helper.html">File Helper</a>. No longer recurses
by default so as to encourage responsible use (this function can cause server performance issues when used without caution).</li>
<li>Modified the second parameter of <kbd>directory_map()</kbd> in the <a href="helpers/directory_helper.html">Directory Helper</a> to accept an integer to specify recursion depth.</li>
- <li>Modified <kbd>delete_files()</kbd> in the <a href="helpers/file_helper.html">File Helper</a> to return FALSE on failure.</li>
+ <li>Modified <kbd>delete_files()</kbd> in the <a href="helpers/file_helper.html">File Helper</a> to return FALSE on failure.</li>
<li>Added an optional second parameter to <kbd>byte_format()</kbd> in the <a href="helpers/number_helper.html">Number Helper</a> to allow for decimal precision.</li>
<li>Added alpha, and sha1 string types to <kbd>random_string()</kbd> in the <a href="helpers/string_helper.html">String Helper</a>.</li>
<li>Modified <kbd>prep_url()</kbd> so as to not prepend http:// if the supplied string already has a scheme.</li>
@@ -227,7 +227,7 @@ Hg Tag: v1.7.2</p>
<li>Modified <a href="general/errors.html">show_error()</a> to allow sending of HTTP server response codes.</li>
<li>Modified <a href="general/errors.html">show_404()</a> to send 404 status code, removing non-CGI compatible header() statement from error_404.php template.</li>
<li>Added set_status_header() to the <a href="general/common_functions.html">Common functions<a> to allow use when the Output class is unavailable.</li>
- <li>Added is_php() to <a href="general/common_functions.html">Common functions</a> to facilitate PHP version comparisons.</p>
+ <li>Added is_php() to <a href="general/common_functions.html">Common functions</a> to facilitate PHP version comparisons.</p>
<li>Added 2 CodeIgniter "cheatsheets" (thanks to DesignFellow.com for this contribution).</li>
</ul>
</li>
@@ -252,7 +252,7 @@ Hg Tag: v1.7.2</p>
<li>Fixed a bug in form_textarea() where form data was not prepped correctly.</li>
<li>Fixed a bug in form_prep() causing it to not preserve entities in the user's original input when called back into a form element</li>
<li>Fixed a bug in _protect_identifiers() where the swap prefix ($swap_pre) was not being observed.</li>
- <li>Fixed a bug where the 400 status header sent with the 'disallowed URI characters' was not compatible with CGI environments.</li>
+ <li>Fixed a bug where the 400 status header sent with the 'disallowed URI characters' was not compatible with CGI environments.</li>
<li>Fixed a bug in the typography class where heading tags could have paragraph tags inserted when using auto_typography().</li>
</ul>
@@ -363,7 +363,7 @@ Hg Tag: 1.7.0</p>
</li>
<li>Database
<ul>
- <li>Improved Active Record class to allow full path column and table names: hostname.database.table.column. Also improved the alias handling.</li>
+ <li>Improved Active Record class to allow full path column and table names: hostname.database.table.column. Also improved the alias handling.</li>
<li>Improved how table and column names are escaped and prefixed. It now honors full path names when adding prefixes and escaping.</li>
<li>Added Active Record caching feature to "update" and "delete" functions.</li>
<li>Added removal of non-printing control characters in <kbd>escape_str()</kbd> of DB drivers that do not have native PHP escaping mechanisms (mssql, oci8, odbc), to avoid potential SQL errors, and possible sources of SQL injection.</li>
@@ -553,7 +553,7 @@ Hg Tag: 1.6.2</p>
<ul>
<li>Added ability for <a href="libraries/input.html">xss_clean()</a> to accept arrays.</li>
<li>Removed closing PHP tags from all PHP files to avoid accidental output and potential 'cannot modify headers' errors.</li>
- <li>Removed &quot;scripts&quot; from the auto-load search path. Scripts were deprecated
+ <li>Removed &quot;scripts&quot; from the auto-load search path. Scripts were deprecated
in Version 1.4.1 (September 21, 2006). If you still need to use them for legacy reasons, they must now be manually loaded in each Controller.</li>
<li>Added a <a href="general/reserved_names.html">Reserved Names</a> page to the userguide, and migrated reserved controller names into it.</li>
<li>Added a <a href="general/common_functions.html">Common Functions</a> page to the userguide for globally available functions.</li>
@@ -599,7 +599,7 @@ Hg Tag: 1.6.2</p>
<p>Release Date: February 12, 2008<br />
Hg Tag: 1.6.1</p>
<ul>
- <li>Active Record
+ <li>Active Record
<ul>
<li>Added <a href="./database/active_record.html#caching">Active Record Caching</a>.</li>
<li>Made Active Record fully database-prefix aware.</li>
@@ -674,7 +674,7 @@ Hg Tag: 1.6.1</p>
<li>Changed the behaviour of variables submitted to the where() clause with no values to auto set &quot;IS NULL&quot;</li>
</ul>
</li>
-
+
<li>Other Database Related
<ul>
<li>MySQL driver now requires MySQL 4.1+</li>
@@ -690,19 +690,19 @@ Hg Tag: 1.6.1</p>
in harmony with the global nature of the behavior (#1834).</li>
</ul>
</li>
-
+
<li>Core changes
<ul>
<li>Added ability to load multiple views, whose content will be appended to the output in the order loaded.</li>
<li>Added the ability to <a href="./general/autoloader.html">auto-load</a> <a href="./general/models.html">Models</a>.</li>
<li>Reorganized the URI and Routes classes for better clarity.</li>
- <li>Added Compat.php to allow function overrides for older versions of PHP or PHP environments missing certain extensions / libraries</li>
+ <li>Added Compat.php to allow function overrides for older versions of PHP or PHP environments missing certain extensions / libraries</li>
<li>Added memory usage, GET, URI string data, and individual query execution time to Profiler output.</li>
<li>Deprecated Scaffolding.</li>
<li>Added is_really_writable() to Common.php to provide a cross-platform reliable method of testing file/folder writability.</li>
</ul>
</li>
-
+
<li>Libraries
<ul>
<li>Changed the load protocol of Models to allow for extension.</li>
@@ -722,7 +722,7 @@ Hg Tag: 1.6.1</p>
<li>Enabled the 'system' methods for the XML-RPC Server library, except for 'system.multicall' which is still disabled.</li>
</ul>
</li>
-
+
<li>Helpers &amp; Plugins
<ul>
<li>Added link_tag() to the <a href="./helpers/html_helper.html">HTML helper.</a></li>
@@ -738,8 +738,8 @@ Hg Tag: 1.6.1</p>
<li>Javascript Calendar plugin now uses the months and days from the calendar language file, instead of hard-coded values, internationalizing it.</li>
</ul>
</li>
+
-
<li>Documentation Changes
<ul>
<li>Added <a href="./doc_style/index.html">Writing Documentation</a> section for the community to use in writing their own documentation.</li>
@@ -756,7 +756,7 @@ Hg Tag: 1.6.1</p>
</ul>
<h3>Bug fixes for Version 1.6.0</h3>
-
+
<ul>
<li>Fixed a bug (#1813) preventing using $CI->db in the same application with returned database objects.</li>
<li>Fixed a bug (#1842) where the $this->uri->rsegments array would not include the 'index' method if routed to the controller without an implicit method.</li>
diff --git a/user_guide/database/active_record.html b/user_guide/database/active_record.html
index 482115ccd..065db4913 100644
--- a/user_guide/database/active_record.html
+++ b/user_guide/database/active_record.html
@@ -220,20 +220,20 @@ $this->db->join('comments', 'comments.id = blogs.id', <strong>'left'</strong>);<
<code>$this->db->where('name', $name);
<br /><br />// Produces: WHERE name = 'Joe' </code>
-
+
<p>Notice that the equal sign is added for you.</p>
-
+
<p>If you use multiple function calls they will be chained together with <var>AND</var> between them:</p>
-
+
<code>$this->db->where('name', $name);<br />
$this->db->where('title', $title);<br />
$this->db->where('status', $status);
<br /><br />// WHERE name = 'Joe' AND title = 'boss' AND status = 'active' </code> </li>
-
+
<li><strong>Custom key/value method:</strong>
-
+
<p>You can include an operator in the first parameter in order to control the comparison:</p>
-
+
<code>$this->db->where('name !=', $name);<br />
$this->db->where('id <', $id);
<br /><br />// Produces: WHERE name != 'Joe' AND id < 45 </code> </li>
@@ -242,7 +242,7 @@ $this->db->join('comments', 'comments.id = blogs.id', <strong>'left'</strong>);<
<code>
$array = array('name' => $name, 'title' => $title, 'status' => $status);<br /><br />
-
+
$this->db->where($array);
<br /><br />// Produces: WHERE name = 'Joe' AND title = 'boss' AND status = 'active' </code>
@@ -250,10 +250,10 @@ $this->db->join('comments', 'comments.id = blogs.id', <strong>'left'</strong>);<
<code>
$array = array('name !=' => $name, 'id <' => $id, 'date >' => $date);<br /><br />
-
+
$this->db->where($array);</code> </li>
<li><strong>Custom string:</strong>
-
+
<p>You can write your own clauses manually:</p>
<code>
@@ -263,7 +263,7 @@ $this->db->join('comments', 'comments.id = blogs.id', <strong>'left'</strong>);<
<p>$this-&gt;db-&gt;where() accepts an optional third parameter. If you set it to FALSE, CodeIgniter will not try to protect your field or table names with backticks.</p>
-<p><code> $this-&gt;db-&gt;where('MATCH (field) AGAINST (&quot;value&quot;)', NULL, FALSE);<br />
+<p><code> $this-&gt;db-&gt;where('MATCH (field) AGAINST (&quot;value&quot;)', NULL, FALSE);<br />
</code></p>
<h2>$this->db->or_where();</h2>
<p>This function is identical to the one above, except that multiple instances are joined by OR:</p>
@@ -290,7 +290,7 @@ $this->db->or_where('id >', $id);
$names = array('Frank', 'Todd', 'James');<br />
$this->db->or_where_in('username', $names);<br />
// Produces: OR username IN ('Frank', 'Todd', 'James')</code></p>
-
+
<h2>$this->db->where_not_in();</h2>
<p>Generates a WHERE field NOT IN ('item', 'item') SQL query joined with AND if appropriate</p>
<p><code>
@@ -316,14 +316,14 @@ $this->db->or_where('id >', $id);
<code>$this->db->like('title', 'match');
<br /><br />// Produces: WHERE title LIKE '%match%' </code>
-
+
<p>If you use multiple function calls they will be chained together with <var>AND</var> between them:</p>
-
+
<code>$this->db->like('title', 'match');<br />
$this->db->like('body', 'match');
<br /><br />
// WHERE title LIKE '%match%' AND body LIKE '%match%</code>
- If you want to control where the wildcard (%) is placed, you can use an optional third argument. Your options are 'before', 'after' and 'both' (which is the default).
+ If you want to control where the wildcard (%) is placed, you can use an optional third argument. Your options are 'before', 'after' and 'both' (which is the default).
<code>$this->db->like('title', 'match', 'before');
<br />
// Produces: WHERE title LIKE '%match' <br />
@@ -333,17 +333,17 @@ $this->db->or_where('id >', $id);
<br />
$this-&gt;db-&gt;like('title', 'match', 'both'); <br />
// Produces: WHERE title LIKE '%match%' </code> </li>
-
+
<li><strong>Associative array method:</strong>
<code>
$array = array('title' => $match, 'page1' => $match, 'page2' => $match);<br /><br />
-
+
$this->db->like($array);
<br /><br />// WHERE title LIKE '%match%' AND page1 LIKE '%match%' AND page2 LIKE '%match%'</code></li>
</ol>
-
-
+
+
<h2>$this->db->or_like();</h2>
<p>This function is identical to the one above, except that multiple instances are joined by OR:</p>
@@ -355,7 +355,7 @@ $this->db->or_like('body', $match);
-
+
<p class="important">Note: or_like() was formerly known as orlike(), which has been removed.</p>
<h2>$this-&gt;db-&gt;not_like();</h2>
<p>This function is identical to <strong>like()</strong>, except that it generates NOT LIKE statements:</p>
@@ -370,17 +370,17 @@ $this-&gt;db-&gt;or_not_like('body', 'match'); <br />
// WHERE title LIKE '%match% OR body NOT LIKE '%match%'</code>
<h2>$this->db->group_by();</h2>
<p>Permits you to write the GROUP BY portion of your query:</p>
-
+
<code>$this->db->group_by("title");
<br /><br />// Produces: GROUP BY title
</code>
<p>You can also pass an array of multiple values as well:</p>
-
+
<code>$this->db->group_by(array("title", "date"));
<br />
<br />// Produces: GROUP BY title, date</code>
-
+
<p class="important">Note: group_by() was formerly known as groupby(), which has been removed. </p>
<h2> $this-&gt;db-&gt;distinct();<br />
@@ -392,7 +392,7 @@ $this-&gt;db-&gt;or_not_like('body', 'match'); <br />
// Produces: SELECT DISTINCT * FROM table</code></p>
<h2>$this->db->having();</h2>
<p>Permits you to write the HAVING portion of your query. There are 2 possible syntaxes, 1 argument or 2:</p>
-
+
<code>$this->db->having('user_id = 45');
<br />
// Produces: HAVING user_id = 45<br />
@@ -401,7 +401,7 @@ $this-&gt;db-&gt;having('user_id', 45); <br />
// Produces: HAVING user_id = 45<br />
<br />
</code>
-
+
<p>You can also pass an array of multiple values as well:</p>
@@ -419,14 +419,14 @@ $this-&gt;db-&gt;having('user_id', 45); <br />
<h2>$this->db->order_by();</h2>
<p>Lets you set an ORDER BY clause. The first parameter contains the name of the column you would like to order by.
The second parameter lets you set the direction of the result. Options are <kbd>asc</kbd> or <kbd>desc</kbd>, or <kbd>random</kbd>. </p>
-
+
<code>$this->db->order_by("title", "desc");
<br />
<br />// Produces: ORDER BY title DESC
</code>
<p>You can also pass your own string in the first parameter:</p>
-
+
<code>$this->db->order_by('title desc, name asc');
<br />
<br />// Produces: ORDER BY title DESC, name ASC
@@ -479,10 +479,10 @@ echo $this-&gt;db-&gt;count_all_results();<br />
// Produces an integer, like 25</code>
-
+
<a name="insert">&nbsp;</a>
<h1>Inserting Data</h1>
-
+
<h2>$this->db->insert();</h2>
<p>Generates an insert string based on the data you supply, and runs the query. You can either pass an
<strong>array</strong> or an <strong>object</strong> to the function. Here is an example using an array:</p>
@@ -520,9 +520,9 @@ $this->db->insert('mytable', $object);
<p>The first parameter will contain the table name, the second is an associative array of values.</p>
<p class="important"><strong>Note:</strong> All values are escaped automatically producing safer queries.</p>
-
-
-
+
+
+
<h2>$this->db->set();</h2>
<p>This function enables you to set values for <dfn>inserts</dfn> or <dfn>updates</dfn>.</p>
@@ -576,10 +576,10 @@ $this->db->insert('mytable');
</code>
-
+
<a name="update">&nbsp;</a>
<h1>Updating Data</h1>
-
+
<h2>$this->db->update();</h2>
<p>Generates an update string and runs the query based on the data you supply. You can pass an
<strong>array</strong> or an <strong>object</strong> to the function. Here is an example using
@@ -625,7 +625,7 @@ $this->db->update('mytable', $object);
<p class="important"><strong>Note:</strong> All values are escaped automatically producing safer queries.</p>
-
+
<p>You'll notice the use of the <dfn>$this->db->where()</dfn> function, enabling you to set the WHERE clause.
You can optionally pass this information directly into the update function as a string:</p>
@@ -634,15 +634,15 @@ You can optionally pass this information directly into the update function as a
<p>Or as an array:</p>
<code>$this->db->update('mytable', $data, array('id' => $id));</code>
-
+
<p>You may also use the <dfn>$this->db->set()</dfn> function described above when performing updates.</p>
-
+
<a name="delete">&nbsp;</a>
<h1>Deleting Data</h1>
-
+
<h2>$this->db->delete();</h2>
<p>Generates a delete SQL string and runs the query.</p>
diff --git a/user_guide/database/call_function.html b/user_guide/database/call_function.html
index fe09d2b14..46dfe89dc 100644
--- a/user_guide/database/call_function.html
+++ b/user_guide/database/call_function.html
@@ -97,7 +97,7 @@ Obviously not all function calls are identical between platforms, so there are l
-
+
</div>
<!-- END CONTENT -->
diff --git a/user_guide/database/fields.html b/user_guide/database/fields.html
index 30d39a42d..e5cc4777d 100644
--- a/user_guide/database/fields.html
+++ b/user_guide/database/fields.html
@@ -142,7 +142,7 @@ $fields = $query->field_data();
<li>primary_key - 1 if the column is a primary key</li>
<li>type - the type of the column</li>
</ul>
-
+
</div>
<!-- END CONTENT -->
diff --git a/user_guide/database/index.html b/user_guide/database/index.html
index 45d15dba4..381592c26 100644
--- a/user_guide/database/index.html
+++ b/user_guide/database/index.html
@@ -78,7 +78,7 @@ structures and Active Record patterns. The database functions offer clear, simpl
<li><a href="forge.html">Database manipulation with Database Forge</a></li>
<li><a href="utilities.html">Database Utilities Class</a></li>
</ul>
-
+
</div>
<!-- END CONTENT -->
diff --git a/user_guide/database/queries.html b/user_guide/database/queries.html
index 7a6734c4a..c8a304943 100644
--- a/user_guide/database/queries.html
+++ b/user_guide/database/queries.html
@@ -132,7 +132,7 @@ $this->db->query($sql, array(3, 'live', 'Rick'));
<p>The question marks in the query are automatically replaced with the values in the array in the second parameter of the query function.</p>
<p class="important">The secondary benefit of using binds is that the values are automatically escaped, producing safer queries. You don't have to remember to manually escape data; the engine does it automatically for you.</p>
-
+
</div>
<!-- END CONTENT -->
diff --git a/user_guide/database/results.html b/user_guide/database/results.html
index 9eaa1793e..410dac840 100644
--- a/user_guide/database/results.html
+++ b/user_guide/database/results.html
@@ -65,11 +65,11 @@ Query Results
<p>There are several ways to generate query results:</p>
<h2>result()</h2>
-
+
<p>This function returns the query result as an array of <strong>objects</strong>, or <strong>an empty array</strong> on failure.
-
+
Typically you'll use this in a foreach loop, like this:</p>
-
+
<code>
$query = $this->db->query("YOUR QUERY");<br />
<br />
@@ -79,11 +79,11 @@ Query Results
&nbsp;&nbsp;&nbsp;echo $row->name;<br />
&nbsp;&nbsp;&nbsp;echo $row->body;<br />
}</code>
-
+
<p>The above <dfn>function</dfn> is an alias of <dfn>result_object()</dfn>.</p>
<p>If you run queries that might <strong>not</strong> produce a result, you are encouraged to test the result first:</p>
-
+
<code>
$query = $this->db->query("YOUR QUERY");<br />
<br />
@@ -97,9 +97,9 @@ Query Results
&nbsp;&nbsp;&nbsp;}<br />
}
</code>
-
+
<h2>result_array()</h2>
-
+
<p>This function returns the query result as a pure array, or an empty array when no result is produced. Typically you'll use this in a foreach loop, like this:</p>
<code>
$query = $this->db->query("YOUR QUERY");<br />
@@ -113,7 +113,7 @@ Query Results
<h2>row()</h2>
-
+
<p>This function returns a single result row. If your query has more than one row, it returns only the first row.
The result is returned as an <strong>object</strong>. Here's a usage example:</p>
<code>
@@ -128,9 +128,9 @@ Query Results
&nbsp;&nbsp;&nbsp;echo $row->body;<br />
}
</code>
-
+
<p>If you want a specific row returned you can submit the row number as a digit in the first parameter:</p>
-
+
<code>$row = $query->row(<dfn>5</dfn>);</code>
@@ -151,13 +151,13 @@ Query Results
}
</code>
-
+
<p>If you want a specific row returned you can submit the row number as a digit in the first parameter:</p>
-
+
<code>$row = $query->row_array(<dfn>5</dfn>);</code>
-
- <p>In addition, you can walk forward/backwards/first/last through your results using these variations:</p>
+
+ <p>In addition, you can walk forward/backwards/first/last through your results using these variations:</p>
<p>
<strong>$row = $query->first_row()</strong><br />
@@ -217,7 +217,7 @@ $query2->free_result(); // The $query2 result object will no longer be availabl
-
+
</div>
<!-- END CONTENT -->
diff --git a/user_guide/database/table_data.html b/user_guide/database/table_data.html
index c85408fab..8b86ed58e 100644
--- a/user_guide/database/table_data.html
+++ b/user_guide/database/table_data.html
@@ -92,7 +92,7 @@ if ($this->db->table_exists('table_name'))<br />
-
+
</div>
<!-- END CONTENT -->
diff --git a/user_guide/doc_style/template.html b/user_guide/doc_style/template.html
index 26831ac06..d5ef5caa4 100644
--- a/user_guide/doc_style/template.html
+++ b/user_guide/doc_style/template.html
@@ -54,7 +54,7 @@ Foo Class
<p>Brief description of Foo Class. If it extends a native CodeIgniter class, please link to the class in the CodeIgniter documents here.</p>
<p class="important"><strong>Important:</strong>&nbsp; This is an important note with <kbd>EMPHASIS</kbd>.</p>
-
+
<p>Features:</p>
<ul>
diff --git a/user_guide/general/alternative_php.html b/user_guide/general/alternative_php.html
index b9069a8be..3193c0585 100644
--- a/user_guide/general/alternative_php.html
+++ b/user_guide/general/alternative_php.html
@@ -58,14 +58,14 @@ Alternate PHP Syntax
<h1>Alternate PHP Syntax for View Files</h1>
<p>If you do not utilize CodeIgniter's <a href="../libraries/parser.html">template engine</a>, you'll be using pure PHP
-in your View files. To minimize the PHP code in these files, and to make it easier to identify the code blocks it is recommended that you use
+in your View files. To minimize the PHP code in these files, and to make it easier to identify the code blocks it is recommended that you use
PHPs alternative syntax for control structures and short tag echo statements. If you are not familiar with this syntax, it allows you to eliminate the braces from your code,
and eliminate "echo" statements.</p>
<h2>Automatic Short Tag Support</h2>
<p><strong>Note:</strong> If you find that the syntax described in this page does not work on your server it might
-be that "short tags" are disabled in your PHP ini file. CodeIgniter will optionally rewrite short tags on-the-fly,
+be that "short tags" are disabled in your PHP ini file. CodeIgniter will optionally rewrite short tags on-the-fly,
allowing you to use that syntax even if your server doesn't support it. This feature can be enabled in your
<dfn>config/config.php</dfn> file.</p>
diff --git a/user_guide/general/creating_libraries.html b/user_guide/general/creating_libraries.html
index 0b4d642ae..3f0e32cb0 100644
--- a/user_guide/general/creating_libraries.html
+++ b/user_guide/general/creating_libraries.html
@@ -200,7 +200,7 @@ etc.
<kbd>This is very important.</kbd> Assigning by reference allows you to use the original CodeIgniter object rather than creating a copy of it.
<br /><br />
<kbd>Also, please note:</kbd> If you are running PHP 4 it's usually best to avoid calling <dfn>get_instance()</dfn>
-from within your class constructors. PHP 4 has trouble referencing the CI super object within application constructors
+from within your class constructors. PHP 4 has trouble referencing the CI super object within application constructors
since objects do not exist until the class is fully instantiated.</p>
diff --git a/user_guide/general/credits.html b/user_guide/general/credits.html
index b77528a7e..5423d5838 100644
--- a/user_guide/general/credits.html
+++ b/user_guide/general/credits.html
@@ -58,8 +58,8 @@ Credits
<h1>Credits</h1>
<p>CodeIgniter was originally developed by <a href="http://www.ellislab.com/">Rick Ellis</a> (CEO of
-<a href="http://ellislab.com/">EllisLab, Inc.</a>). The framework was written for performance in the real
-world, with many of the class libraries, helpers, and sub-systems borrowed from the code-base of
+<a href="http://ellislab.com/">EllisLab, Inc.</a>). The framework was written for performance in the real
+world, with many of the class libraries, helpers, and sub-systems borrowed from the code-base of
<a href="http://www.expressionengine.com/">ExpressionEngine</a>.</p>
<p>It is currently developed and maintained by the ExpressionEngine Development Team.</p>
diff --git a/user_guide/general/drivers.html b/user_guide/general/drivers.html
index 9c86f0216..3163c11a7 100644
--- a/user_guide/general/drivers.html
+++ b/user_guide/general/drivers.html
@@ -75,7 +75,7 @@ Using CodeIgniter Drivers
<code>$this->some_parent->some_method();</code>
<p>The child classes, the drivers themselves, can then be called directly through the parent class, without initializing them:</p>
-
+
<code>$this->some_parent->child_one->some_method();<br />
$this->some_parent->child_two->another_method();</code>
diff --git a/user_guide/general/managing_apps.html b/user_guide/general/managing_apps.html
index 04af6e6a3..a1a96cf82 100644
--- a/user_guide/general/managing_apps.html
+++ b/user_guide/general/managing_apps.html
@@ -70,7 +70,7 @@ file and set its name using the <samp>$application_folder</samp> variable:</p>
<h2>Relocating your Application Folder</h2>
-<p>It is possible to move your <dfn>application</dfn> folder to a different location on your server than your <kbd>system</kbd> folder.
+<p>It is possible to move your <dfn>application</dfn> folder to a different location on your server than your <kbd>system</kbd> folder.
To do so open your main <kbd>index.php</kbd> and set a <em>full server path</em> in the <samp>$application_folder</samp> variable.</p>
@@ -79,7 +79,7 @@ To do so open your main <kbd>index.php</kbd> and set a <em>full server path</em>
<h2>Running Multiple Applications with one CodeIgniter Installation</h2>
-<p>If you would like to share a common CodeIgniter installation to manage several different applications simply
+<p>If you would like to share a common CodeIgniter installation to manage several different applications simply
put all of the directories located inside your <kbd>application</kbd> folder into their
own sub-folder.</p>
@@ -107,7 +107,7 @@ variable. For example, to select the "foo" application for use you would do thi
<code>$application_folder = "applications/foo";</code>
-<p class="important"><strong>Note:</strong>&nbsp; Each of your applications will need its own <dfn>index.php</dfn> file which
+<p class="important"><strong>Note:</strong>&nbsp; Each of your applications will need its own <dfn>index.php</dfn> file which
calls the desired application. The index.php file can be named anything you want.</p>
diff --git a/user_guide/general/models.html b/user_guide/general/models.html
index e405dd1b6..35ab08d20 100644
--- a/user_guide/general/models.html
+++ b/user_guide/general/models.html
@@ -212,7 +212,7 @@ class&nbsp;Blog_controller&nbsp;extends&nbsp;Controller&nbsp;{<br />
<li>You can tell the model loading function to auto-connect by passing <kbd>TRUE</kbd> (boolean) via the third parameter,
and connectivity settings, as defined in your database config file will be used:
- <code>$this->load->model('<var>Model_name</var>', '', <kbd>TRUE</kbd>);</code>
+ <code>$this->load->model('<var>Model_name</var>', '', <kbd>TRUE</kbd>);</code>
</li>
diff --git a/user_guide/general/profiling.html b/user_guide/general/profiling.html
index 47c1a5abc..7cb3f158d 100644
--- a/user_guide/general/profiling.html
+++ b/user_guide/general/profiling.html
@@ -129,7 +129,7 @@ This information can be useful during development in order to help with debuggin
<td class="td">Any GET data passed in the request</td>
<td class="td">TRUE</td>
</tr><tr>
-
+
<td class="td"><strong>http_headers</strong></td>
<td class="td">The HTTP headers for the current request</td>
<td class="td">TRUE</td>
@@ -149,7 +149,7 @@ This information can be useful during development in order to help with debuggin
<td class="td">Listing of all database queries executed, including execution time</td>
<td class="td">TRUE</td>
</tr><tr>
-
+
<td class="td"><strong>uri_string</strong></td>
<td class="td">The URI of the current request</td>
<td class="td">TRUE</td>
diff --git a/user_guide/general/styleguide.html b/user_guide/general/styleguide.html
index 1200a2c12..7b7d837d9 100644
--- a/user_guide/general/styleguide.html
+++ b/user_guide/general/styleguide.html
@@ -107,12 +107,12 @@ Style Guide
a UTF-8 encoded file, and the <abbr title="Byte Order Mark">BOM</abbr> can have a negative side effect in PHP of sending output,
preventing the application from being able to set its own headers. Unix line endings should
be used (LF).</p>
-
+
<p>Here is how to apply these settings in some of the more common text editors. Instructions for your
text editor may vary; check your text editor's documentation.</p>
-
+
<h5>TextMate</h5>
-
+
<ol>
<li>Open the Application Preferences</li>
<li>Click Advanced, and then the "Saving" tab</li>
@@ -121,9 +121,9 @@ Style Guide
<li><em>Optional:</em> Check "Use for existing files as well" if you wish to modify the line
endings of files you open to your new preference.</li>
</ol>
-
+
<h5>BBEdit</h5>
-
+
<ol>
<li>Open the Application Preferences</li>
<li>Select "Text Encodings" on the left.</li>
@@ -137,7 +137,7 @@ Style Guide
<h2><a name="php_closing_tag"></a>PHP Closing Tag</h2>
<div class="guidelineDetails">
- <p>The PHP closing tag on a PHP document <strong>?&gt;</strong> is optional to the PHP parser. However, if used, any whitespace following the closing tag, whether introduced
+ <p>The PHP closing tag on a PHP document <strong>?&gt;</strong> is optional to the PHP parser. However, if used, any whitespace following the closing tag, whether introduced
by the developer, user, or an FTP application, can cause unwanted output, PHP errors, or if the latter are suppressed, blank pages. For this reason, all PHP files should
<strong>OMIT</strong> the closing PHP tag, and instead use a comment block to mark the end of file and it's location relative to the application root.
This allows you to still identify a file as being complete and not truncated.</p>
@@ -158,7 +158,7 @@ echo "Here's my code!";
</code>
</div>
-
+
<h2><a name="class_and_method_naming"></a>Class and Method Naming</h2>
<div class="guidelineDetails">
<p>Class names should always have their first letter uppercase, and the constructor method should match identically. Multiple words should be separated with an underscore, and not CamelCased. All other class methods should be entirely lowercased and named to clearly indicate their function, preferably including a verb. Try to avoid overly long and verbose names.</p>
@@ -193,8 +193,8 @@ function get_the_file_properties_from_the_file() // wordy
function get_file_properties() // descriptive, underscore separator, and all lowercase letters</code>
</div>
-
-
+
+
<h2><a name="variable_names"></a>Variable Names</h2>
<div class="guidelineDetails">
<p>The guidelines for variable naming is very similar to that used for class methods. Namely, variables should contain only lowercase letters, use underscore separators, and be reasonably named to indicate their purpose and contents. Very short, non-word variables should only be used as iterators in for() loops.</p>
@@ -213,8 +213,8 @@ $group_id
$last_city
</code>
</div>
-
-
+
+
<h2><a name="commenting"></a>Commenting</h2>
<div class="guidelineDetails">
<p>In general, code should be commented prolifically. It not only helps describe the flow and intent of the code for less experienced programmers, but can prove invaluable when returning to your own code months down the line. There is not a required format for comments, but the following are recommended.</p>
@@ -257,8 +257,8 @@ $parts = explode("\n", $str);
$parts = $this->foo($parts);
</code>
</div>
-
-
+
+
<h2><a name="constants"></a>Constants</h2>
<div class="guidelineDetails">
<p>Constants follow the same guidelines as do variables, except constants should always be fully uppercase. <em>Always use CodeIgniter constants when appropriate, i.e. SLASH, LD, RD, PATH_CACHE, etc.</em></p>
@@ -275,8 +275,8 @@ SUPER_CLASS_VERSION
$str = str_replace(LD.'foo'.RD, 'bar', $str);
</code>
</div>
-
-
+
+
<h2><a name="true_false_and_null"></a>TRUE, FALSE, and NULL</h2>
<div class="guidelineDetails">
<p><strong>TRUE</strong>, <strong>FALSE</strong>, and <strong>NULL</strong> keywords should always be fully uppercase.</p>
@@ -290,9 +290,9 @@ if ($foo == TRUE)
$bar = FALSE;
function foo($bar = NULL)</code>
</div>
-
-
+
+
<h2><a name="logical_operators"></a>Logical Operators</h2>
<div class="guidelineDetails">
<p>Use of <strong>||</strong> is discouraged as its clarity on some output devices is low (looking like the number 11 for instance).
@@ -310,9 +310,9 @@ if ( ! $foo)
if ( ! is_array($foo))
</code>
</div>
-
-
-
+
+
+
<h2><a name="comparing_return_values_and_typecasting"></a>Comparing Return Values and Typecasting</h2>
<div class="guidelineDetails">
<p>Some PHP functions return FALSE on failure, but may also have a valid return value of "" or 0, which would evaluate to FALSE in loose comparisons. Be explicit by comparing the variable type when using these return values in conditionals to ensure the return value is indeed what you expect, and not a value that has an equivalent loose-type evaluation.</p>
@@ -350,27 +350,27 @@ function build_string($str = "")
<code>$str = (string) $str; // cast $str as a string</code>
</div>
-
-
+
+
<h2><a name="debugging_code"></a>Debugging Code</h2>
<div class="guidelineDetails">
<p>No debugging code can be left in place for submitted add-ons unless it is commented out, i.e. no var_dump(), print_r(), die(), and exit() calls that were used while creating the add-on, unless they are commented out.</p>
<code>// print_r($foo);</code>
</div>
-
-
+
+
<h2><a name="whitespace_in_files"></a>Whitespace in Files</h2>
<div class="guidelineDetails">
<p>No whitespace can precede the opening PHP tag or follow the closing PHP tag. Output is buffered, so whitespace in your files can cause output to begin before CodeIgniter outputs its content, leading to errors and an inability for CodeIgniter to send proper headers. In the examples below, select the text with your mouse to reveal the incorrect whitespace.</p>
<p><strong>INCORRECT</strong>:</p>
-<code>
+<code>
&lt;?php
// ...there is whitespace and a linebreak above the opening PHP tag
// as well as whitespace after the closing PHP tag
-?&gt;
+?&gt;
</code>
<p><strong>CORRECT</strong>:</p>
<code>&lt;?php
@@ -378,15 +378,15 @@ function build_string($str = "")
?&gt;</code>
</div>
-
-
+
+
<h2><a name="compatibility"></a>Compatibility</h2>
<div class="guidelineDetails">
<p>Unless specifically mentioned in your add-on's documentation, all code must be compatible with PHP version 4.3+. Additionally, do not use PHP functions that require non-default libraries to be installed unless your code contains an alternative method when the function is not available, or you implicitly document that your add-on requires said PHP libraries.</p>
</div>
-
-
+
+
<h2><a name="class_and_file_names_using_common_words"></a>Class and File Names using Common Words</h2>
<div class="guidelineDetails">
<p>When your class or filename is a common word, or might quite likely be identically named in another PHP script, provide a unique prefix to help prevent collision. Always realize that your end users may be running other add-ons or third party PHP scripts. Choose a prefix that is unique to your identity as a developer or company.</p>
@@ -402,8 +402,8 @@ class Pre_xml ext.pre_xml.php
class Pre_import mod.pre_import.php
</code>
</div>
-
-
+
+
<h2><a name="database_table_names"></a>Database Table Names</h2>
<div class="guidelineDetails">
<p>Any tables that your add-on might use must use the 'exp_' prefix, followed by a prefix uniquely identifying you as the developer or company, and then a short descriptive table name. You do not need to be concerned about the database prefix being used on the user's installation, as CodeIgniter's database class will automatically convert 'exp_' to what is actually being used.</p>
@@ -419,30 +419,30 @@ exp_pre_email_addresses
<p class="important"><strong>NOTE:</strong> Be mindful that MySQL has a limit of 64 characters for table names. This should not be an issue as table names that would exceed this would likely have unreasonable names. For instance, the following table name exceeds this limitation by one character. Silly, no? <strong>exp_pre_email_addresses_of_registered_users_in_seattle_washington</strong>
</div>
-
-
+
+
<h2><a name="one_file_per_class"></a>One File per Class</h2>
<div class="guidelineDetails">
<p>Use separate files for each class your add-on uses, unless the classes are <em>closely related</em>. An example of CodeIgniter files that contains multiple classes is the Database class file, which contains both the DB class and the DB_Cache class, and the Magpie plugin, which contains both the Magpie and Snoopy classes.</p>
</div>
-
-
+
+
<h2><a name="whitespace"></a>Whitespace</h2>
<div class="guidelineDetails">
<p>Use tabs for whitespace in your code, not spaces. This may seem like a small thing, but using tabs instead of whitespace allows the developer looking at your code to have indentation at levels that they prefer and customize in whatever application they use. And as a side benefit, it results in (slightly) more compact files, storing one tab character versus, say, four space characters.</p>
</div>
-
-
+
+
<h2><a name="line_breaks"></a>Line Breaks</h2>
<div class="guidelineDetails">
<p>Files must be saved with Unix line breaks. This is more of an issue for developers who work in Windows, but in any case ensure that your text editor is setup to save files with Unix line breaks.</p>
</div>
-
-
+
+
<h2><a name="code_indenting"></a>Code Indenting</h2>
<div class="guidelineDetails">
<p>Use Allman style indenting. With the exception of Class declarations, braces are always placed on a line by themselves, and indented at the same level as the control statement that "owns" them.</p>
@@ -498,12 +498,12 @@ for ($i = 0; $i &lt; 10; $i++)
}
}</code>
</div>
-
+
<h2><a name="bracket_spacing"></a>Bracket and Parenthetic Spacing</h2>
<div class="guidelineDetails">
<p>In general, parenthesis and brackets should not use any additional spaces. The exception is that a space should always follow PHP control structures that accept arguments with parenthesis (declare, do-while, elseif, for, foreach, if, switch, while), to help distinguish them from functions and increase readability.</p>
-
+
<code>INCORRECT:
$arr[ $foo ] = 'foo';
@@ -514,13 +514,13 @@ $arr[$foo] = 'foo'; // no spaces around array keys
INCORRECT:
function foo ( $bar )
{
-
+
}
CORRECT:
function foo($bar) // no spaces around parenthesis in function declarations
{
-
+
}
@@ -531,9 +531,9 @@ CORRECT:
foreach ($query->result() as $row) // single space following PHP control structures, but not in interior parenthesis
</code>
</div>
-
-
-
+
+
+
<h2><a name="localized_text"></a>Localized Text</h2>
<div class="guidelineDetails">
<p>Any text that is output in the control panel should use language variables in your lang file to allow localization.</p>
@@ -544,9 +544,9 @@ return "Invalid Selection";
CORRECT:
return $this->lang->line('invalid_selection');</code>
</div>
-
-
+
+
<h2><a name="private_methods_and_variables"></a>Private Methods and Variables</h2>
<div class="guidelineDetails">
<p>Methods and variables that are only accessed internally by your class, such as utility and helper functions that your public methods use for code abstraction, should be prefixed with an underscore.</p>
@@ -554,9 +554,9 @@ return $this->lang->line('invalid_selection');</code>
<code>convert_text() // public method
_convert_text() // private method</code>
</div>
-
-
+
+
<h2><a name="php_errors"></a>PHP Errors</h2>
<div class="guidelineDetails">
<p>Code must run error free and not rely on warnings and notices to be hidden to meet this requirement. For instance, never access a variable that you did not set yourself (such as $_POST array keys) without first checking to see that it isset().</p>
@@ -574,9 +574,9 @@ _convert_text() // private method</code>
<p class="important"><strong>NOTE:</strong> Setting the <a href="http://us.php.net/manual/en/ref.errorfunc.php#ini.display-errors">display_errors</a> setting with ini_set() at runtime is not identical to having it enabled in the PHP environment. Namely, it will not have any effect if the script has fatal errors</p>
</div>
-
-
+
+
<h2><a name="short_open_tags"></a>Short Open Tags</h2>
<div class="guidelineDetails">
<p>Always use full PHP opening tags, in case a server does not have short_open_tag enabled.</p>
@@ -589,9 +589,9 @@ _convert_text() // private method</code>
<strong>CORRECT</strong>:
&lt;?php echo $foo; ?&gt;</code>
</div>
-
-
+
+
<h2><a name="one_statement_per_line"></a>One Statement Per Line</h2>
<div class="guidelineDetails">
<p>Never combine statements on one line.</p>
@@ -605,9 +605,9 @@ $bar = 'that';
$bat = str_replace($foo, $bar, $bag);
</code>
</div>
-
-
+
+
<h2><a name="strings"></a>Strings</h2>
<div class="guidelineDetails">
<p>Always use single quoted strings unless you need variables parsed, and in cases where you do need variables parsed, use braces to prevent greedy token parsing. You may also use double-quoted strings if the string contains single quotes, so you do not have to use escape characters.</p>
@@ -622,9 +622,9 @@ $bat = str_replace($foo, $bar, $bag);
"My string {$foo}"
"SELECT foo FROM bar WHERE baz = 'bag'"</code>
</div>
-
-
+
+
<h2><a name="sql_queries"></a>SQL Queries</h2>
<div class="guidelineDetails">
<p>MySQL keywords are always capitalized: SELECT, INSERT, UPDATE, WHERE, AS, JOIN, ON, IN, etc.</p>
@@ -645,16 +645,16 @@ $query = $this->db->query("SELECT foo, bar, baz, foofoo, foobar AS raboof, fooba
ORDER BY foobaz
LIMIT 5, 100");</code>
</div>
-
-
+
+
<h2><a name="default_function_arguments"></a>Default Function Arguments</h2>
<div class="guidelineDetails">
<p>Whenever appropriate, provide function argument defaults, which helps prevent PHP errors with mistaken calls and provides common fallback values which can save a few lines of code. Example:</p>
<code>function foo($bar = '', $baz = FALSE)</code>
</div>
-
+
</div>
diff --git a/user_guide/general/views.html b/user_guide/general/views.html
index b5dea05a1..8f317109e 100644
--- a/user_guide/general/views.html
+++ b/user_guide/general/views.html
@@ -169,7 +169,7 @@ class Blog extends Controller {
{
$data['title'] = "My Real Title";
$data['heading'] = "My Real Heading";
-
+
$this->load->view('blogview', $data);
}
}
@@ -211,7 +211,7 @@ class Blog extends Controller {
$data['title'] = "My Real Title";
$data['heading'] = "My Real Heading";
-
+
$this->load->view('blogview', $data);
}
}
@@ -229,8 +229,8 @@ class Blog extends Controller {
&lt;/head>
&lt;body>
&lt;h1>&lt;?php echo $heading;?>&lt;/h1>
-
-&lt;h3>My Todo List&lt;/h3>
+
+&lt;h3>My Todo List&lt;/h3>
&lt;ul>
&lt;?php foreach($todo_list as $item):?>
@@ -239,7 +239,7 @@ class Blog extends Controller {
&lt;?php endforeach;?>
&lt;/ul>
-
+
&lt;/body>
&lt;/html>
</textarea>
diff --git a/user_guide/helpers/captcha_helper.html b/user_guide/helpers/captcha_helper.html
index c4aa65fad..bd7482266 100644
--- a/user_guide/helpers/captcha_helper.html
+++ b/user_guide/helpers/captcha_helper.html
@@ -87,9 +87,9 @@ CAPTCHA Helper
<p>The "word" is the word that appears in the captcha image, which if not
supplied to the function, will be a random string.</p>
-
+
<h3>Using the CAPTCHA helper</h3>
-
+
<p>Once loaded you can generate a captcha like this:</p>
<code>$vals = array(<br />
@@ -120,14 +120,14 @@ echo $cap['image'];</code>
</ul>
<h3>Adding a Database</h3>
-
+
<p>In order for the captcha function to prevent someone from submitting, you will need
to add the information returned from <kbd>create_captcha()</kbd> 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.</p>
-
+
<p>Here is a table prototype:</p>
-
+
<code>CREATE TABLE captcha (<br />
&nbsp;captcha_id bigint(13) unsigned NOT NULL auto_increment,<br />
&nbsp;captcha_time int(10) unsigned NOT NULL,<br />
@@ -138,7 +138,7 @@ echo $cap['image'];</code>
)</code>
<p>Here is an example of usage with a database. On the page where the CAPTCHA will be shown you'll have something like this:</p>
-
+
<code>$this-&gt;load-&gt;helper(&#x27;captcha&#x27;);<br />
$vals = array(<br />
&nbsp;&nbsp;&nbsp;&nbsp;&#x27;img_path&#x27; =&gt; &#x27;./captcha/&#x27;,<br />
@@ -161,10 +161,10 @@ echo $cap[&#x27;image&#x27;];<br />
echo &#x27;&lt;input type=&quot;text&quot; name=&quot;captcha&quot; value=&quot;&quot; /&gt;&#x27;;</code>
<p>Then, on the page that accepts the submission you'll have something like this:</p>
-
+
<code>// First, delete old captchas<br />
$expiration = time()-7200; // Two hour limit<br />
-$this-&gt;db-&gt;query(&quot;DELETE FROM captcha WHERE captcha_time &lt; &quot;.$expiration); <br />
+$this-&gt;db-&gt;query(&quot;DELETE FROM captcha WHERE captcha_time &lt; &quot;.$expiration); <br />
<br />
// Then see if a captcha exists:<br />
$sql = &quot;SELECT COUNT(*) AS count FROM captcha WHERE word = ? AND ip_address = ? AND date &gt; ?&quot;;<br />
@@ -176,7 +176,7 @@ if ($row-&gt;count == 0)<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;You must submit the word that appears in the image&quot;;<br />
}</code>
-
+
</div>
<!-- END CONTENT -->
diff --git a/user_guide/helpers/compatibility_helper.html b/user_guide/helpers/compatibility_helper.html
index de8c49d0a..9afec6541 100644
--- a/user_guide/helpers/compatibility_helper.html
+++ b/user_guide/helpers/compatibility_helper.html
@@ -68,7 +68,7 @@ Compatibility Helper
You may use those functions without loading this helper. The functions are split between that file and this Helper so that only
functions required by the framework are included by default. This way, whether or not you load the additional functions in this Helper
remains your choice.</p>
-
+
<h2>Loading this Helper</h2>
<p>This helper is loaded using the following code:</p>
diff --git a/user_guide/helpers/date_helper.html b/user_guide/helpers/date_helper.html
index 2d908705e..f8775b146 100644
--- a/user_guide/helpers/date_helper.html
+++ b/user_guide/helpers/date_helper.html
@@ -116,7 +116,7 @@ echo standard_date($format, $time);
<th>Description</th>
<th>Example</th>
</tr>
- <tr>
+ <tr>
<td>DATE_ATOM</td>
<td>Atom</td>
<td>2005-08-15T16:13:03+0000</td>
@@ -149,7 +149,7 @@ echo standard_date($format, $time);
<tr>
<td>DATE_RFC1123</td>
<td>RFC 1123</td>
- <td>Sun, 14 Aug 2005 16:13:03 UTC</td>
+ <td>Sun, 14 Aug 2005 16:13:03 UTC</td>
</tr>
<tr>
<td>DATE_RFC2822</td>
diff --git a/user_guide/helpers/directory_helper.html b/user_guide/helpers/directory_helper.html
index 2324252dd..6e4faef02 100644
--- a/user_guide/helpers/directory_helper.html
+++ b/user_guide/helpers/directory_helper.html
@@ -83,7 +83,7 @@ you can do so using the second parameter (integer). A depth of 1 will only map t
<code>$map = directory_map('./mydirectory/', 1);</code>
-<p>By default, hidden files will not be included in the returned array. To override this behavior,
+<p>By default, hidden files will not be included in the returned array. To override this behavior,
you may set a third parameter to <var>true</var> (boolean):</p>
<code>$map = directory_map('./mydirectory/', FALSE, TRUE);</code>
diff --git a/user_guide/helpers/form_helper.html b/user_guide/helpers/form_helper.html
index 03a60685b..0aaa8f60f 100644
--- a/user_guide/helpers/form_helper.html
+++ b/user_guide/helpers/form_helper.html
@@ -258,11 +258,11 @@ echo form_fieldset_close();
<br />
<br />
// Produces<br />
-&lt;fieldset&gt;
+&lt;fieldset&gt;
<br />
-&lt;legend&gt;Address Information&lt;/legend&gt;
+&lt;legend&gt;Address Information&lt;/legend&gt;
<br />
-&lt;p&gt;form content here&lt;/p&gt;
+&lt;p&gt;form content here&lt;/p&gt;
<br />
&lt;/fieldset&gt;</code>
<p>Similar to other functions, you can submit an associative array in the second parameter if you prefer to set additional attributes. </p>
diff --git a/user_guide/helpers/html_helper.html b/user_guide/helpers/html_helper.html
index 50a1c48a4..845ecf109 100644
--- a/user_guide/helpers/html_helper.html
+++ b/user_guide/helpers/html_helper.html
@@ -118,7 +118,7 @@ echo link_tag('css/mystyles.css');<br />
<code>
echo link_tag('favicon.ico', 'shortcut icon', 'image/ico');<br />
- // &lt;link href=&quot;http://site.com/favicon.ico&quot; rel=&quot;shortcut icon&quot; type=&quot;image/ico&quot; /&gt;
+ // &lt;link href=&quot;http://site.com/favicon.ico&quot; rel=&quot;shortcut icon&quot; type=&quot;image/ico&quot; /&gt;
<br />
<br />
echo link_tag('feed', 'alternate', 'application/rss+xml', 'My RSS Feed');<br />
@@ -134,7 +134,7 @@ echo link_tag('css/mystyles.css');<br />
<br />
echo link_tag($link);<br />
// &lt;link href=&quot;http://site.com/css/printer.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;print&quot; /&gt;</code></p>
-
+
<h2><a name="nbs"></a>nbs()</h2>
<p>Generates non-breaking spaces (&amp;nbsp;) based on the number you submit. Example:</p>
<code>echo nbs(3);</code>
diff --git a/user_guide/helpers/smiley_helper.html b/user_guide/helpers/smiley_helper.html
index 661330aab..d95562d94 100644
--- a/user_guide/helpers/smiley_helper.html
+++ b/user_guide/helpers/smiley_helper.html
@@ -91,7 +91,7 @@ a publicly accessible place on your server. This helper also assumes you have t
<p>In your <dfn>application/controllers/</dfn> folder, create a file called <kbd>smileys.php</kbd> and place the code below in it.</p>
-<p><strong>Important:</strong> Change the URL in the <dfn>get_clickable_smileys()</dfn> function below so that it points to
+<p><strong>Important:</strong> Change the URL in the <dfn>get_clickable_smileys()</dfn> function below so that it points to
your <dfn>smiley</dfn> folder.</p>
<p>You'll notice that in addition to the smiley helper we are using the <a href="../libraries/table.html">Table Class</a>.</p>
@@ -105,21 +105,21 @@ class Smileys extends Controller {
{
parent::Controller();
}
-
+
function index()
{
$this->load->helper('smiley');
$this->load->library('table');
-
+
$image_array = get_clickable_smileys('http://example.com/images/smileys/', 'comments');
-
+
$col_array = $this->table->make_columns($image_array, 8);
-
+
$data['smiley_table'] = $this->table->generate($col_array);
-
+
$this->load->view('smiley_view', $data);
}
-
+
}
?&gt;
</textarea>
diff --git a/user_guide/helpers/string_helper.html b/user_guide/helpers/string_helper.html
index 2b12c2a2a..d3f97fb52 100644
--- a/user_guide/helpers/string_helper.html
+++ b/user_guide/helpers/string_helper.html
@@ -145,7 +145,7 @@ The third parameter is FALSE by default; if set to TRUE it will remove occurence
$string=",Fred, Bill,, Joe, Jimmy,";<br />
$string=reduce_multiples($string, ", ", TRUE); //results in "Fred, Bill, Joe, Jimmy"
</code>
-</p>
+</p>
<h2>quotes_to_entities()</h2>
<p>Converts single and double quotes in a string to the corresponding HTML entities. Example:</p>
diff --git a/user_guide/helpers/text_helper.html b/user_guide/helpers/text_helper.html
index 438eaec45..6a68180b6 100644
--- a/user_guide/helpers/text_helper.html
+++ b/user_guide/helpers/text_helper.html
@@ -120,7 +120,7 @@ part it should correctly identify characters outside the normal range (like acce
<p>Transliterates high ASCII characters to low ASCII equivalents, useful when non-English characters need to be used where only standard ASCII characters are safely used, for instance, in URLs.</p>
<code>$string = convert_accented_characters($string);</code>
-
+
<p>This function uses a companion config file <dfn>application/config/foreign_chars.php</dfn> to define the to and from array for transliteration.</p>
<h2>word_censor()</h2>
diff --git a/user_guide/images/ci_logo.jpg b/user_guide/images/ci_logo.jpg
index 3ae0eee07..9ab5a8e24 100644
--- a/user_guide/images/ci_logo.jpg
+++ b/user_guide/images/ci_logo.jpg
Binary files differ
diff --git a/user_guide/images/ci_logo_flame.jpg b/user_guide/images/ci_logo_flame.jpg
index 17e9c586b..5bf38adbb 100644
--- a/user_guide/images/ci_logo_flame.jpg
+++ b/user_guide/images/ci_logo_flame.jpg
Binary files differ
diff --git a/user_guide/images/ci_quick_ref.png b/user_guide/images/ci_quick_ref.png
index c07d6b469..a4aa49585 100644
--- a/user_guide/images/ci_quick_ref.png
+++ b/user_guide/images/ci_quick_ref.png
Binary files differ
diff --git a/user_guide/images/codeigniter_1.7.1_helper_reference.png b/user_guide/images/codeigniter_1.7.1_helper_reference.png
index 15a7c1576..6a7d9f8c9 100644
--- a/user_guide/images/codeigniter_1.7.1_helper_reference.png
+++ b/user_guide/images/codeigniter_1.7.1_helper_reference.png
Binary files differ
diff --git a/user_guide/images/codeigniter_1.7.1_library_reference.png b/user_guide/images/codeigniter_1.7.1_library_reference.png
index 7f054f95f..08636857e 100644
--- a/user_guide/images/codeigniter_1.7.1_library_reference.png
+++ b/user_guide/images/codeigniter_1.7.1_library_reference.png
Binary files differ
diff --git a/user_guide/images/nav_bg.jpg b/user_guide/images/nav_bg.jpg
index 440e04ddb..35640707b 100644
--- a/user_guide/images/nav_bg.jpg
+++ b/user_guide/images/nav_bg.jpg
Binary files differ
diff --git a/user_guide/installation/downloads.html b/user_guide/installation/downloads.html
index f4114b7d1..f557a7887 100644
--- a/user_guide/installation/downloads.html
+++ b/user_guide/installation/downloads.html
@@ -84,11 +84,11 @@ Downloading CodeIgniter
<h1 id="hg">Mercurial Server</h1>
<p><a href="http://mercurial.selenic.com">Mercurial</a> is a distributed version control system.</p>
-
+
<p>Public Hg access is available at <a href="http://bitbucket.org/ellislab/codeigniter/">BitBucket</a>.
Please note that while every effort is made to keep this code base functional, we cannot guarantee the functionality of code taken
from the tip.</p>
-
+
<p>Beginning with version 1.6.1, stable tags are also available via BitBucket, simply select the version from the Tags dropdown.</p>
</div>
<!-- END CONTENT -->
diff --git a/user_guide/installation/index.html b/user_guide/installation/index.html
index 3d58725ed..973d21064 100644
--- a/user_guide/installation/index.html
+++ b/user_guide/installation/index.html
@@ -73,7 +73,7 @@ variables at the top of the file with the new name you've chosen.</p>
<p>For the best security, both the <dfn>system</dfn> and any <dfn>application</dfn> folders should be placed above web root so that they are not directly accessible via a browser. By default, .htaccess files are included in each folder to help prevent direct access, but it is best to remove them from public access entirely in case the web server configuration changes or doesn't abide by the .htaccess.</p>
<p>After moving them, open your main <kdb>index.php</kbd> file and set the <samp>$system_folder</samp> and <samp>$application_folder</samp> variables, preferably with a full path, e.g. '<dfn>/www/MyUser/system</dfn>'.</p>
-
+
<p>That's it!</p>
diff --git a/user_guide/installation/upgrade_160.html b/user_guide/installation/upgrade_160.html
index e0e987ede..b6a946d7e 100644
--- a/user_guide/installation/upgrade_160.html
+++ b/user_guide/installation/upgrade_160.html
@@ -79,7 +79,7 @@ Upgrading from 1.5.4 to 1.6.0
<h2>Step 2: Add time_to_update to your config.php </h2>
<p>Add the following to application/config/config.php with the other session configuration options</p>
-<p><code>$config['sess_time_to_update'] = 300;</code></p>
+<p><code>$config['sess_time_to_update'] = 300;</code></p>
<h2>Step 3: Add $autoload['model']</h2>
<p>Add the following to application/config/autoload.php</p>
<p><code> /*<br />
diff --git a/user_guide/installation/upgrade_170.html b/user_guide/installation/upgrade_170.html
index 7f3cec614..91238ecbc 100644
--- a/user_guide/installation/upgrade_170.html
+++ b/user_guide/installation/upgrade_170.html
@@ -79,7 +79,7 @@ Upgrading from 1.6.3 to 1.7.0
<h2>Step 2: Update your Session Table</h2>
-<p>If you are using the Session class in your application, AND if you are storing session data to a database, you must add a new column named <dfn>user_data</dfn> to your session table.
+<p>If you are using the Session class in your application, AND if you are storing session data to a database, you must add a new column named <dfn>user_data</dfn> to your session table.
Here is an example of what this column might look like for MySQL:</p>
<code>user_data text NOT NULL</code>
@@ -93,7 +93,7 @@ Here is an example of what this column might look like for MySQL:</p>
<h2>Step 3: Update your Validation Syntax</h2>
-<p>This is an <strong>optional</strong>, but recommended step, for people currently using the Validation class. CI 1.7 introduces a new <a href="../libraries/form_validation.html">Form Validation class</a>, which
+<p>This is an <strong>optional</strong>, but recommended step, for people currently using the Validation class. CI 1.7 introduces a new <a href="../libraries/form_validation.html">Form Validation class</a>, which
deprecates the old Validation library. We have left the old one in place so that existing applications that use it will not break, but you are encouraged to
migrate to the new version as soon as possible. Please read the user guide carefully as the new library works a little differently, and has several new features.</p>
diff --git a/user_guide/installation/upgrade_200.html b/user_guide/installation/upgrade_200.html
index 155df90d3..58ed6e5ce 100644
--- a/user_guide/installation/upgrade_200.html
+++ b/user_guide/installation/upgrade_200.html
@@ -80,9 +80,9 @@ Upgrading from 1.7.2 to 2.0.0
<h2>Step 3: Convert your Plugins to Helpers</h2>
<p>2.0.0 gets rid of the "Plugin" system as their functionality was identical to Helpers, but non-extensible. You will need to rename your plugin files from <var>filename_pi.php</var> to <var>filename_helper.php</var>, move them to your <kbd>helpers</kbd> folder, and change all instances of:
-
+
<code>$this->load->plugin('foo');</code>
-
+
to
<code>$this->load->helper('foo');</code>
@@ -97,7 +97,7 @@ to
making it no longer possible to decode encrypted data produced by the original version of this library. To help with the transition, a new method has
been added, <kbd>encode_from_legacy()</kbd> that will decode the data with the original algorithm and return a re-encoded string using the improved methods.
This will enable you to easily replace stale encrypted data with fresh in your applications, either on the fly or en masse.</p>
-
+
<p>Please read <a href="../libraries/encryption.html#legacy">how to use this method</a> in the Encryption library documentation.</p>
</p>
diff --git a/user_guide/libraries/calendar.html b/user_guide/libraries/calendar.html
index 74a8619bf..2c052424d 100644
--- a/user_guide/libraries/calendar.html
+++ b/user_guide/libraries/calendar.html
@@ -114,7 +114,7 @@ how data passed to your cells is handled so you can pass different types of info
<h2>Setting Display Preferences</h2>
-<p>There are seven preferences you can set to control various aspects of the calendar. Preferences are set by passing an
+<p>There are seven preferences you can set to control various aspects of the calendar. Preferences are set by passing an
array of preferences in the second parameter of the loading function. Here is an example:</p>
diff --git a/user_guide/libraries/cart.html b/user_guide/libraries/cart.html
index 0dcf04acc..fb5f6621c 100644
--- a/user_guide/libraries/cart.html
+++ b/user_guide/libraries/cart.html
@@ -58,7 +58,7 @@ Shopping Cart Class
<h1>Shopping Cart Class</h1>
-<p>The Cart Class permits items to be added to a session that stays active while a user is browsing your site.
+<p>The Cart Class permits items to be added to a session that stays active while a user is browsing your site.
These items can be retrieved and displayed in a standard "shopping cart" format, allowing the user to update the quantity or remove items from the cart.</p>
<p>Please note that the Cart Class ONLY provides the core "cart" functionality. It does not provide shipping, credit card authorization, or other processing components.</p>
@@ -109,7 +109,7 @@ It is intended to be used in cases where your product has options associated wit
<li><strong>options</strong> - Any additional attributes that are needed to identify the product. These must be passed via an array.
</ul>
-<p>In addition to the five indexes above, there are two reserved words: <dfn>rowid</dfn> and <dfn>subtotal</dfn>. These are used internally by the Cart class, so
+<p>In addition to the five indexes above, there are two reserved words: <dfn>rowid</dfn> and <dfn>subtotal</dfn>. These are used internally by the Cart class, so
please do NOT use those words as index names when inserting data into the cart.</p>
<p>Your array may contain additional data. Anything you include in your array will be stored in the session. However, it is best to standardize your data among
@@ -181,24 +181,24 @@ $this->cart->insert($data);
&lt;?php foreach($this->cart->contents() as $items): ?>
&lt;?php echo form_hidden($i.'[rowid]', $items['rowid']); ?>
-
+
&lt;tr>
&lt;td>&lt;?php echo form_input(array('name' => $i.'[qty]', 'value' => $items['qty'], 'maxlength' => '3', 'size' => '5')); ?>&lt;/td>
&lt;td>
&lt;?php echo $items['name']; ?>
-
+
&lt;?php if ($this->cart->has_options($items['rowid']) == TRUE): ?>
-
+
&lt;p>
&lt;?php foreach ($this->cart->product_options($items['rowid']) as $option_name => $option_value): ?>
-
+
&lt;strong>&lt;?php echo $option_name; ?>:&lt;/strong> &lt;?php echo $option_value; ?>&lt;br />
-
+
&lt;?php endforeach; ?>
&lt;/p>
-
+
&lt;?php endif; ?>
-
+
&lt;/td>
&lt;td style="text-align:right">&lt;?php echo $this->cart->format_number($items['price']); ?>&lt;/td>
&lt;td style="text-align:right">$&lt;?php echo $this->cart->format_number($items['subtotal']); ?>&lt;/td>
diff --git a/user_guide/libraries/email.html b/user_guide/libraries/email.html
index e144826be..b863ef4c1 100644
--- a/user_guide/libraries/email.html
+++ b/user_guide/libraries/email.html
@@ -83,7 +83,7 @@ Email Class
<code>$this->load->library('email');<br />
<br />
-$this->email->from('your@example.com', 'Your Name');<br />
+$this->email->from('your@example.com', 'Your Name');<br />
$this->email->to('someone@example.com'); <br />
$this->email->cc('another@another-example.com'); <br />
$this->email->bcc('them@their-example.com'); <br />
@@ -233,7 +233,7 @@ in a loop, permitting the data to be reset between cycles.</p>
<code>foreach ($list as $name => $address)<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;$this->email->clear();<br /><br />
-
+
&nbsp;&nbsp;&nbsp;&nbsp;$this->email->to($address);<br />
&nbsp;&nbsp;&nbsp;&nbsp;$this->email->from('your@example.com');<br />
&nbsp;&nbsp;&nbsp;&nbsp;$this->email->subject('Here is your info '.$name);<br />
diff --git a/user_guide/libraries/file_uploading.html b/user_guide/libraries/file_uploading.html
index 31041341f..254b2666a 100644
--- a/user_guide/libraries/file_uploading.html
+++ b/user_guide/libraries/file_uploading.html
@@ -145,15 +145,15 @@ folder:</p>
<textarea class="textarea" style="width:100%" cols="50" rows="43">&lt;?php
class Upload extends Controller {
-
+
function Upload()
{
parent::Controller();
$this->load->helper(array('form', 'url'));
}
-
+
function index()
- {
+ {
$this->load->view('upload_form', array('error' => ' ' ));
}
@@ -164,22 +164,22 @@ class Upload extends Controller {
$config['max_size'] = '100';
$config['max_width'] = '1024';
$config['max_height'] = '768';
-
+
$this->load->library('upload', $config);
-
+
if ( ! $this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());
-
+
$this->load->view('upload_form', $error);
- }
+ }
else
{
$data = array('upload_data' => $this->upload->data());
-
+
$this->load->view('upload_success', $data);
}
- }
+ }
}
?&gt;</textarea>
diff --git a/user_guide/libraries/form_validation.html b/user_guide/libraries/form_validation.html
index 2099135a0..1d0b57181 100644
--- a/user_guide/libraries/form_validation.html
+++ b/user_guide/libraries/form_validation.html
@@ -106,7 +106,7 @@ have left the old class in the library so applications currently using it will n
<ol>
<li>A form is displayed.</li>
<li>You fill it in and submit it.</li>
-<li>If you submitted something invalid, or perhaps missed a required item, the form is redisplayed containing your data
+<li>If you submitted something invalid, or perhaps missed a required item, the form is redisplayed containing your data
along with an error message describing the problem.</li>
<li>This process continues until you have submitted a valid form.</li>
</ol>
@@ -225,13 +225,13 @@ folder:</p>
<textarea class="textarea" style="width:100%" cols="50" rows="21">&lt;?php
class Form extends Controller {
-
+
function index()
{
$this->load->helper(array('form', 'url'));
-
+
$this->load->library('form_validation');
-
+
if ($this->form_validation->run() == FALSE)
{
$this->load->view('myform');
@@ -316,18 +316,18 @@ $this->form_validation->set_rules('email', 'Email', 'required');<br />
<textarea class="textarea" style="width:100%" cols="50" rows="28">&lt;?php
class Form extends Controller {
-
+
function index()
{
$this->load->helper(array('form', 'url'));
-
+
$this->load->library('form_validation');
-
+
$this->form_validation->set_rules('username', 'Username', 'required');
$this->form_validation->set_rules('password', 'Password', 'required');
$this->form_validation->set_rules('passconf', 'Password Confirmation', 'required');
$this->form_validation->set_rules('email', 'Email', 'required');
-
+
if ($this->form_validation->run() == FALSE)
{
$this->load->view('myform');
@@ -518,18 +518,18 @@ create a callback function that does that. Let's create a example of this.</p>
<textarea class="textarea" style="width:100%" cols="50" rows="44">&lt;?php
class Form extends Controller {
-
+
function index()
{
$this->load->helper(array('form', 'url'));
-
+
$this->load->library('form_validation');
-
+
$this->form_validation->set_rules('username', 'Username', 'callback_username_check');
$this->form_validation->set_rules('password', 'Password', 'required');
$this->form_validation->set_rules('passconf', 'Password Confirmation', 'required');
$this->form_validation->set_rules('email', 'Email', 'required');
-
+
if ($this->form_validation->run() == FALSE)
{
$this->load->view('myform');
@@ -539,7 +539,7 @@ class Form extends Controller {
$this->load->view('formsuccess');
}
}
-
+
function username_check($str)
{
if ($str == 'test')
@@ -552,7 +552,7 @@ class Form extends Controller {
return TRUE;
}
}
-
+
}
?></textarea>
@@ -616,7 +616,7 @@ $this->form_validation->set_rules('first_name', '<kbd>lang:</kbd>first_name', 'r
<a name="errordelimiters"></a>
<h2>Changing the Error Delimiters</h2>
-<p>By default, the Form Validation class adds a paragraph tag (&lt;p&gt;) around each error message shown. You can either change these delimiters globally or
+<p>By default, the Form Validation class adds a paragraph tag (&lt;p&gt;) around each error message shown. You can either change these delimiters globally or
individually.</p>
<ol>
diff --git a/user_guide/libraries/ftp.html b/user_guide/libraries/ftp.html
index a46b155b9..493177655 100644
--- a/user_guide/libraries/ftp.html
+++ b/user_guide/libraries/ftp.html
@@ -82,7 +82,7 @@ $this->load->library('ftp');<br />
$config['hostname'] = 'ftp.example.com';<br />
$config['username'] = 'your-username';<br />
$config['password'] = 'your-password';<br />
-$config['debug'] = TRUE;<br />
+$config['debug'] = TRUE;<br />
<br />
$this->ftp->connect($config);<br />
<br />
@@ -101,7 +101,7 @@ $this->load->library('ftp');<br />
$config['hostname'] = 'ftp.example.com';<br />
$config['username'] = 'your-username';<br />
$config['password'] = 'your-password';<br />
-$config['debug'] = TRUE;<br />
+$config['debug'] = TRUE;<br />
<br />
$this->ftp->connect($config);<br />
<br />
@@ -121,7 +121,7 @@ $this->load->library('ftp');<br />
$config['hostname'] = 'ftp.example.com';<br />
$config['username'] = 'your-username';<br />
$config['password'] = 'your-password';<br />
-$config['debug'] = TRUE;<br />
+$config['debug'] = TRUE;<br />
<br />
$this->ftp->connect($config);<br />
<br />
@@ -231,7 +231,7 @@ $this->ftp->delete_file('/public_html/joe/blog.html');
<h2>$this->ftp->delete_dir()</h2>
<p>Lets you delete a directory and everything it contains. Supply the source path to the directory with a trailing slash.</p>
-<p class="important"><strong>Important</strong>&nbsp; Be VERY careful with this function. It will recursively delete
+<p class="important"><strong>Important</strong>&nbsp; Be VERY careful with this function. It will recursively delete
<b>everything</b> within the supplied path, including sub-folders and all files. Make absolutely sure your path is correct.
Try using the <kbd>list_files()</kbd> function first to verify that your path is correct.</p>
@@ -242,7 +242,7 @@ $this->ftp->delete_dir('/public_html/path/to/folder/');
<h2>$this->ftp->list_files()</h2>
-<p>Permits you to retrieve a list of files on your server returned as an <dfn>array</dfn>. You must supply
+<p>Permits you to retrieve a list of files on your server returned as an <dfn>array</dfn>. You must supply
the path to the desired directory.</p>
<code>
@@ -254,7 +254,7 @@ print_r($list);
<h2>$this->ftp->mirror()</h2>
-<p>Recursively reads a local folder and everything it contains (including sub-folders) and creates a
+<p>Recursively reads a local folder and everything it contains (including sub-folders) and creates a
mirror via FTP based on it. Whatever the directory structure of the original file path will be recreated on the server.
You must supply a source path and a destination path:</p>
diff --git a/user_guide/libraries/image_lib.html b/user_guide/libraries/image_lib.html
index 3dce50bf2..98ed4f6dd 100644
--- a/user_guide/libraries/image_lib.html
+++ b/user_guide/libraries/image_lib.html
@@ -447,7 +447,7 @@ calling the watermark function. Here is an example:</p>
<code>
$config['source_image'] = '/path/to/image/mypic.jpg';<br />
-$config['wm_text'] = 'Copyright 2006 - John Doe';<br />
+$config['wm_text'] = 'Copyright 2006 - John Doe';<br />
$config['wm_type'] = 'text';<br />
$config['wm_font_path'] = './system/fonts/texb.ttf';<br />
$config['wm_font_size'] = '16';<br />
diff --git a/user_guide/libraries/loader.html b/user_guide/libraries/loader.html
index 1d5a47f40..34e3929a9 100644
--- a/user_guide/libraries/loader.html
+++ b/user_guide/libraries/loader.html
@@ -78,8 +78,8 @@ Note: We use the terms "class" and "library" interchangeably.</p>
<p>Once loaded, the library will be ready for use, using <kbd>$this->email-></kbd><samp><em>some_function</em>()</samp>.</p>
-<p>Library files can be stored in subdirectories within the main "libraries" folder, or within your personal <dfn>application/libraries</dfn> folder.
-To load a file located in a subdirectory, simply include the path, relative to the "libraries" folder.
+<p>Library files can be stored in subdirectories within the main "libraries" folder, or within your personal <dfn>application/libraries</dfn> folder.
+To load a file located in a subdirectory, simply include the path, relative to the "libraries" folder.
For example, if you have file located at:</p>
<code>libraries/flavors/chocolate.php</code>
@@ -217,7 +217,7 @@ $this->load->library('foo_bar');</code>
<p>When your controller is finished using resources from an application package, and particularly if you have other application packages you want to work with, you may wish to remove the package path so the Loader no longer looks in that folder for resources. To remove the last path added, simply call the method with no parameters.</p>
<h3>$this->load->remove_package_path()</h3>
-
+
<p>Or to remove a specific package path, specify the same path previously given to <kbd>add_package_path() for a package.</kbd>:</p>
<code>$this->load->remove_package_path(<var>APPPATH</var>.'third_party/<var>foo_bar</var>/');</code>
diff --git a/user_guide/libraries/output.html b/user_guide/libraries/output.html
index eeb278371..a1427de7b 100644
--- a/user_guide/libraries/output.html
+++ b/user_guide/libraries/output.html
@@ -140,9 +140,9 @@ at the bottom of your pages for debugging and optimization purposes.</p>
<h2>Parsing Execution Variables</h2>
<p>CodeIgniter will parse the pseudo-variables <var>{elapsed_time}</var> and <var>{memory_usage}</var> in your output by default. To disable this, set the <var>$parse_exec_vars</var> class property to <var>FALSE</var> in your controller.
-
+
<code>$this->output->parse_exec_vars = FALSE;</code>
-
+
</div>
<!-- END CONTENT -->
diff --git a/user_guide/libraries/pagination.html b/user_guide/libraries/pagination.html
index 521b708b1..42c102c8d 100644
--- a/user_guide/libraries/pagination.html
+++ b/user_guide/libraries/pagination.html
@@ -69,7 +69,7 @@ Pagination Class
<p>Here is a simple example showing how to create pagination in one of your <a href="../general/controllers.html">controller</a> functions:</p>
<code>
-$this->load->library('pagination');<br /><br />
+$this->load->library('pagination');<br /><br />
$config['base_url'] = 'http://example.com/index.php/test/page/';<br />
$config['total_rows'] = '200';<br />
$config['per_page'] = '20';
diff --git a/user_guide/libraries/table.html b/user_guide/libraries/table.html
index f1a46fca0..e90aca3d2 100644
--- a/user_guide/libraries/table.html
+++ b/user_guide/libraries/table.html
@@ -83,7 +83,7 @@ $data = array(<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array('John', 'Green', 'Medium') <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);<br />
<br />
-echo $this->table->generate($data);
+echo $this->table->generate($data);
</code>
<p>Here is an example of a table created from a database query result. The table class will automatically generate the
@@ -95,7 +95,7 @@ $this->load->library('table');<br />
<br />
$query = $this->db->query("SELECT * FROM my_table");<br />
<br />
-echo $this->table->generate($query);
+echo $this->table->generate($query);
</code>
@@ -110,7 +110,7 @@ $this->table->add_row('Fred', 'Blue', 'Small');<br />
$this->table->add_row('Mary', 'Red', 'Large');<br />
$this->table->add_row('John', 'Green', 'Medium');<br />
<br />
-echo $this->table->generate();
+echo $this->table->generate();
</code>
<p>Here is the same example, except instead of individual parameters, arrays are used:</p>
@@ -124,7 +124,7 @@ $this->table->add_row(array('Fred', 'Blue', 'Small'));<br />
$this->table->add_row(array('Mary', 'Red', 'Large'));<br />
$this->table->add_row(array('John', 'Green', 'Medium'));<br />
<br />
-echo $this->table->generate();
+echo $this->table->generate();
</code>
diff --git a/user_guide/libraries/typography.html b/user_guide/libraries/typography.html
index 2675fa759..e78af5f9a 100644
--- a/user_guide/libraries/typography.html
+++ b/user_guide/libraries/typography.html
@@ -134,7 +134,7 @@ This function is identical to the native PHP <dfn>nl2br()</dfn> function, except
<p>When using the Typography library in conjunction with the Template Parser library it can often be desirable to protect single
and double quotes within curly braces. To enable this, set the <kbd>protect_braced_quotes</kbd> class property to <samp>TRUE</samp>.</p>
-
+
<p>Usage example:</p>
<code>$this->load->library('typography');<br />
diff --git a/user_guide/libraries/unit_testing.html b/user_guide/libraries/unit_testing.html
index 0e7d1d696..84db54431 100644
--- a/user_guide/libraries/unit_testing.html
+++ b/user_guide/libraries/unit_testing.html
@@ -81,7 +81,7 @@ to determine if it is producing the correct data type and result.
<h2>$this->unit->run( <var>test</var>, <var>expected result</var>, '<var>test name</var>', '<var>notes</var>');</h2>
-<p>Where <var>test</var> is the result of the code you wish to test, <var>expected result</var> is the data type you expect,
+<p>Where <var>test</var> is the result of the code you wish to test, <var>expected result</var> is the data type you expect,
<var>test name</var> is an optional name you can give your test, and <var>notes</var> are optional notes. Example:</p>
<code>$test = 1 + 1;<br />
diff --git a/user_guide/libraries/xmlrpc.html b/user_guide/libraries/xmlrpc.html
index 8d1dbdf5f..971ab0296 100644
--- a/user_guide/libraries/xmlrpc.html
+++ b/user_guide/libraries/xmlrpc.html
@@ -192,7 +192,7 @@ The allowed methods are on the left side of the array. When either of those are
<p>The '<var>object</var>' key is a special key that you pass an instantiated class object with, which is necessary when the method you are mapping to is not
part of the CodeIgniter super object.</p>
-
+
<p>In other words, if an XML-RPC Client sends a request for the <var>new_post</var> method, your
server will load the <dfn>My_blog</dfn> class and call the <dfn>new_entry</dfn> function.
If the request is for the <var>update_post</var> method, your
@@ -202,7 +202,7 @@ server will load the <dfn>My_blog</dfn> class and call the <dfn>update_entry</df
or if you are using standardized APIs, like the Blogger or MetaWeblog API, you'll use their function names.</p>
<p>There are two additional configuration keys you may make use of when initializing the server class: <var>debug</var> can be set to TRUE in order to enable debugging, and <var>xss_clean</var> may be set to FALSE to prevent sending data through the Security library's xss_clean function.
-
+
<h2>Processing Server Requests</h2>
<p>When the XML-RPC Server receives a request and loads the class/method for processing, it will pass
@@ -324,20 +324,20 @@ In it, place this code and save it to your <samp>applications/controllers/</samp
<textarea class="textarea" style="width:100%" cols="50" rows="32">&lt;?php
class Xmlrpc_client extends Controller {
-
+
function index()
- {
+ {
$this->load->helper('url');
$server_url = site_url('xmlrpc_server');
-
+
$this->load->library('xmlrpc');
-
+
$this->xmlrpc->server($server_url, 80);
$this->xmlrpc->method('Greetings');
-
+
$request = array('How is it going?');
- $this->xmlrpc->request($request);
-
+ $this->xmlrpc->request($request);
+
if ( ! $this->xmlrpc->send_request())
{
echo $this->xmlrpc->display_error();
@@ -367,24 +367,24 @@ class Xmlrpc_server extends Controller {
{
$this->load->library('xmlrpc');
$this->load->library('xmlrpcs');
-
+
$config['functions']['Greetings'] = array('function' => 'Xmlrpc_server.process');
-
+
$this->xmlrpcs->initialize($config);
$this->xmlrpcs->serve();
}
-
-
+
+
function process($request)
{
$parameters = $request->output_parameters();
-
+
$response = array(
array(
'you_said' => $parameters['0'],
'i_respond' => 'Not bad at all.'),
'struct');
-
+
return $this->xmlrpc->send_response($response);
}
}
@@ -422,7 +422,7 @@ The Server receives the request and maps it to the "process" function, where a r
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);<br />
$this-&gt;xmlrpc-&gt;request($request);</code>
-
+
<p>You can retrieve the associative array when processing the request in the Server.</p>
<code>$parameters = $request-&gt;output_parameters();<br />
diff --git a/user_guide/nav/moo.fx.js b/user_guide/nav/moo.fx.js
index 53cfa925f..c80697fd2 100755
--- a/user_guide/nav/moo.fx.js
+++ b/user_guide/nav/moo.fx.js
@@ -71,7 +71,7 @@ fx.Layout.prototype = Object.extend(new fx.Base(), {
});
fx.Height = Class.create();
-Object.extend(Object.extend(fx.Height.prototype, fx.Layout.prototype), {
+Object.extend(Object.extend(fx.Height.prototype, fx.Layout.prototype), {
increase: function() {
this.el.style.height = this.now + "px";
},
@@ -83,7 +83,7 @@ Object.extend(Object.extend(fx.Height.prototype, fx.Layout.prototype), {
});
fx.Width = Class.create();
-Object.extend(Object.extend(fx.Width.prototype, fx.Layout.prototype), {
+Object.extend(Object.extend(fx.Width.prototype, fx.Layout.prototype), {
increase: function() {
this.el.style.width = this.now + "px";
},
diff --git a/user_guide/nav/moo.fx.pack.js b/user_guide/nav/moo.fx.pack.js
index 574f27cff..e2ce39927 100755
--- a/user_guide/nav/moo.fx.pack.js
+++ b/user_guide/nav/moo.fx.pack.js
@@ -113,7 +113,7 @@ fx.MultiFadeSize.prototype = Object.extend(new Multi(), {
this.el[i].fs.toggle(mode);
setTimeout(function(){el.fs.toggle(mode);}.bind(el), delay);
}
-
+
}
},
@@ -170,13 +170,13 @@ fx.RememberHeight.prototype = Object.extend(new Remember(), {
this.fx = new fx.Height(this.el, this.options);
this.prefix = 'height';
},
-
+
toggle: function(){
if (this.el.offsetHeight == 0) this.setCookie(this.el.scrollHeight);
else this.setCookie(0);
this.fx.toggle();
},
-
+
resize: function(to){
this.setCookie(this.el.offsetHeight+to);
this.fx.custom(this.el.offsetHeight,this.el.offsetHeight+to);
diff --git a/user_guide/overview/at_a_glance.html b/user_guide/overview/at_a_glance.html
index f07313721..984eb0867 100644
--- a/user_guide/overview/at_a_glance.html
+++ b/user_guide/overview/at_a_glance.html
@@ -103,7 +103,7 @@ approach to URLs that is synonymous with dynamic systems, CodeIgniter uses a seg
<h2>CodeIgniter Packs a Punch</h2>
<p>CodeIgniter comes with full-range of libraries that enable the most commonly needed web development tasks,
-like accessing a database, sending email, validating form data, maintaining sessions, manipulating images, working with XML-RPC data and
+like accessing a database, sending email, validating form data, maintaining sessions, manipulating images, working with XML-RPC data and
much more.</p>
<h2>CodeIgniter is Extensible</h2>
diff --git a/user_guide/overview/index.html b/user_guide/overview/index.html
index 3cb56f42b..59ee05c5a 100644
--- a/user_guide/overview/index.html
+++ b/user_guide/overview/index.html
@@ -67,7 +67,7 @@ Introduction
<li><a href="goals.html">Design and Architectural Goals</a></li>
<li><a href="package.html">Package Description</a></li>
</ul>
-
+
diff --git a/user_guide/toc.html b/user_guide/toc.html
index db9e9a824..d0caa6231 100644
--- a/user_guide/toc.html
+++ b/user_guide/toc.html
@@ -68,7 +68,7 @@ Table of Contents
<li><a href="license.html">License Agreement</a></li>
<li><a href="changelog.html">Change Log</a></li>
<li><a href="./general/credits.html">Credits</a></li>
-</ul>
+</ul>
<h3>Installation</h3>
<ul>
@@ -87,7 +87,7 @@ Table of Contents
<li><a href="./overview/appflow.html">Application Flow Chart</a></li>
<li><a href="./overview/mvc.html">Model-View-Controller</a></li>
<li><a href="./overview/goals.html">Architectural Goals</a></li>
-</ul>
+</ul>
</td>
@@ -114,7 +114,7 @@ Table of Contents
<li><a href="./general/managing_apps.html">Managing Applications</a></li>
<li><a href="./general/alternative_php.html">Alternative PHP Syntax</a></li>
<li><a href="./general/security.html">Security</a></li>
- <li><a href="./general/styleguide.html">PHP Style Guide</a></li>
+ <li><a href="./general/styleguide.html">PHP Style Guide</a></li>
<li><a href="./doc_style/index.html">Writing Documentation</a></li>
</ul>
@@ -134,7 +134,7 @@ Table of Contents
<li><a href="./libraries/form_validation.html">Form Validation Class</a></li>
<li><a href="./libraries/ftp.html">FTP Class</a></li>
<li><a href="./libraries/table.html">HTML Table Class</a></li>
-<li><a href="./libraries/image_lib.html">Image Manipulation Class</a></li>
+<li><a href="./libraries/image_lib.html">Image Manipulation Class</a></li>
<li><a href="./libraries/input.html">Input Class</a></li>
<li><a href="./libraries/loader.html">Loader Class</a></li>
<li><a href="./libraries/language.html">Language Class</a></li>
@@ -180,7 +180,7 @@ Table of Contents
<li><a href="./helpers/typography_helper.html">Typography Helper</a></li>
<li><a href="./helpers/url_helper.html">URL Helper</a></li>
<li><a href="./helpers/xml_helper.html">XML Helper</a></li>
-</ul>
+</ul>
<h3>Additional Resources</h3>