Guihandeler::generateHeadPublic link registrami crea una piccola finestra; articolo da finire backend per inviare commento
41 lines
1.2 KiB
PHP
41 lines
1.2 KiB
PHP
<?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);
|
|
}
|
|
?>
|