📄 blocklist.class.php
字号:
<?php/*** @package Blocklist* @copyright (C) 2006 Websmurf* @author Websmurf* * --------------------------------------------------------------------------------* All rights reserved. Blocklist is a component for Joomla and Mambo. * You can use it to block certain ipadresses or ipblocks** This program is free software; you can redistribute it and/or* modify it under the terms of the Creative Commons - Attribution-NoDerivs 2.5 * license as published by the Creative Commons Organisation* http://creativecommons.org/licenses/by-nd/2.5/.** This program is distributed in the hope that it will be useful,* but WITHOUT ANY WARRANTY; without even the implied warranty of* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * --------------------------------------------------------------------------------**/// ensure this file is being included by a parent filedefined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );class blocklist { /** * Save the configuration * */ function saveConfiguration(){ global $option, $mainframe; $bl_config = mosGetParam($_REQUEST, 'bl_config'); $keys = array_keys($bl_config); $content = '<?php/*** @package Blocklist* @copyright (C) 2006 Websmurf* @author Websmurf**/// ensure this file is being included by a parent filedefined( \'_VALID_MOS\' ) or die( \'Direct Access to this location is not allowed.\' );'; for($i=0,$n=count($keys);$i<$n;$i++){ $content .= '$bl_config[\'' . $keys[$i] . '\'] = \'' . $bl_config[$keys[$i]] . '\';' . "\n"; } $content .= '?>'; if(!is_writable($mainframe->getCfg('absolute_path') . '/administrator/components/com_blocklist/configuration.php')){ mosRedirect('index2.php?option=' . $option . '&act=config', 'Configuration file is unwritable'); exit; } $fp = fopen($mainframe->getCfg('absolute_path') . '/administrator/components/com_blocklist/configuration.php', 'w+'); fwrite($fp, $content); fclose($fp); mosRedirect('index2.php?option=' . $option . '&act=config', 'Configuration saved'); } /** * Show current blocklist * */ function showBlocklist(){ global $option, $mainframe; $content = file($mainframe->getCfg('absolute_path') . '/administrator/components/com_blocklist/block.lst'); $lst = array(); for($i=0,$n=count($content);$i<$n;$i++){ $row = explode("|", $content[$i]); $lst[] = array($row[0], $row[1]); } HTML_blocklist::showBlocklist($lst); } /** * Save blocklist to cache * */ function saveBlocklist(){ global $option, $mainframe; $blocked = mosGetParam($_REQUEST, 'block_ip'); $reason = mosGetParam($_REQUEST, 'reason'); $keys = array_keys($blocked); $list = ""; for($i=0,$n=count($keys);$i<$n;$i++){ $key = $keys[$i]; $list .= $blocked[$key] . "|" . $reason[$key] . "\n"; } $fp = fopen($mainframe->getCfg('absolute_path') . '/administrator/components/com_blocklist/block.lst', 'w+'); fwrite($fp, trim($list)); fclose($fp); mosRedirect('index2.php?option='. $option, 'Changes to blocklist saved'); }}?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -