-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
905 lines (736 loc) · 33 KB
/
index.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
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
<?php
/*
Script Name: WP Quick Install
Author: Jonathan Buttigieg
Contributors: Julio Potier
Script URI: http://wp-quick-install.com
Version: 1.4.1
Licence: GPLv3
Last Update: 08 jan 15
*/
@set_time_limit( 0 );
define( 'WP_API_CORE' , 'http://api.wordpress.org/core/version-check/1.7/?locale=' );
define( 'WPQI_CACHE_PATH' , 'cache/' );
define( 'WPQI_CACHE_CORE_PATH' , WPQI_CACHE_PATH . 'core/' );
define( 'WPQI_CACHE_PLUGINS_PATH' , WPQI_CACHE_PATH . 'plugins/' );
require( 'inc/functions.php' );
// Force URL with index.php
if ( empty( $_GET ) && end( ( explode( '/' , trim($_SERVER['REQUEST_URI'], '/') ) ) ) == 'install-wp' ) {
header( 'Location: index.php' );
die();
}
// Create cache directories
if ( ! is_dir( WPQI_CACHE_PATH ) ) {
mkdir( WPQI_CACHE_PATH );
}
if ( ! is_dir( WPQI_CACHE_CORE_PATH ) ) {
mkdir( WPQI_CACHE_CORE_PATH );
}
if ( ! is_dir( WPQI_CACHE_PLUGINS_PATH ) ) {
mkdir( WPQI_CACHE_PLUGINS_PATH );
}
// We verify if there is a preconfig file
$data = array();
if ( file_exists( 'data.ini' ) ) {
$data = json_encode( parse_ini_file( 'data.ini' ) );
}
// We add ../ to directory
$directory = ! empty( $_POST['directory'] ) ? '../' . $_POST['directory'] . '/' : '../';
if ( isset( $_GET['action'] ) ) {
switch( $_GET['action'] ) {
case "check_before_upload" :
$data = array();
/*--------------------------*/
/* We verify if we can connect to DB or WP is not installed yet
/*--------------------------*/
// DB Test
try {
$db = new PDO('mysql:host='. $_POST['dbhost'] .';dbname=' . $_POST['dbname'] , $_POST['uname'], $_POST['pwd'] );
}
catch (Exception $e) {
$data['db'] = "error etablishing connection";
}
// WordPress test
if ( file_exists( $directory . 'wp-config.php' ) ) {
$data['wp'] = "error directory";
}
// We send the response
echo json_encode( $data );
break;
case "download_wp" :
// Get WordPress language
$language = substr( $_POST['language'], 0, 6 );
// Get WordPress data
$wp = json_decode( file_get_contents( WP_API_CORE . $language ) )->offers[0];
/*--------------------------*/
/* We download the latest version of WordPress
/*--------------------------*/
if ( ! file_exists( WPQI_CACHE_CORE_PATH . 'wordpress-' . $wp->version . '-' . $language . '.zip' ) ) {
file_put_contents( WPQI_CACHE_CORE_PATH . 'wordpress-' . $wp->version . '-' . $language . '.zip', file_get_contents( $wp->download ) );
}
break;
case "unzip_wp" :
// Get WordPress language
$language = substr( $_POST['language'], 0, 6 );
// Get WordPress data
$wp = json_decode( file_get_contents( WP_API_CORE . $language ) )->offers[0];
/*--------------------------*/
/* We create the website folder with the files and the WordPress folder
/*--------------------------*/
// If we want to put WordPress in a subfolder we create it
if ( ! empty( $directory ) ) {
// Let's create the folder
mkdir( $directory );
// We set the good writing rights
chmod( $directory , 0755 );
}
$zip = new ZipArchive;
// We verify if we can use the archive
if ( $zip->open( WPQI_CACHE_CORE_PATH . 'wordpress-' . $wp->version . '-' . $language . '.zip' ) === true ) {
// Let's unzip
$zip->extractTo( '.' );
$zip->close();
// We scan the folder
$files = scandir( 'wordpress' );
// We remove the "." and ".." from the current folder and its parent
$files = array_diff( $files, array( '.', '..' ) );
// We move the files and folders
foreach ( $files as $file ) {
rename( 'wordpress/' . $file, $directory . '/' . $file );
}
rmdir( 'wordpress' ); // We remove WordPress folder
unlink( $directory . '/license.txt' ); // We remove licence.txt
unlink( $directory . '/readme.html' ); // We remove readme.html
unlink( $directory . '/wp-content/plugins/hello.php' ); // We remove Hello Dolly plugin
}
break;
case "wp_config" :
/*--------------------------*/
/* Let's create the wp-config file
/*--------------------------*/
// We retrieve each line as an array
$config_file = file( $directory . 'wp-config-sample.php' );
// Managing the security keys
$secret_keys = explode( "\n", file_get_contents( 'https://api.wordpress.org/secret-key/1.1/salt/' ) );
foreach ( $secret_keys as $k => $v ) {
$secret_keys[$k] = substr( $v, 28, 64 );
}
// We change the data
$key = 0;
foreach ( $config_file as &$line ) {
if ( '$table_prefix =' == substr( $line, 0, 16 ) ) {
$line = '$table_prefix = \'' . sanit( $_POST[ 'prefix' ] ) . "';\r\n";
continue;
}
if ( ! preg_match( '/^define\(\'([A-Z_]+)\',([ ]+)/', $line, $match ) ) {
continue;
}
$constant = $match[1];
switch ( $constant ) {
case 'WP_DEBUG' :
// Debug mod
if ( (int) $_POST['debug'] == 1 ) {
$line = "define('WP_DEBUG', 'true');\r\n";
// Display error
if ( (int) $_POST['debug_display'] == 1 ) {
$line .= "\r\n\n " . "/** Affichage des erreurs à l'écran */" . "\r\n";
$line .= "define('WP_DEBUG_DISPLAY', 'true');\r\n";
}
// To write error in a log files
if ( (int) $_POST['debug_log'] == 1 ) {
$line .= "\r\n\n " . "/** Ecriture des erreurs dans un fichier log */" . "\r\n";
$line .= "define('WP_DEBUG_LOG', 'true');\r\n";
}
}
// We add the extras constant
if ( ! empty( $_POST['uploads'] ) ) {
$line .= "\r\n\n " . "/** Dossier de destination des fichiers uploadés */" . "\r\n";
$line .= "define('UPLOADS', '" . sanit( $_POST['uploads'] ) . "');";
}
if ( (int) $_POST['post_revisions'] >= 0 ) {
$line .= "\r\n\n " . "/** Désactivation des révisions d'articles */" . "\r\n";
$line .= "define('WP_POST_REVISIONS', " . (int) $_POST['post_revisions'] . ");";
}
if ( (int) $_POST['disallow_file_edit'] == 1 ) {
$line .= "\r\n\n " . "/** Désactivation de l'éditeur de thème et d'extension */" . "\r\n";
$line .= "define('DISALLOW_FILE_EDIT', true);";
}
if ( (int) $_POST['autosave_interval'] >= 60 ) {
$line .= "\r\n\n " . "/** Intervalle des sauvegardes automatique */" . "\r\n";
$line .= "define('AUTOSAVE_INTERVAL', " . (int) $_POST['autosave_interval'] . ");";
}
if ( ! empty( $_POST['wpcom_api_key'] ) ) {
$line .= "\r\n\n " . "/** WordPress.com API Key */" . "\r\n";
$line .= "define('WPCOM_API_KEY', '" . $_POST['wpcom_api_key'] . "');";
}
$line .= "\r\n\n " . "/** On augmente la mémoire limite */" . "\r\n";
$line .= "define('WP_MEMORY_LIMIT', '96M');" . "\r\n";
break;
case 'DB_NAME' :
$line = "define('DB_NAME', '" . sanit( $_POST[ 'dbname' ] ) . "');\r\n";
break;
case 'DB_USER' :
$line = "define('DB_USER', '" . sanit( $_POST['uname'] ) . "');\r\n";
break;
case 'DB_PASSWORD' :
$line = "define('DB_PASSWORD', '" . sanit( $_POST['pwd'] ) . "');\r\n";
break;
case 'DB_HOST' :
$line = "define('DB_HOST', '" . sanit( $_POST['dbhost'] ) . "');\r\n";
break;
case 'AUTH_KEY' :
case 'SECURE_AUTH_KEY' :
case 'LOGGED_IN_KEY' :
case 'NONCE_KEY' :
case 'AUTH_SALT' :
case 'SECURE_AUTH_SALT' :
case 'LOGGED_IN_SALT' :
case 'NONCE_SALT' :
$line = "define('" . $constant . "', '" . $secret_keys[$key++] . "');\r\n";
break;
case 'WPLANG' :
$line = "define('WPLANG', '" . sanit( $_POST['language'] ) . "');\r\n";
break;
}
}
unset( $line );
$handle = fopen( $directory . 'wp-config.php', 'w' );
foreach ( $config_file as $line ) {
fwrite( $handle, $line );
}
fclose( $handle );
// We set the good rights to the wp-config file
chmod( $directory . 'wp-config.php', 0666 );
break;
case "install_wp" :
/*--------------------------*/
/* Let's install WordPress database
/*--------------------------*/
define( 'WP_INSTALLING', true );
/** Load WordPress Bootstrap */
require_once( $directory . 'wp-load.php' );
/** Load WordPress Administration Upgrade API */
require_once( $directory . 'wp-admin/includes/upgrade.php' );
/** Load wpdb */
require_once( $directory . 'wp-includes/wp-db.php' );
// WordPress installation
wp_install( $_POST[ 'weblog_title' ], $_POST['user_login'], $_POST['admin_email'], (int) $_POST[ 'blog_public' ], '', $_POST['admin_password'] );
// We update the options with the right siteurl et homeurl value
$protocol = ! is_ssl() ? 'http' : 'https';
$get = basename( dirname( __FILE__ ) ) . '/index.php/wp-admin/install.php?action=install_wp';
$dir = str_replace( '../', '', $directory );
$link = $protocol . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$url = str_replace( $get, $dir, $link );
$url = trim( $url, '/' );
update_option( 'siteurl', $url );
update_option( 'home', $url );
/*--------------------------*/
/* We remove the default content
/*--------------------------*/
if ( $_POST['default_content'] == '1' ) {
wp_delete_post( 1, true ); // We remove the article "Hello World"
wp_delete_post( 2, true ); // We remove the "Exemple page"
}
/*--------------------------*/
/* We update permalinks
/*--------------------------*/
if ( ! empty( $_POST['permalink_structure'] ) ) {
update_option( 'permalink_structure', $_POST['permalink_structure'] );
}
/*--------------------------*/
/* We update the media settings
/*--------------------------*/
if ( ! empty( $_POST['thumbnail_size_w'] ) || !empty($_POST['thumbnail_size_h'] ) ) {
update_option( 'thumbnail_size_w', (int) $_POST['thumbnail_size_w'] );
update_option( 'thumbnail_size_h', (int) $_POST['thumbnail_size_h'] );
update_option( 'thumbnail_crop', (int) $_POST['thumbnail_crop'] );
}
if ( ! empty( $_POST['medium_size_w'] ) || !empty( $_POST['medium_size_h'] ) ) {
update_option( 'medium_size_w', (int) $_POST['medium_size_w'] );
update_option( 'medium_size_h', (int) $_POST['medium_size_h'] );
}
if ( ! empty( $_POST['large_size_w'] ) || !empty( $_POST['large_size_h'] ) ) {
update_option( 'large_size_w', (int) $_POST['large_size_w'] );
update_option( 'large_size_h', (int) $_POST['large_size_h'] );
}
update_option( 'uploads_use_yearmonth_folders', (int) $_POST['uploads_use_yearmonth_folders'] );
/*--------------------------*/
/* We add the pages we found in the data.ini file
/*--------------------------*/
// We check if data.ini exists
if ( file_exists( 'data.ini' ) ) {
// We parse the file and get the array
$file = parse_ini_file( 'data.ini' );
// We verify if we have at least one page
if ( count( $file['posts'] ) >= 1 ) {
foreach ( $file['posts'] as $post ) {
// We get the line of the page configuration
$pre_config_post = explode( "-", $post );
$post = array();
foreach ( $pre_config_post as $config_post ) {
// We retrieve the page title
if ( preg_match( '#title::#', $config_post ) == 1 ) {
$post['title'] = str_replace( 'title::', '', $config_post );
}
// We retrieve the status (publish, draft, etc...)
if ( preg_match( '#status::#', $config_post ) == 1 ) {
$post['status'] = str_replace( 'status::', '', $config_post );
}
// On retrieve the post type (post, page or custom post types ...)
if ( preg_match( '#type::#', $config_post ) == 1 ) {
$post['type'] = str_replace( 'type::', '', $config_post );
}
// We retrieve the content
if ( preg_match( '#content::#', $config_post ) == 1 ) {
$post['content'] = str_replace( 'content::', '', $config_post );
}
// We retrieve the slug
if ( preg_match( '#slug::#', $config_post ) == 1 ) {
$post['slug'] = str_replace( 'slug::', '', $config_post );
}
// We retrieve the title of the parent
if ( preg_match( '#parent::#', $config_post ) == 1 ) {
$post['parent'] = str_replace( 'parent::', '', $config_post );
}
} // foreach
if ( isset( $post['title'] ) && !empty( $post['title'] ) ) {
$parent = get_page_by_title( trim( $post['parent'] ) );
$parent = $parent ? $parent->ID : 0;
// Let's create the page
$args = array(
'post_title' => trim( $post['title'] ),
'post_name' => $post['slug'],
'post_content' => trim( $post['content'] ),
'post_status' => $post['status'],
'post_type' => $post['type'],
'post_parent' => $parent,
'post_author' => 1,
'post_date' => date('Y-m-d H:i:s'),
'post_date_gmt' => gmdate('Y-m-d H:i:s'),
'comment_status' => 'closed',
'ping_status' => 'closed'
);
wp_insert_post( $args );
}
}
}
}
break;
case "install_theme" :
/** Load WordPress Bootstrap */
require_once( $directory . 'wp-load.php' );
/** Load WordPress Administration Upgrade API */
require_once( $directory . 'wp-admin/includes/upgrade.php' );
/*--------------------------*/
/* We install the new theme
/*--------------------------*/
// We verify if theme.zip exists
if ( file_exists( 'theme.zip' ) ) {
$zip = new ZipArchive;
// We verify we can use it
if ( $zip->open( 'theme.zip' ) === true ) {
// We retrieve the name of the folder
$stat = $zip->statIndex( 0 );
$theme_name = str_replace('/', '' , $stat['name']);
// We unzip the archive in the themes folder
$zip->extractTo( $directory . 'wp-content/themes/' );
$zip->close();
// Let's activate the theme
// Note : The theme is automatically activated if the user asked to remove the default theme
if ( $_POST['activate_theme'] == 1 || $_POST['delete_default_themes'] == 1 ) {
switch_theme( $theme_name, $theme_name );
}
// Let's remove the Tweenty family
if ( $_POST['delete_default_themes'] == 1 ) {
delete_theme( 'twentyfourteen' );
delete_theme( 'twentythirteen' );
delete_theme( 'twentytwelve' );
delete_theme( 'twentyeleven' );
delete_theme( 'twentyten' );
}
// We delete the _MACOSX folder (bug with a Mac)
delete_theme( '__MACOSX' );
}
}
break;
case "install_plugins" :
/*--------------------------*/
/* Let's retrieve the plugin folder
/*--------------------------*/
if ( ! empty( $_POST['plugins'] ) ) {
$plugins = explode( ";", $_POST['plugins'] );
$plugins = array_map( 'trim' , $plugins );
$plugins_dir = $directory . 'wp-content/plugins/';
foreach ( $plugins as $plugin ) {
// We retrieve the plugin XML file to get the link to downlad it
$plugin_repo = file_get_contents( "http://api.wordpress.org/plugins/info/1.0/$plugin.json" );
if ( $plugin_repo && $plugin = json_decode( $plugin_repo ) ) {
$plugin_path = WPQI_CACHE_PLUGINS_PATH . $plugin->slug . '-' . $plugin->version . '.zip';
if ( ! file_exists( $plugin_path ) ) {
// We download the lastest version
if ( $download_link = file_get_contents( $plugin->download_link ) ) {
file_put_contents( $plugin_path, $download_link );
} }
// We unzip it
$zip = new ZipArchive;
if ( $zip->open( $plugin_path ) === true ) {
$zip->extractTo( $plugins_dir );
$zip->close();
}
}
}
}
if ( $_POST['plugins_premium'] == 1 ) {
// We scan the folder
$plugins = scandir( 'plugins' );
// We remove the "." and ".." corresponding to the current and parent folder
$plugins = array_diff( $plugins, array( '.', '..' ) );
// We move the archives and we unzip
foreach ( $plugins as $plugin ) {
// We verify if we have to retrive somes plugins via the WP Quick Install "plugins" folder
if ( preg_match( '#(.*).zip$#', $plugin ) == 1 ) {
$zip = new ZipArchive;
// We verify we can use the archive
if ( $zip->open( 'plugins/' . $plugin ) === true ) {
// We unzip the archive in the plugin folder
$zip->extractTo( $plugins_dir );
$zip->close();
}
}
}
}
/*--------------------------*/
/* We activate extensions
/*--------------------------*/
if ( $_POST['activate_plugins'] == 1 ) {
/** Load WordPress Bootstrap */
require_once( $directory . 'wp-load.php' );
/** Load WordPress Plugin API */
require_once( $directory . 'wp-admin/includes/plugin.php');
// Activation
activate_plugins( array_keys( get_plugins() ) );
}
break;
case "success" :
/*--------------------------*/
/* If we have a success we add the link to the admin and the website
/*--------------------------*/
/** Load WordPress Bootstrap */
require_once( $directory . 'wp-load.php' );
/** Load WordPress Administration Upgrade API */
require_once( $directory . 'wp-admin/includes/upgrade.php' );
/*--------------------------*/
/* We update permalinks
/*--------------------------*/
if ( ! empty( $_POST['permalink_structure'] ) ) {
file_put_contents( $directory . '.htaccess' , null );
flush_rewrite_rules();
}
echo '<div id="errors" class="alert alert-danger"><p style="margin:0;"><strong>' . _('Warning') . '</strong>: Don\'t forget to delete WP Quick Install folder.</p></div>';
// Link to the admin
echo '<a href="' . admin_url() . '" class="button" style="margin-right:5px;" target="_blank">'. _('Log In') . '</a>';
echo '<a href="' . home_url() . '" class="button" target="_blank">' . _('Go to website') . '</a>';
break;
}
}
else { ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr">
<head>
<meta charset="utf-8" />
<title>StackPress WordPress Installation</title>
<!-- Get out Google! -->
<meta name="robots" content="noindex, nofollow">
<!-- CSS files -->
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Open+Sans%3A300italic%2C400italic%2C600italic%2C300%2C400%2C600&subset=latin%2Clatin-ext&ver=3.9.1" />
<link rel="stylesheet" href="assets/css/style.min.css" />
<link rel="stylesheet" href="assets/css/buttons.min.css" />
<link rel="stylesheet" href="assets/css/bootstrap.min.css" />
</head>
<body class="wp-core-ui">
<h1 id="logo"><a href="https://stackpress.net/">WordPress</a></h1>
<?php
$parent_dir = realpath( dirname ( dirname( __FILE__ ) ) );
if ( is_writable( $parent_dir ) ) { ?>
<div id="response"></div>
<div class="progress" style="display:none;">
<div class="progress-bar progress-bar-striped active" style="width: 0%;"></div>
</div>
<div id="success" style="display:none; margin: 10px 0;">
<h1 style="margin: 0"><?php echo _('The world is yours') ;?></h1>
<p><?php echo _('WordPress has been installed.') ;?></p>
</div>
<form method="post" action="">
<div id="errors" class="alert alert-danger" style="display:none;">
<strong><?php echo _('Warning');?></strong>
</div>
<h1><?php echo _('Warning');?></h1>
<p><?php echo _('This file must be in the install-wp folder and not be present in the root of your project.');?></p>
<h1><?php echo _('Database Information');?></h1>
<p><?php echo _( "Below you should enter your database connection details you created in your StackPress account." ); ?></p>
<table class="form-table">
<tr>
<th scope="row"><label for="dbname"><?php echo _('Database name');?></label></th>
<td><input name="dbname" id="dbname" type="text" size="25" value="" class="required" /></td>
<td><?php echo _( 'The name of the database you want to run WP in.' ); ?></td>
</tr>
<tr>
<th scope="row"><label for="uname"><?php echo _( 'Database username' );?></label></th>
<td><input name="uname" id="uname" type="text" size="25" value="" class="required" /></td>
<td><?php echo _( 'Your MySQL username' ); ?></td>
</tr>
<tr>
<th scope="row"><label for="pwd"><?php echo _('Password');?></label></th>
<td><input name="pwd" id="pwd" type="text" size="25" value="" /></td>
<td><?php echo _('…and your MySQL password.');?></td>
</tr>
<tr>
<th scope="row"><label for="dbhost"><?php echo _( 'Database Host' ); ?></label></th>
<td><input name="dbhost" id="dbhost" type="text" size="25" value="localhost" class="required" /></td>
<td><?php echo _( 'Do not change this !' ); ?></td>
</tr>
<tr>
<th scope="row"><label for="prefix"><?php echo _( 'Table Prefix' ); ?></label></th>
<td><input name="prefix" id="prefix" type="text" value="wp_" size="25" class="required" /></td>
<td><?php echo _( 'If you want to run multiple WordPress installations in a single database, change this.' ); ?></td>
</tr>
<tr>
<th scope="row"><label for="default_content"><?php echo _('Default content');?></label></th>
<td>
<label><input type="checkbox" name="default_content" id="default_content" value="1" checked="checked" /> <?php echo _('Delete the content')?></label>
</td>
<td><?php echo _('If you want to delete the default content added par WordPress (post, page, comment and links).');?></td>
</tr>
</table>
<h1><?php echo _('Required Information');?></h1>
<p><?php echo _('Don\'t worry, you will be able to change it later.');?></p>
<table class="form-table">
<tr>
<th scope="row"><label for="language"><?php echo _('Language');?></label></th>
<td>
<select id="language" name="language">
<option value="en_US">English (United States)</option>
<?php
// Get all available languages
$languages = json_decode( file_get_contents( 'http://api.wordpress.org/translations/core/1.0/?version=4.0' ) )->translations;
foreach ( $languages as $language ) {
echo '<option value="' . $language->language . '">' . $language->native_name . '</option>';
}
?>
</select>
</td>
</tr>
<!--
<tr>
<th scope="row">
<label for="directory"><?php echo _('Installation Folder');?></label>
<p><?php echo _('Leave blank to install on the root folder');?></p>
</th>
<td>
<input name="directory" type="text" id="directory" size="25" value="" />
</td>
</tr>
-->
<tr>
<th scope="row"><label for="weblog_title"><?php echo _('Site Title');?></label></th>
<td><input name="weblog_title" type="text" id="weblog_title" size="25" value="" class="required" /></td>
</tr>
<tr>
<th scope="row"><label for="user_login"><?php echo _('Username');?></label></th>
<td>
<input name="user_login" type="text" id="user_login" size="25" value="" class="required" />
<p><?php echo _('Usernames can have only alphanumeric characters, spaces, underscores, hyphens, periods and the @ symbol.');?></p>
</td>
</tr>
<tr>
<th scope="row">
<label for="admin_password"><?php echo _('Password');?></label>
<p><?php echo _('A password will be automatically generated for you if you leave this blank.');?></p>
</th>
<td>
<input name="admin_password" type="password" id="admin_password" size="25" value="" />
<p><?php echo _('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ & ).');?>.</p>
</td>
</tr>
<tr>
<th scope="row"><label for="admin_email"><?php echo _('Your E-mail');?></label></th>
<td><input name="admin_email" type="text" id="admin_email" size="25" value="" class="required" />
<p><?php echo _('Double-check your email address before continuing.');?></p></td>
</tr>
<tr>
<th scope="row"><label for="blog_public"><?php echo _('Privacy');?></label></th>
<td colspan="2"><label><input type="checkbox" id="blog_public" name="blog_public" value="1" checked="checked" /> <?php echo _('Allow search engines to index this site.');?></label></td>
</tr>
</table>
<!--
<h1><?php echo _('Theme Informations');?></h1>
<p><?php echo _('Enter the information below for your personal theme.');?></p>
<div class="alert alert-info">
<p style="margin:0px; padding:0px;"><?php echo _('WP Quick Install will automatically install your theme if it\'s on wp-quick-install folder and named theme.zip');?></p>
</div>
<table class="form-table">
<tr>
<th scope="row">
<label for="activate_theme"><?php echo _('Automatic Activation');?></label>
</th>
<td colspan="2">
<label><input type="checkbox" id="activate_theme" name="activate_theme" value="1" /> <?php echo _('Activate the theme after installing WordPress.');?></label>
</td>
</tr>
<tr>
<th scope="row">
<label for="delete_default_themes"><?php echo _('Default Themes');?></label>
</th>
<td colspan="2"><label><input type="checkbox" id="delete_default_themes" name="delete_default_themes" value="1" /> <?php echo _('Delete the default themes (Twenty Family).');?></label></td>
</tr>
</table>
-->
<h1><?php echo _('Extensions Information');?></h1>
<p><?php echo _('We have added security and performance plugins we highly recommend. You can add your own if you like.');?></p>
<table class="form-table">
<tr>
<th scope="row">
<label for="plugins"><?php echo _('Free Extensions');?></label>
<p><?php echo _('The extension slug is available in the url (Ex: http://wordpress.org/extend/plugins/<strong>wordpress-seo</strong>)');?></p>
</th>
<td>
<input name="plugins" type="text" id="plugins" size="50" value="wp-simple-firewall; sucuri-scanner; backupwordpress; wp-super-cache; rocket-lazy-load; akismet" />
<p><?php echo _('Make sure that the extensions slugs are separated by a semicolon (;).');?></p>
</td>
</tr>
<!--
<tr>
<th scope="row">
<label for="plugins"><?php echo _('Premium Extensions');?></label>
<p><?php echo _('Zip Archives have to be in the <em>plugins</em> folder at the <em>install-wp</em> root folder.');?></p>
</th>
<td><label><input type="checkbox" id="plugins_premium" name="plugins_premium" value="1" /> <?php echo _('Install the premium extensions after WordPress installation.');?></label></td>
</tr>
<tr>
<th scope="row">
<label for="plugins"><?php echo _('Automatic activation');?></label>
</th>
<td><label><input type="checkbox" name="activate_plugins" id="activate_plugins" value="1" /> <?php echo _('Activate the extensions after WordPress installation.');?></label></td>
</tr>
-->
</table>
<h1><?php echo _('Permalinks Information');?></h1>
<p><?php echo sprintf( _('By default WordPress uses web URLs which have question marks and lots of numbers in them; however, WordPress offers you the ability to create a custom URL structure for your permalinks and archives. This can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="%s">number of tags are available</a>.'), 'http://codex.wordpress.org/Using_Permalinks'); ?></p>
<table class="form-table">
<tr>
<th scope="row">
<label for="permalink_structure"><?php echo _('Custom Structure');?></label>
</th>
<td>
<code>http://<?php echo $_SERVER['SERVER_NAME']; ?></code>
<input name="permalink_structure" type="text" id="permalink_structure" size="50" value="/%postname%/" />
</td>
</tr>
</table>
<!--
<h1><?php echo _('Media Informations');?></h1>
<p><?php echo _('Specified dimensions below determine the maximum dimensions (in pixels) to use when inserting an image into the body of an article.');?></p>
<table class="form-table">
<tr>
<th scope="row"><?php echo _('Thumbnail sizes');?></th>
<td>
<label for="thumbnail_size_w"><?php echo _('Width : ');?></label>
<input name="thumbnail_size_w" style="width:100px;" type="number" id="thumbnail_size_w" min="0" step="10" value="0" size="1" />
<label for="thumbnail_size_h"><?php echo _('Height : ');?></label>
<input name="thumbnail_size_h" style="width:100px;" type="number" id="thumbnail_size_h" min="0" step="10" value="0" size="1" /><br>
<label for="thumbnail_crop" class="small-text"><input name="thumbnail_crop" type="checkbox" id="thumbnail_crop" value="1" checked="checked" /><?php echo _('Resize images to get the exact dimensions');?></label>
</td>
</tr>
<tr>
<th scope="row"><?php echo _('Middle Size');?></th>
<td>
<label for="medium_size_w"><?php echo _('Width :');?></label>
<input name="medium_size_w" style="width:100px;" type="number" id="medium_size_w" min="0" step="10" value="0" size="5" />
<label for="medium_size_h"><?php echo _('Height : ');?></label>
<input name="medium_size_h" style="width:100px;" type="number" id="medium_size_h" min="0" step="10" value="0" size="5" /><br>
</td>
</tr>
<tr>
<th scope="row"><?php echo _('Big Size');?></th>
<td>
<label for="large_size_w"><?php echo _('Width : ');?></label>
<input name="large_size_w" style="width:100px;" type="number" id="large_size_w" min="0" step="10" value="0" size="5" />
<label for="large_size_h"><?php echo _('Height : ');?></label>
<input name="large_size_h" style="width:100px;" type="number" id="large_size_h" min="0" step="10" value="0" size="5" /><br>
</td>
</tr>
<tr>
<th scope="row">
<label for="upload_dir"><?php echo _('Store uploaded files in this folder');?></label>
<p><?php echo _('By default, medias are stored in the <em> wp-content/uploads</em> folder');?></p>
</th>
<td>
<input type="text" id="upload_dir" name="upload_dir" size="46" value="" /><br/>
<label for="uploads_use_yearmonth_folders" class="small-text"><input name="uploads_use_yearmonth_folders" type="checkbox" id="uploads_use_yearmonth_folders" value="1" checked="checked" /><?php echo _('Organize my files in monthly and annual folders')?></label>
</td>
</tr>
</table>
<h1><?php echo _('wp-config.php Informations');?></h1>
<p><?php echo _('Choose below the additional constants you want to add in <strong>wp-config.php</strong>');?></p>
<table class="form-table">
<tr>
<th scope="row">
<label for="post_revisions"><?php echo _('Revisions');?></label>
<p><?php echo _('By default, number of post revision is unlimited');?></p>
</th>
<td>
<input name="post_revisions" id="post_revisions" type="number" min="0" value="0" />
</td>
</tr>
<tr>
<th scope="row">
<label for="plugins"><?php echo _('Editor');?></label>
</th>
<td><label><input type="checkbox" id="disallow_file_edit" name="disallow_file_edit" value="1" checked='checked' /><?php echo _('Disable theme and extensions editor');?></label></td>
</tr>
<tr>
<th scope="row">
<label for="autosave_interval"><?php echo _('Autosave');?></label>
<p><?php echo _('By default, autosave interval is 60 seconds.');?></p>
</th>
<td><input name="autosave_interval" id="autosave_interval" type="number" min="60" step="60" size="25" value="7200" /> <?php echo _('seconds');?></td>
</tr>
<tr>
<th scope="row">
<label for="debug"><?php echo _('Debug Mode');?></label>
</th>
<td>
<label><input type="checkbox" name="debug" id="debug" value="1" /> <?php echo _('Enable WordPress debug mode</label><p>By checking this box, WordPress will displaying errors</p>');?>
<div id="debug_options" style="display:none;">
<label><input type="checkbox" name="debug_display" id="debug_display" value="1" /> <?php echo _('Enable WP Debug');?></label>
<br/>
<label><input type="checkbox" name="debug_log" id="debug_log" value="1" /> <?php echo _('Write errors in a log file <em>(wp-content/debug.log)</em>. ');?></label>
</div>
</td>
</tr>
<tr>
<th scope="row">
<label for="wpcom_api_key"><?php echo _('WP.com API Key');?></label>
</th>
<td><input name="wpcom_api_key" id="wpcom_api_key" type="text" size="25" value="" /></td>
</tr>
-->
</table>
<p class="step"><span id="submit" class="button button-large"><?php echo _('Install WordPress');?></span></p>
</form>
<script src="assets/js/jquery-1.8.3.min.js"></script>
<script>var data = <?php echo $data; ?>;</script>
<script src="assets/js/script.js"></script>
<?php
} else { ?>
<div class="alert alert-error" style="margin-bottom: 0px;">
<strong><?php echo _('Warning !');?></strong>
<p style="margin-bottom:0px;"><?php echo _('You don\'t have the good permissions rights on ') . basename( $parent_dir ) . _('. Thank you to set the good files permissions.') ;?></p>
</div>
<?php
}
?>
</body>
</html>
<?php
}