Example #1
0
} else {
    $SHOWFORM = false;
}
/** **/
$errs = array();
/** POST rec'd, check valid, proc. upload and save if OK */
if (isset($_POST['op']) and ($ACTION == OP_ADD or $ACTION == OP_EDIT)) {
    $mosh = new mosh_tool();
    $mosh->form_field_prefix = '';
    $msg = '';
    $vals = array();
    $img_vals = array();
    if ($errs = $mosh->check_form($colmap)) {
        // handled below
    } else {
        $vals = $mosh->get_form_vals($colmap);
        /** get list of all file upload fields from colmap **/
        $upfiles = array();
        foreach ($colmap as $k => $params) {
            if ($params[1] == 'image_upload' or $params[1] == 'file') {
                $upfiles[$k] = array();
            }
        }
        /** are there any actual files coming in? if so process *********************************/
        $uplo_count = 0;
        if (count($upfiles)) {
            foreach (array_keys($upfiles) as $upfile) {
                $uplo = new uploadable($upfile);
                if (!$uplo->is_uploaded_file()) {
                    #unset($upfiles[$upfile]);
                } else {
Example #2
0
}
/** **/
$user = cmClassFactory::getInstanceOf(CSHOP_CLASSES_USER, $pdb);
$pagetitle = 'Users';
$table_title = 'User';
$table_namecol = 'email';
/** POST rec'd, check valid, proc. upload and save if OK */
if (isset($_POST['op']) and ($ACTION == OP_ADD or $ACTION == OP_EDIT)) {
    $mosh = new mosh_tool();
    $mosh->form_field_prefix = '';
    $vals = array();
    $img_vals = array();
    if ($errs = $mosh->check_form($user->get_colmap())) {
        // handled below
    } else {
        $vals = $mosh->get_form_vals($user->colmap);
        $user->db->pushErrorHandling(PEAR_ERROR_RETURN);
        if ($ACTION == OP_EDIT) {
            // update the row in $tablenameable
            $user->set_id($itemid);
            if (defined('CSHOP_ALLOW_ANON_ACCOUNT')) {
                $user_rec = $user->fetch(array('is_anon'));
                if ($user_rec['is_anon']) {
                    $vals['anon_email'] = $vals['email'];
                    $vals['email'] = null;
                }
            }
            $res = $user->store($vals, false);
            if (PEAR::isError($res)) {
                $errs[] = $res->getMessage();
            } else {
Example #3
0
                $msg .= sprintf("Inserted new '%s' entry.", $pagetitle);
            }
        }
    }
} elseif (isset($_POST['op_basis'])) {
    /** edit name, zone, basis for this method (or add as case may be) */
    if (isset($_POST['method_id'])) {
        $req_id = $_POST['method_id'];
        $sm->dbc->set_id($req_id);
        $msg = "Ship Method edited. ";
    } else {
        $msg = "Ship Method added. ";
    }
    $mosh = new mosh_tool();
    $mosh->form_field_prefix = '';
    $vals = $mosh->get_form_vals($sm->colmap);
    $sm->dbc->store($vals);
    $req_id = $sm->dbc->get_id();
    /* clear all basis for this method and add new as needed */
    $sm->clear_basises($req_id);
    for ($i = 1;; $i++) {
        // existing ones are in xxxxx1, xxxxxx2, xxxxxxx3, etc
        if (empty($_POST["trBasisMax{$i}"]) && empty($_POST["trBasisMin{$i}"])) {
            break;
        }
        $sm->store_basis($req_id, $_POST["trBasisMin{$i}"], $_POST["trBasisMax{$i}"], $_POST["trCost{$i}"]);
    }
    /* they may have put something in the new basis boxen */
    if (!empty($_POST['add_basis_min']) || !empty($_POST['add_basis_max'])) {
        $sm->dbc->set_id($req_id);
        $sm->store_basis($req_id, $_POST['add_basis_min'], $_POST['add_basis_max'], $_POST['add_cost']);