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


PHP Core::RaiseError方法代码示例

本文整理汇总了PHP中Core::RaiseError方法的典型用法代码示例。如果您正苦于以下问题:PHP Core::RaiseError方法的具体用法?PHP Core::RaiseError怎么用?PHP Core::RaiseError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Core的用法示例。


在下文中一共展示了Core::RaiseError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GetTransport

 /**
  * Return Transport. example: TransportFactory::GetTransport('SSH', $ssh_host, $ssh_port, $ssh_user, $ssh_pass);
  *
  * @static 
  * @param string $transportname
  * @return Object
  */
 public static function GetTransport($transportname)
 {
     $path_to_transports = dirname(__FILE__) . "/Transports";
     if (file_exists("{$path_to_transports}/class.{$transportname}Transport.php")) {
         Core::Load("class.{$transportname}Transport.php", $path_to_transports);
         if (class_exists("{$transportname}Transport") && self::IsTransport("{$transportname}Transport")) {
             // Get Constructor Reflection
             if (is_callable(array("{$transportname}Transport", "__construct"))) {
                 $reflect = new ReflectionMethod("{$transportname}Transport", "__construct");
             }
             // Delete $objectname from arguments
             $num_args = func_num_args() - 1;
             $args = func_get_args();
             array_shift($args);
             if ($reflect) {
                 $required_params = $reflect->getNumberOfRequiredParameters();
                 if ($required_params > $num_args) {
                     $params = $reflect->getParameters();
                     //TODO: Show what params are missing in error
                     Core::RaiseError(sprintf(_("Missing some required arguments for %s Transport constructor. Passed: %s, expected: %s."), $transportname, $num_args, $required_params));
                 }
             }
             $reflect = new ReflectionClass("{$transportname}Transport");
             if (count($args) > 0) {
                 return $reflect->newInstanceArgs($args);
             } else {
                 return $reflect->newInstance(true);
             }
         } else {
             Core::RaiseError(sprintf(_("Class '%s' not found or doesn't implements ITransport interface"), "{$transportname}Transport"));
         }
     }
 }
开发者ID:jasherai,项目名称:libwebta,代码行数:40,代码来源:class.TransportFactory.php

示例2: GetFileMimeType

 public static function GetFileMimeType($path)
 {
     if (file_exists($path)) {
         try {
             if (class_exists("finfo")) {
                 // Probe magick database file
                 $magic_db_path = dirname(__FILE__) . "/magic";
                 if (!file_exists($magic_db_path)) {
                     $magic_db_path = "/usr/share/file/magic";
                 }
                 // Create fifo instance
                 $finfo = new finfo(FILEINFO_MIME, $magic_db_path);
                 if ($finfo) {
                     $retval = @$finfo->file($path);
                 } else {
                     Core::RaiseError("Cannot open FIFO database. Tried {$magic_db_path}", E_ERROR);
                 }
                 return $retval;
             } elseif (function_exists("mime_content_type")) {
                 return mime_content_type($path);
             } else {
                 Core::RaiseError("Cannot determine file mime type.", E_ERROR);
                 return "";
             }
         } catch (Exception $e) {
             Core::RaiseError($e->getMessage(), E_ERROR);
         }
     } else {
         Core::RaiseWarning("File not found.");
         return "";
     }
 }
开发者ID:jasherai,项目名称:libwebta,代码行数:32,代码来源:class.IOTool.php

示例3: __construct

        function __construct($process_classes_folder)
        {
            $processes = @glob("{$process_classes_folder}/class.*Process.php");
            
           $jobs = array();
            if (count($processes) > 0)
            {
                foreach ($processes as $process)
                {
                    $filename = basename($process);
                    $directory = dirname($process);
                    Core::Load($filename, $directory);
                    preg_match("/class.(.*)Process.php/s", $filename, $tmp);
                    $process_name = $tmp[1];
                    if (class_exists("{$process_name}Process"))
                    {
                        $reflect = new ReflectionClass("{$process_name}Process");
                        if ($reflect)
                        {
                            if ($reflect->implementsInterface("IProcess"))
                            {
                                $job = array(
                                                "name"          => $process_name,
                                                "description"   => $reflect->getProperty("ProcessDescription")->getValue($reflect->newInstance())
                                            );
                                array_push($jobs, $job);    
                            }
                            else 
                                Core::RaiseError("Class '{$process_name}Process' doesn't implement 'IProcess' interface.", E_ERROR);
                        }
                        else 
                            Core::RaiseError("Cannot use ReflectionAPI for class '{$process_name}Process'", E_ERROR);
                    }
                    else
                        Core::RaiseError("'{$process}' does not contain definition for '{$process_name}Process'", E_ERROR);
                }
            }
            else 
                Core::RaiseError(_("No job classes found in {$ProcessClassesFolder}"), E_ERROR);
             
            $options = array();
            foreach($jobs as $job)
                $options[$job["name"]] = $job["description"];

            $options["help"] = "Print this help";
                           
            $Getopt = new Getopt($options);
            $opts = $Getopt->getOptions();
            
            if (in_array("help", $opts) || count($opts) == 0 || !$options[$opts[0]])
            {
                print $Getopt->getUsageMessage();    
                exit();
            }
            else
            {                               
                $this->ProcessName = $opts[0];
            }
        }
开发者ID:rchicoria,项目名称:epp-drs,代码行数:59,代码来源:class.JobLauncher.php

示例4: GetPublicKeyFromPrivateKey

 public static function GetPublicKeyFromPrivateKey($private_key)
 {
     try {
         $key_resource = openssl_pkey_get_private($private_key);
         $info = openssl_pkey_get_details($key_resource);
         return $info["key"];
     } catch (Exception $e) {
         Core::RaiseError($e->getMessage(), E_ERROR);
     }
 }
开发者ID:jasherai,项目名称:libwebta,代码行数:10,代码来源:class.SSLManager.php

示例5: __construct

		/**
		 * Constructor
		 * 
		 * @param string path to vbulletin config
		 */
    	function __construct($config_path)
    	{
	    	if (!file_exists($config_path)) 
	    		return false;
	    	
	    	// version checking
	    	$includes = dirname($config_path);
	    	if (file_exists("$includes/class_core.php"))
	    	{
	    		require_once("$includes/class_core.php");
	    		preg_match("/^(\d)\.(\d)/", FILE_VERSION, $m);
	    		$ver = intval($m[1] . $m[2]);
	    	}
	    	
	    	if (!$ver || $ver < self::MIN_VERSION)
	    		Core::RaiseError(sprintf(_("vBulletin forum version '%s' installed. %s or higher required."), $ver, self::MIN_VERSION));
	    	
	    	$config = array();
	    	require($config_path);

	    	$this->TablePrefix = $config['Database']['tableprefix'];
	    	$this->CookiePrefix = $config['Misc']['cookieprefix'];
    		
    		$conf = array(
    			'host'	=> $config['MasterServer']['servername'],
    			'user'	=> $config['MasterServer']['username'],
    			'pass'	=> $config['MasterServer']['password'],
    			'name'	=> $config['Database']['dbname']
    		);
    		
			$this->DB = Core::GetDBInstance($conf, true, $config['Database']['dbtype']);
			$this->Crypto = Core::GetInstance('Crypto', CF_CRYPTOKEY);
			
			// user groups 
			$groups = $this->DB->GetAll("SELECT * FROM {$this->TablePrefix}usergroup");
			foreach($groups as $group)
			{
				$this->Groups[$group['title']] = $group['usergroupid']; 
			}
    	}
开发者ID:rchicoria,项目名称:epp-drs,代码行数:45,代码来源:class.vBulletinConnector.php

示例6: SendLine

		/**
		 * Execute script
		 *
		 * @param string $script
		 * @return string
		 */
	    public function SendLine($command)
	    {
	        Core::RaiseError("SendLine not supported in MySQLScriptingAdapter");
		}
开发者ID:rchicoria,项目名称:epp-drs,代码行数:10,代码来源:class.MySQLScriptingAdapter.php

示例7: UploadFromURL

 /**
  * Upload file from URL
  *
  * @param string $url
  * @return bool
  * @todo Pass custom headers, like User-Agent
  */
 public function UploadFromURL($url, $headers = array())
 {
     $urlinfo = parse_url($url);
     $file = array("name" => $this->NormalizeFileName(basename($url)));
     // Open socket connection
     $sock = @fsockopen($urlinfo['host'], $urlinfo["port"] ? $urlinfo["port"] : 80, $errno, $errstr, 10);
     @stream_set_blocking($sock, 1);
     // If cannot open socket connection raise warning and return false
     if (!$sock) {
         $this->RaiseWarning(_("Failed to copy a file. Cannot connect to " . $urlinfo['host'] . "."), false);
         return false;
     } else {
         if (substr($urlinfo['path'], 0, 1) != '/') {
             $urlinfo['path'] = "/{$urlinfo['path']}";
         }
         // Define request
         $request = "GET " . $urlinfo['path'] . ($urlinfo['query'] ? "?{$urlinfo['query']}" : "") . " HTTP/1.1\r\n";
         if (count($headers) > 0 && is_array($headers)) {
             $request .= implode("\r\n", $headers) . "\r\n";
         }
         $request .= "Host: {$urlinfo['host']}\r\n";
         $request .= "Connection: Close\r\n\r\n";
         // Send request
         @fwrite($sock, $request);
         $headers = "";
         while ($str != "\r\n") {
             $str = @fgets($sock, 2048);
             $headers .= $str;
         }
         if (stristr($headers, "200 OK")) {
             while (!feof($sock) && !$meta['eof']) {
                 @file_put_contents($this->Destination, @fgets($sock, 2048), FILE_APPEND);
                 $meta = stream_get_meta_data($sock);
             }
             // Generate real file info
             $this->File = array("name" => basename($url), "type" => IOTool::GetFileMimeType($this->Destination), "size" => @filesize($this->Destination));
             // Validate real file info
             if ($this->Validate()) {
                 if (file_exists($this->Destination)) {
                     return true;
                 } else {
                     Core::RaiseError(_("Cannot write file."), E_ERROR);
                 }
             }
             @unlink($this->Destination);
             return false;
         } else {
             $tmp = split("\n", $headers);
             $error = trim($tmp[0]);
             Core::RaiseWarning($error);
             return false;
         }
         @fclose($sock);
     }
 }
开发者ID:jasherai,项目名称:libwebta,代码行数:62,代码来源:class.UploadManager.php

示例8: ApplyFilter

 /**
  * Adds WHERE filter to SQL, depending on SESSION and POST filters.
  * @access private
  * @return string Usable SQL string
  */
 public function ApplyFilter($filter, $fields)
 {
     if ($this->PagingApplied) {
         Core::RaiseError(_("Cannot call ApplyFilter after ApplySQLPaging has been called"));
     }
     $filter = stripslashes($filter);
     // Same filter - unchecking button
     if ($filter == $_SESSION["filter"]) {
         $filter = NULL;
         $_SESSION["filter"] = NULL;
         $this->Display["filter"] = false;
     } else {
         if (!$_GET["pf"]) {
             $this->PageNo = 1;
         }
         $filter = $filter ? $filter : $_GET["pf"];
         $filter = stripslashes($filter);
         // Add template vars
         $this->Display["filter_q"] = $filter;
         $this->Display["filter"] = true;
         $_SESSION["filter"] = $filter;
     }
     if ($filter) {
         $this->URLFormat = "?pn=%d&pt=%d&pf=" . urlencode($filter);
         $this->Filter = $filter;
         //SQL
         $filter = mysql_escape_string($filter);
         foreach ($fields as $f) {
             $likes[] = "{$f} LIKE '%{$filter}%'";
         }
         $like = implode(" OR ", $likes);
         if (!stristr($this->SQL, "WHERE")) {
             $this->SQL .= " WHERE {$like}";
         } else {
             $this->SQL .= " AND ({$like})";
         }
         // Additional SQL
         if (!stristr($this->SQL, $this->AdditionalSQL)) {
             $this->SQL .= " " . $this->AdditionalSQL . " ";
         }
         // Downgrade total records count
         if ((int) $_GET["pt"] > 0) {
             $this->Total = (int) $_GET["pt"];
         } else {
             $this->ExecuteSQL();
         }
     }
     return $this->SQL;
 }
开发者ID:jasherai,项目名称:libwebta,代码行数:54,代码来源:class.SQLPaging.php

示例9: Update

		/**
		 * Update data in RRD
		 *
		 * @param array $data
		 * @param integer $timestamp UNIX TimeStamp
		 * @return bool
		 */
		function Update($data, $timestamp = "N")
		{
			$arg = "{$timestamp}";
			foreach ($data as $val)
				$arg .= ":{$val}";
			
			if(rrd_update($this->DBPath, $arg))
				return true;
			else 
				Core::RaiseError(_("Cannot update RRD: ".rrd_error()));
		}
开发者ID:rchicoria,项目名称:epp-drs,代码行数:18,代码来源:class.RRD.php

示例10: GetPwdHash

 /**
  * Get password hash
  * @access public
  * @return string Password hash, $this->PwdHash
  */
 public final function GetPwdHash()
 {
     if (!is_readable($this->PassFilePath)) {
         Core::RaiseError(_("{$this->PassFilePath} not readable"));
     }
     $res = $this->Shell->QueryRaw("cat {$this->PassFilePath} | grep ^{$this->Username}:");
     $rowarr = explode(":", $res);
     $this->PwdHash = $rowarr[1];
     return $this->PwdHash;
 }
开发者ID:jasherai,项目名称:libwebta,代码行数:15,代码来源:class.SystemUser.php

示例11: Handle

 public function Handle($request = false, $defaultNS = "")
 {
     if (!$request) {
         $request = $_REQUEST;
     } else {
         if (!is_array($request)) {
             @parse_str($request, $request);
         }
     }
     if (!$request["method"]) {
         Core::RaiseError("Malformed request", E_USER_ERROR);
     }
     $this->Request = $request;
     // Determine namespace & method
     if ($this->Methods[$request["method"]] instanceof ReflectionMethodEx) {
         $reflection_method = $this->Methods[$request["method"]];
         $req_args = $reflection_method->getParameters();
         foreach ($req_args as $arg) {
             if ($request[$arg->getName()] || $arg->isOptional()) {
                 $given_args++;
                 $args[$arg->getName()] = $request[$arg->getName()];
             } else {
                 $missing_args = $arg->getName();
             }
         }
         if (count($req_args) != $given_args) {
             Core::RaiseError("Invalid Method Call to '{$this->Request['method']}'. Requires '" . count($req_args) . "' arguments, '" . count($given_args) . "' given.", E_USER_ERROR);
         }
         try {
             if ($req_args == 0) {
                 $result = $reflection_method->invoke();
             } else {
                 $result = $reflection_method->invokeArgs($args);
             }
         } catch (Exception $e) {
             Core::RaiseError($e->getMessage(), E_ERROR);
         }
     } elseif ($this->Methods[$request["method"]] instanceof ReflectionFunction) {
         $req_args = $this->Methods[$request["method"]]->getParameters();
         foreach ($req_args as $arg) {
             if ($request[$arg->getName()] || $arg->isOptional()) {
                 $given_args++;
                 $args[$arg->getName()] = $request[$arg->getName()];
             } else {
                 $missing_args = $arg->getName();
             }
         }
         if (count($req_args) != $given_args) {
             Core::RaiseError("Invalid Method Call to '{$this->Request['method']}'. Requires '" . count($req_args) . "' arguments, '" . count($given_args) . "' given.", E_USER_ERROR);
         }
         try {
             if ($req_args == 0) {
                 $result = $this->Methods[$request["method"]]->invoke();
             } else {
                 $result = $this->Methods[$request["method"]]->invokeArgs($args);
             }
         } catch (Exception $e) {
             Core::RaiseError($e->getMessage(), E_ERROR);
         }
     } else {
         Core::RaiseError("Method not implemented", E_USER_ERROR);
     }
     if ($result instanceof SimpleXMLElement) {
         $response = $result->asXML();
     } elseif ($result instanceof DOMDocument) {
         $response = $result->saveXML();
     } elseif ($result instanceof DOMNode) {
         $response = $result->ownerDocument->saveXML($result);
     } elseif (is_array($result) || is_object($result)) {
         $response = $this->HandleStruct($result);
     } else {
         $response = $this->HandleScalar($result);
     }
     @header("Content-type: text/xml");
     @header("Content-length: " . strlen($response));
     print $response;
 }
开发者ID:rchicoria,项目名称:epp-drs,代码行数:77,代码来源:class.RESTServer.php

示例12: __doRequest

		function __doRequest($request, $location, $saction, $version) 
		{		    
		    $doc = new DOMDocument('1.0');
			$doc->loadXML($request);
			
			$objWSSE = new WSSESoap($doc);
			#echo "<pre>"; var_dump($request); #die();
			/* add Timestamp with no expiration timestamp */
		 	$objWSSE->addTimestamp();
		
			/* create new XMLSec Key using RSA SHA-1 and type is private key */
			$objKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array('type'=>'private'));
		
			/* load the private key from file - last arg is bool if key in file (TRUE) or is string (FALSE) */
			$objKey->loadKey($this->KeyPath, TRUE);
		
			try
			{
                /* Sign the message - also signs appropraite WS-Security items */
                $objWSSE->signSoapDoc($objKey);
			}
			catch (Exception $e)
			{
			    Core::RaiseError("[".__METHOD__."] ".$e->getMessage(), E_ERROR);
			}
		
			/* Add certificate (BinarySecurityToken) to the message and attach pointer to Signature */
			$token = $objWSSE->addBinaryToken(file_get_contents($this->CertPath));
			$objWSSE->attachTokentoSig($token);
					
			try
			{
				return parent::__doRequest($objWSSE->saveXML(), $location, $saction, $version);
			}
			catch (Exception $e)
			{
				Core::RaiseError("[".__METHOD__."] ".$e->__toString(), E_ERROR);
			}
		}
开发者ID:rchicoria,项目名称:epp-drs,代码行数:39,代码来源:class.WSSESoapClient.php

示例13: AddAddon

		public function AddAddon($domain, $foldername = "", $pass = "")
		{
			Core::RaiseError("Fixme: Add \$crypto instance here.");
			if (!$foldername) $foldername = preg_replace("/[\-\_]/i", "", $domain);
			if (!$pass) $pass = $crypto->Sault(13);

			$this->Fetch("addon/doadddomain.html?domain=".$domain."&user=".$foldername."&pass=".$pass);
			return array("user" => $foldername, "pass" => $pass);
		}
开发者ID:rchicoria,项目名称:epp-drs,代码行数:9,代码来源:class.CPanel.php

示例14: __construct

		/**
		 * Constructor
		 *
		 * @param string $host
		 * @param string $port
		 * @param array $authinfo
		 * @param string $rndc_path
		 * @param string $namedconf_path
		 * @param string $nameddb_path
		 * @param string $zonetemplate
		 */
		function __construct($host, $port, $authinfo, $rndc_path, $namedconf_path, $nameddb_path, $zonetemplate, $inittransport= true)
		{
			// Call Bind class construct
			parent::__construct($namedconf_path, $nameddb_path, $zonetemplate, $rndc_path, false);	

			$this->Host = $host;
			$this->Port = $port;
			$this->Authinfo = $authinfo;
					
			$this->Transport = self::DEFAULT_TRANSPORT;
			
			if ($inittransport)
				if (!$this->InitTransport())
					Core::RaiseError("Cannot init transport");
			
			$this->DoMakeBackup = false;
			$this->HaveNewZones = 0;
		}
开发者ID:rchicoria,项目名称:epp-drs,代码行数:29,代码来源:class.RemoteBIND.php

示例15: Execute

 /**
  * Execute script
  *
  * @param string $script
  * @return bool
  * @static 
  */
 static public function Execute($script, $params)
 {
     if (!self::$Adapter)
         Core::RaiseError("Please define Adapter using ScriptingClient::SetAdapter() method");
     
     return self::$Adapter->Execute($script, $params);
 }
开发者ID:rchicoria,项目名称:epp-drs,代码行数:14,代码来源:class.ScriptingClient.php


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