1
|
|
|
<?php |
2
|
|
|
ini_set('display_errors', 1); |
3
|
|
|
error_reporting(E_ALL); |
4
|
|
|
require_once('class.SecurePage.php'); |
5
|
|
|
require_once('class.FlipSession.php'); |
6
|
|
|
require_once('app/VolunteerAutoload.php'); |
7
|
|
|
class VolunteerPage extends SecurePage |
8
|
|
|
{ |
9
|
|
|
public $volunteerRoot; |
10
|
|
|
|
11
|
|
|
public function __construct($title) |
12
|
|
|
{ |
13
|
|
|
parent::__construct($title); |
14
|
|
|
$root = $_SERVER['DOCUMENT_ROOT']; |
15
|
|
|
$script_dir = dirname(__FILE__); |
16
|
|
|
$this->volunteerRoot = substr($script_dir, strlen($root)); |
17
|
|
|
$this->addJS($this->volunteerRoot.'/js/volunteer.js'); |
18
|
|
|
$this->addTemplateDir(dirname(__FILE__).'/templates', 'Volunteer'); |
19
|
|
|
$this->setTemplateName('@Volunteer/main.html'); |
20
|
|
|
$this->addCSS('https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.7/css/select2.min.css'); |
21
|
|
|
$this->addJS('https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.7/js/select2.min.js', false); |
|
|
|
|
22
|
|
|
if($this->isAdmin() || $this->isLead()) |
23
|
|
|
{ |
24
|
|
|
$this->addLink('Admin', '_admin/'); |
25
|
|
|
} |
26
|
|
|
if($this->user !== false && $this->user !== null) |
27
|
|
|
{ |
28
|
|
|
$this->addLink('Settings', 'settings.php'); |
29
|
|
|
} |
30
|
|
|
$this->addLink('Help <i class="fas fa-question"></i>', 'docs/help.html'); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
public function printPage() |
34
|
|
|
{ |
35
|
|
|
if($this->user === false || $this->user === null) |
36
|
|
|
{ |
37
|
|
|
$this->body = ' |
38
|
|
|
<div id="content"> |
39
|
|
|
<h1>You must <a href="https://profiles.burningflipside.com/login.php?return='.$this->currentURL().'">log in <span class="fa fa-sign-in-alt"></span></a> to access the Burning Flipside Volunteer system!</h1> |
40
|
|
|
</div>'; |
41
|
|
|
} |
42
|
|
|
parent::printPage(); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
public function isAdmin() |
46
|
|
|
{ |
47
|
|
|
if($this->user === false || $this->user === null) |
48
|
|
|
{ |
49
|
|
|
return false; |
50
|
|
|
} |
51
|
|
|
return $this->user->isInGroupNamed('VolunteerAdmins'); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function isLead() |
55
|
|
|
{ |
56
|
|
|
if($this->user === false || $this->user === null) |
57
|
|
|
{ |
58
|
|
|
return false; |
59
|
|
|
} |
60
|
|
|
if($this->user->isInGroupNamed('Leads')) |
61
|
|
|
{ |
62
|
|
|
return true; |
63
|
|
|
} |
64
|
|
|
return false; |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.