filealias; $aliases = $o->getAliases(); $media = new dcMedia(); $a = new aliasMedia(); $part = $_REQUEST['part'] ?? 'list'; # Update aliases 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'); } catch (Exception $e) { dcCore::app()->error->add($e->getMessage()); } } # New alias if (isset($_POST['filesalias_url'])) { $url = empty($_POST['filesalias_url']) ? PallazzoTools::rand_uniqid() : $_POST['filesalias_url']; $target = $_POST['filesalias_destination']; $totrash = isset($_POST['filesalias_disposable']) ? true : false; $password = empty($_POST['filesalias_password']) ? '' : $_POST['filesalias_password']; if (preg_match('/^' . preg_quote($media->root_url, '/') . '/', $target)) { $target = preg_replace('/^' . preg_quote($media->root_url, '/') . '/', '', $target); $found = $a->getMediaId($target); if (!empty($found)) { try { $o->createAlias($url, $target, $totrash, $password); dcAdminNotices::addSuccessNotice(__('Alias for this media created.')); dcCore::app()->adminurl->redirect('admin.plugin.filesAlias'); } catch (Exception $e) { dcCore::app()->error->add($e->getMessage()); } } else { dcCore::app()->error->add(__('Target is not in media manager.')); } } else { $found = $a->getMediaId($target); if (!empty($found)) { try { $o->createAlias($url, $target, $totrash, $password); dcAdminNotices::addSuccessNotice(__('Alias for this media modified.')); dcCore::app()->adminurl->redirect('admin.plugin.filesAlias'); } catch (Exception $e) { dcCore::app()->error->add($e->getMessage()); } } else { dcCore::app()->error->add(__('Target is not in media manager.')); } } } ?>
' . __('No alias') . '
'; } else { echo ''; } } dcPage::helpBlock('filesAlias'); ?>