[geany/plugins.geany.org] 0aa2e6: Check if GET variable "hash" if set before using it

Enrico Tröger git-noreply at xxxxx
Thu Jul 23 20:26:53 UTC 2015


Branch:      refs/heads/master
Author:      Enrico Tröger <enrico.troeger at uvena.de>
Committer:   Enrico Tröger <enrico.troeger at uvena.de>
Date:        Thu, 23 Jul 2015 20:26:53 UTC
Commit:      0aa2e6d7c1d9ce08bf5e7bd77b3b93e2dec8e738
             https://github.com/geany/plugins.geany.org/commit/0aa2e6d7c1d9ce08bf5e7bd77b3b93e2dec8e738

Log Message:
-----------
Check if GET variable "hash" if set before using it

This fixes warnings like:
[23-Jul-2015 20:17:39 UTC] PHP Notice:  Undefined index: hash in ...plugins.geany.org/content/downloads.html on line 40
[23-Jul-2015 20:17:39 UTC] PHP Notice:  Undefined index: hash in .../plugins.geany.org/content/downloads.html on line 54
[23-Jul-2015 20:17:39 UTC] PHP Notice:  Undefined index: hash in .../plugins.geany.org/content/downloads.html on line 74
[23-Jul-2015 20:17:39 UTC] PHP Notice:  Undefined index: hash in .../plugins.geany.org/content/downloads.html on line 91
[23-Jul-2015 20:17:39 UTC] PHP Notice:  Undefined index: hash in .../plugins.geany.org/content/downloads.html on line 108


Modified Paths:
--------------
    content/downloads.html

Modified: content/downloads.html
11 lines changed, 6 insertions(+), 5 deletions(-)
===================================================================
@@ -5,6 +5,7 @@
 if($handle = opendir($dir))
 {
 	$versions = Array();
+	$hash = isset($_GET['hash']) ? $_GET['hash'] : "md5";
 
 	while(false !== ($file = readdir($handle)))
 	{
@@ -37,7 +38,7 @@
 	echo "	<th>";
 
 	// if sha1 is selected
-	if ($_GET['hash'] != "md5")
+	if ($hash != "md5")
 	{
 		echo "<a href=\"?site=downloads&hash=md5\">MD5</a> ";
 	}
@@ -51,7 +52,7 @@
 	echo "/";
 
 	// if md5 is selected or nothing is selected
-	if ( ( $hash = $_GET['hash'] ) != "sha1" || $hash == "" )
+	if ( $hash != "sha1" || $hash == "" )
 	{
 		echo " <a href=\"?site=downloads&hash=sha1\">SHA1</a> ";
 	}
@@ -71,7 +72,7 @@
 		echo "	<td><a href=\"./geany-plugins/geany-plugins-" . $version . ".tar.gz\">geany-plugins-" . $version . ".tar.gz</a></td>";
 		echo "	<td>Source Code</td>";
 		echo "	<td><a href=\"./geany-plugins/geany-plugins-" . $version . ".tar.gz.sig\">GPG Signature</a></td>";
-		if ($_GET['hash'] == "sha1")
+		if ($hash == "sha1")
 		{
 			echo "	<td><pre>" . sha1_file($dir . "geany-plugins-" .  $version . ".tar.gz") . "</pre></td>";
 		} else {
@@ -88,7 +89,7 @@
 		echo "	<td><a href=\"./geany-plugins/geany-plugins-" . $version . ".tar.bz2\">geany-plugins-" . $version . ".tar.bz2</a></td>";
 		echo "	<td>Source Code</td>";
 		echo "	<td><a href=\"./geany-plugins/geany-plugins-" . $version . ".tar.bz2.sig\">GPG Signature</a></td>";
-		if ($_GET['hash'] == "sha1")
+		if ($hash == "sha1")
 		{
 			echo "	<td><pre>" . sha1_file($dir . "geany-plugins-" .  $version . ".tar.bz2") . "</pre></td>";
 		} else {
@@ -105,7 +106,7 @@
 		echo "	<td><a href=\"./geany-plugins/geany-plugins-" .$wversion . "_setup.exe\">geany-plugins-" . $wversion . "_setup.exe</a></td>";
 		echo "	<td>Win32 Installer</td>";
 		echo "	<td><a href=\"./geany-plugins/geany-plugins-" .$wversion . "_setup.exe.sig\">GPG Signature</a></td>";
-		if ($_GET['hash'] == "sha1")
+		if ($hash == "sha1")
 		{
 			echo "	<td><pre>" . sha1_file($dir . "geany-plugins-" .  $wversion . "_setup.exe") . "</pre></td>";
 		} else {



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list