Getion des commentaires dans un modèle spécial
This commit is contained in:
@@ -61,104 +61,104 @@ switch ($controller->splitted_url[1]) {
|
||||
$notfound = 1;
|
||||
}
|
||||
default:
|
||||
// // If the page exists
|
||||
// if ($blogArticle->checkPermalink($controller->splitted_url[1],$user->rankIsHigher("premium"))) {
|
||||
// if (isset($controller->splitted_url[2]) && $controller->splitted_url[2] == "delete" && $user->rankIsHigher("moderator")) {
|
||||
// $blogArticle->delete();
|
||||
// header('Location: '.$config['rel_root_folder']."blog/".$blogArticle->permalink);
|
||||
// }
|
||||
// else if (isset($controller->splitted_url[2]) && $controller->splitted_url[2] == "restore" && $user->rankIsHigher("moderator")) {
|
||||
// $blogArticle->restore();
|
||||
// header('Location: '.$config['rel_root_folder']."blog/".$blogArticle->permalink);
|
||||
// }
|
||||
// else if (isset($controller->splitted_url[2]) && $controller->splitted_url[2] == "edit" && $user->rankIsHigher("moderator")) {
|
||||
// if(isset($_POST['submit'])) {
|
||||
// $blogArticle->content = $_POST['content'];
|
||||
// $blogArticle->locale = $_POST['locale'];
|
||||
// $blogArticle->name = $_POST['name'];
|
||||
// $blogArticle->is_commentable = isset($_POST['is_commentable'])?'t':'f';
|
||||
// $blogArticle->author = $user->id;
|
||||
// $blogArticle->update();
|
||||
// header('Location: '.$config['rel_root_folder']."blog/".$blogArticle->permalink);
|
||||
// }
|
||||
// else {
|
||||
// $locales = new Kabano\Locales();
|
||||
// $locales->getAll();
|
||||
// If the page exists
|
||||
if ($poi->checkPermalink($controller->splitted_url[1],$user->rankIsHigher("premium"))) {
|
||||
// if (isset($controller->splitted_url[2]) && $controller->splitted_url[2] == "delete" && $user->rankIsHigher("moderator")) {
|
||||
// $poi->delete();
|
||||
// header('Location: '.$config['rel_root_folder']."blog/".$poi->permalink);
|
||||
// }
|
||||
// else if (isset($controller->splitted_url[2]) && $controller->splitted_url[2] == "restore" && $user->rankIsHigher("moderator")) {
|
||||
// $poi->restore();
|
||||
// header('Location: '.$config['rel_root_folder']."blog/".$poi->permalink);
|
||||
// }
|
||||
// else if (isset($controller->splitted_url[2]) && $controller->splitted_url[2] == "edit" && $user->rankIsHigher("moderator")) {
|
||||
// if(isset($_POST['submit'])) {
|
||||
// $poi->content = $_POST['content'];
|
||||
// $poi->locale = $_POST['locale'];
|
||||
// $poi->name = $_POST['name'];
|
||||
// $poi->is_commentable = $_POST['is_commentable'];
|
||||
// $poi->author = $user->id;
|
||||
// $poi->update();
|
||||
// header('Location: '.$config['rel_root_folder']."blog/".$poi->permalink);
|
||||
// }
|
||||
// else {
|
||||
// $locales = new Kabano\Locales();
|
||||
// $locales->getAll();
|
||||
|
||||
// $head['title'] = $blogArticle->name;
|
||||
// include ($config['views_folder']."d.blog.edit.html");
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// // Manage history of an article
|
||||
// if($user->rankIsHigher("premium")) {
|
||||
// $blogHistory = new Kabano\BlogArticles();
|
||||
// $blogHistory->getHistory($controller->splitted_url[1]);
|
||||
// }
|
||||
// if (isset($controller->splitted_url[2]) && is_numeric($controller->splitted_url[2]))
|
||||
// $blogArticle->checkPermalink($controller->splitted_url[1],$user->rankIsHigher("premium"),$controller->splitted_url[2]);
|
||||
// $head['title'] = $poi->name;
|
||||
// include ($config['views_folder']."d.blog.edit.html");
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// Manage history of an article
|
||||
if($user->rankIsHigher("premium")) {
|
||||
$blogHistory = new Kabano\pois();
|
||||
$blogHistory->getHistory($controller->splitted_url[1]);
|
||||
}
|
||||
if (isset($controller->splitted_url[2]) && is_numeric($controller->splitted_url[2]))
|
||||
$poi->checkPermalink($controller->splitted_url[1],$user->rankIsHigher("premium"),$controller->splitted_url[2]);
|
||||
|
||||
// // Manage comment creation
|
||||
// if (isset($controller->splitted_url[2]) && $controller->splitted_url[2]=="new_comment") {
|
||||
// if (isset($_POST['submit']) && $user->rankIsHigher("registered")) {
|
||||
// $blogComment = new Kabano\BlogComment();
|
||||
// $blogComment->locale = $user->locale;
|
||||
// $blogComment->author = $user->id;
|
||||
// $blogComment->content = $blogArticle->content_id;
|
||||
// $blogComment->comment = $_POST['comment'];
|
||||
// $blogComment->insert();
|
||||
// }
|
||||
// }
|
||||
// Manage comment creation
|
||||
if (isset($controller->splitted_url[2]) && $controller->splitted_url[2]=="new_comment") {
|
||||
if (isset($_POST['submit']) && $user->rankIsHigher("registered")) {
|
||||
$blogComment = new Kabano\BlogComment();
|
||||
$blogComment->locale = $user->locale;
|
||||
$blogComment->author = $user->id;
|
||||
$blogComment->content = $poi->content_id;
|
||||
$blogComment->comment = $_POST['comment'];
|
||||
$blogComment->insert();
|
||||
}
|
||||
}
|
||||
|
||||
// // Manage comment deletion
|
||||
// if (isset($controller->splitted_url[2]) && $controller->splitted_url[2]=="delete_comment") {
|
||||
// if (isset($controller->splitted_url[3]) && is_numeric($controller->splitted_url[3])) {
|
||||
// $blogComment = new Kabano\BlogComment();
|
||||
// if($blogComment->checkId($controller->splitted_url[3]))
|
||||
// if ($user->rankIsHigher("moderator") || $user->id == $blogComment->author)
|
||||
// $blogComment->delete();
|
||||
// }
|
||||
// }
|
||||
// Manage comment deletion
|
||||
if (isset($controller->splitted_url[2]) && $controller->splitted_url[2]=="delete_comment") {
|
||||
if (isset($controller->splitted_url[3]) && is_numeric($controller->splitted_url[3])) {
|
||||
$blogComment = new Kabano\BlogComment();
|
||||
if($blogComment->checkId($controller->splitted_url[3]))
|
||||
if ($user->rankIsHigher("moderator") || $user->id == $blogComment->author)
|
||||
$blogComment->delete();
|
||||
}
|
||||
}
|
||||
|
||||
// // Manage comment restoration
|
||||
// if (isset($controller->splitted_url[2]) && $controller->splitted_url[2]=="restore_comment") {
|
||||
// if (isset($controller->splitted_url[3]) && is_numeric($controller->splitted_url[3])) {
|
||||
// $blogComment = new Kabano\BlogComment();
|
||||
// if($blogComment->checkId($controller->splitted_url[3]))
|
||||
// if ($user->rankIsHigher("moderator") || $user->id == $blogComment->author)
|
||||
// $blogComment->restore();
|
||||
// }
|
||||
// }
|
||||
// Manage comment restoration
|
||||
if (isset($controller->splitted_url[2]) && $controller->splitted_url[2]=="restore_comment") {
|
||||
if (isset($controller->splitted_url[3]) && is_numeric($controller->splitted_url[3])) {
|
||||
$blogComment = new Kabano\BlogComment();
|
||||
if($blogComment->checkId($controller->splitted_url[3]))
|
||||
if ($user->rankIsHigher("moderator") || $user->id == $blogComment->author)
|
||||
$blogComment->restore();
|
||||
}
|
||||
}
|
||||
|
||||
// $blogArticle->md2html();
|
||||
$poi->md2html();
|
||||
|
||||
// // Manage comments
|
||||
// if ($blogArticle->is_commentable == "t") {
|
||||
// $blogArticles_comments = new Kabano\BlogComments();
|
||||
// $blogArticles_comments->listComments($blogArticle->content_id, ($user->rankIsHigher("premium")));
|
||||
// Manage comments
|
||||
if ($poi->is_commentable == "t") {
|
||||
$pois_comments = new Kabano\BlogComments();
|
||||
$pois_comments->listComments($poi->content_id, ($user->rankIsHigher("premium")));
|
||||
|
||||
// $i = 0;
|
||||
// foreach ($blogArticles_comments->objs as $comment) {
|
||||
// $comment->md2html();
|
||||
// $comment->author_obj = new Kabano\User();
|
||||
// $comment->author_obj->checkId($comment->author);
|
||||
// }
|
||||
// }
|
||||
$i = 0;
|
||||
foreach ($pois_comments->objs as $comment) {
|
||||
$comment->md2html();
|
||||
$comment->author_obj = new Kabano\User();
|
||||
$comment->author_obj->checkId($comment->author);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// $tempUser = new Kabano\User();
|
||||
// $tempUser->checkId($blogArticle->author);
|
||||
// $blogArticle->author_name = $tempUser->name;
|
||||
// unset($tempUser);
|
||||
$tempUser = new Kabano\User();
|
||||
$tempUser->checkId($poi->author);
|
||||
$poi->author_name = $tempUser->name;
|
||||
unset($tempUser);
|
||||
|
||||
// $head['title'] = $blogArticle->name;
|
||||
// include ($config['views_folder']."d.blog.view.html");
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// $notfound = 1;
|
||||
// }
|
||||
// break;
|
||||
$head['title'] = $poi->name;
|
||||
include ($config['views_folder']."d.blog.view.html");
|
||||
// }
|
||||
}
|
||||
else {
|
||||
$notfound = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user