public function get_product_list($col_ids, $type = false) { if (!array_valid($col_ids)) { return false; } $p["fields"] = "a.id,a.name,a.desc"; $p["where"] = "WHERE a.id IN(" . implode(",", $col_ids) . ")"; $collections = $this->db->get_info("collection", $p); //Make sure we have some collections to work with if (array_valid($collections)) { foreach ($collections as $id => $info) { $p["fields"] = "a.id,w.listImage AS src,w.listAlt AS alt,w.dir AS dir,a.name AS 'desc',a.code AS code,a.price AS price,a.productTypeID AS 'type'"; $p["join"] = "LEFT JOIN productjoincollection p ON p.productID = a.id\n"; $p["join"] .= "LEFT JOIN productweb w ON w.productID = a.id\n"; $p["where"] = "WHERE p.collectionID = {$id}\n"; if (!empty($type)) { $p["where"] .= "AND a.productTypeID = {$type}\n"; } $products[$id] = $this->db->get_info("product", $p); } } $results["collections"] = $collections; $results["products"] = $products; return $results; }
/** * Build Order Enquiry text to be placed in message textarea. Used on /company/how-to-order/ */ public static function build_order_message($z) { if (!array_valid($z)) { return false; } return $z["name"] . " - " . strtoupper($z["sku"]) . " - Qty: "; }
public function set_all($p) { if (array_valid($p)) { foreach ($p as $k => $v) { $this->{$k} = $v; } } }
public function insert() { $p = $this->input->post('p'); if (!array_valid($p['add'])) { echo "MISSING INFORMATION - COULD NOT INSERT"; } if ($this->Website_model->insert($p['add']) === FALSE) { $errors[] = 'The domain cannot be blank'; $this->session->set_flashdata('errors', $errors); redirect('/websites/add/', 'location'); } redirect('/websites/view/', 'location'); }
public function update_password() { $p = $this->input->post('p'); $user_id = $this->session->userdata('user_id'); $result = $this->User_model->update_password($p['user'], $user_id); if ($result === TRUE) { redirect('/users/view/', 'location'); } else { // Save error messages to the if (array_valid($result)) { $this->session->set_flashdata('errors', $result); } redirect('/users/password/', 'location'); } }
public function insert() { $p = $this->input->post('p'); if (!array_valid($p['add'])) { echo "MISSING INFORMATION - COULD NOT INSERT"; } $id = $this->Collection_model->insert($p['add']); if ($id === FALSE) { $errors[] = 'The collection name cannot be blank'; $this->session->set_flashdata('errors', $errors); redirect('/collections/add/', 'location'); } elseif (array_valid($p['product_types'])) { $this->Collection_model->update_product_types($p['product_types'], $id); } redirect('/collections/view/', 'location'); }
public function update_product_types($data, $id) { if (!is_valid_id($id)) { return FALSE; } else { // Delete all the existing joined product types $this->db->where('collectionID', $id); $this->db->delete('collectionjoinproducttype'); if (array_valid($data)) { // Insert the new product type associations foreach ($data as $ptype_id) { $this->db->insert('collectionjoinproducttype', array('collectionID' => $id, 'productTypeID' => $ptype_id)); } } return TRUE; } }
<?php if (!array_valid($websites)) { ?> There are no websites in the system. <?php } else { ?> <table width="50%" class="border-table"> <tr> <th class="center">ID</th> <th>Domain</th> <th>Manage</th> </tr> <?php foreach ($websites as $row) { ?> <tr> <td class="center"><?php echo $row['id']; ?> </td> <td title="<?php echo $row['home_dir']; ?> "><?php echo $row['domain']; ?> </td> <td><a href="/websites/info/<?php echo $row['id'];
<?php if (!array_valid($collections)) { ?> There are no collections in the system. <?php } else { ?> <table width="50%" class="border-table"> <tr> <th class="center">ID</th> <th>Name</th> <th>Manage</th> </tr> <?php foreach ($collections as $collection) { ?> <tr> <td class="center"><?php echo $collection['id']; ?> </td> <td><?php echo $collection['name']; ?> </td> <td><a href="/collections/info/<?php echo $collection['id']; ?> /" class="edit">Edit</a></td> </tr>
" id="thumb" /></a> </div> </div> <div id="product-right"> <h1><?php echo $d["body_title"]; ?> </h1> <span id="product-name" class="hide"><?php echo $d["body_title"]; ?> </span> <div id="thumbs"> <?php if (array_valid($d["thumbs"])) { ?> <?php foreach ($d["thumbs"] as $thumb) { ?> <a href="/images/products/necklaces/<?php echo $d["dir"]; ?> /<?php echo str_replace(".jpg", "", $thumb["src"]); ?> _full.jpg" class="cloud-zoom-gallery" rel="useZoom:'zoom', smallImage: '/images/products/necklaces/<?php echo $d["dir"]; ?> /<?php echo $thumb["src"];
?> <p><?php echo $collection["desc"]; ?> </p><?php } ?> </div> <?php // Set the order which we want products to be shown: Necklaces, Bracelets, Earrings $types = array(2, 1, 3); foreach ($types as $type) { ?> <?php if (array_valid($d["products"][$k][$type])) { ?> <?php $class = type_to_str($type); ?> <?php foreach ($d['products'][$k][$type] as $id => $product) { ?> <div class="<?php echo $class; ?> "> <a name="<?php echo $product["code"]; ?> "></a>
<?php if (array_valid($d["js_main"])) { foreach ($d["js_main"] as $js) { ?> <script type="text/javascript" src="/js/<?php echo $js; ?> "></script> <?php } } ?> <?php if (array_valid($d["js_head"])) { foreach ($d["js_head"] as $js) { ?> <script type="text/javascript" src="/js/head/<?php echo $js; ?> "></script> <?php } } ?> <!-- INCLUDE JS BODY::ONLOAD HERE --> <script type="text/javascript"> $(document).ready(function() { Cufon.replace('h1');
<?php if (!array_valid($users)) { ?> There are no users in the system. <?php } else { ?> <table width="100%" class="border-table"> <tr> <th class="center">ID</th> <th>Name</th> <th>Email</th> <th>Login</th> <th>Active</th> </tr> <?php foreach ($users as $row) { ?> <tr> <td class="center"><?php echo $row['id']; ?> </td> <td><?php echo $row['name']; ?> </td> <td><?php echo $row['email']; ?>
session_start(); $abs_path = $_SERVER["DOCUMENT_ROOT"]; //Set the include path - need to check if windows/linux (this may not work on all servers) if (isset($_SERVER["SystemRoot"])) { $i["dev"] = true; //Dev'ing on windows computer ini_set("display_errors", "on"); error_reporting(E_ALL ^ E_NOTICE); ini_set("include_path", ".;{$abs_path}/config;{$abs_path}/classes;{$abs_path}/classes/captcha"); } else { ini_set("include_path", ".:{$abs_path}/config:{$abs_path}/classes:{$abs_path}/classes/captcha"); } require_once "CoreUtil.php"; require_once "SitePage.php"; //Set the default timezone to prevent E_WARNING in footer.php date_default_timezone_set('America/Los_Angeles'); // Set the ID that represents this website $websiteID = 1; //Get any submitted form data if (array_valid($_POST["z"])) { $z = $_POST["z"]; } elseif (array_valid($_GET["z"])) { $z = $_GET["z"]; } //Put stuff you want to set in $page during __construct() $i["google_analytics_code"] = "UA-20106831-1"; $i["abs_path"] = $abs_path . "/"; $page = new SitePage($i); //Make sure to always include /js/include/default.php javascript $display["js_include"][] = "default.php";
<?php if (!array_valid($types)) { ?> There are no product types in the system. <?php } else { ?> <table width="50%" class="border-table"> <tr> <th class="center">ID</th> <th>Type</th> <th>Manage</th> </tr> <?php foreach ($types as $type) { ?> <tr> <td class="center"><?php echo $type['id']; ?> </td> <td><?php echo $type['type']; ?> </td> <td><a href="/product_types/info/<?php echo $type['id']; ?> /" class="edit">Edit</a></td> </tr>
public function update_password($data, $id) { if (array_valid($data) && is_valid_id($id)) { // Ensure no bogus whitespace on any of the information array_trim($data); // Let's be sure the passwords match $new_password = $data['magickey']; $match_password = $data['matchkey']; if ($new_password === $match_password) { $update_data['magickey'] = sha1($new_password); $this->db->where('id', $id); $this->db->update('user', $update_data); return TRUE; } else { $errors[] = 'The passwords for both fields did not match, please try again'; } } else { $errors[] = 'No user information was provided'; } if (array_valid($errors)) { return $errors; } }
/></td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <th colspan="2">Images <a href="javascript:void(0);" onclick="get_image_filenames()">Get filenames</a></th> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td colspan="2"> <table id="image-list"> <?php if (array_valid($info["images"])) { ?> <?php foreach ($info["images"] as $count => $image) { ?> <tr> <td colspan="2">Filename: <input type="text" name="p[images][<?php echo $count; ?> ][filename]" size="50" id="image_<?php echo $count; ?> " value="<?php echo $image["filename"]; ?> "/> Alt: <input type="text" name="p[images][<?php
public function insert() { $p = $this->input->post('p'); if (!array_valid($p['product']) or !array_valid($p['productWeb'])) { echo "MISSING INFORMATION - COULD NOT INSERT"; } $this->db->trans_start(); //First ensure that we aren't trying to insert a duplicate product code if ($this->Product_model->code_exist($p['product']['code'])) { exit("COULD NOT INSERT - DUPLICATE PRODUCT CODE"); } // Upload the images to the proper directory on the server $this->load->model('Website_model'); $this->load->model('Product_type_model', 'PType_model'); // Get the websites home directory $website_info = $this->Website_model->get_website($p['productWeb']['websiteID']); // Get the product type label $product_type_info = $this->PType_model->get_product_type($p['product']['productTypeID']); // Upload the Images $upload_path = $website_info['home_dir'] . '/images/products/' . strtolower($product_type_info['type']) . '/' . $p['productWeb']['dir'] . '/'; $this->Product_model->upload_images($upload_path); // Upload the listing image $upload_path = $website_info['home_dir'] . '/images/products/' . strtolower($product_type_info['type']) . '/list/'; $this->Product_model->upload_images($upload_path, 'listing_image'); $insert_id = $this->Product_model->insert($p['product']); if (is_valid_id($insert_id)) { $this->Product_model->insert_webinfo($p['productWeb'], $insert_id); if (isset($p['collections'])) { $this->Product_model->insert_collections($p['collections'], $insert_id); } $this->Product_model->insert_images($p['images'], $insert_id, $p['productWeb']['websiteID']); $this->db->trans_complete(); echo "SUCCESS"; } else { echo "COULD NOT INSERT"; } }
<?php if (array_valid($d["errors"])) { ?> <ul> <?php foreach ($d["errors"] as $error) { ?> <li class="required"><?php echo $error; ?> </li> <?php } ?> </ul> <?php }
<?php if (array_valid($errors)) { ?> <div style="text-align:left"> <ul> <?php foreach ($errors as $error) { ?> <li><?php echo $error; ?> </li> <?php } ?> </ul> </div> <?php } ?> <form action="/collections/insert/" id="collection-form" method="post"> <table class="tall-table"> <tr> <th colspan="2">Add Collection</th> </tr> <tr> <td>Name:</td> <td><input type="text" name="p[add][name]" size="50" id="product-name" /></td>
<div id="footer"> <a href="/" class="footer">Home</a> <a href="/company/contact-us/" class="footer">Contact Us</a> <a href="/company/about-us/" class="footer">About Us</a> <a href="/company/luxe-jewels/" class="footer">Luxe Jewels</a> <a href="/company/how-to-order/" class="footer">How To Order</a> <a href="/company/terms-and-conditions/" class="footer">Terms & Conditions</a> <a href="http://www.facebook.com/mmb.jewlery" class="footer"><img src="/images/layout/facebook.gif" alt="Visit Us On Facebook" class="middle" /></a> <div id="copyright">© <?php echo date("Y"); ?> Mirror Mirror Bijoux</div> </div> <?php if (array_valid($d["js_include"])) { foreach ($d["js_include"] as $js) { ?> <script type="text/javascript"><?php include $this->js_include_path . $js; ?> </script> <?php } } ?> </body> </html>
public function upload_images($upload_path, $index = 'images') { if (!is_dir($upload_path)) { mkdir($upload_path, 0777, TRUE); } $allowable_file_types = array('image/jpeg', 'image/gif', 'image/jpg', 'image/png'); if (array_valid($_FILES[$index])) { $files =& $_FILES[$index]; if (array_valid($files['name'])) { foreach ($files['name'] as $i => $name) { if (in_array($files['type'][$i], $allowable_file_types) && $files['error'][$i] == 0) { move_uploaded_file($files['tmp_name'][$i], $upload_path . $name); } } } else { if (in_array($files['type'], $allowable_file_types) && $files['error'] == 0) { move_uploaded_file($files['tmp_name'], $upload_path . $files['name']); } } } }
} ?> <script type="text/javascript" src="/js/jquery.js"></script> <?php if (isset($js_main) && array_valid($js_main)) { foreach ($js_main as $js) { ?> <script type="text/javascript" src="/js/<?php echo $js; ?> "></script> <?php } } if (isset($js_head) && array_valid($js_head)) { foreach ($js_head as $js) { ?> <script type="text/javascript" src="/js/head/<?php echo $js; ?> "></script> <?php } } ?> </head> <body> <div id="container"> <div id="header"> <div id="nav">