Changeset 21117 for extensions/Comments_Access_Manager
- Timestamp:
- Mar 3, 2013, 5:42:11 PM (12 years ago)
- Location:
- extensions/Comments_Access_Manager
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Comments_Access_Manager/admin.php
r20253 r21117 34 34 if (isset($_POST['submit']) and isset($_POST['CM_No_Comment_Anonymous']) and isset($_POST['CM_GroupComm']) and isset($_POST['CM_GroupValid1']) and isset($_POST['CM_GroupValid2'])) 35 35 { 36 37 $newconf_CM = array( 38 $version, 39 $_POST['CM_No_Comment_Anonymous'], 40 $_POST['CM_GroupComm'], 41 (isset($_POST['CM_AllowComm_Group'])?$_POST['CM_AllowComm_Group']:''), 42 $_POST['CM_GroupValid1'], 43 (isset($_POST['CM_ValidComm_Group1'])?$_POST['CM_ValidComm_Group1']:''), 44 $_POST['CM_GroupValid2'], 45 (isset($_POST['CM_ValidComm_Group2'])?$_POST['CM_ValidComm_Group2']:''), 46 ); 36 $newconf_CM['CMVersion'] = $version; 37 $newconf_CM['CM_No_Comment_Anonymous'] = (isset($_POST['CM_No_Comment_Anonymous']) ? $_POST['CM_No_Comment_Anonymous'] : 'false'); 38 $newconf_CM['CM_GROUPCOMM'] = (isset($_POST['CM_GroupComm']) ? $_POST['CM_GroupComm'] : 'false'); 39 $newconf_CM['CM_ALLOWCOMM_GROUP'] = (isset($_POST['CM_AllowComm_Group']) ? $_POST['CM_AllowComm_Group'] : ''); 40 $newconf_CM['CM_GROUPVALID1'] = (isset($_POST['CM_GroupValid1']) ? $_POST['CM_GroupValid1'] : 'false'); 41 $newconf_CM['CM_VALIDCOMM1_GROUP'] = (isset($_POST['CM_ValidComm_Group1']) ? $_POST['CM_ValidComm_Group1'] : ''); 42 $newconf_CM['CM_GROUPVALID2'] = (isset($_POST['CM_GroupValid2']) ? $_POST['CM_GroupValid2'] : 'false'); 43 $newconf_CM['CM_VALIDCOMM2_GROUP'] = (isset($_POST['CM_ValidComm_Group2']) ? $_POST['CM_ValidComm_Group2'] : ''); 47 44 48 45 $conf['CommentsManager'] = serialize($newconf_CM); … … 76 73 77 74 //configuration value for users group allowed to post comments 78 if (isset($conf_CM[ 3]) and $conf_CM[3] == $row['id'])75 if (isset($conf_CM['CM_ALLOWCOMM_GROUP']) and $conf_CM['CM_ALLOWCOMM_GROUP'] == $row['id']) 79 76 { 80 77 $AllowComm = $row['id']; … … 82 79 83 80 //configuration value for users group allowed to post comments 84 if (isset($conf_CM[ 5]) and $conf_CM[5] == $row['id'])81 if (isset($conf_CM['CM_VALIDCOMM1_GROUP']) and $conf_CM['CM_VALIDCOMM1_GROUP'] == $row['id']) 85 82 { 86 83 $ValidComm1 = $row['id']; … … 88 85 89 86 //configuration value for users group allowed to post comments 90 if (isset($conf_CM[ 7]) and $conf_CM[7] == $row['id'])87 if (isset($conf_CM['CM_VALIDCOMM2_GROUP']) and $conf_CM['CM_VALIDCOMM2_GROUP'] == $row['id']) 91 88 { 92 89 $ValidComm2 = $row['id']; … … 129 126 'CM_CFA' => $conf['comments_forall'], 130 127 'CM_VALIDATION' => $conf['comments_validation'], 131 'CM_VERSION' => $conf_CM[ 0],132 'CM_NO_COMMENT_ANO_TRUE' => $conf_CM[ 1]=='true' ? 'checked="checked"' : '' ,133 'CM_NO_COMMENT_ANO_FALSE' => $conf_CM[ 1]=='false' ? 'checked="checked"' : '' ,134 'CM_GROUPCOMM_TRUE' => $conf_CM[ 2]=='true' ? 'checked="checked"' : '' ,135 'CM_GROUPCOMM_FALSE' => $conf_CM[ 2]=='false' ? 'checked="checked"' : '' ,136 'CM_ALLOWCOMM_GROUP' => $conf_CM[ 3],137 'CM_GROUPVALID1_TRUE' => $conf_CM[ 4]=='true' ? 'checked="checked"' : '' ,138 'CM_GROUPVALID1_FALSE' => $conf_CM[ 4]=='false' ? 'checked="checked"' : '' ,139 'CM_VALIDCOMM1_GROUP' => $conf_CM[ 5],140 'CM_GROUPVALID2_TRUE' => $conf_CM[ 6]=='true' ? 'checked="checked"' : '' ,141 'CM_GROUPVALID2_FALSE' => $conf_CM[ 6]=='false' ? 'checked="checked"' : '' ,142 'CM_VALIDCOMM2_GROUP' => $conf_CM[ 7],128 'CM_VERSION' => $conf_CM['CMVersion'], 129 'CM_NO_COMMENT_ANO_TRUE' => $conf_CM['CM_No_Comment_Anonymous']=='true' ? 'checked="checked"' : '' , 130 'CM_NO_COMMENT_ANO_FALSE' => $conf_CM['CM_No_Comment_Anonymous']=='false' ? 'checked="checked"' : '' , 131 'CM_GROUPCOMM_TRUE' => $conf_CM['CM_GROUPCOMM']=='true' ? 'checked="checked"' : '' , 132 'CM_GROUPCOMM_FALSE' => $conf_CM['CM_GROUPCOMM']=='false' ? 'checked="checked"' : '' , 133 'CM_ALLOWCOMM_GROUP' => $conf_CM['CM_ALLOWCOMM_GROUP'], 134 'CM_GROUPVALID1_TRUE' => $conf_CM['CM_GROUPVALID1']=='true' ? 'checked="checked"' : '' , 135 'CM_GROUPVALID1_FALSE' => $conf_CM['CM_GROUPVALID1']=='false' ? 'checked="checked"' : '' , 136 'CM_VALIDCOMM1_GROUP' => $conf_CM['CM_VALIDCOMM1_GROUP'], 137 'CM_GROUPVALID2_TRUE' => $conf_CM['CM_GROUPVALID2']=='true' ? 'checked="checked"' : '' , 138 'CM_GROUPVALID2_FALSE' => $conf_CM['CM_GROUPVALID2']=='false' ? 'checked="checked"' : '' , 139 'CM_VALIDCOMM2_GROUP' => $conf_CM['CM_VALIDCOMM2_GROUP'], 143 140 ) 144 141 ); -
extensions/Comments_Access_Manager/changelog.txt
r20253 r21117 85 85 Correction and improvement of the Translation Repository en_UK 86 86 Add zh_CN, thanks to : dennisyan 87 88 2013-03-03: 89 2.5.0 - Compliance with Piwigo 2.5 90 Code refactory : Change config variables to assoc array and $_POST vars control before writing conf in database - Thx to flop25 for his advices ;-) 91 Update zh_CN, thanks to : winson and dennisyan 92 Add pt_BR, thanks to : flaviove -
extensions/Comments_Access_Manager/include/functions.inc.php
r14634 r21117 46 46 { 47 47 // Does not allow empty author name on comments for all 48 if ((isset($conf_CM[ 1]) and $conf_CM[1] == 'true') and $comm['author'] == 'guest')48 if ((isset($conf_CM['CM_No_Comment_Anonymous']) and $conf_CM['CM_No_Comment_Anonymous'] == 'true') and $comm['author'] == 'guest') 49 49 { 50 50 $comment_action = 'reject'; … … 52 52 } 53 53 54 if ((isset($conf_CM[ 6]) and $conf_CM[6] == 'true') and !is_a_guest() and $conf['comments_validation'])54 if ((isset($conf_CM['CM_GROUPVALID2']) and $conf_CM['CM_GROUPVALID2'] == 'true') and !is_a_guest() and $conf['comments_validation']) 55 55 { 56 56 if (CM_CheckValidGroup($comm['author']) or is_admin()) … … 68 68 if (!$conf['comments_forall'] and !is_admin()) 69 69 { 70 if ((isset($conf_CM[ 2]) and $conf_CM[2] == 'true') and (isset($conf_CM[4]) and $conf_CM[4] == 'false') and !CM_CheckAuthor($comm['author'])) // Comments authorized group set - Auto validation group unset70 if ((isset($conf_CM['CM_GROUPCOMM']) and $conf_CM['CM_GROUPCOMM'] == 'true') and (isset($conf_CM['CM_GROUPVALID1']) and $conf_CM['CM_GROUPVALID1'] == 'false') and !CM_CheckAuthor($comm['author'])) // Comments authorized group set - Auto validation group unset 71 71 { 72 72 $comment_action = 'reject'; // Comment rejected if author is not in the allowed group 73 73 array_push($page['errors'], l10n('CM_Not_Allowed_Author')); 74 74 } 75 elseif ((isset($conf_CM[ 2]) and $conf_CM[2] == 'false') and (isset($conf_CM[4]) and $conf_CM[4] == 'true') and $conf['comments_validation']) // Comments authorized group unset - Auto validation group set75 elseif ((isset($conf_CM['CM_GROUPCOMM']) and $conf_CM['CM_GROUPCOMM'] == 'false') and (isset($conf_CM['CM_GROUPVALID1']) and $conf_CM['CM_GROUPVALID1'] == 'true') and $conf['comments_validation']) // Comments authorized group unset - Auto validation group set 76 76 { 77 77 if (CM_CheckValidGroup($comm['author']) and $conf['comments_validation']) … … 84 84 } 85 85 } 86 elseif ((isset($conf_CM[ 2]) and $conf_CM[2] == 'true') and (isset($conf_CM[4]) and $conf_CM[4] == 'true') and $conf['comments_validation']) // Comments authorized group set - Auto validation group set86 elseif ((isset($conf_CM['CM_GROUPCOMM']) and $conf_CM['CM_GROUPCOMM'] == 'true') and (isset($conf_CM['CM_GROUPVALID1']) and $conf_CM['CM_GROUPVALID1'] == 'true') and $conf['comments_validation']) // Comments authorized group set - Auto validation group set 87 87 { 88 88 if (!CM_CheckAuthor($comm['author'])) … … 119 119 $conf_CM = unserialize($conf['CommentsManager']); 120 120 121 if (isset($conf_CM[ 3]) and $conf_CM[3] <> -1)121 if (isset($conf_CM['CM_ALLOWCOMM_GROUP']) and $conf_CM['CM_ALLOWCOMM_GROUP'] <> -1) 122 122 { 123 123 $query = ' … … 130 130 ON u.id = ug.user_id 131 131 WHERE u.username LIKE "'.$author.'" 132 AND ug.group_id = '.$conf_CM[ 3].'132 AND ug.group_id = '.$conf_CM['CM_ALLOWCOMM_GROUP'].' 133 133 ;'; 134 134 … … 163 163 if ($conf['comments_forall']) 164 164 { 165 if (isset($conf_CM[ 7]) and $conf_CM[7] <> -1)166 { 167 $group_id = $conf_CM[ 7];165 if (isset($conf_CM['CM_VALIDCOMM2_GROUP']) and $conf_CM['CM_VALIDCOMM2_GROUP'] <> -1) 166 { 167 $group_id = $conf_CM['CM_VALIDCOMM2_GROUP']; 168 168 } 169 169 } 170 170 else 171 171 { 172 if (isset($conf_CM[ 5]) and $conf_CM[5] <> -1)173 { 174 $group_id = $conf_CM[ 5];172 if (isset($conf_CM['CM_VALIDCOMM1_GROUP']) and $conf_CM['CM_VALIDCOMM1_GROUP'] <> -1) 173 { 174 $group_id = $conf_CM['CM_VALIDCOMM1_GROUP']; 175 175 } 176 176 } -
extensions/Comments_Access_Manager/include/upgradedb.inc.php
r11070 r21117 45 45 $Newconf_CM = unserialize($conf_CM['value']); 46 46 47 $Newconf_CM[ 0] = $version;47 $Newconf_CM[CMVersion] = $version; 48 48 49 49 $update_conf = serialize($Newconf_CM); … … 128 128 conf_update_param('CommentsManager', pwg_db_real_escape_string($update_conf)); 129 129 } 130 131 132 /* upgrade from 2.4 to 2.5 */ 133 /* *********************** */ 134 function upgradeCM_240_250() 135 { 136 global $conf; 137 138 // Upgrading options - Changing config variables to assoc array 139 // ------------------------------------------------------------ 140 141 // Upgrade $conf_CM options 142 $conf_CM = unserialize($conf['CommentsManager']); 143 144 $Newconf_CM = array( 145 'CMVersion' => $conf_CM[0], 146 'CM_No_Comment_Anonymous' => $conf_CM[1], 147 'CM_GROUPCOMM' => $conf_CM[2], 148 'CM_ALLOWCOMM_GROUP' => $conf_CM[3], 149 'CM_GROUPVALID1' => $conf_CM[4], 150 'CM_VALIDCOMM1_GROUP' => $conf_CM[5], 151 'CM_GROUPVALID2' => $conf_CM[6], 152 'CM_VALIDCOMM2_GROUP' => $conf_CM[7] 153 ); 154 155 // unset obsolete conf 156 // ------------------- 157 for ($i = 0; $i <= 7; $i++) 158 { 159 unset ($conf_CM[$i]); 160 } 161 162 $update_conf = serialize($Newconf_CM); 163 164 conf_update_param('CommentsManager', pwg_db_real_escape_string($update_conf)); 165 } 130 166 ?> -
extensions/Comments_Access_Manager/maintain.inc.php
r11208 r21117 16 16 $version = $plugin['version']; 17 17 18 $default = array($version,'false','false',-1,'false',-1,'false',-1); 18 $default = array( 19 'CMVersion' => $version, 20 'CM_No_Comment_Anonymous' => 'false', 21 'CM_GROUPCOMM' => 'false', 22 'CM_ALLOWCOMM_GROUP' => -1, 23 'CM_GROUPVALID1' => 'false', 24 'CM_VALIDCOMM1_GROUP' => -1, 25 'CM_GROUPVALID2' => 'false', 26 'CM_VALIDCOMM2_GROUP' => -1 27 ); 19 28 20 29 $query = ' … … 62 71 upgradeCM_221_222(); 63 72 } 73 74 // upgrade from 2.4 to 2.5 75 if (version_compare($conf_CM[0], '2.5.0') < 0) 76 { 77 upgradeCM_240_250(); 78 } 64 79 } 65 80
Note: See TracChangeset
for help on using the changeset viewer.