/
bootstrap.php
80 lines (67 loc) · 2.26 KB
/
bootstrap.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
<?php
class UsersBootstrap extends \Dsc\Bootstrap
{
protected $dir = __DIR__;
protected $namespace = 'Users';
protected function runSite()
{
parent::runSite();
\Dsc\System::instance()->get('router')->mount(new \Users\Site\Routes\Prefixed(), $this->namespace);
}
protected function preSite()
{
parent::preSite();
if (class_exists('\Minify\Factory'))
{
\Minify\Factory::registerPath($this->dir . "/src/");
}
\Dsc\System::instance()->get('auth')->loginWithRememberMe();
static::setActive();
}
protected function preAdmin()
{
parent::preAdmin();
if (class_exists('\Search\Factory'))
{
\Search\Factory::registerSource(new \Search\Models\Source(array(
'id' => 'users',
'title' => 'Users',
'class' => '\Users\Models\Users',
'priority' => 20,
)));
}
static::setActive();
}
public static function setActive()
{
if (!\Audit::instance()->isbot())
{
if (class_exists('\Activity\Models\Actors'))
{
$actor = \Activity\Models\Actors::fetch();
if ($actor->isExcluded())
{
return;
}
}
if (\Dsc\System::instance()->get('input')->get('ping', null, 'int') != 1)
{
$fw = \Base::instance();
$path = $fw->hive()['PATH'];
switch ($path)
{
// ignore certain paths, even if they aren't specifically pings
case (strpos($path, '/minify/') === 0 ? true : false):
case "/minify/css":
case "/minify/js":
break;
default:
(new \Dsc\Mongo\Collections\Sessions)->store();
break;
}
}
}
\Dsc\Mongo\Collections\Sessions::throttledCleanup();
}
}
$app = new UsersBootstrap();