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/Configuration.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
/**
4
 * This is the model class for table "configuration".
5
 *
6
 * The followings are the available columns in table 'configuration':
7
 * @property string $key
8
 * @property string $value
9
 * @property string $created
10
 * @property string $updated
11
 */
12
class Configuration 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...
13
{
14
	/**
15
	 * Returns the static model of the specified AR class.
16
	 * @param string $className active record class name.
17
	 * @return Configuration the static model class
18
	 */
19
	public static function model($className=__CLASS__)
20
	{
21
		return parent::model($className);
22
	}
23
24
	/**
25
	 * @return string the associated database table name
26
	 */
27
	public function tableName()
28
	{
29
		return 'configuration';
30
	}
31
32
	/**
33
	 * @return array validation rules for model attributes.
34
	 */
35
	public function rules()
36
	{
37
		// NOTE: you should only define rules for those attributes that
38
		// will receive user inputs.
39
		return array(
40
			array('key, value', 'required'),
41
			array('key', 'length', 'max'=>64),
42
			// The following rule is used by search().
43
			array('key, value, created, updated', 'safe', 'on'=>'search'),
44
		);
45
	}
46
47
	/**
48
	 * @return array relational rules.
49
	 */
50
	public function relations()
51
	{
52
		// NOTE: you may need to adjust the relation name and the related
53
		// class name for the relations automatically generated below.
54
		return array();
55
	}
56
57
	/**
58
	 * @return array customized attribute labels (name=>label)
59
	 */
60
	public function attributeLabels()
61
	{
62
		return array(
63
			'key'     => Yii::t('ciims.models.Configuration', 'Key'),
64
			'value'   => Yii::t('ciims.models.Configuration', 'Value'),
65
			'created' => Yii::t('ciims.models.Configuration', 'Created'),
66
			'updated' => Yii::t('ciims.models.Configuration', 'Updated'),
67
		);
68
	}
69
70
	/**
71
	 * Retrieves a list of models based on the current search/filter conditions.
72
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
73
	 */
74
	public function search()
75
	{
76
		$criteria=new CDbCriteria;
77
78
		$criteria->compare('t.key',$this->key,true);
79
		$criteria->compare('value',$this->value,true);
80
		$criteria->compare('created',$this->created,true);
81
		$criteria->compare('updated',$this->updated,true);
82
		$criteria->order = "created DESC";
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal created DESC 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...
83
84
		return new CActiveDataProvider($this, array(
85
			'criteria'=>$criteria,
86
		));
87
	}
88
89
	/**
90
	 * Generates a unique id
91
	 * @return string
92
	 */
93
	public function generateUniqueId()
94
	{
95
		$rnd_id = crypt(uniqid(mt_rand(),1));
96
		$rnd_id = strip_tags(stripslashes($rnd_id));
97
		$rnd_id = str_replace(".","",$rnd_id);
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal . 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...
Coding Style Comprehensibility introduced by
The string literal 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...
98
		$rnd_id = strrev(str_replace("/","",$rnd_id));
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal / 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...
Coding Style Comprehensibility introduced by
The string literal 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...
99
		$rnd_id = str_replace("$", '', substr($rnd_id,0,20));
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal $ 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...
100
101
		return $rnd_id;
102
	}
103
104
	/**
105
	 * This will do a full recursive deletion of a card from bothe the filesystem and from
106
	 * @param  string $name The folder name in runtiome
107
	 * @return boolean      If the recursive delete was successful or not
108
	 */
109
	public function fullDelete($name, $type='card')
110
	{
111
		if ($type == 'card')
112
			$path = Yii::getPathOfAlias('application.runtime.cards.' . $name);
113
		else
114
			$path = $name;
115
116
		try
117
		{
118
			// Delete the directory path
119
			CiiFileDeleter::removeDirectory($path);
120
121
			// Delete the cache
122
			Yii::app()->cache->delete('dashboard_cards_available');
123
			Yii::app()->cache->delete('cards_in_category');
124
125
			// Delete the record
126
			return $this->delete();
127
		}
128
		catch (Exception $e) {
129
			return false;
130
		}
131
	}
132
}
133