auth->makePermissions([dcAuth::PERMISSION_ADMIN])); $redir = empty($_REQUEST['redir']) ? dcCore::app()->admin->list->getURL() . '#plugins' : $_REQUEST['redir']; dcCore::app()->blog->settings->addNamespace('cinecturlink2'); $s = dcCore::app()->blog->settings->cinecturlink2; $cinecturlink2_active = (bool) $s->cinecturlink2_active; $cinecturlink2_widthmax = abs((int) $s->cinecturlink2_widthmax); $cinecturlink2_folder = (string) $s->cinecturlink2_folder; $cinecturlink2_triggeronrandom = (bool) $s->cinecturlink2_triggeronrandom; $cinecturlink2_public_active = (bool) $s->cinecturlink2_public_active; $cinecturlink2_public_title = (string) $s->cinecturlink2_public_title; $cinecturlink2_public_description = (string) $s->cinecturlink2_public_description; $cinecturlink2_public_nbrpp = (int) $s->cinecturlink2_public_nbrpp; if ($cinecturlink2_public_nbrpp < 1) { $cinecturlink2_public_nbrpp = 10; } $combo_dirs = cinecturlink2::getPublicDirs(); if (!empty($_POST['save'])) { try { $cinecturlink2_active = !empty($_POST['cinecturlink2_active']); $cinecturlink2_widthmax = abs((int) $_POST['cinecturlink2_widthmax']); $cinecturlink2_newdir = (string) files::tidyFileName($_POST['cinecturlink2_newdir']); $cinecturlink2_folder = empty($cinecturlink2_newdir) ? (string) files::tidyFileName($_POST['cinecturlink2_folder']) : $cinecturlink2_newdir; $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 = (int) $_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::makePublicDir( DC_ROOT . '/' . dcCore::app()->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); dcAdminNotices::addSuccessNotice( __('Configuration successfully updated.') ); dcCore::app()->adminurl->redirect( 'admin.plugins', ['module' => 'cinecturlink2', 'conf' => 1, 'redir' => dcCore::app()->admin->list->getRedir()] ); } catch (Exception $e) { dcCore::app()->error->add($e->getMessage()); } } echo '
' . form::combo('cinecturlink2_folder', $combo_dirs, $cinecturlink2_folder) . '
' . form::field('cinecturlink2_newdir', 60, 64, '', 'maximal') . '
' . form::number('cinecturlink2_widthmax', 10, 512, $cinecturlink2_widthmax) . '
' . __('This increases the random effect, but updates the cache of the blog whenever the widget is displayed, which reduces the perfomances of your blog.') . '
' . sprintf(__('Public page has url: %s'), '' . dcCore::app()->blog->url . dcCore::app()->url->getBase('cinecturlink2') . '') . '
' . form::field('cinecturlink2_public_title', 60, 255, $cinecturlink2_public_title, 'maximal') . '
' . form::field('cinecturlink2_public_description', 60, 255, $cinecturlink2_public_description, 'maximal') . '
' . form::number('cinecturlink2_public_nbrpp', 1, 100, $cinecturlink2_public_nbrpp) . '