public static function toString($value)
 {
     checkArgument(is_int($value), 'value must be a integer');
     if (array_key_exists($value, self::$_values)) {
         return self::$_values[$value];
     }
     return 'UNKNOWN';
 }
Пример #2
0
	.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']);
        switch ($_GET['action']) {
            case 'set':
                $disp = $note->setNote($bdd);
                break;
            case 'get':
                $disp = $note->getNote($bdd);
                break;
            case 'getLast':
                $disp = $note->getLast($bdd);
                break;
            case 'getAll':
                $disp = $note->getAll($bdd);
Пример #3
0
<?php

header('Content-Type: application/json; charset=utf-8');
/*
	---- VALUE ----
	.Get name
	.Get id
	.Get action
		Set :			Get :			GetLast :	GetAll :
		.Get note 		.Get matiere 	nil 		nil
		.Get date
		.Get matiere
*/
include 'co_Bdd.php';
try {
    if (checkArgument() && checkUser($_GET['name'], $_GET['id'], $bdd)) {
        switch ($_GET['action']) {
            case 'set':
                $disp = setNote($bdd);
                break;
            case 'get':
                $disp = getNote($bdd);
                break;
            case 'getLast':
                $disp = getLast($bdd);
                break;
            case 'getAll':
                $disp = getAll($bdd);
                break;
            default:
                throw new Exception('ActionNotFound', 04);
Пример #4
0
 /**
  * Seek past the current field
  * TODO Rewrite this to be safer
  */
 public static function skip_field($fp, $wire_type, &$limit = PHP_INT_MAX)
 {
     checkArgument(get_resource_type($fp) === 'stream', 'fp must be a file resource');
     checkArgument(is_int($wire_type), 'wire_type must be a integer');
     switch ($wire_type) {
         case 0:
             // varint
             $tmp = self::skip_varint($fp, $limit);
             if ($tmp === false) {
                 throw new \Exception('Protobuf::skip_varint returned false');
             }
         case 1:
             // 64bit
             if (fseek($fp, 8, SEEK_CUR) === -1) {
                 throw new Exception('skip(' . self::get_wiretype(1) . '): Error seeking');
             }
             $limit -= 8;
         case 2:
             // length delimited
             $len = self::read_varint($fp, $limit);
             if ($len === false) {
                 throw new \Exception('Protobuf::read_varint returned false');
             }
             if (fseek($fp, $len, SEEK_CUR) === -1) {
                 throw new Exception('skip(' . self::get_wiretype(2) . '): Error seeking');
             }
             $limit -= $len;
             //case 3: // Start group TODO we must keep looping until we find the closing end grou
             //case 4: // End group - We should never skip a end group!
             //	return 0; // Do nothing
         //case 3: // Start group TODO we must keep looping until we find the closing end grou
         //case 4: // End group - We should never skip a end group!
         //	return 0; // Do nothing
         case 5:
             // 32bit
             if (fseek($fp, 4, SEEK_CUR) === -1) {
                 throw new Exception('skip(' . self::get_wiretype(5) . '): Error seeking');
             }
             $limit -= 4;
         default:
             throw new Exception('skip(' . self::get_wiretype($wire_type) . '): Unsupported wire_type');
     }
 }