Changeset 5195 for trunk/include/functions_user.inc.php
- Timestamp:
- Mar 19, 2010, 11:25:39 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions_user.inc.php
r5123 r5195 1247 1247 1248 1248 /* 1249 * Return if current user can edit/delete a comment1250 * @param action edit/delete 1249 * Return if current user can edit/delete/validate a comment 1250 * @param action edit/delete/validate 1251 1251 * @return bool 1252 1252 */ 1253 1253 function can_manage_comment($action, $comment_author_id) 1254 1254 { 1255 if (!in_array($action, array('delete','edit'))) { 1255 global $user, $conf; 1256 1257 if (is_a_guest()) 1258 { 1256 1259 return false; 1257 1260 } 1258 return (is_admin() || 1259 (($GLOBALS['user']['id'] == $comment_author_id) 1260 && !is_a_guest() 1261 && $GLOBALS['conf'][sprintf('user_can_%s_comment', $action)])); 1261 1262 if (!in_array($action, array('delete','edit', 'validate'))) 1263 { 1264 return false; 1265 } 1266 1267 if (is_admin()) 1268 { 1269 return true; 1270 } 1271 1272 if ('edit' == $action and $conf['user_can_edit_comment']) 1273 { 1274 if ($comment_author_id == $user['id']) { 1275 return true; 1276 } 1277 } 1278 1279 if ('delete' == $action and $conf['user_can_delete_comment']) 1280 { 1281 if ($comment_author_id == $user['id']) { 1282 return true; 1283 } 1284 } 1285 1286 return false; 1262 1287 } 1263 1288
Note: See TracChangeset
for help on using the changeset viewer.