$pagSection = "Home"; require_once "__inc__.php"; require_once ROOT_PATH . "header.php"; ?> <h3>Ultimi topics</h3> <ul class="nav-list" style="margin: 1em 0;"> <?php // Ultimi topics nel forum $q = exequery(Topic::SELECT_SQL . "WHERE a.private = 0 AND type = " . Forum::TYPE_TOPIC . " \n\t\t\t\tORDER BY last_post_date DESC LIMIT 0,15"); while ($values = mysqli_fetch_array($q)) { $topic = new Topic($values); ?> <li> <a class="nowrap" href="<?php echo $topic->getUrl(); ?> "> <span class="tag pull-right" style="margin-left: 0.5em;"><?php echo $topic['argument_title']; ?> </span> <span class="bubble red pull-right"><?php echo $topic['replies']; ?> </span> <?php echo $topic->getName(); ?> <span class="hide-phone hide-tablet"> - <?php echo $topic->getFormattedDate();
$message = db_escape(Charset::Utf8ToDB($_POST['message'])); $is_poll = isset($_POST['poll']); // Le domande del sondaggio vengono memorizzate nel campo // "poll" come array serializzato. Se "poll" e' null, allora // vuol dire che il topic non e' un sondaggio if ($is_poll) { $poll_questions = explode("\n", trim(purify(Charset::Utf8ToDB($_POST['poll'])))); if (count($poll_questions) >= 2) { $poll_data = db_escape(serialize($poll_questions)); } else { // Numero di domande nel sondaggio non valido (< 2) $poll_data = null; } } if (!Forum::IsUserFlooding($currentUser)) { exequery(sprintf("INSERT INTO forum_posts (user_id, argument, subject, message, type, post_date, last_post_date, ip, poll, replies) \n VALUES(%d, %d, '%s', '%s', %d, %d, %d, '%s', \"%s\", 0)", $currentUser['id'], $_POST['forum_id'], $subject, $message, Forum::TYPE_TOPIC, time(), time(), get_ip(), $poll_data)); $id = DB::LastId(); $topic = new Topic($id); Forum::IncPostCountForUser($currentUser); $response->set("topic_url", $topic->getUrl()); $response->setSuccess(true); } else { $response->setError("Attendi almeno " . Forum::FLOOD_SECONDS_LIMIT . " secondi tra un post e l'altro."); } } else { $response->setError("Non sei loggato."); } } else { $response->setError($av->getLastError()); } $response->send();
}, ShowReplyForm: function(){ $("#frm-forum-reply").show(); $("#btn-forum-reply").hide(); FormBuilder.GetField("frm-forum-reply", "message").focusToEnd(); $("body").scrollTo("#frm-forum-reply", {duration: 500}); } }; $(function(){ <?php if ($topic['locked']) { ?> // Se il topic e' bloccato, non permettere agli utenti di rispondere e quotare $(".btn-quote, #btn-forum-reply").addClass("disabled"); <?php } ?> }); </script> <?php $pag = new Pagination($posts_count, Forum::POSTS_PER_PAGE, $_GET['p']); echo $pag->getNavigator("default.html", $topic->getUrl("#PAGE#")); ?> <?php require_once ROOT_PATH . "footer.php";