aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--class/class.aff.php105
-rw-r--r--class/class.app.php71
-rw-r--r--class/class.art.php10
-rw-r--r--class/class.media.php110
-rw-r--r--fn/fn.php22
-rw-r--r--public/css/stylebase.css200
-rw-r--r--public/css/stylem.css196
-rw-r--r--public/css/stylew.css52
-rw-r--r--public/m/index.php90
-rw-r--r--public/w/index.php36
11 files changed, 632 insertions, 261 deletions
diff --git a/README.md b/README.md
index 4434f71..0cc9b0c 100644
--- a/README.md
+++ b/README.md
@@ -40,3 +40,4 @@ There is 3 levels of privacy :
## M
+- 0.1 : test version. \ No newline at end of file
diff --git a/class/class.aff.php b/class/class.aff.php
index a62274e..3ae4662 100644
--- a/class/class.aff.php
+++ b/class/class.aff.php
@@ -17,7 +17,7 @@ class Aff
public function lecture(Art $art, App $app)
{
- echo '<body class="lecture">';
+ echo '<div class="lecture">';
if ($art->secure() == 1) {
echo '<span class="alert"><h4>cet article est privé</h4></span>';
}
@@ -28,6 +28,7 @@ class Aff
if ($this->session() >= $art->secure()) {
?>
<style type="text/css">
+ <?= $art->csstemplate($app) ?>
body{
background: <?= $art->couleurbkg() ?>;
}
@@ -42,17 +43,18 @@ class Aff
section a[target="_blank"] {
color: <?= $art->couleurlienblank() ?>;
}
- <?= $art->csstemplate($app) ?>
</style>
<section>
+ <header>
<h1><?= $art->titre() ?></h1>
<h6><?= $art->soustitre() ?></h6>
+ </header>
<article><?= $art->html($app) ?></article>
</section>
<?php
}
- echo '</body>';
+ echo '</div>';
}
public function edit(Art $art, $list)
@@ -60,7 +62,7 @@ class Aff
if ($this->session() >= self::$edit) {
?>
- <body class="edit">
+ <div class="edit">
<section>
<form action="?id=<?= $art->id() ?>" method="post">
<details close>
@@ -85,11 +87,17 @@ class Aff
<label for="template">Template :</label>
<select name="template" id="template">
<?php
+ if ($art->template() == 'NULL') {
+ echo '<option value="" selected >Sans template</option>';
+ } else {
+ echo '<option value="" >sans template</option>';
+ }
foreach ($list as $item) {
- if ($item['id'] == $art->template()) {
- echo '<option value="' . $item['id'] . '" selected >' . $item['titre'] . '</option>';
+
+ if ($item->id() == $art->template()) {
+ echo '<option value="' . $item->id() . '" selected >' . $item->titre() . '</option>';
} else {
- echo '<option value="' . $item['id'] . '">' . $item['titre'] . '</option>';
+ echo '<option value="' . $item->id() . '">' . $item->titre() . '</option>';
}
}
?>
@@ -117,7 +125,7 @@ class Aff
<input type="submit" name="action" value="delete" onclick="confirmSubmit(event, 'Suppression de cet article')">
</form>
</div>
- </body>
+ </div>
<?php
@@ -125,23 +133,33 @@ class Aff
}
-public function template(Art $art, $list)
+public function copy(Art $art, $list)
{
- echo '<div class="template">';
- echo '<form action="?id=' . $art->id() . '" method="post">';
- echo '<input type="hidden" name="action" value="template">';
- echo '<input type="hidden" name="id" value="' . $art->id() . '">';
- echo '<select name="template">';
- foreach ($list as $item) {
- echo '<option value="' . $item['id'] . '">' . $item['titre'] . '</option>';
- }
- echo '</select>';
?>
- <input type="submit" value="template" onclick="confirmSubmit(event, 'Ecraser le style CSS')">
+ <div class="copy">
+ <form action="?id=<?= $art->id() ?>&edit=1" method="post">
+ <input type="hidden" name="action" value="copy">
+ <input type="hidden" name="id" value="<?= $art->id() ?>">
+ <select name="copy">
+ <?php
+ foreach ($list as $item) {
+ echo '<option value="' . $item->id() . '">' . $item->titre() . '</option>';
+ }
+ echo '</select>';
+ ?>
+ <label for="checkcss">CSS</label>
+ <input type="checkbox" id="checkcss" name="css" value="true">
+ <label for="checkcolor">Color</label>
+ <input type="checkbox" id="checkcolor" name="color" value="true">
+ <label for="checkhtml">HTML</label>
+ <input type="checkbox" id="checkhtml" name="html" value="true">
+ <label for="checktemplate">template</label>
+ <input type="checkbox" id="checktemplate" name="template" value="true">
+ <input type="submit" value="copy" onclick="confirmSubmit(event, 'Ecraser ces valeurs')">
+ </form>
+ </div>
<?php
-// echo '<input type="submit" value="template">';
- echo '</form>';
- echo '</div>';
+
}
public function head($title, $tool)
@@ -149,7 +167,8 @@ public function head($title, $tool)
?>
<head>
<meta charset="utf8" />
- <meta name="viewport" content="width=device-width" />
+ <meta name="viewport" content="width=device-width" />
+ <link href="/css/stylebase.css" rel="stylesheet" />
<link href="/css/style<?= $tool ?>.css" rel="stylesheet" />
<title><?= $title ?></title>
<script src="../rsc/js/app.js"></script>
@@ -174,7 +193,7 @@ public function head($title, $tool)
public function tag($getlist, $tag)
{
- echo '<body class="tag">';
+ echo '<div class="tag">';
echo '<ul>';
foreach ($getlist as $item) {
if (in_array($tag, $item->tag('array'))) {
@@ -187,12 +206,12 @@ public function head($title, $tool)
}
}
echo ' </ul> ';
- echo ' </body> ';
+ echo ' </div> ';
}
public function lien($getlist, $lien)
{
- echo '<body class="lien">';
+ echo '<div class="lien">';
echo '<ul>';
foreach ($getlist as $item) {
if (in_array($lien, $item->lien('array'))) {
@@ -205,7 +224,7 @@ public function head($title, $tool)
}
}
echo ' </ul> ';
- echo ' </body> ';
+ echo ' </div> ';
}
public function home($getlist)
@@ -236,7 +255,7 @@ public function head($title, $tool)
public function home2($getlist)
{
- echo '<body class="home">';
+ echo '<div class="home">';
if ($this->session() >= 2) {
echo '<ul>';
foreach ($getlist as $item) {
@@ -253,38 +272,45 @@ public function head($title, $tool)
}
echo ' </ul> ';
}
- echo ' </body> ';
+ echo ' </div> ';
}
public function home2table($getlist)
{
- echo '<body class="home">';
+ echo '<div class="home">';
echo '<section>';
echo '<h1>W</h1>';
$this->search();
if ($this->session() >= 2) {
echo '<h1>Home</h1>';
echo '<table>';
- echo '<tr><th>titre</th><th>résumé</th><th>lien</th><th>edit</th></tr>';
+ echo '<tr><th><a href="./?tri=titre">titre</a></th><th>résumé</th><th>lien from</th><th>lien to</th><th><a href="./?tri=datemodif&desc=DESC">dernière modif</a></th><th><a href="./?tri=datecreation&desc=DESC">date de création</a></th><th>edit</th></tr>';
foreach ($getlist as $item) {
- $count = 0;
+ $liento = 0;
+ $lienfrom = 0;
foreach ($getlist as $lien) {
if (in_array($item->id(), $lien->lien('array'))) {
- $count++;
+ $liento++;
}
}
+ foreach ($item->lien('array') as $count) {
+ $lienfrom++;
+ }
echo '<tr>';
echo '<td><a href="?id=' . $item->id() . '">' . $item->titre() . '</a></td>';
echo '<td>' . $item->intro() . '</td>';
- echo '<td><a href="?lien=' . $item->id() . '">' . $count . '</a></td>';
+ echo '<td>' . $lienfrom . '</td>';
+ echo '<td><a href="?lien=' . $item->id() . '">' . $liento . '</a></td>';
+ echo '<td>' . $item->datemodif('hrdi') . '</td>';
+ echo '<td>' . $item->datecreation('hrdi') . '</td>';
echo '<td><a href="?id=' . $item->id() . '&edit=1">modifier</a></td>';
echo '</tr>';
}
echo ' </table> ';
}
echo '</section>';
- echo ' </body> ';
+ echo ' </div> ';
}
public function aside($list)
@@ -314,7 +340,7 @@ public function head($title, $tool)
if (isset($_GET['id'])) {
if ($this->session() == 0) {
?>
- <form action="?id=<?= $_GET['id'] ?>" method="post">
+ <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="login">
@@ -324,7 +350,7 @@ public function head($title, $tool)
}
if ($this->session() >= 1) {
?>
- <form action="?id=<?= $_GET['id'] ?>" method="post">
+ <form action="./?id=<?= $_GET['id'] ?>" method="post">
<input type="hidden" name="action" value="logout">
<input type="submit" value="logout">
</form>
@@ -372,13 +398,16 @@ public function head($title, $tool)
if ($this->session() >= 2) {
?>
+ <details close>
+ <summary>Add Media</summary>
<h1>Ajouter un media</h1>
<form action="./" method="post" enctype="multipart/form-data">
<input type="hidden" name="action" value="addmedia">
<input type="file" accept="*" name="media" required>
<input type="text" name="id" id="" placeholder="nom du fichier" required>
<input type="submit" value="envoi">
- </form>
+ </form>
+ </details>
<?php
}
diff --git a/class/class.app.php b/class/class.app.php
index 3fac66b..8ca1b1f 100644
--- a/class/class.app.php
+++ b/class/class.app.php
@@ -68,15 +68,15 @@ class App
}
- public function getlister(array $selection, $tri)
+ public function getlister(array $selection = ['id', 'titre'], $tri = 'id', $desc = 'ASC')
{
$list = [];
$option = ['datecreation', 'titre', 'id', 'intro', 'datemodif'];
- if (is_array($selection) && is_string($tri) && strlen($tri) < 12 && in_array($tri, $option)) {
+ if (is_array($selection) && is_string($tri) && strlen($tri) < 16 && is_string($desc) && strlen($desc) < 5 && in_array($tri, $option)) {
$selection = implode(", ", $selection);
- $select = 'SELECT ' . $selection . ' FROM art ORDER BY ' . $tri;
+ $select = 'SELECT ' . $selection . ' FROM art ORDER BY ' . $tri . ' ' . $desc;
$req = $this->bdd->query($select);
while ($donnees = $req->fetch(PDO::FETCH_ASSOC)) {
$list[] = new Art($donnees);
@@ -114,8 +114,6 @@ class App
$now = new DateTimeImmutable(null, timezone_open("Europe/Paris"));
$art->updatelien();
- var_dump($now);
-
$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, lien = :lien, template = :template WHERE id = :id');
$q->bindValue(':id', $art->id());
@@ -138,6 +136,11 @@ class App
$q->execute();
}
+
+
+
+// __________________________________________ M E D ________________________________________________________
+
public function addmedia(array $file, $maxsize, $id)
{
$maxsize = 2 ** 40;
@@ -149,6 +152,7 @@ class App
if (in_array($extension_upload, $extensions_autorisees)) {
if (!file_exists('../media/' . $id . '.' . $extension_upload)) {
+ $extension_upload = strtolower($extension_upload);
$uploadok = move_uploaded_file($file['media']['tmp_name'], '../media/' . $id . '.' . $extension_upload);
if ($uploadok) {
header('Location: ./?message=uploadok');
@@ -166,6 +170,63 @@ class App
}
}
+
+ public function getmedia($entry)
+ {
+ $fileinfo = pathinfo($entry);
+
+ $filepath = $fileinfo['dirname'] . '.' . $fileinfo['extension'];
+
+ list($width, $height, $type, $attr) = getimagesize($filepath);
+
+ echo 'filepath : ' . $filepath;
+
+ $donnes = array(
+ 'id' => str_replace('.' . $fileinfo['extension'], '', $fileinfo['filename']),
+ 'path' => $fileinfo['dirname'],
+ 'extension' => $fileinfo['extension']
+ );
+
+
+
+ return new Art($donnees);
+
+ }
+
+ public function getlistermedia($dir)
+ {
+ if ($handle = opendir($dir)) {
+ $list = [];
+ while (false !== ($entry = readdir($handle))) {
+ if ($entry != "." && $entry != "..") {
+ $fileinfo = pathinfo($entry);
+
+ $filepath = $dir . $fileinfo['filename'] . '.' . $fileinfo['extension'];
+
+ list($width, $height, $type, $attr) = getimagesize($filepath);
+ $filesize = filesize($filepath);
+
+ $donnees = array(
+ 'id' => str_replace('.' . $fileinfo['extension'], '', $fileinfo['filename']),
+ 'path' => $fileinfo['dirname'],
+ 'extension' => $fileinfo['extension'],
+ 'size' => $filesize,
+ 'width' => $width,
+ 'height' => $height
+ );
+
+ $list[] = new Media($donnees);
+
+ }
+ }
+ return $list;
+ }
+
+ return $list;
+
+ }
+
+
//_________________________________________________________ S E S ________________________________________________________
public function login($pass)
diff --git a/class/class.art.php b/class/class.art.php
index 2b03a7d..2b67611 100644
--- a/class/class.art.php
+++ b/class/class.art.php
@@ -20,6 +20,7 @@ class Art
private $couleurlien;
private $couleurlienblank;
private $lien;
+ private $template;
const LEN = 255;
const LENHTML = 20000;
@@ -64,6 +65,7 @@ a:hover {}');
$this->setcouleurlien('#000000');
$this->setcouleurlienblank('#000000');
$this->setlien('');
+ $this->settemplate('');
}
public function updatelien()
@@ -110,6 +112,9 @@ a:hover {}');
return $this->datecreation->format('Y-m-d H:i:s');
} elseif ($option == 'date') {
return $this->datecreation;
+ } elseif ($option == 'hrdi') {
+ $now = new DateTimeImmutable(null, timezone_open("Europe/Paris"));
+ return hrdi($this->datecreation->diff($now));
}
}
@@ -120,6 +125,9 @@ a:hover {}');
return $this->datemodif->format('Y-m-d H:i:s');
} elseif ($option == 'date') {
return $this->datemodif;
+ } elseif ($option == 'hrdi') {
+ $now = new DateTimeImmutable(null, timezone_open("Europe/Paris"));
+ return hrdi($this->datemodif->diff($now));
}
}
@@ -167,6 +175,8 @@ a:hover {}');
$html = str_replace('href="http', ' class="external" target="_blank" href="http', $html);
$html = str_replace('src="/', 'src="../media/', $html);
+ $html = str_replace('<iframe', '<div class="iframe"><div class="container"><iframe class="video" ', $html);
+ $html = str_replace('</iframe>', '</iframe></div></div>', $html);
return $html;
diff --git a/class/class.media.php b/class/class.media.php
index e144776..e5056c9 100644
--- a/class/class.media.php
+++ b/class/class.media.php
@@ -3,14 +3,120 @@
class Media
{
private $id;
+ private $path;
private $extension;
private $type;
private $size;
- private $height;
private $width;
+ private $height;
-}
+// _____________________________________________________ F U N ____________________________________________________
+
+ public function __construct(array $donnees)
+ {
+ $this->hydrate($donnees);
+ }
+
+ public function hydrate(array $donnees)
+ {
+ foreach ($donnees as $key => $value) {
+ $method = 'set' . $key;
+
+ if (method_exists($this, $method)) {
+ $this->$method($value);
+ }
+ }
+ }
+
+
+
+// _________________________________________________ G E T ____________________________________________________
+
+ public function id()
+ {
+ return $this->id;
+ }
+
+ public function path()
+ {
+ return $this->path;
+ }
+
+ public function extension()
+ {
+ return $this->extension;
+ }
+
+ public function type()
+ {
+ return $this->type;
+ }
+
+ public function size()
+ {
+ return $this->size;
+ }
+
+ public function width()
+ {
+ return $this->width;
+ }
+
+ public function height()
+ {
+ return $this->height;
+ }
+
+// ___________________________________________________ S E T __________________________________________________
+
+ public function setid($id)
+ {
+ if (strlen($id) < 40 and is_string($id)) {
+ $this->id = strip_tags(strtolower($id));
+ }
+ }
+
+ public function setpath($path)
+ {
+ if (strlen($path) < 40 and is_string($path)) {
+ $this->path = strip_tags(strtolower($path));
+ }
+ }
+
+ public function setextension($extension)
+ {
+ if (strlen($extension) < 7 and is_string($extension)) {
+ $this->extension = strip_tags(strtolower($extension));
+ }
+ }
+
+ public function setsize($size)
+ {
+ if (40 and is_int($size)) {
+ $this->size = strip_tags(strtolower($size));
+ }
+ }
+
+ public function setwidth($width)
+ {
+ if (is_int($width)) {
+ $this->width = strip_tags(strtolower($width));
+ }
+ }
+
+ public function setheight($height)
+ {
+ if (is_int($height)) {
+ $this->height = strip_tags(strtolower($height));
+ }
+ }
+
+
+
+
+
+}
?> \ No newline at end of file
diff --git a/fn/fn.php b/fn/fn.php
index 65d14f4..ce9bdae 100644
--- a/fn/fn.php
+++ b/fn/fn.php
@@ -77,5 +77,27 @@ function readablesize(int $bytes)
return sprintf($format, $num, $unit);
}
+
+/* human readable date interval
+ * @param DateInterval $diff - l'interval de temps
+ * @return string
+ */
+function hrdi(DateInterval $diff)
+{
+ $str = "";
+ if ($diff->y > 1) return $str . $diff->y . ' ans';
+ if ($diff->y == 1) return $str . ' 1 an et ' . $diff->m . ' mois';
+ if ($diff->m > 1) return $str . $diff->m . ' mois';
+ if ($diff->m == 1) return $str . ' 1 mois et ' . $diff->d . ($diff->d > 1 ? ' jours' : ' jour');
+ if ($diff->d > 1) return $str . $diff->d . ' jours';
+ if ($diff->d == 1) return $str . ' 1 jour et ' . $diff->h . ($diff->h > 1 ? ' heures' : ' heure');
+ if ($diff->h > 1) return $str . $diff->h . ' heures';
+ if ($diff->h == 1) return $str . ' 1 heure et ' . $diff->i . ($diff->i > 1 ? ' minutes' : ' minute');
+ if ($diff->i > 1) return $str . $diff->i . ' minutes';
+ if ($diff->i == 1) return $str . ' 1 minute';
+ return $str . ' quelques secondes';
+}
+
+
?>
diff --git a/public/css/stylebase.css b/public/css/stylebase.css
new file mode 100644
index 0000000..46d43f4
--- /dev/null
+++ b/public/css/stylebase.css
@@ -0,0 +1,200 @@
+body {
+ 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 {
+ font-style: italic;
+}
+
+h3 {
+ opacity: 0.7;
+}
+
+h6 {
+ font-size: 1em;
+}
+
+p{
+ font-size: 1em;
+}
+
+em {
+ opacity: 0.8;
+}
+
+a{
+ text-decoration: none;
+}
+
+a:hover{
+ text-decoration: underline;
+}
+
+img {
+ width: 90%;
+ max-width: 1000px;
+}
+
+form {
+ margin-bottom: 0px;
+}
+
+section {
+ text-align: justify;
+ padding: 3%;
+ line-height: 1.2em;
+}
+
+.edit {
+ overflow-y: scroll;
+}
+
+.edit section {
+ text-align: left;
+ padding-top: 0px;
+ padding-bottom: 0px;
+ padding-left: 8%;
+ padding-right: 8%;
+ line-height: 1.2em;
+}
+
+.button, input, textarea, select {
+ display: inline-block;
+ width: 90%;
+ padding-left: 15px;
+ padding-right: 15px;
+ margin: 5px;
+ margin-left: 5%;
+ margin-right: 5%;
+ height: 30px;
+ border-style: unset;
+}
+
+.button {
+ text-align: center;
+ color: black;
+ font-size: 13px;
+ padding-top: 7px;
+ background-color: #bfbfbf;
+ box-sizing: border-box;
+ align-items: flex-start;
+ text-align: center;
+ cursor: default;
+ white-space: pre;
+ -webkit-rtl-ordering: logical;
+ text-rendering: auto;
+ color: initial;
+ letter-spacing: normal;
+ word-spacing: normal;
+ text-transform: none;
+ text-indent: 0px;
+ text-shadow: none;
+}
+
+.button:hover {
+
+ text-decoration: none;
+}
+
+article {
+ position: relative;
+ z-index: 7;
+}
+
+#html{
+ height: calc(100% - 95px);
+}
+
+#css{
+ height: 250px;
+}
+
+input[type="submit"] {
+ background-color: #bfbfbf;
+}
+
+aside {
+ position: fixed;
+ bottom: 0px;
+ right: -300px;
+ padding: 7px;
+ z-index: 5;
+ background: #bfbfbf;
+ opacity: 0.3;
+ width: 350px;
+ overflow-y: scroll;
+ max-height: calc(100% - 200px);
+}
+
+aside:hover {
+ opacity: 1;
+ right: 0px;
+}
+
+nav {
+ position: fixed;
+ top: 0px;
+ right: -6%;
+ z-index: 10;
+ opacity: 0.3;
+ width: 8%;
+ text-align: right;
+}
+
+
+
+nav:hover, .edit nav {
+ opacity: 1;
+ right: 0px;
+}
+
+.alert h4 {
+ background-color: red;
+ margin: 0px;
+}
+
+table {
+ width: 100%;
+ margin-top: 20px;
+}
+
+.home tr:hover {
+ background-color: #bfbfbf;
+}
+
+.home td:hover {
+ background-color: #a7a6a6;
+}
+
+td {
+ border: 1px solid #ffffff00;
+ padding-top: 3px;
+ padding-bottom: 3px;
+}
+
+.submit {
+ position: fixed;
+ top: 0px;
+ left: 0px;
+ width: 8%;
+}
+
+
+summary {
+ height: 24px;
+ outline: none;
+ font-size: 1.4em;
+ background-color: #a0a0a0;
+ margin-top: 3px;
+ margin-bottom: 3px;
+} \ No newline at end of file
diff --git a/public/css/stylem.css b/public/css/stylem.css
index d942257..4e18678 100644
--- a/public/css/stylem.css
+++ b/public/css/stylem.css
@@ -1,199 +1,51 @@
-html {
-}
-
-body {
- background-color: #dcdcdceb;
- font-family: helvetica, arial, sans-serif;
- margin: 0px;
- overflow: scroll;
-
-}
-
-h1 {
- font-size: 3em;
- font-variant: all-small-caps;
- margin-top: 0px;
- margin-bottom: 0px;
-}
-
-h2 {
- font-style: italic;
-}
-
-h3 {
- opacity: 0.7;
-}
-
-h6 {
- font-size: 1em;
-}
-
-p{
- font-size: 1em;
-}
-
-em {
- opacity: 0.8;
-}
-
-a{
- text-decoration: none;
-}
-
-a:hover{
- text-decoration: underline;
-}
-
-img {
- width: 90%;
- max-width: 1000px;
-}
-
-section {
- text-align: justify;
- padding: 3%;
- line-height: 1.2em;
-}
-
-.edit {
- text-align: left;
- padding-top: 1%;
- padding-bottom: 1%;
- padding-left: 8%;
- padding-right: 8%;
- line-height: 1.2em;
-}
-
-
-section input, textarea, select {
- width: 90%;
- padding-left: 15px;
- padding-right: 15px;
- margin: 5px;
- margin-left: 5%;
- margin-right: 5%;
- height: 30px;
- border-style: unset;
-}
-
-article {
- position: relative;
- z-index: 100;
-}
-
-#html{
- height: 1000px;
-}
-
-#css{
- height: 100px;
-}
-
-input[type="submit"] {
- background-color: #bfbfbf;
-}
-
-aside {
- position: fixed;
- bottom: 0px;
- right: -300px;
- padding: 7px;
- z-index: 5;
- background: #bfbfbf;
- opacity: 0.3;
- width: 350px;
- overflow-y: scroll;
- max-height: 70%;
-}
-
-aside:hover {
- opacity: 1;
- right: 0px;
-}
-
-nav {
- position: fixed;
- top: 0px;
- right: -50px;
- padding: 7px;
- z-index: 10;
- background: #6c7d8a;
- opacity: 0.3;
- width:100px;
- border-width: 4px;
- border-style: outset;
-}
-
-nav:hover {
- 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;
-}
-.submit {
- position: fixed;
- top: 0px;
- left: 0px;
- width: 8%;
-}
.infobulle {
display: none;
}
-.little:focus .infobulle {
+.little:hover .infobulle {
display: inline-block;
position: relative;
background-color: white;
- border: 1px solid black;
z-index: 5;
top: 5px;
- left: 100px;
width: 300px;
+ font-family: monospace;
+ font-size: 0.9em;
+ line-height: 1.1em;
}
span.infobulle img {
- width: 100%
+ width: 100%;
}
.grid {
display: flex;
flex-wrap: wrap;
+ padding: 4%;
+ margin-right: 120px;
+
}
.little {
width: 100px;
height: 150px;
margin: 10px;
+ background-color: white;
+
+}
+
+.infobulle input[type="text"] {
+ font-family: monospace;
+ font-size: 0.9em;
+ margin: 3px;
+}
+
+img.thumbnail {
+ width: 100%;
+}
+
+section.gest {
+ padding-bottom: 300px;
} \ No newline at end of file
diff --git a/public/css/stylew.css b/public/css/stylew.css
index ab206a3..3a414c7 100644
--- a/public/css/stylew.css
+++ b/public/css/stylew.css
@@ -1,6 +1,3 @@
-html {
-}
-
body {
background-color: #dcdcdceb;
font-family: helvetica, arial, sans-serif;
@@ -58,11 +55,11 @@ section {
line-height: 1.2em;
}
-body.edit {
+.edit {
overflow-y: scroll;
}
-body.edit section {
+.edit section {
text-align: left;
padding-top: 0px;
padding-bottom: 0px;
@@ -136,7 +133,7 @@ aside {
opacity: 0.3;
width: 350px;
overflow-y: scroll;
- max-height: 70%;
+ max-height: calc(100% - 200px);
}
aside:hover {
@@ -156,7 +153,7 @@ nav {
-nav:hover, body.edit nav {
+nav:hover, .edit nav {
opacity: 1;
right: 0px;
}
@@ -171,6 +168,20 @@ table {
margin-top: 20px;
}
+.home tr:hover {
+ background-color: #bfbfbf;
+}
+
+.home td:hover {
+ background-color: #a7a6a6;
+}
+
+td {
+ border: 1px solid #ffffff00;
+ padding-top: 3px;
+ padding-bottom: 3px;
+}
+
.submit {
position: fixed;
top: 0px;
@@ -203,18 +214,23 @@ span.infobulle img {
flex-wrap: wrap;
}
-summary {
- height: 24px;
- outline: none;
- font-size: 1.4em;
- background-color: #bdbdbd;
- margin-top: 3px;
- margin-bottom: 3px;
-}
-
-.template {
+.copy {
position: fixed;
bottom: 0px;
left: 0px;
width: 8%;
-} \ No newline at end of file
+}
+
+.container {
+ position: relative;
+ width: 100%;
+ height: 0;
+ padding-bottom: 56.25%;
+ }
+ .video {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ } \ No newline at end of file
diff --git a/public/m/index.php b/public/m/index.php
index bf14b0f..e29c801 100644
--- a/public/m/index.php
+++ b/public/m/index.php
@@ -9,6 +9,7 @@ $config = require('../../config.php');
require('../../fn/fn.php');
require('../../class/class.art.php');
+require('../../class/class.media.php');
require('../../class/class.app.php');
require('../../class/class.aff.php');
session();
@@ -42,6 +43,24 @@ if (isset($_POST['action'])) {
case 'addmedia':
$app->addmedia($_FILES, 2 ** 30, $_POST['id']);
break;
+
+ case 'login':
+ $_SESSION['level'] = $app->login($_POST['pass']);
+ if (isset($_GET['id'])) {
+ header('Location: ?id=' . $_GET['id']);
+ } else {
+ header('Location: ?');
+ }
+ break;
+
+ case 'logout':
+ $_SESSION['level'] = $app->logout();
+ if (isset($_GET['id'])) {
+ header('Location: ?id=' . $_GET['id']);
+ } else {
+ header('Location: ?');
+ }
+ break;
}
}
@@ -53,49 +72,84 @@ echo '<body>';
$aff->nav($app);
$aff->addmedia();
-echo '<h1>Media</h1>';
-echo '<section class="grid">';
+echo '<details open>';
+echo '<summary>Media List</summary>';
+echo '<h1>Media</h1>';
+echo '<section class="gest">';
$dir = "../media/";
+echo '<form action="" method="post">';
+
+echo '<div class="grid">';
if ($handle = opendir($dir)) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
$fileinfo = pathinfo($entry);
- $filepath = '../media/' . $fileinfo['filename'] . '.' . $fileinfo['extension'];
+ $filepath = $dir . $fileinfo['filename'] . '.' . $fileinfo['extension'];
list($width, $height, $type, $attr) = getimagesize($filepath);
$filesize = filesize($filepath);
- echo '<a href="#" class="little">';
- echo '<h3>' . $entry . '</h3>';
+ echo '<div class="little">';
+
+
+ ?>
+ <label for="<?= $entry ?>"><?= $entry ?></label>
+ <input type="hidden" name="" value="">
+ <input type="checkbox" id="<?= $entry ?>" name="<?= $entry ?>" value="1">
+
+ <?php
+ echo '<img class="thumbnail" src="' . $filepath . '" alt="' . $fileinfo['filename'] . '">';
+ echo '<span class="infobulle">';
+ echo 'width = ' . $width . ' px';
+ echo '<br/>';
+ echo 'height = ' . $height . ' px';
+ echo '<br/>';
+ echo 'filesize = ' . readablesize($filesize);
+ echo '<br/>';
- echo '<img class="thumbnail" src="' . $filepath . '" alt="' . $fileinfo['filename'] . '">';
+ echo '<input type="text" value="![' . $fileinfo['filename'] . '](/' . $entry . ')">';
+ echo '<br/>';
- echo '<span class="infobulle">';
- echo 'width = ' . $width;
- echo '<br/>';
- echo 'height = ' . $height;
- echo '<br/>';
- echo 'filesize = ' . readablesize($filesize);
- echo '<br/>';
- echo '<img src="' . $filepath . '" alt="' . $fileinfo['filename'] . '">';
- echo '</span>';
+ echo '<img src="' . $filepath . '" alt="' . $fileinfo['filename'] . '">';
+ echo '</span>';
- echo '</a>';
- }
+
+ echo '</div>';
}
- closedir($handle);
}
+closedir($handle);
+}
+
+echo '</div>';
+
+?>
+<select name="action" id="">
+ <option value="">compress /2</option>
+ <option value="">downscale /2</option>
+ <option value="">upscale *2</option>
+</select>
+<input type="submit" value="edit">
+<input type="submit" value="delete">
+</form>
+</div>
+
+
+<?php
+
echo '</section>';
+echo '</details>';
+
+var_dump($app->getlistermedia($dir));
echo '</body>';
diff --git a/public/w/index.php b/public/w/index.php
index 51bce0e..71f1728 100644
--- a/public/w/index.php
+++ b/public/w/index.php
@@ -38,11 +38,25 @@ if (isset($_POST['action'])) {
}
break;
- case 'template':
+ case 'copy':
if ($app->exist($_GET['id'])) {
- $template = $app->get($_POST['template']);
+ $copy = $app->get($_POST['copy']);
$art = $app->get($_POST['id']);
- $art->setcss($template->css());
+ if (!empty($_POST['css'])) {
+ $art->setcss($copy->css());
+ }
+ if (!empty($_POST['color'])) {
+ $art->setcouleurtext($copy->couleurtext());
+ $art->setcouleurbkg($copy->couleurbkg());
+ $art->setcouleurlien($copy->couleurlien());
+ $art->setcouleurlienblank($copy->couleurlienblank());
+ }
+ if (!empty($_POST['html'])) {
+ $art->sethtml($copy->md());
+ }
+ if (!empty($_POST['template'])) {
+ $art->settemplate($copy->template());
+ }
$app->update($art);
header('Location: ?id=' . $art->id() . '&edit=1');
}
@@ -98,7 +112,7 @@ $aff->head($titre, 'w');
// ______________________________________________________ B O D Y _______________________________________________________________
-
+echo '<body>';
$aff->nav($app);
if (isset($_GET['id'])) {
@@ -107,9 +121,9 @@ if (isset($_GET['id'])) {
$art = $app->get($_GET['id']);
- if (isset($_GET['edit']) and $_GET['edit'] == 1) {
- $aff->edit($art, $app->lister());
- $aff->template($art, $app->lister());
+ if (isset($_GET['edit']) and $_GET['edit'] == 1 and $aff->session() == 2) {
+ $aff->edit($art, $app->getlister(['id', 'titre'], 'id'));
+ $aff->copy($art, $app->getlister(['id', 'titre'], 'id'));
$aff->aside($app->lister());
} else {
$aff->lecture($art, $app);
@@ -147,8 +161,14 @@ if (isset($_GET['id'])) {
} else {
$tri = 'id';
}
- $aff->home2table($app->getlister(['id', 'titre', 'intro', 'lien'], $tri));
+ if (isset($_GET['desc'])) {
+ $desc = strip_tags($_GET['desc']);
+ } else {
+ $desc = 'ASC';
+ }
+ $aff->home2table($app->getlister(['id', 'titre', 'intro', 'lien', 'datecreation', 'datemodif'], $tri, $desc));
}
+echo '</body>';
?>