Aggiornato testo CommentoModel;
Guihandeler::generateHeadPublic link registrami crea una piccola finestra; articolo da finire backend per inviare commento
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
|
||||
require_once(dirname(__FILE__)."/load.php");
|
||||
|
||||
try {
|
||||
// if(UserLoginManager::isLogged()){
|
||||
var_dump($_POST);
|
||||
$id = PostHandler::get("id");
|
||||
$titolo = PostHandler::get("titolo");
|
||||
$commento = PostHandler::get("commento");
|
||||
|
||||
if(!is_null($id)){
|
||||
$articolo = GlobalVariables::get("dao")->getFirst("NotiziaModel",array("id"=>$id,"status"=>NotiziaModel::STATUS_ACCEPTED));
|
||||
if(!is_null($articolo)){
|
||||
|
||||
$news = new stdClass();
|
||||
$news->notizia = $articolo->id;
|
||||
$news->user = UserLoginManager::getLogged();
|
||||
|
||||
$commento = new CommentoModel($news);
|
||||
$commento->titolo = $titolo;
|
||||
$commento->testo = $testo;
|
||||
$commento->status = CommentoModel::STATUS_PENDING;
|
||||
|
||||
GlobalVariables::get("dao")->save($commento);
|
||||
echo '<div class="commentoSent">Il tuo commento è stato inviato ed è in attesa di apporvazione.</div>';
|
||||
}
|
||||
}
|
||||
// }
|
||||
else{
|
||||
echo '<div class="commentoSent redError">Un errore ha impedito l\'invio del commento.</div>';
|
||||
}
|
||||
|
||||
}catch (Exception $exec){
|
||||
var_dump($exec);
|
||||
// echo '<div class="commentoSent redError">Un errore ha impedito l\'invio del commento.(Ex)</div>';
|
||||
$msg = LogModel::fromException($exec);
|
||||
GlobalVariables::get("dao")->save($msg);
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user