Example #1
0
 public function create($request)
 {
     $req = $request->getParameters();
     $response = new ViewResponse('assist/ticket');
     if (trim($req['bug']) != '') {
         if (Session::isActive()) {
             $user_id = Session::get()->id;
         } else {
             if (trim($req['email']) != '') {
                 $user_id = $req['email'];
             } else {
                 $user_id = 0;
             }
         }
         $ticket = Ticket::create(array('user_id' => $user_id, 'description' => $req['bug'], 'timestamp' => time(), 'ip' => $_SERVER['REMOTE_ADDR']));
         $ticket_id = $ticket->id;
         $response->addMessage(ViewMessage::success('Envoyé ! Vous serez notifié de l\'avancement par E-Mail ou Message Privé (Ticket #' . $ticket_id . ')'));
         /*$username = (Session::isActive()) ? Session::get()->username : '******';
         		$notif = new PushoverNotification();
         		$notif->setMessage('Nouveau ticket de '.$username);
         		$notif->setReceiver('all');
         		$notif->setExtraParameter('url', 'http://dreamvids.fr'.WEBROOT.'admin/tickets');
         		$notif->send();*/
     } else {
         $response->addMessage(ViewMessage::error('Merci de nous décrire votre problème.'));
     }
     return $response;
 }
Example #2
0
 public function create($request)
 {
     $req = $request->getParameters();
     $response = new ViewResponse('assist/ticket');
     if (trim($req['bug']) != '') {
         if (Session::isActive()) {
             $user_id = Session::get()->id;
         } else {
             if (trim($req['email']) != '') {
                 $user_id = $req['email'];
             } else {
                 $user_id = 0;
             }
         }
         if (!empty(Ticket::find('all', ['conditions' => ['ip = ? AND timestamp < ' . (Utils::tps() + 60), $_SERVER['REMOTE_ADDR']]]))) {
             $r = $this->index($request);
             $r->addMessage(ViewMessage::error('Trop d\'envois avec la même IP en une minute, réssayez plus tard.'));
             return $r;
         }
         $ticket = Ticket::create(array('user_id' => $user_id, 'description' => $req['bug'], 'timestamp' => time(), 'ip' => $_SERVER['REMOTE_ADDR']));
         StaffNotification::createNotif('ticket', $user_id, null, $ticket->id);
         $ticket_id = $ticket->id;
         $response->addMessage(ViewMessage::success('Envoyé ! Vous serez notifié de l\'avancement par E-Mail ou Message Privé (Ticket #' . $ticket_id . ')'));
         /*$username = (Session::isActive()) ? Session::get()->username : '******';
         		$notif = new PushoverNotification();
         		$notif->setMessage('Nouveau ticket de '.$username);
         		$notif->setReceiver('all');
         		$notif->setExtraParameter('url', 'http://dreamvids.fr'.WEBROOT.'admin/tickets');
         		$notif->send();*/
     } else {
         $response->addMessage(ViewMessage::error('Merci de nous décrire votre problème.'));
     }
     return $response;
 }
Example #3
0
 /**
  * @runInSeparateProcess
  */
 public function testSessionStart()
 {
     $session = new Session();
     $session->start();
     $this->assertEquals(null, $session->getHash());
     $this->assertEquals(null, $session->getAddress());
     $this->assertEquals(true, $session->isActive());
 }
Example #4
0
 public static function init($request)
 {
     self::$request = $request;
     self::registerLanguage(array("fr"));
     if (Session::isActive()) {
         self::$prefered_language = Session::get()->getLanguageSetting() == "auto" ? self::GetLanguageFromHttpRequest() : Session::get()->getLanguageSetting();
     } else {
         self::$prefered_language = self::GetLanguageFromHttpRequest();
     }
 }
 public function index($request)
 {
     if (Session::isActive()) {
         return new RedirectResponse(WEBROOT);
     } else {
         $data = array();
         $data['currentPageTitle'] = 'Mot de passe oublié';
         return new ViewResponse('password/password', $data);
     }
 }
Example #6
0
 public function channelSelection($request)
 {
     if (Session::isActive()) {
         $data = array();
         $data['channel'] = Session::get()->getOwnedChannels();
         $data['currentPageTitle'] = 'Mettre en ligne';
         return new ViewResponse('upload/channels', $data);
     } else {
         return new RedirectResponse(Utils::generateLoginURL());
     }
 }
 public function index($request)
 {
     if (Session::isActive()) {
         return new RedirectResponse(WEBROOT . 'login');
     } else {
         $data = array();
         $data['currentPageTitle'] = 'Inscription';
         $data["currentPage"] = "register";
         return new ViewResponse('login/register', $data);
     }
 }
Example #8
0
 public function get($id, $request)
 {
     //Triggered when an egg is clicked to add the point(s)
     $data = [];
     if (Eggs::isAvailable($id)) {
         $data['egg'] = Eggs::find($id);
         if (Session::isActive()) {
             $data['egg']->user_id = Session::get()->id;
             $data['egg']->found = true;
             $data['egg']->save();
             $data['pts'] = Eggs::countUserScore(Session::get());
         }
         return new ViewResponse('egg/found', $data);
         //echo 'You won ' . $pts . ' point' . $pts > 1 ? 's' : '';
     } else {
         if (Session::isActive()) {
             $data['pts'] = Eggs::countUserScore(Session::get());
         }
         return new ViewResponse('egg/error', $data);
     }
 }
Example #9
0
 public function create($request)
 {
     if (Session::isActive()) {
         $req = $request->getParameters();
         Session::get()->last_visit = Utils::tps();
         Session::get()->save();
         if (isset($req['sender'], $req['conversation'], $req['content']) && !empty($req['conversation']) && !empty($req['sender']) && !empty($req['content'])) {
             $sender = Utils::secure($req['sender']);
             $conversation = Utils::secure($req['conversation']);
             $content = Utils::secure($req['content']);
             $channel = UserChannel::exists($sender) ? UserChannel::find($sender) : false;
             if ($channel && $channel->belongToUser(Session::get()->id) && ($conv = Conversation::find($conversation))) {
                 if (!$conv->containsChannel($channel)) {
                     return Utils::getUnauthorizedResponse();
                 }
                 $message = Message::sendNew($sender, $conversation, $content);
                 $messageData = array('id' => $message->id, 'avatar' => $channel->getAvatar(), 'pseudo' => $channel->name, 'text' => $content, 'mine' => 'true');
                 return new JsonResponse($messageData);
             }
         }
     }
     return new Response(500);
 }
Example #10
0
 public function index($request)
 {
     $data = array();
     $data['currentPageTitle'] = 'Accueil';
     $data['discoverVids'] = Video::getDiscoverVideos(2);
     $data['bestVids'] = Video::getBestVideos(6);
     if (Session::isActive()) {
         $channel = Session::get()->getMainChannel();
         $data['subscriptions'] = Session::get()->getSubscribedChannels();
         if ($data['subscriptions'] instanceof UserChannel) {
             $data['subscriptions'] = [$data['subscriptions']];
         }
         $data['subscriptions_vids'] = Video::getSubscriptionsVideos(Session::get()->id, 20);
         $data['channelId'] = $channel->id;
         $data['channelName'] = $channel->name;
         $data['avatar'] = $channel->getAvatar();
         $data['background'] = $channel->getBackground();
         return new ViewResponse('home/logged', $data);
     } else {
         $data['best_chans'] = UserChannel::getBestChannels();
         $data['news_vids'] = Video::getLastVideos();
         return new ViewResponse('home/guest', $data);
     }
 }
Example #11
0
 public function index($request)
 {
     if (Session::isActive()) {
         $sess = Session::get();
         $data = array();
         $data['currentPageTitle'] = 'Flux d\'activité';
         $data['actions'] = array();
         $data['subscriptions'] = array();
         $data['last_visit'] = $sess->last_visit;
         $sess->last_visit = Utils::tps();
         $sess->save();
         $actions = Session::get()->getNotifications();
         $data['subscriptions'] = Session::get()->getSubscribedChannels();
         if (count($actions) > 0) {
             $data['actions'] = $actions;
         }
         $data = $this->regroupPmFeeds($data);
         $data = $this->regroupLikeFeeds($data);
         $data = $this->regroupSubscribeFeeds($data);
         return new ViewResponse('feed/feed', $data);
     } else {
         return new RedirectResponse(Utils::generateLoginURL());
     }
 }
Example #12
0
 public function destroy($id, $request)
 {
     $comment = Comment::exists($id) ? Comment::find($id) : false;
     if (Session::isActive() && (Session::get()->isModerator() || Session::get()->isAdmin() || $comment && $comment->getVideo()->getAuthor()->belongToUser(Session::get()->id) || $comment && $comment->getAuthor()->belongToUser(Session::get()->id))) {
         $comment->erase(Session::get());
         $response = new Response(200);
         $response->setBody("done");
         return $response;
     }
     $response = new Response(500);
     $response->setBody("error");
     return $response;
 }
Example #13
0
 public static function logoutCurrent()
 {
     if (Session::isActive()) {
         UserSession::delete_all(array('conditions' => array('user_id = ?', Session::get()->id)));
         setcookie("SESSID", '', -1);
         Session::set(-1);
     }
 }
 public function channel($id, $request)
 {
     if (Session::isActive() && ($channel = UserChannel::find($id)) && $channel->belongToUser(Session::get()->id)) {
         if ($request->acceptsJson()) {
             $conversations = Conversation::getByChannel($channel);
             $conversationsData = array();
             foreach ($conversations as $conv) {
                 $conversationsData[] = array('id' => $conv->id, 'title' => $conv->object, 'members' => $conv->getMemberChannelsName(), 'avatar' => $conv->getThumbnail(), 'text' => $conv->getLastMessage() ? $conv->getLastMessage()->content : 'Aucun message');
             }
             return new JsonResponse($conversationsData);
         }
     } else {
         return Utils::getUnauthorizedResponse();
     }
     return new Response(500);
 }
Example #15
0
 public function destroy($id, $request)
 {
     if (Session::isActive() && UserChannel::find(Playlist::find($id)->channel_id)->belongToUser(Session::get()->id)) {
         Playlist::find($id)->delete();
         Playlist::delete_all(array('conditions' => 'id = ?'), $id);
         return new Response(200);
     } else {
         ob_clean();
         return new Response(500);
     }
 }
Example #16
0
<section class="middle">
	<h1 class="title">Assistance: Un problème ? Nous sommes là !</a></h1>

	<?php 
@(include $messages);
?>

	<form method="post" action="<?php 
echo WEBROOT . 'assistance';
?>
" class="form middle">
		<?php 
echo !Session::isActive() ? '<input type="email" name="email" id="email" placeholder="Votre E-Mail (optionnel) pour être avertit du déroulement de votre problème" /><br />' : '';
?>
		<textarea name="bug" id="bug" placeholder="Donnez une description précise de votre problème"></textarea>
		<input type="submit" name="submitLogin" value="Envoyer" />
	</form>
</section>
Example #17
0
echo JS . 'marmottajax.js';
?>
"></script>

<script>

	new DreamPlayer({
	
	    cible: document.getElementById("player-div"),
	    poster: "<?php 
echo $thumbnail;
?>
",
	
	    <?php 
if (Session::isActive()) {
    echo "source: _last_definition_setting_,";
    echo "volume: _last_volume_setting_,";
}
?>

	    <?php 
if (isset($nextVideo)) {
    echo 'redirectAtEnd: "' . @$nextVideo . '",';
}
?>
	
	    sources: [
	
	        {
	
Example #18
0
 public function language($request)
 {
     if (Session::isActive()) {
         $data['currentPageTitle'] = "Paramètre de langues";
         $data['settings'] = Session::get()->getSettings();
         $data['current'] = 'language';
         $data['avaiable_languages'] = Translator::getLanguagesList();
         $data['lang_setting'] = Session::get()->getLanguageSetting();
         return new ViewResponse('account/language', $data);
     } else {
         return RedirectResponse(WEBROOT . 'login');
     }
 }
Example #19
0
function validAdmin()
{
    $Group = UserProxy::getInstance()->UserGroup;
    return Session::isActive() && $Group == 'admin';
}
Example #20
0
 public function destroy($id, $request)
 {
     if (Session::isActive()) {
         if ($access = LiveAccess::find($id)) {
             $access->delete();
             return new Response(200);
         } else {
             return new Response(404);
         }
     } else {
         return Utils::getUnauthorizedResponse();
     }
 }
Example #21
0
 public function edit($id, $request)
 {
     if (Session::isActive()) {
         $channel = UserChannel::exists($id) ? UserChannel::find($id) : UserChannel::find_by_name($id);
         if (!$channel->belongToUser(Session::get()->id)) {
             return Utils::getForbiddenResponse();
         }
         if (is_object($channel)) {
             $data = array();
             $data['currentPage'] = 'channel';
             $data['current'] = 'channels';
             $data['currentPageTitle'] = $channel->name . ' - Edition';
             $data['id'] = $channel->id;
             $data['mainChannel'] = $channel->isUsersMainChannel(Session::get()->id);
             $data['owner_id'] = $channel->owner_id;
             $data['name'] = $channel->name;
             $data['description'] = $channel->description;
             $data['avatar'] = $channel->getAvatar();
             $data['background'] = $channel->getBackground();
             $admins = explode(';', trim($channel->admins_ids, ';'));
             $data['admins_ids'] = $admins;
             $data['admins'] = array();
             foreach ($admins as $adm) {
                 $data['admins'][] = User::find_by_id($adm)->getMainChannel();
             }
             return new ViewResponse('channel/edit', $data);
         } else {
             return Utils::getNotFoundResponse();
         }
     } else {
         return new RedirectResponse(Utils::generateLoginURL());
     }
 }
Example #22
0
 public function logged($request)
 {
     return new JsonResponse(['logged' => Session::isActive()]);
 }
Example #23
0
<div class="content">
	<div id="video-top-infos">
		<div id="video-top-title">
			<div id="video-top-channel">
				<img src="<?php 
echo $channel->getAvatar();
?>
">
				<?php 
if (Session::isActive() && Session::get()->getMainChannel()->id != $channel->id) {
    ?>
				<span id="hover_subscribe" data-channel="<?php 
    echo $channel->id;
    ?>
" class="<?php 
    echo $subscribed ? 'subscribed' : '';
    ?>
">
					<i><?php 
    echo $subscribed ? 'Abonné' : 'S\'abonner';
    ?>
</i>
				</span>
				<?php 
}
?>
				<div id="video-top-channel-infos">
					<a id="video-top-pseudo" href="<?php 
echo WEBROOT . 'channel/' . $channel->id;
?>
" class="<?php 
Example #24
0
 public function edit($id, $request)
 {
     if (Session::isActive() && UserChannel::find(Video::find($id)->poster_id)->belongToUser(Session::get()->id)) {
         if ($video = Video::find($id)) {
             $data = array();
             $data['currentPageTitle'] = $video->title . ' - Modification';
             $data['video'] = $video;
             return new ViewResponse('video/edit', $data);
         } else {
             return new RedirectResponse(WEBROOT . 'account/videos');
         }
     } else {
         return new RedirectResponse(Utils::generateLoginURL());
     }
 }
Example #25
0
function displayComments($video, $parent, $i)
{
    $comments = $video->getComments($parent);
    if (empty($comments)) {
        ?>
					<p>Aucun commentaire à propos de cette video</p>
				<?php 
    }
    foreach ($comments as $comment) {
        $comment->comment = Utils::makeLinks(Utils::secure($comment->comment));
        $margin = $i * 8;
        ?>
					<div style="width: <?php 
        echo 100 - $margin;
        ?>
%; margin-left:<?php 
        echo $margin;
        ?>
%" class="comment" id="c-<?php 
        echo $comment->id;
        ?>
">
						<div class="comment-head">
							<div class="user">
								<img src="<?php 
        echo UserChannel::find($comment->poster_id)->getAvatar();
        ?>
" alt="[Avatar]">
								<a href="<?php 
        echo WEBROOT . 'channel/' . UserChannel::find($comment->poster_id)->name;
        ?>
"><?php 
        echo UserChannel::getNameById($comment->poster_id);
        ?>
</a>
							</div>
							<div class="date">
								<p><?php 
        echo Utils::relative_time($comment->timestamp);
        echo $comment->last_updated_timestamp ? ' (Edité ' . Utils::relative_time($comment->last_updated_timestamp) . ')' : '';
        ?>
</p>
							</div>
						</div>
						<div class="comment-text">
							<p style="word-wrap:break-word"><?php 
        echo $comment->comment;
        ?>
</p>
						</div>
						<div class="comment-notation">
							<ul>
								<li class="plus" id="plus-<?php 
        echo $comment->id;
        ?>
" onclick="likeComment('<?php 
        echo $comment->id;
        ?>
')">+<?php 
        echo $comment->likes;
        ?>
</li>
								<li class="moins" id="moins-<?php 
        echo $comment->id;
        ?>
" onclick="dislikeComment('<?php 
        echo $comment->id;
        ?>
')">-<?php 
        echo $comment->dislikes;
        ?>
</li>
								<li onclick="reportComment('<?php 
        echo $comment->id;
        ?>
', this)" style="cursor:pointer">Signaler</li>
								<li onclick="document.location.href='#comments';document.getElementById('response').innerHTML='<b>Répondre à <?php 
        echo UserChannel::getNameById($comment->poster_id);
        ?>
 :</b>';document.getElementById('textarea-comment').focus();document.getElementById('parent-comment').value='<?php 
        echo $comment->id;
        ?>
';" style="cursor:pointer">Répondre</li>
								<?php 
        if (Session::isActive() && (Session::get()->isModerator() || Session::get()->isAdmin() || $comment->getAuthor()->belongToUser(Session::get()->id))) {
            ?>
								
								<li onclick="editComment('<?php 
            echo $comment->id;
            ?>
', this)" style="cursor:pointer">Editer</li>
								<?php 
        }
        ?>
								<?php 
        if (Session::isActive() && (Session::get()->isModerator() || Session::get()->isAdmin() || $video->getAuthor()->belongToUser(Session::get()->id) || $comment->getAuthor()->belongToUser(Session::get()->id))) {
            ?>
								<li onclick="deleteComment('<?php 
            echo $comment->id;
            ?>
', this)" style="cursor:pointer">Supprimer</li>
								<?php 
        }
        ?>
							</ul>
						</div>
					</div>
			<?php 
        if (Comment::count(array('conditions' => array('parent = ?', $comment->id))) >= 1) {
            displayComments($video, $comment->id, $i + 1);
        }
    }
}
Example #26
0
		<img src="<?php 
echo $author->getAvatar();
?>
" alt="Avatar de la chaîne">
		<p><?php 
echo $author->name;
?>
</p>
		<a href="<?php 
echo WEBROOT . 'channel/' . $author->id;
?>
"><div class="channel-access-btn"><img src="<?php 
echo IMG . 'arrow_right.png';
?>
" alt="Allez sur la chaîne"></div></a>
	</div>
	
	
<?php 
if (Session::isActive() && (Session::get()->isModerator() || Session::get()->isAdmin())) {
    ?>
	<form method="post" action="" role="form" class="moderating-commands" onsubmit="return false">
		<button class="blue" onclick="unSuspendVideo('<?php 
    echo $video->id;
    ?>
')">Ré-activer</button>
	</form>
<?php 
}
?>
</div>
 public function destroy($id, $request)
 {
     if (Session::isActive()) {
         $user = Session::get();
         if (ChannelPost::exists($id)) {
             $post = ChannelPost::find($id);
             if (UserChannel::find($post->channel_id) && UserChannel::find($post->channel_id)->belongToUser($user->id)) {
                 $post->erase();
             }
         }
     }
     return new Response(200);
 }