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

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

parent 34d2cb92
......@@ -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
......@@ -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
......
......@@ -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);
}
......
......@@ -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
......@@ -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
<?php
if(!isset($admin)){
header("Location:/patate");
header('Location:/patate');
exit();
}
?>
......@@ -19,7 +19,7 @@
<input type="submit" value="Nouveau billet" />
</form>
<?php include("site/view/private/listBlogPostView.php"); ?>
<?php include('site/view/private/listBlogPostView.php'); ?>
</article>
......@@ -31,7 +31,7 @@
</form>
<?php include("site/view/private/listProjectsView.php"); ?>
<?php include('site/view/private/listProjectsView.php'); ?>
</article>
</section>
......
<?php
if(!isset($admin)){
header("Location:/patate");
header('Location:/patate');
exit();
}
......
<?php
if(!isset($admin)){
header("Location:/patate");
header('Location:/patate');
exit();
}
......
<?php
if(!isset($admin)){
header("Location:/patate");
header('Location:/patate');
exit();
}
?>
......
<?php
if(!isset($admin)){
header("Location:/patate");
header('Location:/patate');
exit();
}
?>
......@@ -19,7 +19,7 @@
<article class="input">
<label for="inputDate">Date de publication</label>
<input type="datetime-local" name="time" value="<?php echo $blogpost['datetime']->format("Y-m-d\TH:i:s"); ?>" class="small" id="inputDate" />
<input type="datetime-local" name="time" value="<?php echo $blogpost['datetime']->format('Y-m-d\TH:i:s'); ?>" class="small" id="inputDate" />
</article>
<article class="input">
......@@ -34,7 +34,7 @@
<article class="input">
<label for="inputComments" class="large">Autoriser les commentaires</label>
<input type="checkbox" name="comments" id="inputComments" <?php if($blogpost['comments'] == 1) echo "checked"; ?> />
<input type="checkbox" name="comments" id="inputComments" <?php if($blogpost['comments'] == 1) echo 'checked'; ?> />
</article>
<input type="submit" value="Éditer" />
......
......@@ -7,12 +7,12 @@
$hr = false;
foreach ($blogposts as $post){
$post['datetime'] = new DateTime($post['time']);
$post['link'] = urlencode(str_replace(" ", "-", $post['title']));
$post['link'] = urlencode(str_replace(' ', '-', $post['title']));
if(!$hr)
$hr = true;
else
echo "<hr />";
echo '<hr />';
?>
<article>
<p class="listAdmin">
......
<?php
if(!isset($admin)){
header("Location:/patate");
header('Location:/patate');
exit();
}
$hr = false;
foreach ($projects as $project){
$project['internalLink'] = urlencode(str_replace(" ", "-", $project['name']));
$project['internalLink'] = urlencode(str_replace(' ', '-', $project['name']));
if(!$hr)
$hr = true;
else
echo "<hr />";
echo '<hr />';
?>
<article>
<p class="listAdmin">
......
<?php
if(!isset($admin)){
header("Location:/patate");
header('Location:/patate');
exit();
}
?>
......
<?php
if(!isset($pageName)){
header("Location:/");
header('Location:/');
exit();
}
?>
......
<?php
if(!isset($pageName)){
header("Location:/");
header('Location:/');
exit();
}
$hr = false;
foreach ($blogposts as $blogpost){
$blogpost['link'] = urlencode(str_replace(" ", "-", $blogpost['title']));
$blogpost['link'] = urlencode(str_replace(' ', '-', $blogpost['title']));
$blogpost['datetime'] = new DateTime($blogpost['time']);
if(!$hr)
$hr = true;
else
echo "<hr />";
echo '<hr />';
include("site/view/public/blogPostView.php");
include('site/view/public/blogPostView.php');
}
if(!$hr){
?>
......
<?php
if(!isset($pageName)){
header("Location:/");
header('Location:/');
exit();
}
$project['internalLink'] = urlencode(str_replace(" ", "-", $project['name']));
$project['internalLink'] = urlencode(str_replace(' ', '-', $project['name']));
?>
<article>
<h3><a href="<?php echo $project['link']; ?>"><?php echo $project['name']; ?></a></h3>
......
<?php
if(!isset($pageName)){
header("Location:/");
header('Location:/');
exit();
}
$hr = false;
foreach ($projects as $project){
$project['internalLink'] = urlencode(str_replace(" ", "-", $project['name']));
$project['internalLink'] = urlencode(str_replace(' ', '-', $project['name']));
if(!$hr)
$hr = true;
else
echo "<hr />";
echo '<hr />';
?>
<article>
<h3><a href="<?php echo $project['link']; ?>"><?php echo $project['name']; ?></a></h3>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment