Skip to content

Commit

Permalink
Fixed error messages shown when admin tool called while not logged in.
Browse files Browse the repository at this point in the history
  • Loading branch information
NorHei committed Jul 27, 2017
1 parent e55191d commit da9d2ff
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions wbce/admin/admintools/tool.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,21 @@
// test for valid tool name
if(!preg_match('/^[a-z][a-z_\-0-9]{2,}$/i', $toolDir)) $toolCheck=false;

// Check if tool is installed
$sql = 'SELECT `name` FROM `'.TABLE_PREFIX.'addons` '.
'WHERE `type`=\'module\' AND `function` LIKE \'%tool%\' '.
'AND `directory`=\''.$database->escapeString($toolDir).'\' '.
'AND `directory` NOT IN(\''.(implode("','",$_SESSION['MODULE_PERMISSIONS'])).'\') ';
if(!($toolName = $database->get_one($sql))) $toolCheck=false;
// Check is user is logged in
//if ($wb->is_authenticated() !== true) $toolCheck=false;

// User has absolutely no permissions , possibly even not logged in :-)?
if (empty($_SESSION['MODULE_PERMISSIONS'])) $toolCheck=false;

// Check if tool is installed but only if user is loged in

if ($toolCheck === true) {
$sql = 'SELECT `name` FROM `'.TABLE_PREFIX.'addons` '.
'WHERE `type`=\'module\' AND `function` LIKE \'%tool%\' '.
'AND `directory`=\''.$database->escapeString($toolDir).'\' '.
'AND `directory` NOT IN(\''.(implode("','",$_SESSION['MODULE_PERMISSIONS'])).'\') ';
if(!($toolName = $database->get_one($sql))) $toolCheck=false;
}

// back button triggered, so go back.
if (isset ($_POST['admin_tools'])) {$toolCheck=false;}
Expand Down

0 comments on commit da9d2ff

Please sign in to comment.