Example #1
0
<?php

header('Content-Type: application/json');
use API\DataBase\User;
use API\DataBase\Note;
use API\Autoloader;
use API\Param\Config;
require 'Object/Autoloader.php';
Autoloader::register();
/*
	---- VALUE ----
	.Get name
	.Get id
	.Get action
		Set :			Get :			GetLast :	GetAll :
		.Get note 		.Get matiere 	nil 		nil
		.Get date
		.Get matiere
*/
try {
    $inst = Config::getInstance();
    $bdd = new PDO('mysql:host=' . $inst->get('db_host') . ';dbname=' . $inst->get('db_name') . '', $inst->get('db_user'), $inst->get('db_pass'));
} catch (\Exception $e) {
    die('Erreur : ' . $e->getMessage());
}
$bdd->query("SET NAMES 'UTF-8'");
try {
    if (checkArgument()) {
        $user = new User($_GET['id'], $_GET['name'], null, null, null);
        $user->checkIdUser($bdd);
        $note = new Note(null, $_GET['id'], $_GET['matiere'], $_GET['note'], $_GET['date']);
Example #2
0
                require_once $fullClassPath;
            }
        }
        if ($included) {
            /* Silently win */
            return true;
        } else {
            /* We might want to make this better */
            // die('Invalid filename ' . $class . '. Epic failure in Autoloader' . PHP_EOL);
            return false;
        }
    }
    /**
     * All PHP settings are interpretted here
     */
    protected function phpSettings()
    {
        date_default_timezone_set('GMT');
        if (Config::getConfig('debug') == 1) {
            error_reporting(-1);
        } else {
            ini_set("log_errors", Config::getConfig('LogErrors'));
            ini_set("error_log", Config::getConfig('LoggerDirectory') . '/' . Config::getConfig('ErrorLogFile') . date('Y-m-d'));
        }
    }
}
/**
 * Bootstrap
 */
Autoloader::build();
//Where all the things begin