Sorry for this ugly message. We are searching for some translators.
Please send me an eMail or jabber: t4c@im.digital-bit.ch
Got: de, en, pl, ro, lu, ru, es - Need: everything else
Userdata
Name
ex1t
Scriptlanguage
PHP
Tabwidth
2
Date
06/30/2009 01:07:33 pm
IP
92.229.121.141
Description
The user was too lazy to give a description
Code (Hide rownumbers )
<?php
class NewsController extends AppController {
var $name = 'News' ;
function index() {
$news = $this -> News -> find('all' , array (
'order' => 'id' ,
'direction' => 'desc' ,
'limit' => '10'
));
$this -> set('news' , $news);
}
function comments($id) {
$news = $this -> News -> read(null, $id);
if (empty ($news['news' ]['id' ])) {
$this->Session->setFlash('Der von dir angeforderte Newsartikel scheint nicht vorhanden zu sein.' );
$this->redirect(array ('action' =>'index' ));
}
$cmtcount = $this -> News -> Comments -> find('count' , array ('conditions' => array ('Comments.news_id' => '' .$id.'' )));
$comments = $this -> News -> Comments -> find('all' , array (
'order' => 'id' ,
'direction' => 'desc'
'conditions' => array ('Comments.news_id' => '' .$id.''
)));
if ($cmtcount == "0") { $nocmt = true; } else { $nocmt = false; }
if (!empty ($this -> data)) {
if (empty ($this->data['Comments' ]['content' ])) {
$this -> Session -> setFlash('Das Feld Kommentartext darf nicht leer sein.' );
} else {
$this -> data ['Comments' ]['content' ] = Sanitize::html($this->data['Comments' ]['content' ]);
$this->data = Sanitize::clean($this->data, array ('encode' => false));
$this->data['Comments' ]['news_id' ] = $id;
$this -> News -> Comments -> create();
if ($this -> News -> Comments -> save($this->data)) {
$this -> Session -> setFlash('Dein Kommentar wurde eingetragen.' );
$this -> redirect('/news/comments/' .$id.'' );
} else {
$this -> Session -> setFlash('Leider ist beim eintragen ein Fehler aufgetreten. Bitte versuche es erneut.' );
}
}
}
}
}
?>