diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2019-08-09 12:04:52 +0200 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2019-08-09 12:04:52 +0200 |
commit | 95ada5c09026882f384a4a386916b1b2decbfce9 (patch) | |
tree | 8826115b693e10aa4ed36dceaad6b8d6dffef5bf /app | |
parent | 49f827b172dd3c07e3c4562a261557feb1ef03f6 (diff) | |
download | wcms-95ada5c09026882f384a4a386916b1b2decbfce9.tar.gz wcms-95ada5c09026882f384a4a386916b1b2decbfce9.zip |
Feature : %CONNECT%
+ fix terminal.css
Diffstat (limited to 'app')
-rw-r--r-- | app/class/modelrender.php | 80 | ||||
-rw-r--r-- | app/view/templates/user.php | 10 |
2 files changed, 41 insertions, 49 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); diff --git a/app/view/templates/user.php b/app/view/templates/user.php index 4717ee6..6e302f8 100644 --- a/app/view/templates/user.php +++ b/app/view/templates/user.php @@ -49,7 +49,7 @@ <table> <tr> -<th>id</th><th>password</th><th>hash</th><th>level</th><th>set expiration date</th><th>action</th><th>expire</th> +<th>id</th><th>password</th><th>hash</th><th>level</th><th>set expiration date</th><th>action</th><th>expire</th><th>connect</th> </tr> <tr> @@ -84,6 +84,10 @@ <td> </td> + <td> + + </td> + </form> </tr> @@ -138,6 +142,10 @@ foreach ($userlist as $user ) { <?= $user->expiredate('hrdi') ?> </td> + <td> + <?= $user->connectcount() ?> + </td> + </tr> |