Browse Source

Merge branch 'master' of https://github.com/Bramas/Lychee into Bramas-master

Tobias Reich 8 years ago
parent
commit
68e992bb18
2 changed files with 27 additions and 0 deletions
  1. 12 0
      plugins/check/index.php
  2. 15 0
      plugins/displaylog/index.php

+ 12 - 0
plugins/check/index.php

@@ -99,6 +99,18 @@ if (!$gdVersion['GIF Read Support'] || !$gdVersion['GIF Create Support'])	$error
 if ($error==='')	echo('No critical problems found. Lychee should work without problems!' . PHP_EOL);
 else				echo $error;
 
+# Don't go further if the user is not connected
+session_start();
+$isAdmin = ((isset($_SESSION['login'])&&$_SESSION['login']===true)&&
+        (isset($_SESSION['identifier'])&&$_SESSION['identifier']===$settings['identifier']));
+
+if(!$isAdmin)
+{
+        echo(PHP_EOL . PHP_EOL . 'You have to be logged in to see more information.');
+	exit();
+}
+
+
 # Show separator
 echo(PHP_EOL . PHP_EOL . 'System Information' . PHP_EOL);
 echo('------------------' . PHP_EOL);

+ 15 - 0
plugins/displaylog/index.php

@@ -37,6 +37,21 @@ if (mysqli_connect_errno()!=0) {
 	exit();
 }
 
+# Load settings
+$settings = new Settings($database);
+$settings = $settings->get();
+
+# Check if the user is connected
+session_start();
+$isAdmin = ((isset($_SESSION['login'])&&$_SESSION['login']===true)&&
+        (isset($_SESSION['identifier'])&&$_SESSION['identifier']===$settings['identifier']));
+
+if(!$isAdmin)
+{
+        exit('You have to be logged in to see the log.');
+}
+
+
 # Result
 $query	= Database::prepare($database, "SELECT FROM_UNIXTIME(time), type, function, line, text FROM ?", array(LYCHEE_TABLE_LOG));
 $result	= $database->query($query);