1<?php
2/**
3 * @package tikiwiki
4 */
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
11
12use Tiki\Package\ExtensionManager;
13
14$section = 'admin';
15
16require_once('tiki-setup.php');
17$adminlib = TikiLib::lib('admin');
18
19$auto_query_args = ['page'];
20
21$access->check_permission('tiki_p_admin');
22$logslib = TikiLib::lib('logs');
23
24/**
25 * Display feedback on prefs changed
26 *
27 * @param string $name Name of feature
28 * @param string $message Other message
29 * @param int $st Type of change (0=disabled, 1=enabled, 2=changed, 3=info, 4=reset)
30 * @param int $num unknown
31 * @return void
32 * @throws Exception
33 */
34function add_feedback($name, $message, $st, $num = null)
35{
36	TikiLib::lib('prefs')->addRecent($name);
37
38	Feedback::add(['num' => $num,
39		'mes' => $message,
40		'st' => $st,
41		'name' => $name,
42		'tpl' => 'pref',]);
43}
44
45/**
46 * simple_set_toggle
47 *
48 * @param mixed $feature
49 * @access public
50 * @return void
51 * @throws Exception
52 */
53function simple_set_toggle($feature)
54{
55	global $prefs;
56	$logslib = TikiLib::lib('logs');
57	$tikilib = TikiLib::lib('tiki');
58	if (isset($_REQUEST[$feature]) && $_REQUEST[$feature] == 'on') {
59		if ((! isset($prefs[$feature]) || $prefs[$feature] != 'y')) {
60			// not yet set at all or not set to y
61			if ($tikilib->set_preference($feature, 'y')) {
62				add_feedback($feature, tr('%0 enabled', $feature), 1, 1);
63				$logslib->add_action('feature', $feature, 'system', 'enabled');
64			}
65		}
66	} else {
67		if ((! isset($prefs[$feature]) || $prefs[$feature] != 'n')) {
68			// not yet set at all or not set to n
69			if ($tikilib->set_preference($feature, 'n')) {
70				add_feedback($feature, tr('%0 disabled', $feature), 0, 1);
71				$logslib->add_action('feature', $feature, 'system', 'disabled');
72			}
73		}
74	}
75	TikiLib::lib('cache')->invalidate('allperms');
76}
77
78/**
79 * simple_set_value
80 *
81 * @param mixed $feature
82 * @param string $pref
83 * @param mixed $isMultiple
84 * @access public
85 * @return void
86 * @throws Exception
87 */
88function simple_set_value($feature, $pref = '', $isMultiple = false)
89{
90	global $prefs;
91	$logslib = TikiLib::lib('logs');
92	$tikilib = TikiLib::lib('tiki');
93	$old = $prefs[$feature];
94	if (isset($_POST[$feature])) {
95		if ($pref != '') {
96			if ($tikilib->set_preference($pref, $_POST[$feature])) {
97				$prefs[$feature] = $_POST[$feature];
98			}
99		} else {
100			$tikilib->set_preference($feature, $_POST[$feature]);
101		}
102	} elseif ($isMultiple) {
103		// Multiple selection controls do not exist if no item is selected.
104		// We still want the value to be updated.
105		if ($pref != '') {
106			if ($tikilib->set_preference($pref, [])) {
107				$prefs[$feature] = $_POST[$feature];
108			}
109		} else {
110			$tikilib->set_preference($feature, []);
111		}
112	}
113	if (isset($_POST[$feature]) && $old != $_POST[$feature]) {
114		add_feedback($feature, ($_POST[$feature]) ? tr('%0 set', $feature) : tr('%0 unset', $feature), 2);
115		$msg = '';
116		if (is_array($_POST[$feature]) && is_array($old)) {
117			$newCount = count($_POST[$feature]);
118			$oldCount = count($old);
119			if ($newCount > $oldCount) {
120				$added = $newCount - $oldCount;
121				$item = $added == 1 ? tr('item added') : tr('items added');
122				$msg = $added . ' ' . $item;
123			} elseif ($oldCount > $newCount) {
124				$deleted = $oldCount - $newCount;
125				$item = $deleted == 1 ? tr('item deleted') : tr('items deleted');
126				$msg = $deleted . ' ' . $item;
127			}
128		} else {
129			$msg = $old . ' => ' . $_POST[$feature];
130		}
131		$logslib->add_action('feature', $feature, 'system', $msg);
132	}
133	TikiLib::lib('cache')->invalidate('allperms');
134}
135
136$crumbs[] = new Breadcrumb(tra('Control Panels'), tra('Sections'), 'tiki-admin.php', 'Admin+Home', tra('Help on Configuration Sections', '', true));
137// Default values for AdminHome
138$admintitle = tra('Control Panels');
139$helpUrl = 'Admin+Home';
140$helpDescription = $description = '';
141$url = 'tiki-admin.php';
142$adminPage = '';
143
144$prefslib = TikiLib::lib('prefs');
145
146if (isset($_REQUEST['pref_filters']) && $access->checkCsrf()) {
147	$prefslib->setFilters($_REQUEST['pref_filters']);
148	Feedback::success(tra('Default preference filters set'));
149}
150
151/*
152 * If blacklist preferences have been updated and its also not being disabled
153 * Then update the database with the selection.
154 */
155
156$blackL = TikiLib::lib('blacklist');
157
158if (isset($_POST['pass_blacklist'])) {    // if preferences were updated and blacklist feature is enabled (or is being enabled)
159	$pass_blacklist_file = $jitPost->pass_blacklist_file->striptags();
160	$userfile = explode('-', $pass_blacklist_file);
161	$userfile = $userfile[3];
162	if ($userfile) {                       // if the blacklist is a user generated file
163		$passDir = 'storage/pass_blacklists/';
164	} else {
165		$passDir = 'lib/pass_blacklists/';
166	}
167	if ($pass_blacklist_file === 'auto') {
168		if ($_POST['min_pass_length'] != $GLOBALS['prefs']['min_pass_length'] ||
169			$_POST['pass_chr_num'] != $GLOBALS['prefs']['pass_chr_num']    ||
170			$_POST['pass_chr_special'] != $GLOBALS['prefs']['pass_chr_special']) {       // if blacklist is auto and an option is changed that could effect the selection
171			$prefname = implode('-', $blackL->selectBestBlacklist($_POST['pass_chr_num'], $_POST['pass_chr_special'], $_POST['min_pass_length']));
172			$filename = $passDir . $prefname . '.txt';
173			$tikilib->set_preference('pass_auto_blacklist', $prefname);
174			$blackL->loadBlacklist(dirname($_SERVER['SCRIPT_FILENAME']) . '/' . $filename);
175		}
176	} elseif ($pass_blacklist_file != $GLOBALS['prefs']['pass_blacklist_file']) {        // if manual selection mode has been changed
177		$filename = $passDir . $pass_blacklist_file . '.txt';
178		$blackL->loadBlacklist(dirname($_SERVER['SCRIPT_FILENAME']) . '/' . $filename);
179	}
180}
181
182$temp_filters = isset($_REQUEST['filters']) ? explode(' ', $_REQUEST['filters']) : null;
183$smarty->assign('pref_filters', $prefslib->getFilters($temp_filters));
184
185if (isset($_POST['lm_preference'] ) && $access->checkCsrf()) {
186	$changes = $prefslib->applyChanges((array) $_POST['lm_preference'], $_POST);
187	foreach ($changes as $pref => $val) {
188		if ($val['type'] == 'reset') {
189			add_feedback($pref, tr('%0 reset', $pref), 4);
190			$logslib->add_action('feature', $pref, 'system', 'reset');
191		} else {
192			$value = $val['new'];
193			if ($value == 'y') {
194				add_feedback($pref, tr('%0 enabled', $pref), 1, 1);
195				$logslib->add_action('feature', $pref, 'system', 'enabled');
196			} elseif ($value == 'n') {
197				add_feedback($pref, tr('%0 disabled', $pref), 0, 1);
198				$logslib->add_action('feature', $pref, 'system', 'disabled');
199			} else {
200				add_feedback($pref, tr('%0 set', $pref), 1, 1);
201				$logslib->add_action('feature', $pref, 'system', (is_array($val['old']) ? implode($val['old'], ',') : $val['old']) . '=>' . (is_array($value) ? implode($value, ',') : $value));
202			}
203			/*
204				Enable/disable addreference/showreference plugins alognwith references feature.
205			*/
206			if ($pref == 'feature_references') {
207				$tikilib->set_preference('wikiplugin_addreference', $value);
208				$tikilib->set_preference('wikiplugin_showreference', $value);
209
210				/* Add/Remove the plugin toolbars from the editor */
211				$toolbars = ['wikiplugin_addreference', 'wikiplugin_showreference'];
212				$t_action = ($value == 'y') ? 'add' : 'remove';
213				$tikilib->saveEditorToolbars($toolbars, 'global', $t_action);
214			}
215		}
216	}
217}
218
219if (isset($_REQUEST['lm_criteria'])) {
220	set_time_limit(0);
221	try {
222		$smarty->assign('lm_criteria', $_REQUEST['lm_criteria']);
223		$results = $prefslib->getMatchingPreferences($_REQUEST['lm_criteria']);
224		$results = array_slice($results, 0, 50);
225		$results = $prefslib->unsetHiddenPreferences($results);
226		$smarty->assign('lm_searchresults', $results);
227	} catch (ZendSearch\Lucene\Exception\ExceptionInterface $e) {
228		Feedback::warning(['mes' => $e->getMessage(), 'title' => tr('Search error')]);
229		$smarty->assign('lm_criteria', '');
230		$smarty->assign('lm_searchresults', '');
231	}
232} else {
233	$smarty->assign('lm_criteria', '');
234	$smarty->assign('lm_searchresults', '');
235}
236
237$smarty->assign('indexNeedsRebuilding', $prefslib->indexNeedsRebuilding());
238
239if (isset($_REQUEST['prefrebuild'])) {
240	$prefslib->rebuildIndex();
241	header('Location: ' . $base_url . 'tiki-admin.php');
242}
243
244$admin_icons = [
245	"general" => [
246		'title' => tr('General'),
247		'description' => tr('Global site configuration, date formats, etc.'),
248		'help' => 'General Admin',
249	],
250	"features" => [
251		'title' => tr('Features'),
252		'description' => tr('Switches for major features'),
253		'help' => 'Features Admin',
254	],
255	"login" => [
256		'title' => tr('Log in'),
257		'description' => tr('User registration, remember me cookie settings and authentication methods'),
258		'help' => 'Login Config',
259	],
260	"user" => [
261		'title' => tr('User Settings'),
262		'description' => tr('User related preferences like info and picture, features, messages and notification, files, etc'),
263		'help' => 'User Settings',
264	],
265	"profiles" => [
266		'title' => tr('Profiles'),
267		'description' => tr('Repository configuration, browse and apply profiles'),
268		'help' => 'Profiles',
269	],
270	"look" => [
271		'title' => tr('Look & Feel'),
272		'description' => tr('Theme selection, layout settings and UI effect controls'),
273		'help' => 'Look and Feel',
274	],
275	"textarea" => [
276		'title' => tr('Editing and Plugins'),
277		'description' => tr('Text editing settings applicable to many areas. Plugin activation and plugin alias management'),
278		'help' => 'Text area',
279	],
280	"module" => [
281		'title' => tr('Modules'),
282		'description' => tr('Module appearance settings'),
283		'help' => 'Module',
284	],
285	"i18n" => [
286		'title' => tr('i18n'),
287		'description' => tr('Internationalization and localization - multilingual features'),
288		'help' => 'i18n',
289	],
290	"metatags" => [
291		'title' => tr('Meta Tags'),
292		'description' => tr('Information to include in the header of each page'),
293		'help' => 'Meta Tags',
294	],
295	"maps" => [
296		'title' => tr('Maps'),
297		'description' => tr('Settings and features for maps'),
298		'help' => 'Maps',
299		'disabled' => false,
300	],
301	"performance" => [
302		'title' => tr('Performance'),
303		'description' => tr('Server performance settings'),
304		'help' => 'Performance',
305	],
306	"security" => [
307		'title' => tr('Security'),
308		'description' => tr('Site security settings'),
309		'help' => 'Security',
310	],
311	"comments" => [
312		'title' => tr('Comments'),
313		'description' => tr('Comments settings'),
314		'help' => 'Comments',
315	],
316	"rss" => [
317		'title' => tr('Feeds'),
318		'help' => 'Feeds User',
319		'description' => tr('Outgoing RSS feed setup'),
320	],
321	"connect" => [
322		'title' => tr('Connect'),
323		'help' => 'Connect',
324		'description' => tr('Tiki Connect - join in!'),
325	],
326	"rating" => [
327		'title' => tr('Rating'),
328		'help' => 'Rating',
329		'description' => tr('Rating settings'),
330		'disabled' => $prefs['wiki_simple_ratings'] !== 'y' &&
331						$prefs['wiki_comments_simple_ratings'] !== 'y' &&
332						$prefs['comments_vote'] !== 'y' &&
333						$prefs['rating_advanced'] !== 'y' &&
334						$prefs['trackerfield_rating'] !== 'y' &&
335						$prefs['article_user_rating'] !== 'y' &&
336						$prefs['rating_results_detailed'] !== 'y' &&
337						$prefs['rating_smileys'] !== 'y',
338	],
339	"search" => [
340		'title' => tr('Search'),
341		'description' => tr('Search configuration'),
342		'help' => 'Search',
343		'disabled' => $prefs['feature_search'] !== 'y' &&
344						$prefs['feature_search_fulltext'] !== 'y',
345	],
346	"wiki" => [
347		'title' => tr('Wiki'),
348		'disabled' => $prefs['feature_wiki'] != 'y',
349		'description' => tr('Wiki page settings and features'),
350		'help' => 'Wiki Config',
351	],
352	"fgal" => [
353		'title' => tr('File Galleries'),
354		'disabled' => $prefs['feature_file_galleries'] != 'y',
355		'description' => tr('Defaults and configuration for file galleries'),
356		'help' => 'File Gallery',
357	],
358	"blogs" => [
359		'title' => tr('Blogs'),
360		'disabled' => $prefs['feature_blogs'] != 'y',
361		'description' => tr('Settings for blogs'),
362		'help' => 'Blog',
363	],
364	"gal" => [
365		'title' => tr('Image Galleries'),
366		'disabled' => $prefs['feature_galleries'] != 'y',
367		'description' => tr('Defaults and configuration for image galleries (will be phased out in favour of file galleries)'),
368		'help' => 'Image Gallery',
369	],
370	"articles" => [
371		'title' => tr('Articles'),
372		'disabled' => $prefs['feature_articles'] != 'y',
373		'description' => tr('Settings and features for articles'),
374		'help' => 'Articles',
375	],
376	"forums" => [
377		'title' => tr('Forums'),
378		'disabled' => $prefs['feature_forums'] != 'y',
379		'description' => tr('Settings and features for forums'),
380		'help' => 'Forums-Admin',
381	],
382	"trackers" => [
383		'title' => tr('Trackers'),
384		'disabled' => $prefs['feature_trackers'] != 'y',
385		'description' => tr('Settings and features for trackers'),
386		'help' => 'Trackers-Admin',
387	],
388	"polls" => [
389		'title' => tr('Polls'),
390		'disabled' => $prefs['feature_polls'] != 'y',
391		'description' => tr('Settings and features for polls'),
392		'help' => 'Polls',
393	],
394	"calendar" => [
395		'title' => tr('Calendar'),
396		'disabled' => $prefs['feature_calendar'] != 'y',
397		'description' => tr('Settings and features for calendars'),
398		'help' => 'Calendar',
399	],
400	"category" => [
401		'title' => tr('Categories'),
402		'disabled' => $prefs['feature_categories'] != 'y',
403		'description' => tr('Settings and features for categories'),
404		'help' => 'Categories-Admin',
405	],
406	"workspace" => [
407		'title' => tr('Workspaces'),
408		'disabled' => $prefs['workspace_ui'] != 'y' && $prefs['feature_areas'] != 'y',
409		'description' => tr('Configure workspace feature'),
410		'help' => 'Workspace',
411	],
412	"score" => [
413		'title' => tr('Score'),
414		'disabled' => $prefs['feature_score'] != 'y',
415		'description' => tr('Values of actions for users rank score'),
416		'help' => 'Score',
417	],
418	"freetags" => [
419		'title' => tr('Tags'),
420		'disabled' => $prefs['feature_freetags'] != 'y',
421		'description' => tr('Settings and features for tags'),
422		'help' => 'Tags',
423	],
424	"faqs" => [
425		'title' => tr('FAQs'),
426		'disabled' => $prefs['feature_faqs'] != 'y',
427		'description' => tr('Settings and features for FAQs'),
428		'help' => 'FAQ',
429	],
430	"directory" => [
431		'title' => tr('Directory'),
432		'disabled' => $prefs['feature_directory'] != 'y',
433		'description' => tr('Settings and features for directory of links'),
434		'help' => 'Directory',
435	],
436	"copyright" => [
437		'title' => tr('Copyright'),
438		'disabled' => $prefs['feature_copyright'] != 'y',
439		'description' => tr('Site-wide copyright information'),
440		'help' => 'Copyright',
441	],
442	"messages" => [
443		'title' => tr('Messages'),
444		'disabled' => $prefs['feature_messages'] != 'y',
445		'description' => tr('Message settings'),
446		'help' => 'Inter-User Messages',
447	],
448	"webmail" => [
449		'title' => tr('Webmail'),
450		'disabled' => $prefs['feature_webmail'] != 'y',
451		'description' => tr('Webmail settings'),
452		'help' => 'Webmail',
453		'url' => 'tiki-webmail.php?page=settings'
454	],
455	"wysiwyg" => [
456		'title' => tr('Wysiwyg'),
457		'disabled' => $prefs['feature_wysiwyg'] != 'y',
458		'description' => tr('Options for WYSIWYG editor'),
459		'help' => 'Wysiwyg',
460	],
461	"ads" => [
462		'title' => tr('Banners'),
463		'disabled' => $prefs['feature_banners'] != 'y',
464		'description' => tr('Site advertisements and notices'),
465		'help' => 'Banner-Admin',
466	],
467	"intertiki" => [
468		'title' => tr('InterTiki'),
469		'disabled' => $prefs['feature_intertiki'] != 'y',
470		'description' => tr('Set up links between Tiki servers'),
471		'help' => 'InterTiki',
472	],
473	"semantic" => [
474		'title' => tr('Semantic Links'),
475		'disabled' => $prefs['feature_semantic'] != 'y',
476		'description' => tr('Manage semantic wiki links'),
477		'help' => 'Semantic Admin',
478	],
479	"webservices" => [
480		'title' => tr('Webservices'),
481		'disabled' => $prefs['feature_webservices'] != 'y',
482		'description' => tr('Register and manage web services'),
483		'help' => 'WebServices',
484	],
485	"sefurl" => [
486		'title' => tr('SEF URL'),
487		'disabled' => $prefs['feature_sefurl'] != 'y' && $prefs['feature_canonical_url'] != 'y',
488		'description' => tr('Search Engine Friendly URLs'),
489		'help' => 'Search-Engine-Friendly-URL',
490	],
491	"video" => [
492		'title' => tr('Video'),
493		'disabled' => $prefs['feature_kaltura'] != 'y',
494		'description' => tr('Video integration configuration'),
495		'help' => 'Video-Admin',
496	],
497	"payment" => [
498		'title' => tr('Payment'),
499		'disabled' => $prefs['payment_feature'] != 'y',
500		'description' => tr('Payment settings'),
501		'help' => 'Payment',
502	],
503	"socialnetworks" => [
504		'title' => tr('Social networks'),
505		'disabled' => $prefs['feature_socialnetworks'] != 'y',
506		'description' => tr('Configure social networks integration'),
507		'help' => 'Social Networks',
508	],
509	"community" => [
510		'title' => tr('Community'),
511		'description' => tr('User specific features and settings'),
512		'help' => 'Community',
513	],
514	"share" => [
515		'title' => tr('Share'),
516		'disabled' => $prefs['feature_share'] != 'y',
517		'description' => tr('Configure share feature'),
518		'help' => 'Share',
519	],
520	"stats" => [
521		'title' => tr('Statistics'),
522//		'disabled' => $prefs['feature_stats'] != 'y',
523		'description' => tr('Configure statistics reporting for your site usage'),
524		'help' => 'Statistics-Admin',
525	],
526	"print" => [
527		'title' => tr('Print Settings'),
528		'description' => tr('Settings and features for print versions and pdf generation'),
529		'help' => 'Print Setting-Admin',
530	],
531	"packages" => [
532		'title' => tr('Packages'),
533		'description' => tr('External packages installation and management'),
534		'help' => 'Packages',
535	],
536	"rtc" => [
537		'title' => tr('RTC'),
538		'description' => tr('Real-time collaboration tools'),
539		'help' => 'RTC',
540	],
541];
542
543if (isset($_REQUEST['page'])) {
544	$adminPage = $_REQUEST['page'];
545	// Check if the associated incude_*.php file exists. If not, check to see if it might exist in the Addons.
546	// If it exists, include the associated file
547	$utilities = new \Tiki\Package\Extension\Utilities();
548	if (file_exists("admin/include_$adminPage.php")) {
549		include_once("admin/include_$adminPage.php");
550	} elseif ($filepath = $utilities->getExtensionFilePath("admin/include_$adminPage.php")) {
551		include_once($filepath);
552	}
553	$url = 'tiki-admin.php' . '?page=' . $adminPage;
554
555	if (isset($admin_icons[$adminPage])) {
556		$admin_icon = $admin_icons[$adminPage];
557
558		$admintitle = $admin_icon['title'];
559		$description = isset($admin_icon['description']) ? $admin_icon['description'] : '';
560		$helpUrl = isset($admin_icon['help']) ? $admin_icon['help'] : '';
561	}
562	$helpDescription = tr("Help on %0 Config", $admintitle);
563
564	$smarty->assign('include', $adminPage);
565	$smarty->assign('template_not_found', 'n');
566	if (substr($adminPage, 0, 3) == 'tp_' && ! file_exists("admin/include_$adminPage.tpl")) {
567		$packageAdminTplFile = $utilities->getExtensionFilePath("templates/admin/include_$adminPage.tpl");
568		if (! file_exists($packageAdminTplFile)) {
569			$smarty->assign('include', 'extension_package_missing_page');
570		}
571		if (! ExtensionManager::isExtensionEnabled(str_replace("_", "/", substr($adminPage, 3)))) {
572			$smarty->assign('include', 'extension_package_inactive');
573		}
574	} elseif (! file_exists("templates/admin/include_$adminPage.tpl")) {
575		// Graceful error management when URL is wrong for admin panel
576		$smarty->assign('template_not_found', 'y');
577	} else {
578		$smarty->assign('template_not_found', 'n');
579	}
580
581	//for most admin include page forms, need to redirect as changes to one pref can affect display of others
582	//however other forms that perform actions other than changing preferences should not redirect to avoid infinite loops
583	//for these add a hidden input named redirect with a value of 0
584	if ($access->csrfResult() && (! isset($_POST['redirect']) || $_POST['redirect'] === 1)
585		&& ! isset($_POST['saveblacklist']) && ! isset($_POST['viewblacklist']))
586	{
587		$access->redirect($_SERVER['REQUEST_URI'], '', 200);
588	}
589} else {
590	$smarty->assign('include', 'list_sections');
591	$smarty->assign('admintitle', 'Control Panels');
592	$smarty->assign('description', 'Home Page for Administrators');
593	$smarty->assign('headtitle', breadcrumb_buildHeadTitle($crumbs));
594	$smarty->assign('description', $crumbs[0]->description);
595}
596$headerlib->add_cssfile('themes/base_files/feature_css/admin.css');
597if (isset($admintitle) && isset($description)) {
598	$crumbs[] = new Breadcrumb($admintitle, $description, $url, $helpUrl, $helpDescription);
599	$smarty->assign_by_ref('admintitle', $admintitle);
600	$headtitle = breadcrumb_buildHeadTitle($crumbs);
601	$smarty->assign_by_ref('headtitle', $headtitle);
602	$smarty->assign_by_ref('helpUrl', $helpUrl);
603	$smarty->assign_by_ref('description', $description);
604}
605
606// VERSION TRACKING
607$forcecheck = ! empty($_GET['forcecheck']);
608
609// Versioning feature has been enabled, so if the time is right, do a live
610// check, otherwise display the stored data.
611if ($prefs['feature_version_checks'] == 'y' || $forcecheck) {
612	$versionUtils = new Tiki_Version_Utils();
613	$upgrades = $versionUtils->checkUpdatesForVersion($TWV->version);
614
615	$smarty->assign('upgrade_messages', $upgrades);
616}
617
618foreach ($admin_icons as &$admin_icon) {
619	$admin_icon = array_merge([ 'disabled' => false, 'description' => ''], $admin_icon);
620}
621
622// SSL setup
623$haveMySQLSSL = $tikilib->haveMySQLSSL();
624$smarty->assign('haveMySQLSSL', $haveMySQLSSL);
625if ($haveMySQLSSL) {
626	$isSSL = $tikilib->isMySQLConnSSL();
627} else {
628	$isSSL = false;
629}
630$smarty->assign('mysqlSSL', $isSSL);
631
632$smarty->assign('admin_icons', $admin_icons);
633
634$show_warning = $adminlib->checkSystemConfigurationFile();
635$smarty->assign('show_system_configuration_warning', $show_warning);
636
637// disallow robots to index page:
638$smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW');
639// Display the template
640$smarty->assign('adminpage', $adminPage);
641$smarty->assign('mid', 'tiki-admin.tpl');
642$smarty->assign('trail', $crumbs);
643$smarty->assign('crumb', count($crumbs) - 1);
644
645if (file_exists(__DIR__ . '/vendor/autoload.php')) {
646	if (file_exists(__DIR__ . '/vendor/do_not_clean.txt')
647		|| ! ( // check the existence of critical files denoting a legacy vendor folder
648			(file_exists(__DIR__ . '/vendor/zendframework/zend-config/src/Config.php') //ZF2
649				|| file_exists(__DIR__ . '/vendor/bombayworks/zendframework1/library/Zend/Config.php')) //ZF1
650			&& (file_exists(__DIR__ . '/vendor/smarty/smarty/libs/Smarty.class.php') //Smarty
651				|| file_exists(__DIR__ . '/vendor/smarty/smarty/distribution/libs/Smarty.class.php')) //Smarty
652			&& file_exists(__DIR__ . '/vendor/adodb/adodb/adodb.inc.php') //Adodb
653		)) {
654		$vendorAutoloadIgnored = false;
655	} else {
656		$vendorAutoloadIgnored = true;
657	}
658} else {
659	$vendorAutoloadIgnored = false;
660}
661
662if (file_exists(__DIR__ . '/vendor/autoload-disabled.php')) {
663	$vendorAutoloadDisabled = true;
664} else {
665	$vendorAutoloadDisabled = false;
666}
667
668$smarty->assign('fgal_web_accessible', false);
669if ($prefs['fgal_use_dir'] && $prefs['fgal_use_db'] === 'n') {
670	$smarty->assign('fgal_web_accessible', $access->isFileWebAccessible($prefs['fgal_use_dir']. 'index.php'));
671}
672$smarty->assign('vendor_autoload_ignored', $vendorAutoloadIgnored);
673$smarty->assign('vendor_autoload_disabled', $vendorAutoloadDisabled);
674
675include_once('installer/installlib.php');
676$installer = Installer::getInstance();
677$smarty->assign('db_requires_update', $installer->requiresUpdate());
678$smarty->assign('installer_not_locked', $installer->checkInstallerLocked());
679$smarty->assign('search_index_outdated', \TikiLib::lib('unifiedsearch')->isOutdated());
680
681$smarty->display('tiki.tpl');
682