public function getFolder($folder, $page = 1, $sorting = "DESC", $sort_by = self::DATE)
 {
     //Controllo che page sia numerico
     validate_num($page);
     //Mi assicuro che sorting sia corretto
     $sorting = strtoupper($sorting);
     if ($sorting != "ASC") {
         $sorting = "DESC";
     }
     //Aggiorno $sort_by per la query
     if ($sort_by == self::NAME) {
         $sort_by = $folder == self::SENT ? "to_id" : "from_id";
     } else {
         if ($sort_by == self::SUBJECT) {
             $sort_by = "subject";
         } else {
             $sort_by = "date_tm";
         }
     }
     //Creo i limiti
     $limit = DB::GetLimit($page, self::MESSAGE_FOR_PAGE);
     //Creo la query con cui prelevo i messaggi dal database
     $query = Message::SELECT_SQL . " WHERE " . self::whereForFolderQuery($folder) . " ORDER BY {$sort_by} {$sorting} LIMIT {$limit}";
     //Eseguo la query
     $qr = exequery($query);
     //Metto i messaggi nell'array
     $array = NULL;
     while ($m = mysqli_fetch_array($qr, MYSQLI_ASSOC)) {
         $array[] = new Message($m);
     }
     //restituisco l'array
     return $array;
 }
Example #2
0
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require_once "__inc__.php";
validate_num($_GET['id']);
validate_num($_GET['p']);
$forum_info = Forum::GetForumInfo($_GET['id']);
$pagTitle = "Forum " . $forum_info['title'];
$backUrl = "/p/forum/";
require_once ROOT_PATH . "header.php";
if (!Forum::IsAccessGrantedTo($forum_info, $currentUser)) {
    AlertMessage::Show("Non hai i permessi per visualizzare questo forum.", AlertMessage::WARN);
    ndie();
}
// TODO: cerca topic
// argument e' l'id del canale del forum (Android, C++, Off-Topic, etc.)
$limit = DB::GetLimit($_GET['p'], Forum::TOPICS_PER_PAGE);
$q = exequery(DB::SelectCalcFoundRows(Topic::SELECT_SQL) . "\n\t\t\t\tWHERE p.argument = {$_GET['id']} AND p.type = " . Forum::TYPE_TOPIC . " \n\t\t\t\tORDER BY p.show_as DESC, p.last_post_date DESC\n\t\t\t\tLIMIT {$limit}");
$topics_count = DB::GetCalcFoundRows();
// TODO: aggiungi indice su show_as
?>

<div class="center" style="margin-bottom: 1em;"> <!-- nuovo post -->
	<?php 
$formBuilder = new FormBuilder("frm-forum-post", "/restful/forum/newtopic.php");
$fields = array();
$fields[] = array("id" => "subject", "type" => "textinput", "label" => "Oggetto:", "validation" => "required,Specifica un oggetto per il messaggio");
$fields[] = array("id" => "poll", "type" => "textarea", "label" => "Sondaggio:<br/><span class='small'>(1 domanda per linea)</span>", "attrs" => "style='height: 6em;'");
$fields[] = array("id" => "message", "type" => "textarea", "validation" => "required,Devi scrivere un messaggio");
$formBuilder->addValue("forum_id", $_GET['id']);
$formBuilder->addFields($fields);
$formBuilder->setCloseable(true);
Example #3
0
validate_num($_GET['id']);
validate_num($_GET['forum_id']);
validate_num($_GET['p']);
$forum_info = Forum::GetForumInfo($_GET['forum_id']);
$topic = new Topic($_GET['id']);
$pagTitle = $topic["argument_title"] . " - " . $topic['subject'];
$backUrl = "../";
if ($topic['argument'] != $_GET['forum_id']) {
    ndie("forum_id != id");
}
require_once ROOT_PATH . "header.php";
if (!Forum::IsAccessGrantedTo($forum_info, $currentUser)) {
    AlertMessage::Show("Non hai i permessi per visualizzare questo forum.", AlertMessage::WARN);
    ndie();
}
$limit = DB::GetLimit($_GET['p'], Forum::POSTS_PER_PAGE);
$q = exequery(DB::SelectCalcFoundRows(ForumPost::SELECT_SQL) . "\n\t\t\t\t\tWHERE (fp.type = " . Forum::TYPE_POST . " AND root_topic = {$topic['id']}) OR (fp.type = " . Forum::TYPE_TOPIC . " AND fp.id = {$topic['id']})\n\t\t\t\t\tORDER BY fp.id\n\t\t\t\t\tLIMIT {$limit}");
$posts_count = DB::GetCalcFoundRows();
?>
<div id="forum-thread">

<?php 
if ($topic->isPoll()) {
    $poll_data = $topic->getPollData();
    ?>
<div class="poll">
	<b><?php 
    echo $topic['subject'];
    ?>
</b></br></br>
<?php