aboutsummaryrefslogtreecommitdiff
path: root/class
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2018-04-12 16:54:59 +0200
committervincent-peugnet <v.peugnet@free.fr>2018-04-12 16:54:59 +0200
commit1b6f5e650fa774cda77d511bf4cbdc638a2b42f6 (patch)
treeec560104a579ac0e21de40d1666f3da80bc8862a /class
parent552dd49b00cedb168c95cdf841971e93b0ad678d (diff)
downloadwcms-1b6f5e650fa774cda77d511bf4cbdc638a2b42f6.tar.gz
wcms-1b6f5e650fa774cda77d511bf4cbdc638a2b42f6.zip
delete_update_media_blank
Diffstat (limited to 'class')
-rw-r--r--class/class.aff.php109
-rw-r--r--class/class.app.php6
-rw-r--r--class/class.art.php23
3 files changed, 98 insertions, 40 deletions
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: <?= $art->couleurlien() ?>;
}
+
+ a[target="_blank"] {
+ color: <?= $art->couleurlienblank() ?>;
+ }
<?= $art->css() ?>
</style>
<article>
<h1><?= $art->titre() ?></h1>
- <h2><?= $art->soustitre() ?></h2>
+ <h6><?= $art->soustitre() ?></h6>
<p><?= $art->html('html') ?></p>
</article>
<?php
@@ -53,8 +57,7 @@ class Aff
?>
<article class="edit">
- <form class="edit" action="?id=<?= $art->id() ?>" method="post">
- <input type="submit" value="modifier">
+ <form action="?id=<?= $art->id() ?>" method="post">
<label for="titre">Titre :</label>
<input type="text" name="titre" id="titre" value="<?= $art->titre(); ?>">
<label for="soustitre">Sous-titre :</label>
@@ -77,12 +80,16 @@ class Aff
<input type="color" name="couleurbkg" value="<?= $art->couleurbkg() ?>" id="couleurbkg">
<label for="couleurlien">Couleur des liens :</label>
<input type="color" name="couleurlien" value="<?= $art->couleurlien() ?>" id="couleurlien">
+ <label for="couleurlienblank">Couleur des liens externes :</label>
+ <input type="color" name="couleurlienblank" value="<?= $art->couleurlienblank() ?>" id="couleurlienblank">
<label for="html">Contenu :</label>
<textarea name="html" id="html" ><?= $art->html('md'); ?></textarea>
<input type="hidden" name="datecreation" value="<?= $art->datecreation('string'); ?>">
<input type="hidden" name="id" value="<?= $art->id() ?>">
- <input type="hidden" name="action" value="update">
- <input type="submit" value="modifier">
+ <div class="submit">
+ <input type="submit" name="action" value="update">
+ <input type="submit" name="action" value="delete">
+ </div>
</form>
</article>
@@ -97,6 +104,7 @@ public function head($title)
?>
<head>
<meta charset="utf8" />
+ <meta name="viewport" content="width=device-width" />
<link href="/css/style.css" rel="stylesheet" />
<title><?= $title ?></title>
</head>
@@ -109,16 +117,25 @@ public function head($title)
public function home($list)
{
- echo '<ul>';
- 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>';
+ ?>
+ <form action="./" method="get">
+ <input type="text" name="id" id="id" placeholder="identifiant article" required>
+ <input type="submit" value="accéder">
+ </form>
+ <?php
+
+ if ($this->session() == 2) {
+ echo '<ul>';
+ 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 tag($getlist, $tag)
@@ -156,40 +173,62 @@ public function head($title)
<nav>
<?= $this->session() ?>
</br>
- <a href="?" >home</a>
+ <a href="?">home</a>
+
</br>
<?php
- if ($this->session() >= 1) {
- if (isset($_GET['id'])) {
+
+ if (isset($_GET['id']) and $app->exist($_GET['id'])) {
+ if ($this->session() == 0) {
?>
- <form action="?id=<?= $_GET['id'] ?>" method="post">
- <input type="hidden" name="action" value="logout">
- <input type="submit" value="disconnect">
- </form>
- <?php
+ <form action="?id=<?= $_GET['id'] ?>" method="post">
+ <input type="hidden" name="action" value="login">
+ <input type="password" name="pass" id="pass" placeholder="password">
+ <input type="submit" value="connect">
+ </form>
+ <?php
- }
- if (isset($_GET['id']) and $app->exist($_GET['id']) and $this->session() == 2) {
- ?>
+ }
+ if ($this->session() >= 1) {
+ ?>
+ <form action="?id=<?= $_GET['id'] ?>" method="post">
+ <input type="hidden" name="action" value="logout">
+ <input type="submit" value="disconnect">
+ </form>
+ <?php
+
+ if ($this->session() == 2) {
+ ?>
<a href="?id=<?= $_GET['id'] ?>" target="_blank">display</a>
- </br>
+ </br>
<a href="?id=<?= $_GET['id'] ?>&edit=1" >edit</a>
- <?php
+ <?php
+
+ }
}
} else {
- if (isset($_GET['id'])) {
+ if ($this->session() == 0) {
?>
- <form action="?id=<?= $_GET['id'] ?>" method="post">
- <input type="hidden" name="action" value="login">
- <input type="password" name="pass" id="pass" placeholder="password">
- <input type="submit" value="connect">
- </form>
- <?php
+ <form action="?" method="post">
+ <input type="hidden" name="action" value="login">
+ <input type="password" name="pass" id="pass" placeholder="password">
+ <input type="submit" value="connect">
+ </form>
+ <?php
+
+ }
+ if ($this->session() >= 1) {
+ ?>
+ <form action="?" method="post">
+ <input type="hidden" name="action" value="logout">
+ <input type="submit" value="disconnect">
+ </form>
+ <?php
+ }
}
- }
- ?>
+ ?>
</nav>
<?php
diff --git a/class/class.app.php b/class/class.app.php
index 69d6d92..d9e3fff 100644
--- a/class/class.app.php
+++ b/class/class.app.php
@@ -26,7 +26,7 @@ class App
$now = new DateTimeImmutable(null, timezone_open("Europe/Paris"));
- $q = $this->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));
+ }
+ }
+
}