本文整理汇总了PHP中getUserGroups函数的典型用法代码示例。如果您正苦于以下问题:PHP getUserGroups函数的具体用法?PHP getUserGroups怎么用?PHP getUserGroups使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getUserGroups函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: processBlockRequestInput
function processBlockRequestInput($checks = 1)
{
global $submitErr, $submitErrMsg, $mode, $user, $days;
$return = array();
$return['blockname'] = getContinuationVar("blockname", processInputVar("blockname", ARG_STRING));
$return['imageid'] = getContinuationVar("imageid", processInputVar("imageid", ARG_NUMERIC));
$return['machinecnt'] = getContinuationVar("machinecnt", processInputVar("machinecnt", ARG_NUMERIC, 0));
$return['swhour'] = getContinuationVar("swhour", processInputVar("swhour", ARG_MULTINUMERIC));
$return['swminute'] = getContinuationVar("swminute", processInputVar("swminute", ARG_MULTINUMERIC));
$return['swmeridian'] = getContinuationVar("swmeridian", processInputVar("swmeridian", ARG_MULTISTRING));
$return['ewhour'] = getContinuationVar("ewhour", processInputVar("ewhour", ARG_MULTINUMERIC));
$return['ewminute'] = getContinuationVar("ewminute", processInputVar("ewminute", ARG_MULTINUMERIC));
$return['ewmeridian'] = getContinuationVar("ewmeridian", processInputVar("ewmeridian", ARG_MULTISTRING));
$return['smhour'] = getContinuationVar("smhour", processInputVar("smhour", ARG_MULTINUMERIC));
$return['smminute'] = getContinuationVar("smminute", processInputVar("smminute", ARG_MULTINUMERIC));
$return['smmeridian'] = getContinuationVar("smmeridian", processInputVar("smmeridian", ARG_MULTISTRING));
$return['emhour'] = getContinuationVar("emhour", processInputVar("emhour", ARG_MULTINUMERIC));
$return['emminute'] = getContinuationVar("emminute", processInputVar("emminute", ARG_MULTINUMERIC));
$return['emmeridian'] = getContinuationVar("emmeridian", processInputVar("emmeridian", ARG_MULTISTRING));
$return['slhour'] = getContinuationVar("slhour", processInputVar("slhour", ARG_MULTINUMERIC));
$return['slminute'] = getContinuationVar("slminute", processInputVar("slminute", ARG_MULTINUMERIC));
$return['slmeridian'] = getContinuationVar("slmeridian", processInputVar("slmeridian", ARG_MULTISTRING));
$return['elhour'] = getContinuationVar("elhour", processInputVar("elhour", ARG_MULTINUMERIC));
$return['elminute'] = getContinuationVar("elminute", processInputVar("elminute", ARG_MULTINUMERIC));
$return['elmeridian'] = getContinuationVar("elmeridian", processInputVar("elmeridian", ARG_MULTISTRING));
$return['weeknum'] = getContinuationVar("weeknum", processInputVar("weeknum", ARG_NUMERIC));
$return['day'] = getContinuationVar("day", processInputVar("day", ARG_NUMERIC));
$return['date'] = getContinuationVar("date", processInputVar("date", ARG_MULTISTRING));
$return['available'] = getContinuationVar("available", processInputVar("available", ARG_STRING, 'weekly'));
$return['usergroupid'] = getContinuationVar("usergroupid", processInputVar("usergroupid", ARG_NUMERIC));
$return['admingroupid'] = getContinuationVar("admingroupid", processInputVar("admingroupid", ARG_NUMERIC));
$return['swdate'] = getContinuationVar("swdate", processInputVar("swdate", ARG_STRING));
$return['ewdate'] = getContinuationVar("ewdate", processInputVar("ewdate", ARG_STRING));
$return['smdate'] = getContinuationVar("smdate", processInputVar("smdate", ARG_STRING));
$return['emdate'] = getContinuationVar("emdate", processInputVar("emdate", ARG_STRING));
$return['wdays'] = getContinuationVar("wdays", processInputVar("wdays", ARG_MULTISTRING));
$return['state'] = getContinuationVar("state", 0);
$return['blockRequestid'] = getContinuationVar("blockRequestid", processInputVar("blockRequestid", ARG_NUMERIC));
$return['wdayschecked'] = array();
foreach ($days as $day) {
if (in_array($day, $return['wdays'])) {
$return['wdayschecked'][$day] = 'checked';
} else {
$return['wdayschecked'][$day] = '';
}
}
if (!$checks) {
return $return;
}
if (!preg_match('/^([-a-zA-Z0-9\\. ]){3,80}$/', $return["blockname"])) {
$submitErr |= BLOCKNAMEERR;
$submitErrMsg[BLOCKNAMEERR] = "Name can only contain letters, numbers, spaces, dashes(-),<br>and periods(.) and can be from 3 to 80 characters long";
}
$resources = getUserResources(array("imageAdmin", "imageCheckOut"));
$resources["image"] = removeNoCheckout($resources["image"]);
if (!in_array($return['imageid'], array_keys($resources['image']))) {
$submitErr |= IMAGEIDERR;
$submitErrMsg[IMAGEIDERR] = "The submitted image is invalid.";
}
if ($return['machinecnt'] < MIN_BLOCK_MACHINES) {
$submitErr |= BLOCKCNTERR;
$submitErrMsg[BLOCKCNTERR] = "You must request at least " . MIN_BLOCK_MACHINES . " machines";
} elseif ($return['machinecnt'] > MAX_BLOCK_MACHINES) {
$submitErr |= BLOCKCNTERR;
$submitErrMsg[BLOCKCNTERR] = "You cannot request more than " . MAX_BLOCK_MACHINES . " machines";
}
// FIXME should we limit the course groups that show up?
$groups = getUserGroups();
if (!array_key_exists($return['usergroupid'], $groups)) {
$submitErr |= USERGROUPIDERR;
$submitErrMsg[USERGROUPIDERR] = "The submitted user group is invalid.";
}
if (!array_key_exists($return['admingroupid'], $groups) && $return['admingroupid'] != 0) {
$submitErr |= ADMINGROUPIDERR;
$submitErrMsg[ADMINGROUPIDERR] = "The submitted user group is invalid.";
}
if ($return['available'] == 'weekly') {
$keys = array('1' => 'swhour', '2' => 'ewhour', '3' => 'swminute', '4' => 'ewminute', '5' => 'swmeridian', '6' => 'ewmeridian', '7' => 'swdate', '8' => 'ewdate');
// check days of week
foreach ($return['wdays'] as $index => $day) {
if (!in_array($day, $days)) {
unset($return['wdays'][$index]);
}
}
/*foreach($days as $day) {
if(in_array($day, $return['wdays']))
$return['wdayschecked'][$day] = 'checked';
}*/
if (!count($return['wdays'])) {
$submitErr |= STARTDAYERR;
$submitErrMsg[STARTDAYERR] = "You must select at least one day of the week";
}
} elseif ($return['available'] == 'monthly') {
$keys = array('1' => 'smhour', '2' => 'emhour', '3' => 'smminute', '4' => 'emminute', '5' => 'smmeridian', '6' => 'emmeridian', '7' => 'smdate', '8' => 'emdate');
// check weeknum
if ($return['weeknum'] < 1 || $return['weeknum'] > 5) {
$submitErr |= WEEKNUMERR;
$submitErrMsg[WEEKNUMERR] = "Invalid week of the month submitted";
}
// check day
//.........这里部分代码省略.........
开发者ID:gw-acadtech,项目名称:VCL,代码行数:101,代码来源:requests.php
示例2: confirmEditOrAddImage
function confirmEditOrAddImage($state)
{
global $submitErr, $user;
$data = processImageInput(1);
if ($submitErr) {
editOrAddImage($state);
return;
}
if (get_magic_quotes_gpc()) {
$data['description'] = stripslashes($data['description']);
$data['usage'] = stripslashes($data['usage']);
$data['comments'] = stripslashes($data['comments']);
}
$groups = getUserGroups();
$groups[0] = array("name" => "Any");
if (!$state) {
$images = getImages();
}
if ($state) {
$nextmode = "imageClickThroughAgreement";
$title = "Add Image";
$question = "Add the following image?";
} else {
$nextmode = "submitEditImage";
$title = "Edit Image";
$question = "Submit changes to the image?";
}
$platforms = getPlatforms();
$oslist = getOSList();
print "<FORM action=\"" . BASEURL . SCRIPT . "\" method=post>\n";
print "<DIV align=center>\n";
print "<H2>{$title}</H2>\n";
print "{$question}<br><br>\n";
print "<TABLE>\n";
if (!$state) {
/*print " <TR>\n";
print " <TH align=right>Short Name:</TH>\n";
print " <TD>" . $data["name"] . "</TD>\n";
print " </TR>\n";*/
}
print " <TR>\n";
print " <TH align=right>Name:</TH>\n";
print " <TD>" . $data["prettyname"] . "</TD>\n";
print " </TR>\n";
print " <TR>\n";
print " <TH align=right>Owner:</TH>\n";
print " <TD>" . $data["owner"] . "</TD>\n";
print " </TR>\n";
/*print " <TR>\n";
print " <TH align=right>Platform:</TH>\n";
print " <TD>" . $platforms[$data["platformid"]] . "</TD>\n";
print " </TR>\n";
print " <TR>\n";
print " <TH align=right>OS:</TH>\n";
print " <TD>" . $oslist[$data["osid"]]["prettyname"] . "</TD>\n";
print " </TR>\n";*/
print " <TR>\n";
print " <TD colspan=2>\n";
print "<br><strong>Image Description</strong>:<br>\n";
print "{$data['description']}<br><br>\n";
print "<strong>Usage Notes</strong>:<br>\n";
print "{$data['usage']}<br><br>\n";
if ($state) {
print "<strong>Revision Comments</strong>:<br>\n";
print "{$data['comments']}<br><br>\n";
}
print " </TD>\n";
print " </TR>\n";
print "</TABLE>\n";
print "<TABLE>\n";
print " <TR>\n";
print " <TD colspan=2><strong>Advanced Options</strong>:</TD>\n";
print " </TR>\n";
print " <TR>\n";
print " <TD colspan=2><hr></TD>\n";
print " </TR>\n";
print " <TR>\n";
print " <TH align=right>Minimum RAM (MB):</TH>\n";
print " <TD>" . $data["minram"] . "</TD>\n";
print " </TR>\n";
print " <TR>\n";
print " <TH align=right>Minimum Num of Processors:</TH>\n";
print " <TD>" . $data["minprocnumber"] . "</TD>\n";
print " </TR>\n";
print " <TR>\n";
print " <TH align=right>Minimum Processor Speed (MHz):</TH>\n";
print " <TD>" . $data["minprocspeed"] . "</TD>\n";
print " </TR>\n";
print " <TR>\n";
print " <TH align=right>Minimum Network Speed (Mbps):</TH>\n";
print " <TD>" . $data["minnetwork"] . "</TD>\n";
print " </TR>\n";
print " <TR>\n";
print " <TH align=right>Maximum Concurrent Usage:</TH>\n";
if ($data['maxconcurrent'] == '') {
print " <TD>N/A</TD>\n";
} else {
print " <TD>" . $data["maxconcurrent"] . "</TD>\n";
}
print " </TR>\n";
//.........这里部分代码省略.........
开发者ID:gw-acadtech,项目名称:VCL,代码行数:101,代码来源:images.php
示例3: getUserMaxTimes
function getUserMaxTimes($uid = 0)
{
global $user;
$return = array("initial" => 0, "total" => 0, "extend" => 0);
if ($uid == 0) {
$groupids = array_keys($user["groups"]);
} else {
$groupids = array_keys(getUsersGroups($uid, 1));
}
if (!count($groupids)) {
array_push($groupids, getUserGroupID(DEFAULTGROUP));
}
$allgroups = getUserGroups();
foreach ($groupids as $id) {
if ($return["initial"] < $allgroups[$id]["initialmaxtime"]) {
$return["initial"] = $allgroups[$id]["initialmaxtime"];
}
if ($return["total"] < $allgroups[$id]["totalmaxtime"]) {
$return["total"] = $allgroups[$id]["totalmaxtime"];
}
if ($return["extend"] < $allgroups[$id]["maxextendtime"]) {
$return["extend"] = $allgroups[$id]["maxextendtime"];
}
}
return $return;
}
开发者ID:gw-acadtech,项目名称:VCL,代码行数:26,代码来源:utils.php
示例4: XMLRPCblockAllocation
function XMLRPCblockAllocation($imageid, $start, $end, $numMachines, $usergroupid, $ignoreprivileges = 0)
{
global $user, $xmlrpcBlockAPIUsers;
if (!in_array($user['id'], $xmlrpcBlockAPIUsers)) {
return array('status' => 'error', 'errorcode' => 34, 'errormsg' => 'access denied for managing block allocations');
}
# valid $imageid
$resources = getUserResources(array("imageAdmin", "imageCheckOut"));
$resources["image"] = removeNoCheckout($resources["image"]);
if (!array_key_exists($imageid, $resources['image'])) {
return array('status' => 'error', 'errorcode' => 3, 'errormsg' => "access denied to {$imageid}");
}
# validate $start and $end
$dtreg = '([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})';
$startts = datetimeToUnix($start);
$endts = datetimeToUnix($end);
$maxend = datetimeToUnix("2038-01-01 00:00:00");
if (!preg_match("/^{$dtreg}\$/", $start) || $startts < 0 || $startts > $maxend) {
return array('status' => 'error', 'errorcode' => 4, 'errormsg' => "received invalid input for start");
}
if (!preg_match("/^{$dtreg}\$/", $end) || $endts < 0 || $endts > $maxend) {
return array('status' => 'error', 'errorcode' => 36, 'errormsg' => "received invalid input for end");
}
# validate $numMachines
if (!is_numeric($numMachines) || $numMachines < MIN_BLOCK_MACHINES || $numMachines > MAX_BLOCK_MACHINES) {
return array('status' => 'error', 'errorcode' => 64, 'errormsg' => 'The submitted number of seats must be between ' . MIN_BLOCK_MACHINES . ' and ' . MAX_BLOCK_MACHINES . '.');
}
# validate $usergroupid
$groups = getUserGroups();
if (!array_key_exists($usergroupid, $groups)) {
return array('status' => 'error', 'errorcode' => 67, 'errormsg' => 'Submitted user group does not exist');
}
# validate ignoreprivileges
if (!is_numeric($ignoreprivileges) || $ignoreprivileges < 0 || $ignoreprivileges > 1) {
return array('status' => 'error', 'errorcode' => 86, 'errormsg' => 'ignoreprivileges must be 0 or 1');
}
$ownerid = getUserlistID('vclreload@Local');
$name = "API:{$start}";
$managementnodes = getManagementNodes('future');
if (empty($managementnodes)) {
return array('status' => 'error', 'errorcode' => 12, 'errormsg' => 'could not allocate a management node to handle block allocation');
}
$mnid = array_rand($managementnodes);
$query = "INSERT INTO blockRequest " . "(name, " . "imageid, " . "numMachines, " . "groupid, " . "repeating, " . "ownerid, " . "managementnodeid, " . "expireTime, " . "status) " . "VALUES " . "('{$name}', " . "{$imageid}, " . "{$numMachines}, " . "{$usergroupid}, " . "'list', " . "{$ownerid}, " . "{$mnid}, " . "'{$end}', " . "'accepted')";
doQuery($query, 101);
$brid = dbLastInsertID();
$query = "INSERT INTO blockTimes " . "(blockRequestid, " . "start, " . "end) " . "VALUES " . "({$brid}, " . "'{$start}', " . "'{$end}')";
doQuery($query, 101);
$btid = dbLastInsertID();
$query = "INSERT INTO blockWebDate " . "(blockRequestid, " . "start, " . "end, " . "days) " . "VALUES " . "({$brid}, " . "'{$start}', " . "'{$end}', " . "0)";
doQuery($query);
$sh = date('g', $startts);
$smi = date('i', $startts);
$sme = date('a', $startts);
$eh = date('g', $startts);
$emi = date('i', $startts);
$eme = date('a', $startts);
$query = "INSERT INTO blockWebTime " . "(blockRequestid, " . "starthour, " . "startminute, " . "startmeridian, " . "endhour, " . "endminute, " . "endmeridian, " . "`order`) " . "VALUES " . "({$brid}, " . "{$sh}," . "{$smi}," . "'{$sme}'," . "{$eh}," . "{$emi}," . "'{$eme}'," . "0)";
doQuery($query);
$return = XMLRPCprocessBlockTime($btid, $ignoreprivileges);
$return['blockTimesid'] = $btid;
return $return;
}
开发者ID:bq-xiao,项目名称:apache-vcl,代码行数:63,代码来源:xmlrpcWrappers.php
示例5: handleFileUploads
$formVars['serialNo'] = $serialNo;
// for '$recordAction = "add"' we update the original '$formVars' array element to ensure a correct serial number when generating the file name via the 'parsePlaceholderString()' function
// handle file uploads:
// for '$recordAction = "add"' file name generation needs to be done *after* the record has been created and a serial number is available
if (!empty($uploadFile) && !empty($uploadFile["tmp_name"])) {
// process information of any file that was uploaded, auto-generate a file name if required and move the file to the appropriate directory:
$fileName = handleFileUploads($uploadFile, $formVars);
$queryRefsUpdateFileName = "UPDATE {$tableRefs} SET file = " . quote_smart($fileName) . " WHERE serial = " . quote_smart($serialNo);
$result = queryMySQLDatabase($queryRefsUpdateFileName);
// function 'queryMySQLDatabase()' is defined in 'include.inc.php'
}
$queryUserData = "INSERT INTO {$tableUserData} SET " . "marked = " . quote_smart($markedRadio) . ", " . "copy = " . quote_smart($copyName) . ", " . "selected = " . quote_smart($selectedRadio) . ", " . "user_keys = " . quote_smart($userKeysName) . ", " . "user_notes = " . quote_smart($userNotesName) . ", " . "user_file = " . quote_smart($userFileName) . ", " . "user_groups = " . quote_smart($userGroupsName) . ", " . "cite_key = " . quote_smart($citeKeyName) . ", " . "related = " . quote_smart($relatedName) . ", " . "record_id = " . quote_smart($serialNo) . ", " . "user_id = " . quote_smart($loginUserID) . ", " . "data_id = NULL";
// inserting 'NULL' into an auto_increment PRIMARY KEY attribute allocates the next available key value
$result = queryMySQLDatabase($queryUserData);
// function 'queryMySQLDatabase()' is defined in 'include.inc.php'
getUserGroups($tableUserData, $loginUserID);
// update the 'userGroups' session variable (function 'getUserGroups()' is defined in 'include.inc.php')
// Send EMAIL announcement:
if ($sendEmailAnnouncements == "yes") {
// first, build an appropriate author string:
// Call the 'extractAuthorsLastName()' function (defined in 'include.inc.php') to extract the last name of a particular author (specified by position). Required Parameters:
// 1. pattern describing delimiter that separates different authors
// 2. pattern describing delimiter that separates author name & initials (within one author)
// 3. position of the author whose last name shall be extracted (e.g., "1" will return the 1st author's last name)
// 4. contents of the author field
$authorString = extractAuthorsLastName("/ *; */", "/ *, */", 1, $authorName);
if ($authorCount == "2") {
$authorString .= " & ";
$authorString .= extractAuthorsLastName("/ *; */", "/ *, */", 2, $authorName);
}
if ($authorCount == "3") {
开发者ID:Olari0,项目名称:Finugriling,代码行数:31,代码来源:modify.php
示例6: _post
}
if (SQUID_LDAP_PASSWORD_REGEX && !preg_match(SQUID_LDAP_PASSWORD_REGEX, _post("password"))) {
$errors[] = "Invalid password.";
}
if (!$errors) {
$un = _post("username");
$pw = _post("password");
$register = _post("register_device") == 1;
$ad = ldap_connect(SQUID_LDAP_SERVER);
if ($ad !== false && @ldap_bind($ad, $un . SQUID_LDAP_USERNAME_APPEND, $pw)) {
$allowed = true;
$proxyEnforced = true;
$sessionTime = SQUID_DEFAULT_SESSION_DURATION;
if (!empty($SQUID_LDAP_GROUP_PERMISSIONS)) {
$allowed = false;
$groups = getUserGroups($un, true, false);
if (is_array($groups)) {
foreach ($SQUID_LDAP_GROUP_PERMISSIONS as $groupDN => $groupPermissions) {
if (in_array($groupDN, $groups) && (!$register && $groupPermissions["ALLOW_SESSION"] || $register && $groupPermissions["ALLOW_DEVICE_REGISTRATION"])) {
$allowed = true;
if (!$register && isset($groupPermissions["SESSION_DURATION"])) {
$sessionTime = $groupPermissions["SESSION_DURATION"];
}
if (isset($groupPermissions["ALLOW_NO_PROXY"]) && $groupPermissions["ALLOW_NO_PROXY"]) {
$proxyEnforced = false;
}
break;
}
}
}
}
开发者ID:eduridden,项目名称:extensions,代码行数:31,代码来源:login.php
示例7: processBlockAllocationInput
function processBlockAllocationInput()
{
global $user;
$return = array();
$method = getContinuationVar('method');
$return['name'] = processInputVar('name', ARG_STRING);
$return['owner'] = processInputVar('owner', ARG_STRING);
$return['imageid'] = processInputVar('imageid', ARG_NUMERIC);
$return['seats'] = processInputVar('seats', ARG_NUMERIC);
$return['groupid'] = processInputVar('groupid', ARG_NUMERIC);
$override = getContinuationVar('override', 0);
$type = processInputVar('type', ARG_STRING);
$err = 0;
if ($method != 'request' && !preg_match('/^([-a-zA-Z0-9\\. \\(\\)]){3,80}$/', $return['name'])) {
$errmsg = i("The name can only contain letters, numbers, spaces, dashes(-), and periods(.) and can be from 3 to 80 characters long");
$err = 1;
}
$resources = getUserResources(array("imageAdmin", "imageCheckOut"));
$resources["image"] = removeNoCheckout($resources["image"]);
if (!array_key_exists($return['imageid'], $resources['image'])) {
$errmsg = i("The submitted image is invalid.");
$err = 1;
}
if (!$err && $method != 'request' && !validateUserid($return['owner'])) {
$errmsg = i("The submitted owner is invalid.");
$err = 1;
} else {
$return['ownerid'] = getUserlistID($return['owner']);
}
$groups = getUserGroups(0, $user['affiliationid']);
$extragroups = getContinuationVar('extragroups');
if (!$err && !array_key_exists($return['groupid'], $groups) && !array_key_exists($return['groupid'], $extragroups) && $return['groupid'] != 0) {
$errmsg = i("The submitted user group is invalid.");
$err = 1;
}
if (!$err && $return['groupid'] == 0) {
$return['groupid'] = 'NULL';
}
if (!$err && ($return['seats'] < MIN_BLOCK_MACHINES || $return['seats'] > MAX_BLOCK_MACHINES)) {
$errmsg = sprintf(i("The submitted number of seats must be between %d and %d."), MIN_BLOCK_MACHINES, MAX_BLOCK_MACHINES);
$err = 1;
}
if (!$err) {
$imgdata = getImages(0, $return['imageid']);
$concur = $imgdata[$return['imageid']]['maxconcurrent'];
if (!is_null($concur) && $concur != 0 && $return['seats'] > $concur) {
$errmsg = sprintf(i("The selected image can only have %d concurrent reservations. Please reduce the number of requested seats to %d or less."), $concur, $concur);
$err = 1;
}
}
$dooverride = 0;
# check user group access to image
if (($method == 'new' || $method == 'edit') && !$err && !$override) {
$groupresources = getUserResources(array("imageAdmin", "imageCheckOut"), array("available"), 0, 0, 0, $return['groupid']);
if (!array_key_exists($return['imageid'], $groupresources['image'])) {
$dooverride = 1;
$errmsg = i("WARNING - The selected user group does not currently have access to the selected environment. You can submit the Block Allocation again to ignore this warning.");
$err = 1;
}
}
if (!$err && $type != 'weekly' && $type != 'monthly' && $type != 'list') {
$errmsg = i("You must select one of \"Repeating Weekly\", \"Repeating Monthly\", or \"List of Dates/Times\".");
$err = 1;
}
if (!$err) {
if ($type == 'list') {
$slots = processInputVar('slots', ARG_STRING);
$return['slots'] = explode(',', $slots);
$return['times'] = array();
$lastdate = array('day' => '', 'ts' => 0);
foreach ($return['slots'] as $slot) {
$tmp = explode('|', $slot);
if (count($tmp) != 3) {
$errmsg = i("Invalid date/time submitted.");
$err = 1;
break;
}
$date = $tmp[0];
if (!$err) {
$datets = strtotime($date);
if ($method != 'edit' && $datets < time() - SECINDAY) {
$errmsg = i("The date must be today or later.");
$err = 1;
break;
}
}
$return['times'][] = "{$tmp[1]}|{$tmp[2]}";
if ($datets > $lastdate['ts']) {
$lastdate['ts'] = $datets;
$lastdate['day'] = $date;
}
}
if (!$err) {
$expirets = strtotime("{$lastdate['day']} 23:59:59");
$return['expiretime'] = unixToDatetime($expirets);
}
}
if ($type == 'weekly' || $type == 'monthly') {
$return['startdate'] = processInputVar('startdate', ARG_NUMERIC);
$return['enddate'] = processInputVar('enddate', ARG_NUMERIC);
//.........这里部分代码省略.........
开发者ID:bq-xiao,项目名称:apache-vcl,代码行数:101,代码来源:blockallocations.php
示例8: releaseLock
if (is_null($proxyPort)) {
releaseLock();
exit("No spare WAN ports for this IP address.");
}
if ($conn->query("insert into wan_sessions (username, serial_number, ip_address, proxy_port, auth_time_utc, expiry_time_utc)\nvalues ('" . $conn->escape_string($username) . "', '" . $conn->escape_string($serialNumber) . "', '{$srcIP}', {$proxyPort}, UTC_TIMESTAMP(), ADDTIME(UTC_TIMESTAMP(), '" . SQUID_WAN_SESSION_DURATION . "'))")) {
iptablesAddWanUser($srcIP, $proxyPort);
} else {
releaseLock();
exit("Error creating session.");
}
} else {
renewWanSession($sessionId, $conn);
}
releaseLock();
// check that our user is active, and hand out a custom PAC if required
$userGroups = getUserGroups($username, true, false);
// if $userGroups === FALSE, the user is inactive (or we encountered an LDAP error)
if (is_array($userGroups)) {
$pacFile = SQUID_ROOT . "/pac.wan.js";
$subs["{PORT}"] = $proxyPort;
foreach ($userGroups as $userGroup) {
if (isset($SQUID_CUSTOM_PAC) && is_array($SQUID_CUSTOM_PAC) && array_key_exists($userGroup, $SQUID_CUSTOM_PAC)) {
$pacFile = SQUID_ROOT . "/" . $SQUID_CUSTOM_PAC[$userGroup];
break;
}
}
}
} else {
$q->close();
releaseLock();
}
开发者ID:eduridden,项目名称:extensions,代码行数:31,代码来源:pac.php
示例9: renewWanSession
$ttl = $row[1] + 0;
// keep the session alive
renewWanSession($row[2], $mconn);
}
releaseLock();
}
if (!$un) {
writeReply("ERR");
// negative cache TTL is 5 seconds
cacheResult($srcIP, $mac, isset($input[1]) ? $input[1] : "", null, 5);
continue;
}
if ($ttl > SQUID_MAX_TTL) {
$ttl = SQUID_MAX_TTL;
}
$userGroups = getUserGroups($un, true, true, $ldapServer, $ldapUser, $ldapPassword, $ldapBase);
if ($userGroups === false) {
// this could indicate a disabled account or an LDAP error
writeReply(SQUID_FAILURE_CODE . " message=\"Unable to retrieve groups for '{$un}'.\"");
cacheResult($srcIP, $mac, isset($input[1]) ? $input[1] : "", null, 10);
continue;
}
if (!isset($input[1])) {
writeReply("OK user={$un}");
cacheResult($srcIP, $mac, "", $un, $ttl);
continue;
} else {
if (!isset($ldapGroups[$input[1]])) {
writeReply(SQUID_FAILURE_CODE . " message=\"No matching group DN found for '{$input['1']}'.\"");
cacheResult($srcIP, $mac, $input[1], null, SQUID_MAX_TTL);
continue;
开发者ID:eduridden,项目名称:extensions,代码行数:31,代码来源:external_auth.php
示例10: AJsaveUserGroupPrivs
function AJsaveUserGroupPrivs()
{
global $user;
$groups = getUserGroups(0, $user['affiliationid']);
$groupid = processInputVar('groupid', ARG_NUMERIC);
if (!array_key_exists($groupid, $groups)) {
sendJSON(array('failed' => 'noaccess'));
return;
}
$permids = processInputVar('permids', ARG_STRING);
if (!preg_match('/^[0-9,]*$/', $permids)) {
sendJSON(array('failed' => 'invalid input'));
return;
}
$perms = explode(',', $permids);
$query = "DELETE FROM usergrouppriv WHERE usergroupid = {$groupid}";
doQuery($query, 101);
if (empty($perms[0])) {
sendJSON(array('success' => 1));
return;
}
$values = array();
foreach ($perms as $permid) {
$values[] = "({$groupid}, {$permid})";
}
$allvals = implode(',', $values);
$query = "INSERT INTO usergrouppriv " . "(usergroupid, " . "userprivtypeid) " . "VALUES {$allvals}";
doQuery($query, 101);
sendJSON(array('success' => 1));
$_SESSION['user']["groupperms"] = getUsersGroupPerms(array_keys($user['groups']));
}
开发者ID:bq-xiao,项目名称:apache-vcl,代码行数:31,代码来源:privileges.php
示例11: confirmDeleteGroup
function confirmDeleteGroup()
{
$groupid = getContinuationVar("groupid");
$type = getContinuationVar("type");
$usergroups = getUserGroups(1);
$resourcegroups = getResourceGroups();
if ($type == "user") {
$title = "Delete User Group";
$question = "Delete the following user group?";
$name = $usergroups[$groupid]["name"];
$target = "";
} else {
$title = "Delete Resource Group";
$question = "Delete the following resource group?";
list($resourcetype, $name) = split('/', $resourcegroups[$groupid]["name"]);
$target = "#resources";
}
if (checkForGroupUsage($groupid, $type)) {
print "<H2 align=center>{$title}</H2>\n";
print "This group is currently assigned to at least one node in the ";
print "privilege tree. You cannot delete it until it is no longer ";
print "in use.";
return;
}
print "<DIV align=center>\n";
print "<H2>{$title}</H2>\n";
print "{$question}<br><br>\n";
print "<TABLE>\n";
if ($type == "resource") {
print " <TR>\n";
print " <TH align=right>Type:</TH>\n";
print " <TD>{$resourcetype}</TD>\n";
print " </TR>\n";
}
print " <TR>\n";
print " <TH align=right>Name:</TH>\n";
print " <TD>{$name}</TD>\n";
print " </TR>\n";
if ($type == "resource") {
print " <TR>\n";
print " <TH align=right>Owning User Group:</TH>\n";
print " <TD>" . $resourcegroups[$groupid]["owner"] . "</TD>\n";
print " </TR>\n";
}
print "</TABLE>\n";
print "<TABLE>\n";
print " <TR valign=top>\n";
print " <TD>\n";
print " <FORM action=\"" . BASEURL . SCRIPT . "{$target}\" method=post>\n";
$cdata = array('groupid' => $groupid, 'type' => $type);
$cont = addContinuationsEntry('submitDeleteGroup', $cdata);
print " <INPUT type=hidden name=continuation value=\"{$cont}\">\n";
print " <INPUT type=submit value=Submit>\n";
print " </FORM>\n";
print " </TD>\n";
print " <TD>\n";
print " <FORM action=\"" . BASEURL . SCRIPT . "\" method=post>\n";
print " <INPUT type=hidden name=mode value=viewGroups>\n";
print " <INPUT type=submit value=Cancel>\n";
print " </FORM>\n";
print " </TD>\n";
print " </TR>\n";
print "</TABLE>\n";
}
开发者ID:gw-acadtech,项目名称:VCL,代码行数:64,代码来源:groups.php
示例12: check_login
function check_login($referer, $loginEmail, $loginPassword)
{
global $username;
global $password;
global $hostName;
global $databaseName;
global $connection;
global $HeaderString;
global $loginUserID;
global $loginFirstName;
global $loginLastName;
global $adminLoginEmail;
global $abbrevInstitution;
global $tableAuth, $tableUserData, $tableUsers;
// defined in 'db.inc.php'
global $loc;
// Get the two character salt from the email address collected from the challenge
$salt = substr($loginEmail, 0, 2);
// Encrypt the loginPassword collected from the challenge (so that we can compare it to the encrypted passwords that are stored in the 'auth' table)
$crypted_password = crypt($loginPassword, $salt);
// CONSTRUCT SQL QUERY:
$query = "SELECT user_id FROM {$tableAuth} WHERE email = " . quote_smart($loginEmail) . " AND password = " . quote_smart($crypted_password);
// -------------------
// (1) OPEN CONNECTION, (2) SELECT DATABASE
connectToMySQLDatabase();
// function 'connectToMySQLDatabase()' is defined in 'include.inc.php'
// (3) RUN the query on the database through the connection:
$result = queryMySQLDatabase($query);
// function 'queryMySQLDatabase()' is defined in 'include.inc.php'
// (4) EXTRACT results:
if (mysql_num_rows($result) == 1) {
$foundUser = true;
// then we have found the user
$row = mysql_fetch_array($result);
// fetch the one row into the array '$row'
} else {
$foundUser = false;
}
// -------------------
if ($foundUser) {
// Clear any other session variables:
if (isset($_SESSION['errors'])) {
// delete the 'errors' session variable:
deleteSessionVariable("errors");
}
// function 'deleteSessionVariable()' is defined in 'include.inc.php'
if (isset($_SESSION['formVars'])) {
// delete the 'formVars' session variable:
deleteSessionVariable("formVars");
}
// function 'deleteSessionVariable()' is defined in 'include.inc.php'
$userID = $row["user_id"];
// extract the user's userID from the last query
// Now we need to get the user's first name and last name (e.g., in order to display them within the login welcome message)
$query = "SELECT user_id, first_name, last_name, abbrev_institution, language, last_login FROM {$tableUsers} WHERE user_id = " . quote_smart($userID);
// CONSTRUCT SQL QUERY
$result = queryMySQLDatabase($query);
// RUN the query on the database through the connection (function 'queryMySQLDatabase()' is defined in 'include.inc.php')
$row2 = mysql_fetch_array($result);
// EXTRACT results: fetch the one row into the array '$row2'
// Save the fetched user details to the session file:
// Write back session variables:
saveSessionVariable("loginEmail", $loginEmail);
// function 'saveSessionVariable()' is defined in 'include.inc.php'
saveSessionVariable("loginUserID", $row2["user_id"]);
saveSessionVariable("loginFirstName", $row2["first_name"]);
saveSessionVariable("loginLastName", $row2["last_name"]);
saveSessionVariable("abbrevInstitution", $row2["abbrev_institution"]);
saveSessionVariable("userLanguage", $row2["language"]);
saveSessionVariable("lastLogin", $row2["last_login"]);
// Get all user groups specified by the current user
// and (if some groups were found) save them as semicolon-delimited string to the session variable 'userGroups':
getUserGroups($tableUserData, $row2["user_id"]);
// function 'getUserGroups()' is defined in 'include.inc.php'
if ($loginEmail == $adminLoginEmail) {
// ('$adminLoginEmail' is specified in 'ini.inc.php')
// Get all user groups specified by the admin
// and (if some groups were found) save them as semicolon-delimited string to the session variable 'adminUserGroups':
getUserGroups($tableUsers, $row2["user_id"]);
}
// function 'getUserGroups()' is defined in 'include.inc.php'
// Get all user queries that were saved previously by the current user
// and (if some queries were found) save them as semicolon-delimited string to the session variable 'userQueries':
getUserQueries($row2["user_id"]);
// function 'getUserQueries()' is defined in 'include.inc.php'
// Get all export formats that were selected previously by the current user
// and (if some formats were found) save them as semicolon-delimited string to the session variable 'user_export_formats':
getVisibleUserFormatsStylesTypes($row2["user_id"], "format", "export");
// function 'getVisibleUserFormatsStylesTypes()' is defined in 'include.inc.php'
// Get all citation formats that were selected previously by the current user
// and (if some formats were found) save them as semicolon-delimited string to the session variable 'user_cite_formats':
getVisibleUserFormatsStylesTypes($row2["user_id"], "format", "cite");
// function 'getVisibleUserFormatsStylesTypes()' is defined in 'include.inc.php'
// Get all citation styles that were selected previously by the current user
// and (if some styles were found) save them as semicolon-delimited string to the session variable 'user_styles':
getVisibleUserFormatsStylesTypes($row2["user_id"], "style", "");
// function 'getVisibleUserFormatsStylesTypes()' is defined in 'include.inc.php'
// Get all document types that were selected previously by the current user
// and (if some types were found) save them as semicolon-delimited string to the session variable 'user_types':
getVisibleUserFormatsStylesTypes($row2["user_id"], "type", "");
//.........这里部分代码省略.........
开发者ID:Olari0,项目名称:Finugriling,代码行数:101,代码来源:user_login.php
示例13: switch
<?php
/*
Script para manejar cualquier request para obtener datos de la base de datos
*/
require_once 'functions.php';
if (isset($_POST['id']) and isset($_POST['getData'])) {
switch ($_POST['getData']) {
case 0:
echo json_encode(getUserGroups($_POST['id']));
break;
case 1:
echo json_encode(getTeacherUserGroups($_POST['id']));
break;
case 2:
echo json_encode(getTeachers());
break;
case 3:
echo json_encode(getAllGroups());
break;
case 4:
echo json_encode(getTasksFromClass($_POST['group']));
break;
case 5:
echo json_encode(getStudentsFromClass($_POST['group']));
break;
case 6:
echo json_encode(getAllGroupsReport());
break;
case 7:
echo json_encode(getTeacherUserGroupsReport($_POST['id']));
开发者ID:hecerinc,项目名称:inclassassistant,代码行数:31,代码来源:getData.php
示例14: processProfileInput
//.........这里部分代码省略.........
$err['field'] = 'desc';
$err['error'] = 1;
return $err;
}
$resources = getUserResources(array("imageAdmin", "imageCheckOut"));
$images = removeNoCheckout($resources['image']);
if (!array_key_exists($ret['imageid'], $images)) {
$err['msg'] = "Invalid image selected";
$err['field'] = 'imageid';
$err['error'] = 1;
return $err;
}
$addrArr = explode('.', $ret['fixedIP']);
if ($ret['fixedIP'] == '') {
$ret['fixedIP'] = 'NULL';
} elseif (!validateIPv4addr($ret['fixedIP'])) {
$err['msg'] = "Invalid value for Fixed IP Address. Must be w.x.y.z with each of " . "w, x, y, and z being between 1 and 255 (inclusive)";
$err['field'] = 'fixedIP';
$err['error'] = 1;
return $err;
} elseif (!preg_match('/^[1]+0[^1]+$/', sprintf('%032b', ip2long($ret['netmask'])))) {
$err['msg'] = "Invalid netmask specified";
$err['field'] = 'netmask';
$err['error'] = 1;
return $err;
} elseif (!validateIPv4addr($ret['router'])) {
$err['msg'] = "Invalid value for Router. Must be w.x.y.z with each of " . "w, x, y, and z being between 1 and 255 (inclusive)";
$err['field'] = 'router';
$err['error'] = 1;
return $err;
} elseif ((ip2long($ret['fixedIP']) & ip2long($ret['netmask'])) != (ip2long($ret['router']) & ip2long($ret['netmask']))) {
$err['msg'] = "IP address and router are not on the same subnet " . "based on the specified netmask.";
$err['field'] = 'router';
$err['error'] = 1;
return $err;
}
if ($ret['fixedIP'] != 'NULL') {
$tmp = explode(',', $ret['dns']);
|
请发表评论