Exemple #1
0
 public static function formData($id = null)
 {
     global $lC_Database, $lC_Language;
     $lC_Language->loadIniFile('reviews.php');
     $result = array();
     if ($id != null) {
         $result['rData'] = lC_Reviews_Admin::getData($id);
         $result['dateShort'] = lC_DateTime::getShort($result['rData']['date_added']);
         switch ($result['rData']['reviews_status']) {
             case 1:
                 // approved
                 $result['rData']['reviews_status_text'] = $lC_Language->get('review_status_approved');
                 break;
             case 2:
                 // rejected
                 $result['rData']['reviews_status_text'] = $lC_Language->get('review_status_rejected');
                 break;
             default:
                 //new
                 $result['rData']['reviews_status_text'] = $lC_Language->get('review_status_pending');
                 break;
         }
         $result['ratingRadio'] = '';
         for ($i = 1; $i <= 5; $i++) {
             $checked = $result['rData']['reviews_rating'] == $i ? 'checked' : NULL;
             $result['ratingRadio'] .= '<label for="reviews_rating-' . $i . '" class="button blue-active"><input type="radio" name="reviews_rating" id="reviews_rating-' . $i . '" value="' . $i . '" ' . $checked . '>' . $i . '</label>';
         }
         $result['ratingStars'] = lc_image('../images/stars_' . $result['rData']['reviews_rating'] . '.png', sprintf($lC_Language->get('rating_from_5_stars'), $result['rData']['reviews_rating'])) . '&nbsp;[' . sprintf($lC_Language->get('rating_from_5_stars'), $result['rData']['reviews_rating']) . ']';
     }
     return $result;
 }
Exemple #2
0
/**
* Retrieve web server and database server information
*
* @access public
*/
function lc_get_system_information()
{
    global $lC_Database;
    $Qdb_date = $lC_Database->query('select now() as datetime');
    $Qdb_uptime = $lC_Database->query('show status like "Uptime"');
    @(list($system, $host, $kernel) = preg_split('/[\\s,]+/', @exec('uname -a'), 5));
    $db_uptime = intval($Qdb_uptime->valueInt('Value') / 3600) . ':' . str_pad(intval($Qdb_uptime->valueInt('Value') / 60 % 60), 2, '0', STR_PAD_LEFT);
    return array('date' => lC_DateTime::getShort(null, true), 'system' => $system, 'kernel' => $kernel, 'host' => $host, 'ip' => gethostbyname($host), 'uptime' => @exec('uptime'), 'http_server' => $_SERVER['SERVER_SOFTWARE'], 'php' => PHP_VERSION, 'zend' => function_exists('zend_version') ? zend_version() : '', 'db_server' => DB_SERVER, 'db_ip' => gethostbyname(DB_SERVER), 'db_version' => 'MySQL ' . (function_exists('mysql_get_server_info') ? @mysql_get_server_info() : ''), 'db_date' => lC_DateTime::getShort($Qdb_date->value('datetime'), true), 'db_uptime' => $db_uptime);
}
 public static function getAll()
 {
     global $lC_Language;
     if (!defined('LC_ADMIN_FILE_MANAGER_ROOT_PATH')) {
         define('LC_ADMIN_FILE_MANAGER_ROOT_PATH', substr(DIR_FS_CATALOG, 0, -1));
     }
     $media = $_GET['media'];
     $goto_array = array(array('id' => '', 'text' => $lC_Language->get('top_level')));
     if ($_SESSION['fm_directory'] != LC_ADMIN_FILE_MANAGER_ROOT_PATH) {
         $path_array = explode('/', substr($_SESSION['fm_directory'], strlen(LC_ADMIN_FILE_MANAGER_ROOT_PATH) + 1));
         foreach ($path_array as $value) {
             if (sizeof($goto_array) < 2) {
                 $goto_array[] = array('id' => $value, 'text' => $value);
             } else {
                 $parent = end($goto_array);
                 $goto_array[] = array('id' => $parent['id'] . '/' . $value, 'text' => $parent['id'] . '/' . $value);
             }
         }
     }
     $lC_DirectoryListing = new lC_DirectoryListing($_SESSION['fm_directory']);
     $lC_DirectoryListing->setStats(true);
     $result = array('aaData' => array());
     if ($_SESSION['fm_directory'] != LC_ADMIN_FILE_MANAGER_ROOT_PATH) {
         $files = '<td>' . lc_link_object(lc_href_link_admin(FILENAME_DEFAULT, 'file_manager&goto=' . $goto_array[sizeof($goto_array) - 2]['id']), '<span class="icon-up-fat icon-blue">&nbsp;' . $lC_Language->get('parent_level')) . '</td>';
         $result['aaData'][] = array("{$files}", "", "", "", "", "", "", "");
     }
     $cnt = 0;
     foreach ($lC_DirectoryListing->getFiles() as $file) {
         $file_owner = posix_getpwuid($file['user_id']);
         $group_owner = posix_getgrgid($file['group_id']);
         if ($file['is_directory'] === true) {
             $entry_url = lc_href_link_admin(FILENAME_DEFAULT, 'file_manager&directory=' . $file['name']);
             $files = '<td>' . lc_link_object($entry_url, '<span class="icon-folder icon-orange">&nbsp;' . $file['name']) . '</td>';
         } else {
             $entry_url = lc_href_link_admin(FILENAME_DEFAULT, 'file_manager&entry=' . $file['name'] . '&action=save');
             $files = '<td><a href="javascript:void(0);" onclick="editEntry(\'' . $file['name'] . '\')">' . '<span class="icon-page-list icon-blue">&nbsp;' . $file['name'] . '</a></td>';
         }
         $size = '<td>' . number_format($file['size']) . '</td>';
         $perms = '<td>' . lc_get_file_permissions($file['permissions']) . '</td>';
         $user = '******' . $file_owner['name'] . '</td>';
         $group = '<td>' . $group_owner['name'] . '</td>';
         $write = '<td>' . is_writable($lC_DirectoryListing->getDirectory() . '/' . $file['name']) ? '<span class="icon-tick icon-green">' : '<span class="icon-cross icon-red">' . '</td>';
         $last = '<td>' . lC_DateTime::getShort(@date('Y-m-d H:i:s', $file['last_modified']), true) . '</td>';
         if ($file['is_directory'] === false) {
             $action_links = '<a href="' . ((int) ($_SESSION['admin']['access']['file_manager'] < 3) ? '#' : 'javascript://" onclick="editEntry(\'' . $file['name'] . '\')') . '" class="button icon-pencil' . ((int) ($_SESSION['admin']['access']['file_manager'] < 3) ? ' disabled' : NULL) . '">' . ($media === 'mobile-portrait' || $media === 'mobile-landscape' ? NULL : $lC_Language->get('icon_edit')) . '</a>' . '<a href="' . ((int) ($_SESSION['admin']['access']['file_manager'] < 2) ? '#' : lc_href_link_admin(FILENAME_DEFAULT, 'file_manager&entry=' . $file['name'] . '&action=download')) . '" class="button icon-download with-tooltip' . ((int) ($_SESSION['admin']['access']['file_manager'] < 2) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('icon_download') . '"></a>' . '<a href="' . ((int) ($_SESSION['admin']['access']['file_manager'] < 4) ? '#' : 'javascript://" onclick="deleteEntry(\'' . $file['name'] . '\', \'' . urlencode($file['name']) . '\')"') . '" class="button icon-trash with-tooltip' . ((int) ($_SESSION['admin']['access']['file_manager'] < 4) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('icon_delete') . '"></a>';
         } else {
             $action_links = '<a href="' . ((int) ($_SESSION['admin']['access']['file_manager'] < 4) ? '#' : 'javascript://" onclick="deleteEntry(\'' . $file['name'] . '\', \'' . urlencode($file['name']) . '\')"') . '" class="button icon-trash' . ((int) ($_SESSION['admin']['access']['file_manager'] < 4) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('icon_delete') . '"></a>';
         }
         $action = '<td class="align-right vertical-center"><span class="button-group compact">
                ' . $action_links . '
              </span></td>';
         $result['aaData'][] = array("{$files}", "{$size}", "{$perms}", "{$user}", "{$group}", "{$write}", "{$last}", "{$action}");
         $cnt++;
     }
     $result['total'] = $cnt;
     return $result;
 }
 /**
  * Get the coupons information
  *
  * @param integer $id The coupons id
  * @access public
  * @return array
  */
 public static function get($id)
 {
     global $lC_Database, $lC_Language, $lC_Currencies, $lC_DateTime;
     $Qfeatured = $lC_Database->query('select * from :table_featured_products where id = :id limit 1');
     $Qfeatured->bindTable(':table_featured_products', TABLE_FEATURED_PRODUCTS);
     $Qfeatured->bindInt(':id', $id);
     $Qfeatured->execute();
     $data = $Qfeatured->toArray();
     $data['expires_date'] = $Qfeatured->value('expires_date') != '0000-00-00 00:00:00' ? lC_DateTime::getShort($Qfeatured->value('expires_date')) : null;
     $Qfeatured->freeResult();
     return $data;
 }
Exemple #5
0
 protected function _setData()
 {
     global $lC_Database, $lC_Language, $lC_Template;
     if (!$this->enabled) {
         $this->_data = '';
     } else {
         $this->_data = '<div class="four-columns six-columns-tablet twelve-columns-mobile">' . '  <h2 class="relative thin">' . $this->_title . '</h2>' . '  <ul class="list spaced">';
         $Qcustomers = $lC_Database->query('select customers_id, customers_gender, customers_lastname, customers_firstname, customers_status, date_account_created from :table_customers order by date_account_created desc limit 7');
         $Qcustomers->bindTable(':table_customers', TABLE_CUSTOMERS);
         $Qcustomers->execute();
         while ($Qcustomers->next()) {
             $full = $Qcustomers->valueProtected('customers_firstname') . ' ' . $Qcustomers->valueProtected('customers_lastname');
             $this->_data .= '    <li>' . '      <span class="list-link icon-user icon-blue" title="' . $lC_Language->get('edit') . '">' . '        <strong>' . $Qcustomers->value('customers_firstname') . ' ' . $Qcustomers->value('customers_lastname') . '</strong> &nbsp; <span class="anthracite">' . lC_DateTime::getShort($Qcustomers->value('date_account_created')) . '</span>' . '      </span>' . '      <div class="absolute-right compact show-on-parent-hover">' . '        <a href="' . ((int) ($_SESSION['admin']['access']['customers'] < 3) ? '#' : 'javascript://" onclick="editCustomer(\'' . $Qcustomers->valueInt('customers_id') . '\')') . ';" class="button icon-pencil' . ((int) ($_SESSION['admin']['access']['customers'] < 3) ? ' disabled' : NULL) . '">' . $lC_Language->get('icon_view') . '</a>' . '        <a href="' . ((int) ($_SESSION['admin']['access']['customers'] < 2) ? '#' : lc_href_link_admin(FILENAME_DEFAULT, 'orders&cID=' . $Qcustomers->valueInt('customers_id'))) . '" class="button icon-price-tag with-tooltip' . ((int) ($_SESSION['admin']['access']['customers'] < 2) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('icon_orders') . '"></a>' . '        <!-- a href="' . ((int) ($_SESSION['admin']['access']['customers'] < 4) ? '#' : 'javascript://" onclick="deleteCustomer(\'' . $Qcustomers->valueInt('customers_id') . '\', \'' . urlencode($full) . '\')') . ';" class="button icon-trash with-tooltip' . ((int) ($_SESSION['admin']['access']['customers'] < 4) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('icon_delete') . '"></a -->' . '      </div>' . '    </li>';
         }
         $this->_data .= '  </ul>' . '</div>';
         $Qcustomers->freeResult();
         $this->_data .= $this->loadModal();
     }
 }
Exemple #6
0
 protected function _setData()
 {
     global $lC_Database, $lC_Language;
     if (!$this->enabled) {
         $this->_data = '';
     } else {
         $this->_data = '<div class="four-columns six-columns-tablet twelve-columns-mobile">' . '  <h2 class="relative thin">' . $this->_title . '</h2>' . '  <ul class="list spaced">';
         $Qorders = $lC_Database->query('select o.orders_id, o.customers_name, o.date_purchased, s.orders_status_name, ot.text as order_total from :table_orders o, :table_orders_total ot, :table_orders_status s where o.orders_id = ot.orders_id and ot.class = "total" and o.orders_status = s.orders_status_id and s.language_id = :language_id order by o.date_purchased desc limit 7');
         $Qorders->bindTable(':table_orders', TABLE_ORDERS);
         $Qorders->bindTable(':table_orders_total', TABLE_ORDERS_TOTAL);
         $Qorders->bindTable(':table_orders_status', TABLE_ORDERS_STATUS);
         $Qorders->bindInt(':language_id', $lC_Language->getID());
         $Qorders->execute();
         while ($Qorders->next()) {
             $this->_data .= '    <li>' . '      <a href="' . ((int) ($_SESSION['admin']['access']['orders'] < 3) ? '#' : lc_href_link_admin(FILENAME_DEFAULT, 'orders=' . $Qorders->valueInt('orders_id') . '&action=save')) . '"' . '        <span class="list-link icon-price-tag icon-green" title="oID[' . $Qorders->value('orders_id') . ']">' . '          <strong><span class="tag green-bg"><small class="white">' . strip_tags($Qorders->value('order_total')) . '</small></span></strong> &nbsp; <span class="anthracite"><strong>' . $Qorders->value('customers_name') . '</strong> &nbsp; ' . lC_DateTime::getShort($Qorders->value('date_purchased')) . '</span>' . '        </span>' . '        <div class="absolute-right compact show-on-parent-hover">' . '          <span class="button icon-pencil' . ((int) ($_SESSION['admin']['access']['orders'] < 3) ? ' disabled' : NULL) . '">' . $lC_Language->get('icon_view') . '</span>' . '          <!-- a href="' . ((int) ($_SESSION['admin']['access']['orders'] < 4) ? '#' : lc_href_link_admin(FILENAME_DEFAULT, 'orders=' . $Qorders->valueInt('orders_id') . '&action=save')) . '" class="button icon-trash with-tooltip' . ((int) ($_SESSION['admin']['access']['orders'] < 4) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('icon_delete') . '"></a -->' . '        </div>' . '      </a>' . '    </li>';
         }
         $this->_data .= '  </ul>' . '</div>';
         $Qorders->freeResult();
         $this->_data .= $this->loadModal();
     }
 }
Exemple #7
0
 public static function getAll()
 {
     global $lC_Language, $_module;
     $media = $_GET['media'];
     $lC_DirectoryListing = new lC_DirectoryListing(DIR_FS_WORK . 'cache/');
     $lC_DirectoryListing->setIncludeDirectories(false);
     $lC_DirectoryListing->setCheckExtension('cache');
     $cached_files = array();
     foreach ($lC_DirectoryListing->getFiles() as $file) {
         $last_modified = filemtime(DIR_FS_WORK . 'cache/' . $file['name']);
         if (strpos($file['name'], '-') !== false) {
             $code = substr($file['name'], 0, strpos($file['name'], '-'));
         } else {
             $code = substr($file['name'], 0, strpos($file['name'], '.'));
         }
         if (isset($cached_files[$code])) {
             $cached_files[$code]['total']++;
             if ($last_modified > $cached_files[$code]['last_modified']) {
                 $cached_files[$code]['last_modified'] = $last_modified;
             }
         } else {
             $cached_files[$code] = array('total' => 1, 'last_modified' => $last_modified);
         }
     }
     $result = array('aaData' => array());
     foreach ($cached_files as $cache => $stats) {
         $check = '<td><input class="batch" type="checkbox" name="batch[]" value="' . $cache . '" id="' . $cache . '"></td>';
         $block = '<td>' . $cache . '</td>';
         $total = '<td>' . $stats['total'] . '</td>';
         $last = '<td>' . lC_DateTime::getShort(lC_DateTime::fromUnixTimestamp($stats['last_modified']), true) . '</td>';
         $action = '<td><span class="button-group compact">
                <a href="' . ((int) ($_SESSION['admin']['access'][$_module] < 4) ? '#' : 'javascript://" onclick="deleteEntry(\'' . $cache . '\', \'' . urlencode($cache) . '\')') . '" class="button icon-trash' . ((int) ($_SESSION['admin']['access'][$_module] < 4) ? ' disabled' : NULL) . '">' . ($media === 'mobile-portrait' || $media === 'mobile-landscape' ? NULL : $lC_Language->get('icon_delete')) . '</a>
              </span></td>';
         $result['aaData'][] = array("{$check}", "{$block}", "{$total}", "{$last}", "{$action}");
     }
     return $result;
 }
Exemple #8
0
 public static function getAll()
 {
     global $lC_Database, $lC_Language, $_module;
     $media = $_GET['media'];
     $result = array('aaData' => array());
     /* Total Records */
     $QresultTotal = $lC_Database->query('SELECT count(customers_id) as total from :table_customers');
     $QresultTotal->bindTable(':table_customers', TABLE_CUSTOMERS);
     $QresultTotal->execute();
     $result['iTotalRecords'] = $QresultTotal->valueInt('total');
     $QresultTotal->freeResult();
     /* Paging */
     $sLimit = " LIMIT 0,25 ";
     if (isset($_GET['iDisplayStart'])) {
         if ($_GET['iDisplayLength'] != -1) {
             $sLimit = " LIMIT " . $_GET['iDisplayStart'] . ", " . $_GET['iDisplayLength'];
         }
     }
     /* Ordering */
     if (isset($_GET['iSortCol_0'])) {
         $sOrder = " ORDER BY ";
         for ($i = 0; $i < (int) $_GET['iSortingCols']; $i++) {
             $sOrder .= lC_Customers_Admin::fnColumnToField($_GET['iSortCol_' . $i]) . " " . $_GET['sSortDir_' . $i] . ", ";
         }
         $sOrder = substr_replace($sOrder, "", -2);
     }
     /* Filtering */
     $sWhere = "";
     if ($_GET['sSearch'] != "") {
         $sWhere = " WHERE c.customers_lastname LIKE '%" . $_GET['sSearch'] . "%' OR " . "c.customers_firstname LIKE '%" . $_GET['sSearch'] . "%' OR " . "c.customers_email_address LIKE '%" . $_GET['sSearch'] . "%' ";
     } else {
         if (isset($_GET['cSearch']) && $_GET['cSearch'] != null) {
             $sWhere = " WHERE c.customers_id = '" . $_GET['cSearch'] . "' ";
         }
     }
     /* Total Filtered Records */
     $QresultFilterTotal = $lC_Database->query("SELECT count(c.customers_id) as total, c.customers_id, c.customers_group_id, c.customers_gender, c.customers_lastname, c.customers_firstname, c.customers_email_address, c.customers_status, c.customers_ip_address, c.date_account_created, c.date_account_last_modified, c.date_last_logon, c.number_of_logons, a.entry_country_id\n                                                 from :table_customers c\n                                               LEFT JOIN :table_address_book a\n                                                 on (c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id) " . $sWhere . $sOrder);
     $QresultFilterTotal->bindTable(':table_customers', TABLE_CUSTOMERS);
     $QresultFilterTotal->bindTable(':table_address_book', TABLE_ADDRESS_BOOK);
     $QresultFilterTotal->execute();
     $result['iTotalDisplayRecords'] = $QresultFilterTotal->valueInt('total');
     $QresultFilterTotal->freeResult();
     /* Main Listing Query */
     $Qcustomers = $lC_Database->query("SELECT c.customers_id, c.customers_group_id, c.customers_gender, c.customers_lastname, c.customers_firstname, c.customers_email_address, c.customers_status, c.customers_ip_address, c.date_account_created, c.date_account_last_modified, c.date_last_logon, c.number_of_logons, c.customers_default_address_id, a.entry_country_id\n                                         from :table_customers c\n                                       LEFT JOIN :table_address_book a\n                                         on (c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id) " . $sWhere . $sOrder . $sLimit);
     $Qcustomers->bindTable(':table_customers', TABLE_CUSTOMERS);
     $Qcustomers->bindTable(':table_address_book', TABLE_ADDRESS_BOOK);
     $Qcustomers->execute();
     $cnt = 1;
     $tagArr = array();
     while ($Qcustomers->next()) {
         $customer_icon = lc_icon_admin('people.png', 'cID[' . $Qcustomers->value('customers_id') . ']');
         //$customer_icon = '<span class="icon-user title="cID[' . $Qcustomers->value('customers_id') . ']"></span>';
         if (ACCOUNT_GENDER > -1) {
             switch ($Qcustomers->value('customers_gender')) {
                 case 'm':
                     $customer_icon = '<span style="cursor:pointer;" class="with-tooltip" title="cID[' . $Qcustomers->value('customers_id') . '] ' . $lC_Language->get('gender_male') . '">' . lc_icon_admin('male.png') . '</span>';
                     //$customer_icon = '<span class="icon-user icon-blue" title="cID[' . $Qcustomers->value('customers_id') . '] ' . $lC_Language->get('gender_male') . '"></span>';
                     break;
                 case 'f':
                     $customer_icon = '<span style="cursor:pointer;" class="with-tooltip" title="cID[' . $Qcustomers->value('customers_id') . '] ' . $lC_Language->get('gender_female') . '">' . lc_icon_admin('female.png') . '</span>';
                     //$customer_icon = '<span class="icon-user icon-red" title="cID[' . $Qcustomers->value('customers_id') . '] ' . $lC_Language->get('gender_female') . '"></span>';
                     break;
                 default:
                     //$customer_icon = lc_icon_admin('female.png', 'cID[' . $Qcustomers->value('customers_id') . '] ' . $lC_Language->get('gender_female'));
                     $customer_icon = '<span style="cursor:pointer;" class="icon-user icon-anthracite with-tooltip" title="cID[' . $Qcustomers->value('customers_id') . ']"></span>';
             }
         }
         if (!key_exists($Qcustomers->valueInt('customers_group_id'), $tagArr)) {
             $tagArr[$Qcustomers->valueInt('customers_group_id')] = self::nextColor($tagArr);
         }
         $tagColor = $tagArr[$Qcustomers->valueInt('customers_group_id')];
         $full = $Qcustomers->valueProtected('customers_firstname') . ' ' . $Qcustomers->valueProtected('customers_lastname');
         $check = '<td><input class="batch" type="checkbox" name="batch[]" value="' . $Qcustomers->valueInt('customers_id') . '" id="' . $Qcustomers->valueInt('customers_id') . '"></td>';
         $gender = '<td>' . $customer_icon . '</td>';
         $name = '<td>' . $Qcustomers->valueProtected('customers_firstname') . ' ' . $Qcustomers->valueProtected('customers_lastname') . '</td>';
         $Qcustomers_orders = $lC_Database->query("SELECT count(*) as order_count \n                                         from :table_orders \n                                         where customers_id = '" . $Qcustomers->valueInt('customers_id') . "'");
         $Qcustomers_orders->bindTable(':table_orders', TABLE_ORDERS);
         $Qcustomers_orders->execute();
         $order_count = '<td>' . $Qcustomers_orders->valueInt('order_count') . '</td>';
         $email = '<td>' . $Qcustomers->value('customers_email_address') . '</td>';
         $group = '<td><small class="tag ' . $tagColor . ' glossy">' . lc_get_customer_groups_name($Qcustomers->valueInt('customers_group_id')) . '</small></td>';
         $date = '<td>' . lC_DateTime::getShort($Qcustomers->value('date_account_created')) . '</td>';
         $action = '<td class="align-right vertical-center">
                <span class="button-group">
                  <a href="' . ((int) ($_SESSION['admin']['access'][$_module] < 3) ? '#' : 'javascript://" onclick="editCustomer(\'' . $Qcustomers->valueInt('customers_id') . '\')') . '" class="button icon-pencil' . ((int) ($_SESSION['admin']['access'][$_module] < 3) ? ' disabled' : NULL) . '">' . ($media === 'mobile-portrait' || $media === 'mobile-landscape' ? NULL : $lC_Language->get('icon_edit')) . '</a>
                  <a href="' . ((int) ($_SESSION['admin']['access'][$_module] < 3) ? '#' : 'javascript://" onclick="createOrder(\'' . $Qcustomers->valueInt('customers_id') . '\',\'' . $Qcustomers->valueInt('customers_default_address_id') . '\')') . '" class="button icon-plus-round with-tooltip' . ((int) ($_SESSION['admin']['access'][$_module] < 3) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('icon_create_order') . '"></a>
                  <a href="javascript:void(0);" class="button icon-monitor with-tooltip' . ((int) ($_SESSION['admin']['access'][$_module] < 4) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('icon_login_as_customer') . ' (PRO)"></a>
                </span>
                <span class="button-group">
                  <a href="' . ((int) ($_SESSION['admin']['access'][$_module] < 4) ? '#' : lc_href_link_admin(FILENAME_DEFAULT, 'orders&cID=' . $Qcustomers->valueInt('customers_id'))) . '" class="button icon-price-tag with-tooltip' . ((int) ($_SESSION['admin']['access'][$_module] < 4) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('icon_view_orders') . '"></a>
                </span>
              </td>';
         $result['aaData'][] = array("{$check}", "{$gender}", "{$name}", "{$email}", "{$order_count}", "{$group}", "{$date}", "{$action}");
         $cnt++;
     }
     $result['sEcho'] = intval($_GET['sEcho']);
     $Qcustomers->freeResult();
     return $result;
 }
Exemple #9
0
 /**
  * Check to see if it's time to re-check validity; once per day
  *  
  * @access private      
  * @return boolean
  */
 private static function _timeToCheck()
 {
     global $lC_Database;
     $serial = defined('INSTALLATION_ID') && INSTALLATION_ID != '' ? INSTALLATION_ID : NULL;
     if ($serial == NULL) {
         return TRUE;
     }
     //    if (defined('ADDONS_SYSTEM_LOADED_7_PRO_STATUS') && !file_exists(DIR_FS_CATALOG . 'addons/Loaded_7_Pro/controller.php')) return TRUE;
     //    if (defined('ADDONS_SYSTEM_LOADED_7_B2B_STATUS') && !file_exists(DIR_FS_CATALOG . 'addons/Loaded_7_B2B/controller.php')) return TRUE;
     $Qcheck = $lC_Database->query('select * from :table_configuration where configuration_key = :configuration_key limit 1');
     $Qcheck->bindTable(':table_configuration', TABLE_CONFIGURATION);
     $Qcheck->bindValue(':configuration_key', 'INSTALLATION_ID');
     $Qcheck->execute();
     if ($Qcheck->value('date_added') == '0000-00-00 00:00:00') {
         return TRUE;
     }
     $today = substr(lC_DateTime::getShort(date("Y-m-d H:m:s")), 3, 2);
     $check = substr(lC_DateTime::getShort($Qcheck->value('last_modified')), 3, 2);
     $Qcheck->freeResult();
     // update last checked
     if ($serial != NULL) {
         self::updateLastCheckedDate($serial);
     }
     return (int) $today != (int) $check ? TRUE : FALSE;
 }
Exemple #10
0
                    break;
                default:
                    $file_array['compression'] = TEXT_NO_EXTENSION;
                    break;
            }
            $buInfo = new objectInfo($file_array);
        }
        ?>

      <tr onmouseover="rowOverEffect(this);" onmouseout="rowOutEffect(this);">
        <td><?php 
        echo lc_link_object(lc_href_link(FILENAME_DEFAULT, $lC_Template->getModule() . '&action=download&file=' . $entry), lc_icon_admin('save.png', ICON_FILE_DOWNLOAD) . '&nbsp;' . $entry);
        ?>
</td>
        <td><?php 
        echo lC_DateTime::getShort(lC_DateTime::fromUnixTimestamp(filemtime(DIR_FS_BACKUP . $entry)), true);
        ?>
</td>
        <td><?php 
        echo number_format(filesize(DIR_FS_BACKUP . $entry));
        ?>
 bytes</td>
        <td align="right">

<?php 
        if (isset($buInfo) && $entry == $buInfo->file) {
            echo lc_link_object('#', lc_icon_admin('tape.png', IMAGE_RESTORE), 'onclick="toggleInfoBox(\'bRestore\');"') . '&nbsp;' . lc_link_object('#', lc_icon_admin('trash.png', IMAGE_DELETE), 'onclick="toggleInfoBox(\'bDelete\');"');
        } else {
            echo lc_link_object(lc_href_link(FILENAME_DEFAULT, $lC_Template->getModule() . '&file=' . $entry . '&action=bRestore'), lc_icon_admin('tape.png', IMAGE_RESTORE)) . '&nbsp;' . lc_link_object(lc_href_link(FILENAME_DEFAULT, $lC_Template->getModule() . '&file=' . $entry . '&action=bDelete'), lc_icon_admin('trash.png', IMAGE_DELETE));
        }
        ?>
Exemple #11
0
 public static function getHistory()
 {
     global $lC_Language, $lC_Database, $_module;
     $media = $_GET['media'];
     $Qhistory = $lC_Database->query('select * from :table_updates_log order by dateCreated');
     $Qhistory->bindTable(':table_updates_log', TABLE_UPDATES_LOG);
     $Qhistory->execute();
     $result = array('aaData' => array());
     while ($Qhistory->next()) {
         $uAction = '<th scope"row">' . $Qhistory->value('action') . '</th>';
         $uResult = '<td>' . $Qhistory->value('result') . '</td>';
         $uUser = '******' . $Qhistory->value('user') . '</td>';
         $uDate = '<td>' . lC_DateTime::getShort($Qhistory->value('dateCreated'), true) . '</td>';
         //    $log = '<td class="align-right vertical-center"><span class="button-group compact">
         //                 <a href="' . ((int)($_SESSION['admin']['access']['definitions'] < 3) ? '#' : 'javascript://" onclick="editGroup(\'' . $Qgroups->valueInt('customers_group_id') . '\')') . '" class="button icon-pencil' . ((int)($_SESSION['admin']['access']['definitions'] < 3) ? ' disabled' : NULL) . '">' .  (($media === 'mobile-portrait' || $media === 'mobile-landscape') ? NULL : $lC_Language->get('icon_edit')) . '</a>
         //                 <a href="' . ((int)($_SESSION['admin']['access']['definitions'] < 4 || $Qgroups->valueInt('customers_group_id') == DEFAULT_CUSTOMERS_GROUP_ID) ? '#' : 'javascript://" onclick="deleteGroup(\'' . $Qgroups->valueInt('customers_group_id') . '\', \'' . urlencode($Qgroups->valueProtected('title')) . '\')') . '" class="button icon-trash with-tooltip' . ((int)($_SESSION['admin']['access']['definitions'] < 4 || $Qgroups->valueInt('customers_group_id') == DEFAULT_CUSTOMERS_GROUP_ID ) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('icon_delete') . '"></a>
         //               </span></td>';
         $result['aaData'][] = array("{$uAction}", "{$uResult}", "{$uUser}", "{$uDate}");
         $result['entries'][] = $Qhistory->toArray();
     }
     $Qhistory->freeResult();
     return $result;
 }
 protected function _setData()
 {
     global $lC_Database, $lC_Language, $lC_Currencies;
     $this->_data = array();
     $orderDate_qry = $lC_Database->query('select o.date_purchased , count(*) as orderCount from :table_orders o where 1 ');
     if (isset($_GET['statusID'])) {
         switch ($_GET['statusID']) {
             case 'Pending':
             case 'Approved':
             case 'Rejected':
                 $query = $lC_Database->query('select orders_status_id, orders_status_name from :table_orders_status where orders_status_type = "' . $_GET['statusID'] . '"');
                 $query->bindTable(':table_orders_status', TABLE_ORDERS_STATUS);
                 $query->bindInt(':language_id', $lC_Language->getID());
                 $query->execute();
                 $ids = '';
                 while ($query->next()) {
                     $ids .= $query->value('orders_status_id') . ",";
                 }
                 $ids = substr($ids, 0, -1);
                 $orderDate_qry->appendQuery(' and o.orders_status IN ( :orders_status )');
                 $orderDate_qry->bindValue(':orders_status', $ids);
                 break;
             default:
                 if ((int) $_GET['statusID'] > 0) {
                     $orderDate_qry->appendQuery(' and o.orders_status = :orders_status ');
                     $orderDate_qry->bindInt(':orders_status', $_GET['statusID']);
                 }
         }
     }
     $s_date_arr = explode('/', $_GET['startDate']);
     $start = $s_date_arr['2'] . "-" . $s_date_arr['0'] . "-" . $s_date_arr['1'];
     $e_date_arr = explode('/', $_GET['expiresDate']);
     $end = $e_date_arr['2'] . "-" . $e_date_arr['0'] . "-" . $e_date_arr['1'];
     if (isset($_GET['startDate']) && !empty($_GET['startDate'])) {
         $orderDate_qry->appendQuery(' and o.date_purchased >= :start ');
         $orderDate_qry->bindvalue(':start', $start);
     }
     if (isset($_GET['expiresDate']) && !empty($_GET['expiresDate'])) {
         $orderDate_qry->appendQuery(' and o.date_purchased <= :end');
         $orderDate_qry->bindvalue(':end', $end);
     }
     $orderDate_qry->appendQuery(' group by o.date_purchased ');
     $orderDate_qry->bindTable(':table_orders', TABLE_ORDERS);
     $orderDate_qry->execute();
     while ($orderDate_qry->next()) {
         $orderCount = 0;
         $itemCount = 0;
         $revenueTotal = 0;
         $shippingTotal = 0;
         $couponTotal = 0;
         $datePurchased = lC_DateTime::getShort($orderDate_qry->value('date_purchased'));
         $orderCount = $orderDate_qry->value('orderCount');
         $order_qry = $lC_Database->query('select orders_id from :table_orders where date_purchased = :date_purchased ');
         $order_qry->bindTable(':table_orders', TABLE_ORDERS);
         $order_qry->bindValue(':date_purchased', $orderDate_qry->value('date_purchased'));
         $order_qry->setBatchLimit($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS);
         $order_qry->execute();
         while ($order_qry->next()) {
             $tmp_arry = $this->_getOrdersProductsDetails_sales($order_qry->value('orders_id'));
             foreach ($tmp_arry as $k => $v) {
                 switch ($k) {
                     case 'itemCount':
                         $itemCount += $v;
                         break;
                     case 'revenueTotal':
                         $revenueTotal += $v;
                         break;
                     case 'shippingTotal':
                         $shippingTotal += $v;
                         break;
                     case 'couponTotal':
                         $couponTotal += $v;
                         break;
                 }
             }
         }
         $this->_data[] = array($datePurchased, $orderCount, $itemCount, $lC_Currencies->format($revenueTotal), $lC_Currencies->format($shippingTotal), $lC_Currencies->format($couponTotal));
     }
 }
 public function add($product_id, $quantity = null)
 {
     global $lC_Database, $lC_Services, $lC_Language, $lC_Customer, $lC_Product;
     if (!is_numeric($product_id)) {
         return false;
     }
     $Qproduct = $lC_Database->query('select p.*, i.image from :table_products p left join :table_products_images i on (p.products_id = i.products_id and i.default_flag = :default_flag) where p.products_id = :products_id');
     $Qproduct->bindTable(':table_products', TABLE_PRODUCTS);
     $Qproduct->bindTable(':table_products_images', TABLE_PRODUCTS_IMAGES);
     $Qproduct->bindInt(':default_flag', 1);
     $Qproduct->bindInt(':products_id', $product_id);
     $Qproduct->execute();
     if ($Qproduct->value('image') == null) {
         // check for parent image
         $Qimage = $lC_Database->query('select image from :table_products_images where products_id = :parent_id');
         $Qimage->bindTable(':table_products_images', TABLE_PRODUCTS_IMAGES);
         $Qimage->bindInt(':default_flag', 1);
         $Qimage->bindInt(':parent_id', $Qproduct->valueInt('parent_id'));
         $Qimage->execute();
         $image = $Qimage->value('image');
     } else {
         $image = $Qproduct->value('image');
     }
     if ($Qproduct->valueInt('products_status') === 1) {
         if ($this->exists($product_id)) {
             $item_id = $this->getBasketID($product_id);
             if (is_numeric($quantity)) {
                 $quantity = $this->getQuantity($item_id) + 1;
             }
             $this->_contents[$item_id]['quantity'] = $quantity;
             if ($lC_Customer->isLoggedOn()) {
                 $Qupdate = $lC_Database->query('update :table_shopping_carts set quantity = :quantity where customers_id = :customers_id and item_id = :item_id');
                 $Qupdate->bindTable(':table_shopping_carts', TABLE_SHOPPING_CARTS);
                 $Qupdate->bindInt(':quantity', $quantity);
                 $Qupdate->bindInt(':customers_id', $lC_Customer->getID());
                 $Qupdate->bindInt(':item_id', $item_id);
                 $Qupdate->execute();
             }
         } else {
             if (!is_numeric($quantity)) {
                 $quantity = 1;
             }
             $Qdescription = $lC_Database->query('select products_name, products_keyword, products_description, products_tags, products_url from :table_products_description where products_id = :products_id and language_id = :language_id');
             $Qdescription->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
             $Qdescription->bindInt(':products_id', $product_id);
             $Qdescription->bindInt(':language_id', $lC_Language->getID());
             $Qdescription->execute();
             $desc = $Qdescription->toArray();
             if ($Qproduct->valueInt('parent_id') > 0) {
                 $Qmaster = $lC_Database->query('select products_name as parent_name, products_description as description, products_keyword as keyword, products_tags as tags, products_url as url from :table_products_description where products_id = :products_id and language_id = :language_id limit 1');
                 $Qmaster->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
                 $Qmaster->bindInt(':products_id', $Qproduct->valueInt('parent_id'));
                 $Qmaster->bindInt(':language_id', $lC_Language->getID());
                 $Qmaster->execute();
                 if ($Qproduct->valueInt('is_subproduct') > 0) {
                     $desc['products_name'] = $Qmaster->value('parent_name') . ' - ' . $desc['products_name'];
                 } else {
                     $desc['products_name'] = $Qmaster->value('parent_name');
                 }
                 $desc['products_description'] = $Qmaster->value('description');
                 $desc['products_keyword'] = $Qmaster->value('keyword');
                 $desc['products_tags'] = $Qmaster->value('tags');
                 $desc['products_url'] = $Qmaster->value('url');
             }
             // we get the product price from the product class - price already includes options, etc.
             if (!isset($lC_Product)) {
                 $lC_Product = new lC_Product($product_id);
             }
             $price = $lC_Product->getPrice($product_id, $lC_Customer->getCustomerGroup(), $_POST);
             if ($lC_Customer->isLoggedOn()) {
                 $Qid = $lC_Database->query('select max(item_id) as item_id from :table_shopping_carts where customers_id = :customers_id');
                 $Qid->bindTable(':table_shopping_carts', TABLE_SHOPPING_CARTS);
                 $Qid->bindInt(':customers_id', $lC_Customer->getID());
                 $Qid->execute();
                 $item_id = $Qid->valueInt('item_id') + 1;
             } else {
                 if (empty($this->_contents)) {
                     $item_id = 1;
                 } else {
                     $item_id = max(array_keys($this->_contents)) + 1;
                 }
             }
             $this->_contents[$item_id] = array('item_id' => $item_id, 'id' => $product_id, 'parent_id' => $Qproduct->valueInt('parent_id'), 'name' => $desc['products_name'], 'model' => $Qproduct->value('products_model'), 'sku' => $Qproduct->value('products_sku'), 'keyword' => $desc['products_keyword'], 'tags' => $desc['products_tags'], 'url' => $desc['products_url'], 'description' => $desc['products_description'], 'image' => $image, 'price' => $price, 'quantity' => $quantity, 'weight' => $Qproduct->value('products_weight'), 'tax_class_id' => $Qproduct->valueInt('products_tax_class_id'), 'date_added' => lC_DateTime::getShort(lC_DateTime::getNow()), 'weight_class_id' => $Qproduct->valueInt('products_weight_class'));
             // simple options
             if (isset($_POST['simple_options']) && empty($_POST['simple_options']) === false) {
                 foreach ($_POST['simple_options'] as $options_id => $values_id) {
                     if (is_array($values_id)) {
                         $text_value = current($values_id);
                         // for text fields
                         $values_id = key($values_id);
                     }
                     $QsimpleOptionsValues = $lC_Database->query('select price_modifier from :table_products_simple_options_values where options_id = :options_id and values_id = :values_id and customers_group_id = :customers_group_id');
                     $QsimpleOptionsValues->bindTable(':table_products_simple_options_values', TABLE_PRODUCTS_SIMPLE_OPTIONS_VALUES);
                     $QsimpleOptionsValues->bindInt(':options_id', $options_id);
                     $QsimpleOptionsValues->bindInt(':values_id', $values_id);
                     $QsimpleOptionsValues->bindInt(':customers_group_id', '1');
                     $QsimpleOptionsValues->execute();
                     $Qvariants = $lC_Database->query('select pvg.title as group_title, pvg.module, pvv.title as value_title from :table_products_variants_groups pvg, :table_products_variants_values pvv where pvg.id = :options_id and pvv.id = :values_id and pvv.languages_id = :languages_id and pvv.products_variants_groups_id = pvg.id and pvg.languages_id = :languages_id limit 1');
                     $Qvariants->bindTable(':table_products_variants_groups', TABLE_PRODUCTS_VARIANTS_GROUPS);
                     $Qvariants->bindTable(':table_products_variants_values', TABLE_PRODUCTS_VARIANTS_VALUES);
                     $Qvariants->bindInt(':options_id', $options_id);
                     $Qvariants->bindInt(':values_id', $values_id);
                     $Qvariants->bindInt(':languages_id', $lC_Language->getID());
                     $Qvariants->bindInt(':languages_id', $lC_Language->getID());
                     $Qvariants->execute();
                     if (strstr($Qvariants->value('module'), 'file_upload')) {
                         $group_title = is_array($_FILES['simple_options_upload']['name']) && count($_FILES['simple_options_upload']['name']) > 2 ? $lC_Language->get('text_label_files') : $lC_Language->get('text_label_file');
                         $value_title = is_array($_FILES['simple_options_upload']['name']) ? implode(', ', $_FILES['simple_options_upload']['name']) : $_FILES['simple_options_upload']['name'];
                         if (substr($value_title, -2) == ', ') {
                             $value_title = substr($value_title, 0, -2);
                         }
                         $value_title = str_replace(', ,', ', ', $value_title);
                         if ($value_title == '') {
                             $group_title = '';
                         }
                         if (is_array($_FILES['simple_options_upload']['name'])) {
                             $filesArr = $_FILES;
                             $_SESSION['file_upload'] = $_FILES['simple_options_upload'];
                             foreach ($filesArr['simple_options_upload']['name'] as $key => $file) {
                                 $_FILES = array('simple_options_upload' => array('name' => $file, 'type' => $filesArr['simple_options_upload']['type'][$key], 'tmp_name' => $filesArr['simple_options_upload']['tmp_name'][$key], 'error' => $filesArr['simple_options_upload']['error'][$key], 'size' => $filesArr['simple_options_upload']['size'][$key]));
                                 // upload the file
                                 $image = new upload('simple_options_upload', realpath('pub'));
                                 if ($image->exists()) {
                                     if ($image->parse() && $image->save()) {
                                         // success
                                     }
                                 }
                             }
                         }
                     } else {
                         if ($Qvariants->value('module') == 'text_field') {
                             $group_title = $Qvariants->value('group_title');
                             $value_title = $text_value;
                         } else {
                             $group_title = $Qvariants->value('group_title');
                             $value_title = $Qvariants->value('value_title');
                         }
                     }
                     $this->_contents[$item_id]['simple_options'][] = array('value_id' => $values_id, 'group_id' => $options_id, 'group_title' => $group_title, 'value_title' => $value_title, 'price_modifier' => $QsimpleOptionsValues->valueDecimal('price_modifier'));
                     $QsimpleOptionsValues->freeResult();
                     $Qvariants->freeResult();
                 }
             }
             if ($lC_Customer->isLoggedOn()) {
                 $Qnew = $lC_Database->query('insert into :table_shopping_carts (customers_id, item_id, products_id, quantity, meta_data, date_added) values (:customers_id, :item_id, :products_id, :quantity, :meta_data, :date_added)');
                 $Qnew->bindTable(':table_shopping_carts', TABLE_SHOPPING_CARTS);
                 $Qnew->bindInt(':customers_id', $lC_Customer->getID());
                 $Qnew->bindInt(':item_id', $item_id);
                 $Qnew->bindInt(':products_id', $product_id);
                 $Qnew->bindInt(':quantity', $quantity);
                 $Qnew->bindValue(':meta_data', serialize($this->_contents[$item_id]['simple_options']));
                 $Qnew->bindRaw(':date_added', 'now()');
                 $Qnew->execute();
             }
             if ($Qproduct->valueInt('parent_id') > 0) {
                 $Qvariant = $lC_Database->query('select pvg.id as group_id, pvg.title as group_title, pvg.module, pvv.id as value_id, pvv.title as value_title from :table_products_variants pv, :table_products_variants_values pvv, :table_products_variants_groups pvg where pv.products_id = :products_id and pv.products_variants_values_id = pvv.id and pvv.languages_id = :languages_id and pvv.products_variants_groups_id = pvg.id and pvg.languages_id = :languages_id');
                 $Qvariant->bindTable(':table_products_variants', TABLE_PRODUCTS_VARIANTS);
                 $Qvariant->bindTable(':table_products_variants_values', TABLE_PRODUCTS_VARIANTS_VALUES);
                 $Qvariant->bindTable(':table_products_variants_groups', TABLE_PRODUCTS_VARIANTS_GROUPS);
                 $Qvariant->bindInt(':products_id', $product_id);
                 $Qvariant->bindInt(':languages_id', $lC_Language->getID());
                 $Qvariant->bindInt(':languages_id', $lC_Language->getID());
                 $Qvariant->execute();
                 while ($Qvariant->next()) {
                     $group_title = lC_Variants::getGroupTitle($Qvariant->value('module'), $Qvariant->toArray());
                     $value_title = lC_Variants::getValueTitle($Qvariant->value('module'), $Qvariant->toArray());
                     $has_custom_value = lC_Variants::hasCustomValue($Qvariant->value('module'));
                     if (strstr($Qvariant->value('module'), 'file_upload')) {
                         $group_title = is_array($_FILES['variants_upload']['name']) && count($_FILES['variants_upload']['name']) > 2 ? $lC_Language->get('text_label_files') : $lC_Language->get('text_label_file');
                         $value_title = is_array($_FILES['variants_upload']['name']) ? implode(', ', $_FILES['variants_upload']['name']) : $_FILES['variants_upload']['name'];
                         if (substr($value_title, -2) == ', ') {
                             $value_title = substr($value_title, 0, -2);
                         }
                         if (is_array($_FILES['variants_upload']['name'])) {
                             $filesArr = $_FILES;
                             $_SESSION['file_upload'] = $_FILES['variants_upload'];
                             foreach ($filesArr['variants_upload']['name'] as $key => $file) {
                                 $_FILES = array('variants_upload' => array('name' => $file, 'type' => $filesArr['variants_upload']['type'][$key], 'tmp_name' => $filesArr['variants_upload']['tmp_name'][$key], 'error' => $filesArr['variants_upload']['error'][$key], 'size' => $filesArr['variants_upload']['size'][$key]));
                                 // upload the file
                                 $image = new upload('variants_upload', realpath('pub'));
                                 if ($image->exists()) {
                                     if ($image->parse() && $image->save()) {
                                         // success
                                     }
                                 }
                             }
                         }
                     } else {
                         if ($Qvariant->value('module') == 'text_field') {
                             $group_title = $Qvariant->value('group_title');
                         } else {
                             $group_title = $Qvariant->value('group_title');
                             $value_title = $Qvariant->value('value_title');
                         }
                     }
                     $this->_contents[$item_id]['variants'][] = array('group_id' => $Qvariant->valueInt('group_id'), 'value_id' => $Qvariant->valueInt('value_id'), 'group_title' => $group_title, 'value_title' => $value_title, 'has_custom_value' => $has_custom_value);
                     if ($lC_Customer->isLoggedOn() && $has_custom_value === true) {
                         $Qnew = $lC_Database->query('insert into :table_shopping_carts_custom_variants_values (shopping_carts_item_id, customers_id, products_id, products_variants_values_id, products_variants_values_text) values (:shopping_carts_item_id, :customers_id, :products_id, :products_variants_values_id, :products_variants_values_text)');
                         $Qnew->bindTable(':table_shopping_carts_custom_variants_values', TABLE_SHOPPING_CARTS_CUSTOM_VARIANTS_VALUES);
                         $Qnew->bindInt(':shopping_carts_item_id', $item_id);
                         $Qnew->bindInt(':customers_id', $lC_Customer->getID());
                         $Qnew->bindInt(':products_id', $product_id);
                         $Qnew->bindInt(':products_variants_values_id', $Qvariant->valueInt('value_id'));
                         $Qnew->bindValue(':products_variants_values_text', $value_title);
                         $Qnew->execute();
                     }
                 }
             }
         }
         $this->_cleanUp();
         $this->_calculate();
     }
 }
Exemple #14
0
 /**
  * Get the coupons information
  *
  * @param integer $id The coupons id
  * @access public
  * @return array
  */
 public static function get($id)
 {
     global $lC_Database, $lC_Language, $lC_Currencies, $lC_DateTime;
     $Qcoupon = $lC_Database->query('select * from :table_coupons where coupons_id = :coupons_id limit 1');
     $Qcoupon->bindTable(':table_coupons', TABLE_COUPONS);
     $Qcoupon->bindInt(':coupons_id', $id);
     $Qcoupon->execute();
     $data = $Qcoupon->toArray();
     if ($Qcoupon->value('type') == 'T' || $Qcoupon->value('type') == 'R') {
         $data['reward'] = $Qcoupon->value('type') == 'T' ? number_format($Qcoupon->value('reward'), DECIMAL_PLACES) . '%' : $lC_Currencies->format($Qcoupon->value('reward'));
     }
     $data['purchase_over'] = $Qcoupon->value('purchase_over') > 0 ? number_format($Qcoupon->value('purchase_over'), DECIMAL_PLACES) : null;
     $data['start_date'] = $Qcoupon->value('start_date') != null ? lC_DateTime::getShort($Qcoupon->value('start_date')) : null;
     $data['expires_date'] = $Qcoupon->value('expires_date') != null ? lC_DateTime::getShort($Qcoupon->value('expires_date')) : null;
     $Qcoupon->freeResult();
     return $data;
 }
Exemple #15
0
 private function _isValid($cInfo)
 {
     global $lC_ShoppingCart, $lC_Customer, $lC_Currencies;
     $valid = array('status' => true, 'rpcStatus' => 1, 'msg' => '');
     // check status
     if (isset($cInfo['status']) && $cInfo['status'] != '1') {
         $valid = array('status' => false, 'rpcStatus' => -3);
     }
     // check purchase over
     $total = (double) $lC_ShoppingCart->getTotal();
     if (isset($cInfo['purchase_over']) && (double) $cInfo['purchase_over'] > $total) {
         $valid = array('status' => false, 'rpcStatus' => -4, 'msg' => $lC_Currencies->format($cInfo['purchase_over']));
     }
     // check start/end dates
     $today = lC_DateTime::getShort(lC_DateTime::getNow());
     $start = isset($cInfo['start_date']) && $cInfo['start_date'] != NULL ? lC_DateTime::getShort($cInfo['start_date']) : NULL;
     $expires = isset($cInfo['expires_date']) && $cInfo['expires_date'] != NULL ? lC_DateTime::getShort($cInfo['expires_date']) : NULL;
     if ($start != NULL) {
         if ($start <= $today) {
         } else {
             $valid = array('status' => false, 'rpcStatus' => -5, 'msg' => $start);
         }
     }
     if ($expires != NULL) {
         if ($today <= $expires) {
         } else {
             $valid = array('status' => false, 'rpcStatus' => -6, 'msg' => $expires);
         }
     }
     // check uses per coupon and uses per customer
     $uses = $this->_getUses($cInfo['coupons_id']);
     if ((int) $cInfo['uses_per_coupon'] > 0 && (int) $cInfo['uses_per_coupon'] <= (int) $uses['per_coupon']) {
         $valid = array('status' => false, 'rpcStatus' => -7, 'msg' => $cInfo['uses_per_coupon']);
     }
     if ((int) $cInfo['uses_per_customer'] > 0 && (int) $cInfo['uses_per_customer'] <= (int) $uses['per_customer']) {
         $valid = array('status' => false, 'rpcStatus' => -8, 'msg' => $cInfo['uses_per_customer']);
     }
     return $valid;
 }
Exemple #16
0
 public static function getData($id)
 {
     global $lC_Database, $lC_Language, $lC_Currencies, $lC_DateTime;
     $Qspecial = $lC_Database->query('select p.products_id, pd.products_name, p.products_price, s.specials_id, s.specials_new_products_price, s.specials_date_added, s.specials_last_modified, s.start_date, s.expires_date, s.date_status_change, s.status from :table_products p, :table_specials s, :table_products_description pd where s.specials_id = :specials_id and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = :language_id limit 1');
     $Qspecial->bindTable(':table_specials', TABLE_SPECIALS);
     $Qspecial->bindTable(':table_products', TABLE_PRODUCTS);
     $Qspecial->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
     $Qspecial->bindInt(':specials_id', $id);
     $Qspecial->bindInt(':language_id', $lC_Language->getID());
     $Qspecial->execute();
     $data = $Qspecial->toArray();
     $data['products_price_formatted'] = $lC_Currencies->format($Qspecial->value('products_price'));
     if ($Qspecial->value('start_date') != null) {
         $data['start_date_formatted'] = lC_DateTime::getShort($Qspecial->value('start_date'));
     }
     if ($Qspecial->value('expires_date') != null) {
         $data['expires_date_formatted'] = lC_DateTime::getShort($Qspecial->value('expires_date'));
     }
     $Qspecial->freeResult();
     return $data;
 }
        echo lc_href_link(FILENAME_ACCOUNT, 'receipt=' . $Qhistory->valueInt('orders_id'), 'SSL');
        ?>
"><?php 
        echo lc_image(DIR_WS_TEMPLATE_IMAGES . 'icons/16/search.png', $lC_Language->get('text_view'));
        ?>
</a></td>
            <td><?php 
        echo $Qhistory->valueInt('orders_id');
        ?>
</td>                
            <td><?php 
        echo lc_output_string_protected($order_name);
        ?>
</td> 
            <td><?php 
        echo lC_DateTime::getShort($Qhistory->value('date_purchased'));
        ?>
</td>
            <td><?php 
        echo $Qhistory->value('orders_status_name');
        ?>
</td> 
            <td><?php 
        echo lC_Order::numberOfProducts($Qhistory->valueInt('orders_id'));
        ?>
</td>
            <td><?php 
        echo strip_tags($Qhistory->value('order_total'));
        ?>
</td>
          </tr>
Exemple #18
0
 public static function backup($compression = null, $download_only = false)
 {
     global $lC_Database;
     if (lc_empty(DIR_FS_BACKUP) || !@is_dir(DIR_FS_BACKUP) || !@is_writeable(DIR_FS_BACKUP)) {
         return false;
     }
     lc_set_time_limit(0);
     $backup_file = 'db_' . DB_DATABASE . '-' . @date('YmdHis') . '.sql';
     $fp = @fopen(DIR_FS_BACKUP . $backup_file, 'w');
     $schema = '# LoadedCommerce, Innovative eCommerce Solutions' . "\n" . '# http://www.loadedcommerce.com' . "\n" . '#' . "\n" . '# Database Backup For ' . STORE_NAME . "\n" . '# Copyright (c) ' . @date('Y') . ' ' . STORE_OWNER . "\n" . '#' . "\n" . '# Database: ' . DB_DATABASE . "\n" . '# Database Server: ' . DB_SERVER . "\n" . '#' . "\n" . '# Backup Date: ' . lC_DateTime::getShort(null, true) . "\n\n";
     @fputs($fp, $schema);
     $Qtables = $lC_Database->query('show tables');
     while ($Qtables->next()) {
         $table = $Qtables->value('Tables_in_' . DB_DATABASE);
         $schema = 'drop table if exists ' . $table . ';' . "\n" . 'create table ' . $table . ' (' . "\n";
         $table_list = array();
         $Qfields = $lC_Database->query('show fields from :table');
         $Qfields->bindTable(':table', $table);
         $Qfields->execute();
         while ($Qfields->next()) {
             $table_list[] = $Qfields->value('Field');
             $schema .= '  ' . $Qfields->value('Field') . ' ' . $Qfields->value('Type');
             if (!lc_empty($Qfields->value('Default'))) {
                 $schema .= ' default \'' . $Qfields->value('Default') . '\'';
             }
             if ($Qfields->value('Null') != 'YES') {
                 $schema .= ' not null';
             }
             if (!lc_empty($Qfields->value('Extra'))) {
                 $schema .= ' ' . $Qfields->value('Extra');
             }
             $schema .= ',' . "\n";
         }
         $schema = substr($schema, 0, -2);
         // add the keys
         $Qkeys = $lC_Database->query('show keys from :table');
         $Qkeys->bindTable(':table', $table);
         $Qkeys->execute();
         $index = array();
         while ($Qkeys->next()) {
             $kname = $Qkeys->value('Key_name');
             if (!isset($index[$kname])) {
                 $index[$kname] = array('unique' => !$Qkeys->value('Non_unique'), 'fulltext' => $Qkeys->value('Index_type') == 'FULLTEXT' ? true : false, 'columns' => array());
             }
             $index[$kname]['columns'][] = $Qkeys->value('Column_name');
         }
         foreach ($index as $kname => $info) {
             $schema .= ',' . "\n";
             $columns = implode($info['columns'], ', ');
             if ($kname == 'PRIMARY') {
                 $schema .= '  PRIMARY KEY (' . $columns . ')';
             } elseif ($info['fulltext'] === true) {
                 $schema .= '  FULLTEXT ' . $kname . ' (' . $columns . ')';
             } elseif ($info['unique']) {
                 $schema .= '  UNIQUE ' . $kname . ' (' . $columns . ')';
             } else {
                 $schema .= '  KEY ' . $kname . ' (' . $columns . ')';
             }
         }
         $schema .= "\n" . ');' . "\n\n";
         @fputs($fp, $schema);
         // dump the data from the tables except from the sessions table and the who's online table
         if ($table != TABLE_SESSIONS && $table != TABLE_WHOS_ONLINE) {
             $Qrows = $lC_Database->query('select :columns from :table');
             $Qrows->bindRaw(':columns', implode(', ', $table_list));
             $Qrows->bindTable(':table', $table);
             $Qrows->execute();
             while ($Qrows->next()) {
                 $rows = $Qrows->toArray();
                 $schema = 'insert into ' . $table . ' (' . implode(', ', $table_list) . ') values (';
                 foreach ($table_list as $i) {
                     if (!isset($rows[$i])) {
                         $schema .= 'NULL, ';
                     } elseif (strlen($rows[$i]) > 0) {
                         $row = addslashes($rows[$i]);
                         $row = str_replace("\n#", "\n" . '\\#', $row);
                         $schema .= '\'' . $row . '\', ';
                     } else {
                         $schema .= '\'\', ';
                     }
                 }
                 $schema = substr($schema, 0, -2) . ');' . "\n";
                 fputs($fp, $schema);
             }
         }
     }
     fclose($fp);
     unset($schema);
     switch ($compression) {
         case 'gzip':
             exec(CFG_APP_GZIP . ' ' . DIR_FS_BACKUP . $backup_file);
             $backup_file .= '.gz';
             break;
         case 'zip':
             exec(CFG_APP_ZIP . ' -j ' . DIR_FS_BACKUP . $backup_file . '.zip ' . DIR_FS_BACKUP . $backup_file);
             if (file_exists(DIR_FS_BACKUP . $backup_file)) {
                 unlink(DIR_FS_BACKUP . $backup_file);
             }
             $backup_file .= '.zip';
             break;
     }
     if ($download_only === true) {
         header('Content-type: application/x-octet-stream');
         header('Content-disposition: attachment; filename=' . $backup_file);
         readfile(DIR_FS_BACKUP . $backup_file);
         if (file_exists(DIR_FS_BACKUP . $backup_file)) {
             unlink(DIR_FS_BACKUP . $backup_file);
         }
         exit;
     }
     if (file_exists(DIR_FS_BACKUP . $backup_file)) {
         return true;
     }
     return false;
 }
Exemple #19
0
 public static function get($id)
 {
     global $lC_Database, $lC_Language, $lC_Currencies;
     $Qproducts = $lC_Database->query('select p.*, pd.* from :table_products p, :table_products_description pd where p.products_id = :products_id and p.products_id = pd.products_id and pd.language_id = :language_id');
     $Qproducts->bindTable(':table_products', TABLE_PRODUCTS);
     $Qproducts->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
     $Qproducts->bindInt(':products_id', $id);
     $Qproducts->bindInt(':language_id', $lC_Language->getID());
     $Qproducts->execute();
     $data = array_merge(array('products_id' => $id), (array) $Qproducts->toArray());
     $Qproducts->freeResult();
     $Qspecials = $lC_Database->query('select * from :table_specials where products_id = :products_id');
     $Qspecials->bindTable(':table_specials', TABLE_SPECIALS);
     $Qspecials->bindInt(':products_id', $id);
     $Qspecials->execute();
     $data['products_special_status'] = $Qspecials->valueInt('status');
     $data['products_special_price'] = $Qspecials->valueDecimal('specials_new_products_price');
     if ($Qspecials->value('start_date') != null) {
         $data['products_special_start_date'] = lC_DateTime::getShort($Qspecials->value('start_date'));
     }
     if ($Qspecials->value('expires_date') != null) {
         $data['products_special_expires_date'] = lC_DateTime::getShort($Qspecials->value('expires_date'));
     }
     $Qspecials->freeResult();
     $Qfeatured = $lC_Database->query('select status from :table_featured_products where products_id = :products_id limit 1');
     $Qfeatured->bindTable(':table_featured_products', TABLE_FEATURED_PRODUCTS);
     $Qfeatured->bindInt(':products_id', $id);
     $Qfeatured->execute();
     $data['products_featured'] = $Qfeatured->valueInt('status');
     $Qfeatured->freeResult();
     $variants_array = array();
     if ($data['has_children'] == '1') {
         $QmultiSKUProducts = $lC_Database->query('select * from :table_products where parent_id = :parent_id');
         $QmultiSKUProducts->bindTable(':table_products', TABLE_PRODUCTS);
         $QmultiSKUProducts->bindInt(':parent_id', $data['products_id']);
         $QmultiSKUProducts->execute();
         while ($QmultiSKUProducts->next()) {
             $variants_array[$QmultiSKUProducts->valueInt('products_id')]['data'] = array('cost' => $QmultiSKUProducts->value('products_cost'), 'price' => $QmultiSKUProducts->value('products_price'), 'msrp' => $QmultiSKUProducts->value('products_msrp'), 'tax_class_id' => $QmultiSKUProducts->valueInt('products_tax_class_id'), 'model' => $QmultiSKUProducts->value('products_model'), 'sku' => $QmultiSKUProducts->value('products_sku'), 'quantity' => $QmultiSKUProducts->value('products_quantity'), 'weight' => $QmultiSKUProducts->value('products_weight'), 'weight_class_id' => $QmultiSKUProducts->valueInt('products_weight_class'), 'availability_shipping' => 1, 'status' => $QmultiSKUProducts->valueInt('products_status'));
             $Qvariants = $lC_Database->query('select pv.default_combo, pv.default_visual, pvg.id as group_id, pvg.title as group_title, pvg.module, pvv.id as value_id, pvv.title as value_title, pvv.visual as visual, pvv.sort_order as value_sort_order from :table_products_variants pv, :table_products_variants_groups pvg, :table_products_variants_values pvv where pv.products_id = :products_id and pv.products_variants_values_id = pvv.id and pvv.languages_id = :languages_id and pvv.products_variants_groups_id = pvg.id and pvg.languages_id = :languages_id order by pvg.sort_order, pvg.title');
             $Qvariants->bindTable(':table_products_variants', TABLE_PRODUCTS_VARIANTS);
             $Qvariants->bindTable(':table_products_variants_groups', TABLE_PRODUCTS_VARIANTS_GROUPS);
             $Qvariants->bindTable(':table_products_variants_values', TABLE_PRODUCTS_VARIANTS_VALUES);
             $Qvariants->bindInt(':products_id', $QmultiSKUProducts->valueInt('products_id'));
             $Qvariants->bindInt(':languages_id', $lC_Language->getID());
             $Qvariants->bindInt(':languages_id', $lC_Language->getID());
             $Qvariants->execute();
             while ($Qvariants->next()) {
                 $variants_array[$QmultiSKUProducts->valueInt('products_id')]['values'][$Qvariants->valueInt('group_id')][$Qvariants->valueInt('value_id')] = array('value_id' => $Qvariants->valueInt('value_id'), 'group_title' => $Qvariants->value('group_title'), 'value_title' => $Qvariants->value('value_title'), 'sort_order' => $Qvariants->value('value_sort_order'), 'default' => (bool) $Qvariants->valueInt('default_combo'), 'default_visual' => $Qvariants->valueInt('default_visual'), 'module' => $Qvariants->value('module'), 'visual' => $Qvariants->value('visual'));
             }
         }
         $QmultiSKUProducts->freeResult();
     }
     $data['variants'] = $variants_array;
     $Qattributes = $lC_Database->query('select id, value, value2 from :table_product_attributes where products_id = :products_id and languages_id in (0, :languages_id)');
     $Qattributes->bindTable(':table_product_attributes', TABLE_PRODUCT_ATTRIBUTES);
     $Qattributes->bindInt(':products_id', $id);
     $Qattributes->bindInt(':languages_id', $lC_Language->getID());
     $Qattributes->execute();
     $attributes_array = array();
     $data['attributes2'] = array();
     while ($Qattributes->next()) {
         // if the value is date, reformat for datepicker
         $value = substr($Qattributes->value('value'), 4, 1) == '-' ? lC_DateTime::getShort($Qattributes->value('value')) : $Qattributes->value('value');
         $attributes_array[$Qattributes->valueInt('id')] = $value;
         // check for value2
         if ($Qattributes->value('value2') != null) {
             $data['attributes2'][$Qattributes->valueInt('id')] = $Qattributes->value('value2');
         }
     }
     $data['attributes'] = $attributes_array;
     $Qattributes->freeResult();
     $Qimages = $lC_Database->query('select id, image, default_flag from :table_products_images where products_id = :products_id order by sort_order');
     $Qimages->bindTable(':table_products_images', TABLE_PRODUCTS_IMAGES);
     $Qimages->bindInt(':products_id', $id);
     $Qimages->execute();
     while ($Qimages->next()) {
         if ($Qimages->valueInt('default_flag') == '1') {
             $data['image'] = $Qimages->value('image');
         }
     }
     $Qimages->freeResult();
     // load subproducts
     $Qsubproducts = $lC_Database->query('select p.*, pd.* from :table_products p, :table_products_description pd where p.parent_id = :products_id and p.products_id = pd.products_id and pd.language_id = :language_id');
     $Qsubproducts->bindTable(':table_products', TABLE_PRODUCTS);
     $Qsubproducts->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
     $Qsubproducts->bindInt(':products_id', $id);
     $Qsubproducts->bindInt(':language_id', $lC_Language->getID());
     $Qsubproducts->execute();
     $subproducts_array = array();
     while ($Qsubproducts->next()) {
         // subproduct images
         $Qimages = $lC_Database->query('select id, image, default_flag from :table_products_images where products_id = :sub_products_id order by sort_order');
         $Qimages->bindTable(':table_products_images', TABLE_PRODUCTS_IMAGES);
         $Qimages->bindInt(':sub_products_id', $Qsubproducts->valueInt('products_id'));
         $Qimages->execute();
         $subproducts_array[] = array_merge((array) $Qsubproducts->toArray(), array('image' => $Qimages->value('image')));
         $Qimages->freeResult();
     }
     $data['subproducts'] = $subproducts_array;
     if (sizeof($data['subproducts']) > 0) {
         $data['has_subproducts'] = 1;
     }
     $Qsubproducts->freeResult();
     // load simple options
     $Qoptions = $lC_Database->query('select so.options_id, so.products_id, so.sort_order, so.status, vg.title, vg.module from :table_products_simple_options so left join :table_products_variants_groups vg on (so.options_id = vg.id) where so.products_id = :products_id and vg.languages_id = :languages_id order by so.sort_order');
     $Qoptions->bindTable(':table_products_simple_options', TABLE_PRODUCTS_SIMPLE_OPTIONS);
     $Qoptions->bindTable(':table_products_variants_groups', TABLE_PRODUCTS_VARIANTS_GROUPS);
     $Qoptions->bindInt(':products_id', $id);
     $Qoptions->bindInt(':languages_id', $lC_Language->getID());
     $Qoptions->execute();
     $cnt = 0;
     while ($Qoptions->next()) {
         $data['simple_options'][$cnt] = $Qoptions->toArray();
         $Qvalues = $lC_Database->query('select sov.products_id, sov.options_id, sov.values_id, sov.price_modifier, sov.customers_group_id, vv.title from :table_products_simple_options_values sov left join :table_products_variants_values vv on (sov.values_id = vv.id) where sov.options_id = :options_id and vv.languages_id = :languages_id order by sov.sort_order');
         $Qvalues->bindTable(':table_products_simple_options_values', TABLE_PRODUCTS_SIMPLE_OPTIONS_VALUES);
         $Qvalues->bindTable(':table_products_variants_values', TABLE_PRODUCTS_VARIANTS_VALUES);
         $Qvalues->bindInt(':options_id', $Qoptions->valueInt('options_id'));
         $Qvalues->bindInt(':products_id', $id);
         $Qvalues->bindInt(':languages_id', $lC_Language->getID());
         $Qvalues->execute();
         while ($Qvalues->next()) {
             $data['simple_options'][$cnt]['values'][] = $Qvalues->toArray();
         }
         $Qvalues->freeResult();
         $cnt++;
     }
     $Qoptions->freeResult();
     if (DISPLAY_PRICE_WITH_TAX == 1 || $_SESSION['localization']['show_tax'] == 1) {
         $tax_data = lC_Tax_classes_Admin::getEntry($data['products_tax_class_id']);
         $data['products_price_with_tax'] = $data['products_price'] + $tax_data['tax_rate'] / 100 * $data['products_price'];
         //$data['products_cost_with_tax'] = $data['products_cost'] + ($tax_data['tax_rate']/100)*$data['products_cost'];
         $data['products_msrp_with_tax'] = $data['products_msrp'] + $tax_data['tax_rate'] / 100 * $data['products_msrp'];
     }
     return $data;
 }
Exemple #20
0
       </address>
    </div>
    <div class="col-sm-6 col-lg-6">
      <div class="well text-right">
        <h3 class="no-margin-top"><?php 
echo $lC_Language->get('receipt_order_number_title');
?>
 <?php 
echo $_GET['receipt'];
?>
</h3>
        <div><strong><?php 
echo $lC_Language->get('receipt_order_date_title');
?>
</strong> <?php 
echo lC_DateTime::getShort($order->info['date_purchased']);
?>
</div>
        <div><strong><?php 
echo $lC_Language->get('receipt_order_status_title');
?>
</strong> <?php 
echo $order->info['orders_status'];
?>
</div>
        <div><strong><?php 
echo $lC_Language->get('receipt_payment_method_title');
?>
</strong> <?php 
echo $order->info['payment_method'];
?>