Example #1
0
});
$app->get('/getAllUser', function () {
    //renvoi toutes les infos de tous les utilisateurs
    $user = User::getAllUser();
});
$app->post('/AddUser', function () {
    //ajoute un utilisateur
    $user = User::AddUser($_POST["pseudo"], $_POST["email"], $_POST["password"], $_POST["birthdate"], $_POST["city"], $_POST["budget"]);
});
$app->get('/connexion/:pseudo/:password', function ($pseudo, $password) {
    User::connexion($pseudo, $password);
    //retourne userID si ok sinon retourne 0
});
$app->put('/modifUser', function () {
    //modifier utilisateur
    $user = User::UpdateUser($_POST["pseudo"], $_POST["email"], $_POST["password"], $_POST["birthdate"], $_POST["city"], $_POST["budget"], $_POST["id"]);
});
$app->delete('/delUser', function () {
    //modifier utilisateur
    $user = User::DeleteUser($_POST["id"]);
});
/*--------------------------------------------------
						FRIGO
--------------------------------------------------*/
$app->get('/getIngredientsFridge/:userId', function ($userId) {
    Frigo::getIngredientsFridge($userId);
    //renvoi tous les ingr├ędients du frigo de l'utilisateur
});
$app->get('/getIngredientsFridgeWithFiltre/:userId/:filtre/:donnee', function ($userId, $filtre, $donnee) {
    Frigo::getIngredientsFridgeWithFiltre($userId, $filtre, $donnee);
    //renvoi tous les ingr├ędients du frigo de l'utilisateur avec filtre
 public static function adminUpdateUser($id)
 {
     $data = Input::all();
     $rules = ['email' => ['required', 'email', 'max:128', 'unique:users,email,' . Auth::id()], 'username' => ['required', 'min:5', 'max:15', 'alpha_num', 'unique:users,username,' . Auth::id()]];
     $validator = Validator::make($data, $rules);
     if ($validator->fails()) {
         return Alert::formError($validator);
     } else {
         $user = new User();
         $update = User::UpdateUser($id, $data);
         return Alert::flash(Lang::get('admin.user-updated'), 'success');
     }
 }
Example #3
0
        } else {
            if ($img_type == 'image/png') {
                $img_type = '.png';
                $uploaddir = 'upload/consumer_avatar/';
                $apend = $id_for_img . $img_type;
                $uploadfile = "{$uploaddir}{$apend}";
                move_uploaded_file($_FILES['myfile']['tmp_name'], $uploadfile);
                $avatar_extension = $uploadfile;
            } else {
                echo 'Not supported type.';
            }
        }
    } else {
        $avatar_extension = $image;
    }
    $UpdateUser->UpdateUser($id, $id_group, $login, $password, $orgName, $email, $avatar_extension);
}
if ($status == 'del') {
    $deleteUser = new User();
    $ava_img = $deleteUser->DeleteUser($id);
    if ($ava_img) {
        unlink($ava_img);
    }
}
if ($status == 'delgr') {
    $deleteUser = new Group();
    $massage = $deleteUser->DeleteGroup($id);
}
if ($status == 'addgroup') {
    $addNewGroup = new Group();
    $massage = $addNewGroup->AddGroup($name);