Changeset 11070 for extensions/Comments_Access_Manager
- Timestamp:
- May 26, 2011, 10:41:39 PM (13 years ago)
- Location:
- extensions/Comments_Access_Manager
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Comments_Access_Manager/admin.php
r11069 r11070 33 33 // ************************************************************************* 34 34 35 if (isset($_POST['submit']) and isset($_POST['CM_No_Comment_Anonymous']) and isset($_POST['CM_GroupComm']) and isset($_POST['CM_GroupValid ']))35 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'])) 36 36 { 37 37 … … 41 41 $_POST['CM_GroupComm'], 42 42 (isset($_POST['CM_AllowComm_Group'])?$_POST['CM_AllowComm_Group']:''), 43 $_POST['CM_GroupValid'], 44 (isset($_POST['CM_ValidComm_Group'])?$_POST['CM_ValidComm_Group']:''), 43 $_POST['CM_GroupValid1'], 44 (isset($_POST['CM_ValidComm_Group1'])?$_POST['CM_ValidComm_Group1']:''), 45 $_POST['CM_GroupValid2'], 46 (isset($_POST['CM_ValidComm_Group2'])?$_POST['CM_ValidComm_Group2']:''), 45 47 ); 46 48 … … 58 60 $groups[-1] = '---------'; 59 61 $AllowComm = -1; 60 $ValidComm = -1; 62 $ValidComm1 = -1; 63 $ValidComm2 = -1; 61 64 62 65 //Check groups list in database … … 82 85 if (isset($conf_CM[5]) and $conf_CM[5] == $row['id']) 83 86 { 84 $ValidComm = $row['id']; 87 $ValidComm1 = $row['id']; 88 } 89 90 //configuration value for users group allowed to post comments 91 if (isset($conf_CM[7]) and $conf_CM[7] == $row['id']) 92 { 93 $ValidComm2 = $row['id']; 85 94 } 86 95 } … … 96 105 //Template initialization for validated group for comments 97 106 $template->assign( 98 'ValidComm_Group ',107 'ValidComm_Group1', 99 108 array( 100 109 'group_options'=> $groups, 101 'group_selected' => $ValidComm 110 'group_selected' => $ValidComm1 111 ) 112 ); 113 //Template initialization for validated group for comments 114 $template->assign( 115 'ValidComm_Group2', 116 array( 117 'group_options'=> $groups, 118 'group_selected' => $ValidComm2 102 119 ) 103 120 ); … … 111 128 array( 112 129 'CM_PATH' => CM_PATH, 130 'CM_CFA' => $conf['comments_forall'], 113 131 'CM_VERSION' => $conf_CM[0], 114 132 'CM_NO_COMMENT_ANO_TRUE' => $conf_CM[1]=='true' ? 'checked="checked"' : '' , … … 117 135 'CM_GROUPCOMM_FALSE' => $conf_CM[2]=='false' ? 'checked="checked"' : '' , 118 136 'CM_ALLOWCOMM_GROUP' => $conf_CM[3], 119 'CM_GROUPVALID_TRUE' => $conf_CM[4]=='true' ? 'checked="checked"' : '' , 120 'CM_GROUPVALID_FALSE' => $conf_CM[4]=='false' ? 'checked="checked"' : '' , 121 'CM_VALIDCOMM_GROUP' => $conf_CM[5], 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], 122 143 ) 123 144 ); -
extensions/Comments_Access_Manager/changelog.txt
r11069 r11070 6 6 7 7 -- 2011-05-26 8 2.2.1 - Add new feature : Users in a specified group can post comments without admin validation when "Comments for all" is enabled and admin validation is enabled. 8 2.2.1 - Add new feature : Users in a specified group can post comments without admin validation when "Comments for all" is disabled and admin validation is enabled. 9 10 -- 2011-05-26 11 2.2.2 - Add new feature : Users in a specified group can post comments without admin validation when "Comments for all" is enabled and admin validation is enabled. -
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 ?> -
extensions/Comments_Access_Manager/language/en_UK/help/plugin.lang.php
r11069 r11070 7 7 By default, when <b>"comments for all"</b> option is disabled, only registered users can post comments. With this option, you can restrict this behavior by specifying a user group. Thus, only registered users and members of this group may post comments.'; 8 8 9 9 10 // --------- Starting below: New or revised $lang ---- from version 2.2.1 10 11 $lang['CM_ValidCommTitle'] = 'Allow comments without validation by an administrator'; 11 $lang['CM_ValidCommTitle_d'] = 'This option lets you specify a group of users whose comments will be provided without validation by the administrator when the gallery is configured to not allow comments to all and that the validation of comments by an administrator is required. 12 // --------- End: New or revised $lang ---- from version 2.2.1 13 14 15 // --------- Starting below: New or revised $lang ---- from version 2.2.2 16 $lang['CM_ValidCommTitle_d'] = 'This option lets you specify a group of users whose comments will be provided without validation by the administrator when the gallery is configured to <u>not allow comments to all</u> and that the validation of comments by an administrator is required. 12 17 <br><br> 13 By default, when <b>"comments all"</b> are off and the validation of comments is enabled, the comments of all registered users are subject to validation by an administrator before being visible on the gallery. With this option, you can allow members of a group of your choice to post comments without such prior approval is required.'; 14 // --------- End: New or revised $lang ---- from version 2.2.1 18 By default, when <b>"comments all"</b> is disabled and the validation of comments is enabled, the comments of all registered users are subject to validation by an administrator before being visible on the gallery. With this option, you can allow members of a group of your choice to post comments without such prior approval is required.'; 19 $lang['CM_ValidComm2Title'] = 'Allow comments without validation by an administrator'; 20 $lang['CM_ValidComm2Title_d'] = 'This option lets you specify a group of users whose comments will be provided without validation by the administrator when the gallery is configured to <u>allow comments to all</u> and that the validation of comments by an administrator is required. 21 <br><br> 22 By default, when <b>"comments all"</b> and the validation of comments are enabled, the comments of all registered users are subject to validation by an administrator before being visible on the gallery. With this option, you can allow members of a group of your choice to post comments without such prior approval is required.'; 23 // --------- End: New or revised $lang ---- from version 2.2.2 15 24 ?> -
extensions/Comments_Access_Manager/language/en_UK/plugin.lang.php
r11069 r11070 19 19 $lang['CM_Validation_For_Group'] = 'Allow comments without validation by an administrator'; 20 20 $lang['CM_ValidComm_Group'] = 'Select the group of users allowed to post comments without validation:'; 21 $lang['CM_CommentsForAll'] = '"Comments for all" option <b style="color:red;">enabled</b>';22 $lang['CM_CommentsForRegistered'] = '"Comments for all" option <b style="color:red;">disabled</b>';23 21 // --------- End: New or revised $lang ---- from version 2.2.1 22 23 // --------- Starting below: New or revised $lang ---- from version 2.2.2 24 $lang['CM_CommentsForAll'] = '"Comments for all" option is <b style="color:red;">enabled</b>'; 25 $lang['CM_CommentsForRegistered'] = '"Comments for all" option is <b style="color:red;">disabled</b>'; 26 // --------- End: New or revised $lang ---- from version 2.2.2 24 27 ?> -
extensions/Comments_Access_Manager/language/fr_FR/help/plugin.lang.php
r11069 r11070 6 6 Par défaut, lorsque les <b>"commentaires pour tous"</b> sont désactivés, seuls les utilisateurs inscrits peuvent poster des commentaires. Avec cette option, vous pouvez restreindre d\'avantage ce fonctionnement en précisant un groupe d\'utilisateurs. Ainsi, seuls les utilisateurs inscrits et faisant partie de ce groupe pourront poster des commentaires.'; 7 7 8 8 9 // --------- Starting below: New or revised $lang ---- from version 2.2.1 9 10 $lang['CM_commentTitle'] = 'Pseudo obligatoire pour les non-inscrits.'; 10 11 $lang['CM_ValidCommTitle'] = 'Autoriser les commentaires sans validation par un administrateur'; 11 $lang['CM_ValidCommTitle_d'] = 'Cette option permet de spécifier un groupe d\'utilisateurs dont les commentaires seront dispensés de validation par l\'administrateur lorsque la galerie est configurée pour ne pas autoriser les commentaires pour tous et que la validation des commentaires par un administrateur est requise. 12 // --------- End: New or revised $lang ---- from version 2.2.1 13 14 15 // --------- Starting below: New or revised $lang ---- from version 2.2.2 16 $lang['CM_ValidCommTitle_d'] = 'Cette option permet de spécifier un groupe d\'utilisateurs dont les commentaires seront dispensés de validation par l\'administrateur lorsque la galerie est configurée pour <u>ne pas autoriser</u> les commentaires pour tous et que la validation des commentaires par un administrateur est requise. 12 17 <br><br> 13 18 Par défaut, lorsque les <b>"commentaires pour tous"</b> sont désactivés et que la validation des commentaires est activée, les commentaires de tous les utilisateurs inscrits sont soumis à validation par un administrateur avant d\'être visibles sur la galerie. Avec cette option, vous pouvez autoriser les membres d\'un groupe de votre choix à poster des commentaires sans que cette validation préalable ne soit nécessaire.'; 14 // --------- End: New or revised $lang ---- from version 2.2.1 19 $lang['CM_ValidComm2Title'] = 'Autoriser les commentaires sans validation par un administrateur'; 20 $lang['CM_ValidComm2Title_d'] = 'Cette option permet de spécifier un groupe d\'utilisateurs dont les commentaires seront dispensés de validation par l\'administrateur lorsque la galerie est configurée <u>pour autoriser</u> les commentaires pour tous et que la validation des commentaires par un administrateur est requise. 21 <br><br> 22 Par défaut, lorsque les <b>"commentaires pour tous"</b> et la validation des commentaires sont activés, les commentaires de tous les utilisateurs inscrits sont soumis à validation par un administrateur avant d\'être visibles sur la galerie. Avec cette option, vous pouvez autoriser les membres d\'un groupe de votre choix à poster des commentaires sans que cette validation préalable ne soit nécessaire.'; 23 // --------- End: New or revised $lang ---- from version 2.2.2 15 24 ?> -
extensions/Comments_Access_Manager/language/fr_FR/plugin.lang.php
r11069 r11070 20 20 $lang['CM_Validation_For_Group'] = 'Autoriser les commentaires sans validation par un administrateur'; 21 21 $lang['CM_ValidComm_Group'] = 'Sélectionnez le groupe d\'utilisateurs autorisé à poster des commentaires sans validation :'; 22 $lang['CM_CommentsForAll'] = 'Option "Commentaires pour tous" <b style="color:red;">activé</b>';23 $lang['CM_CommentsForRegistered'] = 'Option "Commentaires pour tous" <b style="color:red;">désactivé</b>';24 22 // --------- End: New or revised $lang ---- from version 2.2.1 23 24 25 // --------- Starting below: New or revised $lang ---- from version 2.2.2 26 $lang['CM_CommentsForAll'] = 'L\'option "Commentaires pour tous" est <b style="color:red;">activée</b>'; 27 $lang['CM_CommentsForRegistered'] = 'L\'option "Commentaires pour tous" est <b style="color:red;">désactivée</b>'; 28 // --------- End: New or revised $lang ---- from version 2.2.2 25 29 ?> -
extensions/Comments_Access_Manager/main.inc.php
r11069 r11070 2 2 /* 3 3 Plugin Name: Comments Access Manager 4 Version: 2.2. 14 Version: 2.2.2 5 5 Description: Gérer l'accès aux commentaites - Manage comments access 6 6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid= -
extensions/Comments_Access_Manager/maintain.inc.php
r11069 r11070 56 56 upgradeCM_220_221(); 57 57 } 58 59 // upgrade from 2.2.1 to 2.2.2 60 if (version_compare($conf_CM[0], '2.2.2') < 0) 61 { 62 upgradeCM_221_222(); 63 } 58 64 } 59 65 -
extensions/Comments_Access_Manager/template/admin.tpl
r11069 r11070 26 26 27 27 <fieldset> 28 <fieldset> 29 <div class="FieldTitle"> 30 {'CM_CommentsForAll'|@translate} 28 29 {if !$CM_CFA} 30 <div class="cm_hide"> 31 {/if} 32 <fieldset> 33 <div class="FieldTitle"> 34 {'CM_CommentsForAll'|@translate} 35 </div> 36 37 <br> 38 39 <ul> 40 <li> 41 <label class="cluetip" title="{'CM_commentTitle'|translate}|{'CM_commentTitle_d'|translate}"> 42 {'CM_No_Anonymous_Comments'|@translate} 43 </label> 44 45 <br><br> 46 47 <input type="radio" value="false" {$CM_NO_COMMENT_ANO_FALSE} name="CM_No_Comment_Anonymous"> 48 {'CM_Disable'|@translate} 49 50 <br> 51 52 <input type="radio" value="true" {$CM_NO_COMMENT_ANO_TRUE} name="CM_No_Comment_Anonymous"> 53 {'CM_Enable'|@translate} 54 55 <br><br> 56 57 </li> 58 59 <li> 60 <label class="cluetip" title="{'CM_ValidComm2Title'|translate}|{'CM_ValidComm2Title_d'|translate}"> 61 {'CM_Validation_For_Group'|@translate} 62 </label> 63 64 <br><br> 65 66 <input type="radio" value="false" {$CM_GROUPVALID2_FALSE} name="CM_GroupValid2"> 67 {'CM_Disable'|@translate} 68 69 <br> 70 71 <input type="radio" value="true" {$CM_GROUPVALID2_TRUE} name="CM_GroupValid2"> 72 {'CM_Enable'|@translate} 73 74 <br><br> 75 76 <ul> 77 <li> 78 <label> 79 {'CM_ValidComm_Group'|@translate} 80 </label> 81 82 <br><br> 83 84 {html_options name="CM_ValidComm_Group2" options=$ValidComm_Group2.group_options selected=$ValidComm_Group2.group_selected} 85 </li> 86 </ul> 87 88 <br><br> 89 90 </li> 91 </ul> 92 </fieldset> 93 {if !$CM_CFA} 31 94 </div> 32 <br>33 <ul> 34 <li>35 <label class="cluetip" title="{'CM_commentTitle'|translate}|{'CM_commentTitle_d'|translate}">36 {'CM_No_Anonymous_Comments'|@translate}37 </label>38 <br><br>39 <input type="radio" value="false" {$CM_NO_COMMENT_ANO_FALSE} name="CM_No_Comment_Anonymous">40 {'CM_Disable'|@translate}95 {/if} 96 97 {if $CM_CFA} 98 <div class="cm_hide"> 99 {/if} 100 <fieldset> 101 <div class="FieldTitle"> 102 {'CM_CommentsForRegistered'|@translate} 103 </div> 41 104 <br> 42 <input type="radio" value="true" {$CM_NO_COMMENT_ANO_TRUE} name="CM_No_Comment_Anonymous"> 43 {'CM_Enable'|@translate} 44 <br><br> 45 </li> 46 </ul> 47 </fieldset> 48 49 <fieldset> 50 <div class="FieldTitle"> 51 {'CM_CommentsForRegistered'|@translate} 105 <ul> 106 <li> 107 <label class="cluetip" title="{'CM_GroupCommTitle'|translate}|{'CM_GroupCommTitle_d'|translate}"> 108 {'CM_Comments_For_Group'|@translate} 109 </label> 110 111 <br><br> 112 113 <input type="radio" value="false" {$CM_GROUPCOMM_FALSE} name="CM_GroupComm"> 114 {'CM_Disable'|@translate} 115 116 <br> 117 118 <input type="radio" value="true" {$CM_GROUPCOMM_TRUE} name="CM_GroupComm"> 119 {'CM_Enable'|@translate} 120 121 <br><br> 122 123 <ul> 124 <li> 125 <label> 126 {'CM_AllowedComm_Group'|@translate} 127 </label> 128 129 <br><br> 130 131 {html_options name="CM_AllowComm_Group" options=$AllowComm_Group.group_options selected=$AllowComm_Group.group_selected} 132 </li> 133 </ul> 134 135 <br><br> 136 137 </li> 138 139 <li> 140 <label class="cluetip" title="{'CM_ValidCommTitle'|translate}|{'CM_ValidCommTitle_d'|translate}"> 141 {'CM_Validation_For_Group'|@translate} 142 </label> 143 144 <br><br> 145 146 <input type="radio" value="false" {$CM_GROUPVALID1_FALSE} name="CM_GroupValid1"> 147 {'CM_Disable'|@translate} 148 149 <br> 150 151 <input type="radio" value="true" {$CM_GROUPVALID1_TRUE} name="CM_GroupValid1"> 152 {'CM_Enable'|@translate} 153 154 <br><br> 155 156 <ul> 157 <li> 158 <label> 159 {'CM_ValidComm_Group'|@translate} 160 </label> 161 162 <br><br> 163 164 {html_options name="CM_ValidComm_Group1" options=$ValidComm_Group1.group_options selected=$ValidComm_Group1.group_selected} 165 </li> 166 </ul> 167 168 <br><br> 169 170 </li> 171 </ul> 172 </fieldset> 173 {if $CM_CFA} 52 174 </div> 53 <br> 54 <ul> 55 <li> 56 <label class="cluetip" title="{'CM_GroupCommTitle'|translate}|{'CM_GroupCommTitle_d'|translate}"> 57 {'CM_Comments_For_Group'|@translate} 58 </label> 59 <br><br> 60 <input type="radio" value="false" {$CM_GROUPCOMM_FALSE} name="CM_GroupComm"> 61 {'CM_Disable'|@translate} 62 <br> 63 <input type="radio" value="true" {$CM_GROUPCOMM_TRUE} name="CM_GroupComm"> 64 {'CM_Enable'|@translate} 65 <br><br> 66 67 <ul> 68 <li> 69 <label> 70 {'CM_AllowedComm_Group'|@translate} 71 </label> 72 <br><br> 73 {html_options name="CM_AllowComm_Group" options=$AllowComm_Group.group_options selected=$AllowComm_Group.group_selected} 74 </li> 75 </ul> 76 <br><br> 77 </li> 78 79 <li> 80 <label class="cluetip" title="{'CM_ValidCommTitle'|translate}|{'CM_ValidCommTitle_d'|translate}"> 81 {'CM_Validation_For_Group'|@translate} 82 </label> 83 <br><br> 84 <input type="radio" value="false" {$CM_GROUPVALID_FALSE} name="CM_GroupValid"> 85 {'CM_Disable'|@translate} 86 <br> 87 <input type="radio" value="true" {$CM_GROUPVALID_TRUE} name="CM_GroupValid"> 88 {'CM_Enable'|@translate} 89 <br><br> 90 91 <ul> 92 <li> 93 <label> 94 {'CM_ValidComm_Group'|@translate} 95 </label> 96 <br><br> 97 {html_options name="CM_ValidComm_Group" options=$ValidComm_Group.group_options selected=$ValidComm_Group.group_selected} 98 </li> 99 </ul> 100 <br><br> 101 </li> 102 </ul> 103 </fieldset> 175 {/if} 104 176 </fieldset> 105 177 -
extensions/Comments_Access_Manager/template/cm.css
r11069 r11070 12 12 font-weight:bolder; 13 13 } 14 15 div.cm_hide 16 { 17 display: none; 18 }
Note: See TracChangeset
for help on using the changeset viewer.