$objectid = sotf_Utils::getParameter('objectid'); $userid = sotf_Utils::getParameter('userid'); $save = sotf_Utils::getParameter('save'); $pattern = sotf_Utils::getParameter('pattern'); $prefix = sotf_Utils::getParameter('prefix'); $new = sotf_Utils::getParameter('new'); if ($new) { // restart user search } elseif ($userid) { if ($userid[0] == 'g') { $gid = substr($userid, 1); $group = sotf_Group::getById($gid); $users[$userid] = $group->get('name'); $smarty->assign("USERS", $users); } else { $username = sotf_User::getUsername($userid); $users[$userid] = $username; $smarty->assign("USERS", $users); } } elseif ($pattern) { $smarty->assign("PATTERN", $pattern); $users = sotf_User::findUsers($pattern, $prefix); debug("USERS", $users); $groups = sotf_Group::findGroups($pattern, $prefix); debug("GROUPS", $groups); if (count($users) + count($groups) > 50) { $smarty->assign("TOO_MANY_MATCHES", count($users) + count($groups)); } elseif (empty($users) and empty($groups)) { $smarty->assign("NO_MATCHES", 1); } else { $smarty->assign("USERS", $users);
} else { $aid = $user->id; $count = $db->getOne("SELECT count(*) FROM sotf_user_permissions WHERE user_id='{$aid}' AND object_id='node' AND permission_id='1'"); if ($count == 0) { $db->query("INSERT INTO sotf_user_permissions (object_id, user_id, permission_id) VALUES('node',{$aid},1)"); } $count = $db->getOne("SELECT count(*) FROM sotf_user_prefs WHERE id='{$aid}' OR username='******'"); if ($count == 0) { $db->query("INSERT INTO sotf_user_prefs (id,username) VALUES({$aid}, '{$admin_name}')"); } } } // check for correct node admin $adminId = $db->getOne("SELECT user_id FROM sotf_user_permissions WHERE object_id='node' AND permission_id='1'"); if ($adminId) { $adminName = sotf_User::getUsername($adminId); } //$adminName = $userdb->getOne("SELECT username FROM authenticate WHERE auth_id='$adminId'"); if (!$adminName) { $install_test_result[$id] = "Please select node administrator"; $install_color[$id] = $install_red; } else { $install_test_result[$id] = "OK"; $install_color[$id] = $install_green; if (!$admin_name) { $admin_name = $adminName; } } } PrintTitle($id); print '<div align="center">Please type in the username and password for the node administrator.</div';