Example #1
0
 function _DbConnector()
 {
     global $link;
     $errmsg = "Momentaneamente offline. Riprova in 5 minuti.";
     $link = mysqli_connect(DBHOST, DBUSER, DBPASS, DBNAME);
     if (!$link) {
         ndie($errmsg . " errno: " . mysqli_errno());
     }
 }
Example #2
0
<?php

/* This Source Code Form is subject to the terms of the Mozilla Public
 * 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");