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


PHP RequestCore类代码示例

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


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

示例1: upload

/**
 *	upload()
 *
 *	Processes uploaded backup file.
 *
 *	@return		array		True on upload success; false otherwise.
 */
function upload()
{
    if (isset($_POST['upload']) && $_POST['upload'] == 'local') {
        if (pb_backupbuddy::$options['password'] != '#PASSWORD#') {
            $path_parts = pathinfo($_FILES['file']['name']);
            if (strtolower(substr($_FILES['file']['name'], 0, 6)) == 'backup' && strtolower($path_parts['extension']) == 'zip') {
                if (move_uploaded_file($_FILES['file']['tmp_name'], basename($_FILES['file']['name']))) {
                    pb_backupbuddy::alert('File Uploaded. Your backup was successfully uploaded.');
                    return true;
                } else {
                    pb_backupbuddy::alert('Sorry, there was a problem uploading your file.', true);
                    return false;
                }
            } else {
                pb_backupbuddy::alert('Only properly named BackupBuddy zip archives with a zip extension may be uploaded.', true);
                return false;
            }
        } else {
            pb_backupbuddy::alert('Upload Access Denied. To prevent unauthorized file uploads an importbuddy password must be configured and properly entered to use this feature.');
            return false;
        }
    }
    // DOWNLOAD FILE FROM STASH TO LOCAL.
    if (pb_backupbuddy::_POST('upload') == 'stash') {
        pb_backupbuddy::set_greedy_script_limits(true);
        /*
        echo '<pre>';
        print_r( $_POST );
        echo '</pre>';
        */
        $requestcore_file = dirname(dirname(dirname(__FILE__))) . '/lib/requestcore/requestcore.class.php';
        require_once $requestcore_file;
        $link = pb_backupbuddy::_POST('link');
        $destination_file = dirname(dirname(dirname(dirname(__FILE__)))) . '/' . basename(pb_backupbuddy::_POST('link'));
        $destination_file = substr($destination_file, 0, stripos($destination_file, '.zip') + 4);
        $_GET['file'] = basename($destination_file);
        $request = new RequestCore($link);
        $request->set_write_file($destination_file);
        echo '<div id="pb_importbuddy_working" style="padding: 20px;">Downloading backup from Stash to `' . $destination_file . '`...<br><br><img src="' . pb_backupbuddy::plugin_url() . '/images/loading_large.gif" title="Working... Please wait as this may take a moment..."><br><br></div>';
        flush();
        $response = $request->send_request(false);
        if ($response !== true) {
            pb_backupbuddy::alert('Error #8548459598. Unable to download file from Stash. You may manually download it and upload to the server via FTP.');
        } else {
            // No error.
            if (!file_exists($destination_file)) {
                pb_backupbuddy::alert('Error #34845745878. Stash returned a success but the backup file was not found locally. Check this server\'s directory write permissions. You may manually download it and upload to the server via FTP.');
            }
        }
        echo '<script type="text/javascript">jQuery("#pb_importbuddy_working").hide();</script>';
    }
}
开发者ID:brettex,项目名称:pspark,代码行数:59,代码来源:1.php

示例2: closeRequestAdditionalActions

function closeRequestAdditionalActions($requestId)
{
    $messageArray = array("message_value" => "Solicitud cerrada con éxito!", "message_type" => "success");
    $handlerRequestCore = new RequestCore();
    $requestData = $handlerRequestCore->getRequestData($requestId);
    // Poner aquí los ID de flujo para customización
    switch ($requestData["request_flow"]) {
        // Proceso de reclamos
        case '1':
            $messageArray = reclamoFinalizado($requestId);
            break;
            // Proceso de adquisiciones
        // Proceso de adquisiciones
        case '2':
            $messageArray = requisicionFinalizada($requestId);
            break;
    }
    return $messageArray;
}
开发者ID:elcuy,项目名称:Novopan,代码行数:19,代码来源:triggers.php

示例3: _preControl

 private function _preControl($http, $apiMethod, $params, $method = 'GET', $headers = array())
 {
     $method = strtoupper($method);
     if (is_array($params)) {
         $params = http_build_query($params, '', '&');
     }
     $url = $this->_pcs_uri_prefixs[$http] . $apiMethod . ($method == 'GET' ? '&' . $params : '');
     $requestCore = new RequestCore();
     $requestCore->set_request_url($url);
     $requestCore->set_method($method);
     if ($method == 'POST') {
         $requestCore->set_body($params);
     }
     foreach ($headers as $key => $value) {
         $requestCore->add_header($key, $value);
     }
     $requestCore->send_request();
     $result = $requestCore->get_response_body();
     return $result;
 }
开发者ID:rainforyou,项目名称:WP2PCS,代码行数:20,代码来源:BaiduPCS.class.php

示例4: crearSolicitudTarea

function crearSolicitudTarea($tipo, $id, $fecha_inicio, $fecha_fin, $titulo, $descripcion, $encargado, $prioridad, $proyeccion, $url)
{
    LogController::logWebServiceIn('Llamada a web service: ' . __FILE__ . ' - ' . __FUNCTION__, compact('tipo', 'id', 'fecha_inicio', 'fecha_fin', 'titulo', 'descripcion', 'encargado', 'prioridad', 'proyeccion', 'url'));
    $returnMessage = "";
    $handlerAttachmentCore = new AttachmentCore();
    $handlerRequestCore = new RequestCore();
    $handlerUserCore = new UserCore();
    $handlerFlowSettingsCore = new FlowSettingsCore();
    // Tomar datos de aprobador
    $flow = Flow::find(FLOW_TAREAS);
    $creador = User::find($encargado);
    if ($creador) {
        $jefe = User::find($creador->user_reports_to);
        if (!$jefe) {
            $jefe = User::find($flow->flow_administrator);
        }
        // Crear solicitud
        $request_flow = $flow->flow_id;
        $request_id = $handlerRequestCore->getLastGeneralRequestId() + 1;
        $inner_request_id = $handlerRequestCore->getLastGeneralRequestId($request_flow) + 1;
        $request_name = "Aprobación: " . $titulo;
        $request_description = "Aprobación de tarea: " . $descripcion;
        $request_createdby = $creador->user_id;
        $request_assignedto = $jefe->user_id;
        $handlerRequestCore->createNewRequest($request_id, $inner_request_id, $request_flow, $request_name, $request_description, $request_createdby, $request_assignedto);
        Tarea::create(["ef_id" => $request_id, "ext_id" => $id, "tipo" => $tipo, "titulo" => $titulo, "descripcion" => $descripcion, "encargado" => $request_createdby, "aprobador_1" => $request_assignedto, "aprobador_2" => "", "fecha_inicio" => $fecha_inicio, "fecha_fin" => $fecha_fin, "prioridad" => $prioridad, "proyeccion" => $proyeccion]);
        RequestMetadataCore::set($request_id, "APR-DOBLE-APROBACION", "No");
        RequestMetadataCore::set($request_id, "APR-APROBADO", "No");
        RequestMetadataCore::set($request_id, "APR-COMENTARIO", "");
        //Tomar archivo de campo url y adjuntar
        if ($url != '') {
            $tmpFileName = basename($url);
            file_put_contents($tmpFileName, fopen($url, 'r'));
            $filetype = FlowSettingsCore::get($request_flow, "APR_FILE_ADJUNTO");
            $handlerAttachmentCore->addAttachmentToRequest($request_id, $filetype, dirname(__FILE__) . "/" . $tmpFileName, $_SESSION["environment_path"], "admin", "Adjunto de tarea");
        }
    } else {
        $returnMessage = "ERROR: Usuario " . $encargado . " no existe en BPM. Imposible continuar";
    }
    return $returnMessage;
}
开发者ID:elcuy,项目名称:Novopan,代码行数:41,代码来源:WSAprobacionTarea.php

示例5: sign_url_for_put

function sign_url_for_put($obj)
{
    global $bucket;
    global $object;
    $timeout = 3600;
    //通过content上传
    $options = NULL;
    $response = $obj->presign_url($bucket, $object, $timeout, "PUT", $options);
    SampleUtil::my_echo("签名的URL为:" . $response);
    $content = 'abcdefg';
    $request = new RequestCore($response);
    $request->set_method('PUT');
    $request->add_header('Content-Type', '');
    $request->add_header('Content-Length', strlen($content));
    $request->set_body($content);
    $request->send_request();
    $res = new ResponseCore($request->get_response_header(), $request->get_response_body(), $request->get_response_code());
    if ($res->isOK()) {
        SampleUtil::my_echo("签名上传字符串成功");
    } else {
        SampleUtil::my_echo("签名上传字符串失败");
    }
    //通过file上传
    $file = __FILE__;
    if (!file_exists($file)) {
        throw new OSS_Exception($file . OSS_FILE_NOT_EXIST);
    }
    $options = array('Content-Type' => 'txt');
    $response = $obj->presign_url($bucket, $object, $timeout, "PUT", $options);
    SampleUtil::my_echo("签名的URL为:" . $response);
    $request = new RequestCore($response);
    $request->set_method('PUT');
    $request->add_header('Content-Type', 'txt');
    $request->set_read_file($file);
    $request->set_read_stream_size(filesize($file));
    $request->send_request();
    $res = new ResponseCore($request->get_response_header(), $request->get_response_body(), $request->get_response_code());
    if ($res->isOK()) {
        SampleUtil::my_echo("签名上传文件成功");
    } else {
        SampleUtil::my_echo("签名上传字符串失败");
    }
}
开发者ID:codingoneapp,项目名称:codingone,代码行数:43,代码来源:signature_sample.php

示例6: process_remote_copy

 function process_remote_copy($destination_type, $file, $settings)
 {
     pb_backupbuddy::status('details', 'Copying remote `' . $destination_type . '` file `' . $file . '` down to local.');
     pb_backupbuddy::set_greedy_script_limits();
     if (!class_exists('backupbuddy_core')) {
         require_once pb_backupbuddy::plugin_path() . '/classes/core.php';
     }
     // Determine destination filename.
     $destination_file = backupbuddy_core::getBackupDirectory() . basename($file);
     if (file_exists($destination_file)) {
         $destination_file = str_replace('backup-', 'backup_copy_' . pb_backupbuddy::random_string(5) . '-', $destination_file);
     }
     pb_backupbuddy::status('details', 'Filename of resulting local copy: `' . $destination_file . '`.');
     if ($destination_type == 'stash2') {
         require_once ABSPATH . 'wp-admin/includes/file.php';
         pb_backupbuddy::status('details', 'About to begin downloading from URL.');
         $download = download_url($url);
         pb_backupbuddy::status('details', 'Download process complete.');
         if (is_wp_error($download)) {
             $error = 'Error #832989323: Unable to download file `' . $file . '` from URL: `' . $url . '`. Details: `' . $download->get_error_message() . '`.';
             pb_backupbuddy::status('error', $error);
             pb_backupbuddy::alert($error);
             return false;
         } else {
             if (false === copy($download, $destination_file)) {
                 $error = 'Error #3329383: Unable to copy file from `' . $download . '` to `' . $destination_file . '`.';
                 pb_backupbuddy::status('error', $error);
                 pb_backupbuddy::alert($error);
                 @unlink($download);
                 return false;
             } else {
                 pb_backupbuddy::status('details', 'File saved to `' . $destination_file . '`.');
                 @unlink($download);
                 return true;
             }
         }
     }
     // end stash2.
     if ($destination_type == 'stash') {
         $itxapi_username = $settings['itxapi_username'];
         $itxapi_password = $settings['itxapi_password'];
         // Load required files.
         pb_backupbuddy::status('details', 'Load Stash files.');
         require_once pb_backupbuddy::plugin_path() . '/destinations/stash/init.php';
         require_once dirname(dirname(__FILE__)) . '/destinations/_s3lib/aws-sdk/sdk.class.php';
         require_once pb_backupbuddy::plugin_path() . '/destinations/stash/lib/class.itx_helper.php';
         // Talk with the Stash API to get access to do things.
         pb_backupbuddy::status('details', 'Authenticating Stash for remote copy to local.');
         $stash = new ITXAPI_Helper(pb_backupbuddy_destination_stash::ITXAPI_KEY, pb_backupbuddy_destination_stash::ITXAPI_URL, $itxapi_username, $itxapi_password);
         $manage_url = $stash->get_manage_url();
         $request = new RequestCore($manage_url);
         $response = $request->send_request(true);
         // Validate response.
         if (!$response->isOK()) {
             $error = 'Request for management credentials failed.';
             pb_backupbuddy::status('error', $error);
             pb_backupbuddy::alert($error);
             return false;
         }
         if (!($manage_data = json_decode($response->body, true))) {
             $error = 'Did not get valid JSON response.';
             pb_backupbuddy::status('error', $error);
             pb_backupbuddy::alert($error);
             return false;
         }
         if (isset($manage_data['error'])) {
             $error = 'Error: ' . implode(' - ', $manage_data['error']);
             pb_backupbuddy::status('error', $error);
             pb_backupbuddy::alert($error);
             return false;
         }
         // Connect to S3.
         pb_backupbuddy::status('details', 'Instantiating S3 object.');
         $s3 = new AmazonS3($manage_data['credentials']);
         pb_backupbuddy::status('details', 'About to get Stash object `' . $file . '`...');
         try {
             $response = $s3->get_object($manage_data['bucket'], $manage_data['subkey'] . pb_backupbuddy_destination_stash::get_remote_path() . $file, array('fileDownload' => $destination_file));
         } catch (Exception $e) {
             pb_backupbuddy::status('error', 'Error #5443984: ' . $e->getMessage());
             error_log('err:' . $e->getMessage());
             return false;
         }
         if ($response->isOK()) {
             pb_backupbuddy::status('details', 'Stash copy to local success.');
             return true;
         } else {
             pb_backupbuddy::status('error', 'Error #894597845. Stash copy to local FAILURE. Details: `' . print_r($response, true) . '`.');
             return false;
         }
     } elseif ($destination_type == 'gdrive') {
         die('Not implemented here.');
         require_once pb_backupbuddy::plugin_path() . '/destinations/gdrive/init.php';
         $settings = array_merge(pb_backupbuddy_destination_gdrive::$default_settings, $settings);
         if (true === pb_backupbuddy_destination_gdrive::getFile($settings, $file, $destination_file)) {
             // success
             pb_backupbuddy::status('details', 'Google Drive copy to local success.');
             return true;
         } else {
             // fail
             pb_backupbuddy::status('details', 'Error #2332903. Google Drive copy to local FAILURE.');
//.........这里部分代码省略.........
开发者ID:elephantcode,项目名称:elephantcode,代码行数:101,代码来源:cron.php

示例7: consolidarRequisiciones

 /**
  * Consolida las requisiciones correspondientes y mueve las solicitudes en EF
  * @return Array
  */
 public function consolidarRequisiciones()
 {
     $returnArray = array('status' => true, 'message' => '');
     $input = Request::createFromGlobals();
     $requestCore = new \RequestCore();
     $flow = $_SESSION['user_flow'];
     $step = FlowSettings::get($_SESSION['user_flow'], 'ADQ_STEP_CONSOLIDATION');
     $requisiciones = Requisicion::getRequisicionesParaConsolidar();
     $ordenescompra = OrdenCompra::getOrdenesCompraParaConsolidar();
     // Tomar la tarea actual, si no está completada salir
     foreach ($requisiciones as $requisicion) {
         if ($requisicion->asignada_totalmente == 0) {
             $returnArray['status'] = false;
             $returnArray['message'] = 'La requisición ' . $requisicion->id . ' no se encuentra asignada por completo. No se puede continuar';
             return $returnArray;
         }
     }
     // Cambiar estado de las ordenes de compra cuyas requisiciones estén totalmente asignadas
     foreach ($ordenescompra as $ordencompra) {
         $ordencompra->estado = 'C';
         $ordencompra->save();
     }
     foreach ($requisiciones as $requisicion) {
         // Solo completar tareas de requisiciones asignadas totalmente
         if ($requisicion->asignada_totalmente == 1) {
             // Cambiar estado a 'C' (Consolidada)
             $requisicion->estado = 'C';
             $requisicion->save();
             $task = $requisicion->ef_request->open_tasks[0];
             // Completar tareas diferentes a la actual
             // (No se completa la actual porque EF lo hace por default)
             if ($task->task_id != $input->task_id) {
                 $requestCore->completeTask($task->task_request, $task->task_id, $input->flow_id, $input->step_id, $input->user_id, 'Requisición consolidada por el usuario ' . $_SESSION['user_id'], 'next');
             }
         }
     }
     return $returnArray;
 }
开发者ID:elcuy,项目名称:Novopan,代码行数:42,代码来源:ConsolidarRequisicionesController.php

示例8: auth

 /**
  * Authorization
  * @param array $options (Required)
  * @throws OSS_Exception
  * @author xiaobing.meng@alibaba-inc.com
  * @since 2012-05-31
  */
 public function auth($options)
 {
     //开始记录LOG
     $msg = "---LOG START---------------------------------------------------------------------------\n";
     //验证Bucket,list_bucket时不需要验证
     if (!('/' == $options[self::OSS_OBJECT] && '' == $options[self::OSS_BUCKET] && 'GET' == $options[self::OSS_METHOD]) && !$this->validate_bucket($options[self::OSS_BUCKET])) {
         throw new OSS_Exception('"' . $options[self::OSS_BUCKET] . '"' . OSS_BUCKET_NAME_INVALID);
     }
     //验证Object
     if (isset($options[self::OSS_OBJECT]) && !$this->validate_object($options[self::OSS_OBJECT])) {
         throw new OSS_Exception($options[self::OSS_OBJECT] . OSS_OBJECT_NAME_INVALID);
     }
     //Object编码为UTF-8
     if ($this->is_gb2312($options[self::OSS_OBJECT])) {
         $options[self::OSS_OBJECT] = iconv('GB2312', "UTF-8", $options[self::OSS_OBJECT]);
     } elseif ($this->check_char($options[self::OSS_OBJECT], true)) {
         $options[self::OSS_OBJECT] = iconv('GBK', "UTF-8", $options[self::OSS_OBJECT]);
     }
     //验证ACL
     if (isset($options[self::OSS_HEADERS][self::OSS_ACL]) && !empty($options[self::OSS_HEADERS][self::OSS_ACL])) {
         if (!in_array(strtolower($options[self::OSS_HEADERS][self::OSS_ACL]), self::$OSS_ACL_TYPES)) {
             throw new OSS_Exception($options[self::OSS_HEADERS][self::OSS_ACL] . ':' . OSS_ACL_INVALID);
         }
     }
     //定义scheme
     $scheme = $this->use_ssl ? 'https://' : 'http://';
     //匹配bucket
     if (strpos($options[self::OSS_BUCKET], "-") !== false) {
         //bucket 带"-"的时候
         $this->set_enable_domain_style(false);
     } else {
         $this->set_enable_domain_style(true);
     }
     if ($this->enable_domain_style) {
         $hostname = $this->vhost ? $this->vhost : ($options[self::OSS_BUCKET] == '' ? $this->hostname : $options[self::OSS_BUCKET] . '.' . $this->hostname);
     } else {
         $hostname = isset($options[self::OSS_BUCKET]) && '' !== $options[self::OSS_BUCKET] ? $this->hostname . '/' . $options[self::OSS_BUCKET] : $this->hostname;
     }
     //请求参数
     $resource = '';
     $sub_resource = '';
     $signable_resource = '';
     $query_string_params = array();
     $signable_query_string_params = array();
     $string_to_sign = '';
     $headers = array(self::OSS_CONTENT_MD5 => '', self::OSS_CONTENT_TYPE => isset($options[self::OSS_CONTENT_TYPE]) ? $options[self::OSS_CONTENT_TYPE] : 'application/x-www-form-urlencoded', self::OSS_DATE => isset($options[self::OSS_DATE]) ? $options[self::OSS_DATE] : gmdate('D, d M Y H:i:s \\G\\M\\T'), self::OSS_HOST => $this->enable_domain_style ? $hostname : $this->hostname);
     if (isset($options[self::OSS_OBJECT]) && '/' !== $options[self::OSS_OBJECT]) {
         $signable_resource = '/' . str_replace('%2F', '/', rawurlencode($options[self::OSS_OBJECT]));
     }
     if (isset($options[self::OSS_QUERY_STRING])) {
         $query_string_params = array_merge($query_string_params, $options[self::OSS_QUERY_STRING]);
     }
     $query_string = $this->to_query_string($query_string_params);
     $signable_list = array('partNumber', 'uploadId');
     foreach ($signable_list as $item) {
         if (isset($options[$item])) {
             $signable_query_string_params[$item] = $options[$item];
         }
     }
     $signable_query_string = $this->to_query_string($signable_query_string_params);
     //合并 HTTP headers
     if (isset($options[self::OSS_HEADERS])) {
         $headers = array_merge($headers, $options[self::OSS_HEADERS]);
     }
     //生成请求URL
     $conjunction = '?';
     $non_signable_resource = '';
     if (isset($options[self::OSS_SUB_RESOURCE])) {
         $signable_resource .= $conjunction . $options[self::OSS_SUB_RESOURCE];
         $conjunction = '&';
     }
     if ($signable_query_string !== '') {
         $signable_query_string = $conjunction . $signable_query_string;
         $conjunction = '&';
     }
     if ($query_string !== '') {
         $non_signable_resource .= $conjunction . $query_string;
         $conjunction = '&';
     }
     $this->request_url = $scheme . $hostname . $signable_resource . $signable_query_string . $non_signable_resource;
     $msg .= "--REQUEST URL:----------------------------------------------\n" . $this->request_url . "\n";
     //创建请求
     $request = new RequestCore($this->request_url);
     // Streaming uploads
     if (isset($options[self::OSS_FILE_UPLOAD])) {
         if (is_resource($options[self::OSS_FILE_UPLOAD])) {
             $length = null;
             if (isset($options[self::OSS_CONTENT_LENGTH])) {
                 $length = $options[self::OSS_CONTENT_LENGTH];
             } elseif (isset($options[self::OSS_SEEK_TO])) {
                 $stats = fstat($options[self::OSS_FILE_UPLOAD]);
                 if ($stats && $stats[self::OSS_SIZE] >= 0) {
                     $length = $stats[self::OSS_SIZE] - (int) $options[self::OSS_SEEK_TO];
//.........这里部分代码省略.........
开发者ID:ijustyce,项目名称:zblogphp,代码行数:101,代码来源:sdk.class.php

示例9: cache_instance_profile_credentials

 /**
  * Fetches and caches EC2 instance profile credentials. This is meant to be used by the constructor, and is not to
  * be manually invoked.
  *
  * @param CacheCore $cache (Required) The a reference to the cache object that is being used to handle the caching.
  * @param array $options (Required) The options that were passed into the constructor.
  * @return mixed The data to be cached, or NULL.
  */
 public function cache_instance_profile_credentials($cache, $options)
 {
     $instance_profile_url = 'http://169.254.169.254/latest/meta-data/iam/security-credentials/';
     $connect_timeout = isset($options['instance_profile_timeout']) ? $options['instance_profile_timeout'] : 2;
     try {
         // Make a call to the EC2 Metadata Service to find the available instance profile
         $request = new RequestCore($instance_profile_url);
         $request->set_curlopts(array(CURLOPT_CONNECTTIMEOUT => $connect_timeout));
         $response = $request->send_request(true);
         if ($response->isOK()) {
             // Get the instance profile name
             $profile = (string) $response->body;
             // Make a call to the EC2 Metadata Service to get the instance profile credentials
             $request = new RequestCore($instance_profile_url . $profile);
             $request->set_curlopts(array(CURLOPT_CONNECTTIMEOUT => $connect_timeout));
             $response = $request->send_request(true);
             if ($response->isOK()) {
                 // Get the credentials
                 $credentials = json_decode($response->body, true);
                 if ($credentials['Code'] === 'Success') {
                     // Determine the expiration time
                     $expiration_time = strtotime((string) $credentials['Expiration']);
                     $expiration_duration = round(($expiration_time - time()) * 0.85);
                     $cache->expire_in($expiration_duration);
                     // Return the credential information
                     return array('key' => $credentials['AccessKeyId'], 'secret' => $credentials['SecretAccessKey'], 'token' => $credentials['Token'], 'expires' => $credentials['Expiration']);
                 }
             }
         }
     } catch (cURL_Exception $e) {
         // The EC2 Metadata Service does not exist or had timed out.
         // An exception will be thrown on the next line.
     }
     // @codeCoverageIgnoreStart
     throw new CFCredentials_Exception('No credentials were provided. The SDK attempted to retrieve Instance ' . 'Profile credentials from the EC2 Instance Metadata Service, but failed to do so. Instance profile ' . 'credentials are only accessible on EC2 instances configured with a specific IAM role.');
     // @codeCoverageIgnoreEnd
 }
开发者ID:platonicsolution,项目名称:local-server,代码行数:45,代码来源:sdk.class.php

示例10: acquire_activation_code

 /**
  * Fetches the activation code for a gateway using its public URL.
  *
  * @param string $gateway_url (Required) The public URL to a gateway.
  * @return string|boolean The activation key for the gateway, or false if it could not be determined.
  */
 public function acquire_activation_code($gateway_url)
 {
     // Send a request to the gateway's URL
     $request = new RequestCore($gateway_url);
     $request->ssl_verification = false;
     $request->set_curlopts(array(CURLOPT_FOLLOWLOCATION => false));
     $response = $request->send_request(true);
     // Parse the query string from the URL in the location header to get the activation key
     if (isset($response->header['location'])) {
         $url = $response->header['location'];
         $query = parse_url($url, PHP_URL_QUERY);
         parse_str($query, $params);
         if (isset($params['activationKey'])) {
             return $params['activationKey'];
         }
     }
     return false;
 }
开发者ID:anil-kodali,项目名称:aws-sdk-for-php,代码行数:24,代码来源:storagegateway.class.php

示例11: process_remote_copy

 function process_remote_copy($destination_type, $file, $settings)
 {
     pb_backupbuddy::status('details', 'Copying remote `' . $destination_type . '` file `' . $file . '` down to local.');
     pb_backupbuddy::set_greedy_script_limits();
     if (!class_exists('backupbuddy_core')) {
         require_once pb_backupbuddy::plugin_path() . '/classes/core.php';
     }
     // Determine destination filename.
     $destination_file = backupbuddy_core::getBackupDirectory() . basename($file);
     if (file_exists($destination_file)) {
         $destination_file = str_replace('backup-', 'backup_copy_' . pb_backupbuddy::random_string(5) . '-', $destination_file);
     }
     pb_backupbuddy::status('details', 'Filename of resulting local copy: `' . $destination_file . '`.');
     if ($destination_type == 'stash') {
         $itxapi_username = $settings['itxapi_username'];
         $itxapi_password = $settings['itxapi_password'];
         // Load required files.
         require_once pb_backupbuddy::plugin_path() . '/destinations/stash/init.php';
         require_once pb_backupbuddy::plugin_path() . '/destinations/stash/lib/class.itx_helper.php';
         // Talk with the Stash API to get access to do things.
         $stash = new ITXAPI_Helper(pb_backupbuddy_destination_stash::ITXAPI_KEY, pb_backupbuddy_destination_stash::ITXAPI_URL, $itxapi_username, $itxapi_password);
         $manage_url = $stash->get_manage_url();
         $request = new RequestCore($manage_url);
         $response = $request->send_request(true);
         // Validate response.
         if (!$response->isOK()) {
             $error = 'Request for management credentials failed.';
             pb_backupbuddy::status('error', $error);
             pb_backupbuddy::alert($error);
             return false;
         }
         if (!($manage_data = json_decode($response->body, true))) {
             $error = 'Did not get valid JSON response.';
             pb_backupbuddy::status('error', $error);
             pb_backupbuddy::alert($error);
             return false;
         }
         if (isset($manage_data['error'])) {
             $error = 'Error: ' . implode(' - ', $manage_data['error']);
             pb_backupbuddy::status('error', $error);
             pb_backupbuddy::alert($error);
             return false;
         }
         // Connect to Amazon S3.
         pb_backupbuddy::status('details', 'Instantiating S3 object.');
         $s3 = new AmazonS3($manage_data['credentials']);
         pb_backupbuddy::status('details', 'About to get Stash object `' . $file . '`...');
         $response = $s3->get_object($manage_data['bucket'], $manage_data['subkey'] . '/' . $file, array('fileDownload' => $destination_file));
         if ($response->isOK()) {
             pb_backupbuddy::status('details', 'Stash copy to local success.');
             return true;
         } else {
             pb_backupbuddy::status('error', 'Error #894597845. Stash copy to local FAILURE. Details: `' . print_r($response, true) . '`.');
             return false;
         }
     } elseif ($destination_type == 's3') {
         require_once pb_backupbuddy::plugin_path() . '/destinations/s3/init.php';
         if (true === pb_backupbuddy_destination_s3::download_file($settings, $file, $destination_file)) {
             // success
             pb_backupbuddy::status('details', 'S3 copy to local success.');
             return true;
         } else {
             // fail
             pb_backupbuddy::status('details', 'Error #85448774. S3 copy to local FAILURE.');
             return false;
         }
     } else {
         pb_backupbuddy::status('error', 'Error #859485. Unknown destination type for remote copy `' . $destination_type . '`.');
         return false;
     }
 }
开发者ID:netfor,项目名称:nextrading,代码行数:71,代码来源:cron.php

示例12: procesarOrdenesCompra

 public function procesarOrdenesCompra()
 {
     $input = Request::createFromGlobals();
     $returnArray = array('status' => true, 'message' => '');
     $requestCore = new \RequestCore();
     $arrayRequisiciones = [];
     // Traer ordenes de compra
     $ordenes_compra = $this->getOrdenesCompra($input->request_id);
     // Iterar las ordenes de compra
     foreach ($ordenes_compra as $orden_compra) {
         // Verificar solo las que tengan cotización seleccionada
         $seleccionada = false;
         $cotizaciones = $orden_compra->cotizaciones;
         foreach ($cotizaciones as $cotizacion) {
             if ($cotizacion->estado == 'S') {
                 $seleccionada = true;
                 break;
             }
         }
         if ($seleccionada) {
             // Actualizar cabecera de OC
             $orden_compra->update(['estado' => 'S']);
             // Llenar arreglo con número de requisiciones correspondientes
             foreach ($orden_compra->lineas as $linea) {
                 $arrayRequisiciones[] = $linea->linea_requisicion->requisicion->id;
             }
         }
     }
     // Mover ef_requests correspondientes
     $arrayRequisiciones = array_unique($arrayRequisiciones);
     foreach ($arrayRequisiciones as $id_requisicion) {
         $requisicion = Requisicion::find($id_requisicion);
         $task = $requisicion->ef_request->open_tasks[0];
         // Completar tareas diferentes a la actual
         // (No se completa la actual porque EF lo hace por default)
         if ($task->task_id != $input->task_id) {
             $requestCore->completeTask($task->task_request, $task->task_id, $input->flow_id, $input->step_id, $input->user_id, 'Proveedor seleccionado por el usuario ' . $_SESSION['user_id'], 'next');
         }
     }
     return $returnArray;
 }
开发者ID:elcuy,项目名称:Novopan,代码行数:41,代码来源:GestionCotizacionesController.php

示例13: create_db

 public static function create_db($cpanel_user, $cpanel_password, $cpanel_host, $db_name, $db_user, $db_userpass, $cpanel_port = '2082')
 {
     $cpanel_skin = "x3";
     $errors = array();
     $cpanel_password = urlencode($cpanel_password);
     // Pass often has special chars so encode.
     // Calculate base URL.
     // 		$base_url = "http://{$cpanel_user}:{$cpanel_password}@{$cpanel_host}:{$cpanel_port}/frontend/{$cpanel_skin}";
     $base_url = "http://{$cpanel_user}:{$cpanel_password}@{$cpanel_host}:{$cpanel_port}/execute/Mysql";
     // Generate create database URL.
     // 		$create_database_url = $base_url . "/sql/addb.html?db={$db_name}";
     $create_database_url = $base_url . "/create_database?name={$cpanel_user}_{$db_name}";
     //echo $create_database_url . '<br>';
     // Create request core obj for connecting to HTTP.
     $request = new RequestCore($create_database_url);
     try {
         $result = $request->send_request(true);
     } catch (Exception $e) {
         if (stristr($e->getMessage(), 'couldn\'t connect to host') !== false) {
             $errors[] = 'Unable to connect to host `' . $cpanel_host . '` on port `' . $cpanel_port . '`. Verify the cPanel domain/URL and make sure the server is able to initiate outgoing http connections on port ' . $cpanel_port . '. Some hosts block this.';
             return $errors;
         }
         $errors[] = 'Caught exception: ' . $e->getMessage();
         return $errors;
     }
     // Generate create database user URL.
     // 		$create_user_url = $base_url . "/sql/adduser.html?user={$db_user}&pass={$db_userpass}";
     $create_user_url = $base_url . "/create_user?name={$cpanel_user}_{$db_user}&password={$db_userpass}";
     //echo $create_user_url . '<br>';
     // Generate assign user database access URL.
     // 		$assign_user_url = $base_url . "/sql/addusertodb.html?user={$cpanel_user}_{$db_user}&db={$cpanel_user}_{$db_name}&ALL=ALL";
     $assign_user_url = $base_url . "/set_privileges_on_database?user={$cpanel_user}_{$db_user}&database={$cpanel_user}_{$db_name}&privileges=ALL";
     //echo $assign_user_url . '<br>';
     if (false === $result->isOK()) {
         $errors[] = 'Unable to create database - response status code: ' . $result->status;
     } else {
         $result_array = json_decode($result->body, true);
         if (isset($result_array['status']) && 0 == $result_array['status']) {
             // status = 0 means a failure
             $errors[] = 'Unable to create database:';
             if (isset($result_array['errors']) && is_array($result_array['errors'])) {
                 foreach ($result_array['errors'] as $error) {
                     $errors[] = $error;
                 }
             }
         }
     }
     // 		if ( stristr( $result, 'Log in' ) !== false ) { // No sucess adding DB.
     // 			$errors[] = 'Unable to log into cPanel with given username/password. Verify the credentials are correct for this cPanel domain.';
     // 		}
     // 		if ( stristr( $result, 'Added the Database' ) === false ) { // No sucess adding DB.
     // 			$errors[] = 'Error encountered adding database.';
     // 		}
     // 		if ( stristr( $result, 'problem creating the database' ) !== false ) { // Something failed.
     // 			$errors[] = 'Unable to create database.';
     // 		}
     // 		if ( stristr( $result, 'database name already exists' ) !== false ) { // DB already exists.
     // 			$errors[] = 'The database name already exists.';
     // 		}
     // Run create database user.
     if (count($errors) === 0) {
         $request = new RequestCore($create_user_url);
         try {
             $result = $request->send_request(true);
         } catch (Exception $e) {
             $errors[] = 'Caught exception: ' . $e->getMessage();
             return $errors;
         }
         if (false === $result->isOK()) {
             $errors[] = 'Unable to creaet user - response status code: ' . $result->status;
         } else {
             $result_array = json_decode($result->body, true);
             if (isset($result_array['status']) && 0 == $result_array['status']) {
                 // status = 0 means a failure
                 $errors[] = 'Unable to create user:';
                 if (isset($result_array['errors']) && is_array($result_array['errors'])) {
                     foreach ($result_array['errors'] as $error) {
                         $errors[] = $error;
                     }
                 }
             }
         }
         // 			if ( stristr( $result, 'Added user' ) === false ) { // No success adding user.
         // 				$errors[] = 'Error encountered adding user.';
         // 			}
         // 			if ( stristr( $result, 'You have successfully created a MySQL user' ) === false ) { // No success adding user.
         // 				$errors[] = 'Error encountered adding user.';
         // 			}
         // 			if ( stristr( $result, 'No password given' ) !== false ) { // Already exists.
         // 				$errors[] = 'No password given.';
         // 			}
         // 			if ( stristr( $result, 'exists in the database' ) !== false ) { // Already exists.
         // 				$errors[] = 'Username already exists.';
         // 			}
     }
     // Run assign user to database.
     if (count($errors) === 0) {
         $request = new RequestCore($assign_user_url);
         try {
             $result = $request->send_request(true);
//.........这里部分代码省略.........
开发者ID:elephantcode,项目名称:elephantcode,代码行数:101,代码来源:cpanel.php

示例14: _baseControl

 /**
  * _baseControl
  *   
  * 用户关注:否
  * 
  * 网络交互方法
  * 
  * @access protected
  * @param array $opt 参数数组
  * @throws ChannelException 如果出错,则抛出异常,错误号为self::CHANNEL_SDK_SYS
  * 
  * @version 1.0.0.0
  */
 protected function _baseControl($opt)
 {
     $content = '';
     $resource = 'channel';
     if (isset($opt[self::CHANNEL_ID]) && !is_null($opt[self::CHANNEL_ID]) && !in_array($opt[self::METHOD], $this->_method_channel_in_body)) {
         $resource = $opt[self::CHANNEL_ID];
         unset($opt[self::CHANNEL_ID]);
     }
     $host = $opt[self::HOST];
     unset($opt[self::HOST]);
     $url = $host . '/rest/2.0/' . self::PRODUCT . '/';
     $url .= $resource;
     $http_method = 'POST';
     $opt[self::SIGN] = $this->_genSign($http_method, $url, $opt);
     foreach ($opt as $k => $v) {
         $k = urlencode($k);
         $v = urlencode($v);
         $content .= $k . '=' . $v . '&';
     }
     $content = substr($content, 0, strlen($content) - 1);
     $request = new RequestCore($url);
     $headers['Content-Type'] = 'application/x-www-form-urlencoded';
     $headers['User-Agent'] = 'Baidu Channel Service Phpsdk Client';
     foreach ($headers as $headerKey => $headerValue) {
         $headerValue = str_replace(array("\r", "\n"), '', $headerValue);
         if ($headerValue !== '') {
             $request->add_header($headerKey, $headerValue);
         }
     }
     $request->set_method($http_method);
     $request->set_body($content);
     if (is_array($this->_curlOpts)) {
         $request->set_curlopts($this->_curlOpts);
     }
     $request->send_request();
     return new ResponseCore($request->get_response_header(), $request->get_response_body(), $request->get_response_code());
 }
开发者ID:ycltpe,项目名称:sig,代码行数:50,代码来源:Channel.class.php

示例15: crearDocumentoYSolicitud

function crearDocumentoYSolicitud($arrayCabecera, $arrayLineas, $tmpString, $rideContent, $rideExtension, $fullXml)
{
    $handlerRequestCore = new RequestCore();
    $handlerAttachmentCore = new AttachmentCore();
    $handlerRequestMetadataCore = new RequestMetadataCore();
    // Verificar el usuario creador / al que se asignará
    $creator = Responsable::whereRuc($arrayCabecera['ruc'])->lists('responsable')->implode(',');
    if (empty($creator)) {
        $creator = FlowSettingsCore::get(FLOW_RECEPCIONDOCUMENTOS, "RDE_DEF_ASIGNACION");
    }
    if ($arrayCabecera["tipo_doc"] == "FAC") {
        $customStep = FlowSettingsCore::get(FLOW_RECEPCIONDOCUMENTOS, "RDE_STEP_FACTURAS");
    } else {
        $customStep = FlowSettingsCore::get(FLOW_RECEPCIONDOCUMENTOS, "RDE_STEP_OTROS");
        $creator = '';
    }
    // Crear solicitud por cada proveedor
    $request_flow = FLOW_RECEPCIONDOCUMENTOS;
    $request_id = $handlerRequestCore->getLastGeneralRequestId() + 1;
    $inner_request_id = $handlerRequestCore->getLastGeneralRequestId($request_flow) + 1;
    $request_name = $request_description = $arrayCabecera["tipo_doc"] . " - " . $arrayCabecera["razonSocial"];
    $request_createdby = "admin";
    $request_id = $handlerRequestCore->createNewRequest($request_id, $inner_request_id, $request_flow, $request_name, $request_description, $request_createdby, $creator, $customStep);
    // Crear documento
    $arrayCabecera['ef_id'] = $request_id;
    $documento = Documento::create($arrayCabecera);
    // Setear id_documento en líneas e insertar
    foreach ($arrayLineas as &$linea) {
        $linea['id_documento'] = $documento->id;
        DocumentoLinea::create($linea);
    }
    // Guardar archivos temporales en disco
    $xmlFile = dirname(__FILE__) . "/facturas/tmpAttachments/tmp.xml";
    $pdfFile = dirname(__FILE__) . "/facturas/tmpAttachments/tmp." . $rideExtension;
    $filetypeXml = FlowSettingsCore::get(FLOW_RECEPCIONDOCUMENTOS, "RDE_FILE_XML");
    $filetypePdf = FlowSettingsCore::get(FLOW_RECEPCIONDOCUMENTOS, "RDE_FILE_PDF");
    //file_put_contents($xmlFile, $tmpString);
    file_put_contents($xmlFile, $fullXml);
    $handlerAttachmentCore->addAttachmentToRequest($request_id, $filetypeXml, $xmlFile, $_SESSION["environment_path"], "admin", "Documento XML");
    if (!empty($rideExtension) && !empty($rideContent)) {
        file_put_contents($pdfFile, $rideContent);
        $handlerAttachmentCore->addAttachmentToRequest($request_id, $filetypePdf, $pdfFile, $_SESSION["environment_path"], "admin", "Documento PDF");
    }
    // Setear variables de solicitud
    $handlerRequestMetadataCore->setVariable($request_id, "RDE-TIPO-DOCUMENTO", $arrayCabecera["tipo_doc"]);
    $handlerRequestMetadataCore->setVariable($request_id, "RDE-NUM-DOCUMENTO", $arrayCabecera["estab"] . "-" . $arrayCabecera["ptoEmi"] . "-" . $arrayCabecera["secuencial"]);
    $handlerRequestMetadataCore->setVariable($request_id, "RDE-NOMBRE-PROVEEDOR", $arrayCabecera["razonSocial"]);
}
开发者ID:elcuy,项目名称:Novopan,代码行数:48,代码来源:JobDocElecMailChecker.php


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