forked from pulamus/openclassifieds2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-yclas.php
executable file
·1456 lines (1342 loc) · 65.1 KB
/
install-yclas.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
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* HTML template for the install
*
* @package Install
* @category Helper
* @author Chema <[email protected]>
* @copyright (c) 2009-2014 Open Classifieds Team
* @license GPL v3
*/
ob_start();
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
ini_set('display_errors', 1);
@set_time_limit(0);
// Set the full path to the docroot
define('DOCROOT', realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR);
//we check first short tags if not we can not even load the installer
if (! ((bool) ini_get('short_open_tag')) )
die('<strong><u>OC Installation requirement</u></strong>: Before you proceed with your OC installation: Keep in mind OC uses the short tag "short cut" syntax.<br><br> Thus the <a href="http://php.net/manual/ini.core.php#ini.short-open-tag" target="_blank">short_open_tag</a> directive must be enabled in your php.ini.<br><br><u>Easy Solution</u>:<ol><li>Open php.ini file and look for line short_open_tag = Off</li><li>Replace it with short_open_tag = On</li><li>Restart then your PHP server</li><li>Refresh this page to resume your OC installation</li><li>Enjoy OC ;)</li></ol>');
//prevent from new install to be done over current existing one
if (file_exists(DOCROOT.'oc/config/database.php'))
die('It seems Yclas is already installed');
//read from oc/versions.json on CDN
$versions = install::versions();
$last_version = key($versions);
$is_compatible = install::is_compatible();
/**
* Helper installation classes
*
* @package Install
* @category Helper
* @author Chema <[email protected]>
* @copyright (c) 2009-2016 Open Classifieds Team
* @license GPL v3
*/
/**
* Class with install functions helper
*/
class install{
/**
*
* Software install settings
* @var string
*/
const VERSION = '3.6.0';
/**
* default locale/language of the install
* @var string
*/
public static $locale = 'en_UK';
/**
* message to notify
* @var string
*/
public static $msg = '';
/**
* installation error messages here
* @var string
*/
public static $error_msg = '';
/**
* checks that your hosting has everything that needs to have
* @return array
*/
public static function requirements()
{
/**
* mod rewrite check
*/
$mod_result = ((function_exists('apache_get_modules') AND in_array('mod_rewrite',apache_get_modules()))
OR (getenv('HTTP_MOD_REWRITE')=='On')
OR (strpos(@shell_exec('/usr/local/apache/bin/apachectl -l'), 'mod_rewrite') !== FALSE)
OR (isset($_SERVER['IIS_UrlRewriteModule'])));
$mod_msg = ($mod_result)?NULL:'Can not check if mod_rewrite is installed, probably everything is fine. Try to proceed with the installation anyway ;)';
/**
* all the install checks
*/
return array(
'New Installation'=>array('message' => 'It seems that Yclas is already installed',
'mandatory' => TRUE,
'result' => !file_exists('oc/config/database.php')
),
'Write DIR' =>array('message' => 'Can\'t write to the current directory. Please fix this by giving the webserver user write access to the directory.',
'mandatory' => TRUE,
'result' => (is_writable(DOCROOT))
),
'PHP' =>array('message' => 'PHP 5.6 or newer is required, this version is '. PHP_VERSION,
'mandatory' => TRUE,
'result' => version_compare(PHP_VERSION, '5.6', '>=')
),
'mod_rewrite'=>array('message' => $mod_msg,
'mandatory' => FALSE,
'result' => $mod_result
),
'Short Tag' =>array('message' => '<a href="http://www.php.net/manual/en/ini.core.php#ini.short-open-tag">short_open_tag</a> must be enabled in your php.ini.',
'mandatory' => TRUE,
'result' => (bool) ini_get('short_open_tag')
),
'Safe Mode' =>array('message' => '<a href="http://php.net/manual/en/features.safe-mode.php>safe_mode</a> must be disabled.',
'mandatory' => TRUE,
'result' => ((bool) ini_get('safe_mode'))?FALSE:TRUE
),
'SPL' =>array('message' => 'PHP <a href="http://www.php.net/spl">SPL</a> is either not loaded or not compiled in.',
'mandatory' => TRUE,
'result' => (function_exists('spl_autoload_register'))
),
'Reflection'=>array('message' => 'PHP <a href="http://www.php.net/reflection">reflection</a> is either not loaded or not compiled in.',
'mandatory' => TRUE,
'result' => (class_exists('ReflectionClass'))
),
'Filters' =>array('message' => 'The <a href="http://www.php.net/filter">filter</a> extension is either not loaded or not compiled in.',
'mandatory' => TRUE,
'result' => (function_exists('filter_list'))
),
'Iconv' =>array('message' => 'The <a href="http://php.net/iconv">iconv</a> extension is not loaded.',
'mandatory' => TRUE,
'result' => (extension_loaded('iconv'))
),
'Mbstring' =>array('message' => 'The <a href="http://php.net/mbstring">mbstring</a> extension is not loaded.',
'mandatory' => TRUE,
'result' => (extension_loaded('mbstring'))
),
'CType' =>array('message' => 'The <a href="http://php.net/ctype">ctype</a> extension is not enabled.',
'mandatory' => TRUE,
'result' => (function_exists('ctype_digit'))
),
'URI' =>array('message' => 'Neither <code>$_SERVER[\'REQUEST_URI\']</code>, <code>$_SERVER[\'PHP_SELF\']</code>, or <code>$_SERVER[\'PATH_INFO\']</code> is available.',
'mandatory' => TRUE,
'result' => (isset($_SERVER['REQUEST_URI']) OR isset($_SERVER['PHP_SELF']) OR isset($_SERVER['PATH_INFO']))
),
'cUrl' =>array('message' => 'Install requires the <a href="http://php.net/curl">cURL</a> extension for the Request_Client_External class.',
'mandatory' => TRUE,
'result' => (extension_loaded('curl'))
),
'GD' =>array('message' => 'Install requires the <a href="http://php.net/gd">GD</a> v2 for the Image class',
'mandatory' => TRUE,
'result' => (function_exists('gd_info'))
),
'MySQL' =>array('message' => 'Install requires the <a href="http://php.net/mysqli">MySQLi</a> extension to support MySQL databases.',
'mandatory' => TRUE,
'result' => (function_exists('mysqli_connect'))
),
'ZipArchive' =>array('message' => 'PHP module zip not installed. You will need this to auto update the software.',
'mandatory' => FALSE,
'result' => class_exists('ZipArchive')
),
'SoapClient' =>array('message' => 'Install requires the <a href="http://php.net/manual/en/class.soapclient.php">SoapClient</a> class.',
'mandatory' => FALSE,
'result' => class_exists('SoapClient')
),
);
}
/**
* checks from requirements if its compatible or not. Also fills the msg variable
* @return boolean
*/
public static function is_compatible()
{
self::$msg = [];
$compatible = TRUE;
foreach (install::requirements() as $name => $values)
{
if ($values['mandatory'] == TRUE AND $values['result'] == FALSE)
$compatible = FALSE;
if ($values['result'] == FALSE)
self::$msg[] = $values['message'];
}
return $compatible;
}
/**
* get phpinfo clean in a string
* @return strin
*/
public static function phpinfo()
{
ob_start();
@phpinfo();
$phpinfo = ob_get_contents();
ob_end_clean();
//strip the body html
return preg_replace('%^.*<body>(.*)</body>.*$%ms', '$1', $phpinfo);
}
/**
* returns array of last versions from json
* @return array
*/
public static function versions()
{
return json_decode(core::curl_get_contents('https://raw.githubusercontent.com/yclas/yclas/master/versions.json?t='.time()),TRUE);
}
/**
* return HTML select for the timezones
* @param string $select_name
* @param string $selected
* @return string
*/
public static function get_select_timezones($select_name='TIMEZONE', $selected=NULL)
{
if ($selected=='UTC')
$selected='Europe/London';
$timezones = core::get_timezones();
$sel = '<select class="form-control" id="'.$select_name.'" name="'.$select_name.'">';
foreach( $timezones as $continent=>$timezone )
{
$sel.= '<optgroup label="'.$continent.'">';
foreach( $timezone as $city=>$cityname )
{
$seloption = ($city==$selected) ? ' selected="selected"' : '';
$sel .= "<option value=\"$city\"$seloption>$cityname</option>";
}
$sel.= '</optgroup>';
}
$sel.='</select>';
return $sel;
}
/**
* returns array of OC languages available
* @TODO better get them by an ajax request
*
* @return array
*/
public static function get_languages()
{
$locales = ['ar',
'bg_BG',
'bn_BD',
'ca_ES',
'da_DK',
'de_DE',
'el_GR',
'en_UK',
'en_US',
'es_ES',
'fr_FR',
'hi_IN',
'hu_HU',
'in_ID',
'it_IT',
'ja_JP',
'ml_IN',
'nl_NL',
'no_NO',
'pl_PL',
'pt_PT',
'ro_RO',
'ru_RU',
'sk_SK',
'sn_ZW',
'sq_AL',
'sr_RS',
'sv_SE',
'ta_IN',
'tl_PH',
'tr',
'ur_PK',
'vi_VN',
'zh_CN'
];
return $locales;
}
/**
* returns suggested installation url
* @return string
*/
public static function get_url()
{
// Try to guess installation URL
// Check whether we are using HTTPS or not
if (isset($_SERVER['HTTPS']))
{
if ('on' == strtolower($_SERVER['HTTPS']) OR '1' == $_SERVER['HTTPS'])
{
$url = 'https://'.$_SERVER['SERVER_NAME'];
}
}
elseif (isset($_SERVER['SERVER_PORT']) AND ('443' == $_SERVER['SERVER_PORT']))
{
$url = 'https://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'];
}
else
{
$url = 'http://'.$_SERVER['SERVER_NAME'];
if ($_SERVER['SERVER_PORT'] != '80')
$url = $url.':'.$_SERVER['SERVER_PORT'];
}
$url .= self::get_folder();
return $url;
}
/**
* returns suggested installation folder
* @return string
*/
public static function get_folder()
{
// Getting the folder, erasing the install-openclassifieds
$folder = str_replace('/install-yclas.php','', $_SERVER['SCRIPT_NAME']).'/';
return $folder;
}
}
class core{
/**
* copies files/directories recursively
* @param string $source from
* @param string $dest to
* @param integer $overwrite 0=do not overwrite 1=force overwrite 2=overwrite only is size is different
* @return void
*/
public static function copy($source, $dest, $overwrite = 0)
{
//be sure source exists..
if (!is_readable($source))
die('File ('.$source.') could not be readed, likely a permissions problem.');
//just a file to copy, so do it!
if(is_file($source))
{
$copy_file = FALSE;
//if doesnt exists OR we want to overwrite always OR different size copy the file.
if( !is_file( $dest ) OR $overwrite == 1 OR ( $overwrite == 2 AND filesize($source)===filesize($dest) ) )
$copy_file = TRUE;
if ($copy_file === TRUE)
{
try {
copy($source, $dest);
} catch (Exception $e) {
die('File ('.$source.') could not be copied, likely a permissions problem.');
}
}
//always return if its a file, so we dont move forward
return;
}
//was not a file, so folder...lets check exists, if not create it
if(!is_dir($dest))
mkdir($dest);
//read folder contents
$objects = scandir($source);
foreach ($objects as $object)
{
if($object != '.' && $object != '..')
{
$from = $source . '/' . $object;
$to = $dest . '/' . $object;
Core::copy($from, $to, $overwrite);
}
}
}
/**
* recursively deletes file or directory
* @param string $file
* @return void
*/
public static function delete($file)
{
if (is_dir($file))
{
$objects = scandir($file);
foreach ($objects as $object)
{
if ($object != '.' AND $object != '..')
{
if (is_dir($file.'/'.$object))
core::delete($file.'/'.$object); //recursive
else
unlink($file.'/'.$object);
}
}
reset($objects);
@rmdir($file);
}
elseif(is_file($file))
unlink($file);
}
/**
* gets the html content from a URL
* @param string $url
* @return string on success, false on errors
*/
public static function curl_get_contents($url)
{
$c = curl_init(); if ($c === FALSE) return FALSE;
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_URL, $url);
curl_setopt($c, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($c, CURLOPT_TIMEOUT,30);
curl_setopt($c, CURLOPT_NOPROGRESS, false);
curl_setopt($c, CURLOPT_PROGRESSFUNCTION, array(new core, 'write_curl_progress'));
// curl_setopt($c, CURLOPT_FOLLOWLOCATION, TRUE);
// $contents = curl_exec($c);
$contents = core::curl_exec_follow($c);
curl_close($c);
return ($contents)? $contents : FALSE;
}
/**
* [curl_exec_follow description] http://us2.php.net/manual/en/function.curl-setopt.php#102121
* @param curl $ch handler
* @param integer $maxredirect hoe many redirects we allow
* @return contents
*/
public static function curl_exec_follow($ch, $maxredirect = 5)
{
//using normal curl redirect
if (ini_get('open_basedir') == '' AND ini_get('safe_mode' == 'Off'))
{
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, $maxredirect > 0);
curl_setopt($ch, CURLOPT_MAXREDIRS, $maxredirect);
}
//using safemode...WTF!
else
{
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
if ($maxredirect > 0)
{
$newurl = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
$rch = curl_copy_handle($ch);
curl_setopt($rch, CURLOPT_HEADER, TRUE);
curl_setopt($rch, CURLOPT_NOBODY, TRUE);
curl_setopt($rch, CURLOPT_FORBID_REUSE, FALSE);
curl_setopt($rch, CURLOPT_RETURNTRANSFER, TRUE);
do
{
curl_setopt($rch, CURLOPT_URL, $newurl);
$header = curl_exec($rch);
if (curl_errno($rch))
$code = 0;
else
{
$code = curl_getinfo($rch, CURLINFO_HTTP_CODE);
if ($code == 301 OR $code == 302)
{
preg_match('/Location:(.*?)\n/', $header, $matches);
$newurl = trim(array_pop($matches));
}
else
$code = 0;
}
}
while ($code AND --$maxredirect);
curl_close($rch);
if (!$maxredirect)
{
if ($maxredirect === NULL)
trigger_error('Too many redirects. When following redirects, libcurl hit the maximum amount.', E_USER_WARNING);
else
$maxredirect = 0;
return FALSE;
}
curl_setopt($ch, CURLOPT_URL, $newurl);
}
}
return curl_exec($ch);
}
/**
* rss reader
* @param string $url
* @return array
*/
public static function rss($url)
{
$rss = @simplexml_load_file($url);
if($rss == FALSE OR ! isset($rss->channel->item))
return array();
return $rss->channel->item;
}
/**
* shortcut for the query method $_GET
* @param [type] $key [description]
* @param [type] $default [description]
* @return [type] [description]
*/
public static function get($key,$default=NULL)
{
return (isset($_GET[$key]))?$_GET[$key]:$default;
}
/**
* shortcut for $_POST[]
* @param [type] $key [description]
* @param [type] $default [description]
* @return [type] [description]
*/
public static function post($key,$default=NULL)
{
return (isset($_POST[$key]))?$_POST[$key]:$default;
}
/**
* shortcut to get or post
* @param [type] $key [description]
* @param [type] $default [description]
* @return [type] [description]
*/
public static function request($key,$default=NULL)
{
return (core::post($key)!==NULL)?core::post($key):core::get($key,$default);
}
/**
* write progress.json file of curl download progress
* @param string $resource
* @param string $download_size
* @param string $downloaded
* @param string $upload_size
* @param string $uploaded
* @return void
*/
public static function write_curl_progress($resource, $download_size, $downloaded, $upload_size, $uploaded )
{
static $previousProgress = 0;
if ($download_size == 0)
$progress = 0;
else
$progress = round($downloaded * 100 / $download_size);
if ($progress > $previousProgress)
{
$previousProgress = $progress;
$fp = fopen('progress.json', 'wa+');
fputs($fp, json_encode(array('progress' => array($progress))));
fclose($fp);
}
}
/**
* gets the offset of a date
* @param string $offset
* @return string
*/
public static function format_offset($offset)
{
$hours = $offset / 3600;
$remainder = $offset % 3600;
$sign = $hours > 0 ? '+' : '-';
$hour = (int) abs($hours);
$minutes = (int) abs($remainder / 60);
if ($hour == 0 AND $minutes == 0) {
$sign = ' ';
}
return $sign . str_pad($hour, 2, '0', STR_PAD_LEFT) .':'. str_pad($minutes,2, '0');
}
/**
* returns timezones ins a more friendly array way, ex Madrid [+1:00]
* @return array
*/
public static function get_timezones()
{
if (method_exists('DateTimeZone','listIdentifiers'))
{
$utc = new DateTimeZone('UTC');
$dt = new DateTime('now', $utc);
$timezones = array();
$timezone_identifiers = DateTimeZone::listIdentifiers();
foreach( $timezone_identifiers as $value )
{
$current_tz = new DateTimeZone($value);
$offset = $current_tz->getOffset($dt);
if ( preg_match( '/^(America|Antartica|Africa|Arctic|Asia|Atlantic|Australia|Europe|Indian|Pacific)\//', $value ) )
{
$ex=explode('/',$value);//obtain continent,city
$city = isset($ex[2])? $ex[1].' - '.$ex[2]:$ex[1];//in case a timezone has more than one
$timezones[$ex[0]][$value] = $city.' ['.core::format_offset($offset).']';
}
}
return $timezones;
}
else//old php version
{
return FALSE;
}
}
/**
* Parse Accept-Language HTTP header to detect user's language(s)
* and get the most favorite one
*
* Adapted from
* @link http://www.thefutureoftheweb.com/blog/use-accept-language-header
* @param string $lang default language to return in case of any
* @return NULL|string favorite user's language
*
*/
public static function get_browser_favorite_language($lang = 'en_US')
{
if ( ! isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
return $lang;
// break up string into pieces (languages and q factors)
preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $lang_parse);
if ( ! count($lang_parse[1]))
return $lang;
// create a list of languages in the form 'es' => 0.8
$langs = array_combine($lang_parse[1], $lang_parse[4]);
// set default to 1 for languages without a specified q factor
foreach ($langs as $lang => $q)
if ($q === '') $langs[$lang] = 1;
arsort($langs, SORT_NUMERIC); // sort list based on q factor. higher first
reset($langs);
$lang = strtolower(key($langs)); // Gotcha ! the 1st top favorite language
// when necessary, convert 'es' to 'es_ES'
// so scandir("languages") will match and gettext_init below can seamlessly load its stuff
if (strlen($lang) == 2)
$lang .= '_'.strtoupper($lang);
return str_replace('-', '_', $lang);
}
}
/**
* gettext short cut currently @TODO just echoes untranslated string
* @param [type] $msgid [description]
* @return [type] [description]
*/
function __($msgid)
{
return $msgid;
}
?>
<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en>"> <!--<![endif]-->
<head>
<meta charset="utf8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Yclas Self-Hosted <?=__("Installation")?></title>
<meta name="copyright" content="Yclas Self-Hosted <?=install::VERSION?>" >
<meta name="author" content="Yclas Self-Hosted">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="shortcut icon" href="https://yclas.com/images/favicon.ico?v0.1" />
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script type="text/javascript" src="//cdn.jsdelivr.net/html5shiv/3.7.2/html5shiv.min.js"></script> <![endif]-->
<link href="//cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="//cdn.jsdelivr.net/fontawesome/4.5.0/css/font-awesome.min.css" rel="stylesheet">
<link href="//cdn.jsdelivr.net/animatecss/3.3.0/animate.min.css" rel="stylesheet">
<link href="//cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.1/css/selectize.bootstrap3.min.css" rel="stylesheet">
<style type="text/css">
body {
background-color: #f3f3f4;
padding-top: 80px;
padding-bottom: 15px;
color: #676a6c;
}
a {
color: #0072A6;
}
a:hover {
color: #00587F;
}
.logo {
height: 45px;
}
.off-canvas {
background-color: #ffffff;
padding: 5px 20px 20px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.05);
-moz-box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.05);
box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.05);
-webkit-transition: max-height 0.8s;
-moz-transition: max-height 0.8s;
transition: max-height 0.8s;
}
.off-canvas h3 {
margin-top: 0;
font-size: 13px;
text-align: center;
text-transform: uppercase;
font-weight: 400;
padding: 15px 0;
letter-spacing: 2px;
border-bottom: 1px solid #EDEDEE;
margin-bottom: 15px;
}
.form-control {
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
border-color: #e5e6e7;
}
.selectize-input {
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
border-color: #e5e6e7;
}
.selectize-control.single .selectize-input::after {
border-color: #676a6c transparent transparent;
}
.copyright {
font-size: 12px;
}
.copyright a {
color: #676a6c;
}
.btn-default {
background-color: #41bb19;
border-color: #41bb19;
color: #FFFFFF;
font-size: 12px;
text-transform: uppercase;
letter-spacing: 2px;
}
.btn-default:hover,
.btn-default:focus,
.btn-default.focus,
.btn-default:active,
.btn-default.active,
.open > .dropdown-toggle.btn-default {
color: #FFFFFF;
background-color: #32AF0A;
border-color: #32AF0A;
}
.btn-default.disabled,
.btn-default.disabled.active,
.btn-default.disabled.focus,
.btn-default.disabled:active,
.btn-default.disabled:focus,
.btn-default.disabled:hover,
.btn-default[disabled],
.btn-default.active[disabled],
.btn-default.focus[disabled],
.btn-default[disabled]:active,
.btn-default[disabled]:focus,
.btn-default[disabled]:hover {
background-color: #32AF0A;
border-color: #32AF0A;
}
.btn.active.focus,
.btn.active:focus,
.btn.focus,
.btn:active.focus,
.btn:active:focus,
.btn:focus {
outline: 0;
}
.text-success {
color: #41bb19;
}
.btn-default.action {
letter-spacing: 0px;
}
.list-requirements {
margin-bottom: 10px;
font-size: 12px;
line-height: 25px;
padding-bottom: 10px;
-webkit-column-count: 2;
-moz-column-count: 2;
column-count: 2;
-webkit-column-gap: 15px;
-moz-column-gap: 15px;
column-gap: 15px;
}
.list-requirements .check {
vertical-align: 4%;
}
.list-requirements .check .fa-spinner {
width: 20px;
}
.has-feedback label ~ .form-control-feedback.fa {
top: 35px;
}
.has-success .checkbox,
.has-success .checkbox-inline,
.has-success .control-label,
.has-success .help-block,
.has-success .radio,
.has-success .radio-inline,
.has-success.checkbox label,
.has-success.checkbox-inline label,
.has-success.radio label,
.has-success.radio-inline label {
color: #41bb19;
}
.has-success .form-control {
border-color: #41bb19;
}
.has-success .form-control-feedback {
color: #41bb19;
}
.form-control:focus,
.has-success .form-control:focus,
.selectize-input.focus {
border-color: #32AF0A;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.has-error .form-control:focus{
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.loading {
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, 0) 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, rgba(0, 0, 0, 0) 75%, rgba(0, 0, 0, 0));
background-size: 40px 40px;
-webkit-animation: progress-bar-stripes 2s linear infinite;
animation: 2s linear 0s normal none infinite progress-bar-stripes;
}
.btn.btn-default.loading {
background-image: linear-gradient(45deg, rgba(235, 235, 235, 0.15) 25%, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, 0) 50%, rgba(235, 235, 235, 0.15) 50%, rgba(235, 235, 235, 0.15) 75%, rgba(0, 0, 0, 0) 75%, rgba(0, 0, 0, 0));
}
.alert {
background-color: #FFFFFF;
color: #676a6c;
border-width: 0;
-webkit-box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.05);
-moz-box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.05);
box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.05);
}
.alert-success {
background-color: rgba(39, 194, 76, 0.15);
color: #676a6c;
}
.alert-info {
background-color: rgba(35, 183, 229, 0.15);
color: #676a6c;
}
.alert-warning {
background-color: rgba(255, 144, 43, 0.15);
color: #676a6c;
}
.alert-danger {
background-color: rgba(240, 80, 80, 0.15);
color: #676a6c;
}
.alert-services {
background-color: #41BB19;
color: #ffffff;
padding-top: 7px;
padding-bottom: 7px;
text-transform: uppercase;
letter-spacing: 2px;
font-size: 12px;
}
.alert-services:hover {
background-color: #32AF0A;
}
.alert-services a {
color: #FFFFFF;
}
.alert-services a:hover {
text-decoration: none;
}
.alerts {
margin-top: -60px;
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<?
//choosing what to display
//execute installation since they are posting data
if ( $_POST AND $is_compatible === TRUE)
{
//theres post, download latest version, unzip and rediret to install
//download file
file_put_contents('progress.json', '');
$file_content = core::curl_get_contents($versions[$last_version]['download']);
file_put_contents('oc.zip', $file_content);
$zip = new ZipArchive;
// open zip file, extract to dir
if ($zip_open = $zip->open('oc.zip'))
{
if ( !($folder_update = $zip->getNameIndex(0)) )
{
hosting_view();
exit;
}
$zip->extractTo(DOCROOT);
$zip->close();
core::copy($folder_update, DOCROOT);
// delete downloaded zip file
core::delete($folder_update);
@unlink('oc.zip');
@unlink('progress.json');
@unlink($_SERVER['SCRIPT_FILENAME']);
// redirect to install
header("Location: index.php");
}
else
hosting_view();
}
//normally if compatible just display the form
elseif ($is_compatible === TRUE)
{?>
<?if (!empty(install::$msg) OR !empty(install::$error_msg))
hosting_view();?>
<?}
//not compatible
else
hosting_view();
?>
<div class="col-md-8 col-md-offset-2 animated fadeIn">
<div class="row">
<div class="col-md-6">
<h2><a target="_blank" href="https://yclas.com/"><img class="logo" src="https://i0.wp.com/yclas.nyc3.digitaloceanspaces.com/images/yclas_Logo_noTagline_144x44.png"></a></h2>
<br>
<p><strong><?=__("Welcome to the super easy and fast installation")?></strong></p>
<p>Yclas.com is an open source powerful PHP classifieds script that can help you start a website and turn it into a fully customizable classifieds site within a few minutes.</p>
<br>
<p class="text-center"><strong><?=__('Can’t get it to work?')?></strong></p>
<p><a target="_blank" href="https://selfhosted.yclas.com/" class="btn btn-default btn-large btn-block"><?=__("Get our professional services")?></a></p>
</div>
<div class="col-md-6">
<div class="off-canvas animated">
<form method="post" action="index.php">
<div class="panel-1">
<h3><?=__("Software Requirements")?> v.<?=$last_version;?></h3>
<ul class="list-unstyled list-requirements">
<?foreach (install::requirements() as $name => $values):
$color = ($values['result'])?'success':'danger';?>
<li data-color="<?=$color?>" data-result="<?=($values['result'])?"check":"times"?>">
<span class="check">