Beispiel #1
0
 public static function execute($data)
 {
     if (!empty($data['password'])) {
         $data['password'] = osc_encrypt_string(trim($data['password']));
     }
     return OSCOM::callDB('Admin\\Administrators\\Save', $data);
 }
Beispiel #2
0
 public static function execute($id = null, $data)
 {
     if (is_numeric($id)) {
         $data['id'] = $id;
     }
     return OSCOM::callDB('Admin\\Countries\\Save', $data);
 }
 public static function execute($module)
 {
     $class = 'osCommerce\\OM\\Core\\Site\\Admin\\Module\\Service\\' . $module;
     if (class_exists($class)) {
         $OSCOM_SM = new $class();
         $OSCOM_SM->install();
         $sm = explode(';', MODULE_SERVICES_INSTALLED);
         if (isset($OSCOM_SM->depends)) {
             if (is_string($OSCOM_SM->depends) && ($key = array_search($OSCOM_SM->depends, $sm)) !== false) {
                 if (isset($sm[$key + 1])) {
                     array_splice($sm, $key + 1, 0, $module);
                 } else {
                     $sm[] = $module;
                 }
             } elseif (is_array($OSCOM_SM->depends)) {
                 foreach ($OSCOM_SM->depends as $depends_module) {
                     if (($key = array_search($depends_module, $sm)) !== false) {
                         if (!isset($array_position) || $key > $array_position) {
                             $array_position = $key;
                         }
                     }
                 }
                 if (isset($array_position)) {
                     array_splice($sm, $array_position + 1, 0, $module);
                 } else {
                     $sm[] = $module;
                 }
             }
         } elseif (isset($OSCOM_SM->precedes)) {
             if (is_string($OSCOM_SM->precedes)) {
                 if (($key = array_search($OSCOM_SM->precedes, $sm)) !== false) {
                     array_splice($sm, $key, 0, $module);
                 } else {
                     $sm[] = $module;
                 }
             } elseif (is_array($OSCOM_SM->precedes)) {
                 foreach ($OSCOM_SM->precedes as $precedes_module) {
                     if (($key = array_search($precedes_module, $sm)) !== false) {
                         if (!isset($array_position) || $key < $array_position) {
                             $array_position = $key;
                         }
                     }
                 }
                 if (isset($array_position)) {
                     array_splice($sm, $array_position, 0, $module);
                 } else {
                     $sm[] = $module;
                 }
             }
         } else {
             $sm[] = $module;
         }
         $data = array('key' => 'MODULE_SERVICES_INSTALLED', 'value' => implode(';', $sm));
         if (OSCOM::callDB('Admin\\Configuration\\EntrySave', $data)) {
             Cache::clear('configuration');
             return true;
         }
     }
     return false;
 }
Beispiel #4
0
 public static function execute($data)
 {
     if (!empty($data['password'])) {
         $data['password'] = Hash::get(trim($data['password']));
     }
     return OSCOM::callDB('Admin\\Customers\\Save', $data);
 }
Beispiel #5
0
 public static function execute($data)
 {
     if (OSCOM::callDB('Admin\\Configuration\\EntrySave', $data)) {
         Cache::clear('configuration');
         return true;
     }
     return false;
 }
 public static function execute($data)
 {
     if ($OSCOM_PDO = PDO::initialize($data['server'], $data['username'], $data['password'], null, $data['port'], $data['class'])) {
         Registry::set('PDO', $OSCOM_PDO);
         OSCOM::callDB('Setup\\Install\\CreateDB', array('database' => $data['database']));
     }
     return PDO::initialize($data['server'], $data['username'], $data['password'], $data['database'], $data['port'], $data['class']);
 }
 public static function execute($data)
 {
     $result = OSCOM::callDB('Admin\\Login\\GetAdmin', array('username' => $data['username']));
     if (!empty($result)) {
         return osc_validate_password($data['password'], $result['user_password']);
     }
     return false;
 }
Beispiel #8
0
 public static function execute($pageset = 1)
 {
     $data = array('batch_pageset' => $pageset, 'batch_max_results' => MAX_DISPLAY_SEARCH_RESULTS);
     if (!is_numeric($data['batch_pageset']) || floor($data['batch_pageset']) != $data['batch_pageset']) {
         $data['batch_pageset'] = 1;
     }
     return OSCOM::callDB('Admin\\Administrators\\GetAll', $data);
 }
 public static function execute($id, $modules, $mode = Administrators::ACCESS_MODE_ADD)
 {
     $data = array('id' => $id, 'modules' => $modules, 'mode' => $mode);
     if (in_array('0', $data['modules'])) {
         $data['modules'] = array('*');
     }
     return OSCOM::callDB('Admin\\Administrators\\SavePermissions', $data);
 }
Beispiel #10
0
 public static function execute($search, $pageset = 1)
 {
     $data = array('keywords' => $search, 'batch_pageset' => $pageset, 'batch_max_results' => MAX_DISPLAY_SEARCH_RESULTS);
     if (!is_numeric($data['batch_pageset']) || floor($data['batch_pageset']) != $data['batch_pageset']) {
         $data['batch_pageset'] = 1;
     }
     return OSCOM::callDB('Admin\\Currencies\\Find', $data);
 }
 public static function execute($email_address, $customer_id = null)
 {
     $data = array('email_address' => $email_address);
     $result = OSCOM::callDB('Admin\\Customers\\Get', $data);
     if (isset($customer_id)) {
         return $result['customers_id'] != $customer_id;
     }
     return !empty($result);
 }
Beispiel #12
0
 public static function execute($id)
 {
     $data = array('id' => $id);
     if (Languages::get($id, 'code') != DEFAULT_LANGUAGE && OSCOM::callDB('Admin\\Languages\\Delete', $data)) {
         Cache::clear('languages');
         return true;
     }
     return false;
 }
Beispiel #13
0
 public static function execute($id)
 {
     $data = array('id' => $id);
     if (OSCOM::callDB('Admin\\Currencies\\Delete', $data)) {
         Cache::clear('currencies');
         return true;
     }
     return false;
 }
 public static function execute($group)
 {
     $data = array('group' => $group);
     if (OSCOM::callDB('Admin\\Languages\\DeleteGroup', $data)) {
         Cache::clear('languages');
         return true;
     }
     return false;
 }
 public static function execute($username, $key = null)
 {
     $data = array('username' => $username);
     $result = OSCOM::callDB('Admin\\Login\\GetAdmin', $data);
     if (isset($key)) {
         $result = $result[$key] ?: null;
     }
     return $result;
 }
Beispiel #16
0
 public static function execute($id, $key = null)
 {
     $data = array('id' => $id);
     $result = OSCOM::callDB('Admin\\Currencies\\Get', $data);
     if (!empty($key) && isset($result[$key])) {
         $result = $result[$key];
     }
     return $result;
 }
 public static function initialize()
 {
     Registry::set('MessageStack', new MessageStack());
     Registry::set('Cache', new Cache());
     Registry::set('PDO', PDO::initialize());
     foreach (OSCOM::callDB('Shop\\GetConfiguration', null, 'Site') as $param) {
         define($param['cfgKey'], $param['cfgValue']);
     }
     Registry::set('Session', Session::load('adminSid'));
     Registry::get('Session')->start();
     Registry::get('MessageStack')->loadFromSession();
     Registry::set('Language', new Language());
     if (!self::hasAccess(OSCOM::getSiteApplication())) {
         Registry::get('MessageStack')->add('header', 'No access.', 'error');
         OSCOM::redirect(OSCOM::getLink(null, OSCOM::getDefaultSiteApplication()));
     }
     $application = 'osCommerce\\OM\\Core\\Site\\Admin\\Application\\' . OSCOM::getSiteApplication() . '\\Controller';
     Registry::set('Application', new $application());
     Registry::set('Template', new Template());
     Registry::get('Template')->setApplication(Registry::get('Application'));
     // HPDL move following checks elsewhere
     // check if a default currency is set
     if (!defined('DEFAULT_CURRENCY')) {
         Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_error_no_default_currency'), 'error');
     }
     // check if a default language is set
     if (!defined('DEFAULT_LANGUAGE')) {
         Registry::get('MessageStack')->add('header', ERROR_NO_DEFAULT_LANGUAGE_DEFINED, 'error');
     }
     if (function_exists('ini_get') && (bool) ini_get('file_uploads') == false) {
         Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_warning_uploads_disabled'), 'warning');
     }
     // check if Work directories are writable
     $work_dirs = array();
     foreach (array('Cache', 'CoreUpdate', 'Database', 'Logs', 'Session', 'Temp') as $w) {
         if (!is_writable(OSCOM::BASE_DIRECTORY . 'Work/' . $w)) {
             $work_dirs[] = $w;
         }
     }
     if (!empty($work_dirs)) {
         Registry::get('MessageStack')->add('header', sprintf(OSCOM::getDef('ms_error_work_directories_not_writable'), OSCOM::BASE_DIRECTORY . 'Work/', implode(', ', $work_dirs)), 'error');
     }
     if (!OSCOM::configExists('time_zone', 'OSCOM')) {
         Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_warning_time_zone_not_defined'), 'warning');
     }
     if (!OSCOM::configExists('dir_fs_public', 'OSCOM') || !file_exists(OSCOM::getConfig('dir_fs_public', 'OSCOM'))) {
         Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_warning_dir_fs_public_not_defined'), 'warning');
     }
     // check if the upload directory exists
     if (is_dir(OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'upload')) {
         if (!is_writeable(OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'upload')) {
             Registry::get('MessageStack')->add('header', sprintf(OSCOM::getDef('ms_error_upload_directory_not_writable'), OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'upload'), 'error');
         }
     } else {
         Registry::get('MessageStack')->add('header', sprintf(OSCOM::getDef('ms_error_upload_directory_non_existant'), OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'upload'), 'error');
     }
 }
 public static function execute($id, $status)
 {
     $data = array('id' => $id, 'status' => $status);
     if (OSCOM::callDB('Admin\\CreditCards\\SetStatus', $data)) {
         Cache::clear('credit-cards');
         return true;
     }
     return false;
 }
Beispiel #19
0
 public static function execute($id, $key = null)
 {
     $data = array('id' => $id);
     $result = OSCOM::callDB('Admin\\TaxClasses\\Get', $data);
     if (isset($key)) {
         $result = $result[$key] ?: null;
     }
     return $result;
 }
Beispiel #20
0
 public static function execute($id)
 {
     $def = Languages::getDefinition($id);
     $data = array('id' => $id);
     if (OSCOM::callDB('Admin\\Languages\\DeleteDefinition', $data)) {
         Cache::clear('languages-' . Languages::get($def['languages_id'], 'code') . '-' . $def['content_group']);
         return true;
     }
     return false;
 }
 public static function execute($language_id, $group)
 {
     $result = OSCOM::callDB('Admin\\Languages\\GetGroup', array('group' => $group));
     foreach ($result['entries'] as $entry) {
         if ($entry['languages_id'] == $language_id) {
             return true;
         }
     }
     return false;
 }
 public static function execute($data)
 {
     if (OSCOM::callDB('Admin\\Categories\\SaveSortOrder', $data)) {
         Cache::clear('categories');
         Cache::clear('category_tree');
         Cache::clear('also_purchased');
         return true;
     }
     return false;
 }
 public static function execute($data)
 {
     Registry::set('PDO', PDO::initialize($data['server'], $data['username'], $data['password'], $data['database'], $data['port'], $data['class']));
     OSCOM::setConfig('db_table_prefix', $data['table_prefix'], 'Admin');
     OSCOM::setConfig('db_table_prefix', $data['table_prefix'], 'Shop');
     OSCOM::setConfig('db_table_prefix', $data['table_prefix'], 'Setup');
     $cfg_data = array(array('key' => 'STORE_NAME', 'value' => $data['shop_name']), array('key' => 'STORE_OWNER', 'value' => $data['shop_owner_name']), array('key' => 'STORE_OWNER_EMAIL_ADDRESS', 'value' => $data['shop_owner_email']), array('key' => 'EMAIL_FROM', 'value' => '"' . $data['shop_owner_name'] . '" <' . $data['shop_owner_email'] . '>'));
     OSCOM::callDB('Admin\\UpdateConfigurationParameters', $cfg_data, 'Site');
     $admin_data = array('username' => $data['admin_username'], 'password' => $data['admin_password'], 'modules' => array('0'));
     Administrators::save($admin_data);
 }
Beispiel #24
0
 public static function execute($id = null, $data)
 {
     if (is_numeric($id)) {
         $data['id'] = $id;
     }
     if (OSCOM::callDB('Admin\\CreditCards\\Save', $data)) {
         Cache::clear('credit-cards');
         return true;
     }
     return false;
 }
Beispiel #25
0
 public static function execute($data)
 {
     if (OSCOM::callDB('Admin\\Currencies\\Save', $data)) {
         Cache::clear('currencies');
         if ($data['set_default'] === true) {
             Cache::clear('configuration');
         }
         return true;
     }
     return false;
 }
Beispiel #26
0
 public static function execute($data)
 {
     if (OSCOM::callDB('Admin\\Languages\\Update', $data)) {
         Cache::clear('languages');
         if ($data['set_default'] === true) {
             Cache::clear('configuration');
         }
         return true;
     }
     return false;
 }
Beispiel #27
0
 public static function execute()
 {
     $result = array();
     $db_time = OSCOM::callDB('Admin\\ServerInfo\\GetTime');
     $db_uptime = OSCOM::callDB('Admin\\ServerInfo\\GetUptime');
     $db_version = OSCOM::callDB('Admin\\ServerInfo\\GetVersion');
     @(list($system, $host, $kernel) = preg_split('/[\\s,]+/', @exec('uname -a'), 5));
     $data = array(array('key' => 'date', 'title' => OSCOM::getDef('field_server_date'), 'value' => DateTime::getShort(null, true)), array('key' => 'system', 'title' => OSCOM::getDef('field_server_operating_system'), 'value' => $system . ' ' . $kernel), array('key' => 'host', 'title' => OSCOM::getDef('field_server_host'), 'value' => $host . ' (' . gethostbyname($host) . ')'), array('key' => 'uptime', 'title' => OSCOM::getDef('field_server_up_time'), 'value' => @exec('uptime')), array('key' => 'http_server', 'title' => OSCOM::getDef('field_http_server'), 'value' => $_SERVER['SERVER_SOFTWARE']), array('key' => 'php', 'title' => OSCOM::getDef('field_php_version'), 'value' => 'PHP v' . PHP_VERSION . ' / Zend v' . zend_version()), array('key' => 'db_server', 'title' => OSCOM::getDef('field_database_host'), 'value' => DB_SERVER . ' (' . gethostbyname(DB_SERVER) . ')'), array('key' => 'db_version', 'title' => OSCOM::getDef('field_database_version'), 'value' => $db_version), array('key' => 'db_date', 'title' => OSCOM::getDef('field_database_date'), 'value' => DateTime::getShort($db_time, true)), array('key' => 'db_uptime', 'title' => OSCOM::getDef('field_database_up_time'), 'value' => $db_uptime));
     $result['entries'] = $data;
     $result['total'] = count($data);
     return $result;
 }
 public static function execute($data)
 {
     $definitions = $data['definitions'];
     unset($data['definitions']);
     foreach ($definitions as $key => $value) {
         $data['key'] = $key;
         $data['value'] = $value;
         OSCOM::callDB('Admin\\Languages\\UpdateDefinition', $data);
         Cache::clear('languages-' . Languages::get($data['language_id'], 'code') . '-' . $data['group']);
     }
     return true;
 }
Beispiel #29
0
    public static function execute() {
      $result = OSCOM::callDB('Admin\ProductAttributes\GetAll');

      foreach ( $result['entries'] as &$module ) {
        $class = 'osCommerce\\OM\\Core\\Site\\Admin\\Module\\ProductAttribute\\' . $module['code'];

        $OSCOM_PA = new $class();

        $module['title'] = $OSCOM_PA->getTitle();
      }

      return $result;
    }
 public function load($key, $language_code = null)
 {
     if (!isset($language_code)) {
         $language_code = $this->_code;
     }
     if ($this->_languages[$language_code]['parent_id'] > 0) {
         $this->load($key, $this->getCodeFromID($this->_languages[$language_code]['parent_id']));
     }
     $def_data = array('language_id' => $this->getData('id', $language_code), 'group' => $key);
     foreach (OSCOM::callDB('GetLanguageDefinitions', $def_data, 'Core') as $def) {
         $this->_definitions[$def['definition_key']] = $def['definition_value'];
     }
 }