Exemplo n.º 1
0
 function __construct()
 {
     global $lC_Language, $breadcrumb_string;
     $this->_page_title = $lC_Language->get('heading_title');
     $current_category_id = 0;
     if (is_numeric($_GET[$this->_module])) {
         $current_category_id = $_GET[$this->_module];
     }
     $lC_CategoryTree = new lC_CategoryTree_Admin();
     if (!isset($_GET['action'])) {
         $_GET['action'] = '';
     }
     // check if the categories image directory exists
     if (is_dir('../images/categories')) {
         if (!is_writeable('../images/categories')) {
             $_SESSION['error'] = true;
             $_SESSION['errmsg'] = sprintf($lC_Language->get('ms_error_image_directory_not_writable'), realpath('../images/categories'));
         }
     } else {
         $_SESSION['error'] = true;
         $_SESSION['errmsg'] = sprintf($lC_Language->get('ms_error_image_directory_non_existant'), realpath('../images/categories'));
     }
     // setup the breadcrumb
     $breadcrumb_array = array(lc_link_object(lc_href_link_admin(FILENAME_DEFAULT, $this->_module), $lC_Language->get('text_top')));
     foreach ($lC_CategoryTree->getPathArray($current_category_id) as $category) {
         $breadcrumb_array[] = lc_link_object(lc_href_link_admin(FILENAME_DEFAULT, $this->_module . '=' . $category['id']), $category['name']);
     }
     $breadcrumb_string = '<ul>';
     foreach ($breadcrumb_array as $key => $value) {
         $breadcrumb_string .= '<li>' . $value . '</li>';
     }
     $breadcrumb_string .= '</ul>';
 }
Exemplo n.º 2
0
 public function __construct()
 {
     global $lC_Language, $lC_MessageStack;
     parent::__construct();
     $this->_page_contents = 'edit.php';
     if (isset($_POST['subaction']) && $_POST['subaction'] == 'confirm') {
         switch ($_GET['action']) {
             case 'save':
                 $data = array('oid' => $_POST['oid'], 'status' => $_POST['status'], 'comment' => $_POST['comment'], 'notify_customer' => isset($_POST['notify_customer']) && $_POST['notify_customer'] == 1 ? true : false, 'append_comment' => isset($_POST['append_comment']) && $_POST['append_comment'] == 1 ? true : false);
                 /*
                  * Update the order status
                  *
                  * @param integer $data['oid'] The orders id used on status update
                  * @param array $data The order status information
                  * @access public
                  * @return boolean
                  */
                 if (lC_Orders_Admin::updateStatus($data['oid'], $data)) {
                     lc_redirect_admin(lc_href_link_admin(FILENAME_DEFAULT, $this->_module . '=' . $data['oid'] . '&action=save'));
                 } else {
                     $_SESSION['error'] = true;
                     $_SESSION['errmsg'] = $lC_Language->get('ms_error_action_not_performed');
                 }
                 break;
         }
     }
 }
Exemplo n.º 3
0
 public function __construct()
 {
     global $lC_Language, $lC_Statistics, $lC_Vqmod, $breadcrumb_string;
     $this->_page_title = $lC_Language->get('heading_title');
     if (!isset($_GET['module'])) {
         $_GET['module'] = '';
     }
     if (!empty($_GET['module']) && !file_exists('includes/modules/statistics/' . $_GET['module'] . '.php')) {
         $_GET['module'] = '';
     }
     if (empty($_GET['module'])) {
         $this->_page_contents = 'listing.php';
     } else {
         include_once $lC_Vqmod->modCheck('includes/modules/statistics/' . $_GET['module'] . '.php');
         $class = 'lC_Statistics_' . str_replace(' ', '_', ucwords(str_replace('_', ' ', $_GET['module'])));
         $lC_Statistics = new $class();
         $lC_Statistics->activate();
         $breadcrumb_array = array(lc_link_object(lc_href_link_admin(FILENAME_DEFAULT, $this->_module), $lC_Language->get('heading_title')));
         $breadcrumb_array[] = lc_link_object(lc_href_link_admin(FILENAME_DEFAULT, $this->_module . '&module=' . $_GET['module']), $lC_Statistics->getTitle());
         $breadcrumb_string = '<ul>';
         foreach ($breadcrumb_array as $key => $value) {
             $breadcrumb_string .= '<li>' . $value . '</li>';
         }
         $breadcrumb_string .= '</ul>';
     }
 }
Exemplo n.º 4
0
 public function __construct()
 {
     global $lC_Database, $lC_Language, $lC_MessageStack;
     parent::__construct();
     if (isset($_SESSION['img_resize_flag'])) {
         unset($_SESSION['img_resize_flag']);
     }
     if (!empty($_POST['user_name']) && !empty($_POST['user_password'])) {
         $Qadmin = $lC_Database->query('select * from :table_administrators where user_name = :user_name');
         $Qadmin->bindTable(':table_administrators', TABLE_ADMINISTRATORS);
         $Qadmin->bindValue(':user_name', $_POST['user_name']);
         $Qadmin->execute();
         if ($Qadmin->numberOfRows() > 0) {
             if (lc_validate_password($_POST['user_password'], $Qadmin->value('user_password'))) {
                 $_SESSION['admin'] = array('id' => $Qadmin->valueInt('id'), 'firstname' => $Qadmin->value('first_name'), 'lastname' => $Qadmin->value('last_name'), 'username' => $Qadmin->value('user_name'), 'password' => $Qadmin->value('user_password'), 'access' => lC_Access::getUserLevels($Qadmin->valueInt('access_group_id')), 'language_id' => $Qadmin->value('language_id'));
                 $get_string = null;
                 if (isset($_SESSION['redirect_origin'])) {
                     $get_string = http_build_query($_SESSION['redirect_origin']['get']);
                     if (substr($get_string, -1) == '=') {
                         $get_string = substr($get_string, 0, -1);
                     }
                     unset($_SESSION['redirect_origin']);
                 }
                 if (defined('INSTALLATION_ID') && INSTALLATION_ID != NULL) {
                     lc_redirect_admin(lc_href_link_admin(FILENAME_DEFAULT, $get_string));
                 } else {
                     // redirect to login=register
                     lc_redirect_admin(lc_href_link_admin(FILENAME_DEFAULT, 'login&action=register'));
                 }
             }
         }
     }
     $_SESSION['error'] = true;
     $_SESSION['errmsg'] = $lC_Language->get('ms_error_login_invalid');
 }
Exemplo n.º 5
0
 public static function getAll()
 {
     global $lC_Language;
     $media = $_GET['media'];
     $lC_DirectoryListing = new lC_DirectoryListing(DIR_FS_BACKUP);
     $lC_DirectoryListing->setIncludeDirectories(false);
     $lC_DirectoryListing->setCheckExtension('zip');
     $lC_DirectoryListing->setCheckExtension('sql');
     $lC_DirectoryListing->setCheckExtension('gz');
     $cnt = 0;
     $result = array('aaData' => array());
     foreach ($lC_DirectoryListing->getFiles() as $file) {
         $downloadLink = lc_href_link_admin(FILENAME_DEFAULT, 'backup&action=download&file=' . $file['name']);
         $check = '<td><input class="batch" type="checkbox" name="batch[]" value="' . $file['name'] . '" id="' . $file['name'] . '"></td>';
         $filename = '<td><a href="' . $downloadLink . '"><span class="icon-download icon-orange with-tooltip" title="' . $lC_Language->icon_download . '">&nbsp;' . $file['name'] . '</a></td>';
         $date = '<td>' . lC_DateTime::getShort(lC_DateTime::fromUnixTimestamp(@filemtime(DIR_FS_BACKUP . $file['name'])), true) . '</td>';
         $size = '<td>' . number_format(@filesize(DIR_FS_BACKUP . $file['name'])) . '</td>';
         $action = '<td class="align-right vertical-center"><span class="button-group compact">
   <a href="' . ((int) ($_SESSION['admin']['access']['backup'] < 3) ? '#' : 'javascript://" onclick="restoreEntry(\'' . $file['name'] . '\')') . '" class="button icon-pencil' . ((int) ($_SESSION['admin']['access']['backup'] < 3) ? ' disabled' : NULL) . '">' . ($media === 'mobile-portrait' || $media === 'mobile-landscape' ? NULL : $lC_Language->get('icon_restore')) . '</a>
   <a href="' . ((int) ($_SESSION['admin']['access']['backup'] < 4) ? '#' : 'javascript://" onclick="deleteEntry(\'' . $file['name'] . '\', \'' . urlencode($file['name']) . '\')') . '" class="button icon-trash with-tooltip' . ((int) ($_SESSION['admin']['access']['backup'] < 4) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('icon_delete') . '"></a>
   </span></td>';
         $result['aaData'][] = array("{$check}", "{$filename}", "{$date}", "{$size}", "{$action}");
         $cnt++;
     }
     $result['total'] = $cnt;
     return $result;
 }
Exemplo n.º 6
0
 /**
  * Returns the featured products datatable data for listings
  *
  * @access public
  * @return array
  */
 public static function getAll()
 {
     global $lC_Database, $lC_Language, $lC_Currencies, $_module;
     $media = $_GET['media'];
     $Qfeatured = $lC_Database->query('select * from :table_featured_products');
     $Qfeatured->bindTable(':table_featured_products', TABLE_FEATURED_PRODUCTS);
     $Qfeatured->execute();
     $result = array('aaData' => array());
     while ($Qfeatured->next()) {
         $Qname = $lC_Database->query('select products_name from :table_products_description where products_id = :products_id');
         $Qname->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
         $Qname->bindInt(':products_id', $Qfeatured->value('products_id'));
         $Qname->execute();
         $check = '<td><input class="batch" type="checkbox" name="batch[]" value="' . $Qfeatured->valueInt('id') . '" id="' . $Qfeatured->valueInt('id') . '"></td>';
         $name = '<td>' . $Qname->value('products_name') . '</td>';
         $expires = '<td><span' . (date("Y-m-d H:i:s") > $Qfeatured->value('expires_date') && $Qfeatured->value('expires_date') != '0000-00-00 00:00:00' ? ' class="red bold with-tooltip" title="' . $lC_Language->get('text_featured_product_expired') . '"' : '') . '>' . ($Qfeatured->value('expires_date') != '0000-00-00 00:00:00' ? lC_DateTime::getShort($Qfeatured->value('expires_date')) : $lC_Language->get('text_featured_product_no_expiration')) . '</span></td>';
         $status = '<td><span id="status_' . $Qfeatured->value('id') . '" onclick="updateStatus(\'' . $Qfeatured->valueInt('id') . '\', \'' . ($Qfeatured->valueInt('status') == 1 ? -1 : 1) . '\');">' . ($Qfeatured->valueInt('status') == 1 ? '<span class="icon-tick icon-size2 icon-green cursor-pointer with-tooltip" title="' . $lC_Language->get('text_disable') . '"></span>' : '<span class="icon-cross icon-size2 icon-red cursor-pointer with-tooltip" title="' . $lC_Language->get('text_enable') . '"></span>') . '</span></td>';
         $action = '<td class="align-right vertical-center">
                <span class="button-group">
                  <a href="' . ((int) ($_SESSION['admin']['access'][$_module] < 3) ? '#' : lc_href_link_admin(FILENAME_DEFAULT, $_module . '=' . $Qfeatured->valueInt('id') . '&action=save')) . '" 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>
                </span>
                <span class="button-group">
                  <a href="' . ((int) ($_SESSION['admin']['access'][$_module] < 4) ? '#' : 'javascript://" onclick="deleteFeaturedProduct(\'' . $Qfeatured->valueInt('id') . '\', \'' . $Qname->value('products_name') . '\')') . '" class="button icon-trash with-tooltip' . ((int) ($_SESSION['admin']['access'][$_module] < 4) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('icon_delete') . '"></a>
                </span>
              </td>';
         $result['aaData'][] = array("{$check}", "{$name}", "{$expires}", "{$status}", "{$action}");
     }
     $Qfeatured->freeResult;
     return $result;
 }
Exemplo n.º 7
0
 public static function getAll()
 {
     global $_module, $lC_Database, $lC_Language;
     $media = $_GET['media'];
     $Qgroups = $lC_Database->query('select id, title, sort_order from :table_products_variants_groups where languages_id = :languages_id order by sort_order, title');
     $Qgroups->bindTable(':table_products_variants_groups', TABLE_PRODUCTS_VARIANTS_GROUPS);
     $Qgroups->bindInt(':languages_id', $lC_Language->getID());
     $Qgroups->execute();
     $result = array('aaData' => array());
     while ($Qgroups->next()) {
         $Qentries = $lC_Database->query('select count(*) as total from :table_products_variants_values where products_variants_groups_id = :products_variants_groups_id and  languages_id = :languages_id');
         $Qentries->bindTable(':table_products_variants_values', TABLE_PRODUCTS_VARIANTS_VALUES);
         $Qentries->bindInt(':products_variants_groups_id', $Qgroups->valueInt('id'));
         $Qentries->bindInt(':languages_id', $lC_Language->getID());
         $Qentries->execute();
         $check = '<td><input class="batch" type="checkbox" name="batch[]" value="' . $Qgroups->valueInt('id') . '" id="' . $Qgroups->valueInt('id') . '"></td>';
         $group = '<td>' . lc_link_object(lc_href_link_admin(FILENAME_DEFAULT, $_module . '=' . $Qgroups->valueInt('id')), '<span class="icon-folder icon-orange"></span>&nbsp;' . $Qgroups->value('title')) . '</td>';
         $total = '<td>' . $Qentries->valueInt('total') . '</td>';
         $sort = '<td>' . $Qgroups->valueInt('sort_order') . '</td>';
         $action = '<td class="align-right vertical-center">
                <span class="button-group">
                  <a href="' . ((int) ($_SESSION['admin']['access']['product_variants'] < 3) ? '#' : 'javascript://" onclick="editGroup(\'' . $Qgroups->valueInt('id') . '\')') . '" class="button icon-pencil ' . ((int) ($_SESSION['admin']['access']['product_variants'] < 3) ? 'disabled' : NULL) . '">' . ($media === 'mobile-portrait' || $media === 'mobile-landscape' ? NULL : $lC_Language->get('icon_edit')) . '</a>
                </span>
                <span class="button-group">
                  <a href="' . ((int) ($_SESSION['admin']['access']['product_variants'] < 4) ? '#' : 'javascript://" onclick="deleteGroup(\'' . $Qgroups->valueInt('id') . '\', \'' . urlencode($Qgroups->valueProtected('title')) . '\');') . '" class="button icon-trash with-tooltip' . ((int) ($_SESSION['admin']['access']['product_variants'] < 4) ? 'disabled' : NULL) . '" title="' . $lC_Language->get('icon_delete') . '"></a>
                </span>
              </td>';
         $result['aaData'][] = array("{$check}", "{$group}", "{$total}", "{$sort}", "{$action}");
         $Qentries->freeResult();
     }
     $Qgroups->freeResult();
     return $result;
 }
Exemplo n.º 8
0
 function __construct()
 {
     global $lC_Language, $lC_MessageStack;
     $this->_page_title = $lC_Language->get('heading_title');
     if (!isset($_GET['action'])) {
         $_GET['action'] = '';
     }
     // check if the graphs directory exists
     $_SESSION['errArr'] = array();
     if (!empty($_GET['action']) && !$_SESSION['error']) {
         switch ($_GET['action']) {
             case 'save':
                 //echo '<pre>';print_r($_POST);exit;
                 $shipping_name = serialize($_POST['ups']);
                 $data = array('title' => $_POST['title'], 'shipping_name' => $shipping_name);
                 /*
                  * Save the banner information
                  *
                  * @param integer $_GET['bid'] The banner id
                  * @param array $data The banner information
                  * @access public
                  * @return boolean
                  */
                 if (lC_Restrict_shipping_Admin::save(isset($_GET['bid']) && is_numeric($_GET['bid']) ? $_GET['bid'] : null, $data)) {
                     lc_redirect_admin(lc_href_link_admin(FILENAME_DEFAULT, $this->_module));
                 } else {
                     $_SESSION['error'] = true;
                     $_SESSION['errmsg'] = $lC_Language->get('ms_error_action_not_performed');
                 }
                 break;
         }
     }
 }
Exemplo n.º 9
0
 public function __construct()
 {
     global $lC_Database, $lC_Language, $lC_MessageStack, $rInfo;
     parent::__construct();
     if (!isset($_SESSION['verify_key_valid']) || $_SESSION['verify_key_valid'] === false) {
         lc_redirect_admin(lc_href_link_admin(FILENAME_DEFAULT, $this->_module));
     }
 }
Exemplo n.º 10
0
 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 = '<td>' . $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;
 }
Exemplo n.º 11
0
 public function __construct()
 {
     global $lC_Language;
     $lC_Language->loadIniFile('modules/summary/revenue.php');
     $this->_title = $lC_Language->get('summary_revenue_title');
     $this->_title_link = lc_href_link_admin(FILENAME_DEFAULT, 'revenue');
     if (lC_Access::hasAccess('orders')) {
         $this->_setData();
     }
 }
Exemplo n.º 12
0
 public function __construct()
 {
     global $lC_Language, $lC_MessageStack;
     parent::__construct();
     unset($_SESSION['admin']);
     if (isset($_SESSION['img_resize_flag'])) {
         unset($_SESSION['img_resize_flag']);
     }
     lc_redirect_admin(lc_href_link_admin(FILENAME_DEFAULT));
 }
Exemplo n.º 13
0
 public function __construct()
 {
     global $lC_Language;
     $lC_Language->loadIniFile('modules/summary/administrators_log.php');
     $lC_Language->loadIniFile('administrators_log.php');
     $this->_title = $lC_Language->get('summary_administrators_log_title');
     $this->_title_link = lc_href_link_admin(FILENAME_DEFAULT, 'administrators_log');
     if (lC_Access::hasAccess('administrators_log')) {
         $this->_setData();
     }
 }
Exemplo n.º 14
0
 public function __construct()
 {
     global $lC_Language, $lC_MessageStack, $lC_Currencies, $lC_DateTime;
     parent::__construct();
     $this->_page_contents = 'edit.php';
     if (isset($_POST['subaction']) && $_POST['subaction'] == 'confirm') {
         // validate the input
         $type = isset($_POST['type']) && $_POST['type'] != NULL ? preg_replace('/[^A-Z\\s]/', '', $_POST['type']) : 'R';
         $name = isset($_POST['name']) && $_POST['name'] != NULL ? preg_replace('/[^A-Za-z0-9\\s]/', '', $_POST['name']) : NULL;
         $reward = isset($_POST['reward']) && $_POST['reward'] != NULL ? preg_replace('/[^0-9\\s\\.\\%]/', '', $_POST['reward']) : 0.0;
         $mode = isset($_POST['mode']) && $_POST['mode'] != NULL ? preg_replace('/[^a-z\\s]/', '', $_POST['mode']) : 'coupon';
         $code = isset($_POST['code']) && $_POST['code'] != NULL ? preg_replace('/[^A-Za-z0-9\\s]/', '', $_POST['code']) : substr(str_shuffle(str_repeat('ABCEFGHJKLMNPRSTUVWXYZabcdefghjklmnpqrstuvwxyz23456789', 7)), 0, 7);
         $purchase_over = isset($_POST['purchase_over']) && $_POST['purchase_over'] != NULL ? preg_replace('/[^0-9\\s\\.\\%]/', '', $_POST['purchase_over']) : 0.0;
         $start_date = isset($_POST['start_date']) && $_POST['start_date'] != NULL ? preg_replace('/[^0-9\\s\\/]/', '', $_POST['start_date']) : NULL;
         $expires_date = isset($_POST['expires_date']) && $_POST['expires_date'] != NULL ? preg_replace('/[^0-9\\s\\/]/', '', $_POST['expires_date']) : NULL;
         $uses_per_coupon = isset($_POST['uses_per_coupon']) && $_POST['uses_per_coupon'] != NULL ? preg_replace('/[^0-9\\s]/', '', $_POST['uses_per_coupon']) : 1;
         $uses_per_customer = isset($_POST['uses_per_customer']) && $_POST['uses_per_customer'] != NULL ? preg_replace('/[^0-9\\s]/', '', $_POST['uses_per_customer']) : 1;
         $restrict_to_products = isset($_POST['restrict_to_products']) && $_POST['restrict_to_products'] != NULL ? preg_replace('/[^0-9\\s]/', '', $_POST['restrict_to_products']) : -1;
         $restrict_to_categories = isset($_POST['restrict_to_categories']) && $_POST['restrict_to_categories'] != NULL ? preg_replace('/[^0-9\\s]/', '', $_POST['restrict_to_categories']) : -1;
         $restrict_to_customers = isset($_POST['restrict_to_customers']) && $_POST['restrict_to_customers'] != NULL ? preg_replace('/[^0-9\\s]/', '', $_POST['restrict_to_customers']) : -1;
         $status = isset($_POST['status']) && $_POST['status'] == 'on' ? 1 : -1;
         $sale_exclude = isset($_POST['sale_exclude']) && $_POST['sale_exclude'] == 'on' ? 1 : -1;
         $notes = isset($_POST['notes']) && $_POST['notes'] != NULL ? preg_replace('/[^a-zA-Z0-9\\s\\.\\%\\,]/', '', $_POST['notes']) : NULL;
         switch ($type) {
             case 'R':
                 // regular
             // regular
             case 'T':
                 // percent
                 if (strstr($reward, '%')) {
                     $type = 'T';
                 }
                 break;
             case 'S':
                 // free shipping
                 break;
             case 'P':
                 // free product
                 break;
         }
         $data = array('name' => $name, 'type' => $type, 'mode' => $mode, 'code' => $code, 'reward' => str_replace("%", "", $reward), 'purchase_over' => $purchase_over, 'start_date' => $start_date, 'expires_date' => $expires_date, 'uses_per_coupon' => $uses_per_coupon, 'uses_per_customer' => $uses_per_customer, 'restrict_to_products' => $restrict_to_products, 'restrict_to_categories' => $restrict_to_categories, 'restrict_to_customers' => $restrict_to_customers, 'status' => $status, 'sale_exclude' => $sale_exclude, 'notes' => $notes);
         $id = lC_Coupons_Admin::save(isset($_GET[$this->_module]) && is_numeric($_GET[$this->_module]) ? $_GET[$this->_module] : null, $data);
         if (is_numeric($id) && isset($id)) {
             if (!empty($_POST['save_close'])) {
                 lc_redirect_admin(lc_href_link_admin(FILENAME_DEFAULT, $this->_module));
             } else {
                 lc_redirect_admin(lc_href_link_admin(FILENAME_DEFAULT, $this->_module . '=' . $id . '&action=save'));
             }
         } else {
             $lC_MessageStack->add($this->_module, $lC_Language->get('ms_error_action_not_performed'), 'error');
             lc_redirect_admin(lc_href_link_admin(FILENAME_DEFAULT, $this->_module));
         }
     }
 }
Exemplo n.º 15
0
 function __construct()
 {
     global $lC_Language;
     $this->_page_title = $lC_Language->get('heading_title');
     if (!isset($_GET['action'])) {
         $_GET['action'] = '';
     }
     if (!empty($_GET['action']) && !$_SESSION['error']) {
         switch ($_GET['action']) {
             case 'save':
                 $branding_image = $_POST['branding_manager_logo'];
                 $branding_name = $_POST['branding_name'];
                 $branding_slogan = $_POST['branding_slogan'];
                 $branding_chat_code = $_POST['branding_chat_code'];
                 $branding_address = $_POST['branding_address'];
                 $branding_support_phone = $_POST['branding_support_phone'];
                 $branding_support_email = $_POST['branding_support_email'];
                 $branding_sales_phone = $_POST['branding_sales_phone'];
                 $branding_sales_email = $_POST['branding_sales_email'];
                 $branding_meta_description = $_POST['branding_meta_description'];
                 $branding_meta_keywords = $_POST['branding_meta_keywords'];
                 $branding_graph_site_thumbnail = $_POST['branding_graph_site_thumbnail'];
                 $branding_meta_title = $_POST['branding_meta_title'];
                 $branding_meta_title_prefix = $_POST['branding_meta_title_prefix'];
                 $branding_meta_title_suffix = $_POST['branding_meta_title_suffix'];
                 $branding_meta_title_delimeter = $_POST['branding_meta_title_delimeter'];
                 $branding_social_fb_page = $_POST['branding_social_fb_page'];
                 $branding_social_twitter = $_POST['branding_social_twitter'];
                 $branding_social_pinterest = $_POST['branding_social_pinterest'];
                 $branding_social_google_plus = $_POST['branding_social_google_plus'];
                 $branding_social_youtube = $_POST['branding_social_youtube'];
                 $branding_social_linkedin = $_POST['branding_social_linkedin'];
                 $branding_footer_text = $_POST['branding_footer_text'];
                 $branding_home_page_text = $_POST['branding_home_page_text'];
                 $branding_customcss = $_POST['branding_customcss'];
                 $data = array('site_image' => $branding_image, 'name' => $branding_name, 'slogan' => $branding_slogan, 'chat_code' => $branding_chat_code, 'address' => $branding_address, 'support_phone' => $branding_support_phone, 'support_email' => $branding_support_email, 'sales_phone' => $branding_sales_phone, 'sales_email' => $branding_sales_email, 'meta_description' => $branding_meta_description, 'meta_keywords' => $branding_meta_keywords, 'og_image' => $branding_graph_site_thumbnail, 'meta_title' => $branding_meta_title, 'meta_title_prefix' => $branding_meta_title_prefix, 'meta_title_suffix' => $branding_meta_title_suffix, 'meta_delimeter' => $branding_meta_title_delimeter, 'social_facebook_page' => $branding_social_fb_page, 'social_twitter' => $branding_social_twitter, 'social_pinterest' => $branding_social_pinterest, 'social_google_plus' => $branding_social_google_plus, 'social_youtube' => $branding_social_youtube, 'social_linkedin' => $branding_social_linkedin, 'footer_text' => $branding_footer_text, 'home_page_text' => $branding_home_page_text, 'custom_css' => $branding_customcss);
                 /*
                  * Save the Branding information
                  *
                  * @param array $data The Branding information
                  * @access public
                  * @return boolean
                  */
                 if (lC_Branding_manager_Admin::save($data)) {
                     lc_redirect_admin(lc_href_link_admin(FILENAME_DEFAULT, $this->_module));
                 } else {
                     $_SESSION['error'] = true;
                     $_SESSION['errmsg'] = $lC_Language->get('ms_error_action_not_performed');
                 }
                 break;
         }
     }
 }
Exemplo n.º 16
0
/**
* Redirect to a URL address
*
* @param string $url The URL address to redirect to
* @access public
*/
function lc_redirect_admin($url)
{
    global $lC_Session;
    if (strpos($url, "\n") !== false || strpos($url, "\r") !== false) {
        $url = lc_href_link_admin(FILENAME_DEFAULT);
    }
    if (strpos($url, '&amp;') !== false) {
        $url = str_replace('&amp;', '&', $url);
    }
    header('Location: ' . $url);
    $lC_Session->close();
    exit;
}
Exemplo n.º 17
0
 public function __construct()
 {
     global $lC_Database, $lC_Language, $lC_MessageStack, $rInfo;
     parent::__construct();
     if (isset($_POST['key']) && $_POST['key'] != NULL && isset($_POST['email']) && $_POST['email'] != NULL) {
         if (lC_Login_Admin::lostPasswordConfirmKey($_POST['key'], $_POST['email'])) {
             $rInfo = new lC_ObjectInfo($_POST);
         } else {
             // if key is invalid redirect back to login
             lc_redirect_admin(lc_href_link_admin(FILENAME_DEFAULT, $this->_module));
         }
     }
 }
Exemplo n.º 18
0
 public function __construct()
 {
     global $lC_Language, $lC_Database, $lC_MessageStack;
     if (!isset($_GET['set'])) {
         $_GET['set'] = 'members';
     }
     $action = isset($_GET['gid']) && !empty($_GET['gid']) ? 'edit' : 'insert';
     switch ($_GET['set']) {
         case 'groups':
             $this->_page_title = $lC_Language->get('heading_title_groups');
             $this->_page_name = 'groups';
             $this->_page_contents = 'groups.php';
             if (isset($_GET['process'])) {
                 $result = array();
                 switch (strtolower($_GET['process'])) {
                     case 'edit':
                         $result = lC_Administrators_Admin::saveGroup($_GET['gid'], $_POST);
                         break;
                     default:
                         $result = lC_Administrators_Admin::saveGroup(NULL, $_POST);
                 }
                 if ($result['rpcStatus'] != 1 || $lC_Database->isError()) {
                     if ($lC_Database->isError()) {
                         $lC_MessageStack->add($this->_module, $lC_Database->getError(), 'error');
                     } else {
                         $lC_MessageStack->add($this->_module, $lC_Language->get('ms_error_action_not_performed'), 'error');
                     }
                 }
                 $_SESSION['messageToStack'] = $lC_MessageStack->getAll();
                 lc_redirect_admin(lc_href_link_admin(FILENAME_DEFAULT, $this->_module . '&set=groups'));
             }
             break;
         case 'access':
             if ($action == 'insert' && (int) $_SESSION['admin']['access'][$this->_module] < 2) {
                 lc_redirect(lc_href_link_admin(FILENAME_DEFAULT, 'error_pages&set=no_access'));
             }
             if ($action != 'insert' && (int) $_SESSION['admin']['access'][$this->_module] < 3) {
                 lc_redirect(lc_href_link_admin(FILENAME_DEFAULT, 'error_pages&set=no_access'));
             }
             $this->_page_title = $action == 'insert' ? $lC_Language->get('heading_title_new_group') : $lC_Language->get('heading_title_edit_group');
             $this->_page_name = 'access';
             $this->_page_contents = 'access.php';
             break;
         case 'members':
         default:
             $this->_page_title = $lC_Language->get('heading_title');
             $this->_page_name = 'members';
             $this->_page_contents = 'main.php';
             break;
     }
 }
Exemplo n.º 19
0
 protected function _setData()
 {
     global $lC_Database, $lC_Currencies;
     $this->_data = array();
     $this->_resultset = $lC_Database->query('select o.orders_id, o.customers_name, ot.value from :table_orders o, :table_orders_total ot where o.orders_id = ot.orders_id and ot.class = :class order by value desc');
     $this->_resultset->bindTable(':table_orders', TABLE_ORDERS);
     $this->_resultset->bindTable(':table_orders_total', TABLE_ORDERS_TOTAL);
     $this->_resultset->bindValue(':class', 'total');
     $this->_resultset->setBatchLimit($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS);
     $this->_resultset->execute();
     while ($this->_resultset->next()) {
         $this->_data[] = array(lc_link_object(lc_href_link_admin(FILENAME_DEFAULT, 'orders&oID=' . $this->_resultset->value('orders_id') . '&action=save'), $this->_icon . '&nbsp;' . $this->_resultset->value('customers_name')), $lC_Currencies->format($this->_resultset->valueInt('value')));
     }
 }
Exemplo n.º 20
0
 protected function _setData()
 {
     global $lC_Database, $lC_Language;
     $this->_data = array();
     $this->_resultset = $lC_Database->query('select p.products_id, p.products_ordered, pd.products_name from :table_products p, :table_products_description pd where p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = :language_id order by p.products_ordered desc, pd.products_name');
     $this->_resultset->bindTable(':table_products', TABLE_PRODUCTS);
     $this->_resultset->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
     $this->_resultset->bindInt(':language_id', $lC_Language->getID());
     $this->_resultset->setBatchLimit($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS);
     $this->_resultset->execute();
     while ($this->_resultset->next()) {
         $this->_data[] = array(lc_link_object(lc_href_link_admin(FILENAME_DEFAULT, 'products&pID=' . $this->_resultset->valueInt('products_id') . '&action=preview'), $this->_icon . '&nbsp;' . $this->_resultset->value('products_name')), $this->_resultset->valueInt('products_ordered'));
     }
 }
Exemplo n.º 21
0
 public static function lostPasswordConfirmEmail($email)
 {
     global $lC_Database, $lC_Language;
     $lC_Language->loadIniFile('login.php');
     // check for email
     $Qadmin = $lC_Database->query('select * from :table_administrators where user_name = :user_name limit 1');
     $Qadmin->bindTable(':table_administrators', TABLE_ADMINISTRATORS);
     $Qadmin->bindValue(':user_name', $email);
     $Qadmin->execute();
     $admin = $Qadmin->toArray();
     // if email exists we continue
     if ($Qadmin->numberOfRows() > 0) {
         $lC_Database->startTransaction();
         $verify_key = utility::generateUID();
         // set the key to be verified from the resulting email
         $Qsetkey = $lC_Database->query('update :table_administrators set verify_key = :verify_key where user_name = :user_name');
         $Qsetkey->bindTable(':table_administrators', TABLE_ADMINISTRATORS);
         $Qsetkey->bindValue(':user_name', $email);
         $Qsetkey->bindValue(':verify_key', $verify_key);
         $Qsetkey->setLogging($_SESSION['module'], $email);
         $Qsetkey->execute();
         if (!$lC_Database->isError()) {
             $lC_Database->commitTransaction();
             $_SESSION['user_not_exists'] = null;
             $_SESSION['user_confirmed_email'] = $email;
             // set email contents
             $email_text = '';
             $email_text .= sprintf($lC_Language->get('text_lost_password_verification_body_line_1'), $admin['first_name']) . "\n\n";
             $email_text .= sprintf($lC_Language->get('text_lost_password_verification_body_line_2'), $admin['user_name']) . "\n\n";
             $email_text .= sprintf($lC_Language->get('text_lost_password_verification_body_line_3'), lc_href_link_admin(FILENAME_DEFAULT, 'login&action=lost_password&email=' . $admin['user_name'] . '&key=' . $verify_key)) . "\n\n";
             $email_text .= sprintf($lC_Language->get('text_lost_password_verification_body_line_4'), $verify_key) . "\n\n";
             $email_text .= $lC_Language->get('text_lost_password_verification_body_line_5') . "\n\n";
             $email_text .= $lC_Language->get('text_lost_password_verification_body_line_6') . "\n\n";
             $email_text .= sprintf($lC_Language->get('text_lost_password_verification_body_line_7'), STORE_NAME) . "\n\n";
             // send verification email
             lc_email($Qadmin->valueProtected('first_name') . ' ' . $Qadmin->valueProtected('last_name'), $Qadmin->valueProtected('user_name'), sprintf($lC_Language->get('text_lost_password_verification_subject'), STORE_NAME), $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
             return true;
         } else {
             $lC_Database->rollbackTransaction();
             $_SESSION['user_not_exists'] = true;
             $_SESSION['user_confirmed_email'] = null;
             return false;
         }
     } else {
         $_SESSION['user_not_exists'] = true;
         $_SESSION['user_confirmed_email'] = null;
         return false;
     }
 }
Exemplo n.º 22
0
 public function __construct()
 {
     global $lC_Language, $breadcrumb_string;
     $this->_page_title = $lC_Language->get('heading_title');
     $breadcrumb_array = array(lc_link_object(lc_href_link_admin(FILENAME_DEFAULT, $this->_module), $lC_Language->get('heading_title')));
     if (!empty($_GET[$this->_module]) && is_numeric($_GET[$this->_module])) {
         $this->_page_contents = 'entries.php';
         $this->_page_title = lC_Product_variants_Admin::getData($_GET[$this->_module], null, 'title');
         $breadcrumb_array[] = lc_link_object(lc_href_link_admin(FILENAME_DEFAULT, $this->_module . '=' . $this->_page_contents), $this->_page_title);
     }
     $breadcrumb_string = '<ul>';
     foreach ($breadcrumb_array as $key => $value) {
         $breadcrumb_string .= '<li>' . $value . '</li>';
     }
     $breadcrumb_string .= '</ul>';
 }
Exemplo n.º 23
0
 public function __construct()
 {
     global $lC_Database, $lC_Language, $lC_MessageStack;
     parent::__construct();
     if (!isset($_SESSION['verify_key_valid']) || $_SESSION['verify_key_valid'] === false) {
         lc_redirect_admin(lc_href_link_admin(FILENAME_DEFAULT, $this->_module));
     }
     if (isset($_POST['password']) && $_POST['password'] != NULL && isset($_POST['email']) && $_POST['email'] != NULL) {
         if (lC_Login_Admin::passwordChange($_POST['password'], $_POST['email'])) {
             $rInfo = new lC_ObjectInfo($_POST);
         } else {
             // if error, redirect back to login
             lc_redirect_admin(lc_href_link_admin(FILENAME_DEFAULT, $this->_module));
         }
     }
 }
Exemplo n.º 24
0
 public function __construct()
 {
     global $lC_Database, $lC_Language, $lC_Template, $lC_Currencies;
     $lC_Currencies = new lC_Currencies();
     $this->_page_title = $lC_Language->get('heading_title');
     if (!isset($_GET['action'])) {
         $_GET['action'] = '';
     }
     if (isset($_GET['cID']) && $_GET['cID'] != null) {
         $_SESSION['cIDFilter'] = $_GET['cID'];
     } else {
         if (isset($_SESSION['cIDFilter'])) {
             unset($_SESSION['cIDFilter']);
         }
     }
     if (isset($_GET['action']) && $_GET['action'] == "quick_add") {
         if ($order_insert_id = lC_Orders_Admin::createOrder($_GET['cID'])) {
             lc_redirect_admin(lc_href_link_admin(FILENAME_DEFAULT, $this->_module . '=' . $order_insert_id . '&action=save&tabProducts=1'));
         }
     } else {
         if (isset($_GET['action']) && $_GET['action'] == "add_product") {
             lC_Orders_Admin::addOrderProductData();
             lc_redirect_admin(lc_href_link_admin(FILENAME_DEFAULT, $this->_module . '=' . $_GET['oID'] . '&action=save&tabProducts=1'));
         }
     }
     // for temporary use
     if (isset($_POST['action_order_total']) && $_POST['action_order_total'] == 'save_order_total') {
         lC_Orders_Admin::saveOrderTotal();
         lc_redirect_admin(lc_href_link_admin(FILENAME_DEFAULT, $this->_module . '=' . $_POST['oid'] . '&action=save&tabTotals=1'));
     }
     if (!empty($_GET['action'])) {
         switch ($_GET['action']) {
             case 'invoice':
                 $this->_page_contents = 'invoice.php';
                 $this->_has_header = false;
                 $this->_has_footer = false;
                 $this->_has_wrapper = false;
                 break;
             case 'packaging_slip':
                 $this->_page_contents = 'packaging_slip.php';
                 $this->_has_header = false;
                 $this->_has_footer = false;
                 $this->_has_wrapper = false;
                 break;
         }
     }
 }
Exemplo n.º 25
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();
     }
 }
Exemplo n.º 26
0
 function __construct()
 {
     global $lC_Language, $lC_MessageStack;
     $this->_page_title = $lC_Language->get('heading_title');
     if (!isset($_GET['action'])) {
         $_GET['action'] = '';
     }
     $this->image_extension = lc_dynamic_image_extension();
     // check if the graphs directory exists
     $_SESSION['errArr'] = array();
     if (!empty($this->image_extension)) {
         if (is_dir('images/graphs')) {
             if (!is_writeable('images/graphs')) {
                 $_SESSION['errArr']['error'] = true;
                 $_SESSION['errArr']['errmsg'] = sprintf($lC_Language->get('ms_error_graphs_directory_not_writable'), realpath('images'));
             }
         } else {
             $_SESSION['errArr']['error'] = true;
             $_SESSION['errArr']['errmsg'] = sprintf($lC_Language->get('ms_error_graphs_directory_non_existant'), realpath('images'));
         }
     }
     if (!empty($_GET['action']) && !$_SESSION['error']) {
         switch ($_GET['action']) {
             case 'save':
                 $data = array('title' => $_POST['title'], 'url' => $_POST['url'], 'target' => isset($_POST['target']) && $_POST['target'] == 'on' ? true : false, 'group' => isset($_POST['group']) ? $_POST['group'] : null, 'group_new' => $_POST['group_new'], 'image' => isset($_FILES['image']) ? $_FILES['image'] : null, 'image_local' => $_POST['image_local'], 'image_target' => $_POST['image_target'], 'html_text' => $_POST['html_text'], 'date_scheduled' => $_POST['date_scheduled'], 'date_expires' => $_POST['date_expires'], 'expires_impressions' => $_POST['expires_impressions'], 'status' => isset($_POST['status']) && $_POST['status'] == 'on' ? true : false);
                 /*
                  * Save the banner information
                  *
                  * @param integer $_GET['bid'] The banner id
                  * @param array $data The banner information
                  * @access public
                  * @return boolean
                  */
                 if (lC_Banner_manager_Admin::save(isset($_GET['bid']) && is_numeric($_GET['bid']) ? $_GET['bid'] : null, $data)) {
                     lc_redirect_admin(lc_href_link_admin(FILENAME_DEFAULT, $this->_module));
                 } else {
                     $_SESSION['error'] = true;
                     $_SESSION['errmsg'] = $lC_Language->get('ms_error_action_not_performed');
                 }
                 break;
         }
     }
 }
Exemplo n.º 27
0
 public function __construct()
 {
     global $lC_Language, $lC_MessageStack;
     parent::__construct();
     $this->_page_contents = 'edit.php';
     if (isset($_POST['subaction']) && $_POST['subaction'] == 'confirm') {
         switch ($_GET['action']) {
             case 'save':
                 $data = array('image' => isset($_POST['categories_image']) ? $_POST['categories_image'] : null, 'parent_id' => $_POST['parent_id'], 'sort_order' => $_POST['sort_order'], 'mode' => $_POST['categories_mode'], 'link_target' => $_POST['categories_link_target'] == 'on' ? 1 : 0, 'custom_url' => $_POST['categories_custom_url'], 'status' => $_POST['categories_status'] == 'on' ? 1 : 0, 'nav' => $_POST['categories_visibility_nav'] == 'on' ? 1 : 0, 'box' => $_POST['categories_visibility_box'] == 'on' ? 1 : 0, 'name' => $_POST['categories_name'], 'menu_name' => $_POST['categories_menu_name'], 'blurb' => $_POST['categories_blurb'], 'description' => $_POST['categories_description'], 'permalink' => $_POST['categories_permalink'], 'tags' => $_POST['categories_tags']);
                 // access levels
                 if (isset($_POST['access_levels'])) {
                     $data['access_levels'] = $_POST['access_levels'];
                 }
                 if (isset($_POST['sync_all_products'])) {
                     $data['sync_all_products'] = $_POST['sync_all_products'];
                 }
                 if (isset($_POST['sync_all_children'])) {
                     $data['sync_all_children'] = $_POST['sync_all_children'];
                 }
                 /*
                  * Save the category information
                  *
                  * @param integer $_GET['cid'] The categories id used on update, null on insert
                  * @param array $data The categories information
                  * @access public
                  * @return boolean
                  */
                 $id = lC_Categories_Admin::save(isset($_GET['categories']) && is_numeric($_GET['categories']) ? $_GET['categories'] : null, $data);
                 if (is_numeric($id)) {
                     if (empty($_POST['save_close'])) {
                         lc_redirect_admin(lc_href_link_admin(FILENAME_DEFAULT, $this->_module . '=' . $id . '&cid=' . $_GET['cid'] . '&action=save'));
                     } else {
                         lc_redirect_admin(lc_href_link_admin(FILENAME_DEFAULT, $this->_module . '=' . $data['parent_id']));
                     }
                 } else {
                     $_SESSION['error'] = true;
                     $_SESSION['errmsg'] = $lC_Language->get('ms_error_action_not_performed');
                 }
                 break;
         }
     }
 }
Exemplo n.º 28
0
 protected function _setData()
 {
     global $lC_Database, $lC_Language, $lC_Currencies, $lC_Vqmod;
     if (!$this->enabled) {
         $this->_data = '';
     } else {
         $this->_data = '<div class="four-columns six-columns-tablet twelve-columns-mobile clear-both">' . '  <h2 class="relative thin">' . $this->_title . '</h2>' . '  <ul class="list spaced">';
         if (!isset($lC_Currencies)) {
             if (!class_exists('lC_Currencies')) {
                 include $lC_Vqmod->modCheck('../includes/classes/currencies.php');
             }
             $lC_Currencies = new lC_Currencies();
         }
         $Qproducts = $lC_Database->query('select p.products_id, greatest(p.products_date_added, p.products_last_modified) as date_last_modified, pd.products_name from :table_products p, :table_products_description pd where parent_id = 0 and p.products_id = pd.products_id and pd.language_id = :language_id order by date_last_modified desc limit 6');
         $Qproducts->bindTable(':table_products', TABLE_PRODUCTS);
         $Qproducts->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
         $Qproducts->bindInt(':language_id', $lC_Language->getID());
         $Qproducts->execute();
         while ($Qproducts->next()) {
             $data = lC_Products_Admin::get($Qproducts->valueInt('products_id'));
             $products_icon = lc_icon_admin('products.png');
             $products_price = $data['products_price'];
             if (!empty($data['variants'])) {
                 $products_icon = lc_icon_admin('attach.png');
                 $products_price = null;
                 foreach ($data['variants'] as $variant) {
                     if ($products_price === null || $variant['data']['price'] < $products_price) {
                         $products_price = $variant['data']['price'];
                     }
                 }
                 if ($products_price === null) {
                     $products_price = 0;
                 }
             }
             $this->_data .= '    <li>' . '      <span class="list-link icon-bag icon-blue" title="' . $lC_Language->get('edit') . '">' . '        <strong>' . (!empty($data['variants']) ? $lC_Language->get('text_from') . ' ' : '') . $lC_Currencies->format($products_price) . '</strong> <span class="anthracite">' . lc_output_string_protected($data['products_name']) . '</span>' . '      </span>' . '      <div class="absolute-right compact show-on-parent-hover">' . '        <a href="' . ((int) ($_SESSION['admin']['access']['products'] < 3) ? '#' : lc_href_link_admin(FILENAME_DEFAULT, 'products=' . $Qproducts->valueInt('products_id') . '&cID=' . $category_id . '&action=save')) . '" class="button icon-pencil' . ((int) ($_SESSION['admin']['access']['products'] < 3) ? ' disabled' : NULL) . '">' . $lC_Language->get('icon_edit') . '</a>' . '        <a href="' . ((int) ($_SESSION['admin']['access']['products'] < 3) ? '#' : 'javascript://" onclick="copyProduct(\'' . $Qproducts->valueInt('products_id') . '\', \'' . urlencode($Qproducts->value('products_name')) . '\')') . '" class="button icon-pages with-tooltip' . ((int) ($_SESSION['admin']['access']['products'] < 3) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('icon_copy') . '"></a>' . '        <a href="' . ((int) ($_SESSION['admin']['access']['products'] < 4) ? '#' : 'javascript://" onclick="deleteProduct(\'' . $Qproducts->valueInt('products_id') . '\', \'' . urlencode($Qproducts->value('products_name')) . '\')') . '" class="button icon-trash with-tooltip' . ((int) ($_SESSION['admin']['access']['products'] < 4) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('icon_delete') . '"></a>' . '      </div>' . '    </li>';
         }
         $this->_data .= '  </ul>' . '</div>';
         $Qproducts->freeResult();
         $this->_data .= $this->loadModal();
     }
 }
Exemplo n.º 29
0
 public function __construct()
 {
     global $lC_Language, $breadcrumb_string;
     $this->_page_title = $lC_Language->get('heading_title');
     $breadcrumb_array = array(lc_link_object(lc_href_link_admin(FILENAME_DEFAULT, $this->_module), $lC_Language->get('heading_title')));
     if (!empty($_GET[$this->_module]) && is_numeric($_GET[$this->_module]) && lC_Languages_Admin::exists($_GET[$this->_module])) {
         $this->_page_title = lC_Languages_Admin::get($_GET[$this->_module], 'name');
         $this->_page_contents = 'groups.php';
         $breadcrumb_array[] = lc_link_object(lc_href_link_admin(FILENAME_DEFAULT, $this->_module . '=' . $this->_page_contents), $this->_page_title);
         if (isset($_GET['group']) && !empty($_GET['group']) && lC_Languages_Admin::isDefinitionGroup($_GET[$this->_module], $_GET['group'])) {
             $this->_page_title = $_GET['group'];
             $this->_page_contents = 'definitions.php';
             $breadcrumb_array[] = lc_link_object(lc_href_link_admin(FILENAME_DEFAULT, $this->_module . '=' . $this->_page_contents), $this->_page_title);
         }
     }
     $breadcrumb_string = '<ul>';
     foreach ($breadcrumb_array as $key => $value) {
         $breadcrumb_string .= '<li>' . lc_output_utf8_decoded($value) . '</li>';
     }
     $breadcrumb_string .= '</ul>';
     if (!isset($_GET['action'])) {
         $_GET['action'] = '';
     }
     if (!empty($_GET['action'])) {
         switch ($_GET['action']) {
             case 'import':
                 $lang = isset($_GET['language_import']) && $_GET['language_import'] != NULL ? $_GET['language_import'] : $_POST['language_import'];
                 $type = isset($_GET['import_type']) && $_GET['import_type'] != NULL ? $_GET['import_type'] : $_POST['import_type'];
                 try {
                     lC_Languages_Admin::import($lang, $type);
                 } catch (Exception $e) {
                     $_SESSION['error'] = true;
                     $_SESSION['errmsg'] = $lC_Language->get('ms_error_action_not_performed');
                 }
                 break;
             case 'export':
                 lC_Languages_Admin::export($_GET['lid'], $_POST['groups'], isset($_POST['include_data']) && $_POST['include_data'] == 'on');
                 break;
         }
     }
 }
Exemplo n.º 30
0
 public static function getAll($id = null)
 {
     global $_module, $lC_Database, $lC_Language, $current_category_id;
     $media = $_GET['media'];
     $result = array('entries' => array());
     $result = array('aaData' => array());
     if (!is_numeric($id)) {
         if (isset($current_category_id) && is_numeric($current_category_id)) {
             $id = $current_category_id;
         } else {
             $id = 0;
         }
     }
     $Qcategories = $lC_Database->query('select c.*, cd.categories_name from :table_categories c, :table_categories_description cd where c.categories_id = cd.categories_id and cd.language_id = :language_id and c.parent_id = :parent_id order by c.sort_order, cd.categories_name');
     $Qcategories->bindTable(':table_categories', TABLE_CATEGORIES);
     $Qcategories->bindTable(':table_categories_description', TABLE_CATEGORIES_DESCRIPTION);
     $Qcategories->bindInt(':language_id', $lC_Language->getID());
     $Qcategories->bindInt(':parent_id', $id);
     $Qcategories->execute();
     while ($Qcategories->next()) {
         $check = '<td><input class="batch" type="checkbox" name="batch[]" value="' . $Qcategories->value('categories_id') . '" id="' . $Qcategories->value('categories_id') . '"></td>';
         $category = '<td><span class="icon-list icon-size2 dragsort" title="' . $lC_Language->get('text_sort') . '" style="cursor:move;"></span><a href="' . lc_href_link_admin(FILENAME_DEFAULT, $_module . '=' . $Qcategories->value('categories_id')) . '"><span class="icon-' . lC_Categories_Admin::getCategoryIcon($Qcategories->value('categories_mode')) . ' margin-left"></span><span class="mid-margin-left">' . $Qcategories->value('categories_name') . '</span></a></td>';
         $status = '<td><span class="align-center" id="status_' . $Qcategories->value('categories_id') . '" onclick="updateStatus(\'' . $Qcategories->value('categories_id') . '\', \'' . ($Qcategories->value('categories_status') == 1 ? 0 : 1) . '\');">' . ($Qcategories->valueInt('categories_status') == 1 ? '<span class="icon-tick icon-size2 icon-green cursor-pointer with-tooltip" title="' . $lC_Language->get('text_disable_category') . '"></span>' : '<span class="icon-cross icon-size2 icon-red cursor-pointer with-tooltip" title="' . $lC_Language->get('text_enable_category') . '"></span>') . '</span></td>';
         $visibility = '<td>' . ($Qcategories->valueInt('parent_id') == 0 ? '  <span class="align-center margin-right" id="nav_' . $Qcategories->value('categories_id') . '" onclick="updateVisibilityNav(\'' . $Qcategories->value('categories_id') . '\', \'' . ($Qcategories->value('categories_visibility_nav') == 1 ? 0 : 1) . '\');">' . ($Qcategories->valueInt('categories_visibility_nav') == 1 ? '<span class="icon-directions icon-size2 icon-green cursor-pointer with-tooltip" title="' . $lC_Language->get('text_hide_in_nav') . '"></span>' : '<span class="icon-directions icon-size2 icon-silver cursor-pointer with-tooltip" title="' . $lC_Language->get('text_show_in_nav') . '"></span>') . '  </span>' : '') . '  <span class="align-center" id="box_' . $Qcategories->value('categories_id') . '" onclick="updateVisibilityBox(\'' . $Qcategories->value('categories_id') . '\', \'' . ($Qcategories->value('categories_visibility_box') == 1 ? 0 : 1) . '\');">' . ($Qcategories->valueInt('categories_visibility_box') == 1 ? '<span class="icon-browser icon-size2 icon-green cursor-pointer with-tooltip" title="' . $lC_Language->get('text_hide_in_box') . '"></span>' : '<span class="icon-browser icon-size2 icon-silver cursor-pointer with-tooltip" title="' . $lC_Language->get('text_show_in_box') . '"></span>') . '  </span>' . '</td>';
         $mode = '<td>' . $lC_Language->get('text_mode_' . $Qcategories->value('categories_mode')) . '</td>';
         $sort = '<td><input type="text" onfocus="this.select();" name="sort_order_' . $Qcategories->value('categories_id') . '" onchange="updateCategorySort(this.value, \'' . $Qcategories->value('categories_id') . '\');" value="' . $Qcategories->valueInt('sort_order') . '" class="sort input" /></td>';
         $action = '<td class="align-right vertical-center">
                <span class="button-group" style="white-space:nowrap;">
                  <a href="' . ((int) ($_SESSION['admin']['access'][$_module] < 3) ? '#' : lc_href_link_admin(FILENAME_DEFAULT, $_module . '=' . $Qcategories->value('categories_id') . '&cid=' . ($_GET['categories'] ? $_GET['categories'] : 0) . '&action=save')) . '" 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']['languages'] < 4) ? '#' : 'javascript://" onclick="moveCategory(\'' . $Qcategories->value('categories_id') . '\', \'' . urlencode($Qcategories->valueProtected('categories_name')) . '\')"') . '" class="button icon-cloud-upload with-tooltip ' . ((int) ($_SESSION['admin']['access']['languages'] < 4) ? 'disabled' : NULL) . '" title="' . $lC_Language->get('icon_move') . '"></a>
                </span>
                <span class="button-group">
                  <a href="' . ((int) ($_SESSION['admin']['access']['languages'] < 4) ? '#' : 'javascript://" onclick="deleteCategory(\'' . $Qcategories->value('categories_id') . '\', \'' . urlencode($Qcategories->valueProtected('categories_name')) . '\')"') . '" class="button icon-trash with-tooltip ' . ((int) ($_SESSION['admin']['access']['languages'] < 4) ? 'disabled' : NULL) . '" title="' . $lC_Language->get('icon_delete') . '"></a>
                </span>
              </td>';
         $result['aaData'][] = array("{$check}", "{$category}", "{$status}", "{$visibility}", "{$mode}", "{$sort}", "{$action}");
         $result['entries'][] = $Qcategories->toArray();
     }
     $Qcategories->freeResult();
     return $result;
 }