These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | require_once('class.FlipPage.php'); |
||
3 | |||
4 | class FlipAdminPage extends FlipPage |
||
5 | { |
||
6 | public $user; |
||
7 | public $is_admin = false; |
||
8 | |||
9 | function __construct($title, $adminGroup='LDAPAdmins') |
||
10 | { |
||
11 | $this->user = FlipSession::getUser(); |
||
12 | $this->is_admin = $this->userIsAdmin($adminGroup); |
||
13 | parent::__construct($title); |
||
14 | $adminCSS = '/css/common/admin.min.css'; |
||
15 | if($this->minified !== 'min') |
||
16 | { |
||
17 | $adminCSS = '/css/common/admin.css'; |
||
18 | } |
||
19 | $this->addCSSByURI($adminCSS); |
||
20 | $this->addWellKnownJS(JS_METISMENU, false); |
||
21 | } |
||
22 | |||
23 | protected function userIsAdmin($adminGroup) |
||
24 | { |
||
25 | if($this->user === false || $this->user === null) |
||
26 | { |
||
27 | return false; |
||
28 | } |
||
29 | return $this->user->isInGroupNamed($adminGroup); |
||
30 | } |
||
31 | |||
32 | function addAllLinks() |
||
33 | { |
||
34 | if($this->user === false || $this->user === null) |
||
35 | { |
||
36 | $this->add_link('<i class="fa fa-sign-in"></i> Login', $this->loginUrl); |
||
0 ignored issues
–
show
|
|||
37 | } |
||
38 | else |
||
39 | { |
||
40 | $this->add_links(); |
||
41 | $this->add_link('<i class="fa fa-sign-out"></i> Logout', $this->logoutUrl); |
||
0 ignored issues
–
show
The method
FlipPage::add_link() has been deprecated with message: 1.0.0 Use addLink instead
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead. ![]() |
|||
42 | } |
||
43 | } |
||
44 | |||
45 | protected function getDropdown($link, $name) |
||
46 | { |
||
47 | $ret = '<li>'; |
||
48 | $href = $this->getHrefForDropdown($link); |
||
49 | $ret .= $this->createLink($name.' <i class="fa fa-arrow-right"></i>', $href); |
||
50 | $ret.='<ul>'; |
||
51 | $subNames = array_keys($link); |
||
52 | foreach($subNames as $subName) |
||
53 | { |
||
54 | $ret.=$this->getLinkByName($subName, $link); |
||
55 | } |
||
56 | $ret.='</ul></li>'; |
||
57 | return $ret; |
||
58 | } |
||
59 | |||
60 | function addHeader() |
||
61 | { |
||
62 | $sites = $this->getSiteLinksForHeader(); |
||
63 | $sideNav = $this->getLinksMenus(); |
||
64 | $log = '<a href="https://profiles.burningflipside.com/logout.php"><i class="fa fa-sign-out"></i></a>'; |
||
65 | if($this->user === false || $this->user === null) |
||
66 | { |
||
67 | $log = '<a href="https://profiles.burningflipside.com/login.php?return='.$this->current_url().'"><i class="fa fa-sign-in"></i></a>'; |
||
0 ignored issues
–
show
The method
WebPage::current_url() has been deprecated with message: 1.0.0 This funciton is deprectated and will be remoted. Please use currentURL() instead
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead. ![]() |
|||
68 | } |
||
69 | $this->body = '<div id="wrapper"> |
||
70 | <nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0"> |
||
71 | <div class="navbar-header"> |
||
72 | <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse"> |
||
73 | <span class="sr-only">Toggle Navigation</span> |
||
74 | <span class="icon-bar"></span> |
||
75 | <span class="icon-bar"></span> |
||
76 | <span class="icon-bar"></span> |
||
77 | </button> |
||
78 | <a class="navbar-brand" href="index.php">'.$this->title.'</a> |
||
79 | </div> |
||
80 | <ul class="nav navbar-top-links navbar-right"> |
||
81 | <a href=".."> |
||
82 | <i class="fa fa-home"></i> |
||
83 | </a> |
||
84 | '.$log.' |
||
85 | <li class="dropdown"> |
||
86 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"> |
||
87 | <i class="fa fa-link"></i> |
||
88 | <b class="caret"></b> |
||
89 | </a> |
||
90 | <ul class="dropdown-menu dropdown-sites"> |
||
91 | '.$sites.' |
||
92 | </ul> |
||
93 | </li> |
||
94 | </ul> |
||
95 | <div class="navbar-default sidebar" role="navigation"> |
||
96 | <div class="sidebar-nav navbar-collapse" style="height: 1px;"> |
||
97 | <ul class="nav" id="side-menu"> |
||
98 | '.$sideNav.' |
||
99 | </ul> |
||
100 | </div> |
||
101 | </div> |
||
102 | </nav> |
||
103 | <div id="page-wrapper" style="min-height: 538px;">'.$this->body.'</div></div>'; |
||
104 | } |
||
105 | |||
106 | const CARD_GREEN = 'panel-green'; |
||
107 | const CARD_BLUE = 'panel-primary'; |
||
108 | const CARD_YELLOW = 'panel-yellow'; |
||
109 | const CARD_RED = 'panel-red'; |
||
110 | |||
111 | function add_card($iconName, $bigText, $littleText, $link='#', $color = self::CARD_BLUE, $textColor=false) |
||
112 | { |
||
113 | if($textColor === false) |
||
114 | { |
||
115 | switch($color) |
||
116 | { |
||
117 | default: |
||
118 | $textColor=''; |
||
119 | break; |
||
120 | case self::CARD_BLUE: |
||
121 | $textColor='text-primary'; |
||
122 | break; |
||
123 | case self::CARD_GREEN: |
||
124 | $textColor='text-success'; |
||
125 | break; |
||
126 | case self::CARD_YELLOW: |
||
127 | $textColor='text-warning'; |
||
128 | break; |
||
129 | case self::CARD_RED: |
||
130 | $textColor='text-danger'; |
||
131 | break; |
||
132 | } |
||
133 | } |
||
134 | $card = '<div class="col-lg-3 col-md-6"> |
||
135 | <div class="panel '.$color.'"> |
||
136 | <div class="panel-heading"> |
||
137 | <div class="row"> |
||
138 | <div class="col-xs-3"> |
||
139 | <i class="fa '.$iconName.'" style="font-size: 5em;"></i> |
||
140 | </div> |
||
141 | <div class="col-xs-9 text-right"> |
||
142 | <div style="font-size: 40px;">'.$bigText.'</div> |
||
143 | <div>'.$littleText.'</div> |
||
144 | </div> |
||
145 | </div> |
||
146 | </div> |
||
147 | <a href="'.$link.'"> |
||
148 | <div class="panel-footer"> |
||
149 | <span class="pull-left">View Details</span> |
||
150 | <span class="pull-right fa fa-arrow-circle-right"></span> |
||
151 | <div class="clearfix"></div> |
||
152 | </div> |
||
153 | </a> |
||
154 | </div> |
||
155 | </div>'; |
||
156 | $this->body .= $card; |
||
157 | } |
||
158 | |||
159 | function printPage($header=true) |
||
160 | { |
||
161 | if($this->user === false || $this->user === null) |
||
162 | { |
||
163 | $this->body = ' |
||
164 | <div class="row"> |
||
165 | <div class="col-lg-12"> |
||
166 | <h1 class="page-header">You must <a href="'.$this->loginUrl.'?return='.$this->current_url().'">log in <span class="glyphicon glyphicon-log-in"></span></a> to access the '.$this->title.' Admin system!</h1> |
||
0 ignored issues
–
show
The method
WebPage::current_url() has been deprecated with message: 1.0.0 This funciton is deprectated and will be remoted. Please use currentURL() instead
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead. ![]() |
|||
167 | </div> |
||
168 | </div>'; |
||
169 | } |
||
170 | else if($this->is_admin === false) |
||
171 | { |
||
172 | $this->body = ' |
||
173 | <div class="row"> |
||
174 | <div class="col-lg-12"> |
||
175 | <h1 class="page-header">The current user does not have access rights to the '.$this->title.' Admin system!</h1> |
||
176 | </div> |
||
177 | </div>'; |
||
178 | } |
||
179 | parent::printPage(); |
||
180 | } |
||
181 | } |
||
182 | /* vim: set tabstop=4 shiftwidth=4 expandtab: */ |
||
183 | ?> |
||
184 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.