/*!
Executes the custom HTTP action
326357
function customHTTPAction( $http, $action, $parameters = array() )
    {
        $dataType = $this->dataType();
        if ( $dataType )
            $dataType->customObjectAttributeHTTPAction( $http, $action, $this, $parameters );
    }
729634
async function action_handler(req, h) {
    const data = req.payload
    const json = 'string' === typeof data ? tu.parseJSON(data) : data
    if (json instanceof Error) {
      throw json
    }

    const seneca = prepare_seneca(req, json)
    const msg = tu.internalize_msg(seneca, json)

    return await new Promise(resolve => {
      var out = null
      for (var i = 0; i < modify_action.length; i++) {
        out = modify_action[i].call(seneca, msg, req)
        if (out) {
          return resolve(out)
        }
      }

      seneca.act(msg, function(err, out, meta) {
        if (err && !options.debug) {
          err.stack = null
        }

        resolve(tu.externalize_reply(this, err, out, meta))
      })
    })
  }
599488
function executeController(server, controller, req, res) {
    try {
        const promise = controller.call(server, req, res);
        if (promise && typeof promise.catch === 'function') {
            promise.catch(function(err) {
                res.status(500).send(err);
            });
        }
    } catch (err) {
        res.send(err);
    }
}
1085153
function execute(req, res) {
  var proxy = req.exec ? req.exec.proxy : this.proxy;
  res.send(null, proxy(req, res));
}
817559
function execute() {

    if (dryRun) {
        console.log(`In ${destDir}, this script would...`);
    } else {
        console.log(`Generating API documentation using TypeDoc...`);
    }

    const packages = path.resolve(rootDir, srcDir);

    glob(packages, {realpath:true}, function(error, srcFiles) {
       
        srcFiles.forEach((srcPath) => {    
            
            var valid = true;

            var packageName = srcPath
                .split(path.sep)
                .pop();

            excludedPackages.forEach((excludedPackageName) => {
                if (packageName === excludedPackageName) {
                    console.log(chalk.yellow(`...skip generating TypeDoc API files for ${packageName}`));
                    valid = false;
                }
            });

            if(valid) {
                dryRun ? console.log(`...generate TypeDoc API files for ${packageName}`) : createAPIFiles(packageName, srcPath);
            }

        });

    });
}
464669
function handleCustomHTTPActions( $http, $attributeDataBaseName,
                                      $customActionAttributeArray, $customActionParameters )
    {
        $dataType = $this->dataType();
        if ( $dataType )
        {
            $customActionParameters['contentobject_attribute'] = $this;
            $dataType->handleCustomObjectHTTPActions( $http, $attributeDataBaseName,
                                                      $customActionAttributeArray, $customActionParameters );
        }
    }
169333
function http($url, $post_data = null) {/*{{{*/
    $ch = curl_init();
    if (defined("CURL_CA_BUNDLE_PATH")) curl_setopt($ch, CURLOPT_CAINFO, CURL_CA_BUNDLE_PATH);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
    curl_setopt($ch, CURLOPT_TIMEOUT, 30);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    //////////////////////////////////////////////////
    ///// Set to 1 to verify Server's SSL Cert //////
    //////////////////////////////////////////////////
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    if (isset($post_data)) {
      curl_setopt($ch, CURLOPT_POST, 1);
      curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
    }

    $response = curl_exec($ch);
    $this->http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    $this->last_api_call = $url;
    curl_close ($ch);

	/**
    echo "<pre>";
    echo $url . "\n";
    print_r(explode("&", $post_data)) . "\n";
    print_r($response) . "\n";
    echo "---\n</pre>";
	 */

    return $response;
  }
528497
public function exec()
    {
        $http = $this->argument('http');
        //
        $process = Router::get($http);
        //
        $this->show($process);
    }
219757
function execute(req, res) {
  res.send(null, this.info.toString(req.args[0] ? '' + req.args[0] : null));
}
239011
function execute_(callback) {
    var self = this;
    self.migrate(function(err) {
        if (err) { callback(err); return; }
        try {
            var event = { model:self.model, query:self.query, type:'select' };
            var flatten = self.$flatten || (self.getLevels()===0);
            if (!flatten) {
                //get expandable fields
                var expandables = self.model.attributes.filter(function(x) { return x.expandable; });
                //get selected fields
                var selected = self.query.$select[self.model.viewAdapter];
                if (_.isArray(selected)) {
                    //remove hidden fields
                    var hiddens = self.model.attributes.filter(function(x) { return x.hidden; });
                    if (hiddens.length>0) {
                        for (var i = 0; i < selected.length; i++) {
                            /**
                             * @type {QueryField}
                             */
                            var x = selected[i] instanceof QueryField ? selected[i] : new QueryField(selected[i]);
                            var hiddenField = hiddens.find(function(y) {
                                return x.getName() === y.name;
                            });
                            if (hiddenField) {
                                selected.splice(i, 1);
                                i-=1;
                            }
                        }
                    }
                    //expand fields
                    if (expandables.length>0) {
                        selected.forEach(function(x) {
                            //get field
                            var field = expandables.find(function(y) {
                                var f = x instanceof QueryField ? x : new QueryField(x);
                                return f.getName() === y.name;
                            });
                            //add expandable models
                            if (field) {
                                var mapping = self.model.inferMapping(field.name);
                                if (mapping) {
                                    self.$expand = self.$expand || [ ];
                                    var expand1 = self.$expand.find(function(x) {
                                        return x.name === field.name;
                                    });
                                    if (typeof expand1 === 'undefined') {
                                        self.expand(mapping);
                                    }
                                }

                            }
                        });
                    }
                }
            }
        }
        catch(err) {
            return callback(err);
        }

        //merge view filter. if any
        if (self.$view) {
            return self.model.filter({ $filter: self.$view.filter, $order:self.$view.order, $group:self.$view.group }, function(err, q) {
                if (err) {
                    if (err) { callback(err); }
                }
                else {
                    //prepare current filter
                    if (q.query.$prepared) {
                        if (event.query.$where)
                            event.query.prepare();
                        event.query.$where = q.query.$prepared;
                    }
                    if (q.query.$group)
                    //replace group fields
                        event.query.$group = q.query.$group;
                    //add order fields
                    if (q.query.$order) {
                        if (_.isArray(event.query.$order)) {
                            q.query.$order.forEach(function(x) { event.query.$order.push(x); });
                        }
                        else {
                            event.query.$order = q.query.$order;
                        }
                    }
                    //execute query
                    return finalExecuteInternal_.call(self, event, callback);
                }
            });
        }
        else {
            //execute query
            return finalExecuteInternal_.call(self, event, callback);
        }
    });
}
148889
public function executeInternal()
    {
        $formRuntime = $this->finisherContext->getFormRuntime();
        $request = $formRuntime->getRequest()->getMainRequest();

        $delay = (integer)$this->parseOption('delay');
        $statusCode = $this->parseOption('statusCode');
        $uri = trim($this->parseOption('uri'));

        
        if ($uri === '') {
            $uri = $this->buildActionUri($request);
        }

        $uriParts = parse_url($uri);
        if (!isset($uriParts['scheme']) || $uriParts['scheme'] === '') {
            $uri = $request->getHttpRequest()->getBaseUri() . $uri;
        }

        $escapedUri = htmlentities($uri, ENT_QUOTES, 'utf-8');

        $response = $formRuntime->getResponse();

        $response->setContent('<html><head><meta http-equiv="refresh" content="' . $delay . ';url=' . $escapedUri . '"/></head></html>');
        $response->setStatus($statusCode);

        if ($delay === 0) {
            $response->setHeader('Location', (string)$uri);
        }
    }
214148
public function execute() {

		// Register all handles and monitor that
		// all requests are executed
		$handleExecutionCounter = array();

		foreach( $this->httpRequests as $httpRequest ) {
			$httpRequest->setOption( CURLOPT_RETURNTRANSFER, true );
			$handleExecutionCounter[(int)  $httpRequest() ] = true;
			curl_multi_add_handle( $this->handle, $httpRequest() );
		}

		$response = $this->doMakeMultiRequest( $handleExecutionCounter );

		return $response;
	}
561498
protected function curl_execute()
    {
        $ch = curl_init();

        curl_setopt_array($ch, $this->getOptions());

        $this->_content = curl_exec($ch);

        $this->_errorCode = curl_errno($ch);

        $this->_info = curl_getinfo($ch);

        if ($this->_errorCode) {
            $this->_errorMessage = curl_error($ch);
        }
        curl_close($ch);
        return $this->isHttpOK();
    }
731680
function fetchObjectAttributeHTTPInput( $http, $base, $contentObjectAttribute )
    {

        eZMediaType::checkFileUploads();

        $classAttribute = $contentObjectAttribute->contentClassAttribute();
        $player = $classAttribute->attribute( "data_text1" );
        $pluginPage = eZMediaType::pluginPage( $player );

        $contentObjectAttributeID = $contentObjectAttribute->attribute( "id" );
        $version = $contentObjectAttribute->attribute( "version" );
        $width = $http->postVariable( $base . "_data_media_width_" . $contentObjectAttribute->attribute( "id" ) );
        $height = $http->postVariable( $base . "_data_media_height_" . $contentObjectAttribute->attribute( "id" ) );
        $quality = $http->hasPostVariable( $base . "_data_media_quality_" . $contentObjectAttribute->attribute( "id" ) ) ? $http->postVariable( $base . "_data_media_quality_" . $contentObjectAttribute->attribute( "id" ) ) : null;
        if ( $http->hasPostVariable( $base . "_data_media_controls_" . $contentObjectAttribute->attribute( "id" ) ) )
            $controls = $http->postVariable( $base . "_data_media_controls_" . $contentObjectAttribute->attribute( "id" ) );
        else
            $controls = null;

        $media = eZMedia::fetch( $contentObjectAttributeID, $version );
        if ( $media == null )
        {
           $media = eZMedia::create( $contentObjectAttributeID, $version );
        }

        $media->setAttribute( "contentobject_attribute_id", $contentObjectAttributeID );
        $media->setAttribute( "version", $version );
        $media->setAttribute( "width", $width );
        $media->setAttribute( "height", $height );
        $media->setAttribute( "quality", $quality );
        $media->setAttribute( "controls", $controls );
        $media->setAttribute( "pluginspage", $pluginPage );
        if ( $http->hasPostVariable( $base . "_data_media_is_autoplay_" . $contentObjectAttribute->attribute( "id" ) ) )
            $media->setAttribute( "is_autoplay", true );
        else
            $media->setAttribute( "is_autoplay", false );
        if ( $http->hasPostVariable( $base . "_data_media_has_controller_" . $contentObjectAttribute->attribute( "id" ) ) )
            $media->setAttribute( "has_controller", true );
        else
            $media->setAttribute( "has_controller", false );
        if ( $http->hasPostVariable( $base . "_data_media_is_loop_" . $contentObjectAttribute->attribute( "id" ) ) )
            $media->setAttribute( "is_loop", true );
        else
            $media->setAttribute( "is_loop", false );

        $mediaFilePostVarName = $base . "_data_mediafilename_" . $contentObjectAttribute->attribute( "id" );
        if ( eZHTTPFile::canFetch( $mediaFilePostVarName ) )
            $mediaFile = eZHTTPFile::fetch( $mediaFilePostVarName );
        else
            $mediaFile = null;
        if ( $mediaFile instanceof eZHTTPFile )
        {
            $mimeData = eZMimeType::findByFileContents( $mediaFile->attribute( "original_filename" ) );
            $mime = $mimeData['name'];

            if ( $mime == '' )
            {
                $mime = $mediaFile->attribute( "mime_type" );
            }
            $extension = eZFile::suffix( $mediaFile->attribute( "original_filename" ) );
            $mediaFile->setMimeType( $mime );
            if ( !$mediaFile->store( "original", $extension ) )
            {
                eZDebug::writeError( "Failed to store http-file: " . $mediaFile->attribute( "original_filename" ),
                                     "eZMediaType" );
                return false;
            }

            $orig_dir = $mediaFile->storageDir( "original" );
            eZDebug::writeNotice( "dir=$orig_dir" );
            $media->setAttribute( "filename", basename( $mediaFile->attribute( "filename" ) ) );
            $media->setAttribute( "original_filename", $mediaFile->attribute( "original_filename" ) );
            $media->setAttribute( "mime_type", $mime );

            $filePath = $mediaFile->attribute( 'filename' );
            $fileHandler = eZClusterFileHandler::instance();
            $fileHandler->fileStore( $filePath, 'media', true, $mime );
        }
        else if ( $media->attribute( 'filename' ) == '' )
        {
            $media->remove();
            return false;
        }

        $media->store();
        $contentObjectAttribute->setContent( $media );
        return true;
    }
1212009
public function _dispatch($action, $httpMethod, $vars = array())
    {
        $this->_action = $action;
        $this->_data = $_POST;
        $this->_params = array_merge(Atomik::get('request'), $vars);
        $this->_httpMethod = $httpMethod;
        
        $this->preDispatch();
        $result = $this->_execute($action, $this->_params);
        $this->postDispatch($result);
        return $result;
    }
875287
public function executeRequest()
    {

        // curl general
        $curl_options = [
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_SSL_VERIFYPEER => true,
            CURLOPT_CUSTOMREQUEST  => $this->requestType
        ];

        // set to post
        if ($this->requestType == 'POST') {
            $curl_options[CURLOPT_POST] = true;
        }

        // build url and append query params
        $url = $this->url($this->getUrl());
        $this->params[$this->oauth2->getAccessTokenName()] = $this->oauth2->getAccessToken();
        if (count($this->getParams()) > 0) {
            $url->setQuery($this->getParams());
        }
        $curl_options[CURLOPT_URL] = $url->val();

        // check request headers
        if (count($this->getHeaders()) > 0) {
            $header = [];
            foreach ($this->getHeaders() as $key => $parsed_urlvalue) {
                $header[] = "$key: $parsed_urlvalue";
            }
            $curl_options[CURLOPT_HTTPHEADER] = $header;
        }

        // init curl
        $ch = curl_init();
        curl_setopt_array($ch, $curl_options);

        // https handling
        if ($this->certificateFile != '') {
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
            curl_setopt($ch, CURLOPT_CAINFO, $this->certificateFile);
        } else {
            // bypass ssl verification
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        }

        // execute the curl request
        $result = curl_exec($ch);
        $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        $content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
        if ($curl_error = curl_error($ch)) {
            throw new OAuth2Exception($curl_error);
        } else {
            $json_decode = $this->jsonDecode($result, true);
        }
        curl_close($ch);

        return [
            'result'       => (null === $json_decode) ? $result : $json_decode,
            'code'         => $http_code,
            'content_type' => $content_type
        ];
    }
1308962
public function exec()
    {
        $http = $this->argument('http');
        //
        $process = Router::post($http);
        //
        $this->show($process);
    }