Example #1
0
 public function lC_Products_Images()
 {
     global $lC_Session, $lC_Language, $lC_Product;
     if (empty($_GET) === false) {
         $id = false;
         $counter = 0;
         foreach ($_GET as $key => $value) {
             $counter++;
             if ($counter < 2) {
                 continue;
             }
             if ((preg_match('/^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$/', $key) || preg_match('/^[a-zA-Z0-9 -_]*$/', $key)) && $key != $lC_Session->getName()) {
                 $id = $key;
             }
             break;
         }
         if ($id !== false && lC_Product::checkEntry($id)) {
             $lC_Product = new lC_Product($id);
             $this->addPageTags('keywords', $lC_Product->getTitle());
             $this->addPageTags('keywords', $lC_Product->getModel());
             if ($lC_Product->hasTags()) {
                 $this->addPageTags('keywords', $lC_Product->getTags());
             }
             $this->_page_title = $lC_Product->getTitle();
         } else {
             $this->_page_title = $lC_Language->get('product_not_found_heading');
             $this->_page_contents = 'info_not_found.php';
         }
     } else {
         $this->_page_title = $lC_Language->get('product_not_found_heading');
         $this->_page_contents = 'info_not_found.php';
     }
 }
Example #2
0
 function execute()
 {
     global $lC_Database, $lC_Session, $lC_NavigationHistory, $lC_Customer;
     if (!$lC_Customer->isLoggedOn()) {
         $lC_NavigationHistory->setSnapshot();
         lc_redirect(lc_href_link(FILENAME_ACCOUNT, 'login', 'SSL'));
         return false;
     }
     $id = false;
     foreach ($_GET as $key => $value) {
         if ((preg_match('/^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$/', $key) || preg_match('/^[a-zA-Z0-9 -_]*$/', $key)) && $key != $lC_Session->getName()) {
             $id = $key;
         }
         break;
     }
     if ($id !== false && lC_Product::checkEntry($id)) {
         $lC_Product = new lC_Product($id);
         $Qcheck = $lC_Database->query('select products_id from :table_products_notifications where customers_id = :customers_id and products_id = :products_id limit 1');
         $Qcheck->bindTable(':table_products_notifications', TABLE_PRODUCTS_NOTIFICATIONS);
         $Qcheck->bindInt(':customers_id', $lC_Customer->getID());
         $Qcheck->bindInt(':products_id', $lC_Product->getID());
         $Qcheck->execute();
         if ($Qcheck->numberOfRows() > 0) {
             $Qn = $lC_Database->query('delete from :table_products_notifications where customers_id = :customers_id and products_id = :products_id');
             $Qn->bindTable(':table_products_notifications', TABLE_PRODUCTS_NOTIFICATIONS);
             $Qn->bindInt(':customers_id', $lC_Customer->getID());
             $Qn->bindInt(':products_id', $lC_Product->getID());
             $Qn->execute();
         }
     }
     lc_redirect(lc_href_link(basename($_SERVER['SCRIPT_FILENAME']), lc_get_all_get_params(array('action'))));
 }
Example #3
0
 function execute()
 {
     global $lC_Session, $lC_ShoppingCart, $lC_Product, $lC_Language, $lC_Customer;
     if (!isset($lC_Product)) {
         $id = false;
         foreach ($_GET as $key => $value) {
             if ((is_numeric($key) || preg_match('/^[a-zA-Z0-9 -_]*$/', $key)) && $key != $lC_Session->getName()) {
                 $id = $key;
             }
             break;
         }
         if ($id !== false && lC_Product::checkEntry($id)) {
             $lC_Product = new lC_Product($id);
         }
     }
     if (isset($lC_Product)) {
         // VQMOD-hookpoint; DO NOT MODIFY OR REMOVE THE LINE BELOW
         $quantity = isset($_POST['quantity']) && !empty($_POST['quantity']) ? (int) $_POST['quantity'] : 1;
         if ($lC_Product->hasVariants()) {
             if (isset($_POST['variants']) && is_array($_POST['variants']) && !empty($_POST['variants'])) {
                 if ($lC_Product->variantExists($_POST['variants'])) {
                     $lC_ShoppingCart->add($lC_Product->getProductVariantID($_POST['variants']), $quantity);
                 } else {
                     lc_redirect(lc_href_link(FILENAME_PRODUCTS, $lC_Product->getKeyword() . '&error=' . urlencode($lC_Language->get('variant_combo_not_available'))));
                     return false;
                 }
             } else {
                 lc_redirect(lc_href_link(FILENAME_PRODUCTS, $lC_Product->getKeyword()));
                 return false;
             }
         } else {
             if (isset($_GET['info']) && $_GET['info'] == '1') {
             } else {
                 if ($lC_Product->hasSubProducts($lC_Product->getID()) || $lC_Product->hasSimpleOptions()) {
                     lc_redirect(lc_href_link(FILENAME_PRODUCTS, $lC_Product->getKeyword()));
                 }
             }
             if (isset($_POST['quantity']) && is_array($_POST['quantity'])) {
                 foreach ($_POST['quantity'] as $product_id => $quantity) {
                     $lC_ShoppingCart->add((int) $product_id, (int) $quantity);
                 }
             } else {
                 $lC_ShoppingCart->add($lC_Product->getID(), $quantity);
             }
         }
     }
     lc_redirect(lc_href_link(FILENAME_CHECKOUT));
 }
Example #4
0
 function execute()
 {
     global $lC_Database, $lC_Session, $lC_NavigationHistory, $lC_Customer;
     if (!$lC_Customer->isLoggedOn()) {
         $lC_NavigationHistory->setSnapshot();
         lc_redirect(lc_href_link(FILENAME_ACCOUNT, 'login', 'SSL'));
         return false;
     }
     $notifications = array();
     if (isset($_GET['products']) && !empty($_GET['products'])) {
         $products_array = explode(';', $_GET['products']);
         foreach ($products_array as $product_id) {
             if (is_numeric($product_id) && !in_array($product_id, $notifications)) {
                 $notifications[] = $product_id;
             }
         }
     } else {
         $id = false;
         foreach ($_GET as $key => $value) {
             if ((preg_match('/^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$/', $key) || preg_match('/^[a-zA-Z0-9 -_]*$/', $key)) && $key != $lC_Session->getName()) {
                 $id = $key;
             }
             break;
         }
         if ($id !== false && lC_Product::checkEntry($id)) {
             $lC_Product = new lC_Product($id);
             $notifications[] = $lC_Product->getID();
         }
     }
     if (!empty($notifications)) {
         foreach ($notifications as $product_id) {
             $Qcheck = $lC_Database->query('select products_id from :table_products_notifications where customers_id = :customers_id and products_id = :products_id limit 1');
             $Qcheck->bindTable(':table_products_notifications', TABLE_PRODUCTS_NOTIFICATIONS);
             $Qcheck->bindInt(':customers_id', $lC_Customer->getID());
             $Qcheck->bindInt(':products_id', $product_id);
             $Qcheck->execute();
             if ($Qcheck->numberOfRows() < 1) {
                 $Qn = $lC_Database->query('insert into :table_products_notifications (products_id, customers_id, date_added) values (:products_id, :customers_id, :date_added)');
                 $Qn->bindTable(':table_products_notifications', TABLE_PRODUCTS_NOTIFICATIONS);
                 $Qn->bindInt(':products_id', $product_id);
                 $Qn->bindInt(':customers_id', $lC_Customer->getID());
                 $Qn->bindRaw(':date_added', 'now()');
                 $Qn->execute();
             }
         }
     }
     lc_redirect(lc_href_link(basename($_SERVER['SCRIPT_FILENAME']), lc_get_all_get_params(array('action'))));
 }
Example #5
0
 public function lC_Products_Tell_a_friend()
 {
     global $lC_Services, $lC_Session, $lC_Language, $lC_Breadcrumb, $lC_Customer, $lC_NavigationHistory, $lC_Product;
     if (ALLOW_GUEST_TO_TELL_A_FRIEND == '-1' && $lC_Customer->isLoggedOn() === false) {
         $lC_NavigationHistory->setSnapshot();
         lc_redirect(lc_href_link(FILENAME_ACCOUNT, 'login', 'SSL'));
     }
     $counter = 0;
     foreach ($_GET as $key => $value) {
         $counter++;
         if ($counter < 2) {
             continue;
         }
         if ((preg_match('/^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$/', $key) || preg_match('/^[a-zA-Z0-9 -_]*$/', $key)) && $key != $lC_Session->getName()) {
             if (lC_Product::checkEntry($key) === false) {
                 $this->_page_title = $lC_Language->get('product_not_found_heading');
                 $this->_page_contents = 'info_not_found.php';
             } else {
                 $lC_Product = new lC_Product($key);
                 $this->_page_title = $lC_Product->getTitle();
                 if ($lC_Services->isStarted('breadcrumb')) {
                     $lC_Breadcrumb->add($lC_Product->getTitle(), lc_href_link(FILENAME_PRODUCTS, $lC_Product->getKeyword()));
                     $lC_Breadcrumb->add($lC_Language->get('breadcrumb_tell_a_friend'), lc_href_link(FILENAME_PRODUCTS, $this->_module . '&' . $lC_Product->getKeyword()));
                 }
                 if (isset($_GET['action']) && $_GET['action'] == 'process') {
                     $this->_process();
                 }
             }
             break;
         }
     }
     if ($counter < 2) {
         $this->_page_title = $lC_Language->get('product_not_found_heading');
         $this->_page_contents = 'info_not_found.php';
     }
 }
 public function hasProducts()
 {
     if (SERVICE_RECENTLY_VISITED_SHOW_PRODUCTS == '1') {
         if (isset($this->visits['products']) && !empty($this->visits['products'])) {
             foreach ($this->visits['products'] as $k => $v) {
                 if (!lC_Product::checkEntry($v['id'])) {
                     unset($this->visits['products'][$k]);
                 }
             }
             return sizeof($this->visits['products']) > 0;
         }
     }
     return false;
 }
Example #7
0
 public function lC_Products_Products()
 {
     global $lC_Database, $lC_Services, $lC_Session, $lC_Language, $lC_Breadcrumb, $lC_Product, $lC_Image, $lC_Currencies, $cPath_array;
     $template_code = isset($_SESSION['template']['code']) && $_SESSION['template']['code'] != NULL ? $_SESSION['template']['code'] : 'core';
     if (empty($_GET) === false) {
         $id = false;
         // PHP < 5.0.2; array_slice() does not preserve keys and will not work with numerical key values, so foreach() is used
         foreach ($_GET as $key => $value) {
             $key = end(explode("/", $key));
             if ((preg_match('/^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$/', $key) || preg_match('/^[a-zA-Z0-9 -_]*$/', $key)) && $key != $lC_Session->getName()) {
                 $id = $key;
             }
             break;
         }
         if ($id !== false && lC_Product::checkEntry($id)) {
             $lC_Product = new lC_Product($id);
             $lC_Product->incrementCounter();
             if (strtotime($lC_Product->getDateAvailable()) <= strtotime(lC_Datetime::getShort())) {
                 $this->addPageTags('description', substr(strip_tags($lC_Product->getDescription()), 0, 300));
                 $this->addPageTags('keywords', $lC_Product->getTitle());
                 $this->addPageTags('keywords', $lC_Product->getModel());
                 if ($lC_Product->hasTags()) {
                     $this->addPageTags('keywords', $lC_Product->getTags());
                 }
                 $this->addOGPTags('type', 'product');
                 $this->addOGPTags('title', $lC_Product->getTitle() . ' ' . $lC_Product->getModel());
                 $this->addOGPTags('description', $lC_Currencies->displayPrice($lC_Product->getPrice(), $lC_Product->getTaxClassID()) . ' - ' . $lC_Product->getTitle() . ' ' . lc_clean_html($lC_Product->getDescription()));
                 $this->addOGPTags('url', lc_href_link(FILENAME_PRODUCTS, $lC_Product->getKeyword(), 'NONSSL', false, true, true));
                 $this->addOGPTags('image', HTTP_SERVER . DIR_WS_CATALOG . 'templates/' . $template_code . '/images/logo.png');
                 $this->addOGPTags('image', HTTP_SERVER . DIR_WS_CATALOG . $lC_Image->getAddress($lC_Product->getImage(), 'large'));
                 if ($lC_Product->getImages() != '') {
                     foreach ($lC_Product->getImages() as $key => $value) {
                         if ($value['default_flag'] == true) {
                             continue;
                         }
                         if (file_exists(DIR_FS_CATALOG . $lC_Image->getAddress($value['image'], 'popup'))) {
                             $this->addOGPTags('image', HTTP_SERVER . DIR_WS_CATALOG . $lC_Image->getAddress($value['image'], 'large'));
                         }
                     }
                 }
                 lC_Services_category_path::process($lC_Product->getCategoryID());
                 if (empty($cPath_array) && $_GET['cPath'] == '' && isset($lC_Services) && $lC_Services->isStarted('seo')) {
                     foreach ($_GET as $cats => $values) {
                         $cats = explode("/", $cats);
                         foreach ($cats as $cat) {
                             $Qcid = $lC_Database->query('select item_id from :table_permalinks where permalink = :permalink and type = 1 and language_id = :language_id');
                             $Qcid->bindTable(':table_permalinks', TABLE_PERMALINKS);
                             $Qcid->bindValue(':permalink', $cat);
                             $Qcid->bindInt(':language_id', $lC_Language->getID());
                             $Qcid->execute();
                             $cPath_array[] = $Qcid->valueInt('item_id');
                         }
                     }
                 }
                 if ($lC_Services->isStarted('breadcrumb')) {
                     if (isset($_GET['cPath']) && $_GET['cPath'] != '') {
                         $path = $_GET['cPath'];
                     } else {
                         $path = implode("_", $cPath_array);
                     }
                     $lC_Breadcrumb->add($lC_Product->getTitle(), lc_href_link(FILENAME_PRODUCTS, $lC_Product->getKeyword()), $path);
                 }
                 $this->_page_title = $lC_Product->getTitle();
             } else {
                 $this->_page_title = $lC_Language->get('product_not_found_heading');
                 $this->_page_contents = 'info_not_available.php';
             }
         } else {
             $this->_page_title = $lC_Language->get('product_not_found_heading');
             $this->_page_contents = 'info_not_found.php';
         }
     } else {
         $this->_page_title = $lC_Language->get('product_not_found_heading');
         $this->_page_contents = 'info_not_found.php';
     }
 }
Example #8
0
 public function lC_Products_Reviews()
 {
     global $lC_Services, $lC_Session, $lC_Language, $lC_Breadcrumb, $lC_Product, $lC_Customer, $lC_NavigationHistory, $lC_Image, $lC_Currencies;
     if ($lC_Services->isStarted('reviews') === false) {
         lc_redirect(lc_href_link(FILENAME_DEFAULT));
     }
     $this->_page_title = $lC_Language->get('reviews_heading');
     $template_code = isset($_SESSION['template']['code']) && $_SESSION['template']['code'] != NULL ? $_SESSION['template']['code'] : 'core';
     $this->addJavascriptPhpFilename('templates/' . $template_code . '/javascript/form_check.js.php');
     if ($lC_Services->isStarted('breadcrumb')) {
         $lC_Breadcrumb->add($lC_Language->get('breadcrumb_reviews'), lc_href_link(FILENAME_PRODUCTS, $this->_module));
     }
     if (is_numeric($_GET[$this->_module])) {
         if (lC_Reviews::exists($_GET[$this->_module])) {
             $lC_Product = new lC_Product(lC_Reviews::getProductID($_GET[$this->_module]));
             $this->_page_title = $lC_Product->getTitle();
             $this->addOGPTags('type', 'product');
             $this->addOGPTags('title', $lC_Product->getTitle() . ' ' . $lC_Product->getModel());
             $this->addOGPTags('description', $lC_Currencies->displayPrice($lC_Product->getPrice(), $lC_Product->getTaxClassID()) . ' - ' . $lC_Product->getTitle() . ' ' . lc_clean_html($lC_Product->getDescription()));
             $this->addOGPTags('url', lc_href_link(FILENAME_PRODUCTS, $lC_Product->getKeyword(), 'NONSSL', false, true, true));
             $this->addOGPTags('image', HTTP_SERVER . DIR_WS_CATALOG . 'templates/' . $template_code . '/images/logo.png');
             $this->addOGPTags('image', HTTP_SERVER . DIR_WS_CATALOG . $lC_Image->getAddress($lC_Product->getImage(), 'large'));
             foreach ($lC_Product->getImages() as $key => $value) {
                 if ($value['default_flag'] == true) {
                     continue;
                 }
                 if (file_exists(DIR_FS_CATALOG . $lC_Image->getAddress($value['image'], 'popup'))) {
                     $this->addOGPTags('image', HTTP_SERVER . DIR_WS_CATALOG . $lC_Image->getAddress($value['image'], 'large'));
                 }
             }
         }
         $this->_page_contents = 'reviews_info.php';
         if ($lC_Services->isStarted('breadcrumb')) {
             $lC_Breadcrumb->add($lC_Product->getTitle(), lc_href_link(FILENAME_PRODUCTS, $this->_module . '=' . $_GET[$this->_module]));
         }
     } else {
         $this->_page_contents = 'reviews_not_found.php';
     }
     $counter = 0;
     foreach ($_GET as $key => $value) {
         $counter++;
         if ($counter < 2) {
             continue;
         }
         if ((preg_match('/^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$/', $key) || preg_match('/^[a-zA-Z0-9 -_]*$/', $key)) && $key != $lC_Session->getName()) {
             if (lC_Product::checkEntry($key) === false) {
                 $this->_page_contents = 'info_not_found.php';
             } elseif ($_GET[$this->_module] == 'new') {
                 if ($lC_Customer->isLoggedOn() === false && SERVICE_REVIEW_ENABLE_REVIEWS == 1) {
                     $lC_NavigationHistory->setSnapshot();
                     lc_redirect(lc_href_link(FILENAME_ACCOUNT, 'login', 'SSL'));
                 }
                 $lC_Product = new lC_Product($key);
                 $this->_page_title = $lC_Product->getTitle();
                 $this->_page_contents = 'reviews_new.php';
                 if ($lC_Services->isStarted('breadcrumb')) {
                     $lC_Breadcrumb->add($lC_Product->getTitle(), lc_href_link(FILENAME_PRODUCTS, $this->_module . '&' . $lC_Product->getKeyword()));
                     $lC_Breadcrumb->add($lC_Language->get('breadcrumb_reviews_new'), lc_href_link(FILENAME_PRODUCTS, $this->_module . '=new&' . $lC_Product->getKeyword()));
                 }
                 if (isset($_GET['action']) && $_GET['action'] == 'process') {
                     $this->_process($lC_Product->getID());
                 }
             } else {
                 $lC_Product = new lC_Product($key);
                 $this->_page_title = $lC_Product->getTitle();
                 $this->_page_contents = 'product_reviews.php';
                 if ($lC_Services->isStarted('breadcrumb')) {
                     $lC_Breadcrumb->add($lC_Product->getTitle(), lc_href_link(FILENAME_PRODUCTS, $this->_module . '&' . $lC_Product->getKeyword()));
                 }
             }
         }
         break;
     }
     if ($counter < 2) {
         if (lC_Reviews::exists() === false) {
             $this->_page_contents = 'reviews_not_found.php';
         }
     }
 }