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 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 function connect()
 {
     $dsn = 'sqlsrv:Server=' . $this->_server;
     if (!empty($this->_port)) {
         $dsn .= ', ' . $this->_port;
     }
     $dsn .= '; Database=' . $this->_database;
     parent::__construct($dsn, $this->_username, $this->_password, $this->_driver_options);
     $this->_connected = true;
 }
Exemple #4
0
 public function query($statement)
 {
     $statement = $this->_autoPrefixTables($statement);
     $args = func_get_args();
     if (count($args) > 1) {
         return call_user_func_array(array($this, 'parent::query'), $args);
     } else {
         return parent::query($statement);
     }
 }
 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);
 }
 public static function connect()
 {
     $result = false;
     try {
         self::$_dbh = PDO::initialize(OSCOM::BASE_DIRECTORY . 'Work/Database/errors.sqlite3', null, null, null, null, 'SQLite3');
         self::$_dbh->exec('create table if not exists error_log ( timestamp int, message text );');
         $result = true;
     } catch (\Exception $e) {
         trigger_error($e->getMessage());
     }
     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('Service', new Service());
     Registry::get('Service')->start();
     Registry::set('Template', new Template());
     $application = 'osCommerce\\OM\\Core\\Site\\Shop\\Application\\' . OSCOM::getSiteApplication() . '\\Controller';
     Registry::set('Application', new $application());
     Registry::get('Template')->setApplication(Registry::get('Application'));
 }
Exemple #8
0
    public function connect() {
      $dsn_array = array();

      if ( empty($this->_database) ) {
        $this->_database = 'postgres';
      }

      $dsn_array[] = 'dbname=' . $this->_database;

      $dsn_array[] = 'host=' . $this->_server;

      if ( !empty($this->_port) ) {
        $dsn_array[] = 'port=' . $this->_port;
      }

      $dsn = 'pgsql:' . implode(';', $dsn_array);

      $this->_connected = true;

      return parent::__construct($dsn, $this->_username, $this->_password, $this->_driver_options);
    }
 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;
 }
<p><?php 
    echo nl2br(wordwrap(HTML::outputProtected($r['reviews_text']), 60, '&shy;'));
    ?>
</p>

<?php 
}
?>

<div class="listingPageLinks">
  <span style="float: right;"><?php 
echo PDO::getBatchPageLinks('page', $reviews_listing['total'], OSCOM::getAllGET('page'));
?>
</span>

  <?php 
echo PDO::getBatchTotalPages(OSCOM::getDef('result_set_number_of_reviews'), isset($_GET['page']) ? $_GET['page'] : 1, $reviews_listing['total']);
?>
</div>

<div class="submitFormButtons">
  <span style="float: right;"><?php 
echo HTML::button(array('href' => OSCOM::getLink(null, null, 'Reviews&Write&' . $OSCOM_Product->getKeyword()), 'icon' => 'pencil', 'title' => OSCOM::getDef('button_write_review')));
?>
</span>

  <?php 
echo HTML::button(array('href' => OSCOM::getLink(null, null, $OSCOM_Product->getKeyword()), 'icon' => 'triangle-1-w', 'title' => OSCOM::getDef('button_back')));
?>
</div>
<h1><?php 
echo $OSCOM_Template->getPageTitle();
?>
</h1>

<div style="overflow: auto;">

<?php 
foreach ($specials_listing['entries'] as $s) {
    echo '<span style="width: 33%; float: left; text-align: center;">';
    if (!empty($s['image'])) {
        echo HTML::link(OSCOM::getLink(null, null, $s['products_keyword']), $OSCOM_Image->show($s['image'], $s['products_name'])) . '<br />';
    }
    echo HTML::link(OSCOM::getLink(null, null, $s['products_keyword']), $s['products_name']) . '<br />' . '<s>' . $OSCOM_Currencies->displayPrice($s['products_price'], $s['products_tax_class_id']) . '</s> <span class="productSpecialPrice">' . $OSCOM_Currencies->displayPrice($s['specials_new_products_price'], $s['products_tax_class_id']) . '</span>' . '</span>' . "\n";
}
?>

</div>

<div class="listingPageLinks">
  <span style="float: right;"><?php 
echo PDO::getBatchPageLinks('page', $specials_listing['total'], OSCOM::getAllGET('page'));
?>
</span>

  <?php 
echo PDO::getBatchTotalPages(OSCOM::getDef('result_set_number_of_products'), isset($_GET['page']) ? $_GET['page'] : 1, $specials_listing['total']);
?>
</div>
 public static function execute($data)
 {
     Registry::set('PDO', PDO::initialize($data['server'], $data['username'], $data['password'], $data['database'], $data['port'], $data['class']));
     // Import SQL queries
     OSCOM::callDB('Setup\\Install\\ImportSQL', array('table_prefix' => $data['table_prefix']));
     // Import language definitions
     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');
     foreach (Language::extractDefinitions('en_US.xml') as $def) {
         $def['id'] = 1;
         OSCOM::callDB('Admin\\InsertLanguageDefinition', $def, 'Site');
     }
     $DL_lang = new DirectoryListing(OSCOM::BASE_DIRECTORY . 'Core/Site/Shop/Languages/en_US');
     $DL_lang->setRecursive(true);
     $DL_lang->setIncludeDirectories(false);
     $DL_lang->setAddDirectoryToFilename(true);
     $DL_lang->setCheckExtension('xml');
     foreach ($DL_lang->getFiles() as $files) {
         foreach (Language::extractDefinitions('en_US/' . $files['name']) as $def) {
             $def['id'] = 1;
             OSCOM::callDB('Admin\\InsertLanguageDefinition', $def, 'Site');
         }
     }
     // Import Service modules
     $services = array('OutputCompression', 'Session', 'Language', 'Debug', 'Currencies', 'Core', 'SimpleCounter', 'CategoryPath', 'Breadcrumb', 'WhosOnline', 'Specials', 'Reviews', 'RecentlyVisited');
     $installed = array();
     foreach ($services as $service) {
         $class = 'osCommerce\\OM\\Core\\Site\\Admin\\Module\\Service\\' . $service;
         $module = new $class();
         $module->install();
         if (isset($module->depends)) {
             if (is_string($module->depends) && ($key = array_search($module->depends, $installed)) !== false) {
                 if (isset($installed[$key + 1])) {
                     array_splice($installed, $key + 1, 0, $service);
                 } else {
                     $installed[] = $service;
                 }
             } elseif (is_array($module->depends)) {
                 foreach ($module->depends as $depends_module) {
                     if (($key = array_search($depends_module, $installed)) !== false) {
                         if (!isset($array_position) || $key > $array_position) {
                             $array_position = $key;
                         }
                     }
                 }
                 if (isset($array_position)) {
                     array_splice($installed, $array_position + 1, 0, $service);
                 } else {
                     $installed[] = $service;
                 }
             }
         } elseif (isset($module->precedes)) {
             if (is_string($module->precedes)) {
                 if (($key = array_search($module->precedes, $installed)) !== false) {
                     array_splice($installed, $key, 0, $service);
                 } else {
                     $installed[] = $service;
                 }
             } elseif (is_array($module->precedes)) {
                 foreach ($module->precedes as $precedes_module) {
                     if (($key = array_search($precedes_module, $installed)) !== false) {
                         if (!isset($array_position) || $key < $array_position) {
                             $array_position = $key;
                         }
                     }
                 }
                 if (isset($array_position)) {
                     array_splice($installed, $array_position, 0, $service);
                 } else {
                     $installed[] = $service;
                 }
             }
         } else {
             $installed[] = $service;
         }
         unset($array_position);
     }
     $cfg_data = array('title' => 'Service Modules', 'key' => 'MODULE_SERVICES_INSTALLED', 'value' => implode(';', $installed), 'description' => 'Installed services modules', 'group_id' => '6');
     OSCOM::callDB('Admin\\InsertConfigurationParameters', $cfg_data, 'Site');
     // Import Payment modules
     define('DEFAULT_ORDERS_STATUS_ID', 1);
     $module = new \osCommerce\OM\Core\Site\Admin\Module\Payment\COD();
     $module->install();
     $pm_data = array('key' => 'MODULE_PAYMENT_COD_STATUS', 'value' => '1');
     OSCOM::callDB('Admin\\UpdateConfigurationParameters', $pm_data, 'Site');
     // Import Shipping modules
     $module = new \osCommerce\OM\Core\Site\Admin\Module\Shipping\Flat();
     $module->install();
     // Import Order Total modules
     $module = new \osCommerce\OM\Core\Site\Admin\Module\OrderTotal\SubTotal();
     $module->install();
     $module = new \osCommerce\OM\Core\Site\Admin\Module\OrderTotal\Shipping();
     $module->install();
     $module = new \osCommerce\OM\Core\Site\Admin\Module\OrderTotal\Tax();
     $module->install();
     $module = new \osCommerce\OM\Core\Site\Admin\Module\OrderTotal\Total();
     $module->install();
     // Import Foreign Keys
     OSCOM::callDB('Setup\\Install\\ImportFK', array('table_prefix' => $data['table_prefix']));
 }
 public function connect()
 {
     $dsn = 'sqlite:' . $this->_server;
     $this->_connected = true;
     return parent::__construct($dsn, $this->_username, $this->_password, $this->_driver_options);
 }
 public static function execute($data)
 {
     Registry::set('PDO', PDO::initialize($data['server'], $data['username'], $data['password'], $data['database'], $data['port'], $data['class']));
     OSCOM::callDB('Setup\\Install\\ImportSampleSQL', array('table_prefix' => $data['table_prefix']));
 }