- more replacement of former global settings variable _adminID

This commit is contained in:
steinm 2010-12-10 13:38:03 +00:00
parent 2903e30f08
commit 5650c23595
4 changed files with 20 additions and 27 deletions

View File

@ -36,10 +36,10 @@ $action = $_GET["action"];
if ($action == "addcategory") {
$name = sanitizeString($_GET["name"]);
if (is_object($dms->getKeywordCategoryByName($name, $settings->_adminID))) {
if (is_object($dms->getKeywordCategoryByName($name, $user->getID()))) {
UI::exitError(getMLText("admin_tools"),getMLText("keyword_exists"));
}
$newCategory = $dms->addKeywordCategory($settings->_adminID, $name);
$newCategory = $dms->addKeywordCategory($user->getID(), $name);
if (!$newCategory) {
UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
}
@ -59,7 +59,7 @@ else if ($action == "removecategory") {
}
$owner = $category->getOwner();
if ($owner->getID() != $settings->_adminID) {
if (!$owner->isAdmin()) {
UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
}
if (!$category->remove()) {
@ -81,7 +81,7 @@ else if ($action == "editcategory") {
}
$owner = $category->getOwner();
if ($owner->getID() != $settings->_adminID) {
if (!$owner->isAdmin()) {
UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
}
@ -97,7 +97,7 @@ else if ($action == "newkeywords") {
$categoryid = sanitizeString($_GET["categoryid"]);
$category = $dms->getKeywordCategory($categoryid);
$owner = $category->getOwner();
if ($owner->getID() != $settings->_adminID) {
if (!$owner->isAdmin()) {
UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
}
@ -122,7 +122,7 @@ else if ($action == "editkeywords")
}
$owner = $category->getOwner();
if ($owner->getID() != $settings->_adminID) {
if (!$owner->isAdmin()) {
UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
}
@ -150,7 +150,7 @@ else if ($action == "removekeywords") {
}
$owner = $category->getOwner();
if ($owner->getID() != $settings->_adminID) {
if (!$owner->isAdmin()) {
UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
}

View File

@ -105,16 +105,20 @@ else if ($action == "removeuser") {
else if (isset($_GET["userid"])) {
$userid = $_GET["userid"];
}
if ($userid==$settings->_adminID) {
UI::exitError(getMLText("admin_tools"),getMLText("cannot_delete_admin"));
}
if (!isset($userid) || !is_numeric($userid) || intval($userid)<1) {
UI::exitError(getMLText("admin_tools"),getMLText("invalid_user_id"));
}
/* This used to be a check if an admin is deleted. Now it checks if one
* wants to delete herself.
*/
if ($userid==$user->getID()) {
UI::exitError(getMLText("admin_tools"),getMLText("cannot_delete_yourself"));
}
$userToRemove = $dms->getUser($userid);
if (!is_object($userToRemove) || ($userToRemove->getID() == $settings->_adminID)) {
if (!is_object($userToRemove)) {
UI::exitError(getMLText("admin_tools"),getMLText("invalid_user_id"));
}

View File

@ -37,7 +37,7 @@ if (!isset($_GET["userid"]) || !is_numeric($_GET["userid"]) || intval($_GET["use
$userid = $_GET["userid"];
$currUser = $dms->getUser($userid);
if (($userid==$settings->_adminID) || $currUser->isGuest()) {
if ($userid==$user->getID()) {
UI::exitError(getMLText("rm_user"),getMLText("access_denied"));
}
@ -62,14 +62,12 @@ UI::contentContainerStart();
<p>
<?php printMLText("assign_user_property_to"); ?> :
<select name="assignTo">
<option value="<?php print $settings->_adminID; ?>"><?php echo getMLText("admin")?>
<?php
$users = $dms->getAllUsers();
foreach ($users as $currUser) {
if (($currUser->getID() == $settings->_adminID) || $currUser->isGuest() || ($currUser->getID() == $userid) )
if ($currUser->isGuest() || ($currUser->getID() == $userid) )
continue;
if (isset($_GET["userid"]) && $currUser->getID()==$_GET["userid"]) $selected=$count;
print "<option value=\"".$currUser->getID()."\">" . $currUser->getLogin();
}

View File

@ -101,10 +101,6 @@ UI::contentContainerStart();
$selected=0;
$count=2;
foreach ($users as $currUser) {
/*
if (($currUser->getID() == $settings->_adminID) || $currUser->isGuest())
continue;
*/
if (isset($_GET["userid"]) && $currUser->getID()==$_GET["userid"]) $selected=$count;
print "<option value=\"".$currUser->getID()."\">" . $currUser->getLogin();
$count++;
@ -231,11 +227,6 @@ UI::contentContainerStart();
<?php
foreach ($users as $currUser) {
/*
if (($currUser->getID() == $settings->_adminID) || $currUser->isGuest())
continue;
*/
print "<td id=\"keywords".$currUser->getID()."\" style=\"display : none;\">";
UI::contentSubHeading(getMLText("user")." : ".$currUser->getLogin());