These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * @title Main Controller |
||
4 | * |
||
5 | * @author Pierre-Henry Soria <[email protected]> |
||
6 | * @copyright (c) 2012-2017, Pierre-Henry Soria. All Rights Reserved. |
||
7 | * @license GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory. |
||
8 | * @package PH7 / App / System / Module / Admin / Controller |
||
9 | * @version 1.0 |
||
10 | */ |
||
11 | namespace PH7; |
||
12 | |||
13 | use |
||
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
14 | PH7\Framework\Mvc\Model\DbConfig, |
||
15 | PH7\Framework\Layout\Html\Meta, |
||
16 | PH7\Framework\Core\Kernel, |
||
17 | PH7\Framework\Security\Version; |
||
18 | |||
19 | class MainController extends Controller |
||
20 | { |
||
21 | |||
22 | public function index() |
||
23 | { |
||
24 | // Add Validate-Site JS file if needed |
||
25 | if (ValidateSiteCore::needInject($this->session)) { |
||
26 | $this->design->addJs(PH7_LAYOUT . PH7_SYS . PH7_MOD . 'validate-site' . PH7_SH . PH7_TPL . PH7_TPL_MOD_NAME . PH7_SH . PH7_JS, 'validationbox.js'); |
||
27 | } |
||
28 | |||
29 | $this->view->page_title = t('Admin Panel'); |
||
30 | $this->view->h1_title = t('Dashboard'); |
||
31 | $this->view->h2_title = t('Hi <em>%0%</em>! Welcome back to your site!', $this->session->get('admin_first_name')); |
||
32 | $this->view->h3_title = t('How are you today?'); |
||
33 | |||
34 | $this->view->is_news_feed = (bool) DbConfig::getSetting('isSoftwareNewsFeed'); |
||
35 | |||
36 | $this->checkUpdates(); |
||
37 | |||
38 | $this->addStats(); |
||
39 | |||
40 | $this->output(); |
||
0 ignored issues
–
show
The method
output() does not seem to exist on object<PH7\MainController> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
41 | } |
||
42 | |||
43 | public function stat() |
||
44 | { |
||
45 | $this->view->page_title = t('Statistics'); |
||
46 | $this->view->h1_title = t('Site statistics'); |
||
47 | |||
48 | $this->addStats(); |
||
49 | |||
50 | $this->output(); |
||
0 ignored issues
–
show
The method
output() does not seem to exist on object<PH7\MainController> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
51 | } |
||
52 | |||
53 | public function login() |
||
54 | { |
||
55 | // Prohibit the referencing in search engines of the admin panel |
||
56 | $this->view->header = Meta::NOINDEX; |
||
57 | |||
58 | $this->view->page_title = t('Sign in to Admin Panel'); |
||
59 | $this->view->h1_title = t('Admin Panel - Login'); |
||
60 | $this->output(); |
||
0 ignored issues
–
show
The method
output() does not seem to exist on object<PH7\MainController> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
61 | } |
||
62 | |||
63 | public function logout() |
||
64 | { |
||
65 | (new Admin)->logout(); |
||
66 | } |
||
67 | |||
68 | protected function addStats() |
||
69 | { |
||
70 | // Adding the common CSS for the chart. |
||
71 | $this->design->addCss(PH7_LAYOUT . PH7_SYS . PH7_MOD . $this->registry->module . PH7_SH . PH7_TPL . PH7_TPL_MOD_NAME . PH7_SH . PH7_CSS, 'general.css'); |
||
72 | |||
73 | $oStatModel = new StatisticCoreModel; |
||
74 | |||
75 | // Get the since date of the website |
||
76 | $this->view->since_date = $this->dateTime->get(StatisticCoreModel::getDateOfCreation())->date(); |
||
77 | |||
78 | |||
79 | //---------- Number of Logins Members ----------// |
||
80 | |||
81 | // All Members |
||
82 | $this->view->today_login_members = $oStatModel->totalLogins('Members', 1); |
||
83 | $this->view->week_login_members = $oStatModel->totalLogins('Members', 7); |
||
84 | $this->view->month_login_members = $oStatModel->totalLogins('Members', 31); |
||
85 | $this->view->year_login_members = $oStatModel->totalLogins('Members', 365); |
||
86 | $this->view->login_members = $oStatModel->totalLogins(); |
||
87 | |||
88 | // Men Members |
||
89 | $this->view->today_login_male_members = $oStatModel->totalLogins('Members', 1, 'male'); |
||
90 | $this->view->week_login_male_members = $oStatModel->totalLogins('Members', 7, 'male'); |
||
91 | $this->view->month_login_male_members = $oStatModel->totalLogins('Members', 31, 'male'); |
||
92 | $this->view->year_login_male_members = $oStatModel->totalLogins('Members', 365, 'male'); |
||
93 | $this->view->login_male_members = $oStatModel->totalLogins('Members', 0, 'male'); |
||
94 | |||
95 | // Women Members |
||
96 | $this->view->today_login_female_members = $oStatModel->totalLogins('Members', 1, 'female'); |
||
97 | $this->view->week_login_female_members = $oStatModel->totalLogins('Members', 7, 'female'); |
||
98 | $this->view->month_login_female_members = $oStatModel->totalLogins('Members', 31, 'female'); |
||
99 | $this->view->year_login_female_members = $oStatModel->totalLogins('Members', 365, 'female'); |
||
100 | $this->view->login_female_members = $oStatModel->totalLogins('Members', 0, 'female'); |
||
101 | |||
102 | // Couple Members |
||
103 | $this->view->today_login_couple_members = $oStatModel->totalLogins('Members', 1, 'couple'); |
||
104 | $this->view->week_login_couple_members = $oStatModel->totalLogins('Members', 7, 'couple'); |
||
105 | $this->view->month_login_couple_members = $oStatModel->totalLogins('Members', 31, 'couple'); |
||
106 | $this->view->year_login_couple_members = $oStatModel->totalLogins('Members', 365, 'couple'); |
||
107 | $this->view->login_couple_members = $oStatModel->totalLogins('Members', 0, 'couple'); |
||
108 | |||
109 | |||
110 | //---------- Number of Logins Affiliates ----------// |
||
111 | |||
112 | // All Affiliates |
||
113 | $this->view->today_login_affiliate = $oStatModel->totalLogins('Affiliates', 1); |
||
114 | $this->view->week_login_affiliate = $oStatModel->totalLogins('Affiliates', 7); |
||
115 | $this->view->month_login_affiliate = $oStatModel->totalLogins('Affiliates', 31); |
||
116 | $this->view->year_login_affiliate = $oStatModel->totalLogins('Affiliates', 365); |
||
117 | $this->view->login_affiliate = $oStatModel->totalLogins('Affiliates'); |
||
118 | |||
119 | // Men Affiliates |
||
120 | $this->view->today_login_male_affiliate = $oStatModel->totalLogins('Affiliates', 1, 'male'); |
||
121 | $this->view->week_login_male_affiliate = $oStatModel->totalLogins('Affiliates', 7, 'male'); |
||
122 | $this->view->month_login_male_affiliate = $oStatModel->totalLogins('Affiliates', 31, 'male'); |
||
123 | $this->view->year_login_male_affiliate = $oStatModel->totalLogins('Affiliates', 365, 'male'); |
||
124 | $this->view->login_male_affiliate = $oStatModel->totalLogins('Affiliates', 0, 'male'); |
||
125 | |||
126 | // Women Affiliates |
||
127 | $this->view->today_login_female_affiliate = $oStatModel->totalLogins('Affiliates', 1, 'female'); |
||
128 | $this->view->week_login_female_affiliate = $oStatModel->totalLogins('Affiliates', 7, 'female'); |
||
129 | $this->view->month_login_female_affiliate = $oStatModel->totalLogins('Affiliates', 31, 'female'); |
||
130 | $this->view->year_login_female_affiliate = $oStatModel->totalLogins('Affiliates', 365, 'female'); |
||
131 | $this->view->login_female_affiliate = $oStatModel->totalLogins('Affiliates', 0, 'female'); |
||
132 | |||
133 | |||
134 | //---------- Number of Logins Admins ----------// |
||
135 | |||
136 | // All Admins |
||
137 | $this->view->today_login_admins = $oStatModel->totalLogins('Admins', 1); |
||
138 | $this->view->week_login_admins = $oStatModel->totalLogins('Admins', 7); |
||
139 | $this->view->month_login_admins = $oStatModel->totalLogins('Admins', 31); |
||
140 | $this->view->year_login_admins = $oStatModel->totalLogins('Admins', 365); |
||
141 | $this->view->login_admins = $oStatModel->totalLogins('Admins'); |
||
142 | |||
143 | // Men Admins |
||
144 | $this->view->today_login_male_admins = $oStatModel->totalLogins('Admins', 1, 'male'); |
||
145 | $this->view->week_login_male_admins = $oStatModel->totalLogins('Admins', 7, 'male'); |
||
146 | $this->view->month_login_male_admins = $oStatModel->totalLogins('Admins', 31, 'male'); |
||
147 | $this->view->year_login_male_admins = $oStatModel->totalLogins('Admins', 365, 'male'); |
||
148 | $this->view->login_male_admins = $oStatModel->totalLogins('Admins', 0, 'male'); |
||
149 | |||
150 | // Women Admins |
||
151 | $this->view->today_login_female_admins = $oStatModel->totalLogins('Admins', 1, 'female'); |
||
152 | $this->view->week_login_female_admins = $oStatModel->totalLogins('Admins', 7, 'female'); |
||
153 | $this->view->month_login_female_admins = $oStatModel->totalLogins('Admins', 31, 'female'); |
||
154 | $this->view->year_login_female_admins = $oStatModel->totalLogins('Admins', 365, 'female'); |
||
155 | $this->view->login_female_admins = $oStatModel->totalLogins('Admins', 0, 'female'); |
||
156 | |||
157 | |||
158 | //---------- Members Registrations ----------// |
||
159 | |||
160 | // All Members |
||
161 | $this->view->today_total_members = $oStatModel->totalMembers(1); |
||
162 | $this->view->week_total_members = $oStatModel->totalMembers(7); |
||
163 | $this->view->month_total_members = $oStatModel->totalMembers(31); |
||
164 | $this->view->year_total_members = $oStatModel->totalMembers(365); |
||
165 | $this->view->total_members = $oStatModel->totalMembers(); |
||
166 | |||
167 | // Men Members |
||
168 | $this->view->today_total_male_members = $oStatModel->totalMembers(1, 'male'); |
||
169 | $this->view->week_total_male_members = $oStatModel->totalMembers(7, 'male'); |
||
170 | $this->view->month_total_male_members = $oStatModel->totalMembers(31, 'male'); |
||
171 | $this->view->year_total_male_members = $oStatModel->totalMembers(365, 'male'); |
||
172 | $this->view->total_male_members = $oStatModel->totalMembers(0, 'male'); |
||
173 | |||
174 | // Women Members |
||
175 | $this->view->today_total_female_members = $oStatModel->totalMembers(1, 'female'); |
||
176 | $this->view->week_total_female_members = $oStatModel->totalMembers(7, 'female'); |
||
177 | $this->view->month_total_female_members = $oStatModel->totalMembers(31, 'female'); |
||
178 | $this->view->year_total_female_members = $oStatModel->totalMembers(365, 'female'); |
||
179 | $this->view->total_female_members = $oStatModel->totalMembers(0, 'female'); |
||
180 | |||
181 | // Couple Members |
||
182 | $this->view->today_total_couple_members = $oStatModel->totalMembers(1, 'couple'); |
||
183 | $this->view->week_total_couple_members = $oStatModel->totalMembers(7, 'couple'); |
||
184 | $this->view->month_total_couple_members = $oStatModel->totalMembers(31, 'couple'); |
||
185 | $this->view->year_total_couple_members = $oStatModel->totalMembers(365, 'couple'); |
||
186 | $this->view->total_couple_members = $oStatModel->totalMembers(0, 'couple'); |
||
187 | |||
188 | |||
189 | //---------- Affiliates Registrations ----------// |
||
190 | |||
191 | // All Affiliates |
||
192 | $this->view->today_total_affiliate = $oStatModel->totalAffiliates(1); |
||
193 | $this->view->week_total_affiliate = $oStatModel->totalAffiliates(7); |
||
194 | $this->view->month_total_affiliate = $oStatModel->totalAffiliates(31); |
||
195 | $this->view->year_total_affiliate = $oStatModel->totalAffiliates(365); |
||
196 | $this->view->total_affiliate = $oStatModel->totalAffiliates(); |
||
197 | |||
198 | // Men Affiliates |
||
199 | $this->view->today_total_male_affiliate = $oStatModel->totalAffiliates(1, 'male'); |
||
200 | $this->view->week_total_male_affiliate = $oStatModel->totalAffiliates(7, 'male'); |
||
201 | $this->view->month_total_male_affiliate = $oStatModel->totalAffiliates(31, 'male'); |
||
202 | $this->view->year_total_male_affiliate = $oStatModel->totalAffiliates(365, 'male'); |
||
203 | $this->view->total_male_affiliate = $oStatModel->totalAffiliates(0, 'male'); |
||
204 | |||
205 | // Women Affiliates |
||
206 | $this->view->today_total_female_affiliate = $oStatModel->totalAffiliates(1, 'female'); |
||
207 | $this->view->week_total_female_affiliate = $oStatModel->totalAffiliates(7, 'female'); |
||
208 | $this->view->month_total_female_affiliate = $oStatModel->totalAffiliates(31, 'female'); |
||
209 | $this->view->year_total_female_affiliate = $oStatModel->totalAffiliates(365, 'female'); |
||
210 | $this->view->total_female_affiliate = $oStatModel->totalAffiliates(0, 'female'); |
||
211 | |||
212 | |||
213 | //---------- Admins Registrations ----------// |
||
214 | |||
215 | // All Admins |
||
216 | $this->view->today_total_admins = $oStatModel->totalAdmins(1); |
||
217 | $this->view->week_total_admins = $oStatModel->totalAdmins(7); |
||
218 | $this->view->month_total_admins = $oStatModel->totalAdmins(31); |
||
219 | $this->view->year_total_admins = $oStatModel->totalAdmins(365); |
||
220 | $this->view->total_admins = $oStatModel->totalAdmins(); |
||
221 | |||
222 | // Men Admins |
||
223 | $this->view->today_total_male_admins = $oStatModel->totalAdmins(1, 'male'); |
||
224 | $this->view->week_total_male_admins = $oStatModel->totalAdmins(7, 'male'); |
||
225 | $this->view->month_total_male_admins = $oStatModel->totalAdmins(31, 'male'); |
||
226 | $this->view->year_total_male_admins = $oStatModel->totalAdmins(365, 'male'); |
||
227 | $this->view->total_male_admins = $oStatModel->totalAdmins(0, 'male'); |
||
228 | |||
229 | // Women Admins |
||
230 | $this->view->today_total_female_admins = $oStatModel->totalAdmins(1, 'female'); |
||
231 | $this->view->week_total_female_admins = $oStatModel->totalAdmins(7, 'female'); |
||
232 | $this->view->month_total_female_admins = $oStatModel->totalAdmins(31, 'female'); |
||
233 | $this->view->year_total_female_admins = $oStatModel->totalAdmins(365, 'female'); |
||
234 | $this->view->total_female_admins = $oStatModel->totalAdmins(0, 'female'); |
||
235 | |||
236 | |||
237 | //---------- Blogs ----------// |
||
238 | |||
239 | $this->view->today_total_blogs = $oStatModel->totalBlogs(1); |
||
240 | $this->view->week_total_blogs = $oStatModel->totalBlogs(7); |
||
241 | $this->view->month_total_blogs = $oStatModel->totalBlogs(31); |
||
242 | $this->view->year_total_blogs = $oStatModel->totalBlogs(365); |
||
243 | $this->view->total_blogs = $oStatModel->totalBlogs(); |
||
244 | |||
245 | |||
246 | //---------- Notes ----------// |
||
247 | |||
248 | $this->view->today_total_notes = $oStatModel->totalNotes(1); |
||
249 | $this->view->week_total_notes = $oStatModel->totalNotes(7); |
||
250 | $this->view->month_total_notes = $oStatModel->totalNotes(31); |
||
251 | $this->view->year_total_notes = $oStatModel->totalNotes(365); |
||
252 | $this->view->total_notes = $oStatModel->totalNotes(); |
||
253 | |||
254 | |||
255 | //---------- Messages ----------// |
||
256 | |||
257 | $this->view->today_total_mails = $oStatModel->totalMails(1); |
||
258 | $this->view->week_total_mails = $oStatModel->totalMails(7); |
||
259 | $this->view->month_total_mails = $oStatModel->totalMails(31); |
||
260 | $this->view->year_total_mails = $oStatModel->totalMails(365); |
||
261 | $this->view->total_mails = $oStatModel->totalMails(); |
||
262 | |||
263 | |||
264 | //---------- Comments ----------// |
||
265 | |||
266 | // Profile Comments |
||
267 | $this->view->today_total_profile_comments = $oStatModel->totalProfileComments(1); |
||
268 | $this->view->week_total_profile_comments = $oStatModel->totalProfileComments(7); |
||
269 | $this->view->month_total_profile_comments = $oStatModel->totalProfileComments(31); |
||
270 | $this->view->year_total_profile_comments = $oStatModel->totalProfileComments(365); |
||
271 | $this->view->total_profile_comments = $oStatModel->totalProfileComments(); |
||
272 | |||
273 | // Picture Comments |
||
274 | $this->view->today_total_picture_comments = $oStatModel->totalPictureComments(1); |
||
275 | $this->view->week_total_picture_comments = $oStatModel->totalPictureComments(7); |
||
276 | $this->view->month_total_picture_comments = $oStatModel->totalPictureComments(31); |
||
277 | $this->view->year_total_picture_comments = $oStatModel->totalPictureComments(365); |
||
278 | $this->view->total_picture_comments = $oStatModel->totalPictureComments(); |
||
279 | |||
280 | // Video Comments |
||
281 | $this->view->today_total_video_comments = $oStatModel->totalVideoComments(1); |
||
282 | $this->view->week_total_video_comments = $oStatModel->totalVideoComments(7); |
||
283 | $this->view->month_total_video_comments = $oStatModel->totalVideoComments(31); |
||
284 | $this->view->year_total_video_comments = $oStatModel->totalVideoComments(365); |
||
285 | $this->view->total_video_comments = $oStatModel->totalVideoComments(); |
||
286 | |||
287 | // Blog Comments |
||
288 | $this->view->today_total_blog_comments = $oStatModel->totalBlogComments(1); |
||
289 | $this->view->week_total_blog_comments = $oStatModel->totalBlogComments(7); |
||
290 | $this->view->month_total_blog_comments = $oStatModel->totalBlogComments(31); |
||
291 | $this->view->year_total_blog_comments = $oStatModel->totalBlogComments(365); |
||
292 | $this->view->total_blog_comments = $oStatModel->totalBlogComments(); |
||
293 | |||
294 | // Note Comments |
||
295 | $this->view->today_total_note_comments = $oStatModel->totalNoteComments(1); |
||
296 | $this->view->week_total_note_comments = $oStatModel->totalNoteComments(7); |
||
297 | $this->view->month_total_note_comments = $oStatModel->totalNoteComments(31); |
||
298 | $this->view->year_total_note_comments = $oStatModel->totalNoteComments(365); |
||
299 | $this->view->total_note_comments = $oStatModel->totalNoteComments(); |
||
300 | |||
301 | // Game Comments |
||
302 | $this->view->today_total_game_comments = $oStatModel->totalGameComments(1); |
||
303 | $this->view->week_total_game_comments = $oStatModel->totalGameComments(7); |
||
304 | $this->view->month_total_game_comments = $oStatModel->totalGameComments(31); |
||
305 | $this->view->year_total_game_comments = $oStatModel->totalGameComments(365); |
||
306 | $this->view->total_game_comments = $oStatModel->totalGameComments(); |
||
307 | |||
308 | |||
309 | unset($oStatModel); |
||
310 | } |
||
311 | |||
312 | protected function checkUpdates() |
||
313 | { |
||
314 | if (Version::isUpdateEligible()) |
||
315 | { |
||
316 | $aLatestVerInfo = Version::getLatestInfo(); |
||
317 | $sLatestVer = t('%0% build %1%', $aLatestVerInfo['version'], $aLatestVerInfo['build']); |
||
318 | |||
319 | $this->design->setMessage(t('%software_name% <strong>%0%</strong> is available! Please <a href="%1%" target="_blank">update it today</a> to keep your site safe and stable.', $sLatestVer, Kernel::SOFTWARE_LICENSE_KEY_URL)); |
||
320 | } |
||
321 | } |
||
322 | |||
323 | } |
||
324 |