aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2018-03-19 04:06:36 +0100
committervincent-peugnet <v.peugnet@free.fr>2018-03-19 04:06:36 +0100
commit1654358ea4e4c0a100d7e58b1001ece1f908b7b3 (patch)
treec7b5848e5cbe6ff45667751589b71819737f75c0
parentff27ff7217e4ba984ba2f9557a4b7841e7adf61b (diff)
downloadwcms-1654358ea4e4c0a100d7e58b1001ece1f908b7b3.tar.gz
wcms-1654358ea4e4c0a100d7e58b1001ece1f908b7b3.zip
nouveau style
-rw-r--r--class/class.aff.php72
-rw-r--r--class/class.art.php11
-rw-r--r--public/css/style.css59
-rw-r--r--public/w/index.php45
4 files changed, 121 insertions, 66 deletions
diff --git a/class/class.aff.php b/class/class.aff.php
index 2558c24..d9bb56b 100644
--- a/class/class.aff.php
+++ b/class/class.aff.php
@@ -5,7 +5,7 @@ class Aff
private $session;
- private static $edit = 2;
+ private static $edit = 2;
// ____________________________________________________ F U N ______________________________________________
@@ -17,14 +17,14 @@ class Aff
public function lecture(Art $art)
{
- if($art->secure() == 1) {
+ if ($art->secure() == 1) {
echo '<span class="alert"><h4>cet article est privé</h4></span>';
}
- if($art->secure() == 2) {
+ if ($art->secure() == 2) {
echo "<span class=\"alert\"><h4>cet article n'est pas publié</h4></span>";
}
-
- if ($this->session() >= $art->secure()) {
+
+ if ($this->session() >= $art->secure()) {
?>
<style type="text/css">
article {
@@ -48,10 +48,10 @@ class Aff
}
public function edit(Art $art)
- {
- if ($this->session() >= self::$edit) {
+ {
+ if ($this->session() >= self::$edit) {
- ?>
+ ?>
<article>
<form class="edit" action="?id=<?= $art->id() ?>" method="post">
<input type="submit" value="modifier">
@@ -88,42 +88,44 @@ class Aff
<?php
- }
+}
- }
+}
- public function head($title) {
- ?>
+public function head($title)
+{
+ ?>
<head>
<meta charset="utf8" />
<link href="/css/style.css" rel="stylesheet" />
<title><?= $title ?></title>
</head>
<?php
+
}
public function home($list)
{
echo '<ul>';
- foreach ($list as $item) {
+ foreach ($list as $item) {
echo '<li><a href="?id=' . $item['id'] . '">' . $item['titre'] . '</a> - ' . $item['intro'];
if ($this->session() >= 2) {
echo ' - <a href="?id=' . $item['id'] . '&edit=1">modifier</a></li>';
} else {
echo '</li>';
- }
- }
- echo ' </ul> ';
+ }
+ }
+ echo ' </ul> ';
}
public function aside($list)
{
if ($this->session() >= 2) {
echo '<aside><ul>';
- foreach ($list as $item) {
- echo '<li><a href="?id=' . $item['id'] . '&edit=1">' . $item['titre'] . '</a> - <code>[' . $item['titre'] . '](?id=' . $item['id'].')</code>';
-
-
+ foreach ($list as $item) {
+ echo '<li><a href="?id=' . $item['id'] . '&edit=1">' . $item['titre'] . '</a> - <code>[' . $item['titre'] . '](?id=' . $item['id'] . ')</code>';
+
+
}
echo ' </ul></aside> ';
}
@@ -134,28 +136,30 @@ class Aff
?>
<nav>
<?= $this->session() ?>
+ </br>
<a href="?" >home</a>
+ </br>
<?php
if ($this->session() >= 1) {
- if(isset($_GET['id'])){
- ?>
+ if (isset($_GET['id'])) {
+ ?>
<form action="?id=<?= $_GET['id'] ?>" method="post">
<input type="hidden" name="action" value="logout">
<input type="submit" value="disconnect">
</form>
<?php
- }
- if(isset($_GET['id']) AND $app->exist($_GET['id']) AND $this->session() == 2)
- {
- ?>
- <a href="?id=<?= $_GET['id'] ?>&display=1" target="_blank">display</a>
+
+ }
+ if (isset($_GET['id']) and $app->exist($_GET['id']) and $this->session() == 2) {
+ ?>
+ <a href="?id=<?= $_GET['id'] ?>" target="_blank">display</a>
+ </br>
<a href="?id=<?= $_GET['id'] ?>&edit=1" >edit</a>
<?php
+
}
- }
- else
- {
- if(isset($_GET['id'])){
+ } else {
+ if (isset($_GET['id'])) {
?>
<form action="?id=<?= $_GET['id'] ?>" method="post">
<input type="hidden" name="action" value="login">
@@ -163,11 +167,13 @@ class Aff
<input type="submit" value="connect">
</form>
<?php
- }
+
}
- ?>
+ }
+ ?>
</nav>
<?php
+
}
//______________________________________________________ S E T _________________________________________________
diff --git a/class/class.art.php b/class/class.art.php
index 54fa28d..cc7a0d0 100644
--- a/class/class.art.php
+++ b/class/class.art.php
@@ -1,6 +1,8 @@
<?php
use Michelf\Markdown;
+use Michelf\MarkdownExtra;
+
class Art
{
@@ -51,7 +53,7 @@ class Art
$this->setintro('resumé');
$this->settag('sans tag,');
$this->setdatecreation($now);
- $this->setcss('');
+ $this->setcss('article {}');
$this->sethtml('contenu');
$this->setsecure(2);
$this->setcouleurtext('#000000');
@@ -111,13 +113,14 @@ class Art
}
public function html($option)
- {
+ {
if ($option == 'md') {
return $this->html;
} elseif ($option == 'html') {
- return Markdown::defaultTransform($this->html);
+ $html = MarkdownExtra::defaultTransform($this->html);
+ $htmla = str_replace('class="b"', ' target="_blank" ', $html);
+ return $htmla;
}
- // return $this->html;
}
public function secure()
diff --git a/public/css/style.css b/public/css/style.css
index 245258c..54326c9 100644
--- a/public/css/style.css
+++ b/public/css/style.css
@@ -1,10 +1,14 @@
body {
- background-color: #dcdcdceb;
-
+ background-color: #dcdcdceb;
+ font-family: helvetica, arial, sans-serif;
+ margin: 0px;
}
h1 {
font-size: 3em;
+ font-variant: all-small-caps;
+ margin-top: 0px;
+ margin-bottom: 0px;
}
h2 {
@@ -16,7 +20,15 @@ h3 {
}
p{
- font-size: 1.1em;
+ font-size: 1em;
+}
+
+article {
+ text-align: justify;
+ padding: 3%;
+}
+
+article p{
}
article input, textarea, select {
@@ -47,13 +59,13 @@ aside {
right: -300px;
padding: 7px;
z-index: 5;
- background: coral;
+ background: #6c7d8a;
opacity: 0.3;
width: 350px;
}
aside:hover {
- opacity: 0.9;
+ opacity: 1;
right: 0px;
}
@@ -63,17 +75,46 @@ nav {
right: -50px;
padding: 7px;
z-index: 10;
- background: #5085ff;
+ background: #6c7d8a;
opacity: 0.3;
- width:100px;
+ width:100px;
+ border-width: 4px;
+ border-style: outset;
}
nav:hover {
- opacity: 0.9;
- right: 0px;
+ opacity: 1;
+ right: -5px;
}
.alert h4 {
background-color: red;
margin: 0px;
+}
+
+nav a {
+ color: black;
+ padding: 1px 4px;
+ font-size: 13px;
+ background-color: #bfbfbf;
+ /* text-rendering: auto; */
+ /* color: initial; */
+ /* letter-spacing: normal; */
+ /* word-spacing: normal; */
+ /* text-transform: none; */
+ text-indent: 0px;
+ text-decoration: none;
+ /* text-shadow: none; */
+ /* display: inline-block; */
+ /* -webkit-appearance: push-button; */
+ align-items: flex-start;
+ text-align: center;
+ cursor: default;
+ /* color: buttontext; */
+ /* background-color: buttonface; */
+ box-sizing: border-box;
+ /* padding: 2px 6px 3px; */
+ border-width: 2px;
+ border-color: lightgrey;
+ border-style: outset;
} \ No newline at end of file
diff --git a/public/w/index.php b/public/w/index.php
index 2dd33c0..f12e7f4 100644
--- a/public/w/index.php
+++ b/public/w/index.php
@@ -8,14 +8,19 @@
$config = require('../../config.php');
require('../../vendor/autoload.php');
use Michelf\Markdown;
+use Michelf\MarkdownExtra;
+
require('../../fn/fn.php');
require('../../class/class.art.php');
require('../../class/class.app.php');
require('../../class/class.aff.php');
session();
-$level = 0;
-$level = $_SESSION['level'];
+if (!isset($_SESSION['level'])) {
+ $level = 0;
+} else {
+ $level = $_SESSION['level'];
+}
$app = new App($config);
$aff = new Aff($level);
@@ -24,26 +29,26 @@ $aff = new Aff($level);
if (isset($_POST['action'])) {
switch ($_POST['action']) {
-
+
case 'update':
- if ($app->exist($_GET['id'])) {
- $art = new Art($_POST);
- $app->update($art);
- header('Location: ?id=' . $art->id() . '&edit=1');
- }
- break;
-
- case 'login' :
- $_SESSION['level'] = $app->login($_POST['pass']);
- header('Location: ?id=' . $_GET['id']);
- break;
-
- case 'logout' :
- $_SESSION['level'] = $app->logout();
- header('Location: ?id=' . $_GET['id']);
- break;
+ if ($app->exist($_GET['id'])) {
+ $art = new Art($_POST);
+ $app->update($art);
+ header('Location: ?id=' . $art->id() . '&edit=1');
+ }
+ break;
+
+ case 'login':
+ $_SESSION['level'] = $app->login($_POST['pass']);
+ header('Location: ?id=' . $_GET['id']);
+ break;
+
+ case 'logout':
+ $_SESSION['level'] = $app->logout();
+ header('Location: ?id=' . $_GET['id']);
+ break;
}
-
+
}