-
Notifications
You must be signed in to change notification settings - Fork 4
/
tiki-admin_integrator.php
84 lines (75 loc) · 3.07 KB
/
tiki-admin_integrator.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
// (c) Copyright 2002-2012 by authors of the Tiki Wiki CMS Groupware Project
//
// 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.
// $Id: tiki-admin_integrator.php 40224 2012-03-17 09:29:15Z pkdille $
require_once ('tiki-setup.php');
require_once ('lib/integrator/integrator.php');
// If Integrator is ON, check permissions...
$access->check_feature('feature_integrator');
$access->check_permission(array('tiki_p_admin_integrator'));
// Setup local variables from request or set default values
$repID = isset($_REQUEST['repID']) ? $_REQUEST['repID'] : 0;
$name = isset($_REQUEST['name']) ? $_REQUEST['name'] : '';
$path = isset($_REQUEST['path']) ? $_REQUEST['path'] : '';
$start = isset($_REQUEST['start']) ? $_REQUEST['start'] : '';
$cssfile = isset($_REQUEST['cssfile']) ? $_REQUEST['cssfile'] : '';
$expiration = isset($_REQUEST['expiration']) ? $_REQUEST['expiration'] : 0;
$description = isset($_REQUEST['description']) ? $_REQUEST['description'] : '';
$vis = isset($_REQUEST['vis']) ? ($_REQUEST['vis'] == 'on' ? 'y' : 'n') : 'n';
$cacheable = isset($_REQUEST['cacheable']) ? ($_REQUEST['cacheable'] == 'on' ? 'y' : 'n') : 'n';
// Create instance of integrator
$integrator = new TikiIntegrator($dbTiki);
// Check if 'submit' pressed ...
if (isset($_REQUEST['save'])) {
// ... and all mandatory paramaters r OK
if (strlen($name) > 0) $integrator->add_replace_repository($repID, $name, $path, $start, $cssfile, $vis, $cacheable, $expiration, $description);
else {
$smarty->assign('msg', tra("Repository name can't be an empty"));
$smarty->display('error.tpl');
die;
}
}
// Whether some action requested?
if (isset($_REQUEST['action'])) {
switch ($_REQUEST['action']) {
case 'edit':
if ($repID != 0) {
$rep = $integrator->get_repository($repID);
$smarty->assign('repID', $repID);
$smarty->assign('name', $rep['name']);
$smarty->assign('path', $rep['path']);
$smarty->assign('start', $rep['start_page']);
$smarty->assign('cssfile', $rep['css_file']);
$smarty->assign('expiration', $rep['expiration']);
$smarty->assign('vis', $rep['visibility']);
$smarty->assign('cacheable', $rep['cacheable']);
$smarty->assign('description', $rep['description']);
}
break;
case 'rm':
if ($repID != 0) {
$access->check_authenticity();
$integrator->remove_repository($repID);
}
break;
case 'clear':
if ($repID != 0) $integrator->clear_cache($repID);
header('location: ' . $_SERVER['SCRIPT_NAME'] . '?action=edit&repID=' . $repID);
exit;
default:
$smarty->assign('msg', tra('Requested action is not supported on repository'));
$smarty->display('error.tpl');
die;
break;
}
}
// Fill list of repositories
$repositories = $integrator->list_repositories(false);
$smarty->assign_by_ref('repositories', $repositories);
// disallow robots to index page:
$smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW');
// Display the template
$smarty->assign('mid', 'tiki-admin_integrator.tpl');
$smarty->display('tiki.tpl');