create() public static method

The information contained in the URI always take precedence over the other information (server and parameters).
public static create ( string $uri, string $method = 'GET', array $parameters = [], array $cookies = [], array $files = [], array $server = [], string $content = null ) : Request
$uri string The URI
$method string The HTTP method
$parameters array The query (GET) or request (POST) parameters
$cookies array The request cookies ($_COOKIE)
$files array The request files ($_FILES)
$server array The server parameters ($_SERVER)
$content string The raw body data
return Request A Request instance
Example #1
10
 /**
  * Returns the routing traces associated to the given request.
  *
  * @param RequestDataCollector $request
  * @param string               $method
  *
  * @return array
  */
 private function getTraces(RequestDataCollector $request, $method)
 {
     $traceRequest = Request::create($request->getPathInfo(), $request->getRequestServer()->get('REQUEST_METHOD'), $request->getRequestAttributes()->all(), $request->getRequestCookies()->all(), array(), $request->getRequestServer()->all());
     $context = $this->matcher->getContext();
     $context->setMethod($method);
     $matcher = new TraceableUrlMatcher($this->routes, $context);
     return $matcher->getTracesForRequest($traceRequest);
 }
Example #2
0
 public function analyse()
 {
     $query = Input::get('q');
     $analysisData = new stdClass();
     $analysisData->keyword = $query;
     $analysisData->posts = array();
     $analysisData->tools = array('all');
     $postsRetrievers = array(new FacebookPostsRetriever(), new TwitterPostsRetriever());
     foreach ($postsRetrievers as $postsRetriever) {
         $posts = $postsRetriever->retrieve($query, null);
         $analysisData->posts = array_merge($analysisData->posts, $posts);
     }
     $analysisDataJSON = json_encode($analysisData);
     //        $response = Unirest::post("http://service/analyzer",
     //			array( "Accept" => "application/json" ),
     //			array('query' => $analysisDataJSON)
     //        );
     $request = Request::create('/service/analyzer', 'POST', array('query' => $analysisDataJSON));
     Request::replace($request->input());
     $response = Route::dispatch($request)->getContent();
     //		$analysisResult = json_decode($response->raw_body);
     $analysisResult = json_decode($response);
     foreach ($analysisResult->posts as $post) {
         foreach ($analysisData->posts as $postData) {
             if ($postData['id'] == $post->id) {
                 $post->data = $postData;
                 break;
             }
         }
     }
     return View::make('AnalysisResult')->with('analysisResult', $analysisResult);
 }
Example #3
0
 public function testAbsoluteLinkShouldAddRootUriFromRequest()
 {
     $helper = new UrlHelper();
     $request = Request::create(false, 'localhost', '/webroot/test', '/webroot');
     $this->assertEquals('http://localhost/webroot/page', $helper->absoluteLink('/page', $request));
     $request = Request::create(true, 'localhost', '/webroot/test', '/webroot');
     $this->assertEquals('https://localhost/webroot/page', $helper->absoluteLink('/page', $request));
 }
Example #4
0
 /**
  * Call the given URI and return a Response.
  *
  * @param  string $uri
  *
  * @return \Illuminate\Http\Response
  */
 protected function call($uri)
 {
     $request = Request::create($uri, 'GET');
     $kernel = $this->app->make(HttpKernel::class);
     $response = $kernel->handle($request);
     $kernel->terminate($request, $response);
     return $response;
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $request = Request::create('/api/blocknotify', 'GET', array('secret' => !$this->option('secret') ? Config::get('bitcoin.callback_secret') : $this->option('secret'), 'blockhash' => $this->option('blockhash')));
     Request::replace($request->input());
     $response = Route::dispatch($request)->getContent();
     if ($this->option('debug')) {
         $this->info($response);
     }
 }
Example #6
0
 public static function getInstance(array $config = array())
 {
     if (self::$_instance === NULL) {
         self::$_instance = new self();
         self::$_instance->config = array('charset' => 'utf-8', 'content_type' => 'text/html', 'database' => array('models' => BASE_PATH . '/models/', 'engine' => 'sqlite3', 'db_name' => BASE_PATH . '/test.db'), 'static_url' => '/static', 'xhtml_tags' => false);
         Request::create();
     }
     date_default_timezone_set('Australia/ACT');
     return self::$_instance;
 }
Example #7
0
 /**
  * Metodo para crear request entre controladores
  * 
  * @param type $url Metodo destino
  * @param type $method Metodo de envio (GET o POST)
  * @param type $data Arreglo de datos
  * @param type $json Si el retorno es json o array
  * @return type JSON o ARRAY
  */
 public static function ruta($url, $method, $data, $json = true)
 {
     //Datos enviados, vector
     Input::replace($data);
     //Crea Request via GET o POST
     $request = Request::create($url, $method);
     //Obtener response
     $response = Route::dispatch($request);
     //Solo contenido, en formato json
     $content = $response->getContent();
     if ($json) {
         //Retorna formato JSON
         return $content;
     } else {
         //Retorna un arreglo
         return json_decode($content);
     }
 }
 public function release($url, $method = 'GET', $input, $no_json)
 {
     // Store the original input of the request
     $originalInput = \Request::input();
     // Create request to the API, adding the no-json parameter, since it's an internal request
     $request = \Request::create($url, $method);
     // Replace the input with the request instance input
     \Request::replace($input);
     // Fetch the response
     if ($no_json) {
         $content = \Route::dispatch($request)->getContent();
         $result = json_decode($content, 1);
     } else {
         $result = \Route::dispatch($request)->getContent();
     }
     // Replace the input again with the original request input.
     \Request::replace($originalInput);
     return $result;
 }
Example #9
0
    public static function Create($p_sessionId, &$p_objectId, $p_objectTypeId = null, $p_userId = null) {
        if (empty($p_sessionId)) {
            throw new SessionIdNotSet();
        }

        $session = new Session($p_sessionId);
        if (!$session->exists()) {
            $sessionParams = array('start_time'=>strftime("%Y-%m-%d %T"));
            if (!empty($p_userId)) {
                $sessionParams['user_id'] = $p_userId;
            }
            $session->create($sessionParams);
        }
        $sessionUserId = $session->getUserId();
        if (!empty($p_userId) && !empty($sessionUserId) && $sessionUserId != $p_userId) {
            throw new InvalidUserId();
        }

        $requestObject = new RequestObject($p_objectId);
        if (!$requestObject->exists()) {
            if (empty($p_objectTypeId)) {
                throw new ObjectTypeIdNotSet();
            }
            $requestObject->create(array('object_type_id'=>$p_objectTypeId));
            $p_objectId = $requestObject->getObjectId();
        } elseif (empty($p_objectId)) {
            throw new ObjectIdNotSet();
        }

        $request = new Request($p_sessionId, $p_objectId);
        if (!$request->exists()) {
            $request->create();
        }
        if (!$request->isInStats()) {
        	$requestStats = new RequestStats($p_objectId);
        	if (!$requestStats->exists()) {
        		$requestStats->create();
        	}
        	$requestStats->incrementRequestCount();
            $request->setLastStatsUpdate();
        }
    }
Example #10
0
 /**
  * Forms must never accept empty request
  */
 public function testUnhandledForms()
 {
     // get form kernel
     $forms = app('Lavender\\Contracts\\Form\\Kernel');
     foreach ($forms->all() as $id => $class) {
         $form = form($id)->resolve();
         // form must always resolve correctly
         $this->assertInstanceOf($class, $form);
         // create empty request
         $request = Request::create('/', 'POST', []);
         // create a form request
         $form_request = app('Lavender\\Http\\FormRequest');
         // set the current request
         $form_request->setRequest($request);
         // handle the form request
         $result = form($id)->handle($form_request);
         // empty request must always fail
         $this->assertEquals(false, $result, "Unhandled form \"{$id}\"");
     }
 }
Example #11
0
 /**
  * Writes the statistics (when article read).
  *
  * @param int $p_sessionId
  *      used for not writing the stats multiple times
  * @param int $p_objectId
  *      the article object whose stats shall be updated
  * @return bool
  */
 public static function UpdateStats($p_sessionId, $p_objectId)
 {
     if (!$p_sessionId || !$p_objectId) {
         return false;
     }
     $request = new Request($p_sessionId, $p_objectId);
     if (!$request->exists()) {
         $request->create();
     }
     if (!$request->isInStats()) {
         $requestStats = new RequestStats($p_objectId);
         if (!$requestStats->exists()) {
             $requestStats->create();
         }
         $requestStats->incrementRequestCount();
         $request->setLastStatsUpdate();
         return true;
     }
     return false;
 }
 public function testManyActivitiesCanBeAddedToUsers()
 {
     factory(App\Group::class, 4)->create()->each(function ($g) {
         for ($i = 0; $i < 5; $i++) {
             $g->users()->save(factory(App\User::class)->make(), ['role' => 'member']);
         }
         $g->users()->save(factory(App\User::class)->make(), ['role' => 'leader']);
     });
     factory(App\Activity::class, 5)->create();
     $group = Group::find(1);
     $activity = Activity::find(1);
     $stuff = array('activityId' => $activity->id, 'group' => $group->id);
     foreach ($group->users as $user) {
         $stuff[$user->id] = 'true';
     }
     $request = Request::create('/', 'POST', $stuff);
     $this->controller->addMany($request);
     foreach ($group->users as $user) {
         $this->seeInDatabase('activity_user', ['activity_id' => $activity->id, 'user_id' => $user->id]);
     }
 }
Example #13
0
 public function testConstructors()
 {
     $request1 = Request::create('http://example.com', 'POST', ['foo' => 'bar']);
     $this->assertEquals('example.com', $request1->getHeaderLine('Host'));
     $this->assertEquals(['foo' => 'bar'], $request1->getParsedBody());
     $request2 = Request::create('http://example.com', 'GET', ['foo' => 'bar']);
     $this->assertEquals(['foo' => 'bar'], $request2->getQueryParams());
     $_SERVER = ['REQUEST_URI' => 'http://example.com', 'REQUEST_METHOD' => 'POST'];
     $_POST = ['foo' => 'bar'];
     $_GET = ['baz' => 'foobar'];
     $_COOKIE = ['bar' => 'bazbar'];
     $_FILES = ['form' => ['files' => ['tmp_name' => ['foo', 'bar'], 'name' => ['foo', 'bar'], 'size' => [52, 16], 'type' => ['baz', 'foobar'], 'error' => [0, 0]]]];
     $request3 = Request::createGlobal();
     $this->assertEquals('example.com', $request3->getHeaderLine('Host'));
     $this->assertEquals('POST', $request3->getMethod());
     $this->assertEquals(['foo' => 'bar'], $request3->getParsedBody());
     $this->assertEquals(['baz' => 'foobar'], $request3->getQueryParams());
     $this->assertEquals(['bar' => 'bazbar'], $request3->getCookieParams());
     $this->assertEquals($_SERVER, $request3->getServerParams());
     $this->assertArrayHasKey('form', $request3->getUploadedFiles());
     $this->assertCount(2, $request3->getUploadedFiles()['form']['files']);
     $this->assertInstanceOf('Jivoo\\Http\\Message\\UploadedFile', $request3->getUploadedFiles()['form']['files'][0]);
     $this->assertInstanceOf('Jivoo\\Http\\Message\\UploadedFile', $request3->getUploadedFiles()['form']['files'][1]);
 }
Example #14
0
|
| Here is where you will register all of the routes in an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::group(['middleware' => ['api', 'web']], function ($account) {
    Route::get('/', function () {
        return 'Welcome to application';
    });
    //Route::get('/', function(){
    //	return redirect('/home');
    //});
    Route::get('/posts', function () {
        $token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJkb21haW4iOiJ0cmF2ZWwuY29tIiwic3ViIjoxLCJpc3MiOiJodHRwOlwvXC90cmF2ZWwuY29tXC9hcGlcL3YxXC9hdXRoZW50aWNhdGUiLCJpYXQiOjE0NTU2OTM2MDcsImV4cCI6MTQ1NTY5NzIwNywibmJmIjoxNDU1NjkzNjA3LCJqdGkiOiI3NTM0M2YzYTEyYTg1NGI2ZmI5Yjc0MWY2ZDFhYzQ1ZiJ9.3nGMHHXALcOGKPqiiuKqrAmxaJnUQasg1HX3pfYGZyA';
        $request = Request::create(Request::root() . '/api/v1/posts', 'GET', ['token' => $token]);
        $response = Route::dispatch($request)->getData();
        $result = json_decode(json_encode($response), true);
        echo '<pre>';
        print_r($result);
        //return $result;
    });
});
Route::group(['prefix' => 'api/v1', 'middleware' => ['cors', 'api.jwt']], function () {
    Route::resource('authenticate', 'AuthenticateController', ['only' => ['index']]);
    Route::post('authenticate', 'AuthenticateController@authenticate');
    Route::get('authenticate/user', 'AuthenticateController@getAuthenticatedUser');
    Route::get('refresh_token', 'AuthenticateController@refresh_token');
    // Api calls
    Route::resource('posts', 'Api\\V1\\postsController');
    Route::get('my_posts', 'Api\\V1\\postsController@getUserPosts');
Example #15
0
 /**
  * http request wrapper
  * @param $url
  * @param $method
  * @param $parameters
  * @return \Henter\WeChat\Response
  */
 function request($url, $method, $parameters)
 {
     return Request::create(array('url' => $url, 'method' => $method, 'headers' => array('user-agent' => $this->user_agent), 'form' => $parameters, 'timeout' => $this->timeout))->send();
 }
Example #16
0
 public function postAuthForm()
 {
     //delegate to default api function
     $request = \Request::create(\URL::route('api.auth.auth'), 'POST', \Input::all());
     return \Route::dispatch($request);
 }
Example #17
0
 public function testMethodCanBeInjectedViaPostParam()
 {
     $_POST['_method'] = 'put';
     $request = Request::create(false, 'localhost', '/test');
     $this->assertEquals('PUT', $request->method());
     $_SERVER['REQUEST_URI'] = '/test';
     $_SERVER['REQUEST_METHOD'] = 'GET';
     $request = Request::createFromGlobals();
     $this->assertEquals('PUT', $request->method());
     unset($_POST['_method']);
 }
 protected static function requestOriginalApi($uri, $method = 'GET', $params = array())
 {
     $request = Request::create($uri, $method, $params);
     $response = Route::dispatch($request)->getContent();
     return $response;
 }
 public function testFirstPageView()
 {
     // Register fake named route
     Route::any('/foobar', function () {
         return 'hello world';
     });
     $headers = Request::instance()->server->getHeaders();
     $request = Request::create('http://localhost/foobar', 'get', [], [], [], $headers);
     Route::dispatch($request);
     $ab = App::make('ab');
     $ab->track($request);
     $ab->experiment();
     $this->assertEquals(1, Experiment::find('a')->visitors);
     $this->assertEquals(0, Experiment::find('a')->engagement);
 }
Example #20
0
 /**
  * Comprueba que la notificación de pago recibida es correcta y auténtica
  *
  * @param array $post_data Datos POST incluidos con la notificación
  *
  * @throws Payment_Exception
  * @return bool
  */
 public function validate_notification($post_data = null, &$fee = 0)
 {
     if (!isset($post_data)) {
         $post_data = $_POST;
     }
     /*Validación de notificación
     
     Para garantizar que se ha realizado un pago en su cuenta PayPal, debe verificar que la dirección de correo electrónico utilizada como "receiver_email" se ha registrado y confirmado en su cuenta PayPal.
     
     Una vez que el servidor ha recibido la notificación de pago instantánea, necesitará confirmarla creando un HTTP POST en PayPal. El POST se debe enviar a https://www.paypal.com/cgi-bin/webscr.
     
     cuando las reciba. También necesitará añadir una variable llamada "cmd" con el valor "_notify-validate" (p.ej. cmd=_notify-validate) a la cadena POST.
     
     PayPal responderá al envío con una sola palabra, "VERIFICADO" o "NO VÁLIDO", en el cuerpo de la respuesta. Si recibe la respuesta VERIFICADO, necesitará realizar varias comprobaciones antes de cumplimentar el pedido:
     
     Confirme que el "payment_status" es "Completado", ya que las IPN también se envían para otros resultados como "Pendiente" o "Fallido".
     Compruebe que "txn_id" no es un duplicado para impedir que cualquier persona con intenciones fraudulentas utilice una antigua transacción completada.
     Valide que "receiver_email" es una dirección de correo electrónico registrada en su cuenta PayPal, con el fin de impedir que el pago se envíe a la cuenta de una persona con intenciones fraudulentas.
     Compruebe otros detalles de la transacción como el número de artículo y el precio para confirmar que el precio no ha cambiado.
     Una vez que haya completado las comprobaciones anteriores, puede actualizar su base de datos con los datos de la IPN y procesar la compra.
     
     Si recibe la notificación "NO VÁLIDO", debe tratarla como sospechosa e investigarla.*/
     if ($post_data['receiver_email'] != $this->merchant_id) {
         throw new Payment_Exception("receiver_email != {$this->merchant_id}");
     }
     $refund = false;
     if (strcasecmp($post_data['payment_status'], 'refunded') == 0) {
         //Pago devuelto
         $refund = true;
     } elseif (strcasecmp($post_data['payment_status'], 'completed') != 0) {
         throw new Payment_Exception('Payment_status not completed');
     }
     $expected_gross = $refund ? $this->amount * -1 : $this->amount;
     if ($post_data['mc_gross'] != $expected_gross || strcasecmp($post_data['mc_currency'], $this->currency) != 0) {
         throw new Payment_Exception('mc_gross or mc_currency invalid');
     }
     //Realizar validación contra el servidor de Paypal
     $post_data['cmd'] = '_notify-validate';
     $response = Request::create($this->url_payment)->post($post_data)->execute();
     if ($response->status() != 200 || strcasecmp($response->body(), 'VERIFIED') != 0) {
         throw new Payment_Exception('Invalid Paypal response: ' . $response->body());
     }
     $fee = floatval($post_data['mc_fee']);
     if ($refund) {
         throw new Payment_Exception('Payment refunded', Payment_Exception::REASON_REFUND);
     }
     //Comprobar unicidad y almacenar el ID de Transacción de Paypal
     if (isset($this->find_txnid_callback, $this->store_txnid_callback)) {
         $txn_id = $post_data['txn_id'];
         $found = call_user_func($this->find_txnid_callback, $txn_id);
         if ($found) {
             throw new Payment_Exception('Duplicated transaction id (txn_id)', $txn_id);
         } else {
             call_user_func($this->store_txnid_callback, $txn_id);
         }
     }
     return true;
 }
    $getTravelPackage = Input::json()->all();
    //print_r($getTravelPackage);
    $updatePackage = ["old" => $getTravelPackage["old"], "new" => $getTravelPackage["new"]];
    //$travel = Travel::where("Travel_Name","=",$getTravelPackage['nama'])->first();
    $package = TravelPackage::where("Package_Name", '=', $updatePackage["old"]["name"])->where("Package_Price", '=', $updatePackage["old"]["price"]);
    if ($package->count() == 1) {
        $urlOld = $updatePackage["old"]["image"];
        $requestOld = Request::create($urlOld);
        $nameOld = $requestOld->segments();
        $nameOld = $nameOld[count($nameOld) - 1];
        $filename = 'resources/images/integration/int_travel/' . $nameOld;
        if (File::exists($filename)) {
            File::delete($filename);
        }
        $urlNew = $updatePackage["new"]["image"];
        $requestNew = Request::create($urlNew);
        $nameNew = $requestNew->segments();
        $nameNew = $nameNew[count($nameNew) - 1];
        $fileNew = file_get_contents($urlNew);
        file_put_contents("resources/images/integration/int_travel/" . $nameNew, $fileNew);
        $newPackage = ["Package_Name" => $updatePackage["new"]["name"], "Package_Picture" => $nameNew, "Package_Description" => $updatePackage["new"]["details"], "Package_Price" => $updatePackage["new"]["price"]];
        $package->update($newPackage);
    }
});
Route::POST('/DeletePaketWisata', function () {
    $getTravelPackage = Input::json()->all();
    $deletePackage = ["Package_Name" => $getTravelPackage["paket"]["name"], "Package_Price" => $getTravelPackage["paket"]["price"], "Package_Picture" => $getTravelPackage["picture"]];
    $package = TravelPackage::where("Package_Name", "=", $deletePackage['Package_Name'])->where("Package_Price", "=", $deletePackage['Package_Price']);
    $name = $package->get()->first()->Package_Picture;
    $filename = 'resources/images/integration/int_travel/' . $name;
    if ($package->count() == 1) {
 public function cargarDatos()
 {
     $request = Request::create('/estados', 'GET', array());
     $estados = Route::dispatch($request)->original;
     return View::make('completar', array('nombre' => Input::get('nombre'), 'cotizacion_id' => Input::get('cotizacion_id'), 'pago' => Input::get('pago'), 'cobertura' => Input::get('cobertura'), 'formato' => Input::get('formato'), 'descripcion' => Input::get('descripcion'), 'estados' => $estados, 'tipo' => Input::get('tipo'), 'claveInterna' => Input::get('clave-interna'), 'modelo' => Input::get('modelo'), 'recibos' => Input::get('recibos')));
 }
Example #23
0
 /**
  * Batch Operations
  * https://parse.com/docs/rest/guide#objects-batch-operations
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function batch()
 {
     $requests = json_decode(file_get_contents('php://input'));
     $output = array();
     foreach ($requests->requests as $request) {
         $url = parse_url($request->path);
         $query = array();
         if (isset($url['query'])) {
             parse_str($url['query'], $query);
         }
         $body = isset($request->body) ? json_encode($request->body) : null;
         self::$currentRequest = \Request::create($request->path, $request->method, $query, array(), array(), array(), $body);
         $result = json_decode(\Route::dispatch(self::$currentRequest)->getContent());
         if (!property_exists($result, 'error')) {
             $output[] = array("success" => $result);
         } else {
             $output[] = array("error" => $result);
         }
     }
     return \Response::json($output);
 }
<?php 
require_once "includes/initialize.php";
if (isset($_POST['submit'])) {
    $cuz_id = trim(mysql_prep($_POST['cuz_id']));
    $fer_type = trim(mysql_prep($_POST['fer_type']));
    $name = trim(mysql_prep($_POST['name']));
    $quantity = trim(mysql_prep($_POST['quantity']));
    $date = trim(mysql_prep($_POST['date']));
    if (empty($errors)) {
        $new_req = new Request();
        $new_req->cuz_id = $cuz_id;
        $new_req->fer_type = $fer_type;
        $new_req->name = $name;
        $new_req->quantity = $quantity;
        $new_req->date = $date;
        $rslt = $new_req->create();
        if ($rslt) {
            echo "<div class=\"container\">\n\t\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t\t<div class=\"col-md-7\">\n\t\t\t\t\t\t\t\t<div class=\"panel panel-default\">\n\t\t\t\t\t\t\t\t\t<div class=\"panel-body\">\n\t\t\t\t\t\t\t\t\t\t<h4>Your request has been successfully sent<h4><br>\n\t\t\t\t\t\t\t\t\t\t<h4>Thank You!<h4><br>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t";
        } else {
            echo "<div class=\"container\">\n\t\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t\t<div class=\"col-md-7\">\n\t\t\t\t\t\t\t\t<div class=\"panel panel-default\">\n\t\t\t\t\t\t\t\t\t<div class=\"panel-body\">\n\t\t\t\t\t\t\t\t\t\t<h4>Error!<h4><br>\n\t\t\t\t\t\t\t\t\t\t<h4>Your request has not been sent<h4><br>\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t";
        }
    } else {
        echo "<div class=\"container\">\n\t\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t\t<div class=\"col-md-7\">\n\t\t\t\t\t\t\t\t<div class=\"panel panel-default\">\n\t\t\t\t\t\t\t\t\t<div class=\"panel-body\">\n\t\t\t\t\t\t\t\t\t\t<h4>Error!<h4><br>\n\t\t\t\t\t\t\t\t\t\t<h4>Your request has not been sent<h4>.<br>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t";
    }
} else {
    $cuz_id = "";
    $fer_type = "";
    $name = "";
    $quantity = "";
    $date = "";
    $form = <<<EOT
 protected function handleRequest(\React\Http\Request $request, \React\Http\Response $response)
 {
     $request_headers = $request->getHeaders();
     $requestUri = $this->getRequestUri($request_headers, $request->getPath());
     $laravel_request = \Request::create($this->getRequestUri($request_headers, $request->getPath()), $request->getMethod(), array_merge($request->getQuery(), $this->post_params), $this->getCookies($request_headers), [], [], $this->request_body);
     $laravel_request->headers->add($request_headers);
     $laravel_response = \App::handle($laravel_request);
     $headers = array_merge($laravel_response->headers->allPreserveCase(), $this->buildCookies($laravel_response->headers->getCookies()));
     $response->writeHead($laravel_response->getStatusCode(), $headers);
     $response->end($laravel_response->getContent());
     echo $requestUri . "\n";
 }
Example #26
0
<?php

/*	Client script used by members_area.php.
*----------------------------------------------------------------------------
*	Original Author: Joshua Thompson
*	Creation Date: 11/16/2015
*
*	Modification Author: Joshua Thompson
*	Modification Date: 11/30/2015
*----------------------------------------------------------------------------
*/
// Required for the internal classes we use to retrieve data.
require_once 'scripts/classes.php';
// Determine if we're trying to submit a new request to the database.
if ((isset($_POST['request']) || isset($_GET['request'])) && isset($_POST['submit'])) {
    // Try to create the request, returning the approval code.
    if (!($app_code = Request::create($_SESSION['id'], $_POST['workType'], $_POST['experience'], $_POST['education'], $_POST['salary'], $_POST['zip'], $_POST['distance'], $_POST['candidates']))) {
        $message = "Error processing request. Please try again.";
    } else {
        $message = "The request has been submitted.<br />A contract manager will verify the request within 24 hours.<div id='approval_code' name='approval_code'>Confirmation Code: " . $app_code . "</div>";
    }
} elseif (isset($_POST['approval_code']) && isset($_POST['search'])) {
    if (!($request = Request::getRequest($_POST['approval_code'], $_SESSION['access']))) {
        $message = "No search results found.";
    }
}
Example #27
0
 /**
  * @dataProvider invalidEntityActionPairs
  * @expectedException \API_Exception
  * @param $inEntity
  * @param $inAction
  * @param $inVersion
  * @throws \API_Exception
  */
 public function testCreateRequest_InvalidEntityAction($inEntity, $inAction, $inVersion)
 {
     Request::create($inEntity, $inAction, array('version' => $inVersion), NULL);
 }
Example #28
0
 /**
  * Creates instance of App class and initialize the application
  *
  * @param array $params initialization parameters
  * @return void
  * @static
  */
 public static function create(array $params = null)
 {
     self::$app_mode = self::MODE_DEVELOPMENT;
     if (is_null(self::$instance)) {
         self::$instance = new self();
     }
     // setting up autoloader
     spl_autoload_register(array('App', 'autoload'));
     try {
         // setup config
         Config::create(isset($params['config']) ? $params['config'] : null);
         Config::setVar($params);
         // application mode
         self::setMode(Config::getVar('mode', self::MODE_DEVELOPMENT));
         // our error handler
         if (!self::isDevMode()) {
             set_error_handler(array('App', 'handleErrors'));
         }
         // language specific params
         if (function_exists('mb_internal_encoding')) {
             mb_internal_encoding(Config::getVar('app_encoding', 'UTF-8'));
         }
         if (function_exists('date_default_timezone_set')) {
             date_default_timezone_set(Config::getVar('app_timezone', 'UTC'));
         }
         setlocale(LC_CTYPE, Config::getVar('app_locale', 'en_US.UTF-8'));
         // creating base objects
         Log::create();
         Request::create();
         // saving application params
         self::$params = $params;
         // unregister globals
         if (ini_get('register_globals')) {
             self::unregisterGlobals(array('_POST', '_GET', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES'));
             ini_set('register_globals', false);
         }
     } catch (Exception $e) {
         self::$instance->handleDefaultException($e);
     }
 }
 protected function seedWithRequest($http_type, $uri, array $params)
 {
     $request = Request::create($uri, $http_type, $params);
     // Replace the input with your request instance input
     Request::replace($request->input());
     Route::dispatch($request)->getContent();
 }
Example #30
0
/*
 * A J A X    -    C A L L S
 */
Route::post('/book/ajax/isbn', ['as' => 'book.ajax.isbn', 'uses' => 'BooksController@ajaxSearchISBN']);
Route::post('/book/ajax/showSubCategory', ['as' => 'book.ajax.categories', 'uses' => 'BooksController@ajaxGetSubCategory']);
Route::post('/book/ajax/create4category', ['as' => 'book.ajax.4category', 'uses' => 'BooksController@ajaxCreate4category']);
Route::post('/book/ajax/ShowBookCode', ['as' => 'book.ajax.bookcode', 'uses' => 'BooksController@ajaxGetBookCode']);
Route::post('/book/ajax/addNewAuthor', ['as' => 'book.ajax.addAuthor', 'uses' => 'BooksController@ajaxAddNewAuthor']);
Route::post('/book/ajax/addNewEditor', ['as' => 'book.ajax.addEditor', 'uses' => 'BooksController@ajaxAddNewEditor']);
Route::get('/book/categories/recursion/{cat_id}', 'BooksController@getCategoriesByRecursion');
Route::get('users', ['uses' => 'Admin\\UserController@index']);
Route::get('date', function () {
    return Auth::user()->myAdministratorHash();
});
Route::get('broadcast', function () {
    $request = Request::create('/', 'GET', ['first_name' => 'test', 'last_name' => 'test', 'username' => 'test', 'email' => '*****@*****.**', 'password' => bcrypt('1453'), 'role_id' => 1, 'org_id' => 1]);
    DB::beginTransaction();
    $user = \App\User::create($request->all());
    $collection = $user->with('role')->where('id', $user->id)->get();
    event(new UserHasRegistered($collection));
    //    event(new UserHasRegistered($user));
    return 'done';
});
//Route::get('temp', function(){ return view('admin.users.temp');});
//Route::get('broadcast2', function(){
////    event(new BookHasCreated('This is the new notification', time(), 'http://www.google.gr', Auth::user()->hash));
//    event(new BookHasCreated(
//        'Δημιουργία βιβλίου',
//        Carbon::now()->format('d-m-Y'),
//        'http://library.gr/cPanel/products/6988045D0D/edit',
//        Auth::user()->myAdministratorHash()