/** * Updates the sortorder of the pages list in the database * */ function updateItemsSortorder(&$reports) { if (!empty($_POST['order'])) { // if someone didn't sort anything there are no values! $order = processOrder($_POST['order']); $parents = array('NULL'); foreach ($order as $id => $orderlist) { // fix the parent ID and update the DB record $sortstring = implode('-', $orderlist); $level = count($orderlist); $parents[$level] = $id; $myparent = $parents[$level - 1]; $sql = "UPDATE " . prefix('menu') . " SET `sort_order` = '" . $sortstring . "', `parentid`= " . $myparent . " WHERE `id`=" . $id; query($sql); } $reports[] = "<br clear: all><p class='messagebox fade-message'>" . gettext("Sort order saved.") . "</p>"; } }
/** * Updates the sortorder of the pages list in the database * */ function updateItemsSortorder() { if (empty($_POST['order'])) { // if someone didn't sort anything there are no values! return '<p class="notebox fade-message">' . gettext('Nothing changed') . '</p>'; } else { $order = processOrder($_POST['order']); $parents = array('NULL'); foreach ($order as $id => $orderlist) { // fix the parent ID and update the DB record $sortstring = implode('-', $orderlist); $level = count($orderlist); $parents[$level] = $id; $myparent = $parents[$level - 1]; $sql = "UPDATE " . prefix('menu') . " SET `sort_order` = " . db_quote($sortstring) . ", `parentid`= " . db_quote($myparent) . " WHERE `id`=" . sanitize_numeric($id); query($sql); } return "<p class='messagebox fade-message'>" . gettext("Sort order saved.") . "</p>"; } }
<?php /* * checkout.php * * Copyright 2010 nitzan <nitzan@nitzan-laptop> * */ if ($_POST['form_submit'] == "11234") { $address = $_POST['address']; $cardType = $_POST['cardType']; $cardnumber = $_POST['cardnumber']; $duedate = $_POST['duedate']; $ownerId = $_POST['ownerId']; $recite = processOrder($address, $cardType, $cardnumber, $duedate, $ownerId); } get_top_nav(); //Call the navigation ?> <div id="wrap"> <div id="widecb"> <div id="additemnav"> <ul> <li><a href="" title=""><?php _e('Orders history'); ?> </a></li> <li><a href="<?php echo HOME; ?>
<?php //asg9Request.php // responds to request require_once "mydb.php"; //print_r($_GET); if (isset($_GET['phone'])) { phoneFind(); } else { processOrder(); } function phoneFind() { $db = dbConnect(); //$db->debug=1; $phone = htmlentities($_GET['phone'], ENT_QUOTES); $query = "select * from myCustomer where phone = '{$phone}'"; $result = $db->Execute($query); if (!$result) { print "Error with result"; return; } $count = $result->RowCount(); if ($count == 0) { printOrder($phone); } else { $row = $result->FetchRow(); $name = $row['name']; $customer = $row['customerId']; $queryCO = "select * from myCustomerToMyOrder where customerId = '{$customer}'"; $resultCO = $db->Execute($queryCO);
/** * POST handler for album tree sorts * * @param int $parentid id of owning album * */ function postAlbumSort($parentid) { if (isset($_POST['order']) && !empty($_POST['order'])) { $order = processOrder(sanitize($_POST['order'])); $sortToID = array(); foreach ($order as $id => $orderlist) { $id = str_replace('id_', '', $id); $sortToID[implode('-', $orderlist)] = $id; } foreach ($order as $item => $orderlist) { $item = str_replace('id_', '', $item); $currentalbum = query_single_row('SELECT * FROM ' . prefix('albums') . ' WHERE `id`=' . $item); $sortorder = array_pop($orderlist); if (count($orderlist) > 0) { $newparent = $sortToID[implode('-', $orderlist)]; } else { $newparent = $parentid; } if ($newparent == $currentalbum['parentid']) { $sql = 'UPDATE ' . prefix('albums') . ' SET `sort_order`=' . db_quote(sprintf('%03u', $sortorder)) . ' WHERE `id`=' . $item; query($sql); } else { // have to do a move $albumname = $currentalbum['folder']; $album = newAlbum($albumname); if (strpos($albumname, '/') !== false) { $albumname = basename($albumname); } if (is_null($newparent)) { $dest = $albumname; } else { $parent = query_single_row('SELECT * FROM ' . prefix('albums') . ' WHERE `id`=' . $newparent); if ($parent['dynamic']) { return "&mcrerr=5"; } else { $dest = $parent['folder'] . '/' . $albumname; } } if ($e = $album->move($dest)) { return "&mcrerr=" . $e; } else { $album->setSortOrder(sprintf('%03u', $sortorder)); $album->save(); } } } return true; } return false; }
/** * Updates the sortorder of the items list in the database * * @param string $mode 'pages' or 'categories' * @param array $reports The success messagees * @return array */ function updateItemSortorder($mode = 'pages', &$reports) { if (!empty($_POST['order'])) { // if someone didn't sort anything there are no values! $order = processOrder($_POST['order']); $parents = array('NULL'); foreach ($order as $id => $orderlist) { $id = str_replace('id_', '', $id); $level = count($orderlist); $parents[$level] = $id; $myparent = $parents[$level - 1]; switch ($mode) { case 'pages': $dbtable = prefix('pages'); break; case 'categories': $dbtable = prefix('news_categories'); break; } $sql = "UPDATE " . $dbtable . " SET `sort_order` = '" . implode('-', $orderlist) . "', `parentid`= " . $myparent . " WHERE `id`=" . $id; query($sql); } } $reports[] = "<br clear=\"all\"><p class='messagebox fade-message'>" . gettext("Sort order saved.") . "</p>"; }
/** * Updates the sortorder of the items list in the database * * @param string $mode 'pages' or 'categories' * @return array */ function updateItemSortorder($mode = 'pages') { if (!empty($_POST['order'])) { // if someone didn't sort anything there are no values! $order = processOrder($_POST['order']); $parents = array('NULL'); foreach ($order as $id => $orderlist) { $id = str_replace('id_', '', $id); $level = count($orderlist); $parents[$level] = $id; $myparent = $parents[$level - 1]; switch ($mode) { case 'pages': $dbtable = prefix('pages'); break; case 'categories': $dbtable = prefix('news_categories'); break; } $sql = "UPDATE " . $dbtable . " SET `sort_order` = " . db_quote(implode('-', $orderlist)) . ", `parentid`= " . $myparent . " WHERE `id`=" . $id; query($sql); } return true; } return false; }
exit; } //Friendly error for FOPEN if (!$fp) { echo "<p>Couldn't open the file! Panic!</p>"; exit; } $fileSize = filesize($myDir . $myFile); $orderLine = []; $orderLine = fgetcsv($fp, $fileSize, "\t"); if ($debug) { echo "There are: " . count($orderLine) . " elements<br/>"; var_dump($orderLine); } // Main method to display the entry processOrder($orderLine, $fieldSubHeadings); $isUnlocked = flock($fp, LOCK_UN); if (!$isUnlocked) { echo "<p>Could not unlock the file!</p>"; exit; } fclose($fp); } } ?> </div><?php } else { header("location:orderVegetables.php"); } // END: if( isset($_POST['submit']) ) { ?>