Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
l3m-website
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Corentin Bettiol
l3m-website
Commits
d38afd22
Commit
d38afd22
authored
Jan 13, 2019
by
Corentin Bettiol
💻
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add basic admin view
parent
2ae140cc
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
149 additions
and
22 deletions
+149
-22
css/design.css
css/design.css
+40
-8
index.php
index.php
+2
-0
site/controller/mainController.php
site/controller/mainController.php
+38
-6
site/layout/layout.php
site/layout/layout.php
+12
-1
site/model/BlogManager.php
site/model/BlogManager.php
+7
-3
site/model/config-dist.php
site/model/config-dist.php
+8
-1
site/view/private/admin.php
site/view/private/admin.php
+14
-0
site/view/private/loginFormView.php
site/view/private/loginFormView.php
+15
-0
site/view/public/404.php
site/view/public/404.php
+1
-1
site/view/public/changelog.php
site/view/public/changelog.php
+11
-1
urlrewriting.txt
urlrewriting.txt
+1
-1
No files found.
css/design.css
View file @
d38afd22
...
...
@@ -25,10 +25,10 @@ CSS
font-family
:
ubuntumono
;
background-color
:
#f0f0f0
;
padding
:
2px
;
border-bottom
:
5px
solid
#ccc
ccc
;
border-bottom
:
5px
solid
#ccc
;
}
article
p
,
#pageTitle
,
article
h3
,
article
ul
{
article
p
,
#pageTitle
,
article
h3
,
article
ul
,
article
form
{
max-width
:
1500px
;
margin
:
30px
auto
;
}
...
...
@@ -63,7 +63,6 @@ h2{
font-size
:
1.5em
;
}
h3
a
{
text-decoration
:
none
;
text-shadow
:
0
0
1px
#69f
;
...
...
@@ -106,12 +105,9 @@ article{
background-color
:
#f0f0f0
;
}
section
{
}
#listMenu
.selected
{
padding-bottom
:
2px
;
border-bottom
:
5px
solid
#ccc
ccc
;
border-bottom
:
5px
solid
#ccc
;
}
article
.postInfos
{
...
...
@@ -129,7 +125,7 @@ article .postInfos{
hr
{
width
:
66%
;
border
:
1px
solid
#
CFCFCF
;
border
:
1px
solid
#
ccc
;
}
a
{
...
...
@@ -141,6 +137,42 @@ a:hover{
transition
:
color
0.3s
;
}
input
{
width
:
50%
;
display
:
block
;
box-sizing
:
border-box
;
margin
:
15px
auto
;
padding
:
10px
;
font-size
:
1em
;
}
input
[
type
=
"text"
],
input
[
type
=
"password"
]
{
background-color
:
white
;
border
:
none
;
padding-left
:
13px
;
border-bottom
:
3px
solid
#ccc
;
border-left
:
0px
solid
#ccc
;
transition
:
border-left
0.05s
,
padding-left
0.05s
;
}
input
[
type
=
"text"
]
:hover
,
input
[
type
=
"password"
]
:hover
,
input
[
type
=
"text"
]
:focus
,
input
[
type
=
"password"
]
:focus
{
border-left
:
3px
solid
#ccc
;
padding-left
:
10px
;
transition
:
border-left
0.05s
,
padding-left
0.05s
;
}
input
[
type
=
"submit"
]
{
background-color
:
#ccc
;
border
:
none
;
transition
:
background-color
0.3s
;
}
input
[
type
=
"submit"
]
:hover
{
background-color
:
#ddd
;
transition
:
background-color
0.3s
;
}
/*
====
...
...
index.php
View file @
d38afd22
<?php
session_start
();
require_once
(
"site/controller/mainController.php"
);
require_once
(
"site/layout/layout.php"
);
...
...
site/controller/mainController.php
View file @
d38afd22
<?php
ini_set
(
'display_errors'
,
'on'
);
error_reporting
(
E_ALL
|
E_STRICT
);
require_once
(
"site/model/config.php"
);
require_once
(
"site/model/Base.php"
);
...
...
@@ -31,6 +29,12 @@ function getPageName(){
case
'article'
:
return
[
$_GET
[
'title'
],
$_GET
[
'title'
]];
break
;
case
'patate'
:
return
[
"Administration"
,
"administration"
];
break
;
case
'eplucher'
:
return
[
"prout hihi"
,
"eplucher"
];
break
;
default
:
return
[
"Blog"
,
"blog"
];
break
;
...
...
@@ -44,6 +48,7 @@ function getPageName(){
function
writeMenu
(
$pageName
){
?>
<ul
id=
"listMenu"
>
<?php
if
(
$pageName
==
"Administration"
){
?>
<li><h2><a
href=
"/eplucher"
class=
"selected"
>
🔧
</a></h2></li>
<?php
}
?>
<li><h2><a
href=
"/"
title=
"Blog"
<?php
if
(
$pageName
==
"Blog"
){
?>
class=
"selected"
<?php
}
?>
>
Blog
</a></h2></li>
<li><h2><a
href=
"/about"
title=
"À propos"
<?php
if
(
$pageName
==
"À Propos"
){
?>
class=
"selected"
<?php
}
?>
>
À propos
</a></h2></li>
<li><h2><a
href=
"/projects"
title=
"Projets"
<?php
if
(
$pageName
==
"Projets"
){
?>
class=
"selected"
<?php
}
?>
>
Projets
</a></h2></li>
...
...
@@ -51,8 +56,6 @@ function writeMenu($pageName){
</ul>
<?php
}
function
writeBlogPage
(
$pageName
){
if
(
$pageName
[
1
]
==
"blog"
){
...
...
@@ -67,7 +70,7 @@ function writeBlogPage($pageName){
header
(
"Location:/404"
);
}
else
{
$blogposts
=
$blog
->
getBlog
();
$blogposts
=
$blog
->
getBlog
(
0
);
require
(
"site/view/public/blogView.php"
);
}
}
...
...
@@ -82,6 +85,35 @@ function writeProjectsPage($pageName){
require
(
"site/view/public/projectsView.php"
);
}
function
loginAdminPage
(
$pageName
){
if
(
password_verify
(
$_POST
[
'pass'
],
pass
)
&&
$_POST
[
'user'
]
==
user
){
$_SESSION
[
'user'
]
=
$_POST
[
'user'
];
$_SESSION
[
'pass'
]
=
$_POST
[
'pass'
];
header
(
"Location:/patate"
);
}
else
echo
"nan"
;
}
function
writeAdminPage
(
$pageName
){
if
(
verifyAdminConnect
())
require
(
"site/view/private/admin.php"
);
else
{
require
(
"site/view/private/loginFormView.php"
);
}
}
function
verifyAdminConnect
(){
return
isset
(
$_SESSION
[
'user'
])
&&
$_SESSION
[
'user'
]
==
user
&&
isset
(
$_SESSION
[
'pass'
])
&&
password_verify
(
$_SESSION
[
'pass'
],
pass
);
}
function
decoAdminPage
(){
$_SESSION
=
array
();
header
(
"Location:/"
);
}
$pageName
=
getPageName
();
$pageName
=
getPageName
();
\ No newline at end of file
site/layout/layout.php
View file @
d38afd22
...
...
@@ -55,6 +55,17 @@
case
'404'
:
require
(
"site/view/public/404.php"
);
break
;
case
'administration'
:
if
(
isset
(
$_POST
[
'user'
])
&&
isset
(
$_POST
[
'pass'
])){
loginAdminPage
(
$pageName
);
}
else
{
writeAdminPage
(
$pageName
);
}
break
;
case
'eplucher'
:
decoAdminPage
();
break
;
default
:
# code...
...
...
@@ -65,7 +76,7 @@
<footer
id=
"footer"
>
<p>
Site
créé par Corentin Bettiol
-
<a
href=
"/changelog"
title=
"changelog"
>
Changelog
</a>
-
<a
href=
"/rss"
title=
"rss"
>
RSS
</a>
- v5
Site
en vanilla html5/css3/php7, fait avec ♥
-
<a
href=
"/changelog"
title=
"changelog"
>
Changelog
</a>
-
<a
href=
"/rss"
title=
"rss"
>
RSS
</a>
- v5
</p>
</footer>
...
...
site/model/BlogManager.php
View file @
d38afd22
<?php
class
BlogManager
extends
Base
{
public
function
getBlog
()
public
function
getBlog
(
$page
)
{
$start
=
$page
*
5
;
$stop
=
$start
+
5
;
$db
=
$this
->
dbConnect
();
$req
=
$db
->
query
(
'SELECT * FROM l3m_blog ORDER BY id DESC LIMIT 0, 5'
);
$req
=
$db
->
prepare
(
'SELECT * FROM l3m_blog ORDER BY id DESC LIMIT '
.
$start
.
', '
.
$stop
.
''
);
$posts
=
$req
->
fetch
();
return
$
req
;
return
$
posts
;
}
public
function
getBlogPost
(
$link
)
...
...
site/model/config-dist.php
View file @
d38afd22
<?php
// config file
// rename this file config.php
// database config
define
(
'dbName'
,
''
);
define
(
'dbUser'
,
''
);
define
(
'dbPass'
,
''
);
\ No newline at end of file
define
(
'dbPass'
,
''
);
// login config
define
(
'user'
,
''
);
define
(
'pass'
,
''
);
\ No newline at end of file
site/view/private/admin.php
0 → 100644
View file @
d38afd22
<article>
<h3>
🔧 Administration
</h3>
<p>
Todo : toutes les fonctionnalités hyper chiadées
&
ultra stylées.
</p>
<nav>
<ul>
<li><a
href=
"/patatedouce/b"
>
Nouveau post du blog
</a></li>
<li><a
href=
"/patatedouce/lb"
>
Lister les articles
</a></li>
<li><a
href=
"/patatedouce/p"
>
Nouveau projet
</a></li>
<li><a
href=
"/patatedouce/lp"
>
Lister les projets
</a></li>
</ul>
</nav>
</article>
\ No newline at end of file
site/view/private/loginFormView.php
0 → 100644
View file @
d38afd22
<article>
<h3>
Connexion à la partie administration du site
</h3>
<p>
Attention au ban ip à partir de deux erreurs !
</p>
<form
action=
"/patate"
method=
"post"
accept-charset=
"utf-8"
>
<input
type=
"text"
name=
"user"
placeholder=
"Pseudonyme"
/>
<input
type=
"password"
name=
"pass"
placeholder=
"Mot de passe"
/>
<input
type=
"submit"
value=
"Connexion"
/>
</form>
</article>
site/view/public/404.php
View file @
d38afd22
...
...
@@ -10,6 +10,6 @@
<div
id=
"videoFond"
>
<video
autoplay
loop
>
<source
type=
"video/mp4"
src=
"/img/CloudsLoop.mp4"
media=
"(orientation: landscape)"
>
<source
type=
"video/mp4"
src=
"/img/CloudsLoop.mp4"
media=
"(orientation: landscape)"
/
>
</video>
</div>
\ No newline at end of file
site/view/public/changelog.php
View file @
d38afd22
<article>
<h3>
12/01/19
</h3>
<h3>
13/01/19
</h3>
<ul>
<li>
Ajout du formulaire au panneau d'administration
</li>
<li>
Stockage du hash du mdp dans le fichier config.php, utilisation de verify_hash() pour la connexion
</li>
<li>
Affichage d'une vue sommaire pour le panneau d'administration
</li>
</ul>
</article>
<article>
<h3><a
href=
"https://git.bitmycode.com/sodimel/l3m-website/commit/2ae140cc39ec43e1a9da520e988fc42d172d29c8"
title=
"commit 2ae140cc"
>
12/01/19
</a></h3>
<ul>
<li>
Modifications mineures css
</li>
...
...
urlrewriting.txt
View file @
d38afd22
RewriteEngine On
RewriteRule /(about|changelog|blog|rss|projects|contact|
login)
/index.php?action=$1
RewriteRule /(about|changelog|blog|rss|projects|contact|
patate|eplucher)$
/index.php?action=$1
RewriteRule /article/([a-zA-Z0-9\-]*)$ /index.php?action=blog&title=$1
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment