-
Notifications
You must be signed in to change notification settings - Fork 15
/
fpa-en.php
9519 lines (7745 loc) · 562 KB
/
fpa-en.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
/**
* @version 1.6.7
* @package Joomla!
* @subpackage Forum Post Assistant
* @category Diagnostic Tool
* @author RussW
* @author PhilD
* @copyright 2011-present, GNU GPLv2 or later license
* @see https://forumpostassistant.github.io/docs/
* @internal Supports: All known Joomla! versions running >php5.4
* @internal Contributors : @RussW, @PhilD13, @mandville, @frostmakk, @sozzled, @Webdongle, @btoplak
* @since 24-Jun-2011
*
* UI/UX overhauled - @RussW Jun-2020
* DocBlock updated - @RussW 8-Jun-2020
* Bootstrap/Bootswatch 5.1.0 updated - @RussW 2-Sep-2021
*
* Remember to revision and last updated date below
* Date reference format : d-mmm|mmmm-yyyy (e.g. 1-Jan-1970 | 1-January-1970)
*
*/
define ( '_RES', 'Forum Post Assistant' );
define ( '_RES_VERSION', '1.6.7' );
define ( '_RES_CODENAME', 'Marvin' );
define ( '_RES_LAST_UPDATED', '11-May-2024' );
define ( '_RES_RELEASE', 'Stable' ); // can be Alpha, Beta, RC, Stable
define ( '_RES_LANG', 'en-GB' ); // Country/Language Code
define ( '_RES_COPYRIGHT_STMT', ' Copyright © 2011-'. @date("Y"). ' Russell Winter, Phil DeGruy, Bernard Toplak, Claire Mandville, Sveinung Larsen. <br>' );
/**
* Keyboard Access Keys:
* a screan reader accessible only note regarding this information is located just
* inside the body so it is read to the user before any menu or page informatin is.
*
* d = delete, g = generate post, o = FPA options, n = night mode, l = light mode, v = run VEL, f = re-run default FPA
*
* Chrome
* Windows/Linux - [alt]+ accesskey
* Mac/OSX - [control]+[alt]+ accesskey
* Firefox
* Windows/Linux - [alt]+[shift]+ accesskey
* Mac/OSX - [control]+[alt]+ accesskey
* Safari
* [control]+[alt]+ accesskey
* Edge/IE
* [alt]+ accesskey
*
*/
/**
* for edit changelog see https://github.com/ForumPostAssistant/FPA/pulls?q=is%3Apr+is%3Aclosed
*
* TODO/WISHLIST:
* @RussW VEL integration
* @RussW - add expoert to .csv on tabular data/lists
* @RussW - add FPA Guided Tour
* @RussW - split FPA post content to multiple textareas/posts if exceeds 20k characters
*
*/
/** SET THE FPA DEFAULTS *****************************************************************/
#define ( '_FPA_DEV', TRUE ); // developer-mode, displays raw array data
#define ( '_FPA_DIAG', TRUE ); // diagnostic-mode, turns on PHP logging errors, display errors and logs error to a file
if ( defined( '_FPA_DIAG' ) ) {
ini_set( 'display_errors', 1 );
} else {
ini_set( 'display_errors', 0 );
}
/**
* DISABLE/ENABLE FPA SPECIAL FEATURES
* comment-out to disable individual features
*
* FPA Self Destruct
* - deletes FPA if _FPA_SELF_DESTRUCT_AGE exceeded
* - if _FPA_DEV or _FPA_DIAG are defined/TRUE then self-destruction won't happen
*
* FPA SSL Redirect
* - redirects to the SSL site if available
* - if _FPA_DEV or _FPA_DIAG are defined/TRUE then redirection won't happen
*
* LiveChecks require cURL to function (tested below)
* - each LiveCheck also has it's own resource requirement criteria to run
* - this is tested for within each unique LiveCheck function
*
*/
define ( '_FPA_SELF', basename($_SERVER['PHP_SELF']) ); // DONT DISABLE SEVERAL FUNCTIONS RELY ON THIS : take in to account renamed FPA, ensure all local links work
define ( '_FPA_SELF_DESTRUCT', TRUE); // self-destruct, attempts to self-delete on next run if file older than configured duration
define ( '_FPA_SSL_REDIRECT', TRUE); // SSL Redirect - when possible and if a valid SSL certificate is found FPa will attempt to redirect to the SSL version of the site
define ( '_LIVE_CHECK_FPA', TRUE ); // enable live latest FPA version check
define ( '_LIVE_CHECK_JOOMLA', TRUE ); // enable live latest Joomla! version check
#define ( '_LIVE_CHECK_VEL', TRUE ); // enable live VEL check
/**
* attempt to GZip the page output for performance - Added @RussW 27-May-2020
* added testing for zlib otherwise conflicts with gzip - updated @RussW 29-May-2020
*
*/
if ( ini_get( 'zlib.output_compression' ) != '1' AND substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') ) {
ob_start('ob_gzhandler');
} else {
ob_start();
}
/**
* Check for a localhost before doing anything
*
* if on a reserved subnet, then don't use _FPA_AUTO_DESTRUCT function
* due to never changing "modified" date on copy n paste
*
* if a windows development environment is "localhost" then default permisisons are always
* elevated (777) show a notice to the user that this is normal - added @RussW 5-May-2020
* updated @RussW 8-Jun-2020 to search array of known reserved ip addresses
*
*/
/**
* set the list of 'localhost' possibilities to be chcked for
* added @RussW 08-Jun-2020
*/
$maskLOCAL = array('127.0',
'10.',
'192.168.',
'172.16',
'172.17.',
'172.18.',
'172.19.',
'172.20.',
'172.21.',
'172.22.',
'172.23.',
'172.24.',
'172.25.',
'172.26.',
'172.27.',
'172.28.',
'172.29.',
'172.30.',
'172.31.',
'::1'
);
$isLOCALHOST = 0;
$isWINLOCAL = 0;
foreach ($maskLOCAL as $checkLOCALHOST) {
if ( strpos( $_SERVER['REMOTE_ADDR'], $checkLOCALHOST, 0 ) !== FALSE ) {
$isLOCALHOST = 1;
break;
} // found one of the reserved ip addresses
} // end foreach through reserved ip address & SERVER_NAME check
// check for windows to show local permission message
if ( $isLOCALHOST == 1 AND strtoupper( substr( PHP_OS, 0, 3 ) ) == 'WIN' ) {
$isWINLOCAL = 1;
}
/**
* FPA Self Destruct
* comment-out _FPA_SELF_DESTRUCT in Default Settings to disable
* (there is no need to comment-out the _FPA_SELF_DESTRUCT_AGE constant)
*
* if enabled, checks the FPA file date and if over _FPA_SELF_DESTRUCT_AGE days old then run the self-delete script
* - if $isLOCAL = 1 : don't even access the _FPA_SELF_DESTRUCT routine
* as local file modified dates are not udpated when copied and will keep being deleted (thanks @sozzled)
*
* CONSTANTS are used throughout this feature as a security measure because they cannot be overriden at runtime
* added @RussW 30-May-2020
*
*/
$fpaEXPIRENOTICE = false;
define ( '_FPA_SELF_DESTRUCT_AGE', 5 ); // age of FPA file before _FPA_SELF_DESTRUCT runs (set as CONSTANT so it can't be changed/overridden at runtime)
if ( defined('_FPA_SELF_DESTRUCT') AND $isLOCALHOST == 0 AND ( !defined('_FPA_DEV') AND !defined('_FPA_DIAG') ) ) {
if ( file_exists( _FPA_SELF ) ) {
$fileinfo = stat( _FPA_SELF );
}
// only try and delete the file if we can get the 'last modified' date
if ( !empty($fileinfo) ) {
$fileMTime = @date( 'd-m-Y', $fileinfo['mtime'] );
$today = @date( 'd-m-Y' );
$thisDate = new DateTime($today);
$fileDate = new DateTime($fileMTime);
$interval = $thisDate->diff($fileDate);
$fileAge = $interval->days;
//var_dump($interval);
// if all the criteria satisfied, define the _FPA_SELF_DESTRUCT_DOIT constant
if ( $fileAge > _FPA_SELF_DESTRUCT_AGE AND $interval->invert == 1) {
define ('_FPA_SELF_DESTRUCT_DOIT', TRUE);
} else {
$fpaEXPIRENOTICE = '<span class="d-print-none d-inline-block mx-auto small text-center text-info" data-html2canvas-ignore="true">As a security measure, this copy of FPA will expire and be deleted in <strong>'. ( (int)_FPA_SELF_DESTRUCT_AGE - $fileAge) .'</strong> days.</span>';
}
}
} else {
$fpaEXPIRENOTICE = '';
} // if _FPA_SELF_DESTRUCT defined
/**
* SSL check and redirect
*
* redirects to the SSL site if is SSL capable
* added @RussW 31-May-2020
*
*/
function has_ssl( $domain ) {
$res = false;
$stream = @stream_context_create( array( 'ssl' => array( 'capture_peer_cert' => true ) ) );
$socket = @stream_socket_client( 'ssl://' . $domain . ':443', $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $stream );
// If we got an ssl certificate we check here, if the certificate domain matches the website domain.
if ( $socket ) {
$cont = stream_context_get_params( $socket );
$cert_ressource = $cont['options']['ssl']['peer_certificate'];
$cert = openssl_x509_parse( $cert_ressource );
// Expected name has format "/CN=*.yourdomain.com"
$namepart = explode( '=', $cert['name'] );
// We want to correctly confirm the certificate even for subdomains like "www.yourdomain.com"
if ( count( $namepart ) == 2 ) {
$cert_domain = trim( $namepart[1], '*. ' );
$check_domain = substr( $domain, -strlen( $cert_domain ) );
$res = ($cert_domain == $check_domain);
}
}
return $res;
}
if ( defined('_FPA_SSL_REDIRECT') AND ( !defined('_FPA_DEV') AND !defined('_FPA_DIAG') ) ) {
$checkSSL = has_ssl($_SERVER['HTTP_HOST']);
}
$pageURL = $_SERVER['HTTP_HOST'] . '/' . _FPA_SELF;
// do the rediect
if (is_bool(@$checkSSL) === true AND @$_SERVER['HTTPS'] != 'on') {
if (@$checkSSL) {
header("Location: https://$pageURL");
exit;
}
}
/**
* check for cURL availability
* (required for LiveChecks to function)
*
* - check cURL is not in php disabled_functions
* - check there is a cURL module loaded
* - check the curl_exec function is available
* - DISABLE if doIT = 1 (no point in LiveChecks when generating post content)
* added @RussW - 27-May-2020
*
*/
$canDOLIVE = '0';
if (
( defined('_LIVE_CHECK_FPA')
OR defined('_LIVE_CHECK_JOOMLA')
OR defined('_LIVE_CHECK_VEL')
)
AND stristr(ini_get('disable_functions'), 'curl') == FALSE
AND extension_loaded('curl')
AND function_exists('curl_exec')
AND @$_POST['doIT'] != 1) {
$canDOLIVE = '1';
} // $canDOLIVE
/** SET THE JOOMLA! PARENT FLAG AND CONSTANTS ********************************************/
define ( '_VALID_MOS', 1 ); // for J!1.0
define ( '_JEXEC', 1 ); // for J!1.5, J!1.6 thru J!2.5, J!3.0, J!4.0
// Define some basic assistant information
define ( '_LICENSE_LINK', '<a href="https://www.gnu.org/licenses/" target="_blank" rel="noopener noreferrer">https://www.gnu.org/licenses/</a>' ); // link to GPL license
define ( '_LICENSE_FOOTER', ' The FPA comes with ABSOLUTELY NO WARRANTY. <br> This is free software,
and covered under the GNU GPLv2 or later license. You are welcome to redistribute it under certain conditions.
For details read the LICENSE.txt file included in the download package with this script.<br>
A copy of the license may also be obtained at ' );
define ( '_RES_FPALINK', 'https://github.com/ForumPostAssistant/FPA/tarball/en-GB/' ); // where to get the latest 'Final Releases'
// @RussW updated 23-May-2020
define ( '_RES_FPALATEST', 'Download the latest FPA release (tar.gz)' );
define ( '_RES_FPALINK2', 'https://github.com/ForumPostAssistant/FPA/zipball/en-GB/' ); // where to get the latest 'Final Releases'
// @RussW updated 23-May-2020
define ( '_RES_FPALATEST2', 'Download the latest FPA release (zip)' );
/** DEFINE LANGUAGE STRINGS **************************************************************/
define ( '_PHP_DISERR', 'Display PHP Errors Enabled' );
define ( '_PHP_ERRREP', 'PHP Error Reporting Enabled' );
define ( '_PHP_LOGERR', 'PHP Errors Being Logged To File' );
// section titles & developer-mode array names
// updated @RussW 29-May-2020
define ( '_FPA_SNAP_TITLE', 'Environment Snapshot' );
define ( '_FPA_INST_TITLE', 'Application Instance' );
define ( '_FPA_SYS_TITLE', 'System Environment' );
define ( '_FPA_PHP_TITLE', 'PHP Environment' );
define ( '_FPA_PHPEXT_TITLE', 'PHP Extensions' );
define ( '_FPA_PHPREQ_TITLE', 'PHP Requirements' );
define ( '_FPA_APAMOD_TITLE', 'Apache Modules' );
define ( '_FPA_APAREQ_TITLE', 'Apache Requirements' );
define ( '_FPA_DB_TITLE', 'Database Instance' );
define ( '_FPA_TABLE', 'Tables' );
define ( '_FPA_DBTBL_TITLE', 'Table Structure' );
define ( '_FPA_PERMCHK_TITLE', 'Permissions Checks' );
define ( '_FPA_COREDIR_TITLE', 'Core Folders' );
define ( '_FPA_ELEVPERM_TITLE', 'Elevated Permissions' );
define ( '_FPA_EXTCOM_TITLE', 'Components' );
define ( '_FPA_EXTMOD_TITLE', 'Modules' );
define ( '_FPA_EXTPLG_TITLE', 'Plugins' );
define ( '_FPA_TMPL_TITLE', 'Templates' );
define ( '_FPA_EXTLIB_TITLE', 'Libraries' );
// snapshot definitions
define ( '_FPA_SUPPHP', 'PHP Supports');
define ( '_FPA_SUPSQL', 'Database Supports');
define ( '_FPA_BADPHP', 'Known Buggy PHP');
define ( '_FPA_BADZND', 'Known Buggy Zend');
// slow screen message
// @RussW _FPA_SLOWGENPOST to be removed 23-May-2020
define ( '_FPA_SLOWGENPOST', 'Generating Post Output...' );
// @RussW _FPA_SLOWRUNTEST to be removed 23-May-2020
define ( '_FPA_SLOWRUNTEST', 'Hang on while we run some tests...' );
// remove script notice content - @PhilD 17-Apr-2012
// @RussW _FPA_DELNOTE_LN1 to be removed 23-May-2020
define ( '_FPA_DELNOTE_LN1', '<h5 class="text-danger">** SECURITY NOTICE **</h5>' );
// @RussW updated 23-May-2020
define ( '_FPA_DELNOTE_LN2', '<p class="small">The FPA script may contain private information that could be used to obtain information by others to compromise your website. We recommend that you remove the FPA script after you use it.</p>' );
// @RussW updated 23-May-2020
define ( '_FPA_DELNOTE_LN3', '<p class="text-danger">After use, please delete the FPA script.</p>' );
// dev/diag-mode content
define ( '_FPA_DEVMI', 'developer-mode-information' );
define ( '_FPA_ELAPSE', 'elapse-runtime' );
// @RussW removed uppercase 27-May-2020
define ( '_FPA_DEVENA', 'Developer Mode Enabled' );
define ( '_FPA_DEVDSC', 'This means that a variety of additional information will be displayed on-screen to assist with troubleshooting this script.' );
// @RussW typo fixed & removed uppercase 27-May-2020
define ( '_FPA_DIAENA', 'Diagnostic Mode Enabled' );
define ( '_FPA_DIADSC', 'This means that all php and script errors will be displayed on-screen and logged out to a file named' );
// @RussW _FPA_DIAERR to be removed 27-May-2020
define ( '_FPA_DIAERR', 'Last DIGNOSTIC MODE Error' );
define ( '_FPA_SPNOTE', 'Special Note' );
// user post form content
define ( '_FPA_INSTRUCTIONS', 'Instructions' );
define ( '_FPA_INS_1', 'Enter your problem description <em>(optional)</em>' );
define ( '_FPA_INS_2', 'Enter any error messages you see <em>(optional)</em>' );
define ( '_FPA_INS_3', 'Enter any actions taken to resolve the issue <em>(optional)</em>' );
define ( '_FPA_INS_4', 'Select detail level options of output <em>(optional)</em>' );
// @RussW updated 23-May-2020
define ( '_FPA_INS_5', 'Click the <span class="text-success">Click Here To Generate Post</span> button to build the post content' );
// @RussW updated 23-May-2020
define ( '_FPA_INS_6', 'Copy the contents of the <span class="text-dark">Post Content</span> box and paste it into a post following the instructions provided' );
// @RussW updated 23-May-2020
define ( '_FPA_INS_7', '<p class="text-muted">To copy the contents of the Post Detail box:</p>
<ol>
<li class="pb-1">Click the <span class="badge bg-warning">Copy Post Content To Clipboard</span> button</li>
<li class="text-muted p-1">Login to the Joomla! Forum and start a new post or reply</li>
<li class="pb-1">Use <strong>CTRL-v</strong> to paste the copied text into your forum post/reply</li>
<li class="pb-1"><em>Disable smilies to prevent charcters being converted by the forums software</em></li>
</ol>
<p class="xsmall py-1 my-1"><i class="fas fa-info-circle text-info"></i> In the event that the "Copy Post Content To Clipboard" button does not work, <strong>click inside the Post Content textarea</strong>, then <strong>press CTRL-a (or Command-a)</strong> to select all the content, then <strong>press CTRL-c (Command-c)</strong> to copy the content and use <strong>CRTL-v (Command-v)</strong> to paste the copied content in to your forum post</p>');
// @RussW added 23-May-2020
define ( '_FPA_INS_8', '<p class="text-center">Your site has many extensions installed, the post output exceededs the forum post limit. <strong>Please run the FPA twice</strong> and make two seperate posts/replies.</p><ol><li>First run without the plugins selected</li><li>Run again with only the plugins selected</li></ol>');
define ( '_FPA_POST_NOTE', 'Leave ALL fields blank/empty to simply post diagnostic information.' );
define ( '_FPA_PROB_DSC', 'Problem Description' );
define ( '_FPA_PROB_MSG', 'Log/Error Message' );
define ( '_FPA_PROB_ACT', 'Actions Taken To Resolve' );
define ( '_FPA_PROB_CRE', 'Actions To ReCreate Issue' );
define ( '_FPA_OPT', 'Optional Settings' );
define ( '_FPA_SHOWELV', 'Show elevated folder permissions' );
define ( '_FPA_SHOWDBT', 'Show database table statistics' );
define ( '_FPA_SHOWCOM', 'Show Components' );
define ( '_FPA_SHOWMOD', 'Show Modules' );
define ( '_FPA_SHOWLIB', 'Show Libraries' );
define ( '_FPA_SHOWPLG', 'Show Plugins' );
define ( '_FPA_SHOWCEX', 'Show Core Extensions' );
define ( '_FPA_INFOPRI', 'Information Privacy' );
define ( '_FPA_STRICT', 'Strict' );
define ( '_FPA_PRIVNON', 'None' );
define ( '_FPA_PRIVNONNOTE', 'No elements are masked' );
define ( '_FPA_PRIVPAR', 'Partial' );
define ( '_FPA_PRIVPARNOTE', 'Some elements are masked' );
define ( '_FPA_PRIVSTR', 'Strict' );
define ( '_FPA_PRIVSTRNOTE', 'All indentifiable elements are masked' );
define ( '_FPA_CLICK', 'Click Here To Generate Post' );
define ( '_FPA_OUTMEM', 'Out of Memory');
define ( '_FPA_OUTTIM', 'Execution Time-Outs' );
define ( '_FPA_INCPOPS', 'Temporarily increase PHP Memory and Execution Time' );
define ( '_FPA_POSTD', 'Your Forum Post Content' );
/** common screen and post output strings ************************************************/
define ( '_FPA_APP', 'Joomla!' );
define ( '_FPA_INSTANCE', 'Instance' );
define ( '_FPA_PLATFORM', 'Platform' );
define ( '_FPA_DB', 'Database');
define ( '_FPA_SYS', 'System' );
define ( '_FPA_SERV', 'Server' );
define ( '_FPA_CLNT', 'Client' );
define ( '_FPA_HNAME', 'Hostname' );
define ( '_FPA_DISC', 'Discovery' );
define ( '_FPA_LEGEND', 'Legends and Settings' );
define ( '_FPA_GOOD', 'OK/GOOD' );
define ( '_FPA_WARNINGS', 'WARNINGS' );
define ( '_FPA_ALERTS', 'ALERTS' );
define ( '_FPA_SITE', 'Site' );
define ( '_FPA_ADMIN', 'Admin' );
define ( '_FPA_BY', 'by' );
define ( '_FPA_OR', 'or' );
define ( '_FPA_OF', 'of' );
define ( '_FPA_TO', 'to' );
define ( '_FPA_FOR', 'for' );
define ( '_FPA_IS', 'is' );
define ( '_FPA_AT', 'at' );
define ( '_FPA_IN', 'in' );
define ( '_FPA_BUT', 'but' );
define ( '_FPA_LAST', 'Last' );
define ( '_FPA_NONE', 'None' );
define ( '_FPA_DEF', 'default' );
define ( '_FPA_Y', 'Yes' );
define ( '_FPA_N', 'No' );
define ( '_FPA_FIRST', 'First' );
define ( '_FPA_M', 'Maybe' );
define ( '_FPA_MDB', 'Yes - MariaDB Used' );
define ( '_FPA_U', 'Unknown' );
define ( '_FPA_K', 'Known' );
define ( '_FPA_E', 'Exists' );
define ( '_FPA_JCORE', 'Core' );
define ( '_FPA_3PD', '3rd Party' );
define ( '_FPA_TESTP', 'tests performed' );
define ( '_FPA_DNE', 'Does Not Exist' );
define ( '_FPA_F', 'Found' );
define ( '_FPA_NF', 'Not Found' );
define ( '_FPA_OPTS', 'Options' );
define ( '_FPA_CF', 'Config' );
define ( '_FPA_CFG', 'Configuration' );
define ( '_FPA_YC', 'Configured' );
define ( '_FPA_NC', 'Not Configured' );
define ( '_FPA_ECON', 'Connection Error' );
define ( '_FPA_CON', 'Connect' );
define ( '_FPA_YCON', 'Connected' );
define ( '_FPA_CONT', 'Connection Type' );
define ( '_FPA_NCON', 'Not Connected' );
define ( '_FPA_SUP', 'support' );
define ( '_FPA_YSUP', 'supported' );
define ( '_FPA_DROOT', 'Doc Root' );
define ( '_FPA_NSUP', 'not supported' );
define ( '_FPA_NOA', 'Not Attempted' );
define ( '_FPA_NER', 'No Errors Reported' );
define ( '_FPA_ER', 'Error(s) Reported' );
define ( '_FPA_ERR', 'error' );
define ( '_FPA_ERRS', 'errors' );
define ( '_FPA_YMATCH', 'Matches' );
define ( '_FPA_NMATCH', 'Mis-Match' );
define ( '_FPA_NACOMP', 'Appear Incomplete' );
define ( '_FPA_YACOMP', 'Appear Complete' );
define ( '_FPA_SEC', 'Security' );
define ( '_FPA_FEAT', 'Features' );
define ( '_FPA_PERF', 'Performance' );
define ( '_FPA_NA', 'N/A' );
define ( '_FPA_CRED', 'Credentials' );
define ( '_FPA_CREDPRES', 'Credentials Present' );
define ( '_FPA_HOST', 'Host' );
define ( '_FPA_TEC', 'Technology' );
define ( '_FPA_WSVR', 'Web Server' );
define ( '_FPA_HIDDEN', 'protected' );
define ( '_FPA_PASS', 'Password' );
define ( '_FPA_USER', 'Username' );
define ( '_FPA_USR', 'User' );
// @RussW updated 23-May-2020
define ( '_FPA_TNAM', 'Name' );
define ( '_FPA_TSIZ', 'Size' );
define ( '_FPA_TENG', 'Engine' );
define ( '_FPA_TCRE', 'Created' );
define ( '_FPA_TUPD', 'Updated' );
define ( '_FPA_TCKD', 'Checked' );
define ( '_FPA_TCOL', 'Collation' );
define ( '_FPA_CHARS', 'Character Set' );
define ( '_FPA_TFRA', 'Fragment Size' );
define ( '_FPA_AUTH', 'Author' );
define ( '_FPA_ADDR', 'Address' );
define ( '_FPA_STATUS', 'Status' );
define ( '_FPA_TYPE', 'Type' );
define ( '_FPA_TREC', 'Rcds' ); // Number of table records
define ( '_FPA_TAVL', 'Avg. Length' );
define ( '_FPA_MODE', 'Mode' );
define ( '_FPA_WRITABLE', 'Writable' );
define ( '_FPA_RO', 'Read-Only' );
define ( '_FPA_FOLDER', 'Folder' );
define ( '_FPA_FILE', 'File' );
define ( '_FPA_OWNER', 'Owner' );
define ( '_FPA_GROUP', 'Group' );
define ( '_FPA_VER', 'Version' );
define ( '_FPA_CRE', 'Created' );
define ( '_FPA_LOCAL', 'Local' );
define ( '_FPA_REMOTE', 'Remote' );
define ( '_FPA_SECONDS', 'seconds' );
define ( '_FPA_TBL', 'Table' );
define ( '_FPA_STAT', 'Statistics' );
define ( '_FPA_BASIC', 'Basic' );
define ( '_FPA_DETAILED', 'Detailed' );
define ( '_FPA_ENVIRO', 'Environment' );
define ( '_FPA_VALID', 'Valid' );
define ( '_FPA_NVALID', 'Not Valid' );
define ( '_FPA_EN', 'Enabled' );
define ( '_FPA_DI', 'Disabled' );
define ( '_FPA_NO', 'No' );
define ( '_FPA_STATS', 'statistics');
define ( '_FPA_POTOI', 'Potential Ownership Issues' );
define ( '_FPA_POTME', 'Potential Missing Extensions' );
define ( '_FPA_POTMM', 'Potential Missing Modules' );
define ( '_FPA_DBCONNNOTE', 'may not be an error, check with host for remote access requirements.' );
define ( '_FPA_DBCREDINC', 'Credentials incomplete or not available');
define ( '_FPA_MISSINGCRED', 'Missing credentials detected' );
define ( '_FPA_NODISPLAY', 'Nothing to display.' );
define ( '_FPA_EMPTY', 'could be empty' );
define ( '_FPA_UINC', 'increased by user, was' );
define ( '_PHP_VERLOW', 'PHP version too low' );
define ( '_FPA_SHOW', 'Show' );
define ( '_FPA_HIDE', 'Hide' );
define ( 'act', '');
define ( '_FPA_MVFW', 'More than one instance of version.php found!' );
define ( '_FPA_MVFWF', 'Multiple found' );
define ( '_FPA_DIR_UNREADABLE', 'A directory is <b>NOT READABLE</b> and cannot be checked!');
define ( '_FPA_DI_PHP_FU', 'Disabled Functions' );
define ( '_FPA_FDSKSP', 'Free Disk Space' );
define ( '_FPA_NIMPLY', 'Not implemented for' );
define ( '_FPA_PGSQL', 'PostgreSQL' );
define ( '_FPA_PMISS', 'Password missing' );
define ( '_FPA_DEFI', 'Defines' );
define ( '_FPA_DEFIPA', 'Site and Admin config paths not equal' );
define ( '_FPA_CONF_PREF_TABLE', '#of Tables with config prefix' );
define ( '_FPA_OTHER_TABLE', '#of other Tables' );
define ( '_FPA_MSSQL_SUPP', 'Microsoft SQL Server is not supported by the FPA' );
define ( '_FPA_MYSQLI_CONN', 'PHP function mysqli_connect not found.' );
// @RussW new May-2020
define ( '_FPA_DASHBOARD', 'Dashboard' );
define ( '_FPA_DASHBOARD_CONFIDENCE_TITLE', 'Confidence' );
define ( '_FPA_DASHBOARD_CONFIDENCE_NOTE', 'An initial <em>basic confidence audit</em> has been performed to determine if the minimum requirements and best practices have been met to ensure the successful operation of the latest version of Joomla! and it\'s standard functions.');
define ( '_FPA_DISCOVERY_REPORT', 'Discovery Report' );
define ( '_FPA_PERMOWN', 'Permissions & Ownership' );
define ( '_FPA_CNF_A', 'Joomla! should run without any problems' );
define ( '_FPA_CNF_B', 'Joomla! should run but some features may have minor problems' );
define ( '_FPA_CNF_C', 'Joomla! might run but some features will have problems' );
define ( '_FPA_CNF_D', 'Joomla! might run but many features will have problems' );
define ( '_FPA_CNF_E', 'Joomla! probably will not run or will have many problems' );
define ( '_FPA_CNF_F', 'Joomla! probably will not run and will have many problems' );
define ( '_FPA_UPRIV', 'User Privileges' );
define ( '_VER_CHECK_ATOLD', 'is out of date' );
define ( '_VER_CHECK_ATCUR', 'is up to date' );
define ( '_VER_CHECK_ATDEV', 'is a development version' );
define ( '_FPA_WIN_LOCALHOST', '<span class="d-inline-block text-dark py-1"><span class="badge bg-info">Note:</span> Elevated permissions are expected on Windows localhost development environments.</span>' );
define ( '_FPA_LOGS_NOTICE', '<span class="d-inline-block text-dark py-1"><span class="badge bg-info">Note:</span> The logs folder can be logs/ or administrator/logs/ depending on what version the site was first created with.</span>' );
define ( '_FPA_JDISCLAIMER', 'Forum Post Assistant (FPA) is not affiliated with or endorsed by The Joomla! Project<sup>™</sup>. Use of the Joomla!<sup>®</sup> name, symbol, logo, and related trademarks is licensed by Open Source Matters, Inc.' );
/** END LANGUAGE STRINGS *****************************************************************/
/**
* delete script
*
* attempts to delete file from site. If it fails then message to manually delete the file is presented.
* fixed undefined index when server uses E_STRICT - @PhilD 20-Sep-2012
* @PhilD 7-Aug-2012
* @RussW updated 21-May-2020
* @RussW 30-May-2020
* added FPA Self Destruct feature, updated to use global file path & $_POST
*
*/
if ( ( isset($_POST['act']) AND $_POST['act'] == 'delete' ) OR ( defined('_FPA_SELF_DESTRUCT') AND defined('_FPA_SELF_DESTRUCT_DOIT') ) ) {
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim( dirname($_SERVER['PHP_SELF'] ), '/\\');
$extra = ''; // add index (or other) page if desired
// try to set script to 777 to make sure we have permission to delete
@chmod(_FPA_SELF, 0777); // octal; correct value of mode
// Delete the file.
@unlink(_FPA_SELF);
// Message and link to home page of site.
// if SSL return to https:// otherwise http://
if ( @$_SERVER['HTTPS'] == 'on' ? $hostPrefix = 'https://' : $hostPrefix = 'http://');
$page = $hostPrefix . $host . $uri . $extra;
// Something went wrong and the script was not deleted so it must be removed manually so we tell the user to do so - @PhilD 7-Aug-2012
if ( file_exists(_FPA_SELF) ) {
@chmod(_FPA_SELF, 0644); // octal; correct value of mode
echo '<div id="deleteMessage" style="padding:20px;border:1px solid #e99002;background-color:#fff8ee;margin:0 auto;margin-top:50px;margin-bottom:20px;max-width:70%;position:relative;z-index:9999;top:10%;font-family:sans-serif, arial;" align="center">';
echo '<h1 style="color:#e99002;font-size:44px;">SOMETHING WENT WRONG!</h1>';
if ( defined('_FPA_SELF_DESTRUCT_DOIT') ) {
echo '<h2 style="color:#43ac6a;">As a security measure, FPA attempted to self-delete itself due to the time it has been present on the server, but was not successful.</h2>';
echo '<p style="color:#e99002;font-size:20px;margin:0 auto;max-width:80%;">Please remove the file manually using FTP or through your hosting File Manager, or upload a new copy to continue using it.</p>';
} else {
echo '<h1 style="color:#e99002;font-size:44px;">SOMETHING WENT WRONG!</h1>';
echo '<p style="color:#e99002;font-size:30px;">We could not delete the FPA file ('. _FPA_SELF .').</p>';
echo '<p style="color:#e99002;font-size:20px;margin:0 auto;max-width:80%;">For your website security, please remove the file <em style="color:#f04124;">'. _FPA_SELF .'</em> manually using FTP or through your hosting File Manager.</p>';
}
} else {
echo '<div id="deleteMessage" style="padding:20px;border:1px solid #43ac6a;background-color:#effff5;margin:0 auto;margin-top:50px;margin-bottom:20px;max-width:70%;position:relative;z-index:9999;top:10%;font-family:sans-serif, arial;" align="center">';
if ( defined('_FPA_SELF_DESTRUCT_DOIT') ) {
echo '<h2 style="color:#43ac6a;">As a security measure, this copy of FPA has been self-deleted due to the time it has been present on the server.</h2>';
echo '<p style="color:#e99002;font-size:20px;margin:0 auto;max-width:80%;">You will need to upload another copy of FPA to continue.</p>';
} else {
echo '<h1 style="color:#43ac6a;">Thank You For Using The FPA.</h1>';
}
}
echo '<p><a href="'. $page .'">Go to your Home Page.</a></p>';
echo '</div>';
exit;
} // end delete script
/**
* darkmode template
*
* use the bootswatch cyborg BS4 theme instead of the Yeti theme
* use PHP_SESSION to maintain the users choice
* added @RussW 31-May-2020
*
*/
session_start();
if ( @$_POST['darkmode'] == '0' ) {
$_SESSION['darkmode'] = '0';
$darkmode = '0';
} elseif ( @$_POST['darkmode'] == '1' ) {
$_SESSION['darkmode'] = '1';
$darkmode = '1';
} elseif ( isset($_SESSION['darkmode']) ) {
$darkmode = $_SESSION['darkmode'];
$_SESSION['darkmode'] = $_SESSION['darkmode'];
} elseif ( !isset($_SESSION['darkmode']) OR ( $_SESSION['darkmode'] != '1' OR @$_POST['darkmode'] != '1' ) ) {
//session_start();
$_SESSION['darkmode'] = '0';
$darkmode = '0';
}
// unset($_SESSION['darkmode']);
// session_destroy();
// TESTING PRIVACY
// setup the default runtime parameters and collect the POST data changes, if any
if ( !$_SESSION ) {
session_start();
}
if ( @$_POST['showProtected'] == 0 ) {
$_SESSION['privacy'] = 0;
$showProtected = 0;
$selectshowProtected_1 = 'CHECKED';
$selectshowProtected_2 = '';
} elseif ( @$_POST['showProtected'] == 1 ) {
$_SESSION['privacy'] = 1;
$showProtected = 1;
$selectshowProtected_1 = '';
$selectshowProtected_2 = 'CHECKED';
} elseif ( isset($_SESSION['privacy']) ) {
$_SESSION['privacy'] = $_SESSION['privacy'];
$showProtected = $_SESSION['privacy'];
} elseif ( !isset($_SESSION['privacy']) OR ( $_SESSION['privacy'] != 1 OR !isset($_POST['showProtected']) OR @$_POST['showProtected'] != 1 OR $showProtected != 1 ) ) {
$_SESSION['privacy'] = 0;
$showProtected = 0;
$selectshowProtected_1 = 'CHECKED';
$selectshowProtected_2 = '';
} else {
$showProtected = 0;
$_SESSION['privacy'] = 0;
$selectshowProtected_1 = 'CHECKED';
$selectshowProtected_2 = '';
}
// hardened server and no explicit choice
if ( extension_loaded('suhosin') AND !isset($_POST['showProtected']) ) {
$showProtected = 1;
$_SESSION['privacy'] = 1;
}
//unset($_SESSION['privacy']);
//unset($_SESSION);
//session_destroy();
/*
// setup the default runtime parameters and collect the POST data changes, if any
if ( @$_POST['showProtected'] ) {
$showProtected = @$_POST['showProtected'];
} else {
$showProtected = 2; // default (limited privacy masking)
}
*/
if ( @$_POST['showElevated'] == 0 AND @$_POST['doIT'] == 1 ) {
$showElevated = 0;
} else {
$showElevated = 1; // default 1(show) changed default to 1 - @PhilD 20-Apr-2012
}
if ( @$_POST['showTables'] == 0 AND @$_POST['doIT'] == 1 ) {
$showTables = 0;
} else {
$showTables = 1;
}
if ( @$_POST['showComponents'] == 0 AND @$_POST['doIT'] == 1 ) {
$showComponents = 0;
} else {
$showComponents = 1; // default 0 (hide) changed default to 1 - @PhilD 20-Apr-2012
}
if ( @$_POST['showModules'] == 0 AND @$_POST['doIT'] == 1 ) {
$showModules = 0;
} else {
$showModules = 1; // default 0 (hide) changed default to 1 - @PhilD 20-Apr-2012
}
if ( @$_POST['showLibraries'] == 0 AND @$_POST['doIT'] == 1 ) {
$showLibraries = 0;
} else {
$showLibraries = 1;
}
if ( @$_POST['showPlugins'] == 0 AND @$_POST['doIT'] == 1 ) {
$showPlugins = 0;
} else {
$showPlugins = 1; // default 0(hide) changed default to 1 - @PhilD 20-Apr-2012
}
if ( @$_POST['showCoreEx'] == 0 AND @$_POST['doIT'] == 1 ) {
$showCoreEx = 0;
} else {
$showCoreEx = 1;
}
/** TIMER-POPS ***************************************************************************/
// mt_get: returns the current microtime
function mt_get(){
global $mt_time;
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
// mt_start: starts the microtime counter
function mt_start(){
global $mt_time; $mt_time = mt_get();
}
// mt_end: calculates the elapsed time
function mt_end($len=3){
global $mt_time;
$time_end = mt_get();
return round($time_end - $mt_time, $len);
}
// actually start the timer-pop
mt_start();
// build the initial arrays used throughout fpa/bra
$fpa['ARRNAME'] = _RES;
$fpa['diagLOG'] = 'fpa-Diag.log';
$snapshot['ARRNAME'] = _FPA_SNAP_TITLE;
$instance['ARRNAME'] = _FPA_INST_TITLE;
$system['ARRNAME'] = _FPA_SYS_TITLE;
$phpenv['ARRNAME'] = _FPA_PHP_TITLE;
$phpenv['phpLASTERR'] = '';
$phpextensions['ARRNAME'] = _FPA_PHPEXT_TITLE;
$phpreq['ARRNAME'] = _FPA_PHPREQ_TITLE;
$phpreq['libxml'] = '';
$phpreq['xml'] = '';
$phpreq['zlib'] = '';
$phpreq['zip'] = '';
$phpreq['openssl'] = '';
$phpreq['curl'] = '';
$phpreq['iconv'] = '';
$phpreq['mbstring'] = '';
$phpreq['mysql'] = '';
$phpreq['mysqli'] = '';
$phpreq['pdo_mysql'] = '';
$phpreq['mcrypt'] = '';
$phpreq['fileinfo'] = '';
$phpreq['gd'] = '';
$phpreq['json'] = '';
$phpreq['SimpleXML'] = '';
$phpreq['dom'] = '';
$apachemodules['ARRNAME'] = _FPA_APAMOD_TITLE;
$apachereq['ARRNAME'] = _FPA_APAREQ_TITLE;
$apachereq['mod_rewrite'] = '';
$apachereq['mod_expires'] = '';
$apachereq['mod_deflate'] = '';
$apachereq['mod_ssl'] = '';
$database['ARRNAME'] = _FPA_DB_TITLE;
$tables['ARRNAME'] = _FPA_DBTBL_TITLE;
$modecheck['ARRNAME'] = _FPA_PERMCHK_TITLE;
// folders to be tested for permissions
$folders['ARRNAME'] = _FPA_COREDIR_TITLE;
$folders[] = 'images/';
$folders[] = 'components/';
$folders[] = 'modules/';
$folders[] = 'plugins/'; // J!1.5 and above | either / or
$folders[] = 'mambots/'; // J!1.0 only
$folders[] = 'language/';
$folders[] = 'templates/';
$folders[] = 'cache/';
$folders[] = 'logs/';
$folders[] = 'tmp/';
$folders[] = 'administrator/components/';
$folders[] = 'administrator/modules/';
$folders[] = 'administrator/language/';
$folders[] = 'administrator/templates/';
$folders[] = 'sites/'; // nooku only?
$folders[] = 'administrator/logs/';
$folders[] = 'api/';
$elevated['ARRNAME'] = _FPA_ELEVPERM_TITLE;
$component['ARRNAME'] = _FPA_EXTCOM_TITLE;
$module['ARRNAME'] = _FPA_EXTMOD_TITLE;
$plugin['ARRNAME'] = _FPA_EXTPLG_TITLE;
$template['ARRNAME'] = _FPA_TMPL_TITLE;
$library['ARRNAME'] = _FPA_EXTLIB_TITLE;
$instance['configDBPREF'] = '';
// build the developer-mode function to display the raw arrays
function showDev( &$section ) {
if ( defined( '_FPA_DEV' ) ) {
echo '<div class="row"><div class="col-12">';
echo '<div class="card border border-warning mb-3 w-100">';
echo '<div class="card-header bg-warning text-white">';
echo '<span class="text-dark">['. _FPA_DEVMI .']</span><br />';
echo @$section['ARRNAME'] .' Array :';
echo '</div>';
echo '<div class="card-body small p-2">';
echo '<pre class="xsmall m-0">';
print_r ( $section );
echo '<pre>';
echo '<p class="m-0"><em>'. _FPA_ELAPSE .': <strong>'. mt_end() .'</strong> '. _FPA_SECONDS .'</em></p>';
echo '</div>';
echo '</div>';
echo '</div></div>';
} // end if _FPA_DEV defined
} // end developer-mode function
/** DETERMINE SOME SETTINGS BEFORE FPA MIGHT PLAY WITH THEM ******************************/
$phpenv['phpERRORDISPLAY'] = ini_get( 'display_errors' );
$phpenv['phpERRORREPORT'] = ini_get( 'error_reporting' );
$fpa['ORIGphpMEMLIMIT'] = ini_get( 'memory_limit' );
$fpa['ORIGphpMAXEXECTIME'] = ini_get( 'max_execution_time' );
$phpenv['phpERRLOGFILE'] = ini_get( 'error_log' );
$system['sysSHORTOS'] = strtoupper( substr( PHP_OS, 0, 3 ) ); // WIN, DAR, LIN, SOL
$system['sysSHORTWEB'] = strtoupper( substr( $_SERVER['SERVER_SOFTWARE'], 0, 3 ) ); // APA = Apache, MIC = MS IIS, LIT = LiteSpeed etc
// if the user see's Out Of Memory or Execution Timer pops, double the current memory_limit and max_execution_time
if ( @$_POST['increasePOPS'] == 1 ) {
ini_set ( 'memory_limit', (rtrim($fpa['ORIGphpMEMLIMIT'],"M")*2)."M" );
ini_set ( 'max_execution_time', ($fpa['ORIGphpMAXEXECTIME']*2) );
}
/**
* DETERMINE IF THERE IS A KNOWN ERROR ALREADY
*
* here we try and determine if there is an existing php error log file, if there is we
* then look to see how old it is, if it's less than one day old, lets see if what the last
* error this and try and auto-enter that as the problem description
*/
// is there an existing php error-log file?
if ( file_exists( $phpenv['phpERRLOGFILE'] ) ) {
// when was the file last modified?
$phpenv['phpLASTERRDATE'] = @date ("dS F Y H:i:s.", filemtime( $phpenv['phpERRLOGFILE'] ));
// determine the number of seconds for one day
$age = 86400;
// $age = strtotime('tomorrow') - time();
// get the modified time in seconds
$file_time = filemtime( $phpenv['phpERRLOGFILE'] );
// get the current time in seconds
$now_time = time();
/**
* if the file was modified less than one day ago, grab the last error entry
* Changed this section to get rid of the "Strict Standards: Only variables should be passed by reference" error
* @PhilD 20-Sep-2012
*
*/
if ( $now_time - $file_time < $age ) {
/**
* !FIXME memory allocation error on large php_error file - @RussW
* replaced these two lines with code below - @PhilD 23-Sep-2012
* $lines = file( $phpenv['phpERRLOGFILE'] );
* $phpenv['phpLASTERR'] = array_pop( $lines );
*
* Begin the fix for the memory allocation error on large php_error file
* Solution is to read the file line by line; not reading the whole file in memory.
* I just open a kind of a pointer to it, then seek it char by char.
* This is a more efficient way to work with large files. - @PhilD 23-Sep-2012
*
*/
$line = '';
$f = fopen(($phpenv['phpERRLOGFILE']), 'r');
$cursor = -1;
fseek($f, $cursor, SEEK_END);
$char = fgetc($f);
// Trim trailing newline chars of the file
while ($char === "\n" || $char === "\r") {
fseek($f, $cursor--, SEEK_END);
$char = fgetc($f);
}
// Read until the start of file or first newline char
while ($char !== false && $char !== "\n" && $char !== "\r") {
// Prepend the new char
$line = $char . $line;
fseek($f, $cursor--, SEEK_END);
$char = fgetc($f);
}
$phpenv['phpLASTERR'] = $line;
}
} // End Fix for memory allocation error when reading php_error file
/**
* DETERMINE INSTANCE STATUS & VERSIONING
*
* here we check for known files to determine if an instance even exists, then we look for
* the version and configuration files. some differ between between versions, so we have a
* bit of jiggling to do.
* to try and avoid "white-screens" fpa no-longer "includes" these files, but merely tries
* to open and read them, although this is slower, it improves the reliability of fpa.
*
*/
/**
* is an instance present?
*
* this is a two-fold sanity check, we look two pairs of known folders, only one pair need exist
* this caters for the potential of missing folders, but is not exhaustive or too time consuming
*
*/
if ( ( file_exists( 'components/' ) AND file_exists( 'modules/' ) ) OR ( file_exists( 'administrator/components/' ) AND file_exists( 'administrator/modules/' ) ) ) {
$instance['instanceFOUND'] = _FPA_Y;
} else {
$instance['instanceFOUND'] = _FPA_N;
}
/**