tiki  21.2
About: Tiki Wiki is a Groupware/CMS (Content Management System) solution that has features like Wikis, Forums, Blogs, Articles, Image Gallery, Map Server, Link Directory, Multilingual Support, Bug Tracker, RSS Feeds etc. Latest release 21 with Long Term Support (LTS).
  Fossies Dox: tiki-21.2.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

tiki-channel.php
Go to the documentation of this file.
1 <?php
5 // (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
6 //
7 // All Rights Reserved. See copyright.txt for details and a complete list of authors.
8 // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
9 // $Id$
10 
12  [
13  'staticKeyFiltersForArrays' => ['channels' => 'rawhtml_unsafe',],
14  ]
15 ];
16 
17 require_once 'tiki-setup.php';
18 
19 // This file will handle a second mode of authentication, don't limit it to permissions.
20 // Only channels registered through the admin panel can be executed.
21 // Each channel execution validates access rights.
22 
23 if (! isset($_REQUEST['channels']) || ! is_array($_REQUEST['channels'])) {
24  $access->display_error('tiki-channel.php', tra('Invalid request. Expecting channels array.'));
25 }
26 
27 $calls = [];
28 $channels = [];
29 
30 foreach ($_REQUEST['channels'] as $info) {
31  if (! isset($info['channel_name'])) {
32  $access->display_error('tiki-channel.php', tra('Missing channel name.'));
33  }
34 
35  $channel = $info['channel_name'];
36  $channels[] = $channel;
37  unset($info['channel_name']);
38  $calls[] = [ $channel, $info ];
39 }
40 
42 
43 $channels = array_unique($channels);
44 $groups = $tikilib->get_user_groups($user);
45 
46 if (! $user && ! $config->canExecuteChannels($channels, $groups)) {
47  // User not defined and some groups missing, likely to be a machine
48  if (! $access->http_auth()) {
49  $access->display_error('tiki-channel.php', tra('Authentication required.'));
50  }
51 
52  // Get the new ones
53  $groups = $tikilib->get_user_groups($user);
54 }
55 
56 if (! $config->canExecuteChannels($channels, $groups)) {
57  $access->display_error(
58  'tiki-channel.php',
59  tra('One of the requested channels cannot be requested. It does not exist or permission is denied.')
60  );
61 }
62 
63 $profiles = $config->getProfiles($channels);
64 
65 if (count($profiles) != count($channels)) {
66  $access->display_error('tiki-channel.php', tra('One of the install profiles could not be obtained.'));
67 }
68 
71 $installer->limitGlobalPreferences([]);
72 
73 foreach ($calls as $call) {
74  list($channel, $userInput) = $call;
75 
76  // Profile can be installed multiple times
77  // Only last values preserved
78  $profile = $profiles[$channel];
79  $installer->forget($profile);
80 
81  $installer->setUserData($userInput);
82  $installer->install($profile);
83 }
84 
85 if (isset($_REQUEST['return_uri'])) {
86  header("Location: {$_REQUEST['return_uri']}");
87 }
tra
tra($content, $lg='', $unused=false, $args=[])
Definition: tra.php:37
$calls
if(! isset($_REQUEST['channels'])||! is_array($_REQUEST['channels'])) $calls
Definition: tiki-channel.php:27
Tiki_Profile_Installer
Definition: Installer.php:13
$groups
$groups
Definition: tiki-channel.php:44
$user
if(strpos($_SERVER['SCRIPT_NAME'], basename(__FILE__)) !=false) global $user
Definition: avatar_force_upload.php:7
$_REQUEST
$_REQUEST["fgal_podcast_dir"]
Definition: include_fgal.php:25
php
$info
if(strpos($_SERVER['SCRIPT_NAME'], basename(__FILE__)) !=false) global $info
Definition: editmode.php:12
$prefs
if(strpos($_SERVER['SCRIPT_NAME'], basename(__FILE__)) !==false) global $prefs
Definition: include_connect.php:9
$installer
$installer
Definition: tiki-channel.php:70
$access
$access
Definition: include_rating.php:15
Tiki_Profile_ChannelList\fromConfiguration
static fromConfiguration($string)
Definition: ChannelList.php:17
$profiles
if(! $user &&! $config->canExecuteChannels($channels, $groups)) if(! $config->canExecuteChannels($channels, $groups)) $profiles
Definition: tiki-channel.php:63
$config
foreach($_REQUEST['channels'] as $info) $config
Definition: tiki-channel.php:41
$channels
$channels
Definition: tiki-channel.php:28
$tikilib
global $tikilib
Definition: include_textarea.php:42
$inputConfiguration
$inputConfiguration
Definition: tiki-channel.php:11
Tiki_Profile\useUnicityPrefix
static useUnicityPrefix($prefix)
Definition: Profile.php:111