Beispiel #1
0
function checkAuthResult()
{
    $code = getVariable('code', FALSE);
    $state = getVariable('state', FALSE);
    $oauthUnguessable = getSessionVariable('oauthUnguessable', null);
    if (!$code || !$state || !$oauthUnguessable) {
        return;
    }
    if ($state != $oauthUnguessable) {
        //Miss-match on what we're tring to validated.
        echo "Miss-match on secret'";
        return;
    }
    try {
        $api = new \AABTest\GithubAPI\GithubAPI();
        $command = $api->accessToken(GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET, $code, "http://" . SERVER_HOSTNAME . "/github/return.php");
        $response = $command->execute();
        setSessionVariable('githubAccess', $response);
        echo "You are now authed for the following scopes:<br/>";
        foreach ($response->scopes as $scope) {
            echo $scope . "<br/>";
        }
    } catch (\AABTest\GithubAPI\GithubAPIException $fae) {
        echo "Exception processing response: " . $fae->getMessage();
    }
}
Beispiel #2
0
function checkAuthResult()
{
    $oauthToken = getVariable('oauth_token', FALSE);
    $oauthVerifier = getVariable('oauth_verifier', FALSE);
    /** @var \AABTest\OauthRequestToken $oauthRequest */
    $oauthRequest = getSessionVariable('oauthRequest', null);
    if (!$oauthToken || !$oauthVerifier || !$oauthRequest) {
        return;
    }
    if ($oauthToken != $oauthRequest->oauthToken) {
        //Miss-match on what we're tring to validated.
        return;
    }
    try {
        $oauthConfig = new OauthConfig(FLICKR_KEY, FLICKR_SECRET);
        $oauthService = new \ArtaxApiBuilder\Service\FlickrOauth1($oauthConfig);
        $oauthService->setOauthToken($oauthRequest->oauthToken);
        $oauthService->setTokenSecret($oauthRequest->oauthTokenSecret);
        $api = new \AABTest\FlickrAPI\FlickrAPI(FLICKR_KEY, $oauthService);
        $command = $api->GetOauthAccessToken($oauthVerifier);
        $oauthAccessToken = $command->execute();
        setSessionVariable('oauthAccessToken', $oauthAccessToken);
        echo "Oauth is confirmed - username is:" . $oauthAccessToken->user->username;
    } catch (\AABTest\FlickrAPI\FlickrAPIException $fae) {
        echo "Exception processing response: " . $fae->getResponse()->getBody();
    }
}
Beispiel #3
0
function checkAuthResult()
{
    $code = getVariable('code', FALSE);
    $state = getVariable('state', FALSE);
    $provider = createProvider([], []);
    $oauthUnguessable = getSessionVariable('oauthUnguessable', null);
    if (!$code || !$state || !$oauthUnguessable) {
        return;
    }
    if ($state !== $oauthUnguessable) {
        //Miss-match on what we're tring to validated.
        echo "Mismatch on secret'";
        return;
    }
    try {
        $api = $provider->make('DebugGithub');
        //$client
        /** @var  $api DebugGithub */
        $command = $api->oauthAuthorize(GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET, $code, "http://" . SERVER_HOSTNAME . "/github/return.php");
        $accessResponse = $command->execute();
        setSessionVariable(GITHUB_ACCESS_RESPONSE_KEY, $accessResponse);
        if ($accessResponse->oauthScopes) {
            echo "You are now authed for the following scopes:<br/>";
            foreach ($accessResponse->oauthScopes as $scope) {
                echo $scope . "<br/>";
            }
        }
    } catch (GithubArtaxServiceException $fae) {
        echo "Exception processing response: " . $fae->getMessage();
    }
}
Beispiel #4
0
function AJnewRequest()
{
    global $user, $remoteIP;
    $data = processRequestInput();
    #$data['err'] = 1;
    #$data['errmsg'] = 'none';
    if ($data['err']) {
        sendJSON($data);
        return;
    }
    if ($data['start'] == 0) {
        $nowfuture = 'now';
        $startts = unixFloor15();
        if ($data['ending'] == 'duration') {
            $endts = $startts + $data['duration'] * 60;
            $nowArr = getdate();
            if ($nowArr['minutes'] % 15 != 0) {
                $endts += 900;
            }
        }
    } else {
        $nowfuture = 'future';
        $startts = $data['start'];
        if ($data['ending'] == 'duration') {
            $endts = $startts + $data['duration'] * 60;
        }
    }
    if ($data['ending'] == 'indefinite') {
        $endts = datetimeToUnix('2038-01-01 00:00:00');
    } elseif ($data['ending'] == 'endat') {
        $endts = $data['end'];
    }
    $images = getImages();
    # TODO initially, this is a hack where we munge the datastructure
    # finishconfigs
    /*if($data['type'] == 'server') {
    		$tmp = getConfigClusters($data['imageid'], 1);
    		if(count($tmp)) {
    			$subimages = array();
    			foreach($tmp as $cluster) {
    				for($i = 0; $i < $cluster['maxinstance']; $i++)
    					$subimages[] = $cluster['childimageid'];
    			}
    			$images[$data['imageid']]['subimages'] = $subimages;
    			if($images[$data['imageid']]['imagemetaid'] == NULL)
    				$images[$data['imageid']]['imagemetaid'] = 1;
    		}
    		elseif($images[$data['imageid']]['imagemetaid'] != NULL &&
    			count($images[$data['imageid']]['subimages'])) {
    			$images[$data['imageid']]['subimages'] = array();
    		}
    	}*/
    # check for exceeding max overlaps
    $max = getMaxOverlap($user['id']);
    if (checkOverlap($startts, $endts, $max)) {
        print "dojo.byId('deployerr').innerHTML = '";
        print i("The selected time overlaps with another reservation you have.");
        print "<br>";
        if ($max == 0) {
            print i("You cannot have any overlapping reservations.");
        } else {
            printf(i("You can have up to %d overlapping reservations."), $max);
        }
        print "'; dojo.removeClass('deployerr', 'hidden');";
        return;
    }
    $imaging = 0;
    if ($data['type'] == 'imaging') {
        $imaging = 1;
    }
    $availablerc = isAvailable($images, $data['imageid'], $data['revisionids'], $startts, $endts, 1, 0, 0, 0, $imaging, $data['ipaddr'], $data['macaddr']);
    if ($availablerc == -4) {
        $msg = i("The IP address you specified is assigned to another VCL node and cannot be used at this time. Submitting a time in the future may allow you to make the reservation, but if the IP remains assigned to the other node, the reservation will fail at deploy time.");
        $data = array('err' => 1, 'errmsg' => $msg);
        sendJSON($data);
        return;
    } elseif ($availablerc == -3) {
        $msg = i("The IP or MAC address you specified overlaps with another reservation using the same IP or MAC address you specified. Please use a different IP or MAC or select a different time to deploy the server.");
        $data = array('err' => 1, 'errmsg' => $msg);
        sendJSON($data);
        return;
    } elseif ($availablerc == -2) {
        $msg = i("The time you requested overlaps with a maintenance window.");
        $data = array('err' => 1, 'errmsg' => $msg);
        sendJSON($data);
        return;
    } elseif ($availablerc == -1) {
        cleanSemaphore();
        $msg = i("You have requested an environment that is limited in the number of concurrent reservations that can be made. No further reservations for the environment can be made for the time you have selected.");
        $data = array('err' => 1, 'errmsg' => $msg);
        sendJSON($data);
        return;
    } elseif ($availablerc == 0) {
        cleanSemaphore();
        $data = array('err' => 2);
        sendJSON($data);
        return;
    }
    $requestid = addRequest($imaging, $data['revisionids'], 1 - $data['nousercheck']);
    if ($data['type'] == 'server') {
        if ($data['ipaddr'] != '') {
            # save additional network info in variable table
            $allnets = getVariable('fixedIPavailnetworks', array());
            $key = long2ip($data['network']) . "/{$data['netmask']}";
            $allnets[$key] = array('router' => $data['router'], 'dns' => $data['dnsArr']);
            setVariable('fixedIPavailnetworks', $allnets, 'yaml');
        }
        $query = "UPDATE reservation " . "SET remoteIP = '{$remoteIP}' " . "WHERE requestid = {$requestid}";
        doQuery($query);
        $fields = array('requestid', 'serverprofileid');
        $values = array($requestid, $data['profileid']);
        if ($data['name'] == '') {
            $fields[] = 'name';
            $name = $images[$data['imageid']]['prettyname'];
            $values[] = "'{$name}'";
        } else {
            $fields[] = 'name';
            $name = mysql_real_escape_string($data['name']);
            $values[] = "'{$name}'";
        }
        if ($data['ipaddr'] != '') {
            $fields[] = 'fixedIP';
            $values[] = "'{$data['ipaddr']}'";
        }
        if ($data['macaddr'] != '') {
            $fields[] = 'fixedMAC';
            $values[] = "'{$data['macaddr']}'";
        }
        if ($data['admingroupid'] != 0) {
            $fields[] = 'admingroupid';
            $values[] = $data['admingroupid'];
        }
        if ($data['logingroupid'] != 0) {
            $fields[] = 'logingroupid';
            $values[] = $data['logingroupid'];
        }
        if ($data['monitored'] != 0) {
            $fields[] = 'monitored';
            $values[] = 1;
        }
        $allfields = implode(',', $fields);
        $allvalues = implode(',', $values);
        $query = "INSERT INTO serverrequest ({$allfields}) VALUES ({$allvalues})";
        doQuery($query, 101);
        if ($data['ipaddr'] != '') {
            $srqid = dbLastInsertID();
            $var = array('netmask' => $data['netmask'], 'router' => $data['router'], 'dns' => $data['dnsArr']);
            setVariable("fixedIPsr{$srqid}", $var, 'yaml');
        }
        # TODO configs
        //saveRequestConfigs($requestid, $data['imageid'], $data['configs'], $data['configvars']);
    }
    $data = array('err' => 0);
    sendJSON($data);
}
Beispiel #5
0
/** @var  $accessResponse \GithubService\Model\AccessResponse */
$accessResponse = getSessionVariable(GITHUB_ACCESS_RESPONSE_KEY);
if ($accessResponse) {
    if (!$accessResponse instanceof GithubService\Model\AccessResponse) {
        //class was renamed...or something else bad happened.
        setSessionVariable(GITHUB_ACCESS_RESPONSE_KEY, null);
        $accessResponse = null;
    }
}
$shareClasses = [];
if ($accessResponse) {
    $shareClasses['GithubService\\Model\\AccessResponse'] = $accessResponse;
}
$provider = createProvider([], $shareClasses);
//These actions need to be done before the rest of the page.
$action = getVariable('action');
switch ($action) {
    case 'delete':
        unsetSessionVariable(GITHUB_ACCESS_RESPONSE_KEY);
        $accessResponse = null;
        break;
    case 'revoke':
        revokeAuthority($accessResponse);
        break;
}
try {
    if ($accessResponse == null) {
        echo "<p>You are not github authorised. Please choose the permissions you want to test with:</p>";
        processUnauthorizedActions();
    } else {
        echo "<p>You are github authorised.</p>";
 /**
  * @param GithubService $api
  * @param $accessResponse
  */
 function processAddEmail(GithubService $api, $accessResponse)
 {
     $newEmail = getVariable('email');
     $emailCommand = $api->addUserEmails(new Oauth2Token($accessResponse->accessToken), [$newEmail]);
     $allowedScopes = getAuthorisations();
     if (false) {
         //This isn't working yet.
         $emailCommand->checkScopeRequirement($allowedScopes);
     }
     $emailCommand->execute();
     $request = $emailCommand->createRequest();
     $request->setBody(json_encode([$newEmail]));
     $response = $emailCommand->dispatch($request);
 }
                            scraperwiki::save_sqlite(array("url"), array_merge(array("url" => $resultURL, "type" => $pageType, "parent_page_content" => $entryPageContent, "page_store_count" => count($storesContentList)), $storesContentList));
                        }
                    }
                }
                sleep(2.5);
            }
        }
    } else {
        print "Timeout on {$page} for {$keywords}";
    }
}
register_shutdown_function('handleShutdown');
$currentPage = 1;
$myVar = getVariable("currentPage");
if (isset($myVar)) {
    $currentPage = getVariable("currentPage");
}
function handleShutdown()
{
    global $currentPage;
    $error = error_get_last();
    if ($error !== NULL) {
        setVariable("currentPage", $currentPage + 1);
    }
}
function getVariable($key)
{
    try {
        return scraperwiki::get_var($key);
    } catch (Exception $e) {
        return;
Beispiel #8
0
function makeOauthRequest()
{
    $scopes = getVariable('scopes');
    echo "<p>Requesting scopes: " . implode(', ', $scopes) . ".</p>";
    showOauthRequest($scopes);
}
					  $_SESSION["rh_idUsuJefe"]=(String)$adamS[5];
					  $_SESSION["rh_fechaIniAus"]=(String)$adamS[6];
					  $_SESSION["rh_fechaFinalAus"]=(String)$adamS[7];
					  $_SESSION["rh_indicador"]=(String)$adamS[8];
					  
					  
					  		   				   
					  $usuario=getVariable("rh_usuario");
					  $nombreUsuario=getVariable("rh_nombre");
					  $idSociedad=getVariable("rh_sociedad");
					  $idCecos1=getVariable("rh_idCecos");
					  $idJer=getVariable("rh_idJer");
					  $idUsuJefe=getVariable("rh_idUsuJefe");
					  $fechaInicialAus=cambiaf_a_mysql(getVariable("rh_fechaIniAus"));				   
					  $fechaFinalAus=cambiaf_a_mysql(getVariable("rh_fechaFinalAus"));
					  $indicador=getVariable("rh_indicador");
					  
					  $logLine=$usuario."\t".$nombreUsuario."\t".$idCecos1."\t".$idJer."\t".$idUsuJefe."\t".$fechaInicialAus."\t".$fechaFinalAus."\t".$indicador;
					  $idCecos=$U->getIdCecosSociedad($idCecos1,$idSociedad);
					   //Cumple validaci�n indicador = "A"
					  if ($idCecos== null || $idCecos<=0){
					  	guardaLogError("005",$logLine,$i);
					  }
					  else{
						  if (strcmp($indicador,"A")==0){
						  	$U->Load_Usuario_rh($usuario);
						     	if (strcmp($U->Get_dato("u_usuario"), $usuario)==0){
									guardaLogError("003",$logLine,$i);   		
						   		}
						   		else{
						   			$Ut=new Usuario();
Beispiel #10
0
        $value = parseArrayToStr( $value, "\n" );
    }

}
// Init value from ini (default\override\extensions\siteaccess)
$values = array();
$values['default'] = getVariable( $block, $settingName, $iniFile, 'settings/' );
$values['siteaccess'] = getVariable( $block, $settingName, $iniFile, "settings/siteaccess/$siteAccess" );
$values['override'] = getVariable( $block, $settingName, $iniFile, "settings/override/" );
// Get values from extensions
$ini = eZINI::instance();
$extensions = $ini->hasVariable( 'ExtensionSettings','ActiveExtensions' ) ? $ini->variable( 'ExtensionSettings','ActiveExtensions' ) : array();
$extensionDir = $ini->hasVariable( 'ExtensionSettings','ExtensionDirectory' ) ? $ini->variable( 'ExtensionSettings','ExtensionDirectory' ) : 'extension';
foreach ( $extensions as $extension )
{
    $extValue = getVariable( $block, $settingName, $iniFile, "$extensionDir/$extension/settings" );
    $values['extensions'][$extension] = $extValue;
}

if ( !isset( $settingType ) )
    $settingType = 'string';

$tpl->setVariable( 'setting_name', $settingName );
$tpl->setVariable( 'current_siteaccess', $siteAccess );
$tpl->setVariable( 'setting_type_array', $settingTypeArray );
$tpl->setVariable( 'setting_type', $settingType );
$tpl->setVariable( 'ini_file', $iniFile );
$tpl->setVariable( 'block', $block );
$tpl->setVariable( 'value', $value );
$tpl->setVariable( 'values', $values );
$tpl->setVariable( 'placement', $settingPlacement );
Beispiel #11
0
 function getHTML()
 {
     global $user;
     $val = getVariable($this->key, $this->defaultval);
     $h = "<div class=\"configwidget\" style=\"width: 100%;\">\n";
     $h .= "<h3>{$this->name}</h3>\n";
     $h .= "<span class=\"siteconfigdesc\">\n";
     $h .= $this->desc;
     $h .= "<br><br></span>\n";
     switch ($this->type) {
         case 'numeric':
             $extra = array('smallDelta' => 1, 'largeDelta' => 10);
             $h .= labeledFormItem($this->domidbase, $this->label, 'spinner', "{min:{$this->minval}, max:{$this->maxval}}", 1, $val, '', '', $extra);
             break;
         case 'boolean':
             $extra = array();
             if ($val == 1) {
                 $extra = array('checked' => 'checked');
             }
             $h .= labeledFormItem($this->domidbase, $this->label, 'check', '', 1, 1, '', '', $extra);
             break;
         case 'textarea':
             $h .= labeledFormItem($this->domidbase, $this->label, 'textarea', '', 1, $val, '', '', '', '120px');
             break;
         default:
             $h .= labeledFormItem($this->domidbase, $this->label, 'text', '', 1, $val);
             break;
     }
     $h .= "<div id=\"{$this->domidbase}msg\"></div>\n";
     $h .= dijitButton("{$this->domidbase}btn", i('Submit Changes'), "{$this->jsname}.saveSettings();", 1);
     $cdata = $this->basecdata;
     $cont = addContinuationsEntry('AJupdateAllSettings', $cdata);
     $h .= "<input type=\"hidden\" id=\"{$this->domidbase}cont\" value=\"{$cont}\">\n";
     $h .= "</div>\n";
     return $h;
 }
Beispiel #12
0
    exit(0);
}
//Start recording the channel
ot_debug("Recording Channel");
$mixMonDir = getVariable($channel, "MIXMON_DIR");
$mixMonFormat = getVariable($channel, "MIXMON_FORMAT");
$mixMonPost = getVariable($channel, "MIXMON_POST");
// Setting in both channels in case a subsequent park or attended transfer of one
setVariable($bridgePeer, "REC_STATUS", "RECORDING");
setVariable($channel, "REC_STATUS", "RECORDING");
setVariable($channel, "AUDIOHOOK_INHERIT(MixMonitor)", "yes");
setVariable($bridgePeer, "AUDIOHOOK_INHERIT(MixMonitor)", "yes");
$astman->mixmonitor($masterChannel, "{$mixMonDir}{$year}/{$month}/{$day}/{$callFileName}.{$mixMonFormat}", "ai(LOCAL_MIXMON_ID)", $mixMonPost, rand());
$mixmonid = getVariable($channel, "LOCAL_MIXMON_ID");
setVariable($channel, "__MIXMON_ID", $mixmonid);
$channame = getVariable($channel, "CHANNEL(name)");
setVariable($channel, "__RECORD_ID", $channame);
//Set the monitor format and file name for the cdr entry
ot_debug("Setting CDR info");
$monFmt = $mixMonFormat != "" ? $mixMonFormat : "wav";
setVariable($channel, "MON_FMT", $monFmt);
setVariable($bridgePeer, "CDR(recordingfile)", "{$callFileName}.{$monFmt}");
setVariable($channel, "CDR(recordingfile)", "{$callFileName}.{$monFmt}");
setVariable($bridgePeer, "CALLFILENAME", "{$callFileName}");
setVariable($channel, "CALLFILENAME", "{$callFileName}");
setVariable($channel, "ONETOUCH_REC_SCRIPT_STATUS", "RECORDING_STARTED");
//Get variable function
function getVariable($channel, $varName)
{
    global $astman;
    $results = $astman->GetVar($channel, $varName, rand());
function WriteTextServerStats($xml)
{
    $content = implode("", file($xml['serversite'][0]['serverdata'][0]['path'][0]));
    $xmlStats = XML_unserialize($content);
    echo '<div id="textstat"><h1>Detailed statistics</h1>';
    echo '<p class="uptime">This server uptime is ' . $xmlStats['statistics'][0]['uptime']['0 attr']['value'] . ' seconds</p>';
    echo '<table>';
    echo '<tr class="maintitle"><td align="center" colspan="4"><b>Bytes managed</b></td></tr>';
    echo '<tr class="subtitle"><td colspan="2">Recieved</td><td colspan="2">Send</td></tr>';
    echo '<tr class="data"><td colspan="2">' . getVariable($xmlStats, "Bytes recv") . '</td><td colspan="2">' . getVariable($xmlStats, "Bytes send") . '</td></tr>';
    echo '<tr><td>&nbsp;</td></tr>';
    echo '<tr class="maintitle"><td align="center" colspan="4"><b>Messages managed</b></td></tr>';
    echo '<tr class="subtitle"><td>Recieved</td><td>Send</td><td>Invalid version</td><td>Incorrect</td></tr>';
    echo '<tr class="data"><td>' . getVariable($xmlStats, "Message recv") . '</td><td>' . getVariable($xmlStats, "Message send") . '</td><td>' . getVariable($xmlStats, "Message invalid version") . '</td><td>' . getVariable($xmlStats, "Message incorrect") . '</td></tr>';
    echo '<tr><td>&nbsp;</td></tr>';
    echo '<tr class="maintitle"><td align="center" colspan="4"><b>Players managed</b></td></tr>';
    echo '<tr class="subtitle"><td>Logins</td><td>Logins failed</td><td>Logouts</td><td>Timeouts</td></tr>';
    echo '<tr class="data"><td>' . getVariable($xmlStats, "Players login") . '</td><td>' . getVariable($xmlStats, "Players invalid login") . '</td><td>' . getVariable($xmlStats, "Players logout") . '</td><td>' . getVariable($xmlStats, "Players timeout") . '</td></tr>';
    echo '<tr><td>&nbsp;</td></tr>';
    echo '<tr class="maintitle"><td align="center" colspan="4"><b>Actions managed</b></td></tr>';
    echo '<tr class="subtitle"><td>Managed</td><td>Chat</td><td>Move</td><td>Attack</td></tr>';
    echo '<tr class="data"><td>' . getVariable($xmlStats, "Actions added") . '</td><td>' . getVariable($xmlStats, "Actions chat") . '</td><td>' . getVariable($xmlStats, "Actions move") . '</td><td>' . getVariable($xmlStats, "Actions attack") . '</td></tr>';
    echo '</table></div>';
    echo '<div id="textstat"><h1>Killed statistics</h1>';
    echo '<table>';
    echo '<tr class="maintitle"><td align="center" colspan="4"><b>Creatures killed</b></td></tr>';
    echo '<tr class="subtitle"><td colspan="2">Creature</td><td colspan="2">Amount</td></tr>';
    $creatures = array("sheep", "rat", "caverat", "orc");
    foreach ($creatures as $creature) {
        $amount = getVariable($xmlStats, "Killed " . $creature);
        echo '<tr class="data"><td colspan="2">' . $creature . '</td><td colspan="2">' . $amount . '</td></tr>';
    }
    echo '</table></div>';
}
Beispiel #14
0
function AJfetchRouterDNS()
{
    $data = array('status' => 'none');
    $page = processInputVar('page', ARG_STRING);
    if ($page != 'deploy' && $page != 'profile') {
        sendJSON($data);
        return;
    }
    $ipaddr = processInputVar('ipaddr', ARG_STRING);
    # validate fixed IP address
    if (!validateIPv4addr($ipaddr)) {
        sendJSON($data);
        return;
    }
    # validate netmask
    $netmask = processInputVar('netmask', ARG_STRING);
    $bnetmask = ip2long($netmask);
    if (!preg_match('/^[1]+0[^1]+$/', sprintf('%032b', $bnetmask))) {
        sendJSON($data);
        return;
    }
    $network = ip2long($ipaddr) & $bnetmask;
    $availnets = getVariable('fixedIPavailnetworks', array());
    $key = long2ip($network) . "/{$netmask}";
    if (array_key_exists($key, $availnets)) {
        $data = array('status' => 'success', 'page' => $page, 'router' => $availnets[$key]['router'], 'dns' => implode(',', $availnets[$key]['dns']));
    }
    sendJSON($data);
}
$validToDay=getVariable("validToDay");

$validToMonth=0;
$validToMonth=getVariable("validToMonth");

$validToYear=0;
$validToYear=getVariable("validToYear");

$vengroupingID=0;
$vengroupingID=getVariable("vengroupingID");

$vengroupingMinistryID=0;
$vengroupingMinistryID=getVariable("vengroupingMinistryID");

$vengroupingNMSID=0;
$vengroupingNMSID=getVariable("vengroupingNMSID");

//text type variables which likely contain HTML
$supplierAddress=0;
$supplierAddress=getVariableLessHTML("supplierAddress");

$reviewNotes=0;
$reviewNotes=getVariableLessHTML("reviewNotes");

$supplierCommentsField=0;
$supplierCommentsField=getVariableLessHTML("supplierCommentsField");

$deliveryComments=0;
$deliveryComments=getVariableLessHTML("deliveryComments");

$description=0;
Beispiel #16
0
function checkMusic()
{
    getVariable("playstop");
}
Beispiel #17
0
function getManagementNodes($alive = "neither", $includedeleted = 0, $id = 0)
{
    if ($alive == "now") {
        $lastcheckin = unixToDatetime(time() - 300);
    } elseif ($alive == "future") {
        $lastcheckin = unixToDatetime(time() - 3600);
    }
    $query = "SELECT m.id, " . "m.IPaddress, " . "m.hostname, " . "m.ownerid, " . "CONCAT(u.unityid, '@', a.name) as owner, " . "m.stateid, " . "s.name as state, " . "m.lastcheckin, " . "m.checkininterval, " . "m.installpath, " . "m.imagelibenable, " . "m.imagelibgroupid, " . "rg.name AS imagelibgroup, " . "m.imagelibuser, " . "m.imagelibkey, " . "m.keys, " . "m.sshport, " . "m.publicIPconfiguration AS publicIPconfig, " . "m.publicSubnetMask AS publicnetmask, " . "m.publicDefaultGateway AS publicgateway, " . "m.publicDNSserver AS publicdnsserver, " . "m.sysadminEmailAddress AS sysadminemail, " . "m.sharedMailBox AS sharedmailbox, " . "r.id as resourceid, " . "m.availablenetworks, " . "m.NOT_STANDALONE AS federatedauth, " . "nh.publicIPaddress AS natpublicIPaddress, " . "COALESCE(nh.internalIPaddress, '') AS natinternalIPaddress " . "FROM user u, " . "state s, " . "affiliation a, " . "managementnode m " . "LEFT JOIN resourcegroup rg ON (m.imagelibgroupid = rg.id) " . "LEFT JOIN resourcetype rt ON (rt.name = 'managementnode') " . "LEFT JOIN resource r ON (r.resourcetypeid = rt.id AND r.subid = m.id) " . "LEFT JOIN nathost nh ON (r.id = nh.resourceid) " . "WHERE m.ownerid = u.id AND " . "m.stateid = s.id AND " . "u.affiliationid = a.id";
    if ($id != 0) {
        $query .= " AND m.id = {$id}";
    }
    if ($includedeleted == 0) {
        $query .= " AND s.name != 'deleted'";
    }
    if ($alive == "now" || $alive == "future") {
        $query .= " AND m.lastcheckin > '{$lastcheckin}'" . " AND s.name != 'maintenance'";
    }
    $qh = doQuery($query, 101);
    $return = array();
    while ($row = mysql_fetch_assoc($qh)) {
        if (is_null($row['natpublicIPaddress'])) {
            $row['nathostenabled'] = 0;
            $row['natpublicIPaddress'] = '';
        } else {
            $row['nathostenabled'] = 1;
        }
        $return[$row["id"]] = $row;
        $return[$row['id']]['availablenetworks'] = explode(',', $row['availablenetworks']);
        if ($row['state'] == 'deleted') {
            $return[$row['id']]['deleted'] = 1;
        } else {
            $return[$row['id']]['deleted'] = 0;
        }
    }
    # Get items from variable table for specific management node id
    foreach ($return as $mn_id => $value) {
        if (array_key_exists("hostname", $value)) {
            $mn_hostname = $value['hostname'];
            $timeservers = getVariable('timesource|' . $mn_hostname);
            if ($timeservers == NULL) {
                $timeservers = getVariable('timesource|global');
            }
            $return[$mn_id]['timeservers'] = $timeservers;
        }
    }
    return $return;
}
Beispiel #18
0
    $settingType = $ini->settingType($value);
    if ($settingType == 'array') {
        $value = parseArrayToStr($value, "\n");
    }
}
// Init value from ini (default\override\extensions\siteaccess)
$values = array();
$values['default'] = getVariable($block, $settingName, $iniFile, 'settings/');
$values['siteaccess'] = getVariable($block, $settingName, $iniFile, "settings/siteaccess/{$siteAccess}");
$values['override'] = getVariable($block, $settingName, $iniFile, "settings/override/");
// Get values from extensions
$ini = eZINI::instance();
$extensions = $ini->hasVariable('ExtensionSettings', 'ActiveExtensions') ? $ini->variable('ExtensionSettings', 'ActiveExtensions') : array();
$extensionDir = $ini->hasVariable('ExtensionSettings', 'ExtensionDirectory') ? $ini->variable('ExtensionSettings', 'ExtensionDirectory') : 'extension';
foreach ($extensions as $extension) {
    $extValue = getVariable($block, $settingName, $iniFile, "{$extensionDir}/{$extension}/settings");
    $values['extensions'][$extension] = $extValue;
}
if (!isset($settingType)) {
    $settingType = 'string';
}
$tpl->setVariable('setting_name', $settingName);
$tpl->setVariable('current_siteaccess', $siteAccess);
$tpl->setVariable('setting_type_array', $settingTypeArray);
$tpl->setVariable('setting_type', $settingType);
$tpl->setVariable('ini_file', $iniFile);
$tpl->setVariable('block', $block);
$tpl->setVariable('value', $value);
$tpl->setVariable('values', $values);
$tpl->setVariable('placement', $settingPlacement);
$Result = array();
Beispiel #19
0
 function addResource($data)
 {
     global $user;
     $ownerid = getUserlistID($data['owner']);
     $esc = array('sysadminemail' => mysql_real_escape_string($data['sysadminemail']), 'sharedmailbox' => mysql_real_escape_string($data['sharedmailbox']));
     $keys = array('IPaddress', 'hostname', 'ownerid', 'stateid', 'checkininterval', 'installpath', '`keys`', 'sshport', 'sysadminEmailAddress', 'sharedMailBox', 'availablenetworks', 'NOT_STANDALONE', 'imagelibenable', 'publicIPconfiguration', 'imagelibgroupid', 'imagelibuser', 'imagelibkey', 'publicSubnetMask', 'publicDefaultGateway', 'publicDNSserver');
     $values = array("'{$data['ipaddress']}'", "'{$data['name']}'", $ownerid, $data['stateid'], $data['checkininterval'], "'{$data['installpath']}'", "'{$data['keys']}'", $data['sshport'], "'{$esc['sysadminemail']}'", "'{$esc['sharedmailbox']}'", "'{$data['availablenetworks']}'", "'{$data['federatedauth']}'", $data['imagelibenable'], "'{$data['publicIPconfig']}'");
     if ($data['imagelibenable'] == 1) {
         $values[] = $data['imagelibgroupid'];
         $values[] = "'{$data['imagelibuser']}'";
         $values[] = "'{$data['imagelibkey']}'";
     } else {
         $values[] = 'NULL';
         $values[] = 'NULL';
         $values[] = 'NULL';
     }
     if ($data['publicIPconfig'] == 'static') {
         $values[] = "'{$data['publicnetmask']}'";
         $values[] = "'{$data['publicgateway']}'";
         $values[] = "'{$data['publicdnsserver']}'";
     } else {
         $values[] = 'NULL';
         $values[] = 'NULL';
         $values[] = 'NULL';
     }
     $query = "INSERT INTO managementnode (" . implode(', ', $keys) . ") VALUES (" . implode(', ', $values) . ")";
     doQuery($query);
     $rscid = dbLastInsertID();
     // add entry in resource table
     $query = "INSERT INTO resource " . "(resourcetypeid, " . "subid) " . "VALUES (16, " . "{$rscid})";
     doQuery($query);
     $resourceid = dbLastInsertID();
     # NAT host
     if ($data['nathostenabled']) {
         $query = "INSERT INTO nathost " . "(resourceid, " . "publicIPaddress, " . "internalIPaddress) " . "VALUES " . "({$resourceid}, " . "'{$data['natpublicIPaddress']}', " . "'{$data['natinternalIPaddress']}')";
         doQuery($query);
     }
     # time server
     $globalval = getVariable('timesource|global');
     if ($data['timeservers'] != $globalval) {
         setVariable("timesource|{$data['name']}", $data['timeservers'], 'none');
     }
     return $rscid;
 }