Coding standard fixes. Routes: Error page override works now. Welcome controller: Return false where needed. Header-view: lnk-helper function to help highlight current page matching links. ecards-helper: lnk() and checkboxes(), needs commenting. new-view: values for javascript, Image name for dropdown. style.css: better colours, footer links not so prominent, helper classes, moved cursor: move from users without javascript. scripts.js: documentation.

This commit is contained in:
Ismo Vuorinen
2013-07-16 18:42:36 +03:00
parent 4bb689166d
commit adaca5b8b2
9 changed files with 211 additions and 115 deletions

144
index.php
View File

@@ -19,12 +19,16 @@
*
*/
$config_baselocation = dirname(__FILE__) . '/application/config/';
if( is_readable( $config_baselocation . 'development/_config.php' ) ) {
define('ENVIRONMENT', 'development');
} elseif( is_readable( $config_baselocation . 'production/_config.php' ) ) {
define('ENVIRONMENT', 'production');
} else {
die("No config found {$config_baselocation}/development/config.php nor {$config_baselocation}/production/config.php");
if (is_readable($config_baselocation . 'production/config.php')) {
define('ENVIRONMENT', 'production');
}
if (is_readable($config_baselocation . 'development/config.php') && ! defined('ENVIRONMENT')) {
define('ENVIRONMENT', 'development');
}
if (! defined('ENVIRONMENT')) {
die("No config found {$config_baselocation}/development/config.php "
."nor {$config_baselocation}/production/config.php");
}
/*
@@ -36,22 +40,19 @@ if( is_readable( $config_baselocation . 'development/_config.php' ) ) {
* By default development will show errors but testing and live will hide them.
*/
if (defined('ENVIRONMENT'))
{
switch (ENVIRONMENT)
{
case 'development':
error_reporting(E_ALL);
break;
case 'testing':
case 'production':
error_reporting(0);
break;
default:
exit('The application environment is not set correctly.');
}
if (defined('ENVIRONMENT')) {
switch (ENVIRONMENT)
{
case 'development':
error_reporting(E_ALL);
break;
case 'testing':
case 'production':
error_reporting(0);
break;
default:
exit('The application environment is not set correctly.');
}
}
/*
@@ -64,7 +65,7 @@ if (defined('ENVIRONMENT'))
* as this file.
*
*/
$system_path = 'system';
$system_path = 'system';
/*
*---------------------------------------------------------------
@@ -80,7 +81,7 @@ if (defined('ENVIRONMENT'))
* NO TRAILING SLASH!
*
*/
$application_folder = 'application';
$application_folder = 'application';
/*
* --------------------------------------------------------------------
@@ -102,15 +103,15 @@ if (defined('ENVIRONMENT'))
* 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
// $routing['directory'] = '';
// 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
// $routing['controller'] = '';
// The controller class file name. Example: Mycontroller
// $routing['controller'] = '';
// The controller function you wish to be called.
// $routing['function'] = '';
// The controller function you wish to be called.
// $routing['function'] = '';
/*
@@ -128,7 +129,7 @@ if (defined('ENVIRONMENT'))
* Un-comment the $assign_to_config array below to use this feature
*
*/
// $assign_to_config['name_of_config_item'] = 'value of config item';
// $assign_to_config['name_of_config_item'] = 'value of config item';
@@ -142,62 +143,59 @@ if (defined('ENVIRONMENT'))
* ---------------------------------------------------------------
*/
// Set the current directory correctly for CLI requests
if (defined('STDIN'))
{
chdir(dirname(__FILE__));
}
// Set the current directory correctly for CLI requests
if (defined('STDIN')) {
chdir(dirname(__FILE__));
}
if (realpath($system_path) !== FALSE)
{
$system_path = realpath($system_path).'/';
}
if (realpath($system_path) !== false) {
$system_path = realpath($system_path).'/';
}
// ensure there's a trailing slash
$system_path = rtrim($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));
}
// 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)
);
}
/*
* -------------------------------------------------------------------
* Now that we know the path, set the main path constants
* -------------------------------------------------------------------
*/
// The name of THIS file
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
// The name of THIS file
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
// The PHP file extension
// this global constant is deprecated.
define('EXT', '.php');
// The PHP file extension
// this global constant is deprecated.
define('EXT', '.php');
// Path to the system folder
define('BASEPATH', str_replace("\\", "/", $system_path));
// Path to the system folder
define('BASEPATH', str_replace("\\", "/", $system_path));
// Path to the front controller (this file)
define('FCPATH', str_replace(SELF, '', __FILE__));
// Path to the front controller (this file)
define('FCPATH', str_replace(SELF, '', __FILE__));
// Name of the "system folder"
define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/'));
// Name of the "system folder"
define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/'));
// The path to the "application" folder
if (is_dir($application_folder))
{
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);
}
// The path to the "application" folder
if (is_dir($application_folder)) {
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);
}
define('APPPATH', BASEPATH.$application_folder.'/');
}
define('APPPATH', BASEPATH.$application_folder.'/');
}
/*
* --------------------------------------------------------------------
@@ -210,4 +208,4 @@ if (defined('ENVIRONMENT'))
require_once BASEPATH.'core/CodeIgniter.php';
/* End of file index.php */
/* Location: ./index.php */
/* Location: ./index.php */