if (check_important_topic($id) == 0 && check_announcement_topic($id) == 0) { $set_topic = "\n<form method=\"POST\" action=\"viewtopic.php?id=" . $id . "&set_topic=1\" />" . "\n<input type=\"radio\" name=\"set_topic\" value=\"null\" checked> Topic Normale" . "\n<input type=\"radio\" name=\"set_topic\" value=\"announcement\"> Setta il topic in forma Annuncio" . "\n<input type=\"radio\" name=\"set_topic\" value=\"important\" > Setta il topic in forma Importante" . "\n<input type=\"submit\" value=\"Setta topic\" />" . "\n</form>"; } elseif (check_important_topic($id) == 1 && check_announcement_topic($id) == 0) { $set_topic = "\n<form method=\"POST\" action=\"viewtopic.php?id=" . $id . "&set_topic=1\" />" . "\n<input type=\"radio\" name=\"set_topic\" value=\"null\"> Topic Normale" . "\n<input type=\"radio\" name=\"set_topic\" value=\"announcement\"> Setta il topic in forma Annuncio" . "\n<input type=\"radio\" name=\"set_topic\" value=\"important\" checked> Setta il topic in forma Importante" . "\n<input type=\"submit\" value=\"Setta topic\" />" . "\n</form>"; } elseif (check_important_topic($id) == 0 && check_announcement_topic($id) == 1) { $set_topic = "\n<form method=\"POST\" action=\"viewtopic.php?id=" . $id . "&set_topic=1\" />" . "\n<input type=\"radio\" name=\"set_topic\" value=\"null\"> Topic Normale" . "\n<input type=\"radio\" name=\"set_topic\" value=\"announcement\" checked> Setta il topic in forma Annuncio" . "\n<input type=\"radio\" name=\"set_topic\" value=\"important\"> Setta il topic in forma Importante" . "\n<input type=\"submit\" value=\"Setta topic\" />" . "\n</form>"; } // cancella topic $delete_topic = "<form method=\"POST\" action=\"viewtopic.php?id=" . $id . "\" />" . "\n<input type=\"hidden\" value=\"1\" name=\"delete_topic\" />" . "\n<input type=\"submit\" value=\"Rimuovi Topic\" />" . "\n</form>\n"; // sposta topic $move_topic = "<form method=\"POST\" action=\"viewtopic.php?id=" . $id . "&move_topic=1\" />" . "\n<select name=\"to_forum\">"; $list_forum = mysql_query("SELECT id, title \n\t\t\t\t\t\t\t\t\t FROM " . __PREFIX__ . "forum \n\t\t\t\t\t\t\t\t ORDER BY position"); while ($row = mysql_fetch_array($list_forum)) { $move_topic .= "\n<option value=\"" . $row['id'] . "\">" . $row['title'] . "</option>"; } $move_topic .= "\n</select>" . "\n<br />" . "\n<br />" . "\n<input type=\"hidden\" value=\"" . check_t_id($id) . "\" name=\"move_t_id\" />" . "\n<input type=\"submit\" value=\"Sposta Topic\" />" . "\n</form>\n"; } else { $block_topic = ''; $delete_topic = ''; $move_topic = ''; $set_topic = ''; } // inizio div reply print "\n<div class = 'reply'>\n"; if (login($username, $password)) { // controllo se l'utente è loggato if (check_block_topic($id) == 0 || check_block_topic($id) == NULL) { // controllo se il topic è bloccato/chiuso if (level($username) != 'banned') { // controllo se l'utente è bannato print "<table>" . "\n<tr><td>" . @$block_topic . "\n</td><td>" . @$delete_topic . "</td><td>" . @$move_topic . "</td></tr>" . "\n</table>";
function delete_topic($username, $id) { if (empty($id)) { die(header('Location: index.php')); } if (level($username) == 'admin' || level($username) == 'mod') { $query = "SELECT f_id FROM " . __PREFIX__ . "topic WHERE id = '" . $id . "'"; $f_id = mysql_fetch_row(mysql_query($query)); $t_id = check_t_id($id); $sql = "DELETE FROM " . __PREFIX__ . "topic WHERE t_id = '{$t_id}'"; mysql_query($sql) or _err(mysql_error()); header("Location: viewforum.php?id=" . $f_id[0]); } else { print "<script>alert(\"Operazione consentita solo ad Amministratori e Moderatori\");</script>"; } }