Changeset 31952 for extensions
- Timestamp:
- Nov 27, 2018, 4:55:02 PM (6 years ago)
- Location:
- extensions/AntiAspi
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/AntiAspi/admin.php
r31372 r31952 74 74 break; 75 75 case 'ipconfig': 76 antiaspi_check_old_conf(); 76 77 global $conf, $template; 77 78 $admin_base_url = ANTIASPI_ADMIN . '-ipconfig'; -
extensions/AntiAspi/initadmin.php
r31362 r31952 12 12 } 13 13 14 function antiaspi_check_old_conf() 15 { 16 global $page; 17 18 $conf = array(); 19 20 $local_conf_filpath = PHPWG_ROOT_PATH. 'local/config/config.inc.php'; 21 if (file_exists($local_conf_filpath)) 22 { 23 @include($local_conf_filpath); 24 } 25 26 if (isset($conf['antiaspi'])) 27 { 28 $page['errors'][] = 'we have found some antiaspi settings in your local configuration, please remove it, no longer in use.'; 29 } 30 } -
extensions/AntiAspi/maintain.class.php
r31370 r31952 4 4 class AntiAspi_maintain extends PluginMaintain 5 5 { 6 private $default_conf = array( 7 'diff' => '20 pages in 00:00:10', 8 'same' => '15 pages in 00:00:30', 9 'banned during' => '23:59:59', 10 'only guest' => true, 11 'only picture' => false, 12 'allowed ip' => array('123.123.123.123','122.122.122.122'), 13 ); 14 6 15 function install($plugin_version, &$errors=array()) 7 16 { 8 global $prefixeTable; 17 global $prefixeTable, $conf; 18 19 // add config parameter 20 if (empty($conf['antiaspi'])) 21 { 22 conf_update_param('antiaspi', $this->default_conf, true); 23 } 24 else 25 { 26 $old_conf = safe_unserialize($conf['antiaspi']); 27 28 foreach (array_keys($this->default_conf) as $conf_key) 29 { 30 if (!isset($old_conf[$conf_key])) 31 { 32 $old_conf[$conf_key] = $this->default_conf[$conf_key]; 33 } 34 } 35 36 conf_update_param('antiaspi', $old_conf, true); 37 } 9 38 10 39 // table antiaspi_ip_ban to store list of banned IP addresses … … 43 72 function update($old_version, $new_version, &$errors=array()) 44 73 { 45 global $conf;46 47 if (!isset($conf['antiaspi']))48 {49 $conf['antiaspi'] = array(50 'diff' => '20 pages in 00:00:10' ,51 'same' => '15 pages in 00:00:30' ,52 'banned during' => '23:59:59' ,53 'only guest' => true ,54 'only picture' => false ,55 'allowed ip' => array('123.123.123.123','122.122.122.122'),56 );57 conf_update_param('antiaspi', $conf['antiaspi']);58 }59 60 74 $this->install($new_version, $errors); 61 75 } … … 67 81 pwg_query('DROP TABLE '.$prefixeTable.'antiaspi_ip_ban;'); 68 82 pwg_query('DROP TABLE '.$prefixeTable.'antiaspi_log;'); 83 84 // delete configuration 85 pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param IN ("antiaspi");'); 69 86 } 70 87 }
Note: See TracChangeset
for help on using the changeset viewer.