Example #1
0
function PostMember()
{
    global $zbp;
    if (!isset($_POST['ID'])) {
        return;
    }
    if (!$zbp->CheckRights('MemberAll')) {
        unset($_POST['Level']);
        unset($_POST['Name']);
    }
    if (isset($_POST['Password'])) {
        if ($_POST['Password'] == '') {
            unset($_POST['Password']);
        } else {
            if (strlen($_POST['Password']) < $zbp->option['ZC_PASSWORD_MIN'] || strlen($_POST['Password']) > $zbp->option['ZC_PASSWORD_MAX']) {
                $zbp->ShowError(54);
            }
            if (!CheckRegExp($_POST['Password'], '[password]')) {
                $zbp->ShowError(54);
            }
            $_POST['Password'] = Member::GetPassWordByGuid($_POST['Password'], $_POST['Guid']);
        }
    }
    if (isset($_POST['Name'])) {
        if (isset($zbp->membersbyname[$_POST['Name']])) {
            if ($zbp->membersbyname[$_POST['Name']]->ID != $_POST['ID']) {
                $zbp->ShowError(62);
            }
        }
    }
    if (isset($_POST['Alias'])) {
        $_POST['Alias'] = TransferHTML($_POST['Alias'], '[noscript]');
    }
    $mem = new Member();
    if (GetVars('ID', 'POST') == 0) {
        if (isset($_POST['Password']) == false || $_POST['Password'] == '') {
            $zbp->ShowError(73);
        }
        $_POST['IP'] = GetGuestIP();
    } else {
        $mem->LoadInfoByID(GetVars('ID', 'POST'));
    }
    foreach ($zbp->datainfo['Member'] as $key => $value) {
        if ($key == 'ID') {
            continue;
        }
        if ($key == 'Meta') {
            continue;
        }
        if (isset($_POST[$key])) {
            $mem->{$key} = GetVars($key, 'POST');
        }
    }
    foreach ($GLOBALS['Filter_Plugin_PostMember_Core'] as $fpname => &$fpsignal) {
        $fpname($mem);
    }
    FilterMember($mem);
    FilterMeta($mem);
    CountMember($mem);
    $mem->Save();
    foreach ($GLOBALS['Filter_Plugin_PostMember_Succeed'] as $fpname => &$fpsignal) {
        $fpname($mem);
    }
    if (isset($_POST['Password'])) {
        if ($mem->ID == $zbp->user->ID) {
            Redirect($zbp->host . 'zb_system/cmd.php?act=login');
        }
    }
    return true;
}
Example #2
0
/**
 * 提交模块数据
 * @return bool
 */
function PostModule()
{
    global $zbp;
    if (isset($_POST['catalog_style'])) {
        $zbp->option['ZC_MODULE_CATALOG_STYLE'] = $_POST['catalog_style'];
        $zbp->SaveOption();
    }
    if (!isset($_POST['ID'])) {
        return;
    }
    if (!GetVars('FileName', 'POST')) {
        $_POST['FileName'] = 'mod' . rand(1000, 2000);
    } else {
        $_POST['FileName'] = strtolower($_POST['FileName']);
    }
    if (!GetVars('HtmlID', 'POST')) {
        $_POST['HtmlID'] = $_POST['FileName'];
    }
    if (isset($_POST['MaxLi'])) {
        $_POST['MaxLi'] = (int) $_POST['MaxLi'];
    }
    if (isset($_POST['IsHideTitle'])) {
        $_POST['IsHideTitle'] = (int) $_POST['IsHideTitle'];
    }
    if (!isset($_POST['Type'])) {
        $_POST['Type'] = 'div';
    }
    if (isset($_POST['Content'])) {
        if ($_POST['Type'] != 'div') {
            $_POST['Content'] = str_replace(array("\r", "\n"), array('', ''), $_POST['Content']);
        }
    }
    if (isset($_POST['Source'])) {
    }
    $mod = $zbp->GetModuleByID(GetVars('ID', 'POST'));
    foreach ($zbp->datainfo['Module'] as $key => $value) {
        if ($key == 'ID' || $key == 'Meta') {
            continue;
        }
        if (isset($_POST[$key])) {
            $mod->{$key} = GetVars($key, 'POST');
        }
    }
    if (isset($_POST['NoRefresh'])) {
        $mod->NoRefresh = (bool) $_POST['NoRefresh'];
    }
    foreach ($GLOBALS['Filter_Plugin_PostModule_Core'] as $fpname => &$fpsignal) {
        $fpname($mod);
    }
    FilterModule($mod);
    FilterMeta($mod);
    $mod->Save();
    $zbp->AddBuildModule($mod->FileName);
    foreach ($GLOBALS['Filter_Plugin_PostModule_Succeed'] as $fpname => &$fpsignal) {
        $fpname($mod);
    }
    return true;
}