本文整理汇总了PHP中Shell::QueryRaw方法的典型用法代码示例。如果您正苦于以下问题:PHP Shell::QueryRaw方法的具体用法?PHP Shell::QueryRaw怎么用?PHP Shell::QueryRaw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shell
的用法示例。
在下文中一共展示了Shell::QueryRaw方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testShell
function testShell()
{
$Shell = new Shell();
//
// Delete tmp file
//
@unlink("/tmp/shelltest");
$this->assertFalse(file_exists("/tmp/shelltest"), "Tmp file does not exists");
//
// Create tmp file
//
$Shell->Execute("touch", array("/tmp/shelltest"));
$this->assertTrue(file_exists("/tmp/shelltest"), "Tmp file exists");
//
// ls -al
//
$result = $Shell->Query("ls", array("-al"));
$this->assertTrue(!empty($result), "Result not empty");
// Query raw
$Shell->QueryRaw("ls -al");
$this->assertTrue(!empty($result), "Result not empty");
}
示例2: FetchRecord
/**
* Whois request
*
* @param string $host
* @return string
*/
public function FetchRecord($host)
{
// Cut off www
if(substr($host, 0, 4) == 'www.')
$host = substr($host, 4);
// Extract TLD and find a suitable whois server
$pi = pathinfo($host);
$whoisinfo = $this->Servers[$pi["extension"]];
if (!$whoisinfo[0])
{
Core::RaiseWarning(sprintf(_("No custom whois server defined for %s. Using default one."), $host));
$hostparam = "";
}
else
$hostparam = " -h {$whoisinfo[0]}";
// Sanitize
$host = escapeshellcmd($host);
// Execute Shell command and Get result
$retval = $this->Shell->QueryRaw("{$this->WhoisBinPath} {$hostparam} {$host}");
// Check domain name existense and return false if domain NOT exists or Raw whois data about domain
if (stristr($retval, $whoisinfo[1]) ||
stristr($retval, "hostname nor servname provided") ||
preg_match("/((No entries found)|(No match)|(No Data Found)|(No match for)|(No data found))/si", $retval)
)
return false;
else
return $retval;
}
示例3: SendTrap
public function SendTrap($trap)
{
return $this->Shell->QueryRaw(self::$SNMPTrapPath . ' -v 2c -c ' . $this->Community . ' ' . $this->Connection . ' "" ' . $trap);
}
示例4: GetUserByUID
/**
* Find user by username
* @access public
* @param string $username username
* @return SystemUser SystemUser object
*/
public function GetUserByUID($uid)
{
if (!is_readable("/etc/passwd"))
Core::RaiseError(_("/etc/passwd not readable"));
$res = $this->Shell->QueryRaw("cat /etc/passwd | grep ':[\*x]:$uid:'");
$rowarr = explode(":", $res);
$retval = new SystemUser($rowarr[2]);
return $retval;
}
示例5: ValidateLic
/**
* Validate license file
* @access public
* @return bool True in case if license is valid
*/
public final function ValidateLic()
{
$this->SelectWeakestLic();
$licdata = $this->DecryptLic();
$type = key($this->WeakestLic);
// Remove this lic from Lics list
array_shift($this->Lics);
$contact = "Please contact " . LIC_EMAIL;
$retval = ($type == $licdata[0]);
// Check type matching
if (!$retval && $this->ErrorOnFailure)
{
$this->RaiseError("License types don't match. {$contact}");
die();
}
$retval &= ($licdata[2] >= time());
// Check expiration
if (!$retval && $this->ErrorOnFailure)
{
$this->RaiseError("License expired. {$contact}");
die();
}
$retval &= ($licdata[4] == LIC_PRODUCTID || $licdata[4] == $this->ProductID);
// Check Product ID
if (!$retval && $this->ErrorOnFailure)
{
$this->RaiseError("This license was generated for another product. {$contact}");
die();
}
if ($licdata[5])
$md5_prepend = @md5_file(LIBWEBTA_BASE . "/../../prepend.inc.php");
if ($licdata[6])
$md5_lic = @md5_file(__FILE__);
$retval &= ((!$licdata[5] || ($licdata[5] == $md5_prepend)) && (!$licdata[6] || ($licdata[6] == $md5_lic)));
// Checksum
if (!$retval && $this->ErrorOnFailure)
{
$this->RaiseError("Invalid checksum. {$contact}");
die();
}
// Check value
switch ($type)
{
default:
case "ip":
$message = "IP address of the server and IP address of license do not match.";
if (!getenv("windir") && !preg_match("/windows/i", getenv("OS")))
{
$retval &= count($this->Shell->QueryRaw("/sbin/ifconfig | grep {$licdata[1]}", false));
if (!$retval)
{
$ip = @gethostbyname($_SERVER['HTTP_HOST']);
$retval &= ($ip == $licdata[1]);
}
}
else
{
$ip = @gethostbyname($_SERVER['HTTP_HOST']);
$retval &= ($ip == $licdata[1]);
}
break;
case "trial":
// Nothing to do here. Expiration already being checked
break;
}
if (!$retval)
{
// Try to validate next lic in Lics
while(count($this->Lics) > 0)
$retval = $this->ValidateLic();
}
//.........这里部分代码省略.........