diff --git a/_config.php b/_config.php index 23618d0..b7d936e 100644 --- a/_config.php +++ b/_config.php @@ -1,144 +1,134 @@ getURL().'#plugins' : $_REQUEST['redir']; + $list->getURL().'#plugins' : $_REQUEST['redir']; -# -- Get settings -- $core->blog->settings->addNamespace('cinecturlink2'); $s = $core->blog->settings->cinecturlink2; -$cinecturlink2_active = (boolean) $s->cinecturlink2_active; -$cinecturlink2_widthmax = abs((integer) $s->cinecturlink2_widthmax); -$cinecturlink2_folder = (string) $s->cinecturlink2_folder; -$cinecturlink2_triggeronrandom = (boolean) $s->cinecturlink2_triggeronrandom; -$cinecturlink2_public_active = (boolean) $s->cinecturlink2_public_active; -$cinecturlink2_public_title = (string) $s->cinecturlink2_public_title; -$cinecturlink2_public_description = (string) $s->cinecturlink2_public_description; -$cinecturlink2_public_nbrpp = (integer) $s->cinecturlink2_public_nbrpp; +$cinecturlink2_active = (boolean) $s->cinecturlink2_active; +$cinecturlink2_widthmax = abs((integer) $s->cinecturlink2_widthmax); +$cinecturlink2_folder = (string) $s->cinecturlink2_folder; +$cinecturlink2_triggeronrandom = (boolean) $s->cinecturlink2_triggeronrandom; +$cinecturlink2_public_active = (boolean) $s->cinecturlink2_public_active; +$cinecturlink2_public_title = (string) $s->cinecturlink2_public_title; +$cinecturlink2_public_description = (string) $s->cinecturlink2_public_description; +$cinecturlink2_public_nbrpp = (integer) $s->cinecturlink2_public_nbrpp; if ($cinecturlink2_public_nbrpp < 1) { - $cinecturlink2_public_nbrpp = 10; + $cinecturlink2_public_nbrpp = 10; } -# -- Set settings -- if (!empty($_POST['save'])) { + try { + $cinecturlink2_active = !empty($_POST['cinecturlink2_active']); + $cinecturlink2_widthmax = abs((integer) $_POST['cinecturlink2_widthmax']); + $cinecturlink2_folder = (string) files::tidyFileName($_POST['cinecturlink2_folder']); + $cinecturlink2_triggeronrandom = !empty($_POST['cinecturlink2_triggeronrandom']); + $cinecturlink2_public_active = !empty($_POST['cinecturlink2_public_active']); + $cinecturlink2_public_title = (string) $_POST['cinecturlink2_public_title']; + $cinecturlink2_public_description = (string) $_POST['cinecturlink2_public_description']; + $cinecturlink2_public_nbrpp = (integer) $_POST['cinecturlink2_public_nbrpp']; + if ($cinecturlink2_public_nbrpp < 1) { + $cinecturlink2_public_nbrpp = 10; + } + if (empty($cinecturlink2_folder)) { + throw new Exception(__('You must provide a specific folder for images.')); + } + cinecturlink2::test_folder( + DC_ROOT . '/' . $core->blog->settings->system->public_path, + $cinecturlink2_folder, + true + ); + $s->put('cinecturlink2_active', $cinecturlink2_active); + $s->put('cinecturlink2_public_active', $cinecturlink2_public_active); + $s->put('cinecturlink2_public_title', $cinecturlink2_public_title); + $s->put('cinecturlink2_public_description', $cinecturlink2_public_description); + $s->put('cinecturlink2_public_nbrpp', $cinecturlink2_public_nbrpp); + $s->put('cinecturlink2_widthmax', $cinecturlink2_widthmax); + $s->put('cinecturlink2_folder', $cinecturlink2_folder); + $s->put('cinecturlink2_triggeronrandom', $cinecturlink2_triggeronrandom); - try { - $cinecturlink2_active = !empty($_POST['cinecturlink2_active']); - $cinecturlink2_widthmax = abs((integer) $_POST['cinecturlink2_widthmax']); - $cinecturlink2_folder = (string) files::tidyFileName($_POST['cinecturlink2_folder']); - $cinecturlink2_triggeronrandom = !empty($_POST['cinecturlink2_triggeronrandom']); - $cinecturlink2_public_active = !empty($_POST['cinecturlink2_public_active']); - $cinecturlink2_public_title = (string) $_POST['cinecturlink2_public_title']; - $cinecturlink2_public_description = (string) $_POST['cinecturlink2_public_description']; - $cinecturlink2_public_nbrpp = (integer) $_POST['cinecturlink2_public_nbrpp']; - if ($cinecturlink2_public_nbrpp < 1) { - $cinecturlink2_public_nbrpp = 10; - } - - if (empty($cinecturlink2_folder)) { - throw new Exception(__('You must provide a specific folder for images.')); - } - cinecturlink2::test_folder( - DC_ROOT.'/'.$core->blog->settings->system->public_path, - $cinecturlink2_folder, - true - ); - - $s->put('cinecturlink2_active', $cinecturlink2_active); - $s->put('cinecturlink2_public_active', $cinecturlink2_public_active); - $s->put('cinecturlink2_public_title', $cinecturlink2_public_title); - $s->put('cinecturlink2_public_description', $cinecturlink2_public_description); - $s->put('cinecturlink2_public_nbrpp', $cinecturlink2_public_nbrpp); - $s->put('cinecturlink2_widthmax', $cinecturlink2_widthmax); - $s->put('cinecturlink2_folder', $cinecturlink2_folder); - $s->put('cinecturlink2_triggeronrandom', $cinecturlink2_triggeronrandom); - - dcPage::addSuccessNotice( - __('Configuration has been successfully updated.') - ); - http::redirect( - $list->getURL('module=cinecturlink2&conf=1&redir='. - $list->getRedir()) - ); - } - catch (Exception $e) { - $core->error->add($e->getMessage()); - } + dcPage::addSuccessNotice( + __('Configuration has been successfully updated.') + ); + $core->adminurl->redirect( + 'admin.plugins', + ['module' => 'cinecturlink2', 'conf' => 1, 'redir' => $list->getRedir()] + ); + } catch (Exception $e) { + $core->error->add($e->getMessage()); + } } -# -- Display form -- echo ' -
-

'.__('General').'

+

' . __('General') . '

-

+

-

+

-

+

-

'.__('Widget').'

+

' . __('Widget') . '

-

-

'.__('This increases the random effect, but updates the cache of the blog whenever the widget is displayed, which reduces the perfomances of your blog.').'

+

+

' . __('This increases the random effect, but updates the cache of the blog whenever the widget is displayed, which reduces the perfomances of your blog.') . '

-

'.__('Public page').'

+

' . __('Public page') . '

-

-

'.sprintf(__('Public page has url: %s'),''.$core->blog->url.$core->url->getBase('cinecturlink2').'').'

+

+

' . sprintf(__('Public page has url: %s'), '' . $core->blog->url . $core->url->getBase('cinecturlink2') . '') . '

-

+

-

+

-

+

-

'.__('Informations').'

+

' . __('Informations') . '

-
'; +'; \ No newline at end of file