Skip to content

Commit

Permalink
Debug barre recherche
Browse files Browse the repository at this point in the history
  • Loading branch information
NailaMelhem committed Apr 20, 2015
1 parent 6472e18 commit 8a49d94
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
17 changes: 10 additions & 7 deletions Application/Controllers/Recherche.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,23 @@ public function getAutoCompletion($params) {

public function getRecherche($params) {
unset($params['method']);
$mot=$params['recherche'];
var_dump("params recu",$params);
$mot = $params['recherche'];
$ou = $params['ou'];

var_dump($mot, $ou);

/*if(!$this->verifierChaine($chaine) ){
if(!$this->verifierChaine($mot) ){
//caracteres non permis
return $this->setApiResult( [] );
//return $this->setApiResult( [] );
}

$ou=$this->echapper($ou);*/

//$ou=$this->echapper($ou);
//echo "<br> ou apres echappe=".$ou."<br>";
$modelViewRecette = new \Application\Models\ViewRecette();
$res=$modelViewRecette->fetchAllLike($mot, $ou, " ORDER BY $ou ");

var_dump("viewrecettes",$res);

if( !empty( $res ) ) {
return $this->setApiResult( $res);
Expand All @@ -79,9 +82,9 @@ public function getRecherche($params) {


public function verifierChaine($chaine) {
/*if ($chaine==="." || $chaine===".." || $chaine==="..." ) {
if ($chaine==="." || $chaine===".." || $chaine==="..." ) {
return false;
}*/
}
return true;
}

Expand Down
4 changes: 2 additions & 2 deletions Library/Core/RestServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ public function __destruct(){ //envoi
<div
style='background-color:black;
color:green;
width:400px;
height:400px;
width:800px;
height:600px;
overflow:auto;
'>
@@@>>><br />
Expand Down
3 changes: 2 additions & 1 deletion Library/Model/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ public function fetchAll($where=1, $fields="*") {
}

public function fetchAllLike($recherche, $champ, $conf ="1", $fields="*") {
$req="SELECT $fields FROM `{$this->table}` WHERE ($champ LIKE :recherche) $conf ";

$req="SELECT $fields FROM `{$this->table}` WHERE ($champ LIKE :recherche ) $conf ";
echo $req;
$sql = $this->database->prepare($req);

Expand Down

0 comments on commit 8a49d94

Please sign in to comment.