Completed
Branch FVSv2 (bb4b20)
by Patrick
03:23
created

class.VolunteerPage.php (3 issues)

Upgrade to new PHP Analysis Engine

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.SecurePage.php');
3
require_once('class.FlipSession.php');
4
require_once('app/VolunteerAutoload.php');
5
class VolunteerPage extends SecurePage
6
{
7
    public  $volunteerRoot;
8
9
    function __construct($title)
10
    {
11
        parent::__construct($title);
12
        $root = $_SERVER['DOCUMENT_ROOT'];
13
        $script_dir = dirname(__FILE__);
14
        $this->volunteerRoot = substr($script_dir, strlen($root));
15
        $this->addJSByURI($this->volunteerRoot.'/js/volunteer.js', false);
16
    }
17
18
    function print_page($header=true)
19
    {
20
        if($this->user === false || $this->user === null)
21
        {
22
            $this->body = '
23
<div id="content">
24
    <h1>You must <a href="https://profiles.burningflipside.com/login.php?return='.$this->current_url().'">log in <span class="fa fa-sign-in"></span></a> to access the Burning Flipside Volunteer system!</h1>
0 ignored issues
show
Deprecated Code introduced by
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.

Loading history...
25
</div>';
26
            $this->add_login_form();
27
        }
28
        parent::print_page($header);
0 ignored issues
show
The call to SecurePage::print_page() has too many arguments starting with $header.

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.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
Deprecated Code introduced by
The method WebPage::print_page() has been deprecated with message: 1.0.0 This funciton is deprectated and will be remoted. Please use printPage() 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.

Loading history...
29
    }
30
31
    function isAdmin()
32
    {
33
        if($this->user === false || $this->user === null)
34
        {
35
            return false;
36
        }
37
        return $this->user->isInGroupNamed('VolunteerAdmins');
38
    }
39
40
    function isLead()
41
    {
42
        if($this->user === false || $this->user === null)
43
        {
44
            return false;
45
        }
46
        return $this->user->isInGroupNamed('Leads');
47
    }
48
}
49
?>
50