@@ -14,11 +14,11 @@ public function init()
14
14
15
15
public function browseAction ()
16
16
{
17
- if (!$ this ->_hasParam ('sort_field ' )) {
17
+ if (!$ this ->_hasParam ('sort_field ' )) {
18
18
$ this ->_setParam ('sort_field ' , 'added ' );
19
19
}
20
20
21
- if (!$ this ->_hasParam ('sort_dir ' )) {
21
+ if (!$ this ->_hasParam ('sort_dir ' )) {
22
22
$ this ->_setParam ('sort_dir ' , 'd ' );
23
23
}
24
24
parent ::browseAction ();
@@ -27,11 +27,11 @@ public function browseAction()
27
27
public function batchDeleteAction ()
28
28
{
29
29
$ ids = $ _POST ['ids ' ];
30
- foreach ($ ids as $ id ) {
30
+ foreach ($ ids as $ id ) {
31
31
$ record = $ this ->_helper ->db ->findById ($ id );
32
32
$ record ->delete ();
33
33
}
34
- $ response = array ('status ' => 'ok ' );
34
+ $ response = array ('status ' => 'ok ' );
35
35
$ this ->_helper ->json ($ response );
36
36
}
37
37
@@ -41,19 +41,19 @@ public function addAction()
41
41
$ module = isset ($ _POST ['module ' ]) ? Inflector::camelize ($ _POST ['module ' ]) : '' ;
42
42
$ destArray = array (
43
43
'module ' => $ module ,
44
- 'controller ' => strtolower (Inflector::pluralize ($ _POST ['record_type ' ])),
44
+ 'controller ' => strtolower (Inflector::pluralize ($ _POST ['record_type ' ])),
45
45
'action ' => 'show ' ,
46
46
'id ' => $ _POST ['record_id ' ]
47
47
);
48
48
49
49
$ comment = new Comment ();
50
- if ($ user = current_user ()) {
50
+ if ($ user = current_user ()) {
51
51
$ comment ->user_id = $ user ->id ;
52
52
}
53
53
$ comment ->flagged = 0 ;
54
54
$ form = $ this ->_getForm ();
55
55
$ valid = $ form ->isValid ($ this ->getRequest ()->getPost ());
56
- if (!$ valid ) {
56
+ if (!$ valid ) {
57
57
$ destination .= "#comment-form " ;
58
58
$ commentSession = new Zend_Session_Namespace ('commenting ' );
59
59
$ commentSession ->post = serialize ($ _POST );
@@ -67,7 +67,7 @@ public function addAction()
67
67
$ reqAppPublicComment = (bool ) get_option ('commenting_require_public_moderation ' );
68
68
$ requiresApproval = $ requiresApproval || (!is_object (current_user ()) && $ reqAppPublicComment );
69
69
//end Daniel Lind contribution
70
- if ($ requiresApproval ) {
70
+ if ($ requiresApproval ) {
71
71
$ this ->_helper ->flashMessenger (__ ("Your comment is awaiting moderation " ), 'success ' );
72
72
}
73
73
@@ -91,11 +91,11 @@ public function updateSpamAction()
91
91
$ table = $ this ->_helper ->db ->getTable ();
92
92
$ wordPressAPIKey = get_option ('commenting_wpapi_key ' );
93
93
$ ak = new Zend_Service_Akismet ($ wordPressAPIKey , WEB_ROOT );
94
- $ response = array ('errors ' => array ());
95
- foreach ($ commentIds as $ commentId ) {
94
+ $ response = array ('errors ' => array ());
95
+ foreach ($ commentIds as $ commentId ) {
96
96
$ comment = $ table ->find ($ commentId );
97
97
$ data = $ comment ->getAkismetData ();
98
- if ($ spam ) {
98
+ if ($ spam ) {
99
99
$ submitMethod = 'submitSpam ' ;
100
100
} else {
101
101
$ submitMethod = 'submitHam ' ;
@@ -108,7 +108,7 @@ public function updateSpamAction()
108
108
$ response ['status ' ] = 'ok ' ;
109
109
} catch (Exception $ e ){
110
110
$ response ['status ' ] = 'fail ' ;
111
- $ response ['errors ' ][] = array ('id ' => $ comment ->id );
111
+ $ response ['errors ' ][] = array ('id ' => $ comment ->id );
112
112
$ response ['message ' ] = $ e ->getMessage ();
113
113
_log ($ e );
114
114
}
@@ -122,32 +122,32 @@ public function updateApprovedAction()
122
122
$ commentIds = $ _POST ['ids ' ];
123
123
$ status = $ _POST ['approved ' ];
124
124
$ table = $ this ->_helper ->db ->getTable ();
125
- if (! $ commentIds ) {
125
+ if (! $ commentIds ) {
126
126
return ;
127
127
}
128
- foreach ($ commentIds as $ commentId ) {
128
+ foreach ($ commentIds as $ commentId ) {
129
129
$ comment = $ table ->find ($ commentId );
130
130
$ comment ->approved = $ status ;
131
131
//if approved, it isn't spam
132
- if ( ( $ status == 1 ) && ($ comment ->is_spam == 1 ) ) {
132
+ if (( $ status == 1 ) && ($ comment ->is_spam == 1 )) {
133
133
$ comment ->is_spam = 0 ;
134
134
$ ak = new Zend_Service_Akismet ($ wordPressAPIKey , WEB_ROOT );
135
135
$ data = $ comment ->getAkismetData ();
136
136
try {
137
137
$ ak ->submitHam ($ data );
138
- $ response = array ('status ' => 'ok ' );
138
+ $ response = array ('status ' => 'ok ' );
139
139
$ comment ->save ();
140
140
} catch (Exception $ e ) {
141
141
_log ($ e ->getMessage ());
142
- $ response = array ('status ' => 'fail ' , 'message ' => $ e ->getMessage ());
142
+ $ response = array ('status ' => 'fail ' , 'message ' => $ e ->getMessage ());
143
143
}
144
144
145
145
} else {
146
146
try {
147
147
$ comment ->save ();
148
- $ response = array ('status ' => 'ok ' );
148
+ $ response = array ('status ' => 'ok ' );
149
149
} catch (Exception $ e ) {
150
- $ response = array ('status ' => 'fail ' , 'message ' => $ e ->getMessage ());
150
+ $ response = array ('status ' => 'fail ' , 'message ' => $ e ->getMessage ());
151
151
_log ($ e ->getMessage ());
152
152
}
153
153
}
@@ -162,21 +162,21 @@ public function updateFlaggedAction()
162
162
$ commentIds = $ _POST ['ids ' ];
163
163
$ flagged = $ _POST ['flagged ' ];
164
164
165
- if ($ commentIds ) {
166
- foreach ($ commentIds as $ id ) {
165
+ if ($ commentIds ) {
166
+ foreach ($ commentIds as $ id ) {
167
167
$ comment = $ this ->_helper ->db ->getTable ('Comment ' )->find ($ id );
168
168
$ comment ->flagged = $ flagged ;
169
169
$ comment ->save ();
170
170
}
171
171
} else {
172
- $ response = array ('status ' => 'empty ' , 'message ' => 'No Comments Found ' );
172
+ $ response = array ('status ' => 'empty ' , 'message ' => 'No Comments Found ' );
173
173
}
174
- if ($ flagged ) {
174
+ if ($ flagged ) {
175
175
$ action = 'flagged ' ;
176
176
} else {
177
177
$ action = 'unflagged ' ;
178
178
}
179
- $ response = array ('status ' => 'ok ' , 'action ' => $ action , 'ids ' => $ commentIds );
179
+ $ response = array ('status ' => 'ok ' , 'action ' => $ action , 'ids ' => $ commentIds );
180
180
$ this ->_helper ->json ($ response );
181
181
}
182
182
@@ -187,7 +187,7 @@ public function flagAction()
187
187
$ comment ->flagged = true ;
188
188
$ comment ->save ();
189
189
$ this ->emailFlagged ($ comment );
190
- $ response = array ('status ' => 'ok ' , 'id ' => $ commentId , 'action ' => 'flagged ' );
190
+ $ response = array ('status ' => 'ok ' , 'id ' => $ commentId , 'action ' => 'flagged ' );
191
191
$ this ->_helper ->json ($ response );
192
192
}
193
193
@@ -197,7 +197,7 @@ public function unflagAction()
197
197
$ comment = $ this ->_helper ->db ->getTable ('Comment ' )->find ($ commentId );
198
198
$ comment ->flagged = 0 ;
199
199
$ comment ->save ();
200
- $ response = array ('status ' => 'ok ' , 'id ' => $ commentId , 'action ' => 'unflagged ' );
200
+ $ response = array ('status ' => 'ok ' , 'id ' => $ commentId , 'action ' => 'unflagged ' );
201
201
$ this ->_helper ->json ($ response );
202
202
}
203
203
0 commit comments