use abstract plugin id
This commit is contained in:
parent
b7e3a0bdec
commit
652deff380
12
_admin.php
12
_admin.php
@ -16,18 +16,18 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
||||
|
||||
dcCore::app()->menu[dcAdmin::MENU_BLOG]->addItem(
|
||||
__('Media sharing'),
|
||||
dcCore::app()->adminurl->get('admin.plugin.filesAlias'),
|
||||
urldecode(dcPage::getPF('filesAlias/icon.svg')),
|
||||
preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.filesAlias')) . '(&.*)?$/', $_SERVER['REQUEST_URI']),
|
||||
dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__)),
|
||||
urldecode(dcPage::getPF(basename(__DIR__) . '/icon.svg')),
|
||||
preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__))) . '(&.*)?$/', $_SERVER['REQUEST_URI']),
|
||||
dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([dcAuth::PERMISSION_CONTENT_ADMIN]), dcCore::app()->blog->id)
|
||||
);
|
||||
|
||||
dcCore::app()->addBehavior('adminDashboardFavoritesV2', function (dcFavorites $favs) {
|
||||
$favs->register('filesAlias', [
|
||||
'title' => __('Media sharing'),
|
||||
'url' => dcCore::app()->adminurl->get('admin.plugin.filesAlias'),
|
||||
'small-icon' => dcPage::getPF('filesAlias/icon.svg'),
|
||||
'large-icon' => dcPage::getPF('filesAlias/icon.svg'),
|
||||
'url' => dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__)),
|
||||
'small-icon' => dcPage::getPF(basename(__DIR__) . '/icon.svg'),
|
||||
'large-icon' => dcPage::getPF(basename(__DIR__) . '/icon.svg'),
|
||||
'permissions' => dcCore::app()->auth->makePermissions([
|
||||
dcAuth::PERMISSION_USAGE,
|
||||
dcAuth::PERMISSION_CONTENT_ADMIN,
|
||||
|
@ -20,7 +20,7 @@ Clearbricks::lib()->autoload([
|
||||
'PallazzoTools' => __DIR__ . '/inc/lib.files.alias.tools.php',
|
||||
]);
|
||||
|
||||
dcCore::app()->filealias = new filesAliases();
|
||||
dcCore::app()->__set('filealias', new filesAliases());
|
||||
|
||||
dcCore::app()->url->register(
|
||||
'filesalias',
|
||||
|
16
_public.php
16
_public.php
@ -33,27 +33,27 @@ class urlFilesAlias extends dcUrlHandlers
|
||||
{
|
||||
$delete = false;
|
||||
|
||||
dcCore::app()->ctx->filealias = dcCore::app()->filealias->getAlias($args);
|
||||
dcCore::app()->ctx->__set('filealias', dcCore::app()->__get('filealias')->getAlias($args));
|
||||
|
||||
if (dcCore::app()->ctx->filealias->isEmpty()) {
|
||||
if (dcCore::app()->ctx->__get('filealias')->isEmpty()) {
|
||||
self::p404();
|
||||
}
|
||||
|
||||
if (dcCore::app()->ctx->filealias->filesalias_disposable) {
|
||||
if (dcCore::app()->ctx->__get('filealias')->filesalias_disposable) {
|
||||
$delete = true;
|
||||
}
|
||||
|
||||
if (dcCore::app()->ctx->filealias->filesalias_password) {
|
||||
if (dcCore::app()->ctx->__get('filealias')->filesalias_password) {
|
||||
# Check for match
|
||||
if (!empty($_POST['filepassword']) && $_POST['filepassword'] == dcCore::app()->ctx->filealias->filesalias_password) {
|
||||
self::servefile(dcCore::app()->ctx->filealias->filesalias_destination, $args, $delete);
|
||||
if (!empty($_POST['filepassword']) && $_POST['filepassword'] == dcCore::app()->ctx->__get('filealias')->filesalias_password) {
|
||||
self::servefile(dcCore::app()->ctx->__get('filealias')->filesalias_destination, $args, $delete);
|
||||
} else {
|
||||
self::serveDocument('file-password-form.html', 'text/html', false);
|
||||
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
self::servefile(dcCore::app()->ctx->filealias->filesalias_destination, $args, $delete);
|
||||
self::servefile(dcCore::app()->ctx->__get('filealias')->filesalias_destination, $args, $delete);
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ class urlFilesAlias extends dcUrlHandlers
|
||||
|
||||
readfile($file->file);
|
||||
if ($delete) {
|
||||
dcCore::app()->filealias->deleteAlias($alias);
|
||||
dcCore::app()->__get('filealias')->deleteAlias($alias);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
16
index.php
16
index.php
@ -14,7 +14,7 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$o = dcCore::app()->filealias;
|
||||
$o = dcCore::app()->__get('filealias');
|
||||
$aliases = $o->getAliases();
|
||||
$media = new dcMedia();
|
||||
$a = new aliasMedia();
|
||||
@ -25,7 +25,7 @@ if (isset($_POST['a']) && is_array($_POST['a'])) {
|
||||
try {
|
||||
$o->updateAliases($_POST['a']);
|
||||
dcAdminNotices::addSuccessNotice(__('Aliases successfully updated.'));
|
||||
dcCore::app()->adminurl->redirect('admin.plugin.filesAlias');
|
||||
dcCore::app()->adminurl->redirect('admin.plugin.' . basename(__DIR__));
|
||||
} catch (Exception $e) {
|
||||
dcCore::app()->error->add($e->getMessage());
|
||||
}
|
||||
@ -47,7 +47,7 @@ if (isset($_POST['filesalias_url'])) {
|
||||
try {
|
||||
$o->createAlias($url, $target, $totrash, $password);
|
||||
dcAdminNotices::addSuccessNotice(__('Alias for this media created.'));
|
||||
dcCore::app()->adminurl->redirect('admin.plugin.filesAlias');
|
||||
dcCore::app()->adminurl->redirect('admin.plugin.' . basename(__DIR__));
|
||||
} catch (Exception $e) {
|
||||
dcCore::app()->error->add($e->getMessage());
|
||||
}
|
||||
@ -61,7 +61,7 @@ if (isset($_POST['filesalias_url'])) {
|
||||
try {
|
||||
$o->createAlias($url, $target, $totrash, $password);
|
||||
dcAdminNotices::addSuccessNotice(__('Alias for this media modified.'));
|
||||
dcCore::app()->adminurl->redirect('admin.plugin.filesAlias');
|
||||
dcCore::app()->adminurl->redirect('admin.plugin.' . basename(__DIR__));
|
||||
} catch (Exception $e) {
|
||||
dcCore::app()->error->add($e->getMessage());
|
||||
}
|
||||
@ -83,11 +83,11 @@ if ($part == 'new') {
|
||||
echo
|
||||
dcPage::breadcrumb([
|
||||
html::escapeHTML(dcCore::app()->blog->name) => '',
|
||||
__('Media sharing') => dcCore::app()->adminurl->get('admin.plugin.filesAlias'),
|
||||
__('Media sharing') => dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__)),
|
||||
__('New alias') => '',
|
||||
]) .
|
||||
dcPage::notices() .
|
||||
'<form action="' . dcCore::app()->adminurl->get('admin.plugin.filesAlias') . '" method="post">' .
|
||||
'<form action="' . dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__)) . '" method="post">' .
|
||||
'<h3>' . __('New alias') . '</h3>' .
|
||||
'<p ><label for="filesalias_destination" class="required">' . __('Destination:') . ' </label>' .
|
||||
form::field('filesalias_destination', 70, 255) . '</p>' .
|
||||
@ -113,14 +113,14 @@ if ($part == 'new') {
|
||||
]) .
|
||||
dcPage::notices() .
|
||||
'<p class="top-add"><a class="button add" href="' .
|
||||
dcCore::app()->adminurl->get('admin.plugin.filesAlias', ['part' => 'new']) .
|
||||
dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__), ['part' => 'new']) .
|
||||
'">' . __('New alias') . '</a></p>';
|
||||
|
||||
if (empty($aliases)) {
|
||||
echo '<p>' . __('No alias') . '</p>';
|
||||
} else {
|
||||
echo
|
||||
'<form action="' . dcCore::app()->adminurl->get('admin.plugin.filesAlias') . '" method="post">' .
|
||||
'<form action="' . dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__)) . '" method="post">' .
|
||||
'<div class="table-outer">' .
|
||||
'<table><thead>' .
|
||||
'<caption>' . __('Aliases list') . '</caption>' .
|
||||
|
Loading…
Reference in New Issue
Block a user