Issues (9)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/Template.php (9 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
/**
3
 * Created by PhpStorm.
4
 * User: egorov
5
 * Date: 08.04.2015
6
 * Time: 13:22
7
 */
8
namespace samsoncms\template;
9
10
use samson\core\CompressableExternalModule;
11
use samsonphp\event\Event;
12
13
/**
14
 * Base SamsonCMS template controller
15
 * @package samsoncms\template
16
 */
17
class Template extends CompressableExternalModule
0 ignored issues
show
Deprecated Code introduced by
The class samson\core\CompressableExternalModule has been deprecated with message: Just implement samsonframework\core\CompressInterface

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
18
{
19
    /** Event when main page rendering has started */
20
    const E_MAIN_STARTED = 'template.main.started';
21
22
    /** Event when main page rendering has finished */
23
    const E_MAIN_RENDERED= 'template.main.rendered';
24
25
    /** Event when #template-menu rendering has started */
26
    const E_MENU_STARTED = 'template.menu.started';
27
28
    /** Event when #template-menu rendering has finished */
29
    const E_MENU_RENDERED = 'template.menu.rendered';
30
31
    /** Event when #e404 rendering has started */
32
    const E_E404_STARTED = 'template.e404.started';
33
34
    /** Event when #e404 rendering has finished */
35
    const E_E404_RENDERED = 'template.e404.rendered';
36
37
38
    /** @var bool Flag to show SamsonCMS logo in menu */
39
    public $menuLogo = 'www/menu/img/logo_w.png';
40
41
42
    /** @var string Module identifier */
43
    protected $id = 'template';
44
45
    /** Subscribed to e404 */
46
    //p0ublic function init(array $params = array())
47
    //{
48
    //    Event::subscribe('core.e404', array($this, '__e404'));
49
    //}
50
51
    /**
52
     * Universal controller action, this is SamsonCMS main page
53
     * rendering.
54
     */
55
    public function __handler()
56
    {
57
        // HTML main #template-container
58
        $html = '';
59
60
        Event::fire('template.main.started', array(&$html));
61
        Event::fire('template.main.rendered', array(&$html));
62
63
        // Prepare view
64
        $this->view('container')
65
            ->title(t('Главная', true))
0 ignored issues
show
Deprecated Code introduced by
The function t() has been deprecated with message: Should be used as $this->system->getContainer()->geti18n()->translate()|plural()

This function has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.

Loading history...
66
            ->set($html, 'template-container');
67
    }
68
69
    /** #template-menu rendering controller action */
70
    public function __menu()
71
    {
72
        // HTML main #template-menu
73
        $html = '';
74
        $submenu = '';
75
76
        $html .= $this->view('menu/item')
77
                ->set('home', 'icon')
78
                ->set(t('Главная', true), 'name')
0 ignored issues
show
Deprecated Code introduced by
The function t() has been deprecated with message: Should be used as $this->system->getContainer()->geti18n()->translate()|plural()

This function has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.

Loading history...
79
                ->set('homeLink', 'class')
80
                ->set(url()->module == '' ? 'active' : '', 'active')
81
                ->output();
82
83
        $html .= $this->view('menu/item')
84
            ->set('globe', 'icon')
85
            ->set('../', 'id')
86
            ->set(t('На сайт', true), 'name')
0 ignored issues
show
Deprecated Code introduced by
The function t() has been deprecated with message: Should be used as $this->system->getContainer()->geti18n()->translate()|plural()

This function has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.

Loading history...
87
            ->set('_blank', 'target')
88
            ->output();
89
90
        Event::fire('template.menu.started', array(&$html, &$submenu));
91
92
        $html .= $this->view('menu/item')
93
            ->set('sign-out', 'icon')
94
            ->set('sign-out', 'class')
95
            ->set('signin/logout', 'id')
96
            ->set(t('Выход', true), 'name')
0 ignored issues
show
Deprecated Code introduced by
The function t() has been deprecated with message: Should be used as $this->system->getContainer()->geti18n()->translate()|plural()

This function has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.

Loading history...
97
            ->output();
98
99
        Event::fire('template.menu.rendered', array(&$html, &$submenu));
100
101
        // Prepare view
102
        $this->view('menu/index')
103
            // TODO: Remove samson\core\Core dependency
104
            ->set(url()->module, 'module')
105
            ->set($this->menuLogo, 'logo')
106
107
            ->set($html, 'template-menu')
108
            ->set($submenu, 'submenu');
109
    }
110
111
    /** E404 controller action */
112
    function __e404()
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Comprehensibility Best Practice introduced by
It is recommend to declare an explicit visibility for __e404.

Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed.

If you are not sure which visibility to choose, it is a good idea to start with the most restrictive visibility, and then raise visibility as needed, i.e. start with private, and only raise it to protected if a sub-class needs to have access, or public if an external class needs access.

Loading history...
113
    {
114
        // HTML main #template-container
115
        $html = '';
116
117
        $this->system->active($this);
118
119
        Event::fire('template.e404.started', array(&$html));
120
        Event::fire('template.e404.rendered', array(&$html));
121
122
        // Render template e404 into local module
123
        m('local')->html(
0 ignored issues
show
Deprecated Code introduced by
The function m() has been deprecated with message: Use $this->system->module() in module context

This function has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.

Loading history...
124
            $this->view('e404')
125
            ->set($html, 'template-container')
126
            ->output()
127
        )->title(t('Страница не найдена', true));
0 ignored issues
show
Deprecated Code introduced by
The function t() has been deprecated with message: Should be used as $this->system->getContainer()->geti18n()->translate()|plural()

This function has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.

Loading history...
128
129
        header("HTTP/1.0 404 Not Found");
130
    }
131
}
132