Commit ebe5a9ea authored by Corentin Bettiol's avatar Corentin Bettiol 💻
Browse files

replace " by ' in all files, replace 'array()' by '[]' in Managers.

parent 34d2cb92
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -4,9 +4,9 @@
session_start();

// le gros gros controlleur (peut-être le casser en plusieurs morceaux plus tard)
require_once("site/controller/mainController.php");
require_once('site/controller/mainController.php');

// afficher le contenu (qui va switcher sur le contenu dynamique à afficher)
require_once("site/layout/layout.php");
require_once('site/layout/layout.php');

?>
 No newline at end of file
+5 −5
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@
			writeBlogPage($pageName); // voir mainController
			break;
		case 'about': // à propos
			require("site/view/public/about.php"); // statique
			require('site/view/public/about.php'); // statique
			break;
		case 'projects': // projets
			writeProjectsPage($pageName); // voir mainController
@@ -51,16 +51,16 @@
		case 'eplucher': // déconnexion du panneau d'administration
			decoAdminPage(); // voir mainController
		case 'contact': // contact
			require("site/view/public/contact.php"); // statique
			require('site/view/public/contact.php'); // statique
			break;
		case 'changelog': // historique de développement
			require("site/view/public/changelog.php"); // statique
			require('site/view/public/changelog.php'); // statique
			break;
		case 'rss': // rss
			require("site/view/public/rss.php"); // todo
			require('site/view/public/rss.php'); // todo
			break;
		case '404': // page not found
			require("site/view/public/404.php"); // statique
			require('site/view/public/404.php'); // statique
			break;
		case 'administration': // panneau d'administration (url = patate)
			// si on envoie les données en post
+4 −4
Original line number Diff line number Diff line
@@ -17,13 +17,13 @@ class AdminManager extends Base

	public function getBlogPost($link)
	{
		$blogpost = new BlogManager(NULL, NULL, NULL, NULL, NULL, NULL); // moche :c
		$blogpost = new BlogManager(null, null, null, null, null, null); // moche :c
		return $blogpost->get($link);
	}

	public function getProject($link)
	{
        $project = new ProjectManager(NULL,NULL,NULL,NULL,NULL); // moche :c
        $project = new ProjectManager(null,null,null,null,null); // moche :c
        return $project->get($link);
	}

@@ -54,12 +54,12 @@ class AdminManager extends Base
	}

	public function deleteBlogPost($link){
		$blog = new BlogManager(NULL, NULL, NULL, NULL, NULL, NULL);
		$blog = new BlogManager(null, null, null, null, null, null);
		$blog->deleteBlogPost($link);
	}

	public function deleteProject($link){
		$project = new ProjectManager(NULL, NULL, NULL, NULL, NULL);
		$project = new ProjectManager(null, null, null, null, null);
		$project->deleteProject($link);
	}

+14 −14
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ class BlogManager extends Base
		$this->title = htmlspecialchars($title);
		$this->content = htmlspecialchars($content);
		$this->shortContent = htmlspecialchars($shortContent);
		if($comments == "on")
		if($comments == 'on')
			$this->comments = 1;
		else
			$this->comments = 0;
@@ -37,17 +37,17 @@ class BlogManager extends Base

		$link = htmlspecialchars($link);

		$title = str_replace("-", " ", $link);
		$title = str_replace('-', ' ', $link);

		$db = $this->dbConnect();
		$req = $db->prepare('SELECT * FROM l3m_blog WHERE title = ?');
		$req->execute(array($title));
		$req->execute([$title]);
		$post = $req->fetch();

		if($post == false)
			return false;

		$post["link"] = urlencode($link);
		$post['link'] = urlencode($link);
		$post['datetime'] = new DateTime($post['time']);

		return $post;
@@ -57,48 +57,48 @@ class BlogManager extends Base
	public function update(){
		$db = $this->dbConnect();
		$req = $db->prepare('UPDATE l3m_blog SET time = :time, title = :title, content = :content, shortContent = :shortContent, comments = :comments WHERE id = :id');
		$req->execute(array(
		$req->execute([
			'time' => $this->time,
			'title' => $this->title,
			'content' => $this->content,
			'shortContent' => $this->shortContent,
			'comments' => $this->comments,
			'id' => $this->id
		));
		]);
	}

	public function send(){

		if($this->time == ""){
		if($this->time == ''){
			$this->time = new datetime();
			$this->time = $this->time->format('Y-m-d H:i:s');
		}
		if(strlen($this->title) < 1){
			header("Location:/patate");
			header('Location:/patate');
			exit();
		}
		if(strlen($this->shortContent) < 1){
			$this->shortContent = "Ce billet de blog ne dispose d'aucune description.";
			$this->shortContent = 'Ce billet de blog ne dispose d\'aucune description.';
		}
		$db = $this->dbConnect();
		$req = $db->prepare('INSERT INTO l3m_blog(time, title, content, shortcontent, comments) VALUES(:time, :title, :content, :shortContent, :comments)');
		$req->execute(array(
		$req->execute([
			'time' => $this->time,
			'title' => $this->title,
			'content' => $this->content,
			'shortContent' => $this->shortContent,
			'comments' => $this->comments
		));
		]);
	}


	public function delete($link){
		$title = str_replace("-", " ", $link);
		$title = str_replace('-', ' ', $link);

		$db = $this->dbConnect();
		$req = $db->prepare('DELETE FROM l3m_blog WHERE title = :title');
		$req->execute(array(
		$req->execute([
			'title' => $title
		));
		]);
	}
}
 No newline at end of file
+11 −11
Original line number Diff line number Diff line
@@ -26,11 +26,11 @@ class ProjectManager extends Base
	public function get($link)
	{
		$link = htmlspecialchars($link);
		$name = str_replace("-", " ", $link);
		$name = str_replace('-', ' ', $link);

		$db = $this->dbConnect();
		$req = $db->prepare('SELECT * FROM l3m_projects WHERE name = ?');
		$req->execute(array($name));
		$req->execute([$name]);
		$project = $req->fetch();

		if($project == false)
@@ -43,40 +43,40 @@ class ProjectManager extends Base
	public function update(){
		$db = $this->dbConnect();
		$req = $db->prepare('UPDATE l3m_projects SET name = :name, link = :link, content = :content, shortContent = :shortContent WHERE id = :id');
		$req->execute(array(
		$req->execute([
			'name' => $this->name,
			'link' => $this->link,
			'content' => $this->content,
			'shortContent' => $this->shortContent,
			'id' => $this->id
		));
		]);
	}

	public function send(){
		if(strlen($this->name) < 1){
			header("Location:/patate");
			header('Location:/patate');
			exit();
		}
		if(strlen($this->shortContent) < 1){
			$this->shortContent = "Pas de description.";
			$this->shortContent = 'Pas de description.';
		}
        $db = $this->dbConnect();
        $req = $db->prepare('INSERT INTO l3m_projects(name, link, content, shortcontent) VALUES(:name, :link, :content, :shortContent)');
        $req->execute(array(
        $req->execute([
			'name' => $this->name,
			'link' => $this->link,
			'content' => $this->content,
			'shortContent' => $this->shortContent
        ));
        ]);
	}

	public function delete($link){
		$title = str_replace("-", " ", $link);
		$title = str_replace('-', ' ', $link);

		$db = $this->dbConnect();
		$req = $db->prepare('DELETE FROM l3m_projects WHERE name = :name');
		$req->execute(array(
		$req->execute([
			'name' => $title
		));
		]);
	}
}
 No newline at end of file
Loading