diff --git a/controllers/d.wiki.php b/controllers/d.wiki.php index ee65816..7ec0ef3 100755 --- a/controllers/d.wiki.php +++ b/controllers/d.wiki.php @@ -64,7 +64,6 @@ else if(isset($controller->splitted_url[1]) && $wikiPage->checkUrl($controller-> if (isset($controller->splitted_url[2]) && is_numeric($controller->splitted_url[2])) $wikiPage->checkUrl($controller->splitted_url[1],$user->role>=600, $controller->splitted_url[2]); - $wikiPage->populate(); $wikiPage->md2html(); $head['title'] = $wikiPage->title; include ($config['views_folder']."d.wiki.view.html"); diff --git a/includes/routes.php b/includes/routes.php index a299822..74c04e9 100755 --- a/includes/routes.php +++ b/includes/routes.php @@ -61,10 +61,9 @@ if($notfound) { require_once($config['models_folder']."d.wiki.php"); $wikiPage = new WikiPage(); $wikiPage->checkUrl('404'); - $wikiPage->populate(); $wikiPage->md2html(); $head['css'] = "d.index.css;d.wiki.css"; - $head['title'] = $wikiPage->title; + $head['title'] = $wikiPage->name; include ($config['views_folder']."d.wiki.view.html"); } diff --git a/models/d.wiki.php b/models/d.wiki.php index f8046d6..f428edc 100755 --- a/models/d.wiki.php +++ b/models/d.wiki.php @@ -27,7 +27,7 @@ class WikiPage public $content = NULL; /***** - ** Checks if a page at this URL exists and return the ID + ** Checks if a page at this URL exists and return the populated element *****/ public function checkUrl($url, $withArchive=0, $elementNb=0) { global $config; @@ -37,7 +37,7 @@ class WikiPage $query = "SELECT * FROM contents WHERE permalink=$1"; if($withArchive==0) { - $query .= " AND is_archive=FALSE AND is_public=FALSE"; + $query .= " AND is_archive=FALSE AND is_public=TRUE"; } $query .= " ORDER BY update_date DESC LIMIT 1 OFFSET $2"; @@ -59,7 +59,7 @@ class WikiPage } /***** - ** Populate the object using its ID + ** Populate the object using raw data from SQL *****/ private function populate($row) { $this->permalink = $row['permalink']; @@ -76,6 +76,20 @@ class WikiPage $this->content = $row['content']; } + /***** + ** Return archive status + *****/ + public function is_archive() { + return $this->is_archive; + } + + /***** + ** Return archive status + *****/ + public function update_date() { + return $this->update_date; + } + /***** ** Edit a page by archiving the current one and inserting a new one ID *****/ diff --git a/views/d.wiki.view.html b/views/d.wiki.view.html index 0bf21d0..d6f0992 100755 --- a/views/d.wiki.view.html +++ b/views/d.wiki.view.html @@ -7,15 +7,15 @@ -
archive=="t"?'class="archive"':''?>> -

title?>.

+
is_archive()?'class="archive"':''?>> +

name?>.

role >= 600) { ?> @@ -25,7 +25,7 @@ role >= 800) { ?> Éditer la page - archive == 'f') { ?> + is_archive()) { ?> — Effacer la page @@ -37,7 +37,7 @@ content_html?> -

Page mise à jour le lastedit)) ?> UTC

+

Page mise à jour le update_date())) ?> UTC