kUtRL/index.php

67 lines
2.3 KiB
PHP
Raw Normal View History

2021-08-25 23:06:22 +00:00
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
2021-08-27 23:53:13 +00:00
#
2021-08-25 23:06:22 +00:00
# This file is part of kUtRL, a plugin for Dotclear 2.
#
2021-08-27 23:53:13 +00:00
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
2021-08-25 23:06:22 +00:00
#
# Licensed under the GPL version 2.0 license.
# A copy of this license is available in LICENSE file or at
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
2021-08-27 23:53:13 +00:00
#
2021-08-25 23:06:22 +00:00
# -- END LICENSE BLOCK ------------------------------------
2021-08-26 00:08:41 +00:00
if (!defined('DC_CONTEXT_ADMIN')) {
return;
}
2021-08-25 23:06:22 +00:00
# Check user perms
dcPage::check('admin');
# Settings
$s = $core->blog->settings->kUtRL;
# Default values
$show_filters = false;
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
$section = isset($_REQUEST['section']) ? $_REQUEST['section'] : '';
$img_green = '<img src="images/check-on.png" alt="ok" />';
$img_red = '<img src="images/check-off.png" alt="fail" />';
$header =
2021-08-26 00:08:41 +00:00
dcPage::jsLoad('index.php?pf=kUtRL/js/main.js') .
'<script type="text/javascript">' . "\n//<![CDATA[\n" .
"jcToolsBox.prototype.text_wait = '" . html::escapeJS(__('Please wait')) . "';\n" .
"\n//]]>\n</script>\n" .
2021-08-25 23:06:22 +00:00
'<style type="text/css">
.titleKutrl { margin: -20px; text-align:center; }
.titleKutrl a { border:none; text-decoration: none; }
</style>';
$footer = '<hr class="clear"/><p class="right">
2021-08-26 00:08:41 +00:00
<a class="button" href="' . $p_url . '&amp;part=setting" title="' . __('Configure extension') . '">' . __('Settings') . '</a> -
<a class="button" href="' . $p_url . '&amp;part=service" title="' . __('Configure services') . '">' . __('Services') . '</a> -
kUtRL - ' . $core->plugins->moduleInfo('kUtRL','version') . '&nbsp;
<img alt="' . __('kUtRL') . '" src="index.php?pf=kUtRL/icon.png" />
</p>';
2021-08-25 23:06:22 +00:00
# Messages
$msg = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : '';
2021-08-26 00:08:41 +00:00
$msg_list = [
2021-08-25 23:06:22 +00:00
'savesetting' => __('Configuration successfully saved'),
'saveservice' => __('Services successfully updated'),
'createlink' => __('Link successfully shorten'),
'deletelinks' => __('Links successfully deleted')
2021-08-26 00:08:41 +00:00
];
2021-08-25 23:06:22 +00:00
if (isset($msg_list[$msg])) {
2021-08-26 00:08:41 +00:00
$msg = sprintf('<p class="message">%s</p>', $msg_list[$msg]);
2021-08-25 23:06:22 +00:00
}
# Pages
$start_part = $s->kutrl_active ? 'links' : 'setting';
$default_part = isset($_REQUEST['part']) ? $_REQUEST['part'] : $start_part;
2021-08-26 00:08:41 +00:00
if (!file_exists(dirname(__FILE__) . '/inc/index.' . $default_part . '.php')) {
2021-08-25 23:06:22 +00:00
$default_part = 'setting';
}
2021-08-26 00:08:41 +00:00
include dirname(__FILE__) . '/inc/index.' . $default_part . '.php';