shiyiya / typecho-theme-sagiri

🍰 As lovely as sagiri

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

最新1.15版本异常

harry10086 opened this issue · comments

下载最新版本更新后发现几个问题:
1.之前的主题1.07版本我正常使用数字验证码现在提示错误,导致主题相关设置不可见
我是在functions.php最后加如下代码,提示function spam_protection_math(){该行出错

function themeInit($comment){
    if ($comment->is('single')) {
        $comment = spam_protection_pre($comment);
    }
}
function spam_protection_math(){
    $num1=rand(1,20);
    $num2=rand(1,20);
    echo "<label for=\"math\">请问 <i>$num1 + $num2 = ?</i></label>\n";
    echo "<input type=\"text\" name=\"sum\" class=\"text\" value=\"\" size=\"25\" tabindex=\"4\" style=\"width:40px\">\n";
    echo "<input type=\"hidden\" name=\"num1\" value=\"$num1\">\n";
    echo "<input type=\"hidden\" name=\"num2\" value=\"$num2\">";
}
function spam_protection_pre($commentdata){
    $sum=$_POST['sum'];
    switch($sum){
        case $_POST['num1']+$_POST['num2']:
            break;
        case null:
            throw new Typecho_Widget_Exception(_t('请输入验证码'));
            break;
        default:
            throw new Typecho_Widget_Exception(_t('验证码错误,请重新输入'));
    }
    return $commentdata;
}

2.删除上面的代码后,可以进入主题设置,设置页面顶部提示如下

Warning: Illegal offset type in isset or empty in /www/wwwroot/test.mxzhi.com/var/Typecho/Widget/Helper/Form/Element/Radio.php on line 73

3.不修改任何设置,访问主页,页面排版没有了,随便选择几个主题设置选项,无任何改变

commented

尝试对比未出错版本 function php ,注意 Typecho_Widget_Helper_Form_Element_Radio ` 内容。
我这里暂时无法复现。

commented

如果还有问题,你可以重开此 issue!

已经ok了。
验证码加入错误是因为function php里已经定义了 themeInit,合并内容即可
谢谢!