Ejemplo n.º 1
0
function lastnews($cat = -1)
{
    global $prefix;
    $quer = "SELECT titulo,data,noticia,autor,email,visto,reg,cat FROM " . $prefix . "noticias";
    if ($cat > -1) {
        $quer .= " WHERE cat=" . $cat;
    }
    $quer .= " ORDER BY reg DESC LIMIT 0,1";
    $query = dbquery($quer);
    if ($row_db = fetch_array($query)) {
        return show_one_news($row_db['0'], $row_db['1'], $row_db['2'], $row_db['3'], $row_db['4']);
    }
}
Ejemplo n.º 2
0
function shownews($post_integra = 1, $post_cabecalho = 9, $comenta = 0, $categ = -1)
{
    global $newsmessage, $set, $pagenum, $prefix;
    if ($_GET['action'] == "delete" && is_intval($_GET['id']) && is_intval($_GET['commentid']) && $_SESSION['adminlevel'] > 3) {
        dbquery("DELETE FROM " . $prefix . "comments WHERE id=" . $_GET['commentid']);
    }
    if (isset($_GET['id'])) {
        if (!is_intval($_GET['id'])) {
            die("news - Aha! Clever!");
        } else {
            $noticia_numero = $_GET['id'];
        }
    }
    if ($noticia_numero != "") {
        $query = "SELECT titulo,data,noticia,autor,email,visto, reg FROM " . $prefix . "noticias WHERE reg=" . $noticia_numero;
        if ($categ > -1) {
            $query .= " AND cat=" . $categ;
        }
    } else {
        $query = "SELECT titulo, data, noticia, autor, email, visto, reg FROM " . $prefix . "noticias";
        if ($categ > -1) {
            $query .= " WHERE cat=" . $categ;
        }
        $query .= " ORDER BY reg DESC LIMIT 0, {$post_integra}";
    }
    $row = dbquery($query);
    $first = false;
    while ($row_db = fetch_array($row)) {
        $out .= show_one_news($row_db['titulo'], $row_db['data'], $row_db['noticia'], $row_db['autor'], $row_db['email']);
        //check if there are comments on this news
        $res = dbquery("SELECT * FROM " . $prefix . "comments WHERE newsid=" . $row_db['reg'] . " ORDER BY time DESC");
        $num = num_rows($res);
        if ($_GET['showcomments'] == "1" || $comenta == 2) {
            //show the comments
            $ff = true;
            $i = 0;
            while ($row1 = fetch_array($res)) {
                if ($ff) {
                    $out .= "<div class=\"LNEnews_comments\">" . $newsmessage[143] . ":</div>";
                    $ff = false;
                }
                $out .= "<div class=\"LNEnews_comment\">\n";
                if ($_SESSION['adminlevel'] > 3) {
                    $out .= "\n<form method=\"post\" action=\"\" class=\"delete\">\n";
                    $out .= "<input type=\"hidden\" name=\"newsid\" value=\"" . $row1['newsid'] . "\" />\n";
                    $out .= "<input type=\"hidden\" name=\"id\" value=\"" . $row1['id'] . "\" />\n";
                    $out .= "<input type=\"hidden\" name=\"submit\" value=\"deletecomment\" />\n";
                    $out .= "<input type=\"image\" name=\"aaa\" src=\"images/editdelete.png\" value=\"\" title=\"{$newsmessage['174']}\" style=\"border: none; background: transparent; width: 16px; height: 16px;\"/>\n";
                    $out .= "</form>\n";
                }
                $out .= "<span class=\"time\">" . $newsmessage[112] . " " . data_formatada($row1['time']) . "</span>";
                $out .= "<span class=\"text\">" . decode($row1['text']) . "</span>";
                $out .= "<span class=\"poster\">" . $newsmessage[144] . ": </span>\n";
                /*				if($row1['postermail']!="")
                					$out.="<span class=\"author\"><a href=\"mailto:".decode($row1['postermail'])."\">".stripslashes(decode($row1['poster']))."</a></span>"; 
                				else */
                $out .= "<span class=\"author\">" . stripslashes(decode($row1['poster'])) . "</span>";
                $out .= "</div>\n";
                unset($_GET['showcomments']);
            }
        } else {
            if ($num) {
                $out .= "<a href=\"" . $_SERVER['SCRIPT_NAME'] . "?page=" . $pagenum . "&amp;id=" . $row_db['reg'] . "&amp;showcomments=1\">" . $newsmessage[143] . ": " . $num . "</a><br />\n";
            }
        }
        $out .= "\n<br />";
        if (!$first && ($comenta == 2 || $comenta == 1 && $_SESSION['user'] != "")) {
            $out .= commentform($row_db[6]);
        }
        $first = true;
        $novo_visto = $row_db[5] + 1;
        $query_add = dbquery("UPDATE " . $prefix . "noticias SET visto = {$novo_visto} WHERE reg = " . $row_db[6]);
    }
    $post_cabecalho_s = $post_cabecalho + $post_integra;
    if ($noticia_numero != "") {
        $query = "SELECT titulo, reg ,data, visto FROM " . $prefix . "noticias WHERE reg != " . $noticia_numero;
        if ($categ > -1) {
            $query .= " AND cat=" . $categ;
        }
        $query .= " ORDER BY reg DESC LIMIT 0, " . $post_cabecalho_s;
    } else {
        $query = "SELECT titulo, reg ,data, visto FROM " . $prefix . "noticias";
        if ($categ > -1) {
            $query .= " WHERE cat=" . $categ;
        }
        $query .= " ORDER BY reg DESC LIMIT {$post_integra}, " . $post_cabecalho_s;
    }
    $query = dbquery($query);
    $GETarray = $_GET;
    $first = true;
    while ($row_db = fetch_array($query)) {
        if ($first) {
            $first = false;
            $out .= "<div align=\"center\"><span style=\"font-size: 85%; font-weight: bold;\">{$newsmessage['113']}</span></div>";
            $out .= "<table border='0' align='center'><tr><td>{$newsmessage['12']}</td><td>{$newsmessage['114']}</td><td>{$newsmessage['115']}</td></tr>";
        }
        $GETarray['id'] = $row_db[1];
        $GETarray['showcomments'] = "0";
        $call = $_SERVER['SCRIPT_NAME'] . "?" . http_build_query($GETarray, '', '&amp;');
        $out .= "<tr><td><a href=\"" . $call . "\">" . stripslashes(decode($row_db["0"])) . "</a></td><td>" . data_formatada($row_db["2"]) . "</td><td>" . $row_db["3"] . "</td></tr>";
    }
    if (!$first) {
        $out .= "</table>";
    }
    $out .= "<span class=\"rss\">" . showrss() . "</span>\n";
    return $out;
}
Ejemplo n.º 3
0
<?php

//Includes the common functions
global $prefix, $set, $fuso_s;
require_once "../data/database.php";
if ($MySQL == 1) {
    $sqldbdb = @mysql_connect($databasehost, $databaselogin, $databasepassword) or die("Error - Could not connect to MySQL server: " . mysql_error());
    @mysql_select_db($databasename) or die("Error - Could not open database " . mysql_error());
} elseif ($MySQL == 0) {
    if (!($sqldbdb = @sqlite_open("../data/{$databasename}.db"))) {
        die("Error - Could not open database");
    }
} else {
    if (!($sqldbdb = new SQLite3("../data/{$databasename}.db"))) {
        die("Couldn't open SQLite 3 database");
    }
}
require_once "../languages/lang_en_US.php";
require_once "common.php";
readsetup();
require_once "../addons/news/lang/lang_en_US.php";
require_once "../addons/news/main1.php";
$query = dbquery("SELECT titulo,data,noticia,autor,email,visto,reg,cat FROM " . $prefix . "noticias ORDER BY reg DESC LIMIT 0,1");
if ($row_db = fetch_array($query)) {
    print "<html>\n<head>\n";
    print "<link rel='stylesheet' type='text/css' href='../templates/admintemplate/style.css' />\n";
    print "<link rel='stylesheet' type='text/css' href='../css/lightneasy.css' />\n";
    print "<head><body style=\"width: 270px;\">\n";
    print show_one_news($row_db['0'], $row_db['1'], $row_db['2'], $row_db['3'], $row_db['4']);
    print "</body>\n</html>\n";
}