Changeset 6761 for extensions
- Timestamp:
- Aug 15, 2010, 3:32:31 AM (14 years ago)
- Location:
- extensions/nbc_HistoryIPExcluder/branches/2.1
- Files:
-
- 3 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/nbc_HistoryIPExcluder/branches/2.1/admin/HIPE_admin.php
r5615 r6761 37 37 pwg_query($query); 38 38 39 if (!isset($_POST['HIPE_chkb'])) $_POST['HIPE_chkb'] = '0'; 40 $newconf_HIPE = array( 41 'Blacklist' => $_POST['HIPE_chkb'], 42 'Version' => $version, 43 ); 44 45 $conf['HistoryIPConfig'] = serialize($newconf_HIPE); 46 47 $query = ' 48 UPDATE '.CONFIG_TABLE.' 49 SET value="'.addslashes($conf['HistoryIPConfig']).'" 50 WHERE param="HistoryIPConfig" 51 LIMIT 1'; 52 pwg_query($query); 53 39 54 // information message 40 55 array_push($page['infos'], l10n('HIPE_save_config')); … … 85 100 while ($subrow = pwg_db_fetch_assoc($subresult)) 86 101 { 87 $template->a ssign(102 $template->append( 88 103 'resultat', 89 104 array( … … 125 140 while ($subrow = pwg_db_fetch_assoc($subresult)) 126 141 { 127 $template->a ssign(142 $template->append( 128 143 'resultat', 129 144 array( … … 158 173 while ($subrow = pwg_db_fetch_assoc($subresult)) 159 174 { 160 $template->a ssign(175 $template->append( 161 176 'resultat', 162 177 array( … … 172 187 elseif ( isset($_POST['HIPE_MemberForIp']) and isset($_POST['HIPE_input'])) 173 188 { 174 $template->a ssign(189 $template->append( 175 190 array( 176 191 'HIPE_DESCRIPTION2' => l10n('HIPE_MemberForIp_description'), … … 205 220 206 221 $conf_HIPE = explode("," , $conf['HistoryIPExcluder']); 222 $HIPE_Config = unserialize($conf['HistoryIPConfig']); 207 223 208 224 $template->assign( … … 215 231 ); 216 232 233 if ($HIPE_Config['Blacklist'] == 1) $template->assign(array('HIPE_IPBlacklisted' => 'checked="checked"')); 234 217 235 $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/HIPE_admin.tpl'); 218 236 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); -
extensions/nbc_HistoryIPExcluder/branches/2.1/admin/HIPE_admin.tpl
r5615 r6761 15 15 <div style="text-align:center;"> 16 16 <textarea name="HIPE_IPs_Excluded" rows="10" cols="30" {$TAG_INPUT_ENABLED}>{$IPs_EXCLUDED}</textarea> 17 </div> 17 18 18 </div> 19 <fieldset> 20 <legend>{'HIPE_IPBlacklist_title'|@translate}</legend> 21 <ul> 22 <li><input type="checkbox" name="HIPE_chkb" {$HIPE_IPBlacklisted} value="1"> {'HIPE_IPBlacklisted'|@translate}</li> 23 </ul> 24 </fieldset> 19 25 20 26 <p><input type="submit" name="submit" value="{'submit'|@translate}" class="bouton" {$TAG_INPUT_ENABLED}> <input type="submit" name="CleanHist" value="{'HIPE_CleanHist'|@translate}" class="bouton" {$TAG_INPUT_ENABLED}></p> … … 44 50 <table> 45 51 <!-- BEGIN resultat --> 46 <tr> 47 <td>{$resultat.HIPE_RESULTAT1}</td> 48 <td>{$resultat.HIPE_RESULTAT2}</td> 49 <td>{$resultat.HIPE_RESULTAT3}</td> 50 <td>{$resultat.HIPE_RESULTAT4}</td> 51 <td>{$resultat.HIPE_RESULTAT5}</td> 52 {foreach from=$resultat item=result} 53 <tr style="color: red;"> 54 <td>{$result.HIPE_RESULTAT1}</td> 55 <td>{$result.HIPE_RESULTAT2}</td> 56 <td>{$result.HIPE_RESULTAT3}</td> 57 <td>{$result.HIPE_RESULTAT4}</td> 58 <td>{$result.HIPE_RESULTAT5}</td> 52 59 </tr> 60 {/foreach} 53 61 <!-- END resultat --> 54 62 </table> -
extensions/nbc_HistoryIPExcluder/branches/2.1/language/en_UK/plugin.lang.php
r5615 r6761 30 30 $lang['HIPE_version'] = ' - Version: '; 31 31 // --------- End: New or revised $lang ---- from version 2.1.0 32 33 // --------- Starting below: New or revised $lang ---- from version 2.1.1 34 $lang['HIPE_IPBlacklist_title'] = 'Registration blacklist'; 35 $lang['HIPE_IPBlacklisted'] = ' Prevent registration to the gallery of excluded IPs (blacklist)'; 36 $lang['Error_HIPE_BlacklistedIP'] = 'Error! Your IP has been banned. You can not subscribe to this gallery. Contact the administrator for further details.'; 37 // --------- End: New or revised $lang ---- from version 2.1.1 32 38 ?> -
extensions/nbc_HistoryIPExcluder/branches/2.1/language/es_ES/plugin.lang.php
r5615 r6761 31 31 $lang['HIPE_version'] = ' - Versión: '; 32 32 // --------- End: New or revised $lang ---- from version 2.1.0 33 34 // --------- Starting below: New or revised $lang ---- from version 2.1.1 35 /*TODO*/$lang['HIPE_IPBlacklist_title'] = 'Registration blacklist'; 36 /*TODO*/$lang['HIPE_IPBlacklisted'] = ' Prevent registration to the gallery of excluded IPs (blacklist)'; 37 /*TODO*/$lang['Error_HIPE_BlacklistedIP'] = 'Error! Your IP has been banned. You can not subscribe to this gallery. Contact the administrator for further details.'; 38 // --------- End: New or revised $lang ---- from version 2.1.1 33 39 ?> -
extensions/nbc_HistoryIPExcluder/branches/2.1/language/fr_FR/plugin.lang.php
r5615 r6761 30 30 $lang['HIPE_version'] = ' - Version: '; 31 31 // --------- End: New or revised $lang ---- from version 2.1.0 32 33 // --------- Starting below: New or revised $lang ---- from version 2.1.1 34 $lang['HIPE_IPBlacklist_title'] = 'Exclusion à l\'inscription'; 35 $lang['HIPE_IPBlacklisted'] = ' Empêcher l\'inscription à la galerie des IP exclues de l\'historique (Blacklistage)'; 36 $lang['Error_HIPE_BlacklistedIP'] = 'Erreur! Votre IP a été bannie. Vous ne pouvez plus vous inscrire à cette galerie. Contactez l\'administrateur pour de plus amples détails.'; 37 // --------- End: New or revised $lang ---- from version 2.1.1 32 38 ?> -
extensions/nbc_HistoryIPExcluder/branches/2.1/language/hu_HU/plugin.lang.php
r5615 r6761 30 30 $lang['HIPE_version'] = ' - Változat: '; 31 31 // --------- End: New or revised $lang ---- from version 2.1.0 32 33 // --------- Starting below: New or revised $lang ---- from version 2.1.1 34 /*TODO*/$lang['HIPE_IPBlacklist_title'] = 'Registration blacklist'; 35 /*TODO*/$lang['HIPE_IPBlacklisted'] = ' Prevent registration to the gallery of excluded IPs (blacklist)'; 36 /*TODO*/$lang['Error_HIPE_BlacklistedIP'] = 'Error! Your IP has been banned. You can not subscribe to this gallery. Contact the administrator for further details.'; 37 // --------- End: New or revised $lang ---- from version 2.1.1 32 38 ?> -
extensions/nbc_HistoryIPExcluder/branches/2.1/language/it_IT/plugin.lang.php
r5615 r6761 30 30 $lang['HIPE_version'] = ' - Versione: '; 31 31 // --------- End: New or revised $lang ---- from version 2.1.0 32 33 // --------- Starting below: New or revised $lang ---- from version 2.1.1 34 /*TODO*/$lang['HIPE_IPBlacklist_title'] = 'Registration blacklist'; 35 /*TODO*/$lang['HIPE_IPBlacklisted'] = ' Prevent registration to the gallery of excluded IPs (blacklist)'; 36 /*TODO*/$lang['Error_HIPE_BlacklistedIP'] = 'Error! Your IP has been banned. You can not subscribe to this gallery. Contact the administrator for further details.'; 37 // --------- End: New or revised $lang ---- from version 2.1.1 32 38 ?> -
extensions/nbc_HistoryIPExcluder/branches/2.1/main.inc.php
r5615 r6761 2 2 /* 3 3 Plugin Name: History IP Excluder 4 Version: 2.1. 05 Description: Permet l'exclusion d'une IP ou d'une plage d'IP de l historique - Excludes one IP or a range of IP from the history.4 Version: 2.1.1 5 Description: Permet l'exclusion d'une IP ou d'une plage d'IP de l'historique et de les blacklister à l'inscription - Base MySql seulement! / Excludes one IP or a range of IP from the history and to blacklist them on registration - MySql database only! 6 6 Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=147 7 7 Author: Nicco, Eric … … 20 20 - Removing "nbc_" prefix in plugin code and display in piwigo's plugin manager 21 21 - Displaying the good plugin name and current version in admin panel 22 23 2.1.1 - Bug 1792 fixed (Thx to TOnin) 24 - Bug 1511 fixed - New function to blacklist excluded IPs or ranged IPs for registration 22 25 23 26 -------------------------------------------------------------------------------- … … 86 89 } 87 90 } 91 92 /* Check users registration */ 93 add_event_handler('register_user_check', 'HIPE_RegistrationCheck', EVENT_HANDLER_PRIORITY_NEUTRAL +2, 2); 94 95 function HIPE_RegistrationCheck($err, $user) 96 { 97 global $errors, $conf; 98 load_language('plugin.lang', HIPE_PATH); 99 100 if (count($err)!=0 ) return $err; 101 102 $IP_Client = explode('.', $_SERVER['REMOTE_ADDR']); 103 $HIPE_Config = unserialize($conf['HistoryIPConfig']); 104 $conf_HIPE = explode("," , $conf['HistoryIPExcluder']); 105 106 if (isset($HIPE_Config['Blacklist']) and $HIPE_Config['Blacklist'] == true) 107 { 108 foreach ($conf_HIPE as $Exclusion) 109 { 110 $IP_Exclude = explode('.', $Exclusion); 111 112 if ( 113 (($IP_Client[0] == $IP_Exclude[0]) or ($IP_Exclude[0] == '%')) and 114 (!isset($IP_Exclude[1]) or ($IP_Client[1] == $IP_Exclude[1]) or ($IP_Exclude[1] == '%')) and 115 (!isset($IP_Exclude[2]) or ($IP_Client[2] == $IP_Exclude[2]) or ($IP_Exclude[2] == '%')) and 116 (!isset($IP_Exclude[3]) or ($IP_Client[3] == $IP_Exclude[3]) or ($IP_Exclude[3] == '%')) 117 ) 118 { 119 $err = l10n('Error_HIPE_BlacklistedIP'); 120 } 121 } 122 return $err; 123 } 124 } 88 125 ?> -
extensions/nbc_HistoryIPExcluder/branches/2.1/maintain.inc.php
r5615 r6761 10 10 INSERT INTO '.CONFIG_TABLE.' (param,value,comment) 11 11 VALUES ("HistoryIPExcluder","","History IP Excluder parameters"); 12 '; 13 14 pwg_query($q); 15 16 $default = array ( 17 'Blacklist' => "0", 18 'Version'=> "2.1.1", 19 ); 20 21 $q = ' 22 INSERT INTO '.CONFIG_TABLE.' (param,value,comment) 23 VALUES ("HistoryIPConfig","'.addslashes(serialize($default)).'","History IP Excluder options"); 12 24 '; 13 25 … … 31 43 if ($count == 1) 32 44 { 33 /* upgrade from branch 2.0.0 to 2.0.1 */45 /* upgrade from branch 2.0.0 to 2.0.1 */ 34 46 /* ************************************ */ 35 47 upgrade_200(); 48 } 49 50 $query = ' 51 SELECT param 52 FROM '.CONFIG_TABLE.' 53 WHERE param = "HistoryIPConfig" 54 ;'; 55 $count = pwg_db_num_rows(pwg_query($query)); 56 57 if ($count == 0) 58 { 59 /* upgrade from branch 2.1.0 to 2.1.1 */ 60 /* ************************************ */ 61 upgrade_210(); 36 62 } 37 63 } … … 42 68 global $conf; 43 69 44 if (isset($conf[' nbc_HistoryIPExcluder']))70 if (isset($conf['HistoryIPExcluder'])) 45 71 { 46 72 $q = ' 47 73 DELETE FROM '.CONFIG_TABLE.' 48 WHERE param=" nbc_HistoryIPExcluder" LIMIT 1;74 WHERE param="HistoryIPExcluder" LIMIT 1; 49 75 '; 50 76 51 77 pwg_query($q); 52 78 } 79 if (isset($conf['HistoryIPConfig'])) 80 { 81 $q = ' 82 DELETE FROM '.CONFIG_TABLE.' 83 WHERE param="HistoryIPConfig" LIMIT 1; 84 '; 85 86 pwg_query($q); 87 } 53 88 } 54 89 … … 71 106 ;'; 72 107 pwg_query($q); 108 109 upgrade_210(); 110 } 111 112 function upgrade_210() 113 { 114 global $conf; 115 116 $default = array ( 117 'Blacklist' => "0", 118 'Version'=> "2.1.1", 119 ); 120 121 $q = ' 122 INSERT INTO '.CONFIG_TABLE.' (param,value,comment) 123 VALUES ("HistoryIPConfig","'.addslashes(serialize($default)).'","History IP Excluder options"); 124 '; 125 126 pwg_query($q); 73 127 } 74 128 ?>
Note: See TracChangeset
for help on using the changeset viewer.