当前位置: 首页>>代码示例>>PHP>>正文


PHP Shell::QueryRaw方法代码示例

本文整理汇总了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");
 }
开发者ID:rchicoria,项目名称:epp-drs,代码行数:22,代码来源:tests.php

示例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;
    	}
开发者ID:rchicoria,项目名称:epp-drs,代码行数:43,代码来源:class.Whois.php

示例3: SendTrap

 public function SendTrap($trap)
 {
     return $this->Shell->QueryRaw(self::$SNMPTrapPath . ' -v 2c -c ' . $this->Community . ' ' . $this->Connection . ' "" ' . $trap);
 }
开发者ID:jasherai,项目名称:libwebta,代码行数:4,代码来源:class.SNMP.php

示例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;
		}
开发者ID:rchicoria,项目名称:epp-drs,代码行数:17,代码来源:class.SystemUserManager.php

示例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();
			}
			
//.........这里部分代码省略.........
开发者ID:rchicoria,项目名称:epp-drs,代码行数:101,代码来源:class.LicenseManager.php


注:本文中的Shell::QueryRaw方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。