コード例 #1
1
function showCarrusel($titulo, $id, $vods)
{
    $idCarousel = "carousel" . $id;
    print '     <div class="row">' . "\n";
    print '        <div id="titserie">' . $titulo . '</div>' . "\n";
    print '         <div class="well">' . "\n";
    print '<div id="' . $idCarousel . '" class="carousel slide">' . "\n";
    print '    <div class="carousel-inner">' . "\n";
    $randVods1 = getNRandomVods($vods, 4);
    $randVods2 = getNRandomVods($vods, 4);
    $randVods3 = getNRandomVods($vods, 4);
    addItem($randVods1, ' active');
    addItem($randVods2, '');
    addItem($randVods3, '');
    //    addVideo($randVods1);
    //    addVideo($randVods2);
    //    addVideo($randVods3);
    print '<div style="display:none;" class="subhtml">' . "\n";
    print '    <div class="customHtml">' . "\n";
    print '        <h4> Ventana Educativa </h4>' . "\n";
    print '    </div>' . "\n";
    print '</div>' . "\n";
    print '</div> <!-- carousel-inner -->' . "\n";
    print '<a class="left carousel-control carouselleft"  href="#' . $idCarousel . '" data-slide="prev">' . '<i class="fa fa-chevron-left fa-2x"></i></a>' . "\n";
    print '<a class="right carousel-control carouselright"  href="#' . $idCarousel . '" data-slide="next">' . '<i class="fa fa-chevron-right fa-2x"></i></a>' . "\n";
    print '<ol class="carousel-indicators">' . "\n";
    print '<li data-target="#' . $idCarousel . '" data-slide-to="0" class="active"></li>' . "\n";
    print '<li data-target="#' . $idCarousel . '" data-slide-to="1"></li>' . "\n";
    print '<li data-target="#' . $idCarousel . '" data-slide-to="2"></li>' . "\n";
    print '</ol>' . "\n";
    print '</div> <!--End Carousel-->' . "\n";
    print '</div> <!--End Well-->' . "\n";
    print '</div> <!--End row-->' . "\n";
}
コード例 #2
0
function render_give_item($username, $target, $item)
{
    $article = get_indefinite_article($item);
    addItem($target, $item, 1);
    $give_msg = "You have been given {$article} {$item} by {$username}.";
    sendMessage($username, $target, $give_msg);
    return "{$target} will receive your {$item}.<br>\n";
}
コード例 #3
0
ファイル: block_funcs.php プロジェクト: spas-viktor/books
function addNewBook($title)
{
    $addBook = array('UF_TITLE' => $title);
    $result = addItem(2, $addBook);
    if ($result->isSuccess()) {
        $_SESSION['BookMessage'] = "Книга " . $title . " добавлена!";
    } else {
        $_SESSION['BookMessage'] = "При добавлении книги произошла ошибка!";
    }
    return $result->getId();
}
コード例 #4
0
 /**
  * MenuItem constructor.
  */
 public function __construct($id)
 {
     $this->id = $id;
     if (is_null(static::$current)) {
         static::$current = $this;
         $this->level(0);
     } else {
         static::$current = addItem($this);
         $this->level(static::$current->level() + 1);
     }
 }
コード例 #5
0
ファイル: module.php プロジェクト: astorm/pestle
function generateColumnsNode($xml, $columnsName, $pulsestorm_commercebug_log_id, $pageActionsClassName)
{
    $columns = simpleXmlAddNodesXpath($xml, "columns[@name={$columnsName}]");
    $sectionColumns = $columns->addChild('selectionsColumn');
    $sectionColumns->addAttribute('name', 'ids');
    $data = addArgument($sectionColumns, 'data', 'array');
    $config = addItem($data, 'config', 'array');
    addBaseColumnItemNodes($config, '55', $pulsestorm_commercebug_log_id);
    addIdColumnToColumns($columns, $data, $pulsestorm_commercebug_log_id);
    addActionsColumnToColumns($columns, $pageActionsClassName, $pulsestorm_commercebug_log_id);
    return $columns;
}
コード例 #6
0
ファイル: AdminNav.php プロジェクト: wuwenhan/huoqiwang
 /**
  * @param                            $data
  * @param \yii\rbac\ManagerInterface $authManager
  * @param null                       $parent
  */
 function addItem($data, $authManager, $parent = null)
 {
     foreach ($data as $d) {
         $item = $authManager->createPermission($d['action']);
         $item->description = $d['name'];
         $authManager->add($item);
         $authManager->addChild($parent, $item);
         if (isset($d['children'])) {
             addItem($d['children'], $authManager, $item);
         }
     }
 }
コード例 #7
0
ファイル: module.php プロジェクト: astorm/pestle
/**
* Generates a Magento 2.1 ui grid listing and support classes.
*
* @command magento2:generate:ui:add-column-sections
* @argument listing_file Which Listing File? []
* @argument column_name Column Name? [ids]
* @argument index_field Index Field/Primary Key? [entity_id]
*/
function pestle_cli($argv)
{
    $xml = simplexml_load_file($argv['listing_file']);
    validateAsListing($xml);
    $columns = getOrCreateColumnsNode($xml);
    $sectionsColumn = $columns->addChild('selectionsColumn');
    $sectionsColumn->addAttribute('name', $argv['column_name']);
    $argument = addArgument($sectionsColumn, 'data', 'array');
    $configItem = addItem($argument, 'config', 'array');
    $indexField = addItem($configItem, 'indexField', 'string', $argv['index_field']);
    writeStringToFile($argv['listing_file'], formatXmlString($xml->asXml()));
}
コード例 #8
0
ファイル: clubCard.php プロジェクト: blynch-newpi/IS4C
function clubCard($intItemNum)
{
    $query = "select * from localtemptrans where trans_id = " . $intItemNum;
    $connection = tDataConnect();
    $result = sql_query($query, $connection);
    $row = sql_fetch_array($result);
    $num_rows = sql_num_rows($result);
    if ($num_rows > 0) {
        $strUPC = $row["upc"];
        $strDescription = $row["description"];
        $dblVolSpecial = $row["VolSpecial"];
        $dblquantity = -0.5 * $row["quantity"];
        $dblTotal = truncate2(-1 * 0.5 * $row["total"]);
        // invoked truncate2 rounding function to fix half-penny errors apbw 3/7/05
        $strCardNo = $_SESSION["memberID"];
        $dblDiscount = $row["discount"];
        $dblmemDiscount = $row["memDiscount"];
        $intDiscountable = $row["discountable"];
        $dblUnitPrice = $row["unitPrice"];
        $intScale = nullwrap($row["scale"]);
        if ($row["foodstamp"] != 0) {
            $intFoodStamp = 1;
        } else {
            $intFoodStamp = 0;
        }
        $intdiscounttype = nullwrap($row["discounttype"]);
        if ($row["voided"] == 20) {
            boxMsg("Discount already taken");
        } elseif ($row["trans_type"] == "T" or $row["trans_status"] == "D" or $row["trans_status"] == "V" or $row["trans_status"] == "C") {
            boxMsg("Item cannot be discounted");
        } elseif (strncasecmp($strDescription, "Club Card", 9) == 0) {
            //----- edited by abpw 2/15/05 -----
            boxMsg("Item cannot be discounted");
        } elseif ($_SESSION["tenderTotal"] < 0 and $intFoodStamp == 1 and -1 * $dblTotal > $_SESSION["fsEligible"]) {
            boxMsg("Item already paid for");
        } elseif ($_SESSION["tenderTotal"] < 0 and -1 * $dblTotal > $_SESSION["runningTotal"] - $_SESSION["taxTotal"]) {
            boxMsg("Item already paid for");
        } else {
            // --- added partial item desc to club card description - apbw 2/15/05 ---
            addItem($strUPC, "Club Card: " . substr($strDescription, 0, 19), "I", "", "J", $row["department"], $dblquantity, $dblUnitPrice, $dblTotal, 0.5 * $row["regPrice"], $intScale, $row["tax"], $intFoodStamp, $dblDiscount, $dblmemDiscount, $intDiscountable, $intdiscounttype, $dblquantity, $row["volDiscType"], $row["volume"], $dblVolSpecial, 0, 0, 0);
            $update = "update localtemptrans set voided = 20 where trans_id = " . $intItemNum;
            $connection = tDataConnect();
            sql_query($update, $connection);
            $_SESSION["TTLflag"] = 0;
            $_SESSION["TTLRequested"] = 0;
            lastpage();
        }
    }
}
コード例 #9
0
ファイル: cart.php プロジェクト: JohnLeMieux/CellStore
/**
 * The structure of the page.
 *
 * $title The title of the page
 */
function main($title = "")
{
    $db = new DB();
    if (isset($_REQUEST['add'])) {
        $pid = $_REQUEST['add'];
        addItem($db, $pid);
    } else {
        if (isset($_REQUEST['del'])) {
            $pid = $_REQUEST['del'];
            deleteItem($db, $pid);
        } else {
            if (isset($_REQUEST['update'])) {
                $pid = $_REQUEST['update'];
                updateItem($db, $pid);
            }
        }
    }
    $other = getJavaScript();
    include "includes/header.php";
    showContent($title, $db);
    include "includes/footer.php";
}
コード例 #10
0
ファイル: module.php プロジェクト: astorm/pestle
/**
* Generates a Magento 2.1 ui grid listing and support classes.
*
* @command magento2:generate:ui:add-column-actions
* @argument listing_file Which Listing File? []
* @argument index_field Index Field/Primary Key? [entity_id]
*/
function pestle_cli($argv)
{
    $xml = simplexml_load_file($argv['listing_file']);
    validateAsListing($xml);
    $actionsClass = generatePageActionsClassFromListingXmlFileAndXml($argv['listing_file'], $xml);
    $columns = getOrCreateColumnsNode($xml);
    $actionsColumn = $columns->addChild('actionsColumn');
    $actionsColumn->addAttribute('name', 'actions');
    $actionsColumn->addAttribute('class', $actionsClass);
    $argument = addArgument($actionsColumn, 'data', 'array');
    $configItem = addItem($argument, 'config', 'array');
    $indexField = addItem($configItem, 'indexField', 'string', $argv['index_field']);
    output(formatXmlString($xml->asXml()));
    // <actionsColumn name="actions" class="Pulsestorm\ToDoCrud\Ui\Component\Listing\Column\Pulsestormtodolisting\PageActions">
    //     <argument name="data" xsi:type="array">
    //         <item name="config" xsi:type="array">
    //             <item name="resizeEnabled" xsi:type="boolean">false</item>
    //             <item name="resizeDefaultWidth" xsi:type="string">107</item>
    //             <item name="indexField" xsi:type="string">pulsestorm_todocrud_todoitem_id</item>
    //         </item>
    //     </argument>
    // </actionsColumn>
}
コード例 #11
0
ファイル: functions_pmt.php プロジェクト: relaismago/outils
function createXml($elements)
{
    // Trie les objets par nom
    usort($elements, "sortByName");
    // Création du fichier xml
    $dom = getDom();
    // Ajout de l'élément root
    $root = $dom->createElement("Elements");
    $dom->appendChild($root);
    // Ajoute tous les objets
    foreach ($elements as $element) {
        addItem($element, $dom);
    }
    // Sauvegarde le fichier xml en conservant l'indentation
    $dom->formatOutput = true;
    $dom->save("tanieres/" . removeInvalidChar($elements[0][2]) . ".xml");
}
コード例 #12
0
ファイル: upcscanned.php プロジェクト: WedgeCoop/IS4C
function upcscanned($entered)
{
    $hitareflag = 0;
    $entered = str_replace(".", " ", $entered);
    if (strlen($entered) == 0 || !$entered) {
        lastpage();
    } else {
        if ($_SESSION["quantity"] == 0 && $_SESSION["multiple"] == 0) {
            $quantity = 1;
        } else {
            $quantity = $_SESSION["quantity"];
        }
    }
    $scaleprice = 0;
    if (substr($entered, 0, 1) == 0 && strlen($entered) == 7) {
        $p6 = substr($entered, -1);
        if ($p6 == 0) {
            $entered = substr($entered, 0, 3) . "00000" . substr($entered, 3, 3);
        } elseif ($p6 == 1) {
            $entered = substr($entered, 0, 3) . "10000" . substr($entered, 3, 3);
        } elseif ($p6 == 2) {
            $entered = substr($entered, 0, 3) . "20000" . substr($entered, 3, 3);
        } elseif ($p6 == 3) {
            $entered = substr($entered, 0, 4) . "00000" . substr($entered, 4, 2);
        } elseif ($p6 == 4) {
            $entered = substr($entered, 0, 5) . "00000" . substr($entered, 5, 1);
        } else {
            $entered = substr($entered, 0, 6) . "0000" . $p6;
        }
    }
    if (strlen($entered) == 13 && substr($entered, 0, 1) != 0) {
        $upc = "0" . substr($entered, 0, 12);
    } else {
        $upc = substr("0000000000000" . $entered, -13);
    }
    if (substr($upc, 0, 3) == "002") {
        $scaleprice = truncate2(substr($upc, -4) / 100);
        $upc = substr($upc, 0, 8) . "00000";
    }
    $query = "select * from products where upc = '" . $upc . "' AND inUse = 1";
    $db = pDataConnect();
    $result = sql_query($query, $db);
    $num_rows = sql_num_rows($result);
    $row = sql_fetch_array($result);
    $normal_price = $row["normal_price"];
    $special_price = $row["special_price"];
    $cost = 0;
    $deposit = $row["deposit"];
    $dept = $row["department"];
    if ($num_rows == 0 && substr($upc, 0, 3) != "005") {
        $fconn = tDataconnect();
        $datetimestamp = strftime("%Y-%m-%d %H:%M:%S %p", time());
        $inserterror = "insert into failedscans select " . $upc . " as upc, " . $_SESSION["laneno"] . " as lane_no, " . $_SESSION["CashierNo"] . " as emp_no, " . $_SESSION["transno"] . " as trans_no, " . "'" . $datetimestamp . "' as fdate";
        mysql_query($inserterror, $fconn);
        boxMsg($upc . "<br /><b>is not a valid item</b>");
    } elseif ($num_rows == 0 && substr($upc, 0, 3) == "005") {
        couponcode($upc);
    } elseif (($dept == 19 || $dept == 20) && $_SESSION["store"] == "rvm" && $_SESSION["msgrepeat"] == 0 && $_SESSION["carded"] == 0) {
        if ($_SESSION["bdaystatus"] == 99) {
            $boxMsg = "<b>Enter date of birth from valid ID</b><br />in the form mmddyyyy<p><font size=-1>[Clear] to cancel</font></p>";
        }
        if ($_SESSION["bdaystatus"] == -1) {
            $boxMsg = "<b>Invalid date of birth</b><br />re-enter in the form mmddyyyy<p><font size=-1>[Clear] to cancel</font></p>";
        }
        if ($_SESSION["bdaystatus"] == 0) {
            $boxMsg = "<b>Sales of item declined</b><p><font size=-1>[Clear] to cancel</font></p>";
        }
        $_SESSION["boxMsg"] = $boxMsg;
        bdBoxMsgScreen();
    } elseif ($row["scale"] != 0 && $_SESSION["weight"] == 0 && $_SESSION["quantity"] == 0) {
        if ($_SESSION["wgtRequested"] == 0) {
            $_SESSION["wgtRequested"] = 1;
            lastpage();
            echo "<script type=\"text/javascript\">\n" . "lockScreen = setTimeout('document.forms[0].elements[0].value = \"" . $_SESSION["strEntered"] . "\"; document.forms[0].submit();', 700)\n" . "</script>";
        } else {
            $_SESSION["SNR"] = 1;
            boxMsg("please put item on scale");
            $_SESSION["wgtRequested"] = 0;
        }
    } elseif ($row["scale"] != 0 && $_SESSION["scale"] == 0) {
        $_SESSION["waitforScale"] = 1;
        $_SESSION["SNR"] = 1;
        lastpage();
    } elseif ($row["scale"] == 0 && (int) $_SESSION["quantity"] != $_SESSION["quantity"] && $_SESSION["fractions"] != 1) {
        boxMsg("fractional quantity cannot be accepted for this item");
    } elseif ($_SESSION["itemDiscount"] < 0 || $_SESSION["itemDiscount"] > 65) {
        xboxMsg("item cannot be<br />discounted at " . $_SESSION["itemDiscount"] . "%");
        $_SESSION["itemDiscount"] = 0;
    } else {
        $mixMatch = 0;
        $qttyEnforced = $row["qttyEnforced"];
        if ($qttyEnforced == 1 && $_SESSION["multiple"] == 0 && $_SESSION["msgrepeat"] == 0) {
            qttyscreen();
        } else {
            $_SESSION["qttyvalid"] = 1;
        }
        if ($_SESSION["qttyvalid"] != 1) {
            sql_close($db);
        } else {
            $upc = $row["upc"];
            $description = $row["description"];
            $description = str_replace("'", "", $description);
            $description = str_replace(",", "", $description);
            $transType = "I";
            $transsubType = "CA";
            $department = $row["department"];
            $unitPrice = $normal_price;
            $regPrice = $normal_price;
            $CardNo = $_SESSION["memberID"];
            if ($row["scale"] != 0) {
                $scale = 1;
            } else {
                $scale = 0;
            }
            if ($row["tax"] != 0 && $_SESSION["toggletax"] == 0) {
                $tax = $row["tax"];
            } elseif ($row["tax"] != 0 && $_SESSION["toggletax"] != 0) {
                $tax = 0;
                $_SESSION["toggletax"] = 0;
            } elseif ($row["tax"] == 0 && $_SESSION["toggletax"] != 0) {
                $tax = $_SESSION["toggletax"];
                $_SESSION["toggletax"] = 0;
            } else {
                $tax = 0;
            }
            if ($row["foodstamp"] != 0 && $_SESSION["togglefoodstamp"] == 0) {
                $foodstamp = 1;
            } elseif ($row["foodstamp"] != 0 && $_SESSION["togglefoodstamp"] == 1) {
                $foodstamp = 0;
                $_SESSION["togglefoodstamp"] = 0;
            } elseif ($row["foodstamp"] == 0 && $_SESSION["togglefoodstamp"] == 1) {
                $foodstamp = 1;
                $_SESSION["togglefoodstamp"] = 0;
            } else {
                $foodstamp = 0;
            }
            if ($scale == 1) {
                $hitareflag = 0;
                if ($_SESSION["quantity"] != 0) {
                    $quantity = $_SESSION["quantity"] - $_SESSION["tare"];
                } else {
                    $quantity = $_SESSION["weight"] - $_SESSION["tare"];
                }
                if ($quantity <= 0) {
                    $hitareflag = 1;
                }
                $_SESSION["tare"] = 0;
            }
            $discounttype = nullwrap($row["discounttype"]);
            $discountable = $row["discount"];
            $sale_price = $row["special_price"];
            if ($_SESSION["itemDiscount"] > 0 && $_SESSION["itemDiscount"] < 65 && $discounttype != 0) {
                $discountable = 1;
                $special_price = number_format($sale_price * (100 - $_SESSION["itemDiscount"]) / 100, 2);
                $_SESSION["itemDiscount"] = 0;
            } elseif ($_SESSION["itemDiscount"] > 0 && $_SESSION["itemDiscount"] < 65) {
                $discountable = 1;
                $discounttype = 1;
                $special_price = number_format($normal_price * (100 - $_SESSION["itemDiscount"]) / 100, 2);
                $_SESSION["itemDiscount"] = 0;
            }
            if ($_SESSION["toggleDiscountable"] == 1) {
                $_SESSION["toggleDiscountable"] = 0;
                if ($discountable != 0) {
                    $discountable = 0;
                } else {
                    $discountable = 1;
                }
            }
            if ($_SESSION["nd"] == 1 && $discountable == 7) {
                $discountable = 3;
                $_SESSION["nd"] = 0;
            }
            if ($discounttype == 2 || $discounttype == 4) {
                $memDiscount = truncate2($normal_price * $quantity) - truncate2($special_price * $quantity);
                $discount = 0;
                $unitPrice = $normal_price;
            } elseif ($discounttype == 1) {
                $unitPrice = $special_price;
                $unitDiscount = $normal_price - $special_price;
                $discount = $unitDiscount * $quantity;
                $memDiscount = 0;
            } else {
                $unitPrice = $normal_price;
                $discount = 0;
                $memDiscount = 0;
            }
            if ($_SESSION["isMember"] == 1 && $discounttype == 2) {
                $unitPrice = nullwrap($special_price);
            }
            if ($_SESSION["isStaff"] != 0 && $discounttype == 4) {
                $unitPrice = nullwrap($special_price);
            }
            if ($_SESSION["casediscount"] > 0 && $_SESSION["casediscount"] <= 100) {
                $casediscount = (100 - $_SESSION["casediscount"]) / 100;
                $unitPrice = $casediscount * $unitPrice;
            }
            //-------------Mix n Match -------------------------------------
            $matched = 0;
            $VolSpecial = nullwrap($row["groupprice"]);
            $volDiscType = nullwrap($row["pricemethod"]);
            $volume = nullwrap($row["quantity"]);
            if ($row["advertised"] != 0) {
                if ($row["discounttype"] == 2 && $_SESSION["isMember"] == 1 || $row["discounttype"] != 2) {
                    $VolSpecial = nullwrap($row["specialgroupprice"]);
                    $volDiscType = nullwrap($row["specialpricemethod"]);
                    $volume = nullwrap($row["specialquantity"]);
                }
            }
            if ($volDiscType && $volDiscType >= 1) {
                // If item is on volume discount
                if (!$row["mixmatchcode"] || $row["mixmatchcode"] == 0) {
                    $mixMatch = 0;
                    $queryt = "select sum(ItemQtty - matched) as mmqtty from localtemptrans where " . "upc = '" . $row["upc"] . "' group by upc";
                } else {
                    $mixMatch = $row["mixmatchcode"];
                    $queryt = "select sum(ItemQtty - matched) as mmqtty, mixMatch from localtemptrans " . "where mixMatch = '" . $mixMatch . "' group by mixMatch";
                }
                if ($volDiscType == 1) {
                    $unitPrice = truncate2($VolSpecial / $volume);
                }
                $voladj = $VolSpecial - ($volume - 1) * $unitPrice;
                // one at special price
                $newmm = (int) ($quantity / $volume);
                // number of complete sets
                $dbt = tDataConnect();
                $resultt = sql_query($queryt, $dbt);
                $num_rowst = sql_num_rows($resultt);
                if ($num_rowst > 0) {
                    $rowt = sql_fetch_array($resultt);
                    $mmqtty = $rowt["mmqtty"];
                    // number not in complete sets in localtemptrans
                } else {
                    $mmqtty = 0;
                }
                $newmmtotal = $mmqtty + $quantity % $volume;
                $na = $newmmtotal % $volume;
                $quantity = $quantity % $volume;
                if ($newmm >= 1) {
                    addItem($upc, $description, "I", "", "", $department, $cost, $newmm, truncate2($VolSpecial), truncate2($newmm * $VolSpecial), truncate2($VolSpecial), $scale, $tax, $foodstamp, $discount, $memDiscount, $discountable, $discounttype, $volume * $newmm, $volDiscType, $volume, $VolSpecial, $mixMatch, $volume * $newmm, 0, 0, '');
                    $newmm = 0;
                    $_SESSION["qttyvalid"] = 0;
                }
                if ($newmmtotal >= $volume) {
                    addItem($upc, $description, "I", "", "", $department, $cost, 1, $voladj, $voladj, $voladj, $scale, $tax, $foodstamp, $discount, $memDiscount, $discountable, $discounttype, 1, $volDiscType, $volume, $VolSpecial, $mixMatch, $volume, 0, 0, '');
                    $quantity = $quantity - 1;
                    $newmmtotal = 0;
                    $_SESSION["qttyvalid"] = 0;
                }
                sql_close($dbt);
            }
            $total = $unitPrice * $quantity;
            if (substr($upc, 0, 3) == "002" and $discounttype != 2) {
                $unitPrice = truncate2($scaleprice);
                $regPrice = $total;
                $total = $unitPrice * $quantity;
            }
            $total = truncate2($total);
            $unitPrice = truncate2($unitPrice);
            if ($upc == "0000000008010" && $_SESSION["msgrepeat"] == 0) {
                $_SESSION["endorseType"] = "giftcert";
                $_SESSION["tenderamt"] = $total;
                $_SESSION["boxMsg"] = "<b>" . $total . " gift certificate</b><br />insert document<br />press [enter] to endorse<p><font size='-1'>[clear] to cancel</font></p>";
                boxMsgscreen();
            } elseif ($upc == "0000000008006" && $_SESSION["msgrepeat"] == 0) {
                $_SESSION["endorseType"] = "stock";
                $_SESSION["tenderamt"] = $total;
                $_SESSION["boxMsg"] = "<B>" . $total . " stock payment</B><br />insert form<br />press [enter] to endorse<P><FONT size='-1'>[clear] to cancel</FONT>";
                boxMsgscreen();
            } elseif ($upc == "0000000008011" && $_SESSION["msgrepeat"] == 0) {
                $_SESSION["endorseType"] = "classreg";
                $_SESSION["tenderamt"] = $total;
                $_SESSION["boxMsg"] = "<b>" . $total . " class registration</b><br />insert form<br />press [enter] to endorse<p><font size='-1'>[clear] to cancel</font></p>";
                boxMsgscreen();
            } elseif ($hitareflag == 1) {
                boxMsg("item weight must be greater than tare weight");
            } else {
                if ($quantity != 0) {
                    $qtty = $quantity;
                    if ($scale == 1) {
                        goodBeep();
                    }
                    if ($_SESSION["casediscount"] > 0) {
                        addcdnotify();
                        $discounttype = 3;
                        $_SESSION["casediscount"] = 0;
                        $quantity = 1;
                        $unitPrice = $total;
                        $regPrice = $total;
                    }
                    if ($_SESSION["ddNotify"] == 1 && $_SESSION["itemPD"] == 10) {
                        $_SESSION["itemPD"] = 0;
                        $discountable = 7;
                    }
                    if ($_SESSION["ddNotify"] == 1 && $discountable == 7) {
                        $intvoided = 22;
                    } else {
                        $intvoided = 0;
                    }
                    addItem($upc, $description, "I", " ", " ", $department, $cost, $quantity, $unitPrice, $total, $regPrice, $scale, $tax, $foodstamp, $discount, $memDiscount, $discountable, $discounttype, $qtty, $volDiscType, $volume, $VolSpecial, $mixMatch, $matched, $intvoided, 0, '');
                    $_SESSION["msgrepeat"] = 0;
                    $_SESSION["qttyvalid"] = 0;
                }
            }
            if ($deposit && $deposit > 0) {
                addDeposit($quantity, $deposit, $foodstamp);
            }
            if ($tax == 1) {
                $_SESSION["istaxable"] = 1;
            } else {
                $_SESSION["istaxable"] = 0;
                $_SESSION["voided"] = 0;
            }
            if ($discounttype == 1) {
                $_SESSION["ondiscount"] = 1;
                $_SESSION["voided"] = 2;
                adddiscount($discount);
            } elseif ($discounttype == 2 && $_SESSION["isMember"] == 1) {
                $_SESSION["ondiscount"] = 1;
                $_SESSION["voided"] = 2;
                addmemspecialmsg();
            } elseif ($discounttype == 4 && $_SESSION["isStaff"] != 0) {
                $_SESSION["ondiscount"] = 1;
                $_SESSION["voided"] = 2;
                adddiscount($memDiscount);
            } else {
                $_SESSION["ondiscount"] = 0;
                $_SESSION["voided"] = 0;
            }
            if ($_SESSION["tare"] != 0) {
                $_SESSION["tare"] = 0;
            }
            $_SESSION["alert"] = "";
            $_SESSION["ttlflag"] = 0;
            $_SESSION["ttlrequested"] = 0;
            $_SESSION["fntlflag"] = 0;
            $_SESSION["togglefoodstamp"] = 0;
            $_SESSION["toggletax"] = 0;
            $_SESSION["repeat"] = 1;
            setglobalflags(0);
            if ($hitareflag != 1) {
                lastpage();
            }
        }
    }
    $_SESSION["quantity"] = 0;
    $_SESSION["itemPD"] = 0;
}
コード例 #13
0
    require_once dirname(dirname(dirname(__FILE__))) . '/' . PLUGIN_FOLDER . '/zenpage/admin-functions.php';
}
require_once dirname(__FILE__) . '/menu_manager-admin-functions.php';
admin_securityChecks(NULL, currentRelativeURL());
$page = 'edit';
$result = NULL;
$reports = array();
if (isset($_GET['id'])) {
    $result = getItem(sanitize($_GET['id']));
}
if (isset($_GET['save'])) {
    XSRFdefender('update_menu');
    if ($_POST['update']) {
        $result = updateMenuItem($reports);
    } else {
        $result = addItem($reports);
    }
}
if (isset($_GET['del'])) {
    XSRFdefender('delete_menu');
    deleteItem($reports);
}
printAdminHeader('menu', is_array($result) && $result['id'] ? gettext('edit') : gettext('add'));
?>
<link rel="stylesheet" href="../zenpage/zenpage.css" type="text/css" />
<?php 
$menuset = checkChosenMenuset();
?>
</head>
<body>
	<?php 
コード例 #14
0
ファイル: cart.php プロジェクト: dpecos/npshop
            update_cart($cart);
        }
    } else {
        deleteItem($itemId);
    }
}
function deleteItem($itemId)
{
    $item = new Item($itemId);
    $cart = get_cart();
    $cart->deleteItem($item);
    update_cart($cart);
}
if (isset($_REQUEST['action'])) {
    if ($_REQUEST['action'] == "add") {
        addItem($_REQUEST['itemId']);
    } else {
        if ($_REQUEST['action'] == "delete") {
            deleteItem($_REQUEST['itemId']);
        } else {
            if ($_REQUEST['action'] == "update" || $_REQUEST['action'] == "update_confirm" || $_REQUEST['action'] == "update_continue") {
                //print_r($_REQUEST);
                $cart = get_cart();
                foreach ($cart->items as $itemId => $item) {
                    if (isset($_REQUEST[$itemId . "_id"]) && isset($_REQUEST[$itemId . "_quantity"])) {
                        modifyItem($_REQUEST[$itemId . "_id"], $_REQUEST[$itemId . "_quantity"]);
                    }
                }
                if (count($errors) != 0) {
                    $errorMsg = _("No se pudo actualizar el carrito correctamente.");
                }
コード例 #15
0
ファイル: void.php プロジェクト: WedgeCoop/IS4C
function voidupc($upc)
{
    $lastpageflag = 1;
    $deliflag = 0;
    if (strpos($upc, "*") && (strpos($upc, "**") || strpos($upc, "*") == 0 || strpos($upc, "*") == strlen($upc) - 1)) {
        $upc = "stop";
    } elseif (strpos($upc, "*")) {
        $voidupc = explode("*", $upc);
        if (!is_numeric($voidupc[0])) {
            $upc = "stop";
        } else {
            $quantity = $voidupc[0];
            $upc = $voidupc[1];
            $weight = 0;
        }
    } elseif (!is_numeric($upc) && !strpos($upc, "DP")) {
        $upc = "stop";
    } else {
        $quantity = 1;
        $weight = $_SESSION["weight"];
    }
    if (is_numeric($upc)) {
        $upc = substr("0000000000000" . $upc, -13);
        if (substr($upc, 0, 3) == "002" && substr($upc, -5) != "00000") {
            $scaleprice = substr($upc, 10, 4) / 100;
            $upc = substr($upc, 0, 8) . "0000";
            $deliflag = 1;
        } elseif (substr($upc, 0, 3) == "002" && substr($upc, -5) == "00000") {
            $scaleprice = $_SESSION["scaleprice"];
            $deliflag = 1;
        }
    }
    if ($upc == "stop") {
        inputUnknown();
    } else {
        $db = tDataConnect();
        if ($_SESSION["discounttype"] == 3) {
            $query = "select sum(quantity) as voidable, max(scale), as scale, max(volDiscType) as volDiscType " . "from localtemptrans where upc = '" . $upc . "' and discounttype = 3 and unitPrice = " . $_SESSION["caseprice"] . " group by upc";
        } elseif ($deliflag == 0) {
            $query = "select sum(ItemQtty) as voidable, sum(quantity) as vquantity, max(scale) as scale, " . "max(volDiscType) as volDiscType from localtemptrans where upc = '" . $upc . "' and discounttype <> 3 group by upc, discounttype";
        } else {
            $query = "select sum(ItemQtty) as voidable, sum(quantity) as vquantity, max(scale) as scale, " . "max(volDiscType) as volDiscType from localtemptrans where upc = '" . $upc . "' and unitPrice = " . $scaleprice . " and discounttype <> 3 group by upc";
        }
        if ($_SESSION["ddNotify"] == 1) {
            $query = "select sum(ItemQtty) as voidable, sum(quantity) as vquantity, max(scale) as scale, " . "max(volDiscType) as volDiscType from localtemptrans where upc = '" . $upc . "' and discounttype <> 3 and discountable = " . $_SESSION["discountable"] . " group by upc, discounttype, discountable";
        }
        $result = sql_query($query, $db);
        $num_rows = sql_num_rows($result);
        if ($num_rows == 0) {
            boxMsg("Item not found");
        } else {
            $row = sql_fetch_array($result);
            if ($row["scale"] == 1 && $weight > 0) {
                $quantity = $weight - $_SESSION["tare"];
                $_SESSION["tare"] = 0;
            }
            $volDiscType = $row["volDiscType"];
            $voidable = nullwrap($row["voidable"]);
            $VolSpecial = 0;
            $volume = 0;
            $scale = nullwrap($row["scale"]);
            if ($voidable == 0 && $quantity == 1) {
                boxMsg("Items already voided");
            } elseif ($voidable == 0 && $quantity > 1) {
                boxMsg("Items already voided");
            } elseif ($scale == 1 && $quantity < 0) {
                boxMsg("tare weight cannot be greater than item weight");
            } elseif ($voidable < $quantity && $row["scale"] == 1) {
                $message = "Void request exceeds<br />weight of item rung in<p><b>You can void up to " . $row["voidable"] . " lb</b></p>";
                boxMsg($message);
            } elseif ($voidable < $quantity) {
                $message = "Void request exceeds<br />number of items rung in<p><b>You can void up to " . $row["voidable"] . "</b></p>";
                boxMsg($message);
            } else {
                unset($result);
                //--------------------------------Void Item----------------------------
                if ($_SESSION["discounttype"] == 3) {
                    $query_upc = "select * from localtemptrans where upc = '" . $upc . "' and discounttype = 3 and unitPrice = " . $_SESSION["caseprice"];
                } elseif ($deliflag == 0) {
                    $query_upc = "select * from localtemptrans where upc = '" . $upc . "' and discounttype <> 3";
                } else {
                    $query_upc = "select * from localtemptrans where upc = '" . $upc . "' and unitPrice = " . $scaleprice;
                }
                $_SESSION["discounttype"] = 9;
                $result = sql_query($query_upc, $db);
                $row = sql_fetch_array($result);
                $ItemQtty = $row["ItemQtty"];
                $foodstamp = nullwrap($row["foodstamp"]);
                $discounttype = nullwrap($row["discounttype"]);
                $mixMatch = nullwrap($row["mixMatch"]);
                if ($_SESSION["isMember"] != 1 && $row["discounttype"] == 2 || $_SESSION["isStaff"] == 0 && $row["discounttype"] == 4) {
                    $unitPrice = $row["regPrice"];
                } elseif (($_SESSION["isMember"] == 1 && $row["discounttype"] == 2 || $_SESSION["isStaff"] != 0 && $row["discounttype"] == 4) && $row["unitPrice"] == $row["regPrice"]) {
                    $db_p = pDataConnect();
                    $query_p = "select * from products where upc = '" . $upc . "'";
                    $result_p = sql_query($query_p, $db_p);
                    $row_p = sql_fetch_array($result_p);
                    $unitPrice = $row_p["special_price"];
                    sql_close($db_p);
                } else {
                    $unitPrice = $row["unitPrice"];
                }
                $discount = -1 * $row["discount"];
                $memDiscount = -1 * $row["memDiscount"];
                $discountable = $row["discountable"];
                $cost = 0;
                if ($_SESSION["ddNotify"] == 1) {
                    $discountable = $_SESSION["discountable"];
                }
                //----------------------mix match---------------------
                if ($volDiscType >= 1) {
                    $db_mm = tDataConnect();
                    $query_mm = "select sum(ItemQtty) as mmqtty from localtemptrans where mixMatch = " . $mixMatch;
                    $result_mm = sql_query($query_mm, $db_mm);
                    $row_mm = sql_fetch_array($result_mm);
                    $mmqtty = nullwrap($row_mm["mmqtty"]);
                    sql_close($db_mm);
                    $db_pq = pDataConnect();
                    $query_pq = "select * from products where upc = '" . $upc . "'";
                    $result_pq = sql_query($query_pq, $db_pq);
                    $row_pq = sql_fetch_array($result_pq);
                    if ($volDiscType == 1) {
                        $unitPrice = truncate2($row_pq["groupprice"] / $row_pq["quantity"]);
                    } elseif ($discounttype == 1) {
                        $unitPrice = $row_pq["special_price"];
                        $VolSpecial = nullwrap($row_pq["specialgroupprice"]);
                    } else {
                        $unitPrice = $row_pq["normal_price"];
                        $VolSpecial = nullwrap($row_pq["groupprice"]);
                    }
                    if ($row_pq["advertised"] == 0) {
                        $volume = nullwrap($row_pq["quantity"]);
                    } else {
                        $volume = nullwrap($row_pq["specialquantity"]);
                    }
                    sql_close($db_pq);
                    $volmulti = (int) ($quantity / $volume);
                    $vmremainder = $quantity % $volume;
                    if ($mixMatch == 0) {
                        $mm = (int) ($voidable / $volume);
                        $mmremainder = $voidable % $volume;
                    } else {
                        $mm = (int) ($mmqtty / $volume);
                        $mmremainder = $mmqtty % $volume;
                    }
                    if ($volmulti > 0) {
                        addItem($upc, $row["description"], $row["trans_type"], $row["trans_subtype"], "V", $row["department"], $cost, -1 * $volmulti, $VolSpecial, -1 * $volmulti * $VolSpecial, $VolSpecial, 0, $row["tax"], $foodstamp, $discount, $memDiscount, $discountable, $discounttype, -1 * $volmulti * $volume, $volDiscType, $volume, $VolSpecial, $mixMatch, -1 * $volume * $volmulti, 1, 0, '');
                        $quantity = $vmremainder;
                    }
                    if ($vmremainder > $mmremainder) {
                        $voladj = $row["VolSpecial"] - $unitPrice * ($volume - 1);
                        addItem($upc, $row["description"], $row["trans_type"], $row["trans_subtype"], "V", $row["department"], $cost, -1, $voladj, -1 * $voladj, $voladj, 0, $row["tax"], $foodstamp, $discount, $memDiscount, $discountable, $discounttype, -1, $volDiscType, $volume, $VolSpecial, $mixMatch, -1 * $volume, 1, 0, '');
                        $quantity = $quantity - 1;
                    }
                }
                $quantity = -1 * $quantity;
                $total = truncate2($quantity * $unitPrice);
                $CardNo = $_SESSION["memberID"];
                $discounttype = nullwrap($row["discounttype"]);
                if ($discounttype == 3) {
                    $quantity = -1 * $ItemQtty;
                }
                if ($_SESSION["tenderTotal"] < 0 && $foodstamp == 1 && -1 * $total > $_SESSION["fsEligible"]) {
                    boxMsg("Item already paid for");
                    $lastpageflag = 0;
                } elseif ($_SESSION["tenderTotal"] < 0 && -1 * $total > $_SESSION["runningTotal"] - $_SESSION["taxTotal"]) {
                    boxMsg("Item already paid for");
                    $lastpageflag = 0;
                } elseif ($quantity != 0) {
                    addItem($upc, $row["description"], $row["trans_type"], $row["trans_subtype"], "V", $row["department"], $cost, $quantity, $unitPrice, $total, $row["regPrice"], $scale, $row["tax"], $foodstamp, $discount, $memDiscount, $discountable, $discounttype, $quantity, $volDiscType, $volume, $VolSpecial, $mixMatch, 0, 1, 0, '');
                    if ($row["trans_type"] != "T") {
                        $_SESSION["ttlflag"] = 0;
                        $_SESSION["ttlrequested"] = 0;
                        $_SESSION["discounttype"] = 0;
                    }
                }
                if ($lastpageflag == 1) {
                    lastpage();
                } else {
                    $lastpageflag = 1;
                }
            }
        }
    }
}
コード例 #16
0
ファイル: attack_npc.php プロジェクト: ninjajerry/ninjawars
                                 if (!subtractHealth($username, $thief_attack)) {
                                     echo "Thief has slain you!<br>\n";
                                     echo "Go to the <a href=\"shrine.php\">shrine</a> to resurrect.<br>\n";
                                 } else {
                                     $thief_gold = rand(0, 40);
                                     // *** Thief Gold ***
                                     if ($thief_attack > 30) {
                                         echo "Thief escaped and stole {$thief_gold} pieces of your gold!\n";
                                         subtractGold($username, $thief_gold);
                                     } else {
                                         if ($thief_attack < 30) {
                                             echo "The Thief is injured!<br>\n";
                                             echo "Thief does {$thief_attack} points of damage!<br>\n";
                                             echo "You have gained {$thief_gold} gold.<br> You have found a Shuriken on the thief!\n";
                                             addGold($username, $thief_gold);
                                             addItem($username, 'Shuriken', $quantity = 1);
                                         }
                                     }
                                     echo "<br>\n";
                                     echo "Beware the Ninja Thieves, they have entered this world to steal from all!<br>\n";
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
 if (getHealth($username) <= 0) {
     sendMessage("SysMsg", $username, "DEATH: You have been killed by a non-player character at {$today}");
コード例 #17
0
<?php

require_once "inc/db.php";
require_once "inc/functions.php";
if (isset($_POST['title']) && isset($_POST['year']) && isset($_POST['format']) && isset($_POST['cast'])) {
    $title = clear($_POST['title']);
    $year = clear($_POST['year']);
    if (!preg_match('/(1|2)[0-9]{3}/', $year)) {
        $year = date("Y");
    }
    $format = clear($_POST['format']);
    $cast = explode(",", clear($_POST['cast']));
    foreach ($cast as $key => $value) {
        $trimmed = trim($value);
        $pieces = explode(" ", $trimmed);
        $surname = array_pop($pieces);
        $name = implode(" ", $pieces);
        $cast[$key] = [$name, $surname];
    }
    addItem($db, $title, $year, $format, $cast);
    header("Location: index.php");
} else {
    header("Location: index.php");
    exit;
}
コード例 #18
0
require "../block_funcs.php";
if (isset($_POST['addAutorsToBook'])) {
    $autorCount = $_POST['autorCount'];
    $bookTitle = $_POST['bookTitle'];
    if (empty($bookTitle)) {
        $_SESSION['BookMessage'] = "Не введено название!";
        LocalRedirect("add_book.php");
    }
    if ($autorCount > 0) {
        if (isset($_POST['saveBookInfo'])) {
            $bookId = addNewBook($bookTitle);
            for ($i = 0; $i < $autorCount; $i++) {
                $newAutor = "autor" . $i;
                $autorId = $_POST[$newAutor];
                $add = array('UF_ID_AUTOR' => $autorId, 'UF_ID_BOOK' => $bookId);
                $result = addItem(3, $add);
            }
            LocalRedirect("/books/");
        }
        $autors = getList(1, array('ID', 'UF_NAME'), array('UF_NAME' => 'ASC'), null);
        ?>
        <form name="addAutors" action="" method="post">
            <div class="ListItem">
                <?php 
        for ($i = 0; $i < $autorCount; $i++) {
            echo "<p class='Text'><b>Автор:</b> <select name='autor" . $i . "'>";
            foreach ($autors as $autor) {
                echo "<option value='" . $autor['ID'] . "'>" . $autor['UF_NAME'] . "</option>";
            }
            echo "</select></p>";
        }
コード例 #19
0
session_start();
extract($_REQUEST);
//check for required variables
if (!isset($action)) {
    $resp = array("status" => "fail", "reason" => "please send an action");
    echo json_encode($resp);
    return;
}
if (!isset($userId)) {
    $resp = array("status" => "fail", "reason" => "no user id");
    echo json_encode($resp);
    return;
}
switch ($action) {
    case "add":
        $resp = addItem($inputArr);
        echo json_encode($resp);
        break;
    case "remove":
        $resp = deleteItem($itemId);
        echo json_encode($resp);
        break;
    case "get":
        $resp = getItems($photoId);
        echo json_encode($resp);
        break;
    default:
        $resp = array("status" => "fail", "reason" => "please send a valid action");
        echo json_encode($resp);
        break;
}
コード例 #20
0
ファイル: budget.php プロジェクト: hxghxg527/FamilyDecoration
     $isParseResut = false;
     break;
     //获取预算所有条目
 //获取预算所有条目
 case "itemlist":
     $res = getBudgetItemsByBudgetId($_REQUEST["budgetId"]);
     break;
     //添加预算
 //添加预算
 case "add":
     $res = addBudget($_REQUEST);
     break;
     //添加小项
 //添加小项
 case "addItem":
     $res = addItem($_REQUEST);
     break;
     //添加大项
 //添加大项
 case "addBigItem":
     $res = addBigItem($_REQUEST);
     break;
     //删除项,不区分大项,小项
 //删除项,不区分大项,小项
 case "delItem":
     $res = delItem($_REQUEST['budgetItemId']);
     break;
     //修改项,不区分大项,小项
 //修改项,不区分大项,小项
 case "editItem":
     $res = editItem($_REQUEST);
コード例 #21
0
ファイル: casino.php プロジェクト: ninjajerry/ninjawars
<hr>

<?php 
$bet = intval(in('bet'));
$reward = "Fire Scroll";
echo "Welcome to the Casino, {$username}!<br>\n";
echo "<form id=\"coin_flip\" action=\"casino.php\" method=\"post\" name=\"coin_flip\">\n";
if ($bet >= 5 && $bet <= 1000) {
    if ($bet <= getGold($username)) {
        $answer = rand(1, 2);
        if ($answer == 1) {
            echo "<div class='ninja-notice'>You win!</div>\n";
            addGold($username, $bet);
            if ($bet == 1000) {
                addItem($username, $reward, 1);
            }
        } else {
            if ($answer == 2) {
                echo "<div class='ninja-notice'>You lose!</div>\n";
                subtractGold($username, $bet);
            }
        }
        echo "<br><a href=\"casino.php\">Try Again?</a><br>\n";
    } else {
        echo "You do not have that much gold.<br>\n";
    }
} else {
    echo "The minimum bet at this table is 5 gold.<br>\n";
    echo "The maximum bet at this table is 1,000 gold.<br>\n";
}
コード例 #22
0
		</div>
	</div>
<?php 
} elseif (isset($_GET['additem'])) {
    ?>

<!-- ADDING LINK -->
	<div class="content">	
		<div class="content-header">
			<h4><a href="?p=admin">Main Menu</a> / <a href="?p=admin&sub=shop">Shop Items</a> / ADD</h4>
		</div> <!-- .content-header -->				
		<div class="main-content">	
		<?php 
    if (isset($_POST['action'])) {
        if ($_POST['action'] == 'add') {
            addItem();
        }
    }
    ?>
			<form method="POST" action="?p=admin&sub=shop&additem=true" class="form label-inline">
			<input type="hidden" name="action" value="add">
			
			<!-- Item Number -->
			<div class="field">
				<label for="ItemNumber"><?php 
    echo $lang['item_number'];
    ?>
: </label>
				<input id="ItemNumber" name="item_number" size="20" type="text" class="medium" />
				<p class="field_help"><?php 
    echo $lang['item_number_desc'];
コード例 #23
0
ファイル: Item.php プロジェクト: TheProjecter/mylangnotebook
<?php

include_once "Database.php";
$cmd = isset($_REQUEST["cmd"]) ? $_REQUEST["cmd"] : false;
// no command?
if (!$cmd) {
    echo '{"success":false,"data" => array ( "msg" => "No command")';
    exit;
}
switch ($cmd) {
    case "add":
        @($nameItem = getRequest(INPUT_MOTHER));
        @($translationItem = getRequest(INPUT_FOREIGN));
        @($categoryItem = getRequest(INPUT_CATEGORY));
        if (addItem($nameItem, $translationItem, $categoryItem)) {
            $response = array("success" => true);
        } else {
            $response = array("success" => false, "data" => array("msg" => "Anything was wong!"));
        }
        break;
    case "del":
        $listItem = array();
        foreach ($_REQUEST as $id => $value) {
            if ($value == "on" && is_numeric($id)) {
                $listItem[] = $id;
            }
        }
        if (delelteItemsList($listItem)) {
            $response = array("success" => true);
        } else {
            $response = array("success" => false, "data" => array("msg" => "Anything was wong in del case!"));
コード例 #24
0
ファイル: mycart.php プロジェクト: samdubey/ADS
<?php

session_start();
$id = 2;
//<---dependent from the database
$name = 'natasha';
//<---dependent from the database
$q = 2;
//<---dependent from the user input
$p = 900.3;
//<---dependent from the database
$ord = array($id, $name, $q, $p, $q * $p);
addItem($ord);
//removeItem(0);
modifyItemValues(0, 3);
showItems();
//savetoDb();
//clearCart();
//method for adding item/s on the cart...
function addItem($order = array())
{
    if (is_array($_SESSION['cart'])) {
        array_push($_SESSION['cart'], $order);
        echo count($_SESSION['cart']) . " item/s added </br></br>";
    } else {
        $_SESSION['cart'] = array();
        array_push($_SESSION['cart'], $order);
        echo count($_SESSION['cart']) . " item/s added </br></br>";
    }
}
//method for querying items on the cart...
コード例 #25
0
ファイル: BuyItem.php プロジェクト: The-Nico26/Caranille
<?php

$timeStart = microtime(true);
session_start();
ob_start();
if (empty($_SESSION)) {
    exit(header("Location: ../../index.php"));
}
require_once $_SESSION['File_Root'] . '/Kernel/Include.php';
require_once $_SESSION['File_Root'] . '/HTML/Header.php';
require_once 'Functions/SQL.php';
redirectToLogin($accountID, $linkRoot);
redirectToBattle($verifyBattle, $linkRoot);
$itemID = htmlspecialchars(addslashes($_POST['itemID']));
$canBePurchased = canBePurchased($bdd, $itemID, $characterTownID);
if ($canBePurchased == 1) {
    $item = newItem($bdd, $itemID);
    if ($character->getGold() - $item->getPurchase() >= 0) {
        addItem($bdd, $itemID, $characterID);
        $gold = $character->getGold() - $item->getPurchase();
        updateCharacterGold($bdd, $gold, $characterID);
    } else {
        echo $itemShop14;
    }
} else {
    echo "An error has surved";
}
require_once $_SESSION['File_Root'] . '/HTML/Footer.php';
コード例 #26
0
ファイル: shop.php プロジェクト: ninjajerry/ninjawars
if (!$quantity || $quantity < 1) {
    $quantity = 1;
} else {
    if ($quantity > 1 && $item != "Shuriken") {
        $grammar = "s";
    }
}
$item_costs = array("Speed Scroll" => 225, "Fire Scroll" => 175, "Stealth Scroll" => 150, "Ice Scroll" => 125, "Shuriken" => 50);
if ($in_purchase == 1) {
    $current_item_cost = either($item_costs[$item], 0);
    $current_item_cost *= $quantity;
    if ($current_item_cost > $gold) {
        // Not enough gold.
        $description .= "<p>\"The total comes to {$current_item_cost} gold,\" the shopkeeper tells you.</p>";
        $description .= "<p>Unfortunately, you do not have that much gold.</p>";
    } else {
        // Has enough gold.
        addItem($username, $item, $quantity);
        $description .= "<p>The shopkeeper hands over {$quantity} " . $item . $grammar . ".</p>";
        $description .= "<p>\"Will you be needing anything else today?\" he asks you as he puts your gold in a safe.</p>";
        subtractGold($username, $current_item_cost);
    }
} else {
    // Default, before anything has been bought.
    $description .= "<p>You enter the village shop and the shopkeeper greets you with a watchful eye.</p>";
    $description .= "<p>As you browse his wares he says, \"Don't try anythin' you'd regret.\" and grins.</p>";
}
$parts = get_certain_vars(get_defined_vars(), array());
echo render_template('shop.tpl', $parts);
// Non-logged in template.
include SERVER_ROOT . "interface/footer.php";
コード例 #27
0
ファイル: podcast.php プロジェクト: BackupTheBerlios/sotf-svn
    writeTag($rss, "description", $queryText);
    writeTag($rss, "link", $config['rootUrl'] . "/advsearchresults.php?back=true&SQLquerySerial={$query}");
    //added slash - martin schmidt
    //$properties["language"]="en";
    $rss .= "\n<image>";
    writeTag($rss, "url", $config['rootUrl'] . "/static/sotflogosmall.gif");
    writeTag($rss, "link", $config['rootUrl']);
    writeTag($rss, "title", "Results of StreamOnTheFly query");
    // width, height
    $rss .= "\n</image>";
    $query = $advsearch->GetSQLCommand();
    $res = $db->limitQuery($query, 0, $items);
    $hits = array();
    while (DB_OK === $res->fetchInto($row)) {
        //$row['icon'] = sotf_Blob::cacheIcon($row['id']);
        $hits[] = $row;
    }
    foreach ($hits as $prog) {
        $prgObj =& $repository->getObject($prog['id']);
        addItem($rss, $prgObj);
    }
    $rss .= "\n</channel>";
} else {
    raiseError("Need a series or station id!");
}
$rss .= "\n</rss>";
// If the document was generated successfully, you may now output it.
Header("Content-Type: text/xml; charset=\"utf-8\"");
Header("Content-Length: " . strval(strlen($rss)));
echo $rss;
$page->logRequest();
コード例 #28
0
ファイル: 1058.php プロジェクト: rwruss/ib3
<?php

echo 'Process joining war ' . $postVals[1];
// Get player info
$unitFile = fopen($gamePath . '/unitDat.dat', 'r+b');
fseek($unitFile, $pGameID * $defaultBlockSize);
$playerDat = unpack('i*', fread($unitFile, $unitBlockSize));
// Get list of wars that players is in
$slotFile = fopen($gamePath . '/gameSlots.slt', 'rb');
$warList = new itemSlot($playerDat[32], $slotFile, 40);
$warList . addItem($postVals[1], $slotFile, $gamePath . '/gameSlots.slt');
$warList . save($slotFile);
fclose($slotFile);
fclose($unitFile);
コード例 #29
0
function updateObjectItems()
{
    if (isset($_REQUEST['Save'])) {
        # parameters check
        assertStringArg('name', false);
        assertUIntArg('type', true);
        assertStringArg('key_', false);
        assertUIntArg('value_type', true);
        $delay_flexStr = '';
        foreach ($_REQUEST['delay_flex'] as $delay_flex) {
            $delay_flexStr .= $delay_flex['delay'] . '/' . $delay_flex['period'] . ';';
        }
        $item = array('itemid' => $_REQUEST['item_id'], 'objectid' => $_REQUEST['objectid'], 'hostid' => $_REQUEST['hostid'], 'name' => $_REQUEST['name'], 'description' => $_REQUEST['description'], 'key_' => $_REQUEST['key_'], 'interfaceid' => $_REQUEST['interfaceid'], 'delay' => isset($_REQUEST['delay']) ? $_REQUEST['delay'] : 0, 'history' => isset($_REQUEST['history']) ? $_REQUEST['history'] : 90, 'status' => isset($_REQUEST['status']) ? $_REQUEST['status'] : 0, 'type' => isset($_REQUEST['type']) ? $_REQUEST['type'] : null, 'snmp_community' => $_REQUEST['snmp_community'], 'snmp_oid' => $_REQUEST['snmp_oid'], 'value_type' => isset($_REQUEST['value_type']) ? $_REQUEST['value_type'] : 0, 'trapper_hosts' => $_REQUEST['trapper_hosts'], 'port' => isset($_REQUEST['port']) ? $_REQUEST['port'] : null, 'units' => $_REQUEST['units'], 'multiplier' => isset($_REQUEST['multiplier']) ? $_REQUEST['multiplier'] : 0, 'delta' => isset($_REQUEST['delta']) ? $_REQUEST['delta'] : 0, 'snmpv3_contextname' => $_REQUEST['snmpv3_contextname'], 'snmpv3_securityname' => $_REQUEST['snmpv3_securityname'], 'snmpv3_securitylevel' => isset($_REQUEST['snmpv3_securitylevel']) ? $_REQUEST['snmpv3_securitylevel'] : 0, 'snmpv3_authprotocol' => isset($_REQUEST['snmpv3_authprotocol']) ? $_REQUEST['snmpv3_authprotocol'] : 0, 'snmpv3_authpassphrase' => $_REQUEST['snmpv3_authpassphrase'], 'snmpv3_privprotocol' => isset($_REQUEST['snmpv3_privprotocol']) ? $_REQUEST['snmpv3_privprotocol'] : 0, 'snmpv3_privpassphrase' => $_REQUEST['snmpv3_privpassphrase'], 'formula' => isset($_REQUEST['formula']) ? $_REQUEST['formula'] : 0, 'trends' => isset($_REQUEST['trends']) ? $_REQUEST['trends'] : 365, 'logtimefmt' => $_REQUEST['logtimefmt'], 'delay_flex' => $delay_flexStr, 'authtype' => isset($_REQUEST['authtype']) ? $_REQUEST['authtype'] : 0, 'username' => $_REQUEST['username'], 'password' => $_REQUEST['password'], 'publickey' => $_REQUEST['publickey'], 'privatekey' => $_REQUEST['privatekey'], 'params' => $_REQUEST['params'], 'ipmi_sensor' => $_REQUEST['ipmi_sensor'], 'data_type' => isset($_REQUEST['data_type']) ? $_REQUEST['data_type'] : 0, 'inventory_link' => isset($_REQUEST['inventory_link']) ? $_REQUEST['inventory_link'] : 0);
        if ($item['itemid'] < 0) {
            # add zabbix item
            $response = addItem($item);
            # if failed, return
            if (isset($response['error'])) {
                showError('Adding zabbix item is failed. Error message:' . $response['error']);
                return;
            }
            # insert item information into DB
            $item['itemid'] = $response['result']['itemids'][0];
            usePreparedInsertBlade('item_information', $item);
            $_REQUEST['item_id'] = $item['itemid'];
            showSuccess('added item ' . $_REQUEST['name'] . '.');
        } else {
            # update zabbix item
            unset($item['objectid']);
            unset($item['hostid']);
            $response = updateItem($item);
            if (isset($response['error'])) {
                showError('Updating zabbix item is failed. Error message:' . $response['error']);
                return buildRedirectURL(NULL, NULL, $_REQUEST);
            }
            # update item information in DB
            $item_id = $item['itemid'];
            unset($item['itemid']);
            usePreparedUpdateBlade('item_information', $item, array('itemid' => $item_id));
            showSuccess('updated item ' . $_REQUEST['name'] . '.');
        }
    } else {
        if (isset($_REQUEST['Delete'])) {
            $item_id = $_REQUEST['item_id'];
            if ($item_id > 0) {
                # delete zabbix item
                $response = deleteItem($item_id);
                if (isset($response['error'])) {
                    showError('Deleting zabbix item is failed. Error message:' . $response['error']);
                }
                # delete item information from DB
                usePreparedDeleteBlade('item_information', array('itemid' => $item_id));
                showSuccess('deleted item ' . $_REQUEST['name'] . '.');
                $_REQUEST['tab'] = 'default';
            }
        } else {
            return buildRedirectURL(NULL, NULL, $_REQUEST);
        }
    }
    $left_params = array('page', 'tab', 'op', 'objectid', 'item_id');
    foreach ($_REQUEST as $key => $value) {
        if (!in_array($key, $left_params)) {
            unset($_REQUEST[$key]);
        }
    }
    return buildRedirectURL(NULL, NULL, $_REQUEST);
}
コード例 #30
0
    } else {
        if (isset($artikel_namen[$item])) {
            $_SESSION['items'][$item] = 1;
        }
    }
}
function getItems()
{
    if ($_SESSION['items']) {
        return $_SESSION['items'];
    } else {
        return array();
    }
}
if ($_GET['artikel']) {
    addItem($_GET['artikel']);
    header("Location: warenkorb.php");
}
$wako = getItems();
?>
<html>
 <head>
 <?php 
include "res/head.php";
?>
  <title> 
    Einkaufen in Europa
  </title>
 </head>
 <body>
   <h1>Ihr Warenkorb</h1>