Exemplo n.º 1
0
 if ($fnew) {
     $filterstr = empty($fconfigarr['filterstr']) ? "/[^a-zA-Z_0-9]+|^[0-9_]+/" : $fconfigarr['filterstr'];
     (empty($fieldnew['ename']) || empty($fieldnew['cname'])) && amessage('field_data_miss', $fconfigarr['errorurl']);
     preg_match($filterstr, $fieldnew['ename']) && amessage('field_ename_illegal', $fconfigarr['errorurl']);
     $fieldnew['ename'] = strtolower($fieldnew['ename']);
     in_array($fieldnew['ename'], $fconfigarr['enamearr']) && amessage('field_ename_repeat', $fconfigarr['errorurl']);
     in_array($fieldnew['ename'], $fieldwords) && amessage('field_ename_notuse', $fconfigarr['errorurl']);
     $fieldnew['length'] = empty($fieldnew['length']) ? 0 : max(0, intval($fieldnew['length']));
     //在这里是类系选择
     $fieldnew['max'] = select_fnew($fieldnew['max']);
     $db->query("ALTER TABLE {$fconfigarr['altertable']} ADD {$fieldnew['ename']} " . ($fieldnew['max'] ? "varchar(30) NOT NULL default ''" : "smallint(6) unsigned NOT NULL default 0"));
 } else {
     $fieldnew['cname'] = empty($fieldnew['cname']) ? $field['cname'] : $fieldnew['cname'];
     if (isset($fieldnew['max'])) {
         $fieldnew['max'] = empty($fieldnew['max']) ? 0 : max(2, intval($fieldnew['max']));
         if (!select_alter($fieldnew['max'], $field['max'], $field['ename'], $fconfigarr['altertable'])) {
             $fieldnew['max'] = $field['max'];
         }
     }
 }
 $fieldnew['innertext'] = empty($settingnew) ? array() : addslashes(serialize($settingnew));
 $fieldnew['guide'] = empty($fieldnew['guide']) ? '' : trim($fieldnew['guide']);
 $fieldnew['vdefault'] = empty($fieldnew['vdefault']) ? '' : trim($fieldnew['vdefault']);
 $fieldnew['vdefault'] = str_replace('[##]', ",", $fieldnew['vdefault']);
 foreach (array('datatype', 'ename', 'length', 'cname', 'notnull', 'nohtml', 'mode', 'guide', 'mlimit', 'rpid', 'issearch', 'innertext', 'fromcode', 'min', 'max', 'regular', 'isfunc', 'func', 'vdefault', 'pmid', 'custom_1', 'custom_2') as $var) {
     isset($fieldnew[$var]) && ($sqlstr .= (!$sqlstr ? '' : ',') . "{$var}='" . $fieldnew[$var] . "'");
 }
 if ($fnew) {
     $db->query("INSERT INTO {$fconfigarr['fieldtable']} SET {$sqlstr}");
 } else {
     $wherestr = empty($fconfigarr['wherestr']) ? "WHERE ename='{$field['ename']}'" : $fconfigarr['wherestr'];
Exemplo n.º 2
0
            trbasic(lang('ctrl_fsale'), 'cotypenew[fsale]', $cotype['fsale'], 'radio');
        }
        tabfooter('bcotypedetail');
        a_guide('cotypedetail');
    } else {
        $cotypenew['notblank'] = empty($cotypenew['notblank']) ? 0 : 1;
        $cotypenew['permission'] = empty($cotypenew['permission']) ? 0 : 1;
        $cotypenew['awardcp'] = empty($cotypenew['awardcp']) ? 0 : 1;
        $cotypenew['taxcp'] = empty($cotypenew['taxcp']) ? 0 : 1;
        $cotypenew['ftaxcp'] = empty($cotypenew['ftaxcp']) ? 0 : 1;
        $cotypenew['sale'] = empty($cotypenew['sale']) ? 0 : 1;
        $cotypenew['fsale'] = empty($cotypenew['fsale']) ? 0 : 1;
        $cotypenew['asmode'] = empty($cotypenew['asmode']) ? 0 : max(2, intval($cotypenew['asmode']));
        $cotypenew['emode'] = empty($cotypenew['emode']) ? 0 : max(0, intval($cotypenew['emode']));
        if (empty($cotype['self_reg'])) {
            if (!select_alter($cotypenew['asmode'], @$cotype['asmode'], 'ccid' . $coid, $tblprefix . 'archives')) {
                $cotypenew['asmode'] = @$cotype['asmode'];
            }
            if (!emode_alter($cotypenew['emode'], @$cotype['emode'], 'ccid' . $coid, $tblprefix . 'archives')) {
                $cotypenew['emode'] = @$cotype['emode'];
            }
        }
        $db->query("UPDATE {$tblprefix}cotypes SET \n\t\t\tnotblank='{$cotypenew['notblank']}',\n\t\t\tsortable='{$cotypenew['sortable']}',\n\t\t\tvmode='{$cotypenew['vmode']}',\n\t\t\tasmode='{$cotypenew['asmode']}',\n\t\t\temode='{$cotypenew['emode']}',\n\t\t\tpermission='{$cotypenew['permission']}',\n\t\t\tawardcp='{$cotypenew['awardcp']}',\n\t\t\ttaxcp='{$cotypenew['taxcp']}',\n\t\t\tftaxcp='{$cotypenew['ftaxcp']}',\n\t\t\tsale='{$cotypenew['sale']}',\n\t\t\tfsale='{$cotypenew['fsale']}'\n\t\t\tWHERE coid='{$coid}'");
        adminlog(lang('det_modify_cotype'));
        updatecache('cotypes');
        amessage('cotypemsetfinish', axaction(6, $forward));
    }
} elseif ($action == 'cotypesdelete' && $coid) {
    //删除类系,与节点的关系
    if (!isset($confirm) || $confirm != 'ok') {
        $message = lang('del_alert') . "<br><br>";