public function __construct($params)
 {
     $_GET = $params->slim->request()->params();
     $this->slim = $params->slim;
     $this->odaOffset = $params->slim->request->params('odaOffset');
     if (is_null($this->odaOffset)) {
         $this->odaOffset = 0;
     } else {
         $this->odaOffset = intval($this->odaOffset);
     }
     $this->odaLimit = $params->slim->request->params('odaLimit');
     if (is_null($this->odaLimit)) {
         $this->odaLimit = 9999;
     } else {
         $this->odaLimit = intval($this->odaLimit);
     }
     parent::__construct($params);
 }
<?php

namespace Oda;

require '../../../../../header.php';
require '../../../../../vendor/autoload.php';
require '../../../../../config/config.php';
use stdClass, Oda\SimpleObject\OdaPrepareInterface, Oda\SimpleObject\OdaPrepareReqSql, Oda\OdaLibBd;
//--------------------------------------------------------------------------
//Build the interface
$params = new SimpleObject\OdaPrepareInterface();
$ODA_INTERFACE = new OdaLibInterface($params);
//--------------------------------------------------------------------------
// vendor/happykiller/oda/resources/api/getMetricsInterface.php?milis=123450&ctrl=ok
//--------------------------------------------------------------------------
$params = new SimpleObject\OdaPrepareReqSql();
$params->sql = "SELECT REPLACE(`type`,SUBSTRING_INDEX(`type`, '/', 4), '') as 'interface' \n    ,COUNT(`id`) as 'nb'\n    ,COUNT(`id`) *  AVG(TIMEDIFF(`fin`,`debut`)) as 'cost'\n    ,AVG(TIMEDIFF(`fin`,`debut`)) as 'average'\n    ,MAX(TIMEDIFF(`fin`,`debut`)) as 'maxTime'\n    ,MIN(TIMEDIFF(`fin`,`debut`)) as 'minTime'\n    FROM  `api_tab_transaction` \n    WHERE 1=1\n    AND `fin` != '0000-00-00 00:00:00'\n    AND `fin` > NOW() - INTERVAL 7 DAY\n    GROUP BY `type`\n;";
$params->typeSQL = OdaLibBd::SQL_GET_ALL;
$retour = $ODA_INTERFACE->BD_ENGINE->reqODASQL($params);
//---------------------------------------------------------------------------
$params = new \stdClass();
$params->label = "metrics";
$params->retourSql = $retour;
$ODA_INTERFACE->addDataReqSQL($params);
Example #3
0
<?php

namespace Oda;

require '../../../../../header.php';
require '../../../../../vendor/autoload.php';
require '../../../../../config/config.php';
use stdClass, Oda\SimpleObject\OdaPrepareInterface, Oda\SimpleObject\OdaPrepareReqSql, Oda\OdaLibBd;
//--------------------------------------------------------------------------
//Build the interface
$params = new SimpleObject\OdaPrepareInterface();
$params->arrayInput = array("type", "msg");
$ODA_INTERFACE = new OdaLibInterface($params);
//--------------------------------------------------------------------------
// vendor/happykiller/oda/resources/api/insertLog.php?milis=123450&type=0&msg=wtf
//--------------------------------------------------------------------------
$id = $ODA_INTERFACE->BD_ENGINE->logTrace($ODA_INTERFACE->inputs["type"], addslashes($ODA_INTERFACE->inputs["msg"]));
//---------------------------------------------------------------------------
$params = new \stdClass();
$params->label = "resultatInsert";
$params->value = $id;
$ODA_INTERFACE->addDataStr($params);
Example #4
0
<?php

namespace Oda;

require '../../../../../header.php';
require '../../../../../vendor/autoload.php';
require '../../../../../config/config.php';
use stdClass, Oda\SimpleObject\OdaPrepareInterface, Oda\SimpleObject\OdaPrepareReqSql, Oda\OdaLibBd;
//--------------------------------------------------------------------------
//Build the interface
$params = new SimpleObject\OdaPrepareInterface();
$params->arrayInput = array("login", "mdp");
$ODA_INTERFACE = new OdaLibInterface($params);
//--------------------------------------------------------------------------
// vendor/happykiller/oda/resources/api/getAuth.php?milis=123450&login=VIS&mdp=VIS
//--------------------------------------------------------------------------
$params = new SimpleObject\OdaPrepareReqSql();
$params->sql = "select a.`id_rang`, a.`code_user`, a.`password`, a.`mail`\n    from `api_tab_utilisateurs` a\n    where 1=1\n    and a.`code_user` = :code_user\n;";
$params->bindsValue = ["code_user" => $ODA_INTERFACE->inputs["login"]];
$params->typeSQL = OdaLibBd::SQL_GET_ONE;
$retour = $ODA_INTERFACE->BD_ENGINE->reqODASQL($params);
if (!$retour->data) {
    $ODA_INTERFACE->dieInError('Auth impossible.(user unknown)', $ODA_INTERFACE::STATE_ERROR_AUTH);
} else {
    if (OdaLib::startsWith($ODA_INTERFACE->inputs["mdp"], "authByGoogle-")) {
        $mail = str_replace("authByGoogle-", "", $ODA_INTERFACE->inputs["mdp"]);
        if ($mail !== $retour->data->mail) {
            $ODA_INTERFACE->dieInError('Auth impossible.(mail incorrect)', $ODA_INTERFACE::STATE_ERROR_AUTH);
        }
    }
}
<?php

namespace Oda;

require '../../../../../header.php';
require '../../../../../vendor/autoload.php';
require '../../../../../config/config.php';
use stdClass, Oda\SimpleObject\OdaPrepareInterface, Oda\SimpleObject\OdaPrepareReqSql, Oda\OdaLibBd;
//--------------------------------------------------------------------------
//Build the interface
$params = new SimpleObject\OdaPrepareInterface();
$params->arrayInput = array("key");
$ODA_INTERFACE = new OdaLibInterface($params);
//--------------------------------------------------------------------------
// vendor/happykiller/oda/resources/api/deleteSession.php?key=e6fff655cb3121c08a8219497ba9358e
//--------------------------------------------------------------------------
$retour = $ODA_INTERFACE->deleteSession($ODA_INTERFACE->inputs["key"]);
//--------------------------------------------------------------------------
$params = new \stdClass();
$params->value = $retour;
$ODA_INTERFACE->addDataStr($params);
$TRANS_MSG_PATH_UNDEFINED = "Upload impossible, path resource undefined.";
$TRANS_MSG_PATH_NOT_EXIST = "Upload impossible, path resource not exist.";
$TRANS_MSG_WRONG_EXT = "Wrong extension file supported.";
$TRANS_MSG_FILE_SIZE = "File too big.";
$TRANS_MSG_FILE_EXIST = "File already exist.";
$TRANS_MSG_ERROR_UNKNOWN = "Error unknown.";
$extensions = array('.jpg', '.png', '.txt', '.doc', '.docx', '.xls', '.xlsx', '.msg', '.pdf');
$fileMax = 5000000;
//5Mo
$config = SimpleObject\OdaConfig::getInstance();
//--------------------------------------------------------------------------
$resources = str_replace("vendor" . DIRECTORY_SEPARATOR . "happykiller" . DIRECTORY_SEPARATOR . "oda" . DIRECTORY_SEPARATOR . "resources" . DIRECTORY_SEPARATOR . "script", $config->resourcesPath, __DIR__);
//--------------------------------------------------------------------------
//Build the interface
$params = new OdaPrepareInterface();
$ODA_INTERFACE = new OdaLibInterface($params);
$folderDest = isset($_GET["path"]) ? $_GET["path"] : "";
$rewhrite = isset($_GET["rewhrite"]) ? filter_var($_GET["rewhrite"], FILTER_VALIDATE_BOOLEAN) : true;
$path = $resources . $folderDest;
if (is_null($config->resourcesPath)) {
    $ODA_INTERFACE->dieInError($TRANS_MSG_PATH_UNDEFINED);
}
if (!file_exists($path)) {
    $ODA_INTERFACE->dieInError($TRANS_MSG_PATH_NOT_EXIST);
} else {
    foreach ($_FILES as $key => $value) {
        $extension = strrchr($value['name'], '.');
        $extension = strtolower($extension);
        $taille = filesize($value['tmp_name']);
        $msg = new stdClass();
        $msg->fileNameIn = $value["name"];
Example #7
0
<?php

namespace Oda;

require '../../../../../header.php';
require '../../../../../vendor/autoload.php';
require '../../../../../config/config.php';
use stdClass, Oda\SimpleObject\OdaPrepareInterface, Oda\SimpleObject\OdaPrepareReqSql, Oda\OdaLibBd;
//--------------------------------------------------------------------------
//Build the interface
$params = new SimpleObject\OdaPrepareInterface();
$params->arrayInput = array("param_name");
$ODA_INTERFACE = new OdaLibInterface($params);
//--------------------------------------------------------------------------
// vendor/happykiller/oda/resources/api/getParam.php?milis=123450&param_name=nom_site
//--------------------------------------------------------------------------
$params = new \stdClass();
$params->nameObj = "api_tab_parametres";
$params->keyObj = ["param_name" => $ODA_INTERFACE->inputs["param_name"]];
$retour = $ODA_INTERFACE->BD_ENGINE->getSingleObject($params);
//---------------------------------------------------------------------------
$params = new \stdClass();
$params->label = "leParametre";
$params->value = $retour;
$ODA_INTERFACE->addDataObject($params);
<?php

namespace Oda;

require '../../../../../header.php';
require '../../../../../vendor/autoload.php';
require '../../../../../config/config.php';
use stdClass, Oda\SimpleObject\OdaPrepareInterface, Oda\SimpleObject\OdaPrepareReqSql, Oda\OdaLibBd;
//--------------------------------------------------------------------------
//Build the interface
$params = new SimpleObject\OdaPrepareInterface();
$params->arrayInput = array("code_user", "mdp", "champs", "value");
$ODA_INTERFACE = new OdaLibInterface($params);
//--------------------------------------------------------------------------
// vendor/happykiller/oda/resources/api/setChangeProfile.php?milis=123450&code_user=VIS&mdp=VIS&champs=prenom&value=kikoo
//--------------------------------------------------------------------------
$params = new \stdClass();
$params->nameObj = "api_tab_utilisateurs";
$params->keyObj = ["code_user" => $ODA_INTERFACE->inputs["code_user"]];
$retour = $ODA_INTERFACE->BD_ENGINE->getSingleObject($params);
if (!password_verify($ODA_INTERFACE->inputs["mdp"], $retour->password)) {
    $ODA_INTERFACE->dieInError('Mot de passe éronné.');
} else {
    $params = new \stdClass();
    $params->nameObj = "api_tab_utilisateurs";
    $params->keyObj = ["code_user" => $ODA_INTERFACE->inputs["code_user"]];
    $params->setObj = [$ODA_INTERFACE->inputs["champs"] => $ODA_INTERFACE->inputs["value"]];
    $retour = $ODA_INTERFACE->BD_ENGINE->setSingleObj($params);
    $params = new \stdClass();
    $params->label = "resultat";
    $params->value = $retour;
<?php

namespace Oda;

require '../../../../../header.php';
require '../../../../../vendor/autoload.php';
require '../../../../../config/config.php';
use stdClass, Oda\SimpleObject\OdaPrepareInterface, Oda\SimpleObject\OdaPrepareReqSql, Oda\OdaLibBd;
//--------------------------------------------------------------------------
//Build the interface
$params = new SimpleObject\OdaPrepareInterface();
$params->arrayInput = array("code_user");
$ODA_INTERFACE = new OdaLibInterface($params);
//--------------------------------------------------------------------------
// vendor/happykiller/oda/resources/api/getListTheme.php?milis=123450&code_user=VIS
//--------------------------------------------------------------------------
$theme_defaut = $ODA_INTERFACE->getParameter("theme_defaut");
$params = new \stdClass();
$params->label = "theme";
if (is_null($theme_defaut)) {
    $params->value = "notAvailable";
} else {
    $params->value = $theme_defaut;
}
$ODA_INTERFACE->addDataStr($params);
//--------------------------------------------------------------------------
$params = new \stdClass();
$params->nameObj = "api_tab_utilisateurs";
$params->keyObj = ["code_user" => $ODA_INTERFACE->inputs["code_user"]];
$params->debug = false;
$retour = $ODA_INTERFACE->BD_ENGINE->getSingleObject($params);
Example #10
0
<?php

namespace Ring;

require '../header.php';
require '../vendor/autoload.php';
require '../config/config.php';
use Oda\OdaLibInterface;
use stdClass, Oda\SimpleObject\OdaPrepareInterface, Oda\SimpleObject\OdaPrepareReqSql, Oda\OdaLibBd;
//--------------------------------------------------------------------------
//Build the interface
$params = new OdaPrepareInterface();
$params->arrayInput = array("param_name");
$INTERFACE = new OdaLibInterface($params);
//--------------------------------------------------------------------------
// api/exemple.php?milis=123450&ctrl=ok&param_name=nom_site
//--------------------------------------------------------------------------
//EXEMPLE SELECT 1 ROW
$params = new OdaPrepareReqSql();
$params->sql = "SELECT *\n    FROM `api_tab_parametres` a\n    WHERE 1=1\n    AND a.`param_name` = :param_name\n;";
$params->bindsValue = ["param_name" => $INTERFACE->inputs["param_name"]];
$params->typeSQL = OdaLibBd::SQL_GET_ONE;
$retour = $INTERFACE->BD_ENGINE->reqODASQL($params);
$params = new stdClass();
$params->label = "resultat_get_one";
$params->retourSql = $retour;
$INTERFACE->addDataReqSQL($params);
//--------------------------------------------------------------------------
//EXEMPLE SELECT N ROWS
$params = new OdaPrepareReqSql();
$params->sql = "SELECT *\n    FROM `api_tab_parametres` a\n    WHERE 1=1\n;";
<?php

namespace Oda;

require '../../../../../header.php';
require '../../../../../vendor/autoload.php';
require '../../../../../config/config.php';
use stdClass, Oda\SimpleObject\OdaPrepareInterface, Oda\SimpleObject\OdaPrepareReqSql, Oda\OdaLibBd;
//--------------------------------------------------------------------------
//Build the interface
$params = new SimpleObject\OdaPrepareInterface();
$params->arrayInput = array("code_user", "key");
$ODA_INTERFACE = new OdaLibInterface($params);
//--------------------------------------------------------------------------
// vendor/happykiller/oda/resources/api/checkSession.php?milis=123450&code_user=FRO&key=e6fff655cb3121c08a8219497ba9358e
//--------------------------------------------------------------------------
$retour = $ODA_INTERFACE->checkSession($ODA_INTERFACE->inputs);
//--------------------------------------------------------------------------
$params = new \stdClass();
$params->value = $retour;
$ODA_INTERFACE->addDataStr($params);