diff options
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | class/class.w.aff.php | 26 | ||||
-rw-r--r-- | class/class.w.app.php | 8 | ||||
-rw-r--r-- | class/class.w.art.php | 28 | ||||
-rw-r--r-- | fn/fn.w.php (renamed from fn/fn.php) | 39 | ||||
-rw-r--r-- | public/css/stylemap.css | 0 | ||||
-rw-r--r-- | public/media/vac.png | bin | 941802 -> 0 bytes | |||
-rw-r--r-- | public/test.php | 119 | ||||
-rw-r--r-- | public/test/index.php | 24 | ||||
-rw-r--r-- | public/w/css/old/styleedit.css (renamed from public/css/old/styleedit.css) | 0 | ||||
-rw-r--r-- | public/w/css/styleadmin.css (renamed from public/css/styleadmin.css) | 0 | ||||
-rw-r--r-- | public/w/css/stylebase.css (renamed from public/css/stylebase.css) | 0 | ||||
-rw-r--r-- | public/w/css/styleedit.css (renamed from public/css/styleedit.css) | 0 | ||||
-rw-r--r-- | public/w/css/stylehome.css (renamed from public/css/stylehome.css) | 0 | ||||
-rw-r--r-- | public/w/css/styleinfo.css (renamed from public/css/styleinfo.css) | 0 | ||||
-rw-r--r-- | public/w/css/stylemedia.css (renamed from public/css/stylemedia.css) | 0 | ||||
-rw-r--r-- | public/w/css/stylerecord.css (renamed from public/css/stylerecord.css) | 0 | ||||
-rw-r--r-- | public/w/index.php | 2 | ||||
-rw-r--r-- | public/w/rsc/js/app.js (renamed from public/rsc/js/app.js) | 0 | ||||
-rw-r--r-- | public/w/rsc/js/mermaid.min.js (renamed from public/rsc/js/mermaid.min.js) | 0 |
20 files changed, 202 insertions, 51 deletions
@@ -1,7 +1,6 @@ vendor/* .vscode/* -config.json +config.w.json error_log -public/media/* -public/ACRRecordings/* -public/css/read/* +public/w/media/* +public/w/css/read/* diff --git a/class/class.w.aff.php b/class/class.w.aff.php index 14b653e..e716630 100644 --- a/class/class.w.aff.php +++ b/class/class.w.aff.php @@ -325,16 +325,16 @@ public function head($title, $tool, $color4) <head> <meta charset="utf8" /> <meta name="viewport" content="width=device-width" /> - <link rel="shortcut icon" href="../media/logo.png" type="image/x-icon"> - <link href="/css/stylebase.css" rel="stylesheet" /> - <link href="/css/style<?= $tool ?>.css" rel="stylesheet" /> + <link rel="shortcut icon" href="./media/logo.png" type="image/x-icon"> + <link href="./css/stylebase.css" rel="stylesheet" /> + <link href="./css/style<?= $tool ?>.css" rel="stylesheet" /> <style> :root { --color4: <?= $color4 ?>; } </style> <title><?= $title ?></title> - <script src="../rsc/js/app.js"></script> + <script src="./rsc/js/app.js"></script> </head> <?php @@ -347,11 +347,11 @@ public function arthead(Art $art, $cssdir, $cssread = '', $edit = 0) <meta charset="utf8" /> <meta name="description" content="<?= $art->intro() ?>" /> <meta name="viewport" content="width=device-width" /> - <link rel="shortcut icon" href="../media/logo.png" type="image/x-icon"> - <link href="/css/stylebase.css" rel="stylesheet" /> - <?= $edit == 0 ? '<link href="' . $cssdir . $cssread . '" rel="stylesheet" />' : '<link href="/css/styleedit.css" rel="stylesheet" />' ?> + <link rel="shortcut icon" href="./media/logo.png" type="image/x-icon"> + <link href="./css/stylebase.css" rel="stylesheet" /> + <?= $edit == 0 ? '<link href="' . $cssdir . $cssread . '" rel="stylesheet" />' : '<link href="./css/styleedit.css" rel="stylesheet" />' ?> <title><?= $edit == 1 ? '✏' : '' ?> <?= $art->titre() ?></title> - <script src="../rsc/js/app.js"></script> + <script src="./rsc/js/app.js"></script> </head> <?php @@ -364,11 +364,11 @@ public function noarthead($id, $cssdir, $cssread = '') <meta charset="utf8" /> <meta name="description" content="This article does not exist yet." /> <meta name="viewport" content="width=device-width" /> - <link rel="shortcut icon" href="../media/logo.png" type="image/x-icon"> - <link href="/css/stylebase.css" rel="stylesheet" /> + <link rel="shortcut icon" href="./media/logo.png" type="image/x-icon"> + <link href="./css/stylebase.css" rel="stylesheet" /> <link href="<?= $cssdir . $cssread ?>" rel="stylesheet" /> <title>❓ <?= $id ?></title> - <script src="../rsc/js/app.js"></script> + <script src="./rsc/js/app.js"></script> </head> <?php @@ -648,7 +648,7 @@ public function mermaid(string $map) ?> - <script src="../rsc/js/mermaid.min.js"></script> + <script src="./rsc/js/mermaid.min.js"></script> <script> mermaid.initialize({ @@ -1013,7 +1013,7 @@ public function nav($app) <details> <summary>Admin</summary> - <p>Edit your own admin password. You can find it in the config.json file, in the root of your website folder.</p> + <p>Edit your own admin password. You can find it in the config.w.json file, in the root of your website folder.</p> <form action="./" method="post"> <input type="hidden" name="action" value="editconfig"> diff --git a/class/class.w.app.php b/class/class.w.app.php index 0c9d6a3..91d0a41 100644 --- a/class/class.w.app.php +++ b/class/class.w.app.php @@ -6,10 +6,10 @@ class App private $arttable; - const CONFIG_FILE = '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'config.json'; - const CSS_READ_DIR = '..' . DIRECTORY_SEPARATOR . 'css' . DIRECTORY_SEPARATOR . 'read' . DIRECTORY_SEPARATOR; - const SQL_READ_DIR = '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'sql' . DIRECTORY_SEPARATOR; - const MEDIA_DIR = '..' . DIRECTORY_SEPARATOR . 'media' . DIRECTORY_SEPARATOR; + const CONFIG_FILE = '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'config.w.json'; + const CSS_READ_DIR = '.' . DIRECTORY_SEPARATOR . 'css' . DIRECTORY_SEPARATOR . 'read' . DIRECTORY_SEPARATOR; + const SQL_READ_DIR = '.' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'sql' . DIRECTORY_SEPARATOR; + const MEDIA_DIR = '.' . DIRECTORY_SEPARATOR . 'media' . DIRECTORY_SEPARATOR; const MEDIA_EXTENSIONS = array('jpeg', 'jpg', 'JPG', 'png', 'gif', 'mp3', 'mp4', 'mov', 'wav', 'flac', 'pdf'); const MEDIA_TYPES = ['image', 'video', 'sound', 'other']; diff --git a/class/class.w.art.php b/class/class.w.art.php index 4c88987..001b29d 100644 --- a/class/class.w.art.php +++ b/class/class.w.art.php @@ -197,6 +197,11 @@ class Art return $this->css; } + public function cssprint() + { + return $cssprint; + } + public function csstemplate(App $app) { $data = []; @@ -210,7 +215,8 @@ class Art } } - return $temp . $this->css; + $cssprint = str_replace('url(/', 'url('.$app::MEDIA_DIR , $temp . $this->css); + return $cssprint; } public function md($expand = false) @@ -226,16 +232,23 @@ class Art public function html(App $app) { + // %%%% TITLE & DESCIPTION $html = str_replace('%TITLE%', $this->titre(), $this->html); $html = str_replace('%DESCRIPTION%', $this->intro(), $html); $parser = new MarkdownExtra; + + // id in headers $parser->header_id_func = function ($header) { - return preg_replace('/[^a-z0-9]/', '', strtolower($header)); + return preg_replace('/[^\w]/', '', strtolower($header)); }; $html = $parser->transform($html); + + // replace = > ?id= $html = str_replace('href="=', 'href="?id=', $html); + + // infobulles tooltip foreach ($this->lien('array') as $id) { $title = "Cet article n'existe pas encore"; foreach ($app->getlister(['id', 'intro']) as $item) { @@ -248,10 +261,17 @@ class Art $html = str_replace($lien, $titlelien, $html); } + if(!empty(strstr($html, '%SUMMARY%'))) { + + + + $html = str_replace('%SUMMARY%', sumparser($html), $html); + } + - $html = str_replace('href="../media/', ' class="file" target="_blank" href="../media/', $html); + $html = str_replace('href="./media/', ' class="file" target="_blank" href="./media/', $html); $html = str_replace('href="http', ' class="external" target="_blank" href="http', $html); - $html = str_replace('<img src="/', '<img src="../media/', $html); + $html = str_replace('<img src="/', '<img 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; @@ -27,7 +27,7 @@ function head($title) <head> <meta charset="utf8" /> <meta name="viexport" content="width=device-width" /> - <link href="/css/style.css" rel="stylesheet" /> + <link href="./css/style.css" rel="stylesheet" /> <title><?= $title ?></title> </head> <?php @@ -139,5 +139,42 @@ function str_clean(string $string) return str_replace(' ', '_', strtolower(strip_tags($string))); } +function sumparser($text) +{ + preg_match_all('#<h([1-6]) id="(\w+)">(.+)</h[1-6]>#iU', $text, $out); + + + $sum = []; + foreach ($out[2] as $key => $value) { + $sum[$value][$out[1][$key]] = $out[3][$key]; + } + + + $sumstring = ''; + $last = 0; + foreach ($sum as $title => $list) { + foreach ($list as $h => $link) { + if($h > $last) { + for ($i = 1; $i <= ($h - $last); $i++) { + $sumstring .= '<ul>'; + } + $sumstring .= '<li><a href="#'.$title.'">'.$link.'</a></li>' ; + } elseif ($h < $last) { + for ($i = 1; $i <= ($last - $h); $i++) { + $sumstring .= '</ul>'; + } + $sumstring .= '<li><a href="#'.$title.'">'.$link.'</a></li>' ; + } elseif ($h = $last) { + $sumstring .= '<li><a href="#'.$title.'">'.$link.'</a></li>' ; + } + $last = $h; + } + } + for ($i = 1; $i <= ($last); $i++) { + $sumstring .= '</ul>'; + } + return $sumstring; +} + ?>
\ No newline at end of file diff --git a/public/css/stylemap.css b/public/css/stylemap.css deleted file mode 100644 index e69de29..0000000 --- a/public/css/stylemap.css +++ /dev/null diff --git a/public/media/vac.png b/public/media/vac.png Binary files differdeleted file mode 100644 index 569f539..0000000 --- a/public/media/vac.png +++ /dev/null diff --git a/public/test.php b/public/test.php new file mode 100644 index 0000000..6e5e835 --- /dev/null +++ b/public/test.php @@ -0,0 +1,119 @@ +<?php +$text = 'gfgdfgdfgdsggggggggggggg +dfgdsfgdh +dh + +gh +g +hg +fhhhhhhhhhhhhhhhhhhgfghfghfgh + +fhfgfgdfgdfgdsggggggggggggg +dfgdsfgdh +dh + +gh +g +hg +fhhhhhhhhhhhhhhhhhhgfghfghfgh + +fhf<h3 id="titre2laguerre">tiTre2:laguerre</h3> dqs fdddddddfdfdsfs fdsfdksdfjnsdjkhsf lkfljkfhjldshsf fsdf +fdgfgdfgdfgdsggggggggggggg +dfgdsfgdh +dh + +gh +g +hg +fhhhhhhhhhhhhhhhhhhgfghfghfgh +<p> +fhfgfgdfgdfgdsggggggggggggg +dfgdsfgdh</p> +dh</br>dh</br>dh</br>dh</br>dh</br>dh</br>dh</br>dh</br>dh</br> + +gh<p> +g +hg</p> +fhhhhhhhhhhhhhhhhhhgfghfghfgh +gh +g +hg +fhhhhhhhhhhhhhhhhhhgfghfghfgh +<p> +fhfgfgdfgdfgdsggggggggggggg +dfgdsfgdh</p> +dh</br>dh</br>dh</br>dh</br>dh</br>dh</br>dh</br>dh</br>dh</br> + +gh<p> +g +hg</p> +fhhhhhhhhhhhhhhhhhhgfghfghfgh +gh +<h1 id="yolo">YOLO</h1> +<h2 id="ptout">PROUT</h2> +<h2 id="lol">LOLDELAMORT</h2> +hg +fhhhhhhhhhhhhhhhhhhgfghfghfgh + +<p> +fhfgfgdfgdfgdsggggggggggggg +dfgdsfgdh</p> +dh</br>dh</br>dh</br>dh</br>dh</br>dh</br>dh</br>dh</br>dh</br> + +gh<p> +g +hg</p> +fhhhhhhhhhhhhhhhhhhgfghfghfgh + +fhf +g +hffffgggggggggggggggggggggggggggggggggggggdsf <h3>titre 3- les hommes </h3> la fin'; + + +function sumparser($text) +{ + preg_match_all('#<h([1-6]) id="(\w+)">(.+)</h[1-6]>#iU', $text, $out); + + var_dump($out); + + $sum = []; + foreach ($out[2] as $key => $value) { + $sum[$value][$out[1][$key]] = $out[3][$key]; + } + + var_dump($sum); + + $sumstring = ''; + $last = 0; + foreach ($sum as $title => $list) { + foreach ($list as $h => $link) { + if($h > $last) { + for ($i = 1; $i <= ($h - $last); $i++) { + $sumstring .= '<ul>'; + } + $sumstring .= '<li><a href="#'.$title.'">'.$link.'</a></li>' ; + } elseif ($h < $last) { + for ($i = 1; $i <= ($last - $h); $i++) { + $sumstring .= '</ul>'; + } + $sumstring .= '<li><a href="#'.$title.'">'.$link.'</a></li>' ; + } elseif ($h = $last) { + $sumstring .= '<li><a href="#'.$title.'">'.$link.'</a></li>' ; + } + $last = $h; + } + } + for ($i = 1; $i <= ($last); $i++) { + $sumstring .= '</ul>'; + } + return $sumstring; +} + + + + + +echo $sumstring; + + +echo $text.'</br>';
\ No newline at end of file diff --git a/public/test/index.php b/public/test/index.php deleted file mode 100644 index 5b778ee..0000000 --- a/public/test/index.php +++ /dev/null @@ -1,24 +0,0 @@ - - -<?php - -$pattern = "/%%(\w*)%%/"; - -$string = "bla bla bld dd d , dfddddddsdsdf fzpapap %q dsq%%c%%dd % dsqqsd %% dsqq dsq sd %%c%%dsssssssssss dsqd %%coucouhibou%% fdsf fdsf fdsfsdfsdf "; - - - -preg_match_all($pattern, $string, $out); - -foreach ($out[0] as $key => $value) { - $replace = '^^ÔHYEAH BB££___'.$out[1][$key]. '_____§§§§§§'; - $string = str_replace($value, $replace, $string); - -} - - -var_dump($out); - -var_dump($string); - -?>
\ No newline at end of file diff --git a/public/css/old/styleedit.css b/public/w/css/old/styleedit.css index 21435fb..21435fb 100644 --- a/public/css/old/styleedit.css +++ b/public/w/css/old/styleedit.css diff --git a/public/css/styleadmin.css b/public/w/css/styleadmin.css index a3fcc5c..a3fcc5c 100644 --- a/public/css/styleadmin.css +++ b/public/w/css/styleadmin.css diff --git a/public/css/stylebase.css b/public/w/css/stylebase.css index 017b075..017b075 100644 --- a/public/css/stylebase.css +++ b/public/w/css/stylebase.css diff --git a/public/css/styleedit.css b/public/w/css/styleedit.css index fe6745f..fe6745f 100644 --- a/public/css/styleedit.css +++ b/public/w/css/styleedit.css diff --git a/public/css/stylehome.css b/public/w/css/stylehome.css index 98822f0..98822f0 100644 --- a/public/css/stylehome.css +++ b/public/w/css/stylehome.css diff --git a/public/css/styleinfo.css b/public/w/css/styleinfo.css index a3fcc5c..a3fcc5c 100644 --- a/public/css/styleinfo.css +++ b/public/w/css/styleinfo.css diff --git a/public/css/stylemedia.css b/public/w/css/stylemedia.css index d721a9b..d721a9b 100644 --- a/public/css/stylemedia.css +++ b/public/w/css/stylemedia.css diff --git a/public/css/stylerecord.css b/public/w/css/stylerecord.css index 409bcd4..409bcd4 100644 --- a/public/css/stylerecord.css +++ b/public/w/css/stylerecord.css diff --git a/public/w/index.php b/public/w/index.php index f37899f..a5b3e03 100644 --- a/public/w/index.php +++ b/public/w/index.php @@ -7,7 +7,7 @@ session_start(); require('../../vendor/autoload.php'); -require('../../fn/fn.php'); +require('../../fn/fn.w.php'); spl_autoload_register('my_autoloader'); diff --git a/public/rsc/js/app.js b/public/w/rsc/js/app.js index 1f1df61..1f1df61 100644 --- a/public/rsc/js/app.js +++ b/public/w/rsc/js/app.js diff --git a/public/rsc/js/mermaid.min.js b/public/w/rsc/js/mermaid.min.js index 85ec05d..85ec05d 100644 --- a/public/rsc/js/mermaid.min.js +++ b/public/w/rsc/js/mermaid.min.js |