/** * 获取插件配置面板 * * @access public * @param Typecho_Widget_Helper_Form $form 配置面板 * @return void */ public static function config(Typecho_Widget_Helper_Form $form) { $dir = dirname(__FILE__) . '/securimage/'; $fileList = getDirlist($dir . 'fonts'); $image_height = new Typecho_Widget_Helper_Form_Element_Text('image_height', NULL, '80', _t('验证码图片高度'), _t('默认值为80')); $form->addInput($image_height); $image_width = new Typecho_Widget_Helper_Form_Element_Text('image_width', NULL, '215', _t('验证码图片宽度'), _t('默认值为215')); $form->addInput($image_width); $image_bg_color = new Typecho_Widget_Helper_Form_Element_Text('image_bg_color', NULL, '#ffffff', _t('背景颜色'), _t('默认值为#ffffff')); $form->addInput($image_bg_color); $is_background = new Typecho_Widget_Helper_Form_Element_Radio('is_background', array('1' => '启用', '0' => '不启用'), 1, '是否启用背景图片', '如果启用背景图片,请自行修改插件目录下securimage/backgrounds/目录中的背景图片'); $form->addInput($is_background); $num_lines = new Typecho_Widget_Helper_Form_Element_Text('num_lines', NULL, '3', _t('干扰线数量'), _t('最小值为0,必须是整数')); $form->addInput($num_lines); $line_color = new Typecho_Widget_Helper_Form_Element_Text('line_color', NULL, '#666666', _t('干扰线颜色'), _t('默认值为#666666')); $form->addInput($line_color); $perturbation = new Typecho_Widget_Helper_Form_Element_Text('perturbation', NULL, '0.3', _t('验证码扭曲指数'), _t('取值范围从0-1.0,默认为0.3')); $form->addInput($perturbation); $text_color = new Typecho_Widget_Helper_Form_Element_Text('text_color', NULL, '#666666', _t('验证码颜色'), _t('默认值为#666666')); $form->addInput($text_color); $ttf_file = new Typecho_Widget_Helper_Form_Element_Select('ttf_file', $fileList, 'stxingkai.ttf', '验证码字体', '如果使用中文验证码,请务必选择中文字体文件,否则无法演示验证码'); $form->addInput($ttf_file); $image_signature = new Typecho_Widget_Helper_Form_Element_Text('image_signature', NULL, 'ccvita.com', _t('签名内容')); $form->addInput($image_signature); $signature_color = new Typecho_Widget_Helper_Form_Element_Text('signature_color', NULL, '#666666', _t('签名颜色'), _t('默认值为#666666')); $form->addInput($signature_color); $signature_font = new Typecho_Widget_Helper_Form_Element_Select('signature_font', $fileList, 'AHGBold.ttf', '签名字体', '如果使用中文签名,请务必选择中文字体文件,否则无法演示验证码'); $form->addInput($signature_font); $use_wordlist = new Typecho_Widget_Helper_Form_Element_Radio('use_wordlist', array('1' => '启用', '0' => '不启用'), 0, '是否自定义验证码文本', '如果自定义验证码文本'); $form->addInput($use_wordlist); $wordlist = new Typecho_Widget_Helper_Form_Element_Textarea('wordlist', NULL, "中文\n验证码", _t('验证码文本'), _t('自定义验证码内容,每行一个<br><img src="' . Typecho_Common::url('/action/captcha', Helper::options()->index) . '" alt="captcha" onclick="this.src = this.src + \'?\' + Math.random()" style="cursor: pointer" title="' . _t('点击图片刷新验证码') . '" />')); $form->addInput($wordlist); }
function getDirlist($dirpath, $nStep) { global $pwd; $arrPath = explode('/', $pwd); if ($dir_handle = opendir($dirpath)) { while (false !== ($files = readdir($dir_handle))) { $subDir = $dirpath . $files . '/'; if (@is_dir($subDir) && $files != '.' && $files != '..') { getPrintdir($nStep, $subDir, $files, !strstr($pwd, $subDir), getDirexists($subDir)); if ($arrPath[$nStep + 1] == $files) { getDirlist($subDir, $nStep + 1); } } } } closedir($dir_handle); }
function getDirlist($dirpath, $nStep) { global $imgdir, $THIS_FILE, $pwd; $arrPath = explode("/", $pwd); if ($dir_handle = opendir($dirpath)) { while (false !== ($file = readdir($dir_handle))) { $subDir = $dirpath . $file . "/"; if ($file != '.' && $file != '..') { if (@is_dir($subDir)) { getPrintdir($nStep, $subDir, $file, !strstr($pwd, $subDir), getDirexists($subDir)); if ($arrPath[$nStep + 1] == $file) { getDirlist($subDir, $nStep + 1); } } else { getPrintFile($file, $nStep, $dirpath); } } } } closedir($dir_handle); }
<TR> <TD VALIGN=TOP BGCOLOR=WHITE WIDTH=194 NOWRAP> <TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=0> <TR> <TD WIDTH=100% HEIGHT=21 BACKGROUND='<?php echo $imgdir; ?> /tt_bg.gif'> µð·ºÅ丮 </TD> </TR> </TABLE> <?php getDirlisth(); getDirlist($pwd_start, $step_start); getDirlistf(); ?> <INPUT TYPE=TEXT ID='focus_input' onblur="hidefocus()" style='position:absolute;width:0;heihgt:0;left:-100;top:0;'> </TD> <TD WIDTH=6 BACKGROUND='<?php echo $imgdir; ?> /vline01.gif' NOWRAP> <TD VALIGN=TOP BGCOLOR=EFEFEF> <?php if ($query != 'modify') { ?>