Compare commits

..

4 Commits
v1.2 ... master

Author SHA1 Message Date
5799443ffd
release 1.2.1 2023-11-04 11:55:04 +01:00
2a4939bbd5
code review 2023-11-04 11:54:04 +01:00
d8dc27223e
use tpl appendPath 2023-11-04 11:47:16 +01:00
2bbf822463
fix typo 2023-11-04 11:46:53 +01:00
8 changed files with 23 additions and 16 deletions

View File

@ -1,3 +1,10 @@
filesAlias 1.2.1 - 2023.11.04
===========================================================
* Require Dotclear 2.28
* Require PHP 8.1
* Fix typo
* Code review
filesAlias 1.2 - 2023.10.17 filesAlias 1.2 - 2023.10.17
=========================================================== ===========================================================
* Require Dotclear 2.28 * Require Dotclear 2.28

View File

@ -1,7 +1,7 @@
# README # README
[![Release](https://img.shields.io/badge/release-1.2-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/filesAlias/releases) [![Release](https://img.shields.io/badge/release-1.2.1-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/filesAlias/releases)
![Date](https://img.shields.io/badge/date-2023.10.17-c44d58.svg) ![Date](https://img.shields.io/badge/date-2023.11.04-c44d58.svg)
[![Dotclear](https://img.shields.io/badge/dotclear-v2.28-137bbb.svg)](https://fr.dotclear.org/download) [![Dotclear](https://img.shields.io/badge/dotclear-v2.28-137bbb.svg)](https://fr.dotclear.org/download)
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/filesAlias) [![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/filesAlias)
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/filesAlias/src/branch/master/LICENSE) [![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/filesAlias/src/branch/master/LICENSE)
@ -32,6 +32,7 @@ You can change public URL handler (default is _pub/_) by using plugin myUrlhandl
* [Packages & details](https://git.dotclear.watch/JcDenis/filesAlias/releases) (or on [Dotaddict](https://plugins.dotaddict.org/dc2/details/filesAlias)) * [Packages & details](https://git.dotclear.watch/JcDenis/filesAlias/releases) (or on [Dotaddict](https://plugins.dotaddict.org/dc2/details/filesAlias))
* [Sources & contributions](https://git.dotclear.watch/JcDenis/filesAlias) (or on [GitHub](https://github.com/JcDenis/filesAlias)) * [Sources & contributions](https://git.dotclear.watch/JcDenis/filesAlias) (or on [GitHub](https://github.com/JcDenis/filesAlias))
* [Issues & security](https://git.dotclear.watch/JcDenis/filesAlias/issues) (or on [GitHub](https://github.com/JcDenis/filesAlias/issues)) * [Issues & security](https://git.dotclear.watch/JcDenis/filesAlias/issues) (or on [GitHub](https://github.com/JcDenis/filesAlias/issues))
* [Discuss & help](https://forum.dotclear.org/viewtopic.php?id=42317)
## CONTRIBUTORS ## CONTRIBUTORS

View File

@ -18,7 +18,7 @@ $this->registerModule(
'Files alias', 'Files alias',
"Manage aliases of your blog's media", "Manage aliases of your blog's media",
'Osku and contributors', 'Osku and contributors',
'1.2', '1.2.1',
[ [
'requires' => [['core', '2.28']], 'requires' => [['core', '2.28']],
'permissions' => 'My', 'permissions' => 'My',

View File

@ -2,10 +2,10 @@
<modules xmlns:da="http://dotaddict.org/da/"> <modules xmlns:da="http://dotaddict.org/da/">
<module id="filesAlias"> <module id="filesAlias">
<name>Files alias</name> <name>Files alias</name>
<version>1.2</version> <version>1.2.1</version>
<author>Osku and contributors</author> <author>Osku and contributors</author>
<desc>Manage aliases of your blog's media</desc> <desc>Manage aliases of your blog's media</desc>
<file>https://git.dotclear.watch/JcDenis/filesAlias/releases/download/v1.2/plugin-filesAlias.zip</file> <file>https://git.dotclear.watch/JcDenis/filesAlias/releases/download/v1.2.1/plugin-filesAlias.zip</file>
<da:dcmin>2.28</da:dcmin> <da:dcmin>2.28</da:dcmin>
<da:details>https://git.dotclear.watch/JcDenis/filesAlias/src/branch/master/README.md</da:details> <da:details>https://git.dotclear.watch/JcDenis/filesAlias/src/branch/master/README.md</da:details>
<da:support>https://git.dotclear.watch/JcDenis/filesAlias/issues</da:support> <da:support>https://git.dotclear.watch/JcDenis/filesAlias/issues</da:support>

View File

@ -29,8 +29,7 @@ class Frontend extends Process
} }
// add path to template // add path to template
App::frontend()->template()->setPath( App::frontend()->template()->appendPath(
App::frontend()->template()->getPath(),
My::path() . DIRECTORY_SEPARATOR . 'default-templates' My::path() . DIRECTORY_SEPARATOR . 'default-templates'
); );
// register template value for file alias // register template value for file alias

View File

@ -24,7 +24,7 @@ class FrontendTemplate
* *
* - any filters See Tpl::getFilters() * - any filters See Tpl::getFilters()
* *
* @param ArrayObject $attr The attributes * @param ArrayObject<string, mixed> $attr The attributes
* *
* @return string * @return string
*/ */

View File

@ -67,7 +67,7 @@ class Manage extends Process
$password = empty($_POST['filesalias_password']) ? '' : $_POST['filesalias_password']; $password = empty($_POST['filesalias_password']) ? '' : $_POST['filesalias_password'];
if (preg_match('/^' . preg_quote(App::media()->root_url, '/') . '/', $target)) { if (preg_match('/^' . preg_quote(App::media()->root_url, '/') . '/', $target)) {
$target = preg_replace('/^' . preg_quote(App::media()->root_url, '/') . '/', '', $target); $target = (string) preg_replace('/^' . preg_quote(App::media()->root_url, '/') . '/', '', $target);
$found = Utils::getMediaId($target); $found = Utils::getMediaId($target);
if (!empty($found)) { if (!empty($found)) {
@ -139,19 +139,19 @@ class Manage extends Process
// destination // destination
(new Para())->items([ (new Para())->items([
(new Label(__('Destination:')))->for('filesalias_destination')->class('required'), (new Label(__('Destination:')))->for('filesalias_destination')->class('required'),
(new Input('filesalias_destination'))->size(70)->maxlenght(255), (new Input('filesalias_destination'))->size(70)->maxlength(255),
]), ]),
(new Note())->text(__('Destination file must be in media manager.'))->class('form-note'), (new Note())->text(__('Destination file must be in media manager.'))->class('form-note'),
// url // url
(new Para())->items([ (new Para())->items([
(new Label(__('URL (alias):')))->for('filesalias_url')->class('required'), (new Label(__('URL (alias):')))->for('filesalias_url')->class('required'),
(new Input('filesalias_url'))->size(70)->maxlenght(255), (new Input('filesalias_url'))->size(70)->maxlength(255),
]), ]),
(new Note())->text(__('Leave empty to get a randomize alias.'))->class('form-note'), (new Note())->text(__('Leave empty to get a randomize alias.'))->class('form-note'),
// password // password
(new Para())->items([ (new Para())->items([
(new Label(__('Password:')))->for('filesalias_password')->class('required'), (new Label(__('Password:')))->for('filesalias_password')->class('required'),
(new Input('filesalias_password'))->size(70)->maxlenght(255), (new Input('filesalias_password'))->size(70)->maxlength(255),
]), ]),
// disposable // disposable
(new Para())->items([ (new Para())->items([
@ -198,13 +198,13 @@ class Manage extends Process
$lines .= '<tr class="line" id="l_' . $i . '">' . $lines .= '<tr class="line" id="l_' . $i . '">' .
'<td>' . '<td>' .
(new Input(['a[' . $i . '][filesalias_destination]']))->size(50)->maxlenght(255)->value(Html::escapeHTML($destination))->render() . (new Input(['a[' . $i . '][filesalias_destination]']))->size(50)->maxlength(255)->value(Html::escapeHTML($destination))->render() .
'</td>' . '</td>' .
'<td>' . '<td>' .
(new Input(['a[' . $i . '][filesalias_url]']))->size(50)->maxlenght(255)->value(Html::escapeHTML($url))->render() . (new Input(['a[' . $i . '][filesalias_url]']))->size(50)->maxlength(255)->value(Html::escapeHTML($url))->render() .
'<a href="' . $full . '">' . __('link') . '</a></td>' . '<a href="' . $full . '">' . __('link') . '</a></td>' .
'<td>' . '<td>' .
(new Input(['a[' . $i . '][filesalias_password]']))->size(50)->maxlenght(255)->value(Html::escapeHTML($password))->render() . (new Input(['a[' . $i . '][filesalias_password]']))->size(50)->maxlength(255)->value(Html::escapeHTML($password))->render() .
'</td>' . '</td>' .
'<td class="maximal">' . '<td class="maximal">' .
(new Checkbox(['a[' . $i . '][filesalias_disposable]'], $disposable))->value(1)->render() . (new Checkbox(['a[' . $i . '][filesalias_disposable]'], $disposable))->value(1)->render() .

View File

@ -177,6 +177,6 @@ class Utils
->and('media_file = ' . $sql->quote($target)) ->and('media_file = ' . $sql->quote($target))
->select(); ->select();
return $rs->count() ? (int) $rs->f('media_id') : 0; return !is_null($rs) && $rs->count() ? (int) $rs->f('media_id') : 0;
} }
} }