tiki-admin_dsn.php 1.85 KB
Newer Older
lrargerich's avatar
lrargerich committed
1
<?php
2
// (c) Copyright 2002-2011 by authors of the Tiki Wiki CMS Groupware Project
3
// 
4 5
// 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.
6
// $Id$
changi67's avatar
changi67 committed
7

8 9
require_once ('tiki-setup.php');
include_once ('lib/admin/adminlib.php');
10 11 12

$access->check_permission('tiki_p_admin');

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