Example #1
0
function listNewsComments($nid, $pages, $page = 1, $rows = 10)
{
    if (!is_numeric($nid)) {
        return;
    }
    if ($page < 0 || $rows < 0 || !is_numeric($page) || !is_numeric($rows)) {
        return;
    }
    $pages = getNewsCommentsPages($nid, $rows);
    #Seite checken
    if ($pages < $page && $pages != 0) {
        $page = $pages;
    }
    $return = selectsql("select c.*,u.*,g.usertitle,DATE_FORMAT(c.time, '%d.%m.%y') as cdate,\n\t\t\t\t\t\t\tDATE_FORMAT(c.time, '%H:%i') as ctime, cn.nid  \n\t\t\t\t\t\t\t\tfrom com_news cn\n\t\t\t\t\t\t\t\tleft join comments c on(c.cid = cn.cid)\n\t\t\t\t\t\t\t\tleft join  user u on (u.uid = c.uid)\n\t\t\t\t\t\t\t\tleft join groups g on (g.gid = u.gid)\n\t\t\t\t\t\t\t\twhere cn.nid = {$nid} \n\t\t\t\t\t\t\t\torder by time asc \n\t\t\t\t\t\t\t\tLIMIT " . $rows * ($page - 1) . ",{$rows}");
    return $return;
}
Example #2
0
 function _Comment_add()
 {
     $nid = param_num("nid");
     if (!$nid) {
         $this->_header("index.php");
     }
     $newsdata = getNews($nid);
     if (!$newsdata) {
         $this->_header("index.php");
     }
     $comrows = 6;
     $data = $_SESSION['steps'];
     #information message, step 2
     if ($data['addcom']) {
         #save step
         unset($data['addcom']);
         $_SESSION['steps'] = $data;
         $pages = getNewsCommentsPages($nid, $comrows);
         $this->forms['information']['url'] = $this->backtracking->backlink();
         $this->forms['information']['title'] = "Kommentar hinzufügen";
         $this->forms['information']['message'] = "Kommentar hinzugefügt";
         $this->forms['information']['style'] = "green";
         $this->show('message_information', "Kommentar hinzufügen");
     }
     #formular send
     if ($_REQUEST['send']) {
         if ($_REQUEST['next_x']) {
             $items['message'] = param_str("message", true);
             $errors = false;
             #check if empty
             foreach ($items as $key => $value) {
                 if (!$value) {
                     $this->forms['addcom']['fields'][$key]['error'] = 'Feld darf nicht leer sein!';
                     $this->forms['addcom']['fields'][$key]['bgrd'] = '_error';
                     $errors = true;
                 } else {
                     $this->forms['addcom']['fields'][$key]['value'] = $value;
                 }
             }
             #optional parameters
             if (!$errors) {
                 #save step
                 $data['addcom'] = 1;
                 $_SESSION['steps'] = $data;
                 $id = addcom($nid, editPostdata($items['message']), $this->userdata['uid']);
                 addToLogfile("Kommentar zu News <b>" . $newsdata['title'] . "</b> hinzugefügt", "News", $this->userdata['uid']);
                 $this->_header("index.php?action=addcom&nid=" . $nid . "&send");
             }
         } else {
             $this->_header($this->backtracking->backlink());
         }
     }
     $this->forms['addcom']['name'] = $return['name'];
     $this->forms['addcom']['url'] = "index.php?nid=" . $nid;
     $this->forms['addcom']['action'] = 'addcom';
     $this->show('com_add_form', "Kommentar hinzufügen");
 }