X-Git-Url: http://git.datanom.net/qtadmin.git/blobdiff_plain/7b56160975b8ef93b24fb6d1128d557efab2b7da..3039de292a8f75426d4b2c0ea70a00b75bda5b02:/lib/utils.inc.php diff --git a/lib/utils.inc.php b/lib/utils.inc.php index 773e45f..0b9fe70 100644 --- a/lib/utils.inc.php +++ b/lib/utils.inc.php @@ -1,6 +1,7 @@ root .'config.php'; +require_once $CFG->root . 'lib/session_handler.inc.php'; class Utils { @@ -18,11 +19,13 @@ class Utils { + __TITLE__ -'; - private $footer = ''; +
'; + private $footer = '
'; private $heading = '

Session timeout:

__TITLE__

'; @@ -91,10 +94,11 @@ class Utils { } else { $file = $CFG->root.'qtadmin.log'; } - file_put_contents($file, "[$time]: $message", FILE_APPEND | LOCK_EX); + file_put_contents($file, "[$time]: $message\n", FILE_APPEND | LOCK_EX); + chmod($file, 0600); break; case 'stderr': - file_put_contents('php://stderr', "[$time]: $message"); + file_put_contents('php://stderr', "[$time]: $message\n"); break; case 'syslog': syslog($priority, $message); @@ -310,6 +314,16 @@ class Utils { return $user; } + public function authorized($recipient) { + $authorized = false; + + if ($this->isAdmin() || $this->getUser() == $recipient) { + $authorized = true; + } + + return $authorized; + } + public function getHeader() { $this->log("getHeader", 4);