diff --git a/controllers/d.blog.php b/controllers/d.blog.php index 3d88ae5..ab9b07c 100755 --- a/controllers/d.blog.php +++ b/controllers/d.blog.php @@ -120,14 +120,6 @@ switch ($controller->splitted_url[1]) { if($user->rankIsHigher("premium")) { $blogArticles_history = new Kabano\BlogArticles(); $blogArticles_history->getHistory($controller->splitted_url[1]); - - $i = 0; - foreach ($blogArticles_history->ids as $row) { - $blogArticles_history_list[$i] = new Kabano\BlogArticle(); - $blogArticles_history_list[$i]->id = $row; - $blogArticles_history_list[$i]->populate(); - $i++; - } } 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]); @@ -166,11 +158,10 @@ switch ($controller->splitted_url[1]) { } } - $blogArticle->populate(); $blogArticle->md2html(); // Manage comments - if ($blogArticle->comments == "t") { + if ($blogArticle->is_commentable == "t") { $blogArticles_comments = new Kabano\BlogComments(); $blogArticles_comments->listComments($blogArticle->id, ($user->rankIsHigher("premium"))); @@ -189,12 +180,11 @@ switch ($controller->splitted_url[1]) { $tempUser = new Kabano\User(); - $tempUser->id = $blogArticle->author; - $tempUser->populate(); + $tempUser->checkId($blogArticle->author); $blogArticle->author_name = $tempUser->name; unset($tempUser); - $head['title'] = $blogArticle->title; + $head['title'] = $blogArticle->name; include ($config['views_folder']."d.blog.view.html"); } } diff --git a/models/d.blog.php b/models/d.blog.php index ce22e5d..d72eb4f 100755 --- a/models/d.blog.php +++ b/models/d.blog.php @@ -271,13 +271,13 @@ class BlogArticles /***** ** Return the list of archived version of a blog article *****/ -/* public function getHistory($url) { + public function getHistory($url) { global $config; $con = pg_connect("host=".$config['SQL_host']." dbname=".$config['SQL_db']." user=".$config['SQL_user']." password=".$config['SQL_pass']) or die ("Could not connect to server\n"); - $query = "SELECT id FROM blog_articles WHERE url=$1 ORDER BY lastedit DESC"; + $query = "SELECT * FROM contents WHERE permalink=$1 AND type='blog' ORDER BY update_date DESC"; pg_prepare($con, "prepare1", $query) or die ("Cannot prepare statement\n"); @@ -290,12 +290,12 @@ class BlogArticles for($i = 0; $i < $this->number; $i++) { $row = pg_fetch_assoc($result, $i); - $this->ids[$i] = $row['id']; + $this->objs[$i] = new BlogArticle; + $this->objs[$i]->populate($row); } - }*/ + } } - /********************************************************** *********************************************************** ** diff --git a/views/d.blog.view.html b/views/d.blog.view.html index 1cdd312..4ae330e 100755 --- a/views/d.blog.view.html +++ b/views/d.blog.view.html @@ -7,9 +7,9 @@ -
archive=="t"?'class="archive"':''?>> -

title?>.

- role >= 600) { ?> +
is_archive=="t"||$blogArticle->is_public=="f"?'class="archive"':''?>> +

name?>.

+ rankIsHigher("premium")) { ?> role >= 800 && isset($blogArticles_history_list)) { ?> + if ($user->rankIsHigher("moderator") && isset($blogArticles_history_list)) { ?> — role >= 800) { ?> - Éditer l'article - archive == 'f') { ?> - — - Effacer l'article + if ($user->rankIsHigher("moderator")) { ?> + Éditer l'article — + is_public == 't') { ?> + Effacer l'article + + Restaurer l'article @@ -38,21 +39,21 @@

Article écrit par - role > 0) { ?> + rankIsHigher("blocked")) { ?> author_name?> author_name?> - le lastedit)) ?> UTC

+ le creation_date)) ?> UTC

- comments == "t" && $blogArticle->archive == "f") { ?> + is_commentable == "t" && $blogArticle->is_archive == "f" && $blogArticle->is_public == "t") { ?>
-
-
role==0?"class='sent' ":""?>> - role > 0) { ?> + +
rank=="visitor"?"class='sent' ":""?>> + rankIsHigher("registered")) { ?>

Ajouter un nouveau commentaire

@@ -73,19 +74,19 @@ author_obj->avatar=='t') { ?> Avatar - + - role > 0) { ?> + rankIsHigher("blocked")) { ?> author_obj->name?> author_obj->name?> le lastedit)) ?> UTC - role >= 800 || $user->id == $row->author) && $row->archive == 'f') { ?> - Effacer le commentaire + rankIsHigher("moderator") || $user->id == $row->author) && $row->archive == 'f') { ?> + Effacer le commentaire - role >= 800 || $user->id == $row->author) && $row->archive == 't') { ?> - Réafficher le commentaire + rankIsHigher("moderator") || $user->id == $row->author) && $row->archive == 't') { ?> + Réafficher le commentaire
@@ -102,14 +103,14 @@
-role >= 600) { ?> +rankIsHigher("premium")) { ?> -role > 0) { ?> +rankIsHigher("registered")) { ?>