} elseif (isset($_GET[$reqIdKey]) and !empty($_GET[$reqIdKey])) { $itemid = $_GET[$reqIdKey]; $ACTION = OP_EDIT; } elseif (isset($_GET['op_add'])) { $ACTION = OP_ADD; } else { $SHOWFORM = false; } /** **/ $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'];
} elseif (isset($_POST['id']) and isset($_POST['op_kill'])) { $itemid = $_POST['id']; $ACTION = OP_KILL; } elseif (isset($_GET['op_edit']) and !empty($_GET['op_edit'])) { $itemid = $_GET['op_edit']; $ACTION = OP_EDIT; } elseif (isset($_GET['op_add'])) { $ACTION = OP_ADD; } 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(); } }
page_open(array('sess' => CSHOP_CLASSES_AUTH_SESSION, 'auth' => 'defaultAuth')); // control flags $ACTION = null; $SHOWFORM = true; $SUCCESS = null; $errs = array(); $recover_key_name = 'm'; $pw_min_length = 6; $smarty->assign('pw_min_length', $pw_min_length); /** define set of actions this script can perform **/ define('OP_GET_EMAIL', 'NEXT STEP'); define('OP_SEND_TOKEN', 'TOKEN SENT'); define('OP_RESET_PASS', 'RESET PASSWORD'); define('OP_RESET_PASS_PROC', 'DO RESET PASSWORD'); $user = cmClassFactory::getInstanceOf(CSHOP_CLASSES_USER, $pdb); $mosh = new mosh_tool(); /** decide on a course of action **/ if (isset($_POST['f_op']) and $_POST['f_op'] == OP_GET_EMAIL) { $ACTION = OP_SEND_TOKEN; } elseif (isset($_POST['f_op_send'])) { $ACTION = OP_RESET_PASS_PROC; } elseif (!empty($_GET[$recover_key_name])) { $ACTION = OP_RESET_PASS; } else { $ACTION = OP_GET_EMAIL; } /** now take the action **/ if ($ACTION == OP_SEND_TOKEN) { // check email addr and send email to user $femail = $_POST['f_email']; if (!$mosh->is_proper_email($_POST['f_email'])) {
$msg .= sprintf("'%s' entry was updated.", $pagetitle); } else { $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'])) {
* creating basic reports on sales and orders * * $Id: report.inventory.php,v 1.5 2008/06/23 02:54:50 sbeam Exp $ */ require_once CONFIG_DIR . 'cshop.config.php'; require_once "mosh_tool.class.php"; require_once "fu_HTML_Table.class.php"; require_once "res_pager.class.php"; require_once "filter_form.class.php"; require_once CSHOP_CLASSES_ORDER . '.class.php'; require_once CSHOP_CLASSES_PRODUCT . '.class.php'; require_once "store.edit.inc.php"; require_once "csv_table.class.php"; $c = CSHOP_CLASSES_PRODUCT; $prod = new $c($pdb); $mosh = new mosh_tool(); /** possibly limit by product */ $pid = !empty($_GET['pid']) ? $_GET['pid'] : null; /** or possibly, by category */ $filter_cat_id = !empty($_GET['cat']) ? $_GET['cat'] : null; $header_row = array('qty' => 'Qty', 'title' => 'Product', 'color' => 'Color', 'size_code' => 'Size', 'sku' => 'SKU'); $link_fmt = 'store.edit.php?win=inventory&productid=%d'; $link_vals = array('product_id'); $def_orby = 'title'; // determine order column and direction $orby = $def_orby; if (isset($_GET['by']) and in_array($_GET['by'], array_keys($header_row))) { $orby = $_GET['by']; } $order_dir = (empty($_GET['dir']) or $_GET['dir'] == 'A') ? 'ASC' : 'DESC'; if (isset($_GET['op_csv'])) {