Completed
Push — develop ( ff0f24...b7393c )
by Patrick
09:27
created

class.ProfilesPage.php (1 issue)

Severity

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('Autoload.php');
3
class ProfilesPage extends \Flipside\Http\WebPage
4
{
5
    public $profiles_root;
6
7
    public function __construct($title)
8
    {
9
        parent::__construct($title, true);
0 ignored issues
show
The call to WebPage::__construct() has too many arguments starting with true.

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...
10
        $root = $_SERVER['DOCUMENT_ROOT'];
11
        $script_dir = dirname(__FILE__);
12
        if(strstr($script_dir, $root) === false)
13
        {
14
            $this->profiles_root = dirname($_SERVER['SCRIPT_NAME']);
15
        }
16
        else
17
        {
18
            $this->profiles_root = substr($script_dir, strlen($root));
19
        }
20
        $this->content['root'] = $this->profiles_root;
21
        $this->addTemplateDir('./templates', 'Profiles');
22
        $this->setTemplateName('@Profiles/profile-main.html');
23
    }
24
25
    public function addLinks()
26
    {
27
        if($this->user !== false && $this->user !== null)
28
        {
29
            if($this->user->isInGroupNamed('LDAPAdmins') || $this->user->isInGroupNamed('AFs'))
30
            {
31
                $this->addLink('Admin', $this->profiles_root.'/_admin/index.php');
32
            }
33
            if(($this->user->isInGroupNamed('Leads') || $this->user->isInGroupNamed('CC')) || $this->user->isInGroupNamed('AFs'))
34
            {
35
                $this->addLink('Leads', $this->profiles_root.'/lead/index.php');
36
            }
37
            $this->addLink('My Profile', $this->profiles_root.'/profile.php');
38
        }
39
    }
40
}
41
/* vim: set tabstop=4 shiftwidth=4 expandtab: */
42