summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--application/config/config.php37
-rw-r--r--application/config/routes.php9
-rw-r--r--system/core/Config.php45
-rw-r--r--system/core/Lang.php18
-rw-r--r--system/core/Loader.php35
-rw-r--r--system/core/Router.php14
-rw-r--r--system/libraries/Table.php2
-rw-r--r--user_guide/changelog.html4
8 files changed, 92 insertions, 72 deletions
diff --git a/application/config/config.php b/application/config/config.php
index 2a084ac22..251f1aa3f 100644
--- a/application/config/config.php
+++ b/application/config/config.php
@@ -10,8 +10,11 @@
|
| http://example.com/
|
+| If this is not set then CodeIgniter will guess the protocol, domain and
+| path to your installation.
+|
*/
-$config['base_url'] = "http://example.com/";
+$config['base_url'] = '';
/*
|--------------------------------------------------------------------------
@@ -23,7 +26,7 @@ $config['base_url'] = "http://example.com/";
| variable so that it is blank.
|
*/
-$config['index_page'] = "index.php";
+$config['index_page'] = 'index.php';
/*
|--------------------------------------------------------------------------
@@ -31,7 +34,7 @@ $config['index_page'] = "index.php";
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
-| URI string. The default setting of "AUTO" works for most servers.
+| URI string. The default setting of 'AUTO' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'AUTO' Default - auto detects
@@ -41,7 +44,7 @@ $config['index_page'] = "index.php";
| 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO
|
*/
-$config['uri_protocol'] = "AUTO";
+$config['uri_protocol'] = 'AUTO';
/*
|--------------------------------------------------------------------------
@@ -54,7 +57,7 @@ $config['uri_protocol'] = "AUTO";
| http://codeigniter.com/user_guide/general/urls.html
*/
-$config['url_suffix'] = "";
+$config['url_suffix'] = '';
/*
|--------------------------------------------------------------------------
@@ -66,7 +69,7 @@ $config['url_suffix'] = "";
| than english.
|
*/
-$config['language'] = "english";
+$config['language'] = 'english';
/*
|--------------------------------------------------------------------------
@@ -77,14 +80,14 @@ $config['language'] = "english";
| that require a character set to be provided.
|
*/
-$config['charset'] = "UTF-8";
+$config['charset'] = 'UTF-8';
/*
|--------------------------------------------------------------------------
| Enable/Disable System Hooks
|--------------------------------------------------------------------------
|
-| If you would like to use the "hooks" feature you must enable it by
+| If you would like to use the 'hooks' feature you must enable it by
| setting this variable to TRUE (boolean). See the user guide for details.
|
*/
@@ -139,7 +142,7 @@ $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
|
| Options are: TRUE or FALSE (boolean)
|
-| The other items let you set the query string "words" that will
+| The other items let you set the query string 'words' that will
| invoke your controllers and its functions:
| example.com/index.php?c=controller&m=function
|
@@ -217,7 +220,7 @@ $config['cache_path'] = '';
| MUST set an encryption key. See the user guide for info.
|
*/
-$config['encryption_key'] = "";
+$config['encryption_key'] = '';
/*
|--------------------------------------------------------------------------
@@ -257,9 +260,9 @@ $config['sess_time_to_update'] = 300;
| 'cookie_path' = Typically will be a forward slash
|
*/
-$config['cookie_prefix'] = "";
-$config['cookie_domain'] = "";
-$config['cookie_path'] = "/";
+$config['cookie_prefix'] = '';
+$config['cookie_domain'] = '';
+$config['cookie_path'] = '/';
/*
|--------------------------------------------------------------------------
@@ -297,7 +300,7 @@ $config['csrf_protection'] = FALSE;
| 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'] = FALSE;
@@ -307,9 +310,9 @@ $config['compress_output'] = FALSE;
| Master Time Reference
|--------------------------------------------------------------------------
|
-| Options are "local" or "gmt". This pref tells the system whether to use
-| your server's local time as the master "now" reference, or convert it to
-| GMT. See the "date helper" page of the user guide for information
+| Options are 'local' or 'gmt'. This pref tells the system whether to use
+| your server's local time as the master 'now' reference, or convert it to
+| GMT. See the 'date helper' page of the user guide for information
| regarding date handling.
|
*/
diff --git a/application/config/routes.php b/application/config/routes.php
index 614462fd9..5f9a58343 100644
--- a/application/config/routes.php
+++ b/application/config/routes.php
@@ -23,16 +23,23 @@
| RESERVED ROUTES
| -------------------------------------------------------------------------
|
-| There is one reserved routes:
+| There area two reserved routes:
|
| $route['default_controller'] = 'welcome';
|
| This route indicates which controller class should be loaded if the
| URI contains no data. In the above example, the "welcome" class
| would be loaded.
+|
+| $route['404_override'] = 'errors/page_missing';
+|
+| This route will tell the Router what URI segments to use if those provided
+| in the URL cannot be matched to a valid route.
+|
*/
$route['default_controller'] = "welcome";
+$route['404_override'] = '';
/* End of file routes.php */
diff --git a/system/core/Config.php b/system/core/Config.php
index bdd1b8333..8ecfba73a 100644
--- a/system/core/Config.php
+++ b/system/core/Config.php
@@ -47,6 +47,24 @@ class CI_Config {
{
$this->config =& get_config();
log_message('debug', "Config Class Initialized");
+
+ // Set the base_url automatically if none was provided
+ if ($this->config['base_url'] == '')
+ {
+ if(isset($_SERVER['HTTP_HOST']))
+ {
+ $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']);
+ }
+
+ else
+ {
+ $base_url = 'http://localhost/';
+ }
+
+ $this->set_item('base_url', $base_url);
+ }
}
// --------------------------------------------------------------------
@@ -185,14 +203,7 @@ class CI_Config {
return FALSE;
}
- $pref = $this->config[$item];
-
- if ($pref != '' && substr($pref, -1) != '/')
- {
- $pref .= '/';
- }
-
- return $pref;
+ return rtrim($this->config[$item], '/').'/';
}
// --------------------------------------------------------------------
@@ -208,14 +219,7 @@ class CI_Config {
{
if ($uri == '')
{
- if ($this->item('base_url') == '')
- {
- return $this->item('index_page');
- }
- else
- {
- return $this->slash_item('base_url').$this->item('index_page');
- }
+ return $this->slash_item('base_url').$this->item('index_page');
}
if ($this->item('enable_query_strings') == FALSE)
@@ -244,14 +248,7 @@ class CI_Config {
$uri = $str;
}
- if ($this->item('base_url') == '')
- {
- return $this->item('index_page').'?'.$uri;
- }
- else
- {
- return $this->slash_item('base_url').$this->item('index_page').'?'.$uri;
- }
+ return $this->slash_item('base_url').$this->item('index_page').'?'.$uri;
}
}
diff --git a/system/core/Lang.php b/system/core/Lang.php
index e7867b354..8ec179771 100644
--- a/system/core/Lang.php
+++ b/system/core/Lang.php
@@ -78,17 +78,21 @@ class CI_Lang {
{
include($alt_path.'language/'.$idiom.'/'.$langfile);
}
- elseif (file_exists(APPPATH.'language/'.$idiom.'/'.$langfile))
- {
- include(APPPATH.'language/'.$idiom.'/'.$langfile);
- }
else
{
- if (file_exists(BASEPATH.'language/'.$idiom.'/'.$langfile))
+ $found = FALSE;
+
+ foreach (get_instance()->load->get_package_paths(TRUE) as $package_path)
{
- include(BASEPATH.'language/'.$idiom.'/'.$langfile);
+ if (file_exists($package_path.'language/'.$idiom.'/'.$langfile))
+ {
+ include($package_path.'language/'.$idiom.'/'.$langfile);
+ $found = TRUE;
+ break;
+ }
}
- else
+
+ if ($found !== TRUE)
{
show_error('Unable to load the requested language file: language/'.$idiom.'/'.$langfile);
}
diff --git a/system/core/Loader.php b/system/core/Loader.php
index afbae6175..136cae9bf 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -81,12 +81,12 @@ class CI_Loader {
{
foreach($library as $read)
{
- $this->library($read);
+ $this->library($read);
}
-
+
return;
}
-
+
if ($library == '' OR isset($this->_base_classes[$library]))
{
return FALSE;
@@ -527,7 +527,7 @@ class CI_Loader {
function add_package_path($path)
{
$path = rtrim($path, '/').'/';
-
+
array_unshift($this->_ci_library_paths, $path);
array_unshift($this->_ci_model_paths, $path);
array_unshift($this->_ci_helper_paths, $path);
@@ -540,6 +540,22 @@ class CI_Loader {
// --------------------------------------------------------------------
/**
+ * Get Package Paths
+ *
+ * Return a list of all package paths, by default it will ignore BASEPATH.
+ *
+ * @access public
+ * @param string
+ * @return void
+ */
+ function get_package_paths($include_base = FALSE)
+ {
+ return $include_base === TRUE ? $this->_ci_library_paths : $this->_ci_model_paths;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Remove Package Path
*
* Remove a path from the library, model, and helper path arrays if it exists
@@ -563,7 +579,7 @@ class CI_Loader {
else
{
$path = rtrim($path, '/').'/';
-
+
foreach (array('_ci_library_paths', '_ci_model_paths', '_ci_helper_paths') as $var)
{
if (($key = array_search($path, $this->{$var})) !== FALSE)
@@ -942,15 +958,6 @@ class CI_Loader {
return FALSE;
}
- // Autoload packages
- if (isset($autoload['packages']))
- {
- foreach ($autoload['packages'] as $package_path)
- {
- $this->add_package_path($package_path);
- }
- }
-
// Load any custom config file
if (count($autoload['config']) > 0)
{
diff --git a/system/core/Router.php b/system/core/Router.php
index 9276800c3..79a8b4fcc 100644
--- a/system/core/Router.php
+++ b/system/core/Router.php
@@ -270,19 +270,17 @@ class CI_Router {
// 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'] != '')
+ if (!empty($this->routes['404_override']))
{
- if (strpos($this->routes['404_override'], '/') !== FALSE)
- {
- $x = explode('/', $this->routes['404_override']);
+ $x = explode('/', $this->routes['404_override']);
- $this->set_class($x[0]);
- $this->set_method($x[1]);
+ $this->set_class($x[0]);
+ $this->set_method(isset($x[1]) ? $x[1] : 'index');
- return $x;
- }
+ return $x;
}
+
// Nothing else to do at this point but show a 404
show_404($segments[0]);
}
diff --git a/system/libraries/Table.php b/system/libraries/Table.php
index a57781c29..b4c6d366e 100644
--- a/system/libraries/Table.php
+++ b/system/libraries/Table.php
@@ -346,7 +346,7 @@ class CI_Table {
{
if ($function !== FALSE && is_callable($function))
{
- $out .= $function($cell);
+ $out .= call_user_func($function, $cell);
}
else
{
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index c3693e5f9..30734a835 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -76,6 +76,10 @@ Hg Tag: </p>
<li>In-development code is now hosted at <a href="http://bitbucket.org/ellislab/codeigniter/">BitBucket</a>.</li>
<li>Removed the deprecated Validation Class.</li>
<li>Added CI_ Prefix to all core classes.</li>
+ <li>Package paths can now be set in application/config/autoload.php.</li>
+ <li>Upload library file_name can now be set without an extension, the extension will be taken from the uploaded file instead of the given name.</li>
+ <li>Name can be omitted from $this->dbforge->modify_column()'s 2nd param if you aren't changing the name.</li>
+ <li><kbd>$config['base_url']</kbd> is now empty by default and will guess what it should be.</li>
</ul>
<li>Libraries
<ul>