use short settings id
This commit is contained in:
parent
59a603437c
commit
19aec0309d
19 changed files with 150 additions and 261 deletions
14
_admin.php
14
_admin.php
|
@ -28,7 +28,7 @@ dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
|||
);
|
||||
|
||||
# Admin behaviors
|
||||
if (dcCore::app()->blog->settings->get(basename(__DIR__))->get('kutrl_active')) {
|
||||
if (dcCore::app()->blog->settings->get(basename(__DIR__))->get('active')) {
|
||||
dcCore::app()->addBehavior('adminDashboardFavoritesV2', ['adminKutrl', 'antispamDashboardFavoritesV2']);
|
||||
dcCore::app()->addBehavior('adminColumnsListsV2', ['adminKutrl', 'adminColumnsListsV2']);
|
||||
dcCore::app()->addBehavior('adminFiltersListsV2', ['adminKutrl', 'adminFiltersListsV2']);
|
||||
|
@ -106,7 +106,7 @@ class adminKutrl
|
|||
{
|
||||
$s = dcCore::app()->blog->settings->get(basename(__DIR__));
|
||||
|
||||
if (!$s->get('kutrl_active') || !$s->get('kutrl_admin_service')) {
|
||||
if (!$s->get('active') || !$s->get('active')) {
|
||||
return null;
|
||||
}
|
||||
if (null === ($kut = kUtRL::quickPlace('admin'))) {
|
||||
|
@ -125,7 +125,7 @@ class adminKutrl
|
|||
form::hidden(['kutrl_old_post_url'], $post_url);
|
||||
|
||||
if (!$rs) {
|
||||
if (empty($_POST['kutrl_old_post_url']) && $s->get('kutrl_admin_entry_default')) {
|
||||
if (empty($_POST['kutrl_old_post_url']) && $s->get('admin_entry_default')) {
|
||||
$chk = true;
|
||||
} else {
|
||||
$chk = !empty($_POST['kutrl_create']);
|
||||
|
@ -164,7 +164,7 @@ class adminKutrl
|
|||
public static function adminAfterPostUpdate($cur, $post_id)
|
||||
{
|
||||
# Create: see adminAfterPostCreate
|
||||
if (!empty($_POST['kutrl_create']) || !dcCore::app()->blog->settings->get(basename(__DIR__))->get('kutrl_active')) {
|
||||
if (!empty($_POST['kutrl_create']) || !dcCore::app()->blog->settings->get(basename(__DIR__))->get('active')) {
|
||||
return null;
|
||||
}
|
||||
if (null === ($kut = kUtRL::quickPlace('admin'))) {
|
||||
|
@ -210,7 +210,7 @@ class adminKutrl
|
|||
|
||||
public static function adminAfterPostCreate($cur, $post_id)
|
||||
{
|
||||
if (empty($_POST['kutrl_create']) || !dcCore::app()->blog->settings->get(basename(__DIR__))->get('kutrl_active')) {
|
||||
if (empty($_POST['kutrl_create']) || !dcCore::app()->blog->settings->get(basename(__DIR__))->get('active')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -238,7 +238,7 @@ class adminKutrl
|
|||
|
||||
public static function adminBeforePostDelete($post_id)
|
||||
{
|
||||
if (!dcCore::app()->blog->settings->get(basename(__DIR__))->get('kutrl_active')) {
|
||||
if (!dcCore::app()->blog->settings->get(basename(__DIR__))->get('active')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -256,7 +256,7 @@ class adminKutrl
|
|||
|
||||
public static function adminPostsActions(dcPostsActions $pa)
|
||||
{
|
||||
if (!dcCore::app()->blog->settings->get(basename(__DIR__))->get('kutrl_active')
|
||||
if (!dcCore::app()->blog->settings->get(basename(__DIR__))->get('active')
|
||||
|| !dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([dcAuth::PERMISSION_ADMIN]), dcCore::app()->blog->id)) {
|
||||
return null;
|
||||
}
|
||||
|
|
36
_config.php
36
_config.php
|
@ -32,15 +32,15 @@ foreach (kUtRL::getServices() as $service_id => $service) {
|
|||
$ext_services_combo = array_merge([__('Disabled') => ''], $services_combo);
|
||||
$lst_services_combo = array_merge(['-' => ''], $services_combo);
|
||||
|
||||
$s_active = (bool) $s->get('kutrl_active');
|
||||
$s_plugin_service = (string) $s->get('kutrl_plugin_service');
|
||||
$s_admin_service = (string) $s->get('kutrl_admin_service');
|
||||
$s_tpl_service = (string) $s->get('kutrl_tpl_service');
|
||||
$s_wiki_service = (string) $s->get('kutrl_wiki_service');
|
||||
$s_allow_external_url = (bool) $s->get('kutrl_allow_external_url');
|
||||
$s_tpl_passive = (bool) $s->get('kutrl_tpl_passive');
|
||||
$s_tpl_active = (bool) $s->get('kutrl_tpl_active');
|
||||
$s_admin_entry_default = (string) $s->get('kutrl_admin_entry_default');
|
||||
$s_active = (bool) $s->get('active');
|
||||
$s_plugin_service = (string) $s->get('plugin_service');
|
||||
$s_admin_service = (string) $s->get('admin_service');
|
||||
$s_tpl_service = (string) $s->get('tpl_service');
|
||||
$s_wiki_service = (string) $s->get('wiki_service');
|
||||
$s_allow_external_url = (bool) $s->get('allow_external_url');
|
||||
$s_tpl_passive = (bool) $s->get('tpl_passive');
|
||||
$s_tpl_active = (bool) $s->get('tpl_active');
|
||||
$s_admin_entry_default = (string) $s->get('admin_entry_default');
|
||||
|
||||
if (!empty($_POST['save'])) {
|
||||
try {
|
||||
|
@ -55,15 +55,15 @@ if (!empty($_POST['save'])) {
|
|||
$s_tpl_active = !empty($_POST['s_tpl_active']);
|
||||
$s_admin_entry_default = !empty($_POST['s_admin_entry_default']);
|
||||
|
||||
$s->put('kutrl_active', $s_active);
|
||||
$s->put('kutrl_plugin_service', $s_plugin_service);
|
||||
$s->put('kutrl_admin_service', $s_admin_service);
|
||||
$s->put('kutrl_tpl_service', $s_tpl_service);
|
||||
$s->put('kutrl_wiki_service', $s_wiki_service);
|
||||
$s->put('kutrl_allow_external_url', $s_allow_external_url);
|
||||
$s->put('kutrl_tpl_passive', $s_tpl_passive);
|
||||
$s->put('kutrl_tpl_active', $s_tpl_active);
|
||||
$s->put('kutrl_admin_entry_default', $s_admin_entry_default);
|
||||
$s->put('active', $s_active);
|
||||
$s->put('plugin_service', $s_plugin_service);
|
||||
$s->put('admin_service', $s_admin_service);
|
||||
$s->put('tpl_service', $s_tpl_service);
|
||||
$s->put('wiki_service', $s_wiki_service);
|
||||
$s->put('allow_external_url', $s_allow_external_url);
|
||||
$s->put('tpl_passive', $s_tpl_passive);
|
||||
$s->put('tpl_active', $s_tpl_active);
|
||||
$s->put('admin_entry_default', $s_admin_entry_default);
|
||||
|
||||
# services
|
||||
foreach (kUtRL::getServices() as $service_id => $service) {
|
||||
|
|
79
_install.php
79
_install.php
|
@ -15,7 +15,7 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
|||
}
|
||||
|
||||
try {
|
||||
# Compare versions
|
||||
// Compare versions
|
||||
if (!dcCore::app()->newVersion(
|
||||
basename(__DIR__),
|
||||
dcCore::app()->plugins->moduleInfo(basename(__DIR__), 'version')
|
||||
|
@ -23,7 +23,7 @@ try {
|
|||
return null;
|
||||
}
|
||||
|
||||
# Table
|
||||
// Table
|
||||
$t = new dbStruct(dcCore::app()->con, dcCore::app()->prefix);
|
||||
$t->{initkUtRL::KURL_TABLE_NAME}
|
||||
->kut_id('bigint', 0, false)
|
||||
|
@ -45,35 +45,54 @@ try {
|
|||
$ti = new dbStruct(dcCore::app()->con, dcCore::app()->prefix);
|
||||
$changes = $ti->synchronize($t);
|
||||
|
||||
# Settings
|
||||
$s = dcCore::app()->blog->settings->addNamespace(basename(__DIR__));
|
||||
// upgrade version < 2022.12.22 : upgrade settings id and ns and array
|
||||
$current = dcCore::app()->getVersion(basename(__DIR__));
|
||||
if ($current && version_compare($current, '2022.12.22', '<')) {
|
||||
$record = dcCore::app()->con->select(
|
||||
'SELECT * FROM ' . dcCore::app()->prefix . dcNamespace::NS_TABLE_NAME . ' ' .
|
||||
"WHERE setting_ns = 'kUtRL' "
|
||||
);
|
||||
while ($record->fetch()) {
|
||||
if (preg_match('/^kutrl_(.*?)$/', $record->setting_id, $match)) {
|
||||
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . dcNamespace::NS_TABLE_NAME);
|
||||
// avoid the use of serialize function
|
||||
if (in_array($record->setting_id, ['kutrl_srv_custom'])) {
|
||||
$cur->setting_value = json_encode(@unserialize(base64_decode((string) $record->setting_value)));
|
||||
}
|
||||
$cur->setting_id = $match[1];
|
||||
$cur->setting_ns = basename(__DIR__);
|
||||
$cur->update(
|
||||
"WHERE setting_id = '" . $record->setting_id . "' and setting_ns = 'kUtRL' " .
|
||||
'AND blog_id ' . (null === $record->blog_id ? 'IS NULL ' : ("= '" . dcCore::app()->con->escape($record->blog_id) . "' "))
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Settings
|
||||
$s = dcCore::app()->blog->settings->addNamespace(basename(__DIR__));
|
||||
|
||||
$s->put('kutrl_active', false, 'boolean', 'Enabled kutrl plugin', false, true);
|
||||
$s->put('kutrl_plugin_service', 'default', 'string', 'Service to use to shorten links on third part plugins', false, true);
|
||||
$s->put('kutrl_admin_service', 'local', 'string', 'Service to use to shorten links on admin', false, true);
|
||||
$s->put('kutrl_tpl_service', 'local', 'string', 'Service to use to shorten links on template', false, true);
|
||||
$s->put('kutrl_wiki_service', 'local', 'string', 'Service to use to shorten links on contents', false, true);
|
||||
$s->put('kutrl_allow_external_url', true, 'boolean', 'Limited short url to current blog\'s url', false, true);
|
||||
$s->put('kutrl_tpl_passive', true, 'boolean', 'Return long url on kutrl tags if kutrl is unactivate', false, true);
|
||||
$s->put('kutrl_tpl_active', false, 'boolean', 'Return short url on dotclear tags if kutrl is active', false, true);
|
||||
$s->put('kutrl_admin_entry_default', true, 'boolean', 'Create short link on new entry by default', false, true);
|
||||
# Settings for "local" service
|
||||
$local_css = ".shortenkutrlwidget input { border: 1px solid #CCCCCC; }\n" .
|
||||
'.dc-kutrl input { border: 1px solid #CCCCCC; margin: 10px; }';
|
||||
$s->put('kutrl_srv_local_protocols', 'http:,https:,ftp:,ftps:,irc:', 'string', 'Allowed kutrl local service protocols', false, true);
|
||||
$s->put('kutrl_srv_local_public', false, 'boolean', 'Enabled local service public page', false, true);
|
||||
$s->put('kutrl_srv_local_css', $local_css, 'string', 'Special CSS for kutrl local service', false, true);
|
||||
$s->put('kutrl_srv_local_404_active', false, 'boolean', 'Use special 404 page on unknow urls', false, true);
|
||||
# Settings for "bilbolinks" service
|
||||
$s->put('kutrl_srv_bilbolinks_base', 'http://tux-pla.net/', 'string', 'URL of bilbolinks service', false, true);
|
||||
# Settings for "YOURLS" service
|
||||
$s->put('kutrl_srv_yourls_base', '', 'string', 'URL of YOURLS service', false, true);
|
||||
$s->put('kutrl_srv_yourls_username', '', 'string', 'User name to YOURLS service', false, true);
|
||||
$s->put('kutrl_srv_yourls_password', '', 'string', 'User password to YOURLS service', false, true);
|
||||
|
||||
# Get dcMiniUrl records as this plugin do the same
|
||||
if (dcCore::app()->plugins->moduleExists('dcMiniUrl')) {
|
||||
require_once __DIR__ . '/inc/patch.dcminiurl.php';
|
||||
$s->put('active', false, 'boolean', 'Enabled kutrl plugin', false, true);
|
||||
$s->put('plugin_service', 'default', 'string', 'Service to use to shorten links on third part plugins', false, true);
|
||||
$s->put('admin_service', 'local', 'string', 'Service to use to shorten links on admin', false, true);
|
||||
$s->put('tpl_service', 'local', 'string', 'Service to use to shorten links on template', false, true);
|
||||
$s->put('wiki_service', 'local', 'string', 'Service to use to shorten links on contents', false, true);
|
||||
$s->put('allow_external_url', true, 'boolean', 'Limited short url to current blog\'s url', false, true);
|
||||
$s->put('tpl_passive', true, 'boolean', 'Return long url on kutrl tags if kutrl is unactivate', false, true);
|
||||
$s->put('tpl_active', false, 'boolean', 'Return short url on dotclear tags if kutrl is active', false, true);
|
||||
$s->put('admin_entry_default', true, 'boolean', 'Create short link on new entry by default', false, true);
|
||||
# Settings for "local" service
|
||||
$local_css = ".shortenkutrlwidget input { border: 1px solid #CCCCCC; }\n" .
|
||||
'.dc-kutrl input { border: 1px solid #CCCCCC; margin: 10px; }';
|
||||
$s->put('srv_local_protocols', 'http:,https:,ftp:,ftps:,irc:', 'string', 'Allowed kutrl local service protocols', false, true);
|
||||
$s->put('srv_local_public', false, 'boolean', 'Enabled local service public page', false, true);
|
||||
$s->put('srv_local_css', $local_css, 'string', 'Special CSS for kutrl local service', false, true);
|
||||
$s->put('srv_local_404_active', false, 'boolean', 'Use special 404 page on unknow urls', false, true);
|
||||
# Settings for "bilbolinks" service
|
||||
$s->put('srv_bilbolinks_base', 'http://tux-pla.net/', 'string', 'URL of bilbolinks service', false, true);
|
||||
# Settings for "YOURLS" service
|
||||
$s->put('srv_yourls_base', '', 'string', 'URL of YOURLS service', false, true);
|
||||
$s->put('srv_yourls_username', '', 'string', 'User name to YOURLS service', false, true);
|
||||
$s->put('srv_yourls_password', '', 'string', 'User password to YOURLS service', false, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
20
_public.php
20
_public.php
|
@ -51,7 +51,7 @@ class urlKutrl extends dcUrlHandlers
|
|||
public static function redirectUrl($args)
|
||||
{
|
||||
# Not active, go to default 404
|
||||
if (!dcCore::app()->blog->settings->get(basename(__DIR__))->get('kutrl_active')) {
|
||||
if (!dcCore::app()->blog->settings->get(basename(__DIR__))->get('active')) {
|
||||
self::p404();
|
||||
|
||||
return null;
|
||||
|
@ -112,13 +112,13 @@ class urlKutrl extends dcUrlHandlers
|
|||
$s = dcCore::app()->blog->settings->get(basename(__DIR__));
|
||||
|
||||
# Not active, go to default 404
|
||||
if (!$s->get('kutrl_active')) {
|
||||
if (!$s->get('active')) {
|
||||
self::p404();
|
||||
|
||||
return null;
|
||||
}
|
||||
# Public page not active, go to kutrl 404
|
||||
if (!$s->get('kutrl_srv_local_public')) {
|
||||
if (!$s->get('srv_local_public')) {
|
||||
self::kutrl404();
|
||||
|
||||
return null;
|
||||
|
@ -218,7 +218,7 @@ class urlKutrl extends dcUrlHandlers
|
|||
|
||||
protected static function kutrl404()
|
||||
{
|
||||
if (!dcCore::app()->blog->settings->get(basename(__DIR__))->get('kutrl_srv_local_404_active')) {
|
||||
if (!dcCore::app()->blog->settings->get(basename(__DIR__))->get('srv_local_404_active')) {
|
||||
self::p404();
|
||||
|
||||
return null;
|
||||
|
@ -284,8 +284,8 @@ class pubKutrl
|
|||
# URL shortening is disabled by tag attribute
|
||||
if (true !== dcCore::app()->ctx->__get('disable_kutrl')) {
|
||||
# kUtRL is not activated
|
||||
if (!dcCore::app()->blog->settings->get(basename(__DIR__))->get('kutrl_active')
|
||||
|| !dcCore::app()->blog->settings->get(basename(__DIR__))->get('kutrl_tpl_active')
|
||||
if (!dcCore::app()->blog->settings->get(basename(__DIR__))->get('active')
|
||||
|| !dcCore::app()->blog->settings->get(basename(__DIR__))->get('tpl_active')
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
@ -314,9 +314,9 @@ class pubKutrl
|
|||
$s = dcCore::app()->blog->settings->get(basename(__DIR__));
|
||||
|
||||
# Passive : all kutrl tag return long url
|
||||
dcCore::app()->ctx->kutrl_passive = (bool) $s->get('kutrl_tpl_passive');
|
||||
dcCore::app()->ctx->kutrl_passive = (bool) $s->get('tpl_passive');
|
||||
|
||||
if (!$s->get('kutrl_active') || !$s->get('kutrl_tpl_service')) {
|
||||
if (!$s->get('active') || !$s->get('tpl_service')) {
|
||||
return null;
|
||||
}
|
||||
if (null === ($kut = kUtRL::quickPlace('tpl'))) {
|
||||
|
@ -327,7 +327,7 @@ class pubKutrl
|
|||
|
||||
public static function publicHeadContent($_)
|
||||
{
|
||||
$css = dcCore::app()->blog->settings->get(basename(__DIR__))->get('kutrl_srv_local_css');
|
||||
$css = dcCore::app()->blog->settings->get(basename(__DIR__))->get('srv_local_css');
|
||||
if ($css) {
|
||||
echo
|
||||
"\n<!-- CSS for kUtRL --> \n" .
|
||||
|
@ -353,7 +353,7 @@ class tplKutrl
|
|||
|
||||
if (isset($attr['is_active'])) {
|
||||
$sign = (bool) $attr['is_active'] ? '' : '!';
|
||||
$if[] = $sign . 'dcCore::app()->blog->settings->get("kUtRL")->get("kutrl_srv_local_public")';
|
||||
$if[] = $sign . 'dcCore::app()->blog->settings->get("' . basename(__DIR__) . '")->get("srv_local_public")';
|
||||
}
|
||||
if (empty($if)) {
|
||||
return $content;
|
||||
|
|
|
@ -69,7 +69,7 @@ $this->addDirectAction(
|
|||
/* ns */
|
||||
basename(__DIR__),
|
||||
/* description */
|
||||
sprintf(__('delete all %s settings'), 'kUtRL')
|
||||
sprintf(__('delete all %s settings'), basename(__DIR__))
|
||||
);
|
||||
|
||||
$this->addDirectAction(
|
||||
|
@ -80,7 +80,7 @@ $this->addDirectAction(
|
|||
/* ns */
|
||||
basename(__DIR__),
|
||||
/* description */
|
||||
sprintf(__('delete %s version number'), 'kUtRL')
|
||||
sprintf(__('delete %s version number'), basename(__DIR__))
|
||||
);
|
||||
|
||||
$this->addDirectAction(
|
||||
|
@ -91,5 +91,5 @@ $this->addDirectAction(
|
|||
/* ns */
|
||||
basename(__DIR__),
|
||||
/* description */
|
||||
sprintf(__('delete %s plugin files'), 'kUtRL')
|
||||
sprintf(__('delete %s plugin files'), basename(__DIR__))
|
||||
);
|
||||
|
|
|
@ -116,8 +116,8 @@ class widgetKutrl
|
|||
{
|
||||
$s = dcCore::app()->blog->settings->get(basename(__DIR__));
|
||||
|
||||
if (!$s->get('kutrl_active')
|
||||
|| !$s->get('kutrl_srv_local_public')
|
||||
if (!$s->get('active')
|
||||
|| !$s->get('srv_local_public')
|
||||
|| !$w->checkHomeOnly(dcCore::app()->url->type)
|
||||
|| dcCore::app()->url->type == 'kutrl') {
|
||||
return null;
|
||||
|
@ -153,7 +153,7 @@ class widgetKutrl
|
|||
{
|
||||
$s = dcCore::app()->blog->settings->get(basename(__DIR__));
|
||||
|
||||
if (!$s->get('kutrl_active') || !$w->checkHomeOnly(dcCore::app()->url->type)) {
|
||||
if (!$s->get('active') || !$w->checkHomeOnly(dcCore::app()->url->type)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ class kUtRL
|
|||
if (!in_array($place, ['tpl', 'wiki', 'admin', 'plugin'])) {
|
||||
return null;
|
||||
}
|
||||
$id = dcCore::app()->blog->settings->get(basename(dirname(__DIR__)))->get('kutrl_' . $place . '_service');
|
||||
$id = dcCore::app()->blog->settings->get(basename(dirname(__DIR__)))->get($place . '_service');
|
||||
if (!empty($id)) {
|
||||
return self::quickService($id);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ class kutrlService
|
|||
$this->init();
|
||||
|
||||
// Force setting
|
||||
$allow_external_url = $this->settings->get('kutrl_allow_external_url');
|
||||
$allow_external_url = $this->settings->get('allow_external_url');
|
||||
$this->config['$allow_external_url'] = null === $allow_external_url ?
|
||||
true : $allow_external_url;
|
||||
|
||||
|
@ -44,7 +44,7 @@ class kutrlService
|
|||
'allow_custom_hash' => false,
|
||||
'allow_protocols' => ['http://'],
|
||||
|
||||
'url_test' => 'http://dotclear.jcdenis.com/go/kUtRL',
|
||||
'url_test' => 'http://github.com/JcDenis/kUtRL/releases',
|
||||
'url_api' => '',
|
||||
'url_base' => '',
|
||||
'url_min_len' => 0,
|
||||
|
@ -218,7 +218,7 @@ class kutrlService
|
|||
{
|
||||
$url = (string) $server;
|
||||
$client = netHttp::initClient($url, $url);
|
||||
$client->setUserAgent('kUtRL - http://kutrl.fr');
|
||||
$client->setUserAgent('kUtRL - https://github.com/JcDenis/kUtRL');
|
||||
$client->setPersistReferers(false);
|
||||
|
||||
if (is_array($headers) && !empty($headers)) {
|
||||
|
|
|
@ -23,7 +23,7 @@ class kutrlWiki
|
|||
# Do nothing on comment preview and post preview
|
||||
if (!empty($_POST['preview'])
|
||||
|| isset(dcCore::app()->ctx) && dcCore::app()->ctx->preview
|
||||
|| !dcCore::app()->blog->settings->get(basename(dirname(__DIR__)))->get('kutrl_active')
|
||||
|| !dcCore::app()->blog->settings->get(basename(dirname(__DIR__)))->get('active')
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class kutrlWiki
|
|||
|
||||
public static function transform($url, $content)
|
||||
{
|
||||
if (!dcCore::app()->blog->settings->get(basename(dirname(__DIR__)))->get('kutrl_active')) {
|
||||
if (!dcCore::app()->blog->settings->get(basename(dirname(__DIR__)))->get('active')) {
|
||||
return null;
|
||||
}
|
||||
if (null === ($kut = kUtRL::quickPlace('wiki'))) {
|
||||
|
|
|
@ -1,130 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @brief kUtRL, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
# This file takes records from plugin dcMiniUrl
|
||||
# and inserts them into plugin kUtRL.
|
||||
|
||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$miniurl_patch = new dcMiniUrl2kUtRL();
|
||||
if ($miniurl_patch->parseRecords()) {
|
||||
try {
|
||||
dcCore::app()->plugins->deactivateModule('dcMiniUrl');
|
||||
} catch (Exception $e) {
|
||||
//dcCore::app()->error->add($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
class dcMiniUrl2kUtRL
|
||||
{
|
||||
public $con;
|
||||
public $k_tb;
|
||||
public $m_tb;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->con = dcCore::app()->con;
|
||||
$this->k_tb = dcCore::app()->prefix . initkUtRL::KURL_TABLE_NAME;
|
||||
$this->m_tb = dcCore::app()->prefix . 'miniurl';
|
||||
}
|
||||
|
||||
public function parseRecords()
|
||||
{
|
||||
$rs = $this->con->select(
|
||||
'SELECT * FROM ' . $this->m_tb . ' '
|
||||
);
|
||||
|
||||
while ($rs->fetch()) {
|
||||
if ($rs->miniurl_type == 'customurl' || $rs->miniurl_type == 'miniurl') {
|
||||
if ($this->exists($rs)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->insertKutrl($rs);
|
||||
$this->insertLocal($rs);
|
||||
} else {
|
||||
$this->insertOther($rs);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function insertKutrl($rs)
|
||||
{
|
||||
$cur = $this->common($rs);
|
||||
$cur->kut_service = 'kutrl';
|
||||
$cur->kut_type = 'local';
|
||||
$cur->kut_counter = 0;
|
||||
$cur->kut_password = null;
|
||||
|
||||
$cur->insert();
|
||||
$this->con->unlock();
|
||||
}
|
||||
|
||||
private function insertLocal($rs)
|
||||
{
|
||||
$cur = $this->common($rs);
|
||||
$cur->kut_service = 'local';
|
||||
$cur->kut_type = $rs->miniurl_type == 'customurl' ?
|
||||
'localcustom' : 'localnormal';
|
||||
|
||||
$cur->insert();
|
||||
$this->con->unlock();
|
||||
}
|
||||
|
||||
private function insertOther($rs)
|
||||
{
|
||||
$cur = $this->common($rs);
|
||||
|
||||
$cur->insert();
|
||||
$this->con->unlock();
|
||||
}
|
||||
|
||||
private function common($rs)
|
||||
{
|
||||
$cur = $this->con->openCursor($this->k_tb);
|
||||
$this->con->writeLock($this->k_tb);
|
||||
$cur->kut_id = $this->nextId();
|
||||
$cur->blog_id = $rs->blog_id;
|
||||
$cur->kut_service = 'unknow';
|
||||
$cur->kut_type = $rs->miniurl_type;
|
||||
$cur->kut_hash = $rs->miniurl_id;
|
||||
$cur->kut_url = $rs->miniurl_str;
|
||||
$cur->kut_dt = $rs->miniurl_dt;
|
||||
$cur->kut_counter = $rs->miniurl_counter;
|
||||
$cur->kut_password = $rs->miniurl_password;
|
||||
|
||||
return $cur;
|
||||
}
|
||||
|
||||
private function exists($rs)
|
||||
{
|
||||
$chk = $this->con->select(
|
||||
'SELECT kut_hash FROM ' . $this->k_tb . ' ' .
|
||||
"WHERE blog_id = '" . $rs->blog_id . "' " .
|
||||
"AND kut_service = 'local' " .
|
||||
"AND kut_hash = '" . $rs->miniurl_id . "' "
|
||||
);
|
||||
|
||||
return !$chk->isEmpty();
|
||||
}
|
||||
|
||||
private function nextId()
|
||||
{
|
||||
return $this->con->select(
|
||||
'SELECT MAX(kut_id) FROM ' . $this->k_tb . ' '
|
||||
)->f(0) + 1;
|
||||
}
|
||||
}
|
|
@ -24,7 +24,7 @@ class bilbolinksKutrlService extends kutrlService
|
|||
|
||||
protected function init()
|
||||
{
|
||||
$base = (string) $this->settings->get('kutrl_srv_bilbolinks_base');
|
||||
$base = (string) $this->settings->get('srv_bilbolinks_base');
|
||||
if (!empty($base) && substr($base, -1, 1) != '/') {
|
||||
$base .= '/';
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ class bilbolinksKutrlService extends kutrlService
|
|||
$base .= '/';
|
||||
}
|
||||
}
|
||||
$this->settings->put('kutrl_srv_bilbolinks_base', $base);
|
||||
$this->settings->put('srv_bilbolinks_base', $base);
|
||||
}
|
||||
|
||||
public function settingsForm()
|
||||
|
@ -50,7 +50,7 @@ class bilbolinksKutrlService extends kutrlService
|
|||
echo
|
||||
'<p><label class="classic">' .
|
||||
__('Url of the service:') . '<br />' .
|
||||
form::field(['kutrl_srv_bilbolinks_base'], 50, 255, $this->settings->get('kutrl_srv_bilbolinks_base')) .
|
||||
form::field(['kutrl_srv_bilbolinks_base'], 50, 255, $this->settings->get('srv_bilbolinks_base')) .
|
||||
'</label></p>' .
|
||||
'<p class="form-note">' .
|
||||
__('This is the root URL of the "bilbolinks" service you want to use. Ex: "http://tux-pla.net/".') .
|
||||
|
|
|
@ -34,19 +34,19 @@ class bitlyKutrlService extends kutrlService
|
|||
|
||||
protected function init()
|
||||
{
|
||||
$this->args['apiKey'] = $this->settings->kutrl_srv_bitly_apikey;
|
||||
$this->args['apiKey'] = $this->settings->get('srv_bitly_apikey');
|
||||
}
|
||||
|
||||
public function saveSettings()
|
||||
{
|
||||
$this->settings->put('kutrl_srv_bitly_apikey', $_POST['kutrl_srv_bitly_apikey']);
|
||||
$this->settings->put('srv_bitly_apikey', $_POST['kutrl_srv_bitly_apikey']);
|
||||
}
|
||||
|
||||
public function settingsForm()
|
||||
{
|
||||
echo
|
||||
'<p><label class="classic">' . __('API Key:') . '<br />' .
|
||||
form::field(['kutrl_srv_bitly_apikey'], 50, 255, $this->settings->kutrl_srv_bitly_apikey) .
|
||||
form::field(['kutrl_srv_bitly_apikey'], 50, 255, $this->settings->get('srv_bitly_apikey')) .
|
||||
'</label></p>' .
|
||||
'<p class="form-note">' .
|
||||
sprintf(__('This is your personnal %s API key. You can find it on your account page.'), $this->config['name']) .
|
||||
|
|
|
@ -23,14 +23,14 @@ class customKutrlService extends kutrlService
|
|||
|
||||
protected function init()
|
||||
{
|
||||
$config = unserialize(base64_decode((string) $this->settings->get('kutrl_srv_custom')));
|
||||
$config = json_decode((string) $this->settings->get('srv_custom'), true);
|
||||
if (!is_array($config)) {
|
||||
$config = [];
|
||||
}
|
||||
|
||||
$this->config['url_api'] = !empty($config['url_api']) ? $config['url_api'] : '';
|
||||
$this->config['url_base'] = !empty($config['url_base']) ? $config['url_base'] : '';
|
||||
$this->config['url_param'] = !empty($config['url_param']) ? $config['url_param'] : '';
|
||||
$this->config['url_api'] = $config['url_api'] ?? '';
|
||||
$this->config['url_base'] = $config['url_base'] ?? '';
|
||||
$this->config['url_param'] = $config['url_param'] ?? '';
|
||||
$this->config['url_encode'] = !empty($config['url_api']);
|
||||
|
||||
$this->config['url_min_length'] = strlen($this->url_base) + 2;
|
||||
|
@ -44,7 +44,7 @@ class customKutrlService extends kutrlService
|
|||
'url_param' => $_POST['kutrl_srv_custom_url_param'],
|
||||
'url_encode' => !empty($_POST['kutrl_srv_custom_url_encode']),
|
||||
];
|
||||
$this->settings->put('kutrl_srv_custom', base64_encode(serialize($config)));
|
||||
$this->settings->put('srv_custom', json_encode($config));
|
||||
}
|
||||
|
||||
public function settingsForm()
|
||||
|
@ -55,7 +55,7 @@ class customKutrlService extends kutrlService
|
|||
'url_param' => '',
|
||||
'url_encode' => true,
|
||||
];
|
||||
$config = unserialize(base64_decode((string) $this->settings->get('kutrl_srv_custom')));
|
||||
$config = json_decode((string) $this->settings->get('srv_custom'), true);
|
||||
if (!is_array($config)) {
|
||||
$config = [];
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ class googlKutrlService extends kutrlService
|
|||
public $home = 'http://goo.gl';
|
||||
|
||||
private $url_api = 'https://www.googleapis.com/urlshortener/v1/url';
|
||||
private $url_test = 'http://dotclear.jcdenis.com/go/kUtRL';
|
||||
private $url_test = 'https://github.com/JcDenis/kUtRL/releases';
|
||||
private $args = [
|
||||
'key' => '',
|
||||
];
|
||||
|
|
|
@ -26,7 +26,7 @@ class localKutrlService extends kutrlService
|
|||
|
||||
protected function init()
|
||||
{
|
||||
$protocols = (string) $this->settings->get('kutrl_srv_local_protocols');
|
||||
$protocols = (string) $this->settings->get('srv_local_protocols');
|
||||
$this->config['allow_protocols'] = empty($protocols) ? [] : explode(',', $protocols);
|
||||
|
||||
$this->config['url_base'] = dcCore::app()->blog->url . dcCore::app()->url->getBase('kutrl') . '/';
|
||||
|
@ -35,10 +35,10 @@ class localKutrlService extends kutrlService
|
|||
|
||||
public function saveSettings()
|
||||
{
|
||||
$this->settings->put('kutrl_srv_local_protocols', $_POST['kutrl_srv_local_protocols'], 'string');
|
||||
$this->settings->put('kutrl_srv_local_public', isset($_POST['kutrl_srv_local_public']), 'boolean');
|
||||
$this->settings->put('kutrl_srv_local_css', $_POST['kutrl_srv_local_css'], 'string');
|
||||
$this->settings->put('kutrl_srv_local_404_active', isset($_POST['kutrl_srv_local_404_active']), 'boolean');
|
||||
$this->settings->put('srv_local_protocols', $_POST['kutrl_srv_local_protocols'], 'string');
|
||||
$this->settings->put('srv_local_public', isset($_POST['kutrl_srv_local_public']), 'boolean');
|
||||
$this->settings->put('srv_local_css', $_POST['kutrl_srv_local_css'], 'string');
|
||||
$this->settings->put('srv_local_404_active', isset($_POST['kutrl_srv_local_404_active']), 'boolean');
|
||||
}
|
||||
|
||||
public function settingsForm()
|
||||
|
@ -49,7 +49,7 @@ class localKutrlService extends kutrlService
|
|||
'<p><strong>' . __('Settings:') . '</strong></p>' .
|
||||
'<p><label class="classic">' .
|
||||
__('Allowed protocols:') . '<br />' .
|
||||
form::field(['kutrl_srv_local_protocols'], 50, 255, $this->settings->get('kutrl_srv_local_protocols')) .
|
||||
form::field(['kutrl_srv_local_protocols'], 50, 255, $this->settings->get('srv_local_protocols')) .
|
||||
'</label></p>' .
|
||||
|
||||
'<p class="form-note">' .
|
||||
|
@ -57,17 +57,17 @@ class localKutrlService extends kutrlService
|
|||
'</p>' .
|
||||
|
||||
'<p><label class="classic">' .
|
||||
form::checkbox(['kutrl_srv_local_public'], '1', $this->settings->get('kutrl_srv_local_public')) . ' ' .
|
||||
form::checkbox(['kutrl_srv_local_public'], '1', $this->settings->get('srv_local_public')) . ' ' .
|
||||
__('Enable public page for visitors to shorten links') .
|
||||
'</label></p>' .
|
||||
|
||||
'<p class="area" id="style-area"><label for="_style">' . __('CSS:') . '</label>' .
|
||||
form::textarea('kutrl_srv_local_css', 50, 3, html::escapeHTML($this->settings->get('kutrl_srv_local_css')), '', '2') .
|
||||
form::textarea('kutrl_srv_local_css', 50, 3, html::escapeHTML($this->settings->get('srv_local_css')), '', '2') .
|
||||
'</p>' .
|
||||
'<p class="form-note">' . __('You can add here special cascading style sheet. Body of page has class "dc-kutrl" and widgets have class "shortenkutrlwidget" and "rankkutrlwidget".') . '</p>' .
|
||||
|
||||
'<p><label class="classic">' .
|
||||
form::checkbox(['kutrl_srv_local_404_active'], '1', $this->settings->get('kutrl_srv_local_404_active')) . ' ' .
|
||||
form::checkbox(['kutrl_srv_local_404_active'], '1', $this->settings->get('srv_local_404_active')) . ' ' .
|
||||
__('Enable special 404 error public page for unknow urls') .
|
||||
'</label></p>' .
|
||||
'<p class="form-note">' . __('If this is not activated, the default 404 page of the theme will be display.') . '</p>' .
|
||||
|
|
|
@ -35,27 +35,27 @@ class suprKutrlService extends kutrlService
|
|||
|
||||
protected function init()
|
||||
{
|
||||
$this->args['login'] = $this->settings->get('kutrl_srv_supr_login');
|
||||
$this->args['apiKey'] = $this->settings->get('kutrl_srv_supr_apikey');
|
||||
$this->args['login'] = $this->settings->get('srv_supr_login');
|
||||
$this->args['apiKey'] = $this->settings->get('srv_supr_apikey');
|
||||
}
|
||||
|
||||
public function saveSettings()
|
||||
{
|
||||
$this->settings->put('kutrl_srv_supr_login', $_POST['kutrl_srv_supr_login']);
|
||||
$this->settings->put('kutrl_srv_supr_apikey', $_POST['kutrl_srv_supr_apikey']);
|
||||
$this->settings->put('srv_supr_login', $_POST['kutrl_srv_supr_login']);
|
||||
$this->settings->put('srv_supr_apikey', $_POST['kutrl_srv_supr_apikey']);
|
||||
}
|
||||
|
||||
public function settingsForm()
|
||||
{
|
||||
echo
|
||||
'<p><label class="classic">' . __('Login:') . '<br />' .
|
||||
form::field(['kutrl_srv_supr_login'], 50, 255, $this->settings->get('kutrl_srv_supr_login')) .
|
||||
form::field(['kutrl_srv_supr_login'], 50, 255, $this->settings->get('srv_supr_login')) .
|
||||
'</label></p>' .
|
||||
'<p class="form-note">' .
|
||||
sprintf(__('This is your login to sign up to %s'), $this->config['name']) .
|
||||
'</p>' .
|
||||
'<p><label class="classic">' . __('API Key:') . '<br />' .
|
||||
form::field(['kutrl_srv_supr_apikey'], 50, 255, $this->settings->get('kutrl_srv_supr_apikey')) .
|
||||
form::field(['kutrl_srv_supr_apikey'], 50, 255, $this->settings->get('srv_supr_apikey')) .
|
||||
'</label></p>' .
|
||||
'<p class="form-note">' .
|
||||
sprintf(__('This is your personnal %s API key. You can find it on your account page.'), $this->config['name']) .
|
||||
|
|
|
@ -35,29 +35,29 @@ class trimKutrlService extends kutrlService
|
|||
|
||||
protected function init()
|
||||
{
|
||||
$this->args['username'] = $this->settings->get('kutrl_srv_trim_username');
|
||||
$this->args['password'] = $this->settings->get('kutrl_srv_trim_password');
|
||||
$this->args['username'] = $this->settings->get('srv_trim_username');
|
||||
$this->args['password'] = $this->settings->get('srv_trim_password');
|
||||
|
||||
$this->api_rate_time = (int) $this->settings->get('kutrl_srv_trim_apiratetime');
|
||||
$this->api_rate_time = (int) $this->settings->get('srv_trim_apiratetime');
|
||||
}
|
||||
|
||||
public function saveSettings()
|
||||
{
|
||||
$this->settings->put('kutrl_srv_trim_username', $_POST['kutrl_srv_trim_username']);
|
||||
$this->settings->put('kutrl_srv_trim_password', $_POST['kutrl_srv_trim_password']);
|
||||
$this->settings->put('srv_trim_username', $_POST['kutrl_srv_trim_username']);
|
||||
$this->settings->put('srv_trim_password', $_POST['kutrl_srv_trim_password']);
|
||||
}
|
||||
|
||||
public function settingsForm()
|
||||
{
|
||||
echo
|
||||
'<p><label class="classic">' . __('Login:') . '<br />' .
|
||||
form::field(['kutrl_srv_trim_username'], 50, 255, $this->settings->get('kutrl_srv_trim_username')) .
|
||||
form::field(['kutrl_srv_trim_username'], 50, 255, $this->settings->get('srv_trim_username')) .
|
||||
'</label></p>' .
|
||||
'<p class="form-note">' .
|
||||
__('This is your login to sign up to tr.im.') .
|
||||
'</p>' .
|
||||
'<p><label class="classic">' . __('Password:') . '<br />' .
|
||||
form::field(['kutrl_srv_trim_password'], 50, 255, $this->settings->get('kutrl_srv_trim_password')) .
|
||||
form::field(['kutrl_srv_trim_password'], 50, 255, $this->settings->get('srv_trim_password')) .
|
||||
'</label></p>' .
|
||||
'<p class="form-note">' .
|
||||
__('This is your password to sign up to tr.im.') .
|
||||
|
@ -106,7 +106,7 @@ class trimKutrlService extends kutrlService
|
|||
|
||||
# API rate limit
|
||||
if ($r['code'] == 425) {
|
||||
$this->settings->put('kutrl_srv_trim_apiratetime', time());
|
||||
$this->settings->put('srv_trim_apiratetime', time());
|
||||
|
||||
$this->error->add(__('Service rate limit exceeded.'));
|
||||
|
||||
|
|
|
@ -31,10 +31,10 @@ class yourlsKutrlService extends kutrlService
|
|||
|
||||
protected function init()
|
||||
{
|
||||
$this->args['username'] = $this->settings->get('kutrl_srv_yourls_username');
|
||||
$this->args['password'] = $this->settings->get('kutrl_srv_yourls_password');
|
||||
$this->args['username'] = $this->settings->get('srv_yourls_username');
|
||||
$this->args['password'] = $this->settings->get('srv_yourls_password');
|
||||
|
||||
$base = (string) $this->settings->get('kutrl_srv_yourls_base');
|
||||
$base = (string) $this->settings->get('srv_yourls_base');
|
||||
//if (!empty($base) && substr($base,-1,1) != '/') $base .= '/';
|
||||
|
||||
$this->config['url_api'] = $base;
|
||||
|
@ -44,9 +44,9 @@ class yourlsKutrlService extends kutrlService
|
|||
|
||||
public function saveSettings()
|
||||
{
|
||||
$this->settings->put('kutrl_srv_yourls_username', $_POST['kutrl_srv_yourls_username']);
|
||||
$this->settings->put('kutrl_srv_yourls_password', $_POST['kutrl_srv_yourls_password']);
|
||||
$this->settings->put('kutrl_srv_yourls_base', $_POST['kutrl_srv_yourls_base']);
|
||||
$this->settings->put('srv_yourls_username', $_POST['kutrl_srv_yourls_username']);
|
||||
$this->settings->put('srv_yourls_password', $_POST['kutrl_srv_yourls_password']);
|
||||
$this->settings->put('srv_yourls_base', $_POST['kutrl_srv_yourls_base']);
|
||||
}
|
||||
|
||||
public function settingsForm()
|
||||
|
@ -54,19 +54,19 @@ class yourlsKutrlService extends kutrlService
|
|||
echo
|
||||
'<p><label class="classic">' .
|
||||
__('Url of the service:') . '<br />' .
|
||||
form::field(['kutrl_srv_yourls_base'], 50, 255, $this->settings->get('kutrl_srv_yourls_base')) .
|
||||
form::field(['kutrl_srv_yourls_base'], 50, 255, $this->settings->get('srv_yourls_base')) .
|
||||
'</label></p>' .
|
||||
'<p class="form-note">' .
|
||||
__('This is the URL of the YOURLS service you want to use. Ex: "http://www.smaller.org/api.php".') .
|
||||
'</p>' .
|
||||
'<p><label class="classic">' . __('Login:') . '<br />' .
|
||||
form::field(['kutrl_srv_yourls_username'], 50, 255, $this->settings->get('kutrl_srv_yourls_username')) .
|
||||
form::field(['kutrl_srv_yourls_username'], 50, 255, $this->settings->get('srv_yourls_username')) .
|
||||
'</label></p>' .
|
||||
'<p class="form-note">' .
|
||||
__('This is your user name to sign up to this YOURLS service.') .
|
||||
'</p>' .
|
||||
'<p><label class="classic">' . __('Password:') . '<br />' .
|
||||
form::field(['kutrl_srv_yourls_password'], 50, 255, $this->settings->get('kutrl_srv_yourls_password')) .
|
||||
form::field(['kutrl_srv_yourls_password'], 50, 255, $this->settings->get('srv_yourls_password')) .
|
||||
'</label></p>' .
|
||||
'<p class="form-note">' .
|
||||
__('This is your password to sign up to this YOURLS service.') .
|
||||
|
|
18
index.php
18
index.php
|
@ -131,8 +131,8 @@ if ($part == 'link') {
|
|||
dcCore::app()->error->add($e->getMessage());
|
||||
}
|
||||
|
||||
$header = $kUtRL_filter->js(dcCore::app()->adminurl->get('admin.plugin.kUtRL', ['part' => 'links'])) .
|
||||
dcPage::jsLoad(dcPage::getPF('kUtRL/js/admin.js'));
|
||||
$header = $kUtRL_filter->js(dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__), ['part' => 'links'])) .
|
||||
dcPage::jsModuleLoad(basename(__DIR__) . '/js/admin.js');
|
||||
|
||||
if (!empty($_POST['deletelinks'])) {
|
||||
try {
|
||||
|
@ -152,7 +152,7 @@ if ($part == 'link') {
|
|||
dcAdminNotices::addSuccessNotice(
|
||||
__('Links successfully deleted')
|
||||
);
|
||||
dcCore::app()->adminurl->redirect('admin.plugin.kUtRL', $kUtRL_filter->values());
|
||||
dcCore::app()->adminurl->redirect('admin.plugin.' . basename(__DIR__), $kUtRL_filter->values());
|
||||
} catch (Exception $e) {
|
||||
dcCore::app()->error->add($e->getMessage());
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ if ($part == 'link') {
|
|||
echo
|
||||
dcPage::breadcrumb([
|
||||
__('Plugins') => '',
|
||||
__('Links shortener') => dcCore::app()->adminurl->get('admin.plugin.kUtRL'),
|
||||
__('Links shortener') => dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__)),
|
||||
__('New link') => '',
|
||||
]) .
|
||||
dcPage::notices();
|
||||
|
@ -181,7 +181,7 @@ if ($part == 'link') {
|
|||
echo '
|
||||
<div class="fieldset">
|
||||
<h4>' . sprintf(__('Shorten link using service "%s"'), $kut->name) . '</h4>
|
||||
<form id="create-link" method="post" action="' . dcCore::app()->adminurl->get('admin.plugin.kUtRL') . '">
|
||||
<form id="create-link" method="post" action="' . dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__)) . '">
|
||||
|
||||
<p><label for="str">' . __('Long link:') . '</label>' .
|
||||
form::field('str', 100, 255, '') . '</p>';
|
||||
|
@ -215,15 +215,15 @@ if ($part == 'link') {
|
|||
dcPage::notices() .
|
||||
|
||||
'<p class="top-add"><a class="button add" href="' .
|
||||
dcCore::app()->adminurl->get('admin.plugin.kUtRL', ['part' => 'link']) .
|
||||
dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__), ['part' => 'link']) .
|
||||
'">' . __('New Link') . '</a></p>';
|
||||
|
||||
$kUtRL_filter->display('admin.plugin.kUtRL', form::hidden('p', 'kUtRL') . form::hidden('part', 'links'));
|
||||
$kUtRL_filter->display('admin.plugin.' . basename(__DIR__), form::hidden('p', basename(__DIR__)) . form::hidden('part', 'links'));
|
||||
|
||||
$list_current->display(
|
||||
$kUtRL_filter->value('page'),
|
||||
$kUtRL_filter->nb,
|
||||
'<form action="' . dcCore::app()->adminurl->get('admin.plugin.kUtRL') . '" method="post" id="form-entries">
|
||||
'<form action="' . dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__)) . '" method="post" id="form-entries">
|
||||
|
||||
%s
|
||||
|
||||
|
@ -233,7 +233,7 @@ if ($part == 'link') {
|
|||
</div>
|
||||
<p class="col right">
|
||||
<input id="do-action" type="submit" value="' . __('Delete selected short links') . '" /></p>' .
|
||||
dcCore::app()->adminurl->getHiddenFormFields('admin.plugin.kUtRL', array_merge(['deletelinks' => 1], $kUtRL_filter->values(true))) .
|
||||
dcCore::app()->adminurl->getHiddenFormFields('admin.plugin.' . basename(__DIR__), array_merge(['deletelinks' => 1], $kUtRL_filter->values(true))) .
|
||||
dcCore::app()->formNonce() . '
|
||||
</p>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue