This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
0 ignored issues
–
show
|
|||
2 | |||
3 | if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
||
4 | |||
5 | if ( ! class_exists( 'WooThemes_Sensei_Email_New_Message_Reply' ) ) : |
||
6 | |||
7 | /** |
||
8 | * Teacher New Message |
||
9 | * |
||
10 | * An email sent to the a user when they receive a reply to the private message. |
||
11 | * |
||
12 | * @package Users |
||
13 | * @author Automattic |
||
14 | * |
||
15 | * @since 1.6.0 |
||
16 | */ |
||
17 | class WooThemes_Sensei_Email_New_Message_Reply { |
||
18 | |||
19 | /** |
||
20 | * @var string |
||
21 | */ |
||
22 | var $template; |
||
0 ignored issues
–
show
The visibility should be declared for property
$template .
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using class A {
var $property;
}
the property is implicitly global. To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2. ![]() |
|||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | var $subject; |
||
0 ignored issues
–
show
The visibility should be declared for property
$subject .
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using class A {
var $property;
}
the property is implicitly global. To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2. ![]() |
|||
28 | |||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | var $heading; |
||
0 ignored issues
–
show
The visibility should be declared for property
$heading .
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using class A {
var $property;
}
the property is implicitly global. To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2. ![]() |
|||
33 | |||
34 | /** |
||
35 | * @var string |
||
36 | */ |
||
37 | var $recipient; |
||
0 ignored issues
–
show
The visibility should be declared for property
$recipient .
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using class A {
var $property;
}
the property is implicitly global. To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2. ![]() |
|||
38 | |||
39 | var $original_sender; |
||
0 ignored issues
–
show
The visibility should be declared for property
$original_sender .
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using class A {
var $property;
}
the property is implicitly global. To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2. ![]() |
|||
40 | var $original_receiver; |
||
0 ignored issues
–
show
The visibility should be declared for property
$original_receiver .
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using class A {
var $property;
}
the property is implicitly global. To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2. ![]() |
|||
41 | var $commenter; |
||
0 ignored issues
–
show
The visibility should be declared for property
$commenter .
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using class A {
var $property;
}
the property is implicitly global. To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2. ![]() |
|||
42 | |||
43 | /** |
||
44 | * @var WP_Post |
||
45 | */ |
||
46 | var $message; |
||
0 ignored issues
–
show
The visibility should be declared for property
$message .
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using class A {
var $property;
}
the property is implicitly global. To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2. ![]() |
|||
47 | |||
48 | /** |
||
49 | * @var WP_Comment |
||
50 | */ |
||
51 | var $comment; |
||
0 ignored issues
–
show
The visibility should be declared for property
$comment .
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using class A {
var $property;
}
the property is implicitly global. To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2. ![]() |
|||
52 | |||
53 | /** |
||
54 | * Constructor |
||
55 | * |
||
56 | * @access public |
||
57 | */ |
||
58 | function __construct() { |
||
0 ignored issues
–
show
|
|||
59 | $this->template = 'new-message-reply'; |
||
60 | $this->subject = apply_filters( 'sensei_email_subject', sprintf( __( '[%1$s] You have a new message', 'woothemes-sensei' ), get_bloginfo( 'name' ) ), $this->template ); |
||
61 | $this->heading = apply_filters( 'sensei_email_heading', __( 'You have received a reply to your private message', 'woothemes-sensei' ), $this->template ); |
||
62 | } |
||
63 | |||
64 | /** |
||
65 | * trigger function. |
||
66 | * |
||
67 | * @param WP_Comment $comment |
||
68 | * @param string $message |
||
69 | * |
||
70 | * @return void |
||
71 | */ |
||
72 | function trigger ( $comment, $message ) { |
||
0 ignored issues
–
show
|
|||
73 | |||
74 | global $sensei_email_data; |
||
75 | |||
76 | $this->comment = $comment; |
||
77 | $this->message = $message; |
||
0 ignored issues
–
show
It seems like
$message of type string is incompatible with the declared type object<WP_Post> of property $message .
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. ![]() |
|||
78 | |||
79 | $this->commenter = get_userdata( $comment->user_id ); |
||
80 | |||
81 | $original_sender = get_post_meta( $this->message->ID, '_sender', true ); |
||
82 | $this->original_sender = get_user_by( 'login', $original_sender ); |
||
83 | |||
84 | $original_receiver = get_post_meta( $this->message->ID, '_receiver', true ); |
||
85 | $this->original_receiver = get_user_by( 'login', $original_receiver ); |
||
86 | |||
87 | $content_type = get_post_meta( $this->message->ID, '_posttype', true ); |
||
0 ignored issues
–
show
$content_type is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the ![]() |
|||
88 | $content_id = get_post_meta( $this->message->ID, '_post', true ); |
||
89 | $content_title = get_the_title( $content_id ); |
||
90 | |||
91 | $comment_link = get_comment_link( $comment ); |
||
92 | |||
93 | // setup the post type parameter |
||
94 | $content_type = get_post_type( $content_id ); |
||
95 | if( !$content_type ){ |
||
96 | $content_type =''; |
||
97 | } |
||
98 | |||
99 | // Construct data array |
||
100 | $sensei_email_data = apply_filters( 'sensei_email_data', array( |
||
101 | 'template' => $this->template, |
||
102 | $content_type.'_id' => $content_id, |
||
103 | 'heading' => $this->heading, |
||
104 | 'commenter_name' => $this->commenter->display_name, |
||
105 | 'message' => $this->comment->comment_content, |
||
106 | 'comment_link' => $comment_link, |
||
107 | 'content_title' => $content_title, |
||
108 | 'content_type' => $content_type, |
||
109 | ), $this->template ); |
||
110 | |||
111 | // Set recipient |
||
112 | if( $this->commenter->user_login == $original_sender ) { |
||
113 | $this->recipient = stripslashes( $this->original_receiver->user_email ); |
||
114 | } else { |
||
115 | $this->recipient = stripslashes( $this->original_sender->user_email ); |
||
116 | } |
||
117 | |||
118 | // Send mail |
||
119 | Sensei()->emails->send( $this->recipient, $this->subject, Sensei()->emails->get_content( $this->template ) ); |
||
120 | } |
||
121 | } |
||
122 | |||
123 | endif; |
||
124 | |||
125 | return new WooThemes_Sensei_Email_New_Message_Reply(); |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.