/
platform.php
executable file
·763 lines (721 loc) · 23.5 KB
/
platform.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
<?php
/**
* This contains all platform specific functions
* @version $Id: platform.php 40 2011-02-09 14:10:00Z biyi $
* @package Platform
* @category Function
* @author Biyi Akinpelu
* @link mailto:biyi@entilda.com
* @copyright Copyright (C) 2011 - 2012 The Platform Authors. All rights reserved.
* @license GNU Public Licence, see LICENSE.php
* Platform is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
/**
* platform: This is a pseudo constructor
* @param void
*
* @return void
*/
function platform(){
global $paths;
platform_launch_initialize();
platform_launch_debug(false);
if (!IS_CLI) platform_launch_dispatch($_SERVER['QUERY_STRING']);
//debug_complete_stack($paths);
}
/**
* platform_launch: used to attach/include a file
* @param string $file The file to launch and load
*
* @return void
*/
function platform_launch($file){
require_once "{$file}";
}
/**
* platform_launch_php: used to attach/include a php file
* @param string $file The php file to launch and load
*
* @return void
*/
function platform_launch_php($file){
platform_launch("{$file}.php");
}
/**
* platform_launch_phtml: used to attach/include a phtml file
* @param string $file The phtml file to launch and load
*
* @return void
*/
function platform_launch_phtml($file){
platform_launch("{$file}.phtml");
}
/**
* platform_launch_application: used to execute system shell application
* @param string $file The phtml file to launch and load
*
* @return mixed An array of standard output of system shell application
*/
function platform_launch_application($command){
exec($command, $output, $return_value);
// TODO:
// debug output from failed commands using $return_value
return $output;
}
/**
* platform_launch_autoload: used to dynamically load attached files
* @param string $file The file object to launch and load
*
* @return void
*/
function platform_launch_autoload($file)
{
global $paths;
foreach ($paths as $instance => $path)
{
$filename = $path . DS . $file;
if (file_exists($filename))
{
if (!stristr($instance, 'templates')){
platform_launch_php($filename);
}
break;
}
}
}
/**
* platform_launch_initialize: used to initialize bootstrapping process
* @param void
*
* @return void
*/
function platform_launch_initialize(){
global $paths;
foreach ($paths as $instance => &$path) {
$contents = platform_launch_list_php($path);
if (is_dir($path)) {
if (!empty($contents)){
foreach ($contents as $file) {
$full_filename = $path . DS . $file;
if (STDLIB == APP_ENGINE){
$allowed = !stristr($instance, 'classes') && !stristr($instance, 'templates');
} else {
$allowed = !stristr($instance, 'templates');
}
if ($allowed){
platform_launch($full_filename);
}
}
}
} else {
continue;
}
}
if (isset($_REQUEST['editor']) && $_REQUEST['editor'] == 'on') {
$path = PLATFORM_SANDBOX_SYSTEM_APPLICATIONS_PATH . DS . 'editor' . DS ;
platform_launch_php($path . 'index.php');
}
}
/**
* platform_launch_browser: used to launch system application browser
* @param void
*
* @return void
*/
function platform_launch_browser(){
$path = PLATFORM_SANDBOX_SYSTEM_APPLICATIONS_PATH . DS . 'browser' . DS ;
$filename = $path . 'index.php';
platform_launch($filename);
}
/**
* platform_launch_dispatch: used to dispatch system requests
* @param void
*
* @return void
*/
function platform_launch_dispatch($request=null){
switch($request){
case 'platform':
platform_launch_sandbox_system_index();
break;
case 'security':
platform_launch_ip_authorization_checks();
break;
case 'browser':
default:
if (empty($request) || is_null($request)){
platform_launch_browser();
} else {
platform_launch_sandbox_system_index();
//benchmark_view();
}
break;
}
}
/**
* platform_launch_path_to: used to dispatch system object listings
* @param string $request The request path to load
*
* @return void
*/
function platform_launch_path_to($request){
$exclude_hidden = array('.AppleDouble', '.config', '.svn', '.git', '.chromium',
'.dude', '.icons', '.fonts', '.mac4lin', '.prebuilds',
'.torrents', '.trash','.files');
switch($request){
case 'platform':
default:
$exclusions = array('services', 'laboratory', 'projects',
'README', 'TODO');
$exclusions = array_merge($exclusions, $exclude_hidden);
// TODO: dynamically load all listings, no hard-fixing listings
// $path = PLATFORM_BASE_PATH . DS;
// $pages = platform_launch_list_path($path, true, $exclusions);
$pages = array('sandbox', 'servers', 'networks', 'sites',
'mirrors', 'help', 'info');
platform_launch_listview_lists_exact($pages);
break;
case 'sandbox':
$exclusions = array('README', 'TODO');
$exclusions = array_merge($exclusions, $exclude_hidden);
$path = PLATFORM_BASE_PATH . DS;
platform_launch_listview_lists($path . $request, $exclusions);
$pages = array(
'README' => $path . 'README',
'TODO' => $path . 'TODO',
);
platform_launch_listview_lists_raw($pages);
break;
case 'servers':
$exclusions = array();
$exclusions = array_merge($exclusions, $exclude_hidden);
$path = PLATFORM_BASE_PATH . DS;
platform_launch_listicon_lists($path . $request, $exclusions);
break;
case 'sites':
$exclusions = array('fonts', 'icons', 'images', 'logs', 'tmp');
$exclusions = array_merge($exclusions, $exclude_hidden);
$path = PLATFORM_BASE_PATH . DS;
platform_launch_listicon_lists($path . $request, $exclusions);
break;
case 'networks':
$exclusions = array();
$exclusions = array_merge($exclusions, $exclude_hidden);
$path = PLATFORM_BASE_PATH . DS;
platform_launch_listview_lists($path . $request, $exclusions);
network_create_nodes();
break;
case 'wireless':
$exclusions = array();
$exclusions = array_merge($exclusions, $exclude_hidden);
$path = PLATFORM_NETWORKS_PATH . DS;
platform_launch_listicon_lists($path . $request, $exclusions);
break;
case 'lan':
$exclusions = array();
$exclusions = array_merge($exclusions, $exclude_hidden);
$path = PLATFORM_NETWORKS_PATH . DS;
platform_launch_listicon_lists($path . $request, $exclusions);
break;
case 'social':
$exclusions = array();
$exclusions = array_merge($exclusions, $exclude_hidden);
$path = PLATFORM_BASE_PATH . DS;
platform_launch_listview_lists($path . $request, $exclusions);
// rewrite output
$pages = array('Yammer' => '/networks/social/yammer/');
platform_launch_listview_lists_raw($pages);
break;
case 'help':
$exclusions = array('wiki', 'manuals', 'documentations');
$exclusions = array_merge($exclusions, $exclude_hidden);
$path = PLATFORM_BASE_PATH . DS;
platform_launch_listview_lists($path . $request, $exclusions);
// rewrite output
$pages = array('Wiki' => '/help/wiki/');
platform_launch_listview_lists_raw($pages);
break;
case 'bugs':
$exclusions = array();
$exclusions = array_merge($exclusions, $exclude_hidden);
$path = PLATFORM_BASE_PATH . DS;
platform_launch_listview_lists($path . $request, $exclusions);
// rewrite output
$pages = array('JIRA' => '/help/bugs/jira/');
platform_launch_listview_lists_raw($pages);
break;
case 'framework':
$exclusions = array();
$exclusions = array_merge($exclusions, $exclude_hidden);
$path = PLATFORM_BASE_PATH . DS;
platform_launch_listview_lists($path . $request, $exclusions);
// rewrite output
$pages = array(
// 'Cake PHP' => '/sandbox/framework/cakephp/',
// 'Code Igniter' => '/sandbox/framework/codeigniter/',
// 'Django' => '/sandbox/framework/django/',
// 'Drupal' => '/sandbox/framework/drupal/',
// 'Laravel' => '/sandbox/framework/laravel/',
'Lumen' => '/sandbox/framework/lumen/',
'Phalcon' => '/sandbox/framework/phalcon/',
// 'Ruby On Rails' => '/sandbox/framework/rails/',
// 'Symfony' => '/sandbox/framework/symfony/',
// 'Yii' => '/sandbox/framework/yii/',
'Zend' => '/sandbox/framework/zf/'
);
platform_launch_listview_lists_raw($pages);
break;
case 'library':
$exclusions = array();
$exclusions = array_merge($exclusions, $exclude_hidden);
$path = PLATFORM_SANDBOX_PATH . DS;
platform_launch_listview_lists($path . $request, $exclusions);
break;
case 'repository':
$exclusions = array();
$exclusions = array_merge($exclusions, $exclude_hidden);
$path = PLATFORM_SANDBOX_PATH . DS;
platform_launch_listview_lists($path . $request, $exclusions);
// rewrite output
$pages = array(
'README' => '/sandbox/repository/README',
'TODO' => '/sandbox/repository/TODO',
);
platform_launch_listview_lists_raw($pages);
break;
case 'system':
$exclusions = array('caches', 'classes', 'components', 'contributions', 'configurations', 'crons',
'daemons', 'databases', 'executables', 'extensions', 'functions',
'hooks', 'languages', 'logs', 'migrations', 'schemas', 'services',
'structs', 'tests', 'templates', 'ui', 'vendors');
$exclusions = array_merge($exclusions, $exclude_hidden);
$path = PLATFORM_SANDBOX_PATH . DS;
platform_launch_listview_lists($path . $request, $exclusions);
break;
case 'applications':
$exclusions = array('browser', 'gnump3d', 'ktorrent','nagios',
'quicknote', 'sugarcrm', 'webmin');
$exclusions = array_merge($exclusions, $exclude_hidden);
platform_launch_listview_lists_applications($exclusions);
break;
case 'workspace':
$exclusions = array('in-basket');
$exclusions = array_merge($exclusions, $exclude_hidden);
$path = PLATFORM_SANDBOX_PATH . DS;
platform_launch_listview_lists($path . $request, $exclusions);
// rewrite output
$pages = array('README' => '/sandbox/workspace/README',
'TODO' => '/sandbox/workspace/TODO',
);
platform_launch_listview_lists_raw($pages);
break;
case 'mirrors':
$exclusions = array('b', 'f', 'hts-cache');
$exclusions = array_merge($exclusions, $exclude_hidden);
$path = PLATFORM_BASE_PATH . DS;
platform_launch_listicon_lists($path . $request, $exclusions);
break;
case 'platforms':
$pages = array('android');
$exclusions = array_merge($exclusions, $exclude_hidden);
platform_launch_listview_lists($pages);
break;
}
}
/**
* platform_launch_back_paths: used to determine back paths relative
* to system base path
* @param void
*
* @return string $back_path The output of number of relative back paths
*/
function platform_launch_back_paths(){
$base_path_array = explode('/', APPLICATION_BASE_PATH);
$current_path_array = explode('/', getcwd());
$back_count = count($base_path_array) - count($current_path_array);
for($i=0; $i < abs($back_count); $i++){
$back_path .= PDS . DS;
}
return $back_path;
}
/**
* platform_launch_update_index: used to update system index
* @param void
*
* @return Mixed The standard output of the result
*/
function platform_launch_update_index(){
return platform_launch_application('updatedb');
}
/**
* platform_launch_list_php: used to list all php files contained within $path
* @param string $path The path to get all php file lists
*
* @return Mixed $contents Array containing the list of php files within $path
*/
function platform_launch_list_php($path){
platform_launch_php(PLATFORM_SANDBOX_SYSTEM_FUNCTIONS_PATH . DS . 'filesystem');
$contents = list_files($path, 'php');
return $contents;
}
/**
* platform_launch_list_path: used to list all files contained within $path
* @param string $path The path to get all file lists
* @param boolean $dir Determines whether to include a directory listings
* @param array $exclusion A collection of paths to exclude from listings
*
* @return Mixed $contents Array containing the list of files within $path
*/
function platform_launch_list_path($path, $dir=false, $exclusion=null){
platform_launch_php(PLATFORM_SANDBOX_SYSTEM_FUNCTIONS_PATH . DS . 'filesystem');
$lists = array();
$contents = read_path($path);
if (!is_null($contents) && is_array($contents)){
foreach($contents as $content){
if (stristr($content, '.php') || stristr($content, '.txt') || stristr($content, '.css')
|| stristr($content, '.html')){
} else {
if ($dir && is_dir($path . DS . $content)){
$lists[] = $content;
}
}
}
}
return $lists;
}
/**
* platform_launch_default_icon: used to display the default icon
* (for templating only)
* @param string $page The page to load default icon
*
* @return void
*/
function platform_launch_default_icon($page=null){
//e($page);
switch($page)
{
case 'bugs':
case 'networks':
case 'wireless':
case 'lan':
case 'social':
case 'sandbox':
case 'servers':
case 'sites':
case 'mirrors':
case 'system':
case 'applications':
case 'nodes':
case 'framework':
case 'libraries':
case 'platforms':
?>
<div class="default_<?php e($page) ?>_icon"> </div>
<?php
break;
default:
?>
<div class="default_icon"> </div>
<?php
break;
}
}
/**
* platform_launch_listview_lists_exact: used to list files in
* exact order as indicate with $pages
* @param array $pages The pages to display in an exact order
*
* @return void
*/
function platform_launch_listview_lists_exact($pages=null){
$request = $_SERVER['QUERY_STRING'];
$pages = (!is_array($pages)) ? platform_launch_list_path(PLATFORM_BASE_PATH . DS . $request, true) : $pages;
?>
<ul>
<?php
if (!is_null($pages) && is_array($pages)):
foreach($pages as $page):
if (stristr('readme', $page)):
$url = platform_launch_load_raw_object($page);
else:
$url = HTTP_URI.$_SERVER['SERVER_NAME']."/?".$page;
endif;
?>
<li><a class="listview_link <?php e($page) ?>" href="<?php e($url) ?>"><span class="listview_<?php e($page) ?>"> </span><?php e(ucfirst($page)) ?></a></li>
<?php e(platform_launch_splash_documentation($page)); ?>
<?php
endforeach;
endif;
?>
</ul>
<?php
}
/**
* platform_launch_listview_lists: used to list files in
* exact order as indicate with $pages
* @param string $path The path to load listings
* @param array $exclusion A collection of paths to exclude from listings
*
* @return void
*/
function platform_launch_listview_lists($path, $exclusion=null){
$pages = platform_launch_list_path($path, true);
$pages = exclude($pages, $exclusion);
?>
<ul>
<?php
if (!is_null($pages) && is_array($pages)):
foreach($pages as $page):
if (stristr('readme', $page)):
$url = platform_launch_load_raw_object($page);
else:
$url = HTTP_URI.$_SERVER['SERVER_NAME']."/?".$page;
endif;
?>
<li><a class="listview_link <?php e($page) ?>" href="<?php e($url) ?>"><span class="listview_<?php e($page) ?>"> </span><?php e(ucfirst($page)) ?></a></li>
<?php e(platform_launch_splash_documentation($page)); ?>
<?php
endforeach;
endif;
?>
</ul>
<?php
}
/**
* platform_launch_listview_lists_raw: used to list files in raw format.
* Output is executed as is in raw output format (not ideal for php files)
* @param array $pages The path to load listings
*
* @return void
*/
function platform_launch_listview_lists_raw($pages=null){
$request = $_SERVER['QUERY_STRING'];
$pages = (!is_array($pages)) ? platform_launch_list_path(PLATFORM_BASE_PATH . DS . $request, true) : $pages;
?>
<ul>
<?php
if (!is_null($pages) && is_array($pages)):
foreach($pages as $page => $link):
if (!is_numeric($page)){
$url = platform_launch_load_raw_object($link);
} else {
$url = null;
}
?>
<li><a class="listview_link" href="<?php e($url) ?>"><span class="listview_<?php e($page) ?>"> </span><?php e($page) ?></a></li>
<?php
endforeach;
endif;
?>
</ul>
<?php
}
/**
* platform_launch_splash_documentation: used to display splash documentation.
*
* @param string $page The page being displayed
*
* @return void
*/
function platform_launch_splash_documentation($page){
$exists = (isset($page) && !empty($page) && $page == 'platform');
js_start(); ?>
$('.listview_link.<?php e($page) ?>').hover(function(){
$.getJSON('/platform.json', function(data) {
$('#main_content').html('<h3><span class="listview_<?php e($page) ?>"> </span><?php e(ucfirst($page)) ?></h3><a href="javascript:{}" onclick="responsiveVoice.speak(' + data.platform.<?php e($page)?> + '\')"><span class="fa fa-headphones object"> Listen </span></a><p style="text-align: justify; font-size: 14px; padding: 10px">'+ data.platform.<?php e($page)?> + '</p>');
});
}, function(){
$.getJSON('/platform.json', function(data) {
$('#main_content').html('<h3><span class="listview_<?php e($page) ?>"> </span><?php e(ucfirst($page)) ?></h3><a href="javascript:{}" onclick="responsiveVoice.speak(\'' + data.platform.<?php e($page)?> + '\')"><span class="fa fa-headphones object"> Listen </span></a><p style="text-align: justify; font-size: 14px; padding: 10px">'+ data.platform.<?php e($page)?> + '</p>');
});
});
<?php js_end();
}
/**
* platform_launch_listview_lists_applications: used to list applications.
* Output is executed in php output format
* @param array $exclusion A collection of paths to exclude from listings
*
* @return void
*/
function platform_launch_listview_lists_applications($exclusions=null){
$request = $_SERVER['QUERY_STRING'];
$pages = platform_launch_list_path(PLATFORM_SANDBOX_SYSTEM_PATH . DS . $request, true);
$pages = exclude($pages, $exclusions);
?>
<ul>
<?php
if (!is_null($pages) && is_array($pages)):
foreach($pages as $page):
if (stristr('readme', $page) || stristr('todo', $page)):
$url = platform_launch_load_raw_object($page);
else:
$url = PLATFORM_SANDBOX_SYSTEM_URI . DS . $request . DS . $page;
endif;
?>
<li><a class="listview_link" href="<?php e($url) ?>"><span class="listview_applications"> </span><?php e($page) ?></a></li>
<?php
endforeach;
endif;
?>
</ul>
<?php
}
/**
* platform_launch_listview_lists_executables: used to list executables.
* Output is executed in php output format
* @param array $exclusion A collection of paths to exclude from listings
*
* @return void
*/
function platform_launch_listview_lists_executables($exclusions=null){
$request = $_SERVER['QUERY_STRING'];
$pages = platform_launch_list_path(PLATFORM_SANDBOX_SYSTEM_PATH . DS . $request, true);
$pages = exclude($pages, $exclusions);
?>
<ul>
<?php
if (!is_null($pages) && is_array($pages)):
foreach($pages as $page):
if (stristr('readme', $page) || stristr('todo', $page)):
$url = platform_launch_load_raw_object($page);
else:
$url = PLATFORM_SANDBOX_SYSTEM_URI . DS . $request . DS . $page;
endif;
?>
<li><a class="listview_link" href="<?php e($url) ?>"><span class="listview_executables"> </span><?php e($page) ?></a></li>
<?php
endforeach;
endif;
?>
</ul>
<?php
}
/**
* platform_launch_load_raw_object: converts file to URI format.
* Output is executed in php output format
* @param string $file The file to convert to URL
*
* @return string $file The converted URI format of $file
*/
function platform_launch_load_raw_object($file){
$file = HTTP_URI.$_SERVER['SERVER_NAME']."$file";
return $file;
}
/**
* platform_launch_listicon_lists: Display HTML output for listings
* @param string $path The path to list
* @param string $exclusion A collection of paths to exclude from listings
*
* @return void
*/
function platform_launch_listicon_lists($path, $exclusion=null){
$request = $_SERVER['QUERY_STRING'];
$pages = platform_launch_list_path($path, true);
$pages = exclude($pages, $exclusion);
?>
<ul>
<?php
if (!is_null($pages) && is_array($pages)):
foreach($pages as $page):
?>
<li><a class="listicon_link" href="http://<?php e($_SERVER['SERVER_NAME']) ?>/<?php e($request) ?>/<?php e(strtolower($page)) ?>"><span class="listicon_<?php e($request) ?>_icon"> </span><?php e(strtolower($page)) ?></a></li>
<?php
endforeach;
endif;
?>
</ul>
<?php
}
/**
* platform_launch_debug: used to load the system debugger
* @param string $status The path to list
*
* @return void
*/
function platform_launch_debug($status=0){
platform_launch_php('debug');
debug_php($status);
}
/**
* platform_launch_log: used to create system logs to file
* @param string $log The log
* @param string $type The type of log to create
*
* @return void
*/
function platform_launch_log($log, $type='system'){
sys_log($log, $type);
}
/**
* platform_launch_redirect: used to redirect request to specific URL
* @param string $url The URL to redirect to
*
* @return void
*/
function platform_launch_redirect($url){
header('location:' . $url);
}
/**
* platform_launch_ip_authorization_checks: used for IP authorizations
* @param void
*
* @return void
*/
function platform_launch_ip_authorization_checks(){
platform_launch_php('global');
$ip = network_get_real_ip();
$browser = detect_browser();
switch($ip){
// TODO: rewrite function
// allowed ip addresses
// localhost network
case '127.0.0.1':
case '127.0.1.1':
// ehonet network
case '192.168.43.1':
case '192.168.43.2':
case '192.168.43.42':
case '192.168.43.65':
case '192.168.43.174':
// ehonet-wifi network
case '10.10.2.200':
case '10.10.2.210':
case '10.10.2.220':
case '10.10.2.222';
case '10.10.2.225':
case '10.10.2.230':
case '10.10.2.240':
//redirect_to('http://'.$_SERVER['HTTP_HOST'].'/platform/');
break;
default:
redirect_to('http://www.entilda.com?api='.base64_encode(base64_encode(base64_encode(time()))).
'&encdata=true&tracking=enabled&cryptocheck='.base64_encode(base64_encode(base64_encode($ip))).'&detected='.$ip.'&client='.$browser);
break;
}
}
/**
* platform_launch_sandbox_system_template: used to load HTML template
* @param string $template The HTML template file to load
*
* @return void
*/
function platform_launch_sandbox_system_template($template){
platform_launch_phtml(PLATFORM_SANDBOX_SYSTEM_TEMPLATES_PATH . DS . $template);
}
/**
* platform_launch_sandbox_system_index: load the HTML page layout
* @param void
*
* @return void
*/
function platform_launch_sandbox_system_index(){
// loading sandbox system templates
platform_launch_sandbox_system_template('header');
platform_launch_sandbox_system_template('layout');
platform_launch_sandbox_system_template('footer');
}