Issues (1752)

Security Analysis    not enabled

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.

class/pages.php (7 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
 * @package      fwolflib
4
 * @copyright    Copyright 2004-2007, Fwolf
5
 * @author       Fwolf <[email protected]>
6
 */
7
8
/**
9
 * Generate web pages
10
 *
11
 * @package    fwolflib
12
 * @copyright  Copyright 2004-2007, Fwolf
13
 * @author     Fwolf <[email protected]>
14
 * @since      2004-4-13 22:50:52
15
 * @access     public
16
 * @version    $Id$
17
 */
18
class Pages
0 ignored issues
show
There is one abstract method GenBody in this class; you could implement it, or declare this class as abstract.
Loading history...
19
{
20
	/**
21
	 * Debug mode
22
	 * @access	protected
23
	 * @var	boolean
24
	 */
25
	protected $mDebug = false;
26
27
	/**
28
	 * Parts of html heads, this is NOT html code
29
	 * Sample value: 'meta'=>array('..', '...'), 'title'='...'
30
	 * @access	protected
31
	 * @var	array
32
	 */
33
	protected $mHead = array();
34
35
	/**
36
	 * Parts of html code before <head>, this is NOT html code
37
	 * Sample value: 'xml'=>array('..', '...'), 'doctype'=>'...'
38
	 * @access	protected
39
	 * @var	array
40
	 */
41
	protected $mHeadahead = array();
42
43
	/**
44
	 * Result html content
45
	 * $mHtml = $mHtmlHeadahead + $mHtmlHead + $mHtmlBody
46
	 * And + some <marks> between these parts.
47
	 * @access	protected
48
	 * @var	string
49
	 */
50
	protected $mHtml = '';
51
52
	/**
53
	 * Html content part of body
54
	 * Code of '<body>' part.
55
	 * @access	protected
56
	 * @var	string
57
	 */
58
	protected $mHtmlBody = '';
59
60
	/**
61
	 * Html content part of head
62
	 * Code of '<head>' part.
63
	 * @access	protected
64
	 * @var	string
65
	 */
66
	protected $mHtmlHead = '';
67
68
	/**
69
	 * Html content part of html_head
70
	 * Code ahead of '<head>', xml, doctype & html marks.
71
	 * @access	protected
72
	 * @var	string
73
	 */
74
	protected $mHtmlHeadahead = '';
75
76
	
77
    /**
78
     * 构造函数
79
     */
80
    function __construct()
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...
81
	{
82
		//开始输出缓冲区
83
		ob_start();
84
85
		//开始SESSION
86
		//调试程序的时候因为程序经常改动,所以不使用CACHE
87
		if (true == $this->mDebug)
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
88
			session_cache_limiter('private,must-revalidate');
89
		session_start();
90
    } // end of func __construct
91
92
	
93
	/**
94
	 * 显示网页正式内容
95
	 * @param	boolean	$return	Return contents instead of print out.
96
	 * @access	public
97
	 */
98
	public function Display($return=false)
99
	{
100
		if (empty($this->mHtml))
101
			$this->GenHtml();
102
		if (true == $return)
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
103
			return $this->mHtml;
104
		else{
105
			echo $this->mHtml;
106
			//结束输出缓冲区,输出内容
107
			ob_end_flush();
108
		}
109
	} // end of func Display
110
111
112
	/**
113
	 * Generate body part of html code
114
	 * @access	protected
115
	 * @return	string
116
	 */
117
	abstract protected function GenBody();
118
119
120
	/**
121
	 * Generate head part of html code
122
	 * @access	proteced
123
	 * @return	string
124
	 */
125
	protected function GenHead()
126
	{
127
		$this->mHtmlHeadahead = '';
128
		// Xml format declaration
129
		if (array_key_exists('xml', $this->mHeadahead))
130
			$this->mHtmlHeadahead .= $this->GenHeadXml() . "\n";
131
		// Doctype
132
133
	} // end of func GenHead
134
135
136
	/**
137
	 * Generate xml declaration part of head_ahead
138
	 * $this->mHeadahead['xml'] = array('version'=>'1.0', 'encoding'='utf-8')
139
	 * @access	protected
140
	 * @return	string
141
	 */
142
	protected function GenHeadXml()
143
	{
144
		if (array_key_exists('xml', $this->mHeadahead)) {
145
			$ar = $this->mHeadahead['xml'];
146
			return "<?xml version=\"{$ar['version']}\" encoding=\"{$ar['encoding']}\"?>";
147
		}
148
		else
149
			return '';
150
	} // end of func GenHeadXml
151
152
153
	/**
154
	 * Generate html code from joining several parts
155
	 * @access	protected
156
	 * @return	string
157
	 */
158
	protected function GenHtml()
159
	{
160
		$this->mHtml = '';
161
		$this->mHtml .= $this->GenHead;
0 ignored issues
show
The property GenHead does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
162
		$this->mHtml .= $this->GenBody;
0 ignored issues
show
The property GenBody does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
163
		$this->mHtml .= "</body>\n</html>";
164
		return $this->mHtml;
165
	} // end of func GenHtml
166
167
168
	/**
169
	 * Set xml part of head_ahead
170
	 * @access	public
171
	 * @param	string	$version
172
	 * @param	string	$encoding
173
	 */
174
	public function SetHeadXml($version = '1.0', $encoding='utf-8') {
175
		$this->mHeadahead['xml']['version'] = $version;
176
		$this->mHeadahead['xml']['encoding'] = $encoding;
177
	} // end of func SetHeadXml
178
179
180
} // end of class Pages
181
182
?>
0 ignored issues
show
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...