From 93a0375011772bbbc510b73129cf50b0004a4de6 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Tue, 3 Aug 2010 05:55:12 +0000 Subject: [PATCH] added a new option - 'index_page' added base_url_make() into codeigniter --- codepot/etc/codepot.ini.in | 8 +++++++ codepot/src/codepot/config/config.php | 4 ++-- codepot/src/codepot/config/routes.php | 1 + codepot/src/codepot/controllers/site.php | 1 - codepot/src/codepot/views/code_blame.php | 24 ++++++++++--------- codepot/src/codepot/views/code_diff.php | 18 +++++++------- codepot/src/codepot/views/code_file.php | 23 +++++++++--------- codepot/src/codepot/views/code_folder.php | 11 +++++---- codepot/src/codepot/views/code_history.php | 6 +++-- codepot/src/codepot/views/code_revision.php | 6 +++-- codepot/src/codepot/views/error.php | 4 ++-- codepot/src/codepot/views/file_delete.php | 6 +++-- codepot/src/codepot/views/file_edit.php | 6 +++-- codepot/src/codepot/views/file_home.php | 6 +++-- codepot/src/codepot/views/file_show.php | 8 ++++--- codepot/src/codepot/views/issue_delete.php | 6 +++-- codepot/src/codepot/views/issue_edit.php | 5 ++-- codepot/src/codepot/views/issue_home.php | 11 +++++---- codepot/src/codepot/views/issue_show.php | 13 +++++----- codepot/src/codepot/views/log.php | 11 +++++---- codepot/src/codepot/views/login.php | 2 +- codepot/src/codepot/views/project_catalog.php | 11 +++++---- codepot/src/codepot/views/project_delete.php | 6 +++-- codepot/src/codepot/views/project_edit.php | 6 +++-- codepot/src/codepot/views/project_home.php | 8 ++++--- codepot/src/codepot/views/site_catalog.php | 5 ++-- codepot/src/codepot/views/site_delete.php | 6 +++-- codepot/src/codepot/views/site_edit.php | 6 +++-- codepot/src/codepot/views/site_home.php | 13 +++++----- codepot/src/codepot/views/site_show.php | 9 ++++--- codepot/src/codepot/views/user_home.php | 13 ++++++---- codepot/src/codepot/views/user_settings.php | 11 +++++---- codepot/src/codepot/views/wiki_delete.php | 6 +++-- codepot/src/codepot/views/wiki_edit.php | 11 +++++---- codepot/src/codepot/views/wiki_home.php | 6 +++-- codepot/src/codepot/views/wiki_show.php | 9 ++++--- codepot/src/config.php.in | 1 + codepot/src/system/helpers/url_helper.php | 18 +++++++++++++- codepot/src/system/libraries/Router.php | 2 +- 39 files changed, 202 insertions(+), 125 deletions(-) diff --git a/codepot/etc/codepot.ini.in b/codepot/etc/codepot.ini.in index bfac2965..f1e500aa 100644 --- a/codepot/etc/codepot.ini.in +++ b/codepot/etc/codepot.ini.in @@ -40,6 +40,14 @@ ldap_admin_password = "" ;------------------------------------------------------------------------------ language = "auto" + +;------------------------------------------------------------------------------ +; Name of the index page. If you want to hide the index page name from +; the URL by rewriting it (e.g. mod_rewrite), you have to change this +; properly to match the rewriting rule +;------------------------------------------------------------------------------ +index_page = "index.php" + ;------------------------------------------------------------------------------ ; When set to yes, viewing pages require a user to sign in. ;------------------------------------------------------------------------------ diff --git a/codepot/src/codepot/config/config.php b/codepot/src/codepot/config/config.php index 0e786568..e38ab2d0 100644 --- a/codepot/src/codepot/config/config.php +++ b/codepot/src/codepot/config/config.php @@ -26,7 +26,7 @@ $config['base_url'] .= preg_replace('@/+$@','',dirname($_SERVER['SCRIPT_NAME'])) | variable so that it is blank. | */ -$config['index_page'] = "index.php"; +$config['index_page'] = CODEPOT_INDEX_PAGE; /* |-------------------------------------------------------------------------- @@ -126,7 +126,7 @@ $config['subclass_prefix'] = 'MY_'; | DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!! | */ -$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-'; +$config['permitted_uri_chars'] = 'a-z 0-9~%.:_@\-'; /* diff --git a/codepot/src/codepot/config/routes.php b/codepot/src/codepot/config/routes.php index c82aac08..18d401ba 100644 --- a/codepot/src/codepot/config/routes.php +++ b/codepot/src/codepot/config/routes.php @@ -43,6 +43,7 @@ $route['default_controller'] = "site"; $route['scaffolding_trigger'] = ""; +$route['@(.+)'] = "project/home/$1"; /* End of file routes.php */ /* Location: ./system/application/config/routes.php */ diff --git a/codepot/src/codepot/controllers/site.php b/codepot/src/codepot/controllers/site.php index 5cc4f52d..bd9e74fc 100644 --- a/codepot/src/codepot/controllers/site.php +++ b/codepot/src/codepot/controllers/site.php @@ -474,7 +474,6 @@ class Site extends Controller redirect ("wiki/attachment/{$part[0]}/{$hexwikiname}/{$hexattname}"); } } - } ?> diff --git a/codepot/src/codepot/views/code_blame.php b/codepot/src/codepot/views/code_blame.php index 0ab7263a..cea026be 100644 --- a/codepot/src/codepot/views/code_blame.php +++ b/codepot/src/codepot/views/code_blame.php @@ -2,18 +2,20 @@ - - - - - - - - - - - + + + + + + + + + + + + + - - - - - + + + + + + + + + + <?=htmlspecialchars($project->name)?> diff --git a/codepot/src/codepot/views/code_file.php b/codepot/src/codepot/views/code_file.php index f42f8c9c..1c55acae 100644 --- a/codepot/src/codepot/views/code_file.php +++ b/codepot/src/codepot/views/code_file.php @@ -2,18 +2,19 @@ - - - - - - - - - - - + + + + + + + + + + + + - - + + + + + + - - + + + + <?=htmlspecialchars($project->name)?> diff --git a/codepot/src/codepot/views/code_revision.php b/codepot/src/codepot/views/code_revision.php index 0633f68e..417d5533 100644 --- a/codepot/src/codepot/views/code_revision.php +++ b/codepot/src/codepot/views/code_revision.php @@ -2,8 +2,10 @@ - - + + + + <?=htmlspecialchars($project->name)?> diff --git a/codepot/src/codepot/views/error.php b/codepot/src/codepot/views/error.php index 1f48da63..3a8799ca 100644 --- a/codepot/src/codepot/views/error.php +++ b/codepot/src/codepot/views/error.php @@ -4,8 +4,8 @@ - - + + <?=$title?> diff --git a/codepot/src/codepot/views/file_delete.php b/codepot/src/codepot/views/file_delete.php index c7327002..f378cf8a 100644 --- a/codepot/src/codepot/views/file_delete.php +++ b/codepot/src/codepot/views/file_delete.php @@ -2,8 +2,10 @@ - - + + + + <title><?=htmlspecialchars($file->name)?> diff --git a/codepot/src/codepot/views/file_edit.php b/codepot/src/codepot/views/file_edit.php index 6ff08edb..25d3c36b 100644 --- a/codepot/src/codepot/views/file_edit.php +++ b/codepot/src/codepot/views/file_edit.php @@ -2,8 +2,10 @@ - - + + + + <?=htmlspecialchars($file->name)?> diff --git a/codepot/src/codepot/views/file_home.php b/codepot/src/codepot/views/file_home.php index 15c8b597..51c75fb2 100644 --- a/codepot/src/codepot/views/file_home.php +++ b/codepot/src/codepot/views/file_home.php @@ -4,8 +4,10 @@ - - + + + + <?=htmlspecialchars($project->name)?> diff --git a/codepot/src/codepot/views/file_show.php b/codepot/src/codepot/views/file_show.php index ed142133..b48e5af2 100644 --- a/codepot/src/codepot/views/file_show.php +++ b/codepot/src/codepot/views/file_show.php @@ -2,9 +2,11 @@ - - - + + + + + - - + + + + + + + + - - - + + + + + - - + + + - - + + + + + + + + + + + - - + + - + + + + + + + + + + + - - + + + + + + + + - - + + + + + + + + + + + + <?=htmlspecialchars($wiki->name)?> diff --git a/codepot/src/config.php.in b/codepot/src/config.php.in index e4672d3e..8e88da94 100644 --- a/codepot/src/config.php.in +++ b/codepot/src/config.php.in @@ -25,6 +25,7 @@ function load_ini ($file) array ('default_site_name', 'string', '@PACKAGE@'), array ('language', 'string', 'auto'), + array ('index_page', 'string', 'index.php'), array ('signin_compulsory', 'boolean', FALSE), array ('https_compulsory', 'boolean', FALSE), diff --git a/codepot/src/system/helpers/url_helper.php b/codepot/src/system/helpers/url_helper.php index 546552a6..e8dfcce2 100644 --- a/codepot/src/system/helpers/url_helper.php +++ b/codepot/src/system/helpers/url_helper.php @@ -63,6 +63,22 @@ if ( ! function_exists('base_url')) $CI =& get_instance(); return $CI->config->slash_item('base_url'); } + +} + +if ( ! function_exists('base_url_make')) +{ + function base_url_make($path) + { + $CI =& get_instance(); + $url = $CI->config->slash_item('base_url'); + if (substr($url, -1) == '/') + { + for ($i = 0; substr($path, $i, 1) == '/'; $i++); + return $url . substr($path, $i); + } + else return $url . $path; + } } // ------------------------------------------------------------------------ @@ -590,4 +606,4 @@ if ( ! function_exists('_parse_attributes')) /* End of file url_helper.php */ -/* Location: ./system/helpers/url_helper.php */ \ No newline at end of file +/* Location: ./system/helpers/url_helper.php */ diff --git a/codepot/src/system/libraries/Router.php b/codepot/src/system/libraries/Router.php index 50c7dd7c..f7b59e4a 100644 --- a/codepot/src/system/libraries/Router.php +++ b/codepot/src/system/libraries/Router.php @@ -386,4 +386,4 @@ class CI_Router { // END Router Class /* End of file Router.php */ -/* Location: ./system/libraries/Router.php */ \ No newline at end of file +/* Location: ./system/libraries/Router.php */