Example #1
0
File: post.php Project: bsamel/bavn
<?php

session_start();
if (!isset($_SESSION['login'])) {
    header('location: accueil.php');
} else {
    if (!empty($_FILES['picture']) && !($_FILES['picture']['error'] > 0) || empty($_FILES['picture']['name'])) {
        include_once './class/ManagerMember.php';
        include_once './class/Article.php';
        $pseudo_receiver = $_POST['where'];
        $id_receiver = ManagerMember::get_member($pseudo_receiver)['ID'];
        $title = $_POST['article_title'];
        $content = $_POST['my_article'];
        $id_author = ManagerMember::get_member($_SESSION['login'])['ID'];
        if (!empty($_FILES['picture']['name'])) {
            echo 'ici';
            $new_article = new Article($title, $content, $id_receiver, $id_author, 1, 0, 0, 0);
            $new_article->add();
            move_uploaded_file($_FILES['picture']['tmp_name'], "./articles/pictures/" . $new_article->get_id());
        } else {
            echo 'la';
            $new_article = new Article($title, $content, $id_receiver, $id_author, 0, 0, 0, 0);
            $new_article->add();
        }
        unset($new_article);
        header('location: ./users/' . $pseudo_receiver . '.php');
        //redirection vers le mur où on a posté l'article
    }
}
Example #2
0
		<div id="select_file">
			<p>Add a picture
			<input type="file" name="picture"/></p>
		</div>
		<?php 
echo '<input type="hidden" name="where" value="breezy";/>';
?>
		<input type="submit" value="Post !"/>
	</form>
	<div>
		<div>
			<a href="#" id="notifications">
				<p>
				<img src="./pictures/notification.png"/>
				<?php 
$user = ManagerMember::get_member($_SESSION['login']);
$notification_factory = new NotificationFactory($user->get_id());
echo $notification_factory->size;
echo '</p>';
?>
			</a>
		</div>
		<div id="notification_menu">
			<?php 
$t_size = $notification_factory->size;
for ($i = 0; $i < $t_size; $i++) {
    $notification_factory->display($i);
}
?>
		</div>
	</div>
Example #3
0
 public function add_a_year($pseudo)
 {
     $this->year = $this->year + 1;
     ManagerMember::add_year_line($pseudo, $this->year);
 }