From efe2e7fa555e5fab686e1b437636216bd2cbd3ff Mon Sep 17 00:00:00 2001
From: Rasmus Fuhse <krassmus@gmail.com>
Date: Sat, 13 Sep 2014 06:37:14 +0200
Subject: [PATCH] some small things

---
 controllers/myplugins.php         |  2 +-
 controllers/update.php            |  1 +
 views/myplugins/_edit_release.php | 15 ++++++++++++---
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/controllers/myplugins.php b/controllers/myplugins.php
index 8e68457..21a001b 100644
--- a/controllers/myplugins.php
+++ b/controllers/myplugins.php
@@ -35,7 +35,7 @@ class MypluginsController extends PluginController {
     public function edit_release_action($release_id) {
         $this->release = new MarketRelease($release_id);
         if (Request::isXhr()) {
-            $this->response->add_header('X-Title', _("Plugin bearbeiten"));
+            $this->response->add_header('X-Title', _("Release bearbeiten"));
             $this->set_layout(null);
         }
     }
diff --git a/controllers/update.php b/controllers/update.php
index 8e98dba..8d77bce 100644
--- a/controllers/update.php
+++ b/controllers/update.php
@@ -16,6 +16,7 @@ class UpdateController extends PluginController {
         if ($release->getSecurityHash() === Request::get("s")) {
             $release->installFile();
         }
+        $this->render_text("OK");
     }
 
 }
\ No newline at end of file
diff --git a/views/myplugins/_edit_release.php b/views/myplugins/_edit_release.php
index b9a0936..2657227 100644
--- a/views/myplugins/_edit_release.php
+++ b/views/myplugins/_edit_release.php
@@ -3,7 +3,9 @@ if (strpos($_SERVER['SERVER_NAME'], ':') !== false) {
     list($_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT']) =
         explode(':', $_SERVER['SERVER_NAME']);
 }
-
+if ($_SERVER['SERVER_NAME'] === "localhost" || $_SERVER['SERVER_NAME'] = "127.0.0.1") {
+    $domain_warning = sprintf(_("Achtung, mit %s als Domain kann der Webhook-Aufruf von github nicht funktionieren."), $_SERVER['SERVER_NAME']);
+}
 $DOMAIN_STUDIP = $_SERVER['HTTPS'] == 'on' ? 'https' : 'http';
 $DOMAIN_STUDIP .= '://'.$_SERVER['SERVER_NAME'];
 
@@ -16,7 +18,11 @@ if ($_SERVER['HTTPS'] == 'on' && $_SERVER['SERVER_PORT'] != 443 ||
 
 <fieldset>
     <legend>
-        <?= _("Release hinzuf�gen") ?>
+        <? if ($release->isNew()) : ?>
+            <?= _("Release hinzuf�gen") ?>
+        <? else : ?>
+            <?= sprintf(_("Release %s bearbeiten"), htmlReady($release['version'])) ?>
+        <? endif ?>
     </legend>
 
     <div>
@@ -57,8 +63,11 @@ if ($_SERVER['HTTPS'] == 'on' && $_SERVER['SERVER_PORT'] != 443 ||
         <? if (!$release->isNew()) : ?>
         <p class="info">
             <?= _("Webhook-URL zum Einf�gen in github oder gitlab:") ?>
-            <input type="text" style="border: thin solid #cccccc; background-color: #eeeeee;" value="<?= $DOMAIN_STUDIP.URLHelper::getLink("plugins.php/pluginmarket/upate/".$release->getId(), array('s' => $release->getSecurityHash()), true) ?>">
+            <input type="text" style="border: thin solid #cccccc; background-color: #eeeeee;" value="<?= $DOMAIN_STUDIP.URLHelper::getLink("plugins.php/pluginmarket/update/release/".$release->getId(), array('s' => $release->getSecurityHash()), true) ?>">
         </p>
+            <? if ($domain_warning) : ?>
+            <p class="info"><?= htmlReady($domain_warning)  ?></p>
+            <? endif ?>
         <? endif ?>
 
     </fieldset>
-- 
GitLab