tiki-admin_dsn.php 1.88 KB
Newer Older
lrargerich's avatar
lrargerich committed
1
<?php
changi67's avatar
changi67 committed
2 3 4
/**
 * @package tikiwiki
 */
5
// (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
6
// 
7 8
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
9
// $Id$
changi67's avatar
changi67 committed
10

11
require_once ('tiki-setup.php');
lphuberdeau's avatar
lphuberdeau committed
12
$adminlib = TikiLib::lib('admin');
13 14 15

$access->check_permission('tiki_p_admin');

16
if (!isset($_REQUEST["dsnId"])) {
17
	$_REQUEST["dsnId"] = 0;
18 19 20
}
$smarty->assign('dsnId', $_REQUEST["dsnId"]);
if ($_REQUEST["dsnId"]) {
21
	$info = $adminlib->get_dsn($_REQUEST["dsnId"]);
lrargerich's avatar
lrargerich committed
22
} else {
23 24 25
	$info = array();
	$info["dsn"] = '';
	$info['name'] = '';
lrargerich's avatar
lrargerich committed
26
}
27 28
$smarty->assign('info', $info);
if (isset($_REQUEST["remove"])) {
29 30
	$access->check_authenticity();
	$adminlib->remove_dsn($_REQUEST["remove"]);
lrargerich's avatar
lrargerich committed
31
}
32
if (isset($_REQUEST["save"])) {
33 34 35 36 37 38 39 40
	check_ticket('admin-dsn');
	$adminlib->replace_dsn($_REQUEST["dsnId"], $_REQUEST["dsn"], $_REQUEST['name']);
	$info = array();
	$info["dsn"] = '';
	$info['name'] = '';
	$smarty->assign('info', $info);
	$smarty->assign('name', '');
	$smarty->assign('dsnId', '');
lrargerich's avatar
lrargerich committed
41
}
42
if (!isset($_REQUEST["sort_mode"])) {
43
	$sort_mode = 'dsnId_desc';
lrargerich's avatar
lrargerich committed
44
} else {
45
	$sort_mode = $_REQUEST["sort_mode"];
46 47
}
if (!isset($_REQUEST["offset"])) {
48
	$offset = 0;
lrargerich's avatar
lrargerich committed
49
} else {
50
	$offset = $_REQUEST["offset"];
lrargerich's avatar
lrargerich committed
51
}
52 53
$smarty->assign_by_ref('offset', $offset);
if (isset($_REQUEST["find"])) {
54
	$find = $_REQUEST["find"];
lrargerich's avatar
lrargerich committed
55
} else {
56
	$find = '';
lrargerich's avatar
lrargerich committed
57
}
58 59 60
$smarty->assign('find', $find);
$smarty->assign_by_ref('sort_mode', $sort_mode);
$channels = $adminlib->list_dsn($offset, $maxRecords, $sort_mode, $find);
61
$smarty->assign_by_ref('cant_pages', $channels["cant"]);
62
$smarty->assign_by_ref('channels', $channels["data"]);
63
ask_ticket('admin-dsn');
64 65
// disallow robots to index page:
$smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW');
lrargerich's avatar
lrargerich committed
66
// Display the template
67
$smarty->assign('mid', 'tiki-admin_dsn.tpl');
68
$smarty->display("tiki.tpl");