BUG11505: Captive Portal: no way to remove an uploaded logo

Message ID 1527158319-14437-1-git-send-email-alexander.marx@ipfire.org
State Dropped
Headers
Series BUG11505: Captive Portal: no way to remove an uploaded logo |

Commit Message

Alexander Marx May 24, 2018, 8:38 p.m. UTC
  added a delete button

Signed-off-by: Alexander Marx <alexander.marx@ipfire.org>
---
 html/cgi-bin/captive.cgi | 9 ++++++++-
 langs/de/cgi-bin/de.pl   | 1 +
 langs/en/cgi-bin/en.pl   | 1 +
 3 files changed, 10 insertions(+), 1 deletion(-)
  

Patch

diff --git a/html/cgi-bin/captive.cgi b/html/cgi-bin/captive.cgi
index 65cc349..02b2eb5 100755
--- a/html/cgi-bin/captive.cgi
+++ b/html/cgi-bin/captive.cgi
@@ -142,6 +142,10 @@  if ($cgiparams{'ACTION'} eq $Lang::tr{'save'}) {
 	}
 }
 
+if ($cgiparams{'ACTION'} eq "$Lang::tr{'Captive delete logo'}") {
+	unlink $logo;
+}
+
 if ($cgiparams{'ACTION'} eq "$Lang::tr{'Captive generate coupons'}") {
 	#check valid remark
 	if ($cgiparams{'REMARK'} ne '' && !&validremark($cgiparams{'REMARK'})){
@@ -381,7 +385,10 @@  if (-e $logo) {
 	print <<END;
 		<tr>
 			<td>$Lang::tr{'Captive logo uploaded'}</td>
-			<td>$Lang::tr{'yes'}</td>
+			<td>
+				$Lang::tr{'yes'}&nbsp;
+				<input type='submit' name='ACTION' value="$Lang::tr{'Captive delete logo'}"/>
+			</td>
 		</tr>
 END
 }
diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl
index edff684..f00a667 100644
--- a/langs/de/cgi-bin/de.pl
+++ b/langs/de/cgi-bin/de.pl
@@ -28,6 +28,7 @@ 
 'Captive clients' => 'Clients',
 'Captive config' => 'Konfiguration',
 'Captive coupon' => 'Gutschein',
+'Captive delete logo' => 'Logo löschen',
 'Captive err doublevoucher' => 'Ein Gutschein mit diesem Code ist bereits im Umlauf',
 'Captive expire' => 'Ablauf',
 'Captive expiry time' => 'Ablaufzeit',
diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl
index 0c77ce4..ef141a3 100644
--- a/langs/en/cgi-bin/en.pl
+++ b/langs/en/cgi-bin/en.pl
@@ -27,6 +27,7 @@ 
 'Captive client session expiry time' => 'Session Expiry Time',
 'Captive config' => 'Settings',
 'Captive coupon' => 'Coupon',
+'Captive delete logo' => 'Delete Logo',
 'Captive err doublevoucher' => 'A coupon with this code already exists',
 'Captive expire' => 'Expire',
 'Captive expiry time' => 'Expiry Time',