prepare to DC 2.24
This commit is contained in:
parent
8b4dd4c2ba
commit
4301e8c133
40
_admin.php
40
_admin.php
@ -14,30 +14,30 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once dirname(__FILE__) . '/_widgets.php';
|
require_once __DIR__ . '/_widgets.php';
|
||||||
|
|
||||||
$_menu['Plugins']->addItem(
|
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
||||||
__('My cinecturlink'),
|
__('My cinecturlink'),
|
||||||
$core->adminurl->get('admin.plugin.cinecturlink2'),
|
dcCore::app()->adminurl->get('admin.plugin.cinecturlink2'),
|
||||||
dcPage::getPF('cinecturlink2/icon.png'),
|
dcPage::getPF('cinecturlink2/icon.png'),
|
||||||
preg_match(
|
preg_match(
|
||||||
'/' . preg_quote($core->adminurl->get('admin.plugin.cinecturlink2')) . '(&.*)?$/',
|
'/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.cinecturlink2')) . '(&.*)?$/',
|
||||||
$_SERVER['REQUEST_URI']
|
$_SERVER['REQUEST_URI']
|
||||||
),
|
),
|
||||||
$core->auth->check('contentadmin', $core->blog->id)
|
dcCore::app()->auth->check(dcAuth::PERMISSION_CONTENT_ADMIN, dcCore::app()->blog->id)
|
||||||
);
|
);
|
||||||
|
|
||||||
$core->addBehavior(
|
dcCore::app()->addBehavior(
|
||||||
'adminColumnsLists',
|
'adminColumnsListsV2',
|
||||||
['cinecturlink2AdminBehaviors', 'adminColumnsLists']
|
['cinecturlink2AdminBehaviors', 'adminColumnsLists']
|
||||||
);
|
);
|
||||||
|
|
||||||
$core->addBehavior(
|
dcCore::app()->addBehavior(
|
||||||
'adminFiltersLists',
|
'adminFiltersListsV2',
|
||||||
['cinecturlink2AdminBehaviors', 'adminFiltersLists']
|
['cinecturlink2AdminBehaviors', 'adminFiltersLists']
|
||||||
);
|
);
|
||||||
$core->addBehavior(
|
dcCore::app()->addBehavior(
|
||||||
'adminDashboardFavorites',
|
'adminDashboardFavoritesV2',
|
||||||
['cinecturlink2AdminBehaviors', 'adminDashboardFavorites']
|
['cinecturlink2AdminBehaviors', 'adminDashboardFavorites']
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -52,11 +52,11 @@ class cinecturlink2AdminBehaviors
|
|||||||
__('Author') => 'link_author',
|
__('Author') => 'link_author',
|
||||||
__('Description') => 'link_desc',
|
__('Description') => 'link_desc',
|
||||||
__('Link') => 'link_url',
|
__('Link') => 'link_url',
|
||||||
__('Rating') => 'link_note'
|
__('Rating') => 'link_note',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function adminColumnsLists($core, $cols)
|
public static function adminColumnsLists($cols)
|
||||||
{
|
{
|
||||||
$cols['c2link'] = [
|
$cols['c2link'] = [
|
||||||
__('Cinecturlink'),
|
__('Cinecturlink'),
|
||||||
@ -67,30 +67,30 @@ class cinecturlink2AdminBehaviors
|
|||||||
'desc' => [false, __('Description')],
|
'desc' => [false, __('Description')],
|
||||||
'link' => [true, __('Liens')],
|
'link' => [true, __('Liens')],
|
||||||
'note' => [true, __('Rating')],
|
'note' => [true, __('Rating')],
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function adminFiltersLists($core, $sorts)
|
public static function adminFiltersLists($sorts)
|
||||||
{
|
{
|
||||||
$sorts['c2link'] = [
|
$sorts['c2link'] = [
|
||||||
__('Cinecturlink'),
|
__('Cinecturlink'),
|
||||||
self::adminSortbyCombo(),
|
self::adminSortbyCombo(),
|
||||||
'link_upddt',
|
'link_upddt',
|
||||||
'desc',
|
'desc',
|
||||||
[__('Links per page'), 30]
|
[__('Links per page'), 30],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function adminDashboardFavorites($core, $favs)
|
public static function adminDashboardFavorites($favs)
|
||||||
{
|
{
|
||||||
$favs->register('cinecturlink2', [
|
$favs->register('cinecturlink2', [
|
||||||
'title' => __('My cinecturlink'),
|
'title' => __('My cinecturlink'),
|
||||||
'url' => $core->adminurl->get('admin.plugin.cinecturlink2') . '#links',
|
'url' => dcCore::app()->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' => dcCore::app()->auth->check('contentadmin', dcCore::app()->blog->id),
|
||||||
'active_cb' => ['cinecturlink2AdminBehaviors', 'adminDashboardFavoritesActive']
|
'active_cb' => ['cinecturlink2AdminBehaviors', 'adminDashboardFavoritesActive'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
22
_config.php
22
_config.php
@ -15,13 +15,13 @@ if (!defined('DC_CONTEXT_MODULE')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Check user perms
|
# Check user perms
|
||||||
dcPage::check('admin');
|
dcPage::check(dcAuth::PERMISSION_ADMIN);
|
||||||
|
|
||||||
$redir = empty($_REQUEST['redir']) ?
|
$redir = empty($_REQUEST['redir']) ?
|
||||||
$list->getURL() . '#plugins' : $_REQUEST['redir'];
|
dcCore::app()->admin->list->getURL() . '#plugins' : $_REQUEST['redir'];
|
||||||
|
|
||||||
$core->blog->settings->addNamespace('cinecturlink2');
|
dcCore::app()->blog->settings->addNamespace('cinecturlink2');
|
||||||
$s = $core->blog->settings->cinecturlink2;
|
$s = dcCore::app()->blog->settings->cinecturlink2;
|
||||||
$cinecturlink2_active = (bool) $s->cinecturlink2_active;
|
$cinecturlink2_active = (bool) $s->cinecturlink2_active;
|
||||||
$cinecturlink2_widthmax = abs((int) $s->cinecturlink2_widthmax);
|
$cinecturlink2_widthmax = abs((int) $s->cinecturlink2_widthmax);
|
||||||
$cinecturlink2_folder = (string) $s->cinecturlink2_folder;
|
$cinecturlink2_folder = (string) $s->cinecturlink2_folder;
|
||||||
@ -34,7 +34,7 @@ if ($cinecturlink2_public_nbrpp < 1) {
|
|||||||
$cinecturlink2_public_nbrpp = 10;
|
$cinecturlink2_public_nbrpp = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
$combo_dirs = cinecturlink2::getPublicDirs($core);
|
$combo_dirs = cinecturlink2::getPublicDirs();
|
||||||
|
|
||||||
if (!empty($_POST['save'])) {
|
if (!empty($_POST['save'])) {
|
||||||
try {
|
try {
|
||||||
@ -56,7 +56,7 @@ if (!empty($_POST['save'])) {
|
|||||||
throw new Exception(__('You must provide a specific folder for images.'));
|
throw new Exception(__('You must provide a specific folder for images.'));
|
||||||
}
|
}
|
||||||
cinecturlink2::makePublicDir(
|
cinecturlink2::makePublicDir(
|
||||||
DC_ROOT . '/' . $core->blog->settings->system->public_path,
|
DC_ROOT . '/' . dcCore::app()->blog->settings->system->public_path,
|
||||||
$cinecturlink2_folder,
|
$cinecturlink2_folder,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
@ -69,15 +69,15 @@ if (!empty($_POST['save'])) {
|
|||||||
$s->put('cinecturlink2_folder', $cinecturlink2_folder);
|
$s->put('cinecturlink2_folder', $cinecturlink2_folder);
|
||||||
$s->put('cinecturlink2_triggeronrandom', $cinecturlink2_triggeronrandom);
|
$s->put('cinecturlink2_triggeronrandom', $cinecturlink2_triggeronrandom);
|
||||||
|
|
||||||
dcPage::addSuccessNotice(
|
dcAdminNotices::addSuccessNotice(
|
||||||
__('Configuration successfully updated.')
|
__('Configuration successfully updated.')
|
||||||
);
|
);
|
||||||
$core->adminurl->redirect(
|
dcCore::app()->adminurl->redirect(
|
||||||
'admin.plugins',
|
'admin.plugins',
|
||||||
['module' => 'cinecturlink2', 'conf' => 1, 'redir' => $list->getRedir()]
|
['module' => 'cinecturlink2', 'conf' => 1, 'redir' => dcCore::app()->admin->list->getRedir()]
|
||||||
);
|
);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +116,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="' . dcCore::app()->blog->url . dcCore::app()->url->getBase('cinecturlink2') . '" title="public page">' . dcCore::app()->blog->url . dcCore::app()->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>
|
||||||
|
@ -24,13 +24,13 @@ $this->registerModule(
|
|||||||
'Cinecturlink 2',
|
'Cinecturlink 2',
|
||||||
'Widgets and pages about books, musics, films, blogs you are interested in',
|
'Widgets and pages about books, musics, films, blogs you are interested in',
|
||||||
'Jean-Christian Denis and Contributors',
|
'Jean-Christian Denis and Contributors',
|
||||||
'1.0.0',
|
'1.1.0',
|
||||||
[
|
[
|
||||||
'requires' => [['core', '2.20']],
|
'requires' => [['core', '2.24']],
|
||||||
'permissions' => 'contentadmin',
|
'permissions' => dcAuth::PERMISSION_CONTENT_ADMIN,
|
||||||
'type' => 'plugin',
|
'type' => 'plugin',
|
||||||
'support' => 'https://github.com/JcDenis/cinecturlink2',
|
'support' => 'https://github.com/JcDenis/cinecturlink2',
|
||||||
'details' => 'https://plugins.dotaddict.org/dc2/details/cinecturlink2',
|
'details' => 'https://plugins.dotaddict.org/dc2/details/cinecturlink2',
|
||||||
'repository' => 'https://raw.githubusercontent.com/JcDenis/cinecturlink2/master/dcstore.xml'
|
'repository' => 'https://raw.githubusercontent.com/JcDenis/cinecturlink2/master/dcstore.xml',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
18
_install.php
18
_install.php
@ -14,15 +14,15 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$new_version = $core->plugins->moduleInfo('cinecturlink2', 'version');
|
$new_version = dcCore::app()->plugins->moduleInfo('cinecturlink2', 'version');
|
||||||
$old_version = $core->getVersion('cinecturlink2');
|
$old_version = dcCore::app()->getVersion('cinecturlink2');
|
||||||
|
|
||||||
if (version_compare($old_version, $new_version, '>=')) {
|
if (version_compare($old_version, $new_version, '>=')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$s = new dbStruct($core->con, $core->prefix);
|
$s = new dbStruct(dcCore::app()->con, dcCore::app()->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)
|
||||||
@ -62,11 +62,11 @@ try {
|
|||||||
->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(dcCore::app()->con, dcCore::app()->prefix);
|
||||||
$changes = $si->synchronize($s);
|
$changes = $si->synchronize($s);
|
||||||
|
|
||||||
$core->blog->settings->addNamespace('cinecturlink2');
|
dcCore::app()->blog->settings->addNamespace('cinecturlink2');
|
||||||
$s = $core->blog->settings->cinecturlink2;
|
$s = dcCore::app()->blog->settings->cinecturlink2;
|
||||||
$s->put('cinecturlink2_active', true, 'boolean', 'Enable cinecturlink2', false, true);
|
$s->put('cinecturlink2_active', true, 'boolean', 'Enable cinecturlink2', false, true);
|
||||||
$s->put('cinecturlink2_widthmax', 100, 'integer', 'Maximum width of picture', false, true);
|
$s->put('cinecturlink2_widthmax', 100, 'integer', 'Maximum width of picture', false, true);
|
||||||
$s->put('cinecturlink2_folder', 'cinecturlink', 'string', 'Public folder of pictures', false, true);
|
$s->put('cinecturlink2_folder', 'cinecturlink', 'string', 'Public folder of pictures', false, true);
|
||||||
@ -77,14 +77,14 @@ try {
|
|||||||
$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);
|
||||||
|
|
||||||
$core->setVersion(
|
dcCore::app()->setVersion(
|
||||||
'cinecturlink2',
|
'cinecturlink2',
|
||||||
$core->plugins->moduleInfo('cinecturlink2', 'version')
|
dcCore::app()->plugins->moduleInfo('cinecturlink2', 'version')
|
||||||
);
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
20
_prepend.php
20
_prepend.php
@ -14,30 +14,28 @@ if (!defined('DC_RC_PATH')) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$d = dirname(__FILE__) . '/inc/';
|
Clearbricks::lib()->autoload(['cinecturlink2' => __DIR__ . '/inc/class.cinecturlink2.php']);
|
||||||
|
Clearbricks::lib()->autoload(['cinecturlink2Context' => __DIR__ . '/inc/lib.cinecturlink2.context.php']);
|
||||||
|
Clearbricks::lib()->autoload(['adminlistCinecturlink2' => __DIR__ . '/inc/lib.cinecturlink2.list.php']);
|
||||||
|
Clearbricks::lib()->autoload(['sitemapsCinecturlink2' => __DIR__ . '/inc/lib.sitemaps.cinecturlink2.php']);
|
||||||
|
Clearbricks::lib()->autoload(['cinecturlink2ActivityReportBehaviors' => __DIR__ . '/inc/lib.cinecturlink2.activityreport.php']);
|
||||||
|
|
||||||
$__autoload['cinecturlink2'] = $d . 'class.cinecturlink2.php';
|
dcCore::app()->url->register(
|
||||||
$__autoload['cinecturlink2Context'] = $d . 'lib.cinecturlink2.context.php';
|
|
||||||
$__autoload['adminlistCinecturlink2'] = $d . 'lib.cinecturlink2.list.php';
|
|
||||||
$__autoload['sitemapsCinecturlink2'] = $d . 'lib.sitemaps.cinecturlink2.php';
|
|
||||||
$__autoload['cinecturlink2ActivityReportBehaviors'] = $d . 'lib.cinecturlink2.activityreport.php';
|
|
||||||
|
|
||||||
$core->url->register(
|
|
||||||
'cinecturlink2',
|
'cinecturlink2',
|
||||||
'cinecturlink',
|
'cinecturlink',
|
||||||
'^cinecturlink(?:/(.+))?$',
|
'^cinecturlink(?:/(.+))?$',
|
||||||
['urlCinecturlink2', 'c2Page']
|
['urlCinecturlink2', 'c2Page']
|
||||||
);
|
);
|
||||||
|
|
||||||
$core->addBehavior(
|
dcCore::app()->addBehavior(
|
||||||
'sitemapsDefineParts',
|
'sitemapsDefineParts',
|
||||||
['sitemapsCinecturlink2', 'sitemapsDefineParts']
|
['sitemapsCinecturlink2', 'sitemapsDefineParts']
|
||||||
);
|
);
|
||||||
$core->addBehavior(
|
dcCore::app()->addBehavior(
|
||||||
'sitemapsURLsCollect',
|
'sitemapsURLsCollect',
|
||||||
['sitemapsCinecturlink2', 'sitemapsURLsCollect']
|
['sitemapsCinecturlink2', 'sitemapsURLsCollect']
|
||||||
);
|
);
|
||||||
|
|
||||||
if (defined('ACTIVITY_REPORT')) {
|
if (defined('ACTIVITY_REPORT')) {
|
||||||
cinecturlink2ActivityReportBehaviors::add($core);
|
cinecturlink2ActivityReportBehaviors::add();
|
||||||
}
|
}
|
||||||
|
167
_public.php
167
_public.php
@ -14,9 +14,9 @@ if (!defined('DC_RC_PATH')) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once dirname(__FILE__) . '/_widgets.php';
|
require_once __DIR__ . '/_widgets.php';
|
||||||
|
|
||||||
$core->blog->settings->addNamespace('cinecturlink2');
|
dcCore::app()->blog->settings->addNamespace('cinecturlink2');
|
||||||
|
|
||||||
$c2_tpl_values = [
|
$c2_tpl_values = [
|
||||||
'c2PageFeedID',
|
'c2PageFeedID',
|
||||||
@ -56,7 +56,7 @@ $c2_tpl_values = [
|
|||||||
'c2CategoryID',
|
'c2CategoryID',
|
||||||
'c2CategoryTitle',
|
'c2CategoryTitle',
|
||||||
'c2CategoryDescription',
|
'c2CategoryDescription',
|
||||||
'c2CategoryURL'
|
'c2CategoryURL',
|
||||||
];
|
];
|
||||||
|
|
||||||
$c2_tpl_blocks = [
|
$c2_tpl_blocks = [
|
||||||
@ -73,19 +73,19 @@ $c2_tpl_blocks = [
|
|||||||
'c2Categories',
|
'c2Categories',
|
||||||
'c2CategoriesHeader',
|
'c2CategoriesHeader',
|
||||||
'c2CategoriesFooter',
|
'c2CategoriesFooter',
|
||||||
'c2CategoryIf'
|
'c2CategoryIf',
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($core->blog->settings->cinecturlink2->cinecturlink2_active) {
|
if (dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_active) {
|
||||||
foreach ($c2_tpl_blocks as $v) {
|
foreach ($c2_tpl_blocks as $v) {
|
||||||
$core->tpl->addBlock($v, ['tplCinecturlink2', $v]);
|
dcCore::app()->tpl->addBlock($v, ['tplCinecturlink2', $v]);
|
||||||
}
|
}
|
||||||
foreach ($c2_tpl_values as $v) {
|
foreach ($c2_tpl_values as $v) {
|
||||||
$core->tpl->addValue($v, ['tplCinecturlink2', $v]);
|
dcCore::app()->tpl->addValue($v, ['tplCinecturlink2', $v]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach (array_merge($c2_tpl_blocks, $c2_tpl_values) as $v) {
|
foreach (array_merge($c2_tpl_blocks, $c2_tpl_values) as $v) {
|
||||||
$core->tpl->addBlock($v, ['tplCinecturlink2', 'disable']);
|
dcCore::app()->tpl->addBlock($v, ['tplCinecturlink2', 'disable']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,19 +93,19 @@ class urlCinecturlink2 extends dcUrlHandlers
|
|||||||
{
|
{
|
||||||
public static function c2Page($args)
|
public static function c2Page($args)
|
||||||
{
|
{
|
||||||
global $core, $_ctx;
|
dcCore::app()->blog->settings->addNamespace('cinecturlink2');
|
||||||
$core->blog->settings->addNamespace('cinecturlink2');
|
$args = (string) $args;
|
||||||
|
|
||||||
if (!$core->blog->settings->cinecturlink2->cinecturlink2_active
|
if (!dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_active
|
||||||
|| !$core->blog->settings->cinecturlink2->cinecturlink2_public_active) {
|
|| !dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_public_active) {
|
||||||
self::p404();
|
self::p404();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$core->tpl->setPath(
|
dcCore::app()->tpl->setPath(
|
||||||
$core->tpl->getPath(),
|
dcCore::app()->tpl->getPath(),
|
||||||
dirname(__FILE__) . '/default-templates/'
|
__DIR__ . '/default-templates/'
|
||||||
);
|
);
|
||||||
|
|
||||||
$params = [];
|
$params = [];
|
||||||
@ -115,7 +115,7 @@ class urlCinecturlink2 extends dcUrlHandlers
|
|||||||
$GLOBALS['c2_page_number'] = $n;
|
$GLOBALS['c2_page_number'] = $n;
|
||||||
}
|
}
|
||||||
|
|
||||||
$caturl = $core->blog->settings->cinecturlink2->cinecturlink2_public_caturl;
|
$caturl = dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_public_caturl;
|
||||||
if (!$caturl) {
|
if (!$caturl) {
|
||||||
$caturl = 'c2cat';
|
$caturl = 'c2cat';
|
||||||
}
|
}
|
||||||
@ -133,12 +133,12 @@ class urlCinecturlink2 extends dcUrlHandlers
|
|||||||
if ($f && in_array($f, ['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;
|
//dcCore::app()->ctx->short_feed_items = dcCore::app()->blog->settings->system->short_feed_items;
|
||||||
|
|
||||||
$params['limit'] = $core->blog->settings->system->nb_post_per_feed;
|
$params['limit'] = dcCore::app()->blog->settings->system->nb_post_per_feed;
|
||||||
$_ctx->c2_page_params = $params;
|
dcCore::app()->ctx->c2_page_params = $params;
|
||||||
|
|
||||||
header('X-Robots-Tag: ' . context::robotsPolicy($core->blog->settings->system->robots_policy, ''));
|
header('X-Robots-Tag: ' . context::robotsPolicy(dcCore::app()->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');
|
||||||
@ -150,8 +150,8 @@ class urlCinecturlink2 extends dcUrlHandlers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$params['limit'] = $core->blog->settings->cinecturlink2->cinecturlink2_public_nbrpp;
|
$params['limit'] = dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_public_nbrpp;
|
||||||
$_ctx->c2_page_params = $params;
|
dcCore::app()->ctx->c2_page_params = $params;
|
||||||
|
|
||||||
self::serveDocument('cinecturlink2.html', 'text/html');
|
self::serveDocument('cinecturlink2.html', 'text/html');
|
||||||
}
|
}
|
||||||
@ -180,27 +180,27 @@ class tplCinecturlink2
|
|||||||
|
|
||||||
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(dcCore::app()->tpl->getFilters($a), 'dcCore::app()->blog->url.dcCore::app()->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) dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_public_title; if (empty(\$title)) { \$title = __('My cinecturlink'); } echo " . sprintf(dcCore::app()->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(dcCore::app()->tpl->getFilters($a), 'dcCore::app()->blog->url.dcCore::app()->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)
|
||||||
{
|
{
|
||||||
return 'urn:md5:<?php echo md5($core->blog->id."cinecturlink2"); ?>';
|
return 'urn:md5:<?php echo md5(dcCore::app()->blog->id."cinecturlink2"); ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
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) dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_public_description; echo ' . sprintf(dcCore::app()->tpl->getFilters($a), '$description') . '; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2If($a, $c)
|
public static function c2If($a, $c)
|
||||||
@ -211,12 +211,12 @@ class tplCinecturlink2
|
|||||||
|
|
||||||
if (isset($a['request_link'])) {
|
if (isset($a['request_link'])) {
|
||||||
$sign = (bool) $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(dcCore::app()->ctx->c2_page_params["link_id"]) || isset(dcCore::app()->ctx->c2_page_params["link_title"]))';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($a['request_cat'])) {
|
if (isset($a['request_cat'])) {
|
||||||
$sign = (bool) $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(dcCore::app()->ctx->c2_page_params["cat_id"]) || isset(dcCore::app()->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";
|
||||||
@ -258,24 +258,24 @@ class tplCinecturlink2
|
|||||||
|
|
||||||
return
|
return
|
||||||
"<?php \n" .
|
"<?php \n" .
|
||||||
"\$params = is_array(\$_ctx->c2_page_params) ? \$_ctx->c2_page_params : array(); \n" .
|
"\$params = is_array(dcCore::app()->ctx->c2_page_params) ? dcCore::app()->ctx->c2_page_params : array(); \n" .
|
||||||
$res .
|
$res .
|
||||||
"\$_ctx->c2_params = \$params; unset(\$params);\n" .
|
"dcCore::app()->ctx->c2_params = \$params; unset(\$params);\n" .
|
||||||
"if (!\$_ctx->exists('cinecturlink')) { \$_ctx->cinecturlink = new cinecturlink2(\$core); } \n" .
|
"if (!dcCore::app()->ctx->exists('cinecturlink')) { dcCore::app()->ctx->cinecturlink = new cinecturlink2(); } \n" .
|
||||||
"\$_ctx->c2_entries = \$_ctx->cinecturlink->getLinks(\$_ctx->c2_params); \n" .
|
"dcCore::app()->ctx->c2_entries = dcCore::app()->ctx->cinecturlink->getLinks(dcCore::app()->ctx->c2_params); \n" .
|
||||||
'while ($_ctx->c2_entries->fetch()) : ?>' . $c . '<?php endwhile; ' . "\n" .
|
'while (dcCore::app()->ctx->c2_entries->fetch()) : ?>' . $c . '<?php endwhile; ' . "\n" .
|
||||||
"\$_ctx->c2_entries = null; \$_ctx->c2_params = null; \n" .
|
"dcCore::app()->ctx->pop('c2_entries'); dcCore::app()->ctx->pop('c2_params'); \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 (dcCore::app()->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 (dcCore::app()->ctx->c2_entries->isEnd()) : ?>' . $c . '<?php endif; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryIf($a, $c)
|
public static function c2EntryIf($a, $c)
|
||||||
@ -286,7 +286,7 @@ class tplCinecturlink2
|
|||||||
|
|
||||||
if (isset($a['has_category'])) {
|
if (isset($a['has_category'])) {
|
||||||
$sign = (bool) $a['has_category'] ? '!' : '=';
|
$sign = (bool) $a['has_category'] ? '!' : '=';
|
||||||
$if[] = '($_ctx->exists("c2_entries") && "" ' . $sign . '= $_ctx->c2_entries->cat_title)';
|
$if[] = '(dcCore::app()->ctx->exists("c2_entries") && "" ' . $sign . '= dcCore::app()->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";
|
||||||
@ -294,106 +294,105 @@ class tplCinecturlink2
|
|||||||
|
|
||||||
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 (dcCore::app()->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 ((dcCore::app()->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)
|
||||||
{
|
{
|
||||||
return 'urn:md5:<?php echo md5($_ctx->c2_entries->blog_id.$_ctx->c2_entries->link_id.$_ctx->c2_entries->link_creadt); ?>';
|
return 'urn:md5:<?php echo md5(dcCore::app()->ctx->c2_entries->blog_id.dcCore::app()->ctx->c2_entries->link_id.dcCore::app()->ctx->c2_entries->link_creadt); ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryID($a)
|
public static function c2EntryID($a)
|
||||||
{
|
{
|
||||||
return self::getGenericValue('$_ctx->c2_entries->link_id', $a);
|
return self::getGenericValue('dcCore::app()->ctx->c2_entries->link_id', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryTitle($a)
|
public static function c2EntryTitle($a)
|
||||||
{
|
{
|
||||||
return self::getGenericValue('$_ctx->c2_entries->link_title', $a);
|
return self::getGenericValue('dcCore::app()->ctx->c2_entries->link_title', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryDescription($a)
|
public static function c2EntryDescription($a)
|
||||||
{
|
{
|
||||||
return self::getGenericValue('$_ctx->c2_entries->link_desc', $a);
|
return self::getGenericValue('dcCore::app()->ctx->c2_entries->link_desc', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryAuthorCommonName($a)
|
public static function c2EntryAuthorCommonName($a)
|
||||||
{
|
{
|
||||||
return self::getGenericValue('dcUtils::getUserCN($_ctx->c2_entries->user_id,$_ctx->c2_entries->user_name,$_ctx->c2_entries->user_firstname,$_ctx->c2_entries->user_displayname)', $a);
|
return self::getGenericValue('dcUtils::getUserCN(dcCore::app()->ctx->c2_entries->user_id,dcCore::app()->ctx->c2_entries->user_name,dcCore::app()->ctx->c2_entries->user_firstname,dcCore::app()->ctx->c2_entries->user_displayname)', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryAuthorDisplayName($a)
|
public static function c2EntryAuthorDisplayName($a)
|
||||||
{
|
{
|
||||||
return self::getGenericValue('$_ctx->c2_entries->user_displayname', $a);
|
return self::getGenericValue('dcCore::app()->ctx->c2_entries->user_displayname', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryAuthorID($a)
|
public static function c2EntryAuthorID($a)
|
||||||
{
|
{
|
||||||
return self::getGenericValue('$_ctx->c2_entries->user_id', $a);
|
return self::getGenericValue('dcCore::app()->ctx->c2_entries->user_id', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryAuthorEmail($a)
|
public static function c2EntryAuthorEmail($a)
|
||||||
{
|
{
|
||||||
return self::getGenericValue((isset($a['spam_protected']) && !$a['spam_protected'] ? '$_ctx->c2_entries->user_email' : "strtr(\$_ctx->c2_entries->user_email,array('@'=>'%40','.'=>'%2e'))"), $a);
|
return self::getGenericValue((isset($a['spam_protected']) && !$a['spam_protected'] ? 'dcCore::app()->ctx->c2_entries->user_email' : "strtr(dcCore::app()->ctx->c2_entries->user_email,array('@'=>'%40','.'=>'%2e'))"), $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryAuthorLink($a)
|
public static function c2EntryAuthorLink($a)
|
||||||
{
|
{
|
||||||
return self::getGenericValue('sprintf(($_ctx->c2_entries->user_url ? \'<a href="%2$s">%1$s</a>\' : \'%1$s\'),html::escapeHTML(dcUtils::getUserCN($_ctx->c2_entries->user_id,$_ctx->c2_entries->user_name,$_ctx->c2_entries->user_firstname,$_ctx->c2_entries->user_displayname)),html::escapeHTML($_ctx->c2_entries->user_url))', $a);
|
return self::getGenericValue('sprintf((dcCore::app()->ctx->c2_entries->user_url ? \'<a href="%2$s">%1$s</a>\' : \'%1$s\'),html::escapeHTML(dcUtils::getUserCN(dcCore::app()->ctx->c2_entries->user_id,dcCore::app()->ctx->c2_entries->user_name,dcCore::app()->ctx->c2_entries->user_firstname,dcCore::app()->ctx->c2_entries->user_displayname)),html::escapeHTML(dcCore::app()->ctx->c2_entries->user_url))', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryAuthorURL($a)
|
public static function c2EntryAuthorURL($a)
|
||||||
{
|
{
|
||||||
return self::getGenericValue('$_ctx->c2_entries->user_url', $a);
|
return self::getGenericValue('dcCore::app()->ctx->c2_entries->user_url', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryFromAuthor($a)
|
public static function c2EntryFromAuthor($a)
|
||||||
{
|
{
|
||||||
return self::getGenericValue('$_ctx->c2_entries->link_author', $a);
|
return self::getGenericValue('dcCore::app()->ctx->c2_entries->link_author', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryLang($a)
|
public static function c2EntryLang($a)
|
||||||
{
|
{
|
||||||
return self::getGenericValue('$_ctx->c2_entries->link_lang', $a);
|
return self::getGenericValue('dcCore::app()->ctx->c2_entries->link_lang', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryURL($a)
|
public static function c2EntryURL($a)
|
||||||
{
|
{
|
||||||
return self::getGenericValue('$_ctx->c2_entries->link_url', $a);
|
return self::getGenericValue('dcCore::app()->ctx->c2_entries->link_url', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryCategory($a)
|
public static function c2EntryCategory($a)
|
||||||
{
|
{
|
||||||
return self::getGenericValue('$_ctx->c2_entries->cat_title', $a);
|
return self::getGenericValue('dcCore::app()->ctx->c2_entries->cat_title', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryCategoryID($a)
|
public static function c2EntryCategoryID($a)
|
||||||
{
|
{
|
||||||
return self::getGenericValue('$_ctx->c2_entries->cat_id', $a);
|
return self::getGenericValue('dcCore::app()->ctx->c2_entries->cat_id', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryCategoryURL($a)
|
public static function c2EntryCategoryURL($a)
|
||||||
{
|
{
|
||||||
return self::getGenericValue('$core->blog->url.$core->url->getBase("cinecturlink2")."/".$core->blog->settings->cinecturlink2->cinecturlink2_public_caturl."/".urlencode($_ctx->c2_entries->cat_title)', $a);
|
return self::getGenericValue('dcCore::app()->blog->url.dcCore::app()->url->getBase("cinecturlink2")."/".dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_public_caturl."/".urlencode(dcCore::app()->ctx->c2_entries->cat_title)', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryImg($a)
|
public static function c2EntryImg($a)
|
||||||
{
|
{
|
||||||
global $core;
|
$f = dcCore::app()->tpl->getFilters($a);
|
||||||
$f = $core->tpl->getFilters($a);
|
|
||||||
$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 (dcCore::app()->ctx->exists('c2_entries')) { " .
|
||||||
'$widthmax = (integer) $core->blog->settings->cinecturlink2->cinecturlink2_widthmax; ' .
|
'$widthmax = (integer) dcCore::app()->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, ' .
|
'dcCore::app()->ctx->c2_entries->link_img, ' .
|
||||||
"html::escapeHTML(\$_ctx->c2_entries->link_title.' - '.\$_ctx->c2_entries->link_author), " .
|
"html::escapeHTML(dcCore::app()->ctx->c2_entries->link_title.' - '.dcCore::app()->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";
|
||||||
@ -404,13 +403,13 @@ class tplCinecturlink2
|
|||||||
$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), $core->blog->settings->system->blog_timezone)';
|
$p = 'dt::rfc822(strtotime(dcCore::app()->ctx->c2_entries->link_creadt), dcCore::app()->blog->settings->system->blog_timezone)';
|
||||||
} elseif (!empty($a['iso8601'])) {
|
} elseif (!empty($a['iso8601'])) {
|
||||||
$p = 'dt::iso8601(strtotime($_ctx->c2_entries->link_creadt), $core->blog->settings->system->blog_timezone)';
|
$p = 'dt::iso8601(strtotime(dcCore::app()->ctx->c2_entries->link_creadt), dcCore::app()->blog->settings->system->blog_timezone)';
|
||||||
} elseif ($format) {
|
} elseif ($format) {
|
||||||
$p = "dt::dt2str('" . $format . "', \$_ctx->c2_entries->link_creadt)";
|
$p = "dt::dt2str('" . $format . "', dcCore::app()->ctx->c2_entries->link_creadt)";
|
||||||
} else {
|
} else {
|
||||||
$p = 'dt::dt2str($core->blog->settings->system->date_format, $_ctx->c2_entries->link_creadt)';
|
$p = 'dt::dt2str(dcCore::app()->blog->settings->system->date_format, dcCore::app()->ctx->c2_entries->link_creadt)';
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::getGenericValue($p, $a);
|
return self::getGenericValue($p, $a);
|
||||||
@ -418,17 +417,17 @@ class tplCinecturlink2
|
|||||||
|
|
||||||
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']) . "'" : 'dcCore::app()->blog->settings->system->time_format') . ', dcCore::app()->ctx->c2_entries->link_creadt)', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2Pagination($a, $c)
|
public static function c2Pagination($a, $c)
|
||||||
{
|
{
|
||||||
$p = "<?php\n" .
|
$p = "<?php\n" .
|
||||||
"\$params = \$_ctx->c2_params;\n" .
|
"\$params = dcCore::app()->ctx->c2_params;\n" .
|
||||||
"\$_ctx->c2_pagination = \$_ctx->cinecturlink->getLinks(\$params,true); unset(\$params);\n" .
|
"dcCore::app()->ctx->c2_pagination = dcCore::app()->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 (dcCore::app()->ctx->c2_pagination->f(0) > dcCore::app()->ctx->c2_entries->count()) : ?>' . $c . '<?php endif; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2PaginationCounter($a)
|
public static function c2PaginationCounter($a)
|
||||||
@ -466,21 +465,21 @@ class tplCinecturlink2
|
|||||||
{
|
{
|
||||||
return
|
return
|
||||||
"<?php \n" .
|
"<?php \n" .
|
||||||
"if (!\$_ctx->exists('cinecturlink')) { \$_ctx->cinecturlink = new cinecturlink2(\$core); } \n" .
|
"if (!dcCore::app()->ctx->exists('cinecturlink')) { dcCore::app()->ctx->cinecturlink = new cinecturlink2(); } \n" .
|
||||||
"\$_ctx->c2_categories = \$_ctx->cinecturlink->getCategories(); \n" .
|
"dcCore::app()->ctx->c2_categories = dcCore::app()->ctx->cinecturlink->getCategories(); \n" .
|
||||||
'while ($_ctx->c2_categories->fetch()) : ?>' . $c . '<?php endwhile; ' . "\n" .
|
'while (dcCore::app()->ctx->c2_categories->fetch()) : ?>' . $c . '<?php endwhile; ' . "\n" .
|
||||||
"\$_ctx->c2_categories = null; \n" .
|
"dcCore::app()->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 (dcCore::app()->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 (dcCore::app()->ctx->c2_categories->isEnd()) : ?>' . $c . '<?php endif; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2CategoryIf($a, $c)
|
public static function c2CategoryIf($a, $c)
|
||||||
@ -493,7 +492,7 @@ class tplCinecturlink2
|
|||||||
}
|
}
|
||||||
if (isset($a['first'])) {
|
if (isset($a['first'])) {
|
||||||
$sign = (bool) $a['first'] ? '' : '!';
|
$sign = (bool) $a['first'] ? '' : '!';
|
||||||
$if[] = $sign . '$_ctx->c2_categories->isStart()';
|
$if[] = $sign . 'dcCore::app()->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; ?>';
|
||||||
@ -507,37 +506,37 @@ 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(dcCore::app()->tpl->getFilters($a), 'dcCore::app()->blog->url.dcCore::app()->url->getBase("cinecturlink2")."/".dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_public_caturl."/".urlencode(dcCore::app()->ctx->c2_categories->cat_title)."/feed/' . $p . '"') . '; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2CategoryFeedID($a)
|
public static function c2CategoryFeedID($a)
|
||||||
{
|
{
|
||||||
return 'urn:md5:<?php echo md5($core->blog->id."cinecturlink2".$_ctx->c2_categories->cat_id); ?>';
|
return 'urn:md5:<?php echo md5(dcCore::app()->blog->id."cinecturlink2".dcCore::app()->ctx->c2_categories->cat_id); ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
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 (dcCore::app()->ctx->exists('c2_categories')) { echo " . sprintf(dcCore::app()->tpl->getFilters($a), 'dcCore::app()->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 (dcCore::app()->ctx->exists('c2_categories')) { echo " . sprintf(dcCore::app()->tpl->getFilters($a), 'dcCore::app()->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 (dcCore::app()->ctx->exists('c2_categories')) { echo " . sprintf(dcCore::app()->tpl->getFilters($a), 'dcCore::app()->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 (dcCore::app()->ctx->exists('c2_categories')) { echo " . sprintf(dcCore::app()->tpl->getFilters($a), 'dcCore::app()->blog->url.dcCore::app()->url->getBase("cinecturlink2")."/".dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_public_caturl."/".urlencode(dcCore::app()->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 (dcCore::app()->ctx->exists('c2_entries')) { echo " . sprintf(dcCore::app()->tpl->getFilters($a), "$p") . '; } ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function getOperator($op)
|
protected static function getOperator($op)
|
||||||
|
60
_widgets.php
60
_widgets.php
@ -14,11 +14,11 @@ if (!defined('DC_RC_PATH')) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$core->addBehavior(
|
dcCore::app()->addBehavior(
|
||||||
'initWidgets',
|
'initWidgets',
|
||||||
['cinecturlink2Widget', 'adminLinks']
|
['cinecturlink2Widget', 'adminLinks']
|
||||||
);
|
);
|
||||||
$core->addBehavior(
|
dcCore::app()->addBehavior(
|
||||||
'initWidgets',
|
'initWidgets',
|
||||||
['cinecturlink2Widget', 'adminCats']
|
['cinecturlink2Widget', 'adminCats']
|
||||||
);
|
);
|
||||||
@ -27,9 +27,7 @@ class cinecturlink2Widget
|
|||||||
{
|
{
|
||||||
public static function adminLinks($w)
|
public static function adminLinks($w)
|
||||||
{
|
{
|
||||||
global $core;
|
$C2 = new cinecturlink2();
|
||||||
|
|
||||||
$C2 = new cinecturlink2($core);
|
|
||||||
|
|
||||||
$categories_combo = ['' => '', __('Uncategorized') => 'null'];
|
$categories_combo = ['' => '', __('Uncategorized') => 'null'];
|
||||||
$categories = $C2->getCategories();
|
$categories = $C2->getCategories();
|
||||||
@ -43,11 +41,11 @@ class cinecturlink2Widget
|
|||||||
__('My rating') => 'link_note',
|
__('My rating') => 'link_note',
|
||||||
__('Title') => 'link_title',
|
__('Title') => 'link_title',
|
||||||
__('Random') => 'RANDOM',
|
__('Random') => 'RANDOM',
|
||||||
__('Number of views') => 'COUNTER'
|
__('Number of views') => 'COUNTER',
|
||||||
];
|
];
|
||||||
$order_combo = [
|
$order_combo = [
|
||||||
__('Ascending') => 'asc',
|
__('Ascending') => 'asc',
|
||||||
__('Descending') => 'desc'
|
__('Descending') => 'desc',
|
||||||
];
|
];
|
||||||
|
|
||||||
$w
|
$w
|
||||||
@ -157,18 +155,16 @@ class cinecturlink2Widget
|
|||||||
|
|
||||||
public static function publicLinks($w)
|
public static function publicLinks($w)
|
||||||
{
|
{
|
||||||
global $core;
|
dcCore::app()->blog->settings->addNamespace('cinecturlink2');
|
||||||
|
|
||||||
$core->blog->settings->addNamespace('cinecturlink2');
|
if (!dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_active
|
||||||
|
|| $w->homeonly == 1 && !dcCore::app()->url->isHome(dcCore::app()->url->type)
|
||||||
if (!$core->blog->settings->cinecturlink2->cinecturlink2_active
|
|| $w->homeonly == 2 && dcCore::app()->url->isHome(dcCore::app()->url->type)
|
||||||
|| $w->homeonly == 1 && !$core->url->isHome($core->url->type)
|
|
||||||
|| $w->homeonly == 2 && $core->url->isHome($core->url->type)
|
|
||||||
) {
|
) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$C2 = new cinecturlink2($core);
|
$C2 = new cinecturlink2();
|
||||||
|
|
||||||
if ($w->category) {
|
if ($w->category) {
|
||||||
if ($w->category == 'null') {
|
if ($w->category == 'null') {
|
||||||
@ -214,7 +210,7 @@ class cinecturlink2Widget
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$widthmax = (int) $core->blog->settings->cinecturlink2->cinecturlink2_widthmax;
|
$widthmax = (int) dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_widthmax;
|
||||||
$style = $widthmax ? ' style="width:' . $widthmax . 'px;"' : '';
|
$style = $widthmax ? ' style="width:' . $widthmax . 'px;"' : '';
|
||||||
|
|
||||||
$entries = [];
|
$entries = [];
|
||||||
@ -230,7 +226,7 @@ class cinecturlink2Widget
|
|||||||
$count = abs((int) $rs->link_count);
|
$count = abs((int) $rs->link_count);
|
||||||
|
|
||||||
# --BEHAVIOR-- cinecturlink2WidgetLinks
|
# --BEHAVIOR-- cinecturlink2WidgetLinks
|
||||||
$bhv = $core->callBehavior('cinecturlink2WidgetLinks', $rs->link_id);
|
$bhv = dcCore::app()->callBehavior('cinecturlink2WidgetLinks', $rs->link_id);
|
||||||
|
|
||||||
$entries[] = '<p style="text-align:center;">' .
|
$entries[] = '<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 . '">' : '') .
|
||||||
@ -242,19 +238,19 @@ class cinecturlink2Widget
|
|||||||
'</p>' . $bhv;
|
'</p>' . $bhv;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$cur = $core->con->openCursor($C2->table);
|
$cur = dcCore::app()->con->openCursor($C2->table);
|
||||||
$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
|
||||||
if ($w->sortby == 'RANDOM'
|
if ($w->sortby == 'RANDOM'
|
||||||
|| $w->sortby == 'COUNTER'
|
|| $w->sortby == 'COUNTER'
|
||||||
) {
|
) {
|
||||||
shuffle($entries);
|
shuffle($entries);
|
||||||
if ($core->blog->settings->cinecturlink2->cinecturlink2_triggeronrandom) {
|
if (dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_triggeronrandom) {
|
||||||
$core->blog->triggerBlog();
|
dcCore::app()->blog->triggerBlog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,27 +260,25 @@ class cinecturlink2Widget
|
|||||||
'',
|
'',
|
||||||
($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 && dcCore::app()->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="' . dcCore::app()->blog->url . dcCore::app()->url->getBase('cinecturlink2') . '" title="' . __('view all links') . '">' . __('More links') . '</a></p>' : ''
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function publicCats($w)
|
public static function publicCats($w)
|
||||||
{
|
{
|
||||||
global $core;
|
dcCore::app()->blog->settings->addNamespace('cinecturlink2');
|
||||||
|
|
||||||
$core->blog->settings->addNamespace('cinecturlink2');
|
if (!dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_active
|
||||||
|
|| !dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_public_active
|
||||||
if (!$core->blog->settings->cinecturlink2->cinecturlink2_active
|
|| $w->homeonly == 1 && !dcCore::app()->url->isHome(dcCore::app()->url->type)
|
||||||
|| !$core->blog->settings->cinecturlink2->cinecturlink2_public_active
|
|| $w->homeonly == 2 && dcCore::app()->url->isHome(dcCore::app()->url->type)
|
||||||
|| $w->homeonly == 1 && !$core->url->isHome($core->url->type)
|
|
||||||
|| $w->homeonly == 2 && $core->url->isHome($core->url->type)
|
|
||||||
) {
|
) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$C2 = new cinecturlink2($core);
|
$C2 = new cinecturlink2();
|
||||||
$rs = $C2->getCategories([]);
|
$rs = $C2->getCategories([]);
|
||||||
if ($rs->isEmpty()) {
|
if ($rs->isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
@ -292,15 +286,15 @@ class cinecturlink2Widget
|
|||||||
|
|
||||||
$res = [];
|
$res = [];
|
||||||
$res[] = '<li><a href="' .
|
$res[] = '<li><a href="' .
|
||||||
$core->blog->url . $core->url->getBase('cinecturlink2') .
|
dcCore::app()->blog->url . dcCore::app()->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[] = '<li><a href="' .
|
$res[] = '<li><a href="' .
|
||||||
$core->blog->url . $core->url->getBase('cinecturlink2') . '/' .
|
dcCore::app()->blog->url . dcCore::app()->url->getBase('cinecturlink2') . '/' .
|
||||||
$core->blog->settings->cinecturlink2->cinecturlink2_public_caturl . '/' .
|
dcCore::app()->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) .
|
||||||
|
@ -21,8 +21,6 @@ if (!defined('DC_RC_PATH')) {
|
|||||||
*/
|
*/
|
||||||
class cinecturlink2
|
class cinecturlink2
|
||||||
{
|
{
|
||||||
/** @var dcCore dcCore instance */
|
|
||||||
public $core;
|
|
||||||
/** @var dbLayer dbLayer instance */
|
/** @var dbLayer dbLayer instance */
|
||||||
public $con;
|
public $con;
|
||||||
/** @var string Cinecturlink table name */
|
/** @var string Cinecturlink table name */
|
||||||
@ -32,17 +30,14 @@ class cinecturlink2
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Contructor
|
* Contructor
|
||||||
*
|
|
||||||
* @param dcCore $core dcCore instance
|
|
||||||
*/
|
*/
|
||||||
public function __construct(dcCore $core)
|
public function __construct()
|
||||||
{
|
{
|
||||||
$core->blog->settings->addNamespace('cinecturlink2');
|
dcCore::app()->blog->settings->addNamespace('cinecturlink2');
|
||||||
|
|
||||||
$this->core = $core;
|
$this->con = dcCore::app()->con;
|
||||||
$this->con = $core->con;
|
$this->table = dcCore::app()->prefix . 'cinecturlink2';
|
||||||
$this->table = $core->prefix . 'cinecturlink2';
|
$this->blog = dcCore::app()->con->escape(dcCore::app()->blog->id);
|
||||||
$this->blog = $core->con->escape($core->blog->id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,7 +68,7 @@ class cinecturlink2
|
|||||||
}
|
}
|
||||||
|
|
||||||
$strReq .= 'FROM ' . $this->table . ' L ' .
|
$strReq .= 'FROM ' . $this->table . ' L ' .
|
||||||
'INNER JOIN ' . $this->core->prefix . 'user U ON U.user_id = L.user_id ' .
|
'INNER JOIN ' . dcCore::app()->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 ';
|
||||||
|
|
||||||
if (!empty($params['from'])) {
|
if (!empty($params['from'])) {
|
||||||
@ -103,7 +98,9 @@ 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 = (int) $v;}});
|
array_walk($params['cat_id'], function (&$v, $k) { if ($v !== null) {
|
||||||
|
$v = (int) $v;
|
||||||
|
}});
|
||||||
} else {
|
} else {
|
||||||
$params['cat_id'] = [(int) $params['cat_id']];
|
$params['cat_id'] = [(int) $params['cat_id']];
|
||||||
}
|
}
|
||||||
@ -174,7 +171,7 @@ class cinecturlink2
|
|||||||
|
|
||||||
$cur->link_id = $this->getNextLinkId();
|
$cur->link_id = $this->getNextLinkId();
|
||||||
$cur->blog_id = $this->blog;
|
$cur->blog_id = $this->blog;
|
||||||
$cur->user_id = $this->core->auth->userID();
|
$cur->user_id = dcCore::app()->auth->userID();
|
||||||
$cur->link_creadt = date('Y-m-d H:i:s');
|
$cur->link_creadt = date('Y-m-d H:i:s');
|
||||||
$cur->link_upddt = date('Y-m-d H:i:s');
|
$cur->link_upddt = date('Y-m-d H:i:s');
|
||||||
$cur->link_pos = 0;
|
$cur->link_pos = 0;
|
||||||
@ -189,7 +186,7 @@ class cinecturlink2
|
|||||||
$this->trigger();
|
$this->trigger();
|
||||||
|
|
||||||
# --BEHAVIOR-- cinecturlink2AfterAddLink
|
# --BEHAVIOR-- cinecturlink2AfterAddLink
|
||||||
$this->core->callBehavior('cinecturlink2AfterAddLink', $cur);
|
dcCore::app()->callBehavior('cinecturlink2AfterAddLink', $cur);
|
||||||
|
|
||||||
return $cur->link_id;
|
return $cur->link_id;
|
||||||
}
|
}
|
||||||
@ -216,7 +213,7 @@ class cinecturlink2
|
|||||||
|
|
||||||
if ($behavior) {
|
if ($behavior) {
|
||||||
# --BEHAVIOR-- cinecturlink2AfterUpdLink
|
# --BEHAVIOR-- cinecturlink2AfterUpdLink
|
||||||
$this->core->callBehavior('cinecturlink2AfterUpdLink', $cur, $id);
|
dcCore::app()->callBehavior('cinecturlink2AfterUpdLink', $cur, $id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,7 +231,7 @@ class cinecturlink2
|
|||||||
}
|
}
|
||||||
|
|
||||||
# --BEHAVIOR-- cinecturlink2BeforeDelLink
|
# --BEHAVIOR-- cinecturlink2BeforeDelLink
|
||||||
$this->core->callBehavior('cinecturlink2BeforeDelLink', $id);
|
dcCore::app()->callBehavior('cinecturlink2BeforeDelLink', $id);
|
||||||
|
|
||||||
$this->con->execute(
|
$this->con->execute(
|
||||||
'DELETE FROM ' . $this->table . ' ' .
|
'DELETE FROM ' . $this->table . ' ' .
|
||||||
@ -289,7 +286,9 @@ 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 = (int) $v; }});
|
array_walk($params['cat_id'], function (&$v, $k) { if ($v !== null) {
|
||||||
|
$v = (int) $v;
|
||||||
|
}});
|
||||||
} else {
|
} else {
|
||||||
$params['cat_id'] = [(int) $params['cat_id']];
|
$params['cat_id'] = [(int) $params['cat_id']];
|
||||||
}
|
}
|
||||||
@ -298,7 +297,9 @@ class cinecturlink2
|
|||||||
|
|
||||||
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 = (int) $v;}});
|
array_walk($params['exclude_cat_id'], function (&$v, $k) { if ($v !== null) {
|
||||||
|
$v = (int) $v;
|
||||||
|
}});
|
||||||
} else {
|
} else {
|
||||||
$params['exclude_cat_id'] = [(int) $params['exclude_cat_id']];
|
$params['exclude_cat_id'] = [(int) $params['exclude_cat_id']];
|
||||||
}
|
}
|
||||||
@ -441,7 +442,7 @@ class cinecturlink2
|
|||||||
*/
|
*/
|
||||||
private function trigger()
|
private function trigger()
|
||||||
{
|
{
|
||||||
$this->core->blog->triggerBlog();
|
dcCore::app()->blog->triggerBlog();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -470,15 +471,14 @@ class cinecturlink2
|
|||||||
/**
|
/**
|
||||||
* Get list of public directories
|
* Get list of public directories
|
||||||
*
|
*
|
||||||
* @param dcCore $core Core instance
|
|
||||||
* @return array Directories
|
* @return array Directories
|
||||||
*/
|
*/
|
||||||
public static function getPublicDirs($core)
|
public static function getPublicDirs()
|
||||||
{
|
{
|
||||||
$dirs = [];
|
$dirs = [];
|
||||||
$all = files::getDirList($core->blog->public_path);
|
$all = files::getDirList(dcCore::app()->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(dcCore::app()->blog->public_path) + 1);
|
||||||
$dirs[$dir] = $dir;
|
$dirs[$dir] = $dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,12 +16,12 @@ if (!defined('DC_RC_PATH')) {
|
|||||||
|
|
||||||
class cinecturlink2ActivityReportBehaviors
|
class cinecturlink2ActivityReportBehaviors
|
||||||
{
|
{
|
||||||
public static function add($core)
|
public static function add()
|
||||||
{
|
{
|
||||||
$core->activityReport->addGroup('cinecturlink2', __('Plugin cinecturlink2'));
|
dcCore::app()->activityReport->addGroup('cinecturlink2', __('Plugin cinecturlink2'));
|
||||||
|
|
||||||
// from BEHAVIOR cinecturlink2AfterAddLink in cinecturlink2/inc/class.cinecturlink2.php
|
// from BEHAVIOR cinecturlink2AfterAddLink in cinecturlink2/inc/class.cinecturlink2.php
|
||||||
$core->activityReport->addAction(
|
dcCore::app()->activityReport->addAction(
|
||||||
'cinecturlink2',
|
'cinecturlink2',
|
||||||
'create',
|
'create',
|
||||||
__('link creation'),
|
__('link creation'),
|
||||||
@ -30,7 +30,7 @@ class cinecturlink2ActivityReportBehaviors
|
|||||||
['cinecturlink2ActivityReportBehaviors', 'addLink']
|
['cinecturlink2ActivityReportBehaviors', 'addLink']
|
||||||
);
|
);
|
||||||
// from BEHAVIOR cinecturlink2AfterUpdLink in cinecturlink2/inc/class.cinecturlink2.php
|
// from BEHAVIOR cinecturlink2AfterUpdLink in cinecturlink2/inc/class.cinecturlink2.php
|
||||||
$core->activityReport->addAction(
|
dcCore::app()->activityReport->addAction(
|
||||||
'cinecturlink2',
|
'cinecturlink2',
|
||||||
'update',
|
'update',
|
||||||
__('updating link'),
|
__('updating link'),
|
||||||
@ -39,7 +39,7 @@ class cinecturlink2ActivityReportBehaviors
|
|||||||
['cinecturlink2ActivityReportBehaviors', 'updLink']
|
['cinecturlink2ActivityReportBehaviors', 'updLink']
|
||||||
);
|
);
|
||||||
// from BEHAVIOR cinecturlink2BeforeDelLink in cinecturlink2/inc/class.cinecturlink2.php
|
// from BEHAVIOR cinecturlink2BeforeDelLink in cinecturlink2/inc/class.cinecturlink2.php
|
||||||
$core->activityReport->addAction(
|
dcCore::app()->activityReport->addAction(
|
||||||
'cinecturlink2',
|
'cinecturlink2',
|
||||||
'delete',
|
'delete',
|
||||||
__('link deletion'),
|
__('link deletion'),
|
||||||
@ -51,38 +51,34 @@ class cinecturlink2ActivityReportBehaviors
|
|||||||
|
|
||||||
public static function addLink($cur)
|
public static function addLink($cur)
|
||||||
{
|
{
|
||||||
global $core;
|
|
||||||
|
|
||||||
$logs = [
|
$logs = [
|
||||||
$cur->link_title,
|
$cur->link_title,
|
||||||
$core->auth->getInfo('user_cn')
|
dcCore::app()->auth->getInfo('user_cn'),
|
||||||
];
|
];
|
||||||
$core->activityReport->addLog('cinecturlink2', 'create', $logs);
|
dcCore::app()->activityReport->addLog('cinecturlink2', 'create', $logs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function updLink($cur, $id)
|
public static function updLink($cur, $id)
|
||||||
{
|
{
|
||||||
global $core;
|
$C2 = new cinecturlink2();
|
||||||
$C2 = new cinecturlink2($core);
|
|
||||||
$rs = $C2->getLinks(['link_id' => $id]);
|
$rs = $C2->getLinks(['link_id' => $id]);
|
||||||
|
|
||||||
$logs = [
|
$logs = [
|
||||||
$rs->link_title,
|
$rs->link_title,
|
||||||
$core->auth->getInfo('user_cn')
|
dcCore::app()->auth->getInfo('user_cn'),
|
||||||
];
|
];
|
||||||
$core->activityReport->addLog('cinecturlink2', 'update', $logs);
|
dcCore::app()->activityReport->addLog('cinecturlink2', 'update', $logs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function delLink($id)
|
public static function delLink($id)
|
||||||
{
|
{
|
||||||
global $core;
|
$C2 = new cinecturlink2();
|
||||||
$C2 = new cinecturlink2($core);
|
|
||||||
$rs = $C2->getLinks(['link_id' => $id]);
|
$rs = $C2->getLinks(['link_id' => $id]);
|
||||||
|
|
||||||
$logs = [
|
$logs = [
|
||||||
$rs->link_title,
|
$rs->link_title,
|
||||||
$core->auth->getInfo('user_cn')
|
dcCore::app()->auth->getInfo('user_cn'),
|
||||||
];
|
];
|
||||||
$core->activityReport->addLog('cinecturlink2', 'delete', $logs);
|
dcCore::app()->activityReport->addLog('cinecturlink2', 'delete', $logs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,13 +14,11 @@ class cinecturlink2Context
|
|||||||
{
|
{
|
||||||
public static function PaginationNbPages()
|
public static function PaginationNbPages()
|
||||||
{
|
{
|
||||||
global $_ctx;
|
if (dcCore::app()->ctx->c2_pagination === null) {
|
||||||
|
|
||||||
if ($_ctx->c2_pagination === null) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$nb_posts = $_ctx->c2_pagination->f(0);
|
$nb_posts = dcCore::app()->ctx->c2_pagination->f(0);
|
||||||
$nb_per_page = $_ctx->c2_params['limit'][1];
|
$nb_per_page = dcCore::app()->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;
|
||||||
@ -68,7 +66,7 @@ class cinecturlink2Context
|
|||||||
|
|
||||||
$args = preg_replace('#(^|/)c2page/([0-9]+)$#', '', $args);
|
$args = preg_replace('#(^|/)c2page/([0-9]+)$#', '', $args);
|
||||||
|
|
||||||
$url = $GLOBALS['core']->blog->url . $args;
|
$url = dcCore::app()->blog->url . $args;
|
||||||
|
|
||||||
if ($n > 1) {
|
if ($n > 1) {
|
||||||
$url = preg_replace('#/$#', '', $url);
|
$url = preg_replace('#/$#', '', $url);
|
||||||
@ -85,20 +83,18 @@ class cinecturlink2Context
|
|||||||
|
|
||||||
public static function categoryCurrent()
|
public static function categoryCurrent()
|
||||||
{
|
{
|
||||||
global $_ctx;
|
if (!isset(dcCore::app()->ctx->c2_page_params['cat_id'])
|
||||||
|
&& !isset(dcCore::app()->ctx->c2_page_params['cat_title'])
|
||||||
if (!isset($_ctx->c2_page_params['cat_id'])
|
|
||||||
&& !isset($_ctx->c2_page_params['cat_title'])
|
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (isset($_ctx->c2_page_params['cat_id'])
|
if (isset(dcCore::app()->ctx->c2_page_params['cat_id'])
|
||||||
&& $_ctx->c2_page_params['cat_id'] == $_ctx->c2_categories->cat_id
|
&& dcCore::app()->ctx->c2_page_params['cat_id'] == dcCore::app()->ctx->c2_categories->cat_id
|
||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (isset($_ctx->c2_page_params['cat_title'])
|
if (isset(dcCore::app()->ctx->c2_page_params['cat_title'])
|
||||||
&& $_ctx->c2_page_params['cat_title'] == $_ctx->c2_categories->cat_title
|
&& dcCore::app()->ctx->c2_page_params['cat_title'] == dcCore::app()->ctx->c2_categories->cat_title
|
||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -18,15 +18,13 @@ class adminlistCinecturlink2
|
|||||||
{
|
{
|
||||||
public $redir = '';
|
public $redir = '';
|
||||||
|
|
||||||
protected $core;
|
|
||||||
protected $rs;
|
protected $rs;
|
||||||
protected $rs_count;
|
protected $rs_count;
|
||||||
protected $html_prev;
|
protected $html_prev;
|
||||||
protected $html_next;
|
protected $html_next;
|
||||||
|
|
||||||
public function __construct(dcCore $core, $rs, $rs_count)
|
public function __construct($rs, $rs_count)
|
||||||
{
|
{
|
||||||
$this->core = &$core;
|
|
||||||
$this->rs = &$rs;
|
$this->rs = &$rs;
|
||||||
$this->rs_count = $rs_count;
|
$this->rs_count = $rs_count;
|
||||||
$this->html_prev = __('« prev.');
|
$this->html_prev = __('« prev.');
|
||||||
@ -35,7 +33,7 @@ class adminlistCinecturlink2
|
|||||||
|
|
||||||
public function userColumns($type, $cols)
|
public function userColumns($type, $cols)
|
||||||
{
|
{
|
||||||
$cols_user = @$this->core->auth->user_prefs->interface->cols;
|
$cols_user = @dcCore::app()->auth->user_prefs->interface->cols;
|
||||||
if (is_array($cols_user) || $cols_user instanceof ArrayObject) {
|
if (is_array($cols_user) || $cols_user instanceof ArrayObject) {
|
||||||
if (isset($cols_user[$type])) {
|
if (isset($cols_user[$type])) {
|
||||||
foreach ($cols_user[$type] as $cn => $cd) {
|
foreach ($cols_user[$type] as $cn => $cd) {
|
||||||
@ -72,7 +70,7 @@ class adminlistCinecturlink2
|
|||||||
'link' => '<th scope="col">' . __('Links') . '</th>',
|
'link' => '<th scope="col">' . __('Links') . '</th>',
|
||||||
'cat' => '<th scope="col">' . __('Category') . '</th>',
|
'cat' => '<th scope="col">' . __('Category') . '</th>',
|
||||||
'note' => '<th scope="col">' . __('Rating') . '</th>',
|
'note' => '<th scope="col">' . __('Rating') . '</th>',
|
||||||
'date' => '<th scope="col">' . __('Date') . '</th>'
|
'date' => '<th scope="col">' . __('Date') . '</th>',
|
||||||
];
|
];
|
||||||
$cols = new ArrayObject($cols);
|
$cols = new ArrayObject($cols);
|
||||||
$this->userColumns('c2link', $cols);
|
$this->userColumns('c2link', $cols);
|
||||||
@ -111,7 +109,7 @@ class adminlistCinecturlink2
|
|||||||
form::checkbox(['entries[]'], $this->rs->link_id, ['checked' => $checked]) .
|
form::checkbox(['entries[]'], $this->rs->link_id, ['checked' => $checked]) .
|
||||||
'</td>',
|
'</td>',
|
||||||
'title' => '<td class="nowrap" scope="row">' .
|
'title' => '<td class="nowrap" scope="row">' .
|
||||||
'<a href="' . $this->core->adminurl->get(
|
'<a href="' . dcCore::app()->adminurl->get(
|
||||||
'admin.plugin.cinecturlink2',
|
'admin.plugin.cinecturlink2',
|
||||||
['part' => 'link', 'linkid' => $this->rs->link_id, 'redir' => $this->redir]
|
['part' => 'link', 'linkid' => $this->rs->link_id, 'redir' => $this->redir]
|
||||||
) . '" title="' . __('Edit') . '">' .
|
) . '" title="' . __('Edit') . '">' .
|
||||||
@ -132,7 +130,7 @@ class adminlistCinecturlink2
|
|||||||
'">' . __('image') . '</a> ' .
|
'">' . __('image') . '</a> ' .
|
||||||
'</td>',
|
'</td>',
|
||||||
'cat' => '<td class="nowrap minimal">' .
|
'cat' => '<td class="nowrap minimal">' .
|
||||||
'<a href="' . $this->core->adminurl->get(
|
'<a href="' . dcCore::app()->adminurl->get(
|
||||||
'admin.plugin.cinecturlink2',
|
'admin.plugin.cinecturlink2',
|
||||||
['part' => 'cat', 'catid' => $this->rs->cat_id, 'redir' => $this->redir]
|
['part' => 'cat', 'catid' => $this->rs->cat_id, 'redir' => $this->redir]
|
||||||
) . '" title="' . __('Edit') . '">' .
|
) . '" title="' . __('Edit') . '">' .
|
||||||
@ -144,11 +142,11 @@ class adminlistCinecturlink2
|
|||||||
'</td>',
|
'</td>',
|
||||||
'date' => '<td class="nowrap count minimal">' .
|
'date' => '<td class="nowrap count minimal">' .
|
||||||
dt::dt2str(
|
dt::dt2str(
|
||||||
$this->core->blog->settings->system->date_format . ', ' . $this->core->blog->settings->system->time_format,
|
dcCore::app()->blog->settings->system->date_format . ', ' . dcCore::app()->blog->settings->system->time_format,
|
||||||
$this->rs->link_upddt,
|
$this->rs->link_upddt,
|
||||||
$this->core->auth->getInfo('user_tz')
|
dcCore::app()->auth->getInfo('user_tz')
|
||||||
) .
|
) .
|
||||||
'</td>'
|
'</td>',
|
||||||
];
|
];
|
||||||
|
|
||||||
$cols = new ArrayObject($cols);
|
$cols = new ArrayObject($cols);
|
||||||
|
@ -19,23 +19,22 @@ class sitemapsCinecturlink2
|
|||||||
|
|
||||||
public static function sitemapsURLsCollect($sitemaps)
|
public static function sitemapsURLsCollect($sitemaps)
|
||||||
{
|
{
|
||||||
global $core;
|
dcCore::app()->blog->settings->addNamespace('sitemaps');
|
||||||
$core->blog->settings->addNamespace('sitemaps');
|
|
||||||
|
|
||||||
if ($core->plugins->moduleExists('cinecturlink2')
|
if (dcCore::app()->plugins->moduleExists('cinecturlink2')
|
||||||
&& $core->blog->settings->sitemaps->sitemaps_cinecturlink2_url
|
&& dcCore::app()->blog->settings->sitemaps->sitemaps_cinecturlink2_url
|
||||||
) {
|
) {
|
||||||
$freq = $sitemaps->getFrequency($core->blog->settings->sitemaps->sitemaps_cinecturlink2_fq);
|
$freq = $sitemaps->getFrequency(dcCore::app()->blog->settings->sitemaps->sitemaps_cinecturlink2_fq);
|
||||||
$prio = $sitemaps->getPriority($core->blog->settings->sitemaps->sitemaps_cinecturlink2_pr);
|
$prio = $sitemaps->getPriority(dcCore::app()->blog->settings->sitemaps->sitemaps_cinecturlink2_pr);
|
||||||
$base = $core->blog->url . $core->url->getBase('cinecturlink2');
|
$base = dcCore::app()->blog->url . dcCore::app()->url->getBase('cinecturlink2');
|
||||||
|
|
||||||
$sitemaps->addEntry($base, $prio, $freq);
|
$sitemaps->addEntry($base, $prio, $freq);
|
||||||
|
|
||||||
$core->blog->settings->addNamespace('cinecturlink2');
|
dcCore::app()->blog->settings->addNamespace('cinecturlink2');
|
||||||
$C2 = new cinecturlink2($core);
|
$C2 = new cinecturlink2();
|
||||||
$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 . '/' . dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_public_caturl . '/' . urlencode($cats->cat_title), $prio, $freq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
180
index.php
180
index.php
@ -14,7 +14,7 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
dcPage::check('contentadmin');
|
dcPage::check(dcAuth::PERMISSION_CONTENT_ADMIN);
|
||||||
|
|
||||||
$linkid = $_REQUEST['linkid'] ?? '';
|
$linkid = $_REQUEST['linkid'] ?? '';
|
||||||
$linktitle = $_POST['linktitle'] ?? '';
|
$linktitle = $_POST['linktitle'] ?? '';
|
||||||
@ -22,7 +22,7 @@ $linkdesc = $_POST['linkdesc'] ?? '';
|
|||||||
$linkauthor = $_POST['linkauthor'] ?? '';
|
$linkauthor = $_POST['linkauthor'] ?? '';
|
||||||
$linkurl = $_POST['linkurl'] ?? '';
|
$linkurl = $_POST['linkurl'] ?? '';
|
||||||
$linkcat = $_POST['linkcat'] ?? null;
|
$linkcat = $_POST['linkcat'] ?? null;
|
||||||
$linklang = $_POST['linklang'] ?? $core->auth->getInfo('user_lang');
|
$linklang = $_POST['linklang'] ?? dcCore::app()->auth->getInfo('user_lang');
|
||||||
$linkimage = $_POST['linkimage'] ?? '';
|
$linkimage = $_POST['linkimage'] ?? '';
|
||||||
$linknote = $_POST['linknote'] ?? '';
|
$linknote = $_POST['linknote'] ?? '';
|
||||||
$catid = $_REQUEST['catid'] ?? '';
|
$catid = $_REQUEST['catid'] ?? '';
|
||||||
@ -34,7 +34,7 @@ $entries = $_POST['entries'] ?? [];
|
|||||||
$headers = '';
|
$headers = '';
|
||||||
$breadcrumb = [
|
$breadcrumb = [
|
||||||
__('Plugins') => '',
|
__('Plugins') => '',
|
||||||
__('My cinecturlink') => $core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'links'])
|
__('My cinecturlink') => dcCore::app()->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'links']),
|
||||||
];
|
];
|
||||||
if (!in_array($part, ['links', 'link', 'cats', 'cat', 'dellinks', 'updlinksnote', 'updlinkscat'])) {
|
if (!in_array($part, ['links', 'link', 'cats', 'cat', 'dellinks', 'updlinksnote', 'updlinkscat'])) {
|
||||||
$part = 'links';
|
$part = 'links';
|
||||||
@ -44,7 +44,7 @@ if (!is_array($entries)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$C2 = new cinecturlink2($core);
|
$C2 = new cinecturlink2();
|
||||||
$categories = $C2->getCategories();
|
$categories = $C2->getCategories();
|
||||||
$categories_combo = ['-' => ''];
|
$categories_combo = ['-' => ''];
|
||||||
while ($categories->fetch()) {
|
while ($categories->fetch()) {
|
||||||
@ -52,7 +52,7 @@ try {
|
|||||||
$categories_combo[$cat_title] = $categories->cat_id;
|
$categories_combo[$cat_title] = $categories->cat_id;
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($part == 'dellinks') {
|
if ($part == 'dellinks') {
|
||||||
@ -62,13 +62,13 @@ if ($part == 'dellinks') {
|
|||||||
foreach ($entries as $id) {
|
foreach ($entries as $id) {
|
||||||
$C2->delLink($id);
|
$C2->delLink($id);
|
||||||
}
|
}
|
||||||
dcPage::addSuccessNotice(
|
dcAdminNotices::addSuccessNotice(
|
||||||
__('Links successfully deleted.')
|
__('Links successfully deleted.')
|
||||||
);
|
);
|
||||||
$core->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'links']);
|
dcCore::app()->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'links']);
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
$breadcrumb[__('Delete links')] = '';
|
$breadcrumb[__('Delete links')] = '';
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ if (in_array($part, ['updlinksnote', 'updlinkscat'])) {
|
|||||||
try {
|
try {
|
||||||
$links = $C2->getLinks(['link_id' => $entries]);
|
$links = $C2->getLinks(['link_id' => $entries]);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,22 +88,22 @@ if ($part == 'updlinksnote') {
|
|||||||
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 = dcCore::app()->con->openCursor($C2->table);
|
||||||
$cur->link_note = (int) $_POST['newlinknote'];
|
$cur->link_note = (int) $_POST['newlinknote'];
|
||||||
$C2->updLink($links->link_id, $cur);
|
$C2->updLink($links->link_id, $cur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dcPage::addSuccessNotice(
|
dcAdminNotices::addSuccessNotice(
|
||||||
__('Links successfully updated.')
|
__('Links successfully updated.')
|
||||||
);
|
);
|
||||||
if (!empty($_POST['redir'])) {
|
if (!empty($_POST['redir'])) {
|
||||||
http::redirect($redir);
|
http::redirect($redir);
|
||||||
} else {
|
} else {
|
||||||
$core->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'links']);
|
dcCore::app()->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'links']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
$breadcrumb[__('Update links rating')] = '';
|
$breadcrumb[__('Update links rating')] = '';
|
||||||
}
|
}
|
||||||
@ -114,22 +114,22 @@ if ($part == 'updlinkscat') {
|
|||||||
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 = dcCore::app()->con->openCursor($C2->table);
|
||||||
$cur->cat_id = (int) $_POST['newcatid'];
|
$cur->cat_id = (int) $_POST['newcatid'];
|
||||||
$C2->updLink($links->link_id, $cur);
|
$C2->updLink($links->link_id, $cur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dcPage::addSuccessNotice(
|
dcAdminNotices::addSuccessNotice(
|
||||||
__('Links successfully updated.')
|
__('Links successfully updated.')
|
||||||
);
|
);
|
||||||
if (!empty($_POST['redir'])) {
|
if (!empty($_POST['redir'])) {
|
||||||
http::redirect($redir);
|
http::redirect($redir);
|
||||||
} else {
|
} else {
|
||||||
$core->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'links']);
|
dcCore::app()->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'links']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
$breadcrumb[__('Update links category')] = '';
|
$breadcrumb[__('Update links category')] = '';
|
||||||
}
|
}
|
||||||
@ -138,10 +138,10 @@ if ($part == 'links') {
|
|||||||
$action_combo = [
|
$action_combo = [
|
||||||
__('Delete') => 'dellinks',
|
__('Delete') => 'dellinks',
|
||||||
__('Change category') => 'updlinkscat',
|
__('Change category') => 'updlinkscat',
|
||||||
__('Change rating') => 'updlinksnote'
|
__('Change rating') => 'updlinksnote',
|
||||||
];
|
];
|
||||||
|
|
||||||
$c2link_filter = new adminGenericFilter($core, 'c2link');
|
$c2link_filter = new adminGenericFilterV2('c2link');
|
||||||
$c2link_filter->add('part', 'links');
|
$c2link_filter->add('part', 'links');
|
||||||
$c2link_filter->add(dcAdminFilters::getPageFilter());
|
$c2link_filter->add(dcAdminFilters::getPageFilter());
|
||||||
$c2link_filter->add(dcAdminFilters::getSearchFilter());
|
$c2link_filter->add(dcAdminFilters::getSearchFilter());
|
||||||
@ -161,13 +161,13 @@ 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($links, $links_counter);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
$breadcrumb[__('My cinecturlink')] = '';
|
$breadcrumb[__('My cinecturlink')] = '';
|
||||||
$headers .= dcPage::jsVars(['dotclear.filter_reset_url' => $core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'links'])]) .
|
$headers .= dcPage::jsVars(['dotclear.filter_reset_url' => dcCore::app()->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'));
|
||||||
}
|
}
|
||||||
@ -178,11 +178,11 @@ if ($part == 'link') {
|
|||||||
$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);
|
dcCore::app()->media = new dcMedia();
|
||||||
$core->media->chdir($core->blog->settings->cinecturlink2->cinecturlink2_folder);
|
dcCore::app()->media->chdir(dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_folder);
|
||||||
$core->media->getDir();
|
dcCore::app()->media->getDir();
|
||||||
$dir = & $core->media->dir;
|
$dir = & dcCore::app()->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)) {
|
||||||
@ -194,14 +194,14 @@ if ($part == 'link') {
|
|||||||
$media_combo = array_merge(['-' => ''], $tmp_media_combo);
|
$media_combo = array_merge(['-' => ''], $tmp_media_combo);
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
//$core->error->add($e->getMessage());
|
//dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($_POST['save'])) {
|
if (!empty($_POST['save'])) {
|
||||||
try {
|
try {
|
||||||
cinecturlink2::makePublicDir(
|
cinecturlink2::makePublicDir(
|
||||||
DC_ROOT . '/' . $core->blog->settings->system->public_path,
|
DC_ROOT . '/' . dcCore::app()->blog->settings->system->public_path,
|
||||||
$core->blog->settings->cinecturlink2->cinecturlink2_folder
|
dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_folder
|
||||||
);
|
);
|
||||||
if (empty($linktitle)) {
|
if (empty($linktitle)) {
|
||||||
throw new Exception(__('You must provide a title.'));
|
throw new Exception(__('You must provide a title.'));
|
||||||
@ -213,7 +213,7 @@ if ($part == 'link') {
|
|||||||
throw new Exception(__('You must provide a link to an image.'));
|
throw new Exception(__('You must provide a link to an image.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$cur = $core->con->openCursor($C2->table);
|
$cur = dcCore::app()->con->openCursor($C2->table);
|
||||||
$cur->link_title = $linktitle;
|
$cur->link_title = $linktitle;
|
||||||
$cur->link_desc = $linkdesc;
|
$cur->link_desc = $linkdesc;
|
||||||
$cur->link_author = $linkauthor;
|
$cur->link_author = $linkauthor;
|
||||||
@ -231,7 +231,7 @@ if ($part == 'link') {
|
|||||||
}
|
}
|
||||||
$linkid = $C2->addLink($cur);
|
$linkid = $C2->addLink($cur);
|
||||||
|
|
||||||
dcPage::addSuccessNotice(
|
dcAdminNotices::addSuccessNotice(
|
||||||
__('Link successfully created.')
|
__('Link successfully created.')
|
||||||
);
|
);
|
||||||
// update a link
|
// update a link
|
||||||
@ -242,20 +242,20 @@ if ($part == 'link') {
|
|||||||
}
|
}
|
||||||
$C2->updLink($linkid, $cur);
|
$C2->updLink($linkid, $cur);
|
||||||
|
|
||||||
dcPage::addSuccessNotice(
|
dcAdminNotices::addSuccessNotice(
|
||||||
__('Link successfully updated.')
|
__('Link successfully updated.')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$core->adminurl->redirect(
|
dcCore::app()->adminurl->redirect(
|
||||||
'admin.plugin.cinecturlink2',
|
'admin.plugin.cinecturlink2',
|
||||||
[
|
[
|
||||||
'part' => 'link',
|
'part' => 'link',
|
||||||
'linkid' => $linkid,
|
'linkid' => $linkid,
|
||||||
'redir' => $redir
|
'redir' => $redir,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,16 +263,16 @@ if ($part == 'link') {
|
|||||||
try {
|
try {
|
||||||
$C2->delLink($linkid);
|
$C2->delLink($linkid);
|
||||||
|
|
||||||
dcPage::addSuccessNotice(
|
dcAdminNotices::addSuccessNotice(
|
||||||
__('Link successfully deleted.')
|
__('Link successfully deleted.')
|
||||||
);
|
);
|
||||||
if (!empty($_POST['redir'])) {
|
if (!empty($_POST['redir'])) {
|
||||||
http::redirect($redir);
|
http::redirect($redir);
|
||||||
} else {
|
} else {
|
||||||
$core->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'links']);
|
dcCore::app()->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'links']);
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,7 +290,7 @@ if ($part == 'link') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$breadcrumb[(empty($linkid) ? __('New link') : __('Edit link'))] = '';
|
$breadcrumb[(empty($linkid) ? __('New link') : __('Edit link'))] = '';
|
||||||
$headers .= dcPage::jsVars(['dotclear.c2_lang' => $core->auth->getInfo('user_lang')]) .
|
$headers .= dcPage::jsVars(['dotclear.c2_lang' => dcCore::app()->auth->getInfo('user_lang')]) .
|
||||||
dcPage::jsLoad(dcPage::getPF('cinecturlink2/js/c2link.js'));
|
dcPage::jsLoad(dcPage::getPF('cinecturlink2/js/c2link.js'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,33 +313,33 @@ if ($part == 'cats') {
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($catorder as $id) {
|
foreach ($catorder as $id) {
|
||||||
$i++;
|
$i++;
|
||||||
$cur = $core->con->openCursor($C2->table . '_cat');
|
$cur = dcCore::app()->con->openCursor($C2->table . '_cat');
|
||||||
$cur->cat_pos = $i;
|
$cur->cat_pos = $i;
|
||||||
$C2->updCategory($id, $cur);
|
$C2->updCategory($id, $cur);
|
||||||
}
|
}
|
||||||
dcPage::addSuccessNotice(
|
dcAdminNotices::addSuccessNotice(
|
||||||
__('Categories successfully reordered.')
|
__('Categories successfully reordered.')
|
||||||
);
|
);
|
||||||
$core->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'cats']);
|
dcCore::app()->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'cats']);
|
||||||
}
|
}
|
||||||
// delete categories
|
// delete categories
|
||||||
if (!empty($_POST['delete']) && !empty($_POST['items_selected'])) {
|
if (!empty($_POST['delete']) && !empty($_POST['items_selected'])) {
|
||||||
foreach ($_POST['items_selected'] as $id) {
|
foreach ($_POST['items_selected'] as $id) {
|
||||||
$C2->delCategory($id);
|
$C2->delCategory($id);
|
||||||
}
|
}
|
||||||
dcPage::addSuccessNotice(
|
dcAdminNotices::addSuccessNotice(
|
||||||
__('Categories successfully deleted.')
|
__('Categories successfully deleted.')
|
||||||
);
|
);
|
||||||
$core->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'cats']);
|
dcCore::app()->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'cats']);
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
$breadcrumb[__('Categories')] = '';
|
$breadcrumb[__('Categories')] = '';
|
||||||
|
|
||||||
$core->auth->user_prefs->addWorkspace('accessibility');
|
dcCore::app()->auth->user_prefs->addWorkspace('accessibility');
|
||||||
if (!$core->auth->user_prefs->accessibility->nodragdrop) {
|
if (!dcCore::app()->auth->user_prefs->accessibility->nodragdrop) {
|
||||||
$headers .= dcPage::jsLoad('js/jquery/jquery-ui.custom.js') .
|
$headers .= 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'));
|
||||||
@ -354,16 +354,16 @@ if ($part == 'cat') {
|
|||||||
if ($exists) {
|
if ($exists) {
|
||||||
throw new Exception(__('Category with same name already exists.'));
|
throw new Exception(__('Category with same name already exists.'));
|
||||||
}
|
}
|
||||||
$cur = $core->con->openCursor($C2->table . '_cat');
|
$cur = dcCore::app()->con->openCursor($C2->table . '_cat');
|
||||||
$cur->cat_title = $cattitle;
|
$cur->cat_title = $cattitle;
|
||||||
$cur->cat_desc = $catdesc;
|
$cur->cat_desc = $catdesc;
|
||||||
|
|
||||||
$catid = $C2->addCategory($cur);
|
$catid = $C2->addCategory($cur);
|
||||||
|
|
||||||
dcPage::addSuccessNotice(
|
dcAdminNotices::addSuccessNotice(
|
||||||
__('Category successfully created.')
|
__('Category successfully created.')
|
||||||
);
|
);
|
||||||
$core->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'cats']);
|
dcCore::app()->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'cats']);
|
||||||
}
|
}
|
||||||
// update category
|
// update category
|
||||||
if (!empty($_POST['save']) && !empty($catid) && !empty($cattitle) && !empty($catdesc)) {
|
if (!empty($_POST['save']) && !empty($catid) && !empty($cattitle) && !empty($catdesc)) {
|
||||||
@ -371,30 +371,30 @@ if ($part == 'cat') {
|
|||||||
if ($exists) {
|
if ($exists) {
|
||||||
throw new Exception(__('Category with same name already exists.'));
|
throw new Exception(__('Category with same name already exists.'));
|
||||||
}
|
}
|
||||||
$cur = $core->con->openCursor($C2->table . '_cat');
|
$cur = dcCore::app()->con->openCursor($C2->table . '_cat');
|
||||||
$cur->cat_title = $cattitle;
|
$cur->cat_title = $cattitle;
|
||||||
$cur->cat_desc = $catdesc;
|
$cur->cat_desc = $catdesc;
|
||||||
|
|
||||||
$C2->updCategory($catid, $cur);
|
$C2->updCategory($catid, $cur);
|
||||||
|
|
||||||
dcPage::addSuccessNotice(
|
dcAdminNotices::addSuccessNotice(
|
||||||
__('Category successfully updated.')
|
__('Category successfully updated.')
|
||||||
);
|
);
|
||||||
$core->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'cats']);
|
dcCore::app()->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'cats']);
|
||||||
}
|
}
|
||||||
// delete category
|
// delete category
|
||||||
if (!empty($_POST['delete']) && !empty($catid)) {
|
if (!empty($_POST['delete']) && !empty($catid)) {
|
||||||
$C2->delCategory($catid);
|
$C2->delCategory($catid);
|
||||||
|
|
||||||
dcPage::addSuccessNotice(
|
dcAdminNotices::addSuccessNotice(
|
||||||
__('Category successfully deleted.')
|
__('Category successfully deleted.')
|
||||||
);
|
);
|
||||||
$core->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'cats']);
|
dcCore::app()->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'cats']);
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
$breadcrumb[__('Categories')] = $core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'cats']);
|
$breadcrumb[__('Categories')] = dcCore::app()->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'cats']);
|
||||||
$breadcrumb[(empty($catid) ? __('New category') : __('Edit category'))] = '';
|
$breadcrumb[(empty($catid) ? __('New category') : __('Edit category'))] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,18 +423,18 @@ if ($part == 'updlinksnote') {
|
|||||||
echo '</ul>';
|
echo '</ul>';
|
||||||
|
|
||||||
echo '<h4>' . __('Rating') . '</h4>
|
echo '<h4>' . __('Rating') . '</h4>
|
||||||
<form method="post" action="' . $core->adminurl->get('admin.plugin.cinecturlink2') . '">' .
|
<form method="post" action="' . dcCore::app()->adminurl->get('admin.plugin.cinecturlink2') . '">' .
|
||||||
'<p><label for="newlinknote" class="ib">' . __('New rating:') . '</label> ' .
|
'<p><label for="newlinknote" class="ib">' . __('New rating:') . '</label> ' .
|
||||||
form::number('newlinknote', [
|
form::number('newlinknote', [
|
||||||
'min' => 0,
|
'min' => 0,
|
||||||
'max' => 20,
|
'max' => 20,
|
||||||
'default' => 10
|
'default' => 10,
|
||||||
]) . '/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="' . (
|
'<a id="post-cancel" href="' . (
|
||||||
$redir ? $redir :
|
$redir ? $redir :
|
||||||
$core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'links'])
|
dcCore::app()->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);
|
||||||
@ -442,7 +442,7 @@ if ($part == 'updlinksnote') {
|
|||||||
echo
|
echo
|
||||||
form::hidden('part', 'updlinksnote') .
|
form::hidden('part', 'updlinksnote') .
|
||||||
form::hidden('redir', $redir) .
|
form::hidden('redir', $redir) .
|
||||||
$core->formNonce() . '</p>' .
|
dcCore::app()->formNonce() . '</p>' .
|
||||||
'</form>';
|
'</form>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -458,13 +458,13 @@ if ($part == 'updlinkscat') {
|
|||||||
echo '</ul>';
|
echo '</ul>';
|
||||||
|
|
||||||
echo '<h4>' . __('Category') . '</h4>
|
echo '<h4>' . __('Category') . '</h4>
|
||||||
<form method="post" action="' . $core->adminurl->get('admin.plugin.cinecturlink2') . '">' .
|
<form method="post" action="' . dcCore::app()->adminurl->get('admin.plugin.cinecturlink2') . '">' .
|
||||||
'<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="' . (
|
'<a id="post-cancel" href="' . (
|
||||||
$redir ? $redir :
|
$redir ? $redir :
|
||||||
$core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'links'])
|
dcCore::app()->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);
|
||||||
@ -472,19 +472,19 @@ if ($part == 'updlinkscat') {
|
|||||||
echo
|
echo
|
||||||
form::hidden('part', 'updlinkscat') .
|
form::hidden('part', 'updlinkscat') .
|
||||||
form::hidden('redir', $redir) .
|
form::hidden('redir', $redir) .
|
||||||
$core->formNonce() . '</p>' .
|
dcCore::app()->formNonce() . '</p>' .
|
||||||
'</form>';
|
'</form>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($part == 'links') {
|
if ($part == 'links') {
|
||||||
$links_redir = $core->adminurl->get('admin.plugin.cinecturlink2', $c2link_filter->values());
|
$links_redir = dcCore::app()->adminurl->get('admin.plugin.cinecturlink2', $c2link_filter->values());
|
||||||
|
|
||||||
echo
|
echo
|
||||||
'<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]) .
|
dcCore::app()->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' => 'cats', 'redir' => $links_redir]) .
|
dcCore::app()->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'cats', 'redir' => $links_redir]) .
|
||||||
'">' . __('Edit categories') . ' </a></p>';
|
'">' . __('Edit categories') . ' </a></p>';
|
||||||
|
|
||||||
if ($links->isEmpty() && !$c2link_filter->show()) {
|
if ($links->isEmpty() && !$c2link_filter->show()) {
|
||||||
@ -498,7 +498,7 @@ if ($part == 'links') {
|
|||||||
$links_list->display(
|
$links_list->display(
|
||||||
$c2link_filter->page,
|
$c2link_filter->page,
|
||||||
$c2link_filter->nb,
|
$c2link_filter->nb,
|
||||||
'<form action="' . $core->adminurl->get('admin.plugin.cinecturlink2') . '" method="post" id="form-entries">' .
|
'<form action="' . dcCore::app()->adminurl->get('admin.plugin.cinecturlink2') . '" method="post" id="form-entries">' .
|
||||||
|
|
||||||
'%s' .
|
'%s' .
|
||||||
|
|
||||||
@ -508,9 +508,9 @@ if ($part == 'links') {
|
|||||||
'<p class="col right"><label for="action" class="classic">' . __('Selected links action:') . '</label> ' .
|
'<p class="col right"><label for="action" class="classic">' . __('Selected links action:') . '</label> ' .
|
||||||
form::combo('part', $action_combo) .
|
form::combo('part', $action_combo) .
|
||||||
'<input id="do-action" type="submit" value="' . __('ok') . '" disabled /></p>' .
|
'<input id="do-action" type="submit" value="' . __('ok') . '" disabled /></p>' .
|
||||||
$core->adminurl->getHiddenFormFields('admin.plugin.cinecturlink2', array_diff_key($c2link_filter->values(), ['part' => ''])) .
|
dcCore::app()->adminurl->getHiddenFormFields('admin.plugin.cinecturlink2', array_diff_key($c2link_filter->values(), ['part' => ''])) .
|
||||||
form::hidden(['redir'], $links_redir) .
|
form::hidden(['redir'], $links_redir) .
|
||||||
$core->formNonce() .
|
dcCore::app()->formNonce() .
|
||||||
'</div>' .
|
'</div>' .
|
||||||
'</form>',
|
'</form>',
|
||||||
$c2link_filter->show(),
|
$c2link_filter->show(),
|
||||||
@ -521,7 +521,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="' . dcCore::app()->adminurl->get('admin.plugin.cinecturlink2') . '">
|
||||||
|
|
||||||
<div class="two-cols clearfix">
|
<div class="two-cols clearfix">
|
||||||
<div class="col70">
|
<div class="col70">
|
||||||
@ -554,7 +554,7 @@ if ($part == 'link') {
|
|||||||
form::combo('newimageselect', $media_combo, '', 'maximal') .
|
form::combo('newimageselect', $media_combo, '', 'maximal') .
|
||||||
'</label></p>' .
|
'</label></p>' .
|
||||||
'<p class="form-note"><a href="' .
|
'<p class="form-note"><a href="' .
|
||||||
$core->adminurl->get('admin.media', ['d' => (string) $core->blog->settings->cinecturlink2->cinecturlink2_folder]) . '">' .
|
dcCore::app()->adminurl->get('admin.media', ['d' => (string) dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_folder]) . '">' .
|
||||||
__('Go to media manager to add image to cinecturlink path.') .
|
__('Go to media manager to add image to cinecturlink path.') .
|
||||||
'<a></p>';
|
'<a></p>';
|
||||||
}
|
}
|
||||||
@ -572,20 +572,20 @@ if ($part == 'link') {
|
|||||||
form::number('linknote', [
|
form::number('linknote', [
|
||||||
'min' => 0,
|
'min' => 0,
|
||||||
'max' => 20,
|
'max' => 20,
|
||||||
'default' => $linknote
|
'default' => $linknote,
|
||||||
]) . '/20' . '</p>
|
]) . '/20' . '</p>
|
||||||
</div></div>
|
</div></div>
|
||||||
|
|
||||||
<p class="border-top">' .
|
<p class="border-top">' .
|
||||||
'<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']) .
|
dcCore::app()->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') .
|
||||||
form::hidden('redir', $redir) .
|
form::hidden('redir', $redir) .
|
||||||
$core->formNonce() . '
|
dcCore::app()->formNonce() . '
|
||||||
</p>
|
</p>
|
||||||
</form>';
|
</form>';
|
||||||
}
|
}
|
||||||
@ -593,17 +593,17 @@ if ($part == 'link') {
|
|||||||
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(
|
dcCore::app()->adminurl->get(
|
||||||
'admin.plugin.cinecturlink2',
|
'admin.plugin.cinecturlink2',
|
||||||
[
|
[
|
||||||
'part' => 'cat',
|
'part' => 'cat',
|
||||||
'redir' => $core->adminurl->get(
|
'redir' => dcCore::app()->adminurl->get(
|
||||||
'admin.plugin.cinecturlink2',
|
'admin.plugin.cinecturlink2',
|
||||||
[
|
[
|
||||||
'part' => 'cats',
|
'part' => 'cats',
|
||||||
'redir' => $redir,
|
'redir' => $redir,
|
||||||
]
|
]
|
||||||
)
|
),
|
||||||
]
|
]
|
||||||
) .
|
) .
|
||||||
'">' . __('New Category') . ' </a></p>';
|
'">' . __('New Category') . ' </a></p>';
|
||||||
@ -612,7 +612,7 @@ if ($part == 'cats') {
|
|||||||
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="' . dcCore::app()->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>
|
||||||
@ -634,23 +634,23 @@ if ($part == 'cats') {
|
|||||||
'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(
|
dcCore::app()->adminurl->get(
|
||||||
'admin.plugin.cinecturlink2',
|
'admin.plugin.cinecturlink2',
|
||||||
[
|
[
|
||||||
'part' => 'cat',
|
'part' => 'cat',
|
||||||
'catid' => $id,
|
'catid' => $id,
|
||||||
'redir' => $core->adminurl->get(
|
'redir' => dcCore::app()->adminurl->get(
|
||||||
'admin.plugin.cinecturlink2',
|
'admin.plugin.cinecturlink2',
|
||||||
[
|
[
|
||||||
'part' => 'cats',
|
'part' => 'cats',
|
||||||
'redir' => $redir
|
'redir' => $redir,
|
||||||
]
|
]
|
||||||
)
|
),
|
||||||
]
|
]
|
||||||
) .
|
) .
|
||||||
'">' . html::escapeHTML($categories->cat_title) . '</a></td>
|
'">' . html::escapeHTML($categories->cat_title) . '</a></td>
|
||||||
@ -667,12 +667,12 @@ if ($part == 'cats') {
|
|||||||
<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']) .
|
dcCore::app()->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') .
|
||||||
$core->formNonce() . '</p>' .
|
dcCore::app()->formNonce() . '</p>' .
|
||||||
'</form>';
|
'</form>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -695,7 +695,7 @@ if ($part == 'cat') {
|
|||||||
) . '</p>';
|
) . '</p>';
|
||||||
}
|
}
|
||||||
echo '
|
echo '
|
||||||
<form method="post" action="' . $core->adminurl->get('admin.plugin.cinecturlink2') . '">
|
<form method="post" action="' . dcCore::app()->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>
|
||||||
@ -705,12 +705,12 @@ if ($part == 'cat') {
|
|||||||
<p class="border-top">' .
|
<p class="border-top">' .
|
||||||
'<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']) .
|
dcCore::app()->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') .
|
||||||
$core->formNonce() . '</p>' .
|
dcCore::app()->formNonce() . '</p>' .
|
||||||
'</form>';
|
'</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user