From 12c2a9e2ae60ffc9075111bab7fc76fa36c79437 Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Thu, 14 Aug 2014 03:09:58 -0400
Subject: [PATCH] Fixes: FS#3610 - The optional wrning message on form tab change is not showing up when activated

---
 interface/lib/classes/auth.inc.php |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/interface/lib/classes/auth.inc.php b/interface/lib/classes/auth.inc.php
index 070662f..5be11cb 100644
--- a/interface/lib/classes/auth.inc.php
+++ b/interface/lib/classes/auth.inc.php
@@ -44,6 +44,14 @@
 			return false;
 		}
 	}
+	
+	public function is_superadmin() {
+		if($_SESSION['s']['user']['typ'] == 'admin' && $_SESSION['s']['user']['userid'] === 1) {
+			return true;
+		} else {
+			return false;
+		}
+	}
 
 	public function has_clients($userid) {
 		global $app, $conf;
@@ -83,6 +91,7 @@
 		global $app;
 		
 		$userid = $app->functions->intval($userid);
+		if(!preg_match('/^[a-zA-Z0-9\-\_]{1,64}$/',$limitname)) $app->error('Invalid limit name '.$limitname);
 		
 		// simple query cache
 		if($this->client_limits===null)
@@ -120,7 +129,8 @@
 
 	public function check_module_permissions($module) {
 		// Check if the current user has the permissions to access this module
-		if(!stristr($_SESSION["s"]["user"]["modules"], $module)) {
+		$user_modules = explode(',',$_SESSION["s"]["user"]["modules"]);
+		if(!in_array($module,$user_modules)) {
 			// echo "LOGIN_REDIRECT:/index.php";
 			header("Location: /index.php");
 			exit;

--
Gitblit v1.9.1