aboutsummaryrefslogtreecommitdiff
path: root/app/class
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2019-08-09 12:04:52 +0200
committervincent-peugnet <v.peugnet@free.fr>2019-08-09 12:04:52 +0200
commit95ada5c09026882f384a4a386916b1b2decbfce9 (patch)
tree8826115b693e10aa4ed36dceaad6b8d6dffef5bf /app/class
parent49f827b172dd3c07e3c4562a261557feb1ef03f6 (diff)
downloadwcms-95ada5c09026882f384a4a386916b1b2decbfce9.tar.gz
wcms-95ada5c09026882f384a4a386916b1b2decbfce9.zip
Feature : %CONNECT%
+ fix terminal.css
Diffstat (limited to 'app/class')
-rw-r--r--app/class/modelrender.php80
1 files changed, 32 insertions, 48 deletions
diff --git a/app/class/modelrender.php b/app/class/modelrender.php
index cc3b753..fb6e002 100644
--- a/app/class/modelrender.php
+++ b/app/class/modelrender.php
@@ -289,6 +289,8 @@ class Modelrender extends Modelart
$text = $this->autourl($text);
+ $text = $this->authenticate($text);
+
return $text;
}
@@ -420,54 +422,6 @@ class Modelrender extends Modelart
return $text;
}
- public function aautomedialist(string $text) : string
- {
-
-
-
- $text = preg_replace_callback(
- '~\%MEDIA:(([a-z0-9-_]+(\/([a-z0-9-_])+)*))\%~',
- function ($matches) {
- $dir = trim($matches[1], '/');
- $mediamanager = new Modelmedia();
-
-
-
- if (is_dir(Model::MEDIA_DIR . $dir)) {
- $medialist = $mediamanager->getlistermedia(Model::MEDIA_DIR . $dir . '/');
-
- $dirid = str_replace('/', '-', $dir);
-
- $ul = '<div class="medialist" id="' . $dirid . '">' . PHP_EOL;
-
- foreach ($medialist as $media) {
- $ul .= '<div class="content ' . $media->type() . '">';
- if ($media->type() == 'image') {
- $ul .= '<img alt="' . $media->id() . '" id="' . $media->id() . '" src="' . $media->getincludepath() . '" >';
- } elseif ($media->type() == 'sound') {
- $ul .= '<audio id="' . $media->id() . '" controls src="' . $media->getincludepath() . '" </audio>';
- } elseif ($media->type() == 'video') {
- $ul .= '<video controls><source src="' . $media->getincludepath() . '" type="video/' . $media->extension() . '"></video>';
- } elseif ($media->type() == 'other') {
- $ul .= '<a href="' . $media->getincludepath() . '" target="_blank" class="media" >' . $media->id() . '.' . $media->extension() . '</a>';
- }
- $ul .= '</div>' . PHP_EOL;
- }
-
- $ul .= '</div>' . PHP_EOL;
-
- return $ul;
- } else {
- return 'directory "' . $dir . '" not found';
- }
- },
- $text
- );
-
- return $text;
- }
-
-
function sumparser($text)
{
@@ -605,6 +559,36 @@ class Modelrender extends Modelart
+ /**
+ * @param string $text content to analyse and replace
+ *
+ * @return string text ouput
+ */
+ public function authenticate(string $text)
+ {
+ $id = $this->art->id();
+ $regex = '~\%CONNECT(\?dir=([a-zA-Z0-9-_]+))?\%~';
+ $text = preg_replace_callback($regex, function ($matches) use ($id) {
+ if(isset($matches[2])) {
+ $id = $matches[2];
+ }
+ $form = '<form action="/!co" method="post">
+ <input type="password" name="pass" id="loginpass" placeholder="password">
+ <input type="hidden" name="route" value="artread/">
+ <input type="hidden" name="id" value="' . $id . '">
+ <input type="submit" name="log" value="login" id="button">
+ </form>';
+ return $form;
+
+ }, $text);
+ return $text;
+ }
+
+
+
+
+
+
public function linkfrom()
{
sort($this->linkfrom);