1<?php
2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
3//
4// All Rights Reserved. See copyright.txt for details and a complete list of authors.
5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
6// $Id$
7
8function prefs_site_list()
9{
10	global $prefs;
11
12	$available_layouts = TikiLib::lib('css')->list_user_selectable_layouts(isset($prefs['site_theme']) ? $prefs['site_theme'] : '', isset($prefs['theme_option']) ? $prefs['theme_option'] : '');
13	$available_admin_layouts = TikiLib::lib('css')->list_user_selectable_layouts(isset($prefs['site_theme_admin']) ? $prefs['site_theme_admin'] : '', isset($prefs['theme_option_admin']) ? $prefs['theme_option_admin'] : '');
14	$listGroups = TikiLib::lib('user')->get_groups();
15	$groups[''] = tr('All');
16	foreach ($listGroups['data'] as $group) {
17		$groups[$group['groupName']] = $group['groupName'];
18	}
19	unset($groups['Anonymous']);
20
21	return  [
22		'site_closed' => [
23			'name' => tra('Close site'),
24			'description' => tra('Use this setting to \"close\" the Tiki site (such as for maintenance). Users attempting to access the site will see only a log-in form. Only users with specific permission will be allowed to log in.
25			Use the Message to display to specify the message that visitors will see when attempting to access your site.'),
26			'type' => 'flag',
27			'help' => 'Site-Access#Close_site',
28			'perspective' => false,
29			'tags' => ['basic'],
30			'default' => 'n',
31		],
32		'site_closed_title' => [
33			'name' => tra('Title'),
34			'type' => 'text',
35			'perspective' => false,
36			'dependencies' => [
37				'site_closed',
38			],
39			'default' => tra('Coming soon'),
40			'tags' => ['basic'],
41		],
42		'site_closed_msg' => [
43			'name' => tra('Message'),
44			'type' => 'text',
45			'perspective' => false,
46			'dependencies' => [
47				'site_closed',
48			],
49			'default' => tra('Site is closed for maintenance; please come back later.'),
50			'tags' => ['basic'],
51		],
52		'site_busy_msg' => [
53			'name' => tra('Message'),
54			'type' => 'text',
55			'perspective' => false,
56			'dependencies' => [
57				'use_load_threshold',
58			],
59			'default' => tra('Server is currently too busy; please come back later.'),
60		],
61		'site_crumb_seper' => [
62			'name' => tra('Locations (breadcrumbs)'),
63			'type' => 'text',
64			'hint' => tr('Examples:  » / >  : -> →'),
65			'size' => '5',
66			'default' => '»',
67		],
68		'site_nav_seper' => [
69			'name' => tra('Choices'),
70			'type' => 'text',
71			'hint' => tr('Examples: | / ¦  :'),
72			'size' => '5',
73			'default' => '|',
74		],
75		'site_title_location' => [
76			'name' => tra('Browser title position'),
77			'description' => tra('Position of the browser title in the full browser bar relative to the current page\'s descriptor.'),
78			'type' => 'list',
79			'options' => [
80				'after' => tra('After current page\'s descriptor'),
81				'before' => tra('Before current page\'s descriptor'),
82				'none' => tra('No browser title, only current page\'s descriptor'),
83				'only' => tra('Only browser title, no current page\'s descriptor'),
84			],
85			'tags' => ['basic'],
86			'default' => 'before',
87		],
88		'site_title_breadcrumb' => [
89			'name' => tra('Browser title display mode'),
90			'description' => tra('When breadcrumbs are used, method to display the browser title.'),
91			'type' => 'list',
92			'options' => [
93				'invertfull' => tra('Most-specific first'),
94				'fulltrail' => tra('Least-specific first (site)'),
95				'pagetitle' => tra('Current only'),
96				'desc' => tra('Description'),
97			],
98			'tags' => ['advanced'],
99			'default' => 'invertfull',
100		],
101		'site_favicon_enable' => [
102			'name' => tr('Favicons'),
103			'description' => tra('Custom favicon image files can be put in the /themes/(themename)/favicons directory, or the default Tiki favicons can be used.'),
104			'type' => 'flag',
105			'default' => 'y',
106			'help' => 'Favicon',
107		],
108		'site_terminal_active' => [
109			'name' => tra('Site terminal'),
110			'description' => tra('Allows users to be directed to a specific perspective depending on the origin IP address. Can be used inside intranets to use different configurations for users depending on their departements or discriminate people in web contexts. Unspecified IPs will fall back to default behavior, including multi-domain handling. Manually selected perspectives take precedence over this.'),
111			'type' => 'flag',
112			'dependencies' => [
113				'feature_perspective',
114			],
115			'default' => 'n',
116		],
117		'site_terminal_config' => [
118			'name' => tra('Site terminal configuration'),
119			'description' => tra('Provides the mapping from subnets to perspective.'),
120			'type' => 'textarea',
121			'perspective' => false,
122			'size' => 10,
123			'hint' => tra('One per line. Network prefix in CIDR notation (address/mask size), separated by comma with the perspective ID.') . ' ' . tra('Example:') . ' 192.168.12.0/24,12',
124			'default' => '',
125		],
126		'site_google_analytics_account' => [
127			'name' => tr('Google Analytics account number'),
128			'description' => tra('The account number for the site. The account number from Google is something like UA-XXXXXXX-YY.'),
129			'type' => 'text',
130			'size' => 15,
131			'default' => '',
132			'hint' => ' Enter only XXXXXXX-YY (without the UA)',
133			'dependencies' => [
134				'wikiplugin_googleanalytics',
135			],
136		],
137		'site_google_analytics_group_option' => [
138			'name' => tr('Google Analytics Groups Option'),
139			'description' => tr('Define option for Google Analytics groups'),
140			'type' => 'list',
141			'tags' => ['advanced'],
142			'options' => [
143				'' => tr('None'),
144				'included' => tr('Included'),
145				'excluded' => tr('Excluded'),
146			],
147			'default' => '',
148			'dependencies' => [
149				'wikiplugin_googleanalytics',
150			],
151		],
152		'site_google_analytics_groups' => [
153			'name' => tra('Google Analytics Available Groups'),
154			'description' => tr('User groups for which Google Analytics will be available'),
155			'type' => 'multilist',
156			'tags' => ['advanced'],
157			'options' => $groups,
158			'default' => [''],
159			'dependencies' => [
160				'site_google_analytics_group_option',
161				'wikiplugin_googleanalytics',
162			],
163		],
164		'site_google_analytics_gtag' => [
165			'name' => tr('Google Global Site Tag Mode'),
166			'description' => tra('Use the newer Google Global Site Tag (gtag.js) as opposed to the previous ga.js.'),
167			'type' => 'flag',
168			'default' => 'y',
169			'dependencies' => [
170				'site_google_analytics_account',
171			],
172		],
173		'site_google_credentials' => [
174			'name' => tra('Google authentication credentials file'),
175			'description' => tr('Path to the Google Service Account credentials JSON file.'),
176			'type' => 'text',
177			'size' => 30,
178			'default' => '',
179			'warning' => 'Must be kept private and not accessible on the internet directly',
180		],
181		'site_layout' => [
182			'name' => tr('Site layout'),
183			'description' => tr('Changes the template for the overall site layout'),
184			'type' => 'list',
185			'default' => 'basic',
186			'help' => 'Site Layout',
187			'tags' => ['advanced'],
188			'options' => $available_layouts,
189		],
190		'site_layout_admin' => [
191			'name' => tr('Admin layout'),
192			'description' => tr('Specify which layout template to use for admin pages.'),
193			'type' => 'list',
194			'default' => 'basic',
195			'tags' => ['advanced'],
196			'options' => $available_admin_layouts,
197		],
198		'site_layout_per_object' => [
199			'name' => tr('Enable layout per page, etc.'),
200			'description' => tr('Specify an alternate layout for a particular wiki page, etc.'),
201			'tags' => ['experimental'],
202			'type' => 'flag',
203			'default' => 'n',
204		],
205		'site_piwik_analytics_server_url' => [
206			'name' => tr('Piwik server URL'),
207			'description' => tr('The URL to the Piwik server of this site') . '<br />'
208					. tr('In Piwik, the selected site (Site Id) must have view permission set for anonymous, or a token authentication parameter can be inserted in the Piwik server URL.'),
209			'type' => 'text',
210			'filter' => 'url',
211			'size' => 30,
212			'default' => '',
213			'hint' => 'http(s)://yourpiwik.tld/index.php(?token_auth=yourtokencode)',
214		],
215		'site_piwik_site_id' => [
216			'name' => tra('Site Id'),
217			'description' => tr('The ID of this website in Piwik'),
218			'type' => 'text',
219			'size' => '5',
220			'default' => '',
221			'dependencies' => [
222				'site_piwik_analytics_server_url',
223			],
224		],
225		'site_piwik_code' => [
226			'name' => tra('Piwik JavaScript tracking code'),
227			'description' => tra("Code to be placed on every page of this website just before the </body> tag"),
228			'type' => 'textarea',
229			'size' => '6',
230			'filter' => 'rawhtml_unsafe',
231			'default' => '',
232			'dependencies' => [
233				'site_piwik_analytics_server_url',
234				'wikiplugin_piwik',
235			],
236		],
237		'site_piwik_group_option' => [
238			'name' => tr('Piwik Groups Option'),
239			'description' => tr('Define option for Piwik groups'),
240			'type' => 'list',
241			'tags' => ['advanced'],
242			'options' => [
243				'' => tr('None'),
244				'included' => tr('Included'),
245				'excluded' => tr('Excluded'),
246			],
247			'default' => '',
248			'dependencies' => [
249				'site_piwik_code',
250				'wikiplugin_piwik',
251			],
252		],
253		'site_piwik_groups' => [
254			'name' => tr('Piwik Available Groups'),
255			'description' => tr('User groups for which piwik will be available'),
256			'type' => 'multilist',
257			'tags' => ['advanced'],
258			'options' => $groups,
259			'default' => [''],
260			'dependencies' => [
261				'site_piwik_group_option',
262				'wikiplugin_piwik',
263			],
264		],
265		'site_security_timeout' => [
266			'name' => tra('Security timeout'),
267			'description' => tr('Sets the expiration of CSRF tickets and related forms. The %0session_lifetime%1
268				preference is used for the default, if set, otherwise the %0session.gc_maxlifetime%1 %0php.ini%1 setting
269				is used, subject to a default maximum of four hours in any case.', '<code>', '</code>'),
270			'type' => 'text',
271			'filter' => 'digits',
272			'warning' => tra('Minimum value is 30 seconds to avoid blocking everyone from being able to make any changes, including to this setting'),
273			'units' => tra('seconds'),
274			'constraints' => [
275				'min' => 30
276			],
277			'tags' => ['basic'],
278			'default' => TikiLib::lib('access')->getDefaultTimeout(),
279		],
280	];
281}
282