public static function getData($id) { global $lC_Database, $lC_Language, $lC_Vqmod; $result = array(); include $lC_Vqmod->modCheck('includes/modules/order_total/' . $id . '.php'); $lC_Language->injectDefinitions('modules/order_total/' . $id . '.xml'); $module = 'lC_OrderTotal_' . $id; $module = new $module(); $cnt = 0; $keys = ''; foreach ($module->getKeys() as $key) { $Qkey = $lC_Database->query('select configuration_title, configuration_value, configuration_description, use_function, set_function from :table_configuration where configuration_key = :configuration_key'); $Qkey->bindTable(':table_configuration', TABLE_CONFIGURATION); $Qkey->bindValue(':configuration_key', $key); $Qkey->execute(); $keys .= '<label for="' . $Qkey->value('configuration_title') . '" class="label"><strong>' . $Qkey->value('configuration_title') . '</strong> <span class="icon-info-round icon-blue with-tooltip with-small-padding" style="cursor:pointer;" title="' . $Qkey->value('configuration_description') . '" data-tooltip-options=\'{"classes":["anthracite-gradient"]}\'></span>'; if (!lc_empty($Qkey->value('set_function'))) { $keys .= lc_call_user_func($Qkey->value('set_function'), $Qkey->value('configuration_value'), $key); } else { $keys .= lc_draw_input_field('configuration[' . $key . ']', $Qkey->value('configuration_value'), 'class="input full-width"'); } $keys .= '</label><br /><br />'; $cnt++; } $result['keys'] = substr($keys, 0, strrpos($keys, '<br /><br />')); $result['totalKeys'] = $cnt; return $result; }
public static function getData($id) { global $lC_Database, $lC_Vqmod; include $lC_Vqmod->modCheck('includes/modules/services/' . $_GET['module'] . '.php'); $module = 'lC_Services_' . $_GET['module'] . '_Admin'; $module = new $module(); $cnt = 0; $keys = ''; $result = array(); foreach ($module->keys() as $key) { $Qkey = $lC_Database->query('select configuration_title, configuration_value, configuration_description, use_function, set_function from :table_configuration where configuration_key = :configuration_key'); $Qkey->bindTable(':table_configuration', TABLE_CONFIGURATION); $Qkey->bindValue(':configuration_key', $key); $Qkey->execute(); $keys .= '<label for="' . $Qkey->value('configuration_title') . '" class="label"><strong>' . $Qkey->value('configuration_title') . '</strong></label>'; if (!lc_empty($Qkey->value('set_function'))) { $keys .= lc_call_user_func($Qkey->value('set_function'), $Qkey->value('configuration_value'), $key); } else { $keys .= lc_draw_input_field('configuration[' . $key . ']', $Qkey->value('configuration_value'), 'class="input" onfocus="this.select();" style="width:28%;"'); } $keys .= '<span class="margin-left">' . lc_show_info_bubble($Qkey->value('configuration_description'), null, 'on-left grey') . '</span><br /><br />'; $cnt++; } $result['keys'] = substr($keys, 0, strrpos($keys, '<br /><br />')); $result['totalKeys'] = $cnt; $result['title'] = $module->title; return $result; }
public static function getData($id) { global $lC_Database, $lC_Language, $lC_Vqmod; include $lC_Vqmod->modCheck('../includes/classes/modules.php'); $lC_Language->load('modules-' . $_GET['set']); include $lC_Vqmod->modCheck('../includes/modules/' . $_GET['set'] . '/' . $id . '.php'); $module = 'lC_' . ucfirst($_GET['set']) . '_' . $id; $lC_Language->injectDefinitions('modules/' . $_GET['set'] . '/' . $id . '.xml'); $module = new $module(); $cnt = 0; $keys = ''; $result = array(); foreach ($module->getKeys() as $key) { $Qkey = $lC_Database->query('select configuration_title, configuration_key, configuration_value, configuration_description, use_function, set_function from :table_configuration where configuration_key = :configuration_key'); $Qkey->bindTable(':table_configuration', TABLE_CONFIGURATION); $Qkey->bindValue(':configuration_key', $key); $Qkey->execute(); $keys .= '<b>' . $Qkey->value('configuration_title') . '</b><br />' . $Qkey->value('configuration_description') . '<br />'; if (!lc_empty($Qkey->value('set_function'))) { $keys .= lc_call_user_func($Qkey->value('set_function'), $Qkey->value('configuration_value'), $key); } else { $keys .= lc_draw_input_field('configuration[' . $key . ']', $Qkey->value('configuration_value')); } $keys .= '<br /><br />'; $cnt++; } $result['keys'] = substr($keys, 0, strrpos($keys, '<br /><br />')); $result['totalKeys'] = $cnt; $result['title'] = $module->getTitle(); $result['author'] = $module->getAuthorName(); return $result; }
function stop() { global $lC_MessageStack, $lC_Template, $lC_Language, $lC_Database; $time_start = explode(' ', PAGE_PARSE_START_TIME); $time_end = explode(' ', microtime()); $parse_time = number_format($time_end[1] + $time_end[0] - ($time_start[1] + $time_start[0]), 3); if (!lc_empty(SERVICE_DEBUG_EXECUTION_TIME_LOG)) { if (!@error_log(strftime('%c') . ' - ' . $_SERVER['REQUEST_URI'] . ' (' . $parse_time . 's)' . "\n", 3, SERVICE_DEBUG_EXECUTION_TIME_LOG)) { if (!file_exists(SERVICE_DEBUG_EXECUTION_TIME_LOG) || !is_writable(SERVICE_DEBUG_EXECUTION_TIME_LOG)) { $lC_MessageStack->add('debug', sprintf($lC_Language->get('debug_exection_time'), SERVICE_DEBUG_EXECUTION_TIME_LOG), 'error'); } } } // additional info if (isset($_SESSION['lC_Customer_data'])) { $lC_MessageStack->add('debug', sprintf($lC_Language->get('debug_exection_time'), $_SESSION['lC_Customer_data']['customers_group_id'], $_SESSION['lC_Customer_data']['customers_group_name']), 'warning'); } $lC_MessageStack->add('debug', sprintf($lC_Language->get('debug_current_template'), $_SESSION['template']['code']), 'info'); if (SERVICE_DEBUG_EXECUTION_DISPLAY == '1') { $lC_MessageStack->add('debug', sprintf($lC_Language->get('debug_exection_time'), $parse_time), 'info'); } $lC_MessageStack->add('debug', $lC_Language->get('debug_notice'), 'info'); if ($lC_Template->showDebugMessages() && $lC_MessageStack->size('debug') > 0) { $_SESSION['debugStack'] = json_encode($lC_MessageStack->get('debug')); } return true; }
public function load() { global $lC_Language, $lC_Vqmod; if (defined('MODULE_DEFAULT_GEOIP') && !lc_empty(MODULE_DEFAULT_GEOIP) && file_exists('includes/modules/geoip/' . MODULE_DEFAULT_GEOIP . '.php')) { $lC_Language->loadIniFile('modules/geoip/' . MODULE_DEFAULT_GEOIP . '.php'); include $lC_Vqmod->modCheck('includes/modules/geoip/' . MODULE_DEFAULT_GEOIP . '.php'); $module = 'lC_GeoIP_' . MODULE_DEFAULT_GEOIP; return new $module(); } else { return new lC_GeoIP_Admin(); } }
public function resize($image, $group_id) { if (lc_empty(CFG_APP_IMAGEMAGICK_CONVERT) || !@file_exists(CFG_APP_IMAGEMAGICK_CONVERT) || utility::execEnabled() === false) { return $this->resizeWithGD($image, $group_id); } if (!file_exists(DIR_FS_CATALOG . DIR_WS_IMAGES . 'products/' . $this->_groups[$group_id]['code'])) { mkdir(DIR_FS_CATALOG . DIR_WS_IMAGES . 'products/' . $this->_groups[$group_id]['code']); @chmod(DIR_FS_CATALOG . DIR_WS_IMAGES . 'products/' . $this->_groups[$group_id]['code'], 0777); } exec(escapeshellarg(CFG_APP_IMAGEMAGICK_CONVERT) . ' -resize ' . (int) $this->_groups[$group_id]['size_width'] . 'x' . (int) $this->_groups[$group_id]['size_height'] . ($this->_groups[$group_id]['force_size'] == '1' ? '!' : '') . ' ' . escapeshellarg(DIR_FS_CATALOG . DIR_WS_IMAGES . 'products/' . $this->_groups[1]['code'] . '/' . $image) . ' ' . escapeshellarg(DIR_FS_CATALOG . DIR_WS_IMAGES . 'products/' . $this->_groups[$group_id]['code'] . '/' . $image)); @chmod(DIR_FS_CATALOG . DIR_WS_IMAGES . 'products/' . $this->_groups[$group_id]['code'] . '/' . $image, 0777); }
public function simpleQuery($query, $debug = false) { global $lC_MessageStack, $lC_Services; if ($this->isConnected()) { $this->number_of_queries++; if ($debug === false && $this->debug === true) { $debug = true; } if (isset($lC_Services) && $lC_Services->isStarted('debug')) { if ($debug === false && SERVICE_DEBUG_OUTPUT_DB_QUERIES == '1') { $debug = true; } if (!lc_empty(SERVICE_DEBUG_EXECUTION_TIME_LOG) && SERVICE_DEBUG_LOG_DB_QUERIES == '1') { @error_log('QUERY ' . $query . "\n", 3, SERVICE_DEBUG_EXECUTION_TIME_LOG); } } elseif ($debug === true) { $debug = false; } if ($debug === true) { $time_start = $this->getMicroTime(); } $resource = @mysqli_query($this->link, $query); if ($debug === true) { $time_end = $this->getMicroTime(); $query_time = number_format($time_end - $time_start, 5); if ($this->debug === true) { $this->time_of_queries += $query_time; } echo '<div style="font-family: Verdana, Arial, sans-serif; font-size: 7px; font-weight: bold;">[<a href="#query' . $this->number_of_queries . '">#' . $this->number_of_queries . '</a>]</div>'; $lC_MessageStack->add('debug', '<a name=\'query' . $this->number_of_queries . '\'></a>[#' . $this->number_of_queries . ' - ' . $query_time . 's] ' . $query, 'warning'); } if ($resource !== false) { $this->error = false; $this->error_number = null; $this->error_query = null; if (mysqli_warning_count($this->link) > 0) { $warning_query = @mysqli_query($this->link, 'show warnings'); while ($warning = @mysqli_fetch_row($warning_query)) { @trigger_error(sprintf('[MYSQL] %s (%d): %s [QUERY] ' . $query, $warning[0], $warning[1], $warning[2]), E_USER_WARNING); } mysqli_free_result($warning_query); } return $resource; } else { $this->setError(mysqli_error($this->link), mysqli_errno($this->link), $query); return false; } } else { return false; } }
public function lC_Account_Login() { global $lC_Language, $lC_Services, $lC_Breadcrumb; // redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled (or the session has not started) if (lc_empty(session_id())) { lc_redirect(lc_href_link(FILENAME_INFO, 'cookie', 'AUTO')); } $this->_page_title = $lC_Language->get('sign_in_heading'); if ($lC_Services->isStarted('breadcrumb')) { $lC_Breadcrumb->add($lC_Language->get('breadcrumb_sign_in'), lc_href_link(FILENAME_ACCOUNT, $this->_module, 'SSL')); } if ($_GET[$this->_module] == 'process') { $this->_process(); } }
public static function getValue($value) { global $lC_Database, $lC_Language; $string = ''; $Qstatus = $lC_Database->query('select title, css_key from :table_shipping_availability where id = :id and languages_id = :languages_id'); $Qstatus->bindTable(':table_shipping_availability'); $Qstatus->bindInt(':id', $value); $Qstatus->bindInt(':languages_id', $lC_Language->getID()); $Qstatus->execute(); if ($Qstatus->numberOfRows() === 1) { $string = $Qstatus->value('title'); if (!lc_empty($Qstatus->value('css_key'))) { $string = '<span class="' . $Qstatus->value('css_key') . '">' . $string . '</span>'; } } return $string; }
/** * Generate an internal URL address for the administration side * * @param string $page The page to link to * @param string $parameters The parameters to pass to the page (in the GET scope) * @access public */ function lc_href_link_admin($page = null, $parameters = null) { if (ENABLE_SSL === true) { $link = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG . DIR_WS_ADMIN; } else { $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG . DIR_WS_ADMIN; } $link .= $page; if (empty($parameters) && !lc_empty(SID)) { $link .= '?' . SID; } else { $link .= '?' . $parameters; if (!lc_empty(SID)) { $link .= '&' . SID; } } while (substr($link, -1) == '&' || substr($link, -1) == '?') { $link = substr($link, 0, -1); } return $link; }
public function initialize() { global $lC_Database, $lC_Language, $lC_Product; if (isset($lC_Product) && is_a($lC_Product, 'lC_Product')) { $Qmanufacturer = $lC_Database->query('select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image, mi.manufacturers_url from :table_manufacturers m left join :table_manufacturers_info mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = :languages_id), :table_products p where p.products_id = :products_id and p.manufacturers_id = m.manufacturers_id'); $Qmanufacturer->bindTable(':table_manufacturers', TABLE_MANUFACTURERS); $Qmanufacturer->bindTable(':table_manufacturers_info', TABLE_MANUFACTURERS_INFO); $Qmanufacturer->bindTable(':table_products', TABLE_PRODUCTS); $Qmanufacturer->bindInt(':languages_id', $lC_Language->getID()); $Qmanufacturer->bindInt(':products_id', $lC_Product->getID()); $Qmanufacturer->execute(); if ($Qmanufacturer->numberOfRows()) { $this->_content = ''; if (!lc_empty($Qmanufacturer->value('manufacturers_image'))) { $this->_content .= '<li class="box-manufacturers-info-image">' . lc_link_object(lc_href_link(FILENAME_DEFAULT, 'manufacturers=' . $Qmanufacturer->valueInt('manufacturers_id')), lc_image(DIR_WS_IMAGES . 'manufacturers/' . $Qmanufacturer->value('manufacturers_image'), $Qmanufacturer->value('manufacturers_name'))) . '</li>' . "\n"; } if (!lc_empty($Qmanufacturer->value('manufacturers_url'))) { $this->_content .= '<li class="box-manufacturers-info-url">' . lc_link_object(lc_href_link(FILENAME_REDIRECT, 'action=manufacturer&manufacturers_id=' . $Qmanufacturer->valueInt('manufacturers_id')), sprintf($lC_Language->get('box_manufacturer_info_website'), $Qmanufacturer->value('manufacturers_name')), 'target="_blank"') . '</li>' . "\n"; } $this->_content .= '<li class="box-manufacturers-info-link">' . lc_link_object(lc_href_link(FILENAME_DEFAULT, 'manufacturers=' . $Qmanufacturer->valueInt('manufacturers_id')), $lC_Language->get('box_manufacturer_info_products')) . '</li>' . "\n"; } } }
function lc_draw_hidden_session_id_field() { global $lC_Session; if ($lC_Session->hasStarted() && !lc_empty(SID)) { return lc_draw_hidden_field($lC_Session->getName(), $lC_Session->getID()); } }
public static function delete($id, $delete_image = false) { global $lC_Database; $error = false; $lC_Database->startTransaction(); if ($delete_image === true) { $Qimage = $lC_Database->query('select banners_image from :table_banners where banners_id = :banners_id'); $Qimage->bindTable(':table_banners', TABLE_BANNERS); $Qimage->bindInt(':banners_id', $id); $Qimage->execute(); } $Qdelete = $lC_Database->query('delete from :table_banners where banners_id = :banners_id'); $Qdelete->bindTable(':table_banners', TABLE_BANNERS); $Qdelete->bindInt(':banners_id', $id); $Qdelete->setLogging($_SESSION['module'], $id); $Qdelete->execute(); if ($lC_Database->isError()) { $error = true; } if ($error === false) { $Qdelete = $lC_Database->query('delete from :table_banners_history where banners_id = :banners_id'); $Qdelete->bindTable(':table_banners_history', TABLE_BANNERS_HISTORY); $Qdelete->bindInt(':banners_id', $id); $Qdelete->execute(); if ($lC_Database->isError()) { $error = true; } } if ($error === false) { if ($delete_image === true) { if (!lc_empty($Qimage->value('banners_image'))) { if (is_file('../images/' . $Qimage->value('banners_image')) && is_writeable('../images/' . $Qimage->value('banners_image'))) { @unlink('../images/' . $Qimage->value('banners_image')); } } } $image_extension = lc_dynamic_image_extension(); if (!empty($image_extension)) { if (is_file('images/graphs/banner_yearly-' . $id . '.' . $image_extension) && is_writeable('images/graphs/banner_yearly-' . $id . '.' . $image_extension)) { @unlink('images/graphs/banner_yearly-' . $id . '.' . $image_extension); } if (is_file('images/graphs/banner_monthly-' . $id . '.' . $image_extension) && is_writeable('images/graphs/banner_monthly-' . $id . '.' . $image_extension)) { @unlink('images/graphs/banner_monthly-' . $id . '.' . $image_extension); } if (is_file('images/graphs/banner_daily-' . $id . '.' . $image_extension) && is_writeable('images/graphs/banner_daily-' . $id . '.' . $image_extension)) { unlink('images/graphs/banner_daily-' . $id . '.' . $image_extension); } } $lC_Database->commitTransaction(); return true; } $lC_Database->rollbackTransaction(); return false; }
public static function delete($id) { global $lC_Database; $lC_CategoryTree = new lC_CategoryTree_Admin(); if (is_numeric($id)) { $lC_CategoryTree->setBreadcrumbUsage(false); $categories = array_merge(array(array('id' => $id, 'text' => '')), $lC_CategoryTree->getArray($id)); $products = array(); $products_delete = array(); foreach ($categories as $category) { $Qproducts = $lC_Database->query('select products_id from :table_products_to_categories where categories_id = :categories_id'); $Qproducts->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES); $Qproducts->bindInt(':categories_id', $category['id']); $Qproducts->execute(); while ($Qproducts->next()) { $products[$Qproducts->valueInt('products_id')]['categories'][] = $category['id']; } } foreach ($products as $key => $value) { $Qcheck = $lC_Database->query('select categories_id from :table_products_to_categories where products_id = :products_id and categories_id not in :categories_id limit 1'); $Qcheck->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES); $Qcheck->bindInt(':products_id', $key); $Qcheck->bindRaw(':categories_id', '("' . implode('", "', $value['categories']) . '")'); $Qcheck->execute(); if ($Qcheck->numberOfRows() === 0) { $products_delete[$key] = $key; } } lc_set_time_limit(0); foreach ($categories as $category) { $lC_Database->startTransaction(); $Qimage = $lC_Database->query('select categories_image from :table_categories where categories_id = :categories_id'); $Qimage->bindTable(':table_categories', TABLE_CATEGORIES); $Qimage->bindInt(':categories_id', $category['id']); $Qimage->execute(); $Qc = $lC_Database->query('delete from :table_categories where categories_id = :categories_id'); $Qc->bindTable(':table_categories', TABLE_CATEGORIES); $Qc->bindInt(':categories_id', $category['id']); $Qc->setLogging($_SESSION['module'], $id); $Qc->execute(); if (!$lC_Database->isError()) { $Qcd = $lC_Database->query('delete from :table_categories_description where categories_id = :categories_id'); $Qcd->bindTable(':table_categories_description', TABLE_CATEGORIES_DESCRIPTION); $Qcd->bindInt(':categories_id', $category['id']); $Qcd->setLogging($_SESSION['module'], $id); $Qcd->execute(); if (!$lC_Database->isError()) { $Qp2c = $lC_Database->query('delete from :table_products_to_categories where categories_id = :categories_id'); $Qp2c->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES); $Qp2c->bindInt(':categories_id', $category['id']); $Qp2c->setLogging($_SESSION['module'], $id); $Qp2c->execute(); if (!$lC_Database->isError()) { // permalink $Qpb = $lC_Database->query('delete from :table_permalinks where item_id = :item_id'); $Qpb->bindTable(':table_permalinks', TABLE_PERMALINKS); $Qpb->bindInt(':item_id', $category['id']); $Qpb->execute(); if (!$lC_Database->isError()) { $lC_Database->commitTransaction(); lC_Cache::clear('categories'); lC_Cache::clear('category_tree'); lC_Cache::clear('also_purchased'); if (!lc_empty($Qimage->value('categories_image'))) { $Qcheck = $lC_Database->query('select count(*) as total from :table_categories where categories_image = :categories_image'); $Qcheck->bindTable(':table_categories', TABLE_CATEGORIES); $Qcheck->bindValue(':categories_image', $Qimage->value('categories_image')); $Qcheck->execute(); if ($Qcheck->numberOfRows() === 0) { if (file_exists(realpath('../' . DIR_WS_IMAGES . 'categories/' . $Qimage->value('categories_image')))) { @unlink(realpath('../' . DIR_WS_IMAGES . 'categories/' . $Qimage->value('categories_image'))); } } } } else { $lC_Database->rollbackTransaction(); } } else { $lC_Database->rollbackTransaction(); } } else { $lC_Database->rollbackTransaction(); } } else { $lC_Database->rollbackTransaction(); } } foreach ($products_delete as $id) { lC_Products_Admin::remove($id); } lC_Cache::clear('categories'); lC_Cache::clear('category_tree'); lC_Cache::clear('also_purchased'); return true; } return false; }
public static function preview($id) { global $lC_Database, $lC_Language, $lC_Currencies; $lC_Image = new lC_Image_Admin(); $lC_Language->loadIniFile('products.php'); $result = array(); $Qp = $lC_Database->query('select p.products_id, p.products_quantity, p.products_cost, p.products_price, p.products_msrp, p.products_model, p.products_sku, p.products_weight, p.products_weight_class, p.products_date_added, p.products_last_modified, p.products_status, p.products_tax_class_id, p.manufacturers_id, i.image from :table_products p left join :table_products_images i on (p.products_id = i.products_id and default_flag = :default_flag) where p.products_id = :products_id'); $Qp->bindTable(':table_products', TABLE_PRODUCTS); $Qp->bindTable(':table_products_images', TABLE_PRODUCTS_IMAGES); $Qp->bindInt(':products_id', $id); $Qp->bindInt(':default_flag', 1); $Qp->execute(); $Qpd = $lC_Database->query('select products_name, products_blurb, products_description, products_url, language_id from :table_products_description where products_id = :products_id'); $Qpd->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION); $Qpd->bindInt(':products_id', $id); $Qpd->execute(); $pd_extra = array(); while ($Qpd->next()) { $pd_extra['products_name'][$Qpd->valueInt('language_id')] = $Qpd->valueProtected('products_name'); $pd_extra['products_blurb'][$Qpd->valueInt('language_id')] = $Qpd->valueProtected('products_blurb'); $pd_extra['products_description'][$Qpd->valueInt('language_id')] = $Qpd->value('products_description'); $pd_extra['products_url'][$Qpd->valueInt('language_id')] = $Qpd->valueProtected('products_url'); } $lC_ObjectInfo = new lC_ObjectInfo(array_merge($Qp->toArray(), $pd_extra)); $products_name = $lC_ObjectInfo->get('products_name'); $products_blurb = $lC_ObjectInfo->get('products_blurb'); $products_description = $lC_ObjectInfo->get('products_description'); $products_url = $lC_ObjectInfo->get('products_url'); $result['previewHtml'] = '<div>'; foreach ($lC_Language->getAll() as $l) { $result['previewHtml'] .= '<span id="lang_' . $l['code'] . '"' . ($l['code'] == $lC_Language->getCode() ? ' class="highlight"' : '') . '><a href="javascript:toggleDivBlocks(\'pName_\', \'pName_' . $l['code'] . '\'); toggleClass(\'lang_\', \'lang_' . $l['code'] . '\', \'highlight\', \'span\');">' . $lC_Language->showImage($l['code']) . '</a></span> '; } $result['previewHtml'] .= '</div>'; foreach ($lC_Language->getAll() as $l) { $result['previewHtml'] .= '<div id="pName_' . $l['code'] . '" ' . ($l['code'] != $lC_Language->getCode() ? ' style="display: none;"' : '') . '>'; $result['previewHtml'] .= ' <table border="0" width="100%" cellspacing="0" cellpadding="2">'; $result['previewHtml'] .= ' <tr>'; $result['previewHtml'] .= ' <td><h1>' . lc_output_string_protected($products_name[$l['id']]) . (!lc_empty($lC_ObjectInfo->get('products_model')) ? '<br /><span>' . $lC_ObjectInfo->getProtected('products_model') . '</span>' : '') . '</h1></td>'; $result['previewHtml'] .= ' <td align="right"><h1>' . $lC_Currencies->format($lC_ObjectInfo->get('products_price')) . '</h1></td>'; $result['previewHtml'] .= ' </tr>'; $result['previewHtml'] .= ' </table>'; $result['previewHtml'] .= ' <p>' . $lC_Image->show($lC_ObjectInfo->get('image'), $products_name[$l['id']], 'align="right" hspace="5" vspace="5"', 'product_info') . $products_description[$l['id']] . '</p>'; if (!empty($products_url[$l['id']])) { $result['previewHtml'] .= '<p>' . sprintf($lC_Language->get('text_more_product_information'), lc_output_string_protected($products_url[$l['id']])) . '</p>'; } $result['previewHtml'] .= '<p align="center">' . sprintf($lC_Language->get('text_product_date_added'), lC_DateTime::getLong($lC_ObjectInfo->get('products_date_added'))) . '</p>'; $result['previewHtml'] .= '</div>'; } return $result; }
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; }
public static function delete($id, $delete_image = false, $delete_products = false) { global $lC_Database; if ($delete_image === true) { $Qimage = $lC_Database->query('select manufacturers_image from :table_manufacturers where manufacturers_id = :manufacturers_id'); $Qimage->bindTable(':table_manufacturers', TABLE_MANUFACTURERS); $Qimage->bindInt(':manufacturers_id', $id); $Qimage->execute(); if ($Qimage->numberOfRows() && !lc_empty($Qimage->value('manufacturers_image'))) { if (file_exists(realpath('../' . DIR_WS_IMAGES . 'manufacturers/' . $Qimage->value('manufacturers_image')))) { @unlink(realpath('../' . DIR_WS_IMAGES . 'manufacturers/' . $Qimage->value('manufacturers_image'))); } } } $Qm = $lC_Database->query('delete from :table_manufacturers where manufacturers_id = :manufacturers_id'); $Qm->bindTable(':table_manufacturers', TABLE_MANUFACTURERS); $Qm->bindInt(':manufacturers_id', $id); $Qm->setLogging($_SESSION['module'], $id); $Qm->execute(); $Qmi = $lC_Database->query('delete from :table_manufacturers_info where manufacturers_id = :manufacturers_id'); $Qmi->bindTable(':table_manufacturers_info', TABLE_MANUFACTURERS_INFO); $Qmi->bindInt(':manufacturers_id', $id); $Qmi->setLogging($_SESSION['module'], $id); $Qmi->execute(); if ($delete_products === true) { $Qproducts = $lC_Database->query('select products_id from :table_products where manufacturers_id = :manufacturers_id'); $Qproducts->bindTable(':table_products', TABLE_PRODUCTS); $Qproducts->bindInt(':manufacturers_id', $id); $Qproducts->execute(); while ($Qproducts->next()) { lC_Products_Admin::delete($Qproducts->valueInt('products_id')); } } else { $Qupdate = $lC_Database->query('update :table_products set manufacturers_id = null where manufacturers_id = :manufacturers_id'); $Qupdate->bindTable(':table_products', TABLE_PRODUCTS); $Qupdate->bindInt(':manufacturers_id', $id); $Qupdate->setLogging($_SESSION['module'], $id); $Qupdate->execute(); } lC_Cache::clear('manufacturers'); return true; }
public static function formData($id = null) { global $lC_Database, $lC_Language, $_module; $lC_Language->loadIniFile('customers.php'); $result = array(); $Qgroups = $lC_Database->query('select customers_group_id, customers_group_name from :table_customers_groups where language_id = :language_id order by customers_group_name'); $Qgroups->bindTable(':table_customers_groups', TABLE_CUSTOMERS_GROUPS); $Qgroups->bindInt(':language_id', $lC_Language->getID()); $Qgroups->execute(); $groups_array = array(); while ($Qgroups->next()) { $groups_array[$Qgroups->value('customers_group_id')] = $Qgroups->value('customers_group_name'); } $result['groupsArray'] = $groups_array; if ($id != null) { $result['customerData'] = lC_Customers_Admin::getData($id); $Qaddresses = lC_Customers_Admin::getAddressBookData($id); $cnt = 0; $result['addressBook'] = ''; $body .= '<ul class="list spaced">'; while ($Qaddresses->next()) { $primary = $result['customerData']['customers_default_address_id'] == $Qaddresses->valueInt('address_book_id') ? 'true' : 'false'; $body .= '<li class="">'; $body .= '<span class="button-group compact float-right">' . ' <a href="' . ((int) ($_SESSION['admin']['access'][$_module] < 3) ? '#' : 'javascript://" onclick="editAddress(\'' . $Qaddresses->valueInt('address_book_id') . '\', \'' . $primary . '\')') . '" class="button icon-pencil' . ((int) ($_SESSION['admin']['access'][$_module] < 3) ? ' disabled' : NULL) . '">' . $lC_Language->get('icon_edit') . '</a>' . ' <a href="' . ((int) ($_SESSION['admin']['access'][$_module] < 4) ? '#' : 'javascript://" onclick="deleteAddress(\'' . $Qaddresses->valueInt('address_book_id') . '\')') . '" class="button icon-trash with-tooltip' . ((int) ($_SESSION['admin']['access'][$_module] < 4) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('icon_delete') . '"></a>' . '</span>'; if (ACCOUNT_GENDER > -1) { switch ($Qaddresses->value('gender')) { case 'm': $body .= '<span>' . lc_icon_admin('male.png') . '</span>'; break; case 'f': $body .= '<span>' . lc_icon_admin('female.png') . '</span>'; break; default: $body .= '<span>' . lc_icon_admin('people.png') . '</span>'; break; } } else { $body .= '<span>' . lc_icon_admin('people.png') . '</span>'; } $body .= '<span class="small-margin-left">' . lC_Address::format($Qaddresses->toArray(), ' <br /> ') . '</span>'; if ($primary == 'true') { $body .= '<small class="tag small-margin-left purple-gradient glossy" style="position:absolute; top:12px; right:88px;">' . $lC_Language->get('primary_address') . '</small>'; } $body .= '<span class="icon-phone icon-blue" style="position:absolute; top:17px; left:200px;">'; if (!lc_empty($Qaddresses->valueProtected('telephone_number'))) { $body .= $Qaddresses->valueProtected('telephone_number'); } else { $body .= '<small class="tag silver-gradient glossy"><i>' . $lC_Language->get('no_telephone_number') . '</i></small>'; } $body .= '</span>'; $body .= '<span class="icon-printer icon-orange" style="position:absolute; top:46px; left:200px;">'; if (!lc_empty($Qaddresses->valueProtected('fax_number'))) { $body .= $Qaddresses->valueProtected('fax_number'); } else { $body .= '<small class="tag silver-gradient glossy"><i>' . $lC_Language->get('no_fax_number') . '</i></small>'; } $body .= '</span>'; $body .= '</li>'; $cnt++; } $body .= '</ul>'; $result['addressBook'] = $body; // set default country to store country $country_id = STORE_COUNTRY; $Qzones = $lC_Database->query('select zone_name from :table_zones where zone_country_id = :zone_country_id order by zone_name'); $Qzones->bindTable(':table_zones', TABLE_ZONES); $Qzones->bindInt(':zone_country_id', $country_id); $Qzones->execute(); $zones_array = array(); while ($Qzones->next()) { $zones_array[] = array('id' => $Qzones->value('zone_name'), 'text' => $Qzones->value('zone_name')); } $result['abState'] = lc_draw_pull_down_menu('ab_state', $zones_array, null, 'class="input with-small-padding" style="width:73%;"'); } $countries_array = array(); foreach (lC_Address::getCountries() as $country) { $countries_array[$country['id']] = $country['name']; } $result['countriesArray'] = $countries_array; return $result; }
/** * Loads the session storage handler * * @param string $name The name of the session * @access public */ public static function load($name = null) { $class_name = 'lC_Session'; if (!lc_empty(basename(STORE_SESSIONS)) && file_exists(dirname(__FILE__) . '/session/' . basename(STORE_SESSIONS) . '.php')) { include dirname(__FILE__) . '/session/' . basename(STORE_SESSIONS) . '.php'; $class_name = 'lC_Session_' . basename(STORE_SESSIONS); } return new $class_name($name); }
public static function logInfo($id) { global $lC_Database; $Qlog = $lC_Database->query('select email_address, date_sent from :table_newsletters_log where newsletters_id = :newsletters_id order by date_sent desc'); $Qlog->bindTable(':table_newsletters_log', TABLE_NEWSLETTERS_LOG); $Qlog->bindInt(':newsletters_id', $id); $Qlog->execute(); $result = array('aaData' => array()); while ($Qlog->next()) { $email = '<td>' . $Qlog->valueProtected('email_address') . '</td>'; $sent = '<td>' . (!lc_empty($Qlog->value('date_sent')) ? '<span class="icon-tick icon-green icon-size2"></span>' : '<span class="icon-cross icon-red icon-size2"></span>') . '</td>'; $date = '<td>' . $Qlog->value('date_sent') . '</td>'; $result['aaData'][] = array("{$email}", "{$sent}", "{$date}"); } return $result; }
public static function getData($name) { global $lC_Database, $lC_Language, $lC_Vqmod, $lC_Currencies; $result = array(); include_once DIR_FS_CATALOG . 'addons/' . $name . '/controller.php'; $addon = new $name(); $blurb = $addon->getAddonBlurb() ? $addon->getAddonBlurb() : null; $result['desc'] = '<div class="margin-bottom" style="width:100%;"> <div class="float-left margin-right">' . $addon->getAddonThumbnail() . '</div> <div style="width:90%;"> <div class="strong">' . $addon->getAddonTitle() . '</div> <div>' . lc_image('../images/stars_' . $addon->getAddonRating() . '.png', sprintf($lC_Language->get('rating_from_5_stars'), $addon->getAddonRating()), null, null, 'class="mid-margin-top small-margin-bottom"') . '</div> <div><small>' . $addon->getAddonAuthor() . '</small></div> <div style="position:absolute; right:0; top:0;"><button id="uninstallButton" onclick="uninstallAddon(\'' . $addon->getAddonCode() . '\',\'' . urlencode($addon->getAddonTitle()) . '\', \'' . $addon->getAddonType() . '\');" class="button icon-undo red-gradient glossy"><span>Uninstall</span></button></div> </div> </div>' . $blurb . ' </div>'; $cnt = 0; $keys = ''; foreach ($addon->getKeys() as $key) { $Qkey = $lC_Database->query('select configuration_title, configuration_value, configuration_description, use_function, set_function from :table_configuration where configuration_key = :configuration_key'); $Qkey->bindTable(':table_configuration', TABLE_CONFIGURATION); $Qkey->bindValue(':configuration_key', $key); $Qkey->execute(); $keys .= '<label for="' . $Qkey->value('configuration_title') . '" class="label"><strong>' . $Qkey->value('configuration_title') . '</strong></label>'; if (!lc_empty($Qkey->value('set_function'))) { $keys .= lc_call_user_func($Qkey->value('set_function'), $Qkey->value('configuration_value'), $key); } else { if (stristr($key, 'password')) { $keys .= lc_draw_password_field('configuration[' . $key . ']', 'class="input" onfocus="this.select();"', $Qkey->value('configuration_value')); } else { if (preg_match('/(_COST|_HANDLING|_PRICE|_FEE|_MINIMUM_ORDER)$/i', $key)) { $keys .= '<div class="inputs" style="display:inline; padding:8px 0;">' . ' <span class="mid-margin-left no-margin-right">' . $lC_Currencies->getSymbolLeft() . '</span>' . lc_draw_input_field('configuration[' . $key . ']', @number_format($Qkey->value('configuration_value'), DECIMAL_PLACES), 'class="input-unstyled" onfocus="this.select();"') . '</div>'; } else { $keys .= lc_draw_input_field('configuration[' . $key . ']', $Qkey->value('configuration_value'), 'class="input" onfocus="this.select();"'); } } } $keys .= '<span class="info-spot on-left margin-left"><span class="icon-info-round icon-silver"></span><span class="info-bubble">' . $Qkey->value('configuration_description') . '</span></span><br /><br />'; $cnt++; } $result['keys'] = substr($keys, 0, strrpos($keys, '<br /><br />')); $result['totalKeys'] = $cnt; return $result; }
public function __construct() { global $lC_Language, $lC_MessageStack; parent::__construct(); $this->_page_contents = 'edit.php'; if ((lc_empty(CFG_APP_IMAGEMAGICK_CONVERT) || !@file_exists(CFG_APP_IMAGEMAGICK_CONVERT)) && !lC_Image_Admin::hasGDSupport()) { $_SESSION['error'] = true; $_SESSION['errmsg'] = $lC_Language->get('ms_warning_image_processor_not_available'); } if (isset($_POST['subaction']) && $_POST['subaction'] == 'confirm') { $error = false; $has_variants = isset($_POST['variants']) ? true : false; $data = array('id' => isset($_POST['products_id']) ? $_POST['products_id'] : 0, 'quantity' => isset($_POST['products_quantity']) && $has_variants === false ? $_POST['products_quantity'] : 0, 'cost' => number_format(is_numeric($_POST['products_cost']) ? $_POST['products_cost'] : 0, DECIMAL_PLACES, '.', ''), 'price' => number_format(is_numeric($_POST['products_price']) ? $_POST['products_price'] : 0, DECIMAL_PLACES, '.', ''), 'msrp' => number_format(is_numeric($_POST['products_msrp']) ? $_POST['products_msrp'] : 0, DECIMAL_PLACES, '.', ''), 'weight' => $_POST['products_weight'], 'weight_class' => isset($_POST['products_weight_class']) ? $_POST['products_weight_class'] : '', 'status' => isset($_POST['products_status']) && $_POST['products_status'] == 'on' ? true : false, 'model' => isset($_POST['products_model']) ? $_POST['products_model'] : '', 'sku' => isset($_POST['products_sku']) ? $_POST['products_sku'] : '', 'tax_class_id' => isset($_POST['products_tax_class_id']) ? $_POST['products_tax_class_id'] : 0, 'shipping_rule_id' => isset($_POST['shipping_rule_id']) ? $_POST['shipping_rule_id'] : 0, 'products_name' => $_POST['products_name'], 'products_blurb' => $_POST['products_blurb'], 'products_description' => $_POST['products_description'], 'products_keyword' => $_POST['products_keyword'], 'products_tags' => $_POST['products_tags'], 'products_url' => $_POST['products_url'], 'has_children' => $has_variants, 'products_sort_order' => $_POST['products_sort_order']); if (isset($_POST['attributes'])) { $data['attributes'] = $_POST['attributes']; } if (isset($_POST['attributes2'])) { $data['attributes2'] = $_POST['attributes2']; } if (isset($_POST['categories'])) { $data['categories'] = $_POST['categories']; } if (isset($_POST['localimages'])) { $data['localimages'] = $_POST['localimages']; } // simple options if (isset($_POST['simple_options_group_name'])) { $data['simple_options_group_name'] = $_POST['simple_options_group_name']; } if (isset($_POST['simple_options_group_type'])) { $data['simple_options_group_type'] = $_POST['simple_options_group_type']; } if (isset($_POST['simple_options_group_sort_order'])) { $data['simple_options_group_sort_order'] = $_POST['simple_options_group_sort_order']; } if (isset($_POST['simple_options_group_status'])) { $data['simple_options_group_status'] = $_POST['simple_options_group_status']; } if (isset($_POST['simple_options_entry'])) { $data['simple_options_entry'] = $_POST['simple_options_entry']; } if (isset($_POST['simple_options_entry_price_modifier'])) { $data['simple_options_entry_price_modifier'] = $_POST['simple_options_entry_price_modifier']; } // specials if (isset($_POST['specials_pricing_switch']) && $_POST['specials_pricing_switch'] == 'on') { if (is_array($_POST['products_special_pricing'])) { $data['products_special_pricing'] = $_POST['products_special_pricing']; } $data['specials_pricing_switch'] = 1; if (isset($_POST['products_special_pricing_enable1'])) { $data['products_special_pricing_enable1'] = $_POST['products_special_pricing_enable1'] == 'on' ? 1 : 0; } if (isset($_POST['products_special_price'][1])) { $data['products_special_price1'] = $_POST['products_special_price'][1]; } if (isset($_POST['products_special_start_date'][1])) { $data['products_special_start_date1'] = $_POST['products_special_start_date'][1]; } if (isset($_POST['products_special_expires_date'][1])) { $data['products_special_expires_date1'] = $_POST['products_special_expires_date'][1]; } } // sub-products if (is_array($_POST['sub_products_name']) && count($_POST['sub_products_name']) > 1) { $data['has_subproducts'] = '1'; $data['sub_products_name'] = $_POST['sub_products_name']; if (isset($_POST['sub_products_default']) && $_POST['sub_products_default'] != NULL) { $data['sub_products_default'] = $_POST['sub_products_default']; } if (isset($_POST['sub_products_status']) && $_POST['sub_products_status'] != NULL) { $data['sub_products_status'] = $_POST['sub_products_status']; } if (isset($_POST['sub_products_weight']) && $_POST['sub_products_weight'] != NULL) { $data['sub_products_weight'] = $_POST['sub_products_weight']; } if (isset($_POST['sub_products_sku']) && $_POST['sub_products_sku'] != NULL) { $data['sub_products_sku'] = $_POST['sub_products_sku']; } if (isset($_POST['sub_products_qoh']) && $_POST['sub_products_qoh'] != NULL) { $data['sub_products_qoh'] = $_POST['sub_products_qoh']; } if (isset($_POST['sub_products_id']) && $_POST['sub_products_id'] != NULL) { $data['sub_products_id'] = $_POST['sub_products_id']; } if (isset($_POST['sub_products_cost']) && $_POST['sub_products_cost'] != NULL) { $data['sub_products_cost'] = $_POST['sub_products_cost']; } if (isset($_POST['sub_products_price']) && $_POST['sub_products_price'] != NULL) { $data['sub_products_price'] = $_POST['sub_products_price']; } } // qpb $data['qpb_pricing_switch'] = isset($_POST['qpb_pricing_switch']) && $_POST['qpb_pricing_switch'] == 'on' ? true : false; if (is_array($_POST['products_qty_break_point']) && $_POST['products_qty_break_point'][1] != NULL) { $data['products_qty_break_point'] = $_POST['products_qty_break_point']; } if (is_array($_POST['products_qty_break_price']) && $_POST['products_qty_break_price'][1] != NULL) { $data['products_qty_break_price'] = $_POST['products_qty_break_price']; } // multi SKU options if (isset($_POST['variants'])) { $data['variants'] = $_POST['variants']; } // access levels if (isset($_POST['access_levels'])) { $data['access_levels'] = $_POST['access_levels']; } // options pricing if (isset($_POST['options_pricing'])) { $data['options_pricing'] = $_POST['options_pricing']; } // specials pricing if (isset($_POST['specials_pricing'])) { $data['specials_pricing'] = $_POST['specials_pricing']; } // group pricing $data['groups_pricing_switch'] = isset($_POST['groups_pricing_switch']) && $_POST['groups_pricing_switch'] == 'on' ? true : false; if (isset($_POST['group_pricing'])) { $data['group_pricing'] = $_POST['group_pricing']; } if ($error === false) { // the line below is used as a hook match point - do not not modify or remove $id = (int) lC_Products_Admin::save(isset($_GET[$this->_module]) && is_numeric($_GET[$this->_module]) ? $_GET[$this->_module] : null, $data); if (is_numeric($id)) { if (empty($_POST['save_close'])) { lc_redirect_admin(lc_href_link_admin(FILENAME_DEFAULT, $this->_module . '=' . $id . '&action=save&cID=' . $_GET['cID'])); } else { lc_redirect_admin(lc_href_link_admin(FILENAME_DEFAULT, $this->_module . '&cID=' . $_GET['cID'])); } } else { $_SESSION['error'] = true; $_SESSION['errmsg'] = $lC_Language->get('ms_error_action_not_performed'); } lc_redirect_admin(lc_href_link_admin(FILENAME_DEFAULT, $this->_module . '&cID=' . $_GET['cID'])); } } }
public static function getFormData($id = null) { $result = array(); $result['cData'] = array(); if (isset($id) && $id != null) { $result['cData'] = lC_Configuration_Admin::getData($id); if (!lc_empty($result['cData']['set_function'])) { if ($result['cData']['configuration_key'] == 'STORE_ZONE') { if (lc_store_country_has_zones() == 1) { $result['valueField'] = lc_call_user_func($result['cData']['set_function'], $result['cData']['configuration_value'], $result['cData']['configuration_key']); } else { $result['valueField'] = lc_draw_input_field('configuration[' . $result['cData']['configuration_key'] . ']', $result['cData']['configuration_value'], 'style="width:96%"'); } } else { $result['valueField'] = lc_call_user_func($result['cData']['set_function'], $result['cData']['configuration_value'], $result['cData']['configuration_key']); } } else { $result['valueField'] = lc_draw_input_field('configuration[' . $result['cData']['configuration_key'] . ']', $result['cData']['configuration_value'], 'style="width:96%"'); } } return $result; }
/** * Display a banner. If no ID is passed, the value defined in $_exists_id is used. * * @param int $id The ID of the banner to show * @access public * @return string */ public function display($id = null) { global $lC_Database; $banner_string = ''; if (empty($id) && isset($this->_exists_id) && is_numeric($this->_exists_id)) { $id = $this->_exists_id; unset($this->_exists_id); } $Qbanner = $lC_Database->query('select * from :table_banners where banners_id = :banners_id and status = 1'); $Qbanner->bindTable(':table_banners', TABLE_BANNERS); $Qbanner->bindInt(':banners_id', $id); $Qbanner->execute(); if ($Qbanner->numberOfRows() > 0) { if (!lc_empty($Qbanner->value('banners_html_text'))) { $banner_string = $Qbanner->value('banners_html_text'); } else { if (!lc_empty($Qbanner->value('banners_url'))) { $banner_string = lc_link_object(lc_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $Qbanner->valueInt('banners_id')), lc_image(DIR_WS_IMAGES . $Qbanner->value('banners_image'), $Qbanner->value('banners_title')), $Qbanner->valueInt('banners_target') === 1 ? ' target="_blank" ' : ' target="_self" '); } else { $banner_string = lc_image(DIR_WS_IMAGES . $Qbanner->value('banners_image'), $Qbanner->value('banners_title')); } } $this->_updateDisplayCount($Qbanner->valueInt('banners_id')); if ($this->_show_duplicates_in_group === false) { $this->_shown_ids[] = $Qbanner->valueInt('banners_id'); } } return $banner_string; }
public function setBillingAddress($address_id) { global $lC_Database, $lC_Customer; $previous_address = false; if (isset($this->_billing_address['id'])) { $previous_address = $this->getBillingAddress(); } $Qaddress = $lC_Database->query('select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, ab.entry_telephone, z.zone_code, z.zone_name, ab.entry_country_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format, ab.entry_state from :table_address_book ab left join :table_zones z on (ab.entry_zone_id = z.zone_id) left join :table_countries c on (ab.entry_country_id = c.countries_id) where ab.customers_id = :customers_id and ab.address_book_id = :address_book_id'); $Qaddress->bindTable(':table_address_book', TABLE_ADDRESS_BOOK); $Qaddress->bindTable(':table_zones', TABLE_ZONES); $Qaddress->bindTable(':table_countries', TABLE_COUNTRIES); $Qaddress->bindInt(':customers_id', $lC_Customer->getID()); $Qaddress->bindInt(':address_book_id', $address_id); $Qaddress->execute(); if ($Qaddress->numberOfRows() === 1) { $this->_billing_address = array('id' => $address_id, 'firstname' => $Qaddress->valueProtected('entry_firstname'), 'lastname' => $Qaddress->valueProtected('entry_lastname'), 'company' => $Qaddress->valueProtected('entry_company'), 'street_address' => $Qaddress->valueProtected('entry_street_address'), 'suburb' => $Qaddress->valueProtected('entry_suburb'), 'city' => $Qaddress->valueProtected('entry_city'), 'postcode' => $Qaddress->valueProtected('entry_postcode'), 'state' => !lc_empty($Qaddress->valueProtected('entry_state')) ? $Qaddress->valueProtected('entry_state') : $Qaddress->valueProtected('zone_name'), 'zone_id' => $Qaddress->valueInt('entry_zone_id'), 'zone_code' => $Qaddress->value('zone_code'), 'country_id' => $Qaddress->valueInt('entry_country_id'), 'country_title' => $Qaddress->value('countries_name'), 'country_iso_code_2' => $Qaddress->value('countries_iso_code_2'), 'country_iso_code_3' => $Qaddress->value('countries_iso_code_3'), 'format' => $Qaddress->value('address_format'), 'telephone_number' => $Qaddress->value('entry_telephone')); if (is_array($previous_address) && ($previous_address['id'] != $this->_billing_address['id'] || $previous_address['country_id'] != $this->_billing_address['country_id'] || $previous_address['zone_id'] != $this->_billing_address['zone_id'] || $previous_address['state'] != $this->_billing_address['state'] || $previous_address['postcode'] != $this->_billing_address['postcode'])) { $this->_calculate(false); } } }
<th><?php echo $lC_Language->get('text_items'); ?> </th> <th><?php echo $lC_Language->get('text_total'); ?> </th> </tr> </thead> <tbody> <?php if (lC_Order::numberOfEntries() > 0) { $Qhistory = lC_Order::getListing(MAX_DISPLAY_ORDER_HISTORY); while ($Qhistory->next()) { if (!lc_empty($Qhistory->value('delivery_name'))) { $order_type = $lC_Language->get('order_shipped_to'); $order_name = $Qhistory->value('delivery_name'); } else { $order_type = $lC_Language->get('order_billed_to'); $order_name = $Qhistory->value('billing_name'); } ?> <tr> <td><a href="<?php 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>
public function sendEmail($id) { global $lC_Database, $lC_Language, $lC_Currencies, $lC_ShoppingCart; $Qorder = $lC_Database->query('select * from :table_orders where orders_id = :orders_id limit 1'); $Qorder->bindTable(':table_orders', TABLE_ORDERS); $Qorder->bindInt(':orders_id', $id); $Qorder->execute(); if ($Qorder->numberOfRows() === 1) { $email_order = STORE_NAME . "\n" . $lC_Language->get('email_order_separator') . "\n" . sprintf($lC_Language->get('email_order_order_number'), $id) . "\n" . sprintf($lC_Language->get('email_order_invoice_url'), lc_href_link(FILENAME_ACCOUNT, 'receipt=' . $id, 'SSL', false, true, true)) . "\n" . sprintf($lC_Language->get('email_order_date_ordered'), lC_DateTime::getLong()) . "\n\n" . $lC_Language->get('email_order_products') . "\n" . $lC_Language->get('email_order_separator') . "\n"; $Qproducts = $lC_Database->query('select orders_products_id, products_model, products_sku, products_name, products_price, products_tax, products_quantity from :table_orders_products where orders_id = :orders_id order by orders_products_id'); $Qproducts->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS); $Qproducts->bindInt(':orders_id', $id); $Qproducts->execute(); while ($Qproducts->next()) { $skuModel = $Qproducts->value('products_model') != NULL ? $Qproducts->value('products_model') : NULL; if ($skuModel == NULL) { $skuModel == ($Qproducts->value('products_sku') != NULL) ? $Qproducts->value('products_sku') : NULL; } $email_order .= $Qproducts->valueInt('products_quantity') . ' x ' . $Qproducts->value('products_name') . ' (' . $skuModel . ') = ' . $lC_Currencies->displayPriceWithTaxRate($Qproducts->value('products_price'), $Qproducts->value('products_tax'), $Qproducts->valueInt('products_quantity'), false, $Qorder->value('currency'), $Qorder->value('currency_value')) . "\n"; $Qvariants = $lC_Database->query('select group_title, value_title from :table_orders_products_variants where orders_id = :orders_id and orders_products_id = :orders_products_id order by id'); $Qvariants->bindTable(':table_orders_products_variants', TABLE_ORDERS_PRODUCTS_VARIANTS); $Qvariants->bindInt(':orders_id', $id); $Qvariants->bindInt(':orders_products_id', $Qproducts->valueInt('orders_products_id')); $Qvariants->execute(); while ($Qvariants->next()) { $email_order .= "\t" . $Qvariants->value('group_title') . ': ' . $Qvariants->value('value_title') . "\n"; } } unset($Qproducts); unset($Qvariants); $email_order .= $lC_Language->get('email_order_separator') . "\n"; $Qtotals = $lC_Database->query('select title, text from :table_orders_total where orders_id = :orders_id order by sort_order'); $Qtotals->bindTable(':table_orders_total', TABLE_ORDERS_TOTAL); $Qtotals->bindInt(':orders_id', $id); $Qtotals->execute(); while ($Qtotals->next()) { $email_order .= strip_tags($Qtotals->value('title') . ' ' . $Qtotals->value('text')) . "\n"; } unset($Qtotals); if (lc_empty($Qorder->value('delivery_name')) === false && lc_empty($Qorder->value('delivery_street_address')) === false) { $address = array('name' => $Qorder->value('delivery_name'), 'company' => $Qorder->value('delivery_company'), 'street_address' => $Qorder->value('delivery_street_address'), 'suburb' => $Qorder->value('delivery_suburb'), 'city' => $Qorder->value('delivery_city'), 'state' => $Qorder->value('delivery_state'), 'zone_code' => $Qorder->value('delivery_state_code'), 'country_title' => $Qorder->value('delivery_country'), 'country_iso2' => $Qorder->value('delivery_country_iso2'), 'country_iso3' => $Qorder->value('delivery_country_iso3'), 'postcode' => $Qorder->value('delivery_postcode'), 'format' => $Qorder->value('delivery_address_format')); $email_order .= "\n" . $lC_Language->get('email_order_delivery_address') . "\n" . $lC_Language->get('email_order_separator') . "\n" . lC_Address::format($address) . "\n"; unset($address); } $address = array('name' => $Qorder->value('billing_name'), 'company' => $Qorder->value('billing_company'), 'street_address' => $Qorder->value('billing_street_address'), 'suburb' => $Qorder->value('billing_suburb'), 'city' => $Qorder->value('billing_city'), 'state' => $Qorder->value('billing_state'), 'zone_code' => $Qorder->value('billing_state_code'), 'country_title' => $Qorder->value('billing_country'), 'country_iso2' => $Qorder->value('billing_country_iso2'), 'country_iso3' => $Qorder->value('billing_country_iso3'), 'postcode' => $Qorder->value('billing_postcode'), 'format' => $Qorder->value('billing_address_format')); $email_order .= "\n" . $lC_Language->get('email_order_billing_address') . "\n" . $lC_Language->get('email_order_separator') . "\n" . lC_Address::format($address) . "\n\n"; unset($address); $Qstatus = $lC_Database->query('select orders_status_name from :table_orders_status where orders_status_id = :orders_status_id and language_id = :language_id'); $Qstatus->bindTable(':table_orders_status', TABLE_ORDERS_STATUS); $Qstatus->bindInt(':orders_status_id', $Qorder->valueInt('orders_status')); $Qstatus->bindInt(':language_id', $lC_Language->getID()); $Qstatus->execute(); $email_order .= sprintf($lC_Language->get('email_order_status'), $Qstatus->value('orders_status_name')) . "\n" . $lC_Language->get('email_order_separator') . "\n"; unset($Qstatus); $Qstatuses = $lC_Database->query('select date_added, comments from :table_orders_status_history where orders_id = :orders_id and comments != "" order by orders_status_history_id'); $Qstatuses->bindTable(':table_orders_status_history', TABLE_ORDERS_STATUS_HISTORY); $Qstatuses->bindInt(':orders_id', $id); $Qstatuses->execute(); while ($Qstatuses->next()) { $email_order .= lC_DateTime::getLong($Qstatuses->value('date_added')) . "\n\t" . wordwrap(str_replace("\n", "\n\t", $Qstatuses->value('comments')), 60, "\n\t", 1) . "\n\n"; } unset($Qstatuses); if (is_object($lC_ShoppingCart)) { $email_order .= $lC_Language->get('email_order_payment_method') . "\n" . $lC_Language->get('email_order_separator') . "\n"; $email_order .= $Qorder->value('payment_method') . "\n\n"; /*if (isset($this->email_footer)) { $email_order .= $this->email_footer . "\n\n"; }*/ } lc_email($Qorder->value('customers_name'), $Qorder->value('customers_email_address'), $lC_Language->get('email_order_subject'), $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); // send emails to other people if (SEND_EXTRA_ORDER_EMAILS_TO != '') { lc_email('', SEND_EXTRA_ORDER_EMAILS_TO, $lC_Language->get('email_order_subject'), $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); } } unset($Qorder); }
'); return false; } $.modal({ content: '<div id="backupContent">'+ ' <form name="bBackup" id="bBackup" action="" method="post">'+ ' <p><?php echo $lC_Language->get('introduction_new_backup'); ?> </p>'+ ' <p><?php echo lc_draw_radio_field('compression', $compression_array, 'none', null, ' <br />'); ?> </p>'+ ' <p><?php if (!lc_empty(DIR_FS_BACKUP) && @is_dir(DIR_FS_BACKUP) && @is_writeable(DIR_FS_BACKUP)) { echo lc_draw_checkbox_field('download_only', array(array('id' => 'yes', 'text' => $lC_Language->get('field_download_only')))); } else { echo lc_draw_radio_field('download_only', array(array('id' => 'yes', 'text' => $lC_Language->get('field_download_only'))), true); } ?> </p>'+ ' </form>'+ '</div>', title: '<?php echo $lC_Language->get('modal_heading_new_backup'); ?> ', width: 300, actions: { 'Close' : {
$Qmanufacturer->bindInt(':manufacturers_id', $_GET['manufacturers_id']); $Qmanufacturer->bindInt(':languages_id', $lC_Language->getID()); $Qmanufacturer->execute(); if ($Qmanufacturer->numberOfRows() && !lc_empty($Qmanufacturer->value('manufacturers_url'))) { $Qupdate = $lC_Database->query('update :table_manufacturers_info set url_clicked = url_clicked+1, date_last_click = now() where manufacturers_id = :manufacturers_id and languages_id = :languages_id'); $Qupdate->bindTable(':table_manufacturers_info', TABLE_MANUFACTURERS_INFO); $Qupdate->bindInt(':manufacturers_id', $_GET['manufacturers_id']); $Qupdate->bindInt(':languages_id', $lC_Language->getID()); $Qupdate->execute(); lc_redirect($Qmanufacturer->value('manufacturers_url')); } else { // no url exists for the selected language, lets use the default language then $Qmanufacturer = $lC_Database->query('select mi.languages_id, mi.manufacturers_url from :table_manufacturers_info mi, :table_languages l where mi.manufacturers_id = :manufacturers_id and mi.languages_id = l.languages_id and l.code = :code'); $Qmanufacturer->bindTable(':table_manufacturers_info', TABLE_MANUFACTURERS_INFO); $Qmanufacturer->bindTable(':table_languages', TABLE_LANGUAGES); $Qmanufacturer->bindInt(':manufacturers_id', $_GET['manufacturers_id']); $Qmanufacturer->bindValue(':code', DEFAULT_LANGUAGE); $Qmanufacturer->execute(); if ($Qmanufacturer->numberOfRows() && !lc_empty($Qmanufacturer->value('manufacturers_url'))) { $Qupdate = $lC_Database->query('update :table_manufacturers_info set url_clicked = url_clicked+1, date_last_click = now() where manufacturers_id = :manufacturers_id and languages_id = :languages_id'); $Qupdate->bindTable(':table_manufacturers_info', TABLE_MANUFACTURERS_INFO); $Qupdate->bindInt(':manufacturers_id', $_GET['manufacturers_id']); $Qupdate->bindInt(':languages_id', $Qmanufacturer->valueInt('languages_id')); $Qupdate->execute(); lc_redirect($Qmanufacturer->value('manufacturers_url')); } } } break; } lc_redirect(lc_href_link(FILENAME_DEFAULT));