Issues (114)

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.

protected/models/Events.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
3
/**
4
 * This is the model class for table "events".
5
 *
6
 * The followings are the available columns in table 'events':
7
 * @property integer $id
8
 * @property string $event
9
 * @property string $event_data
10
 * @property string $uri
11
 * @property string $created
12
 */
13
class Events extends CiiModel
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
14
{
15
	/**
16
	 * Adds the CTimestampBehavior to this class
17
	 * @return array
18
	 */
19
	public function behaviors()
20
	{
21
		return array(
22
			'CTimestampBehavior' => array(
23
				'class' 			=> 'zii.behaviors.CTimestampBehavior',
24
				'createAttribute' 	=> 'created',
25
				'updateAttribute' 	=> 'created',
26
				'timestampExpression' => time(),
27
				'setUpdateOnCreate' => false
28
			)
29
		);
30
	}
31
32
	/**
33
	 * Query Scoping
34
	 */
35
	public function scopes()
36
	{
37
		return array(
38
			'groupByUrl' => array(
39
				'group'   => 't.uri',
40
				'select'  => 't.uri, COUNT(*) as id',
41
				'order'   => 't.id ASC',
42
				'condition' => 't.event = "_trackPageView" AND t.created >= ' . strtotime("24 hours ago")
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal 24 hours ago does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
43
			),
44
		);
45
	}
46
47
	/**
48
	 * @return string the associated database table name
49
	 */
50
	public function tableName()
51
	{
52
		return 'events';
53
	}
54
55
	/**
56
	 * @return array validation rules for model attributes.
57
	 */
58
	public function rules()
59
	{
60
		// NOTE: you should only define rules for those attributes that
61
		// will receive user inputs.
62
		return array(
63
			array('event, uri', 'required'),
64
			array('id', 'numerical', 'integerOnly'=>true),
65
			array('event, uri, ', 'length', 'max'=>255),
66
			array('event_data, created', 'safe'),
67
			array('id, content_id, page_title, event, event_data, uri,  created', 'safe', 'on'=>'search'),
68
		);
69
	}
70
71
	/**
72
	 * @return array customized attribute labels (name=>label)
73
	 */
74
	public function attributeLabels()
75
	{
76
		return array(
77
			'id' => 'ID',
78
			'event' => 'Event',
79
			'event_data' => 'Event Data',
80
			'uri' => 'URI',
81
			'content_id' => 'Content ID',
82
			'created' => 'Created',
83
		);
84
	}
85
86
	public function beforeValidate()
87
	{
88
		$this->event_data = CJSON::encode($this->event_data);
89
		return parent::beforeValidate();
90
	}
91
92
	/**
93
	 * Retrieves a list of models based on the current search/filter conditions.
94
	 *
95
	 * Typical usecase:
96
	 * - Initialize the model fields with values from filter form.
97
	 * - Execute this method to get CActiveDataProvider instance which will filter
98
	 * models according to data in model fields.
99
	 * - Pass data provider to CGridView, CListView or any similar widget.
100
	 *
101
	 * @return CActiveDataProvider the data provider that can return the models
102
	 * based on the search/filter conditions.
103
	 */
104
	public function search()
105
	{
106
		// @todo Please modify the following code to remove attributes that should not be searched.
0 ignored issues
show
Coding Style Best Practice introduced by
Comments for TODO tasks are often forgotten in the code; it might be better to use a dedicated issue tracker.
Loading history...
107
108
		$criteria=new CDbCriteria;
109
110
		$criteria->compare('id',$this->id);
111
		$criteria->compare('event',$this->event,true);
112
		$criteria->compare('event_data',$this->event_data,true);
113
		$criteria->compare('uri',$this->uri,true);
114
		$criteria->compare('content_id',$this->content_id,true);
115
		$criteria->compare('created',$this->created,true);
116
117
		return new CActiveDataProvider($this, array(
118
			'criteria'=>$criteria,
119
		));
120
	}
121
122
	/**
123
	 * Returns the static model of the specified AR class.
124
	 * Please note that you should have this exact method in all your CActiveRecord descendants!
125
	 * @param string $className active record class name.
126
	 * @return Events the static model class
127
	 */
128
	public static function model($className=__CLASS__)
129
	{
130
		return parent::model($className);
131
	}
132
}
133