Пример #1
0
        $gerr = $dsql->GetError();
        ShowMsg("增加字段失败,错误提示为:" . $gerr, "javascript:;");
        exit;
    }
    $ok = false;
    //检测旧配置信息,并替换为新配置
    if (is_array($dtp->CTags)) {
        //遍历旧配置
        foreach ($dtp->CTags as $tagid => $ctag) {
            if ($fieldname == strtolower($ctag->GetName())) {
                $dtp->Assign($tagid, stripslashes($fieldstring), false);
                $ok = true;
                break;
            }
        }
        $oksetting = $ok ? $dtp->GetResultNP() : $fieldset . "\n" . stripslashes($fieldstring);
    } else {
        //原来的配置为空
        $oksetting = $fieldset . "\n" . stripslashes($fieldstring);
    }
    $addlist = GetAddFieldList($dtp, $oksetting);
    $oksetting = addslashes($oksetting);
    $rs = $dsql->ExecuteNoneQuery("UPDATE #@__member_model SET `info`='{$oksetting}' WHERE id='{$id}' ");
    if (!$rs) {
        $grr = $dsql->GetError();
        ShowMsg("保存节点配置出错!" . $grr, "javascript:;");
        exit;
    }
    ShowMsg("成功增加一个字段!", "member_model_edit.php?id={$id}");
    exit;
}
Пример #2
0
            if (isset($fields[$fieldname]) && $fields[$fieldname] != $buideType) {
                $tabsql = "ALTER TABLE `{$trueTable}` CHANGE `{$fieldname}` " . $ntabsql;
                $dsql->ExecuteNoneQuery($tabsql);
            } else {
                if (!isset($fields[$fieldname])) {
                    $tabsql = "ALTER TABLE `{$trueTable}` ADD " . $ntabsql;
                    $dsql->ExecuteNoneQuery($tabsql);
                } else {
                    $tabsql = '';
                }
            }
            $dtp->Assign($tagid, stripslashes($fieldstring), false);
            break;
        }
    }
    $oksetting = $dtp->GetResultNP();
    $oksetting = addslashes($oksetting);
    $dsql->ExecuteNoneQuery("UPDATE #@__member_model SET info='{$oksetting}' WHERE id='{$id}' ");
    ShowMsg("成功更改一个字段的配置!", "member_model_edit.php?id={$id}");
    exit;
} else {
    if ($action == "disabled") {
        foreach ($dtp->CTags as $tagid => $ctag) {
            if (strtolower($ctag->GetName()) == strtolower($fname)) {
                $statenum = $ctag->GetAtt('state') == 1 ? 0 : 1;
                $fieldstring = "<field:{$ctag->GetName()} itemname=\"{$ctag->GetAtt('itemname')}\" autofield=\"{$ctag->GetAtt('autofield')}\" type=\"{$ctag->GetAtt('type')}\" isnull=\"{$ctag->GetAtt('isnull')}\" default=\"{$ctag->GetAtt('default')}\"  maxlength=\"{$ctag->GetAtt('maxlength')}\" issearch=\"{$ctag->GetAtt('issearch')}\" isshow=\"{$ctag->GetAtt('isshow')}\" state=\"{$statenum}\">\r\n";
                $fieldstring .= "</field:{$ctag->GetName()}>";
                $dtp->Assign($tagid, stripslashes($fieldstring), false);
            }
        }
        $oksetting = addslashes($dtp->GetResultNP());
Пример #3
0
            if (isset($fields[$fieldname]) && $fields[$fieldname] != $buideType) {
                $tabsql = "ALTER TABLE `{$trueTable}` CHANGE `{$fieldname}` " . $ntabsql;
                $dsql->ExecuteNoneQuery($tabsql);
            } else {
                if (!isset($fields[$fieldname])) {
                    $tabsql = "ALTER TABLE `{$trueTable}` ADD " . $ntabsql;
                    $dsql->ExecuteNoneQuery($tabsql);
                } else {
                    $tabsql = '';
                }
            }
            $dtp->Assign($tagid, stripslashes($fieldstring), false);
            break;
        }
    }
    $oksetting = $dtp->GetResultNP();
    $addlist = GetAddFieldList($dtp, $oksetting);
    $oksetting = addslashes($oksetting);
    $dsql->ExecuteNoneQuery("UPDATE `#@__channeltype` SET fieldset='{$oksetting}',listfields='{$addlist}' WHERE id='{$id}' ");
    ShowMsg("成功更改一个字段的配置!", "mychannel_edit.php?id={$id}&dopost=edit&openfield=1");
    exit;
} else {
    if ($action == "delete") {
        if ($row['issystem'] == 1) {
            ShowMsg("对不起,系统模型的字段不允许删除!", "-1");
            exit;
        }
        //检测旧数据类型,并替换为新配置
        foreach ($dtp->CTags as $tagid => $ctag) {
            if (strtolower($ctag->GetName()) == strtolower($fname)) {
                $dtp->Assign($tagid, "#@Delete@#");