/**
  * Ensures that the validator follows expected behavior
  *
  * @return void
  */
 public function testBasic()
 {
     iconv_set_encoding('internal_encoding', 'UTF-8');
     /**
      * The elements of each array are, in order:
      *      - minimum length
      *      - maximum length
      *      - expected validation result
      *      - array of test input values
      */
     $valuesExpected = array(
         array(0, null, true, array('', 'a', 'ab')),
         array(-1, null, true, array('')),
         array(2, 2, true, array('ab', '  ')),
         array(2, 2, false, array('a', 'abc')),
         array(1, null, false, array('')),
         array(2, 3, true, array('ab', 'abc')),
         array(2, 3, false, array('a', 'abcd')),
         array(3, 3, true, array('äöü')),
         array(6, 6, true, array('Müller'))
         );
     foreach ($valuesExpected as $element) {
         $validator = new Zend_Validate_StringLength($element[0], $element[1]);
         foreach ($element[3] as $input) {
             $this->assertEquals($element[2], $validator->isValid($input));
         }
     }
 }
Example #2
0
 /**
  * Constructs a new Zend_Service_Technorati instance
  * and setup character encoding.
  *
  * @param  string $apiKey  Your Technorati API key
  */
 public function __construct($apiKey)
 {
     iconv_set_encoding('output_encoding', 'UTF-8');
     iconv_set_encoding('input_encoding', 'UTF-8');
     iconv_set_encoding('internal_encoding', 'UTF-8');
     $this->_apiKey = $apiKey;
 }
 /**
  * Устанавливаем кодировку UTF-8 для функций mb_*
  *
  */
 protected function _initEncoding()
 {
     if (phpversion() < 5.6) {
         mb_internal_encoding('utf-8');
         iconv_set_encoding('internal_encoding', 'utf-8');
     }
 }
Example #4
0
 public function send_pay()
 {
     $config = $this->config;
     $p1_MerId = $config['id'];
     //"10001126856";
     $merchantKey = $config['key'];
     //"69cl522AV6q613Ii4W6u8K6XuW8vM1N6bFgyv769220IuYe9u37N4y7rI4Pl";
     $logName = $config['error_log'] = "YeePay_HTML.log";
     $reqURL_onLine = "https://www.yeepay.com/app-merchant-proxy/node";
     //产品通用接口请求地址
     $p0_Cmd = "Buy";
     //支付请求,固定值"Buy" .
     $p9_SAF = "0";
     //送货地址,默认为0
     //	商家设置用户购买商品的支付信息.
     //易宝支付平台统一使用GBK/GB2312编码方式,参数如用到中文,请注意转码
     //	商户订单号,选填.
     //若不为"",提交的订单号必须在自身账户交易中唯一;为""时,易宝支付会自动生成随机的商户订单号.
     $p2_Order = $config['code'];
     //	支付金额,必填.
     //单位:元,精确到分.
     $p3_Amt = $config['money'];
     //	交易币种,固定值"CNY".
     $p4_Cur = "CNY";
     //	商品名称
     //用于支付时显示在易宝支付网关左侧的订单产品信息.
     $p5_Pid = htmlspecialchars(trim($config['title']));
     //iconv("UTF-8","GBK","你妹xxxx")
     //	商品种类
     $p6_Pcat = '';
     //	商品描述
     $p7_Pdesc = '';
     //	商户接收支付成功数据的地址,支付成功后易宝支付会向该地址发送两次成功通知.
     $p8_Url = $config['NotifyUrl'];
     //	商户扩展信息
     //商户可以任意填写1K 的字符串,支付成功时将原样返回.
     $pa_MP = '';
     //	支付通道编码
     //默认为"",到易宝支付网关.若不需显示易宝支付的页面,直接跳转到各银行、神州行支付、骏网一卡通等支付页面,该字段可依照附录:银行列表设置参数值.
     if ($config['pay_bank'] == 'DEFAULT') {
         $pd_FrpId = '';
     } else {
         $pd_FrpId = $config['pay_bank'];
     }
     //	应答机制
     //默认为"1": 需要应答机制;
     $pr_NeedResponse = "1";
     //调用签名函数生成签名串
     iconv_set_encoding("internal_encoding", "UTF-8");
     iconv_set_encoding("output_encoding", "GBK");
     // 开始缓存
     ob_start("ob_iconv_handler");
     include dirname(__FILE__) . '/yeepay/yeepayCommon.class.php';
     $yeepayCommon = new yeepayCommon();
     $yeepayCommon->config = $config;
     $hmac = $yeepayCommon->getReqHmacString($p2_Order, $p3_Amt, $p4_Cur, $p5_Pid, $p6_Pcat, $p7_Pdesc, $p8_Url, $pa_MP, $pd_FrpId, $pr_NeedResponse);
     include dirname(__FILE__) . '/yeepay/yeepay_send.tpl.php';
     ob_end_flush();
     exit;
 }
Example #5
0
 /**
  * Perform a JSON-RPC request and return a response.
  *
  * @param Zend_XmlRpc_Request $request
  * @param null|Zend_XmlRpc_Response $response
  * @return void
  * @throws Zend_XmlRpc_Client_HttpException
  */
 public function doRequest($request, $response = null)
 {
     $this->_lastRequest = $request;
     iconv_set_encoding('input_encoding', 'UTF-8');
     iconv_set_encoding('output_encoding', 'UTF-8');
     iconv_set_encoding('internal_encoding', 'UTF-8');
     $http = $this->getHttpClient();
     if ($http->getUri() === null) {
         $http->setUri($this->_serverAddress);
     }
     $http->setHeaders(array('Content-Type: text/xml; charset=utf-8', 'Accept: text/xml'));
     if ($http->getHeader('user-agent') === null) {
         $http->setHeaders(array('User-Agent: Zend_XmlRpc_Client'));
     }
     $xml = $this->_lastRequest->__toString();
     $http->setRawData($xml);
     $httpResponse = $http->request(Zend_Http_Client::POST);
     if (!$httpResponse->isSuccessful()) {
         /**
          * Exception thrown when an HTTP error occurs
          * @see Zend_XmlRpc_Client_HttpException
          */
         // require_once 'Zend/XmlRpc/Client/HttpException.php';
         throw new Zend_XmlRpc_Client_HttpException($httpResponse->getMessage(), $httpResponse->getStatus());
     }
     if ($response === null) {
         $response = new Zend_XmlRpc_Response();
     }
     $this->_lastResponse = $response;
     $this->_lastResponse->loadXml($httpResponse->getBody());
 }
Example #6
0
 /**
  * Retrieves the encoding
  *
  * @return string
  * @throws Glitch_Application_Resource_Exception
  */
 public function getEncoding()
 {
     if (null === $this->_encoding) {
         // Test for UTF-8 support. The regex will wrongly match 4 chars,
         // rather than 2, if PCRE was compiled without UTF-8 support. If the chars
         // in preg_match appear garbled, change the encoding of this file to UTF-8!
         if (!extension_loaded('iconv') || !preg_match('~^..$~u', '±')) {
             throw new Glitch_Application_Resource_Exception('No multibyte strings support');
         }
         $options = $this->getOptions();
         // Force these options to be set - don't rely on the defaults!
         if (!isset($options['encoding'])) {
             throw new Glitch_Application_Resource_Exception('Undefined encoding option: "encoding"');
         }
         $this->_encoding = (string) $options['encoding'];
         // Override the default charset; also sends the appropriate HTTP header
         ini_set('default_charset', $this->_encoding);
         // ZF uses iconv for e.g. form validation and Zend_Locale
         iconv_set_encoding('internal_encoding', $this->_encoding);
         // MB extension is not required by ZF, so don't throw exceptions
         if (function_exists('mb_internal_encoding')) {
             // ZF uses this for e.g. Zend_Filter and Zend_Feed
             mb_internal_encoding($this->_encoding);
         }
         // Allow application-wide access; e.g. Zend_Mail uses this
         Glitch_Registry::setEncoding($this->_encoding);
     }
     return $this->_encoding;
 }
Example #7
0
 public function call()
 {
     $app = $this->app;
     // Set encoding
     if (function_exists('iconv') && PHP_VERSION_ID < 50600) {
         // These are settings that can be set inside code
         iconv_set_encoding('internal_encoding', 'UTF-8');
         iconv_set_encoding('input_encoding', 'UTF-8');
         iconv_set_encoding('output_encoding', 'UTF-8');
     } elseif (PHP_VERSION_ID >= 50600) {
         ini_set('default_charset', 'UTF-8');
     }
     mb_internal_encoding($app->charset);
     // Configure timezone
     date_default_timezone_set($app->timezone);
     // Share the cryptor for the app
     if ($_crypt = $app->get($this->injectors['cryptor'])) {
         $app->cryptor = function () use($_crypt) {
             return new Cryptor($_crypt);
         };
     }
     // Share the logger for the app
     if ($_log = $app->get($this->injectors['logger'])) {
         $app->logger = Logger::$default = new Logger($_log);
     }
     $this->next();
 }
Example #8
0
 /**
  * Convert a string to ASCII
  *
  * @access public
  * @param  string $str     The string to convert
  * @param  string $charset The default charset to use
  * @return string The converted string
  */
 public static function toASCII($str, $charset = 'UTF-8')
 {
     $asciistr = '';
     if (mb_detect_encoding($str, 'UTF-8', true) === false) {
         $str = utf8_encode($str);
     }
     if (version_compare(PHP_VERSION, '5.6.0') < 0) {
         iconv_set_encoding('input_encoding', 'UTF-8');
         iconv_set_encoding('internal_encoding', 'UTF-8');
         iconv_set_encoding('output_encoding', $charset);
     }
     $str = html_entity_decode($str, ENT_QUOTES, $charset);
     $strlen = iconv_strlen($str, $charset);
     for ($i = 0; $i < $strlen; $i++) {
         $char = iconv_substr($str, $i, 1, $charset);
         if (!preg_match('/[`\'^~"]+/', $char)) {
             if ('UTF-8' === $charset) {
                 $asciistr .= preg_replace('/[`\'^~"]+/', '', iconv($charset, 'ASCII//TRANSLIT//IGNORE', $char));
             } else {
                 $asciistr .= preg_replace('/[`\'^~"]+/', '', iconv('UTF-8', $charset . '//TRANSLIT//IGNORE', $char));
             }
         } else {
             $asciistr .= $char;
         }
     }
     return $asciistr;
 }
Example #9
0
 /**
  * Sets up character encoding, instantiates the HTTP client, and assigns the web service version.
  */
 public function __construct()
 {
     $this->set('version', '1.0');
     iconv_set_encoding('output_encoding', 'UTF-8');
     iconv_set_encoding('input_encoding', 'UTF-8');
     iconv_set_encoding('internal_encoding', 'UTF-8');
 }
 /**
  * @param string $encoding
  *
  * @return bool|string
  */
 public static function setOutputEncoding($encoding)
 {
     if (self::versionGreaterOrEquals56()) {
         return ini_set('output_encoding', $encoding);
     }
     return iconv_set_encoding('output_encoding', $encoding);
 }
Example #11
0
 /**
  * Sets up character encoding, instantiates the HTTP client, and assigns the web service version.
  */
 public function __construct(HttpClient $httpClient = null)
 {
     $this->setHttpClient($httpClient ?: new HttpClient());
     $this->set('version', '1.0');
     iconv_set_encoding('output_encoding', 'UTF-8');
     iconv_set_encoding('input_encoding', 'UTF-8');
     iconv_set_encoding('internal_encoding', 'UTF-8');
 }
Example #12
0
 /**
  * Constructs a new Zend\Service\Technorati instance
  * and setup character encoding.
  *
  * @param  string $apiKey  Your Technorati API key
  */
 public function __construct($apiKey, HttpClient $httpClient = null)
 {
     iconv_set_encoding('output_encoding', 'UTF-8');
     iconv_set_encoding('input_encoding', 'UTF-8');
     iconv_set_encoding('internal_encoding', 'UTF-8');
     $this->apiKey = $apiKey;
     $this->setHttpClient($httpClient ?: new HttpClient());
 }
Example #13
0
 /**
  * Zend_Service_Flickr Constructor, setup character encoding
  *
  * @param string $apiKey Your Flickr API key
  */
 public function __construct($apiKey)
 {
     iconv_set_encoding('output_encoding', 'UTF-8');
     iconv_set_encoding('input_encoding', 'UTF-8');
     iconv_set_encoding('internal_encoding', 'UTF-8');
     $this->apiKey = $apiKey;
     $this->_rest = new Zend_Rest_Client('http://www.flickr.com');
     $this->_array = array();
 }
Example #14
0
 public function setEncoding(string $type = 'input', string $charset = 'utf-8') : bool
 {
     if (!in_array($type, $this->inputs)) {
         throw new InvalidArgumentException('Error', 'invalidInput', $type);
     }
     if (!isCharset($charset)) {
         throw new InvalidArgumentException('Error', 'charsetParameter', '2.($charset)');
     }
     return iconv_set_encoding($type . '_encoding', $charset);
 }
Example #15
0
 function mb_internal_encoding($enc = FALSE)
 {
     if (function_exists('iconv_set_encoding')) {
         if ($enc) {
             iconv_set_encoding('internal_encoding', $enc);
         }
         return iconv_get_encoding('internal_encoding');
     }
     return '';
 }
Example #16
0
 function mb_init($locale = 'pl_PL')
 {
    /*
     * Setting the Content-Type header with charset
     */
    setlocale(LC_CTYPE, $locale.'.UTF-8');
    iconv_set_encoding("output_encoding", "UTF-8");
    mb_internal_encoding('UTF-8');
    mb_regex_encoding('UTF-8');
 }
Example #17
0
 /**
  * Constructs a new Zend_Service_Technorati instance
  * and setup character encoding.
  *
  * @param  string $apiKey  Your Technorati API key
  */
 public function __construct($apiKey)
 {
     if (PHP_VERSION_ID < 50600) {
         iconv_set_encoding('output_encoding', 'UTF-8');
         iconv_set_encoding('input_encoding', 'UTF-8');
         iconv_set_encoding('internal_encoding', 'UTF-8');
     } else {
         ini_set('default_charset', 'UTF-8');
     }
     $this->_apiKey = $apiKey;
 }
 /**
  * Sets up character encoding, instantiates the HTTP client, and assigns the web service version.
  */
 public function __construct()
 {
     $this->set('version', '1.0');
     if (PHP_VERSION_ID < 50600) {
         iconv_set_encoding('output_encoding', 'UTF-8');
         iconv_set_encoding('input_encoding', 'UTF-8');
         iconv_set_encoding('internal_encoding', 'UTF-8');
     } else {
         ini_set('default_charset', 'UTF-8');
     }
 }
Example #19
0
 /**
  * Construct new Client
  *
  * @param string $awsAccessKeyId AWS Access Key ID
  * @param string $awsSecretAccessKey AWS Secret Access Key
  * @param array $config configuration options.
  * Valid configuration options are:
  * <ul>
  * <li>ServiceURL</li>
  * <li>UserAgent</li>
  * <li>SignatureVersion</li>
  * <li>TimesRetryOnError</li>
  * <li>ProxyHost</li>
  * <li>ProxyPort</li>
  * <li>MaxErrorRetry</li>
  * </ul>
  */
 public function __construct($awsAccessKeyId, $awsSecretAccessKey, $config = null)
 {
     iconv_set_encoding('output_encoding', 'UTF-8');
     iconv_set_encoding('input_encoding', 'UTF-8');
     iconv_set_encoding('internal_encoding', 'UTF-8');
     $this->_awsAccessKeyId = $awsAccessKeyId;
     $this->_awsSecretAccessKey = $awsSecretAccessKey;
     if (!is_null($config)) {
         $this->_config = array_merge($this->_config, $config);
     }
 }
Example #20
0
/**
 * Sets encoding for using in morphos/* functions.
 */
function set_encoding($encoding)
{
    if (function_exists('mb_internal_encoding')) {
        mb_internal_encoding($encoding);
    } else {
        if (function_exists('iconv_set_encoding')) {
            iconv_set_encoding('internal_encoding', $encoding);
        } else {
            return false;
        }
    }
}
Example #21
0
 public function __construct()
 {
     ini_set('auto_detect_line_endings', TRUE);
     if (function_exists('iconv') && PHP_VERSION_ID < 50600) {
         iconv_set_encoding('internal_encoding', self::DEFAULT_CHARACTER_ENCODING);
         iconv_set_encoding('input_encoding', self::DEFAULT_CHARACTER_ENCODING);
         iconv_set_encoding('output_encoding', self::DEFAULT_CHARACTER_ENCODING);
     } elseif (PHP_VERSION_ID >= 50600) {
         ini_set('default_charset', self::DEFAULT_CHARACTER_ENCODING);
     }
     $this->log_model = new CPK_WPCSV_Log_Model();
 }
 /**
  * Construct new Client
  *
  * @param string $awsAccessKeyId AWS Access Key ID
  * @param string $awsSecretAccessKey AWS Secret Access Key
  * @param array $config configuration options.
  * @param string $applicationName application name.
  * @param string $applicationVersion application version.
  * @param array $attributes user-agent attributes
  * @return unknown_type
  * Valid configuration options are:
  * <ul>
  * <li>ServiceURL</li>
  * <li>SignatureVersion</li>
  * <li>TimesRetryOnError</li>
  * <li>ProxyHost</li>
  * <li>ProxyPort</li>
  * <li>MaxErrorRetry</li>
  * </ul>
  */
 public function __construct($awsAccessKeyId, $awsSecretAccessKey, $config, $applicationName, $applicationVersion, $attributes = null)
 {
     iconv_set_encoding('output_encoding', 'UTF-8');
     iconv_set_encoding('input_encoding', 'UTF-8');
     iconv_set_encoding('internal_encoding', 'UTF-8');
     $this->awsAccessKeyId = $awsAccessKeyId;
     $this->awsSecretAccessKey = $awsSecretAccessKey;
     if (!is_null($config)) {
         $this->config = array_merge($this->config, $config);
     }
     $this->setUserAgentHeader($applicationName, $applicationVersion, $attributes);
 }
 /**
  * Zend_Service_Audioscrobbler Constructor, setup character encoding
  */
 public function __construct()
 {
     $this->set('version', '1.0');
     iconv_set_encoding('output_encoding', 'UTF-8');
     iconv_set_encoding('input_encoding', 'UTF-8');
     iconv_set_encoding('internal_encoding', 'UTF-8');
     try {
         $this->_rest = new Zend_Service_Rest();
         $this->_rest->setUri('http://ws.audioscrobbler.com');
     } catch (Zend_Http_Client_Exception $e) {
         throw $e;
     }
 }
Example #24
0
 /**
  * Init encodings: iconv, mbstring
  */
 private static function initEncoding()
 {
     if (PHP_VERSION_ID >= 50600) {
         ini_set('input_encoding', APP_CHARSET);
         ini_set('output_encoding', APP_CHARSET);
         ini_set('default_charset', APP_CHARSET);
     } else {
         iconv_set_encoding('input_encoding', APP_CHARSET);
         iconv_set_encoding('output_encoding', APP_CHARSET);
         iconv_set_encoding('internal_encoding', APP_CHARSET);
         ini_set('mbstring.internal_encoding', APP_CHARSET);
     }
 }
Example #25
0
 /**
  * Construct new Client
  *
  * @param string $awsAccessKeyId AWS Access Key ID
  * @param string $awsSecretAccessKey AWS Secret Access Key
  * @param array $config configuration options.
  * @param string $applicationName application name.
  * @param string $applicationVersion application version.
  * @param array $attributes user-agent attributes
  * @return unknown_type
  * Valid configuration options are:
  * <ul>
  * <li>ServiceURL</li>
  * <li>SignatureVersion</li>
  * <li>TimesRetryOnError</li>
  * <li>ProxyHost</li>
  * <li>ProxyPort</li>
  * <li>MaxErrorRetry</li>
  * </ul>
  */
 public function __construct($awsAccessKeyId, $awsSecretAccessKey, $config, $applicationName, $applicationVersion, $attributes = null)
 {
     // TODO do not rewrite global iconv charsets by default!
     iconv_set_encoding('output_encoding', 'UTF-8');
     iconv_set_encoding('input_encoding', 'UTF-8');
     iconv_set_encoding('internal_encoding', 'UTF-8');
     $this->awsAccessKeyId = $awsAccessKeyId;
     $this->awsSecretAccessKey = $awsSecretAccessKey;
     if (null !== $config) {
         $this->config = array_merge($this->config, $config);
     }
     $this->setUserAgentHeader($applicationName, $applicationVersion, $attributes);
 }
Example #26
0
 public function setEncoding($encoding = null)
 {
     if ($encoding !== null) {
         $orig = iconv_get_encoding('internal_encoding');
         $result = iconv_set_encoding('internal_encoding', $encoding);
         if (!$result) {
             require_once 'Zend/Validate/Exception.php';
             throw new Zend_Validate_Exception('Given encoding not supported on this OS!');
         }
         iconv_set_encoding('internal_encoding', $orig);
     }
     $this->_encoding = $encoding;
     return $this;
 }
 /**
  * Construct new Client
  *
  * @param string $awsAccessKeyId AWS Access Key ID
  * @param string $awsSecretAccessKey AWS Secret Access Key
  * @param array $config configuration options.
  * Valid configuration options are:
  * <ul>
  * <li>merchantId</li>
  * <li>accessKey</li>
  * <li>secretKey</li>
  * <li>applicationName</li>
  * <li>applicationVersion</li>
  * <li>region</li>
  * <li>environment</li>
  * <li>serviceURL</li>
  * <li>widgetURL</li>
  * <li>caBundleFile</li>
  * <li>clientId</li>
  * </ul>
  */
 public function __construct($config = null)
 {
     iconv_set_encoding('output_encoding', 'UTF-8');
     iconv_set_encoding('input_encoding', 'UTF-8');
     iconv_set_encoding('internal_encoding', 'UTF-8');
     if ($config != null) {
         $this->_checkConfigHasAllRequiredKeys($config);
         $this->_merchantValues = new OffAmazonPaymentsService_MerchantValues($config['merchantId'], $config['accessKey'], $config['secretKey'], $config['applicationName'], $config['applicationVersion'], $config['region'], $config['environment'], $config['serviceURL'], $config['widgetURL'], $config['caBundleFile'], $config['clientId']);
     } else {
         $this->_merchantValues = new OffAmazonPaymentsService_MerchantValues(MERCHANT_ID, ACCESS_KEY, SECRET_KEY, APPLICATION_NAME, APPLICATION_VERSION, REGION, ENVIRONMENT, SERVICE_URL, WIDGET_URL, CA_BUNDLEFILE, CLIENT_ID);
     }
     $this->_config = array_merge($this->_config, array('ServiceURL' => $this->_merchantValues->getServiceURL()));
     $this->setUserAgentHeader($this->_merchantValues->getApplicationName(), $this->_merchantValues->getApplicationVersion(), array("ApplicationLibraryVersion" => OffAmazonPaymentsService_Client::APPLICATION_LIBRARY_VERSION));
 }
Example #28
0
 public function __construct($application)
 {
     parent::__construct($application);
     date_default_timezone_set('UTC');
     if (function_exists('mb_internal_encoding')) {
         mb_internal_encoding("UTF-8");
     }
     if (function_exists('iconv_set_encoding')) {
         // Not sure if we want to do all of these
         iconv_set_encoding("input_encoding", "UTF-8");
         iconv_set_encoding("output_encoding", "UTF-8");
         iconv_set_encoding("internal_encoding", "UTF-8");
     }
 }
Example #29
0
 /**
  * Zend_Service_Audioscrobbler Constructor, setup character encoding
  * @param mixed $adapter Zend_Http_Client Adapter to be used
  */
 public function __construct($testing = FALSE, $testing_response = NULL)
 {
     $this->set('version', '1.0');
     iconv_set_encoding('output_encoding', 'UTF-8');
     iconv_set_encoding('input_encoding', 'UTF-8');
     iconv_set_encoding('internal_encoding', 'UTF-8');
     try {
         $this->_client = new Zend_Http_Client();
         $this->testing = $testing;
         $this->testing_response = $testing_response;
     } catch (Zend_Http_Client_Exception $e) {
         throw $e;
     }
 }
Example #30
-1
 public function run()
 {
     ignore_user_abort(false);
     ob_implicit_flush(1);
     ini_set('implicit_flush', true);
     cachemgr::init(false);
     if (strpos(strtolower(PHP_OS), 'win') === 0) {
         if (function_exists('mb_internal_encoding')) {
             mb_internal_encoding('UTF-8');
             mb_http_output('GBK');
             ob_start('mb_output_handler', 2);
         } elseif (function_exists('iconv_set_encoding')) {
             iconv_set_encoding('internal_encoding', 'UTF-8');
             iconv_set_encoding('output_encoding', 'GBK');
             ob_start('ob_iconv_handler', 2);
         }
     }
     if (isset($_SERVER['argv'][1])) {
         $args = array_shift($_SERVER['argv']);
         $rst = $this->exec_command(implode(' ', $_SERVER['argv']));
         if ($rst === false) {
             exit(-1);
         }
     } else {
         $this->interactive();
     }
 }