From f9208d86a5ddfe4d52ed4da9275b15c3101c7702 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Wed, 28 Apr 2010 14:33:25 +0000 Subject: [PATCH] * enhanced sign-in handling * fixed attachment cache control. --- codepot/DEBIAN/postinst.in | 7 +- codepot/DEBIAN/postrm.in | 1 + codepot/Makefile.in | 4 +- codepot/codepot.spec.in | 2 + codepot/etc/codepot.ini.in | 4 +- codepot/src/codepot/controllers/code.php | 10 +- codepot/src/codepot/controllers/file.php | 45 ++-- codepot/src/codepot/controllers/issue.php | 37 ++-- codepot/src/codepot/controllers/main.php | 15 +- codepot/src/codepot/controllers/project.php | 21 +- codepot/src/codepot/controllers/site.php | 44 ++-- codepot/src/codepot/controllers/wiki.php | 198 ++++++++++-------- .../src/codepot/language/english/Makefile.am | 1 + .../src/codepot/language/english/Makefile.in | 1 + .../codepot/language/english/code_lang.php | 2 - .../codepot/language/english/common_lang.php | 8 +- .../codepot/language/english/file_lang.php | 5 + .../codepot/language/english/issue_lang.php | 2 + .../codepot/language/english/site_lang.php | 2 + .../codepot/language/english/wiki_lang.php | 2 + .../src/codepot/language/korean/Makefile.am | 1 + .../src/codepot/language/korean/Makefile.in | 1 + .../src/codepot/language/korean/code_lang.php | 2 - .../codepot/language/korean/common_lang.php | 9 +- .../src/codepot/language/korean/file_lang.php | 5 + .../codepot/language/korean/issue_lang.php | 2 + .../src/codepot/language/korean/site_lang.php | 2 + .../src/codepot/language/korean/wiki_lang.php | 6 +- codepot/src/codepot/libraries/wikihelper.php | 16 +- codepot/src/codepot/views/code_blame.php | 8 +- codepot/src/codepot/views/code_file.php | 8 +- codepot/src/codepot/views/file_home.php | 2 +- codepot/src/codepot/views/issue_home.php | 2 +- codepot/src/codepot/views/login.php | 2 +- codepot/src/codepot/views/project_home.php | 3 +- codepot/src/codepot/views/taskbar.php | 2 +- codepot/src/config.php.in | 4 +- codepot/src/css/common.css | 1 + codepot/src/css/project.css | 14 +- 39 files changed, 299 insertions(+), 202 deletions(-) create mode 100644 codepot/src/codepot/language/english/file_lang.php create mode 100644 codepot/src/codepot/language/korean/file_lang.php diff --git a/codepot/DEBIAN/postinst.in b/codepot/DEBIAN/postinst.in index c83e659d..345743bf 100644 --- a/codepot/DEBIAN/postinst.in +++ b/codepot/DEBIAN/postinst.in @@ -5,6 +5,7 @@ [ -d "@LOGDIR@" ] || { mkdir -p "@LOGDIR@" && logdir=1; } [ -d "@DEPOTDIR@/svnrepo" ] || { mkdir -p "@DEPOTDIR@/svnrepo" && svnrepodir=1; } [ -d "@DEPOTDIR@/files" ] || { mkdir -p "@DEPOTDIR@/files" && filesdir=1; } +[ -d "@DEPOTDIR@/attachments" ] || { mkdir -p "@DEPOTDIR@/attachments" && attachmentsdir=1; } [ -f "@SYSCONFDIR@/apache2/envvars" ] && { GROUP=$(. "@SYSCONFDIR@/apache2/envvars" && echo "${APACHE_RUN_GROUP}") @@ -21,9 +22,9 @@ chgrp -R "${GROUP}" "@DEPOTDIR@/svnrepo" chmod 0775 "@DEPOTDIR@/svnrepo" } - [ "${filesdir}" = "1" ] && { - chgrp -R "${GROUP}" "@DEPOTDIR@/files" - chmod 0775 "@DEPOTDIR@/files" + [ "${attachmentsdir}" = "1" ] && { + chgrp -R "${GROUP}" "@DEPOTDIR@/attachments" + chmod 0775 "@DEPOTDIR@/attachments" } } } diff --git a/codepot/DEBIAN/postrm.in b/codepot/DEBIAN/postrm.in index 586255cc..81f7b339 100644 --- a/codepot/DEBIAN/postrm.in +++ b/codepot/DEBIAN/postrm.in @@ -4,6 +4,7 @@ [ -d "@LOGDIR@" ] && rmdir "@LOGDIR@" 2>/dev/null [ -d "@DEPOTDIR@/svnrepo" ] && rmdir "@DEPOTDIR@/svnrepo" 2>/dev/null [ -d "@DEPOTDIR@/files" ] && rmdir "@DEPOTDIR@/files" 2>/dev/null +[ -d "@DEPOTDIR@/attachments" ] && rmdir "@DEPOTDIR@/attachments" 2>/dev/null [ -d "@DEPOTDIR@" ] && rmdir "@DEPOTDIR@" 2>/dev/null exit 0 diff --git a/codepot/Makefile.in b/codepot/Makefile.in index 20ec314b..f0bf9083 100644 --- a/codepot/Makefile.in +++ b/codepot/Makefile.in @@ -699,9 +699,9 @@ install-data-hook: $(INSTALL) -d "$(DESTDIR)@CACHEDIR@" uninstall-hook: - $(RMDIR) "$(DESTDIR)@DEPOTDIR@/svnrepo" - $(RMDIR) "$(DESTDIR)@DEPOTDIR@/files" $(RMDIR) "$(DESTDIR)@DEPOTDIR@/attachments" + $(RMDIR) "$(DESTDIR)@DEPOTDIR@/files" + $(RMDIR) "$(DESTDIR)@DEPOTDIR@/svnrepo" $(RMDIR) "$(DESTDIR)@DEPOTDIR@" $(RMDIR) "$(DESTDIR)@LOGDIR@" $(RMDIR) "$(DESTDIR)@CACHEDIR@" diff --git a/codepot/codepot.spec.in b/codepot/codepot.spec.in index 447c5b7e..88bb9a34 100644 --- a/codepot/codepot.spec.in +++ b/codepot/codepot.spec.in @@ -53,10 +53,12 @@ rm -rf $RPM_BUILD_ROOT %attr(-,apache,apache) /var/lib/codepot/svnrepo %attr(-,apache,apache) /var/lib/codepot/files +%attr(-,apache,apache) /var/lib/codepot/attachments %attr(-,apache,apache) /var/log/codepot %attr(-,apache,apache) /var/cache/codepot %dir /var/lib/codepot/svnrepo %dir /var/lib/codepot/files +%dir /var/lib/codepot/attachments %dir /var/log/codepot %dir /var/cache/codepot diff --git a/codepot/etc/codepot.ini.in b/codepot/etc/codepot.ini.in index 5d7b3f95..86f78fb2 100644 --- a/codepot/etc/codepot.ini.in +++ b/codepot/etc/codepot.ini.in @@ -1,7 +1,7 @@ ;------------------------------------------------------------------------------ ; default site language ;------------------------------------------------------------------------------ -default_site_language = "english"; +default_site_language = "english" ;------------------------------------------------------------------------------ ; default site name @@ -153,5 +153,5 @@ force_project_delete = "no" ;------------------------------------------------------------------------------ ; Leave this empty for the default footer message ;------------------------------------------------------------------------------ -footer = ""; +footer = "" diff --git a/codepot/src/codepot/controllers/code.php b/codepot/src/codepot/controllers/code.php index ccd5b531..471ad176 100644 --- a/codepot/src/codepot/controllers/code.php +++ b/codepot/src/codepot/controllers/code.php @@ -35,7 +35,7 @@ class Code extends Controller $login = $this->login->getUser (); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') - redirect ('main/signin'); + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $data['login'] = $login; $path = $this->converter->HexToAscii ($path); @@ -112,7 +112,7 @@ class Code extends Controller $login = $this->login->getUser (); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') - redirect ('main/signin'); + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $data['login'] = $login; $path = $this->converter->HexToAscii ($path); @@ -176,7 +176,7 @@ class Code extends Controller $login = $this->login->getUser (); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') - redirect ('main/signin'); + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $data['login'] = $login; $path = $this->converter->HexToAscii ($path); @@ -229,7 +229,7 @@ class Code extends Controller $login = $this->login->getUser (); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') - redirect ('main/signin'); + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $data['login'] = $login; $path = $this->converter->HexToAscii ($path); @@ -282,7 +282,7 @@ class Code extends Controller $login = $this->login->getUser (); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') - redirect ('main/signin'); + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $data['login'] = $login; $path = $this->converter->HexToAscii ($path); diff --git a/codepot/src/codepot/controllers/file.php b/codepot/src/codepot/controllers/file.php index a1969f50..55a63dcc 100644 --- a/codepot/src/codepot/controllers/file.php +++ b/codepot/src/codepot/controllers/file.php @@ -18,6 +18,7 @@ class File extends Controller $this->load->library ('Language', 'lang'); $this->lang->load ('common', CODEPOT_LANG); + $this->lang->load ('file', CODEPOT_LANG); } function home ($projectid = "") @@ -27,7 +28,7 @@ class File extends Controller $login = $this->login->getUser (); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') - redirect ('main/signin'); + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $data['login'] = $login; $project = $this->projects->get ($projectid); @@ -68,7 +69,7 @@ class File extends Controller $login = $this->login->getUser (); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') - redirect ('main/signin'); + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $data['login'] = $login; $name = $this->converter->HexToAscii ($name); @@ -98,9 +99,8 @@ class File extends Controller else if ($file === NULL) { $data['project'] = $project; - $data['message'] = - $this->lang->line('MSG_NO_SUCH_FILE'). - " - {$name}"; + $data['message'] = sprintf ( + $this->lang->line('FILE_MSG_NO_SUCH_FILE'), $name); $this->load->view ($this->VIEW_ERROR, $data); } else @@ -119,7 +119,7 @@ class File extends Controller $login = $this->login->getUser (); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') - redirect ('main/signin'); + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $data['login'] = $login; $name = $this->converter->HexToAscii ($name); @@ -148,7 +148,7 @@ class File extends Controller } else if ($file === NULL) { - redirect ('file/create/'. $projectid . '/' . + redirect ("file/create/{$projectid}/" . $this->converter->AsciiToHex($name)); } else @@ -197,7 +197,8 @@ class File extends Controller $this->load->model ('FileModel', 'files'); $login = $this->login->getUser (); - if ($login['id'] == '') redirect ('main'); + if ($login['id'] == '') + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $data['login'] = $login; $name = $this->converter->HexToAscii ($name); @@ -219,7 +220,8 @@ class File extends Controller $this->projects->projectHasMember($project->id, $login['id']) === FALSE) { $data['project'] = $project; - $data['message'] = "NO PERMISSION - $projectid"; + $data['message'] = sprintf ( + $this->lang->line('MSG_PROJECT_MEMBERSHIP_REQUIRED'), $projectid); $this->load->view ($this->VIEW_ERROR, $data); } else @@ -262,13 +264,22 @@ class File extends Controller } else { - redirect ('file/show/' . $project->id . '/' . + redirect ("file/show/{$project->id}/" . $this->converter->AsciiToHex($file->name)); } } else { $fname = $_FILES['file_name']['name']; + + if (strpos ($fname, ':') !== FALSE) + { + $data['message'] = $this->lang->line ('FILE_MSG_NAME_NO_COLON'); + $data['file'] = $file; + $this->load->view ($this->VIEW_EDIT, $data); + return; + } + $ext = substr ($fname, strrpos ($fname, '.') + 1); // delete all \" instances ... @@ -320,7 +331,7 @@ class File extends Controller } else { - redirect ('file/show/' . $project->id . '/' . + redirect ("file/show/{$project->id}/" . $this->converter->AsciiToHex($file->name)); } } @@ -346,7 +357,8 @@ class File extends Controller } else if ($file == NULL) { - $data['message'] = "NO SUCH FILE - $name"; + $data['message'] = sprintf + ($this->lang->line('FILE_MSG_NO_SUCH_FILE'), $name); $this->load->view ($this->VIEW_ERROR, $data); } else @@ -390,7 +402,8 @@ class File extends Controller $this->load->model ('FileModel', 'files'); $login = $this->login->getUser (); - if ($login['id'] == '') redirect ('main'); + if ($login['id'] == '') + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $data['login'] = $login; $name = $this->converter->HexToAscii ($name); @@ -412,7 +425,8 @@ class File extends Controller $this->projects->projectHasMember($project->id, $login['id']) === FALSE) { $data['project'] = $project; - $data['message'] = "NO PERMISSION - $projectid"; + $data['message'] = sprintf ( + $this->lang->line('MSG_PROJECT_MEMBERSHIP_REQUIRED'), $projectid); $this->load->view ($this->VIEW_ERROR, $data); } else @@ -468,7 +482,8 @@ class File extends Controller } else if ($file === NULL) { - $data['message'] = "NO SUCH FILE - $name"; + $data['message'] = sprintf + ($this->lang->line('FILE_MSG_NO_SUCH_FILE'), $name); $this->load->view ($this->VIEW_ERROR, $data); } else diff --git a/codepot/src/codepot/controllers/issue.php b/codepot/src/codepot/controllers/issue.php index b9e94e2f..2191320a 100644 --- a/codepot/src/codepot/controllers/issue.php +++ b/codepot/src/codepot/controllers/issue.php @@ -30,7 +30,7 @@ class Issue extends Controller $login = $this->login->getUser (); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') - redirect ('main/signin'); + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $data['login'] = $login; $project = $this->projects->get ($projectid); @@ -145,7 +145,7 @@ class Issue extends Controller $login = $this->login->getUser (); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') - redirect ('main/signin'); + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $data['login'] = $login; if ($hexid == '') @@ -185,7 +185,8 @@ class Issue extends Controller $this->projects->projectHasMember($project->id, $login['id']) === FALSE) { $data['project'] = $project; - $data['message'] = "NO PERMISSION - $projectid"; + $data['message'] = sprintf ( + $this->lang->line('MSG_PROJECT_MEMBERSHIP_REQUIRED'), $projectid); $this->load->view ($this->VIEW_ERROR, $data); } else if ($this->issues->change ($login['id'], $project, $id, $change) === FALSE) @@ -206,7 +207,8 @@ class Issue extends Controller $this->projects->projectHasMember($project->id, $login['id']) === FALSE) { $data['project'] = $project; - $data['message'] = "NO PERMISSION - $projectid"; + $data['message'] = sprintf ( + $this->lang->line('MSG_PROJECT_MEMBERSHIP_REQUIRED'), $projectid); $this->load->view ($this->VIEW_ERROR, $data); } else if ($this->issues->undo_last_change ($login['id'], $project, $id) === FALSE) @@ -232,9 +234,8 @@ class Issue extends Controller else if ($issue === NULL) { $data['project'] = $project; - $data['message'] = - $this->lang->line('MSG_NO_SUCH_ISSUE'). - " - {$id}"; + $data['message'] = sprintf ( + $this->lang->line('ISSUE_MSG_NO_SUCH_ISSUE'), $id); $this->load->view ($this->VIEW_ERROR, $data); } else @@ -257,7 +258,8 @@ class Issue extends Controller $this->load->model ('IssueModel', 'issues'); $login = $this->login->getUser (); - if ($login['id'] == '') redirect ('main'); + if ($login['id'] == '') + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $data['login'] = $login; $id = $this->converter->HexToAscii ($hexid); @@ -279,7 +281,8 @@ class Issue extends Controller $this->projects->projectHasMember($project->id, $login['id']) === FALSE) { $data['project'] = $project; - $data['message'] = "NO PERMISSION - $projectid"; + $data['message'] = sprintf ( + $this->lang->line('MSG_PROJECT_MEMBERSHIP_REQUIRED'), $projectid); $this->load->view ($this->VIEW_ERROR, $data); } else @@ -353,9 +356,8 @@ class Issue extends Controller } else if ($issue == NULL) { - $data['message'] = - $this->lang->line('MSG_NO_SUCH_ISSUE') . - " - {$id}"; + $data['message'] = sprintf ( + $this->lang->line('ISSUE_MSG_NO_SUCH_ISSUE'), $id); $this->load->view ($this->VIEW_ERROR, $data); } else @@ -402,7 +404,8 @@ class Issue extends Controller $this->load->model ('IssueModel', 'issues'); $login = $this->login->getUser (); - if ($login['id'] == '') redirect ('main'); + if ($login['id'] == '') + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $data['login'] = $login; $id = $this->converter->HexToAscii ($hexid); @@ -424,7 +427,8 @@ class Issue extends Controller $this->projects->projectHasMember($project->id, $login['id']) === FALSE) { $data['project'] = $project; - $data['message'] = "NO PERMISSION - $projectid"; + $data['message'] = sprintf ( + $this->lang->line('MSG_PROJECT_MEMBERSHIP_REQUIRED'), $projectid); $this->load->view ($this->VIEW_ERROR, $data); } else @@ -479,9 +483,8 @@ class Issue extends Controller } else if ($issue === NULL) { - $data['message'] = - $this->lang->line('MSG_NO_SUCH_ISSUE') . - " - {$id}"; + $data['message'] = sprintf ( + $this->lang->line('ISSUE_MSG_NO_SUCH_ISSUE'), $id); $this->load->view ($this->VIEW_ERROR, $data); } else diff --git a/codepot/src/codepot/controllers/main.php b/codepot/src/codepot/controllers/main.php index d0736e22..221d000f 100644 --- a/codepot/src/codepot/controllers/main.php +++ b/codepot/src/codepot/controllers/main.php @@ -15,7 +15,12 @@ class Main extends Controller $this->lang->load ('common', CODEPOT_LANG); } - function index() + function index ($xurl = '') + { + redirect ("main/signin/$xurl"); + } + + function signin ($xurl = '') { $this->load->library(array('encrypt', 'form_validation', 'session')); @@ -43,7 +48,7 @@ class Main extends Controller } else { - if ($user_url != "") redirect ($user_url); + if ($user_url != '') redirect ($user_url); else redirect ('site/home'); } } @@ -60,15 +65,11 @@ class Main extends Controller $this->login->deauthenticate (); $data['user_name'] = ''; $data['user_pass'] = ''; - $data['user_url'] = ''; + $data['user_url'] = $this->converter->HexToAscii($xurl); $this->load->view ('login', $data); } } - function signin () - { - redirect ('main/index'); - } function signout ($xurl = "") { diff --git a/codepot/src/codepot/controllers/project.php b/codepot/src/codepot/controllers/project.php index 7f6dde29..c113e58b 100644 --- a/codepot/src/codepot/controllers/project.php +++ b/codepot/src/codepot/controllers/project.php @@ -29,7 +29,7 @@ class Project extends Controller $login = $this->login->getUser (); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') - redirect ('main/signin'); + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $data['login'] = $login; if ($filter == '') @@ -117,7 +117,7 @@ class Project extends Controller $login = $this->login->getUser (); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') - redirect ('main/signin'); + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $data['login'] = $login; @@ -206,7 +206,7 @@ class Project extends Controller } else { - redirect ('project/home/' . $project->id); + redirect ("project/home/{$project->id}"); } } else @@ -237,7 +237,8 @@ class Project extends Controller $this->load->model ('ProjectModel', 'projects'); $login = $this->login->getUser (); - if ($login['id'] == '') redirect ('main/signin'); + if ($login['id'] == '') + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $project->id = $projectid; $project->name = ''; @@ -253,7 +254,8 @@ class Project extends Controller $this->load->model ('ProjectModel', 'projects'); $login = $this->login->getUser (); - if ($login['id'] == '') redirect ('main/signin'); + if ($login['id'] == '') + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $project = $this->projects->get ($projectid); if ($project === FALSE) @@ -275,7 +277,8 @@ class Project extends Controller { $data['project'] = $project; $data['login'] = $login; - $data['message'] = "NO PERMISSION - $projectid"; + $data['message'] = sprintf ( + $this->lang->line('MSG_PROJECT_MEMBERSHIP_REQUIRED'), $projectid); $this->load->view ($this->VIEW_ERROR, $data); } else @@ -350,7 +353,8 @@ class Project extends Controller $this->load->model ('ProjectModel', 'projects'); $login = $this->login->getUser (); - if ($login['id'] == '') redirect ('main/signin'); + if ($login['id'] == '') + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $project = $this->projects->get ($projectid); if ($project === FALSE) @@ -372,7 +376,8 @@ class Project extends Controller { $data['login'] = $login; $data['project'] = $project; - $data['message'] = "NO PERMISSION - $projectid"; + $data['message'] = sprintf ( + $this->lang->line('MSG_PROJECT_MEMBERSHIP_REQUIRED'), $projectid); $this->load->view ($this->VIEW_ERROR, $data); } else diff --git a/codepot/src/codepot/controllers/site.php b/codepot/src/codepot/controllers/site.php index 094ef724..49a400de 100644 --- a/codepot/src/codepot/controllers/site.php +++ b/codepot/src/codepot/controllers/site.php @@ -34,7 +34,7 @@ class Site extends Controller { $login = $this->login->getUser (); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') - redirect ('main/signin'); + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $this->load->model ('SiteModel', 'sites'); $this->load->model ('ProjectModel', 'projects'); @@ -92,7 +92,7 @@ class Site extends Controller { $login = $this->login->getUser (); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') - redirect ('main/signin'); + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $this->load->model ('SiteModel', 'sites'); @@ -116,7 +116,7 @@ class Site extends Controller { $login = $this->login->getUser (); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') - redirect ('main/signin'); + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $this->load->model ('SiteModel', 'sites'); @@ -128,18 +128,17 @@ class Site extends Controller $data['login'] = $login; $data['message'] = 'DATABASE ERROR'; $this->load->view ($this->VIEW_ERROR, $data); - return; } - - if ($site === NULL) + else if ($site === NULL) { - $data['message'] = "NO SUCH SITE - {$siteid}"; + $data['message'] = sprintf ($this->lang->line('SITE_MSG_NO_SUCH_SITE'), $siteid); $this->load->view ($this->VIEW_ERROR, $data); - return; } - - $data['site'] = $site; - $this->load->view ($this->VIEW_SHOW, $data); + else + { + $data['site'] = $site; + $this->load->view ($this->VIEW_SHOW, $data); + } } function _edit_site ($site, $mode, $login) @@ -219,12 +218,13 @@ class Site extends Controller $this->load->model ('SiteModel', 'sites'); $login = $this->login->getUser (); - if ($login['id'] == '') redirect ('main/signin'); + if ($login['id'] == '') + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); if (!$login['sysadmin?']) { $data['login'] = $login; - $data['message'] = "NO PERMISSION"; + $data['message'] = $this->lang->line('SITE_MSG_ADMINISTRATORSHIP_REQUIRED'); $this->load->view ($this->VIEW_ERROR, $data); } else @@ -242,7 +242,8 @@ class Site extends Controller $this->load->model ('SiteModel', 'sites'); $login = $this->login->getUser (); - if ($login['id'] == '') redirect ('main/signin'); + if ($login['id'] == '') + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $site = $this->sites->get ($siteid); if ($site === FALSE) @@ -254,13 +255,13 @@ class Site extends Controller else if ($site === NULL) { $data['login'] = $login; - $data['message'] = "NO SUCH SITE - $siteid"; + $data['message'] = sprintf ($this->lang->line('SITE_MSG_NO_SUCH_SITE'), $siteid); $this->load->view ($this->VIEW_ERROR, $data); } else if (!$login['sysadmin?']) { $data['login'] = $login; - $data['message'] = "NO PERMISSION - $siteid"; + $data['message'] = $this->lang->line('SITE_MSG_ADMINISTRATORSHIP_REQUIRED'); $this->load->view ($this->VIEW_ERROR, $data); } else @@ -333,7 +334,8 @@ class Site extends Controller $this->load->model ('SiteModel', 'sites'); $login = $this->login->getUser (); - if ($login['id'] == '') redirect ('main/signin'); + if ($login['id'] == '') + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $site = $this->sites->get ($siteid); if ($site === FALSE) @@ -345,13 +347,13 @@ class Site extends Controller else if ($site === NULL) { $data['login'] = $login; - $data['message'] = "NO SUCH SITE - $siteid"; + $data['message'] = sprintf ($this->lang->line('SITE_MSG_NO_SUCH_SITE'), $siteid); $this->load->view ($this->VIEW_ERROR, $data); } else if (!$login['sysadmin?']) { $data['login'] = $login; - $data['message'] = "NO PERMISSION - $siteid"; + $data['message'] = $this->lang->line('SITE_MSG_ADMINISTRATORSHIP_REQUIRED'); $this->load->view ($this->VIEW_ERROR, $data); } else @@ -433,7 +435,7 @@ class Site extends Controller { $login = $this->login->getUser (); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') - redirect ('main/signin'); + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $data['login'] = $login; @@ -458,7 +460,7 @@ class Site extends Controller { $login = $this->login->getUser (); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') - redirect ('main/signin'); + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $data['login'] = $login; diff --git a/codepot/src/codepot/controllers/wiki.php b/codepot/src/codepot/controllers/wiki.php index 83f2fde6..d76631df 100644 --- a/codepot/src/codepot/controllers/wiki.php +++ b/codepot/src/codepot/controllers/wiki.php @@ -30,7 +30,7 @@ class Wiki extends Controller $login = $this->login->getUser (); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') - redirect ('main/signin'); + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $data['login'] = $login; $project = $this->projects->get ($projectid); @@ -71,7 +71,7 @@ class Wiki extends Controller $login = $this->login->getUser (); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') - redirect ('main/signin'); + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $data['login'] = $login; if ($name == '') @@ -105,45 +105,54 @@ class Wiki extends Controller $data['project'] = $project; $data['message'] = "INVALID LINK - {$name}"; $this->load->view ($this->VIEW_ERROR, $data); - return; } else if ($link !== NULL) { + // redirect to a special link like __WIKI__:projectid:wikiname if ($link->extra === NULL) redirect ("{$link->type}/{$link->target}/{$link->projectid}"); else redirect ("{$link->type}/{$link->target}/{$link->projectid}/{$link->extra}"); - return; } - - $wiki = $this->wikis->get ($login['id'], $project, $name); - if ($wiki === FALSE) + else { - $data['project'] = $project; - $data['message'] = 'DATABASE ERROR'; - $this->load->view ($this->VIEW_ERROR, $data); - } - else if ($wiki === NULL) - { - if ($create) + $wiki = $this->wikis->get ($login['id'], $project, $name); + if ($wiki === FALSE) { - redirect ("wiki/create/{$projectid}/" . - $this->converter->AsciiToHex($name)); + $data['project'] = $project; + $data['message'] = 'DATABASE ERROR'; + $this->load->view ($this->VIEW_ERROR, $data); + } + else if ($wiki === NULL) + { + if ($create) + { + // Redirecting to the 'new' page is determined by the project membership + // when the wiki page is not found. + $create = ($login['sysadmin?'] || + $this->projects->projectHasMember($project->id, $login['id'])); + } + + if ($create) + { + redirect ("wiki/create/{$projectid}/" . + $this->converter->AsciiToHex($name)); + } + else + { + $data['project'] = $project; + $data['message'] = sprintf ( + $this->lang->line('WIKI_MSG_NO_SUCH_PAGE'), $name); + $this->load->view ($this->VIEW_ERROR, $data); + } } else { $data['project'] = $project; - $data['message'] = sprintf ( - $this->lang->line('WIKI_MSG_NO_SUCH_PAGE'), $name); - $this->load->view ($this->VIEW_ERROR, $data); + $data['wiki'] = $wiki; + $this->load->view ($this->VIEW_SHOW, $data); } } - else - { - $data['project'] = $project; - $data['wiki'] = $wiki; - $this->load->view ($this->VIEW_SHOW, $data); - } } } @@ -163,7 +172,7 @@ class Wiki extends Controller $login = $this->login->getUser (); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') - redirect ('main/signin'); + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); if ($target == '') { @@ -186,7 +195,7 @@ class Wiki extends Controller { $login = $this->login->getUser (); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') - redirect ('main/signin'); + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); if ($wikiname == '' || $name == '') { @@ -233,40 +242,42 @@ class Wiki extends Controller else { $att = $this->wikis->getAttachment ($login['id'], $project, $wikiname, $name); - if ($att == FALSE) + if ($att === FALSE) { $data['project'] = $project; $data['message'] = 'DATABASE ERROR'; $this->load->view ($this->VIEW_ERROR, $data); - return; } else if ($att === NULL) { $data['project'] = $project; $data['message'] = sprintf ( - $this->lang->line('MSG_WIKI_NO_SUCH_ATTACHMENT'), $name); + $this->lang->line('WIKI_MSG_NO_SUCH_ATTACHMENT'), $name); $this->load->view ($this->VIEW_ERROR, $data); } - - $path = CODEPOT_ATTACHMENT_DIR . "/{$att->encname}"; - - $mtime = @filemtime ($path); - if ($mtime === FALSE) $mtime = time(); - header('Last-Modified: ' . gmdate("D, d M Y H:i:s", $mtime) . ' GMT'); - header ('Content-Type: ' . mime_content_type($path)); - header("Content-Disposition: filename={$name}"); - $len = @filesize($path); - if ($len !== FALSE) header("Content-Length: {$len}"); - //header("Content-Transfer-Encoding: binary"); - flush (); - - $x = @readfile($path); - if ($x === FALSE) + else { - $data['project'] = $project; - $data['message'] = sprintf ( - $this->lang->line('MSG_WIKI_FAILED_TO_READ_ATTACHMENT'), $name); - $this->load->view ($this->VIEW_ERROR, $data); + $path = CODEPOT_ATTACHMENT_DIR . "/{$att->encname}"; + + $mtime = @filemtime ($path); + if ($mtime === FALSE) $mtime = time(); + header ('Content-Type: ' . mime_content_type($path)); + header ('Expires: ' . gmdate("D, d M Y H:i:s", time() + 60*60*24*30) . ' GMT'); // 30days + header ('Last-Modified: ' . gmdate("D, d M Y H:i:s", $mtime) . ' GMT'); + header ("Content-Disposition: filename={$name}"); + $len = @filesize($path); + if ($len !== FALSE) header("Content-Length: {$len}"); + //header("Content-Transfer-Encoding: binary"); + flush (); + + $x = @readfile($path); + if ($x === FALSE) + { + $data['project'] = $project; + $data['message'] = sprintf ( + $this->lang->line('WIKI_MSG_FAILED_TO_READ_ATTACHMENT'), $name); + $this->load->view ($this->VIEW_ERROR, $data); + } } } } @@ -281,7 +292,8 @@ class Wiki extends Controller $this->load->model ('WikiModel', 'wikis'); $login = $this->login->getUser (); - if ($login['id'] == '') redirect ('main'); + if ($login['id'] == '') + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $data['login'] = $login; $name = $this->converter->HexToAscii ($name); @@ -303,7 +315,8 @@ class Wiki extends Controller $this->projects->projectHasMember($project->id, $login['id']) === FALSE) { $data['project'] = $project; - $data['message'] = "NO PERMISSION - $projectid"; + $data['message'] = sprintf ( + $this->lang->line('MSG_PROJECT_MEMBERSHIP_REQUIRED'), $projectid); $this->load->view ($this->VIEW_ERROR, $data); } else @@ -324,44 +337,58 @@ class Wiki extends Controller if ($this->input->post('wiki')) { $wiki->projectid = $this->input->post('wiki_projectid'); - $wiki->name = $this->input->post('wiki_name'); $wiki->text = $this->input->post('wiki_text'); - + $wiki->attachments = array(); $wiki->delete_attachments = array(); - $delatts = $this->input->post('wiki_delete_attachment'); - - if (!empty($delatts)) - { - foreach ($delatts as $att) - { - $atpos = strpos ($att, '@'); - if ($atpos === FALSE) continue; - - $attinfo['name'] = $this->converter->HexToAscii(substr ($att, 0, $atpos)); - $attinfo['encname'] = $this->converter->HexToAscii(substr ($att, $atpos + 1)); - - array_push ( - $wiki->delete_attachments, - (object)$attinfo - ); - } - } - - $wiki->attachments = $this->wikis->getAttachments ( - $login['id'], $project, $wiki->name); - if ($wiki->attachments === FALSE) - { - $data['message'] = 'DATABASE ERROR'; - $this->load->view ($this->VIEW_ERROR, $data); - return; - } if ($this->form_validation->run()) { + $delatts = $this->input->post('wiki_delete_attachment'); + if (!empty($delatts)) + { + foreach ($delatts as $att) + { + $atpos = strpos ($att, '@'); + if ($atpos === FALSE) continue; + + $attinfo['name'] = $this->converter->HexToAscii( + substr ($att, 0, $atpos)); + $attinfo['encname'] = $this->converter->HexToAscii( + substr ($att, $atpos + 1)); + + array_push ( + $wiki->delete_attachments, + (object)$attinfo + ); + } + } + + $atts = $this->wikis->getAttachments ( + $login['id'], $project, $wiki->name); + if ($atts === FALSE) + { + $data['wiki'] = $wiki; + $data['message'] = 'DATABASE ERROR'; + $this->load->view ($this->VIEW_EDIT, $data); + return; + } + $wiki->attachments = $atts; + + if (strpos ($wiki->name, ':') !== FALSE) + { + $data['message'] = $this->lang->line('WIKI_MSG_NAME_NO_COLON'); + $data['wiki'] = $wiki; + $this->load->view ($this->VIEW_EDIT, $data); + return; + } + if ($this->wikihelper->_is_reserved ($wiki->name, FALSE)) { - $data['message'] = "RESERVED WIKI NAME - {$wiki->name}"; + $data['message'] = sprintf ( + $this->lang->line('WIKI_MSG_RESERVED_WIKI_NAME'), + $wiki->name + ); $data['wiki'] = $wiki; $this->load->view ($this->VIEW_EDIT, $data); } @@ -466,7 +493,8 @@ class Wiki extends Controller $this->load->model ('WikiModel', 'wikis'); $login = $this->login->getUser (); - if ($login['id'] == '') redirect ('main'); + if ($login['id'] == '') + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); $data['login'] = $login; $name = $this->converter->HexToAscii ($name); @@ -488,13 +516,15 @@ class Wiki extends Controller $this->projects->projectHasMember($project->id, $login['id']) === FALSE) { $data['project'] = $project; - $data['message'] = "NO PERMISSION - $projectid"; + $data['message'] = sprintf ( + $this->lang->line('MSG_PROJECT_MEMBERSHIP_REQUIRED'), $projectid); $this->load->view ($this->VIEW_ERROR, $data); } else if ($this->wikihelper->_is_reserved ($name, FALSE)) { $data['project'] = $project; - $data['message'] = "RESERVED WIKI PAGE - $name "; + $data['message'] = sprintf ( + $this->lang->line('WIKI_MSG_RESERVED_WIKI_NAME'), $name); $this->load->view ($this->VIEW_ERROR, $data); } else diff --git a/codepot/src/codepot/language/english/Makefile.am b/codepot/src/codepot/language/english/Makefile.am index b5345e46..aa17eac0 100644 --- a/codepot/src/codepot/language/english/Makefile.am +++ b/codepot/src/codepot/language/english/Makefile.am @@ -2,6 +2,7 @@ wwwdir=$(WWWDIR)/codepot/language/english www_DATA = \ code_lang.php \ common_lang.php \ + file_lang.php \ issue_lang.php \ index.html \ project_lang.php \ diff --git a/codepot/src/codepot/language/english/Makefile.in b/codepot/src/codepot/language/english/Makefile.in index 5f1be71e..635ea281 100644 --- a/codepot/src/codepot/language/english/Makefile.in +++ b/codepot/src/codepot/language/english/Makefile.in @@ -168,6 +168,7 @@ wwwdir = $(WWWDIR)/codepot/language/english www_DATA = \ code_lang.php \ common_lang.php \ + file_lang.php \ issue_lang.php \ index.html \ project_lang.php \ diff --git a/codepot/src/codepot/language/english/code_lang.php b/codepot/src/codepot/language/english/code_lang.php index 9180e9d7..1d50f50e 100644 --- a/codepot/src/codepot/language/english/code_lang.php +++ b/codepot/src/codepot/language/english/code_lang.php @@ -1,9 +1,7 @@ diff --git a/codepot/src/codepot/language/english/common_lang.php b/codepot/src/codepot/language/english/common_lang.php index 7fa935a4..353d8d7c 100644 --- a/codepot/src/codepot/language/english/common_lang.php +++ b/codepot/src/codepot/language/english/common_lang.php @@ -28,6 +28,7 @@ $lang['Files'] = 'Files'; $lang['First'] = 'First'; $lang['Folder'] = 'Folder'; $lang['Head revision'] = 'Head revision'; +$lang['Hide details'] = 'Hide details'; $lang['History'] = 'History'; $lang['Home'] = 'Home'; $lang['ID'] = 'ID'; @@ -62,6 +63,7 @@ $lang['Purge'] = 'Purge'; $lang['Repository'] = 'Repository'; $lang['Revision'] = 'Revision'; $lang['Search'] = 'Search'; +$lang['Show details'] = 'Show details'; $lang['Sign in'] = 'Sign in'; $lang['Sign out'] = 'Sign out'; $lang['Site'] = 'Site'; @@ -91,10 +93,8 @@ $lang['MSG_LOG_REVPROP_CHANGE_BY'] = 'Revision property %s changed by %s'; $lang['MSG_NO_DIFF'] = 'No difference found'; $lang['MSG_NO_CODE_AVAIL'] = 'No source code available'; -$lang['MSG_NO_FILES_AVAIL'] = 'No files available'; -$lang['MSG_NO_ISSUES_AVAIL'] = 'No outstanding issues'; -$lang['MSG_NO_SUCH_FILE'] = 'No such file'; -$lang['MSG_NO_SUCH_ISSUE'] = 'No such issue'; $lang['MSG_NO_SUCH_PROJECT'] = 'No such project'; $lang['MSG_SURE_TO_DELETE_THIS'] = "I'm sure to delete this"; + +$lang['MSG_PROJECT_MEMBERSHIP_REQUIRED'] = 'You have to be a member of the %s project to perform this task'; ?> diff --git a/codepot/src/codepot/language/english/file_lang.php b/codepot/src/codepot/language/english/file_lang.php new file mode 100644 index 00000000..5d79a664 --- /dev/null +++ b/codepot/src/codepot/language/english/file_lang.php @@ -0,0 +1,5 @@ + diff --git a/codepot/src/codepot/language/english/issue_lang.php b/codepot/src/codepot/language/english/issue_lang.php index 0448b85c..d0391b95 100644 --- a/codepot/src/codepot/language/english/issue_lang.php +++ b/codepot/src/codepot/language/english/issue_lang.php @@ -21,5 +21,7 @@ $lang['ISSUE_MSG_CHANGED_X_TO_Z'] = "Changed %s to < $lang['ISSUE_MSG_CHANGED_X_FROM_Y_TO_Z'] = "Changed %s from %s to %s"; $lang['ISSUE_MSG_CONFIRM_UNDO'] = 'Are you sure to undo the last change?'; $lang['ISSUE_MSG_CREATED'] = 'Created'; +$lang['ISSUE_MSG_NO_ISSUES_AVAILABLE'] = 'No outstanding issues'; +$lang['ISSUE_MSG_NO_SUCH_ISSUE'] = 'No such issue - %s'; $lang['ISSUE_MSG_TOTAL_NUM_ISSUES'] = 'Total %d issues'; ?> diff --git a/codepot/src/codepot/language/english/site_lang.php b/codepot/src/codepot/language/english/site_lang.php index acb6c354..b63e318f 100644 --- a/codepot/src/codepot/language/english/site_lang.php +++ b/codepot/src/codepot/language/english/site_lang.php @@ -1,2 +1,4 @@ diff --git a/codepot/src/codepot/language/english/wiki_lang.php b/codepot/src/codepot/language/english/wiki_lang.php index 041d5cf2..9a4b3e3f 100644 --- a/codepot/src/codepot/language/english/wiki_lang.php +++ b/codepot/src/codepot/language/english/wiki_lang.php @@ -5,7 +5,9 @@ $lang['WIKI_MORE_NEW_ATTACHMENTS'] = 'Add more'; $lang['WIKI_MSG_ATTACHMENT_NAME_NO_COLON'] = 'Attachment name containing a colon'; $lang['WIKI_MSG_FAILED_TO_READ_ATTACHMENT'] = 'Failed to read wiki attachment - %s'; +$lang['WIKI_MSG_NAME_NO_COLON'] = 'Wiki name containing a colon'; $lang['WIKI_MSG_NO_PAGES_AVAILABLE'] = 'No wiki pages available'; $lang['WIKI_MSG_NO_SUCH_PAGE'] = 'No such wiki page - %s'; $lang['WIKI_MSG_NO_SUCH_ATTACHMENT'] = 'No such wiki attachment - %s'; +$lang['WIKI_MSG_RESERVED_WIKI_NAME'] = 'Wiki name containing a reserved word - %s'; ?> diff --git a/codepot/src/codepot/language/korean/Makefile.am b/codepot/src/codepot/language/korean/Makefile.am index d54c4b1e..40cf2a84 100644 --- a/codepot/src/codepot/language/korean/Makefile.am +++ b/codepot/src/codepot/language/korean/Makefile.am @@ -2,6 +2,7 @@ wwwdir=$(WWWDIR)/codepot/language/korean www_DATA = \ code_lang.php \ common_lang.php \ + file_lang.php \ issue_lang.php \ index.html \ project_lang.php \ diff --git a/codepot/src/codepot/language/korean/Makefile.in b/codepot/src/codepot/language/korean/Makefile.in index cc373e79..92e70ea6 100644 --- a/codepot/src/codepot/language/korean/Makefile.in +++ b/codepot/src/codepot/language/korean/Makefile.in @@ -168,6 +168,7 @@ wwwdir = $(WWWDIR)/codepot/language/korean www_DATA = \ code_lang.php \ common_lang.php \ + file_lang.php \ issue_lang.php \ index.html \ project_lang.php \ diff --git a/codepot/src/codepot/language/korean/code_lang.php b/codepot/src/codepot/language/korean/code_lang.php index 25a76bc3..c14f270c 100644 --- a/codepot/src/codepot/language/korean/code_lang.php +++ b/codepot/src/codepot/language/korean/code_lang.php @@ -1,9 +1,7 @@ diff --git a/codepot/src/codepot/language/korean/common_lang.php b/codepot/src/codepot/language/korean/common_lang.php index 484551ea..e8b07fc4 100644 --- a/codepot/src/codepot/language/korean/common_lang.php +++ b/codepot/src/codepot/language/korean/common_lang.php @@ -28,6 +28,7 @@ $lang['Files'] = '파일'; $lang['First'] = '처음'; $lang['Folder'] = '폴더'; $lang['Head revision'] = '최신리비전'; +$lang['Hide details'] = '상세내역숨김'; $lang['History'] = '변경기록'; $lang['Home'] = '홈'; $lang['ID'] = '아이디'; @@ -62,6 +63,7 @@ $lang['Purge'] = '정화하기'; $lang['Repository'] = '저장소'; $lang['Revision'] = '리비전'; $lang['Search'] = '찾기'; +$lang['Show details'] = '상세내역보기'; $lang['Sign in'] = '로그인'; $lang['Sign out'] = '로그아웃'; $lang['Site'] = '사이트'; @@ -91,10 +93,9 @@ $lang['MSG_LOG_REVPROP_CHANGE_BY'] = '리비전 속성 %s을(를) %s이(가) 변 $lang['MSG_NO_DIFF'] = '차이점이 없습니다'; $lang['MSG_NO_CODE_AVAIL'] = '소스코드가 없습니다'; -$lang['MSG_NO_FILES_AVAIL'] = '파일이 없습니다'; -$lang['MSG_NO_ISSUES_AVAIL'] = '이슈항목이 없습니다'; -$lang['MSG_NO_SUCH_FILE'] = '파일이 없습니다'; -$lang['MSG_NO_SUCH_ISSUE'] = '이슈항목이 없습니다'; $lang['MSG_NO_SUCH_PROJECT'] = '프로젝트가 없습니다'; $lang['MSG_SURE_TO_DELETE_THIS'] = '반드시 이것을 삭제하고 싶어요'; + +$lang['MSG_PROJECT_MEMBERSHIP_REQUIRED'] = '이 작업을 수행하려면 %s 프로젝트의 멤버가 되어야 합니다'; + ?> diff --git a/codepot/src/codepot/language/korean/file_lang.php b/codepot/src/codepot/language/korean/file_lang.php new file mode 100644 index 00000000..90c5381f --- /dev/null +++ b/codepot/src/codepot/language/korean/file_lang.php @@ -0,0 +1,5 @@ + diff --git a/codepot/src/codepot/language/korean/issue_lang.php b/codepot/src/codepot/language/korean/issue_lang.php index b6edf72f..7497e6b5 100644 --- a/codepot/src/codepot/language/korean/issue_lang.php +++ b/codepot/src/codepot/language/korean/issue_lang.php @@ -21,5 +21,7 @@ $lang['ISSUE_MSG_CHANGED_X_TO_Z'] = "%s을/를 diff --git a/codepot/src/codepot/language/korean/site_lang.php b/codepot/src/codepot/language/korean/site_lang.php index acb6c354..53a3f3b3 100644 --- a/codepot/src/codepot/language/korean/site_lang.php +++ b/codepot/src/codepot/language/korean/site_lang.php @@ -1,2 +1,4 @@ diff --git a/codepot/src/codepot/language/korean/wiki_lang.php b/codepot/src/codepot/language/korean/wiki_lang.php index f9f290fe..21b4a2dd 100644 --- a/codepot/src/codepot/language/korean/wiki_lang.php +++ b/codepot/src/codepot/language/korean/wiki_lang.php @@ -3,9 +3,11 @@ $lang['WIKI_ATTACHMENTS'] = '첨부파일'; $lang['WIKI_NEW_ATTACHMENTS'] = '새로운 첨부파일'; $lang['WIKI_MORE_NEW_ATTACHMENTS'] = '첨부파일 추가'; -$lang['WIKI_MSG_ATTACHMENT_NAME_NO_COLON'] = '첨부파일이름에 콜론기호가 포함될 수 없습니다'; +$lang['WIKI_MSG_ATTACHMENT_NAME_NO_COLON'] = '첨부파일이름에 콜론기호를 포함할 수 없습니다'; $lang['WIKI_MSG_FAILED_TO_READ_ATTACHMENT'] = '위키 첨부파일을 읽을 수 없습니다 - %s'; -$lang['WIKI_MSG_NO_PAGES_AVAILABLE'] = '위키 페이지가 없습니다'; +$lang['WIKI_MSG_NAME_NO_COLON'] = '위키이름에 콜론기호를 포함할 수 없습니다'; +$lang['WIKI_MSG_NO_PAGES_AVAILABLE'] = '사용할 수 있는 위키 페이지가 없습니다'; $lang['WIKI_MSG_NO_SUCH_PAGE'] = '위키 페이지를 찾을수 없습니다 - %s'; $lang['WIKI_MSG_NO_SUCH_ATTACHMENT'] = '위키 첨부파일을 찾을 수 없습니다 - %s'; +$lang['WIKI_MSG_RESERVED_WIKI_NAME'] = '%s은(는) 사용할 수 없는 위키이름입니다'; ?> diff --git a/codepot/src/codepot/libraries/wikihelper.php b/codepot/src/codepot/libraries/wikihelper.php index 6fbe89e0..6263d14d 100644 --- a/codepot/src/codepot/libraries/wikihelper.php +++ b/codepot/src/codepot/libraries/wikihelper.php @@ -83,6 +83,17 @@ class WikiHelper return FALSE; } + else if ($ex[0] == '__WIKI__') + { + // __WIKI__:projectid:wikiname:attachment + + $link->type = $this->_trans_reserved ($ex[0]); + $link->target = 'attachment0'; + $link->projectid = ($ex[1] == '')? $projectid: $ex[1]; + $link->extra = $converter->AsciiToHex ("{$link->projectid}:{$ex[2]}:{$ex[3]}"); + + return $link; + } } } @@ -91,7 +102,10 @@ class WikiHelper function _trans_reserved ($name) { - return substr (strtolower ($name), 2, strlen($name) - 4); + // trim off leading and trailing double underscores blindly. + // actually it trims off the first and the last two characters + // each. + return substr (strtolower($name), 2, strlen($name) - 4); } function _is_reserved ($name, $exact) diff --git a/codepot/src/codepot/views/code_blame.php b/codepot/src/codepot/views/code_blame.php index f1daafa1..4b8d2dfd 100644 --- a/codepot/src/codepot/views/code_blame.php +++ b/codepot/src/codepot/views/code_blame.php @@ -18,9 +18,9 @@