From 1b6f5e650fa774cda77d511bf4cbdc638a2b42f6 Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Thu, 12 Apr 2018 16:54:59 +0200 Subject: delete_update_media_blank --- .gitignore | 4 +- class/class.aff.php | 109 ++++++++++++++++++++++++++++++++++----------------- class/class.app.php | 6 ++- class/class.art.php | 23 +++++++++-- fn/fn.php | 5 ++- public/css/style.css | 28 ++++++++++++- public/media/vac.png | Bin 0 -> 941802 bytes public/w/index.php | 23 +++++++++-- 8 files changed, 152 insertions(+), 46 deletions(-) create mode 100644 public/media/vac.png diff --git a/.gitignore b/.gitignore index 19c393f..a027495 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ vendor/* -config.php \ No newline at end of file +config.php +error_log +w/img/* diff --git a/class/class.aff.php b/class/class.aff.php index 46402f4..16d77ca 100644 --- a/class/class.aff.php +++ b/class/class.aff.php @@ -35,11 +35,15 @@ class Aff a { color: couleurlien() ?>; } + + a[target="_blank"] { + color: couleurlienblank() ?>; + } css() ?>

titre() ?>

-

soustitre() ?>

+
soustitre() ?>

html('html') ?>

-
- + @@ -77,12 +80,16 @@ class Aff + + - - +
+ + +
@@ -97,6 +104,7 @@ public function head($title) ?> + <?= $title ?> @@ -109,16 +117,25 @@ public function head($title) public function home($list) { - echo ' '; } public function tag($getlist, $tag) @@ -156,40 +173,62 @@ public function head($title) bdd->prepare('INSERT INTO art(id, titre, soustitre, intro, tag, datecreation, datemodif, css, html, secure, couleurtext, couleurbkg, couleurlien) VALUES(:id, :titre, :soustitre, :intro, :tag, :datecreation, :datemodif, :css, :html, :secure, :couleurtext, :couleurbkg, :couleurlien)'); + $q = $this->bdd->prepare('INSERT INTO art(id, titre, soustitre, intro, tag, datecreation, datemodif, css, html, secure, couleurtext, couleurbkg, couleurlien, couleurlienblank) VALUES(:id, :titre, :soustitre, :intro, :tag, :datecreation, :datemodif, :css, :html, :secure, :couleurtext, :couleurbkg, :couleurlien, :couleurlienblank)'); $q->bindValue(':id', $art->id()); $q->bindValue(':titre', $art->titre()); @@ -41,6 +41,7 @@ class App $q->bindValue(':couleurtext', $art->couleurtext()); $q->bindValue(':couleurbkg', $art->couleurbkg()); $q->bindValue(':couleurlien', $art->couleurlien()); + $q->bindValue(':couleurlienblank', $art->couleurlienblank()); $q->execute(); } @@ -104,7 +105,7 @@ class App { $now = new DateTimeImmutable(null, timezone_open("Europe/Paris")); - $q = $this->bdd->prepare('UPDATE art SET titre = :titre, soustitre = :soustitre, intro = :intro, tag = :tag, datecreation = :datecreation, datemodif = :datemodif, css = :css, html = :html, secure = :secure, couleurtext = :couleurtext, couleurbkg = :couleurbkg, couleurlien = :couleurlien WHERE id = :id'); + $q = $this->bdd->prepare('UPDATE art SET titre = :titre, soustitre = :soustitre, intro = :intro, tag = :tag, datecreation = :datecreation, datemodif = :datemodif, css = :css, html = :html, secure = :secure, couleurtext = :couleurtext, couleurbkg = :couleurbkg, couleurlien = :couleurlien, couleurlienblank = :couleurlienblank WHERE id = :id'); $q->bindValue(':id', $art->id()); $q->bindValue(':titre', $art->titre()); @@ -119,6 +120,7 @@ class App $q->bindValue(':couleurtext', $art->couleurtext()); $q->bindValue(':couleurbkg', $art->couleurbkg()); $q->bindValue(':couleurlien', $art->couleurlien()); + $q->bindValue(':couleurlienblank', $art->couleurlienblank()); $q->execute(); } diff --git a/class/class.art.php b/class/class.art.php index 897cd0b..f945767 100644 --- a/class/class.art.php +++ b/class/class.art.php @@ -53,7 +53,8 @@ class Art $this->setintro('resumé'); $this->settag('sans tag,'); $this->setdatecreation($now); - $this->setcss('article {}'); + $this->setcss('article {} +a:hover {}'); $this->sethtml('contenu'); $this->setsecure(2); $this->setcouleurtext('#000000'); @@ -123,8 +124,11 @@ class Art return $this->html; } elseif ($option == 'html') { $html = MarkdownExtra::defaultTransform($this->html); - $htmla = str_replace('class="b"', ' target="_blank" ', $html); - return $htmla; + $htmla = str_replace('href="http://', ' class="external" target="_blank" href="http://', $html); + + $htmla = str_replace('class="b"', ' target="_blank" ', $htmla); + $htmlmedia = str_replace('src="/', 'src="../media/', $htmla); + return $htmlmedia; } } @@ -148,6 +152,11 @@ class Art return $this->couleurlien; } + public function couleurlienblank() + { + return $this->couleurlienblank; + } + // _____________________________________________________ S E T ____________________________________________________ @@ -252,6 +261,14 @@ class Art } } + public function setcouleurlienblank($couleurlienblank) + { + $couleurlienblank = strval($couleurlienblank); + if (strlen($couleurlienblank) <= self::$lencouleur) { + $this->couleurlienblank = strip_tags(trim($couleurlienblank)); + } + } + } diff --git a/fn/fn.php b/fn/fn.php index d42b7e8..79007ef 100644 --- a/fn/fn.php +++ b/fn/fn.php @@ -21,14 +21,17 @@ function secure() } } -function head($title) { +function head($title) +{ ?> + <?= $title ?> diff --git a/public/css/style.css b/public/css/style.css index 163ca7d..5cdb822 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -19,6 +19,10 @@ h3 { opacity: 0.7; } +h6 { + font-size: 1em; +} + p{ font-size: 1em; } @@ -27,6 +31,14 @@ em { opacity: 0.8; } +a{ + text-decoration: none; +} + +a:hover{ + text-decoration: underline; +} + img { width: 90%; max-width: 1000px; @@ -38,10 +50,16 @@ article { line-height: 1.2em; } -article .edit { +.edit { text-align: left; + padding-top: 1%; + padding-bottom: 1%; + padding-left: 8%; + padding-right: 8%; + line-height: 1.2em; } + article input, textarea, select { width: 90%; padding-left: 15px; @@ -52,6 +70,7 @@ article input, textarea, select { height: 30px; border-style: unset; } + #html{ height: 1000px; } @@ -128,4 +147,11 @@ nav a { border-width: 2px; border-color: lightgrey; border-style: outset; +} + +.submit { + position: fixed; + top: 0px; + left: 0px; + width: 8%; } \ No newline at end of file diff --git a/public/media/vac.png b/public/media/vac.png new file mode 100644 index 0000000..569f539 Binary files /dev/null and b/public/media/vac.png differ diff --git a/public/w/index.php b/public/w/index.php index 93d9f46..0a153b0 100644 --- a/public/w/index.php +++ b/public/w/index.php @@ -38,15 +38,33 @@ if (isset($_POST['action'])) { } break; + case 'delete': + if ($app->exist($_GET['id'])) { + $art = new Art($_POST); + $app->delete($art); + header('Location: ?id=' . $art->id()); + } + break; + + case 'login': $_SESSION['level'] = $app->login($_POST['pass']); - header('Location: ?id=' . $_GET['id']); + if (isset($_GET['id'])) { + header('Location: ?id=' . $_GET['id']); + } else { + header('Location: ?'); + } break; case 'logout': $_SESSION['level'] = $app->logout(); - header('Location: ?id=' . $_GET['id']); + if (isset($_GET['id'])) { + header('Location: ?id=' . $_GET['id']); + } else { + header('Location: ?'); + } break; + } } @@ -111,7 +129,6 @@ if (isset($_GET['id'])) { $aff->tag($app->getlister(), $_GET['tag']); } else { - echo "

Bienvenue sur ce site.

"; $aff->home($app->lister()); } echo ''; -- cgit v1.2.3