From 23e1d4f7de49e4a4eaceeb815d35221b6391d8a4 Mon Sep 17 00:00:00 2001 From: Alexander Grebenschikov Date: Sun, 6 Dec 2020 16:52:51 +0000 Subject: [PATCH 1/3] Move index.php out of root directory, init composer --- .eslintignore | 4 +- .gitignore | 1 + .setup/Dockerfile | 2 + .setup/etc/nginx/conf.d/default.conf | 2 +- .setup/local/init.sh | 4 +- bootstrap.php | 37 +++++------------- composer.json | 16 ++++++++ composer.lock | 18 +++++++++ .../memcache_cache_handler.php | 0 .../smartyplugins/block.t.php | 0 .../smartyplugins/function.scripturl.php | 0 .../smartyplugins/modifier.agestring.php | 0 .../smartyplugins/modifier.buglink.php | 0 .../smartyplugins/modifier.highlight.php | 0 package.json | 2 +- {css => public/css}/ext/jquery.qtip.css | 0 {css => public/css}/fix_lineheight.css | 0 {css => public/css}/gitphp.css | 0 {css => public/css}/gitphpskin.css | 0 {css => public/css}/review.css | 0 {css => public/css}/treediff.css | 0 {images => public/images}/Delete.svg | 0 {images => public/images}/File.svg | 0 {images => public/images}/Folder.svg | 0 {images => public/images}/Search.svg | 0 {images => public/images}/arrow-down.svg | 0 {images => public/images}/check.svg | 0 {images => public/images}/codeisok-logo.png | Bin {images => public/images}/favicon.png | Bin {images => public/images}/ic_settings.svg | 0 {images => public/images}/loader.gif | Bin {images => public/images}/login-pattern.png | Bin index.php => public/index.php | 2 +- {js => public/js}/blame.js | 0 {js => public/js}/blame.min.js | 0 {js => public/js}/diff.js | 0 {js => public/js}/ext/jquery-1.4.2.min.js | 0 {js => public/js}/ext/jquery-1.8.2.min.js | 0 {js => public/js}/ext/jquery.cookie.js | 0 {js => public/js}/ext/jquery.qtip.min.js | 0 {js => public/js}/lang.js | 0 {js => public/js}/lang.min.js | 0 {js => public/js}/projectlist.js | 0 {js => public/js}/review.js | 0 {js => public/js}/sbs_review.js | 0 {js => public/js}/session_checker.js | 0 {js => public/js}/suppresseddiff.js | 0 {js => public/js}/tooltips.js | 0 {js => public/js}/tooltips.min.js | 0 {js => public/js}/tree.js | 0 {js => public/js}/utils.js | 0 {lib => public/lib}/mergely/clike.js | 0 {lib => public/lib}/mergely/codemirror.css | 0 {lib => public/lib}/mergely/codemirror.js | 0 {lib => public/lib}/mergely/codemirror.min.js | 0 .../lib}/mergely/codemirror.min.js.orig | 0 {lib => public/lib}/mergely/codemirror.readme | 0 {lib => public/lib}/mergely/mergely.css | 0 {lib => public/lib}/mergely/mergely.js | 0 {lib => public/lib}/mergely/mergely.min.js | 0 {lib => public/lib}/mergely/searchcursor.js | 0 .../lib}/syntaxhighlighter/scripts/XRegExp.js | 0 .../syntaxhighlighter/scripts/shAutoloader.js | 0 .../syntaxhighlighter/scripts/shBrushAS3.js | 0 .../scripts/shBrushAppleScript.js | 0 .../syntaxhighlighter/scripts/shBrushBash.js | 0 .../scripts/shBrushCSharp.js | 0 .../scripts/shBrushColdFusion.js | 0 .../syntaxhighlighter/scripts/shBrushCpp.js | 0 .../syntaxhighlighter/scripts/shBrushCss.js | 0 .../scripts/shBrushDelphi.js | 0 .../syntaxhighlighter/scripts/shBrushDiff.js | 0 .../scripts/shBrushErlang.js | 0 .../scripts/shBrushGolang.js | 0 .../scripts/shBrushGroovy.js | 0 .../scripts/shBrushJScript.js | 0 .../syntaxhighlighter/scripts/shBrushJava.js | 0 .../scripts/shBrushJavaFX.js | 0 .../scripts/shBrushKotlin.js | 0 .../syntaxhighlighter/scripts/shBrushObjC.js | 0 .../syntaxhighlighter/scripts/shBrushPerl.js | 0 .../syntaxhighlighter/scripts/shBrushPhp.js | 0 .../syntaxhighlighter/scripts/shBrushPlain.js | 0 .../scripts/shBrushPowerShell.js | 0 .../scripts/shBrushProtobuf.js | 0 .../scripts/shBrushPython.js | 0 .../syntaxhighlighter/scripts/shBrushRst.js | 0 .../syntaxhighlighter/scripts/shBrushRuby.js | 0 .../syntaxhighlighter/scripts/shBrushSass.js | 0 .../syntaxhighlighter/scripts/shBrushScala.js | 0 .../syntaxhighlighter/scripts/shBrushSql.js | 0 .../syntaxhighlighter/scripts/shBrushVb.js | 0 .../syntaxhighlighter/scripts/shBrushXml.js | 0 .../syntaxhighlighter/scripts/shBrushYaml.js | 0 .../lib}/syntaxhighlighter/scripts/shCore.js | 0 .../syntaxhighlighter/scripts/shLegacy.js | 0 .../lib}/syntaxhighlighter/styles/shCore.css | 0 .../styles/shCoreDefault.css | 0 .../syntaxhighlighter/styles/shCoreDjango.css | 0 .../styles/shCoreEclipse.css | 0 .../syntaxhighlighter/styles/shCoreEmacs.css | 0 .../styles/shCoreFadeToGrey.css | 0 .../styles/shCoreMDUltra.css | 0 .../styles/shCoreMidnight.css | 0 .../syntaxhighlighter/styles/shCoreRDark.css | 0 .../styles/shThemeDefault.css | 0 .../styles/shThemeDjango.css | 0 .../styles/shThemeEclipse.css | 0 .../syntaxhighlighter/styles/shThemeEmacs.css | 0 .../styles/shThemeFadeToGrey.css | 0 .../styles/shThemeMDUltra.css | 0 .../styles/shThemeMidnight.css | 0 .../syntaxhighlighter/styles/shThemeRDark.css | 0 {.include => src}/Acl.php | 0 {.include => src}/Application.php | 0 {.include/cache => src/Cache}/Cache.php | 3 +- {.include/cache => src/Cache}/Memcache.php | 0 {.include => src}/Config.php | 0 .../controller => src/Controller}/Api.php | 0 .../controller => src/Controller}/Base.php | 7 ++-- .../controller => src/Controller}/Blame.php | 2 +- .../controller => src/Controller}/Blob.php | 4 +- .../Controller}/Blobdiff.php | 0 .../Controller}/Branchdiff.php | 0 .../Controller}/CheckSession.php | 0 .../controller => src/Controller}/Comment.php | 0 .../controller => src/Controller}/Commit.php | 0 .../Controller}/Commitdiff.php | 0 .../Controller}/ControllerInterface.php | 0 .../Controller}/DiffBase.php | 0 .../controller => src/Controller}/Feed.php | 0 .../controller => src/Controller}/Git.php | 0 .../Controller}/GitosisAccess.php | 0 .../Controller}/GitosisBase.php | 0 .../Controller}/GitosisRepositories.php | 0 .../Controller}/GitosisUsers.php | 0 .../controller => src/Controller}/Heads.php | 0 .../controller => src/Controller}/History.php | 0 .../controller => src/Controller}/Log.php | 0 .../controller => src/Controller}/Login.php | 0 .../controller => src/Controller}/Logout.php | 0 .../controller => src/Controller}/Message.php | 0 .../controller => src/Controller}/Project.php | 0 .../Controller}/ProjectCreate.php | 0 .../Controller}/ProjectList.php | 0 .../controller => src/Controller}/Review.php | 0 .../controller => src/Controller}/Search.php | 0 .../Controller}/SearchText.php | 0 .../Controller}/Snapshot.php | 0 .../controller => src/Controller}/Tag.php | 0 .../controller => src/Controller}/Tags.php | 0 .../controller => src/Controller}/Tree.php | 0 {.include => src}/Db.php | 0 {.include => src}/Db_Result.php | 0 {.include => src}/Error.php | 0 {.include/git => src/Git}/Archive.php | 0 {.include/git => src/Git}/Blob.php | 0 {.include/git => src/Git}/BranchDiff.php | 0 {.include/git => src/Git}/Commit.php | 0 {.include/git => src/Git}/DiffContext.php | 0 {.include/git => src/Git}/DiffExe.php | 0 {.include/git => src/Git}/DiffHighlighter.php | 0 {.include/git => src/Git}/FileDiff.php | 0 .../git => src/Git}/FilesystemObject.php | 0 {.include/git => src/Git}/GitExe.php | 0 {.include/git => src/Git}/GitObject.php | 0 {.include/git => src/Git}/Head.php | 0 {.include/git => src/Git}/Project.php | 0 {.include/git => src/Git}/ProjectList.php | 0 .../git => src/Git}/ProjectListArray.php | 0 {.include/git => src/Git}/ProjectListBase.php | 0 {.include/git => src/Git}/Ref.php | 0 {.include/git => src/Git}/Tag.php | 0 {.include/git => src/Git}/TmpDir.php | 0 {.include/git => src/Git}/Tree.php | 0 {.include/git => src/Git}/TreeDiff.php | 0 {.include => src}/Gitosis.php | 0 {.include => src}/Http_Response.php | 0 {.include => src}/Jira.php | 0 {.include => src}/JiraRestClient.php | 0 {.include => src}/Log.php | 0 {.include => src}/MessageException.php | 0 {.include => src}/Model_Gitosis.php | 0 {.include => src}/Redmine.php | 0 {.include => src}/RedmineRestClient.php | 0 {.include => src}/Resource.php | 0 {.include => src}/Session.php | 0 {.include => src}/Tracker.php | 0 {.include => src}/User.php | 0 {.include => src}/Util.php | 3 +- 190 files changed, 63 insertions(+), 44 deletions(-) create mode 100644 composer.json create mode 100644 composer.lock rename {.include/cache => helpers}/memcache_cache_handler.php (100%) rename {.include => helpers}/smartyplugins/block.t.php (100%) rename {.include => helpers}/smartyplugins/function.scripturl.php (100%) rename {.include => helpers}/smartyplugins/modifier.agestring.php (100%) rename {.include => helpers}/smartyplugins/modifier.buglink.php (100%) rename {.include => helpers}/smartyplugins/modifier.highlight.php (100%) rename {css => public/css}/ext/jquery.qtip.css (100%) rename {css => public/css}/fix_lineheight.css (100%) rename {css => public/css}/gitphp.css (100%) rename {css => public/css}/gitphpskin.css (100%) rename {css => public/css}/review.css (100%) rename {css => public/css}/treediff.css (100%) rename {images => public/images}/Delete.svg (100%) rename {images => public/images}/File.svg (100%) rename {images => public/images}/Folder.svg (100%) rename {images => public/images}/Search.svg (100%) rename {images => public/images}/arrow-down.svg (100%) rename {images => public/images}/check.svg (100%) rename {images => public/images}/codeisok-logo.png (100%) rename {images => public/images}/favicon.png (100%) rename {images => public/images}/ic_settings.svg (100%) rename {images => public/images}/loader.gif (100%) rename {images => public/images}/login-pattern.png (100%) rename index.php => public/index.php (94%) mode change 100755 => 100644 rename {js => public/js}/blame.js (100%) rename {js => public/js}/blame.min.js (100%) rename {js => public/js}/diff.js (100%) rename {js => public/js}/ext/jquery-1.4.2.min.js (100%) rename {js => public/js}/ext/jquery-1.8.2.min.js (100%) rename {js => public/js}/ext/jquery.cookie.js (100%) rename {js => public/js}/ext/jquery.qtip.min.js (100%) rename {js => public/js}/lang.js (100%) rename {js => public/js}/lang.min.js (100%) rename {js => public/js}/projectlist.js (100%) rename {js => public/js}/review.js (100%) rename {js => public/js}/sbs_review.js (100%) rename {js => public/js}/session_checker.js (100%) rename {js => public/js}/suppresseddiff.js (100%) rename {js => public/js}/tooltips.js (100%) rename {js => public/js}/tooltips.min.js (100%) rename {js => public/js}/tree.js (100%) rename {js => public/js}/utils.js (100%) rename {lib => public/lib}/mergely/clike.js (100%) rename {lib => public/lib}/mergely/codemirror.css (100%) rename {lib => public/lib}/mergely/codemirror.js (100%) rename {lib => public/lib}/mergely/codemirror.min.js (100%) rename {lib => public/lib}/mergely/codemirror.min.js.orig (100%) rename {lib => public/lib}/mergely/codemirror.readme (100%) rename {lib => public/lib}/mergely/mergely.css (100%) rename {lib => public/lib}/mergely/mergely.js (100%) rename {lib => public/lib}/mergely/mergely.min.js (100%) rename {lib => public/lib}/mergely/searchcursor.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/XRegExp.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shAutoloader.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushAS3.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushAppleScript.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushBash.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushCSharp.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushColdFusion.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushCpp.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushCss.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushDelphi.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushDiff.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushErlang.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushGolang.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushGroovy.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushJScript.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushJava.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushJavaFX.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushKotlin.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushObjC.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushPerl.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushPhp.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushPlain.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushPowerShell.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushProtobuf.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushPython.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushRst.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushRuby.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushSass.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushScala.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushSql.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushVb.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushXml.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shBrushYaml.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shCore.js (100%) rename {lib => public/lib}/syntaxhighlighter/scripts/shLegacy.js (100%) rename {lib => public/lib}/syntaxhighlighter/styles/shCore.css (100%) rename {lib => public/lib}/syntaxhighlighter/styles/shCoreDefault.css (100%) rename {lib => public/lib}/syntaxhighlighter/styles/shCoreDjango.css (100%) rename {lib => public/lib}/syntaxhighlighter/styles/shCoreEclipse.css (100%) rename {lib => public/lib}/syntaxhighlighter/styles/shCoreEmacs.css (100%) rename {lib => public/lib}/syntaxhighlighter/styles/shCoreFadeToGrey.css (100%) rename {lib => public/lib}/syntaxhighlighter/styles/shCoreMDUltra.css (100%) rename {lib => public/lib}/syntaxhighlighter/styles/shCoreMidnight.css (100%) rename {lib => public/lib}/syntaxhighlighter/styles/shCoreRDark.css (100%) rename {lib => public/lib}/syntaxhighlighter/styles/shThemeDefault.css (100%) rename {lib => public/lib}/syntaxhighlighter/styles/shThemeDjango.css (100%) rename {lib => public/lib}/syntaxhighlighter/styles/shThemeEclipse.css (100%) rename {lib => public/lib}/syntaxhighlighter/styles/shThemeEmacs.css (100%) rename {lib => public/lib}/syntaxhighlighter/styles/shThemeFadeToGrey.css (100%) rename {lib => public/lib}/syntaxhighlighter/styles/shThemeMDUltra.css (100%) rename {lib => public/lib}/syntaxhighlighter/styles/shThemeMidnight.css (100%) rename {lib => public/lib}/syntaxhighlighter/styles/shThemeRDark.css (100%) rename {.include => src}/Acl.php (100%) rename {.include => src}/Application.php (100%) rename {.include/cache => src/Cache}/Cache.php (97%) rename {.include/cache => src/Cache}/Memcache.php (100%) rename {.include => src}/Config.php (100%) rename {.include/controller => src/Controller}/Api.php (100%) rename {.include/controller => src/Controller}/Base.php (98%) rename {.include/controller => src/Controller}/Blame.php (98%) rename {.include/controller => src/Controller}/Blob.php (98%) rename {.include/controller => src/Controller}/Blobdiff.php (100%) rename {.include/controller => src/Controller}/Branchdiff.php (100%) rename {.include/controller => src/Controller}/CheckSession.php (100%) rename {.include/controller => src/Controller}/Comment.php (100%) rename {.include/controller => src/Controller}/Commit.php (100%) rename {.include/controller => src/Controller}/Commitdiff.php (100%) rename {.include/controller => src/Controller}/ControllerInterface.php (100%) rename {.include/controller => src/Controller}/DiffBase.php (100%) rename {.include/controller => src/Controller}/Feed.php (100%) rename {.include/controller => src/Controller}/Git.php (100%) rename {.include/controller => src/Controller}/GitosisAccess.php (100%) rename {.include/controller => src/Controller}/GitosisBase.php (100%) rename {.include/controller => src/Controller}/GitosisRepositories.php (100%) rename {.include/controller => src/Controller}/GitosisUsers.php (100%) rename {.include/controller => src/Controller}/Heads.php (100%) rename {.include/controller => src/Controller}/History.php (100%) rename {.include/controller => src/Controller}/Log.php (100%) rename {.include/controller => src/Controller}/Login.php (100%) rename {.include/controller => src/Controller}/Logout.php (100%) rename {.include/controller => src/Controller}/Message.php (100%) rename {.include/controller => src/Controller}/Project.php (100%) rename {.include/controller => src/Controller}/ProjectCreate.php (100%) rename {.include/controller => src/Controller}/ProjectList.php (100%) rename {.include/controller => src/Controller}/Review.php (100%) rename {.include/controller => src/Controller}/Search.php (100%) rename {.include/controller => src/Controller}/SearchText.php (100%) rename {.include/controller => src/Controller}/Snapshot.php (100%) rename {.include/controller => src/Controller}/Tag.php (100%) rename {.include/controller => src/Controller}/Tags.php (100%) rename {.include/controller => src/Controller}/Tree.php (100%) rename {.include => src}/Db.php (100%) rename {.include => src}/Db_Result.php (100%) rename {.include => src}/Error.php (100%) rename {.include/git => src/Git}/Archive.php (100%) rename {.include/git => src/Git}/Blob.php (100%) rename {.include/git => src/Git}/BranchDiff.php (100%) rename {.include/git => src/Git}/Commit.php (100%) rename {.include/git => src/Git}/DiffContext.php (100%) rename {.include/git => src/Git}/DiffExe.php (100%) rename {.include/git => src/Git}/DiffHighlighter.php (100%) rename {.include/git => src/Git}/FileDiff.php (100%) rename {.include/git => src/Git}/FilesystemObject.php (100%) rename {.include/git => src/Git}/GitExe.php (100%) rename {.include/git => src/Git}/GitObject.php (100%) rename {.include/git => src/Git}/Head.php (100%) rename {.include/git => src/Git}/Project.php (100%) rename {.include/git => src/Git}/ProjectList.php (100%) rename {.include/git => src/Git}/ProjectListArray.php (100%) rename {.include/git => src/Git}/ProjectListBase.php (100%) rename {.include/git => src/Git}/Ref.php (100%) rename {.include/git => src/Git}/Tag.php (100%) rename {.include/git => src/Git}/TmpDir.php (100%) rename {.include/git => src/Git}/Tree.php (100%) rename {.include/git => src/Git}/TreeDiff.php (100%) rename {.include => src}/Gitosis.php (100%) rename {.include => src}/Http_Response.php (100%) rename {.include => src}/Jira.php (100%) rename {.include => src}/JiraRestClient.php (100%) rename {.include => src}/Log.php (100%) rename {.include => src}/MessageException.php (100%) rename {.include => src}/Model_Gitosis.php (100%) rename {.include => src}/Redmine.php (100%) rename {.include => src}/RedmineRestClient.php (100%) rename {.include => src}/Resource.php (100%) rename {.include => src}/Session.php (100%) rename {.include => src}/Tracker.php (100%) rename {.include => src}/User.php (100%) rename {.include => src}/Util.php (99%) diff --git a/.eslintignore b/.eslintignore index 7a52a13..0c16ca5 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,2 @@ -lib/ -js/ext/ +public/lib/ +public/js/ext/ diff --git a/.gitignore b/.gitignore index f12b73e..6bbb747 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ php_errors.log update_cache.lock node_modules .vscode +vendor/ \ No newline at end of file diff --git a/.setup/Dockerfile b/.setup/Dockerfile index 2adac3a..78f6ed8 100644 --- a/.setup/Dockerfile +++ b/.setup/Dockerfile @@ -44,6 +44,8 @@ RUN mkdir -pv /local/logs COPY etc/ /etc/ COPY local/ /local/ +COPY --from=composer /usr/bin/composer /usr/bin/composer + VOLUME /var/lib/mysql VOLUME /home/git VOLUME /local/codeisok diff --git a/.setup/etc/nginx/conf.d/default.conf b/.setup/etc/nginx/conf.d/default.conf index 2d78344..49f5e32 100644 --- a/.setup/etc/nginx/conf.d/default.conf +++ b/.setup/etc/nginx/conf.d/default.conf @@ -5,7 +5,7 @@ server { # Make site accessible from http://localhost/ server_name localhost; - root /local/codeisok/; + root /local/codeisok/public; index index.php; error_log /local/logs/codeisok.error.log error; diff --git a/.setup/local/init.sh b/.setup/local/init.sh index d8ab9a1..49efa69 100644 --- a/.setup/local/init.sh +++ b/.setup/local/init.sh @@ -31,10 +31,12 @@ localhost=$(head -n 1 /etc/hosts | awk '{print $2}') echo "127.0.0.1 $localhost $localhost.localdomain $hostname $hostname.localdomain" >> /etc/hosts service sendmail start +composer install -d /local/codeisok + if [ -t 1 ]; then # Interactive mode, stdout is terminal service nginx start bash else nginx -g 'daemon off;' -fi +fi \ No newline at end of file diff --git a/bootstrap.php b/bootstrap.php index 20b944a..0680b23 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -1,33 +1,14 @@ 1 && $namespaces[0] == GITPHP_BASE_NS) { - $file_name = array_pop($namespaces) . ".php"; - unset($namespaces[0]); - - $file_name = GITPHP_INCLUDEDIR . join(DIRECTORY_SEPARATOR, array_map('strtolower', $namespaces)) . DIRECTORY_SEPARATOR . $file_name; - if (file_exists($file_name)) { - require_once $file_name; - } - } - } -); +const GITPHP_BASEDIR = __DIR__ . '/'; +const GITPHP_CONFIGDIR = GITPHP_BASEDIR . '.config/'; +const GITPHP_LOCALEDIR = GITPHP_BASEDIR . '.locale/'; +const GITPHP_TEMPLATESDIR = GITPHP_BASEDIR . '.templates/'; +const GITPHP_TEMPLATESCACHEDIR = GITPHP_BASEDIR . 'templates_c/'; +const GITPHP_CSSDIR = GITPHP_BASEDIR . 'public/css/'; +const GITPHP_JSDIR = GITPHP_BASEDIR . 'public/js/'; +const GITPHP_LIBDIR = GITPHP_BASEDIR . 'public/lib/'; class CountClass { diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..dba71ed --- /dev/null +++ b/composer.json @@ -0,0 +1,16 @@ +{ + "name": "badoo/codeisok", + "description": "Git code browsing and code review tool", + "type": "project", + "license": "GPL-3.0", + "autoload": { + "psr-4": { + "GitPHP\\": "src/" + }, + "files": [ + "helpers/memcache_cache_handler.php" + ] + }, + "minimum-stability": "dev", + "require": {} +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..dbdcd6e --- /dev/null +++ b/composer.lock @@ -0,0 +1,18 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "701d914591fb768c1b42a67e23c9b616", + "packages": [], + "packages-dev": [], + "aliases": [], + "minimum-stability": "dev", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "plugin-api-version": "2.0.0" +} diff --git a/.include/cache/memcache_cache_handler.php b/helpers/memcache_cache_handler.php similarity index 100% rename from .include/cache/memcache_cache_handler.php rename to helpers/memcache_cache_handler.php diff --git a/.include/smartyplugins/block.t.php b/helpers/smartyplugins/block.t.php similarity index 100% rename from .include/smartyplugins/block.t.php rename to helpers/smartyplugins/block.t.php diff --git a/.include/smartyplugins/function.scripturl.php b/helpers/smartyplugins/function.scripturl.php similarity index 100% rename from .include/smartyplugins/function.scripturl.php rename to helpers/smartyplugins/function.scripturl.php diff --git a/.include/smartyplugins/modifier.agestring.php b/helpers/smartyplugins/modifier.agestring.php similarity index 100% rename from .include/smartyplugins/modifier.agestring.php rename to helpers/smartyplugins/modifier.agestring.php diff --git a/.include/smartyplugins/modifier.buglink.php b/helpers/smartyplugins/modifier.buglink.php similarity index 100% rename from .include/smartyplugins/modifier.buglink.php rename to helpers/smartyplugins/modifier.buglink.php diff --git a/.include/smartyplugins/modifier.highlight.php b/helpers/smartyplugins/modifier.highlight.php similarity index 100% rename from .include/smartyplugins/modifier.highlight.php rename to helpers/smartyplugins/modifier.highlight.php diff --git a/package.json b/package.json index 5b1312e..7b48899 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "description": "Git code browsing and code review tool", "directories": { - "lib": "lib" + "lib": "public/lib" }, "scripts": { "lint": "eslint .", diff --git a/css/ext/jquery.qtip.css b/public/css/ext/jquery.qtip.css similarity index 100% rename from css/ext/jquery.qtip.css rename to public/css/ext/jquery.qtip.css diff --git a/css/fix_lineheight.css b/public/css/fix_lineheight.css similarity index 100% rename from css/fix_lineheight.css rename to public/css/fix_lineheight.css diff --git a/css/gitphp.css b/public/css/gitphp.css similarity index 100% rename from css/gitphp.css rename to public/css/gitphp.css diff --git a/css/gitphpskin.css b/public/css/gitphpskin.css similarity index 100% rename from css/gitphpskin.css rename to public/css/gitphpskin.css diff --git a/css/review.css b/public/css/review.css similarity index 100% rename from css/review.css rename to public/css/review.css diff --git a/css/treediff.css b/public/css/treediff.css similarity index 100% rename from css/treediff.css rename to public/css/treediff.css diff --git a/images/Delete.svg b/public/images/Delete.svg similarity index 100% rename from images/Delete.svg rename to public/images/Delete.svg diff --git a/images/File.svg b/public/images/File.svg similarity index 100% rename from images/File.svg rename to public/images/File.svg diff --git a/images/Folder.svg b/public/images/Folder.svg similarity index 100% rename from images/Folder.svg rename to public/images/Folder.svg diff --git a/images/Search.svg b/public/images/Search.svg similarity index 100% rename from images/Search.svg rename to public/images/Search.svg diff --git a/images/arrow-down.svg b/public/images/arrow-down.svg similarity index 100% rename from images/arrow-down.svg rename to public/images/arrow-down.svg diff --git a/images/check.svg b/public/images/check.svg similarity index 100% rename from images/check.svg rename to public/images/check.svg diff --git a/images/codeisok-logo.png b/public/images/codeisok-logo.png similarity index 100% rename from images/codeisok-logo.png rename to public/images/codeisok-logo.png diff --git a/images/favicon.png b/public/images/favicon.png similarity index 100% rename from images/favicon.png rename to public/images/favicon.png diff --git a/images/ic_settings.svg b/public/images/ic_settings.svg similarity index 100% rename from images/ic_settings.svg rename to public/images/ic_settings.svg diff --git a/images/loader.gif b/public/images/loader.gif similarity index 100% rename from images/loader.gif rename to public/images/loader.gif diff --git a/images/login-pattern.png b/public/images/login-pattern.png similarity index 100% rename from images/login-pattern.png rename to public/images/login-pattern.png diff --git a/index.php b/public/index.php old mode 100755 new mode 100644 similarity index 94% rename from index.php rename to public/index.php index f7920f7..229a172 --- a/index.php +++ b/public/index.php @@ -3,7 +3,7 @@ define('GITPHP_START_TIME', microtime(true)); define('GITPHP_START_MEM', memory_get_usage()); -require_once __DIR__ . '/bootstrap.php'; +require_once __DIR__ . '/../bootstrap.php'; define('DO_NOT_USE_ERROR_HANDLER', 1); diff --git a/js/blame.js b/public/js/blame.js similarity index 100% rename from js/blame.js rename to public/js/blame.js diff --git a/js/blame.min.js b/public/js/blame.min.js similarity index 100% rename from js/blame.min.js rename to public/js/blame.min.js diff --git a/js/diff.js b/public/js/diff.js similarity index 100% rename from js/diff.js rename to public/js/diff.js diff --git a/js/ext/jquery-1.4.2.min.js b/public/js/ext/jquery-1.4.2.min.js similarity index 100% rename from js/ext/jquery-1.4.2.min.js rename to public/js/ext/jquery-1.4.2.min.js diff --git a/js/ext/jquery-1.8.2.min.js b/public/js/ext/jquery-1.8.2.min.js similarity index 100% rename from js/ext/jquery-1.8.2.min.js rename to public/js/ext/jquery-1.8.2.min.js diff --git a/js/ext/jquery.cookie.js b/public/js/ext/jquery.cookie.js similarity index 100% rename from js/ext/jquery.cookie.js rename to public/js/ext/jquery.cookie.js diff --git a/js/ext/jquery.qtip.min.js b/public/js/ext/jquery.qtip.min.js similarity index 100% rename from js/ext/jquery.qtip.min.js rename to public/js/ext/jquery.qtip.min.js diff --git a/js/lang.js b/public/js/lang.js similarity index 100% rename from js/lang.js rename to public/js/lang.js diff --git a/js/lang.min.js b/public/js/lang.min.js similarity index 100% rename from js/lang.min.js rename to public/js/lang.min.js diff --git a/js/projectlist.js b/public/js/projectlist.js similarity index 100% rename from js/projectlist.js rename to public/js/projectlist.js diff --git a/js/review.js b/public/js/review.js similarity index 100% rename from js/review.js rename to public/js/review.js diff --git a/js/sbs_review.js b/public/js/sbs_review.js similarity index 100% rename from js/sbs_review.js rename to public/js/sbs_review.js diff --git a/js/session_checker.js b/public/js/session_checker.js similarity index 100% rename from js/session_checker.js rename to public/js/session_checker.js diff --git a/js/suppresseddiff.js b/public/js/suppresseddiff.js similarity index 100% rename from js/suppresseddiff.js rename to public/js/suppresseddiff.js diff --git a/js/tooltips.js b/public/js/tooltips.js similarity index 100% rename from js/tooltips.js rename to public/js/tooltips.js diff --git a/js/tooltips.min.js b/public/js/tooltips.min.js similarity index 100% rename from js/tooltips.min.js rename to public/js/tooltips.min.js diff --git a/js/tree.js b/public/js/tree.js similarity index 100% rename from js/tree.js rename to public/js/tree.js diff --git a/js/utils.js b/public/js/utils.js similarity index 100% rename from js/utils.js rename to public/js/utils.js diff --git a/lib/mergely/clike.js b/public/lib/mergely/clike.js similarity index 100% rename from lib/mergely/clike.js rename to public/lib/mergely/clike.js diff --git a/lib/mergely/codemirror.css b/public/lib/mergely/codemirror.css similarity index 100% rename from lib/mergely/codemirror.css rename to public/lib/mergely/codemirror.css diff --git a/lib/mergely/codemirror.js b/public/lib/mergely/codemirror.js similarity index 100% rename from lib/mergely/codemirror.js rename to public/lib/mergely/codemirror.js diff --git a/lib/mergely/codemirror.min.js b/public/lib/mergely/codemirror.min.js similarity index 100% rename from lib/mergely/codemirror.min.js rename to public/lib/mergely/codemirror.min.js diff --git a/lib/mergely/codemirror.min.js.orig b/public/lib/mergely/codemirror.min.js.orig similarity index 100% rename from lib/mergely/codemirror.min.js.orig rename to public/lib/mergely/codemirror.min.js.orig diff --git a/lib/mergely/codemirror.readme b/public/lib/mergely/codemirror.readme similarity index 100% rename from lib/mergely/codemirror.readme rename to public/lib/mergely/codemirror.readme diff --git a/lib/mergely/mergely.css b/public/lib/mergely/mergely.css similarity index 100% rename from lib/mergely/mergely.css rename to public/lib/mergely/mergely.css diff --git a/lib/mergely/mergely.js b/public/lib/mergely/mergely.js similarity index 100% rename from lib/mergely/mergely.js rename to public/lib/mergely/mergely.js diff --git a/lib/mergely/mergely.min.js b/public/lib/mergely/mergely.min.js similarity index 100% rename from lib/mergely/mergely.min.js rename to public/lib/mergely/mergely.min.js diff --git a/lib/mergely/searchcursor.js b/public/lib/mergely/searchcursor.js similarity index 100% rename from lib/mergely/searchcursor.js rename to public/lib/mergely/searchcursor.js diff --git a/lib/syntaxhighlighter/scripts/XRegExp.js b/public/lib/syntaxhighlighter/scripts/XRegExp.js similarity index 100% rename from lib/syntaxhighlighter/scripts/XRegExp.js rename to public/lib/syntaxhighlighter/scripts/XRegExp.js diff --git a/lib/syntaxhighlighter/scripts/shAutoloader.js b/public/lib/syntaxhighlighter/scripts/shAutoloader.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shAutoloader.js rename to public/lib/syntaxhighlighter/scripts/shAutoloader.js diff --git a/lib/syntaxhighlighter/scripts/shBrushAS3.js b/public/lib/syntaxhighlighter/scripts/shBrushAS3.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushAS3.js rename to public/lib/syntaxhighlighter/scripts/shBrushAS3.js diff --git a/lib/syntaxhighlighter/scripts/shBrushAppleScript.js b/public/lib/syntaxhighlighter/scripts/shBrushAppleScript.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushAppleScript.js rename to public/lib/syntaxhighlighter/scripts/shBrushAppleScript.js diff --git a/lib/syntaxhighlighter/scripts/shBrushBash.js b/public/lib/syntaxhighlighter/scripts/shBrushBash.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushBash.js rename to public/lib/syntaxhighlighter/scripts/shBrushBash.js diff --git a/lib/syntaxhighlighter/scripts/shBrushCSharp.js b/public/lib/syntaxhighlighter/scripts/shBrushCSharp.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushCSharp.js rename to public/lib/syntaxhighlighter/scripts/shBrushCSharp.js diff --git a/lib/syntaxhighlighter/scripts/shBrushColdFusion.js b/public/lib/syntaxhighlighter/scripts/shBrushColdFusion.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushColdFusion.js rename to public/lib/syntaxhighlighter/scripts/shBrushColdFusion.js diff --git a/lib/syntaxhighlighter/scripts/shBrushCpp.js b/public/lib/syntaxhighlighter/scripts/shBrushCpp.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushCpp.js rename to public/lib/syntaxhighlighter/scripts/shBrushCpp.js diff --git a/lib/syntaxhighlighter/scripts/shBrushCss.js b/public/lib/syntaxhighlighter/scripts/shBrushCss.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushCss.js rename to public/lib/syntaxhighlighter/scripts/shBrushCss.js diff --git a/lib/syntaxhighlighter/scripts/shBrushDelphi.js b/public/lib/syntaxhighlighter/scripts/shBrushDelphi.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushDelphi.js rename to public/lib/syntaxhighlighter/scripts/shBrushDelphi.js diff --git a/lib/syntaxhighlighter/scripts/shBrushDiff.js b/public/lib/syntaxhighlighter/scripts/shBrushDiff.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushDiff.js rename to public/lib/syntaxhighlighter/scripts/shBrushDiff.js diff --git a/lib/syntaxhighlighter/scripts/shBrushErlang.js b/public/lib/syntaxhighlighter/scripts/shBrushErlang.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushErlang.js rename to public/lib/syntaxhighlighter/scripts/shBrushErlang.js diff --git a/lib/syntaxhighlighter/scripts/shBrushGolang.js b/public/lib/syntaxhighlighter/scripts/shBrushGolang.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushGolang.js rename to public/lib/syntaxhighlighter/scripts/shBrushGolang.js diff --git a/lib/syntaxhighlighter/scripts/shBrushGroovy.js b/public/lib/syntaxhighlighter/scripts/shBrushGroovy.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushGroovy.js rename to public/lib/syntaxhighlighter/scripts/shBrushGroovy.js diff --git a/lib/syntaxhighlighter/scripts/shBrushJScript.js b/public/lib/syntaxhighlighter/scripts/shBrushJScript.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushJScript.js rename to public/lib/syntaxhighlighter/scripts/shBrushJScript.js diff --git a/lib/syntaxhighlighter/scripts/shBrushJava.js b/public/lib/syntaxhighlighter/scripts/shBrushJava.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushJava.js rename to public/lib/syntaxhighlighter/scripts/shBrushJava.js diff --git a/lib/syntaxhighlighter/scripts/shBrushJavaFX.js b/public/lib/syntaxhighlighter/scripts/shBrushJavaFX.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushJavaFX.js rename to public/lib/syntaxhighlighter/scripts/shBrushJavaFX.js diff --git a/lib/syntaxhighlighter/scripts/shBrushKotlin.js b/public/lib/syntaxhighlighter/scripts/shBrushKotlin.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushKotlin.js rename to public/lib/syntaxhighlighter/scripts/shBrushKotlin.js diff --git a/lib/syntaxhighlighter/scripts/shBrushObjC.js b/public/lib/syntaxhighlighter/scripts/shBrushObjC.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushObjC.js rename to public/lib/syntaxhighlighter/scripts/shBrushObjC.js diff --git a/lib/syntaxhighlighter/scripts/shBrushPerl.js b/public/lib/syntaxhighlighter/scripts/shBrushPerl.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushPerl.js rename to public/lib/syntaxhighlighter/scripts/shBrushPerl.js diff --git a/lib/syntaxhighlighter/scripts/shBrushPhp.js b/public/lib/syntaxhighlighter/scripts/shBrushPhp.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushPhp.js rename to public/lib/syntaxhighlighter/scripts/shBrushPhp.js diff --git a/lib/syntaxhighlighter/scripts/shBrushPlain.js b/public/lib/syntaxhighlighter/scripts/shBrushPlain.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushPlain.js rename to public/lib/syntaxhighlighter/scripts/shBrushPlain.js diff --git a/lib/syntaxhighlighter/scripts/shBrushPowerShell.js b/public/lib/syntaxhighlighter/scripts/shBrushPowerShell.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushPowerShell.js rename to public/lib/syntaxhighlighter/scripts/shBrushPowerShell.js diff --git a/lib/syntaxhighlighter/scripts/shBrushProtobuf.js b/public/lib/syntaxhighlighter/scripts/shBrushProtobuf.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushProtobuf.js rename to public/lib/syntaxhighlighter/scripts/shBrushProtobuf.js diff --git a/lib/syntaxhighlighter/scripts/shBrushPython.js b/public/lib/syntaxhighlighter/scripts/shBrushPython.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushPython.js rename to public/lib/syntaxhighlighter/scripts/shBrushPython.js diff --git a/lib/syntaxhighlighter/scripts/shBrushRst.js b/public/lib/syntaxhighlighter/scripts/shBrushRst.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushRst.js rename to public/lib/syntaxhighlighter/scripts/shBrushRst.js diff --git a/lib/syntaxhighlighter/scripts/shBrushRuby.js b/public/lib/syntaxhighlighter/scripts/shBrushRuby.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushRuby.js rename to public/lib/syntaxhighlighter/scripts/shBrushRuby.js diff --git a/lib/syntaxhighlighter/scripts/shBrushSass.js b/public/lib/syntaxhighlighter/scripts/shBrushSass.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushSass.js rename to public/lib/syntaxhighlighter/scripts/shBrushSass.js diff --git a/lib/syntaxhighlighter/scripts/shBrushScala.js b/public/lib/syntaxhighlighter/scripts/shBrushScala.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushScala.js rename to public/lib/syntaxhighlighter/scripts/shBrushScala.js diff --git a/lib/syntaxhighlighter/scripts/shBrushSql.js b/public/lib/syntaxhighlighter/scripts/shBrushSql.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushSql.js rename to public/lib/syntaxhighlighter/scripts/shBrushSql.js diff --git a/lib/syntaxhighlighter/scripts/shBrushVb.js b/public/lib/syntaxhighlighter/scripts/shBrushVb.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushVb.js rename to public/lib/syntaxhighlighter/scripts/shBrushVb.js diff --git a/lib/syntaxhighlighter/scripts/shBrushXml.js b/public/lib/syntaxhighlighter/scripts/shBrushXml.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushXml.js rename to public/lib/syntaxhighlighter/scripts/shBrushXml.js diff --git a/lib/syntaxhighlighter/scripts/shBrushYaml.js b/public/lib/syntaxhighlighter/scripts/shBrushYaml.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shBrushYaml.js rename to public/lib/syntaxhighlighter/scripts/shBrushYaml.js diff --git a/lib/syntaxhighlighter/scripts/shCore.js b/public/lib/syntaxhighlighter/scripts/shCore.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shCore.js rename to public/lib/syntaxhighlighter/scripts/shCore.js diff --git a/lib/syntaxhighlighter/scripts/shLegacy.js b/public/lib/syntaxhighlighter/scripts/shLegacy.js similarity index 100% rename from lib/syntaxhighlighter/scripts/shLegacy.js rename to public/lib/syntaxhighlighter/scripts/shLegacy.js diff --git a/lib/syntaxhighlighter/styles/shCore.css b/public/lib/syntaxhighlighter/styles/shCore.css similarity index 100% rename from lib/syntaxhighlighter/styles/shCore.css rename to public/lib/syntaxhighlighter/styles/shCore.css diff --git a/lib/syntaxhighlighter/styles/shCoreDefault.css b/public/lib/syntaxhighlighter/styles/shCoreDefault.css similarity index 100% rename from lib/syntaxhighlighter/styles/shCoreDefault.css rename to public/lib/syntaxhighlighter/styles/shCoreDefault.css diff --git a/lib/syntaxhighlighter/styles/shCoreDjango.css b/public/lib/syntaxhighlighter/styles/shCoreDjango.css similarity index 100% rename from lib/syntaxhighlighter/styles/shCoreDjango.css rename to public/lib/syntaxhighlighter/styles/shCoreDjango.css diff --git a/lib/syntaxhighlighter/styles/shCoreEclipse.css b/public/lib/syntaxhighlighter/styles/shCoreEclipse.css similarity index 100% rename from lib/syntaxhighlighter/styles/shCoreEclipse.css rename to public/lib/syntaxhighlighter/styles/shCoreEclipse.css diff --git a/lib/syntaxhighlighter/styles/shCoreEmacs.css b/public/lib/syntaxhighlighter/styles/shCoreEmacs.css similarity index 100% rename from lib/syntaxhighlighter/styles/shCoreEmacs.css rename to public/lib/syntaxhighlighter/styles/shCoreEmacs.css diff --git a/lib/syntaxhighlighter/styles/shCoreFadeToGrey.css b/public/lib/syntaxhighlighter/styles/shCoreFadeToGrey.css similarity index 100% rename from lib/syntaxhighlighter/styles/shCoreFadeToGrey.css rename to public/lib/syntaxhighlighter/styles/shCoreFadeToGrey.css diff --git a/lib/syntaxhighlighter/styles/shCoreMDUltra.css b/public/lib/syntaxhighlighter/styles/shCoreMDUltra.css similarity index 100% rename from lib/syntaxhighlighter/styles/shCoreMDUltra.css rename to public/lib/syntaxhighlighter/styles/shCoreMDUltra.css diff --git a/lib/syntaxhighlighter/styles/shCoreMidnight.css b/public/lib/syntaxhighlighter/styles/shCoreMidnight.css similarity index 100% rename from lib/syntaxhighlighter/styles/shCoreMidnight.css rename to public/lib/syntaxhighlighter/styles/shCoreMidnight.css diff --git a/lib/syntaxhighlighter/styles/shCoreRDark.css b/public/lib/syntaxhighlighter/styles/shCoreRDark.css similarity index 100% rename from lib/syntaxhighlighter/styles/shCoreRDark.css rename to public/lib/syntaxhighlighter/styles/shCoreRDark.css diff --git a/lib/syntaxhighlighter/styles/shThemeDefault.css b/public/lib/syntaxhighlighter/styles/shThemeDefault.css similarity index 100% rename from lib/syntaxhighlighter/styles/shThemeDefault.css rename to public/lib/syntaxhighlighter/styles/shThemeDefault.css diff --git a/lib/syntaxhighlighter/styles/shThemeDjango.css b/public/lib/syntaxhighlighter/styles/shThemeDjango.css similarity index 100% rename from lib/syntaxhighlighter/styles/shThemeDjango.css rename to public/lib/syntaxhighlighter/styles/shThemeDjango.css diff --git a/lib/syntaxhighlighter/styles/shThemeEclipse.css b/public/lib/syntaxhighlighter/styles/shThemeEclipse.css similarity index 100% rename from lib/syntaxhighlighter/styles/shThemeEclipse.css rename to public/lib/syntaxhighlighter/styles/shThemeEclipse.css diff --git a/lib/syntaxhighlighter/styles/shThemeEmacs.css b/public/lib/syntaxhighlighter/styles/shThemeEmacs.css similarity index 100% rename from lib/syntaxhighlighter/styles/shThemeEmacs.css rename to public/lib/syntaxhighlighter/styles/shThemeEmacs.css diff --git a/lib/syntaxhighlighter/styles/shThemeFadeToGrey.css b/public/lib/syntaxhighlighter/styles/shThemeFadeToGrey.css similarity index 100% rename from lib/syntaxhighlighter/styles/shThemeFadeToGrey.css rename to public/lib/syntaxhighlighter/styles/shThemeFadeToGrey.css diff --git a/lib/syntaxhighlighter/styles/shThemeMDUltra.css b/public/lib/syntaxhighlighter/styles/shThemeMDUltra.css similarity index 100% rename from lib/syntaxhighlighter/styles/shThemeMDUltra.css rename to public/lib/syntaxhighlighter/styles/shThemeMDUltra.css diff --git a/lib/syntaxhighlighter/styles/shThemeMidnight.css b/public/lib/syntaxhighlighter/styles/shThemeMidnight.css similarity index 100% rename from lib/syntaxhighlighter/styles/shThemeMidnight.css rename to public/lib/syntaxhighlighter/styles/shThemeMidnight.css diff --git a/lib/syntaxhighlighter/styles/shThemeRDark.css b/public/lib/syntaxhighlighter/styles/shThemeRDark.css similarity index 100% rename from lib/syntaxhighlighter/styles/shThemeRDark.css rename to public/lib/syntaxhighlighter/styles/shThemeRDark.css diff --git a/.include/Acl.php b/src/Acl.php similarity index 100% rename from .include/Acl.php rename to src/Acl.php diff --git a/.include/Application.php b/src/Application.php similarity index 100% rename from .include/Application.php rename to src/Application.php diff --git a/.include/cache/Cache.php b/src/Cache/Cache.php similarity index 97% rename from .include/cache/Cache.php rename to src/Cache/Cache.php index 1ed4055..86cd9e0 100755 --- a/.include/cache/Cache.php +++ b/src/Cache/Cache.php @@ -224,6 +224,7 @@ private function CreateSmarty() $this->tpl = new \Smarty; $this->tpl->template_dir = GITPHP_TEMPLATESDIR; + $this->tpl->compile_dir = GITPHP_TEMPLATESCACHEDIR; $this->tpl->caching = 2; @@ -231,9 +232,7 @@ private function CreateSmarty() $servers = \GitPHP\Config::GetInstance()->GetValue('memcache', null); if (isset($servers) && is_array($servers) && (count($servers) > 0)) { - require_once(GITPHP_CACHEDIR . 'Memcache.php'); \GitPHP\Cache\Memcache::GetInstance()->AddServers($servers); - require_once(GITPHP_CACHEDIR . 'memcache_cache_handler.php'); $this->tpl->cache_handler_func = 'memcache_cache_handler'; } diff --git a/.include/cache/Memcache.php b/src/Cache/Memcache.php similarity index 100% rename from .include/cache/Memcache.php rename to src/Cache/Memcache.php diff --git a/.include/Config.php b/src/Config.php similarity index 100% rename from .include/Config.php rename to src/Config.php diff --git a/.include/controller/Api.php b/src/Controller/Api.php similarity index 100% rename from .include/controller/Api.php rename to src/Controller/Api.php diff --git a/.include/controller/Base.php b/src/Controller/Base.php similarity index 98% rename from .include/controller/Base.php rename to src/Controller/Base.php index 434b592..b55bbb1 100755 --- a/.include/controller/Base.php +++ b/src/Controller/Base.php @@ -56,11 +56,12 @@ abstract class Base implements ControllerInterface public function __construct($project = null) { \GitPHP\Log::GetInstance()->timerStart(); - require_once(\GitPHP\Util::AddSlash(\GitPHP\Config::GetInstance()->GetValue('smarty_prefix', 'lib/smarty/libs/')) . 'Smarty.class.php'); + require_once(\GitPHP\Util::AddSlash(\GitPHP\Config::GetInstance()->GetValue('smarty_prefix', GITPHP_BASEDIR . 'lib/smarty/libs/')) . 'Smarty.class.php'); \GitPHP\Log::GetInstance()->timerStop('require Smarty.class.php'); $this->tpl = new \Smarty; - $this->tpl->plugins_dir[] = GITPHP_INCLUDEDIR . 'smartyplugins'; + $this->tpl->plugins_dir[] = GITPHP_BASEDIR . 'helpers/smartyplugins'; $this->tpl->template_dir = GITPHP_TEMPLATESDIR; + $this->tpl->compile_dir = GITPHP_TEMPLATESCACHEDIR; if (\GitPHP\Config::GetInstance()->GetValue('debug', false)) { $this->tpl->error_reporting = E_ALL; @@ -74,9 +75,7 @@ public function __construct($project = null) $servers = \GitPHP\Config::GetInstance()->GetValue('memcache', null); if (isset($servers) && is_array($servers) && (count($servers) > 0)) { - require_once(GITPHP_CACHEDIR . 'Memcache.php'); \GitPHP\Cache\Memcache::GetInstance()->AddServers($servers); - require_once(GITPHP_CACHEDIR . 'memcache_cache_handler.php'); $this->tpl->cache_handler_func = 'memcache_cache_handler'; } } diff --git a/.include/controller/Blame.php b/src/Controller/Blame.php similarity index 98% rename from .include/controller/Blame.php rename to src/Controller/Blame.php index 4952260..c387431 100755 --- a/.include/controller/Blame.php +++ b/src/Controller/Blame.php @@ -111,7 +111,7 @@ protected function LoadData() $this->tpl->assign('tree', $commit->GetTree()); if (\GitPHP\Config::GetInstance()->GetValue('geshi', true)) { - include_once(\GitPHP\Util::AddSlash(\GitPHP\Config::GetInstance()->GetValue('geshiroot', 'lib/geshi/')) . "geshi.php"); + include_once(\GitPHP\Util::AddSlash(\GitPHP\Config::GetInstance()->GetValue('geshiroot', GITPHP_BASEDIR . 'lib/geshi/')) . "geshi.php"); if (class_exists('GeSHi')) { $geshi = new \GeSHi("", 'php'); if ($geshi) { diff --git a/.include/controller/Blob.php b/src/Controller/Blob.php similarity index 98% rename from .include/controller/Blob.php rename to src/Controller/Blob.php index 0d21e0f..b523f01 100755 --- a/.include/controller/Blob.php +++ b/src/Controller/Blob.php @@ -126,7 +126,7 @@ protected function checkGeshi() { $result = false; if (\GitPHP\Config::GetInstance()->GetValue('geshi', true)) { - include_once(\GitPHP\Util::AddSlash(\GitPHP\Config::GetInstance()->GetValue('geshiroot', 'lib/geshi/')) . "geshi.php"); + include_once(\GitPHP\Util::AddSlash(\GitPHP\Config::GetInstance()->GetValue('geshiroot', GITPHP_BASEDIR . 'lib/geshi/')) . "geshi.php"); if (class_exists('GeSHi')) { $result = true; } @@ -240,7 +240,7 @@ protected function LoadData() switch ($this->params['hi']) { case 'sexy': - include_once('lib/syntaxhighlighter/syntaxhighlighter.php'); + include_once(GITPHP_BASEDIR . 'lib/syntaxhighlighter/syntaxhighlighter.php'); $SH = new \SyntaxHighlighter($blob->GetName()); $this->tpl->assign('sexy', 1); $this->tpl->assign('extracss_files', $SH->getCssList()); diff --git a/.include/controller/Blobdiff.php b/src/Controller/Blobdiff.php similarity index 100% rename from .include/controller/Blobdiff.php rename to src/Controller/Blobdiff.php diff --git a/.include/controller/Branchdiff.php b/src/Controller/Branchdiff.php similarity index 100% rename from .include/controller/Branchdiff.php rename to src/Controller/Branchdiff.php diff --git a/.include/controller/CheckSession.php b/src/Controller/CheckSession.php similarity index 100% rename from .include/controller/CheckSession.php rename to src/Controller/CheckSession.php diff --git a/.include/controller/Comment.php b/src/Controller/Comment.php similarity index 100% rename from .include/controller/Comment.php rename to src/Controller/Comment.php diff --git a/.include/controller/Commit.php b/src/Controller/Commit.php similarity index 100% rename from .include/controller/Commit.php rename to src/Controller/Commit.php diff --git a/.include/controller/Commitdiff.php b/src/Controller/Commitdiff.php similarity index 100% rename from .include/controller/Commitdiff.php rename to src/Controller/Commitdiff.php diff --git a/.include/controller/ControllerInterface.php b/src/Controller/ControllerInterface.php similarity index 100% rename from .include/controller/ControllerInterface.php rename to src/Controller/ControllerInterface.php diff --git a/.include/controller/DiffBase.php b/src/Controller/DiffBase.php similarity index 100% rename from .include/controller/DiffBase.php rename to src/Controller/DiffBase.php diff --git a/.include/controller/Feed.php b/src/Controller/Feed.php similarity index 100% rename from .include/controller/Feed.php rename to src/Controller/Feed.php diff --git a/.include/controller/Git.php b/src/Controller/Git.php similarity index 100% rename from .include/controller/Git.php rename to src/Controller/Git.php diff --git a/.include/controller/GitosisAccess.php b/src/Controller/GitosisAccess.php similarity index 100% rename from .include/controller/GitosisAccess.php rename to src/Controller/GitosisAccess.php diff --git a/.include/controller/GitosisBase.php b/src/Controller/GitosisBase.php similarity index 100% rename from .include/controller/GitosisBase.php rename to src/Controller/GitosisBase.php diff --git a/.include/controller/GitosisRepositories.php b/src/Controller/GitosisRepositories.php similarity index 100% rename from .include/controller/GitosisRepositories.php rename to src/Controller/GitosisRepositories.php diff --git a/.include/controller/GitosisUsers.php b/src/Controller/GitosisUsers.php similarity index 100% rename from .include/controller/GitosisUsers.php rename to src/Controller/GitosisUsers.php diff --git a/.include/controller/Heads.php b/src/Controller/Heads.php similarity index 100% rename from .include/controller/Heads.php rename to src/Controller/Heads.php diff --git a/.include/controller/History.php b/src/Controller/History.php similarity index 100% rename from .include/controller/History.php rename to src/Controller/History.php diff --git a/.include/controller/Log.php b/src/Controller/Log.php similarity index 100% rename from .include/controller/Log.php rename to src/Controller/Log.php diff --git a/.include/controller/Login.php b/src/Controller/Login.php similarity index 100% rename from .include/controller/Login.php rename to src/Controller/Login.php diff --git a/.include/controller/Logout.php b/src/Controller/Logout.php similarity index 100% rename from .include/controller/Logout.php rename to src/Controller/Logout.php diff --git a/.include/controller/Message.php b/src/Controller/Message.php similarity index 100% rename from .include/controller/Message.php rename to src/Controller/Message.php diff --git a/.include/controller/Project.php b/src/Controller/Project.php similarity index 100% rename from .include/controller/Project.php rename to src/Controller/Project.php diff --git a/.include/controller/ProjectCreate.php b/src/Controller/ProjectCreate.php similarity index 100% rename from .include/controller/ProjectCreate.php rename to src/Controller/ProjectCreate.php diff --git a/.include/controller/ProjectList.php b/src/Controller/ProjectList.php similarity index 100% rename from .include/controller/ProjectList.php rename to src/Controller/ProjectList.php diff --git a/.include/controller/Review.php b/src/Controller/Review.php similarity index 100% rename from .include/controller/Review.php rename to src/Controller/Review.php diff --git a/.include/controller/Search.php b/src/Controller/Search.php similarity index 100% rename from .include/controller/Search.php rename to src/Controller/Search.php diff --git a/.include/controller/SearchText.php b/src/Controller/SearchText.php similarity index 100% rename from .include/controller/SearchText.php rename to src/Controller/SearchText.php diff --git a/.include/controller/Snapshot.php b/src/Controller/Snapshot.php similarity index 100% rename from .include/controller/Snapshot.php rename to src/Controller/Snapshot.php diff --git a/.include/controller/Tag.php b/src/Controller/Tag.php similarity index 100% rename from .include/controller/Tag.php rename to src/Controller/Tag.php diff --git a/.include/controller/Tags.php b/src/Controller/Tags.php similarity index 100% rename from .include/controller/Tags.php rename to src/Controller/Tags.php diff --git a/.include/controller/Tree.php b/src/Controller/Tree.php similarity index 100% rename from .include/controller/Tree.php rename to src/Controller/Tree.php diff --git a/.include/Db.php b/src/Db.php similarity index 100% rename from .include/Db.php rename to src/Db.php diff --git a/.include/Db_Result.php b/src/Db_Result.php similarity index 100% rename from .include/Db_Result.php rename to src/Db_Result.php diff --git a/.include/Error.php b/src/Error.php similarity index 100% rename from .include/Error.php rename to src/Error.php diff --git a/.include/git/Archive.php b/src/Git/Archive.php similarity index 100% rename from .include/git/Archive.php rename to src/Git/Archive.php diff --git a/.include/git/Blob.php b/src/Git/Blob.php similarity index 100% rename from .include/git/Blob.php rename to src/Git/Blob.php diff --git a/.include/git/BranchDiff.php b/src/Git/BranchDiff.php similarity index 100% rename from .include/git/BranchDiff.php rename to src/Git/BranchDiff.php diff --git a/.include/git/Commit.php b/src/Git/Commit.php similarity index 100% rename from .include/git/Commit.php rename to src/Git/Commit.php diff --git a/.include/git/DiffContext.php b/src/Git/DiffContext.php similarity index 100% rename from .include/git/DiffContext.php rename to src/Git/DiffContext.php diff --git a/.include/git/DiffExe.php b/src/Git/DiffExe.php similarity index 100% rename from .include/git/DiffExe.php rename to src/Git/DiffExe.php diff --git a/.include/git/DiffHighlighter.php b/src/Git/DiffHighlighter.php similarity index 100% rename from .include/git/DiffHighlighter.php rename to src/Git/DiffHighlighter.php diff --git a/.include/git/FileDiff.php b/src/Git/FileDiff.php similarity index 100% rename from .include/git/FileDiff.php rename to src/Git/FileDiff.php diff --git a/.include/git/FilesystemObject.php b/src/Git/FilesystemObject.php similarity index 100% rename from .include/git/FilesystemObject.php rename to src/Git/FilesystemObject.php diff --git a/.include/git/GitExe.php b/src/Git/GitExe.php similarity index 100% rename from .include/git/GitExe.php rename to src/Git/GitExe.php diff --git a/.include/git/GitObject.php b/src/Git/GitObject.php similarity index 100% rename from .include/git/GitObject.php rename to src/Git/GitObject.php diff --git a/.include/git/Head.php b/src/Git/Head.php similarity index 100% rename from .include/git/Head.php rename to src/Git/Head.php diff --git a/.include/git/Project.php b/src/Git/Project.php similarity index 100% rename from .include/git/Project.php rename to src/Git/Project.php diff --git a/.include/git/ProjectList.php b/src/Git/ProjectList.php similarity index 100% rename from .include/git/ProjectList.php rename to src/Git/ProjectList.php diff --git a/.include/git/ProjectListArray.php b/src/Git/ProjectListArray.php similarity index 100% rename from .include/git/ProjectListArray.php rename to src/Git/ProjectListArray.php diff --git a/.include/git/ProjectListBase.php b/src/Git/ProjectListBase.php similarity index 100% rename from .include/git/ProjectListBase.php rename to src/Git/ProjectListBase.php diff --git a/.include/git/Ref.php b/src/Git/Ref.php similarity index 100% rename from .include/git/Ref.php rename to src/Git/Ref.php diff --git a/.include/git/Tag.php b/src/Git/Tag.php similarity index 100% rename from .include/git/Tag.php rename to src/Git/Tag.php diff --git a/.include/git/TmpDir.php b/src/Git/TmpDir.php similarity index 100% rename from .include/git/TmpDir.php rename to src/Git/TmpDir.php diff --git a/.include/git/Tree.php b/src/Git/Tree.php similarity index 100% rename from .include/git/Tree.php rename to src/Git/Tree.php diff --git a/.include/git/TreeDiff.php b/src/Git/TreeDiff.php similarity index 100% rename from .include/git/TreeDiff.php rename to src/Git/TreeDiff.php diff --git a/.include/Gitosis.php b/src/Gitosis.php similarity index 100% rename from .include/Gitosis.php rename to src/Gitosis.php diff --git a/.include/Http_Response.php b/src/Http_Response.php similarity index 100% rename from .include/Http_Response.php rename to src/Http_Response.php diff --git a/.include/Jira.php b/src/Jira.php similarity index 100% rename from .include/Jira.php rename to src/Jira.php diff --git a/.include/JiraRestClient.php b/src/JiraRestClient.php similarity index 100% rename from .include/JiraRestClient.php rename to src/JiraRestClient.php diff --git a/.include/Log.php b/src/Log.php similarity index 100% rename from .include/Log.php rename to src/Log.php diff --git a/.include/MessageException.php b/src/MessageException.php similarity index 100% rename from .include/MessageException.php rename to src/MessageException.php diff --git a/.include/Model_Gitosis.php b/src/Model_Gitosis.php similarity index 100% rename from .include/Model_Gitosis.php rename to src/Model_Gitosis.php diff --git a/.include/Redmine.php b/src/Redmine.php similarity index 100% rename from .include/Redmine.php rename to src/Redmine.php diff --git a/.include/RedmineRestClient.php b/src/RedmineRestClient.php similarity index 100% rename from .include/RedmineRestClient.php rename to src/RedmineRestClient.php diff --git a/.include/Resource.php b/src/Resource.php similarity index 100% rename from .include/Resource.php rename to src/Resource.php diff --git a/.include/Session.php b/src/Session.php similarity index 100% rename from .include/Session.php rename to src/Session.php diff --git a/.include/Tracker.php b/src/Tracker.php similarity index 100% rename from .include/Tracker.php rename to src/Tracker.php diff --git a/.include/User.php b/src/User.php similarity index 100% rename from .include/User.php rename to src/User.php diff --git a/.include/Util.php b/src/Util.php similarity index 99% rename from .include/Util.php rename to src/Util.php index 5a7b686..dfd9b53 100644 --- a/.include/Util.php +++ b/src/Util.php @@ -176,8 +176,9 @@ public static function insertCommentsToDiffs($comments, $format, &$comments_auth $template = 'review.redmine.tpl'; } $View = new \Smarty; - $View->plugins_dir[] = GITPHP_INCLUDEDIR . 'smartyplugins'; + $View->plugins_dir[] = GITPHP_BASEDIR . 'helpers/smartyplugins'; $View->template_dir = GITPHP_TEMPLATESDIR; + $View->compile_dir = GITPHP_TEMPLATESCACHEDIR; $View->assign($vars_data); $diff = $View->fetch($template); From 507b0dc4b6c2eb03c7b175bbc5c41cefcfbf0f34 Mon Sep 17 00:00:00 2001 From: Alexander Grebenschikov Date: Sun, 6 Dec 2020 17:41:19 +0000 Subject: [PATCH 2/3] Get rid of defines and includes --- composer.json | 4 +- helpers/memcache_cache_handler.php | 2 +- public/index.php | 2 - src/Application.php | 4 +- src/Controller/Branchdiff.php | 2 +- src/Controller/Commitdiff.php | 2 +- src/Controller/DiffBase.php | 63 +++++++++++++++--------------- src/Controller/Feed.php | 30 +++++++------- src/Controller/Git.php | 2 +- src/Controller/Search.php | 30 +++++++------- src/Git/Archive.php | 2 +- src/Git/Blob.php | 10 ++--- src/Git/BranchDiff.php | 16 ++++---- src/Git/Commit.php | 8 ++-- src/Git/FileDiff.php | 6 +-- src/Git/GitExe.php | 42 ++++++++++---------- src/Git/Project.php | 28 ++++++------- src/Git/Ref.php | 2 +- src/Git/Tag.php | 8 ++-- src/Git/Tree.php | 2 +- src/Git/TreeDiff.php | 2 +- src/Resource.php | 3 -- 22 files changed, 133 insertions(+), 137 deletions(-) diff --git a/composer.json b/composer.json index dba71ed..4c45096 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,9 @@ "GitPHP\\": "src/" }, "files": [ - "helpers/memcache_cache_handler.php" + "helpers/memcache_cache_handler.php", + "lib/php-gettext/streams.php", + "lib/php-gettext/gettext.php" ] }, "minimum-stability": "dev", diff --git a/helpers/memcache_cache_handler.php b/helpers/memcache_cache_handler.php index 569480e..940ad59 100755 --- a/helpers/memcache_cache_handler.php +++ b/helpers/memcache_cache_handler.php @@ -14,7 +14,7 @@ /** * Cache key for the cache contents / age map array */ -define('MEMCACHE_OBJECT_MAP', 'memcache_objectmap'); +const MEMCACHE_OBJECT_MAP = 'memcache_objectmap'; /** * memcache cache handler function diff --git a/public/index.php b/public/index.php index 229a172..2d9da09 100644 --- a/public/index.php +++ b/public/index.php @@ -5,8 +5,6 @@ require_once __DIR__ . '/../bootstrap.php'; -define('DO_NOT_USE_ERROR_HANDLER', 1); - $Application = new \GitPHP\Application(); \GitPHP\Log::GetInstance()->timerStart(); diff --git a/src/Application.php b/src/Application.php index 0f647e4..9eab356 100644 --- a/src/Application.php +++ b/src/Application.php @@ -287,8 +287,8 @@ protected function getOldController($action) case 'atom': case 'rss': $controller = new \GitPHP\Controller\Feed(); - if ($action == 'rss') $controller->SetParam('format', GITPHP_FEED_FORMAT_RSS); - else if ($action == 'atom') $controller->SetParam('format', GITPHP_FEED_FORMAT_ATOM); + if ($action == 'rss') $controller->SetParam('format', \GitPHP\Controller\Feed::GITPHP_FEED_FORMAT_RSS); + else if ($action == 'atom') $controller->SetParam('format', \GitPHP\Controller\Feed::GITPHP_FEED_FORMAT_ATOM); break; case 'commit': diff --git a/src/Controller/Branchdiff.php b/src/Controller/Branchdiff.php index 892d3a9..8757fd4 100644 --- a/src/Controller/Branchdiff.php +++ b/src/Controller/Branchdiff.php @@ -189,7 +189,7 @@ protected function LoadData() } if (empty($this->params['sidebyside'])) { - include_once(\GitPHP\Util::AddSlash('lib/syntaxhighlighter') . "syntaxhighlighter.php"); + include_once(\GitPHP\Util::AddSlash(GITPHP_BASEDIR . 'lib/syntaxhighlighter') . "syntaxhighlighter.php"); $this->tpl->assign('sexy', 1); $this->tpl->assign('highlighter_no_ruler', 1); $this->tpl->assign('highlighter_diff_enabled', 1); diff --git a/src/Controller/Commitdiff.php b/src/Controller/Commitdiff.php index a3f4de5..811bb32 100755 --- a/src/Controller/Commitdiff.php +++ b/src/Controller/Commitdiff.php @@ -142,7 +142,7 @@ protected function LoadData() $this->loadReviewsLinks($co, implode('', $co->GetComment())); if (empty($this->params['sidebyside'])) { - include_once(\GitPHP\Util::AddSlash('lib/syntaxhighlighter') . "syntaxhighlighter.php"); + include_once(\GitPHP\Util::AddSlash(GITPHP_BASEDIR . 'lib/syntaxhighlighter') . "syntaxhighlighter.php"); $this->tpl->assign('sexy', 1); $this->tpl->assign('highlighter_no_ruler', 1); $this->tpl->assign('highlighter_diff_enabled', 1); diff --git a/src/Controller/DiffBase.php b/src/Controller/DiffBase.php index bf88f2e..2c3c361 100755 --- a/src/Controller/DiffBase.php +++ b/src/Controller/DiffBase.php @@ -12,25 +12,6 @@ * @subpackage Controller */ - -/** - * Constants for diff modes - */ -define('GITPHP_DIFF_UNIFIED', '1'); -define('GITPHP_DIFF_SIDEBYSIDE', '2'); - -/** - * Constant of the diff mode cookie in the user's browser - */ -define('GITPHP_DIFF_MODE_COOKIE', 'GitPHPDiffMode'); -define('GITPHP_TREEDIFF_ENABLED_COOKIE', 'GitPHPTreeDiffEnabled'); - -/** - * Diff mode cookie lifetime - */ -define('GITPHP_DIFF_MODE_COOKIE_LIFETIME', 60 * 60 * 24 * 365); // 1 year -define('GITPHP_TREEDIFF_ENABLED_COOKIE_LIFETIME', 60 * 60 * 24 * 365); // 1 year - /** * DiffBase controller class * @@ -39,6 +20,24 @@ */ abstract class DiffBase extends Base { + /** + * Constants for diff modes + */ + const GITPHP_DIFF_UNIFIED = '1'; + const GITPHP_DIFF_SIDEBYSIDE = '2'; + + /** + * Constant of the diff mode cookie in the user's browser + */ + const GITPHP_DIFF_MODE_COOKIE = 'GitPHPDiffMode'; + const GITPHP_TREEDIFF_ENABLED_COOKIE = 'GitPHPTreeDiffEnabled'; + + /** + * Diff mode cookie lifetime + */ + const GITPHP_DIFF_MODE_COOKIE_LIFETIME = 60 * 60 * 24 * 365; // 1 year + const GITPHP_TREEDIFF_ENABLED_COOKIE_LIFETIME = 60 * 60 * 24 * 365; // 1 year + /** * ReadQuery * @@ -51,7 +50,7 @@ protected function ReadQuery() if (!isset($this->params['plain']) || $this->params['plain'] != true) { $diffcookie = $this->DiffMode(isset($_GET['o']) ? $_GET['o'] : ''); - if ($diffcookie === GITPHP_DIFF_SIDEBYSIDE) { + if ($diffcookie === self::GITPHP_DIFF_SIDEBYSIDE) { $this->params['sidebyside'] = true; } else { $this->params['unified'] = true; @@ -77,18 +76,18 @@ protected function TreeDiffEnabled($overrideMode = null) { /* * Check cookie */ - if (!empty($_COOKIE[GITPHP_TREEDIFF_ENABLED_COOKIE])) { - $enabled = $_COOKIE[GITPHP_TREEDIFF_ENABLED_COOKIE] === '1'; + if (!empty($_COOKIE[self::GITPHP_TREEDIFF_ENABLED_COOKIE])) { + $enabled = $_COOKIE[self::GITPHP_TREEDIFF_ENABLED_COOKIE] === '1'; } else { /* * Create cookie to prevent browser delay */ - setcookie(GITPHP_TREEDIFF_ENABLED_COOKIE, $enabled ? '1' : '0', time() + GITPHP_TREEDIFF_ENABLED_COOKIE_LIFETIME); + setcookie(self::GITPHP_TREEDIFF_ENABLED_COOKIE, $enabled ? '1' : '0', time() + self::GITPHP_TREEDIFF_ENABLED_COOKIE_LIFETIME); } if ($overrideMode !== null) { $enabled = $overrideMode === '1'; - setcookie(GITPHP_TREEDIFF_ENABLED_COOKIE, $overrideMode, time() + GITPHP_TREEDIFF_ENABLED_COOKIE_LIFETIME); + setcookie(self::GITPHP_TREEDIFF_ENABLED_COOKIE, $overrideMode, time() + self::GITPHP_TREEDIFF_ENABLED_COOKIE_LIFETIME); } return $enabled; @@ -105,18 +104,18 @@ protected function TreeDiffEnabled($overrideMode = null) { */ protected function DiffMode($overrideMode = '') { - $mode = GITPHP_DIFF_UNIFIED; // default + $mode = self::GITPHP_DIFF_UNIFIED; // default /* * Check cookie */ - if (!empty($_COOKIE[GITPHP_DIFF_MODE_COOKIE])) { - $mode = $_COOKIE[GITPHP_DIFF_MODE_COOKIE]; + if (!empty($_COOKIE[self::GITPHP_DIFF_MODE_COOKIE])) { + $mode = $_COOKIE[self::GITPHP_DIFF_MODE_COOKIE]; } else { /* * Create cookie to prevent browser delay */ - setcookie(GITPHP_DIFF_MODE_COOKIE, $mode, time() + GITPHP_DIFF_MODE_COOKIE_LIFETIME); + setcookie(self::GITPHP_DIFF_MODE_COOKIE, $mode, time() + self::GITPHP_DIFF_MODE_COOKIE_LIFETIME); } if (!empty($overrideMode)) { @@ -124,11 +123,11 @@ protected function DiffMode($overrideMode = '') * User is choosing a new mode */ if ($overrideMode == 'sidebyside') { - $mode = GITPHP_DIFF_SIDEBYSIDE; - setcookie(GITPHP_DIFF_MODE_COOKIE, GITPHP_DIFF_SIDEBYSIDE, time() + GITPHP_DIFF_MODE_COOKIE_LIFETIME); + $mode = self::GITPHP_DIFF_SIDEBYSIDE; + setcookie(self::GITPHP_DIFF_MODE_COOKIE, self::GITPHP_DIFF_SIDEBYSIDE, time() + self::GITPHP_DIFF_MODE_COOKIE_LIFETIME); } else { - $mode = GITPHP_DIFF_UNIFIED; - setcookie(GITPHP_DIFF_MODE_COOKIE, GITPHP_DIFF_UNIFIED, time() + GITPHP_DIFF_MODE_COOKIE_LIFETIME); + $mode = self::GITPHP_DIFF_UNIFIED; + setcookie(self::GITPHP_DIFF_MODE_COOKIE, self::GITPHP_DIFF_UNIFIED, time() + self::GITPHP_DIFF_MODE_COOKIE_LIFETIME); } } diff --git a/src/Controller/Feed.php b/src/Controller/Feed.php index e678ced..8d05e26 100755 --- a/src/Controller/Feed.php +++ b/src/Controller/Feed.php @@ -1,14 +1,6 @@ params['format'] == GITPHP_FEED_FORMAT_RSS) { + if ($this->params['format'] == self::GITPHP_FEED_FORMAT_RSS) { return 'rss.tpl'; - } else if ($this->params['format'] == GITPHP_FEED_FORMAT_ATOM) { + } else if ($this->params['format'] == self::GITPHP_FEED_FORMAT_ATOM) { return 'atom.tpl'; } else { return null; @@ -68,13 +68,13 @@ protected function GetCacheKey() */ public function GetName($local = false) { - if ($this->params['format'] == GITPHP_FEED_FORMAT_RSS) { + if ($this->params['format'] == self::GITPHP_FEED_FORMAT_RSS) { if ($local) { return __('rss'); } else { return 'rss'; } - } else if ($this->params['format'] == GITPHP_FEED_FORMAT_ATOM) { + } else if ($this->params['format'] == self::GITPHP_FEED_FORMAT_ATOM) { if ($local) { return __('atom'); } else { @@ -109,9 +109,9 @@ protected function LoadHeaders() throw new \Exception('A feed format is required'); } - if ($this->params['format'] == GITPHP_FEED_FORMAT_RSS) { + if ($this->params['format'] == self::GITPHP_FEED_FORMAT_RSS) { $this->headers[] = "Content-type: text/xml; charset=UTF-8"; - } else if ($this->params['format'] == GITPHP_FEED_FORMAT_ATOM) { + } else if ($this->params['format'] == self::GITPHP_FEED_FORMAT_ATOM) { $this->headers[] = "Content-type: application/atom+xml; charset=UTF-8"; } } @@ -125,7 +125,7 @@ protected function LoadHeaders() */ protected function LoadData() { - $log = $this->project->GetLog('HEAD', GITPHP_FEED_ITEMS); + $log = $this->project->GetLog('HEAD', self::GITPHP_FEED_ITEMS); $entries = count($log); diff --git a/src/Controller/Git.php b/src/Controller/Git.php index 0a18b7f..49bf9a2 100644 --- a/src/Controller/Git.php +++ b/src/Controller/Git.php @@ -189,7 +189,7 @@ protected function loadOnelineLog() if ($no_merges) { array_unshift($args, '--no-merges'); } - $log = $exe->Execute(GIT_LOG, $args); + $log = $exe->Execute(\GitPHP\Git\GitExe::GIT_LOG, $args); } $this->tpl->assign('result', $log); } diff --git a/src/Controller/Search.php b/src/Controller/Search.php index 20a8550..426cbe6 100755 --- a/src/Controller/Search.php +++ b/src/Controller/Search.php @@ -1,14 +1,6 @@ GetValue('search', true)) { @@ -40,7 +40,7 @@ public function __construct() */ protected function GetTemplate() { - if ($this->params['searchtype'] == GITPHP_SEARCH_FILE) { + if ($this->params['searchtype'] == self::GITPHP_SEARCH_FILE) { return 'searchfiles.tpl'; } return 'search.tpl'; @@ -85,9 +85,9 @@ public function GetName($local = false) */ protected function ReadQuery() { - if (!isset($this->params['searchtype'])) $this->params['searchtype'] = GITPHP_SEARCH_COMMIT; + if (!isset($this->params['searchtype'])) $this->params['searchtype'] = self::GITPHP_SEARCH_COMMIT; - if ($this->params['searchtype'] == GITPHP_SEARCH_FILE) { + if ($this->params['searchtype'] == self::GITPHP_SEARCH_FILE) { if (!\GitPHP\Config::GetInstance()->GetValue('filesearch', true)) { throw new \GitPHP\MessageException(__('File search has been disabled'), true); } @@ -124,19 +124,19 @@ protected function LoadData() $results = array(); if ($co) { switch ($this->params['searchtype']) { - case GITPHP_SEARCH_COMMIT: + case self::GITPHP_SEARCH_COMMIT: $results = $this->project->SearchCommit($this->params['search'], $co->GetHash(), 101, ($this->params['page'] * 100)); break; - case GITPHP_SEARCH_AUTHOR: + case self::GITPHP_SEARCH_AUTHOR: $results = $this->project->SearchAuthor($this->params['search'], $co->GetHash(), 101, ($this->params['page'] * 100)); break; - case GITPHP_SEARCH_COMMITTER: + case self::GITPHP_SEARCH_COMMITTER: $results = $this->project->SearchCommitter($this->params['search'], $co->GetHash(), 101, ($this->params['page'] * 100)); break; - case GITPHP_SEARCH_FILE: + case self::GITPHP_SEARCH_FILE: $results = $co->SearchFiles($this->params['search'], 101, ($this->params['page'] * 100)); break; diff --git a/src/Git/Archive.php b/src/Git/Archive.php index f232c5e..bfbfc82 100755 --- a/src/Git/Archive.php +++ b/src/Git/Archive.php @@ -335,7 +335,7 @@ public function GetData() if (!empty($this->path)) $args[] = $this->path; - $data = $exe->Execute(GIT_ARCHIVE, $args); + $data = $exe->Execute(GitExe::GIT_ARCHIVE, $args); unset($exe); switch ($this->format) { diff --git a/src/Git/Blob.php b/src/Git/Blob.php index fba3d7a..6edffaf 100755 --- a/src/Git/Blob.php +++ b/src/Git/Blob.php @@ -74,7 +74,7 @@ public static function getBlobHash($Project, $commit_hash, $file_name) $commit_hash = escapeshellarg($commit_hash); $file_name = escapeshellarg($file_name); - $file_info = $exe->Execute(GIT_LS_TREE, ["$commit_hash -- $file_name"]); + $file_info = $exe->Execute(GitExe::GIT_LS_TREE, ["$commit_hash -- $file_name"]); if (!empty($file_info)) { $file_info = explode(' ', $file_info); return explode("\t", $file_info[2])[0]; @@ -132,7 +132,7 @@ private function ReadData() $args[] = 'blob'; $args[] = $this->hash; - $this->data = $exe->Execute(GIT_CAT_FILE, $args); + $this->data = $exe->Execute(GitExe::GIT_CAT_FILE, $args); \GitPHP\Cache\Cache::GetInstance()->Set($this->GetCacheKey(), $this); } @@ -381,13 +381,13 @@ private function ReadHistory() $args[] = '|'; $args[] = $exe->GetBinary(); $args[] = '--git-dir=' . $this->GetProject()->GetPath(); - $args[] = GIT_DIFF_TREE; + $args[] = GitExe::GIT_DIFF_TREE; $args[] = '-r'; $args[] = '--stdin'; $args[] = '--'; $args[] = $this->GetPath(); - $historylines = explode("\n", $exe->Execute(GIT_REV_LIST, $args)); + $historylines = explode("\n", $exe->Execute(GitExe::GIT_REV_LIST, $args)); $commit = null; foreach ($historylines as $line) { @@ -440,7 +440,7 @@ private function ReadBlame() $args[] = '--'; $args[] = $this->GetPath(); - $blamelines = explode("\n", $exe->Execute(GIT_BLAME, $args)); + $blamelines = explode("\n", $exe->Execute(GitExe::GIT_BLAME, $args)); $lastcommit = ''; foreach ($blamelines as $line) { diff --git a/src/Git/BranchDiff.php b/src/Git/BranchDiff.php index 1713eaa..003f2ef 100644 --- a/src/Git/BranchDiff.php +++ b/src/Git/BranchDiff.php @@ -99,9 +99,9 @@ public function setFromHash($fromHash) public function getBaseHash() { if (empty($this->toHash)) { - $this->toHash = trim($this->exe->Execute(GIT_REV_PARSE, array($this->toBranch))); + $this->toHash = trim($this->exe->Execute(GitExe::GIT_REV_PARSE, array($this->toBranch))); } - $diff_base_hash = trim($this->exe->Execute(GIT_MERGE_BASE, array($this->fromBranch, $this->toHash))); + $diff_base_hash = trim($this->exe->Execute(GitExe::GIT_MERGE_BASE, array($this->fromBranch, $this->toHash))); if ($this->toHash != $diff_base_hash) { $args = array( @@ -109,7 +109,7 @@ public function getBaseHash() '--format="%s"', $diff_base_hash, ); - $diff_base_message = trim($this->exe->Execute(GIT_LOG, $args)); + $diff_base_message = trim($this->exe->Execute(GitExe::GIT_LOG, $args)); $ticket = $this->toBranch; if (preg_match('#([A-Z]+\-[0-9]+)#', $this->toBranch, $m)) { @@ -128,7 +128,7 @@ public function getBaseHash() '--first-parent', "{$this->toHash}..{$this->fromBranch}", ]; - $history = trim($this->exe->Execute(GIT_REV_LIST, $args)); + $history = trim($this->exe->Execute(GitExe::GIT_REV_LIST, $args)); if (empty($history)) { // it might be so that we won't be able to get history with --first-parent // if there is "brother" commit for merge commit that we're looking for @@ -137,7 +137,7 @@ public function getBaseHash() '--parents', "{$this->toHash}..{$this->fromBranch}", ]; - $history = trim($this->exe->Execute(GIT_REV_LIST, $args)); + $history = trim($this->exe->Execute(GitExe::GIT_REV_LIST, $args)); } $history = array_reverse(explode(PHP_EOL, $history)); $look_for = $this->toHash; @@ -155,7 +155,7 @@ public function getBaseHash() } if (!isset($base_commit)) return $diff_base_hash; - $diff_base_hash = trim($this->exe->Execute(GIT_MERGE_BASE, array($base_commit, $this->toHash))); + $diff_base_hash = trim($this->exe->Execute(GitExe::GIT_MERGE_BASE, array($base_commit, $this->toHash))); return $diff_base_hash; } @@ -173,7 +173,7 @@ private function ReadData() $this->fileDiffs = array(); if (empty($this->toHash)) { - $this->toHash = trim($this->exe->Execute(GIT_REV_PARSE, array($this->toBranch))); + $this->toHash = trim($this->exe->Execute(GitExe::GIT_REV_PARSE, array($this->toBranch))); } if (empty($this->fromHash)) { $this->fromHash = $this->getBaseHash(); @@ -187,7 +187,7 @@ private function ReadData() $args[] = $this->toHash; $hide_files_per_category = \GitPHP\Config::GetInstance()->GetValue(\GitPHP\Config::HIDE_FILES_PER_CATEGORY, []); - $diffBranchLines = explode("\n", $this->exe->Execute(GIT_DIFF_TREE, $args)); + $diffBranchLines = explode("\n", $this->exe->Execute(GitExe::GIT_DIFF_TREE, $args)); foreach ($diffBranchLines as $line) { $trimmed = trim($line); if ((strlen($trimmed) > 0) && (substr_compare($trimmed, ':', 0, 1) === 0)) { diff --git a/src/Git/Commit.php b/src/Git/Commit.php index 362b58c..f371ad0 100755 --- a/src/Git/Commit.php +++ b/src/Git/Commit.php @@ -484,7 +484,7 @@ public function ReadData($external_contents = null) $args[] = '--parents'; $args[] = '--max-count=1'; $args[] = $this->hash; - $ret = $exe->Execute(GIT_REV_LIST, $args); + $ret = $exe->Execute(GitExe::GIT_REV_LIST, $args); unset($exe); $lines = explode("\n", $ret); @@ -609,7 +609,7 @@ public function ReadContainingTag() $args = array(); $args[] = '--tags'; $args[] = $this->hash; - $revs = explode("\n", $exe->Execute(GIT_NAME_REV, $args)); + $revs = explode("\n", $exe->Execute(GitExe::GIT_NAME_REV, $args)); foreach ($revs as $revline) { if (preg_match('/^([0-9a-fA-F]{40})\s+tags\/(.+)(\^[0-9]+|\~[0-9]+)$/', $revline, $regs)) { @@ -685,7 +685,7 @@ private function ReadHashPaths() $args[] = '-t'; $args[] = $this->hash; - $lines = explode("\n", $exe->Execute(GIT_LS_TREE, $args)); + $lines = explode("\n", $exe->Execute(GitExe::GIT_LS_TREE, $args)); foreach ($lines as $line) { if (preg_match("/^([0-9]+) (.+) ([0-9a-fA-F]{40})\t(.+)$/", $line, $regs)) { @@ -770,7 +770,7 @@ public function SearchFileContents($pattern) $args[] = escapeshellarg($pattern); $args[] = $this->hash; - $lines = explode("\n", $exe->Execute(GIT_GREP, $args)); + $lines = explode("\n", $exe->Execute(GitExe::GIT_GREP, $args)); $results = array(); diff --git a/src/Git/FileDiff.php b/src/Git/FileDiff.php index 3993987..aab95f3 100755 --- a/src/Git/FileDiff.php +++ b/src/Git/FileDiff.php @@ -616,7 +616,7 @@ public function GetDiff($file = '', $readFileData = true, $explode = false, $hig $args[] = escapeshellarg($this->fromFile); } $Git = new \GitPHP\Git\GitExe($this->project); - $diff = trim($Git->Execute(GIT_DIFF, $args)); + $diff = trim($Git->Execute(GitExe::GIT_DIFF, $args)); $this->diffData = substr($diff, strpos($diff, '---')); } else if (!$this->DiffContext->getIgnoreFormatting() && !empty($this->toHashOriginal)) { $args = array(); @@ -644,7 +644,7 @@ public function GetDiff($file = '', $readFileData = true, $explode = false, $hig $args[] = escapeshellarg($this->fromFile); } $Git = new \GitPHP\Git\GitExe($this->project); - $diff = trim($Git->Execute(GIT_SHOW, $args)); + $diff = trim($Git->Execute(GitExe::GIT_SHOW, $args)); $this->diffData = substr($diff, strpos($diff, '---')); } else { $tmpdir = \GitPHP\Git\TmpDir::GetInstance(); @@ -756,7 +756,7 @@ public function GetDiffSplit() $args[] = $this->fromHash; $args[] = $this->toHash; - $diffLines = explode("\n", $exe->Execute(GIT_DIFF, $args)); + $diffLines = explode("\n", $exe->Execute(GitExe::GIT_DIFF, $args)); unset($exe); diff --git a/src/Git/GitExe.php b/src/Git/GitExe.php index 5a6fff0..d062e27 100755 --- a/src/Git/GitExe.php +++ b/src/Git/GitExe.php @@ -2,29 +2,29 @@ namespace GitPHP\Git; -/** - * Constants for git commands - */ -define('GIT_CAT_FILE', 'cat-file'); -define('GIT_DIFF_TREE', 'diff-tree'); -define('GIT_LS_TREE', 'ls-tree'); -define('GIT_REV_LIST', 'rev-list'); -define('GIT_REV_PARSE', 'rev-parse'); -define('GIT_SHOW_REF', 'show-ref'); -define('GIT_ARCHIVE', 'archive'); -define('GIT_GREP', 'grep'); -define('GIT_BLAME', 'blame'); -define('GIT_NAME_REV', 'name-rev'); -define('GIT_FOR_EACH_REF', 'for-each-ref'); -define('GIT_CONFIG', 'config'); -define('GIT_DIFF', 'diff'); -define('GIT_LOG', 'log'); -define('GIT_SHOW', 'show'); -define('GIT_MERGE_BASE', 'merge-base'); -define('GIT_BRANCH', 'branch'); - class GitExe { + /** + * Constants for git commands + */ + const GIT_CAT_FILE = 'cat-file'; + const GIT_DIFF_TREE = 'diff-tree'; + const GIT_LS_TREE = 'ls-tree'; + const GIT_REV_LIST = 'rev-list'; + const GIT_REV_PARSE = 'rev-parse'; + const GIT_SHOW_REF = 'show-ref'; + const GIT_ARCHIVE = 'archive'; + const GIT_GREP = 'grep'; + const GIT_BLAME = 'blame'; + const GIT_NAME_REV = 'name-rev'; + const GIT_FOR_EACH_REF = 'for-each-ref'; + const GIT_CONFIG = 'config'; + const GIT_DIFF = 'diff'; + const GIT_LOG = 'log'; + const GIT_SHOW = 'show'; + const GIT_MERGE_BASE = 'merge-base'; + const GIT_BRANCH = 'branch'; + /** * project * diff --git a/src/Git/Project.php b/src/Git/Project.php index 83803de..1f92416 100755 --- a/src/Git/Project.php +++ b/src/Git/Project.php @@ -273,7 +273,7 @@ public function GetOwner() $exe = new \GitPHP\Git\GitExe($this); $args = array(); $args[] = 'gitweb.owner'; - $this->owner = $exe->Execute(GIT_CONFIG, $args); + $this->owner = $exe->Execute(GitExe::GIT_CONFIG, $args); unset($exe); if (empty($this->owner) && function_exists('posix_getpwuid') && file_exists($this->GetPath())) { @@ -596,7 +596,7 @@ public function ReadHeadCommit() $args = array(); $args[] = '--verify'; $args[] = 'HEAD'; - $this->head = trim($exe->Execute(GIT_REV_PARSE, $args)); + $this->head = trim($exe->Execute(GitExe::GIT_REV_PARSE, $args)); } /** @@ -859,7 +859,7 @@ public function ReadRefList() $args[] = '--heads'; $args[] = '--tags'; $args[] = '--dereference'; - $ret = $exe->Execute(GIT_SHOW_REF, $args); + $ret = $exe->Execute(GitExe::GIT_SHOW_REF, $args); unset($exe); $lines = explode("\n", $ret); @@ -909,7 +909,7 @@ public function GetTags($count = 0) } $args[] = '--'; $args[] = 'refs/tags'; - $ret = $exe->Execute(GIT_FOR_EACH_REF, $args); + $ret = $exe->Execute(GitExe::GIT_FOR_EACH_REF, $args); unset($exe); $lines = explode("\n", $ret); @@ -1000,7 +1000,7 @@ public function GetHeads($count = 0, $mask = '') $args[] = '--'; $ref_mask = 'refs/heads/'; $args[] = $ref_mask . $mask; - $ret = $exe->Execute(GIT_FOR_EACH_REF, $args); + $ret = $exe->Execute(GitExe::GIT_FOR_EACH_REF, $args); unset($exe); $lines = explode("\n", $ret); @@ -1111,7 +1111,7 @@ public function BatchReadData(array $hashes) $hashlistfile = tempnam('/tmp', 'objlist'); file_put_contents($hashlistfile, implode("\n", $hashes)); $Git = new \GitPHP\Git\GitExe($this); - $Git->Execute(GIT_CAT_FILE, array('--batch', ' < ' . escapeshellarg($hashlistfile), ' > ' . escapeshellarg($outfile))); + $Git->Execute(GitExe::GIT_CAT_FILE, array('--batch', ' < ' . escapeshellarg($hashlistfile), ' > ' . escapeshellarg($outfile))); unlink($hashlistfile); $fp = fopen($outfile, 'r'); unlink($outfile); @@ -1266,7 +1266,7 @@ public function GetTree($hash) public function GetDiffTree($first_tree, $second_tree) { $exe = new \GitPHP\Git\GitExe($this); - return trim($exe->Execute(GIT_DIFF_TREE, ['-r', escapeshellarg($first_tree), escapeshellarg($second_tree)])); + return trim($exe->Execute(GitExe::GIT_DIFF_TREE, ['-r', escapeshellarg($first_tree), escapeshellarg($second_tree)])); } public function SearchText($text, $branch = 'master') @@ -1283,7 +1283,7 @@ public function SearchText($text, $branch = 'master') escapeshellarg($branch), ); $exe = new \GitPHP\Git\GitExe($this); - $result = $exe->Execute(GIT_GREP, $args); + $result = $exe->Execute(GitExe::GIT_GREP, $args); } return $result; } @@ -1344,7 +1344,7 @@ public function GetObjectHash($abbreviated_hash, $object_type = "") $search_for = escapeshellarg("{$abbreviated_hash}^{{$object_type}}"); $exe = new \GitPHP\Git\GitExe($this); - $hash = $exe->Execute(GIT_REV_PARSE, ['--quiet', '--verify', $search_for]); + $hash = $exe->Execute(GitExe::GIT_REV_PARSE, ['--quiet', '--verify', $search_for]); if ($hash) { return trim($hash); } @@ -1471,7 +1471,7 @@ private function RevList($hash, $count = 50, $skip = 0, $args = array(), $hashBa $args[] = $file; } - $revlist = explode("\n", $exe->Execute(GIT_REV_LIST, $args)); + $revlist = explode("\n", $exe->Execute(GitExe::GIT_REV_LIST, $args)); if (!$revlist[count($revlist) - 1]) { /* the last newline creates a null entry */ @@ -1536,7 +1536,7 @@ private function ReadEpoch() $args[] = '-1'; $args[] = 'HEAD'; - $epoch = $exe->Execute(GIT_LOG, $args); + $epoch = $exe->Execute(GitExe::GIT_LOG, $args); if (is_string($epoch) && is_numeric(trim($epoch))) { $this->epoch = (int)trim($epoch); } else { @@ -1619,7 +1619,7 @@ public function getMergeBase(string $first_commit, string $second_commit) if (!$first_commit || !$second_commit) { return null; } - $hash = trim((new \GitPHP\Git\GitExe($this))->Execute(GIT_MERGE_BASE, [$first_commit, $second_commit])); + $hash = trim((new \GitPHP\Git\GitExe($this))->Execute(GitExe::GIT_MERGE_BASE, [$first_commit, $second_commit])); if (!$hash) { return null; } @@ -1652,7 +1652,7 @@ public function GetUnmergedCommitsCache() public function GetRevList($args) { - $hashes = trim((new \GitPHP\Git\GitExe($this))->Execute(GIT_REV_LIST, $args)); + $hashes = trim((new \GitPHP\Git\GitExe($this))->Execute(GitExe::GIT_REV_LIST, $args)); return array_map('trim', explode("\n", $hashes)); } @@ -1752,7 +1752,7 @@ public function ForEachRef($args) { $args = array_map('escapeshellarg', $args); $Exec = new \GitPHP\Git\GitExe($this); - $results = trim($Exec->execute(GIT_FOR_EACH_REF, $args)); + $results = trim($Exec->execute(GitExe::GIT_FOR_EACH_REF, $args)); return array_filter(array_map('trim', explode("\n", $results))); } } diff --git a/src/Git/Ref.php b/src/Git/Ref.php index 20fd3e2..3ce5a47 100755 --- a/src/Git/Ref.php +++ b/src/Git/Ref.php @@ -75,7 +75,7 @@ protected function FindHash() $args[] = '--hash'; $args[] = '--verify'; $args[] = $this->GetRefPath(); - $hash = trim($exe->Execute(GIT_SHOW_REF, $args)); + $hash = trim($exe->Execute(GitExe::GIT_SHOW_REF, $args)); if (empty($hash)) throw new \Exception('Invalid ref ' . $this->GetRefPath()); diff --git a/src/Git/Tag.php b/src/Git/Tag.php index 279c98e..451f544 100755 --- a/src/Git/Tag.php +++ b/src/Git/Tag.php @@ -294,7 +294,7 @@ public function ReadData($external_type = null, $external_contents = null) $args = array(); $args[] = '-t'; $args[] = $this->GetHash(); - $ret = trim($exe->Execute(GIT_CAT_FILE, $args)); + $ret = trim($exe->Execute(GitExe::GIT_CAT_FILE, $args)); } else { $ret = $external_type; } @@ -314,7 +314,7 @@ public function ReadData($external_type = null, $external_contents = null) $args = array(); $args[] = 'tag'; $args[] = $this->GetName(); - $ret = $exe->Execute(GIT_CAT_FILE, $args); + $ret = $exe->Execute(GitExe::GIT_CAT_FILE, $args); unset($exe); } else { $ret = $external_contents; @@ -366,7 +366,7 @@ public function ReadData($external_type = null, $external_contents = null) $args = array(); $args[] = 'tag'; $args[] = $objectHash; - $ret = $exe->Execute(GIT_CAT_FILE, $args); + $ret = $exe->Execute(GitExe::GIT_CAT_FILE, $args); unset($exe); $lines = explode("\n", $ret); foreach ($lines as $i => $line) { @@ -398,7 +398,7 @@ private function ReadCommit() $args[] = '--tags'; $args[] = '--dereference'; $args[] = $this->refName; - $ret = $exe->Execute(GIT_SHOW_REF, $args); + $ret = $exe->Execute(GitExe::GIT_SHOW_REF, $args); unset($exe); $lines = explode("\n", $ret); diff --git a/src/Git/Tree.php b/src/Git/Tree.php index 71b6cbf..c5a135c 100755 --- a/src/Git/Tree.php +++ b/src/Git/Tree.php @@ -102,7 +102,7 @@ protected function ReadContents() $args[] = '-t'; $args[] = $this->hash; - $lines = explode("\n", $exe->Execute(GIT_LS_TREE, $args)); + $lines = explode("\n", $exe->Execute(GitExe::GIT_LS_TREE, $args)); $contents = ['t' => [], 'b' => []]; foreach ($lines as $line) { if (preg_match("/^([0-9]+) (.+) ([0-9a-fA-F]{40})(\s+[0-9]+|\s+-)?\t(.+)$/", $line, $regs)) { diff --git a/src/Git/TreeDiff.php b/src/Git/TreeDiff.php index ca72458..d4e7e9d 100755 --- a/src/Git/TreeDiff.php +++ b/src/Git/TreeDiff.php @@ -105,7 +105,7 @@ private function ReadData() $args[] = $this->toHash; - $diffTreeLines = explode("\n", $exe->Execute(GIT_DIFF_TREE, $args)); + $diffTreeLines = explode("\n", $exe->Execute(GitExe::GIT_DIFF_TREE, $args)); $toHash = $this->fromHash ? '' : $this->toHash; foreach ($diffTreeLines as $line) { $trimmed = trim($line); diff --git a/src/Resource.php b/src/Resource.php index 91c405c..007557d 100755 --- a/src/Resource.php +++ b/src/Resource.php @@ -2,9 +2,6 @@ namespace GitPHP; -require_once(GITPHP_BASEDIR . '/lib/php-gettext/streams.php'); -require_once(GITPHP_BASEDIR . '/lib/php-gettext/gettext.php'); - class Resource { /** From 20d99a5d0e5fc2d5f200d6fa4eddb5352834adf7 Mon Sep 17 00:00:00 2001 From: Alexander Grebenschikov Date: Sun, 6 Dec 2020 17:48:00 +0000 Subject: [PATCH 3/3] Cleanup root directory --- bootstrap.php | 4 ++-- composer.json | 2 +- {helpers => lib}/memcache_cache_handler.php | 0 {helpers => lib}/smartyplugins/block.t.php | 0 .../smartyplugins/function.scripturl.php | 0 .../smartyplugins/modifier.agestring.php | 0 {helpers => lib}/smartyplugins/modifier.buglink.php | 0 .../smartyplugins/modifier.highlight.php | 0 {.locale => resources/locale}/de_DE/README | 0 {.locale => resources/locale}/de_DE/gitphp.mo | Bin {.locale => resources/locale}/de_DE/gitphp.po | 0 {.locale => resources/locale}/fr_FR/gitphp.mo | Bin {.locale => resources/locale}/fr_FR/gitphp.po | 0 {.locale => resources/locale}/gitphp.pot | 0 {.locale => resources/locale}/ru_RU/gitphp.mo | Bin {.locale => resources/locale}/ru_RU/gitphp.po | 0 {.locale => resources/locale}/zh_CN/README | 0 {.locale => resources/locale}/zh_CN/gitphp.mo | Bin {.locale => resources/locale}/zh_CN/gitphp.po | 0 {.templates => resources/templates}/atom.tpl | 0 {.templates => resources/templates}/blame.tpl | 0 {.templates => resources/templates}/blamedata.tpl | 0 {.templates => resources/templates}/blob.tpl | 0 {.templates => resources/templates}/blobdiff.tpl | 0 .../templates}/blobdiffplain.tpl | 0 {.templates => resources/templates}/blobheaders.tpl | 0 {.templates => resources/templates}/blobplain.tpl | 0 {.templates => resources/templates}/branchdiff.tpl | 0 .../templates}/branchdiffplain.tpl | 0 {.templates => resources/templates}/commit.tpl | 0 {.templates => resources/templates}/commitdiff.tpl | 0 .../templates}/commitdiffplain.tpl | 0 {.templates => resources/templates}/committip.tpl | 0 {.templates => resources/templates}/data.tpl | 0 .../templates}/extensions_filter.tpl | 0 {.templates => resources/templates}/filediff.tpl | 0 .../templates}/filediffsidebyside.tpl | 0 {.templates => resources/templates}/footer.tpl | 0 {.templates => resources/templates}/git.tpl | 0 {.templates => resources/templates}/gitosis.tpl | 0 .../templates}/gitosisaccess.tpl | 0 {.templates => resources/templates}/gitosismenu.tpl | 0 .../templates}/gitosisrepositories.tpl | 0 .../templates}/gitosisusers.tpl | 0 {.templates => resources/templates}/header.tpl | 0 {.templates => resources/templates}/headlist.tpl | 0 {.templates => resources/templates}/heads.tpl | 0 {.templates => resources/templates}/history.tpl | 0 {.templates => resources/templates}/log.tpl | 0 {.templates => resources/templates}/login.tpl | 0 {.templates => resources/templates}/message.tpl | 0 {.templates => resources/templates}/nav.tpl | 0 {.templates => resources/templates}/opml.tpl | 0 {.templates => resources/templates}/path.tpl | 0 {.templates => resources/templates}/project.tpl | 0 .../templates}/projectcreate.tpl | 0 .../templates}/projectindex.tpl | 0 {.templates => resources/templates}/projectlist.tpl | 0 {.templates => resources/templates}/refbadges.tpl | 0 {.templates => resources/templates}/review.jira.tpl | 0 {.templates => resources/templates}/review.mail.tpl | 0 .../templates}/review.redmine.tpl | 0 {.templates => resources/templates}/review.tpl | 0 {.templates => resources/templates}/rss.tpl | 0 .../templates}/sbs_non_treediff.tpl | 0 .../templates}/sbs_treediff.tpl | 0 {.templates => resources/templates}/search.tpl | 0 {.templates => resources/templates}/searchfiles.tpl | 0 .../templates}/sexy_highlighter.tpl | 0 {.templates => resources/templates}/shortlog.tpl | 0 .../templates}/shortloglist.tpl | 0 {.templates => resources/templates}/snapshot.tpl | 0 {.templates => resources/templates}/tag.tpl | 0 {.templates => resources/templates}/taglist.tpl | 0 {.templates => resources/templates}/tags.tpl | 0 {.templates => resources/templates}/tagtip.tpl | 0 {.templates => resources/templates}/title.tpl | 0 {.templates => resources/templates}/tree.tpl | 0 {.templates => resources/templates}/treelist.tpl | 0 .../templates}/unified_diff_contents.tpl | 0 .../templates}/unified_treediff.tpl | 0 src/Controller/Base.php | 2 +- src/Util.php | 2 +- 83 files changed, 5 insertions(+), 5 deletions(-) rename {helpers => lib}/memcache_cache_handler.php (100%) rename {helpers => lib}/smartyplugins/block.t.php (100%) rename {helpers => lib}/smartyplugins/function.scripturl.php (100%) rename {helpers => lib}/smartyplugins/modifier.agestring.php (100%) rename {helpers => lib}/smartyplugins/modifier.buglink.php (100%) rename {helpers => lib}/smartyplugins/modifier.highlight.php (100%) rename {.locale => resources/locale}/de_DE/README (100%) rename {.locale => resources/locale}/de_DE/gitphp.mo (100%) rename {.locale => resources/locale}/de_DE/gitphp.po (100%) rename {.locale => resources/locale}/fr_FR/gitphp.mo (100%) rename {.locale => resources/locale}/fr_FR/gitphp.po (100%) rename {.locale => resources/locale}/gitphp.pot (100%) rename {.locale => resources/locale}/ru_RU/gitphp.mo (100%) rename {.locale => resources/locale}/ru_RU/gitphp.po (100%) rename {.locale => resources/locale}/zh_CN/README (100%) rename {.locale => resources/locale}/zh_CN/gitphp.mo (100%) rename {.locale => resources/locale}/zh_CN/gitphp.po (100%) rename {.templates => resources/templates}/atom.tpl (100%) rename {.templates => resources/templates}/blame.tpl (100%) rename {.templates => resources/templates}/blamedata.tpl (100%) rename {.templates => resources/templates}/blob.tpl (100%) rename {.templates => resources/templates}/blobdiff.tpl (100%) rename {.templates => resources/templates}/blobdiffplain.tpl (100%) rename {.templates => resources/templates}/blobheaders.tpl (100%) rename {.templates => resources/templates}/blobplain.tpl (100%) rename {.templates => resources/templates}/branchdiff.tpl (100%) rename {.templates => resources/templates}/branchdiffplain.tpl (100%) rename {.templates => resources/templates}/commit.tpl (100%) rename {.templates => resources/templates}/commitdiff.tpl (100%) rename {.templates => resources/templates}/commitdiffplain.tpl (100%) rename {.templates => resources/templates}/committip.tpl (100%) rename {.templates => resources/templates}/data.tpl (100%) rename {.templates => resources/templates}/extensions_filter.tpl (100%) rename {.templates => resources/templates}/filediff.tpl (100%) rename {.templates => resources/templates}/filediffsidebyside.tpl (100%) rename {.templates => resources/templates}/footer.tpl (100%) rename {.templates => resources/templates}/git.tpl (100%) rename {.templates => resources/templates}/gitosis.tpl (100%) rename {.templates => resources/templates}/gitosisaccess.tpl (100%) rename {.templates => resources/templates}/gitosismenu.tpl (100%) rename {.templates => resources/templates}/gitosisrepositories.tpl (100%) rename {.templates => resources/templates}/gitosisusers.tpl (100%) rename {.templates => resources/templates}/header.tpl (100%) rename {.templates => resources/templates}/headlist.tpl (100%) rename {.templates => resources/templates}/heads.tpl (100%) rename {.templates => resources/templates}/history.tpl (100%) rename {.templates => resources/templates}/log.tpl (100%) rename {.templates => resources/templates}/login.tpl (100%) rename {.templates => resources/templates}/message.tpl (100%) rename {.templates => resources/templates}/nav.tpl (100%) rename {.templates => resources/templates}/opml.tpl (100%) rename {.templates => resources/templates}/path.tpl (100%) rename {.templates => resources/templates}/project.tpl (100%) rename {.templates => resources/templates}/projectcreate.tpl (100%) rename {.templates => resources/templates}/projectindex.tpl (100%) rename {.templates => resources/templates}/projectlist.tpl (100%) rename {.templates => resources/templates}/refbadges.tpl (100%) rename {.templates => resources/templates}/review.jira.tpl (100%) rename {.templates => resources/templates}/review.mail.tpl (100%) rename {.templates => resources/templates}/review.redmine.tpl (100%) rename {.templates => resources/templates}/review.tpl (100%) rename {.templates => resources/templates}/rss.tpl (100%) rename {.templates => resources/templates}/sbs_non_treediff.tpl (100%) rename {.templates => resources/templates}/sbs_treediff.tpl (100%) rename {.templates => resources/templates}/search.tpl (100%) rename {.templates => resources/templates}/searchfiles.tpl (100%) rename {.templates => resources/templates}/sexy_highlighter.tpl (100%) rename {.templates => resources/templates}/shortlog.tpl (100%) rename {.templates => resources/templates}/shortloglist.tpl (100%) rename {.templates => resources/templates}/snapshot.tpl (100%) rename {.templates => resources/templates}/tag.tpl (100%) rename {.templates => resources/templates}/taglist.tpl (100%) rename {.templates => resources/templates}/tags.tpl (100%) rename {.templates => resources/templates}/tagtip.tpl (100%) rename {.templates => resources/templates}/title.tpl (100%) rename {.templates => resources/templates}/tree.tpl (100%) rename {.templates => resources/templates}/treelist.tpl (100%) rename {.templates => resources/templates}/unified_diff_contents.tpl (100%) rename {.templates => resources/templates}/unified_treediff.tpl (100%) diff --git a/bootstrap.php b/bootstrap.php index 0680b23..04cb097 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -3,8 +3,8 @@ const GITPHP_BASEDIR = __DIR__ . '/'; const GITPHP_CONFIGDIR = GITPHP_BASEDIR . '.config/'; -const GITPHP_LOCALEDIR = GITPHP_BASEDIR . '.locale/'; -const GITPHP_TEMPLATESDIR = GITPHP_BASEDIR . '.templates/'; +const GITPHP_LOCALEDIR = GITPHP_BASEDIR . 'resources/locale/'; +const GITPHP_TEMPLATESDIR = GITPHP_BASEDIR . 'resources/templates/'; const GITPHP_TEMPLATESCACHEDIR = GITPHP_BASEDIR . 'templates_c/'; const GITPHP_CSSDIR = GITPHP_BASEDIR . 'public/css/'; const GITPHP_JSDIR = GITPHP_BASEDIR . 'public/js/'; diff --git a/composer.json b/composer.json index 4c45096..06c5ef1 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ "GitPHP\\": "src/" }, "files": [ - "helpers/memcache_cache_handler.php", + "lib/memcache_cache_handler.php", "lib/php-gettext/streams.php", "lib/php-gettext/gettext.php" ] diff --git a/helpers/memcache_cache_handler.php b/lib/memcache_cache_handler.php similarity index 100% rename from helpers/memcache_cache_handler.php rename to lib/memcache_cache_handler.php diff --git a/helpers/smartyplugins/block.t.php b/lib/smartyplugins/block.t.php similarity index 100% rename from helpers/smartyplugins/block.t.php rename to lib/smartyplugins/block.t.php diff --git a/helpers/smartyplugins/function.scripturl.php b/lib/smartyplugins/function.scripturl.php similarity index 100% rename from helpers/smartyplugins/function.scripturl.php rename to lib/smartyplugins/function.scripturl.php diff --git a/helpers/smartyplugins/modifier.agestring.php b/lib/smartyplugins/modifier.agestring.php similarity index 100% rename from helpers/smartyplugins/modifier.agestring.php rename to lib/smartyplugins/modifier.agestring.php diff --git a/helpers/smartyplugins/modifier.buglink.php b/lib/smartyplugins/modifier.buglink.php similarity index 100% rename from helpers/smartyplugins/modifier.buglink.php rename to lib/smartyplugins/modifier.buglink.php diff --git a/helpers/smartyplugins/modifier.highlight.php b/lib/smartyplugins/modifier.highlight.php similarity index 100% rename from helpers/smartyplugins/modifier.highlight.php rename to lib/smartyplugins/modifier.highlight.php diff --git a/.locale/de_DE/README b/resources/locale/de_DE/README similarity index 100% rename from .locale/de_DE/README rename to resources/locale/de_DE/README diff --git a/.locale/de_DE/gitphp.mo b/resources/locale/de_DE/gitphp.mo similarity index 100% rename from .locale/de_DE/gitphp.mo rename to resources/locale/de_DE/gitphp.mo diff --git a/.locale/de_DE/gitphp.po b/resources/locale/de_DE/gitphp.po similarity index 100% rename from .locale/de_DE/gitphp.po rename to resources/locale/de_DE/gitphp.po diff --git a/.locale/fr_FR/gitphp.mo b/resources/locale/fr_FR/gitphp.mo similarity index 100% rename from .locale/fr_FR/gitphp.mo rename to resources/locale/fr_FR/gitphp.mo diff --git a/.locale/fr_FR/gitphp.po b/resources/locale/fr_FR/gitphp.po similarity index 100% rename from .locale/fr_FR/gitphp.po rename to resources/locale/fr_FR/gitphp.po diff --git a/.locale/gitphp.pot b/resources/locale/gitphp.pot similarity index 100% rename from .locale/gitphp.pot rename to resources/locale/gitphp.pot diff --git a/.locale/ru_RU/gitphp.mo b/resources/locale/ru_RU/gitphp.mo similarity index 100% rename from .locale/ru_RU/gitphp.mo rename to resources/locale/ru_RU/gitphp.mo diff --git a/.locale/ru_RU/gitphp.po b/resources/locale/ru_RU/gitphp.po similarity index 100% rename from .locale/ru_RU/gitphp.po rename to resources/locale/ru_RU/gitphp.po diff --git a/.locale/zh_CN/README b/resources/locale/zh_CN/README similarity index 100% rename from .locale/zh_CN/README rename to resources/locale/zh_CN/README diff --git a/.locale/zh_CN/gitphp.mo b/resources/locale/zh_CN/gitphp.mo similarity index 100% rename from .locale/zh_CN/gitphp.mo rename to resources/locale/zh_CN/gitphp.mo diff --git a/.locale/zh_CN/gitphp.po b/resources/locale/zh_CN/gitphp.po similarity index 100% rename from .locale/zh_CN/gitphp.po rename to resources/locale/zh_CN/gitphp.po diff --git a/.templates/atom.tpl b/resources/templates/atom.tpl similarity index 100% rename from .templates/atom.tpl rename to resources/templates/atom.tpl diff --git a/.templates/blame.tpl b/resources/templates/blame.tpl similarity index 100% rename from .templates/blame.tpl rename to resources/templates/blame.tpl diff --git a/.templates/blamedata.tpl b/resources/templates/blamedata.tpl similarity index 100% rename from .templates/blamedata.tpl rename to resources/templates/blamedata.tpl diff --git a/.templates/blob.tpl b/resources/templates/blob.tpl similarity index 100% rename from .templates/blob.tpl rename to resources/templates/blob.tpl diff --git a/.templates/blobdiff.tpl b/resources/templates/blobdiff.tpl similarity index 100% rename from .templates/blobdiff.tpl rename to resources/templates/blobdiff.tpl diff --git a/.templates/blobdiffplain.tpl b/resources/templates/blobdiffplain.tpl similarity index 100% rename from .templates/blobdiffplain.tpl rename to resources/templates/blobdiffplain.tpl diff --git a/.templates/blobheaders.tpl b/resources/templates/blobheaders.tpl similarity index 100% rename from .templates/blobheaders.tpl rename to resources/templates/blobheaders.tpl diff --git a/.templates/blobplain.tpl b/resources/templates/blobplain.tpl similarity index 100% rename from .templates/blobplain.tpl rename to resources/templates/blobplain.tpl diff --git a/.templates/branchdiff.tpl b/resources/templates/branchdiff.tpl similarity index 100% rename from .templates/branchdiff.tpl rename to resources/templates/branchdiff.tpl diff --git a/.templates/branchdiffplain.tpl b/resources/templates/branchdiffplain.tpl similarity index 100% rename from .templates/branchdiffplain.tpl rename to resources/templates/branchdiffplain.tpl diff --git a/.templates/commit.tpl b/resources/templates/commit.tpl similarity index 100% rename from .templates/commit.tpl rename to resources/templates/commit.tpl diff --git a/.templates/commitdiff.tpl b/resources/templates/commitdiff.tpl similarity index 100% rename from .templates/commitdiff.tpl rename to resources/templates/commitdiff.tpl diff --git a/.templates/commitdiffplain.tpl b/resources/templates/commitdiffplain.tpl similarity index 100% rename from .templates/commitdiffplain.tpl rename to resources/templates/commitdiffplain.tpl diff --git a/.templates/committip.tpl b/resources/templates/committip.tpl similarity index 100% rename from .templates/committip.tpl rename to resources/templates/committip.tpl diff --git a/.templates/data.tpl b/resources/templates/data.tpl similarity index 100% rename from .templates/data.tpl rename to resources/templates/data.tpl diff --git a/.templates/extensions_filter.tpl b/resources/templates/extensions_filter.tpl similarity index 100% rename from .templates/extensions_filter.tpl rename to resources/templates/extensions_filter.tpl diff --git a/.templates/filediff.tpl b/resources/templates/filediff.tpl similarity index 100% rename from .templates/filediff.tpl rename to resources/templates/filediff.tpl diff --git a/.templates/filediffsidebyside.tpl b/resources/templates/filediffsidebyside.tpl similarity index 100% rename from .templates/filediffsidebyside.tpl rename to resources/templates/filediffsidebyside.tpl diff --git a/.templates/footer.tpl b/resources/templates/footer.tpl similarity index 100% rename from .templates/footer.tpl rename to resources/templates/footer.tpl diff --git a/.templates/git.tpl b/resources/templates/git.tpl similarity index 100% rename from .templates/git.tpl rename to resources/templates/git.tpl diff --git a/.templates/gitosis.tpl b/resources/templates/gitosis.tpl similarity index 100% rename from .templates/gitosis.tpl rename to resources/templates/gitosis.tpl diff --git a/.templates/gitosisaccess.tpl b/resources/templates/gitosisaccess.tpl similarity index 100% rename from .templates/gitosisaccess.tpl rename to resources/templates/gitosisaccess.tpl diff --git a/.templates/gitosismenu.tpl b/resources/templates/gitosismenu.tpl similarity index 100% rename from .templates/gitosismenu.tpl rename to resources/templates/gitosismenu.tpl diff --git a/.templates/gitosisrepositories.tpl b/resources/templates/gitosisrepositories.tpl similarity index 100% rename from .templates/gitosisrepositories.tpl rename to resources/templates/gitosisrepositories.tpl diff --git a/.templates/gitosisusers.tpl b/resources/templates/gitosisusers.tpl similarity index 100% rename from .templates/gitosisusers.tpl rename to resources/templates/gitosisusers.tpl diff --git a/.templates/header.tpl b/resources/templates/header.tpl similarity index 100% rename from .templates/header.tpl rename to resources/templates/header.tpl diff --git a/.templates/headlist.tpl b/resources/templates/headlist.tpl similarity index 100% rename from .templates/headlist.tpl rename to resources/templates/headlist.tpl diff --git a/.templates/heads.tpl b/resources/templates/heads.tpl similarity index 100% rename from .templates/heads.tpl rename to resources/templates/heads.tpl diff --git a/.templates/history.tpl b/resources/templates/history.tpl similarity index 100% rename from .templates/history.tpl rename to resources/templates/history.tpl diff --git a/.templates/log.tpl b/resources/templates/log.tpl similarity index 100% rename from .templates/log.tpl rename to resources/templates/log.tpl diff --git a/.templates/login.tpl b/resources/templates/login.tpl similarity index 100% rename from .templates/login.tpl rename to resources/templates/login.tpl diff --git a/.templates/message.tpl b/resources/templates/message.tpl similarity index 100% rename from .templates/message.tpl rename to resources/templates/message.tpl diff --git a/.templates/nav.tpl b/resources/templates/nav.tpl similarity index 100% rename from .templates/nav.tpl rename to resources/templates/nav.tpl diff --git a/.templates/opml.tpl b/resources/templates/opml.tpl similarity index 100% rename from .templates/opml.tpl rename to resources/templates/opml.tpl diff --git a/.templates/path.tpl b/resources/templates/path.tpl similarity index 100% rename from .templates/path.tpl rename to resources/templates/path.tpl diff --git a/.templates/project.tpl b/resources/templates/project.tpl similarity index 100% rename from .templates/project.tpl rename to resources/templates/project.tpl diff --git a/.templates/projectcreate.tpl b/resources/templates/projectcreate.tpl similarity index 100% rename from .templates/projectcreate.tpl rename to resources/templates/projectcreate.tpl diff --git a/.templates/projectindex.tpl b/resources/templates/projectindex.tpl similarity index 100% rename from .templates/projectindex.tpl rename to resources/templates/projectindex.tpl diff --git a/.templates/projectlist.tpl b/resources/templates/projectlist.tpl similarity index 100% rename from .templates/projectlist.tpl rename to resources/templates/projectlist.tpl diff --git a/.templates/refbadges.tpl b/resources/templates/refbadges.tpl similarity index 100% rename from .templates/refbadges.tpl rename to resources/templates/refbadges.tpl diff --git a/.templates/review.jira.tpl b/resources/templates/review.jira.tpl similarity index 100% rename from .templates/review.jira.tpl rename to resources/templates/review.jira.tpl diff --git a/.templates/review.mail.tpl b/resources/templates/review.mail.tpl similarity index 100% rename from .templates/review.mail.tpl rename to resources/templates/review.mail.tpl diff --git a/.templates/review.redmine.tpl b/resources/templates/review.redmine.tpl similarity index 100% rename from .templates/review.redmine.tpl rename to resources/templates/review.redmine.tpl diff --git a/.templates/review.tpl b/resources/templates/review.tpl similarity index 100% rename from .templates/review.tpl rename to resources/templates/review.tpl diff --git a/.templates/rss.tpl b/resources/templates/rss.tpl similarity index 100% rename from .templates/rss.tpl rename to resources/templates/rss.tpl diff --git a/.templates/sbs_non_treediff.tpl b/resources/templates/sbs_non_treediff.tpl similarity index 100% rename from .templates/sbs_non_treediff.tpl rename to resources/templates/sbs_non_treediff.tpl diff --git a/.templates/sbs_treediff.tpl b/resources/templates/sbs_treediff.tpl similarity index 100% rename from .templates/sbs_treediff.tpl rename to resources/templates/sbs_treediff.tpl diff --git a/.templates/search.tpl b/resources/templates/search.tpl similarity index 100% rename from .templates/search.tpl rename to resources/templates/search.tpl diff --git a/.templates/searchfiles.tpl b/resources/templates/searchfiles.tpl similarity index 100% rename from .templates/searchfiles.tpl rename to resources/templates/searchfiles.tpl diff --git a/.templates/sexy_highlighter.tpl b/resources/templates/sexy_highlighter.tpl similarity index 100% rename from .templates/sexy_highlighter.tpl rename to resources/templates/sexy_highlighter.tpl diff --git a/.templates/shortlog.tpl b/resources/templates/shortlog.tpl similarity index 100% rename from .templates/shortlog.tpl rename to resources/templates/shortlog.tpl diff --git a/.templates/shortloglist.tpl b/resources/templates/shortloglist.tpl similarity index 100% rename from .templates/shortloglist.tpl rename to resources/templates/shortloglist.tpl diff --git a/.templates/snapshot.tpl b/resources/templates/snapshot.tpl similarity index 100% rename from .templates/snapshot.tpl rename to resources/templates/snapshot.tpl diff --git a/.templates/tag.tpl b/resources/templates/tag.tpl similarity index 100% rename from .templates/tag.tpl rename to resources/templates/tag.tpl diff --git a/.templates/taglist.tpl b/resources/templates/taglist.tpl similarity index 100% rename from .templates/taglist.tpl rename to resources/templates/taglist.tpl diff --git a/.templates/tags.tpl b/resources/templates/tags.tpl similarity index 100% rename from .templates/tags.tpl rename to resources/templates/tags.tpl diff --git a/.templates/tagtip.tpl b/resources/templates/tagtip.tpl similarity index 100% rename from .templates/tagtip.tpl rename to resources/templates/tagtip.tpl diff --git a/.templates/title.tpl b/resources/templates/title.tpl similarity index 100% rename from .templates/title.tpl rename to resources/templates/title.tpl diff --git a/.templates/tree.tpl b/resources/templates/tree.tpl similarity index 100% rename from .templates/tree.tpl rename to resources/templates/tree.tpl diff --git a/.templates/treelist.tpl b/resources/templates/treelist.tpl similarity index 100% rename from .templates/treelist.tpl rename to resources/templates/treelist.tpl diff --git a/.templates/unified_diff_contents.tpl b/resources/templates/unified_diff_contents.tpl similarity index 100% rename from .templates/unified_diff_contents.tpl rename to resources/templates/unified_diff_contents.tpl diff --git a/.templates/unified_treediff.tpl b/resources/templates/unified_treediff.tpl similarity index 100% rename from .templates/unified_treediff.tpl rename to resources/templates/unified_treediff.tpl diff --git a/src/Controller/Base.php b/src/Controller/Base.php index b55bbb1..6f99ba6 100755 --- a/src/Controller/Base.php +++ b/src/Controller/Base.php @@ -59,7 +59,7 @@ public function __construct($project = null) require_once(\GitPHP\Util::AddSlash(\GitPHP\Config::GetInstance()->GetValue('smarty_prefix', GITPHP_BASEDIR . 'lib/smarty/libs/')) . 'Smarty.class.php'); \GitPHP\Log::GetInstance()->timerStop('require Smarty.class.php'); $this->tpl = new \Smarty; - $this->tpl->plugins_dir[] = GITPHP_BASEDIR . 'helpers/smartyplugins'; + $this->tpl->plugins_dir[] = GITPHP_BASEDIR . 'lib/smartyplugins'; $this->tpl->template_dir = GITPHP_TEMPLATESDIR; $this->tpl->compile_dir = GITPHP_TEMPLATESCACHEDIR; diff --git a/src/Util.php b/src/Util.php index dfd9b53..992c1a2 100644 --- a/src/Util.php +++ b/src/Util.php @@ -176,7 +176,7 @@ public static function insertCommentsToDiffs($comments, $format, &$comments_auth $template = 'review.redmine.tpl'; } $View = new \Smarty; - $View->plugins_dir[] = GITPHP_BASEDIR . 'helpers/smartyplugins'; + $View->plugins_dir[] = GITPHP_BASEDIR . 'lib/smartyplugins'; $View->template_dir = GITPHP_TEMPLATESDIR; $View->compile_dir = GITPHP_TEMPLATESCACHEDIR;