Changeset 11069
- Timestamp:
- May 26, 2011, 7:00:46 PM (13 years ago)
- Location:
- extensions/Comments_Access_Manager
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Comments_Access_Manager/admin.php
r11017 r11069 33 33 // ************************************************************************* 34 34 35 if (isset($_POST['submit']) and isset($_POST['CM_No_Comment_Anonymous']) and isset($_POST['CM_GroupComm']) )35 if (isset($_POST['submit']) and isset($_POST['CM_No_Comment_Anonymous']) and isset($_POST['CM_GroupComm']) and isset($_POST['CM_GroupValid'])) 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 45 ); 44 46 … … 56 58 $groups[-1] = '---------'; 57 59 $AllowComm = -1; 60 $ValidComm = -1; 58 61 59 62 //Check groups list in database … … 75 78 $AllowComm = $row['id']; 76 79 } 80 81 //configuration value for users group allowed to post comments 82 if (isset($conf_CM[5]) and $conf_CM[5] == $row['id']) 83 { 84 $ValidComm = $row['id']; 85 } 77 86 } 78 87 … … 83 92 'group_options'=> $groups, 84 93 'group_selected' => $AllowComm 94 ) 95 ); 96 //Template initialization for validated group for comments 97 $template->assign( 98 'ValidComm_Group', 99 array( 100 'group_options'=> $groups, 101 'group_selected' => $ValidComm 85 102 ) 86 103 ); … … 100 117 'CM_GROUPCOMM_FALSE' => $conf_CM[2]=='false' ? 'checked="checked"' : '' , 101 118 '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], 102 122 ) 103 123 ); -
extensions/Comments_Access_Manager/changelog.txt
r11021 r11069 2 2 ** Change log ** 3 3 4 -- 2011-05-23 : 2.2.0 - Initial Release 4 -- 2011-05-23 5 2.2.0 - Initial Release 6 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. -
extensions/Comments_Access_Manager/include/functions.inc.php
r11017 r11069 52 52 } 53 53 54 55 // Do not allow comments if user is not in an allowed group 56 if (isset($conf_CM[2]) and $conf_CM[2] == 'true' and !$conf['comments_forall'] and !is_admin()) 57 { 58 if (!CM_CheckAuthor($comm['author'])) 59 { 60 $comment_action = 'reject'; 61 54 // Rules on comments NOT for all 55 if (!$conf['comments_forall'] and !is_admin()) 56 { 57 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 unset 58 { 59 $comment_action = 'reject'; // Comment rejected if author is not in the allowed group 62 60 array_push($infos, l10n('CM_Not_Allowed_Author')); 61 } 62 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 set 63 { 64 if (CM_CheckValidGroup($comm['author'])) 65 { 66 $comment_action = 'validate'; // Comment is validated if author is not in the validated group 67 } 68 else 69 { 70 $comment_action = 'moderate'; // Comment needs moderation if author is not in the validated group 71 } 72 } 73 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 set 74 { 75 if (!CM_CheckAuthor($comm['author'])) 76 { 77 $comment_action = 'reject'; // Comment rejected if author is not in the allowed group 78 array_push($infos, l10n('CM_Not_Allowed_Author')); 79 } 80 elseif (CM_CheckValidGroup($comm['author'])) 81 { 82 $comment_action = 'validate'; // Comment is validated if author is not in the validated group 83 } 84 else 85 $comment_action = 'moderate'; // Comment needs moderation if author is not in the validated group 63 86 } 64 87 } … … 110 133 111 134 /** 135 * Checks if comment's author name is in the admin's pre-validated group 136 * avoid admins to validate comments for the members of this group 137 * 138 * @author : author's name 139 * 140 * @returns : Boolean (true if user's comment doesn't need validation / false if user's comment is moderated) 141 * 142 */ 143 function CM_CheckValidGroup($author) 144 { 145 global $conf; 146 147 // Get CM configuration 148 $conf_CM = unserialize($conf['CommentsManager']); 149 150 if (isset($conf_CM[5]) and $conf_CM[5] <> -1) 151 { 152 $query = ' 153 SELECT u.id, 154 u.username, 155 ug.user_id, 156 ug.group_id 157 FROM '.USERS_TABLE.' AS u 158 INNER JOIN '.USER_GROUP_TABLE.' AS ug 159 ON u.id = ug.user_id 160 WHERE u.username LIKE "'.$author.'" 161 AND ug.group_id = '.$conf_CM[5].' 162 ;'; 163 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 } 173 } 174 175 176 /** 112 177 * Get the plugin version and name 113 178 * -
extensions/Comments_Access_Manager/include/upgradedb.inc.php
r11017 r11069 74 74 } 75 75 } 76 77 78 /* upgrade from 2.2.0 to 2.2.1 */ 79 /* *************************** */ 80 function upgradeCM_220_221() 81 { 82 global $conf; 83 84 // Upgrading options 85 $query = ' 86 SELECT value 87 FROM '.CONFIG_TABLE.' 88 WHERE param = "CommentsManager" 89 ;'; 90 91 $result = pwg_query($query); 92 $conf_CM = pwg_db_fetch_assoc($result); 93 94 $Newconf_CM = unserialize($conf_CM['value']); 95 96 $Newconf_CM[4] = 'false'; 97 $Newconf_CM[5] = '-1'; 98 99 $update_conf = serialize($Newconf_CM); 100 101 conf_update_param('CommentsManager', pwg_db_real_escape_string($update_conf)); 102 } 76 103 ?> -
extensions/Comments_Access_Manager/language/en_UK/help/plugin.lang.php
r11017 r11069 6 6 <br><br> 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 9 // --------- Starting below: New or revised $lang ---- from version 2.2.1 10 $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 <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 8 15 ?> -
extensions/Comments_Access_Manager/language/en_UK/plugin.lang.php
r11022 r11069 14 14 Also available, the project\'s bugtracker: <a href="http://piwigo.org/bugs/" onclick="window.open(this.href);return false;">http://piwigo.org/bugs/</a>'; 15 15 $lang['CM_Empty Author'] = 'Comments author nickname is mandatory !'; 16 17 18 // --------- Starting below: New or revised $lang ---- from version 2.2.1 19 $lang['CM_Validation_For_Group'] = 'Allow comments without validation by an administrator'; 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 // --------- End: New or revised $lang ---- from version 2.2.1 16 24 ?> -
extensions/Comments_Access_Manager/language/fr_FR/help/plugin.lang.php
r11017 r11069 1 1 <?php 2 $lang['CM_commentTitle'] = 'Commentaires : pseudo obligatoire pour les non-inscrits.';3 2 $lang['CM_commentTitle_d'] = 'Lorsque les visiteurs non inscrits sont autorisés à poster des commentaires (<b>"Commentaires pour tous"</b> actif), cette option oblige le visiteur non inscrit à saisir un pseudo pour que le commentaire soit accepté.'; 4 3 $lang['CM_GroupCommTitle'] = 'Autoriser les commentaires pour un groupe d\'utilisateurs'; … … 6 5 <br><br> 7 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 8 // --------- Starting below: New or revised $lang ---- from version 2.2.1 9 $lang['CM_commentTitle'] = 'Pseudo obligatoire pour les non-inscrits.'; 10 $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 <br><br> 13 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 8 15 ?> -
extensions/Comments_Access_Manager/language/fr_FR/plugin.lang.php
r11022 r11069 6 6 $lang['CM_Disable'] = ' Désactiver (valeur par défaut)'; 7 7 $lang['CM_Enable'] = ' Activer '; 8 $lang['CM_No_Anonymous_Comments'] = 'Commentaires : Pseudo obligatoire pour les non-inscrits';9 8 $lang['CM_Comments_For_Group'] = 'Autoriser les commentaires pour un groupe d\'utilisateurs'; 10 9 $lang['CM_AllowedComm_Group'] = 'Sélectionnez le groupe d\'utilisateurs autorisé à poster des commentaires :'; … … 15 14 Egalement disponible, le bugtracker du projet: <a href="http://piwigo.org/bugs/" onclick="window.open(this.href);return false;">http://piwigo.org/bugs/</a>'; 16 15 $lang['CM_Empty Author'] = 'Le nom de l\'auteur du commentaire est obligatoire !'; 16 17 18 // --------- Starting below: New or revised $lang ---- from version 2.2.1 19 $lang['CM_No_Anonymous_Comments'] = 'Pseudo obligatoire pour les non-inscrits'; 20 $lang['CM_Validation_For_Group'] = 'Autoriser les commentaires sans validation par un administrateur'; 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 // --------- End: New or revised $lang ---- from version 2.2.1 17 25 ?> -
extensions/Comments_Access_Manager/main.inc.php
r11017 r11069 2 2 /* 3 3 Plugin Name: Comments Access Manager 4 Version: 2.2. 04 Version: 2.2.1 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= … … 18 18 include_once (CM_PATH.'include/functions.inc.php'); 19 19 20 load_language('plugin.lang', CM_PATH);21 $conf_CM = unserialize($conf['CommentsManager']);22 23 24 20 // Plugin administration panel 25 21 add_event_handler('get_admin_plugin_menu_links', 'CM_admin_menu'); -
extensions/Comments_Access_Manager/maintain.inc.php
r11017 r11069 16 16 $version = $plugin['version']; 17 17 18 $default = array($version,'false','false',-1 );18 $default = array($version,'false','false',-1,'false',-1); 19 19 20 20 $query = ' … … 46 46 include_once (CM_PATH.'include/upgradedb.inc.php'); 47 47 48 // Database upgrade process 49 if (isset($conf['CommentsManager'])) 50 { 51 $conf_CM = unserialize($conf['CommentsManager']); 52 53 // upgrade from 2.2.0 to 2.2.1 54 if (version_compare($conf_CM[0], '2.2.1') < 0) 55 { 56 upgradeCM_220_221(); 57 } 58 } 59 48 60 // Update plugin version number in #_config table and check consistency of #_plugins table 49 61 CM_version_update(); 50 62 51 load_conf_from_db('param like \' UserAdvManager\\_%\'');63 load_conf_from_db('param like \'CommentsManager\''); 52 64 } 53 65 -
extensions/Comments_Access_Manager/template/admin.tpl
r11017 r11069 9 9 jQuery('.cluetip').cluetip( 10 10 {ldelim} 11 width: 5 50,11 width: 500, 12 12 splitTitle: '|' 13 13 {rdelim}); … … 26 26 27 27 <fieldset> 28 <fieldset> 29 <div class="FieldTitle"> 30 {'CM_CommentsForAll'|@translate} 31 </div> 32 <br> 28 33 <ul> 29 34 <li> … … 39 44 <br><br> 40 45 </li> 41 46 </ul> 47 </fieldset> 48 49 <fieldset> 50 <div class="FieldTitle"> 51 {'CM_CommentsForRegistered'|@translate} 52 </div> 53 <br> 54 <ul> 42 55 <li> 43 56 <label class="cluetip" title="{'CM_GroupCommTitle'|translate}|{'CM_GroupCommTitle_d'|translate}"> … … 63 76 <br><br> 64 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> 65 102 </ul> 103 </fieldset> 66 104 </fieldset> 67 105 -
extensions/Comments_Access_Manager/template/cm.css
r11017 r11069 4 4 font-weight:bold; 5 5 } 6 7 /* CM instructions */ 8 div.FieldTitle 9 { 10 text-align:center; 11 text-decoration: underline; 12 font-weight:bolder; 13 }
Note: See TracChangeset
for help on using the changeset viewer.