Commit 4e808c2a authored by Corentin Bettiol's avatar Corentin Bettiol 💻
Browse files

add comments

parent 2d644dcd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@ function writeBlogPage($pageName){
			$blogpost = $blog->get($_GET['title']);
			if($blogpost != false){

				// articles précédant/suivant
				// articles précédent/suivant
				//$paging = $blog->pagingSingle($_GET['title']);
				//require('site/view/publie/blogPostPagingView.php')

+13 −5
Original line number Diff line number Diff line
@@ -63,17 +63,25 @@ class BlogManager extends Base

		$limit = 2; // afficher deux pages avant & deux pages après
		
		// on part d'un peu avant current, on va jusqu'à current
		for($i = $current-$limit; $i < $current; $i++)
			// si on est pas sur une page négative
			if($i > 0)
				// on ajoute cette page à la liste des pages avant
				array_push($before, $i);

		// on part de la page suivant current, et on va jusqu'à nbPages+1
		for($i = $current+1; $i < $nbPages+1; $i++)
			// si on dépasse pas trop
			if($i < $current+$limit+1)
				// on ajout cette page à la liste des pages après
				array_push($after, $i);

		// si la page courante est loin de la première page, on active le lien sur la flêche gauche
		if($current-$limit > 1)
			$first = true;

		// si la page courante est loin de la dernière page, on active le lien sur la flêche droite
		if($current+$limit < $nbPages)
			$last = $nbPages;

@@ -92,8 +100,9 @@ class BlogManager extends Base
		]);
	}

	// envoi d'un post de blog
	public function send(){
		if($this->time == ''){
		if(strlen($this->time) < 1){
			$this->time = new datetime();
			$this->time = $this->time->format('Y-m-d H:i:s');
		}
@@ -101,9 +110,8 @@ class BlogManager extends Base
			header('Location:/patate');
			exit();
		}
		if(strlen($this->shortContent) < 1){
		if(strlen($this->shortContent) < 1)
			$this->shortContent = 'Ce billet de blog ne dispose d\'aucune description.';
		}

		$this->slug = $this->slugify($this->title, "blog");

@@ -117,7 +125,7 @@ class BlogManager extends Base
		]);
	}


	// suppression d'un post de blog
	public function delete($link){
		$link = htmlspecialchars($link);

+7 −1
Original line number Diff line number Diff line
@@ -6,26 +6,32 @@
?>
<nav id="paging">
<?php

	// flèche gauche
	if($paging['first'])
		echo '<a href="/page/1" title="Première page du blog">⬅️</a>';
	else
		echo '<em>⬅️</em>';

	// pages précédentes
	for($i = 0; $i < 2 - count($paging['before']); $i++)
		echo '<span></span>';

	foreach ($paging['before'] as $b)
		echo '<a href="/page/'. $b .'" title="Page '. $b .' du blog">'. $b .'</a>';
	
	// page courante
	echo '<em class="current">'. $paging['current']. '</em>';


	// pages suivantes
	foreach ($paging['after'] as $a)
		echo '<a href="/page/'. $a .'" title="Page '. $a .' du blog">'. $a .'</a>';


	for($i = 0; $i < 2 - count($paging['after']); $i++)
		echo "<span></span>";

	// flèche droite
	if($paging['last'])
		echo '<a href="/page/'. $paging['last'] .'" title="Dernière page du blog">➡️</a>';
	else