Example #1
0
if (isset($_GET['id_foro']) and array_key_exists($_GET['id_foro'], $_foros)) {
    $id_foro = intval($_GET['id_foro']);
    require 'core/models/class.Temas.php';
    $isset_id = isset($_GET['id']) and is_numeric($_GET['id']) and $_GET['id'] >= 1;
    $loged = isset($_SESSION['app_id']);
    if ($loged) {
        $cerrado = ($_foros[$id_foro]['estado'] == 1 or $_users[$_SESSION['app_id']]['permisos'] == 2);
    } else {
        $cerrado = false;
    }
    $temas = new Temas();
    switch ($mode) {
        case 'add':
            if ($loged and $cerrado) {
                if ($_POST) {
                    $temas->Add();
                } else {
                    include HTML_DIR . 'temas/add_tema.php';
                }
            }
            break;
        case 'edit':
            if ($isset_id and $loged) {
                $tema = $temas->Check();
                if (false != $tema) {
                    if ($_POST) {
                        $temas->Edit();
                    } else {
                        include HTML_DIR . 'temas/edit_tema.php';
                    }
                } else {