/
Globals.php
758 lines (690 loc) · 23.5 KB
/
Globals.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
<?php
/**
* Globals is a core class for loading and accessing system information from anywhere.
* This is very helpful for processes which may need to be used within Views, etc.
*
* SurvLoop - All Our Data Are Belong
* @package wikiworldorder/survloop
* @author Morgan Lesko <wikiworldorder@protonmail.com>
* @since v0.0.18
*/
namespace SurvLoop\Controllers\Globals;
use DB;
use Auth;
use Storage;
use Illuminate\Http\Request;
use App\Models\SLDatabases;
use App\Models\SLDefinitions;
use App\Models\SLFields;
use App\Models\SLTables;
use App\Models\SLTree;
use App\Models\SLNode;
use App\Models\SLNodeResponses;
use App\Models\SLDataLoop;
use App\Models\SLDataSubsets;
use App\Models\SLDataHelpers;
use App\Models\SLDataLinks;
use App\Models\SLSess;
use App\Models\SLSessLoops;
use App\Models\SLSessSite;
use App\Models\SLSessPage;
use App\Models\SLEmails;
use App\Models\SLSearchRecDump;
use SurvLoop\Controllers\SurvLoopImages;
use SurvLoop\Controllers\Tree\TreeNodeSurv;
class Globals extends GlobalsImportExport
{
public $states = null;
public $imgs = false;
public $blurbs = [];
public $emaBlurbs = [];
function __construct(Request $request = NULL, $dbID = 1, $treeID = 1, $treeOverride = -3)
{
$this->loadStatic($request);
$this->loadGlobalTables($dbID, $treeID, $treeOverride);
$this->loadDBFromCache($request);
$this->loadTreeMojis();
$this->loadDataMap($this->treeID);
$this->chkReportFormTree();
$this->loadCustomGlobals();
$GLOBALS["errors"] = '';
return true;
}
public function loadCustomGlobals()
{
$GLOBALS["CUST"] = null;
if (isset($this->sysOpts["cust-abbr"]) && $this->sysOpts["cust-abbr"] != 'SurvLoop') {
$custClass = $this->sysOpts["cust-abbr"] . "\\Controllers\\" . $this->sysOpts["cust-abbr"] . "Globals";
if (class_exists($custClass)) {
eval("\$GLOBALS['CUST'] = new " . $custClass . ";");
}
}
return true;
}
public function urlRoot()
{
return str_replace('https://', '', str_replace('http://', '', $this->sysOpts["app-url"]));
}
public function isStepLoop($loop)
{
return (isset($this->dataLoops[$loop]) && intVal($this->dataLoops[$loop]->DataLoopIsStep) == 1);
}
public function setClosestLoop($loop = '', $itemID = -3, $obj = [])
{
$this->closestLoop = [ "loop" => $loop, "itemID" => $itemID, "obj" => $obj ];
return true;
}
public function chkClosestLoop()
{
if ($this->sessLoops && isset($this->sessLoops[0])) {
$loop = $this->sessLoops[0]->SessLoopName;
if (isset($this->dataLoops[$loop])) {
$this->setClosestLoop($loop, $this->sessLoops[0]->SessLoopItemID, $this->dataLoops[$loop]);
}
}
return true;
}
public function loadSessLoops($sessID)
{
$this->sessLoops = SLSessLoops::where('SessLoopSessID', $sessID)
->orderBy('SessLoopID', 'desc')
->get();
$this->setClosestLoop();
$this->chkClosestLoop();
return $this->sessLoops;
}
public function fakeSessLoopCycle($loop, $itemID)
{
/// add fake to [0] position, then reset closest
$tmpLoops = $this->sessLoops;
$this->sessLoops = [];
$this->sessLoops[0] = new SLSessLoops;
$this->sessLoops[0]->SessLoopName = $loop;
$this->sessLoops[0]->SessLoopItemID = $itemID;
if (sizeof($tmpLoops) > 0) {
foreach ($tmpLoops as $l) {
$this->sessLoops[] = $l;
}
}
$this->setClosestLoop($loop, $itemID, $this->dataLoops[$loop]);
return true;
}
public function removeFakeSessLoopCycle($loop, $itemID)
{
$tmpLoops = $this->sessLoops;
$this->sessLoops = [];
if (sizeof($tmpLoops) > 0) {
foreach ($tmpLoops as $i => $l) {
if ($l->SessLoopName != $loop || $l->SessLoopItemID != $itemID) {
$this->sessLoops[] = $l;
}
}
}
$this->chkClosestLoop();
return true;
}
public function getSessLoopID($loopName)
{
if (sizeof($this->sessLoops) > 0) {
foreach ($this->sessLoops as $loop) {
if ($loop->SessLoopName == $loopName && intVal($loop->SessLoopItemID) > 0) {
return $loop->SessLoopItemID;
}
}
}
return -3;
}
public function getLoopName($loopID)
{
if (sizeof($this->dataLoops) > 0) {
foreach ($this->dataLoops as $loop) {
if ($loopID == $loop->DataLoopID) {
return $loop->DataLoopPlural;
}
}
}
return '';
}
public function getLoopSingular($loopName)
{
if (isset($this->dataLoops[$loopName])) {
return $this->dataLoops[$loopName]->DataLoopSingular;
}
return '';
}
public function getLoopTable($loopName)
{
if (isset($this->dataLoops[$loopName])) {
return $this->dataLoops[$loopName]->DataLoopTable;
}
return '';
}
public function loadLoopConds()
{
if (isset($this->dataLoops) && sizeof($this->dataLoops) > 0) {
foreach ($this->dataLoops as $loopName => $loop) {
if (isset($this->dataLoops[$loopName]->DataLoopTree)) {
$this->dataLoops[$loopName]->loadLoopConds();
}
}
}
return true;
}
protected function getDataSetRow($loopName)
{
if ($loopName == '' || !isset($this->dataLoops[$loopName])) {
return [];
}
return $this->dataLoops[$loopName];
}
protected function loadBlurbNames()
{
if (empty($this->blurbs)) {
$defs = SLDefinitions::select('DefSubset')
->where('DefDatabase', $this->dbID)
->where('DefSet', 'Blurbs')
->get();
if ($defs->isNotEmpty()) {
foreach ($defs as $def) {
$this->blurbs[] = $def->DefSubset;
}
}
}
return $this->blurbs;
}
public function swapBlurbs($str)
{
$this->loadBlurbNames();
if (trim($str) != '' && sizeof($this->blurbs) > 0) {
$changesMade = true;
while ($changesMade) {
$changesMade = false;
foreach ($this->blurbs as $b) {
if (strpos($str, '{{' . $b . '}}') !== false) {
$blurb = $this->getBlurb($b);
$str = str_replace('{{' . $b . '}}', $blurb, $str);
$changesMade = true;
}
$swapStr = '{{' . str_replace('&', '&', $b) . '}}';
if (strpos($str, $swapStr) !== false) {
$blurb = $this->getBlurb($b);
$str = str_replace($swapStr, $blurb, $str);
$changesMade = true;
}
}
}
}
return $str;
}
public function getBlurbAndSwap($blurbName = '', $blurbID = -3)
{
return $this->swapBlurbs($this->getBlurb($blurbName, $blurbID));
}
public function getBlurb($blurbName = '', $blurbID = -3)
{
$def = [];
if ($blurbID > 0) {
$def = SLDefinitions::find($blurbID);
} else {
$def = SLDefinitions::where('DefSubset', 'LIKE', $blurbName)
->where('DefDatabase', $this->dbID)
->where('DefSet', 'Blurbs')
->first();
}
if ($def && isset($def->DefDescription)) {
return $def->DefDescription;
}
return '';
}
public function loadEmailDropOpts($presel = -3, $tree = -3)
{
if ($tree <= 0) {
$tree = $this->treeID;
}
$ret = '';
$emas = SLEmails::where('EmailTree', $tree)
->where('EmailType', 'NOT LIKE', 'Blurb')
->get();
if ($emas->isNotEmpty()) {
foreach ($emas as $e) {
$ret .= '<option value="' . $e->EmailID . '" '
. (($e->EmailID == $presel) ? 'SELECTED' : '')
. ' >' . $e->EmailName . '</option>';
}
}
return $ret;
}
protected function loadEmailBlurbNames()
{
if (sizeof($this->emaBlurbs) == 0) {
$emas = SLEmails::select('EmailName')
//->where('EmailTree', $this->treeID)
->where('EmailType', 'Blurb')
->get();
if ($emas->isNotEmpty()) {
foreach ($emas as $e) {
$this->emaBlurbs[] = $e->EmailName;
}
}
}
return $this->emaBlurbs;
}
public function swapEmailBlurbs($str)
{
$this->loadEmailBlurbNames();
if (trim($str) != '') {
$changesMade = true;
if (sizeof($this->emaBlurbs) > 0) {
while ($changesMade) {
$changesMade = false;
foreach ($this->emaBlurbs as $b) {
if (strpos($str, '[{ ' . $b . ' }]') !== false) {
$blurb = $this->getEmailBlurb($b);
$str = str_replace('[{ ' . $b . ' }]', $blurb, $str);
$changesMade = true;
}
$swapStr = '[{ ' . str_replace('&', '&', $b) . ' }]';
if (strpos($str, $swapStr) !== false) {
$blurb = $this->getEmailBlurb($b);
$str = str_replace($swapStr, $blurb, $str);
$changesMade = true;
}
}
}
}
if (sizeof($GLOBALS["SL"]->REQ->all()) > 0) {
foreach ($GLOBALS["SL"]->REQ->all() as $param => $value) {
$pos = strpos($param, 'emaSwap');
if ($pos !== false && $pos == 0) {
$swapStr = '[{ ' . str_replace('emaSwap', '', $param) . ' }]';
if (strpos($str, $swapStr) !== false) {
$str = str_replace($swapStr, $value, $str);
$changesMade = true;
}
}
}
}
}
return $str;
}
public function getEmailBlurb($blurbName)
{
$ema = SLEmails::where('EmailName', $blurbName)->first();
if ($ema && isset($ema->EmailBody)) {
return $ema->EmailBody;
}
return '';
}
public function getEmailSubj($emaID)
{
$ema = SLEmails::find($emaID);
if ($ema && isset($ema->EmailSubject)) {
return $ema->EmailSubject;
}
return '';
}
public function addToHeadCore($js)
{
if (!isset($this->sysOpts['header-code'])) {
$this->sysOpts['header-code'] = '';
}
if (strpos($this->sysOpts['header-code'], $js) === false) {
$this->sysOpts['header-code'] .= $js;
}
return true;
}
public function debugPrintExtraFilesCSS()
{
$ret = '';
if (isset($this->sysOpts["css-extra-files"]) && trim($this->sysOpts["css-extra-files"]) != '') {
$files = $this->mexplode(',', $this->sysOpts["css-extra-files"]);
foreach ($files as $url) {
$url = trim($url);
if (strpos($url, '../vendor/') === 0) {
$url = $this->convertRel2AbsURL($url);
}
if (trim($url) != '') {
$ret .= '<script src="' . $url . '" type="text/javascript"></script>';
}
}
}
return $ret;
}
public function addTopNavItem($title, $url)
{
if (strpos($this->pageJAVA, 'addTopNavItem("' . $title . '"') === false) {
$this->pageJAVA .= 'setTimeout(\'addTopNavItem("' . $title . '", "' . $url . '")\', 2000);';
}
return true;
}
public function loadImgs($nID = '', $dbID = 1)
{
if ($this->imgs === false) {
$this->imgs = new SurvLoopImages($nID, $dbID);
}
return true;
}
public function getImgSelect($nID = '', $dbID = 1, $presel = '', $newUp = '')
{
$this->loadImgs($nID, $dbID);
return $this->imgs->getImgSelect($nID, $dbID, $presel, $newUp);
}
public function getImgDeet($imgID = -3, $nID = '', $dbID = 1)
{
$this->loadImgs($nID, $dbID);
return $this->imgs->getImgDeet($imgID);
}
public function saveImgDeet($imgID = -3, $nID = '', $dbID = 1)
{
$this->loadImgs($nID, $dbID);
return $this->imgs->saveImgDeet($imgID);
}
public function uploadImg($nID = '', $presel = '', $dbID = 1)
{
$this->loadImgs($nID, $dbID);
return $this->imgs->uploadImg($nID, $presel);
}
public function addPreloadImg($src = '')
{
if (trim($src) == '') {
return false;
}
if (!isset($this->x["preload-imgs"])) {
$this->x["preload-imgs"] = [];
}
$this->x["preload-imgs"][] = $src;
return true;
}
public function listPreloadImgs()
{
if (!isset($this->x["preload-imgs"])) {
$this->x["preload-imgs"] = [];
}
return $this->x["preload-imgs"];
}
public function getCurrUrl()
{
return $_SERVER["REQUEST_URI"];
}
public function addAdmMenuHshoo($url = '')
{
if (trim($url) == '') {
return false;
}
if (!isset($this->x["menu-hshoos"])) {
$this->x["menu-hshoos"] = [];
}
$this->x["menu-hshoos"][] = $url;
$this->addHshoo($url);
return true;
}
public function addAdmMenuHshoos($urls = [])
{
if (sizeof($urls) > 0) {
foreach ($urls as $i => $url) {
$this->addAdmMenuHshoo($url);
}
}
return true;
}
public function isAdmMenuHshoo($url = '')
{
return (isset($this->x["menu-hshoos"]) && in_array($url, $this->x["menu-hshoos"]));
}
public function addHshoo($url = '')
{
if (trim($url) == '') {
return false;
}
if (!isset($this->x["hshoos"])) {
$this->x["hshoos"] = [];
}
if (strpos($url, '#') > 0) {
$url = substr($url, strpos($url, '#'));
}
if (!in_array($url, $this->x["hshoos"])) {
$this->x["hshoos"][] = $url;
}
return true;
}
public function addHshoos($urls = [])
{
if (sizeof($urls) > 0) {
foreach ($urls as $i => $url) {
$this->addAdmMenuHshoo($url);
}
}
return true;
}
public function isHshoo($url = '')
{
return (isset($this->x["hshoos"]) && in_array($url, $this->x["hshoos"]));
}
public function getHshooJs()
{
return view('vendor.survloop.js.inc-check-add-hshoo', [
"hshoos" => ((isset($this->x["hshoos"])) ? $this->x["hshoos"] : [])
])->render();
}
public function getXtraJs()
{
return $this->getHshooJs();
}
public function addBodyParams($html)
{
if (!isset($this->x["bodyParams"])) {
$this->x["bodyParams"] = '';
}
$this->x["bodyParams"] .= $html;
return true;
}
public function getBodyParams()
{
$ret = '';
if (isset($this->x["bodyParams"])) {
$ret .= $this->x["bodyParams"];
}
if (isset($this->x["bodyOverflowX"]) && trim($this->x["bodyOverflowX"]) != '') {
$ret .= ' style="overflow-x: ' . $this->x["bodyOverflowX"] . ';" ';
}
return $ret;
}
public function pageBodyOverflowX($value = 'visible')
{
if ($value == 'visible') {
$this->x["bodyOverflowX"] = 'visible';
} else {
$this->x["bodyOverflowX"] = 'hidden';
}
return true;
}
public function getSrchUrl($override = '')
{
if ($override != '') {
return $this->x["srchUrls"][$override];
}
if ($this->isAdmin) {
return $this->x["srchUrls"]["administrator"];
} elseif ($this->isVolun) {
return $this->x["srchUrls"]["volunteer"];
}
return $this->x["srchUrls"]["public"];
}
public function getDumpSrchResultIDs($searches = [], $treeID = -3)
{
if ($treeID <= 0) {
$treeID = $this->treeID;
}
if (!isset($this->x["srchResDump"])) {
$this->x["srchResDump"] = [];
}
if (sizeof($searches) > 0) {
foreach ($searches as $s) {
$rows = SLSearchRecDump::where('SchRecDmpTreeID', $treeID)
->where('SchRecDmpRecDump', 'LIKE', '%' . $s . '%')
->select('SchRecDmpRecID')
->orderBy('created_at', 'desc')
->get();
if ($rows->isNotEmpty()) {
foreach ($rows as $row) {
if (isset($row->SchRecDmpRecID) && !in_array($row->SchRecDmpRecID, $this->x["srchResIDs"])) {
$this->x["srchResDump"][] = $row->SchRecDmpRecID;
}
}
}
}
}
return true;
}
public function addSrchResults($set = '?', $rows = [], $idFld = '')
{
if (!isset($this->x["srchResIDs"])) {
$this->x["srchResIDs"] = [];
}
if (!isset($this->x["srchRes"])) {
$this->x["srchRes"] = [];
}
if (!isset($this->x["srchRes"][$set])) {
$this->x["srchRes"][$set] = [];
}
if ($rows->isNotEmpty()) {
foreach ($rows as $row) {
if (isset($row->{ $idFld }) && !in_array($row->{ $idFld }, $this->x["srchResIDs"])) {
$this->x["srchResIDs"][] = $row->{ $idFld };
$this->x["srchRes"][$set][] = $row;
}
}
}
return true;
}
public function loadStates()
{
if (!$this->states) {
$hasCanada = (isset($this->sysOpts['has-canada'])
&& intVal($this->sysOpts['has-canada']) == 1);
$this->states = new Geographs($hasCanada);
$this->states->loadStates();
}
return true;
}
public function getState($abbr = '')
{
$this->loadStates();
return $this->states->getState($abbr);
}
public function getZipProperty($zip = '', $fld = 'City')
{
$this->loadStates();
return $this->states->getZipProperty($zip, $fld);
}
public function getCityCounty($city = '', $state = '')
{
$this->loadStates();
return $this->states->getCityCounty($city, $state);
}
public function embedMapSimpAddy($nID = 0, $addy = '', $label = '', $height = 450)
{
$this->loadStates();
return $this->states->embedMapSimpAddy($nID, $addy, $label, $height);
}
public function embedMapSimpRowAddy($nID, $row, $abbr, $label = '', $height = 450)
{
$this->loadStates();
return $this->states->embedMapSimpAddy($nID, $this->printRowAddyNoPO($row, $abbr), $label, $height);
}
public function printRowAddy($row, $abbr, $twoLines = false)
{
$ret = '';
if ($row) {
foreach (['Address', 'Address2', 'AddressCity', 'AddressState', 'AddressZip'] as $i => $fld) {
if (isset($row->{ $abbr . $fld }) && trim($row->{ $abbr . $fld }) != '') {
$ret .= (($twoLines && $fld == 'AddressCity') ? '<br />' : '') . trim($row->{ $abbr . $fld })
. ((in_array($fld, ['Address', 'Address2', 'AddressCity'])) ? ', ' : ' ');
}
}
}
return $ret;
}
public function printRowAddyNoPO($row, $abbr)
{
if (isset($row->{ $abbr . 'Address' })) {
$addy1 = str_replace(' ', '', str_replace('.', '', strtolower($row->{ $abbr . 'Address' })));
if (strpos($addy1, 'pobox') !== false && isset($row->{ $abbr . 'AddressCity' })
&& isset($row->{ $abbr . 'AddressState' })) {
return $row->{ $abbr . 'AddressCity' } . ', ' . $row->{ $abbr . 'AddressState' };
}
}
return $this->printRowAddy($row, $abbr);
}
public function mapsURL($addy)
{
return 'https://www.google.com/maps/search/' . urlencode($addy) . '/';
}
public function rowAddyMapsURL($row, $abbr)
{
return $this->mapsURL($this->printRowAddy($row, $abbr));
}
public function setCurrPage($currPage = '')
{
$this->x["currPage"] = $currPage;
return true;
}
public function setTreeSessID($sessID = 0, $treeID = 0)
{
session()->put('sessID' . $treeID, $sessID);
return true;
}
public function createNewSess($treeID = 0)
{
$sess = new SLSess;
$sess->SessUserID = ((Auth::user() && isset(Auth::user()->id)) ? Auth::user()->id : 0);
$sess->SessTree = $treeID;
$sess->SessIsMobile = $this->isMobile();
$sess->SessBrowser = $this->getCroppedBrowser();
$sess->SessIP = $this->hashIP();
$sess->SessIsActive = 1;
$sess->save();
$this->setTreeSessID($sess->SessID, $treeID);
return $sess;
}
public function getCroppedBrowser()
{
$browser = ((isset($_SERVER['HTTP_USER_AGENT'])) ? $_SERVER['HTTP_USER_AGENT'] : '');
if (strlen($browser) > 254) {
$browser = substr($browser, 0, 254);
}
return $browser;
}
public function logSiteSessPage()
{
$sess = null;
if (session()->has('sessID0') && intVal(session()->get('sessID0')) > 0) {
$sess = SLSessSite::find(intVal(session()->get('sessID0')));
} elseif (Auth::user() && isset(Auth::user()->id)) {
$sess = SLSessSite::where('SiteSessUserID', Auth::user()->id)
->orderBy('created_at', 'desc')
->first();
} else {
$sess = SLSessSite::where('SiteSessIPaddy', $this->hashIP())
->orderBy('created_at', 'desc')
->first();
}
if (!$sess || !isset($sess->SiteSessID)) {
$sess = new SLSessSite;
$sess->SiteSessUserID = ((Auth::user() && isset(Auth::user()->id)) ? Auth::user()->id : 0);
$sess->SiteSessIsMobile = $this->isMobile();
$sess->SiteSessBrowser = $this->getCroppedBrowser();
$sess->SiteSessIPaddy = $this->hashIP();
$sess->save();
$this->setTreeSessID($sess->SiteSessID);
}
$page = new SLSessPage;
$page->SessPageSessID = $sess->SiteSessID;
$page->SessPageURL = ((isset($_SERVER["REQUEST_URI"])) ? $_SERVER["REQUEST_URI"] : '');
if (strlen($page->SessPageURL) > 255) {
$page->SessPageURL = substr($page->SessPageURL, 0, 255);
}
$page->save();
return true;
}
}