1<?php
2/*
3 * e107 website system
4 *
5 * Copyright (C) 2008-2013 e107 Inc (e107.org)
6 * Released under the terms and conditions of the
7 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
8 *
9 * Administration - Site Preferences
10 *
11 */
12
13if(!empty($_POST) && !isset($_POST['e-token']))
14{
15	$_POST['e-token'] = '';
16}
17require_once ("../class2.php");
18
19if(isset($_POST['newver']))
20{
21	header("location:http://e107.org/index.php");
22	exit();
23}
24
25if(!getperms("1"))
26{
27	e107::redirect('admin');
28	exit();
29}
30
31e107::coreLan('prefs', true);
32
33$e_sub_cat = 'prefs';
34//e107::lan('core','mailout','admin');
35e107::coreLan('mailout', true);
36
37
38require_once (e_ADMIN."auth.php");
39
40$e_userclass = e107::getUserClass();
41require_once (e_HANDLER."user_extended_class.php");
42require_once(e_HANDLER.'mailout_admin_class.php');		// Admin tasks handler
43$ue = new e107_user_extended();
44$core_pref = e107::getConfig();
45
46if(!$core_pref->get('timezone'))
47{
48	$core_pref->set('timezone', 'UTC');
49}
50
51$frm = e107::getForm(false, true); //enable inner tabindex counter
52$mes = e107::getMessage();
53$tp = e107::getParser();
54
55/*	RESET DISPLAY NAMES	*/
56if(isset($_POST['submit_resetdisplaynames']))
57{
58	e107::getDb()->update('user', 'user_name=user_loginname');
59	$mes->addInfo(PRFLAN_157);
60}
61
62//echo '<pre>';
63//var_dump($core_pref->getPref());
64//echo '</pre>';
65
66if (isset($_POST['testemail']))
67{
68	sendTest();
69}
70
71
72
73
74
75
76/*	UPDATE PREFERENCES */
77if(isset($_POST['updateprefs']))
78{
79
80
81
82	unset($_POST['updateprefs'], $_POST['sitelanguage']);
83
84
85
86	$_POST['cookie_name'] = str_replace(array(" ", "."), "_", $_POST['cookie_name']);
87	$_POST['cookie_name'] = preg_replace("#[^a-zA-Z0-9_]#", "", $_POST['cookie_name']);
88
89	$_POST['siteurl'] = trim($_POST['siteurl']) ? trim($_POST['siteurl']) : SITEURL;
90	$_POST['siteurl'] = substr($_POST['siteurl'], - 1) == "/" ? $_POST['siteurl'] : $_POST['siteurl']."/";
91
92	// If email verification or Email/Password Login Method - email address is required!
93	if (($_POST['user_reg_veri'] == 1 || $_POST['allowEmailLogin'] == 1) && $_POST['disable_emailcheck'])
94	{
95		$_POST['disable_emailcheck'] = 0;
96		$mes->addError(PRFLAN_211);
97    }
98
99
100	if(!empty($_POST['passwordEncoding']) || !empty($_POST['ssl_enabled']))
101	{
102		$_POST['password_CHAP'] = 0; // disable chap unless using md5 without SSL.
103	}
104
105	// Table of range checking values - min and max for numerics. Only do the important ones
106	$pref_limits = array('loginname_maxlength' => array('min' => 10, 'max' => 100, 'default' => 30),
107					'displayname_maxlength' => array('min' => 5, 'max' => 100, 'default' => 15),
108					'antiflood_timeout' => array('min' => 3, 'max' => 300, 'default' => 10),
109					'signup_pass_len' => array('min' => 2, 'max' => 100, 'default' => 4)
110					);
111
112	$pref['post_html'] = intval($_POST['post_html']);			// This ensures the setting is reflected in set text
113
114
115	$smtp_opts = array();
116
117	if(!empty($_POST['smtp_options']))
118	{
119
120		switch (trim($_POST['smtp_options']))
121		{
122			case 'smtp_ssl' :
123				$smtp_opts[] = 'secure=SSL';
124				break;
125			case 'smtp_tls' :
126				$smtp_opts[] = 'secure=TLS';
127				break;
128			case 'smtp_pop3auth' :
129				$smtp_opts[] = 'pop3auth';
130				break;
131		}
132
133		if (!empty($_POST['smtp_keepalive']))
134		{
135			$smtp_opts[] = 'keepalive';
136		}
137
138		if (!empty($_POST['smtp_useVERP']))
139		{
140			$smtp_opts[] = 'useVERP';
141		}
142
143		$_POST['smtp_options'] = implode(',',$smtp_opts);
144
145		unset($_POST['smtp_keepalive'],$_POST['smtp_useVERP']);
146
147		// e107::getMessage()->addDebug(print_a($_POST['smtp_options'],true));
148	}
149
150
151
152
153
154	$_POST['membersonly_exceptions'] = explode("\n",$_POST['membersonly_exceptions']);
155
156	// FIXME - automate - pref model & validation handler
157	$prefChanges = array();
158	$sessionRegenerate = false;
159	foreach($_POST as $key => $value)
160	{
161		if(isset($pref_limits[$key]))
162		{ // Its a numeric value to check
163			if(is_numeric($value))
164			{
165				if($value < $pref_limits[$key]['min'])
166				{
167					$value = $pref_limits[$key]['min'];
168					$mes->addWarning(str_replace(array('[x]','[y]'),array($key,$value),PRFLAN_213));
169				}
170				if($value > $pref_limits[$key]['max'])
171				{
172					$value = $pref_limits[$key]['max'];
173					$mes->addWarning(str_replace(array('[x]','[y]'),array($key,$value),PRFLAN_212));
174				}
175			}
176			else
177			{
178				$value = $pref_limits[$key]['default'];
179			}
180			$newValue = $value;
181		}
182		elseif('cookie_name' == $key && $core_pref->get($key) != $value)
183		{
184			// special case
185			if(!preg_match('/^[\w\-]+$/', $value))
186			{
187				$newValue = e_COOKIE;
188				$mes->addWarning(PRFLAN_219);
189			}
190			else
191			{
192				$newValue = $value;
193				$sessionRegenerate = true;
194			}
195		}
196		else
197		{
198			$newValue = $tp->toDB($value);
199		}
200
201		$core_pref->update($key, $newValue);
202	}
203
204	if($core_pref->dataHasChanged())
205	{
206		// Need to clear cache in order to refresh library information.
207		e107::getCache()->clearAll('system');
208	}
209
210	$core_pref->save(false);
211
212	// special case, do session cleanup, logout, redirect to login screen
213	if($sessionRegenerate)
214	{
215		// reset cookie
216		cookie($core_pref->get('cookie_name'), $_COOKIE[e_COOKIE], (time() + 3600 * 24 * 30), e_HTTP, e107::getLanguage()->getCookieDomain());
217		cookie(e_COOKIE, null, null);
218
219		// regenerate session
220		$s = $_SESSION;
221		e107::getSession()->destroy();
222		$session = new e_core_session(array('name' => $core_pref->get('cookie_name')));
223		$_SESSION = $s;
224	}
225}
226
227if (e107::isInstalled('alt_auth'))
228{
229	$authlist[] = "e107";
230	$handle = opendir(e_PLUGIN."alt_auth");
231	while($file = readdir($handle))
232	{
233		if(preg_match("/^(.*)_auth\.php/", $file, $match))
234		{
235			$authlist[] = $match[1];
236		}
237	}
238}
239
240
241
242function sendTest()
243{
244	$log = e107::getAdminLog();
245	$mes = e107::getMessage();
246
247	if(trim($_POST['testaddress']) == '')
248	{
249		$mes->add(LAN_MAILOUT_19, E_MESSAGE_ERROR);
250		$subAction = 'error';
251	}
252	else
253	{
254		$mailheader_e107id = USERID;
255		$pref = e107::pref('core');
256
257		$add = ($pref['mailer']) ? " (".strtoupper($pref['mailer']).") " : ' (PHP)';
258
259		if($pref['mailer'] == 'smtp')
260		{
261			$add .= "Port: ".varset($pref['smtp_port'],25);
262			$add .= " - ".str_replace("secure=", "", $pref['smtp_options']);
263		}
264
265
266		$sendto = trim($_POST['testaddress']);
267
268
269		$eml = array();
270
271		$eml['email_subject']		= LAN_MAILOUT_113." ".$add;
272		$eml['email_sender_email']	= null;
273		$eml['email_sender_name']	= null;
274		$eml['email_replyto']		= null;
275		$eml['email_replytonames']	= null;
276		$eml['send_html']			= true;
277		$eml['add_html_header'] 	= null;
278		$eml['email_body']			= str_replace("[br]", "<br>", LAN_MAILOUT_114);
279		$eml['email_attach']		= null;
280		$eml['template']			= 'default';
281		$eml['e107_header']			= USERID;
282
283		if (!e107::getEmail()->sendEmail($sendto, LAN_MAILOUT_189, $eml))
284		{
285			$mes->addError(($pref['mailer'] == 'smtp')  ? LAN_MAILOUT_67 : LAN_MAILOUT_106);
286		}
287	//	if (!sendemail($sendto, LAN_MAILOUT_113." ".SITENAME.$add, str_replace("[br]", "\n", LAN_MAILOUT_114),LAN_MAILOUT_189))
288	//	{
289	//		$mes->addError(($pref['mailer'] == 'smtp')  ? LAN_MAILOUT_67 : LAN_MAILOUT_106);
290	//	}
291		else
292		{
293			$mes->addSuccess(LAN_MAILOUT_81. ' ('.$sendto.')');
294			$log->log_event('MAIL_01',$sendto,E_LOG_INFORMATIVE,'');
295		}
296	}
297
298}
299
300/*
301if(e_QUERY == "u")
302{
303	$ns->tablerender("", "<div style='text-align:center'><b>".PRFLAN_106."</b></div>");
304}
305*/
306$handle = opendir(e_ADMIN.'includes/');
307while($file = readdir($handle))
308{
309	if($file != "." && $file != "..")
310	{
311		$file = str_replace(".php", "", $file);
312		$adminlist[] = $file;
313	}
314}
315closedir($handle);
316
317$pref['membersonly_exceptions'] = implode("\n",$pref['membersonly_exceptions']);
318
319$text = "
320<div id='core-prefs'>
321	<form class='admin-menu' method='post' action='".e_SELF."' autocomplete='off'>
322	<input type='hidden' name='e-token' value='".e_TOKEN."' />
323		<fieldset id='core-prefs-main'>
324			<legend>".PRFLAN_1."</legend>
325			<table class='table adminform'>
326				<colgroup>
327					<col class='col-label' />
328					<col class='col-control' />
329				</colgroup>
330				<tbody>
331					<tr>
332						<td><label for='sitename'>".PRFLAN_2."</label></td>
333						<td>
334							".$frm->text('sitename', $pref['sitename'], 100, 'required=1&size=xxlarge')."
335						</td>
336					</tr>
337					<tr>
338						<td><label for='siteurl'>".PRFLAN_3."</label></td>
339						<td>
340							".$frm->text('siteurl', $pref['siteurl'], 150, 'size=xxlarge')."
341							".($pref['siteurl'] == SITEURL ? "" : "<div class='field-help'>".PRFLAN_159.": <strong>".SITEURL."</strong></div>")."
342						</td>
343					</tr>
344					<tr>
345						<td><label for='redirectsiteurl'>".PRFLAN_134."</label></td>
346						<td>";
347						/*
348							".$frm->radio('redirectsiteurl', 1, $pref['redirectsiteurl'], array('label'=>LAN_ENABLED))."
349							".$frm->radio('redirectsiteurl', 0, !$pref['redirectsiteurl'], array('label'=>LAN_DISABLED))."
350						*/
351						$text .= $frm->radio_switch('redirectsiteurl', $pref['redirectsiteurl'])."<div class='field-help'>".PRFLAN_135."</div>
352						</td>
353					</tr>
354					<tr>
355						<td><label for='sitebutton'>".PRFLAN_4."</label></td>
356						<td>
357";
358/*
359$parms = "name=sitebutton";
360$parms .= "&path=".e_THEME.$pref['sitetheme']."/images/|".e_IMAGE;
361$parms .= "&filter=0";
362$parms .= "&fullpath=1";
363$parms .= "&default=".urlencode($pref['sitebutton']);
364//$parms .= "&width=128px";
365//$parms .= "&height=128px";
366$parms .= "&multiple=FALSE";
367$parms .= "&label=-- No Image --";
368$parms .= "&subdirs=1";
369$parms .= "&tabindex=".$frm->getNext();
370
371
372$text .= "<div class='field-section'>".$tp->parseTemplate("{IMAGESELECTOR={$parms}&scaction=select}")."</div>";
373// $text .= "<div class='field-section'>".$frm->imagepicker('sitebutton',$pref['sitebutton'],'-- No Image --')."</div>";
374
375//TODO make the preview update when image-picker is used.
376$text .= "<div class='field-spacer'>".$tp->parseTemplate("{IMAGESELECTOR={$parms}&scaction=preview}")."</div>";
377
378$sLogo = siteinfo_shortcodes::sc_logo();
379*/
380
381if(!empty($pref['sitebutton']) && strpos($pref['sitebutton'],'{')===false && file_exists(e_IMAGE.$pref['sitebutton']))
382{
383	$pref['sitebutton'] = '{e_IMAGE}'.$pref['sitebutton'];
384}
385
386
387
388$text .= $frm->imagepicker('sitebutton',$pref['sitebutton'],'','w=200&help='.PRFLAN_225); //todo  use 'LegacyPath' option instead of code above.
389
390$text .= "
391						</td>
392					</tr>
393					<tr>
394						<td><label for='sitelogo'>".PRFLAN_214."</label></td>
395						<td>".$frm->imagepicker('sitelogo',$pref['sitelogo'],'','w=200&help='.PRFLAN_226)."</td>
396					</tr>
397					<tr>
398						<td><label for='sitetag'>".PRFLAN_5."</label></td>
399						<td>
400							".$frm->textarea('sitetag', $tp->toForm($pref['sitetag']), 3, 59, array('size'=>'xxlarge'))."
401							<div class='field-help'>".PRFLAN_227."</div>
402						</td>
403					</tr>
404					<tr>
405						<td><label for='sitedescription'>".PRFLAN_6."</label></td>
406						<td>
407							".$frm->textarea('sitedescription', $tp->toForm($pref['sitedescription']), 3, 80, array('size'=>'xxlarge'))."
408							<div class='field-help'>".PRFLAN_228."</div>
409						</td>
410					</tr>
411
412					<tr>
413						<td><label for='sitedisclaimer'>".PRFLAN_9."</label></td>
414						<td>
415							".$frm->textarea('sitedisclaimer',$tp->toForm( $pref['sitedisclaimer']), 3, 80, array('size'=>'xxlarge'))."
416							<div class='field-help'>".PRFLAN_229."</div>
417						</td>
418					</tr>
419				</tbody>
420			</table>
421			".pref_submit('main')."
422		</fieldset>
423";
424
425
426// Email and Contact Information --------------
427
428$text .= "<fieldset class='e-hideme' id='core-prefs-email'>
429			<legend>".PRFLAN_13."</legend>
430			<table class='table adminform'>
431				<colgroup>
432					<col class='col-label' />
433					<col class='col-control' />
434				</colgroup>
435				<tbody>
436				<tr>
437					<td><label for='siteadmin'>".PRFLAN_7."</label></td>
438					<td>
439						".$frm->text('siteadmin', SITEADMIN, 100, array('size'=>'xlarge'))."
440					</td>
441					</tr>
442					<tr>
443						<td><label for='siteadminemail'>".PRFLAN_8."</label></td>
444						<td>
445							".$frm->text('siteadminemail', SITEADMINEMAIL, 100, array('size'=>'xlarge'))."
446						</td>
447					</tr>
448					<tr>
449						<td><label for='replyto-name'>".PRFLAN_174."</label></td>
450						<td>
451							".$frm->text('replyto_name', $pref['replyto_name'], 100, array('size'=>'xlarge'))."
452							<div class='smalltext field-help'>".PRFLAN_175."</div>
453						</td>
454					</tr>
455					<tr>
456						<td><label for='replyto-email'>".PRFLAN_176."</label></td>
457						<td>
458							".$frm->text('replyto_email', $pref['replyto_email'], 100, array('size'=>'xlarge'))."
459							<div class='smalltext field-help'>".PRFLAN_177."</div>
460						</td>
461					</tr>
462
463
464					<tr>
465						<td><label for='testaddress'>".LAN_MAILOUT_110."</label><br /></td>
466						<td class='form-inline'>".$frm->admin_button('testemail', LAN_MAILOUT_112,'other')."&nbsp;
467							<input name='testaddress' id='testaddress' class='tbox form-control input-xxlarge' placeholder='user@yoursite.com' type='text' size='40' maxlength='80' value=\"".(varset($_POST['testaddress']) ? $_POST['testaddress'] : USEREMAIL)."\" />
468						</td>
469					</tr>
470
471					<tr>
472						<td style='vertical-align:top'><label for='mailer'>".PRFLAN_267."</label><br /></td>
473						<td>";
474
475
476				$text .= mailoutAdminClass::mailerPrefsTable($pref);
477
478
479				$text .="</td>
480				</tr>
481
482
483				<tr>
484					<td><label for='mail-sendstyle'>".LAN_MAILOUT_222."</label></td>
485					<td>";
486
487				$emFormat = array(
488					'textonly' => LAN_MAILOUT_125,
489					'texthtml' => LAN_MAILOUT_126,
490					'texttheme' => LAN_MAILOUT_127
491				);
492				$text .= $frm->select('mail_sendstyle', $emFormat, vartrue($pref['mail_sendstyle']));
493				$text .= "
494					</td>
495				</tr>
496
497
498					<tr>
499						<td><label for='sitecontactinfo'>".PRFLAN_162."</label></td>
500						<td>
501							".$frm->textarea('sitecontactinfo', $pref['sitecontactinfo'], 6, 59, array('size'=>'xxlarge'))."
502							<div class='smalltext field-help'>".PRFLAN_163."</div>
503						</td>
504					</tr>
505					<tr>
506						<td><label for='sitecontacts'>".PRFLAN_168."</label></td>
507						<td>
508							".$e_userclass->uc_dropdown('sitecontacts', $pref['sitecontacts'], 'nobody,main,admin,classes', "tabindex='".$frm->getNext()."'")."
509							<div class='smalltext field-help'>".PRFLAN_169."</div>
510						</td>
511					</tr>
512					<tr>
513						<td><label for='contact_visibility'>".PRFLAN_258."</label></td>
514						<td>
515							".$e_userclass->uc_dropdown('contact_visibility', varset( $pref['contact_visibility'],e_UC_PUBLIC), null, "tabindex='".$frm->getNext()."'")."
516							<div class='smalltext field-help'>".PRFLAN_274."</div>
517						</td>
518					</tr>
519
520					<tr>
521						<td><label for='contact-filter'>".PRFLAN_270."</label></td>
522						<td>
523							".$frm->textarea('contact_filter', $pref['contact_filter'], 5, 59, array('size'=>'xxlarge'))."
524							<div class='smalltext field-help'>".PRFLAN_271."</div>
525						</td>
526					</tr>
527
528
529
530					<tr>
531						<td><label for='contact-emailcopy'>".PRFLAN_164."</label></td>
532						<td>";
533						/*
534							".$frm->radio('contact_emailcopy', 1, $pref['contact_emailcopy'])."
535							".$frm->label(LAN_ENABLED, 'contact_emailcopy', 1)."&nbsp;&nbsp;
536							".$frm->radio('contact_emailcopy', 0, !$pref['contact_emailcopy'])."
537							".$frm->label(LAN_DISABLED, 'contact_emailcopy', 0)."
538							<div class='smalltext field-help'>".PRFLAN_165."</div>
539						*/
540					$text .= $frm->radio_switch('contact_emailcopy', $pref['contact_emailcopy'])."<div class='smalltext field-help'>".PRFLAN_165."</div>
541
542
543
544						</td>
545					</tr>
546
547						</tbody>
548			</table>
549			".pref_submit('email')."
550		</fieldset>";
551
552
553// GDPR Settings -----------------------------
554$text .= "
555		<fieldset class='e-hideme' id='core-prefs-gdpr'>
556			<legend>".PRFLAN_277."</legend>
557			<table class='table adminform'>
558				<colgroup>
559					<col class='col-label' />
560					<col class='col-control' />
561				</colgroup>
562				<tbody>
563					<tr>
564						<td><label for='gdpr-privacypolicy'>".PRFLAN_278."</label></td>
565						<td>
566							".$frm->text('gdpr_privacypolicy', $pref['gdpr_privacypolicy'], 200, array('size'=>'xxlarge'))."
567							<div class='smalltext field-help'>".PRFLAN_279."</div>
568						</td>
569					</tr>
570
571					<tr>
572						<td><label for='gdpr-termsandconditions'>".PRFLAN_280."</label></td>
573						<td>
574							".$frm->text('gdpr_termsandconditions', $pref['gdpr_termsandconditions'], 200, array('size'=>'xxlarge'))."
575							<div class='smalltext field-help'>".PRFLAN_279."</div>
576						</td>
577					</tr>
578
579					<tr>
580						<td><label>".LAN_DESCRIPTION."</label></td>
581						<td>
582							<div class='field-help'>".nl2br(PRFLAN_281)."</div>
583						</td>
584					</tr>
585				</tbody>
586			</table>
587			".pref_submit('display')."
588		</fieldset>
589";
590
591
592
593$text .= "
594		<fieldset class='e-hideme' id='core-prefs-display'>
595			<legend>".PRFLAN_13."</legend>
596			<table class='table adminform'>
597				<colgroup>
598					<col class='col-label' />
599					<col class='col-control' />
600				</colgroup>
601				<tbody>
602					<tr>
603						<td><label for='displaythemeinfo'>".PRFLAN_14."</label></td>
604						<td>
605							".$frm->radio_switch('displaythemeinfo', $pref['displaythemeinfo'])."
606						</td>
607					</tr>
608					<tr>
609						<td><label for='displayrendertime'>".PRFLAN_15."</label></td>
610						<td>
611							".$frm->radio_switch('displayrendertime', $pref['displayrendertime'])."
612						</td>
613					</tr>
614					<tr>
615						<td><label for='displaysql'>".PRFLAN_16."</label></td>
616						<td>
617							".$frm->radio_switch('displaysql', $pref['displaysql'])."
618						</td>
619					</tr>
620	";
621if(function_exists("memory_get_usage"))
622{
623	$text .= "
624					<tr>
625						<td><label for='display-memory-usage'>".PRFLAN_137."</label></td>
626						<td>
627							".$frm->radio_switch('display_memory_usage', $pref['display_memory_usage'])."
628						</td>
629					</tr>
630	";
631}
632$text .= "
633				</tbody>
634			</table>
635			".pref_submit('display')."
636		</fieldset>
637";
638
639// Admin Display Areas
640$text .= "
641		<fieldset class='e-hideme' id='core-prefs-admindisp'>
642			<legend>".PRFLAN_77."</legend>
643			<table class='table adminform'>
644				<colgroup>
645					<col class='col-label' />
646					<col class='col-control' />
647				</colgroup>
648				<tbody>
649					<tr>
650						<td><label for='admin-alerts-ok'>".PRFLAN_95."</label></td>
651						<td>
652							".$frm->radio_switch('admin_alerts_ok', $pref['admin_alerts_ok'])."
653							<div class='field-help'>".PRFLAN_96."</div>
654						</td>
655					</tr>
656					<tr>
657						<td><label for='admin-alerts-uniquemenu'>".PRFLAN_97."</label></td>
658						<td>
659							".$frm->radio_switch('admin_alerts_uniquemenu', $pref['admin_alerts_uniquemenu'])."
660							<div class='field-help'>".PRFLAN_98."</div>
661						</td>
662					</tr>";
663					/*<tr>
664						<td>".PRFLAN_199."</td>
665						<td>
666							".$frm->radio_switch('admin_slidedown_subs', $pref['admin_slidedown_subs'])."
667							<div class='field-help'>".PRFLAN_200."</div>
668						</td>
669					</tr>*/
670					$text .= "
671					<tr>
672						<td><label for='admin-separate-plugins'>".PRFLAN_204."</label></td>
673						<td>
674							".$frm->radio_switch('admin_separate_plugins', $pref['admin_separate_plugins'])."
675							<div class='field-help'>".PRFLAN_205."</div>
676						</td>
677					</tr>
678				</tbody>
679			</table>
680			".pref_submit('admindisp')."
681		</fieldset>
682
683	";
684
685// Date options.
686$ga = e107::getDate();
687$date1 = $ga->convert_date(time(), "short");
688$date2 = $ga->convert_date(time(), "long");
689$date3 = $ga->convert_date(time(), "forum");
690//$core_pref$date4 = e107::getDate()->convert(time(),"input");
691$date4 = $tp->toDate(time(),"input");
692
693$text .= "
694		<fieldset class='e-hideme' id='core-prefs-date'>
695			<legend>".PRFLAN_21."</legend>
696			<table class='table adminform'>
697				<colgroup>
698					<col class='col-label' />
699					<col class='col-control' />
700				</colgroup>
701				<tbody>
702					<tr>
703						<td><label for='shortdate'>".PRFLAN_22."</label></td>
704						<td>
705							".$frm->text('shortdate', $pref['shortdate'], 50)."
706							<div class='field-help'>".PRFLAN_83.": {$date1}</div>
707						</td>
708					</tr>
709					<tr>
710						<td><label for='longdate'>".PRFLAN_23."</label></td>
711						<td>
712							".$frm->text('longdate', $pref['longdate'], 50)."
713							<div class='field-help'>".PRFLAN_83.": {$date2}</div>
714						</td>
715					</tr>
716					<tr>
717						<td><label for='forumdate'>".PRFLAN_24."</label></td>
718						<td>
719							".$frm->text('forumdate', $pref['forumdate'], 50)."
720							<div class='field-help'>".PRFLAN_83.": {$date3}</div>
721							<div class='field-help'>".PRFLAN_25." <a target='_blank' href='http://www.php.net/manual/en/function.strftime.php' rel='external'>".PRFLAN_93."</a></div>
722						</td>
723					</tr>";
724
725
726
727					$def = strtotime('December 21, 2012 3:45pm');
728
729					$inputdate = array( // TODO add more formats
730						"%A, %d %B, %Y"	=> strftime("%A, %d %B, %Y",$def),
731						"%A, %d %b, %Y"	=> strftime("%A, %d %b, %Y",$def),
732						"%a, %d %B, %Y"	=> strftime("%a, %d %B, %Y",$def),
733						"%a, %d %b, %Y"	=> strftime("%a, %d %b, %Y",$def),
734
735						"%A, %B %d, %Y"	=> strftime("%A, %B %d, %Y",$def),
736						"%A, %b %d, %Y"	=> strftime("%A, %b %d, %Y",$def),
737						"%A, %b %d, %y"	=> strftime("%A, %b %d, %y",$def),
738
739						"%B %d, %Y"		=> strftime("%B %d, %Y",$def),
740						"%b %d, %Y"		=> strftime("%b %d, %Y",$def),
741						"%b %d, %y"		=> strftime("%b %d, %y",$def),
742
743						"%d %B, %Y"		=> strftime("%d %B, %Y",$def),
744						"%d %b, %Y"		=> strftime("%d %b, %Y",$def),
745						"%d %b, %y"		=> strftime("%d %b, %y",$def),
746
747						"%Y-%m-%d"		=> strftime("%Y-%m-%d",$def),
748						"%d-%m-%Y"		=> strftime("%d-%m-%Y",$def),
749						"%m/%d/%Y"		=> strftime("%m/%d/%Y",$def)
750					);
751
752
753					$inputtime = array();
754
755
756
757
758					$inputtime["%I:%M %p"]	= strftime("%I:%M %p",$def);
759					if(e107::getDate()->supported('P'))
760					{
761						$inputtime["%I:%M %P"]	=  strftime("%I:%M %P",$def);
762					}
763					if(e107::getDate()->supported('l'))
764					{
765						$inputtime["%l:%M %p"]	= strftime("%l:%M %p",$def);
766						$inputtime["%l:%M %P"]	= strftime("%l:%M %P",$def);
767					}
768
769					$inputtime["%H:%M"]		= strftime("%H:%M",$def);
770					$inputtime["%H:%M:%S"]	= strftime("%H:%M:%S",$def);
771
772
773
774
775
776					$text .= "
777					<tr>
778						<td><label for='inputdate'>".PRFLAN_230."</label></td>
779						<td class='form-inline'>
780							".$frm->select('inputdate',$inputdate, e107::getPref('inputdate'));
781
782					$text .= $frm->select('inputtime',$inputtime, e107::getPref('inputtime'));
783
784					$text .= "
785						</td>
786					</tr>";
787
788$timeZones = systemTimeZones();
789
790$text .= "
791					<tr>
792						<td><label for='timezone'>".PRFLAN_56."</label></td>
793						<td>
794							".$frm->select('timezone', $timeZones, vartrue($pref['timezone'], 'UTC'),'size=xlarge')."
795						</td>
796					</tr>
797				</tbody>
798			</table>
799			".pref_submit('date')."
800		</fieldset>
801";
802
803
804// =========== Registration Preferences. ==================
805
806
807
808$elements = array(1=> PRFLAN_259, 2=> PRFLAN_260, 0=>LAN_DISABLED);
809
810
811$text .= "
812		<fieldset class='e-hideme' id='core-prefs-registration'>
813			<legend>".PRFLAN_28."</legend>
814			<table class='table adminform'>
815				<colgroup>
816					<col class='col-label' />
817					<col class='col-control' />
818				</colgroup>
819				<tbody>
820					<tr>
821						<td><label for='user-reg'>".PRFLAN_224."</label></td>
822						<td>
823							".$frm->radio('user_reg', $elements, $pref['user_reg'])."
824							<div class='smalltext field-help'>".PRFLAN_30."</div>
825						</td>
826					</tr>
827
828
829
830					<tr>
831						<td><label for='user-reg-veri'>".PRFLAN_154."</label></td>
832						<td>
833							".$frm->select_open('user_reg_veri', array('size'=>'xlarge'));
834                            $veri_list = array(PRFLAN_152,PRFLAN_31,PRFLAN_153);
835
836							foreach($veri_list as $v => $v_title)
837							{
838								$text .= $frm->option($v_title, $v, ($pref['user_reg_veri'] == $v));
839							}
840
841					$srch = array('[', ']');
842					$repl = array("<a href='".e_ADMIN_ABS."notify.php'>", '</a>');
843
844					$PRFLAN_154a = str_replace($srch,$repl, PRFLAN_154a);
845
846					$text .= "
847							</select>
848							<div class='field-help'>".$PRFLAN_154a."</div>
849						</td>
850					</tr>
851
852					 <tr>
853						<td><label for='allowemaillogin'>".PRFLAN_184."</label></td>
854						<td>".$frm->select_open('allowEmailLogin', array('size'=>'xlarge'));
855                     //   $login_list = array(PRFLAN_201,PRFLAN_202,PRFLAN_203);
856                        $login_list = array(
857	                        2 => PRFLAN_203,
858	                        1 => PRFLAN_202,
859	                        0 => PRFLAN_201
860                        );
861                        foreach($login_list as $l => $l_title)
862						{
863							$text .= $frm->option($l_title, $l, ($pref['allowEmailLogin'] == $l));
864						}
865
866					$text .= "
867							</select></td>
868					</tr>
869					";
870
871					/*
872					 // Highly problematic.
873					$text .= "
874					<tr>
875						<td><label for='signup-remote-emailcheck'>".PRFLAN_160."</label></td>
876						<td>
877							".$frm->radio_switch('signup_remote_emailcheck', $pref['signup_remote_emailcheck'])."
878						</td>
879					</tr>";
880
881					*/
882					$membersOnlyRedirectOptions = array( 'login'=>PRFLAN_264, 'splash'=>PRFLAN_265);
883
884					$text .= "
885
886					<tr>
887						<td><label for='membersonly-enabled'>".PRFLAN_58."</label></td>
888						<td>";
889
890					$memDisp = !vartrue($pref['membersonly_enabled']) ? "e-hideme" : "";
891
892					$text .= $frm->radio_switch('membersonly_enabled', $pref['membersonly_enabled'],'', '', 'class=e-expandit')."
893							<div class='field-help'>".PRFLAN_59."</div>
894							<div class='e-expandit-container {$memDisp}' style='padding-top:10px'>
895							<div class='form-group clearfix'>
896							".
897							$frm->select('membersonly_redirect',$membersOnlyRedirectOptions,$pref['membersonly_redirect'], array('size'=>'xxlarge'))."
898							<div class='field-help'>".PRFLAN_266."</div>
899								</div>
900							<div class='form-group clearfix'>".
901							$frm->textarea('membersonly_exceptions', $pref['membersonly_exceptions'], 3, 1, 'size=xxlarge&placeholder='.PRFLAN_206)."
902							<div class='field-help'>".PRFLAN_207."</div></div>
903
904							</div>
905						</td>
906					</tr>
907
908               		<tr>
909						<td><label for='autologinpostsignup'>".PRFLAN_197."</label></td>
910						<td>
911							".$frm->radio_switch('autologinpostsignup', $pref['autologinpostsignup'])."
912							<div class='smalltext field-help'>".PRFLAN_198."</div>
913						</td>
914					</tr>
915
916					<tr>
917						<td><label for='displayname-maxlength'>".PRFLAN_158.":</label></td>
918						<td>
919							".$frm->number('displayname_maxlength', $pref['displayname_maxlength'], 3)."
920						</td>
921					</tr>
922					<tr>
923						<td><label for='loginname-maxlength'>".PRFLAN_172.":</label></td>
924						<td>
925							".$frm->number('loginname_maxlength', $pref['loginname_maxlength'], 3)."
926						</td>
927					</tr>
928					<tr>
929						<td><label for='signup-pass-len'>".CUSTSIG_16."</label></td>
930						<td>
931							".$frm->number('signup_pass_len', $pref['signup_pass_len'], 2)."
932						</td>
933					</tr>
934
935					<tr>
936						<td><label for='signup-maxip'>".PRFLAN_136."</label></td>
937						<td>
938							".$frm->number('signup_maxip', $pref['signup_maxip'], 3)."
939							<div class='field-help'>".PRFLAN_78."</div>
940						</td>
941					</tr>
942
943
944					</tbody>
945
946
947			</table>
948			".pref_submit('registration')."
949		</fieldset>
950
951	";
952
953
954// Key registration
955
956
957
958
959// Signup options ===========================.
960
961$prefOptionPassword = (isset($pref['signup_option_password'])) ? $pref['signup_option_password'] : 2;
962
963$text .= "
964		<fieldset class='e-hideme' id='core-prefs-signup'>
965			<legend>".PRFLAN_19."</legend>
966			<table class='table adminform'>
967				<colgroup>
968					<col class='col-label' />
969					<col class='col-control' />
970				</colgroup>
971				<tbody>
972				<tr>
973						<td>".PRFLAN_261."</td><td><table class='table table-striped table-condensed table-bordered' style='margin-bottom:0px'>
974						<colgroup>
975					<col class='col-label' />
976					<col class='col-control' />
977				</colgroup>
978				<tr>
979							<td><label>Email</label></td>
980							<td>
981								".$frm->radio('disable_emailcheck', 2, ($pref['disable_emailcheck']==2), array('label' => CUSTSIG_12, 'disabled'=>true))."
982								".$frm->radio('disable_emailcheck', 1, (intval($pref['disable_emailcheck']) == 1), array('label' => CUSTSIG_14))."
983								".$frm->radio('disable_emailcheck', 0, (intval($pref['disable_emailcheck']) == 0), array('label' => CUSTSIG_15))."
984
985							</td>
986						</tr>
987						<tr>
988							<td><label for='signup-option-password'>".LAN_PASSWORD."</label></td>
989							<td>
990								".$frm->radio('signup_option_password', 0, !$prefOptionPassword, array('label' => CUSTSIG_12))."
991								".$frm->radio('signup_option_password', 1, ($prefOptionPassword == 1), array('label' => CUSTSIG_14, 'disabled'=>true))."
992								".$frm->radio('signup_option_password', 2, ($prefOptionPassword == 2), array('label' => CUSTSIG_15))."
993
994							</td>
995						</tr>
996
997
998						";
999
1000		$signup_option_names = array(
1001		//	"signup_option_loginname" 	=> "Login Name",
1002
1003		"signup_option_realname" 		=> CUSTSIG_2,
1004		"signup_option_email_confirm" 	=> CUSTSIG_21,
1005		"signup_option_image" 			=> CUSTSIG_7,
1006
1007		'signup_option_customtitle'		=> CUSTSIG_20,
1008		'signup_option_hideemail'		=> CUSTSIG_22,
1009		"signup_option_class" 			=> CUSTSIG_17,
1010		"signup_option_signature" 		=> CUSTSIG_6,
1011	);
1012
1013
1014	foreach($signup_option_names as $value => $key)
1015	{
1016		$label_value = str_replace('_', '-', $value);
1017		$text .= "
1018						<tr>
1019							<td><label for='".$label_value."'>".$key."</label></td>
1020							<td>
1021								".$frm->radio($value, 0, !$pref[$value], array('label' => CUSTSIG_12))."
1022								".$frm->radio($value, 1, ($pref[$value] == 1), array('label' => CUSTSIG_14))."
1023								".$frm->radio($value, 2, ($pref[$value] == 2), array('label' => CUSTSIG_15))."
1024							</td>
1025						</tr>
1026		";
1027	}
1028
1029
1030				$text .= "
1031
1032
1033	<tr>
1034						<td><label for='user-reg-secureveri'>".PRFLAN_262."</label></td>
1035						<td>
1036							".$frm->radio_switch('user_reg_secureveri', $pref['user_reg_secureveri'], CUSTSIG_12, CUSTSIG_14)."
1037						</td>
1038					</tr>
1039
1040
1041
1042</table>
1043						</td></tr>
1044
1045					<tr>
1046						<td><label for='use-coppa'>".PRFLAN_45."</label></td>
1047						<td>
1048							".$frm->radio_switch('use_coppa', $pref['use_coppa'])."
1049							<div class='field-help'>".PRFLAN_46." <a target='_blank' href='http://www.ftc.gov/privacy/coppafaqs.shtm' rel='external'>".PRFLAN_94."</a></div>
1050						</td>
1051					</tr>";
1052
1053/*
1054					<tr>
1055						<td><label for='disable-emailcheck'>".PRFLAN_167."</label></td>
1056						<td>
1057							". $pref['disable_emailcheck']."
1058						</td>
1059					</tr>*/
1060
1061$text .= "
1062					<tr>
1063						<td><label for='signup-text'>".PRFLAN_126."</label></td>
1064						<td>
1065							".$frm->textarea('signup_text', $pref['signup_text'], 3, 80, array('size'=>'xxlarge'))."
1066						</td>
1067					</tr>
1068
1069					<tr>
1070						<td><label for='signup-text-after'>".PRFLAN_140."</label></td>
1071						<td>
1072							".$frm->textarea('signup_text_after', $pref['signup_text_after'], 3, 80, array('size'=>'xxlarge'))."
1073						</td>
1074					</tr>
1075
1076
1077					<tr>
1078						<td><label for='predefinedloginname'>".PRFLAN_192.":</label></td>
1079						<td>
1080							".$frm->text('predefinedLoginName', $pref['predefinedLoginName'], 50)."
1081							<div class='field-help'><div style='text-align:left'>".PRFLAN_193."<br />".str_replace("[br]","<br /> ",PRFLAN_194)."</div></div>
1082						</td>
1083					</tr>
1084
1085
1086
1087						<tr>
1088						<td><label for='signup-disallow-text'>".CUSTSIG_18."</label></td>
1089						<td>
1090							".$frm->tags('signup_disallow_text', $pref['signup_disallow_text'], 500)."
1091							<div class='field-help'>".CUSTSIG_19."</div>
1092						</td>
1093					</tr>
1094
1095						<tr>
1096						<td><label for='displayname_class'>".PRFLAN_155.":</label></td>
1097						<td class='form-inline'>
1098							".$e_userclass->uc_dropdown('displayname_class', $pref['displayname_class'], 'nobody,member,admin,classes', "tabindex='".$frm->getNext()."'")."
1099							".$frm->admin_button('submit_resetdisplaynames', PRFLAN_156, 'delete')."
1100						</td>
1101					</tr>
1102
1103
1104
1105
1106";
1107
1108/*
1109					<!--
1110					<tr>
1111						<td>".CUSTSIG_13."</td>
1112						<td>".CUSTSIG_14."</td>
1113					</tr>
1114					-->
1115*/
1116
1117
1118
1119$text .= "
1120				</tbody>
1121			</table>
1122			".pref_submit('signup')."
1123		</fieldset>
1124";
1125
1126// Custom Fields.
1127
1128
1129/* text render options */
1130$savePrefs = false;
1131if(!isset($pref['post_html']))
1132{
1133	$pref['post_html'] = '250';
1134	$savePrefs = true;
1135	//save_prefs();
1136}
1137
1138// Make sure, the "post_script" setting is set and if not, set it to "No One" (255)
1139// This should close a possible security hole...
1140if(!isset($pref['post_script']))
1141{
1142	$pref['post_script'] = '255';
1143	$savePrefs = true;
1144	//save_prefs();
1145}
1146else
1147{
1148	// Make sure, that the pref is one of the allowed userclasses
1149	// Close possible security hole
1150	if (!array_key_exists($pref['post_script'], $e_userclass->uc_required_class_list('nobody,admin,main,classes,no-excludes', true)))
1151	{
1152		$pref['post_script'] = 255; //set to userclass "no one" if the old class isn't part of the list of allowed userclasses
1153		$savePrefs = true;
1154	}
1155}
1156
1157if ($savePrefs) $core_pref->setPref($pref)->save(false, true);
1158
1159
1160	$text .= "
1161		<fieldset class='e-hideme' id='core-prefs-textpost'>
1162			<legend>".PRFLAN_101."</legend>
1163			<table class='table adminform'>
1164				<colgroup>
1165					<col class='col-label' />
1166					<col class='col-control' />
1167				</colgroup>
1168				<tbody>
1169					<tr>
1170						<td><label for='make-clickable'>".PRFLAN_127.":</label></td>
1171						<td>
1172							".$frm->radio_switch('make_clickable', $pref['make_clickable'])."
1173							<div class='smalltext field-help'>".PRFLAN_128."</div>
1174						</td>
1175					</tr>";
1176
1177				$replaceDisp = vartrue($pref['link_replace']) ? "" : "e-hideme";
1178
1179				$text .= "
1180					<tr>
1181						<td><label for='link-replace'>".PRFLAN_102."?:</label></td>
1182						<td>
1183							".$frm->radio_switch('link_replace', $pref['link_replace'],'', '', 'expandit=1')."
1184							<div class='smalltext field-help'>".PRFLAN_103."</div>
1185							<div class='e-expandit-container {$replaceDisp}'>
1186							".$frm->text('link_text', $pref['link_text'], 200, 'placeholder='.PRFLAN_104)."
1187							<div class='smalltext field-help'>".PRFLAN_105."</div>".
1188							$frm->text('email_text', $tp->post_toForm($pref['email_text']), 200, 'placeholder='.PRFLAN_107)."
1189							<div class='smalltext field-help'>".PRFLAN_108."</div>
1190
1191							</div>
1192						</td>
1193					</tr>
1194
1195					<tr >
1196						<td><label for='links-new-window'>".PRFLAN_145."?:</label></td>
1197						<td>
1198							".$frm->radio_switch('links_new_window', $pref['links_new_window'])."
1199							<div class='smalltext field-help'>".PRFLAN_146."</div>
1200						</td>
1201					</tr>
1202
1203
1204					<tr>
1205						<td><label for='profanity-filter'>".PRFLAN_40."</label></td>
1206						<td>
1207							".$frm->radio_switch('profanity_filter', $pref['profanity_filter'])."
1208							<div class='smalltext field-help'>".PRFLAN_41."</div>
1209						</td>
1210					</tr>
1211
1212					<tr>
1213						<td><label for='profanity-replace'>".PRFLAN_42.":</label></td>
1214						<td>
1215							".$frm->text('profanity_replace', $pref['profanity_replace'], 20)."
1216						</td>
1217					</tr>
1218					<tr>
1219						<td><label for='profanity-words'>".PRFLAN_43.":</label></td>
1220						<td>
1221							".$frm->tags('profanity_words', $pref['profanity_words'], 250, array('maxItems'=>40))."
1222							<div class='field-help'>".PRFLAN_44."</div>
1223						</td>
1224					</tr>
1225
1226
1227					<tr>
1228						<td><label for='main-wordwrap'>".PRFLAN_109.":</label></td>
1229						<td>
1230							".$frm->number('main_wordwrap', $pref['main_wordwrap'], 3)."
1231							<div class='smalltext field-help'>".PRFLAN_110."</div>
1232						</td>
1233					</tr>
1234					<tr>
1235						<td><label for='menu-wordwrap'>".PRFLAN_111.":</label></td>
1236						<td>
1237							".$frm->number('menu_wordwrap', $pref['menu_wordwrap'], 3)."
1238							<div class='smalltext field-help'>".PRFLAN_110."</div>
1239						</td>
1240					</tr>
1241
1242					<tr>
1243						<td><label for='post-html'>".PRFLAN_116.":</label></td>
1244						<td>
1245							".$e_userclass->uc_dropdown('post_html', $pref['post_html'], 'nobody,public,member,admin,main,classes', "tabindex='".$frm->getNext()."'")."
1246							<div class='smalltext field-help'>".PRFLAN_117."</div>
1247						</td>
1248					</tr>
1249
1250					<tr>
1251						<td><label for='post-script'>".PRFLAN_215.":</label></td>
1252						<td>
1253							".$e_userclass->uc_dropdown('post_script',$pref['post_script'],'nobody,admin,main,classes,no-excludes')."
1254							<div class='smalltext field-help'>".PRFLAN_216."</div>
1255						</td>
1256					</tr>
1257						<tr>
1258						<td><label for='inline-editing'>".PRFLAN_268.":</label></td>
1259						<td>
1260							".$frm->userclass('inline_editing',$pref['inline_editing'],'off','nobody,admin,main,classes,no-excludes')."
1261							<div class='smalltext field-help'>".PRFLAN_269."</div>
1262						</td>
1263					</tr>
1264					<tr>
1265						<td><label for='filter-script'>".PRFLAN_217.":</label></td>
1266						<td>
1267							".$frm->radio_switch('filter_script', varset($pref['filter_script'], 1))."
1268							<div class='smalltext field-help'>".PRFLAN_218."</div>
1269						</td>
1270					</tr>
1271					<tr>
1272						<td><label for='html-abuse'>".PRFLAN_220.":</label></td>
1273						<td>
1274							".$frm->radio_switch('html_abuse', varset($pref['html_abuse'], 1))."
1275							<div class='smalltext field-help'>".PRFLAN_221."</div>
1276						</td>
1277					</tr>
1278					<tr>
1279						<td><label for='wysiwyg'>".PRFLAN_122.":</label></td>
1280						<td>
1281							".$frm->radio_switch('wysiwyg', $pref['wysiwyg'])."
1282							<div class='smalltext field-help'>".PRFLAN_123."</div>
1283						</td>
1284					</tr>
1285					<tr>
1286						<td><label for='old_np'>".PRFLAN_124.":</label></td>
1287						<td>
1288							".$frm->radio_switch('old_np', $pref['old_np'])."
1289							<div class='smalltext field-help'>".PRFLAN_125."</div>
1290						</td>
1291					</tr>
1292
1293";
1294
1295if(file_exists(e_PLUGIN."geshi/geshi.php"))
1296{
1297	$text .= "
1298					<tr>
1299						<td><label for='usegeshi'>".PRFLAN_118."?:</label></td>
1300						<td>
1301							".$frm->radio_switch('useGeshi', $pref['useGeshi'])."
1302							<div class='smalltext field-help'>".str_replace("[link]", "http://qbnz.com/highlighter/", PRFLAN_119)."</div>
1303						</td>
1304					</tr>
1305					<tr>
1306						<td><label for='defaultlangeshi'>".PRFLAN_120."?:</label></td>
1307						<td>
1308							".$frm->text('defaultLanGeshi', ($pref['defaultLanGeshi'] ? $pref['defaultLanGeshi'] : "php"), 20)."
1309							<div class='smalltext field-help'>".PRFLAN_121."</div>
1310						</td>
1311					</tr>
1312	";
1313}
1314$text .= "
1315				</tbody>
1316			</table>
1317			".pref_submit('textpost')."
1318		</fieldset>
1319";
1320
1321function multi_radio($name, $textsVals, $currentval = '')
1322{
1323	$ret = '';
1324	$gap = '';
1325	foreach($textsVals as $v => $t)
1326	{
1327		$sel = ($v == $currentval) ? " checked='checked'" : "";
1328		$ret .= $gap."<input type='radio' name='{$name}' value='{$v}'{$sel} /> ".$t."";
1329		$gap = "&nbsp;&nbsp;";
1330	}
1331	return $ret;
1332}
1333
1334// Security Options. .
1335$hasGD = extension_loaded("gd");
1336
1337$text .= "
1338		<fieldset class='e-hideme' id='core-prefs-security'>
1339			<legend>".PRFLAN_47."</legend>
1340			<table class='table adminform'>
1341				<colgroup>
1342					<col class='col-label' />
1343					<col class='col-control' />
1344				</colgroup>
1345				<tbody>";
1346
1347
1348		$text .="
1349					<tr>
1350						<td><label for='ssl-enabled'>".PRFLAN_60."</label></td>
1351
1352						<td>";
1353
1354							if(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')     // Only allow if an SSL login has been made.
1355							{
1356								$text .= $frm->radio_switch('ssl_enabled', $pref['ssl_enabled']);
1357								$text .= "<div class='field-help'>".PRFLAN_61."</div>";
1358							}
1359							else
1360							{
1361								$text .= "<div class='label label-primary e-tip' title=\"".PRFLAN_61."\">".PRFLAN_275."</div>";
1362							}
1363
1364						$text .= "
1365						</td>
1366					</tr>
1367			";
1368
1369	// Secure Image/ Captcha
1370	$secureImage = array('signcode'=>PRFLAN_76, 'logcode'=>PRFLAN_81, "fpwcode"=>PRFLAN_138,'admincode'=>PRFLAN_222);
1371
1372	foreach($secureImage as $key=>$label)
1373	{
1374
1375		$label = str_replace($srch,$repl,$label);
1376
1377		$text .= "<tr><td><label for='".$key."'>".$label."</label></td><td>";
1378		if($hasGD)
1379		{
1380			$text .= $frm->radio_switch($key, $pref[$key]);
1381		}
1382		else
1383		{
1384			$text .= PRFLAN_133;
1385		}
1386
1387		$text .= "
1388		<div class='field-help'>".PRFLAN_223."</div>
1389		</td></tr>\n";
1390
1391	}
1392
1393
1394/*
1395
1396
1397
1398	$text .= "
1399					<tr>
1400						<td>".PRFLAN_81.": </td>
1401						<td>
1402";
1403
1404if($hasGD)
1405{
1406	$text .= $frm->radio_switch('logcode', $pref['logcode']);
1407}
1408else
1409{
1410	$text .= PRFLAN_133;
1411}
1412$text .= "
1413						</td>
1414					</tr>
1415					<tr>
1416						<td>".PRFLAN_138.": </td>
1417						<td>
1418";
1419if($hasGD)
1420{
1421	$text .= $frm->radio_switch('fpwcode', $pref['fpwcode']);
1422}
1423else
1424{
1425	$text .= PRFLAN_133;
1426}
1427
1428$text .= "
1429						</td>
1430					</tr>";
1431 *
1432
1433 */
1434    $text .= "
1435
1436					<tr>
1437						<td><label for='disallowmultilogin'>".PRFLAN_129."</label></td>
1438						<td>
1439							".$frm->radio_switch('disallowMultiLogin', $pref['disallowMultiLogin'], LAN_YES, LAN_NO)."
1440							<div class='smalltext field-help'>".PRFLAN_130."</div>
1441						</td>
1442					</tr>
1443
1444					<tr>
1445						<td><label for='user-tracking-cookie'>".PRFLAN_48."</label></td>
1446						<td >
1447							<div class='form-inline'>
1448							".$frm->radio('user_tracking', array('cookie' => PRFLAN_49, 'session' => PRFLAN_50), $pref['user_tracking'])."
1449						</div></td>
1450					</tr>
1451
1452
1453					<tr>
1454						<td><label for='cookie-name'>".PRFLAN_55."</label></td>
1455						<td >".$frm->text('cookie_name', $pref['cookie_name'], 20)."
1456						<div class='field-help'>".PRFLAN_263.".</div></td></tr>
1457
1458
1459					<tr>
1460						<td><label for='session-lifetime'>".PRFLAN_272."</label></td>
1461						<td>
1462							".$frm->number('session_lifetime', $pref['session_lifetime'],6)."
1463							<div class='smalltext field-help'>".PRFLAN_273."</div>
1464						</td>
1465					</tr>
1466					";
1467
1468//	if(e_DEVELOPER) // Experimental (translate terms after this check is removed)
1469    {
1470           //  $systemSaveMethod = ini_get('session.save_handler');
1471           //  $saveMethod = (!empty($systemSaveMethod)) ? $systemSaveMethod : 'files';
1472            // $systemSaveMethod => PRFLAN_276,
1473                $text .= "
1474	                <tr>
1475						<td><label for='session-save-method'>".PRFLAN_282."</label></td>
1476						<td class='form-inline'>
1477							".$frm->select('session_save_method', [ 'db'=>'Database', 'files'=>'Files'], $pref['session_save_method'])."
1478							<!-- <div class='smalltext field-help'>".PRFLAN_273."</div>-->
1479							<!-- <span class='label label-warning'>Experimental</span>-->
1480						</td>
1481					</tr>
1482                    ";
1483    }
1484
1485    $text .= "
1486					<tr>
1487						<td><label for='passwordencoding'>".PRFLAN_188.":</label></td>
1488
1489							";
1490
1491						$pwdEncodeOpts = array();
1492
1493						if(function_exists('password_verify')) // ie. php 5.5 or higher
1494						{
1495							$pwdEncodeOpts[3]	 = PRFLAN_276;
1496
1497						}
1498
1499						$pwdEncodeOpts[1] = PRFLAN_190;
1500						$pwdEncodeOpts[0] = PRFLAN_189;
1501
1502						$text .= (isset($pwdEncodeOpts[3]) && $pref['passwordEncoding']!=3) ? "<td class='has-warning'>" : "<td>";
1503						$text .= $frm->select('passwordEncoding', $pwdEncodeOpts,  varset($pref['passwordEncoding'], 0));
1504
1505				//	$text .= $frm->radio_switch('passwordEncoding', varset($pref['passwordEncoding'], 0), PRFLAN_190, PRFLAN_189);
1506
1507						$text .= "
1508							<div class='smalltext field-help'></div>
1509						</td>
1510					</tr>
1511					<tr>";
1512
1513					$CHAP_list = array(PRFLAN_180, PRFLAN_181, PRFLAN_182);
1514
1515					$text .= "
1516						<td><label for='password-chap'>".PRFLAN_178."</label></td>
1517						<td>";
1518
1519						$CHAPopt = !empty($pref['ssl_enabled']) || !empty($pref['passwordEncoding']) ? array('disabled'=>1) : null;
1520						$text .=  $frm->select('password_CHAP',$CHAP_list,$pref['password_CHAP'], $CHAPopt );
1521						//."	".$frm->select_open('password_CHAP');
1522
1523						//TODO - user tracking session name - visible only if Cookie is enabled (JS)
1524
1525						$text .= "
1526							<div class='smalltext field-help'>".PRFLAN_183."<br />".PRFLAN_179."</div>
1527						</td>
1528					</tr>
1529
1530					<tr>
1531						<td><label for='antiflood1'>".PRFLAN_35."</label></td>
1532						<td>
1533							".$frm->radio_switch('antiflood1', $pref['antiflood1'])."
1534						</td>
1535					</tr>
1536					<tr>
1537						<td><label for='antiflood-timeout'>".PRFLAN_36."</label></td>
1538						<td>
1539							".$frm->number('antiflood_timeout', $pref['antiflood_timeout'], 3)."
1540							<div class='smalltext field-help'>".PRFLAN_38."</div>
1541						</td>
1542					</tr>
1543					<tr>
1544						<td><label for='autoban'>".PRFLAN_37."</label></td>
1545						<td>
1546							".$frm->select_open('autoban');
1547
1548$autoban_list = array(
1549	PRFLAN_113,
1550	PRFLAN_144,
1551	PRFLAN_142,
1552	PRFLAN_143
1553);
1554
1555foreach($autoban_list as $ab => $ab_title)
1556{
1557	$sel = ($pref['autoban'] == $ab) ? "selected='selected'" : "";
1558	$text .= "
1559								".$frm->option($ab_title, $ab, ($pref['autoban'] == $ab))."
1560	";
1561}
1562
1563$text .= "
1564							</select>
1565							<div class='field-help'>".PRFLAN_91."</div>
1566						</td>
1567					</tr>
1568					<tr>
1569						<td><label for='failed-login-limit'>".PRFLAN_231."</label></td>
1570						<td>
1571							".$frm->number('failed_login_limit', varset($pref['failed_login_limit'],10), 3, array('max'=>10, 'min'=>0))."
1572							<div class='smalltext field-help'>".PRFLAN_232."</div>
1573						</td>
1574					</tr>
1575					<tr>
1576						<td><label for='adminpwordchange'>".PRFLAN_139."</label></td>
1577						<td>
1578							".$frm->radio_switch('adminpwordchange', $pref['adminpwordchange'])."
1579						</td>
1580					</tr>
1581				</tbody>
1582			</table>
1583			".pref_submit('security')."
1584		</fieldset>
1585";
1586
1587$text .= "
1588		<fieldset class='e-hideme' id='core-prefs-comments'>
1589			<legend>".PRFLAN_87."</legend>
1590			<table class='table adminform'>
1591				<colgroup>
1592					<col class='col-label' />
1593					<col class='col-control' />
1594				</colgroup>
1595				<tbody>
1596					<tr>
1597						<td>".PRFLAN_161.":</td>
1598						<td>
1599							".$frm->radio_switch('comments_disabled', $pref['comments_disabled'], LAN_YES, LAN_NO, array('inverse'=>1))."
1600						</td>
1601					</tr>
1602             		<tr>
1603						<td>".PRFLAN_32."</td>
1604						<td>
1605							".$frm->radio_switch('anon_post', $pref['anon_post'], LAN_YES, LAN_NO)."
1606							<div class='field-help'>".PRFLAN_33."</div>
1607						</td>
1608					</tr>
1609					<tr>
1610						<td>".PRFLAN_89.": </td>
1611						<td>
1612							".$frm->radio_switch('comments_icon', $pref['comments_icon'], LAN_YES, LAN_NO)."
1613						</td>
1614					</tr>
1615					<tr>
1616						<td>".PRFLAN_88.": </td>
1617						<td>
1618							".$frm->radio_switch('nested_comments', $pref['nested_comments'], LAN_YES, LAN_NO)."
1619						</td>
1620					</tr>
1621
1622					<tr>
1623						<td>".PRFLAN_90.": </td>
1624						<td>
1625							".$frm->radio_switch('allowCommentEdit', $pref['allowCommentEdit'], LAN_YES, LAN_NO)."
1626						</td>
1627					</tr>
1628
1629					<tr>
1630						<td>".PRFLAN_166.": </td>
1631						<td>
1632							".$frm->radio_switch('comments_emoticons', $pref['comments_emoticons'], LAN_YES, LAN_NO)."
1633						</td>
1634					</tr>
1635
1636					<tr>
1637						<td>".PRFLAN_233."</td>
1638						<td>
1639							".
1640
1641							$frm->uc_select('comments_moderate', $pref['comments_moderate'],"nobody,guest,new,bots,public,admin,main,classes").
1642							"
1643							<div class='field-help'>".PRFLAN_234."</div>
1644						</td>
1645					</tr>
1646					<tr>
1647						<td>".PRFLAN_235."</td>
1648						<td>";
1649
1650						$comment_sort = array(
1651							"desc"	=> PRFLAN_236, //default
1652							'asc'	=> PRFLAN_237
1653						);
1654
1655					$text .= $frm->select('comments_sort',$comment_sort, $pref['comments_sort'], array('size'=>'xlarge'))."
1656						</td>
1657					</tr>
1658
1659				</tbody>
1660			</table>
1661
1662			<legend>".PRFLAN_209."</legend>
1663			<table class='table adminform'>
1664				<colgroup>
1665					<col class='col-label' />
1666					<col class='col-control' />
1667				</colgroup>
1668				<tbody>
1669
1670					<tr>
1671						<td>".PRFLAN_208.":</td>
1672						<td>
1673							".$e_userclass->uc_dropdown('email_item_class',varset($pref['email_item_class'],e_UC_MEMBER),'nobody,admin,main,public,member,classes', "tabindex='".$frm->getNext()."'")."
1674						</td>
1675					</tr>
1676
1677				</tbody>
1678			</table>
1679			".pref_submit('comments')."
1680		</fieldset>
1681	";
1682
1683// File Uploads
1684
1685	e107::includeLan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_upload.php");
1686	require_once(e_HANDLER."upload_handler.php");
1687
1688
1689
1690
1691
1692
1693	$text .= "
1694	<fieldset class='e-hideme' id='core-prefs-uploads'>
1695			<legend>".PRFLAN_238."</legend>";
1696
1697
1698	$upload_max_filesize = ini_get('upload_max_filesize');
1699	$post_max_size = ini_get('post_max_size');
1700
1701	$maxINI = min($upload_max_filesize,$post_max_size);
1702
1703	if($maxINI < $pref['upload_maxfilesize'])
1704	{
1705		$text .= "<div class='alert-block alert alert-danger'>";
1706		$text .= PRFLAN_239." ".$maxINI."</div>";
1707		$pref['upload_maxfilesize'] = $maxINI;
1708	}
1709
1710
1711
1712
1713	$text .= "
1714			<table class='table adminform'>
1715				<colgroup>
1716					<col class='col-label' />
1717					<col class='col-control' />
1718				</colgroup>
1719				<tbody>
1720	<tr>
1721	<td>".UPLLAN_25."</td>
1722	<td>".
1723
1724	$frm->radio_switch('upload_enabled', $pref['upload_enabled'])
1725	."
1726	<div class='field-help'>".UPLLAN_26."</div>
1727	</td>
1728	</tr>
1729
1730	<tr>
1731	<td>".UPLLAN_33."<br />
1732	</td>
1733	<td>".
1734	$frm->text('upload_maxfilesize', $pref['upload_maxfilesize'], 10)
1735	 ."
1736	 <div class='field-help'>".UPLLAN_34."</div>
1737	</td>
1738	</tr>
1739
1740	<tr>
1741	<td>".UPLLAN_37."</td>
1742	<td>".r_userclass("upload_class", $pref['upload_class'],"off","nobody,public,guest,member,admin,classes")."
1743	<div class='field-help'>".UPLLAN_38."</div>
1744	</td>
1745	</tr>
1746	<tr><td>".PRFLAN_240."</td>
1747	<td>
1748
1749	<table class='table table-striped table-bordered'>
1750	<tr><th>".LAN_TYPE."</th><th>".UPLLAN_33."</th>
1751	";
1752
1753	$fl = e107::getFile();
1754	$data = $fl->getAllowedFileTypes();
1755
1756	foreach($data as $k=>$v)
1757	{
1758		$text .= "<tr><td>".$k."</td>
1759		<td>".$fl->file_size_encode($v)."</td>
1760		</tr>";
1761
1762
1763	}
1764	// $text .= print_a($data,true);
1765
1766
1767
1768	$text .= "</table>
1769
1770	<div>".PRFLAN_241." <b>".str_replace("../",'',e_SYSTEM).e_READ_FILETYPES."</b></div>
1771	</td>
1772
1773
1774	</tbody>
1775		</table>
1776			".pref_submit('uploads');
1777
1778
1779
1780	$text .= "
1781		</fieldset>";
1782
1783
1784$text .= "<fieldset class='e-hideme' id='core-prefs-javascript'>";
1785
1786if(E107_DEBUG_LEVEL > 0)
1787{
1788	// TODO - remove these old JS settings completely!
1789
1790	// Javascript Control
1791	$text .= "
1792			<legend>" . PRFLAN_242 . "</legend>
1793			<table class='table adminform'>
1794				<colgroup>
1795					<col class='col-label' />
1796					<col class='col-control' />
1797				</colgroup>
1798				<tbody>";
1799
1800	$js_options = array(
1801		'auto'  => PRFLAN_243, // load based on dependency
1802		'admin' => PRFLAN_244, // Always load in admin
1803		'front' => PRFLAN_245, // Always load in front-end
1804		'all'   => PRFLAN_246, // Always load in admin and front-end
1805		'none'  => PRFLAN_247  // disabled
1806	);
1807
1808	$js_types = array(
1809		array('id' => 'jquery', 'name' => 'jQuery (local)'),
1810		array('id' => 'prototype', 'name' => 'Prototype (local)'),
1811	);
1812
1813	foreach($js_types as $arr)
1814	{
1815		// $k = $arr['path'];
1816		$k = $arr['id'];
1817		$name = $arr['name'];
1818		$text .= "<tr>
1819				<td>" . $name . "</td>
1820				<td>" . $frm->radio("e_jslib_core[{$k}]", $js_options, $pref['e_jslib_core'][$k]) . "</td>
1821				</tr>";
1822	}
1823
1824	$text .= "
1825					</tbody>
1826			</table>
1827			<table class='table adminform' style='margin-top: 20px'>
1828				<colgroup>
1829					<col class='col-label' />
1830					<col class='col-control' />
1831				</colgroup>
1832				<thead>
1833					<tr><th colspan='2'><span class='label label-warning'>DEPRECATED</span> Available only in DEBUG mode</th></tr>
1834				</thead>
1835				<tbody>
1836					<tr>
1837						<td>" . PRFLAN_248 . "</td>
1838						<td>
1839							" . $frm->radio_switch('e_jslib_nocombine', $pref['e_jslib_nocombine'], LAN_YES, LAN_NO) . "
1840							<div class='smalltext field-help'>" . PRFLAN_249 . "</div>
1841						</td>
1842					</tr>
1843					<tr>
1844						<td>" . PRFLAN_250 . "</td>
1845						<td>
1846							" . $frm->radio_switch('e_jslib_gzip', $pref['e_jslib_gzip'], LAN_YES, LAN_NO) . "
1847							<div class='smalltext field-help'>" . PRFLAN_251 . "</div>
1848						</td>
1849					</tr>
1850					<tr>
1851						<td>" . PRFLAN_252 . "</td>
1852						<td>
1853							" . $frm->radio_switch('e_jslib_nocache', $pref['e_jslib_nocache'], LAN_YES, LAN_NO) . "
1854							<div class='smalltext field-help'>" . PRFLAN_251 . "</div>
1855						</td>
1856					</tr>
1857					<tr>
1858						<td>" . PRFLAN_253 . "</td>
1859						<td>
1860							" . $frm->radio_switch('e_jslib_nobcache', $pref['e_jslib_nobcache'], LAN_YES, LAN_NO) . "
1861							<div class='smalltext field-help'>" . PRFLAN_251 . "</div>
1862						</td>
1863					</tr>
1864		";
1865
1866	$text .= "</tbody></table>";
1867}
1868else
1869{
1870	$text .= "<div>";
1871	$text .= $frm->hidden('e_jslib_core[jquery]', 'all');
1872	$text .= $frm->hidden('e_jslib_core[prototype]', 'none');
1873	$text .= $frm->hidden('e_jslib_nocombine', 1);
1874	$text .= $frm->hidden('e_jslib_nocache', 1);
1875	$text .= $frm->hidden('e_jslib_nobcache', 1);
1876	$text .= $frm->hidden('e_jslib_gzip', 0);
1877	$text .= "</div>";
1878}
1879
1880/**
1881 * @addtogroup CDN settings
1882 * @{
1883 */
1884
1885// [e_LANGUAGEDIR]/[e_LANGUAGE]/lan_library_manager.php
1886e107::lan('core', 'library_manager');
1887
1888$CDNproviders = array(
1889	'jsdelivr' => 'jsDelivr',
1890	'cdnjs' => 'cdnjs',
1891);
1892
1893$text .= '
1894<h4 class="caption">' . LAN_LIBRARY_MANAGER_30 . '</h4>
1895<table class="table adminform">
1896	<colgroup>
1897		<col class="col-label"/>
1898		<col class="col-control"/>
1899	</colgroup>
1900	<tbody>
1901		<tr>
1902			<td>' . LAN_LIBRARY_MANAGER_31 . '</td>
1903			<td>
1904				' . $frm->radio("e_jslib_cdn", array(1 => LAN_YES, 0 => LAN_NO), varset($pref['e_jslib_cdn'], 1)) . '
1905			</td>
1906		</tr>
1907		<tr>
1908			<td>' . LAN_LIBRARY_MANAGER_32 . '</td>
1909			<td>
1910				' . $frm->select("e_jslib_cdn_provider", $CDNproviders, varset($pref['e_jslib_cdn_provider'], 'jsdelivr')) . '
1911			</td>
1912		</tr>
1913	</tbody>
1914</table>
1915';
1916
1917// Submit button.
1918$text .= pref_submit('javascript');
1919
1920/**
1921 * @} End of "addtogroup CDN settings".
1922 */
1923
1924
1925/**
1926 * @addtogroup Third-party libraries
1927 * @{
1928 */
1929
1930$text .= '<h4 class="caption">' . LAN_LIBRARY_MANAGER_25 . '</h4>';
1931$text .= '<table width="100%" class="table table-striped" cellpadding="0" cellspacing="0">';
1932$text .= '<thead>';
1933$text .= '<tr>';
1934$text .= '<th>' . LAN_LIBRARY_MANAGER_13 . '</th>';
1935$text .= '<th class="text-center">' . LAN_LIBRARY_MANAGER_21 . '</th>';
1936$text .= '<th>' . LAN_LIBRARY_MANAGER_29 . '</th>';
1937$text .= '<th class="text-center">' . LAN_VERSION . '</th>';
1938$text .= '<th class="text-center">' . LAN_STATUS . '</th>';
1939$text .= '<th>' . LAN_MESSAGE . '</th>';
1940$text .= '<th>' . LAN_MOREINFO . '</th>';
1941$text .= '</tr>';
1942$text .= '</thead>';
1943$text .= '<tbody>';
1944
1945$libraries = e107::library('info');
1946foreach($libraries as $machineName => $library)
1947{
1948	$details = e107::library('detect', $machineName);
1949
1950	if(empty($details['name']))
1951	{
1952		continue;
1953	}
1954
1955	$name = libraryGetName($machineName, $details);
1956	$provider = libraryGetProvider($details);
1957	$status = libraryGetStatus($details);
1958	$links = libraryGetLinks($details);
1959
1960	$text .= '<tr>';
1961	$text .= '<td>' . $name . '</td>';
1962	$text .= '<td class="text-center">' . $provider . '</td>';
1963	$text .= '<td class="smalltext">' . varset($details['library_path']) . '</td>';
1964	$text .= '<td class="text-center">' . varset($details['version']) . '</td>';
1965	$text .= '<td class="text-center">' . $status . '</td>';
1966	$text .= '<td>' . varset($details['error_message']) . '</td>';
1967	$text .= '<td>' . $links . '</td>';
1968	$text .= '</tr>';
1969}
1970
1971if(empty($libraries))
1972{
1973	$text .= '<tr>';
1974	$text .= '<td colspan="6">' . LAN_NOT_FOUND . '</td>';
1975	$text .= '</tr>';
1976}
1977
1978$text .= '</tbody>';
1979$text .= '</table>';
1980$text .= "</fieldset>";
1981
1982/**
1983 * @} End of "addtogroup Third-party libraries".
1984 */
1985
1986
1987/**
1988 * @addtogroup Advanced Features
1989 * @{
1990 */
1991
1992$text .= "
1993		<fieldset class='e-hideme' id='core-prefs-advanced'>
1994			<legend>".PRFLAN_149."</legend>
1995			<table class='table adminform'>
1996				<colgroup>
1997					<col class='col-label' />
1998					<col class='col-control' />
1999				</colgroup>
2000				<tbody>
2001					<tr>
2002						<td>".PRFLAN_147.":</td>
2003						<td>
2004							".$frm->radio_switch('developer', $pref['developer'])."
2005							<div class='smalltext field-help'>".PRFLAN_148."</div>
2006						</td>
2007					</tr>
2008					<tr>
2009						<td>".PRFLAN_196."</td>
2010						<td>
2011						".$frm->radio_switch('log_page_accesses', $pref['log_page_accesses'])."
2012						<div class='field-help'>".PRFLAN_196a." <strong>".e_LOG."</strong></div>
2013						</td>
2014					</tr>
2015					<tr>
2016						<td>".PRFLAN_17."</td>
2017						<td>
2018							".$frm->radio_switch('compress_output', $pref['compress_output'])."
2019						</td>
2020					</tr>
2021";
2022
2023$auth_dropdown = '';
2024if($authlist)
2025{
2026	$auth_dropdown = "\n".$frm->select_open('auth_method')."\n";
2027	foreach($authlist as $a)
2028	{
2029		$auth_dropdown .= $frm->option($a, $a, ($pref['auth_method'] == $a))."\n";
2030	}
2031	$auth_dropdown .= "</select>\n";
2032}
2033else
2034{
2035	$auth_dropdown = "<input type='hidden' name='auth_method' value='' />".PRFLAN_151;
2036	$pref['auth_method'] = "";
2037}
2038
2039$text .= "
2040					<tr>
2041						<td>".PRFLAN_150."</td>
2042						<td>
2043							{$auth_dropdown}
2044						</td>
2045					</tr>
2046					<tr>
2047						<td>".PRFLAN_173."</td>
2048						<td>
2049							".$frm->radio_switch('check_updates', $pref['check_updates'])."
2050						</td>
2051					</tr>
2052				</tbody>
2053			</table>
2054			".pref_submit('advanced')."
2055		</fieldset>
2056	";
2057
2058/**
2059 * @} End of "addtogroup Advanced Features".
2060 */
2061
2062
2063$text .= "
2064	</form>
2065</div>
2066";
2067
2068$ns->tablerender(PRFLAN_53, $mes->render().$text);
2069
2070require_once(e_ADMIN."footer.php");
2071
2072function pref_submit($post_id = '')
2073{
2074	global $frm;
2075	if($post_id) $post_id = '-'.$post_id;
2076	$text = "
2077		<div class='buttons-bar center'>";
2078
2079	// ML
2080	/* if(e_MLANG == 1){
2081	//$text .="<input class='fcaption' type='submit' name='updateprefs' value='".PRFLAN_52."' />
2082	$but_typ = array(""); // empty = submit
2083	$but_nam = array("updateprefs"); // empty = autobutX with X autoincrement
2084	$but_val = array("updateprefs"); // empty = Submit
2085	$but_class = array("caption"); // empty = button
2086	$butjs = array(""); // empty = ""
2087	$buttitle = array(""); // empty = ""
2088	$text .= e107ml_adpanel(1,$but_typ,$but_nam,$but_val,$but_class,$butjs,$buttitle);
2089	}else{*/
2090	$text .= $frm->admin_button('updateprefs', PRFLAN_52, 'update', '', "id=updateprefs{$post_id}");
2091	// }
2092	$text .= "\n</div>";
2093
2094	// END ML
2095	return $text;
2096}
2097
2098function prefs_adminmenu()
2099{
2100		$var['core-prefs-header1']['header'] = LAN_BASIC_OPTIONS;
2101	$var['core-prefs-main']['text'] = PRFLAN_1;
2102	$var['core-prefs-email']['text'] = PRFLAN_254;
2103	$var['core-prefs-gdpr']['text'] = PRFLAN_277;
2104	$var['core-prefs-registration']['text'] = PRFLAN_28;
2105	$var['core-prefs-signup']['text'] = PRFLAN_19;
2106//	$var['core-prefs-sociallogin']['text'] = "Social Options"; // Moved into plugin.
2107
2108	$var['core-prefs-comments']['text'] = PRFLAN_210;
2109	$var['core-prefs-uploads']['text'] = PRFLAN_255;
2110
2111	$var['core-prefs-header2']['header'] = PRFLAN_256;
2112
2113	$var['core-prefs-display']['text'] = PRFLAN_13;
2114	$var['core-prefs-admindisp']['text'] = PRFLAN_77;
2115	$var['core-prefs-textpost']['text'] = PRFLAN_101;
2116	$var['core-prefs-security']['text'] = PRFLAN_47;
2117	$var['core-prefs-date']['text'] = PRFLAN_21;
2118	$var['core-prefs-javascript']['text'] = PRFLAN_257;
2119	$var['core-prefs-advanced']['text'] = PRFLAN_149;
2120
2121	$icon = e107::getParser()->toIcon('e-prefs-24');
2122	$caption = $icon."<span>".LAN_PREFS."</span>";
2123
2124	e107::getNav()->admin($caption.'--id--prev_nav', 'core-prefs-main', $var);
2125}
2126
2127/**
2128 * @addtogroup Third-party libraries
2129 * @{
2130 */
2131
2132/**
2133 * Helper function to get library's name.
2134 */
2135function libraryGetName($machineName, $details)
2136{
2137	$text = e107::getParser()->lanVars(LAN_LIBRARY_MANAGER_27, array($machineName));
2138	return '<span data-toggle="tooltip" data-placement="top" title="' . $text . '">' . $details['name'] . '</span>';
2139}
2140
2141/**
2142 * Helper function to get links.
2143 */
2144function libraryGetLinks($details)
2145{
2146	$homepage = libraryGetHomepage($details);
2147	$download = libraryGetDownload($details);
2148
2149	if ($homepage && $download)
2150	{
2151		return $homepage . ' | ' . $download;
2152	}
2153
2154	if($homepage)
2155	{
2156		return $homepage;
2157	}
2158
2159	if($download)
2160	{
2161		return $download;
2162	}
2163}
2164
2165/**
2166 * Helper function to get homepage link.
2167 */
2168function libraryGetHomepage($details)
2169{
2170	if (empty($details['vendor_url']))
2171	{
2172		return false;
2173	}
2174
2175	$href = $details['vendor_url'];
2176	$title = $details['name'];
2177
2178	return '<a href="' . $href . '" title="' . $title . '" target="_blank">' . LAN_WEBSITE . '</a>';
2179}
2180
2181/**
2182 * Helper function to get download link.
2183 */
2184function libraryGetDownload($details)
2185{
2186	if (empty($details['download_url']))
2187	{
2188		return false;
2189	}
2190
2191	$href = $details['download_url'];
2192	$title = $details['name'];
2193
2194	return '<a href="' . $href . '" title="' . $title . '" target="_blank">' . LAN_DOWNLOAD . '</a>';
2195}
2196
2197/**
2198 * Helper function to get provider.
2199 */
2200function libraryGetProvider($details)
2201{
2202	$text = 'e107';
2203	$provider = LAN_CORE;
2204
2205	if(varset($details['plugin'], false) == true)
2206	{
2207		$text = $details['plugin'];
2208		$provider = LAN_PLUGIN;
2209	}
2210
2211	if(varset($details['theme'], false) == true)
2212	{
2213		$text = $details['theme'];
2214		$provider = LAN_THEME;
2215	}
2216
2217	return '<span data-toggle="tooltip" data-placement="top" title="' . $text . '">' . $provider . '</span>';
2218}
2219
2220/**
2221 * Helper function to get status.
2222 */
2223function libraryGetStatus($details)
2224{
2225	$tp = e107::getParser();
2226
2227	if($details['installed'] == true)
2228	{
2229		$icon = $tp->toGlyph('fa-check');
2230		$text = LAN_OK;
2231		return '<span class="text-success" data-toggle="tooltip" data-placement="top" title="' . $text . '">' . $icon . '</span>';
2232	}
2233
2234	$icon = $tp->toGlyph('fa-remove');
2235	$text = $details['error'];
2236	return '<span class="text-danger" data-toggle="tooltip" data-placement="top" title="' . $text . '">' . $icon . '</span>';
2237}
2238
2239/**
2240 * @} End of "addtogroup Third-party libraries".
2241 */
2242