function find_all_1($array, $sNeededKey) { $places = find_all($array, $sNeededKey); // print_r($places); echo '<br>'; $kinds = find_all($array, 'kind'); // print_r($kinds); echo '<br>'; $result = array(); for ($i = 0; $i < count($kinds); $i++) { if ($kinds[$i] == 'locality') { $result[] = $places[$i]; } } return $result; }
<?php $page_title = 'Returrapport'; $results = ''; require_once 'includes/load.php'; // Checking userlevel page_require_level(1); if (isset($_POST['submit'])) { $req_dates = array('start-date', 'end-date'); validate_fields($req_dates); $returnCategories = find_all('returnCategory'); if (empty($errors)) { $idArray = []; $resultArray = []; $end_date_storage = []; $return_total = []; $start_date = remove_junk($db->escape($_POST['start-date'])); $end_date = remove_junk($db->escape($_POST['end-date'])); //finner alle unike produktid-er der det har vært trades. $p_id = get_unique_pid_trades($start_date, $end_date); //Pusher de til array så de kan lett itereres. foreach ($p_id as $id) { array_push($idArray, $id); array_push($return_total, get_trade_total($start_date, $end_date, $id['product_id'])); } //skal her hente ut returinfo for produktene. har produkt-id, trenger kun hvor mange som har blitt returnert av hver FK_returncategoryID //må mekke en funksjon som returnerer summen av antallet som har vært returnert. Array i en array? Sjekke for p_id og deretter RC_id per funksjon? Så springe en liten for-loop inne i foreach. } else { $session->msg("d", $errors); redirect('sales_report.php', false); }
<?php $page_title = 'Add User'; require_once 'includes/load.php'; // Checking userlevel page_require_level(1); $groups = find_all('user_groups'); if (isset($_POST['add_user'])) { $req_fields = array('full-name', 'username', 'password', 'level'); validate_fields($req_fields); if (empty($errors)) { $name = remove_junk($db->escape($_POST['full-name'])); $username = remove_junk($db->escape($_POST['username'])); $password = remove_junk($db->escape($_POST['password'])); $user_level = (int) $db->escape($_POST['level']); $password = sha1($password); $query = "INSERT INTO users ("; $query .= "name,username,password,user_level,status"; $query .= ") VALUES ("; $query .= " '{$name}', '{$username}', '{$password}', '{$user_level}','1'"; $query .= ")"; if ($db->query($query)) { //success echo 'papp'; if (mysqli_connect_errno() == 1062) { die('BANANA!'); } $session->msg('s', "User account has been created! "); // redirect('add_user.php', false); } else { //failed
<?php $page_title = 'All categories'; require_once 'includes/load.php'; // Checking userlevel page_require_level(2); $all_categories = find_all('categories'); if (isset($_POST['add_cat'])) { $req_field = array('categorie-name'); validate_fields($req_field); $cat_name = remove_junk($db->escape($_POST['categorie-name'])); if (empty($errors)) { $sql = "INSERT INTO categories (name)"; $sql .= " VALUES ('{$cat_name}')"; if ($db->query($sql)) { $session->msg("s", "Successfully Added Categorie"); redirect('categorie.php', false); } else { $session->msg("d", "Sorry Failed to insert."); redirect('categorie.php', false); } } else { $session->msg("d", $errors); redirect('categorie.php', false); } } include_once 'layouts/header.php'; ?> <div class="row"> <div class="col-md-12">
<?php $page_title = 'All Image'; require_once 'includes/load.php'; // Checking userlevel page_require_level(1); $media_files = find_all('media'); if (isset($_POST['submit'])) { $photo = new Media(); $photo->upload($_FILES['file_upload']); if ($photo->process_media()) { $session->msg('s', 'photo has been uploaded.'); redirect('media.php'); } else { $session->msg('d', join($photo->errors)); redirect('media.php'); } } include_once 'layouts/header.php'; ?> <div class="row"> <div class="col-md-6"> <?php echo display_msg($msg); ?> </div> <div class="col-md-12"> <div class="panel panel-default"> <div class="panel-heading clearfix"> <span class="glyphicon glyphicon-camera"></span>
<?php $page_title = 'Add Product'; require_once 'includes/load.php'; // Checkin What level user has permission to view this page page_require_level(2); $all_categories = find_all('categories'); $all_photo = find_all('media'); if (isset($_POST['add_product'])) { $req_fields = array('product-title', 'product-categorie', 'product-quantity', 'buying-price', 'saleing-price'); validate_fields($req_fields); if (empty($errors)) { $p_name = remove_junk($db->escape($_POST['product-title'])); $p_cat = remove_junk($db->escape($_POST['product-categorie'])); $p_qty = remove_junk($db->escape($_POST['product-quantity'])); $p_buy = remove_junk($db->escape($_POST['buying-price'])); $p_sale = remove_junk($db->escape($_POST['saleing-price'])); if (is_null($_POST['product-photo']) || $_POST['product-photo'] === "") { $media_id = '0'; } else { $media_id = remove_junk($db->escape($_POST['product-photo'])); } $date = make_date(); $query = "INSERT INTO products ("; $query .= " name,quantity,buy_price,sale_price,categorie_id,media_id,date"; $query .= ") VALUES ("; $query .= " '{$p_name}', '{$p_qty}', '{$p_buy}', '{$p_sale}', '{$p_cat}', '{$media_id}', '{$date}'"; $query .= ")"; $query .= " ON DUPLICATE KEY UPDATE name='{$p_name}'"; if ($db->query($query)) { $session->msg('s', "Product added ");
* @link mailto:platform@entilda.com * @copyright Copyright (C) 2011 The Platform Authors. All rights reserved. * @license GNU/GPL, see LICENSE.php * Platform is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ // initilizing platform for self-contained objects platform_launch_initialize(); //e("PLATFORM_INDEXER::LOAD<br/>", true); e('<div class="content">'); $indexes = PLATFORM_SANDBOX_SYSTEM_CACHES_PATH . DS . "indexes.db"; $found = 0; $files = find_all($_REQUEST['search'], APPLICATION_BASE_PATH); $threshold = 216000; if (count($files)) { e('<h3>Found ' . count($files) . ' files</h3>'); if (count($files) > $threshold) { e('Updating index...'); update_index(); } foreach ($files as $file) { if ($found < 10) { $uri_array = explode(APPLICATION_BASE_PATH, $file); $file_url = $uri_array[1]; e(' <a href="' . $file_url . '">' . basename($file) . "</a><br />"); } else { e('<br /><br /><a href="#">View more results...</a>'); break;