public static function insert($module, $module_action, $module_id, $action, $log, $transaction_id) { global $osC_Database; if (is_numeric($transaction_id)) { $log_id = $transaction_id; } else { $Qlog = $osC_Database->query('select max(id) as id from :table_administrators_log'); $Qlog->bindTable(':table_administrators_log', TABLE_ADMINISTRATORS_LOG); $Qlog->execute(); $log_id = $Qlog->valueInt('id') + 1; if ($transaction_id === true) { $osC_Database->logging_transaction = $log_id; } } foreach ($log as $entry) { $Qlog = $osC_Database->query('insert into :table_administrators_log (id, module, module_action, module_id, field_key, old_value, new_value, action, administrators_id, datestamp) values (:id, :module, :module_action, :module_id, :field_key, :old_value, :new_value, :action, :administrators_id, now())'); $Qlog->bindTable(':table_administrators_log', TABLE_ADMINISTRATORS_LOG); $Qlog->bindInt(':id', $log_id); $Qlog->bindValue(':module', $module); $Qlog->bindValue(':module_action', $module_action); $Qlog->bindInt(':module_id', $module_id); $Qlog->bindValue(':field_key', $entry['key']); $Qlog->bindValue(':old_value', $entry['old']); $Qlog->bindValue(':new_value', $entry['new']); $Qlog->bindValue(':action', $action); $Qlog->bindInt(':administrators_id', $_SESSION[OSCOM::getSite()]['id']); $Qlog->execute(); } }
/** * @since v3.0.3 */ public function runActions() { $action = null; $action_index = 1; if (count($_GET) > 1) { $requested_action = HTML::sanitize(basename(key(array_slice($_GET, 1, 1, true)))); if ($requested_action == OSCOM::getSiteApplication()) { $requested_action = null; if (count($_GET) > 2) { $requested_action = HTML::sanitize(basename(key(array_slice($_GET, 2, 1, true)))); $action_index = 2; } } if (!empty($requested_action) && self::siteApplicationActionExists($requested_action)) { $this->_current_action = $action = $requested_action; } } if (isset($action)) { call_user_func(array('osCommerce\\OM\\Core\\Site\\' . OSCOM::getSite() . '\\Application\\' . OSCOM::getSiteApplication() . '\\Action\\' . $action, 'execute'), $this); $action_index++; if ($action_index < count($_GET)) { $action = array($action); for ($i = $action_index, $n = count($_GET); $i < $n; $i++) { $subaction = HTML::sanitize(basename(key(array_slice($_GET, $i, 1, true)))); if (!in_array($subaction, $this->_ignored_actions) && self::siteApplicationActionExists(implode('\\', $action) . '\\' . $subaction)) { call_user_func(array('osCommerce\\OM\\Core\\Site\\' . OSCOM::getSite() . '\\Application\\' . OSCOM::getSiteApplication() . '\\Action\\' . implode('\\', $action) . '\\' . $subaction, 'execute'), $this); $action[] = $subaction; $this->_current_action = $subaction; } else { break; } } } } }
/** * Verify an existing session ID and create or resume the session if the existing session ID is valid * * @access public * @return boolean */ public function start() { if ($this->_life_time > 0) { ini_set('session.gc_maxlifetime', $this->_life_time); } else { $this->_life_time = ini_get('session.gc_maxlifetime'); } session_set_cookie_params(0, OSCOM::getRequestType() == 'NONSSL' ? HTTP_COOKIE_PATH : HTTPS_COOKIE_PATH, OSCOM::getRequestType() == 'NONSSL' ? HTTP_COOKIE_DOMAIN : HTTPS_COOKIE_DOMAIN); $sane_session_id = true; if (isset($_GET[$this->_name]) && (empty($_GET[$this->_name]) || !ctype_alnum($_GET[$this->_name]))) { $sane_session_id = false; } elseif (isset($_POST[$this->_name]) && (empty($_POST[$this->_name]) || !ctype_alnum($_POST[$this->_name]))) { $sane_session_id = false; } elseif (isset($_COOKIE[$this->_name]) && (empty($_COOKIE[$this->_name]) || !ctype_alnum($_COOKIE[$this->_name]))) { $sane_session_id = false; setcookie($this->_name, '', time() - 42000, $this->getCookieParameters('path'), $this->getCookieParameters('domain')); } if ($sane_session_id === false) { osc_redirect(OSCOM::getLink(null, OSCOM::getDefaultSiteApplication(), null, 'NONSSL', false)); } else { if (session_start()) { register_shutdown_function(array($this, 'close')); $this->_is_started = true; $this->_id = session_id(); return true; } } return false; }
function __construct() { foreach (OSCOM::callDB('GetLanguages', null, 'Core') as $lang) { $this->_languages[$lang['code']] = array('id' => (int) $lang['languages_id'], 'code' => $lang['code'], 'name' => $lang['name'], 'locale' => $lang['locale'], 'charset' => $lang['charset'], 'date_format_short' => $lang['date_format_short'], 'date_format_long' => $lang['date_format_long'], 'time_format' => $lang['time_format'], 'text_direction' => $lang['text_direction'], 'currencies_id' => (int) $lang['currencies_id'], 'numeric_separator_decimal' => $lang['numeric_separator_decimal'], 'numeric_separator_thousands' => $lang['numeric_separator_thousands'], 'parent_id' => (int) $lang['parent_id']); } $this->set(); }
public function __construct() { $this->_page_title = OSCOM::getDef('heading_title'); if (!empty($_GET[$this->_module]) && is_numeric($_GET[$this->_module])) { $this->_page_contents = 'entries.php'; $this->_page_title .= ': ' . osC_ProductTypes_Admin::get($_GET[$this->_module], 'title'); } }
function __construct($group) { $OSCOM_Cache = Registry::get('Cache'); $OSCOM_Template = Registry::get('Template'); $OSCOM_Database = Registry::get('Database'); $this->_group = $group; if ($OSCOM_Cache->read('templates_' . $this->_group . '_layout-' . $OSCOM_Template->getCode() . '-' . OSCOM::getSiteApplication() . '-' . $OSCOM_Template->getPageContentsFilename())) { $data = $OSCOM_Cache->getCache(); } else { $data = array(); $Qspecific = $OSCOM_Database->query('select b2p.boxes_group, b.code from :table_templates_boxes_to_pages b2p, :table_templates_boxes b, :table_templates t where b2p.templates_id = :templates_id and b2p.page_specific = 1 and b2p.content_page in (:content_page) and b2p.templates_boxes_id = b.id and b.modules_group = :modules_group and b2p.templates_id = t.id order by b2p.boxes_group, b2p.sort_order'); $Qspecific->bindInt(':templates_id', $OSCOM_Template->getID()); $Qspecific->bindRaw(':content_page', '"*", "' . OSCOM::getSiteApplication() . '/*", "' . OSCOM::getSiteApplication() . '/' . substr($OSCOM_Template->getPageContentsFilename(), 0, strrpos($OSCOM_Template->getPageContentsFilename(), '.')) . '"'); $Qspecific->bindValue(':modules_group', $this->_group); $Qspecific->execute(); if ($Qspecific->numberOfRows()) { while ($Qspecific->next()) { $data[$Qspecific->value('boxes_group')][] = $Qspecific->value('code'); } } else { $_data = array(); $Qmodules = $OSCOM_Database->query('select b2p.boxes_group, b2p.content_page, b.code from :table_templates_boxes_to_pages b2p, :table_templates_boxes b, :table_templates t where b2p.templates_id = :templates_id and b2p.content_page in (:content_page) and b2p.templates_boxes_id = b.id and b.modules_group = :modules_group and b2p.templates_id = t.id order by b2p.boxes_group, b2p.sort_order'); $Qmodules->bindInt(':templates_id', $OSCOM_Template->getID()); $Qmodules->bindRaw(':content_page', '"*", "' . OSCOM::getSiteApplication() . '/*", "' . OSCOM::getSiteApplication() . '/' . substr($OSCOM_Template->getPageContentsFilename(), 0, strrpos($OSCOM_Template->getPageContentsFilename(), '.')) . '"'); $Qmodules->bindValue(':modules_group', $this->_group); $Qmodules->execute(); while ($Qmodules->next()) { $_data[$Qmodules->value('boxes_group')][] = array('code' => $Qmodules->value('code'), 'page' => $Qmodules->value('content_page')); } foreach ($_data as $groups => $modules) { $clean = array(); foreach ($modules as $module) { if (isset($clean[$module['code']])) { if (substr_count($module['page'], '/') > substr_count($clean[$module['code']]['page'], '/')) { unset($clean[$module['code']]); } } $clean[$module['code']] = $module; } $_data[$groups] = $clean; } foreach ($_data as $groups => $modules) { foreach ($modules as $module) { $data[$groups][] = $module['code']; } } } $OSCOM_Cache->write($data); } $this->_modules = $data; }
public function __construct() { global $osC_MessageStack; parent::__construct(); $this->_page_contents = 'entries_delete.php'; if (isset($_POST['subaction']) && $_POST['subaction'] == 'confirm') { if (osC_ProductTypes_Admin::deleteAssignments($_GET[$this->_module], $_GET['aID'])) { $osC_MessageStack->add($this->_module, OSCOM::getDef('ms_success_action_performed'), 'success'); } else { $osC_MessageStack->add($this->_module, OSCOM::getDef('ms_error_action_not_performed'), 'error'); } osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, $this->_module . '=' . $_GET[$this->_module])); } }
public function __construct() { global $osC_MessageStack; parent::__construct(); if (isset($_GET['tID']) && is_numeric($_GET['tID'])) { $this->_page_contents = 'edit.php'; } else { $this->_page_contents = 'new.php'; } if (isset($_POST['subaction']) && $_POST['subaction'] == 'confirm') { $data = array('title' => $_POST['title']); if (osC_ProductTypes_Admin::save(isset($_GET['tID']) && is_numeric($_GET['tID']) ? $_GET['tID'] : null, $data)) { $osC_MessageStack->add($this->_module, OSCOM::getDef('ms_success_action_performed'), 'success'); } else { $osC_MessageStack->add($this->_module, OSCOM::getDef('ms_error_action_not_performed'), 'error'); } osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, $this->_module)); } }
public function __construct() { global $osC_MessageStack; parent::__construct(); if (isset($_GET['aID']) && !empty($_GET['aID'])) { $this->_page_contents = 'entries_edit.php'; } else { $this->_page_contents = 'entries_new.php'; if (sizeof(osC_ProductTypes_Admin::getActions($_GET[$this->_module])) < 1) { $osC_MessageStack->add($this->_module, OSCOM::getDef('ms_warning_no_available_actions'), 'warning'); $this->_page_contents = 'entries.php'; } } if (isset($_POST['subaction']) && $_POST['subaction'] == 'confirm') { $data = array('modules' => explode(',', $_POST['modules'])); if (osC_ProductTypes_Admin::saveAssignments($_GET[$this->_module], isset($_GET['aID']) ? $_GET['aID'] : $_POST['action'], $data)) { $osC_MessageStack->add($this->_module, OSCOM::getDef('ms_success_action_performed'), 'success'); } else { $osC_MessageStack->add($this->_module, OSCOM::getDef('ms_error_action_not_performed'), 'error'); } osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, $this->_module . '=' . $_GET[$this->_module])); } }
/** * Set the time zone to use for dates. * * @param string $time_zone An optional time zone to set to * @param string $site The Site to retrieve the time zone from * @return boolean * @since v3.0.1 */ public static function setTimeZone($time_zone = null, $site = 'OSCOM') { if (!isset($time_zone)) { if (OSCOM::configExists('time_zone', $site)) { $time_zone = OSCOM::getConfig('time_zone', $site); } else { $time_zone = date_default_timezone_get(); } } return date_default_timezone_set($time_zone); }
echo $osC_Language->get('operation_title_filter_users') . ' ' . osc_draw_pull_down_menu('fu', $admins_array); ?> <input type="submit" value="GO" class="operationButton" /> </form> </div> <?php $Qlog = $osC_Database->query('select SQL_CALC_FOUND_ROWS count(al.id) as total, al.id, al.module, al.module_action, al.module_id, al.action, a.user_name, unix_timestamp(al.datestamp) as datestamp from :table_administrators_log al, :table_administrators a where'); if (!empty($_GET['fm']) && in_array($_GET['fm'], $_SESSION[OSCOM::getSite()]['access'])) { $Qlog->appendQuery('al.module = :module'); $Qlog->bindValue(':module', $_GET['fm']); } else { $Qlog->appendQuery('al.module in (":modules")'); $Qlog->bindRaw(':modules', implode('", "', $_SESSION[OSCOM::getSite()]['access'])); } $Qlog->appendQuery('and'); if (is_numeric($_GET['fu'])) { $Qlog->appendQuery('al.administrators_id = :administrators_id and'); $Qlog->bindInt(':administrators_id', $_GET['fu']); } $Qlog->appendQuery('al.administrators_id = a.id group by al.id order by al.id desc'); $Qlog->bindTable(':table_administrators_log', TABLE_ADMINISTRATORS_LOG); $Qlog->bindTable(':table_administrators', TABLE_ADMINISTRATORS); $Qlog->setBatchLimit($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS); $Qlog->execute(); ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr>
/** * Return all templates in an array * * @access public * @return array */ public static function getTemplates() { return OSCOM::callDB('GetTemplates', null, 'Core'); }
/** * Returns the page module name * * @access public * @return string */ function getModule() { return OSCOM::getSiteApplication(); }
public static function getLevels($group = null, $site = null) { if ( !isset($site) ) { $site = OSCOM::getSite(); } $access = array(); if ( isset($_SESSION[$site]['id']) && isset($_SESSION[$site]['access']) ) { foreach ( $_SESSION[$site]['access'] as $module => $data ) { if ( ($data['linkable'] === true) && (!isset($group) || ($group == $data['group'])) ) { if ( !isset($access[$data['group']][$data['sort_order']]) ) { $access[$data['group']][$data['sort_order']] = $data; } else { $access[$data['group']][] = $data; } } } ksort($access); foreach ( $access as $group => $modules ) { ksort($access[$group]); } } return $access; }
/** * Display a banner. If no ID is passed, the value defined in $_exists_id is * used. * * @param int $id The ID of the banner to show * @access public * @return string */ public function display($id = null) { $OSCOM_PDO = Registry::get('PDO'); $banner_string = ''; if (empty($id) && isset($this->_exists_id) && is_numeric($this->_exists_id)) { $id = $this->_exists_id; unset($this->_exists_id); } $Qbanner = $OSCOM_PDO->prepare('select * from :table_banners where banners_id = :banners_id and status = 1'); $Qbanner->bindInt(':banners_id', $id); $Qbanner->execute(); $result = $Qbanner->fetch(); if ($result !== false) { if (!empty($result['banners_html_text'])) { $banner_string = $result['banners_html_text']; } else { // HPDL create Redirect action; fix banner image location $banner_string = HTML::link(OSCOM::getLink('Shop', 'Index', 'Redirect&action=banner&goto=' . (int) $result['banners_id']), HTML::image('public/' . $Qbanner->value('banners_image'), $Qbanner->value('banners_title')), 'target="_blank"'); } $this->_updateDisplayCount($result['banners_id']); if ($this->_show_duplicates_in_group === false) { $this->_shown_ids[] = $result['banners_id']; } } return $banner_string; }
public static function redirect($url) { if ( (strpos($url, "\n") !== false) || (strpos($url, "\r") !== false) ) { $url = static::getLink(OSCOM::getDefaultSite()); } if ( strpos($url, '&') !== false ) { $url = str_replace('&', '&', $url); } header('Location: ' . $url); exit; }
public static function isShortcut($application, $site = null) { if (empty($site)) { $site = OSCOM::getSite(); } if (isset($_SESSION[$site]['id'])) { return $_SESSION[$site]['access'][$application]['shortcut']; } return false; }
<p><label>Installed Modules:</label><ul id="modulesInstalled" class="connectedList"></ul></p> <p><label>Available Modules:</label><ul id="modulesAvailable" class="connectedList"> <?php foreach ($modules_array as $id => $title) { echo '<li id="' . $id . '" class="ui-state-default fg-button fg-button-icon-left" onmouseover="$(this).addClass(\'ui-state-highlight\');" onmouseout="$(this).removeClass(\'ui-state-highlight\');"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>' . $title . '</li>'; } ?> </ul></p> </fieldset> <p><?php echo osc_draw_hidden_field('modules', implode(',', $activated_modules_array), 'id="modules"') . osc_draw_hidden_field('subaction', 'confirm') . osc_draw_button(array('priority' => 'primary', 'icon' => 'check', 'title' => OSCOM::getDef('button_save'))) . ' ' . osc_draw_button(array('href' => osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '=' . $_GET[$osC_Template->getModule()]), 'priority' => 'secondary', 'icon' => 'close', 'title' => OSCOM::getDef('button_cancel'))); ?> </p> </form> </div> <script type="text/javascript"> $('#modulesInstalled, #modulesAvailable').sortable({ containment: '#containment', axis: 'y', connectWith: '.connectedList', update: function(event, ui) { $('#modules').val( $('#modulesInstalled').sortable('toArray') ); } }).disableSelection();
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. */ // to delete /////// define('PAGE_PARSE_START_TIME', microtime()); define('PROJECT_VERSION', 'osCommerce Online Merchant $osCommerce-SIG$'); $request_type = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ? 'SSL' : 'NONSSL'; //////////////////// define('OSCOM_TIMESTAMP_START', microtime()); error_reporting(E_ALL); define('OSCOM_BASE_DIRECTORY', dirname(dirname(__FILE__))); require 'core/OSCOM.php'; OSCOM::initialize(); // redirect to the installation module if DB_SERVER is empty if (strlen(DB_SERVER) < 1) { if (is_dir('install')) { header('Location: install/index.php'); } } if ($request_type == 'NONSSL') { define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG); } else { define('DIR_WS_CATALOG', DIR_WS_HTTPS_CATALOG); } // compatibility logic require 'includes/functions/compatibility.php'; // include the list of project filenames require 'includes/filenames.php';
?> </h3> <form name="tEdit" action="<?php echo osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '&tID=' . $osC_ObjectInfo->getInt('id') . '&action=save'); ?> " method="post"> <p><?php echo OSCOM::getDef('introduction_edit_product_type'); ?> </p> <fieldset> <p><label for="title"><?php echo OSCOM::getDef('field_title'); ?> </label><?php echo osc_draw_input_field('title', $osC_ObjectInfo->get('title')); ?> </p> </fieldset> <p><?php echo osc_draw_hidden_field('subaction', 'confirm') . osc_draw_button(array('priority' => 'primary', 'icon' => 'check', 'title' => OSCOM::getDef('button_save'))) . ' ' . osc_draw_button(array('href' => osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule()), 'priority' => 'secondary', 'icon' => 'close', 'title' => OSCOM::getDef('button_cancel'))); ?> </p> </form> </div>
function getBatchNextPageLink($batch_keyword = 'page', $parameters = '') { $number_of_pages = ceil($this->batch_size / $this->batch_rows); $get_parameter = ''; if (!empty($parameters)) { $parameters = explode('&', $parameters); foreach ($parameters as $parameter) { $keys = explode('=', $parameter, 2); if ($keys[0] != $batch_keyword) { $get_parameter .= $keys[0] . (isset($keys[1]) ? '=' . $keys[1] : '') . '&'; } } } if (defined('OSC_IN_ADMIN') && OSC_IN_ADMIN === true) { $forward_string = osc_icon('nav_forward.png'); $forward_grey_string = osc_icon('nav_forward_grey.png'); } else { $forward_string = OSCOM::getDef('result_set_next_page'); $forward_grey_string = OSCOM::getDef('result_set_next_page'); } $string = ' '; if ($this->batch_number < $number_of_pages && $number_of_pages != 1) { $string .= osc_link_object(OSCOM::getLink(null, null, $get_parameter . $batch_keyword . '=' . ($this->batch_number + 1)), $forward_string); } else { $string .= $forward_grey_string; } return $string; }
</th> <th align="center" width="20"><?php echo osc_draw_checkbox_field('batchFlag', null, null, 'onclick="flagCheckboxes(this);"'); ?> </th> </tr> </tfoot> <tbody> </tbody> </table> </form> <div class="dataTableFooter"> <span id="dataTableLegend"><?php echo '<b>' . OSCOM::getDef('table_action_legend') . '</b> ' . osc_icon('edit.png') . ' ' . OSCOM::getDef('icon_edit') . ' ' . osc_icon('trash.png') . ' ' . OSCOM::getDef('icon_trash'); ?> </span> <span id="batchPullDownMenu"></span> </div> <script type="text/javascript"> var moduleParamsCookieName = 'oscadmin_module_' + pageModule; var moduleParams = new Object(); moduleParams.page = 1; moduleParams.search = ''; if ( $.cookie(moduleParamsCookieName) != null ) { var p = $.secureEvalJSON($.cookie(moduleParamsCookieName)); moduleParams.page = parseInt(p.page);
/** * Get the number of messages belonging to a group * * @param string $group The name of the group to check * @access public */ public function size($group = null) { if (empty($group)) { $group = OSCOM::getSiteApplication(); } $size = 0; if ($this->exists($group)) { $size = sizeof($this->_data[$group]); } return $size; }