Do you wish to register an account?
Browse Source

Update CodeIgniter version and associated config

master
Timothy Warren 7 months ago
parent
commit
b96a69f592
100 changed files with 8603 additions and 5090 deletions
  1. +1
    -3
      .travis.yml
  2. +154
    -17
      application/config/config.php
  3. +50
    -11
      application/config/database.php
  4. +0
    -0
      application/controllers/Account.php
  5. +0
    -0
      application/controllers/Calendar.php
  6. +0
    -0
      application/controllers/Category.php
  7. +0
    -0
      application/controllers/Friend.php
  8. +0
    -0
      application/controllers/Group.php
  9. +0
    -0
      application/controllers/Login.php
  10. +0
    -0
      application/controllers/Reminder.php
  11. +0
    -0
      application/controllers/Task.php
  12. +0
    -0
      application/models/Friend_model.php
  13. +0
    -0
      application/models/Mail_model.php
  14. +0
    -0
      application/models/Task_model.php
  15. +64
    -0
      application/views/errors/html/error_404.php
  16. +64
    -0
      application/views/errors/html/error_db.php
  17. +32
    -0
      application/views/errors/html/error_exception.php
  18. +64
    -0
      application/views/errors/html/error_general.php
  19. +33
    -0
      application/views/errors/html/error_php.php
  20. +1
    -1
      application/views/login/login.php
  21. +1
    -1
      application/views/task/list.php
  22. +1
    -1
      composer.json
  23. +49
    -0
      migrations/20190220154203_recreate_session_db_table.php
  24. +33
    -0
      phinx.yml
  25. +6
    -1
      system/.htaccess
  26. +60
    -45
      system/core/Benchmark.php
  27. +312
    -155
      system/core/CodeIgniter.php
  28. +577
    -292
      system/core/Common.php
  29. +201
    -201
      system/core/Config.php
  30. +53
    -21
      system/core/Controller.php
  31. +174
    -93
      system/core/Exceptions.php
  32. +115
    -97
      system/core/Hooks.php
  33. +541
    -495
      system/core/Input.php
  34. +107
    -64
      system/core/Lang.php
  35. +690
    -523
      system/core/Loader.php
  36. +296
    -0
      system/core/Log.php
  37. +48
    -29
      system/core/Model.php
  38. +491
    -223
      system/core/Output.php
  39. +290
    -297
      system/core/Router.php
  40. +569
    -354
      system/core/Security.php
  41. +306
    -317
      system/core/URI.php
  42. +74
    -75
      system/core/Utf8.php
  43. +254
    -0
      system/core/compat/hash.php
  44. +2
    -1
      system/core/compat/index.html
  45. +149
    -0
      system/core/compat/mbstring.php
  46. +251
    -0
      system/core/compat/password.php
  47. +182
    -0
      system/core/compat/standard.php
  48. +2
    -1
      system/core/index.html
  49. +44
    -35
      system/database/DB.php
  50. +32
    -29
      system/database/DB_cache.php
  51. +226
    -127
      system/database/DB_driver.php
  52. +65
    -95
      system/database/DB_forge.php
  53. +270
    -172
      system/database/DB_query_builder.php
  54. +40
    -33
      system/database/DB_result.php
  55. +34
    -25
      system/database/DB_utility.php
  56. +44
    -66
      system/database/drivers/cubrid/cubrid_driver.php
  57. +31
    -20
      system/database/drivers/cubrid/cubrid_forge.php
  58. +28
    -21
      system/database/drivers/cubrid/cubrid_result.php
  59. +28
    -20
      system/database/drivers/cubrid/cubrid_utility.php
  60. +2
    -1
      system/database/drivers/cubrid/index.html
  61. +63
    -51
      system/database/drivers/ibase/ibase_driver.php
  62. +30
    -22
      system/database/drivers/ibase/ibase_forge.php
  63. +28
    -21
      system/database/drivers/ibase/ibase_result.php
  64. +28
    -20
      system/database/drivers/ibase/ibase_utility.php
  65. +2
    -1
      system/database/drivers/ibase/index.html
  66. +2
    -1
      system/database/drivers/index.html
  67. +2
    -1
      system/database/drivers/mssql/index.html
  68. +52
    -62
      system/database/drivers/mssql/mssql_driver.php
  69. +35
    -20
      system/database/drivers/mssql/mssql_forge.php
  70. +31
    -22
      system/database/drivers/mssql/mssql_result.php
  71. +30
    -20
      system/database/drivers/mssql/mssql_utility.php
  72. +2
    -1
      system/database/drivers/mysql/index.html
  73. +65
    -67
      system/database/drivers/mysql/mysql_driver.php
  74. +31
    -21
      system/database/drivers/mysql/mysql_forge.php
  75. +28
    -21
      system/database/drivers/mysql/mysql_result.php
  76. +28
    -20
      system/database/drivers/mysql/mysql_utility.php
  77. +2
    -1
      system/database/drivers/mysqli/index.html
  78. +149
    -76
      system/database/drivers/mysqli/mysqli_driver.php
  79. +32
    -21
      system/database/drivers/mysqli/mysqli_forge.php
  80. +78
    -23
      system/database/drivers/mysqli/mysqli_result.php
  81. +31
    -23
      system/database/drivers/mysqli/mysqli_utility.php
  82. +2
    -1
      system/database/drivers/oci8/index.html
  83. +104
    -109
      system/database/drivers/oci8/oci8_driver.php
  84. +76
    -22
      system/database/drivers/oci8/oci8_forge.php
  85. +28
    -21
      system/database/drivers/oci8/oci8_result.php
  86. +28
    -20
      system/database/drivers/oci8/oci8_utility.php
  87. +2
    -1
      system/database/drivers/odbc/index.html
  88. +163
    -104
      system/database/drivers/odbc/odbc_driver.php
  89. +30
    -20
      system/database/drivers/odbc/odbc_forge.php
  90. +30
    -21
      system/database/drivers/odbc/odbc_result.php
  91. +30
    -20
      system/database/drivers/odbc/odbc_utility.php
  92. +2
    -1
      system/database/drivers/pdo/index.html
  93. +37
    -100
      system/database/drivers/pdo/pdo_driver.php
  94. +30
    -20
      system/database/drivers/pdo/pdo_forge.php
  95. +31
    -22
      system/database/drivers/pdo/pdo_result.php
  96. +30
    -20
      system/database/drivers/pdo/pdo_utility.php
  97. +2
    -1
      system/database/drivers/pdo/subdrivers/index.html
  98. +29
    -21
      system/database/drivers/pdo/subdrivers/pdo_4d_driver.php
  99. +30
    -22
      system/database/drivers/pdo/subdrivers/pdo_4d_forge.php
  100. +29
    -67
      system/database/drivers/pdo/subdrivers/pdo_cubrid_driver.php

+ 1
- 3
.travis.yml View File

@@ -3,10 +3,8 @@ language: php
sudo: false

php:
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- hhvm

install:


+ 154
- 17
application/config/config.php View File

@@ -106,6 +106,27 @@ $config['enable_hooks'] = TRUE;
*/
$config['subclass_prefix'] = 'MY_';

/*
|--------------------------------------------------------------------------
| Composer auto-loading
|--------------------------------------------------------------------------
|
| Enabling this setting will tell CodeIgniter to look for a Composer
| package auto-loader script in application/vendor/autoload.php.
|
| $config['composer_autoload'] = TRUE;
|
| Or if you have your vendor/ directory located somewhere else, you
| can opt to set a specific path as well:
|
| $config['composer_autoload'] = '/path/to/vendor/autoload.php';
|
| For more information about Composer, please visit http://getcomposer.org/
|
| Note: This will NOT disable or override the CodeIgniter-specific
| autoloading (application/config/autoload.php)
*/
$config['composer_autoload'] = FALSE;

/*
|--------------------------------------------------------------------------
@@ -149,11 +170,25 @@ $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
| use segment based URLs.
|
*/
$config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd'; // experimental not currently in use
$config['directory_trigger'] = 'd';

/*
|--------------------------------------------------------------------------
| Allow $_GET array
|--------------------------------------------------------------------------
|
| By default CodeIgniter enables access to the $_GET array. If for some
| reason you would like to disable it, set 'allow_get_array' to FALSE.
|
| WARNING: This feature is DEPRECATED and currently available only
| for backwards compatibility purposes!
|
*/
$config['allow_get_array'] = TRUE;


/*
|--------------------------------------------------------------------------
@@ -188,6 +223,33 @@ $config['log_threshold'] = 1;
*/
$config['log_path'] = '';

/*
|--------------------------------------------------------------------------
| Log File Extension
|--------------------------------------------------------------------------
|
| The default filename extension for log files. The default 'php' allows for
| protecting the log files via basic scripting, when they are to be stored
| under a publicly accessible directory.
|
| Note: Leaving it blank will default to 'php'.
|
*/
$config['log_file_extension'] = '';

/*
|--------------------------------------------------------------------------
| Log File Permissions
|--------------------------------------------------------------------------
|
| The file system permissions to be applied on newly created log files.
|
| IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal
| integer notation (i.e. 0700, 0644, etc.)
*/
$config['log_file_permissions'] = 0644;


/*
|--------------------------------------------------------------------------
| Date Format for Logs
@@ -199,6 +261,17 @@ $config['log_path'] = '';
*/
$config['log_date_format'] = 'Y-m-d H:i:s';

/*
|--------------------------------------------------------------------------
| Error Views Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/views/errors/ directory. Use a full server path with trailing slash.
|
*/
$config['error_views_path'] = '';

/*
|--------------------------------------------------------------------------
| Cache Directory Path
@@ -210,6 +283,24 @@ $config['log_date_format'] = 'Y-m-d H:i:s';
*/
$config['cache_path'] = '';

/*
|--------------------------------------------------------------------------
| Cache Include Query String
|--------------------------------------------------------------------------
|
| Whether to take the URL query string into consideration when generating
| output cache files. Valid options are:
|
| FALSE = Disabled
| TRUE = Enabled, take all query parameters into account.
| Please be aware that this may result in numerous cache
| files generated for the same page over and over again.
| array('q') = Enabled, but only take into account the specified list
| of query parameters.
|
*/
$config['cache_query_string'] = FALSE;

/*
|--------------------------------------------------------------------------
| Encryption Key
@@ -226,21 +317,59 @@ $config['encryption_key'] = "xLx45kOkywjdvvVMxLov";
| Session Variables
|--------------------------------------------------------------------------
|
| 'session_cookie_name' = the name you want for the cookie
| 'encrypt_sess_cookie' = TRUE/FALSE (boolean). Whether to encrypt the cookie
| 'session_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.
| 'time_to_update' = how many seconds between CI refreshing Session Information
| 'sess_driver'
|
| The storage driver to use: files, database, redis, memcached
|
| 'sess_cookie_name'
|
| The session cookie name, must contain only [0-9a-z_-] characters
|
| 'sess_expiration'
|
| The number of SECONDS you want the session to last.
| Setting to 0 (zero) means expire when the browser is closed.
|
| 'sess_save_path'
|
| The location to save sessions to, driver dependent.
|
| For the 'files' driver, it's a path to a writable directory.
| WARNING: Only absolute paths are supported!
|
| For the 'database' driver, it's a table name.
| Please read up the manual for the format with other session drivers.
|
| IMPORTANT: You are REQUIRED to set a valid save path!
|
| 'sess_match_ip'
|
| Whether to match the user's IP address when reading the session data.
|
| WARNING: If you're using the database driver, don't forget to update
| your session table's PRIMARY KEY when changing this setting.
|
| 'sess_time_to_update'
|
| How many seconds between CI regenerating the session ID.
|
| 'sess_regenerate_destroy'
|
| Whether to destroy session data associated with the old session ID
| when auto-regenerating the session ID. When set to FALSE, the data
| will be later deleted by the garbage collector.
|
| Other session cookie settings are shared with the rest of the application,
| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here.
|
*/
$config['sess_cookie_name'] = 'sess';
$config['sess_expiration'] = 43200; //12 hours
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = TRUE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'sess';
$config['sess_expiration'] = 43200; //12 hours
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

/*
|--------------------------------------------------------------------------
@@ -280,11 +409,15 @@ $config['global_xss_filtering'] = FALSE;
| 'csrf_token_name' = The token name
| 'csrf_cookie_name' = The cookie name
| 'csrf_expire' = The number in seconds the token should expire.
| 'csrf_regenerate' = Regenerate token on every submission
| 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks
*/
$config['csrf_protection'] = TRUE;
$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_token';
$config['csrf_cookie_name'] = 'csrf_cookie';
$config['csrf_expire'] = 7200;
$config['csrf_regenerate'] = TRUE;
$config['csrf_exclude_uris'] = array();

/*
|--------------------------------------------------------------------------
@@ -296,13 +429,17 @@ $config['csrf_expire'] = 7200;
| Even if it does, however, not all browsers support compression
| so enable only if you are reasonably sure your visitors can handle it.
|
| Only used if zlib.output_compression is turned off in your php.ini.
| Please do not use it together with httpd-level output compression.
|
| VERY IMPORTANT: If you are getting a blank page when compression is enabled it
| means you are prematurely outputting something to your browser. It could
| even be a line of whitespace at the end of one of your scripts. For
| compression to work, nothing can be sent before the output buffer is called
| by the output class. Do not "echo" any values with compression enabled.
| by the output class. Do not 'echo' any values with compression enabled.
|
*/

$config['compress_output'] = TRUE;

/*


+ 50
- 11
application/config/database.php View File

@@ -1,41 +1,79 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

/*
| -------------------------------------------------------------------
| DATABASE CONNECTIVITY SETTINGS
| -------------------------------------------------------------------
| This file will contain the settings needed to access your database.
|
| For complete instructions please consult the "Database Connection"
| For complete instructions please consult the 'Database Connection'
| page of the User Guide.
|
| -------------------------------------------------------------------
| EXPLANATION OF VARIABLES
| -------------------------------------------------------------------
|
| ['dsn'] The full DSN string describe a connection to the database.
| ['hostname'] The hostname of your database server.
| ['username'] The username used to connect to the database
| ['password'] The password used to connect to the database
| ['database'] The name of the database you want to connect to
| ['dbdriver'] The database type. ie: mysql. Currently supported:
mysql, mysqli, postgre, odbc, mssql, sqlite, oci8
| ['dbdriver'] The database driver. e.g.: mysqli.
| Currently supported:
| cubrid, ibase, mssql, mysql, mysqli, oci8,
| odbc, pdo, postgre, sqlite, sqlite3, sqlsrv
| ['dbprefix'] You can add an optional prefix, which will be added
| to the table name when using the Active Record class
| to the table name when using the Query Builder class
| ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
| ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
| ['cache_on'] TRUE/FALSE - Enables/disables query caching
| ['cachedir'] The path to the folder where cache files should be stored
| ['char_set'] The character set used in communicating with the database
| ['dbcollat'] The character collation used in communicating with the database
| NOTE: For MySQL and MySQLi databases, this setting is only used
| as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
| (and in table creation queries made with DB Forge).
| There is an incompatibility in PHP with mysql_real_escape_string() which
| can make your site vulnerable to SQL injection if you are using a
| multi-byte character set and are running versions lower than these.
| Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
| ['swap_pre'] A default table prefix that should be swapped with the dbprefix
| ['encrypt'] Whether or not to use an encrypted connection.
|
| 'mysql' (deprecated), 'sqlsrv' and 'pdo/sqlsrv' drivers accept TRUE/FALSE
| 'mysqli' and 'pdo/mysql' drivers accept an array with the following options:
|
| 'ssl_key' - Path to the private key file
| 'ssl_cert' - Path to the public key certificate file
| 'ssl_ca' - Path to the certificate authority file
| 'ssl_capath' - Path to a directory containing trusted CA certificates in PEM format
| 'ssl_cipher' - List of *allowed* ciphers to be used for the encryption, separated by colons (':')
| 'ssl_verify' - TRUE/FALSE; Whether verify the server certificate or not
|
| ['compress'] Whether or not to use client compression (MySQL only)
| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
| - good for ensuring strict SQL while developing
| ['ssl_options'] Used to set various SSL options that can be used when making SSL connections.
| ['failover'] array - A array with 0 or more data for connections if the main should fail.
| ['save_queries'] TRUE/FALSE - Whether to "save" all executed queries.
| NOTE: Disabling this will also effectively disable both
| $this->db->last_query() and profiling of DB queries.
| When you run a query, with this setting set to TRUE (default),
| CodeIgniter will store the SQL statement for debugging purposes.
| However, this may cause high memory usage, especially if you run
| a lot of SQL queries ... disable this to avoid that problem.
|
| The $active_group variable lets you choose which connection group to
| make active. By mysql there is only one group (the "mysql" group).
| make active. By default there is only one group (the 'default' group).
|
| The $active_record variables lets you determine whether or not to load
| the active record class
| The $query_builder variables lets you determine whether or not to load
| the query builder class.
*/


$active_group = "todo";
$active_record = TRUE;
$query_builder = TRUE;

$db = [
'todo' => [
@@ -45,7 +83,7 @@ $db = [
'database' => 'todo',
'dbdriver' => 'postgre',
'dbprefix' => 'todo_',
'pconnect' => TRUE,
'pconnect' => FALSE,
'db_debug' => TRUE,
'cache_on' => FALSE,
'cachedir' => '',
@@ -53,7 +91,8 @@ $db = [
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'autoinit' => TRUE,
'stricton' => FALSE
'stricton' => TRUE,
'save_queries' => TRUE,
],
];



application/controllers/account.php → application/controllers/Account.php View File


application/controllers/calendar.php → application/controllers/Calendar.php View File


application/controllers/category.php → application/controllers/Category.php View File


application/controllers/friend.php → application/controllers/Friend.php View File


application/controllers/group.php → application/controllers/Group.php View File


application/controllers/login.php → application/controllers/Login.php View File


application/controllers/reminder.php → application/controllers/Reminder.php View File


application/controllers/task.php → application/controllers/Task.php View File


application/models/friend_model.php → application/models/Friend_model.php View File


application/models/mail_model.php → application/models/Mail_model.php View File


application/models/task_model.php → application/models/Task_model.php View File


+ 64
- 0
application/views/errors/html/error_404.php View File

@@ -0,0 +1,64 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>404 Page Not Found</title>
<style type="text/css">

::selection { background-color: #E13300; color: white; }
::-moz-selection { background-color: #E13300; color: white; }

body {
background-color: #fff;
margin: 40px;
font: 13px/20px normal Helvetica, Arial, sans-serif;
color: #4F5155;
}

a {
color: #003399;
background-color: transparent;
font-weight: normal;
}

h1 {
color: #444;
background-color: transparent;
border-bottom: 1px solid #D0D0D0;
font-size: 19px;
font-weight: normal;
margin: 0 0 14px 0;
padding: 14px 15px 10px 15px;
}

code {
font-family: Consolas, Monaco, Courier New, Courier, monospace;
font-size: 12px;
background-color: #f9f9f9;
border: 1px solid #D0D0D0;
color: #002166;
display: block;
margin: 14px 0 14px 0;
padding: 12px 10px 12px 10px;
}

#container {
margin: 10px;
border: 1px solid #D0D0D0;
box-shadow: 0 0 8px #D0D0D0;
}

p {
margin: 12px 15px 12px 15px;
}
</style>
</head>
<body>
<div id="container">
<h1><?php echo $heading; ?></h1>
<?php echo $message; ?>
</div>
</body>
</html>

+ 64
- 0
application/views/errors/html/error_db.php View File

@@ -0,0 +1,64 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Database Error</title>
<style type="text/css">

::selection { background-color: #E13300; color: white; }
::-moz-selection { background-color: #E13300; color: white; }

body {
background-color: #fff;
margin: 40px;
font: 13px/20px normal Helvetica, Arial, sans-serif;
color: #4F5155;
}

a {
color: #003399;
background-color: transparent;
font-weight: normal;
}

h1 {
color: #444;
background-color: transparent;
border-bottom: 1px solid #D0D0D0;
font-size: 19px;
font-weight: normal;
margin: 0 0 14px 0;
padding: 14px 15px 10px 15px;
}

code {
font-family: Consolas, Monaco, Courier New, Courier, monospace;
font-size: 12px;
background-color: #f9f9f9;
border: 1px solid #D0D0D0;
color: #002166;
display: block;
margin: 14px 0 14px 0;
padding: 12px 10px 12px 10px;
}

#container {
margin: 10px;
border: 1px solid #D0D0D0;
box-shadow: 0 0 8px #D0D0D0;
}

p {
margin: 12px 15px 12px 15px;
}
</style>
</head>
<body>
<div id="container">
<h1><?php echo $heading; ?></h1>
<?php echo $message; ?>
</div>
</body>
</html>

+ 32
- 0
application/views/errors/html/error_exception.php View File

@@ -0,0 +1,32 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>

<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

<h4>An uncaught Exception was encountered</h4>

<p>Type: <?php echo get_class($exception); ?></p>
<p>Message: <?php echo $message; ?></p>
<p>Filename: <?php echo $exception->getFile(); ?></p>
<p>Line Number: <?php echo $exception->getLine(); ?></p>

<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>

<p>Backtrace:</p>
<?php foreach ($exception->getTrace() as $error): ?>

<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>

<p style="margin-left:10px">
File: <?php echo $error['file']; ?><br />
Line: <?php echo $error['line']; ?><br />
Function: <?php echo $error['function']; ?>
</p>
<?php endif ?>

<?php endforeach ?>

<?php endif ?>

</div>

+ 64
- 0
application/views/errors/html/error_general.php View File

@@ -0,0 +1,64 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
<style type="text/css">

::selection { background-color: #E13300; color: white; }
::-moz-selection { background-color: #E13300; color: white; }

body {
background-color: #fff;
margin: 40px;
font: 13px/20px normal Helvetica, Arial, sans-serif;
color: #4F5155;
}

a {
color: #003399;
background-color: transparent;
font-weight: normal;
}

h1 {
color: #444;
background-color: transparent;
border-bottom: 1px solid #D0D0D0;
font-size: 19px;
font-weight: normal;
margin: 0 0 14px 0;
padding: 14px 15px 10px 15px;
}

code {
font-family: Consolas, Monaco, Courier New, Courier, monospace;
font-size: 12px;
background-color: #f9f9f9;
border: 1px solid #D0D0D0;
color: #002166;
display: block;
margin: 14px 0 14px 0;
padding: 12px 10px 12px 10px;
}

#container {
margin: 10px;
border: 1px solid #D0D0D0;
box-shadow: 0 0 8px #D0D0D0;
}

p {
margin: 12px 15px 12px 15px;
}
</style>
</head>
<body>
<div id="container">
<h1><?php echo $heading; ?></h1>
<?php echo $message; ?>
</div>
</body>
</html>

+ 33
- 0
application/views/errors/html/error_php.php View File

@@ -0,0 +1,33 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>

<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

<h4>A PHP Error was encountered</h4>

<p>Severity: <?php echo $severity; ?></p>
<p>Message: <?php echo $message; ?></p>
<p>Filename: <?php echo $filepath; ?></p>
<p>Line Number: <?php echo $line; ?></p>

<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>

<p>Backtrace:</p>
<?php foreach (debug_backtrace() as $error): ?>

<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>

<p style="margin-left:10px">
File: <?php echo $error['file'] ?><br />
Line: <?php echo $error['line'] ?><br />
Function: <?php echo $error['function'] ?>
</p>

<?php endif ?>

<?php endforeach ?>

<?php endif ?>

</div>

+ 1
- 1
application/views/login/login.php View File

@@ -18,7 +18,7 @@
</ul>
<p>If it sounds interesting, or useful, sign up and try it out.</p>
<p><strong>Want to try it without creating an account? Login with username: <em>guest</em> and password: <em>guest</em></strong></p>
<p>It's nice to have feedback. Send suggestions/comments/criticism to <a href="mailto:tim@timshomepage.net?subject=Tim's Todo Feedback">tim (at) timshomepage.net</a> or <a href="http://twitter.com/timw4mail">@timw4mail</a> on Twitter.</p>
<p>It's nice to have feedback. Send suggestions/comments/criticism to <a href="mailto:tim@timshomepage.net?subject=Tim's Todo Feedback">tim (at) timshomepage.net</a>.</p>
</section>
<section class="right">
<?= form_open('login') ?>


+ 1
- 1
application/views/task/list.php View File

@@ -46,7 +46,7 @@
<?= $this->pagination->create_links(); ?>
</section>
<?php endif ?>
<?php elseif(count($task_list) < 1): ?>
<?php elseif(empty($task_list)): ?>
<h1><?= $list_type ?> Tasks</h1>
<p>You currently have no <?= $list_type ?> tasks.</p>
<?php endif; ?>

+ 1
- 1
composer.json View File

@@ -9,7 +9,7 @@
"role": "Developer"
}],
"require": {
"php": ">=5.4",
"php": ">=7.0",
"robmorgan/phinx": "*",
"ircmaxell/password-compat": "1.0.*"
}

+ 49
- 0
migrations/20190220154203_recreate_session_db_table.php View File

@@ -0,0 +1,49 @@
<?php

use Phinx\Migration\AbstractMigration;

class RecreateSessionDbTable extends AbstractMigration
{
/**
* Change Method.
*
* More information on this method is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-change-method
*
* Uncomment this method if you would like to use it.
*/
public function change()
{
// Session storage table
if ($this->hasTable('todo_ci_sessions'))
{
$this->table('todo_ci_sessions')->drop();

$this->table('todo_ci_sessions', [
'id' => FALSE,
'primary_key' => 'id'
])->addColumn('id' , 'string', ['limit' => 128, 'null' => FALSE])
->addColumn('ip_address', 'string', ['limit' => 45, 'null' => FALSE])
->addColumn('timestamp', 'integer', ['default' => 0, 'null' => FALSE])
->addColumn('data', 'text', ['default' => '', 'null' => FALSE])
->create();
}
}


/**
* Migrate Up.
*/
public function up()
{

}

/**
* Migrate Down.
*/
public function down()
{

}
}

+ 33
- 0
phinx.yml View File

@@ -0,0 +1,33 @@
paths:
migrations: %%PHINX_CONFIG_DIR%%/migrations

environments:
default_migration_table: phinxlog
default_database: development

development:
adapter: pgsql
host: localhost
name: todo
user: todo
pass: todo
port: 5432
charset: utf8

testing:
adapter: pgsql
host: localhost
name: todo_test
user: todo_test
pass: test
port: 5432
charset: utf8

node:
adapter: mysql
host: localhost
name: node
user: node
pass: node
port: 3306
charset: utf8

+ 6
- 1
system/.htaccess View File

@@ -1 +1,6 @@
Deny from all
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>

+ 60
- 45
system/core/Benchmark.php View File

@@ -1,61 +1,82 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
<?php
/**
* CodeIgniter
*
* An open source application development framework for PHP 5.1.6 or newer
* An open source application development framework for PHP
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
* This content is released under the MIT License (MIT)
*
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
* @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
*/

// ------------------------------------------------------------------------
defined('BASEPATH') OR exit('No direct script access allowed');

/**
* CodeIgniter Benchmark Class
* Benchmark Class
*
* This class enables you to mark points and calculate the time difference
* between them. Memory consumption can also be displayed.
* between them. Memory consumption can also be displayed.
*
* @package CodeIgniter
* @subpackage Libraries
* @category Libraries
* @author ExpressionEngine Dev Team
* @link http://codeigniter.com/user_guide/libraries/benchmark.html
* @author EllisLab Dev Team
* @link https://codeigniter.com/user_guide/libraries/benchmark.html
*/
class CI_Benchmark {

/**
* List of all benchmark markers and when they were added
* List of all benchmark markers
*
* @var array
* @var array
*/
var $marker = array();

// --------------------------------------------------------------------
public $marker = array();

/**
* Set a benchmark marker
*
* Multiple calls to this function can be made so that several
* execution points can be timed
* execution points can be timed.
*
* @access public
* @param string $name name of the marker
* @param string $name Marker name
* @return void
*/
function mark($name)
public function mark($name)
{
$this->marker[$name] = microtime();
$this->marker[$name] = microtime(TRUE);
}

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

/**
* Elapsed time
*
* Calculates the time difference between two marked points.
*
* If the first parameter is empty this function instead returns the
@@ -63,15 +84,17 @@ class CI_Benchmark {
* execution time to be shown in a template. The output class will
* swap the real value for this variable.
*
* @access public
* @param string a particular marked point
* @param string a particular marked point
* @param integer the number of decimal places
* @return mixed
* @param string $point1 A particular marked point
* @param string $point2 A particular marked point
* @param int $decimals Number of decimal places
*
* @return string Calculated elapsed time on success,
* an '{elapsed_string}' if $point1 is empty
* or an empty string if $point1 is not found.
*/
function elapsed_time($point1 = '', $point2 = '', $decimals = 4)
public function elapsed_time($point1 = '', $point2 = '', $decimals = 4)
{
if ($point1 == '')
if ($point1 === '')
{
return '{elapsed_time}';
}
@@ -83,13 +106,10 @@ class CI_Benchmark {

if ( ! isset($this->marker[$point2]))
{
$this->marker[$point2] = microtime();
$this->marker[$point2] = microtime(TRUE);
}

list($sm, $ss) = explode(' ', $this->marker[$point1]);
list($em, $es) = explode(' ', $this->marker[$point2]);

return number_format(($em + $es) - ($sm + $ss), $decimals);
return number_format($this->marker[$point2] - $this->marker[$point1], $decimals);
}

// --------------------------------------------------------------------
@@ -97,22 +117,17 @@ class CI_Benchmark {
/**
* Memory Usage
*
* This function returns the {memory_usage} pseudo-variable.
* Simply returns the {memory_usage} marker.
*
* This permits it to be put it anywhere in a template
* without the memory being calculated until the end.
* The output class will swap the real value for this variable.
*
* @access public
* @return string
* @return string '{memory_usage}'
*/
function memory_usage()
public function memory_usage()
{
return '{memory_usage}';
}

}

// END CI_Benchmark class

/* End of file Benchmark.php */
/* Location: ./system/core/Benchmark.php */

+ 312
- 155
system/core/CodeIgniter.php View File

@@ -1,19 +1,41 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
<?php
/**
* CodeIgniter
*
* An open source application development framework for PHP 5.1.6 or newer
* An open source application development framework for PHP
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
* This content is released under the MIT License (MIT)
*
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
* @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
*/

// ------------------------------------------------------------------------
defined('BASEPATH') OR exit('No direct script access allowed');

/**
* System Initialization File
@@ -21,60 +43,101 @@
* Loads the base classes and executes the request.
*
* @package CodeIgniter
* @subpackage codeigniter
* @subpackage CodeIgniter
* @category Front-controller
* @author ExpressionEngine Dev Team
* @link http://codeigniter.com/user_guide/
* @author EllisLab Dev Team
* @link https://codeigniter.com/user_guide/
*/

/**
* CodeIgniter Version
*
* @var string
* @var string
*
*/
define('CI_VERSION', '2.2.0');
const CI_VERSION = '3.1.10';

/**
* CodeIgniter Branch (Core = TRUE, Reactor = FALSE)
*
* @var boolean
*
/*
* ------------------------------------------------------
* Load the framework constants
* ------------------------------------------------------
*/
define('CI_CORE', FALSE);
if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants.php'))
{
require_once(APPPATH.'config/'.ENVIRONMENT.'/constants.php');
}

if (file_exists(APPPATH.'config/constants.php'))
{
require_once(APPPATH.'config/constants.php');
}

/*
* ------------------------------------------------------
* Load the global functions
* ------------------------------------------------------
*/
require(BASEPATH.'core/Common.php');
require_once(BASEPATH.'core/Common.php');


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

if ( ! is_php('5.4'))
{
ini_set('magic_quotes_runtime', 0);

if ((bool) ini_get('register_globals'))
{
require(APPPATH.'config/constants.php');
$_protected = array(
'_SERVER',
'_GET',
'_POST',
'_FILES',
'_REQUEST',
'_SESSION',
'_ENV',
'_COOKIE',
'GLOBALS',
'HTTP_RAW_POST_DATA',
'system_path',
'application_folder',
'view_folder',
'_protected',
'_registered'
);

$_registered = ini_get('variables_order');
foreach (array('E' => '_ENV', 'G' => '_GET', 'P' => '_POST', 'C' => '_COOKIE', 'S' => '_SERVER') as $key => $superglobal)
{
if (strpos($_registered, $key) === FALSE)
{
continue;
}

foreach (array_keys($$superglobal) as $var)
{
if (isset($GLOBALS[$var]) && ! in_array($var, $_protected, TRUE))
{
$GLOBALS[$var] = NULL;
}
}
}
}
}


/*
* ------------------------------------------------------
* Define a custom error handler so we can log PHP errors
* ------------------------------------------------------
*/
set_error_handler('_exception_handler');

if ( ! is_php('5.3'))
{
@set_magic_quotes_runtime(0); // Kill magic quotes
}
set_error_handler('_error_handler');
set_exception_handler('_exception_handler');
register_shutdown_function('_shutdown_handler');

/*
* ------------------------------------------------------
@@ -85,26 +148,39 @@
* 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,
* overridden 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,
* 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
* hurt to load it here.
*/
if (isset($assign_to_config['subclass_prefix']) AND $assign_to_config['subclass_prefix'] != '')
if ( ! empty($assign_to_config['subclass_prefix']))
{
get_config(array('subclass_prefix' => $assign_to_config['subclass_prefix']));
}

/*
* ------------------------------------------------------
* Set a liberal script execution time limit
* Should we use a Composer autoloader?
* ------------------------------------------------------
*/
if (function_exists("set_time_limit") == TRUE AND @ini_get("safe_mode") == 0)
if ($composer_autoload = config_item('composer_autoload'))
{
@set_time_limit(300);
if ($composer_autoload === TRUE)
{
file_exists(APPPATH.'vendor/autoload.php')
? require_once(APPPATH.'vendor/autoload.php')
: log_message('error', '$config[\'composer_autoload\'] is set to TRUE but '.APPPATH.'vendor/autoload.php was not found.');
}
elseif (file_exists($composer_autoload))
{
require_once($composer_autoload);
}
else
{
log_message('error', 'Could not find the specified $config[\'composer_autoload\'] path: '.$composer_autoload);
}
}

/*
@@ -128,33 +204,96 @@
* Is there a "pre_system" hook?
* ------------------------------------------------------
*/
$EXT->_call_hook('pre_system');
$EXT->call_hook('pre_system');

/*
* ------------------------------------------------------
* Instantiate the config class
* ------------------------------------------------------
*
* Note: It is important that Config is loaded first as
* most other classes depend on it either directly or by
* depending on another class that uses it.
*
*/
$CFG =& load_class('Config', 'core');

// Do we have any manually set config items in the index.php file?
if (isset($assign_to_config))
if (isset($assign_to_config) && is_array($assign_to_config))
{
$CFG->_assign_to_config($assign_to_config);
foreach ($assign_to_config as $key => $value)
{
$CFG->set_item($key, $value);
}
}

/*
* ------------------------------------------------------
* Instantiate the UTF-8 class
* Important charset-related stuff
* ------------------------------------------------------
*
* Note: Order here is rather important as the UTF-8
* class needs to be used very early on, but it cannot
* properly determine if UTf-8 can be supported until
* after the Config class is instantiated.
* Configure mbstring and/or iconv if they are enabled
* and set MB_ENABLED and ICONV_ENABLED constants, so
* that we don't repeatedly do extension_loaded() or
* function_exists() calls.
*
* Note: UTF-8 class depends on this. It used to be done
* in it's constructor, but it's _not_ class-specific.
*
*/
$charset = strtoupper(config_item('charset'));
ini_set('default_charset', $charset);

if (extension_loaded('mbstring'))
{
define('MB_ENABLED', TRUE);
// mbstring.internal_encoding is deprecated starting with PHP 5.6
// and it's usage triggers E_DEPRECATED messages.
@ini_set('mbstring.internal_encoding', $charset);
// This is required for mb_convert_encoding() to strip invalid characters.
// That's utilized by CI_Utf8, but it's also done for consistency with iconv.
mb_substitute_character('none');
}
else
{
define('MB_ENABLED', FALSE);
}

// There's an ICONV_IMPL constant, but the PHP manual says that using
// iconv's predefined constants is "strongly discouraged".
if (extension_loaded('iconv'))
{
define('ICONV_ENABLED', TRUE);
// iconv.internal_encoding is deprecated starting with PHP 5.6
// and it's usage triggers E_DEPRECATED messages.
@ini_set('iconv.internal_encoding', $charset);
}
else
{
define('ICONV_ENABLED', FALSE);
}

if (is_php('5.6'))
{
ini_set('php.internal_encoding', $charset);
}

/*
* ------------------------------------------------------
* Load compatibility features
* ------------------------------------------------------
*/

require_once(BASEPATH.'core/compat/mbstring.php');
require_once(BASEPATH.'core/compat/hash.php');
require_once(BASEPATH.'core/compat/password.php');
require_once(BASEPATH.'core/compat/standard.php');

/*
* ------------------------------------------------------
* Instantiate the UTF-8 class
* ------------------------------------------------------
*/
$UNI =& load_class('Utf8', 'core');

/*
@@ -169,14 +308,7 @@
* 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))
{
$RTR->_set_overrides($routing);
}
$RTR =& load_class('Router', 'core', isset($routing) ? $routing : NULL);

/*
* ------------------------------------------------------
@@ -187,15 +319,12 @@

/*
* ------------------------------------------------------
* Is there a valid cache file? If so, we're done...
* Is there a valid cache file? If so, we're done...
* ------------------------------------------------------
*/
if ($EXT->_call_hook('cache_override') === FALSE)
if ($EXT->call_hook('cache_override') === FALSE && $OUT->_display_cache($CFG, $URI) === TRUE)
{
if ($OUT->_display_cache($CFG, $URI) == TRUE)
{
exit;
}
exit;
}

/*
@@ -226,76 +355,157 @@
*
*/
// Load the base controller class
require BASEPATH.'core/Controller.php';

require_once BASEPATH.'core/Controller.php';

/**
* Reference to the CI_Controller method.
*
* Returns current CI instance object
*
* @return CI_Controller
*/
function &get_instance()
{
return CI_Controller::get_instance();
}


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

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

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

// Set a mark point for benchmarking
$BM->mark('loading_time:_base_classes_end');

/*
* ------------------------------------------------------
* Security check
* Sanity checks
* ------------------------------------------------------
*
* None of the functions in the app controller or the
* loader class can be called via the URI, nor can
* controller functions that begin with an underscore
* The Router class has already validated the request,
* leaving us with 3 options here:
*
* 1) an empty class name, if we reached the default
* controller, but it didn't exist;
* 2) a query string which doesn't go through a
* file_exists() check
* 3) a regular request for a non-existing page
*
* We handle all of these as a 404 error.
*
* Furthermore, none of the methods in the app controller
* or the loader class can be called via the URI, nor can
* controller methods that begin with an underscore.
*/
$class = $RTR->fetch_class();
$method = $RTR->fetch_method();

if ( ! class_exists($class)
OR strncmp($method, '_', 1) == 0
OR in_array(strtolower($method), array_map('strtolower', get_class_methods('CI_Controller')))
)
$e404 = FALSE;
$class = ucfirst($RTR->class);
$method = $RTR->method;

if (empty($class) OR ! file_exists(APPPATH.'controllers/'.$RTR->directory.$class.'.php'))
{
$e404 = TRUE;
}
else
{
require_once(APPPATH.'controllers/'.$RTR->directory.$class.'.php');

if ( ! class_exists($class, FALSE) OR $method[0] === '_' OR method_exists('CI_Controller', $method))
{
$e404 = TRUE;
}
elseif (method_exists($class, '_remap'))
{
$params = array($method, array_slice($URI->rsegments, 2));
$method = '_remap';
}
elseif ( ! method_exists($class, $method))
{
$e404 = TRUE;
}
/**
* DO NOT CHANGE THIS, NOTHING ELSE WORKS!
*
* - method_exists() returns true for non-public methods, which passes the previous elseif
* - is_callable() returns false for PHP 4-style constructors, even if there's a __construct()
* - method_exists($class, '__construct') won't work because CI_Controller::__construct() is inherited
* - People will only complain if this doesn't work, even though it is documented that it shouldn't.
*
* ReflectionMethod::isConstructor() is the ONLY reliable check,
* knowing which method will be executed as a constructor.
*/
elseif ( ! is_callable(array($class, $method)))
{
$reflection = new ReflectionMethod($class, $method);
if ( ! $reflection->isPublic() OR $reflection->isConstructor())
{
$e404 = TRUE;
}
}
}

if ($e404)
{
if ( ! empty($RTR->routes['404_override']))
{
$x = explode('/', $RTR->routes['404_override']);
$class = $x[0];
$method = (isset($x[1]) ? $x[1] : 'index');
if ( ! class_exists($class))
if (sscanf($RTR->routes['404_override'], '%[^/]/%s', $error_class, $error_method) !== 2)
{
$error_method = 'index';
}

$error_class = ucfirst($error_class);

if ( ! class_exists($error_class, FALSE))
{
if ( ! file_exists(APPPATH.'controllers/'.$class.'.php'))
if (file_exists(APPPATH.'controllers/'.$RTR->directory.$error_class.'.php'))
{
show_404("{$class}/{$method}");
require_once(APPPATH.'controllers/'.$RTR->directory.$error_class.'.php');
$e404 = ! class_exists($error_class, FALSE);
}
// Were we in a directory? If so, check for a global override
elseif ( ! empty($RTR->directory) && file_exists(APPPATH.'controllers/'.$error_class.'.php'))
{
require_once(APPPATH.'controllers/'.$error_class.'.php');
if (($e404 = ! class_exists($error_class, FALSE)) === FALSE)
{
$RTR->directory = '';
}
}

include_once(APPPATH.'controllers/'.$class.'.php');
}
else
{
$e404 = FALSE;
}
}

// Did we reset the $e404 flag? If so, set the rsegments, starting from index 1
if ( ! $e404)
{
$class = $error_class;
$method = $error_method;

$URI->rsegments = array(
1 => $class,
2 => $method
);
}
else
{
show_404("{$class}/{$method}");
show_404($RTR->directory.$class.'/'.$method);
}
}

if ($method !== '_remap')
{
$params = array_slice($URI->rsegments, 2);
}

/*
* ------------------------------------------------------
* Is there a "pre_controller" hook?
* ------------------------------------------------------
*/
$EXT->_call_hook('pre_controller');
$EXT->call_hook('pre_controller');

/*
* ------------------------------------------------------
@@ -312,53 +522,14 @@
* Is there a "post_controller_constructor" hook?
* ------------------------------------------------------
*/
$EXT->_call_hook('post_controller_constructor');
$EXT->call_hook('post_controller_constructor');

/*
* ------------------------------------------------------
* Call the requested method
* ------------------------------------------------------
*/
// Is there a "remap" function? If so, we call it instead
if (method_exists($CI, '_remap'))
{
$CI->_remap($method, array_slice($URI->rsegments, 2));
}
else
{
// is_callable() returns TRUE on some versions of PHP 5 for private and protected
// methods, so we'll use this workaround for consistent behavior
if ( ! in_array(strtolower($method), array_map('strtolower', get_class_methods($CI))))
{
// Check and see if we are using a 404 override and use it.
if ( ! empty($RTR->routes['404_override']))
{
$x = explode('/', $RTR->routes['404_override']);
$class = $x[0];
$method = (isset($x[1]) ? $x[1] : 'index');
if ( ! class_exists($class))
{
if ( ! file_exists(APPPATH.'controllers/'.$class.'.php'))
{
show_404("{$class}/{$method}");
}

include_once(APPPATH.'controllers/'.$class.'.php');
unset($CI);
$CI = new $class();
}
}
else
{
show_404("{$class}/{$method}");
}
}

// Call the requested method.
// Any URI segments present (besides the class/function) will be passed to the method for convenience
call_user_func_array(array(&$CI, $method), array_slice($URI->rsegments, 2));
}

call_user_func_array(array(&$CI, $method), $params);

// Mark a benchmark end point
$BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_end');
@@ -368,14 +539,14 @@
* Is there a "post_controller" hook?
* ------------------------------------------------------
*/
$EXT->_call_hook('post_controller');
$EXT->call_hook('post_controller');

/*
* ------------------------------------------------------
* Send the final rendered output to the browser
* ------------------------------------------------------
*/
if ($EXT->_call_hook('display_override') === FALSE)
if ($EXT->call_hook('display_override') === FALSE)
{
$OUT->_display();
}
@@ -385,18 +556,4 @@
* Is there a "post_system" hook?
* ------------------------------------------------------
*/
$EXT->_call_hook('post_system');

/*
* ------------------------------------------------------
* Close the DB connection if one exists
* ------------------------------------------------------
*/
if (class_exists('CI_DB') AND isset($CI->db))
{
$CI->db->close();
}


/* End of file CodeIgniter.php */
/* Location: ./system/core/CodeIgniter.php */
$EXT->call_hook('post_system');

+ 577
- 292
system/core/Common.php
File diff suppressed because it is too large
View File


+ 201
- 201
system/core/Config.php View File

@@ -1,78 +1,107 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
<?php
/**
* CodeIgniter
*
* An open source application development framework for PHP 5.1.6 or newer
* An open source application development framework for PHP
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
* This content is released under the MIT License (MIT)
*
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
* @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
*/

// ------------------------------------------------------------------------
defined('BASEPATH') OR exit('No direct script access allowed');

/**
* CodeIgniter Config Class
* Config Class
*
* This class contains functions that enable config files to be managed
*
* @package CodeIgniter
* @subpackage Libraries
* @category Libraries
* @author ExpressionEngine Dev Team
* @link http://codeigniter.com/user_guide/libraries/config.html
* @author EllisLab Dev Team
* @link https://codeigniter.com/user_guide/libraries/config.html
*/
class CI_Config {

/**
* List of all loaded config values
*
* @var array
* @var array
*/
var $config = array();
public $config = array();

/**
* List of all loaded config files
*
* @var array
* @var array
*/
var $is_loaded = array();
public $is_loaded = array();

/**
* List of paths to search when trying to load a config file
* List of paths to search when trying to load a config file.
*
* @var array
* @used-by CI_Loader
* @var array
*/
var $_config_paths = array(APPPATH);
public $_config_paths = array(APPPATH);

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

/**
* Constructor
* Class constructor
*
* Sets the $config data from the primary config.php file as a class variable
* Sets the $config data from the primary config.php file as a class variable.
*
* @access public
* @param string the config file name
* @param boolean if configuration values should be loaded into their own section
* @param boolean true if errors should just return false, false if an error message should be displayed
* @return boolean if the file was successfully loaded or not
* @return void
*/
function __construct()
public function __construct()
{
$this->config = get_config();
log_message('debug', "Config Class Initialized");
$this->config =& get_config();

// Set the base_url automatically if none was provided
if ($this->config['base_url'] == '')
if (empty($this->config['base_url']))
{
if (isset($_SERVER['HTTP_HOST']))
if (isset($_SERVER['SERVER_ADDR']))
{
$base_url = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off' ? 'https' : 'http';
$base_url .= '://'. $_SERVER['HTTP_HOST'];
$base_url .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
}
if (strpos($_SERVER['SERVER_ADDR'], ':') !== FALSE)
{
$server_addr = '['.$_SERVER['SERVER_ADDR'].']';
}
else
{
$server_addr = $_SERVER['SERVER_ADDR'];
}

$base_url = (is_https() ? 'https' : 'http').'://'.$server_addr
.substr($_SERVER['SCRIPT_NAME'], 0, strpos($_SERVER['SCRIPT_NAME'], basename($_SERVER['SCRIPT_FILENAME'])));
}
else
{
$base_url = 'http://localhost/';
@@ -80,6 +109,8 @@ class CI_Config {

$this->set_item('base_url', $base_url);
}

log_message('info', 'Config Class Initialized');
}

// --------------------------------------------------------------------
@@ -87,91 +118,71 @@ class CI_Config {
/**
* Load Config File
*
* @access public
* @param string the config file name
* @param boolean if configuration values should be loaded into their own section
* @param boolean true if errors should just return false, false if an error message should be displayed
* @return boolean if the file was loaded correctly
* @param string $file Configuration file name
* @param bool $use_sections Whether configuration values should be loaded into their own section
* @param bool $fail_gracefully Whether to just return FALSE or display an error message
* @return bool TRUE if the file was loaded correctly or FALSE on failure
*/
function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
public function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
{
$file = ($file == '') ? 'config' : str_replace('.php', '', $file);
$found = FALSE;
$file = ($file === '') ? 'config' : str_replace('.php', '', $file);
$loaded = FALSE;

$check_locations = defined('ENVIRONMENT')
? array(ENVIRONMENT.'/'.$file, $file)
: array($file);

foreach ($this->_config_paths as $path)
{
foreach ($check_locations as $location)
foreach (array($file, ENVIRONMENT.DIRECTORY_SEPARATOR.$file) as $location)
{
$file_path = $path.'config/'.$location.'.php';

if (in_array($file_path, $this->is_loaded, TRUE))
{
$loaded = TRUE;
continue 2;
return TRUE;
}

if (file_exists($file_path))
if ( ! file_exists($file_path))
{
$found = TRUE;
break;
continue;
}
}

if ($found === FALSE)
{
continue;
}

include($file_path);
include($file_path);

if ( ! isset($config) OR ! is_array($config))
{
if ($fail_gracefully === TRUE)
if ( ! isset($config) OR ! is_array($config))
{
return FALSE;
if ($fail_gracefully === TRUE)
{
return FALSE;
}

show_error('Your '.$file_path.' file does not appear to contain a valid configuration array.');
}
show_error('Your '.$file_path.' file does not appear to contain a valid configuration array.');
}

if ($use_sections === TRUE)
{
if (isset($this->config[$file]))
if ($use_sections === TRUE)
{
$this->config[$file] = array_merge($this->config[$file], $config);
$this->config[$file] = isset($this->config[$file])
? array_merge($this->config[$file], $config)
: $config;
}
else
{
$this->config[$file] = $config;
$this->config = array_merge($this->config, $config);
}
}
else
{
$this->config = array_merge($this->config, $config);
}

$this->is_loaded[] = $file_path;
unset($config);

$loaded = TRUE;
log_message('debug', 'Config file loaded: '.$file_path);
break;
$this->is_loaded[] = $file_path;
$config = NULL;
$loaded = TRUE;
log_message('debug', 'Config file loaded: '.$file_path);
}
}

if ($loaded === FALSE)
if ($loaded === TRUE)
{
if ($fail_gracefully === TRUE)
{
return FALSE;
}
show_error('The configuration file '.$file.'.php does not exist.');
return TRUE;
}
elseif ($fail_gracefully === TRUE)
{
return FALSE;
}

return TRUE;
show_error('The configuration file '.$file.'.php does not exist.');
}

// --------------------------------------------------------------------
@@ -179,59 +190,35 @@ class CI_Config {
/**
* Fetch a config file item
*
*
* @access public
* @param string the config item name
* @param string the index name
* @param bool
* @return string
* @param string $item Config item name
* @param string $index Index name
* @return string|null The configuration item or NULL if the item doesn't exist
*/
function item($item, $index = '')
public function item($item, $index = '')
{
if ($index == '')
{
if ( ! isset($this->config[$item]))
{
return FALSE;
}

$pref = $this->config[$item];
}
else
{
if ( ! isset($this->config[$index]))
{
return FALSE;
}

if ( ! isset($this->config[$index][$item]))
{
return FALSE;
}

$pref = $this->config[$index][$item];
return isset($this->config[$item]) ? $this->config[$item] : NULL;
}

return $pref;
return isset($this->config[$index], $this->config[$index][$item]) ? $this->config[$index][$item] : NULL;
}

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

/**
* Fetch a config file item - adds slash after item (if item is not empty)
* Fetch a config file item with slash appended (if not empty)
*
* @access public
* @param string the config item name
* @param bool
* @return string
* @param string $item Config item name
* @return string|null The configuration item or NULL if the item doesn't exist
*/
function slash_item($item)
public function slash_item($item)
{
if ( ! isset($this->config[$item]))
{
return FALSE;
return NULL;
}
if( trim($this->config[$item]) == '')
elseif (trim($this->config[$item]) === '')
{
return '';
}
@@ -243,80 +230,122 @@ class CI_Config {

/**
* Site URL
*
* Returns base_url . index_page [. uri_string]
*
* @access public
* @param string the URI string
* @uses CI_Config::_uri_string()
*
* @param string|string[] $uri URI string or an array of segments
* @param string $protocol
* @return string