Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Lock the Setup Site after new installations are performed. Setup can …

…be unlocked by removing the new "offline" parameter in the settings file.
  • Loading branch information...
commit 8c2f089b78e11e0da1e10252fb01652459f1b3a6 1 parent 257497a
Harald Ponce de Leon haraldpdl authored
2  osCommerce/OM/Core/Site/Setup/Application/Index/Controller.php
View
@@ -12,7 +12,7 @@
class Controller extends \osCommerce\OM\Core\Site\Setup\ApplicationAbstract {
protected function initialize() {
- $this->_page_title = OSCOM::getDef('heading_title');
+ $this->_page_title = OSCOM::getDef('page_title_welcome');
}
}
?>
2  osCommerce/OM/Core/Site/Setup/Application/Install/Controller.php
View
@@ -13,7 +13,7 @@
class Controller extends \osCommerce\OM\Core\Site\Setup\ApplicationAbstract {
protected function initialize() {
$this->_page_contents = 'step_1.php';
- $this->_page_title = OSCOM::getDef('heading_title');
+ $this->_page_title = OSCOM::getDef('page_title_installation');
if ( isset($_GET['step']) && is_numeric($_GET['step']) ) {
switch ( $_GET['step'] ) {
3  osCommerce/OM/Core/Site/Setup/Application/Install/pages/step_3.php
View
@@ -118,6 +118,9 @@
db_table_prefix = "{$_POST['DB_TABLE_PREFIX']}"
db_server_persistent_connections = "false"
store_sessions = "Database"
+
+[Setup]
+offline = "true"
EOT;
if ( is_writable(OSCOM::BASE_DIRECTORY . 'Config/settings.ini') ) {
18 osCommerce/OM/Core/Site/Setup/Application/Offline/Controller.php
View
@@ -0,0 +1,18 @@
+<?php
+/**
+ * osCommerce Online Merchant
+ *
+ * @copyright Copyright (c) 2011 osCommerce; http://www.oscommerce.com
+ * @license BSD License; http://www.oscommerce.com/bsdlicense.txt
+ */
+
+ namespace osCommerce\OM\Core\Site\Setup\Application\Offline;
+
+ use osCommerce\OM\Core\OSCOM;
+
+ class Controller extends \osCommerce\OM\Core\Site\Setup\ApplicationAbstract {
+ protected function initialize() {
+ $this->_page_title = OSCOM::getDef('page_title_authorization_required');
+ }
+ }
+?>
40 osCommerce/OM/Core/Site/Setup/Application/Offline/pages/main.php
View
@@ -0,0 +1,40 @@
+<?php
+/**
+ * osCommerce Online Merchant
+ *
+ * @copyright Copyright (c) 2011 osCommerce; http://www.oscommerce.com
+ * @license BSD License; http://www.oscommerce.com/bsdlicense.txt
+ */
+
+ use osCommerce\OM\Core\HTML;
+ use osCommerce\OM\Core\OSCOM;
+?>
+
+<div class="mainBlock">
+ <ul style="list-style-type: none; padding: 5px; margin: 0px; display: inline; float: right;">
+ <li style="font-weight: bold; display: inline;"><?php echo OSCOM::getDef('title_language'); ?></li>
+
+<?php
+ foreach ( $OSCOM_Language->getAll() as $available_language ) {
+?>
+
+ <li style="display: inline;"><?php echo '<a href="' . OSCOM::getLink(null, null, 'language=' . $available_language['code']) . '">' . $OSCOM_Language->showImage($available_language['code']) . '</a>'; ?></li>
+
+<?php
+ }
+?>
+
+ </ul>
+
+ <h1><?php echo OSCOM::getDef('page_title_authorization_required'); ?></h1>
+</div>
+
+<div class="contentBlock">
+ <div class="contentPane" style="margin-left: 0;">
+ <h2><?php echo OSCOM::getDef('page_heading_access_disabled'); ?></h2>
+
+ <p><?php echo OSCOM::getDef('text_access_disabled'); ?></p>
+
+ <p align="center"><?php echo HTML::button(array('href' => OSCOM::getLink(null, OSCOM::getDefaultSiteApplication()), 'priority' => 'primary', 'icon' => 'triangle-1-e', 'title' => OSCOM::getDef('button_continue'))); ?></p>
+ </div>
+</div>
8 osCommerce/OM/Core/Site/Setup/Controller.php
View
@@ -18,6 +18,10 @@ public static function initialize() {
Registry::set('Language', new Language());
Registry::set('osC_Language', Registry::get('Language')); // HPDL to remove
+ if ( !self::hasAccess(OSCOM::getSiteApplication()) ) {
+ OSCOM::redirect(OSCOM::getLink(null, 'Offline'));
+ }
+
$application = 'osCommerce\\OM\\Core\\Site\\Setup\\Application\\' . OSCOM::getSiteApplication() . '\\Controller';
Registry::set('Application', new $application());
@@ -30,6 +34,10 @@ public static function getDefaultApplication() {
}
public static function hasAccess($application) {
+ if ( OSCOM::configExists('offline') && (OSCOM::getConfig('offline') == 'true') && ($application != 'Offline') ) {
+ return false;
+ }
+
return true;
}
}
14 osCommerce/OM/Core/Site/Setup/Languages/en_US/Offline.php
View
@@ -0,0 +1,14 @@
+# osCommerce Online Merchant
+#
+# @copyright Copyright (c) 2011 osCommerce; http://www.oscommerce.com
+# @license BSD License; http://www.oscommerce.com/bsdlicense.txt
+
+page_title_authorization_required = Authorization Required
+
+page_heading_access_disabled = Administration Access Disabled
+
+title_language = Language:
+
+text_access_disabled = The Setup site is currently locked. If you're an authorized administrator please remove the "offline" parameter in your settings file before continuing.
+
+button_continue = Continue
Please sign in to comment.
Something went wrong with that request. Please try again.