VCL-1080 - Wrong port can be delivered in RDP file

only a bunch of whitespace changes


Project: http://git-wip-us.apache.org/repos/asf/vcl/repo
Commit: http://git-wip-us.apache.org/repos/asf/vcl/commit/cf8c88d6
Tree: http://git-wip-us.apache.org/repos/asf/vcl/tree/cf8c88d6
Diff: http://git-wip-us.apache.org/repos/asf/vcl/diff/cf8c88d6

Branch: refs/heads/VCL-1087_VCL_CAS_SSO
Commit: cf8c88d62f99d6d47ece9313f4c99c42be896a7e
Parents: c541328
Author: Josh Thompson <jftho...@ncsu.edu>
Authored: Wed May 9 15:20:58 2018 -0400
Committer: Josh Thompson <jftho...@ncsu.edu>
Committed: Wed May 9 15:20:58 2018 -0400

----------------------------------------------------------------------
 web/.ht-inc/requests.php |  64 +++++++++----------
 web/.ht-inc/utils.php    | 142 +++++++++++++++++++++---------------------
 2 files changed, 103 insertions(+), 103 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/vcl/blob/cf8c88d6/web/.ht-inc/requests.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/requests.php b/web/.ht-inc/requests.php
index a497ba4..42b7a43 100644
--- a/web/.ht-inc/requests.php
+++ b/web/.ht-inc/requests.php
@@ -380,7 +380,7 @@ function viewRequests() {
                        if(checkUserHasPerm('View Debug Information')) {
                                if(! is_null($requests[$i]['vmhostid'])) {
                                        $query = "SELECT c.hostname "
-                                              . "FROM computer c, " 
+                                              . "FROM computer c, "
                                               .      "vmhost v "
                                               . "WHERE v.id = 
{$requests[$i]['vmhostid']} AND "
                                               .       "v.computerid = c.id";
@@ -1329,7 +1329,7 @@ function newReservationHTML() {
                                                $subowner = 1;
                                }
                        }
-                       if($subowner || 
+                       if($subowner ||
                           (array_key_exists($id, $imagedata) &&
                           count($imagedata[$id]['imagerevision']) > 1 &&
                           ($imagedata[$id]['ownerid'] == $user['id'] ||
@@ -1339,7 +1339,7 @@ function newReservationHTML() {
                        }
                }
        }
-       if(in_array('serverCheckOut', $user['privileges']) && 
+       if(in_array('serverCheckOut', $user['privileges']) &&
           count($checkout['image'])) {
                $serveraccess = 1;
                /*$extraimages = getServerProfileImages($user['id']);
@@ -1369,7 +1369,7 @@ function newReservationHTML() {
                                                        $subowner = 1;
                                        }
                                }
-                               if($subowner || 
+                               if($subowner ||
                                   (array_key_exists($id, $imagedata) &&
                                   count($imagedata[$id]['imagerevision']) > 1 
&&
                                   ($imagedata[$id]['ownerid'] == $user['id'] ||
@@ -1884,7 +1884,7 @@ function AJupdateWaitTime() {
                        $start = unixFloor15($now);
                if($type == 'basic' || $type == 'imaging') {
                        # compute maxstart based on 11:45 pm on start day
-                       $tmp = $now + DAYSAHEAD * SECINDAY; 
+                       $tmp = $now + DAYSAHEAD * SECINDAY;
                        $maxstart = mktime(23, 45, 0, date('n', $tmp), 
date('j', $tmp), date('Y', $tmp));
                        if($start > $maxstart)
                                return;
@@ -1986,7 +1986,7 @@ function AJupdateWaitTime() {
        $rc = isAvailable($images, $imageid, $imagerevisionid, $start, $end, 0, 
0, 0, 0, $imaging, $fixedIP);
        if($rc < 1) {
                $cdata = array('now' => 0,
-                              'start' => $start, 
+                              'start' => $start,
                               'end' => $end,
                               'server' => 0,
                               'imageid' => $imageid);
@@ -2488,7 +2488,7 @@ function saveRequestConfigs($reqid, $imageid, $configs, 
$vars) {
                }
        }
        $qbase = "INSERT INTO configinstance "
-              .        "(reservationid, " 
+              .        "(reservationid, "
               .        "configid, "
               .        "configmapid, "
               .        "configinstancestatusid) "
@@ -2706,8 +2706,8 @@ function detailStatusHTML($reqid) {
 
        if($request['currstateid'] == 11 ||
           ($request['currstateid'] == 12 && $request['laststateid'] == 11))
-               return "<br><span class=\"rederrormsg\">" . 
-                      i("The selected reservation has timed out and is no 
longer available.") . 
+               return "<br><span class=\"rederrormsg\">" .
+                      i("The selected reservation has timed out and is no 
longer available.") .
                       "</span>";
 
        if($request['imageid'] == $request['compimageid'])
@@ -2954,7 +2954,7 @@ function viewRequestInfo() {
        print "  </TR>\n";
        print "  <TR>\n";
        print "    <TH align=right>Start&nbsp;Time:</TH>\n";
-       if(datetimeToUnix($request["start"]) < 
+       if(datetimeToUnix($request["start"]) <
           datetimeToUnix($request["daterequested"])) {
                print "    <TD>" . prettyDatetime($request["daterequested"]) . 
"</TD>\n";
        }
@@ -3092,7 +3092,7 @@ function AJeditRequest() {
        $request = getRequestInfo($requestid, 1);
        # check to see if reservation exists
        if(is_null($request) || $request['stateid'] == 11 || 
$request['stateid'] == 12 ||
-          ($request['stateid'] == 14 && 
+          ($request['stateid'] == 14 &&
           ($request['laststateid'] == 11 || $request['laststateid'] == 12))) {
                sendJSON(array('status' => 'resgone'));
                return;
@@ -3208,14 +3208,14 @@ function AJeditRequest() {
        if($unixstart > $now) {
                $tzunixstart = $unixstart + 
($_SESSION['persistdata']['tzoffset'] * 60);
                $cdata['modifystart'] = 1;
-               $txt  = i("Modify reservation for") . " 
<b>{$request['reservations'][0]['prettyimage']}</b> "; 
+               $txt  = i("Modify reservation for") . " 
<b>{$request['reservations'][0]['prettyimage']}</b> ";
                $txt .= i("starting") . " " . prettyDatetime($request["start"]) 
. ": <br>";
                $h .= preg_replace("/(.{1,60}([ \n]|$))/", '\1<br>', $txt);
                $days = array();
                $startday = date('l', $tzunixstart);
                $cur = time() + ($_SESSION['persistdata']['tzoffset'] * 60);
-               for($end = $cur + DAYSAHEAD * SECINDAY; 
-                   $cur < $end; 
+               for($end = $cur + DAYSAHEAD * SECINDAY;
+                   $cur < $end;
                    $cur += SECINDAY) {
                        $index = date('Ymd', $cur);
                        $days[$index] = date('l', $cur);
@@ -3367,13 +3367,13 @@ function AJeditRequest() {
        // if started, only allow end to be modified
        # check for following reservations
        $timeToNext = timeToNextReservation($request);
-       # check for 30 minutes because need 15 minute buffer and min can 
+       # check for 30 minutes because need 15 minute buffer and min can
        # extend by is 15 min
        if($timeToNext < 30) {
                $movedall = 1;
                $lockedall = 1;
                if(count($request['reservations']) > 1) {
-                       # get semaphore on each existing node in cluster so 
that nothing 
+                       # get semaphore on each existing node in cluster so 
that nothing
                        # can get moved to the nodes during this process
 
                        $semimageid = getImageId('noimage');
@@ -3826,9 +3826,9 @@ function AJsubmitEditRequest() {
        $rc = isAvailable($images, $imageid, $revisions, $startts,
                          $endts, 1, $requestid, 0, 0, 0, $ip, $mac);
        $data = array();
-       if($rc < 1) { 
+       if($rc < 1) {
                $cdata = array('now' => 0,
-                              'start' => $startts, 
+                              'start' => $startts,
                               'end' => $endts,
                               'server' => $allowindefiniteend,
                               'imageid' => $imageid,
@@ -3936,7 +3936,7 @@ function AJconfirmDeleteRequest() {
                return;
        }
        if($request['stateid'] == 11 || $request['stateid'] == 12 ||
-          ($request['stateid'] == 14 && 
+          ($request['stateid'] == 14 &&
           ($request['laststateid'] == 11 || $request['laststateid'] == 12))) {
                $data = array('error' => 1,
                              'refresh' => 1,
@@ -4160,7 +4160,7 @@ function AJrebootRequest() {
        $requestid = getContinuationVar('requestid');
        $reqdata = getRequestInfo($requestid, 1);
        if(is_null($reqdata) || $reqdata['stateid'] == 11 || 
$reqdata['stateid'] == 12 ||
-          ($reqdata['stateid'] == 14 && 
+          ($reqdata['stateid'] == 14 &&
           ($reqdata['laststateid'] == 11 || $reqdata['laststateid'] == 12))) {
                print "resGone('reboot'); ";
                print "dijit.byId('editResDlg').show();";
@@ -4192,7 +4192,7 @@ function AJshowReinstallRequest() {
        $requestid = getContinuationVar('requestid');
        $reqdata = getRequestInfo($requestid, 1);
        if(is_null($reqdata) || $reqdata['stateid'] == 11 || 
$reqdata['stateid'] == 12 ||
-          ($reqdata['stateid'] == 14 && 
+          ($reqdata['stateid'] == 14 &&
           ($reqdata['laststateid'] == 11 || $reqdata['laststateid'] == 12))) {
                sendJSON(array('status' => 'resgone'));
                return;
@@ -4301,7 +4301,7 @@ function AJconnectRequest() {
                return;
        }
        if($requestData['stateid'] == 11 || $requestData['stateid'] == 12 ||
-          ($requestData['stateid'] == 14 && 
+          ($requestData['stateid'] == 14 &&
           ($requestData['laststateid'] == 11 || $requestData['laststateid'] == 
12))) {
                $h = i("This reservation has timed out due to lack of user 
activity and is no longer available.");
                sendJSON(array('html' => $h, 'refresh' => 1));
@@ -4400,17 +4400,17 @@ function AJconnectRequest() {
                        $tos = array($conuser,
                                     $passwd,
                                     $res['connectIP']);
-                       $msg = preg_replace($froms, $tos, 
$method['connecttext']); 
+                       $msg = preg_replace($froms, $tos, 
$method['connecttext']);
                        foreach($method['ports'] as $port) {
                                if($usenat && array_key_exists($port['key'], 
$natports[$cmid]))
-                                       $msg = preg_replace("/{$port['key']}/", 
$natports[$cmid][$port['key']]['publicport'], $msg); 
+                                       $msg = preg_replace("/{$port['key']}/", 
$natports[$cmid][$port['key']]['publicport'], $msg);
                                else {
                                        if((preg_match('/remote desktop/i', 
$method['description']) ||
-                                          preg_match('/RDP/i', 
$method['description'])) && 
+                                          preg_match('/RDP/i', 
$method['description'])) &&
                                           $port['key'] == '#Port-TCP-3389#')
-                                               $msg = 
preg_replace("/{$port['key']}/", $user['rdpport'], $msg); 
+                                               $msg = 
preg_replace("/{$port['key']}/", $user['rdpport'], $msg);
                                        else
-                                               $msg = 
preg_replace("/{$port['key']}/", $port['port'], $msg); 
+                                               $msg = 
preg_replace("/{$port['key']}/", $port['port'], $msg);
                                }
                        }
                        #$h .= preg_replace("/(.{1,120}([ ]|$))/", '\1<br>', 
$msg);
@@ -4620,7 +4620,7 @@ function processRequestInput() {
        $images = removeNoCheckout($resources["image"]);
        #$extraimages = getServerProfileImages($user['id']);
        if((! array_key_exists($return['imageid'], $images) &&
-          /*($return['type'] != 'server' || 
+          /*($return['type'] != 'server' ||
                ! array_key_exists($return['imageid'], $extraimages)) &&*/
           ($return['type'] != 'imaging' ||
           ! array_key_exists($return['imageid'], $withnocheckout))) ||
@@ -4661,7 +4661,7 @@ function processRequestInput() {
                $return['revisionids'][$return['imageid']][] = $revids[0];
        else
                $return['revisionids'][$return['imageid']][] = 
getProductionRevisionid($return['imageid']);
-       
+
        # duration
        if($return['ending'] == 'duration') {
                $return['duration'] = processInputVar('duration', ARG_NUMERIC, 
0);
@@ -4758,7 +4758,7 @@ function processRequestInput() {
                                $return['dnsArr'][] = $dnsaddr;
                                $cnt++;
                        }
-       
+
                        # check that a management node can handle the network
                        $mappedmns = getMnsFromImage($return['imageid']);
                        $mnnets = checkAvailableNetworks($return['ipaddr']);
@@ -5009,8 +5009,8 @@ function getReserveDayData() {
        $cur = time();
        if(array_key_exists('tzoffset', $_SESSION['persistdata']))
                $cur += $_SESSION['persistdata']['tzoffset'] * 60;
-       for($end = $cur + DAYSAHEAD * SECINDAY; 
-           $cur < $end; 
+       for($end = $cur + DAYSAHEAD * SECINDAY;
+           $cur < $end;
            $cur += SECINDAY) {
                $tmp = getdate($cur);
                $index = $cur;

http://git-wip-us.apache.org/repos/asf/vcl/blob/cf8c88d6/web/.ht-inc/utils.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/utils.php b/web/.ht-inc/utils.php
index f7ca371..9c6bcab 100644
--- a/web/.ht-inc/utils.php
+++ b/web/.ht-inc/utils.php
@@ -448,7 +448,7 @@ function checkAccess() {
                                                exit;
                                        }
                                        $search = ldap_search($ds,
-                                                             $auth['binddn'], 
+                                                             $auth['binddn'],
                                                              
"{$auth['lookupuserfield']}={$user['unityid']}",
                                                              array('dn'), 0, 
3, 15);
                                        if($search) {
@@ -498,7 +498,7 @@ function checkAccess() {
                        elseif($authMechs[$authtype]['type'] == 'redirect') {
                                $affilid = 
$authMechs[$authtype]['affiliationid'];
                                if(!(isset($apiValidateFunc) && 
is_array($apiValidateFunc) &&
-                                  array_key_exists($affilid, $apiValidateFunc) 
&& 
+                                  array_key_exists($affilid, $apiValidateFunc) 
&&
                                   $apiValidateFunc[$affilid]($xmluser, 
$xmlpass))) {
                                        printXMLRPCerror(3);    # access denied
                                        dbDisconnect();
@@ -636,7 +636,7 @@ function checkCryptkey() {
                $id = fread($fh, 50);
                fclose($fh);
                $_id = mysql_real_escape_string($id);
-       
+
                $query = "SELECT id "
                       . "FROM cryptkey  "
                       . "WHERE id = '$_id'";
@@ -745,7 +745,7 @@ function maintenanceCheck() {
                doQuery($query, 101, 'vcl', 1);
                dbDisconnect();
                return;
-       }  
+       }
        $inmaintenance = 0;
        $skin = '';
        foreach($files as $file) {
@@ -1104,7 +1104,7 @@ function validateUserid($loginid) {
        global $affilValFuncArgs, $affilValFunc;
        if(empty($loginid))
                return 0;
-       
+
        $rc = getAffilidAndLogin($loginid, $affilid);
        if($rc == -1)
                return 0;
@@ -1122,15 +1122,15 @@ function validateUserid($loginid) {
                return 1;
 
        if($rc == 0 &&
-          ALLOWADDSHIBUSERS == 1 && 
+          ALLOWADDSHIBUSERS == 1 &&
           strpos($loginid, '@')) {
                $query = "SELECT shibonly "
                       . "FROM affiliation "
                       . "WHERE id = " . DEFAULT_AFFILID;
-               $qh = doQuery($query); 
+               $qh = doQuery($query);
                $row = mysql_fetch_assoc($qh);
                if($row['shibonly'] == 1)
-                       return 0;           
+                       return 0;
        }
 
        $valfunc = $affilValFunc[$affilid];
@@ -1270,7 +1270,7 @@ function dbDisconnect() {
 function doQuery($query, $errcode=101, $db="vcl", $nolog=0) {
        global $mysql_link_vcl, $mysql_link_acct, $user, $mode, 
$ENABLE_ITECSAUTH;
        if($db == "vcl") {
-               if(QUERYLOGGING != 0 && (! $nolog) && 
+               if(QUERYLOGGING != 0 && (! $nolog) &&
                   preg_match('/^(UPDATE|INSERT|DELETE)/', $query) &&
                   strpos($query, 'UPDATE continuations SET expiretime = ') === 
FALSE) {
                        $logquery = str_replace("'", "\'", $query);
@@ -1373,7 +1373,7 @@ function getOSList() {
 ///                  checked out\n
 /// \b maxinitialtime - maximum time (in minutes) to be shown when requesting
 ///                     a reservation that the image can reserved for\n
-/// \b imagemetaid - NULL or corresponding id from imagemeta table and the 
+/// \b imagemetaid - NULL or corresponding id from imagemeta table and the
 /// following additional information:\n
 /// \b checkuser - whether or not vcld should check for a logged in user\n
 /// \b sysprep - whether or not to use sysprep on creation of the image\n
@@ -1990,7 +1990,7 @@ function getProductionRevisionid($imageid, $nostatic=0) {
                        return '';
        $query = "SELECT id, "
               .        "imageid "
-              . "FROM imagerevision  " 
+              . "FROM imagerevision  "
               . "WHERE production = 1";
        $qh = doQuery($query, 101);
        while($row = mysql_fetch_assoc($qh))
@@ -2190,7 +2190,7 @@ function getUserResources($userprivs, 
$resourceprivs=array("available"),
 
        $resources = array();
        foreach(array_keys($resourcegroups) as $type) {
-               $resources[$type] = 
+               $resources[$type] =
                   getResourcesFromGroups($resourcegroups[$type], $type, 
$includedeleted);
        }
        if(! $bygroup)
@@ -2220,7 +2220,7 @@ function getUserResources($userprivs, 
$resourceprivs=array("available"),
 /// \brief adds resource privileges to $nodeprivs for the parents of $nodeid
 ///
 
////////////////////////////////////////////////////////////////////////////////
-function getUserResourcesUp(&$nodeprivs, $nodeid, $userid, 
+function getUserResourcesUp(&$nodeprivs, $nodeid, $userid,
                             $resourceprivs, $privdataset) {
        # build list of parent nodes
        # starting at top, get images available at that node and user privs 
there and
@@ -2257,7 +2257,7 @@ function getUserResourcesUp(&$nodeprivs, $nodeid, $userid,
 /// of $nodeid
 ///
 
////////////////////////////////////////////////////////////////////////////////
-function getUserResourcesDown(&$nodeprivs, $nodeid, $userid, 
+function getUserResourcesDown(&$nodeprivs, $nodeid, $userid,
                               $resourceprivs, $privdataset) {
        # FIXME can we check for cascading and if not there, don't descend?
        $children = getChildNodes($nodeid);
@@ -2283,11 +2283,11 @@ function getUserResourcesDown(&$nodeprivs, $nodeid, 
$userid,
 ///
 /// \return modifies $nodeprivs, but doesn't return anything
 ///
-/// \brief for $id, gets privileges and cascaded privileges the user and any 
+/// \brief for $id, gets privileges and cascaded privileges the user and any
 /// groups the user is and adds them to $nodeprivs
 ///
 
////////////////////////////////////////////////////////////////////////////////
-function addNodeUserResourcePrivs(&$nodeprivs, $id, $lastid, $userid, 
+function addNodeUserResourcePrivs(&$nodeprivs, $id, $lastid, $userid,
                                   $resourceprivs, $privdataset) {
        $nodeprivs[$id]["user"] = array("cascade" => 0);
        foreach($resourceprivs as $priv) {
@@ -2358,9 +2358,9 @@ function addNodeUserResourcePrivs(&$nodeprivs, $id, 
$lastid, $userid,
                        if($noprivs)
                                $nodeprivs[$id][$groupid]["cascade"] = 0;
                }
-               // if group not blocking at this node, and group had cascade at 
previous 
+               // if group not blocking at this node, and group had cascade at 
previous
                # node
-               if($lastid && ! $nodeprivs[$id][$groupid]["block"] && 
+               if($lastid && ! $nodeprivs[$id][$groupid]["block"] &&
                   isset($nodeprivs[$lastid][$groupid]) &&
                   $nodeprivs[$lastid][$groupid]["cascade"]) {
                        # set cascade = 1
@@ -2725,7 +2725,7 @@ function encryptData($data, $cryptkey, $algo, $option, 
$keylength) {
        $cryptdata = $iv . $cryptdata;
        return trim(base64_encode($cryptdata));
 }
- 
+
 
////////////////////////////////////////////////////////////////////////////////
 ///
 /// \fn decryptData($data, $cryptkey, $algo, $option, $keylength)
@@ -3392,7 +3392,7 @@ function getUserEditGroups($id) {
                       . "FROM `usergroup` u, "
                       .      "`usergroupmembers` m "
                       . "WHERE u.editusergroupid = m.usergroupid AND "
-                      .       "(u.ownerid = $id OR m.userid = $id) AND " 
+                      .       "(u.ownerid = $id OR m.userid = $id) AND "
                       .       "u.affiliationid = {$user['affiliationid']} "
                       . "ORDER BY name";
        }
@@ -3714,7 +3714,7 @@ function addUserGroupMember($loginid, $groupid) {
                return;
 
        $query = "INSERT INTO usergroupmembers "
-              .        "(userid, " 
+              .        "(userid, "
               .        "usergroupid) "
               . "VALUES "
               .        "($userid, "
@@ -3966,7 +3966,7 @@ function processInputVar($vartag, $type, 
$defaultvalue=NULL, $stripwhitespace=0)
           strncmp("{$_POST[$vartag]}", "0", 1) == 0 &&
           $type == ARG_NUMERIC &&
                strncmp("{$_POST[$vartag]}", "0x0", 3) != 0) ||
-          (array_key_exists($vartag, $_GET) && 
+          (array_key_exists($vartag, $_GET) &&
           ! is_array($_GET[$vartag]) &&
           strncmp("{$_GET[$vartag]}", "0", 1) == 0 &&
           $type == ARG_NUMERIC &&
@@ -4556,7 +4556,7 @@ function updateUserPrefs($userid, $preferredname, $width, 
$height, $bpp, $audio,
 ///
 /// \param $userid - an id from the user table
 ///
-/// \return an array of privileges types that the user has somewhere in the 
+/// \return an array of privileges types that the user has somewhere in the
 /// privilege tree
 ///
 /// \brief get the privilege types that the user has somewhere in the
@@ -4761,7 +4761,7 @@ function isAvailable($images, $imageid, $imagerevisionid, 
$start, $end,
 
        foreach($requestInfo["images"] as $key => $imageid) {
                # check for max concurrent usage of image
-               if(! $skipconcurrentcheck && 
+               if(! $skipconcurrentcheck &&
                   $images[$imageid]['maxconcurrent'] != NULL) {
                        if($userid == 0)
                                $usersgroups = $user['groups'];
@@ -5576,7 +5576,7 @@ function getPossibleRecentFailures($userid, $imageid) {
 ///
 /// \return an array of resource ids of type $resourcetype2
 ///
-/// \brief gets a list of resources of type $resourcetype2 that $resourcesubid 
+/// \brief gets a list of resources of type $resourcetype2 that $resourcesubid
 /// of type $resourcetype1 maps to based on the resourcemap table
 ///
 
////////////////////////////////////////////////////////////////////////////////
@@ -5894,7 +5894,7 @@ function addRequest($forimaging=0, $revisionid=array(), 
$checkuser=1) {
               .        "computerid, "
               .        "imageid, "
               .        "imagerevisionid, "
-              .        "managementnodeid " 
+              .        "managementnodeid "
               . "FROM semaphore "
               . "WHERE expires > NOW() AND "
               .       "procid = '$uniqid'";
@@ -6117,7 +6117,7 @@ function getRequestInfo($id, $returnNULL=0) {
                if($returnNULL)
                        return NULL;
                # FIXME handle XMLRPC cases
-               if(! $printedHTMLheader) 
+               if(! $printedHTMLheader)
                        print $HTMLheader;
                print "<h1>" . i("OOPS! - Reservation Has Expired") . "</h1>\n";
                $h = i("The selected reservation is no longer available. Go to 
<a>Reservations</a> to request a new reservation or select another one that is 
available.");
@@ -6204,7 +6204,7 @@ function getRequestInfo($id, $returnNULL=0) {
 /// \fn updateRequest($requestid, $nowfuture)
 ///
 /// \param $requestid - the id of the request to be updated
-/// \param $nowfuture (optional) - "now" or "future"; whether the 
+/// \param $nowfuture (optional) - "now" or "future"; whether the
 ///
 /// \brief updates an entry to the request and reservation tables
 ///
@@ -6256,7 +6256,7 @@ function updateRequest($requestid, $nowfuture="now") {
                                    # could be updated, which would end up 
setting both
                                    # rows to the same computer
                doQuery($query, 147);
-               addChangeLogEntry($logid, NULL, $endstamp, $startstamp, 
$computerid, NULL, 
+               addChangeLogEntry($logid, NULL, $endstamp, $startstamp, 
$computerid, NULL,
                                  1);
                $query = "UPDATE sublog "
                       . "SET computerid = $computerid "
@@ -6430,7 +6430,7 @@ function moveReservationsOffComputer($compid=0, $count=0) 
{
        # a reservation is reassigned to meets the same restrictions
        foreach($resInfo as $res) {
                // pass forimaging = 1 so that isAvailable only looks at one 
computer
-               $rc = isAvailable($images, $res["imageid"], 
$res['imagerevisionid'], 
+               $rc = isAvailable($images, $res["imageid"], 
$res['imagerevisionid'],
                      datetimeToUnix($res["start"]), 
datetimeToUnix($res["end"]), 0,
                      0, $res["userid"], 0, 1);
                if($rc < 1) {
@@ -6442,7 +6442,7 @@ function moveReservationsOffComputer($compid=0, $count=0) 
{
                return 0;
        foreach($resInfo as $res) {
                $rc = isAvailable($images, $res["imageid"], 
$res['imagerevisionid'],
-                     datetimeToUnix($res["start"]), 
datetimeToUnix($res["end"]), 1, 
+                     datetimeToUnix($res["start"]), 
datetimeToUnix($res["end"]), 1,
                      0, $res["userid"], 0, 1);
                if($rc > 0) {
                        $newcompid = array_shift($requestInfo["computers"]);
@@ -6894,7 +6894,7 @@ function getUserRequests($type, $id=0) {
                        }
                        else {
                                $data[$count]['serverowner'] = 0;
-                               if(! empty($row['serveradmingroupid']) && 
+                               if(! empty($row['serveradmingroupid']) &&
                                   array_key_exists($row['serveradmingroupid'], 
$user['groups']))
                                        $data[$count]['serveradmin'] = 1;
                                else
@@ -7182,7 +7182,7 @@ function getDepartmentName($id) {
 ///
 /// \fn getImageId($image)
 ///
-/// \param $image - name of an image (must match name (not prettyname) in the 
+/// \param $image - name of an image (must match name (not prettyname) in the
 /// image table)
 ///
 /// \return the id of matching $image in the image table or 0 if lookup fails
@@ -7519,7 +7519,7 @@ function getManagementNodes($alive="neither", 
$includedeleted=0, $id=0) {
                        $return[$mn_id]['timeservers'] = $timeservers;
                }
        }
-       
+
        return $return;
 }
 
@@ -7660,7 +7660,7 @@ function getPredictiveModules() {
 /// \return array of free/used timeslotes
 ///
 /// \brief generates an array of availability for computers where index is a
-/// computerid with a value that is an array whose indexes are unix timestamps 
+/// computerid with a value that is an array whose indexes are unix timestamps
 /// that increment by 15 minutes with a value that is an array with 2 indexes:
 /// 'scheduleclosed' and 'available' that tell if the computer's schedule is
 /// closed at that moment and if the computer is available at that moment\n
@@ -7855,7 +7855,7 @@ function getTimeSlots($compids, $end=0, $start=0) {
                                continue;
                        }
                        //if between a start and end time
-                       if($current >= $times[$id][$count]["start"] && 
+                       if($current >= $times[$id][$count]["start"] &&
                           $current <  $times[$id][$count]["end"]) {
                                if($first) {
                                        # set the previous 15 minute block to 
show as busy to allow for load time
@@ -7874,7 +7874,7 @@ function getTimeSlots($compids, $end=0, $start=0) {
                                continue;
                        }
                        //if after previous end but before this start
-                       if($current >= $times[$id][$count - 1]["end"] && 
+                       if($current >= $times[$id][$count - 1]["end"] &&
                           $current <  $times[$id][$count]["start"]) {
                                $reserveInfo[$id][$current]["available"] = 1;
                                continue;
@@ -8304,7 +8304,7 @@ function showTimeTable($links) {
 /// \param $ip - (optional, default='') desired IP address
 /// \param $mac - (optional, default='') desired MAC address
 ///
-/// \return an array where each key is a unix timestamp for the start time of 
+/// \return an array where each key is a unix timestamp for the start time of
 /// the available slot and each element is an array with these items:\n
 /// \b start - start of slot in datetime format\n
 /// \b startts - start of slot in unix timestamp format\n
@@ -8993,7 +8993,7 @@ function getUserComputerMetaData() {
        if(isset($_SESSION['usersessiondata'][$key]))
                return $_SESSION['usersessiondata'][$key];
        $computers = getComputers();
-       $resources = getUserResources(array("computerAdmin"), 
+       $resources = getUserResources(array("computerAdmin"),
                                      array("administer", "manageGroup"), 0, 1);
        $return = array("platforms" => array(),
                        "schedules" => array());
@@ -9026,7 +9026,7 @@ function getUserComputerMetaData() {
 /// they occur\n
 /// \b nextstates - array where each key is a computerloadstate id and its 
value
 /// is that state's following state; the last state has a NULL value\n
-/// \b totaltime - estimated time (in seconds) it takes for all states to 
+/// \b totaltime - estimated time (in seconds) it takes for all states to
 /// complete\n
 /// \b data - array where each key is is a computerloadstate id and each value
 /// is an array with these elements:\n
@@ -9440,8 +9440,8 @@ function getNAThosts($id=0, $sort=0) {
 function getNATports($resid) {
        $ports = array();
        $query = "SELECT n.publicport, "
-              .        "n.connectmethodportid, " 
-              .        "c.port AS privateport, " 
+              .        "n.connectmethodportid, "
+              .        "c.port AS privateport, "
               .        "c.protocol, "
               .        "c.connectmethodid "
               . "FROM natport n, "
@@ -9648,7 +9648,7 @@ function isImageBlockTimeActive($imageid) {
 /// \param $extra - (optional) any extra attributes that need to be set
 ///
 /// \brief prints out a select input part of a form\n
-/// it is assumed that if $selectedid is left off, we assume $dataArr has no 
+/// it is assumed that if $selectedid is left off, we assume $dataArr has no
 /// index '-1'\n
 /// each OPTION's value is the index of that element of the array
 ///
@@ -9707,7 +9707,7 @@ function selectInputAutoDijitHTML($name, $dataArr, 
$domid='', $extra='',
 /// multiple tag set
 ///
 /// \brief generates HTML for select input
-/// it is assumed that if $selectedid is left off, we assume $dataArr has no 
+/// it is assumed that if $selectedid is left off, we assume $dataArr has no
 /// index '-1'\n
 /// each OPTION's value is the index of that element of the array
 ///
@@ -9941,12 +9941,12 @@ function dijitButton($id, $label, $onclick='', 
$wraprightdiv=0) {
 ///
 /// \fn requestIsReady($request)
 ///
-/// \param $request - a request element from the array returned by 
+/// \param $request - a request element from the array returned by
 /// getUserRequests
 ///
 /// \return 1 if request is ready for a user to connect, 0 if not
 ///
-/// \brief checks to see if a request is 
+/// \brief checks to see if a request is
 ///
 
////////////////////////////////////////////////////////////////////////////////
 function requestIsReady($request) {
@@ -9954,7 +9954,7 @@ function requestIsReady($request) {
                if($res["computerstateid"] != 3 && $res["computerstateid"] != 8)
                        return 0;
        }
-       if(($request["currstateid"] == 14 &&      // request current state 
pending 
+       if(($request["currstateid"] == 14 &&      // request current state 
pending
           $request["laststateid"] == 3 &&        //   and last state reserved 
and
           $request["computerstateid"] == 3) ||   //   computer reserved
           ($request["currstateid"] == 8 &&       // request current state inuse
@@ -10171,7 +10171,7 @@ function addLoadTime($imageid, $start, $loadtime) {
 ///
 /// \return 1 if schedule is closed at $timestamp, 0 if it is open
 ///
-/// \brief checks to see if the computer's schedule is open or closed at 
+/// \brief checks to see if the computer's schedule is open or closed at
 /// $timestamp
 ///
 
////////////////////////////////////////////////////////////////////////////////
@@ -10303,7 +10303,7 @@ function getUserGroupID($name, 
$affilid=DEFAULT_AFFILID, $noadd=0) {
 /// \fn getUserGroupName($id, $incAffil)
 ///
 /// \param $id - id of a user group
-/// \param $incAffil - 0 or 1 (optional, defaults to 0); include @ and 
+/// \param $incAffil - 0 or 1 (optional, defaults to 0); include @ and
 /// affiliation at the end
 ///
 /// \return name for $id from usergroup table or 0 if name not found
@@ -10454,7 +10454,7 @@ function getMaintItemsForTimeTable($start, $end) {
 ///
 
////////////////////////////////////////////////////////////////////////////////
 function unset_by_val($needle, &$haystack) {
-       while(($gotcha = array_search($needle,$haystack)) > -1) { 
+       while(($gotcha = array_search($needle,$haystack)) > -1) {
                unset($haystack[$gotcha]);
        }
 }
@@ -10544,15 +10544,15 @@ function sendRDPfile() {
        print "desktopwidth:i:$width\r\n";
        print "desktopheight:i:$height\r\n";
        print "session bpp:i:$bpp\r\n";
-       
+
        print "winposstr:s:0,1,0,0,5000,4000\r\n";
-       # 0: 
+       # 0:
        # 1:    use coordinates for the window position, as opposed to 3 - 
maximized
        # 0:    left position in client coordinates
        # 0:    top position in client coordinates
        # 5000: width in pixels - set large to avoid scrollbars
        # 4000: height in pixels - set large to avoid scrollbars
-       
+
        print "full address:s:$ipaddress$port\r\n";
        print "compression:i:1\r\n";
        print "keyboardhook:i:2\r\n";
@@ -10636,16 +10636,16 @@ function addLogEntry($nowfuture, $start, $end, 
$wasavailable, $imageid) {
 /// available; \b NOTE: pass -1 instead of NULL if you don't want this field
 /// to be updated
 ///
-/// \brief adds an entry to the changelog table and updates information in 
+/// \brief adds an entry to the changelog table and updates information in
 /// the log table
 ///
 
////////////////////////////////////////////////////////////////////////////////
-function addChangeLogEntry($logid, $remoteIP, $end=NULL, $start=NULL, 
+function addChangeLogEntry($logid, $remoteIP, $end=NULL, $start=NULL,
                            $computerid=NULL, $ending=NULL, $wasavailable=-1) {
        if($logid == 0) {
                return;
        }
-       $query = "SELECT computerid, " 
+       $query = "SELECT computerid, "
               .        "start, "
               .        "initialend, "
               .        "remoteIP, "
@@ -10936,8 +10936,8 @@ function getUserMaxTimes($uid=0) {
 ///
 /// \param $max - max allowed length in minutes
 ///
-/// \return array of lengths up to $max starting with 30 minutes, 1 hour, 
-/// 2 hours, then increasing by 2 hours up to 47 hours, then 2 days, then 
+/// \return array of lengths up to $max starting with 30 minutes, 1 hour,
+/// 2 hours, then increasing by 2 hours up to 47 hours, then 2 days, then
 /// increasing by 1 day; indexes are the duration in minutes
 ///
 /// \brief generates an array of reservation lengths
@@ -11242,7 +11242,7 @@ function getMappedConfigs($imageid) {
               .      "user u, "
               .      "affiliation ua, "
               .      "configtype ct, "
-              .      "configmaptype cmt, " 
+              .      "configmaptype cmt, "
               .      "affiliation a, "
               .      "configstage cs "
               . "WHERE cm.configid = c.id AND "
@@ -11347,7 +11347,7 @@ function getMappedSubConfigs($mode, $arg1, $arg2, 
$rec=0) {
               .      "user u, "
               .      "affiliation ua, "
               .      "configtype ct, "
-              .      "configmaptype cmt, " 
+              .      "configmaptype cmt, "
               .      "affiliation a, "
               .      "configstage cs "
               . "WHERE cm.configid = c.id AND "
@@ -11751,7 +11751,7 @@ function sortKeepIndex($a, $b) {
 ///
 /// \return -1, 0, 1 if numerical parts of $a <, =, or > $b
 ///
-/// \brief compares $a and $b to determine which one should be ordered first; 
+/// \brief compares $a and $b to determine which one should be ordered first;
 /// has some understand of numerical order in strings
 ///
 
////////////////////////////////////////////////////////////////////////////////
@@ -11811,8 +11811,8 @@ function compareDashedNumbers($a, $b) {
 /// \param $resource2inlist - (optional) comma delimited list of resource 
groups
 /// to limit query to
 ///
-/// \return an array of $resourcetype1 group to $resourcetype2 group mappings 
-/// where each index is a group id from $resourcetype1 and each value is an 
+/// \return an array of $resourcetype1 group to $resourcetype2 group mappings
+/// where each index is a group id from $resourcetype1 and each value is an
 /// array of $resourcetype2 group ids
 ///
 /// \brief builds an array of $resourcetype2 group ids for each $resourcetype1
@@ -12026,7 +12026,7 @@ function generateString($length=8) {
 /// \param $id (optional) - a profile id; if specified, only data about this
 /// profile will be returned
 ///
-/// \return an array of profiles where each key is the profile id and each 
+/// \return an array of profiles where each key is the profile id and each
 /// element is an array with these keys:\n
 /// \b profilename - name of profile\n
 /// \b name - name of profile (so array can be passed to printSelectInput)\n
@@ -12119,7 +12119,7 @@ function getENUMvalues($table, $field) {
 /// \fn addContinuationsEntry($nextmode, $data, $duration, $deleteFromSelf,
 ///                           $multicall, $repeatProtect)
 ///
-/// \param $nextmode - next mode to go in to 
+/// \param $nextmode - next mode to go in to
 /// \param $data (optional, default=array())- array of data to make available
 /// in $nextmode
 /// \param $duration (optional, default=SECINWEEK)- how long this continuation
@@ -12453,7 +12453,7 @@ function getVariable($key, $default=NULL, $incparams=0) 
{
 ///
 /// \return array of values from variable table
 ///
-/// \brief gets data from the variable table for $pattern matches 'name' from 
+/// \brief gets data from the variable table for $pattern matches 'name' from
 /// table
 ///
 
////////////////////////////////////////////////////////////////////////////////
@@ -12523,7 +12523,7 @@ function setVariable($key, $data, $serialization='') {
        }
        if($update)
                $query = "UPDATE variable "
-                      . "SET value = '$qdata', " 
+                      . "SET value = '$qdata', "
                       .     "serialization = '$serialization', "
                       .     "setby = 'webcode', "
                       .     "timestamp = NOW() "
@@ -12731,13 +12731,13 @@ function xmlRPChandler($function, $args, $blah) {
                if(! defined('XMLRPCLOGGING') || XMLRPCLOGGING != 0) {
                        $saveargs = mysql_real_escape_string(serialize($args));
                        $query = "INSERT INTO xmlrpcLog "
-                              .        "(xmlrpcKeyid, " 
+                              .        "(xmlrpcKeyid, "
                               .        "timestamp, "
                               .        "IPaddress, "
                               .        "method, "
                               .        "apiversion, "
                               .        "comments) "
-                              . "VALUES " 
+                              . "VALUES "
                               .        "($keyid, "
                               .        "NOW(), "
                               .        "'$remoteIP', "
@@ -13024,7 +13024,7 @@ function json_encode($a=false) {
                         // Always use "." for floats.
                         return floatval(str_replace(",", ".", strval($a)));
                }
- 
+
                if (is_string($a)) {
                         static $jsonReplaces = array(array("\\", "/", "\n", 
"\t", "\r", "\b", "\f", '"'), array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', 
'\\f', '\"'));
                        return '"' . str_replace($jsonReplaces[0], 
$jsonReplaces[1], $a) . '"';
@@ -14365,7 +14365,7 @@ function setVCLLocale() {
                setcookie("VCLLOCALE", $_COOKIE['VCLLOCALE'], (time() + (86400 
* 31)), "/", COOKIEDOMAIN);
                $locale = $_COOKIE['VCLLOCALE'];
        }
-       
+
        #putenv('LC_ALL=' . $locale);
        # use UTF8 encoding for any locales other than English (we may just be 
able
        #   to always use UTF8)

Reply via email to