Changeset 11070 for extensions/Comments_Access_Manager/include
- Timestamp:
- May 26, 2011, 10:41:39 PM (13 years ago)
- Location:
- extensions/Comments_Access_Manager/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Comments_Access_Manager/include/functions.inc.php
r11069 r11070 44 44 $conf_CM = unserialize($conf['CommentsManager']); 45 45 46 // Does not allow empty author name on comments for all 47 if (isset($conf_CM[1]) and $conf_CM[1] == 'true' and $comm['author'] == 'guest' and $conf['comments_forall']) 48 { 49 $comment_action = 'reject'; 50 51 array_push($infos, l10n('CM_Empty Author')); 46 if ($conf['comments_forall']) 47 { 48 // Does not allow empty author name on comments for all 49 if ((isset($conf_CM[1]) and $conf_CM[1] == 'true') and $comm['author'] == 'guest') 50 { 51 $comment_action = 'reject'; 52 53 array_push($infos, l10n('CM_Empty Author')); 54 } 55 elseif ((isset($conf_CM[6]) and $conf_CM[6] == 'true') and $comm['author'] != 'guest') 56 { 57 if (CM_CheckValidGroup($comm['author']) or is_admin()) 58 { 59 $comment_action = 'validate'; // Comment is validated if author is not in the validated group 60 } 61 else 62 { 63 $comment_action = 'moderate'; // Comment needs moderation if author is not in the validated group 64 } 65 } 52 66 } 53 67 … … 148 162 $conf_CM = unserialize($conf['CommentsManager']); 149 163 150 if (isset($conf_CM[5]) and $conf_CM[5] <> -1) 151 { 152 $query = ' 164 if ($conf['comments_forall']) 165 { 166 if (isset($conf_CM[7]) and $conf_CM[7] <> -1) 167 { 168 $group_id = $conf_CM[7]; 169 } 170 } 171 else 172 { 173 if (isset($conf_CM[5]) and $conf_CM[5] <> -1) 174 { 175 $group_id = $conf_CM[5]; 176 } 177 } 178 179 $query = ' 153 180 SELECT u.id, 154 181 u.username, … … 159 186 ON u.id = ug.user_id 160 187 WHERE u.username LIKE "'.$author.'" 161 AND ug.group_id = '.$ conf_CM[5].'188 AND ug.group_id = '.$group_id.' 162 189 ;'; 163 190 164 $count = pwg_db_num_rows(pwg_query($query)); 165 166 if (is_null($count) or $count == 0) 167 { 168 return false; 169 } 170 else 171 return true; 172 } 191 $count = pwg_db_num_rows(pwg_query($query)); 192 193 if (is_null($count) or $count == 0) 194 { 195 return false; 196 } 197 else 198 return true; 173 199 } 174 200 -
extensions/Comments_Access_Manager/include/upgradedb.inc.php
r11069 r11070 101 101 conf_update_param('CommentsManager', pwg_db_real_escape_string($update_conf)); 102 102 } 103 104 105 /* upgrade from 2.2.1 to 2.2.2 */ 106 /* *************************** */ 107 function upgradeCM_221_222() 108 { 109 global $conf; 110 111 // Upgrading options 112 $query = ' 113 SELECT value 114 FROM '.CONFIG_TABLE.' 115 WHERE param = "CommentsManager" 116 ;'; 117 118 $result = pwg_query($query); 119 $conf_CM = pwg_db_fetch_assoc($result); 120 121 $Newconf_CM = unserialize($conf_CM['value']); 122 123 $Newconf_CM[6] = 'false'; 124 $Newconf_CM[7] = '-1'; 125 126 $update_conf = serialize($Newconf_CM); 127 128 conf_update_param('CommentsManager', pwg_db_real_escape_string($update_conf)); 129 } 103 130 ?>
Note: See TracChangeset
for help on using the changeset viewer.