Compare commits

...

4 Commits

Author SHA1 Message Date
Jean-Christian Paul Denis 5799443ffd
release 1.2.1 2023-11-04 11:55:04 +01:00
Jean-Christian Paul Denis 2a4939bbd5
code review 2023-11-04 11:54:04 +01:00
Jean-Christian Paul Denis d8dc27223e
use tpl appendPath 2023-11-04 11:47:16 +01:00
Jean-Christian Paul Denis 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
===========================================================
* Require Dotclear 2.28

View File

@ -1,7 +1,7 @@
# README
[![Release](https://img.shields.io/badge/release-1.2-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/filesAlias/releases)
![Date](https://img.shields.io/badge/date-2023.10.17-c44d58.svg)
[![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.11.04-c44d58.svg)
[![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)
[![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))
* [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))
* [Discuss & help](https://forum.dotclear.org/viewtopic.php?id=42317)
## CONTRIBUTORS

View File

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

View File

@ -2,10 +2,10 @@
<modules xmlns:da="http://dotaddict.org/da/">
<module id="filesAlias">
<name>Files alias</name>
<version>1.2</version>
<version>1.2.1</version>
<author>Osku and contributors</author>
<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: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>

View File

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

View File

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

View File

@ -67,7 +67,7 @@ class Manage extends Process
$password = empty($_POST['filesalias_password']) ? '' : $_POST['filesalias_password'];
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);
if (!empty($found)) {
@ -139,19 +139,19 @@ class Manage extends Process
// destination
(new Para())->items([
(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'),
// url
(new Para())->items([
(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'),
// password
(new Para())->items([
(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
(new Para())->items([
@ -198,13 +198,13 @@ class Manage extends Process
$lines .= '<tr class="line" id="l_' . $i . '">' .
'<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>' .
(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>' .
'<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 class="maximal">' .
(new Checkbox(['a[' . $i . '][filesalias_disposable]'], $disposable))->value(1)->render() .

View File

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