$fex->add_element('required_cats', array('', 'bundler_cats', $cat_options, 0)); $fex->add_element('op', array($ACTION, 'submit')); // the button if ($ACTION == OP_EDIT) { $bundle->set_id($req_id); $vals = $bundle->fetch(); $fex->elem_vals = $vals; $method_title = $vals['title']; $fex->add_element('id', array('hid id', 'hidden', $req_id)); // important $confirm_msg = 'This will remove this item from the site permanently. Are you sure?'; $fex->add_element('op_kill', array('REMOVE', 'submit', null, array('class' => 'ccomKillSwitch'), "onclick=\"return confirm('{$confirm_msg}')\"")); } else { $method_title = 'ADD NEW ZONE'; } $form = $fex->get_struct(); } else { $table = new fu_HTML_Table(array('width' => '100%')); $table->setAutoGrow(true); $table->setAutoFill("—"); $header_row = array('title' => 'Bundle Name', 'base_price' => 'Base', 'qty_inventory' => 'On hand'); $table_ordercol = isset($_GET['by']) ? $_GET['by'] : 'title'; $order_dir = (!isset($_GET['dir']) or $_GET['dir'] == 'A') ? 'ASC' : 'DESC'; /** decide on which result page to show **/ $bundle->set_range($rows_per_page); $offset = isset($_GET['page']) ? $rows_per_page * $_GET['page'] - 1 : 0; $bundle->set_offset($offset); /** **/ $have_table = false; $cols = array_merge(array('id'), array_keys($header_row)); if ($rows = $bundle->fetch_any($cols, 0, 0, $table_ordercol, null, $order_dir)) {
$fex->elem_vals = $userinfo; } elseif ($ACTION == OP_EDIT_ADDR) { $fex->add_element('addr_id', array('', 'hidden', $req_id, null)); $fex->add_element($user->addr->get_colmap()); $user->addr->set_id($req_id); $fex->elem_vals = $user->addr->fetch(); } if ($ACTION == OP_NEW_USER or $ACTION == OP_EDIT_LOGIN) { // add password elements if ($username = $user->fetch(array('username'))) { $smarty->assign('username', $username['username']); } $fex->add_element('password', array('Password', 'password', 1)); $fex->add_element('password2', array('Password confirmation', 'password', 1)); } $smarty->assign('cform', $fex->get_struct()); } elseif ($userinfo) { // for static display in tpl $addrs = $user->fetchAllAddr(); $smarty->assign('addrs', $addrs); $smarty->assign('userinfo', $userinfo); } $smarty->assign('order_history', $user->fetch_order_history()); $smarty->assign('ACTION', $ACTION); if (isset($_GET['info'])) { $smarty->assign('msg', base64_decode($_GET['info'])); } if (empty($tpl)) { $tpl = 'account.tpl'; } $smarty->display("float:{$tpl}");
function auth_loginform($failed = 0) { global $sess; global $smarty; global $fex; // see note below $this->error_log('called ' . __FUNCTION__ . '()'); // here we put the entire page using smarty $smarty->assign("page_id", 'login'); require_once "formex.class.php"; // this is a bad kludge to get uname/pw filled pre-filled-out for users that just // registered + confirmed their account - if $fex exists it can be filled out with // a $db_row attrib and maybe $FEx, etc. - see activate.php, e.g. if (!$fex) { $fex = new formex(); // try to save any GET params we might have had during timeout if ($_SERVER['REQUEST_URI']) { $fex->form_action = $_SERVER['REQUEST_URI']; } } $fex->max_size = 16; $fex->add_element('username', array('Username/email', 'text', null, array('class' => 'cartLogin'), 1)); $fex->add_element('password', array('Password', 'password', null, array('class' => 'cartLogin'), 1)); $fex->add_element("op_login", array("LOGIN", "submit", 1)); $smarty->assign("cform", $fex->get_struct()); $smarty->assign(array("self" => $_SERVER['PHP_SELF'], "BAD_PASS" => $failed)); $smarty->display("float:checkout_login.tpl"); }