forked from bludit/bludit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.php
750 lines (610 loc) · 19.8 KB
/
install.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
<?php
/*
* Bludit
* https://www.bludit.com
* Author Diego Najar
* Bludit is opensource software licensed under the MIT license.
*/
// Check PHP version
if(version_compare(phpversion(), '5.3', '<')) {
exit('Current PHP version '.phpversion().', you need > 5.3. (ERR_202)');
}
// Check PHP modules
if(!extension_loaded('mbstring')) {
exit('PHP module mbstring is not installed. Check the requirements.');
}
if(!extension_loaded('json')) {
exit('PHP module json is not installed. Check the requirements.');
}
if(!extension_loaded('gd')) {
exit('PHP module gd is not installed. Check the requirements.');
}
if(!extension_loaded('dom')) {
exit('PHP module dom is not installed. Check the requirements.');
}
// Security constant
define('BLUDIT', true);
// Directory separator
define('DS', DIRECTORY_SEPARATOR);
// PHP paths
define('PATH_ROOT', __DIR__.DS);
define('PATH_CONTENT', PATH_ROOT.'bl-content'.DS);
define('PATH_KERNEL', PATH_ROOT.'bl-kernel'.DS);
define('PATH_LANGUAGES', PATH_ROOT.'bl-languages'.DS);
define('PATH_POSTS', PATH_CONTENT.'posts'.DS);
define('PATH_UPLOADS', PATH_CONTENT.'uploads'.DS);
define('PATH_TMP', PATH_CONTENT.'tmp'.DS);
define('PATH_PAGES', PATH_CONTENT.'pages'.DS);
define('PATH_DATABASES', PATH_CONTENT.'databases'.DS);
define('PATH_PLUGINS_DATABASES',PATH_CONTENT.'databases'.DS.'plugins'.DS);
define('PATH_UPLOADS_PROFILES', PATH_UPLOADS.'profiles'.DS);
define('PATH_UPLOADS_THUMBNAILS',PATH_UPLOADS.'thumbnails'.DS);
define('PATH_HELPERS', PATH_KERNEL.'helpers'.DS);
define('PATH_ABSTRACT', PATH_KERNEL.'abstract'.DS);
// Protecting against Symlink attacks.
define('CHECK_SYMBOLIC_LINKS', TRUE);
// Filename for posts and pages
define('FILENAME', 'index.txt');
// Domain and protocol
define('DOMAIN', $_SERVER['HTTP_HOST']);
if(!empty($_SERVER['HTTPS'])) {
define('PROTOCOL', 'https://');
}
else {
define('PROTOCOL', 'http://');
}
// Base URL
// The user can define the base URL.
// Left empty if you want to Bludit try to detect the base URL.
$base = '';
if( !empty($_SERVER['DOCUMENT_ROOT']) && !empty($_SERVER['SCRIPT_NAME']) && empty($base) ) {
$base = str_replace($_SERVER['DOCUMENT_ROOT'], '', $_SERVER['SCRIPT_NAME']);
$base = dirname($base);
}
elseif( empty($base) ) {
$base = empty( $_SERVER['SCRIPT_NAME'] ) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
$base = dirname($base);
}
if($base!=DS) {
$base = trim($base, '/');
$base = '/'.$base.'/';
}
else {
// Workaround for Windows Web Servers
$base = '/';
}
define('HTML_PATH_ROOT', $base);
// Log separator
define('LOG_SEP', ' | ');
// JSON
if(!defined('JSON_PRETTY_PRINT')) {
define('JSON_PRETTY_PRINT', 128);
}
// Database format date
define('DB_DATE_FORMAT', 'Y-m-d H:i:s');
// Charset, default UTF-8.
define('CHARSET', 'UTF-8');
// Set internal character encoding.
mb_internal_encoding(CHARSET);
// Set HTTP output character encoding.
mb_http_output(CHARSET);
// --- PHP Classes ---
include(PATH_ABSTRACT.'dbjson.class.php');
include(PATH_HELPERS.'sanitize.class.php');
include(PATH_HELPERS.'valid.class.php');
include(PATH_HELPERS.'text.class.php');
include(PATH_HELPERS.'log.class.php');
include(PATH_HELPERS.'date.class.php');
include(PATH_KERNEL.'dblanguage.class.php');
// --- LANGUAGE and LOCALE ---
// Language from the URI
if(isset($_GET['language'])) {
$localeFromHTTP = Sanitize::html($_GET['language']);
}
else {
// Try to detect the locale
if( function_exists('locale_accept_from_http') ) {
$localeFromHTTP = locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']);
}
else {
$explodeLocale = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
$localeFromHTTP = empty($explodeLocale[0])?'en_US':str_replace('-', '_', $explodeLocale[0]);
}
}
// Check if the dictionary exists, otherwise the default language is English.
if( !file_exists(PATH_LANGUAGES.$localeFromHTTP.'.json') ) {
$localeFromHTTP = 'en_US';
}
// Get language file
$Language = new dbLanguage($localeFromHTTP);
// Set locale
setlocale(LC_ALL, $localeFromHTTP);
// --- TIMEZONE ---
// Check if timezone is defined in php.ini
$iniDate = ini_get('date.timezone');
if(empty($iniDate)) {
// Timezone not defined in php.ini, then set UTC as default.
date_default_timezone_set('UTC');
}
// ============================================================================
// FUNCTIONS
// ============================================================================
// Returns an array with all languages
function getLanguageList()
{
$files = glob(PATH_LANGUAGES.'*.json');
$tmp = array();
foreach($files as $file)
{
$t = new dbJSON($file, false);
$native = $t->db['language-data']['native'];
$locale = basename($file, '.json');
$tmp[$locale] = $native;
}
return $tmp;
}
// Generate a random string.
// Thanks, http://stackoverflow.com/questions/4356289/php-random-string-generator
function getRandomString($length = 10) {
return substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length);
}
// Check if Bludit is installed.
function alreadyInstalled() {
return file_exists(PATH_DATABASES.'site.php');
}
// Check the system, permissions, php version, modules, etc.
// Returns an array with the problems otherwise empty array.
function checkSystem()
{
$stdOut = array();
$dirpermissions = 0755;
// Check .htaccess file for different webservers
if( !file_exists(PATH_ROOT.'.htaccess') )
{
if ( !isset($_SERVER['SERVER_SOFTWARE']) ||
stripos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false ||
stripos($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false
) {
$errorText = 'Missing file, upload the file .htaccess (ERR_201)';
error_log($errorText, 0);
$tmp['title'] = 'File .htaccess';
$tmp['errorText'] = $errorText;
array_push($stdOut, $tmp);
}
}
// Try to create the directory content
@mkdir(PATH_CONTENT, $dirpermissions, true);
// Check if the directory content is writeable.
if(!is_writable(PATH_CONTENT))
{
$errorText = 'Writing test failure, check directory content permissions. (ERR_205)';
error_log($errorText, 0);
$tmp['title'] = 'PHP permissions';
$tmp['errorText'] = $errorText;
array_push($stdOut, $tmp);
}
return $stdOut;
}
// Finish with the installation.
function install($adminPassword, $email, $timezone)
{
global $Language;
$stdOut = array();
if( !date_default_timezone_set($timezone) ) {
date_default_timezone_set('UTC');
}
$currentDate = Date::current(DB_DATE_FORMAT);
// ============================================================================
// Create directories
// ============================================================================
// 7=read,write,execute | 5=read,execute
$dirpermissions = 0755;
$firstPostSlug = 'first-post';
if(!mkdir(PATH_POSTS.$firstPostSlug, $dirpermissions, true))
{
$errorText = 'Error when trying to created the directory=>'.PATH_POSTS.$firstPostSlug;
error_log($errorText, 0);
}
if(!mkdir(PATH_PAGES.'error', $dirpermissions, true))
{
$errorText = 'Error when trying to created the directory=>'.PATH_PAGES.'error';
error_log($errorText, 0);
}
if(!mkdir(PATH_PAGES.'about', $dirpermissions, true))
{
$errorText = 'Error when trying to created the directory=>'.PATH_PAGES.'about';
error_log($errorText, 0);
}
if(!mkdir(PATH_PLUGINS_DATABASES.'pages', $dirpermissions, true))
{
$errorText = 'Error when trying to created the directory=>'.PATH_PLUGINS_DATABASES.'pages';
error_log($errorText, 0);
}
if(!mkdir(PATH_PLUGINS_DATABASES.'simplemde', $dirpermissions, true))
{
$errorText = 'Error when trying to created the directory=>'.PATH_PLUGINS_DATABASES.'simplemde';
error_log($errorText, 0);
}
if(!mkdir(PATH_PLUGINS_DATABASES.'tags', $dirpermissions, true))
{
$errorText = 'Error when trying to created the directory=>'.PATH_PLUGINS_DATABASES.'tags';
error_log($errorText, 0);
}
if(!mkdir(PATH_PLUGINS_DATABASES.'about', $dirpermissions, true))
{
$errorText = 'Error when trying to created the directory=>'.PATH_PLUGINS_DATABASES.'about';
error_log($errorText, 0);
}
if(!mkdir(PATH_UPLOADS_PROFILES, $dirpermissions, true))
{
$errorText = 'Error when trying to created the directory=>'.PATH_UPLOADS_PROFILES;
error_log($errorText, 0);
}
if(!mkdir(PATH_TMP, $dirpermissions, true))
{
$errorText = 'Error when trying to created the directory=>'.PATH_TMP;
error_log($errorText, 0);
}
if(!mkdir(PATH_UPLOADS_THUMBNAILS, $dirpermissions, true))
{
$errorText = 'Error when trying to created the directory=>'.PATH_UPLOADS_THUMBNAILS;
error_log($errorText, 0);
}
// ============================================================================
// Create files
// ============================================================================
$dataHead = "<?php defined('BLUDIT') or die('Bludit CMS.'); ?>".PHP_EOL;
// File pages.php
$data = array(
'error'=>array(
'description'=>'Error page',
'username'=>'admin',
'tags'=>array(),
'status'=>'published',
'date'=>$currentDate,
'position'=>0,
'coverImage'=>'',
'md5file'=>'',
'category'=>'',
'uuid'=>md5(uniqid())
),
'about'=>array(
'description'=>$Language->get('About your site or yourself'),
'username'=>'admin',
'tags'=>array(),
'status'=>'published',
'date'=>$currentDate,
'position'=>1,
'coverImage'=>'',
'md5file'=>'',
'category'=>'',
'uuid'=>md5(uniqid())
)
);
file_put_contents(PATH_DATABASES.'pages.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
// File posts.php
$data = array(
$firstPostSlug=>array(
'description'=>$Language->get('Welcome to Bludit'),
'username'=>'admin',
'status'=>'published',
'tags'=>array('bludit'=>'Bludit','cms'=>'CMS','flat-files'=>'Flat files'),
'allowComments'=>'false',
'date'=>$currentDate,
'coverImage'=>'',
'md5file'=>'',
'category'=>'',
'uuid'=>md5(uniqid())
)
);
file_put_contents(PATH_DATABASES.'posts.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
// File site.php
$data = array(
'title'=>'BLUDIT',
'slogan'=>'CMS',
'description'=>'',
'footer'=>'Copyright © '.Date::current('Y'),
'language'=>$Language->getCurrentLocale(),
'locale'=>$Language->getCurrentLocale(),
'timezone'=>$timezone,
'theme'=>'log',
'adminTheme'=>'default',
'homepage'=>'',
'postsperpage'=>'6',
'uriPost'=>'/post/',
'uriPage'=>'/',
'uriTag'=>'/tag/',
'uriBlog'=>'/blog/',
'uriCategory'=>'/category/',
'url'=>PROTOCOL.DOMAIN.HTML_PATH_ROOT,
'emailFrom'=>'no-reply@'.DOMAIN
);
file_put_contents(PATH_DATABASES.'site.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
// File users.php
$salt = getRandomString();
$passwordHash = sha1($adminPassword.$salt);
$data = array(
'admin'=>array(
'firstName'=>$Language->get('Administrator'),
'lastName'=>'',
'role'=>'admin',
'password'=>$passwordHash,
'salt'=>$salt,
'email'=>$email,
'registered'=>$currentDate,
'tokenEmail'=>'',
'tokenEmailTTL'=>'2009-03-15 14:00',
'twitter'=>'',
'facebook'=>'',
'googlePlus'=>'',
'instagram'=>''
)
);
file_put_contents(PATH_DATABASES.'users.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
// File security.php
$randomKey = getRandomString();
$randomKey = sha1($randomKey);
$data = array(
'key1'=>$randomKey,
'minutesBlocked'=>5,
'numberFailuresAllowed'=>10,
'blackList'=>array()
);
file_put_contents(PATH_DATABASES.'security.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
// File categories.php
$data = array(
'videos'=>array('name'=>'Videos', 'posts'=>array(), 'pages'=>array())
);
file_put_contents(PATH_DATABASES.'categories.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
// File tags.php
file_put_contents(
PATH_DATABASES.'tags.php',
$dataHead.json_encode(
array(
'postsIndex'=>array(
'bludit'=>array('name'=>'Bludit', 'posts'=>array('first-post')),
'cms'=>array('name'=>'CMS', 'posts'=>array('first-post')),
'flat-files'=>array('name'=>'Flat files', 'posts'=>array('first-post'))
),
'pagesIndex'=>array()
),
JSON_PRETTY_PRINT),
LOCK_EX
);
// PLUGINS
// File plugins/pages/db.php
file_put_contents(
PATH_PLUGINS_DATABASES.'pages'.DS.'db.php',
$dataHead.json_encode(
array(
'position'=>0,
'homeLink'=>true,
'label'=>$Language->get('Pages')
),
JSON_PRETTY_PRINT),
LOCK_EX
);
// File plugins/about/db.php
file_put_contents(
PATH_PLUGINS_DATABASES.'about'.DS.'db.php',
$dataHead.json_encode(
array(
'position'=>0,
'label'=>$Language->get('About'),
'text'=>$Language->get('this-is-a-brief-description-of-yourself-our-your-site')
),
JSON_PRETTY_PRINT),
LOCK_EX
);
// File plugins/simplemde/db.php
file_put_contents(
PATH_PLUGINS_DATABASES.'simplemde'.DS.'db.php',
$dataHead.json_encode(
array(
'position'=>0,
'tabSize'=>4,
'toolbar'=>'"bold", "italic", "heading", "|", "quote", "unordered-list", "|", "link", "image", "code", "horizontal-rule", "|", "preview", "side-by-side", "fullscreen", "guide"'
),
JSON_PRETTY_PRINT),
LOCK_EX
);
// File plugins/tags/db.php
file_put_contents(
PATH_PLUGINS_DATABASES.'tags'.DS.'db.php',
$dataHead.json_encode(
array(
'position'=>0,
'label'=>$Language->get('Tags')
),
JSON_PRETTY_PRINT),
LOCK_EX
);
// File FILENAME for error page
$data = 'Title: '.$Language->get('Error').'
Content: '.$Language->get('The page has not been found');
file_put_contents(PATH_PAGES.'error'.DS.FILENAME, $data, LOCK_EX);
// File FILENAME for about page
$data = 'Title: '.$Language->get('About').'
Content:
'.$Language->get('the-about-page-is-very-important').'
'.$Language->get('change-this-pages-content-on-the-admin-panel');
file_put_contents(PATH_PAGES.'about'.DS.FILENAME, $data, LOCK_EX);
// File FILENAME for welcome post
$text1 = Text::replaceAssoc(
array(
'{{ADMIN_AREA_LINK}}'=>PROTOCOL.DOMAIN.HTML_PATH_ROOT.'admin'
),
$Language->get('Manage your Bludit from the admin panel')
);
$data = 'Title: '.$Language->get('First post').'
Content:
## '.$Language->get('Whats next').'
- '.$text1.'
- '.$Language->get('Follow Bludit on').' [Twitter](https://twitter.com/bludit) / [Facebook](https://www.facebook.com/bluditcms) / [Google+](https://plus.google.com/+Bluditcms)
- '.$Language->get('Chat with developers and users on Gitter').'
- '.$Language->get('Visit the support forum').'
- '.$Language->get('Read the documentation for more information').'
- '.$Language->get('Share with your friends and enjoy');
file_put_contents(PATH_POSTS.$firstPostSlug.DS.FILENAME, $data, LOCK_EX);
return true;
}
// Check form's parameters and finish Bludit installation.
function checkPOST($args)
{
global $Language;
// Check empty password
if( strlen($args['password']) < 6 )
{
return '<div>'.$Language->g('Password must be at least 6 characters long').'</div>';
}
// Check invalid email
if( !Valid::email($args['email']) && ($args['noCheckEmail']=='0') )
{
return '<div>'.$Language->g('Your email address is invalid').'</div><div id="jscompleteEmail">'.$Language->g('Proceed anyway').'</div>';
}
// Sanitize email
$email = sanitize::email($args['email']);
// Install Bludit
install($args['password'], $email, $args['timezone']);
return true;
}
function redirect($url) {
if(!headers_sent()) {
header("Location:".$url, TRUE, 302);
exit;
}
exit('<meta http-equiv="refresh" content="0; url="'.$url.'">');
}
// ============================================================================
// MAIN
// ============================================================================
$error = '';
if( alreadyInstalled() ) {
exit('Bludit already installed');
}
if( isset($_GET['demo']) ) {
install('demo123', '', 'UTC');
redirect(HTML_PATH_ROOT);
}
if( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
$error = checkPOST($_POST);
if($error===true) {
redirect(HTML_PATH_ROOT);
}
}
?>
<!DOCTYPE HTML>
<html class="uk-height-1-1 uk-notouch">
<head>
<base href="bl-kernel/admin/themes/default/">
<meta charset="<?php echo CHARSET ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo $Language->get('Bludit Installer') ?></title>
<!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="./img/favicon.png">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="./css/uikit/uikit.almost-flat.min.css?version=<?php echo time() ?>">
<link rel="stylesheet" type="text/css" href="./css/installer.css?version=<?php echo time() ?>">
<!-- Javascript -->
<script charset="utf-8" src="./js/jquery.min.js?version=<?php echo time() ?>"></script>
<script charset="utf-8" src="./js/uikit/uikit.min.js?version=<?php echo time() ?>"></script>
<script charset="utf-8" src="./js/jstz.min.js?version=<?php echo time() ?>"></script>
</head>
<body class="uk-height-1-1">
<div class="uk-vertical-align uk-text-center uk-height-1-1">
<div class="uk-vertical-align-middle">
<h1 class="title"><?php echo $Language->get('Bludit Installer') ?></h1>
<div class="content">
<?php
$system = checkSystem();
// Missing requirements
if(!empty($system))
{
foreach($system as $values)
{
echo '<div class="uk-panel">';
echo '<div class="uk-panel-badge uk-badge uk-badge-danger">FAIL</div>';
echo '<h3 class="uk-panel-title">'.$values['title'].'</h3>';
echo $values['errorText'];
echo '</div>';
}
}
// Second step
elseif(isset($_GET['language']))
{
?>
<p><?php echo $Language->get('Complete the form choose a password for the username admin') ?></p>
<?php
if(!empty($error)) {
echo '<div class="uk-alert uk-alert-danger">'.$error.'</div>';
}
?>
<form id="jsformInstaller" class="uk-form uk-form-stacked" method="post" action="" autocomplete="off">
<input type="hidden" name="noCheckEmail" id="jsnoCheckEmail" value="0">
<input type="hidden" name="timezone" id="jstimezone" value="0">
<div class="uk-form-row">
<input type="text" value="admin" class="uk-width-1-1 uk-form-large" disabled>
</div>
<div class="uk-form-row">
<input name="password" id="jspassword" type="password" class="uk-width-1-1 uk-form-large" value="<?php echo isset($_POST['password'])?$_POST['password']:'' ?>" placeholder="<?php echo $Language->get('Password') ?>">
</div>
<div class="uk-form-row">
<input name="email" id="jsemail" type="text" class="uk-width-1-1 uk-form-large" placeholder="<?php echo $Language->get('Email') ?>" autocomplete="off" maxlength="100">
</div>
<div class="uk-form-row">
<button type="submit" class="uk-width-1-1 uk-button uk-button-primary uk-button-large"><?php $Language->p('Install') ?></button>
</div>
</form>
<div id="jsshowPassword"><i class="uk-icon-eye"></i> <?php $Language->p('Show password') ?></div>
<?php
}
else
{
?>
<p><?php echo $Language->get('Choose your language') ?></p>
<form class="uk-form" method="get" action="" autocomplete="off">
<div class="uk-form-row">
<select id="jslanguage" name="language" class="uk-width-1-1">
<?php
$htmlOptions = getLanguageList();
foreach($htmlOptions as $locale=>$nativeName) {
echo '<option value="'.$locale.'"'.( ($localeFromHTTP===$locale)?' selected="selected"':'').'>'.$nativeName.'</option>';
}
?>
</select>
</div>
<div class="uk-form-row">
<button type="submit" class="uk-width-1-1 uk-button uk-button-primary uk-button-large"><?php $Language->p('Next') ?></button>
</div>
</form>
<?php
}
?>
</div>
</div>
</div>
<script>
$(document).ready(function()
{
// Timezone
var timezone = jstz.determine();
$("#jstimezone").val( timezone.name() );
// Proceed without email field.
$("#jscompleteEmail").on("click", function() {
$("#jsnoCheckEmail").val("1");
$("#jsformInstaller").submit();
});
// Show password
$("#jsshowPassword").on("click", function() {
var input = document.getElementById("jspassword");
if(input.getAttribute("type")=="text") {
input.setAttribute("type", "password");
}
else {
input.setAttribute("type", "text");
}
});
});
</script>
</body>
</html>