コード例 #1
0
ファイル: accueil.php プロジェクト: Harmeko/tweet_academie
<?php

require_once '../autoload.php';
require_once '../include/results.php';
//rajouter order bye et condition si reply ou origine et recuper donner(function dans class)
$tweet = new Tweet($user_id);
// $tweet->getIdTweet();
/*var_dump($p = new Tweet($user_id, 2));
var_dump($p->getIdTweet());*/
// var_dump($p = new Tweet($user_id));
// var_dump($p->Tweet_follower($user_id));
if (isset($_FILES['file-input']) && !empty($_FILES['file-input']['name'])) {
    $uploaddir = '../view/img-user/tweet/';
    $validator = new Validator($_POST);
    $validator->isSize('file-input', 'You picture is too oversized');
    $validator->isExtension('file-input', 'You must upload a type of picture with png, gif, jpg, jpeg, please.');
    $uploadfile = basename($_FILES['file-input']['name']);
    $uploadfile = strtr($uploadfile, 'ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðòóôõöùúûüýÿ', 'AAAAAACEEEEIIIIOOOOOUUUUYaaaaaaceeeeiiiioooooouuuuyy');
    $img_tweet = $uploaddir . $uploadfile;
    if ($validator->isValid()) {
        move_uploaded_file($_FILES['file-input']['tmp_name'], $img_tweet);
        $tweet->newTweet($img_tweet);
        /*$info_user->avatar = $avatar;*/
    } else {
        $errors = $validator->getErrors();
    }
} else {
    $tweet->newTweet();
}
require_once '../view/accueil.php';