Example #1
0
 protected function execute()
 {
     try {
         $this->response = $this->request->execute()->response();
         return $this->response->status == 200 ? true : false;
     } catch (\RequestException $e) {
         throw new SupplierException($e->getMessage(), $e->getCode(), $e);
     }
 }
 public static function supprimer($classe, $condition = null)
 {
     $request = new Request('delete', $classe);
     if ($condition != null) {
         $request->setConditions($condition);
     }
     return $request->execute($classe);
 }
Example #3
0
 public function execute()
 {
     parent::execute();
     $this->parsedResult = $this->parseResult($this->result);
     if ($this->parsedResult == 'WRONG_CUSTOMERID') {
         $this->executeWorkaround();
     }
     return $this->result;
 }
Example #4
0
 /**
  * Tests the Client does not attempt to load cache if no Cache library
  * is present
  *
  * @return void
  */
 public function test_cache_not_called_with_no_cache()
 {
     $request = new Request('welcome/index');
     $response = new Response();
     $client_mock = $this->getMock('Request_Client_Internal');
     $request->client($client_mock);
     $client_mock->expects($this->exactly(0))->method('execute_request');
     $client_mock->expects($this->once())->method('execute')->will($this->returnValue($response));
     $this->assertSame($response, $request->execute());
 }
Example #5
0
 /**
  * Route::matches() should return false if the route doesn't match against a uri
  *
  * @test
  */
 function testCreate()
 {
     $request = Request::factory('foo/bar')->execute();
     $this->assertEquals(200, $request->status);
     $this->assertEquals('foo', $request->response);
     try {
         $request = new Request('bar/foo');
         $request->execute();
     } catch (Exception $e) {
         $this->assertEquals(TRUE, $e instanceof ReflectionException);
         $this->assertEquals('404', $request->status);
     }
 }
Example #6
0
 /**
  * Execute the request and return the response as associative
  * array.
  *
  * @param Request $request
  * @return array
  */
 public static function call(Request $request)
 {
     try {
         $response = $request->execute();
     } catch (ApiException $e) {
         self::$log->error($e);
         $response = $e->asResponseArray();
     } catch (Exception $e) {
         self::$log->error($e);
         $apiException = new InternalServerErrorException($e);
         $response = $apiException->asResponseArray();
     }
     return $response;
 }
This is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

this software is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this software. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
require_once "../config/config_base.php";
require_once CONFIG_DIR . "/config_db.php";
require_once INC_DIR . "/autoload.function.php";
$p = new Webpage("Gestion des Types de Billets");
$p->appendCssUrl("../css/index.css");
$p->appendJsUrl("../lib/jquery.min.js");
$content = "";
if (isset($_GET['id']) && $_GET['id'] != null) {
    $request = new Request('SELECT', 'Utilisateur');
    $request->setparams("id_user ,firstName, lastName");
    $request->setConditions("id_user = "******"<p>" . $joueur['firstName'] . " " . $joueur['lastName'] . "</p>";
    }
}
$p->appendContent($content);
echo $p->toHTML();
Example #8
0
 /**
  * @covers Request::execute
  * @todo   Implement testExecute().
  */
 public function testExecute()
 {
     $this->object->execute();
     $this->assertEquals('Trixie', $this->pixie->cookie->get('fairy_cookie'));
 }
Example #9
0
 <?php 
require 'config.php';
require 'clases/Request.php';
require 'clases/Inflector.php';
require 'clases/Response.php';
require 'clases/View.php';
if (empty($_GET['url'])) {
    $url = "";
} else {
    $url = $_GET['url'];
}
$request = new Request($url);
//exit($request->getControllerFileName());
exit($request->execute());
Example #10
0
You should have received a copy of the GNU General Public License
along with this software. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
require_once "../config/config_base.php";
require_once CONFIG_DIR . "/config_db.php";
require_once INC_DIR . "/autoload.function.php";
$content = "Update effectuƩe";
if (isset($_GET['classe']) && $_GET['classe'] != null && isset($_GET['id']) && $_GET['id'] != null && isset($_GET['data']) && $_GET['data'] != null) {
    $request = new Request('SELECT', $_GET['classe']);
    $request->setparams('*');
    $id = 0;
    foreach ($request->execute() as $value) {
        foreach ($value as $key => $useless) {
            if (substr($key, 0, 3) == "id_") {
                $id = $key;
            }
        }
    }
    $data = json_decode($_GET['data']);
    $request = new Request('UPDATE', $_GET['classe']);
    $request->setparams($data);
    $request->setConditions($id . " = " . $_GET['id']);
    foreach ($request->execute() as $truc) {
        var_dump($truc);
    }
} else {
    $content = "Erreur lors de l'update";
}
echo $content;
Example #11
0
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this software. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
require_once "../config/config_base.php";
require_once CONFIG_DIR . "/config_db.php";
header("Content-Type: text/html; charset=UTF-8");
$content = '<div><form>';
$empty = true;
$count = 0;
$request = new Request('SELECT', 'TypeBillet');
$request->setparams("id_typeBillet, libTypeBillet");
foreach ($request->execute() as $billet) {
    $content .= <<<HTML
            <input type="checkbox" id="cb{$count}" value="{$billet['id_typeBillet']}">
             <label for="cb{$count}">{$billet['libTypeBillet']}</label>
HTML;
    $count++;
}
$content .= '</form></div>';
$content .= <<<HTML
    <button id="ajouter">Ajouter</button>
    <script type="text/javascript">
        \$("#ajouter").click(function(){
            \$("#champ").load("../ajax/modifierBillet.php");
            \$('#saveDiv').html("<button id='add'>Sauvegarder</button>");
        });
Example #12
0
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this software. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
require_once "../config/config_base.php";
require_once CONFIG_DIR . "/config_db.php";
header("Content-Type: text/html; charset=UTF-8");
$content = '<div><form>';
$empty = true;
$count = 0;
$request = new Request('SELECT', 'Tournoi');
$request->setparams("id_tournoi, nom");
foreach ($request->execute() as $tournoi) {
    $content .= <<<HTML
            <input type="checkbox" id="cb{$count}" value="{$tournoi['id_tournoi']}">
             <label for="cb{$count}">{$tournoi['nom']}</label>
HTML;
    $count++;
}
$content .= '</form></div>';
$content .= <<<HTML
    <button id="ajouter">Ajouter</button>
    <script type="text/javascript">
        \$("#ajouter").click(function(){
            \$("#champ").load("../ajax/modifierTournoi.php");
        });
    </script>
    
Example #13
0
 public function auth($channels, $private = 0, $expire_time = 180000, &$response = array())
 {
     // post permissions
     $fields = array('AK' => $this->ortc_data['app_key'], 'PK' => $this->ortc_data['priv_key'], 'AT' => $this->ortc_data['token'], 'PVT' => $private, 'TTL' => $expire_time, 'TP' => count($channels));
     /*Array(Array('name'=>'r'))*/
     foreach ($channels as $channel => $perms) {
         $fields[$channel] = $perms;
     }
     $url = $this->_get_server();
     if (!$url) {
         return false;
     }
     // no server available
     $auth_path = '/authenticate';
     $content = Request::execute('POST', $url . $auth_path, $fields, $referer = '', 15, 'CURL library');
     // /auth or /authenticate depends on the server version
     $response = $content;
     return $content['errcode'] == 0;
 }
Example #14
0
 /**
  * Execute a PayPal v1 API request
  * @param Request $request HTTP request to execute
  * @throws PayPal_Exception_InvalidResponse
  * @return mixed
  */
 protected function call(Request $request)
 {
     $response = $request->execute();
     if (!$response->isSuccess()) {
         self::debug("Error in PayPal call", $response);
         throw new PayPal_Exception_InvalidResponse("Error " . $response->status() . " in PayPal call (" . $response->body() . ")");
     }
     $res = json_decode($response->body());
     if (isset($res->error)) {
         self::error("Error in PayPal call: " . print_r($res, true));
         throw new PayPal_Exception_InvalidResponse('PayPal: ' . $res->error_description . ' [' . $res->error . '] while calling ' . $request->uri());
     }
     return $res;
 }
Example #15
0
 /**
  * Tests that an initial request won't use an external client
  * 
  * @expectedException HTTP_Exception_404
  *
  * @return null
  */
 public function test_initial_request_only_loads_internal()
 {
     $this->setEnvironment(array('Kohana::$is_cli' => FALSE, 'Request::$initial' => NULL));
     $request = new Request('http://www.google.com/');
     $request->execute();
 }
Example #16
0
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this software. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
require_once "../config/config_base.php";
require_once CONFIG_DIR . "/config_db.php";
header("Content-Type: text/html; charset=UTF-8");
$content = '<div><form>';
$empty = true;
$count = 0;
$request = new Request('SELECT', 'Creneau');
$request->setparams("*");
foreach ($request->execute() as $creneau) {
    $content .= <<<HTML
            <input type="checkbox" id="cb{$count}" value="{$creneau['id_creneau']}">
             <label for="cb{$count}">{$creneau['day']}, {$creneau['hDeb']}</label>
HTML;
    $count++;
}
$content .= '</form></div>';
$content .= <<<HTML
    <button id="ajouter">Ajouter</button>
    <script type="text/javascript">
        \$("#ajouter").click(function(){
            \$("#champ").load("../ajax/modifierCreneau.php");
        });
    </script>
    
Example #17
0
 public function execute(array $options = NULL)
 {
     return Response::forge(parent::execute($options));
 }
Example #18
0
 /**
  * Sign and execute the request
  *
  * @return Response
  */
 public function execute()
 {
     // Timestamp for avoiding identical signatures
     $this->query('ts', (string) time());
     if ($this->hapi_profile_settings === NULL) {
         $this->load_config();
     }
     // Add signature to the request
     $signature = HAPI_Security::calculate_hmac($this, $this->hapi_profile_settings['private_key']);
     $this->headers('X-Auth', $this->hapi_profile_settings['public_key']);
     $this->headers('X-Auth-Hash', $signature);
     // Add Authorization header if not present
     if (!array_key_exists('Authorization', $this->headers()) && Auth::instance()->logged_in()) {
         $this->headers('Authorization', $this->authorize(Auth::instance()->get_user()));
     }
     return parent::execute();
 }
Example #19
0
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this software. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
require_once "../config/config_base.php";
require_once CONFIG_DIR . "/config_db.php";
header("Content-Type: text/html; charset=UTF-8");
$content = '<div><form>';
$empty = true;
$count = 0;
$request = new Request('SELECT', 'Terrain');
$request->setparams("id_terrain, name", "id_typeTerrain");
foreach ($request->execute() as $terrain) {
    $content .= <<<HTML
            <input type="checkbox" id="cb{$count}" value="{$terrain['id_terrain']}">
             <label for="cb{$count}">{$terrain['name']}</label>
HTML;
    $count++;
}
$content .= '</form></div>';
$content .= <<<HTML
    <button id="ajouter">Ajouter</button>
    <script type="text/javascript">
        \$("#ajouter").click(function(){
            \$("#champ").load("../ajax/modifierTerrain.php");
        });
    </script>
    
Example #20
0
\t \$("#competition").change(function(){
                  \$("option").each(function(){
\t\t\tif (this.selected){
\t\t\t\$("#area").load('../ajax/areaMatchs.php?id='+this.value);
                  }
                });
            });
\t
  </script>
HTML;
if (isset($_GET['id']) && $_GET['id'] != null) {
    $request = new Request('SELECT', 'infs3_prj13.Match');
    $request->setparams("*");
    $request->setConditions("id_competition = " . $_GET['id']);
    $count = 0;
    foreach ($request->execute() as $match) {
        $content .= <<<HTML
            <input type="checkbox" id="cb{$count}" value="{$match['id_match']}">
             <label for="cb{$count}">( {$match['rang']} , {$match['ordre']} )</label>
HTML;
        $count++;
    }
}
$content .= <<<HTML
  </div>
    <button id="ajouter">Ajouter</button>
    <script type="text/javascript">
        \$("#ajouter").click(function(){
            \$("#champ").load("../ajax/modifierMatch.php");
        });
 /**
  * Executes a Request to get the next page for the current operation.
  *
  * @return Response
  *
  * @throws OperationResultException
  * @throws RequestException
  */
 public function fetchNextPage()
 {
     if (!$this->hasNextPage()) {
         return false;
     }
     /*
      * If there are less records left than the page size, we are at the
      * last page. Lower the page size to the records left just to be precise.
      */
     if (!is_null($this->recordsLeft) && $this->recordsLeft < $this->pageSize) {
         $this->pageSize = $this->recordsLeft;
     }
     // Lower page size even more if max will be reached at the next Request.
     if (!is_null($this->maxRecords) && $this->pageSize + $this->recordsFetched > $this->maxRecords) {
         $this->pageSize = $this->maxRecords - $this->recordsFetched;
     }
     $this->pageNumber++;
     $request = new Request($this->operation, $this->getRequestData());
     /** @var Response $response */
     $response = $request->execute();
     /** @var \SimpleXMLElement $result */
     $result = $response->retrieveResult($this->operationResult);
     // Proceed to update the references.
     $allRecords = $result->TotalNumResults;
     $recordsThisPage = $result->NumResults;
     $this->recordsFetched += $result->NumResults;
     $this->recordsLeft = is_null($this->recordsLeft) ? $allRecords - $recordsThisPage : $this->recordsLeft - $recordsThisPage;
     return $response;
 }
Example #22
0
<?php

/*
El frontend controller se encarga de 
configurar la aplicaciĆ³n
*/
require 'config.php';
//Library
require 'library/Request.php';
require 'library/Inflector.php';
require 'library/View.php';
define("DIR_RAIZ", Inflector::routeAdapter(__DIR__));
if (empty($_GET["url"])) {
    $url = "";
} else {
    $url = $_GET["url"];
}
$request = new Request($url);
$request->execute();
 /**
  * @covers Request::execute
  * @todo   Implement testExecute().
  */
 public function testExecute()
 {
     $this->object->execute();
 }
Example #24
0
<?php

/*
 	El frontend controler se encarga
 	de configurar nuestra aplicacion.
*/
require 'config.php';
require 'helpers.php';
//librerias
require 'library/Request.php';
require 'library/Inflector.php';
require 'library/Response.php';
require 'library/View.php';
if (empty($_GET['url'])) {
    $url = "";
} else {
    $url = $_GET['url'];
}
$recuest = new Request($url);
$recuest->execute();
Example #25
0
 protected function getDataList($where = [], $limit = NULL, $order = NULL, $offset = NULL, $count = FALSE)
 {
     $parameters = [];
     $sql = $this->getBaseSelect($count) . $this->getClauseByFields($where, $parameters, $limit, $order, $offset);
     $request = new Request($sql);
     return $request->execute($parameters);
 }