diff --git a/misuzu.php b/misuzu.php index b5fd5532..6ef46ec6 100644 --- a/misuzu.php +++ b/misuzu.php @@ -6,6 +6,7 @@ date_default_timezone_set('UTC'); require_once __DIR__ . '/vendor/autoload.php'; require_once __DIR__ . '/src/changelog.php'; require_once __DIR__ . '/src/colour.php'; +require_once __DIR__ . '/src/git.php'; require_once __DIR__ . '/src/manage.php'; require_once __DIR__ . '/src/news.php'; require_once __DIR__ . '/src/perms.php'; diff --git a/public/manage/changelog.php b/public/manage/changelog.php index cf6c3b1d..efd951ec 100644 --- a/public/manage/changelog.php +++ b/public/manage/changelog.php @@ -91,7 +91,10 @@ switch ($_GET['v'] ?? null) { } else { $postChange = $db->prepare(' INSERT INTO `msz_changelog_changes` - (`change_log`, `change_text`, `action_id`, `user_id`, `change_created`) + ( + `change_log`, `change_text`, `action_id`, + `user_id`, `change_created`, `change_time_filter` + ) VALUES (:log, :text, :action, :user, :created) '); @@ -143,7 +146,9 @@ switch ($_GET['v'] ?? null) { if ($changeId > 0) { $getChange = $db->prepare(' - SELECT `change_id`, `change_log`, `change_text`, `user_id`, `action_id`, `change_created` + SELECT + `change_id`, `change_log`, `change_text`, `user_id`, + `action_id`, `change_created` FROM `msz_changelog_changes` WHERE `change_id` = :change_id '); diff --git a/src/Application.php b/src/Application.php index 4910a62b..ab0b45f2 100644 --- a/src/Application.php +++ b/src/Application.php @@ -254,8 +254,8 @@ class Application extends ApplicationBase $this->templatingInstance->addFilter('md', 'parse_markdown'); $this->templatingInstance->addFilter('bbcode', 'parse_bbcode'); - $this->templatingInstance->addFunction('git_hash', [Application::class, 'gitCommitHash']); - $this->templatingInstance->addFunction('git_branch', [Application::class, 'gitBranch']); + $this->templatingInstance->addFunction('git_commit_hash'); + $this->templatingInstance->addFunction('git_branch'); $this->templatingInstance->addFunction('csrf_token', 'tmp_csrf_token'); $this->templatingInstance->addFunction('perms_check'); diff --git a/src/ApplicationBase.php b/src/ApplicationBase.php index a51aa89d..ea5d7ef5 100644 --- a/src/ApplicationBase.php +++ b/src/ApplicationBase.php @@ -15,12 +15,6 @@ abstract class ApplicationBase */ private static $instance = null; - /** - * Holds all the loaded modules. - * @var array - */ - private $modules = []; - /** * Gets the currently active instance of ApplicationBase * @return ApplicationBase @@ -45,33 +39,4 @@ abstract class ApplicationBase self::$instance = $this; } - - /** - * Gets info from the current git commit. - * @param string $format Follows the format of the pretty flag on the git log command - * @return string - */ - public static function gitCommitInfo(string $format): string - { - return trim(shell_exec(sprintf('git log --pretty="%s" -n1 HEAD', $format))); - } - - /** - * Gets the hash of the current commit. - * @param bool $long Whether to fetch the long hash or the shorter one. - * @return string - */ - public static function gitCommitHash(bool $long = false): string - { - return self::gitCommitInfo($long ? '%H' : '%h'); - } - - /** - * Gets the name of the current branch. - * @return string - */ - public static function gitBranch(): string - { - return trim(shell_exec('git rev-parse --abbrev-ref HEAD')); - } } diff --git a/src/git.php b/src/git.php new file mode 100644 index 00000000..f3327d58 --- /dev/null +++ b/src/git.php @@ -0,0 +1,24 @@ + {{ 'https://flash.moe'|html_link('Flashwave', 'footer__link')|raw }} 2013-{{ ''|date('Y') }} / - - {{ git_branch() }} # {{ git_hash() }} + + {{ git_branch() }} # {{ git_commit_hash() }} - {# link('https://github.com/flashwave/misuzu/tree/' ~ git_branch(), git_branch(), 'footer__link') }} # {{ link('https://github.com/flashwave/misuzu/commit/' ~ git_hash(true), git_hash(), 'footer__link') #} + {# link('https://github.com/flashwave/misuzu/tree/' ~ git_branch(), git_branch(), 'footer__link') }} # {{ link('https://github.com/flashwave/misuzu/commit/' ~ git_commit_hash(true), git_commit_hash(), 'footer__link') #} diff --git a/views/mio/master.twig b/views/mio/master.twig index b62b324f..0958539f 100644 --- a/views/mio/master.twig +++ b/views/mio/master.twig @@ -67,10 +67,10 @@