]> git.datanom.net - qtadmin.git/blobdiff - lib/utils.inc.php
Enhance security
[qtadmin.git] / lib / utils.inc.php
index 9c6be9b51fe8e301a2e59c5d6725e9eacd216826..eec51cd2674dee5b65cfbba17a205147cb56b0b8 100644 (file)
@@ -25,7 +25,7 @@ class Utils {
 <body><div id="container">';
     private $footer = '</div><div id="footer"><p>Powered by <a href="https://qtadmin.datanom.net"
             title="Goto QtAdmin homepage">QtAdmin</a>. &copy; 2015 by Michael Rasmussen</p>
-       </div></body></html>';
+    </div></body></html>';
     private $heading = '<p id="time" class="time">Session timeout:
             <span id="timer"></span></p><h1 class="h1">__TITLE__</h1>';
 
@@ -314,6 +314,19 @@ class Utils {
         return $user;
     }
 
+    public function authorized($recipient) {
+        $authorized = false;
+
+        $this->log("authorized '$recipient'", 3);
+
+        if ($this->isAdmin() || $this->getUser() == $recipient) {
+            $authorized = true;
+        }
+        $this->log("authorized '".$this->getUser()."'", 3);
+
+        return $authorized;
+    }
+
     public function getHeader() {
         $this->log("getHeader", 4);
 
This page took 0.043762 seconds and 5 git commands to generate.