From a5a93dd6396ac8d327ee75c1a1c2f354d44b1485 Mon Sep 17 00:00:00 2001 From: Trevor Slocum Date: Mon, 15 Apr 2013 18:53:16 -0700 Subject: [PATCH] Add ability to update via Git from the management panel (Administrators only) --- imgboard.php | 13 +++++++++++++ inc/html.php | 26 +++++++++++++++++++++++--- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/imgboard.php b/imgboard.php index 116fb0d..bab9525 100644 --- a/imgboard.php +++ b/imgboard.php @@ -237,6 +237,19 @@ if (isset($_POST['message']) || isset($_POST['file'])) { $onload = manageOnLoad('bans'); $text .= manageBanForm(); $text .= manageBansTable(); + } else if (isset($_GET['update'])) { + if (is_dir('.git')) { + $git_output = shell_exec('git pull 2>&1'); + $text .= '
+
Attempting update...' . "\n\n" . $git_output . '
+
+

Note: If TinyIB updates and you have made custom modifications, review the changes which have been merged into your installation. + Ensure that your modifications do not interfere with any new/modified files. + See the README for more information.

'; + } else { + $text .= '

TinyIB was not installed via Git.

+

If you installed TinyIB without Git, you must update manually. If you did install with Git, ensure the script has read and write access to the .git folder.

'; + } } } diff --git a/inc/html.php b/inc/html.php index 3c5c659..cb6c333 100644 --- a/inc/html.php +++ b/inc/html.php @@ -561,7 +561,7 @@ function manageStatus() { $i = 0; foreach ($posts as $post) { if ($post_html != '') { $post_html .= '
'; } - $post_html .= '' . buildPost($post, TINYIB_INDEXPAGE) . '
'; + $post_html .= '' . buildPost($post, TINYIB_INDEXPAGE) . '
'; } return << Info - $info + + + +EOF; + if ($isadmin) { + $output .= << +
+ + + + + +EOF; + } + $output .= << +
+
+ $info +
@@ -588,4 +608,4 @@ EOF; function manageInfo($text) { return '
' . $text . '
'; } -?> +?> \ No newline at end of file