public static function execute() { $site = OSCOM::getSite(); $result = array('entries' => array()); if ( isset($_SESSION[$site]['id']) ) { if ( isset($_GET['reset']) && !empty($_GET['reset']) && OSCOM::siteApplicationExists($_GET['reset']) ) { Dashboard::updateAppDateOpened($_SESSION[$site]['id'], $_GET['reset']); } $shortcuts = array(); foreach ( Dashboard::getShortcuts($_SESSION[$site]['id']) as $app ) { $shortcuts[$app['module']] = $app['last_viewed']; } foreach ( $_SESSION[$site]['access'] as $module => $data ) { if ( $data['shortcut'] === true ) { if ( method_exists('osCommerce\\OM\\Core\\Site\\Admin\\Application\\' . $data['module'] . '\\' . $data['module'], 'getShortcutNotification') || class_exists('osCommerce\\OM\\Core\\Site\\Admin\\Application\\' . $data['module'] . '\\Model\\getShortcutNotification') ) { $result['entries'][$data['module']] = call_user_func(array('osCommerce\\OM\\Core\\Site\\Admin\\Application\\' . $data['module'] . '\\' . $data['module'], 'getShortcutNotification'), $shortcuts[$data['module']]); } } } } $result['rpcStatus'] = RPC::STATUS_SUCCESS; echo json_encode($result); }
public static function execute() { $OSCOM_Language = Registry::get('Language'); $module_files = array(); $DLapps = new DirectoryListing(OSCOM::BASE_DIRECTORY . 'Core/Site/' . OSCOM::getSite() . '/Application'); $DLapps->setIncludeFiles(false); foreach ($DLapps->getFiles() as $file) { if (!in_array($file['name'], call_user_func(array('osCommerce\\OM\\Core\\Site\\' . OSCOM::getSite() . '\\Controller', 'getGuestApplications'))) && file_exists($DLapps->getDirectory() . '/' . $file['name'] . '/Controller.php')) { $module_files[] = $file['name']; } } $modules = array(); foreach ($module_files as $module) { $application_class = 'osCommerce\\OM\\Core\\Site\\' . OSCOM::getSite() . '\\Application\\' . $module . '\\Controller'; if (class_exists($application_class)) { if ($module == OSCOM::getSiteApplication()) { $OSCOM_Application = Registry::get('Application'); } else { Registry::get('Language')->loadIniFile($module . '.php'); $OSCOM_Application = new $application_class(false); } $modules[Access::getGroupTitle($OSCOM_Application->getGroup())][] = array('id' => $module, 'text' => $OSCOM_Application->getTitle(), 'icon' => $OSCOM_Application->getIcon()); } } ksort($modules); return $modules; }
public function __construct() { Registry::get('Language')->loadIniFile('modules/Dashboard/Customers.php'); $this->_title = OSCOM::getDef('admin_indexmodules_customers_title'); $this->_title_link = OSCOM::getLink(null, 'Customers'); if (Access::hasAccess(OSCOM::getSite(), 'Customers')) { $this->_data = '<table border="0" width="100%" cellspacing="0" cellpadding="2" class="dataTable">' . ' <thead>' . ' <tr>' . ' <th>' . OSCOM::getDef('admin_indexmodules_customers_table_heading_customers') . '</th>' . ' <th>' . OSCOM::getDef('admin_indexmodules_customers_table_heading_date') . '</th>' . ' <th>' . OSCOM::getDef('admin_indexmodules_customers_table_heading_status') . '</th>' . ' </tr>' . ' </thead>' . ' <tbody>'; $Qcustomers = Registry::get('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 6'); $Qcustomers->execute(); $counter = 0; while ($Qcustomers->next()) { $customer_icon = osc_icon('people.png'); if (ACCOUNT_GENDER > -1) { switch ($Qcustomers->value('customers_gender')) { case 'm': $customer_icon = osc_icon('user_male.png'); break; case 'f': $customer_icon = osc_icon('user_female.png'); break; } } $this->_data .= ' <tr onmouseover="$(this).addClass(\'mouseOver\');" onmouseout="$(this).removeClass(\'mouseOver\');"' . ($counter % 2 ? ' class="alt"' : '') . '>' . ' <td>' . osc_link_object(OSCOM::getLink(null, 'Customers', 'cID=' . $Qcustomers->valueInt('customers_id') . '&action=save'), $customer_icon . ' ' . $Qcustomers->valueProtected('customers_firstname') . ' ' . $Qcustomers->valueProtected('customers_lastname')) . '</td>' . ' <td>' . $Qcustomers->value('date_account_created') . '</td>' . ' <td align="center">' . osc_icon($Qcustomers->valueInt('customers_status') === 1 ? 'checkbox_ticked.gif' : 'checkbox_crossed.gif', null, null) . '</td>' . ' </tr>'; $counter++; } $this->_data .= ' </tbody>' . '</table>'; } }
public function __construct() { $this->initialize(); if (isset($_GET['action']) && !empty($_GET['action'])) { $action = HTML::sanitize(basename($_GET['action'])); if (class_exists('osCommerce\\OM\\Core\\Site\\' . OSCOM::getSite() . '\\Application\\' . OSCOM::getSiteApplication() . '\\Action\\' . $action)) { call_user_func(array('osCommerce\\OM\\Core\\Site\\' . OSCOM::getSite() . '\\Application\\' . OSCOM::getSiteApplication() . '\\Action\\' . $action, 'execute'), $this); } } }
public function set($code = null) { if (!isset($_SESSION[OSCOM::getSite()]['template'])) { $data = array(); foreach ($this->getTemplates() as $template) { $data = array('id' => $template['id'], 'code' => $template['code']); } $_SESSION[OSCOM::getSite()]['template'] = $data; } $this->_template_id = $_SESSION[OSCOM::getSite()]['template']['id']; $this->_template = $_SESSION[OSCOM::getSite()]['template']['code']; }
public static function hasAccess($application) { if (!isset($_SESSION[OSCOM::getSite()]['id'])) { $redirect = false; if ($application != 'Login') { $_SESSION[OSCOM::getSite()]['redirect_origin'] = $application; $redirect = true; } if ($redirect === true) { osc_redirect_admin(OSCOM::getLink(null, 'Login')); } } return Access::hasAccess(OSCOM::getSite(), $application); }
public static function execute(ApplicationAbstract $application) { if (!empty($_GET['shortcut'])) { $application = HTML::sanitize($_GET['shortcut']); if (OSCOM::siteApplicationExists($application)) { if (Dashboard::deleteShortcut($_SESSION[OSCOM::getSite()]['id'], $application)) { $_SESSION[OSCOM::getSite()]['access'] = Access::getUserLevels($_SESSION[OSCOM::getSite()]['id']); Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_success_shortcut_removed'), 'success'); OSCOM::redirect(OSCOM::getLink(null, $application)); } } } OSCOM::redirect(OSCOM::getLink()); }
public function loadIniFile($filename = null, $comment = '#', $language_code = null) { if (is_null($language_code)) { $language_code = $this->_code; } if ($this->_languages[$language_code]['parent_id'] > 0) { $this->loadIniFile($filename, $comment, $this->getCodeFromID($this->_languages[$language_code]['parent_id'])); } if (is_null($filename)) { if (file_exists(OSCOM::BASE_DIRECTORY . 'Custom/Site/' . OSCOM::getSite() . '/languages/' . $language_code . '.php')) { $contents = file(OSCOM::BASE_DIRECTORY . 'Custom/Site/' . OSCOM::getSite() . '/languages/' . $language_code . '.php'); } elseif (file_exists(OSCOM::BASE_DIRECTORY . 'Core/Site/' . OSCOM::getSite() . '/languages/' . $language_code . '.php')) { $contents = file(OSCOM::BASE_DIRECTORY . 'Core/Site/' . OSCOM::getSite() . '/languages/' . $language_code . '.php'); } else { return array(); } } else { if (substr(realpath(OSCOM::BASE_DIRECTORY . 'Custom/Site/' . OSCOM::getSite() . '/languages/' . $language_code . '/' . $filename), 0, strlen(realpath(OSCOM::BASE_DIRECTORY . 'Custom/Site/' . OSCOM::getSiteApplication() . '/languages/' . $language_code))) != realpath(OSCOM::BASE_DIRECTORY . 'Custom/Site/' . OSCOM::getSiteApplication() . '/languages/' . $language_code)) { return array(); } if (substr(realpath(OSCOM::BASE_DIRECTORY . 'Core/Site/' . OSCOM::getSite() . '/languages/' . $language_code . '/' . $filename), 0, strlen(realpath(OSCOM::BASE_DIRECTORY . 'Core/Site/' . OSCOM::getSiteApplication() . '/languages/' . $language_code))) != realpath(OSCOM::BASE_DIRECTORY . 'Core/Site/' . OSCOM::getSiteApplication() . '/languages/' . $language_code)) { return array(); } if (file_exists(OSCOM::BASE_DIRECTORY . 'Custom/Site/' . OSCOM::getSite() . '/languages/' . $language_code . '/' . $filename)) { $contents = file(OSCOM::BASE_DIRECTORY . 'Custom/Site/' . OSCOM::getSite() . '/languages/' . $language_code . '/' . $filename); } elseif (file_exists(OSCOM::BASE_DIRECTORY . 'Core/Site/' . OSCOM::getSite() . '/languages/' . $language_code . '/' . $filename)) { $contents = file(OSCOM::BASE_DIRECTORY . 'Core/Site/' . OSCOM::getSite() . '/languages/' . $language_code . '/' . $filename); } else { return array(); } } $ini_array = array(); foreach ($contents as $line) { $line = trim($line); $firstchar = substr($line, 0, 1); if (!empty($line) && $firstchar != $comment) { $delimiter = strpos($line, '='); if ($delimiter !== false && substr_count(substr($line, 0, $delimiter), ' ') == 1) { $key = trim(substr($line, 0, $delimiter)); $value = trim(substr($line, $delimiter + 1)); $ini_array[$key] = $value; } elseif (isset($key)) { $ini_array[$key] .= "\n" . trim($line); } } } unset($contents); $this->_definitions = array_merge($this->_definitions, $ini_array); }
public function __construct() { Registry::get('Language')->loadIniFile('modules/Dashboard/Reviews.php'); $this->_title = OSCOM::getDef('admin_indexmodules_reviews_title'); $this->_title_link = OSCOM::getLink(null, 'Reviews'); if (Access::hasAccess(OSCOM::getSite(), 'Reviews')) { $this->_data = '<table border="0" width="100%" cellspacing="0" cellpadding="2" class="dataTable">' . ' <thead>' . ' <tr>' . ' <th>' . OSCOM::getDef('admin_indexmodules_reviews_table_heading_products') . '</th>' . ' <th>' . OSCOM::getDef('admin_indexmodules_reviews_table_heading_language') . '</th>' . ' <th>' . OSCOM::getDef('admin_indexmodules_reviews_table_heading_rating') . '</th>' . ' <th>' . OSCOM::getDef('admin_indexmodules_reviews_table_heading_date') . '</th>' . ' </tr>' . ' </thead>' . ' <tbody>'; $Qreviews = Registry::get('Database')->query('select r.reviews_id, r.products_id, greatest(r.date_added, greatest(r.date_added, r.last_modified)) as date_last_modified, r.reviews_rating, pd.products_name, l.name as languages_name, l.code as languages_code from :table_reviews r left join :table_products_description pd on (r.products_id = pd.products_id and r.languages_id = pd.language_id), :table_languages l where r.languages_id = l.languages_id order by date_last_modified desc limit 6'); $Qreviews->execute(); $counter = 0; while ($Qreviews->next()) { $this->_data .= ' <tr onmouseover="$(this).addClass(\'mouseOver\');" onmouseout="$(this).removeClass(\'mouseOver\');"' . ($counter % 2 ? ' class="alt"' : '') . '>' . ' <td>' . osc_link_object(OSCOM::getLink(null, 'Reviews', 'rID=' . $Qreviews->valueInt('reviews_id') . '&action=save'), osc_icon('reviews.png') . ' ' . $Qreviews->value('products_name')) . '</td>' . ' <td align="center">' . Registry::get('Language')->showImage($Qreviews->value('languages_code')) . '</td>' . ' <td align="center">' . osc_image('../images/stars_' . $Qreviews->valueInt('reviews_rating') . '.png', $Qreviews->valueInt('reviews_rating') . '/5') . '</td>' . ' <td>' . $Qreviews->value('date_last_modified') . '</td>' . ' </tr>'; $counter++; } $this->_data .= ' </tbody>' . '</table>'; } }
public function __construct() { Registry::get('Language')->loadIniFile('modules/IndexModules/AdministratorsLog.php'); $this->_title = OSCOM::getDef('admin_indexmodules_administratorslog_title'); $this->_title_link = OSCOM::getLink(null, 'AdministratorsLog'); if (Access::hasAccess(OSCOM::getSite(), 'AdministratorsLog')) { $this->_data = '<table border="0" width="100%" cellspacing="0" cellpadding="2" class="dataTable">' . ' <thead>' . ' <tr>' . ' <th>' . OSCOM::getDef('admin_indexmodules_administratorslog_table_heading_users') . '</th>' . ' <th>' . OSCOM::getDef('admin_indexmodules_administratorslog_table_heading_module') . '</th>' . ' <th>' . OSCOM::getDef('admin_indexmodules_administratorslog_table_heading_date') . '</th>' . ' </tr>' . ' </thead>' . ' <tbody>'; $Qlog = Registry::get('Database')->query('select count(al.id) as total, al.id, al.module, a.user_name, al.datestamp from :table_administrators_log al, :table_administrators a where al.module in (":modules") and al.administrators_id = a.id group by al.id order by al.id desc limit 6'); $Qlog->bindRaw(':modules', implode('", "', array_keys($_SESSION[OSCOM::getSite()]['access']))); $Qlog->execute(); $counter = 0; while ($Qlog->next()) { $this->_data .= ' <tr onmouseover="$(this).addClass(\'mouseOver\');" onmouseout="$(this).removeClass(\'mouseOver\');"' . ($counter % 2 ? ' class="alt"' : '') . '>' . ' <td>' . osc_link_object(OSCOM::getLink(null, 'AdministratorsLog&lID=' . $Qlog->valueInt('id') . '&action=info'), osc_icon('log.png') . ' ' . $Qlog->valueProtected('user_name')) . '</td>' . ' <td>' . $Qlog->value('module') . ' (' . $Qlog->valueInt('total') . ')</td>' . ' <td>' . $Qlog->value('datestamp') . '</td>' . ' </tr>'; $counter++; } $this->_data .= ' </tbody>' . '</table>'; } }
public static function execute(ApplicationAbstract $application) { $data = array('username' => $_POST['user_name'], 'password' => $_POST['user_password']); if (Login::isValidCredentials($data)) { $admin = Login::getAdmin($data['username']); $_SESSION[OSCOM::getSite()]['id'] = (int) $admin['id']; $_SESSION[OSCOM::getSite()]['username'] = $admin['user_name']; $_SESSION[OSCOM::getSite()]['access'] = Access::getUserLevels($admin['id']); $to_application = OSCOM::getDefaultSiteApplication(); if (isset($_SESSION[OSCOM::getSite()]['redirect_origin'])) { $to_application = $_SESSION[OSCOM::getSite()]['redirect_origin']; unset($_SESSION[OSCOM::getSite()]['redirect_origin']); } osc_redirect_admin(OSCOM::getLink(null, $to_application)); } else { Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_error_login_invalid'), 'error'); } }
public function __construct() { Registry::get('Language')->loadIniFile('modules/Dashboard/Orders.php'); $this->_title = OSCOM::getDef('admin_indexmodules_orders_title'); $this->_title_link = OSCOM::getLink(null, 'Orders'); if (Access::hasAccess(OSCOM::getSite(), 'Orders')) { $this->_data = '<table border="0" width="100%" cellspacing="0" cellpadding="2" class="dataTable">' . ' <thead>' . ' <tr>' . ' <th>' . OSCOM::getDef('admin_indexmodules_orders_table_heading_orders') . '</th>' . ' <th>' . OSCOM::getDef('admin_indexmodules_orders_table_heading_total') . '</th>' . ' <th>' . OSCOM::getDef('admin_indexmodules_orders_table_heading_date') . '</th>' . ' <th>' . OSCOM::getDef('admin_indexmodules_orders_table_heading_status') . '</th>' . ' </tr>' . ' </thead>' . ' <tbody>'; $Qorders = Registry::get('Database')->query('select o.orders_id, o.customers_name, greatest(o.date_purchased, ifnull(o.last_modified, "1970-01-01")) as date_last_modified, s.orders_status_name, ot.text as order_total from :table_orders o, :table_orders_total ot, :table_orders_status s where o.orders_id = ot.orders_id and ot.class = "total" and o.orders_status = s.orders_status_id and s.language_id = :language_id order by date_last_modified desc limit 6'); $Qorders->bindInt(':language_id', Registry::get('Language')->getID()); $Qorders->execute(); $counter = 0; while ($Qorders->next()) { $this->_data .= ' <tr onmouseover="$(this).addClass(\'mouseOver\');" onmouseout="$(this).removeClass(\'mouseOver\');"' . ($counter % 2 ? ' class="alt"' : '') . '>' . ' <td>' . osc_link_object(OSCOM::getLink(null, 'Orders', 'oID=' . $Qorders->valueInt('orders_id') . '&action=save'), osc_icon('orders.png') . ' ' . $Qorders->valueProtected('customers_name')) . '</td>' . ' <td>' . strip_tags($Qorders->value('order_total')) . '</td>' . ' <td>' . $Qorders->value('date_last_modified') . '</td>' . ' <td>' . $Qorders->value('orders_status_name') . '</td>' . ' </tr>'; $counter++; } $this->_data .= ' </tbody>' . '</table>'; } }
public function __construct() { Registry::get('Language')->loadIniFile('modules/IndexModules/ErrorLog.php'); $this->_title = OSCOM::getDef('admin_indexmodules_errorlog_title'); $this->_title_link = OSCOM::getLink(null, 'ErrorLog'); if (Access::hasAccess(OSCOM::getSite(), 'ErrorLog')) { $this->_data = '<table border="0" width="100%" cellspacing="0" cellpadding="2" class="dataTable">' . ' <thead>' . ' <tr>' . ' <th>' . OSCOM::getDef('admin_indexmodules_errorlog_table_heading_date') . '</th>' . ' <th>' . OSCOM::getDef('admin_indexmodules_errorlog_table_heading_message') . '</th>' . ' </tr>' . ' </thead>' . ' <tbody>'; if (ErrorHandler::getTotalEntries() > 0) { $counter = 0; foreach (ErrorHandler::getAll(6) as $row) { $this->_data .= ' <tr onmouseover="$(this).addClass(\'mouseOver\');" onmouseout="$(this).removeClass(\'mouseOver\');"' . ($counter % 2 ? ' class="alt"' : '') . '>' . ' <td style="white-space: nowrap;">' . Registry::get('Template')->getIcon(16, 'errorlog.png') . ' ' . DateTime::getShort(DateTime::fromUnixTimestamp($row['timestamp']), true) . '</td>' . ' <td>' . osc_output_string_protected(substr($row['message'], 0, 60)) . '..</td>' . ' </tr>'; $counter++; } } else { $this->_data .= ' <tr onmouseover="$(this).addClass(\'mouseOver\');" onmouseout="$(this).removeClass(\'mouseOver\');">' . ' <td colspan="2">' . osc_icon('tick.png') . ' ' . OSCOM::getDef('admin_indexmodules_errorlog_no_errors_found') . '</td>' . ' </tr>'; } $this->_data .= ' </tbody>' . '</table>'; } }
public static function execute(ApplicationAbstract $application) { $OSCOM_Database = Registry::get('Database'); if (!empty($_GET['shortcut'])) { $application = osc_sanitize_string($_GET['shortcut']); if (OSCOM::siteApplicationExists($application)) { $Qsc = $OSCOM_Database->query('delete from :table_administrator_shortcuts where administrators_id = :administrators_id and module = :module'); $Qsc->bindInt(':administrators_id', $_SESSION[OSCOM::getSite()]['id']); $Qsc->bindValue(':module', $application); $Qsc->execute(); if (!$OSCOM_Database->isError()) { $_SESSION[OSCOM::getSite()]['access'] = Access::getUserLevels($_SESSION[OSCOM::getSite()]['id']); Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_success_shortcut_removed'), 'success'); osc_redirect_admin(OSCOM::getLink(null, $application)); } } } osc_redirect_admin(OSCOM::getLink()); }
public static function execute(ApplicationAbstract $application) { $error = false; foreach ($_POST['batch'] as $id) { if (!Administrators::setAccessLevels($id, $_POST['modules'], $_POST['mode'])) { $error = true; break; } } if ($error === false) { Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_success_action_performed'), 'success'); if (in_array($_SESSION[OSCOM::getSite()]['id'], $_POST['batch'])) { $_SESSION[OSCOM::getSite()]['access'] = Access::getUserLevels($_SESSION[OSCOM::getSite()]['id']); } } else { Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_error_action_not_performed'), 'error'); } OSCOM::redirect(OSCOM::getLink()); }
public static function execute(ApplicationAbstract $application) { $data = array('username' => $_POST['user_name'], 'password' => $_POST['user_password']); switch (Administrators::save(isset($_GET['id']) && is_numeric($_GET['id']) ? $_GET['id'] : null, $data, isset($_POST['modules']) ? $_POST['modules'] : null)) { case 1: if (isset($_GET['id']) && is_numeric($_GET['id']) && $_GET['id'] == $_SESSION[OSCOM::getSite()]['id']) { $_SESSION[OSCOM::getSite()]['access'] = Access::getUserLevels($_GET['id']); } Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_success_action_performed'), 'success'); osc_redirect_admin(OSCOM::getLink()); break; case -1: Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_error_action_not_performed'), 'error'); osc_redirect_admin(OSCOM::getLink()); break; case -2: Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_error_username_already_exists'), 'error'); break; } }
public static function execute(ApplicationAbstract $application) { if (!CoreUpdate::localPackageExists() || CoreUpdate::getPackageInfo('version_from') != OSCOM::getVersion()) { Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_error_wrong_version_to_update_from'), 'error'); OSCOM::redirect(OSCOM::getLink()); } if (CoreUpdate::canApplyPackage()) { if (CoreUpdate::applyPackage()) { CoreUpdate::deletePackage(); // Refresh access list for new/deleted Applications $_SESSION[OSCOM::getSite()]['access'] = Access::getUserLevels($_SESSION[OSCOM::getSite()]['id']); Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_success_action_performed'), 'success'); } else { Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_error_action_not_performed'), 'error'); } } else { Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_error_check_target_permissions'), 'error'); OSCOM::redirect(OSCOM::getLink(null, null, 'Apply&v=' . $_GET['v'])); } OSCOM::redirect(OSCOM::getLink()); }
public static function execute(ApplicationAbstract $application) { if (!empty($_POST['user_name']) && !empty($_POST['user_password'])) { $Qadmin = Registry::get('Database')->query('select id, user_name, user_password from :table_administrators where user_name = :user_name limit 1'); $Qadmin->bindValue(':user_name', $_POST['user_name']); $Qadmin->execute(); if ($Qadmin->numberOfRows() === 1) { if (osc_validate_password($_POST['user_password'], $Qadmin->value('user_password'))) { $_SESSION[OSCOM::getSite()]['id'] = $Qadmin->valueInt('id'); $_SESSION[OSCOM::getSite()]['username'] = $Qadmin->value('user_name'); $_SESSION[OSCOM::getSite()]['access'] = Access::getUserLevels($Qadmin->valueInt('id')); $to_application = OSCOM::getDefaultSiteApplication(); if (isset($_SESSION[OSCOM::getSite()]['redirect_origin'])) { $to_application = $_SESSION[OSCOM::getSite()]['redirect_origin']; unset($_SESSION[OSCOM::getSite()]['redirect_origin']); } osc_redirect_admin(OSCOM::getLink(null, $to_application)); } } } Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_error_login_invalid'), 'error'); }
public function connect() { $dsn_array = array(); if (!empty($this->_database)) { $dsn_array[] = 'dbname=' . $this->_database; } if (strpos($this->_server, '/') !== false || strpos($this->_server, '\\') !== false) { $dsn_array[] = 'unix_socket=' . $this->_server; } else { $dsn_array[] = 'host=' . $this->_server; if (!empty($this->_port)) { $dsn_array[] = 'port=' . $this->_port; } } $dsn = 'mysql:' . implode(';', $dsn_array); $this->_connected = true; $dbh = parent::__construct($dsn, $this->_username, $this->_password, $this->_driver_options); if (OSCOM::getSite() != 'Setup' && $this->_has_native_fk === false) { $this->setupForeignKeys(); } return $dbh; }
public function __construct() { Registry::get('Language')->loadIniFile('modules/Dashboard/Products.php'); $this->_title = OSCOM::getDef('admin_indexmodules_products_title'); $this->_title_link = OSCOM::getLink(null, 'Products'); if (Access::hasAccess(OSCOM::getSite(), 'Products')) { if (!isset($osC_Currencies)) { if (!class_exists('osC_Currencies')) { include 'includes/classes/currencies.php'; } $osC_Currencies = new osC_Currencies(); } $this->_data = '<table border="0" width="100%" cellspacing="0" cellpadding="2" class="dataTable">' . ' <thead>' . ' <tr>' . ' <th>' . OSCOM::getDef('admin_indexmodules_products_table_heading_products') . '</th>' . ' <th>' . OSCOM::getDef('admin_indexmodules_products_table_heading_price') . '</th>' . ' <th>' . OSCOM::getDef('admin_indexmodules_products_table_heading_date') . '</th>' . ' <th>' . OSCOM::getDef('admin_indexmodules_products_table_heading_status') . '</th>' . ' </tr>' . ' </thead>' . ' <tbody>'; $Qproducts = Registry::get('PDO')->query('select products_id, greatest(products_date_added, products_last_modified) as date_last_modified from :table_products where parent_id is null order by date_last_modified desc limit 6'); $Qproducts->execute(); $counter = 0; while ($Qproducts->fetch()) { $data = osC_Products_Admin::get($Qproducts->valueInt('products_id')); $products_icon = osc_icon('products.png'); $products_price = $data['products_price']; if (!empty($data['variants'])) { $products_icon = osc_icon('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 .= ' <tr onmouseover="$(this).addClass(\'mouseOver\');" onmouseout="$(this).removeClass(\'mouseOver\');"' . ($counter % 2 ? ' class="alt"' : '') . '>' . ' <td>' . osc_link_object(OSCOM::getLink(null, 'Products', 'id=' . (int) $data['products_id'] . '&action=save'), $products_icon . ' ' . osc_output_string_protected($data['products_name'])) . '</td>' . ' <td>' . (!empty($data['variants']) ? 'from ' : '') . $osC_Currencies->format($products_price) . '</td>' . ' <td>' . $Qproducts->value('date_last_modified') . '</td>' . ' <td align="center">' . osc_icon((int) $data['products_status'] === 1 ? 'checkbox_ticked.gif' : 'checkbox_crossed.gif', null, null) . '</td>' . ' </tr>'; $counter++; } $this->_data .= ' </tbody>' . '</table>'; } }
public function getPageContentsFile() { $file_location = OSCOM::BASE_DIRECTORY . 'Core/Site/' . OSCOM::getSite() . '/Application/' . OSCOM::getSiteApplication() . '/pages/' . $this->getPageContentsFilename(); if (file_exists(OSCOM::BASE_DIRECTORY . 'Custom/Site/' . OSCOM::getSite() . '/Application/' . OSCOM::getSiteApplication() . '/pages/' . $this->getPageContentsFilename())) { $file_location = OSCOM::BASE_DIRECTORY . 'Custom/Site/' . OSCOM::getSite() . '/Application/' . OSCOM::getSiteApplication() . '/pages/' . $this->getPageContentsFilename(); } return $file_location; }
</ul> <?php if (isset($_SESSION[OSCOM::getSite()]['id'])) { echo '<ul class="apps" style="float: right;">'; if ($OSCOM_Application->canLinkTo()) { if (Access::isShortcut(OSCOM::getSiteApplication())) { echo ' <li class="shortcuts">' . osc_link_object(OSCOM::getLink(null, 'Index', 'RemoveShortcut&shortcut=' . OSCOM::getSiteApplication()), osc_icon('shortcut_remove.png')) . '</li>'; } else { echo ' <li class="shortcuts">' . osc_link_object(OSCOM::getLink(null, 'Index', 'AddShortcut&shortcut=' . OSCOM::getSiteApplication()), osc_icon('shortcut_add.png')) . '</li>'; } } if (Access::hasShortcut()) { echo ' <li class="shortcuts">'; foreach (Access::getShortcuts() as $shortcut) { echo '<a href="' . OSCOM::getLink(null, $shortcut['module']) . '">' . $OSCOM_Template->getIcon(16, $shortcut['icon'], $shortcut['title']) . '</a>'; } echo ' </li>'; } echo ' <li><a href="#"><span class="ui-icon ui-icon-triangle-1-s" style="float: right;"></span>' . osc_output_string_protected($_SESSION[OSCOM::getSite()]['username']) . '</a>' . ' <ul>' . ' <li><a href="' . OSCOM::getLink(null, 'Login', 'Logoff') . '">' . OSCOM::getDef('header_title_logoff') . '</a></li>' . ' </ul>' . ' </li>' . '</ul>'; } ?> </div> <script type="text/javascript"> $('#adminMenu .apps').droppy({speed: 0}); $('#adminMenu .apps li img').tipsy(); </script>
?> </div> <?php if (isset($_SESSION[OSCOM::getSite()]['id']) && !in_array(OSCOM::getSiteApplication(), array('Index', 'Login'))) { ?> <script type="text/javascript"> $('#appContent').css('marginLeft', '190px'); </script> <?php } if ($OSCOM_Template->hasPageFooter()) { ?> <div id="footer"> <?php include OSCOM::BASE_DIRECTORY . 'Core/Site/' . OSCOM::getSite() . '/templates/oscom/footer.php'; ?> </div> <?php } ?> </body> </html>
} echo ' </li>'; } echo ' <li><a href="#"><span class="ui-icon ui-icon-triangle-1-s" style="float: right;"></span>' . osc_output_string_protected($_SESSION[OSCOM::getSite()]['username']) . '</a>' . ' <ul>' . ' <li><a href="' . OSCOM::getLink(null, 'Login', 'Logoff') . '">' . OSCOM::getDef('header_title_logoff') . '</a></li>' . ' </ul>' . ' </li>' . '</ul>'; } ?> </div> <script type="text/javascript"> $('#adminMenu .apps').droppy({speed: 0}); $('#adminMenu .apps li img').tipsy(); </script> <?php if (isset($_SESSION[OSCOM::getSite()]['id'])) { ?> <script type="text/javascript"> var wkn = new Object; if ( $.cookie('wkn') ) { wkn = $.secureEvalJSON($.cookie('wkn')); } function updateShortcutNotifications(resetApplication) { $.getJSON('<?php echo OSCOM::getRPCLink('Admin', 'Dashboard', 'GetShortcutNotifications&reset=RESETAPP'); ?> '.replace('RESETAPP', resetApplication), function (data) { $.each(data, function(key, val) {
public static function siteApplicationRPCExists($rpc) { return class_exists('osCommerce\\OM\\Core\\Site\\' . OSCOM::getSite() . '\\Application\\' . OSCOM::getSiteApplication() . '\\' . $rpc); }
public static function execute(ApplicationAbstract $application) { unset($_SESSION[OSCOM::getSite()]); Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_success_logged_out'), 'success'); OSCOM::redirect(OSCOM::getLink(null, OSCOM::getDefaultSiteApplication())); }
<body> <div id="pageHeader" class="round"> <div> <div style="float: right; padding-top: 40px; padding-right: 15px; color: #000000; font-weight: bold;"><a href="http://www.oscommerce.com" target="_blank">osCommerce Website</a> | <a href="http://www.oscommerce.com/support" target="_blank">Support</a></div> <a href="<?php echo OSCOM::getLink(null, 'Index'); ?> "><img src="<?php echo OSCOM::getPublicSiteLink('images/oscommerce_logo-silver.jpg'); ?> " border="0" width="250" height="50" alt="" title="osCommerce Online Merchant v3.0" style="margin: 10px 10px 0px 10px;" /></a> </div> </div> <div id="pageContent"> <?php require OSCOM::BASE_DIRECTORY . 'Core/Site/' . OSCOM::getSite() . '/Application/' . OSCOM::getSiteApplication() . '/pages/' . $OSCOM_Template->getPageContentsFilename(); ?> </div> <div id="pageFooter"> Copyright © 2000-2010 <a href="http://www.oscommerce.com" target="_blank">osCommerce</a> (<a href="http://www.oscommerce.com/about/copyright" target="_blank">Copyright Policy</a>, <a href="http://www.oscommerce.com/about/trademark" target="_blank">Trademark Policy</a>)<br />osCommerce provides no warranty and is redistributable under the <a href="http://www.fsf.org/licenses/gpl.txt" target="_blank">GNU General Public License v2 (1991)</a> </div> </body> </html>
public static function hasAccess($application) { return isset($_SESSION[OSCOM::getSite()]['id']) && Access::hasAccess(OSCOM::getSite(), $application); }
<?php /* osCommerce Online Merchant $osCommerce-SIG$ Copyright (c) 2010 osCommerce (http://www.oscommerce.com) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License v2 (1991) as published by the Free Software Foundation. */ use osCommerce\OM\Core\DirectoryListing; use osCommerce\OM\Core\OSCOM; use osCommerce\OM\Core\Registry; $OSCOM_DirectoryListing = new DirectoryListing(OSCOM::BASE_DIRECTORY . 'Core/Site/' . OSCOM::getSite() . '/Module/IndexModules'); $OSCOM_DirectoryListing->setIncludeDirectories(false); $files = $OSCOM_DirectoryListing->getFiles(); $Qonline = Registry::get('Database')->query('select count(*) as total from :table_whos_online where time_last_click >= :time_last_click'); $Qonline->bindInt(':time_last_click', time() - 900); $Qonline->execute(); ?> <h1><?php echo $OSCOM_Template->getIcon(32) . osc_link_object(OSCOM::getLink(), $OSCOM_Template->getPageTitle()); ?> </h1> <p><?php echo osc_link_object(OSCOM::getLink(null, 'OnlineCustomers'), osc_icon('people.png') . ' ' . sprintf(OSCOM::getDef('total_customers_online'), $Qonline->valueInt('total'))); ?> </p>
} ?> </div> <?php $content_right = ''; if ($OSCOM_Template->hasPageBoxModules()) { ob_start(); foreach ($OSCOM_Template->getBoxModules('right') as $box) { $OSCOM_Box = new $box(); $OSCOM_Box->initialize(); if ($OSCOM_Box->hasContent()) { // HPDL move logic elsewhere if ($OSCOM_Template->getCode() == DEFAULT_TEMPLATE) { include OSCOM::BASE_DIRECTORY . 'Core/Site/' . OSCOM::getSite() . '/Module/Box/' . $OSCOM_Box->getCode() . '/pages/main.php'; } else { //HPDL old if (file_exists('templates/' . $osC_Template->getCode() . '/modules/boxes/' . $osC_Box->getCode() . '.php')) { include 'templates/' . $osC_Template->getCode() . '/modules/boxes/' . $osC_Box->getCode() . '.php'; } else { include 'templates/' . DEFAULT_TEMPLATE . '/modules/boxes/' . $osC_Box->getCode() . '.php'; } } } unset($OSCOM_Box); } $content_right = ob_get_contents(); ob_end_clean(); } if (!empty($content_right)) {