fix PRS12 CS
This commit is contained in:
parent
aa102cb260
commit
a43e4015cd
11
README.md
11
README.md
@ -1,10 +1,11 @@
|
|||||||
# README
|
# README
|
||||||
|
|
||||||
[![Release version](https://img.shields.io/github/v/release/JcDenis/cinecturlink2)](https://github.com/JcDenis/cinecturlink2/releases)
|
[![Release](https://img.shields.io/github/v/release/JcDenis/cinecturlink2)](https://github.com/JcDenis/cinecturlink2/releases)
|
||||||
[![Release date](https://img.shields.io/github/release-date/JcDenis/cinecturlink2)](https://github.com/JcDenis/cinecturlink2/releases)
|
[![Date](https://img.shields.io/github/release-date/JcDenis/cinecturlink2)](https://github.com/JcDenis/cinecturlink2/releases)
|
||||||
[![Issue tracking](https://img.shields.io/github/issues/JcDenis/cinecturlink2)](https://github.com/JcDenis/cinecturlink2/issues)
|
[![Issues](https://img.shields.io/github/issues/JcDenis/cinecturlink2)](https://github.com/JcDenis/cinecturlink2/issues)
|
||||||
[![Dotclear version](https://img.shields.io/badge/dotclear-v2.19-blue.svg)](https://fr.dotclear.org/download)
|
[![Dotclear](https://img.shields.io/badge/dotclear-v2.19-blue.svg)](https://fr.dotclear.org/download)
|
||||||
[![License](https://img.shields.io/badge/license-GPL%20v2-blue.svg)](https://github.com/JcDenis/cinecturlink2/blob/master/LICENSE)
|
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/cinecturlink2)
|
||||||
|
[![License](https://img.shields.io/github/license/JcDenis/cinecturlink2)](https://github.com/JcDenis/cinecturlink2/blob/master/LICENSE)
|
||||||
|
|
||||||
## WHAT IS CINECTURLINK2 ?
|
## WHAT IS CINECTURLINK2 ?
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -87,7 +86,7 @@ class cinecturlink2AdminBehaviors
|
|||||||
{
|
{
|
||||||
$favs->register('cinecturlink2', [
|
$favs->register('cinecturlink2', [
|
||||||
'title' => __('My cinecturlink'),
|
'title' => __('My cinecturlink'),
|
||||||
'url' => $core->adminurl->get('admin.plugin.cinecturlink2').'#links',
|
'url' => $core->adminurl->get('admin.plugin.cinecturlink2') . '#links',
|
||||||
'small-icon' => dcPage::getPF('cinecturlink2/icon.png'),
|
'small-icon' => dcPage::getPF('cinecturlink2/icon.png'),
|
||||||
'large-icon' => dcPage::getPF('cinecturlink2/icon-big.png'),
|
'large-icon' => dcPage::getPF('cinecturlink2/icon-big.png'),
|
||||||
'permissions' => $core->auth->check('contentadmin', $core->blog->id),
|
'permissions' => $core->auth->check('contentadmin', $core->blog->id),
|
||||||
|
24
_config.php
24
_config.php
@ -10,24 +10,23 @@
|
|||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_MODULE')) {
|
if (!defined('DC_CONTEXT_MODULE')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$redir = empty($_REQUEST['redir']) ?
|
$redir = empty($_REQUEST['redir']) ?
|
||||||
$list->getURL().'#plugins' : $_REQUEST['redir'];
|
$list->getURL() . '#plugins' : $_REQUEST['redir'];
|
||||||
|
|
||||||
$core->blog->settings->addNamespace('cinecturlink2');
|
$core->blog->settings->addNamespace('cinecturlink2');
|
||||||
$s = $core->blog->settings->cinecturlink2;
|
$s = $core->blog->settings->cinecturlink2;
|
||||||
$cinecturlink2_active = (boolean) $s->cinecturlink2_active;
|
$cinecturlink2_active = (bool) $s->cinecturlink2_active;
|
||||||
$cinecturlink2_widthmax = abs((integer) $s->cinecturlink2_widthmax);
|
$cinecturlink2_widthmax = abs((int) $s->cinecturlink2_widthmax);
|
||||||
$cinecturlink2_folder = (string) $s->cinecturlink2_folder;
|
$cinecturlink2_folder = (string) $s->cinecturlink2_folder;
|
||||||
$cinecturlink2_triggeronrandom = (boolean) $s->cinecturlink2_triggeronrandom;
|
$cinecturlink2_triggeronrandom = (bool) $s->cinecturlink2_triggeronrandom;
|
||||||
$cinecturlink2_public_active = (boolean) $s->cinecturlink2_public_active;
|
$cinecturlink2_public_active = (bool) $s->cinecturlink2_public_active;
|
||||||
$cinecturlink2_public_title = (string) $s->cinecturlink2_public_title;
|
$cinecturlink2_public_title = (string) $s->cinecturlink2_public_title;
|
||||||
$cinecturlink2_public_description = (string) $s->cinecturlink2_public_description;
|
$cinecturlink2_public_description = (string) $s->cinecturlink2_public_description;
|
||||||
$cinecturlink2_public_nbrpp = (integer) $s->cinecturlink2_public_nbrpp;
|
$cinecturlink2_public_nbrpp = (int) $s->cinecturlink2_public_nbrpp;
|
||||||
if ($cinecturlink2_public_nbrpp < 1) {
|
if ($cinecturlink2_public_nbrpp < 1) {
|
||||||
$cinecturlink2_public_nbrpp = 10;
|
$cinecturlink2_public_nbrpp = 10;
|
||||||
}
|
}
|
||||||
@ -36,9 +35,8 @@ $combo_dirs = cinecturlink2::getPublicDirs($core);
|
|||||||
|
|
||||||
if (!empty($_POST['save'])) {
|
if (!empty($_POST['save'])) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$cinecturlink2_active = !empty($_POST['cinecturlink2_active']);
|
$cinecturlink2_active = !empty($_POST['cinecturlink2_active']);
|
||||||
$cinecturlink2_widthmax = abs((integer) $_POST['cinecturlink2_widthmax']);
|
$cinecturlink2_widthmax = abs((int) $_POST['cinecturlink2_widthmax']);
|
||||||
$cinecturlink2_newdir = (string) files::tidyFileName($_POST['cinecturlink2_newdir']);
|
$cinecturlink2_newdir = (string) files::tidyFileName($_POST['cinecturlink2_newdir']);
|
||||||
$cinecturlink2_folder = empty($cinecturlink2_newdir) ?
|
$cinecturlink2_folder = empty($cinecturlink2_newdir) ?
|
||||||
(string) files::tidyFileName($_POST['cinecturlink2_folder']) :
|
(string) files::tidyFileName($_POST['cinecturlink2_folder']) :
|
||||||
@ -47,7 +45,7 @@ if (!empty($_POST['save'])) {
|
|||||||
$cinecturlink2_public_active = !empty($_POST['cinecturlink2_public_active']);
|
$cinecturlink2_public_active = !empty($_POST['cinecturlink2_public_active']);
|
||||||
$cinecturlink2_public_title = (string) $_POST['cinecturlink2_public_title'];
|
$cinecturlink2_public_title = (string) $_POST['cinecturlink2_public_title'];
|
||||||
$cinecturlink2_public_description = (string) $_POST['cinecturlink2_public_description'];
|
$cinecturlink2_public_description = (string) $_POST['cinecturlink2_public_description'];
|
||||||
$cinecturlink2_public_nbrpp = (integer) $_POST['cinecturlink2_public_nbrpp'];
|
$cinecturlink2_public_nbrpp = (int) $_POST['cinecturlink2_public_nbrpp'];
|
||||||
if ($cinecturlink2_public_nbrpp < 1) {
|
if ($cinecturlink2_public_nbrpp < 1) {
|
||||||
$cinecturlink2_public_nbrpp = 10;
|
$cinecturlink2_public_nbrpp = 10;
|
||||||
}
|
}
|
||||||
@ -88,10 +86,10 @@ echo '
|
|||||||
form::checkbox('cinecturlink2_active', 1, $cinecturlink2_active) .
|
form::checkbox('cinecturlink2_active', 1, $cinecturlink2_active) .
|
||||||
__('Enable plugin') . '</label></p>
|
__('Enable plugin') . '</label></p>
|
||||||
|
|
||||||
<p><label for="cinecturlink2_folder">'.__('Public folder of images (under public folder of blog):') . '</label>' .
|
<p><label for="cinecturlink2_folder">' . __('Public folder of images (under public folder of blog):') . '</label>' .
|
||||||
form::combo('cinecturlink2_folder', $combo_dirs, $cinecturlink2_folder) . '</p>
|
form::combo('cinecturlink2_folder', $combo_dirs, $cinecturlink2_folder) . '</p>
|
||||||
|
|
||||||
<p><label for="cinecturlink2_newdir">'.__('Or create a new public folder of images:') . '</label>' .
|
<p><label for="cinecturlink2_newdir">' . __('Or create a new public folder of images:') . '</label>' .
|
||||||
form::field('cinecturlink2_newdir', 60, 64, '', 'maximal') . '</p>
|
form::field('cinecturlink2_newdir', 60, 64, '', 'maximal') . '</p>
|
||||||
|
|
||||||
<p><label for="cinecturlink2_widthmax">' . __('Maximum width of images (in pixel):') . '</label>' .
|
<p><label for="cinecturlink2_widthmax">' . __('Maximum width of images (in pixel):') . '</label>' .
|
||||||
@ -115,7 +113,7 @@ __('Update cache when use "Random" or "Number of view" order on widget (Need rel
|
|||||||
<p><label class="classic" for="cinecturlink2_public_active">' .
|
<p><label class="classic" for="cinecturlink2_public_active">' .
|
||||||
form::checkbox('cinecturlink2_public_active', 1, $cinecturlink2_public_active) .
|
form::checkbox('cinecturlink2_public_active', 1, $cinecturlink2_public_active) .
|
||||||
__('Enable public page') . '</label></p>
|
__('Enable public page') . '</label></p>
|
||||||
<p class="form-note">' . sprintf(__('Public page has url: %s'), '<a href="' . $core->blog->url.$core->url->getBase('cinecturlink2') . '" title="public page">' . $core->blog->url . $core->url->getBase('cinecturlink2') . '</a>') . '</p>
|
<p class="form-note">' . sprintf(__('Public page has url: %s'), '<a href="' . $core->blog->url . $core->url->getBase('cinecturlink2') . '" title="public page">' . $core->blog->url . $core->url->getBase('cinecturlink2') . '</a>') . '</p>
|
||||||
|
|
||||||
<p><label for="cinecturlink2_public_title">' . __('Title of the public page:') . '</label>' .
|
<p><label for="cinecturlink2_public_title">' . __('Title of the public page:') . '</label>' .
|
||||||
form::field('cinecturlink2_public_title', 60, 255, $cinecturlink2_public_title, 'maximal') . '</p>
|
form::field('cinecturlink2_public_title', 60, 255, $cinecturlink2_public_title, 'maximal') . '</p>
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Taken from cinecturlink for Dotclear 1
|
* Taken from cinecturlink for Dotclear 1
|
||||||
* By Tigroux and Brol
|
* By Tigroux and Brol
|
||||||
|
47
_install.php
47
_install.php
@ -10,7 +10,6 @@
|
|||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -25,20 +24,20 @@ if (version_compare($old_version, $new_version, '>=')) {
|
|||||||
try {
|
try {
|
||||||
$s = new dbStruct($core->con, $core->prefix);
|
$s = new dbStruct($core->con, $core->prefix);
|
||||||
$s->cinecturlink2
|
$s->cinecturlink2
|
||||||
->link_id ('bigint', 0, false)
|
->link_id('bigint', 0, false)
|
||||||
->blog_id ('varchar', 32, false)
|
->blog_id('varchar', 32, false)
|
||||||
->cat_id ('bigint', 0, true)
|
->cat_id('bigint', 0, true)
|
||||||
->user_id ('varchar', 32, true)
|
->user_id('varchar', 32, true)
|
||||||
->link_type ('varchar', 32, false, "'cinecturlink'")
|
->link_type('varchar', 32, false, "'cinecturlink'")
|
||||||
->link_title ('varchar', 255, false)
|
->link_title('varchar', 255, false)
|
||||||
->link_desc ('varchar', 255, false)
|
->link_desc('varchar', 255, false)
|
||||||
->link_author ('varchar', 255, false)
|
->link_author('varchar', 255, false)
|
||||||
->link_lang ('varchar', 5, false, "'en'")
|
->link_lang('varchar', 5, false, "'en'")
|
||||||
->link_url ('varchar', 255, false)
|
->link_url('varchar', 255, false)
|
||||||
->link_img ('varchar', 255, false)
|
->link_img('varchar', 255, false)
|
||||||
->link_creadt ('timestamp', 0, false, 'now()')
|
->link_creadt('timestamp', 0, false, 'now()')
|
||||||
->link_upddt ('timestamp', 0, false, 'now()')
|
->link_upddt('timestamp', 0, false, 'now()')
|
||||||
->link_pos ('smallint', 0, false, "'0'")
|
->link_pos('smallint', 0, false, "'0'")
|
||||||
->link_note('smallint', 0, false, "'10'")
|
->link_note('smallint', 0, false, "'10'")
|
||||||
->link_count('bigint', 0, false, "'0'")
|
->link_count('bigint', 0, false, "'0'")
|
||||||
|
|
||||||
@ -51,19 +50,19 @@ try {
|
|||||||
->index('idx_cinecturlink2_type', 'btree', 'link_type');
|
->index('idx_cinecturlink2_type', 'btree', 'link_type');
|
||||||
|
|
||||||
$s->cinecturlink2_cat
|
$s->cinecturlink2_cat
|
||||||
->cat_id ('bigint', 0, false)
|
->cat_id('bigint', 0, false)
|
||||||
->blog_id ('varchar', 32, false)
|
->blog_id('varchar', 32, false)
|
||||||
->cat_title ('varchar', 255, false)
|
->cat_title('varchar', 255, false)
|
||||||
->cat_desc ('varchar', 255, false)
|
->cat_desc('varchar', 255, false)
|
||||||
->cat_creadt ('timestamp', 0, false, 'now()')
|
->cat_creadt('timestamp', 0, false, 'now()')
|
||||||
->cat_upddt ('timestamp', 0, false, 'now()')
|
->cat_upddt('timestamp', 0, false, 'now()')
|
||||||
->cat_pos ('smallint', 0, false, "'0'")
|
->cat_pos('smallint', 0, false, "'0'")
|
||||||
|
|
||||||
->primary('pk_cinecturlink2_cat', 'cat_id')
|
->primary('pk_cinecturlink2_cat', 'cat_id')
|
||||||
->index('idx_cinecturlink2_cat_blog_id', 'btree', 'blog_id')
|
->index('idx_cinecturlink2_cat_blog_id', 'btree', 'blog_id')
|
||||||
->unique('uk_cinecturlink2_cat_title', 'cat_title', 'blog_id');
|
->unique('uk_cinecturlink2_cat_title', 'cat_title', 'blog_id');
|
||||||
|
|
||||||
$si = new dbStruct($core->con,$core->prefix);
|
$si = new dbStruct($core->con, $core->prefix);
|
||||||
$changes = $si->synchronize($s);
|
$changes = $si->synchronize($s);
|
||||||
|
|
||||||
$core->blog->settings->addNamespace('cinecturlink2');
|
$core->blog->settings->addNamespace('cinecturlink2');
|
||||||
@ -74,7 +73,7 @@ try {
|
|||||||
$s->put('cinecturlink2_triggeronrandom', false, 'boolean', 'Open link in new window', false, true);
|
$s->put('cinecturlink2_triggeronrandom', false, 'boolean', 'Open link in new window', false, true);
|
||||||
$s->put('cinecturlink2_public_active', false, 'boolean', 'Enable cinecturlink2', false, true);
|
$s->put('cinecturlink2_public_active', false, 'boolean', 'Enable cinecturlink2', false, true);
|
||||||
$s->put('cinecturlink2_public_title', '', 'string', 'Title of public page', false, true);
|
$s->put('cinecturlink2_public_title', '', 'string', 'Title of public page', false, true);
|
||||||
$s->put('cinecturlink2_public_description', '', 'string','Description of public page', false, true);
|
$s->put('cinecturlink2_public_description', '', 'string', 'Description of public page', false, true);
|
||||||
$s->put('cinecturlink2_public_nbrpp', 20, 'integer', 'Number of entries per page on public page', false, true);
|
$s->put('cinecturlink2_public_nbrpp', 20, 'integer', 'Number of entries per page on public page', false, true);
|
||||||
$s->put('cinecturlink2_public_caturl', 'c2cat', 'string', 'Part of URL for a category list', false, true);
|
$s->put('cinecturlink2_public_caturl', 'c2cat', 'string', 'Part of URL for a category list', false, true);
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
251
_public.php
251
_public.php
@ -10,17 +10,15 @@
|
|||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once dirname(__FILE__).'/_widgets.php';
|
require_once dirname(__FILE__) . '/_widgets.php';
|
||||||
|
|
||||||
$core->blog->settings->addNamespace('cinecturlink2');
|
$core->blog->settings->addNamespace('cinecturlink2');
|
||||||
|
|
||||||
$c2_tpl_values = array(
|
$c2_tpl_values = [
|
||||||
'c2PageFeedID',
|
'c2PageFeedID',
|
||||||
'c2PageFeedURL',
|
'c2PageFeedURL',
|
||||||
'c2PageURL',
|
'c2PageURL',
|
||||||
@ -59,9 +57,9 @@ $c2_tpl_values = array(
|
|||||||
'c2CategoryTitle',
|
'c2CategoryTitle',
|
||||||
'c2CategoryDescription',
|
'c2CategoryDescription',
|
||||||
'c2CategoryURL'
|
'c2CategoryURL'
|
||||||
);
|
];
|
||||||
|
|
||||||
$c2_tpl_blocks = array(
|
$c2_tpl_blocks = [
|
||||||
'c2If',
|
'c2If',
|
||||||
|
|
||||||
'c2Entries',
|
'c2Entries',
|
||||||
@ -76,21 +74,18 @@ $c2_tpl_blocks = array(
|
|||||||
'c2CategoriesHeader',
|
'c2CategoriesHeader',
|
||||||
'c2CategoriesFooter',
|
'c2CategoriesFooter',
|
||||||
'c2CategoryIf'
|
'c2CategoryIf'
|
||||||
);
|
];
|
||||||
|
|
||||||
if ($core->blog->settings->cinecturlink2->cinecturlink2_active) {
|
if ($core->blog->settings->cinecturlink2->cinecturlink2_active) {
|
||||||
|
foreach ($c2_tpl_blocks as $v) {
|
||||||
foreach($c2_tpl_blocks as $v) {
|
$core->tpl->addBlock($v, ['tplCinecturlink2', $v]);
|
||||||
$core->tpl->addBlock($v, array('tplCinecturlink2', $v));
|
|
||||||
}
|
}
|
||||||
foreach($c2_tpl_values as $v) {
|
foreach ($c2_tpl_values as $v) {
|
||||||
$core->tpl->addValue($v, array('tplCinecturlink2', $v));
|
$core->tpl->addValue($v, ['tplCinecturlink2', $v]);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
foreach (array_merge($c2_tpl_blocks, $c2_tpl_values) as $v) {
|
||||||
|
$core->tpl->addBlock($v, ['tplCinecturlink2', 'disable']);
|
||||||
foreach(array_merge($c2_tpl_blocks, $c2_tpl_values) as $v) {
|
|
||||||
$core->tpl->addBlock($v, array('tplCinecturlink2', 'disable'));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,8 +97,7 @@ class urlCinecturlink2 extends dcUrlHandlers
|
|||||||
$core->blog->settings->addNamespace('cinecturlink2');
|
$core->blog->settings->addNamespace('cinecturlink2');
|
||||||
|
|
||||||
if (!$core->blog->settings->cinecturlink2->cinecturlink2_active
|
if (!$core->blog->settings->cinecturlink2->cinecturlink2_active
|
||||||
|| !$core->blog->settings->cinecturlink2->cinecturlink2_public_active)
|
|| !$core->blog->settings->cinecturlink2->cinecturlink2_public_active) {
|
||||||
{
|
|
||||||
self::p404();
|
self::p404();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -111,10 +105,10 @@ class urlCinecturlink2 extends dcUrlHandlers
|
|||||||
|
|
||||||
$core->tpl->setPath(
|
$core->tpl->setPath(
|
||||||
$core->tpl->getPath(),
|
$core->tpl->getPath(),
|
||||||
dirname(__FILE__).'/default-templates/'
|
dirname(__FILE__) . '/default-templates/'
|
||||||
);
|
);
|
||||||
|
|
||||||
$params = array();
|
$params = [];
|
||||||
|
|
||||||
$n = self::getPageArgs($args, 'c2page');
|
$n = self::getPageArgs($args, 'c2page');
|
||||||
if ($n) {
|
if ($n) {
|
||||||
@ -122,20 +116,21 @@ class urlCinecturlink2 extends dcUrlHandlers
|
|||||||
}
|
}
|
||||||
|
|
||||||
$caturl = $core->blog->settings->cinecturlink2->cinecturlink2_public_caturl;
|
$caturl = $core->blog->settings->cinecturlink2->cinecturlink2_public_caturl;
|
||||||
if (!$caturl) $caturl = 'c2cat';
|
if (!$caturl) {
|
||||||
|
$caturl = 'c2cat';
|
||||||
|
}
|
||||||
|
|
||||||
$c = self::getPageArgs($args, $caturl);
|
$c = self::getPageArgs($args, $caturl);
|
||||||
if ($c) {
|
if ($c) {
|
||||||
if (is_numeric($c)) {
|
if (is_numeric($c)) {
|
||||||
$params['cat_id'] = (integer) $c;
|
$params['cat_id'] = (int) $c;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$params['cat_title'] = urldecode($c);
|
$params['cat_title'] = urldecode($c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$f = self::getPageArgs($args, 'feed');
|
$f = self::getPageArgs($args, 'feed');
|
||||||
if ($f && in_array($f, array('atom', 'rss2'))) {
|
if ($f && in_array($f, ['atom', 'rss2'])) {
|
||||||
$mime = $f == 'atom' ? 'application/atom+xml' : 'application/xml';
|
$mime = $f == 'atom' ? 'application/atom+xml' : 'application/xml';
|
||||||
|
|
||||||
//$_ctx->short_feed_items = $core->blog->settings->system->short_feed_items;
|
//$_ctx->short_feed_items = $core->blog->settings->system->short_feed_items;
|
||||||
@ -143,16 +138,14 @@ class urlCinecturlink2 extends dcUrlHandlers
|
|||||||
$params['limit'] = $core->blog->settings->system->nb_post_per_feed;
|
$params['limit'] = $core->blog->settings->system->nb_post_per_feed;
|
||||||
$_ctx->c2_page_params = $params;
|
$_ctx->c2_page_params = $params;
|
||||||
|
|
||||||
header('X-Robots-Tag: '.context::robotsPolicy($core->blog->settings->system->robots_policy, ''));
|
header('X-Robots-Tag: ' . context::robotsPolicy($core->blog->settings->system->robots_policy, ''));
|
||||||
self::serveDocument('cinecturlink2-'.$f.'.xml', $mime);
|
self::serveDocument('cinecturlink2-' . $f . '.xml', $mime);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$d = self::getPageArgs($args, 'c2detail');
|
$d = self::getPageArgs($args, 'c2detail');
|
||||||
if ($d) {
|
if ($d) {
|
||||||
if (is_numeric($d)) {
|
if (is_numeric($d)) {
|
||||||
$params['link_id'] = (integer) $d;
|
$params['link_id'] = (int) $d;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$params['link_title'] = urldecode($d);
|
$params['link_title'] = urldecode($d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -168,8 +161,8 @@ class urlCinecturlink2 extends dcUrlHandlers
|
|||||||
|
|
||||||
protected static function getPageArgs(&$args, $part)
|
protected static function getPageArgs(&$args, $part)
|
||||||
{
|
{
|
||||||
if (preg_match('#(^|/)'.$part.'/([^/]+)#', $args, $m)) {
|
if (preg_match('#(^|/)' . $part . '/([^/]+)#', $args, $m)) {
|
||||||
$args = preg_replace('#(^|/)'.$part.'/([^/]+)#', '', $args);
|
$args = preg_replace('#(^|/)' . $part . '/([^/]+)#', '', $args);
|
||||||
|
|
||||||
return $m[2];
|
return $m[2];
|
||||||
}
|
}
|
||||||
@ -180,24 +173,24 @@ class urlCinecturlink2 extends dcUrlHandlers
|
|||||||
|
|
||||||
class tplCinecturlink2
|
class tplCinecturlink2
|
||||||
{
|
{
|
||||||
public static function disable($a, $c=null)
|
public static function disable($a, $c = null)
|
||||||
{
|
{
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2PageURL($a)
|
public static function c2PageURL($a)
|
||||||
{
|
{
|
||||||
return "<?php echo ".sprintf($GLOBALS['core']->tpl->getFilters($a), '$core->blog->url.$core->url->getBase(\'cinecturlink2\')')."; ?>";
|
return '<?php echo ' . sprintf($GLOBALS['core']->tpl->getFilters($a), '$core->blog->url.$core->url->getBase(\'cinecturlink2\')') . '; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2PageTitle($a)
|
public static function c2PageTitle($a)
|
||||||
{
|
{
|
||||||
return "<?php \$title = (string) \$core->blog->settings->cinecturlink2->cinecturlink2_public_title; if (empty(\$title)) { \$title = __('My cinecturlink'); } echo ".sprintf($GLOBALS['core']->tpl->getFilters($a), '$title')."; ?>";
|
return "<?php \$title = (string) \$core->blog->settings->cinecturlink2->cinecturlink2_public_title; if (empty(\$title)) { \$title = __('My cinecturlink'); } echo " . sprintf($GLOBALS['core']->tpl->getFilters($a), '$title') . '; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2PageFeedURL($a)
|
public static function c2PageFeedURL($a)
|
||||||
{
|
{
|
||||||
return "<?php echo ".sprintf($GLOBALS['core']->tpl->getFilters($a),'$core->blog->url.$core->url->getBase("cinecturlink2")."/feed/'.(!empty($a['type']) && preg_match('#^(rss2|atom)$#', $a['type']) ? $a['type'] : 'atom').'"')."; ?>";
|
return '<?php echo ' . sprintf($GLOBALS['core']->tpl->getFilters($a), '$core->blog->url.$core->url->getBase("cinecturlink2")."/feed/' . (!empty($a['type']) && preg_match('#^(rss2|atom)$#', $a['type']) ? $a['type'] : 'atom') . '"') . '; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2PageFeedID($a)
|
public static function c2PageFeedID($a)
|
||||||
@ -207,45 +200,43 @@ class tplCinecturlink2
|
|||||||
|
|
||||||
public static function c2PageDescription($a)
|
public static function c2PageDescription($a)
|
||||||
{
|
{
|
||||||
return "<?php \$description = (string) \$core->blog->settings->cinecturlink2->cinecturlink2_public_description; echo ".sprintf($GLOBALS['core']->tpl->getFilters($a), '$description')."; ?>";
|
return '<?php $description = (string) $core->blog->settings->cinecturlink2->cinecturlink2_public_description; echo ' . sprintf($GLOBALS['core']->tpl->getFilters($a), '$description') . '; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2If($a ,$c)
|
public static function c2If($a, $c)
|
||||||
{
|
{
|
||||||
$if = array();
|
$if = [];
|
||||||
|
|
||||||
$operator = isset($a['operator']) ? self::getOperator($a['operator']) : '&&';
|
$operator = isset($a['operator']) ? self::getOperator($a['operator']) : '&&';
|
||||||
|
|
||||||
if (isset($a['request_link'])) {
|
if (isset($a['request_link'])) {
|
||||||
$sign = (boolean) $a['request_link'] ? '' : '!';
|
$sign = (bool) $a['request_link'] ? '' : '!';
|
||||||
$if[] = $sign.'(isset($_ctx->c2_page_params["link_id"]) || isset($_ctx->c2_page_params["link_title"]))';
|
$if[] = $sign . '(isset($_ctx->c2_page_params["link_id"]) || isset($_ctx->c2_page_params["link_title"]))';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($a['request_cat'])) {
|
if (isset($a['request_cat'])) {
|
||||||
$sign = (boolean) $a['request_cat'] ? '' : '!';
|
$sign = (bool) $a['request_cat'] ? '' : '!';
|
||||||
$if[] = $sign.'(isset($_ctx->c2_page_params["cat_id"]) || isset($_ctx->c2_page_params["cat_title"]))';
|
$if[] = $sign . '(isset($_ctx->c2_page_params["cat_id"]) || isset($_ctx->c2_page_params["cat_title"]))';
|
||||||
}
|
}
|
||||||
|
|
||||||
return empty($if) ? $c : "<?php if(".implode(' '.$operator.' ', $if).") : ?>\n".$c."<?php endif; ?>\n";
|
return empty($if) ? $c : '<?php if(' . implode(' ' . $operator . ' ', $if) . ") : ?>\n" . $c . "<?php endif; ?>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2Entries($a, $c)
|
public static function c2Entries($a, $c)
|
||||||
{
|
{
|
||||||
$lastn = isset($a['lastn']) ? abs((integer) $a['lastn'])+0 : -1;
|
$lastn = isset($a['lastn']) ? abs((int) $a['lastn']) + 0 : -1;
|
||||||
|
|
||||||
$res = 'if (!isset($c2_page_number)) { $c2_page_number = 1; }'."\n";
|
$res = 'if (!isset($c2_page_number)) { $c2_page_number = 1; }' . "\n";
|
||||||
|
|
||||||
if ($lastn != 0) {
|
if ($lastn != 0) {
|
||||||
if ($lastn > 0) {
|
if ($lastn > 0) {
|
||||||
$res .= "\$params['limit'] = ".$lastn.";\n";
|
$res .= "\$params['limit'] = " . $lastn . ";\n";
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$res .= "if (!isset(\$params['limit']) || \$params['limit'] < 1) { \$params['limit'] = 10; }\n";
|
$res .= "if (!isset(\$params['limit']) || \$params['limit'] < 1) { \$params['limit'] = 10; }\n";
|
||||||
}
|
}
|
||||||
if (!isset($a['ignore_pagination']) || $a['ignore_pagination'] == "0") {
|
if (!isset($a['ignore_pagination']) || $a['ignore_pagination'] == '0') {
|
||||||
$res .= "\$params['limit'] = array(((\$c2_page_number-1)*\$params['limit']),\$params['limit']);\n";
|
$res .= "\$params['limit'] = array(((\$c2_page_number-1)*\$params['limit']),\$params['limit']);\n";
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$res .= "\$params['limit'] = array(0, \$params['limit']);\n";
|
$res .= "\$params['limit'] = array(0, \$params['limit']);\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -253,65 +244,62 @@ class tplCinecturlink2
|
|||||||
if (isset($a['category'])) {
|
if (isset($a['category'])) {
|
||||||
if ($a['category'] == 'null') {
|
if ($a['category'] == 'null') {
|
||||||
$res .= "\$params['sql'] = ' AND L.cat_id IS NULL ';\n";
|
$res .= "\$params['sql'] = ' AND L.cat_id IS NULL ';\n";
|
||||||
}
|
} elseif (is_numeric($a['category'])) {
|
||||||
elseif (is_numeric($a['category'])) {
|
$res .= "\$params['cat_id'] = " . (int) $a['category'] . ";\n";
|
||||||
$res .= "\$params['cat_id'] = ".(integer) $a['category'].";\n";
|
} else {
|
||||||
}
|
$res .= "\$params['cat_title'] = '" . $a['category'] . "';\n";
|
||||||
else {
|
|
||||||
$res .= "\$params['cat_title'] = '".$a['category']."';\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sort = isset($a['sort']) && $a['sort'] == 'asc' ? ' asc' : ' desc';
|
$sort = isset($a['sort']) && $a['sort'] == 'asc' ? ' asc' : ' desc';
|
||||||
$sortby = isset($a['order']) && in_array($a['order'],array('link_count','link_upddt','link_creadt','link_note','link_title')) ? $a['order'] : 'link_upddt';
|
$sortby = isset($a['order']) && in_array($a['order'], ['link_count','link_upddt','link_creadt','link_note','link_title']) ? $a['order'] : 'link_upddt';
|
||||||
|
|
||||||
$res .=
|
$res .= "\$params['order'] = '" . $sortby . $sort . "';\n";
|
||||||
"\$params['order'] = '".$sortby.$sort."';\n";
|
|
||||||
|
|
||||||
return
|
return
|
||||||
"<?php \n".
|
"<?php \n" .
|
||||||
"\$params = is_array(\$_ctx->c2_page_params) ? \$_ctx->c2_page_params : array(); \n".
|
"\$params = is_array(\$_ctx->c2_page_params) ? \$_ctx->c2_page_params : array(); \n" .
|
||||||
$res.
|
$res .
|
||||||
"\$_ctx->c2_params = \$params; unset(\$params);\n".
|
"\$_ctx->c2_params = \$params; unset(\$params);\n" .
|
||||||
"if (!\$_ctx->exists('cinecturlink')) { \$_ctx->cinecturlink = new cinecturlink2(\$core); } \n".
|
"if (!\$_ctx->exists('cinecturlink')) { \$_ctx->cinecturlink = new cinecturlink2(\$core); } \n" .
|
||||||
"\$_ctx->c2_entries = \$_ctx->cinecturlink->getLinks(\$_ctx->c2_params); \n".
|
"\$_ctx->c2_entries = \$_ctx->cinecturlink->getLinks(\$_ctx->c2_params); \n" .
|
||||||
'while ($_ctx->c2_entries->fetch()) : ?>'.$c.'<?php endwhile; '."\n".
|
'while ($_ctx->c2_entries->fetch()) : ?>' . $c . '<?php endwhile; ' . "\n" .
|
||||||
"\$_ctx->c2_entries = null; \$_ctx->c2_params = null; \n".
|
"\$_ctx->c2_entries = null; \$_ctx->c2_params = null; \n" .
|
||||||
"?>\n";
|
"?>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntriesHeader($a, $c)
|
public static function c2EntriesHeader($a, $c)
|
||||||
{
|
{
|
||||||
return "<?php if (\$_ctx->c2_entries->isStart()) : ?>".$c."<?php endif; ?>";
|
return '<?php if ($_ctx->c2_entries->isStart()) : ?>' . $c . '<?php endif; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntriesFooter($a, $c)
|
public static function c2EntriesFooter($a, $c)
|
||||||
{
|
{
|
||||||
return "<?php if (\$_ctx->c2_entries->isEnd()) : ?>".$c."<?php endif; ?>";
|
return '<?php if ($_ctx->c2_entries->isEnd()) : ?>' . $c . '<?php endif; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryIf($a, $c)
|
public static function c2EntryIf($a, $c)
|
||||||
{
|
{
|
||||||
$if = array();
|
$if = [];
|
||||||
|
|
||||||
$operator = isset($a['operator']) ? self::getOperator($a['operator']) : '&&';
|
$operator = isset($a['operator']) ? self::getOperator($a['operator']) : '&&';
|
||||||
|
|
||||||
if (isset($a['has_category'])) {
|
if (isset($a['has_category'])) {
|
||||||
$sign = (boolean) $a['has_category'] ? '!' : '=';
|
$sign = (bool) $a['has_category'] ? '!' : '=';
|
||||||
$if[] = '($_ctx->exists("c2_entries") && "" '.$sign.'= $_ctx->c2_entries->cat_title)';
|
$if[] = '($_ctx->exists("c2_entries") && "" ' . $sign . '= $_ctx->c2_entries->cat_title)';
|
||||||
}
|
}
|
||||||
|
|
||||||
return empty($if) ? $c : "<?php if(".implode(' '.$operator.' ',$if).") : ?>\n".$c."<?php endif; ?>\n";
|
return empty($if) ? $c : '<?php if(' . implode(' ' . $operator . ' ', $if) . ") : ?>\n" . $c . "<?php endif; ?>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryIfFirst($a)
|
public static function c2EntryIfFirst($a)
|
||||||
{
|
{
|
||||||
return '<?php if ($_ctx->c2_entries->index() == 0) { echo "'.(isset($a['return']) ? addslashes(html::escapeHTML($a['return'])) : 'first').'"; } ?>';
|
return '<?php if ($_ctx->c2_entries->index() == 0) { echo "' . (isset($a['return']) ? addslashes(html::escapeHTML($a['return'])) : 'first') . '"; } ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryIfOdd($a)
|
public static function c2EntryIfOdd($a)
|
||||||
{
|
{
|
||||||
return '<?php if (($_ctx->c2_entries->index()+1)%2 == 1) { echo "'.(isset($a['return']) ? addslashes(html::escapeHTML($a['return'])) : 'odd').'"; } ?>';
|
return '<?php if (($_ctx->c2_entries->index()+1)%2 == 1) { echo "' . (isset($a['return']) ? addslashes(html::escapeHTML($a['return'])) : 'odd') . '"; } ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryFeedID($a)
|
public static function c2EntryFeedID($a)
|
||||||
@ -401,46 +389,46 @@ class tplCinecturlink2
|
|||||||
$style = isset($a['style']) ? html::escapeHTML($a['style']) : '';
|
$style = isset($a['style']) ? html::escapeHTML($a['style']) : '';
|
||||||
|
|
||||||
return
|
return
|
||||||
"<?php if (\$_ctx->exists('c2_entries')) { ".
|
"<?php if (\$_ctx->exists('c2_entries')) { " .
|
||||||
"\$widthmax = (integer) \$core->blog->settings->cinecturlink2->cinecturlink2_widthmax; ".
|
'$widthmax = (integer) $core->blog->settings->cinecturlink2->cinecturlink2_widthmax; ' .
|
||||||
"\$img = sprintf('<img src=\"%s\" alt=\"%s\" %s/>',".
|
"\$img = sprintf('<img src=\"%s\" alt=\"%s\" %s/>'," .
|
||||||
"\$_ctx->c2_entries->link_img, ".
|
'$_ctx->c2_entries->link_img, ' .
|
||||||
"html::escapeHTML(\$_ctx->c2_entries->link_title.' - '.\$_ctx->c2_entries->link_author), ".
|
"html::escapeHTML(\$_ctx->c2_entries->link_title.' - '.\$_ctx->c2_entries->link_author), " .
|
||||||
"(\$widthmax ? ' style=\"width:'.\$widthmax.'px;$style\"' : '') ".
|
"(\$widthmax ? ' style=\"width:'.\$widthmax.'px;$style\"' : '') " .
|
||||||
"); ".
|
'); ' .
|
||||||
"echo ".sprintf($f,'$img')."; unset(\$img); } ?> \n";
|
'echo ' . sprintf($f, '$img') . "; unset(\$img); } ?> \n";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryDate($a)
|
public static function c2EntryDate($a)
|
||||||
{
|
{
|
||||||
$format = !empty($a['format']) ? addslashes($a['format']) : '';
|
$format = !empty($a['format']) ? addslashes($a['format']) : '';
|
||||||
|
|
||||||
if (!empty($a['rfc822']))
|
if (!empty($a['rfc822'])) {
|
||||||
$p = "dt::rfc822(strtotime(\$_ctx->c2_entries->link_creadt), \$_ctx->posts->post_tz)";
|
$p = 'dt::rfc822(strtotime($_ctx->c2_entries->link_creadt), $_ctx->posts->post_tz)';
|
||||||
elseif (!empty($a['iso8601']))
|
} elseif (!empty($a['iso8601'])) {
|
||||||
$p = "dt::iso8601(strtotime(\$_ctx->c2_entries->link_creadt), \$_ctx->posts->post_tz)";
|
$p = 'dt::iso8601(strtotime($_ctx->c2_entries->link_creadt), $_ctx->posts->post_tz)';
|
||||||
elseif ($format)
|
} elseif ($format) {
|
||||||
$p = "dt::dt2str('".$format."', \$_ctx->c2_entries->link_creadt)";
|
$p = "dt::dt2str('" . $format . "', \$_ctx->c2_entries->link_creadt)";
|
||||||
else
|
} else {
|
||||||
$p = "dt::dt2str(\$core->blog->settings->system->date_format, \$_ctx->c2_entries->link_creadt)";
|
$p = 'dt::dt2str($core->blog->settings->system->date_format, $_ctx->c2_entries->link_creadt)';
|
||||||
|
}
|
||||||
|
|
||||||
return self::getGenericValue($p, $a);
|
return self::getGenericValue($p, $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryTime($a)
|
public static function c2EntryTime($a)
|
||||||
{
|
{
|
||||||
return self::getGenericValue("dt::dt2str(".(!empty($a['format']) ? "'".addslashes($a['format'])."'" : '$core->blog->settings->system->time_format').", \$_ctx->c2_entries->link_creadt)", $a);
|
return self::getGenericValue('dt::dt2str(' . (!empty($a['format']) ? "'" . addslashes($a['format']) . "'" : '$core->blog->settings->system->time_format') . ', $_ctx->c2_entries->link_creadt)', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2Pagination($a, $c)
|
public static function c2Pagination($a, $c)
|
||||||
{
|
{
|
||||||
$p =
|
$p = "<?php\n" .
|
||||||
"<?php\n".
|
"\$params = \$_ctx->c2_params;\n" .
|
||||||
"\$params = \$_ctx->c2_params;\n".
|
"\$_ctx->c2_pagination = \$_ctx->cinecturlink->getLinks(\$params,true); unset(\$params);\n" .
|
||||||
"\$_ctx->c2_pagination = \$_ctx->cinecturlink->getLinks(\$params,true); unset(\$params);\n".
|
|
||||||
"?>\n";
|
"?>\n";
|
||||||
|
|
||||||
return isset($a['no_context']) ? $p.$c : $p.'<?php if ($_ctx->c2_pagination->f(0) > $_ctx->c2_entries->count()) : ?>'.$c.'<?php endif; ?>';
|
return isset($a['no_context']) ? $p . $c : $p . '<?php if ($_ctx->c2_pagination->f(0) > $_ctx->c2_entries->count()) : ?>' . $c . '<?php endif; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2PaginationCounter($a)
|
public static function c2PaginationCounter($a)
|
||||||
@ -450,65 +438,65 @@ class tplCinecturlink2
|
|||||||
|
|
||||||
public static function c2PaginationCurrent($a)
|
public static function c2PaginationCurrent($a)
|
||||||
{
|
{
|
||||||
return self::getGenericValue('cinecturlink2Context::PaginationPosition('.(isset($a['offset']) ? (integer) $a['offset'] : 0).')', $a);
|
return self::getGenericValue('cinecturlink2Context::PaginationPosition(' . (isset($a['offset']) ? (int) $a['offset'] : 0) . ')', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2PaginationIf($a, $c)
|
public static function c2PaginationIf($a, $c)
|
||||||
{
|
{
|
||||||
$if = array();
|
$if = [];
|
||||||
|
|
||||||
if (isset($a['start'])) {
|
if (isset($a['start'])) {
|
||||||
$sign = (boolean) $a['start'] ? '' : '!';
|
$sign = (bool) $a['start'] ? '' : '!';
|
||||||
$if[] = $sign.'cinecturlink2Context::PaginationStart()';
|
$if[] = $sign . 'cinecturlink2Context::PaginationStart()';
|
||||||
}
|
}
|
||||||
if (isset($a['end'])) {
|
if (isset($a['end'])) {
|
||||||
$sign = (boolean) $a['end'] ? '' : '!';
|
$sign = (bool) $a['end'] ? '' : '!';
|
||||||
$if[] = $sign.'cinecturlink2Context::PaginationEnd()';
|
$if[] = $sign . 'cinecturlink2Context::PaginationEnd()';
|
||||||
}
|
}
|
||||||
|
|
||||||
return empty($if) ? $c : '<?php if('.implode(' && ', $if).') : ?>'.$c.'<?php endif; ?>';
|
return empty($if) ? $c : '<?php if(' . implode(' && ', $if) . ') : ?>' . $c . '<?php endif; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2PaginationURL($a)
|
public static function c2PaginationURL($a)
|
||||||
{
|
{
|
||||||
return self::getGenericValue('cinecturlink2Context::PaginationURL('.(isset($a['offset']) ? (integer) $a['offset'] : 0).')', $a);
|
return self::getGenericValue('cinecturlink2Context::PaginationURL(' . (isset($a['offset']) ? (int) $a['offset'] : 0) . ')', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2Categories($a, $c)
|
public static function c2Categories($a, $c)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
"<?php \n".
|
"<?php \n" .
|
||||||
"if (!\$_ctx->exists('cinecturlink')) { \$_ctx->cinecturlink = new cinecturlink2(\$core); } \n".
|
"if (!\$_ctx->exists('cinecturlink')) { \$_ctx->cinecturlink = new cinecturlink2(\$core); } \n" .
|
||||||
"\$_ctx->c2_categories = \$_ctx->cinecturlink->getCategories(); \n".
|
"\$_ctx->c2_categories = \$_ctx->cinecturlink->getCategories(); \n" .
|
||||||
'while ($_ctx->c2_categories->fetch()) : ?>'.$c.'<?php endwhile; '."\n".
|
'while ($_ctx->c2_categories->fetch()) : ?>' . $c . '<?php endwhile; ' . "\n" .
|
||||||
"\$_ctx->c2_categories = null; \n".
|
"\$_ctx->c2_categories = null; \n" .
|
||||||
"?>\n";
|
"?>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2CategoriesHeader($a, $c)
|
public static function c2CategoriesHeader($a, $c)
|
||||||
{
|
{
|
||||||
return "<?php if (\$_ctx->c2_categories->isStart()) : ?>".$c."<?php endif; ?>";
|
return '<?php if ($_ctx->c2_categories->isStart()) : ?>' . $c . '<?php endif; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2CategoriesFooter($a, $c)
|
public static function c2CategoriesFooter($a, $c)
|
||||||
{
|
{
|
||||||
return "<?php if (\$_ctx->c2_categories->isEnd()) : ?>".$c."<?php endif; ?>";
|
return '<?php if ($_ctx->c2_categories->isEnd()) : ?>' . $c . '<?php endif; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2CategoryIf($a, $c)
|
public static function c2CategoryIf($a, $c)
|
||||||
{
|
{
|
||||||
$if = array();
|
$if = [];
|
||||||
|
|
||||||
if (isset($a['current'])) {
|
if (isset($a['current'])) {
|
||||||
$sign = (boolean) $a['current'] ? '' : '!';
|
$sign = (bool) $a['current'] ? '' : '!';
|
||||||
$if[] = $sign.'cinecturlink2Context::CategoryCurrent()';
|
$if[] = $sign . 'cinecturlink2Context::CategoryCurrent()';
|
||||||
}
|
}
|
||||||
if (isset($a['first'])) {
|
if (isset($a['first'])) {
|
||||||
$sign = (boolean) $a['first'] ? '' : '!';
|
$sign = (bool) $a['first'] ? '' : '!';
|
||||||
$if[] = $sign.'$_ctx->c2_categories->isStart()';
|
$if[] = $sign . '$_ctx->c2_categories->isStart()';
|
||||||
}
|
}
|
||||||
|
|
||||||
return empty($if) ? $c : '<?php if('.implode(' && ', $if).') : ?>'.$c.'<?php endif; ?>';
|
return empty($if) ? $c : '<?php if(' . implode(' && ', $if) . ') : ?>' . $c . '<?php endif; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2CategoryFeedURL($a)
|
public static function c2CategoryFeedURL($a)
|
||||||
@ -519,7 +507,7 @@ class tplCinecturlink2
|
|||||||
$p = 'atom';
|
$p = 'atom';
|
||||||
}
|
}
|
||||||
|
|
||||||
return "<?php echo ".sprintf($GLOBALS['core']->tpl->getFilters($a),'$core->blog->url.$core->url->getBase("cinecturlink2")."/".$core->blog->settings->cinecturlink2->cinecturlink2_public_caturl."/".urlencode($_ctx->c2_categories->cat_title)."/feed/'.$p.'"')."; ?>";
|
return '<?php echo ' . sprintf($GLOBALS['core']->tpl->getFilters($a), '$core->blog->url.$core->url->getBase("cinecturlink2")."/".$core->blog->settings->cinecturlink2->cinecturlink2_public_caturl."/".urlencode($_ctx->c2_categories->cat_title)."/feed/' . $p . '"') . '; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2CategoryFeedID($a)
|
public static function c2CategoryFeedID($a)
|
||||||
@ -529,33 +517,32 @@ class tplCinecturlink2
|
|||||||
|
|
||||||
public static function c2CategoryID($a)
|
public static function c2CategoryID($a)
|
||||||
{
|
{
|
||||||
return "<?php if (\$_ctx->exists('c2_categories')) { echo ".sprintf($GLOBALS['core']->tpl->getFilters($a), '$_ctx->c2_categories->cat_id')."; } ?>";
|
return "<?php if (\$_ctx->exists('c2_categories')) { echo " . sprintf($GLOBALS['core']->tpl->getFilters($a), '$_ctx->c2_categories->cat_id') . '; } ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2CategoryTitle($a)
|
public static function c2CategoryTitle($a)
|
||||||
{
|
{
|
||||||
return "<?php if (\$_ctx->exists('c2_categories')) { echo ".sprintf($GLOBALS['core']->tpl->getFilters($a), '$_ctx->c2_categories->cat_title')."; } ?>";
|
return "<?php if (\$_ctx->exists('c2_categories')) { echo " . sprintf($GLOBALS['core']->tpl->getFilters($a), '$_ctx->c2_categories->cat_title') . '; } ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2CategoryDescription($a)
|
public static function c2CategoryDescription($a)
|
||||||
{
|
{
|
||||||
return "<?php if (\$_ctx->exists('c2_categories')) { echo ".sprintf($GLOBALS['core']->tpl->getFilters($a), '$_ctx->c2_categories->cat_desc')."; } ?>";
|
return "<?php if (\$_ctx->exists('c2_categories')) { echo " . sprintf($GLOBALS['core']->tpl->getFilters($a), '$_ctx->c2_categories->cat_desc') . '; } ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2CategoryURL($a)
|
public static function c2CategoryURL($a)
|
||||||
{
|
{
|
||||||
return "<?php if (\$_ctx->exists('c2_categories')) { echo ".sprintf($GLOBALS['core']->tpl->getFilters($a), '$core->blog->url.$core->url->getBase("cinecturlink2")."/".$core->blog->settings->cinecturlink2->cinecturlink2_public_caturl."/".urlencode($_ctx->c2_categories->cat_title)')."; } ?>";
|
return "<?php if (\$_ctx->exists('c2_categories')) { echo " . sprintf($GLOBALS['core']->tpl->getFilters($a), '$core->blog->url.$core->url->getBase("cinecturlink2")."/".$core->blog->settings->cinecturlink2->cinecturlink2_public_caturl."/".urlencode($_ctx->c2_categories->cat_title)') . '; } ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function getGenericValue($p,$a)
|
protected static function getGenericValue($p, $a)
|
||||||
{
|
{
|
||||||
return "<?php if (\$_ctx->exists('c2_entries')) { echo ".sprintf($GLOBALS['core']->tpl->getFilters($a), "$p")."; } ?>";
|
return "<?php if (\$_ctx->exists('c2_entries')) { echo " . sprintf($GLOBALS['core']->tpl->getFilters($a), "$p") . '; } ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function getOperator($op)
|
protected static function getOperator($op)
|
||||||
{
|
{
|
||||||
switch (strtolower($op))
|
switch (strtolower($op)) {
|
||||||
{
|
|
||||||
case 'or':
|
case 'or':
|
||||||
case '||':
|
case '||':
|
||||||
return '||';
|
return '||';
|
||||||
|
121
_uninstall.php
121
_uninstall.php
@ -10,77 +10,116 @@
|
|||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->addUserAction(
|
$this->addUserAction(
|
||||||
/* type */ 'settings',
|
/* type */
|
||||||
/* action */ 'delete_all',
|
'settings',
|
||||||
/* ns */ 'cinecturlink2',
|
/* action */
|
||||||
/* desc */ __('delete all settings')
|
'delete_all',
|
||||||
|
/* ns */
|
||||||
|
'cinecturlink2',
|
||||||
|
/* desc */
|
||||||
|
__('delete all settings')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addUserAction(
|
$this->addUserAction(
|
||||||
/* type */ 'tables',
|
/* type */
|
||||||
/* action */ 'delete',
|
'tables',
|
||||||
/* ns */ 'cinecturlink2',
|
/* action */
|
||||||
/* desc */ sprintf(__('delete %s table'), 'cinecturlink2')
|
'delete',
|
||||||
|
/* ns */
|
||||||
|
'cinecturlink2',
|
||||||
|
/* desc */
|
||||||
|
sprintf(__('delete %s table'), 'cinecturlink2')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addUserAction(
|
$this->addUserAction(
|
||||||
/* type */ 'tables',
|
/* type */
|
||||||
/* action */ 'delete',
|
'tables',
|
||||||
/* ns */ 'cinecturlink2_cat',
|
/* action */
|
||||||
/* desc */ sprintf(__('delete %s table'), 'cinecturlink2_cat')
|
'delete',
|
||||||
|
/* ns */
|
||||||
|
'cinecturlink2_cat',
|
||||||
|
/* desc */
|
||||||
|
sprintf(__('delete %s table'), 'cinecturlink2_cat')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addUserAction(
|
$this->addUserAction(
|
||||||
/* type */ 'versions',
|
/* type */
|
||||||
/* action */ 'delete',
|
'versions',
|
||||||
/* ns */ 'cinecturlink2',
|
/* action */
|
||||||
/* desc */ __('delete the version number')
|
'delete',
|
||||||
|
/* ns */
|
||||||
|
'cinecturlink2',
|
||||||
|
/* desc */
|
||||||
|
__('delete the version number')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addUserAction(
|
$this->addUserAction(
|
||||||
/* type */ 'plugins',
|
/* type */
|
||||||
/* action */ 'delete',
|
'plugins',
|
||||||
/* ns */ 'cinecturlink2',
|
/* action */
|
||||||
/* desc */ __('delete plugin files')
|
'delete',
|
||||||
|
/* ns */
|
||||||
|
'cinecturlink2',
|
||||||
|
/* desc */
|
||||||
|
__('delete plugin files')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addDirectAction(
|
$this->addDirectAction(
|
||||||
/* type */ 'settings',
|
/* type */
|
||||||
/* action */ 'delete_all',
|
'settings',
|
||||||
/* ns */ 'cinecturlink2',
|
/* action */
|
||||||
/* desc */ sprintf(__('delete all %s settings'), 'cinecturlink2')
|
'delete_all',
|
||||||
|
/* ns */
|
||||||
|
'cinecturlink2',
|
||||||
|
/* desc */
|
||||||
|
sprintf(__('delete all %s settings'), 'cinecturlink2')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addDirectAction(
|
$this->addDirectAction(
|
||||||
/* type */ 'tables',
|
/* type */
|
||||||
/* action */ 'delete',
|
'tables',
|
||||||
/* ns */ 'cinecturlink2',
|
/* action */
|
||||||
/* desc */ sprintf(__('delete %s table'), 'cinecturlink2')
|
'delete',
|
||||||
|
/* ns */
|
||||||
|
'cinecturlink2',
|
||||||
|
/* desc */
|
||||||
|
sprintf(__('delete %s table'), 'cinecturlink2')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addDirectAction(
|
$this->addDirectAction(
|
||||||
/* type */ 'tables',
|
/* type */
|
||||||
/* action */ 'delete',
|
'tables',
|
||||||
/* ns */ 'cinecturlink2_cat',
|
/* action */
|
||||||
/* desc */ sprintf(__('delete %s table'), 'cinecturlink2_cat')
|
'delete',
|
||||||
|
/* ns */
|
||||||
|
'cinecturlink2_cat',
|
||||||
|
/* desc */
|
||||||
|
sprintf(__('delete %s table'), 'cinecturlink2_cat')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addDirectAction(
|
$this->addDirectAction(
|
||||||
/* type */ 'versions',
|
/* type */
|
||||||
/* action */ 'delete',
|
'versions',
|
||||||
/* ns */ 'cinecturlink2',
|
/* action */
|
||||||
/* desc */ sprintf(__('delete %s version number'), 'cinecturlink2')
|
'delete',
|
||||||
|
/* ns */
|
||||||
|
'cinecturlink2',
|
||||||
|
/* desc */
|
||||||
|
sprintf(__('delete %s version number'), 'cinecturlink2')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addDirectAction(
|
$this->addDirectAction(
|
||||||
/* type */ 'plugins',
|
/* type */
|
||||||
/* action */ 'delete',
|
'plugins',
|
||||||
/* ns */ 'cinecturlink2',
|
/* action */
|
||||||
/* description */ sprintf(__('delete %s plugin files'), 'cinecturlink2')
|
'delete',
|
||||||
|
/* ns */
|
||||||
|
'cinecturlink2',
|
||||||
|
/* description */
|
||||||
|
sprintf(__('delete %s plugin files'), 'cinecturlink2')
|
||||||
);
|
);
|
51
_widgets.php
51
_widgets.php
@ -10,7 +10,6 @@
|
|||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -34,7 +33,7 @@ class cinecturlink2Widget
|
|||||||
|
|
||||||
$categories_combo = ['' => '', __('Uncategorized') => 'null'];
|
$categories_combo = ['' => '', __('Uncategorized') => 'null'];
|
||||||
$categories = $C2->getCategories();
|
$categories = $C2->getCategories();
|
||||||
while($categories->fetch()) {
|
while ($categories->fetch()) {
|
||||||
$cat_title = html::escapeHTML($categories->cat_title);
|
$cat_title = html::escapeHTML($categories->cat_title);
|
||||||
$categories_combo[$cat_title] = $categories->cat_id;
|
$categories_combo[$cat_title] = $categories->cat_id;
|
||||||
}
|
}
|
||||||
@ -174,13 +173,12 @@ class cinecturlink2Widget
|
|||||||
if ($w->category) {
|
if ($w->category) {
|
||||||
if ($w->category == 'null') {
|
if ($w->category == 'null') {
|
||||||
$params['sql'] = ' AND L.cat_id IS NULL ';
|
$params['sql'] = ' AND L.cat_id IS NULL ';
|
||||||
}
|
} elseif (is_numeric($w->category)) {
|
||||||
elseif (is_numeric($w->category)) {
|
$params['cat_id'] = (int) $w->category;
|
||||||
$params['cat_id'] = (integer) $w->category;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$limit = abs((integer) $w->limit);
|
$limit = abs((int) $w->limit);
|
||||||
|
|
||||||
// Tirage aléatoire: Consomme beaucoup de ressources!
|
// Tirage aléatoire: Consomme beaucoup de ressources!
|
||||||
if ($w->sortby == 'RANDOM') {
|
if ($w->sortby == 'RANDOM') {
|
||||||
@ -190,15 +188,15 @@ class cinecturlink2Widget
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ids= [];
|
$ids = [];
|
||||||
while($big_rs->fetch()) {
|
while ($big_rs->fetch()) {
|
||||||
$ids[] = $big_rs->link_id;
|
$ids[] = $big_rs->link_id;
|
||||||
}
|
}
|
||||||
shuffle($ids);
|
shuffle($ids);
|
||||||
$ids = array_slice($ids, 0, $limit);
|
$ids = array_slice($ids, 0, $limit);
|
||||||
|
|
||||||
$params['link_id'] = [];
|
$params['link_id'] = [];
|
||||||
foreach($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
$params['link_id'][] = $id;
|
$params['link_id'][] = $id;
|
||||||
}
|
}
|
||||||
} elseif ($w->sortby == 'COUNTER') {
|
} elseif ($w->sortby == 'COUNTER') {
|
||||||
@ -216,11 +214,11 @@ class cinecturlink2Widget
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$widthmax = (integer) $core->blog->settings->cinecturlink2->cinecturlink2_widthmax;
|
$widthmax = (int) $core->blog->settings->cinecturlink2->cinecturlink2_widthmax;
|
||||||
$style = $widthmax ? ' style="width:' . $widthmax . 'px;"' : '';
|
$style = $widthmax ? ' style="width:' . $widthmax . 'px;"' : '';
|
||||||
|
|
||||||
$entries = [];
|
$entries = [];
|
||||||
while($rs->fetch()) {
|
while ($rs->fetch()) {
|
||||||
$url = $rs->link_url;
|
$url = $rs->link_url;
|
||||||
$img = $rs->link_img;
|
$img = $rs->link_img;
|
||||||
$title = html::escapeHTML($rs->link_title);
|
$title = html::escapeHTML($rs->link_title);
|
||||||
@ -229,13 +227,12 @@ class cinecturlink2Widget
|
|||||||
$note = $w->shownote ? ' <em>(' . $rs->link_note . '/20)</em>' : '';
|
$note = $w->shownote ? ' <em>(' . $rs->link_note . '/20)</em>' : '';
|
||||||
$desc = $w->showdesc ? '<br /><em>' . html::escapeHTML($rs->link_desc) . '</em>' : '';
|
$desc = $w->showdesc ? '<br /><em>' . html::escapeHTML($rs->link_desc) . '</em>' : '';
|
||||||
$lang = $rs->link_lang ? ' hreflang="' . $rs->link_lang . '"' : '';
|
$lang = $rs->link_lang ? ' hreflang="' . $rs->link_lang . '"' : '';
|
||||||
$count = abs((integer) $rs->link_count);
|
$count = abs((int) $rs->link_count);
|
||||||
|
|
||||||
# --BEHAVIOR-- cinecturlink2WidgetLinks
|
# --BEHAVIOR-- cinecturlink2WidgetLinks
|
||||||
$bhv = $core->callBehavior('cinecturlink2WidgetLinks', $rs->link_id);
|
$bhv = $core->callBehavior('cinecturlink2WidgetLinks', $rs->link_id);
|
||||||
|
|
||||||
$entries[] =
|
$entries[] = '<p style="text-align:center;">' .
|
||||||
'<p style="text-align:center;">' .
|
|
||||||
($w->withlink && !empty($url) ? '<a href="' . $url . '"' . $lang . ' title="' . $cat . '">' : '') .
|
($w->withlink && !empty($url) ? '<a href="' . $url . '"' . $lang . ' title="' . $cat . '">' : '') .
|
||||||
'<strong>' . $title . '</strong>' . $note . '<br />' .
|
'<strong>' . $title . '</strong>' . $note . '<br />' .
|
||||||
($w->showauthor ? $author . '<br />' : '') . '<br />' .
|
($w->showauthor ? $author . '<br />' : '') . '<br />' .
|
||||||
@ -249,7 +246,6 @@ class cinecturlink2Widget
|
|||||||
$cur->link_count = ($count + 1);
|
$cur->link_count = ($count + 1);
|
||||||
$C2->updLink($rs->link_id, $cur, false);
|
$C2->updLink($rs->link_id, $cur, false);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Tirage aléatoire
|
# Tirage aléatoire
|
||||||
@ -264,10 +260,11 @@ class cinecturlink2Widget
|
|||||||
|
|
||||||
return $w->renderDiv(
|
return $w->renderDiv(
|
||||||
$w->content_only,
|
$w->content_only,
|
||||||
'cinecturlink2list '. $w->class,
|
'cinecturlink2list ' . $w->class,
|
||||||
'',
|
'',
|
||||||
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') . implode(' ',$entries) .
|
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') . implode(' ', $entries) .
|
||||||
($w->showpagelink && $core->blog->settings->cinecturlink2->cinecturlink2_public_active ?
|
(
|
||||||
|
$w->showpagelink && $core->blog->settings->cinecturlink2->cinecturlink2_public_active ?
|
||||||
'<p><a href="' . $core->blog->url . $core->url->getBase('cinecturlink2') . '" title="' . __('view all links') . '">' . __('More links') . '</a></p>' : ''
|
'<p><a href="' . $core->blog->url . $core->url->getBase('cinecturlink2') . '" title="' . __('view all links') . '">' . __('More links') . '</a></p>' : ''
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -294,32 +291,30 @@ class cinecturlink2Widget
|
|||||||
}
|
}
|
||||||
|
|
||||||
$res = [];
|
$res = [];
|
||||||
$res[] =
|
$res[] = '<li><a href="' .
|
||||||
'<li><a href="' .
|
|
||||||
$core->blog->url . $core->url->getBase('cinecturlink2') .
|
$core->blog->url . $core->url->getBase('cinecturlink2') .
|
||||||
'" title="' . __('view all links') . '">' . __('all links') .
|
'" title="' . __('view all links') . '">' . __('all links') .
|
||||||
'</a>'. ($w->shownumlink ? ' ('. ($C2->getLinks([], true)->f(0)) . ')' : '') .
|
'</a>' . ($w->shownumlink ? ' (' . ($C2->getLinks([], true)->f(0)) . ')' : '') .
|
||||||
'</li>';
|
'</li>';
|
||||||
|
|
||||||
while($rs->fetch()) {
|
while ($rs->fetch()) {
|
||||||
$res[] =
|
$res[] = '<li><a href="' .
|
||||||
'<li><a href="' .
|
|
||||||
$core->blog->url . $core->url->getBase('cinecturlink2') . '/' .
|
$core->blog->url . $core->url->getBase('cinecturlink2') . '/' .
|
||||||
$core->blog->settings->cinecturlink2->cinecturlink2_public_caturl . '/' .
|
$core->blog->settings->cinecturlink2->cinecturlink2_public_caturl . '/' .
|
||||||
urlencode($rs->cat_title) .
|
urlencode($rs->cat_title) .
|
||||||
'" title="'.__('view links of this category') . '">' .
|
'" title="' . __('view links of this category') . '">' .
|
||||||
html::escapeHTML($rs->cat_title) .
|
html::escapeHTML($rs->cat_title) .
|
||||||
'</a>'. ($w->shownumlink ? ' (' .
|
'</a>' . ($w->shownumlink ? ' (' .
|
||||||
($C2->getLinks(['cat_id' => $rs->cat_id], true)->f(0)) . ')' : '') .
|
($C2->getLinks(['cat_id' => $rs->cat_id], true)->f(0)) . ')' : '') .
|
||||||
'</li>';
|
'</li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $w->renderDiv(
|
return $w->renderDiv(
|
||||||
$w->content_only,
|
$w->content_only,
|
||||||
'cinecturlink2cat '. $w->class,
|
'cinecturlink2cat ' . $w->class,
|
||||||
'',
|
'',
|
||||||
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') .
|
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') .
|
||||||
'<ul>' . implode(' ',$res) . '</ul>'
|
'<ul>' . implode(' ', $res) . '</ul>'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -10,7 +10,6 @@
|
|||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -63,8 +62,7 @@ class cinecturlink2
|
|||||||
$content_req .= implode(', ', $params['columns']) . ', ';
|
$content_req .= implode(', ', $params['columns']) . ', ';
|
||||||
}
|
}
|
||||||
|
|
||||||
$strReq =
|
$strReq = 'SELECT L.link_id, L.blog_id, L.cat_id, L.user_id, L.link_type, ' .
|
||||||
'SELECT L.link_id, L.blog_id, L.cat_id, L.user_id, L.link_type, ' .
|
|
||||||
$content_req .
|
$content_req .
|
||||||
'L.link_creadt, L.link_upddt, L.link_note, L.link_count, ' .
|
'L.link_creadt, L.link_upddt, L.link_note, L.link_count, ' .
|
||||||
'L.link_title, L.link_desc, L.link_author, ' .
|
'L.link_title, L.link_desc, L.link_author, ' .
|
||||||
@ -74,8 +72,7 @@ class cinecturlink2
|
|||||||
'C.cat_title, C.cat_desc ';
|
'C.cat_title, C.cat_desc ';
|
||||||
}
|
}
|
||||||
|
|
||||||
$strReq .=
|
$strReq .= 'FROM ' . $this->table . ' L ' .
|
||||||
'FROM '. $this->table . ' L ' .
|
|
||||||
'INNER JOIN ' . $this->core->prefix . 'user U ON U.user_id = L.user_id ' .
|
'INNER JOIN ' . $this->core->prefix . 'user U ON U.user_id = L.user_id ' .
|
||||||
'LEFT OUTER JOIN ' . $this->table . '_cat C ON L.cat_id = C.cat_id ';
|
'LEFT OUTER JOIN ' . $this->table . '_cat C ON L.cat_id = C.cat_id ';
|
||||||
|
|
||||||
@ -97,18 +94,18 @@ class cinecturlink2
|
|||||||
|
|
||||||
if (!empty($params['link_id'])) {
|
if (!empty($params['link_id'])) {
|
||||||
if (is_array($params['link_id'])) {
|
if (is_array($params['link_id'])) {
|
||||||
array_walk($params['link_id'], function(&$v, $k){ if($v !== null) { $v = (integer) $v;}});
|
array_walk($params['link_id'], function (&$v, $k) { if ($v !== null) { $v = (int) $v;}});
|
||||||
} else {
|
} else {
|
||||||
$params['link_id'] = [(integer) $params['link_id']];
|
$params['link_id'] = [(int) $params['link_id']];
|
||||||
}
|
}
|
||||||
$strReq .= 'AND L.link_id ' . $this->con->in($params['link_id']);
|
$strReq .= 'AND L.link_id ' . $this->con->in($params['link_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($params['cat_id'])) {
|
if (!empty($params['cat_id'])) {
|
||||||
if (is_array($params['cat_id'])) {
|
if (is_array($params['cat_id'])) {
|
||||||
array_walk($params['cat_id'], function(&$v, $k) { if($v !== null) { $v = (integer) $v;}});
|
array_walk($params['cat_id'], function (&$v, $k) { if ($v !== null) { $v = (int) $v;}});
|
||||||
} else {
|
} else {
|
||||||
$params['cat_id'] = [(integer) $params['cat_id']];
|
$params['cat_id'] = [(int) $params['cat_id']];
|
||||||
}
|
}
|
||||||
$strReq .= 'AND L.cat_id ' . $this->con->in($params['cat_id']);
|
$strReq .= 'AND L.cat_id ' . $this->con->in($params['cat_id']);
|
||||||
}
|
}
|
||||||
@ -177,6 +174,7 @@ class cinecturlink2
|
|||||||
$this->con->unlock();
|
$this->con->unlock();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->con->unlock();
|
$this->con->unlock();
|
||||||
|
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
$this->trigger();
|
$this->trigger();
|
||||||
@ -196,7 +194,7 @@ class cinecturlink2
|
|||||||
*/
|
*/
|
||||||
public function updLink($id, cursor $cur, $behavior = true)
|
public function updLink($id, cursor $cur, $behavior = true)
|
||||||
{
|
{
|
||||||
$id = (integer) $id;
|
$id = (int) $id;
|
||||||
|
|
||||||
if (empty($id)) {
|
if (empty($id)) {
|
||||||
throw new Exception(__('No such link ID'));
|
throw new Exception(__('No such link ID'));
|
||||||
@ -204,7 +202,7 @@ class cinecturlink2
|
|||||||
|
|
||||||
$cur->link_upddt = date('Y-m-d H:i:s');
|
$cur->link_upddt = date('Y-m-d H:i:s');
|
||||||
|
|
||||||
$cur->update("WHERE link_id = " . $id . " AND blog_id = '" . $this->blog . "' ");
|
$cur->update('WHERE link_id = ' . $id . " AND blog_id = '" . $this->blog . "' ");
|
||||||
$this->trigger();
|
$this->trigger();
|
||||||
|
|
||||||
if ($behavior) {
|
if ($behavior) {
|
||||||
@ -220,7 +218,7 @@ class cinecturlink2
|
|||||||
*/
|
*/
|
||||||
public function delLink($id)
|
public function delLink($id)
|
||||||
{
|
{
|
||||||
$id = (integer) $id;
|
$id = (int) $id;
|
||||||
|
|
||||||
if (empty($id)) {
|
if (empty($id)) {
|
||||||
throw new Exception(__('No such link ID'));
|
throw new Exception(__('No such link ID'));
|
||||||
@ -261,15 +259,13 @@ class cinecturlink2
|
|||||||
{
|
{
|
||||||
if ($count_only) {
|
if ($count_only) {
|
||||||
$strReq = 'SELECT count(C.cat_id) ';
|
$strReq = 'SELECT count(C.cat_id) ';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$content_req = '';
|
$content_req = '';
|
||||||
if (!empty($params['columns']) && is_array($params['columns'])) {
|
if (!empty($params['columns']) && is_array($params['columns'])) {
|
||||||
$content_req .= implode(', ', $params['columns']) . ', ';
|
$content_req .= implode(', ', $params['columns']) . ', ';
|
||||||
}
|
}
|
||||||
|
|
||||||
$strReq =
|
$strReq = 'SELECT C.cat_id, C.blog_id, C.cat_title, C.cat_desc, ' .
|
||||||
'SELECT C.cat_id, C.blog_id, C.cat_title, C.cat_desc, ' .
|
|
||||||
$content_req .
|
$content_req .
|
||||||
'C.cat_pos, C.cat_creadt, C.cat_upddt ';
|
'C.cat_pos, C.cat_creadt, C.cat_upddt ';
|
||||||
}
|
}
|
||||||
@ -284,18 +280,18 @@ class cinecturlink2
|
|||||||
|
|
||||||
if (!empty($params['cat_id'])) {
|
if (!empty($params['cat_id'])) {
|
||||||
if (is_array($params['cat_id'])) {
|
if (is_array($params['cat_id'])) {
|
||||||
array_walk($params['cat_id'], function(&$v, $k) { if($v !== null) { $v = (integer) $v; }});
|
array_walk($params['cat_id'], function (&$v, $k) { if ($v !== null) { $v = (int) $v; }});
|
||||||
} else {
|
} else {
|
||||||
$params['cat_id'] = [(integer) $params['cat_id']];
|
$params['cat_id'] = [(int) $params['cat_id']];
|
||||||
}
|
}
|
||||||
$strReq .= 'AND C.cat_id ' . $this->con->in($params['cat_id']);
|
$strReq .= 'AND C.cat_id ' . $this->con->in($params['cat_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($params['exclude_cat_id']) && $params['exclude_cat_id'] !== '') {
|
if (isset($params['exclude_cat_id']) && $params['exclude_cat_id'] !== '') {
|
||||||
if (is_array($params['exclude_cat_id'])) {
|
if (is_array($params['exclude_cat_id'])) {
|
||||||
array_walk($params['exclude_cat_id'], function (&$v, $k) { if ($v !== null) {$v = (integer) $v;}});
|
array_walk($params['exclude_cat_id'], function (&$v, $k) { if ($v !== null) {$v = (int) $v;}});
|
||||||
} else {
|
} else {
|
||||||
$params['exclude_cat_id'] = [(integer) $params['exclude_cat_id']];
|
$params['exclude_cat_id'] = [(int) $params['exclude_cat_id']];
|
||||||
}
|
}
|
||||||
$strReq .= 'AND C.cat_id NOT ' . $this->con->in($params['exclude_cat_id']);
|
$strReq .= 'AND C.cat_id NOT ' . $this->con->in($params['exclude_cat_id']);
|
||||||
}
|
}
|
||||||
@ -350,6 +346,7 @@ class cinecturlink2
|
|||||||
$this->con->unlock();
|
$this->con->unlock();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->con->unlock();
|
$this->con->unlock();
|
||||||
|
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
$this->trigger();
|
$this->trigger();
|
||||||
@ -365,7 +362,7 @@ class cinecturlink2
|
|||||||
*/
|
*/
|
||||||
public function updCategory($id, cursor $cur)
|
public function updCategory($id, cursor $cur)
|
||||||
{
|
{
|
||||||
$id = (integer) $id;
|
$id = (int) $id;
|
||||||
|
|
||||||
if (empty($id)) {
|
if (empty($id)) {
|
||||||
throw new Exception(__('No such category ID'));
|
throw new Exception(__('No such category ID'));
|
||||||
@ -373,7 +370,7 @@ class cinecturlink2
|
|||||||
|
|
||||||
$cur->cat_upddt = date('Y-m-d H:i:s');
|
$cur->cat_upddt = date('Y-m-d H:i:s');
|
||||||
|
|
||||||
$cur->update("WHERE cat_id = " . $id . " AND blog_id = '" . $this->blog . "' ");
|
$cur->update('WHERE cat_id = ' . $id . " AND blog_id = '" . $this->blog . "' ");
|
||||||
$this->trigger();
|
$this->trigger();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,7 +381,7 @@ class cinecturlink2
|
|||||||
*/
|
*/
|
||||||
public function delCategory($id)
|
public function delCategory($id)
|
||||||
{
|
{
|
||||||
$id = (integer) $id;
|
$id = (int) $id;
|
||||||
|
|
||||||
if (empty($id)) {
|
if (empty($id)) {
|
||||||
throw new Exception(__('No such category ID'));
|
throw new Exception(__('No such category ID'));
|
||||||
@ -398,9 +395,9 @@ class cinecturlink2
|
|||||||
|
|
||||||
# Update link cat to NULL
|
# Update link cat to NULL
|
||||||
$cur = $this->con->openCursor($this->table);
|
$cur = $this->con->openCursor($this->table);
|
||||||
$cur->cat_id = NULL;
|
$cur->cat_id = null;
|
||||||
$cur->link_upddt = date('Y-m-d H:i:s');
|
$cur->link_upddt = date('Y-m-d H:i:s');
|
||||||
$cur->update("WHERE cat_id = " . $id . " AND blog_id = '" . $this->blog . "' ");
|
$cur->update('WHERE cat_id = ' . $id . " AND blog_id = '" . $this->blog . "' ");
|
||||||
|
|
||||||
$this->trigger();
|
$this->trigger();
|
||||||
}
|
}
|
||||||
@ -453,9 +450,11 @@ class cinecturlink2
|
|||||||
if ($throw) {
|
if ($throw) {
|
||||||
throw new Exception(__('Failed to create public folder for images.'));
|
throw new Exception(__('Failed to create public folder for images.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -469,7 +468,7 @@ class cinecturlink2
|
|||||||
{
|
{
|
||||||
$dirs = [];
|
$dirs = [];
|
||||||
$all = files::getDirList($core->blog->public_path);
|
$all = files::getDirList($core->blog->public_path);
|
||||||
foreach($all['dirs'] as $dir) {
|
foreach ($all['dirs'] as $dir) {
|
||||||
$dir = substr($dir, strlen($core->blog->public_path) + 1);
|
$dir = substr($dir, strlen($core->blog->public_path) + 1);
|
||||||
$dirs[$dir] = $dir;
|
$dirs[$dir] = $dir;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class cinecturlink2Context
|
class cinecturlink2Context
|
||||||
{
|
{
|
||||||
public static function PaginationNbPages()
|
public static function PaginationNbPages()
|
||||||
@ -22,7 +21,7 @@ class cinecturlink2Context
|
|||||||
}
|
}
|
||||||
$nb_posts = $_ctx->c2_pagination->f(0);
|
$nb_posts = $_ctx->c2_pagination->f(0);
|
||||||
$nb_per_page = $_ctx->c2_params['limit'][1];
|
$nb_per_page = $_ctx->c2_params['limit'][1];
|
||||||
$nb_pages = ceil($nb_posts/$nb_per_page);
|
$nb_pages = ceil($nb_posts / $nb_per_page);
|
||||||
|
|
||||||
return $nb_pages;
|
return $nb_pages;
|
||||||
}
|
}
|
||||||
@ -34,11 +33,12 @@ class cinecturlink2Context
|
|||||||
} else {
|
} else {
|
||||||
$p = 1;
|
$p = 1;
|
||||||
}
|
}
|
||||||
$p = $p+$offset;
|
$p = $p + $offset;
|
||||||
$n = self::PaginationNbPages();
|
$n = self::PaginationNbPages();
|
||||||
if (!$n) {
|
if (!$n) {
|
||||||
return $p;
|
return $p;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $p > $n || $p <= 0 ? 1 : $p;
|
return $p > $n || $p <= 0 ? 1 : $p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,6 +47,7 @@ class cinecturlink2Context
|
|||||||
if (isset($GLOBALS['c2_page_number'])) {
|
if (isset($GLOBALS['c2_page_number'])) {
|
||||||
return self::PaginationPosition() == 1;
|
return self::PaginationPosition() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,6 +56,7 @@ class cinecturlink2Context
|
|||||||
if (isset($GLOBALS['c2_page_number'])) {
|
if (isset($GLOBALS['c2_page_number'])) {
|
||||||
return self::PaginationPosition() == self::PaginationNbPages();
|
return self::PaginationPosition() == self::PaginationNbPages();
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,9 +76,10 @@ class cinecturlink2Context
|
|||||||
}
|
}
|
||||||
# If search param
|
# If search param
|
||||||
if (!empty($_GET['q'])) {
|
if (!empty($_GET['q'])) {
|
||||||
$s = strpos($url,'?') !== false ? '&' : '?';
|
$s = strpos($url, '?') !== false ? '&' : '?';
|
||||||
$url .= $s . 'q=' . rawurlencode($_GET['q']);
|
$url .= $s . 'q=' . rawurlencode($_GET['q']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,6 +102,7 @@ class cinecturlink2Context
|
|||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -10,7 +10,6 @@
|
|||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -62,7 +61,7 @@ class adminlistCinecturlink2
|
|||||||
$links = [];
|
$links = [];
|
||||||
if (isset($_REQUEST['links'])) {
|
if (isset($_REQUEST['links'])) {
|
||||||
foreach ($_REQUEST['links'] as $v) {
|
foreach ($_REQUEST['links'] as $v) {
|
||||||
$links[(integer) $v] = true;
|
$links[(int) $v] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,13 +77,13 @@ class adminlistCinecturlink2
|
|||||||
$cols = new ArrayObject($cols);
|
$cols = new ArrayObject($cols);
|
||||||
$this->userColumns('c2link', $cols);
|
$this->userColumns('c2link', $cols);
|
||||||
|
|
||||||
$html_block =
|
$html_block = '<div class="table-outer">' .
|
||||||
'<div class="table-outer">' .
|
|
||||||
'<table>' .
|
'<table>' .
|
||||||
'<caption>' . ($filter ?
|
'<caption>' . (
|
||||||
|
$filter ?
|
||||||
sprintf(__('List of %s links matching the filter.'), $this->rs_count) :
|
sprintf(__('List of %s links matching the filter.'), $this->rs_count) :
|
||||||
sprintf(__('List of links (%s)'), $this->rs_count)
|
sprintf(__('List of links (%s)'), $this->rs_count)
|
||||||
). '</caption>' .
|
) . '</caption>' .
|
||||||
'<thead>' .
|
'<thead>' .
|
||||||
'<tr>' . implode(iterator_to_array($cols)) . '</tr>' .
|
'<tr>' . implode(iterator_to_array($cols)) . '</tr>' .
|
||||||
'</thead>' .
|
'</thead>' .
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class sitemapsCinecturlink2
|
class sitemapsCinecturlink2
|
||||||
{
|
{
|
||||||
public static function sitemapsDefineParts($map_parts)
|
public static function sitemapsDefineParts($map_parts)
|
||||||
@ -36,7 +35,7 @@ class sitemapsCinecturlink2
|
|||||||
$C2 = new cinecturlink2($core);
|
$C2 = new cinecturlink2($core);
|
||||||
$cats = $C2->getCategories();
|
$cats = $C2->getCategories();
|
||||||
while ($cats->fetch()) {
|
while ($cats->fetch()) {
|
||||||
$sitemaps->addEntry($base . "/" . $core->blog->settings->cinecturlink2->cinecturlink2_public_caturl . '/' . urlencode($cats->cat_title), $prio, $freq);
|
$sitemaps->addEntry($base . '/' . $core->blog->settings->cinecturlink2->cinecturlink2_public_caturl . '/' . urlencode($cats->cat_title), $prio, $freq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
116
index.php
116
index.php
@ -10,7 +10,6 @@
|
|||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -48,7 +47,7 @@ try {
|
|||||||
$C2 = new cinecturlink2($core);
|
$C2 = new cinecturlink2($core);
|
||||||
$categories = $C2->getCategories();
|
$categories = $C2->getCategories();
|
||||||
$categories_combo = ['-' => ''];
|
$categories_combo = ['-' => ''];
|
||||||
while($categories->fetch()) {
|
while ($categories->fetch()) {
|
||||||
$cat_title = html::escapeHTML($categories->cat_title);
|
$cat_title = html::escapeHTML($categories->cat_title);
|
||||||
$categories_combo[$cat_title] = $categories->cat_id;
|
$categories_combo[$cat_title] = $categories->cat_id;
|
||||||
}
|
}
|
||||||
@ -87,10 +86,10 @@ if ($part == 'updlinksnote') {
|
|||||||
try {
|
try {
|
||||||
// update group of links note
|
// update group of links note
|
||||||
if (!empty($entries) && isset($_POST['newlinknote'])) {
|
if (!empty($entries) && isset($_POST['newlinknote'])) {
|
||||||
while($links->fetch()) {
|
while ($links->fetch()) {
|
||||||
if (in_array($links->link_id, $entries)) {
|
if (in_array($links->link_id, $entries)) {
|
||||||
$cur = $core->con->openCursor($C2->table);
|
$cur = $core->con->openCursor($C2->table);
|
||||||
$cur->link_note = (integer) $_POST['newlinknote'];
|
$cur->link_note = (int) $_POST['newlinknote'];
|
||||||
$C2->updLink($links->link_id, $cur);
|
$C2->updLink($links->link_id, $cur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -113,10 +112,10 @@ if ($part == 'updlinkscat') {
|
|||||||
try {
|
try {
|
||||||
// update group of links category
|
// update group of links category
|
||||||
if (!empty($entries) && !empty($_POST['newcatid'])) {
|
if (!empty($entries) && !empty($_POST['newcatid'])) {
|
||||||
while($links->fetch()) {
|
while ($links->fetch()) {
|
||||||
if (in_array($links->link_id, $entries)) {
|
if (in_array($links->link_id, $entries)) {
|
||||||
$cur = $core->con->openCursor($C2->table);
|
$cur = $core->con->openCursor($C2->table);
|
||||||
$cur->cat_id = (integer) $_POST['newcatid'];
|
$cur->cat_id = (int) $_POST['newcatid'];
|
||||||
$C2->updLink($links->link_id, $cur);
|
$C2->updLink($links->link_id, $cur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -146,7 +145,10 @@ if ($part == 'links') {
|
|||||||
$c2link_filter->add('part', 'links');
|
$c2link_filter->add('part', 'links');
|
||||||
$c2link_filter->add(dcAdminFilters::getPageFilter());
|
$c2link_filter->add(dcAdminFilters::getPageFilter());
|
||||||
$c2link_filter->add(dcAdminFilters::getSelectFilter(
|
$c2link_filter->add(dcAdminFilters::getSelectFilter(
|
||||||
'catid', __('Category:'), $categories_combo, 'cat_id'
|
'catid',
|
||||||
|
__('Category:'),
|
||||||
|
$categories_combo,
|
||||||
|
'cat_id'
|
||||||
));
|
));
|
||||||
|
|
||||||
$params = $c2link_filter->params();
|
$params = $c2link_filter->params();
|
||||||
@ -157,15 +159,14 @@ if ($part == 'links') {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$links = $C2->getLinks($params);
|
$links = $C2->getLinks($params);
|
||||||
$links_counter = $C2->getLinks($params,true)->f(0);
|
$links_counter = $C2->getLinks($params, true)->f(0);
|
||||||
$links_list = new adminlistCinecturlink2($core, $links, $links_counter);
|
$links_list = new adminlistCinecturlink2($core, $links, $links_counter);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
$core->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
$breadcrumb[__('My cinecturlink')] = '';
|
$breadcrumb[__('My cinecturlink')] = '';
|
||||||
$headers .=
|
$headers .= dcPage::jsVars(['dotclear.filter_reset_url' => $core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'links'])]) .
|
||||||
dcPage::jsVars(['dotclear.filter_reset_url' => $core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'links'])]) .
|
|
||||||
dcPage::jsFilterControl($c2link_filter->show()) .
|
dcPage::jsFilterControl($c2link_filter->show()) .
|
||||||
dcPage::jsLoad(dcPage::getPF('cinecturlink2/js/c2links.js'));
|
dcPage::jsLoad(dcPage::getPF('cinecturlink2/js/c2links.js'));
|
||||||
}
|
}
|
||||||
@ -174,14 +175,15 @@ if ($part == 'link') {
|
|||||||
$langs_combo = l10n::getISOcodes(true);
|
$langs_combo = l10n::getISOcodes(true);
|
||||||
$notes_combo = range(0, 20);
|
$notes_combo = range(0, 20);
|
||||||
$media_combo = $tmp_media_combo = $dir = null;
|
$media_combo = $tmp_media_combo = $dir = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$allowed_media = ['png', 'jpg', 'gif', 'bmp', 'jpeg'];
|
$allowed_media = ['png', 'jpg', 'gif', 'bmp', 'jpeg'];
|
||||||
$core->media = new dcMedia($core);
|
$core->media = new dcMedia($core);
|
||||||
$core->media->chdir($core->blog->settings->cinecturlink2->cinecturlink2_folder);
|
$core->media->chdir($core->blog->settings->cinecturlink2->cinecturlink2_folder);
|
||||||
$core->media->getDir();
|
$core->media->getDir();
|
||||||
$dir =& $core->media->dir;
|
$dir = & $core->media->dir;
|
||||||
|
|
||||||
foreach($dir['files'] as $file) {
|
foreach ($dir['files'] as $file) {
|
||||||
if (!in_array(files::getExtension($file->relname), $allowed_media)) {
|
if (!in_array(files::getExtension($file->relname), $allowed_media)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -197,7 +199,7 @@ if ($part == 'link') {
|
|||||||
if (!empty($_POST['save'])) {
|
if (!empty($_POST['save'])) {
|
||||||
try {
|
try {
|
||||||
cinecturlink2::makePublicDir(
|
cinecturlink2::makePublicDir(
|
||||||
DC_ROOT . '/' .$core->blog->settings->system->public_path,
|
DC_ROOT . '/' . $core->blog->settings->system->public_path,
|
||||||
$core->blog->settings->cinecturlink2->cinecturlink2_folder
|
$core->blog->settings->cinecturlink2->cinecturlink2_folder
|
||||||
);
|
);
|
||||||
if (empty($linktitle)) {
|
if (empty($linktitle)) {
|
||||||
@ -243,7 +245,8 @@ if ($part == 'link') {
|
|||||||
__('Link successfully updated.')
|
__('Link successfully updated.')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$core->adminurl->redirect('admin.plugin.cinecturlink2',
|
$core->adminurl->redirect(
|
||||||
|
'admin.plugin.cinecturlink2',
|
||||||
[
|
[
|
||||||
'part' => 'link',
|
'part' => 'link',
|
||||||
'linkid' => $linkid,
|
'linkid' => $linkid,
|
||||||
@ -286,8 +289,7 @@ if ($part == 'link') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$breadcrumb[(empty($linkid) ? __('New link') : __('Edit link'))] = '';
|
$breadcrumb[(empty($linkid) ? __('New link') : __('Edit link'))] = '';
|
||||||
$headers .=
|
$headers .= dcPage::jsVars(['dotclear.c2_lang' => $core->auth->getInfo('user_lang')]) .
|
||||||
dcPage::jsVars(['dotclear.c2_lang' => $core->auth->getInfo('user_lang')]) .
|
|
||||||
dcPage::jsLoad(dcPage::getPF('cinecturlink2/js/c2link.js'));
|
dcPage::jsLoad(dcPage::getPF('cinecturlink2/js/c2link.js'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -308,7 +310,7 @@ if ($part == 'cats') {
|
|||||||
$catorder = explode(',', $catorder);
|
$catorder = explode(',', $catorder);
|
||||||
}
|
}
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach($catorder as $id) {
|
foreach ($catorder as $id) {
|
||||||
$i++;
|
$i++;
|
||||||
$cur = $core->con->openCursor($C2->table . '_cat');
|
$cur = $core->con->openCursor($C2->table . '_cat');
|
||||||
$cur->cat_pos = $i;
|
$cur->cat_pos = $i;
|
||||||
@ -329,7 +331,6 @@ if ($part == 'cats') {
|
|||||||
);
|
);
|
||||||
$core->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'cats']);
|
$core->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'cats']);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
$core->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
@ -338,8 +339,7 @@ if ($part == 'cats') {
|
|||||||
|
|
||||||
$core->auth->user_prefs->addWorkspace('accessibility');
|
$core->auth->user_prefs->addWorkspace('accessibility');
|
||||||
if (!$core->auth->user_prefs->accessibility->nodragdrop) {
|
if (!$core->auth->user_prefs->accessibility->nodragdrop) {
|
||||||
$headers .=
|
$headers .= dcPage::jsLoad('js/jquery/jquery-ui.custom.js') .
|
||||||
dcPage::jsLoad('js/jquery/jquery-ui.custom.js') .
|
|
||||||
dcPage::jsLoad('js/jquery/jquery.ui.touch-punch.js') .
|
dcPage::jsLoad('js/jquery/jquery.ui.touch-punch.js') .
|
||||||
dcPage::jsLoad(dcPage::getPF('cinecturlink2/js/c2cats.js'));
|
dcPage::jsLoad(dcPage::getPF('cinecturlink2/js/c2cats.js'));
|
||||||
}
|
}
|
||||||
@ -398,14 +398,14 @@ if ($part == 'cat') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo
|
echo
|
||||||
'<html><head><title>'.__('Cinecturlink 2').'</title>' .
|
'<html><head><title>' . __('Cinecturlink 2') . '</title>' .
|
||||||
$headers .
|
$headers .
|
||||||
'</head><body>'.
|
'</head><body>' .
|
||||||
dcPage::breadcrumb($breadcrumb) .
|
dcPage::breadcrumb($breadcrumb) .
|
||||||
dcPage::notices();
|
dcPage::notices();
|
||||||
|
|
||||||
if (!empty($redir)) {
|
if (!empty($redir)) {
|
||||||
echo '<p><a class="back" href="' . $redir . '">' . __('Back') .' </a></p>';
|
echo '<p><a class="back" href="' . $redir . '">' . __('Back') . ' </a></p>';
|
||||||
}
|
}
|
||||||
if (!empty($title)) {
|
if (!empty($title)) {
|
||||||
echo '<h3>' . $title . '</h3>';
|
echo '<h3>' . $title . '</h3>';
|
||||||
@ -413,10 +413,10 @@ if (!empty($title)) {
|
|||||||
|
|
||||||
if ($part == 'updlinksnote') {
|
if ($part == 'updlinksnote') {
|
||||||
if ($links->isEmpty()) {
|
if ($links->isEmpty()) {
|
||||||
echo '<p>'.__('There is no link').'</p>';
|
echo '<p>' . __('There is no link') . '</p>';
|
||||||
} else {
|
} else {
|
||||||
echo '<h4>' . __('Links') . '</h4><ul>';
|
echo '<h4>' . __('Links') . '</h4><ul>';
|
||||||
while($links->fetch()) {
|
while ($links->fetch()) {
|
||||||
echo '<li><strong>' . $links->link_title . '</strong> ' . $links->link_note . '/20</li>';
|
echo '<li><strong>' . $links->link_title . '</strong> ' . $links->link_note . '/20</li>';
|
||||||
}
|
}
|
||||||
echo '</ul>';
|
echo '</ul>';
|
||||||
@ -431,10 +431,11 @@ if ($part == 'updlinksnote') {
|
|||||||
]) . '/20' . '</p>' .
|
]) . '/20' . '</p>' .
|
||||||
'<p>' .
|
'<p>' .
|
||||||
'<input type="submit" value="' . __('Save') . ' (s)" accesskey="s" name="save" /> ' .
|
'<input type="submit" value="' . __('Save') . ' (s)" accesskey="s" name="save" /> ' .
|
||||||
'<a id="post-cancel" href="' . ($redir ? $redir :
|
'<a id="post-cancel" href="' . (
|
||||||
|
$redir ? $redir :
|
||||||
$core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'links'])
|
$core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'links'])
|
||||||
) . '" class="button" accesskey="c">' . __('Cancel') . ' (c)</a> ';
|
) . '" class="button" accesskey="c">' . __('Cancel') . ' (c)</a> ';
|
||||||
foreach($entries as $id) {
|
foreach ($entries as $id) {
|
||||||
echo form::hidden(['entries[]'], $id);
|
echo form::hidden(['entries[]'], $id);
|
||||||
}
|
}
|
||||||
echo
|
echo
|
||||||
@ -447,10 +448,10 @@ if ($part == 'updlinksnote') {
|
|||||||
|
|
||||||
if ($part == 'updlinkscat') {
|
if ($part == 'updlinkscat') {
|
||||||
if ($links->isEmpty()) {
|
if ($links->isEmpty()) {
|
||||||
echo '<p>'.__('There is no link').'</p>';
|
echo '<p>' . __('There is no link') . '</p>';
|
||||||
} else {
|
} else {
|
||||||
echo '<h4>' . __('Links') . '</h4><ul>';
|
echo '<h4>' . __('Links') . '</h4><ul>';
|
||||||
while($links->fetch()) {
|
while ($links->fetch()) {
|
||||||
echo '<li><strong>' . $links->link_title . '</strong> ' . $links->link_note . '/20</li>';
|
echo '<li><strong>' . $links->link_title . '</strong> ' . $links->link_note . '/20</li>';
|
||||||
}
|
}
|
||||||
echo '</ul>';
|
echo '</ul>';
|
||||||
@ -460,10 +461,11 @@ if ($part == 'updlinkscat') {
|
|||||||
'<p><label for="newcatid" class="ib">' . __('New category:') . '</label> ' .
|
'<p><label for="newcatid" class="ib">' . __('New category:') . '</label> ' .
|
||||||
form::combo('newcatid', $categories_combo, $catid) . '</p>' .
|
form::combo('newcatid', $categories_combo, $catid) . '</p>' .
|
||||||
'<input type="submit" value="' . __('Save') . ' (s)" accesskey="s" name="save" /> ' .
|
'<input type="submit" value="' . __('Save') . ' (s)" accesskey="s" name="save" /> ' .
|
||||||
'<a id="post-cancel" href="' . ($redir ? $redir :
|
'<a id="post-cancel" href="' . (
|
||||||
|
$redir ? $redir :
|
||||||
$core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'links'])
|
$core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'links'])
|
||||||
) . '" class="button" accesskey="c">' . __('Cancel') . ' (c)</a> ';
|
) . '" class="button" accesskey="c">' . __('Cancel') . ' (c)</a> ';
|
||||||
foreach($entries as $id) {
|
foreach ($entries as $id) {
|
||||||
echo form::hidden(['entries[]'], $id);
|
echo form::hidden(['entries[]'], $id);
|
||||||
}
|
}
|
||||||
echo
|
echo
|
||||||
@ -474,29 +476,32 @@ if ($part == 'updlinkscat') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($part == "links") {
|
if ($part == 'links') {
|
||||||
$links_redir = $core->adminurl->get('admin.plugin.cinecturlink2', $c2link_filter->values());
|
$links_redir = $core->adminurl->get('admin.plugin.cinecturlink2', $c2link_filter->values());
|
||||||
|
|
||||||
echo
|
echo
|
||||||
'<p>' .
|
'<p>' .
|
||||||
'<a class="button" href="' .
|
'<a class="button" href="' .
|
||||||
$core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'cats', 'redir' => $links_redir]) .
|
$core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'cats', 'redir' => $links_redir]) .
|
||||||
'">' . __('Edit categories') .' </a>' .
|
'">' . __('Edit categories') . ' </a>' .
|
||||||
'</p>' .
|
'</p>' .
|
||||||
'<p class="top-add"><a class="button add" href="' .
|
'<p class="top-add"><a class="button add" href="' .
|
||||||
$core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'link', 'redir' => $links_redir]) .
|
$core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'link', 'redir' => $links_redir]) .
|
||||||
'">' . __('New Link') .'</a> <a class="button add" href="' .
|
'">' . __('New Link') . '</a> <a class="button add" href="' .
|
||||||
$core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'cat', 'redir' => $links_redir]) .
|
$core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'cat', 'redir' => $links_redir]) .
|
||||||
'">' . __('New Category') .' </a></p>';
|
'">' . __('New Category') . ' </a></p>';
|
||||||
|
|
||||||
if ($links->isEmpty() && !$c2link_filter->show()) {
|
if ($links->isEmpty() && !$c2link_filter->show()) {
|
||||||
echo '<p>'.__('There is no link').'</p>';
|
echo '<p>' . __('There is no link') . '</p>';
|
||||||
} else {
|
} else {
|
||||||
$c2link_filter->display('admin.plugin.cinecturlink2',
|
$c2link_filter->display(
|
||||||
|
'admin.plugin.cinecturlink2',
|
||||||
form::hidden('p', 'cinecturlink2') . form::hidden('part', 'links')
|
form::hidden('p', 'cinecturlink2') . form::hidden('part', 'links')
|
||||||
);
|
);
|
||||||
|
|
||||||
$links_list->display($c2link_filter->page, $c2link_filter->nb,
|
$links_list->display(
|
||||||
|
$c2link_filter->page,
|
||||||
|
$c2link_filter->nb,
|
||||||
'<form action="' . $core->adminurl->get('admin.plugin.cinecturlink2') . '" method="post" id="form-entries">' .
|
'<form action="' . $core->adminurl->get('admin.plugin.cinecturlink2') . '" method="post" id="form-entries">' .
|
||||||
|
|
||||||
'%s' .
|
'%s' .
|
||||||
@ -518,8 +523,7 @@ if ($part == "links") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($part == "link") {
|
if ($part == 'link') {
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<form id="newlinkform" method="post" action="' . $core->adminurl->get('admin.plugin.cinecturlink2') . '">
|
<form id="newlinkform" method="post" action="' . $core->adminurl->get('admin.plugin.cinecturlink2') . '">
|
||||||
|
|
||||||
@ -580,7 +584,7 @@ if ($part == "link") {
|
|||||||
'<input type="submit" value="' . __('Save') . ' (s)" accesskey="s" name="save" /> ' .
|
'<input type="submit" value="' . __('Save') . ' (s)" accesskey="s" name="save" /> ' .
|
||||||
'<a id="post-cancel" href="' .
|
'<a id="post-cancel" href="' .
|
||||||
$core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'links']) .
|
$core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'links']) .
|
||||||
'" class="button" accesskey="c">' . __('Cancel') . ' (c)</a> '.
|
'" class="button" accesskey="c">' . __('Cancel') . ' (c)</a> ' .
|
||||||
'<input type="submit" class="delete" value="' . __('Delete') . '" name="delete" />' .
|
'<input type="submit" class="delete" value="' . __('Delete') . '" name="delete" />' .
|
||||||
form::hidden('linkid', $linkid) .
|
form::hidden('linkid', $linkid) .
|
||||||
form::hidden('part', 'link') .
|
form::hidden('part', 'link') .
|
||||||
@ -590,7 +594,7 @@ if ($part == "link") {
|
|||||||
</form>';
|
</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($part == "cats") {
|
if ($part == 'cats') {
|
||||||
echo
|
echo
|
||||||
'<p class="top-add"><a class="button add" href="' .
|
'<p class="top-add"><a class="button add" href="' .
|
||||||
$core->adminurl->get(
|
$core->adminurl->get(
|
||||||
@ -606,25 +610,24 @@ if ($part == "cats") {
|
|||||||
)
|
)
|
||||||
]
|
]
|
||||||
) .
|
) .
|
||||||
'">' . __('New Category') .' </a></p>';
|
'">' . __('New Category') . ' </a></p>';
|
||||||
|
|
||||||
if ($categories->isEmpty()) {
|
if ($categories->isEmpty()) {
|
||||||
echo '<p>'.__('There is no category').'</p>';
|
echo '<p>' . __('There is no category') . '</p>';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
echo '
|
echo '
|
||||||
<form id="c2items" method="post" action="' . $core->adminurl->get('admin.plugin.cinecturlink2') . '">
|
<form id="c2items" method="post" action="' . $core->adminurl->get('admin.plugin.cinecturlink2') . '">
|
||||||
<div class="table-outer">
|
<div class="table-outer">
|
||||||
<table class="dragable">
|
<table class="dragable">
|
||||||
<caption>' . __('Categories list') . '</caption>
|
<caption>' . __('Categories list') . '</caption>
|
||||||
<thead><tr>
|
<thead><tr>
|
||||||
<th colspan="3" scope="col">'.__('name').'</th>
|
<th colspan="3" scope="col">' . __('name') . '</th>
|
||||||
<th scope="col">'.__('description').'</th>
|
<th scope="col">' . __('description') . '</th>
|
||||||
</tr></thead>
|
</tr></thead>
|
||||||
<tbody id="c2itemslist">';
|
<tbody id="c2itemslist">';
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while($categories->fetch()) {
|
while ($categories->fetch()) {
|
||||||
$id = $categories->cat_id;
|
$id = $categories->cat_id;
|
||||||
|
|
||||||
echo
|
echo
|
||||||
@ -633,13 +636,13 @@ if ($part == "cats") {
|
|||||||
form::number(['order[' . $id . ']'], [
|
form::number(['order[' . $id . ']'], [
|
||||||
'min' => 1,
|
'min' => 1,
|
||||||
'max' => $categories->count(),
|
'max' => $categories->count(),
|
||||||
'default' => $i +1,
|
'default' => $i + 1,
|
||||||
'class' => 'position',
|
'class' => 'position',
|
||||||
'extra_html' => 'title="' . sprintf(__('position of %s'), html::escapeHTML($categories->cat_title)) . '"'
|
'extra_html' => 'title="' . sprintf(__('position of %s'), html::escapeHTML($categories->cat_title)) . '"'
|
||||||
]) .
|
]) .
|
||||||
form::hidden(['dynorder[]', 'dynorder-' . $i], $id) . '</td>
|
form::hidden(['dynorder[]', 'dynorder-' . $i], $id) . '</td>
|
||||||
<td class="minimal">' . form::checkbox(['items_selected[]', 'ims-' . $i], $id) . '</td>
|
<td class="minimal">' . form::checkbox(['items_selected[]', 'ims-' . $i], $id) . '</td>
|
||||||
<td class="nowrap"><a title="' . __('Edit') .'" href="' .
|
<td class="nowrap"><a title="' . __('Edit') . '" href="' .
|
||||||
$core->adminurl->get(
|
$core->adminurl->get(
|
||||||
'admin.plugin.cinecturlink2',
|
'admin.plugin.cinecturlink2',
|
||||||
[
|
[
|
||||||
@ -664,12 +667,12 @@ if ($part == "cats") {
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<p class="form-note">'.__('Check to delete').'</p>
|
<p class="form-note">' . __('Check to delete') . '</p>
|
||||||
<p class="border-top">' .
|
<p class="border-top">' .
|
||||||
'<input type="submit" value="' . __('Save order') . ' (s)" accesskey="s" name="save" /> ' .
|
'<input type="submit" value="' . __('Save order') . ' (s)" accesskey="s" name="save" /> ' .
|
||||||
'<a id="post-cancel" href="' .
|
'<a id="post-cancel" href="' .
|
||||||
$core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'cats']) .
|
$core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'cats']) .
|
||||||
'" class="button" accesskey="c">' . __('Cancel') . ' (c)</a> '.
|
'" class="button" accesskey="c">' . __('Cancel') . ' (c)</a> ' .
|
||||||
'<input type="submit" class="delete" value="' . __('Delete selection') . '" name="delete" />' .
|
'<input type="submit" class="delete" value="' . __('Delete selection') . '" name="delete" />' .
|
||||||
form::hidden('im_order', '') .
|
form::hidden('im_order', '') .
|
||||||
form::hidden('part', 'cats') .
|
form::hidden('part', 'cats') .
|
||||||
@ -689,13 +692,14 @@ if ($part == 'cat') {
|
|||||||
|
|
||||||
if ($catid) {
|
if ($catid) {
|
||||||
$links = $C2->getLinks(['cat_id' => $catid], true)->f(0);
|
$links = $C2->getLinks(['cat_id' => $catid], true)->f(0);
|
||||||
echo '<p class="info">' . (empty($links) ?
|
echo '<p class="info">' . (
|
||||||
|
empty($links) ?
|
||||||
__('No link uses this category.') :
|
__('No link uses this category.') :
|
||||||
sprintf(__('A link uses this category.', '%s links use this category.', $links), $links)
|
sprintf(__('A link uses this category.', '%s links use this category.', $links), $links)
|
||||||
) . '</p>';
|
) . '</p>';
|
||||||
}
|
}
|
||||||
echo '
|
echo '
|
||||||
<form method="post" action="'. $core->adminurl->get('admin.plugin.cinecturlink2') .'">
|
<form method="post" action="' . $core->adminurl->get('admin.plugin.cinecturlink2') . '">
|
||||||
<p><label for="cattitle">' . __('Title:') . ' ' .
|
<p><label for="cattitle">' . __('Title:') . ' ' .
|
||||||
form::field('cattitle', 60, 64, $cattitle, 'maximal') .
|
form::field('cattitle', 60, 64, $cattitle, 'maximal') .
|
||||||
'</label></p>
|
'</label></p>
|
||||||
@ -706,7 +710,7 @@ if ($part == 'cat') {
|
|||||||
'<input type="submit" value="' . __('Save') . ' (s)" accesskey="s" name="save" /> ' .
|
'<input type="submit" value="' . __('Save') . ' (s)" accesskey="s" name="save" /> ' .
|
||||||
'<a id="post-cancel" href="' .
|
'<a id="post-cancel" href="' .
|
||||||
$core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'cats']) .
|
$core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'cats']) .
|
||||||
'" class="button" accesskey="c">' . __('Cancel') . ' (c)</a> '.
|
'" class="button" accesskey="c">' . __('Cancel') . ' (c)</a> ' .
|
||||||
(!empty($catid) ? ' <input type="submit" class="delete" value="' . __('Delete') . '" name="delete" />' : '') .
|
(!empty($catid) ? ' <input type="submit" class="delete" value="' . __('Delete') . '" name="delete" />' : '') .
|
||||||
form::hidden('catid', $catid) .
|
form::hidden('catid', $catid) .
|
||||||
form::hidden('part', 'cat') .
|
form::hidden('part', 'cat') .
|
||||||
|
Loading…
Reference in New Issue
Block a user