public function body()
 {
     $t = $this->pack_module('Base/Theme');
     //caption
     $box_module = ModuleManager::get_instance('/Base_Box|0');
     if ($box_module) {
         $active_module = $box_module->get_main_module();
     }
     if ($active_module && is_callable(array($active_module, 'caption'))) {
         $caption = $active_module->caption();
         if (Variable::get('show_module_indicator')) {
             $t->assign('text', $caption);
         } else {
             $t->assign('text', '');
         }
         $show_caption = Variable::get('show_caption_in_title');
         $maintenance_mode = MaintenanceMode::is_on() ? ' (Maintenance mode)' : '';
         $base_title = Variable::get('base_page_title') . $maintenance_mode;
         if ($show_caption || strlen($base_title) > 0) {
             if ($show_caption && strlen($base_title) > 0) {
                 $caption = $base_title . ' - ' . $caption;
             } elseif (strlen($base_title) > 0) {
                 $caption = $base_title;
             }
             eval_js('document.title=\'' . addslashes($caption) . '\'');
         }
     } else {
         $t->assign('text', '');
         eval_js('document.title=\'' . addslashes(Variable::get('base_page_title')) . '\'');
     }
     $t->display();
 }
 public function testFlow()
 {
     $this->assertFalse($this->maintenanceMode->isOn());
     /** Successfully set maintenance mode */
     $this->maintenanceMode->set(true);
     $this->assertTrue($this->maintenanceMode->isOn());
     /** Successfully disable maintenance mode */
     $this->maintenanceMode->set(false);
     $this->assertFalse($this->maintenanceMode->isOn());
     /** Test case when maintenance mode cannot be disabled from the updater application */
     $this->maintenanceMode->set(true);
     file_put_contents($this->ipFile, '');
     $this->maintenanceMode->set(false);
     $this->assertTrue($this->maintenanceMode->isOn());
 }
Beispiel #3
0
 public function testOffSetMultipleAddresses()
 {
     $mapisExist = [[MaintenanceMode::FLAG_FILENAME, false], [MaintenanceMode::IP_FILENAME, true]];
     $this->flagDir->expects($this->any())->method('isExist')->will($this->returnValueMap($mapisExist));
     $this->flagDir->expects($this->any())->method('delete')->will($this->returnValueMap($mapisExist));
     $this->flagDir->expects($this->any())->method('readFile')->with(MaintenanceMode::IP_FILENAME)->will($this->returnValue('address1,10.50.60.123'));
     $expectedArray = ['address1', '10.50.60.123'];
     $this->model->setAddresses('address1,10.50.60.123');
     $this->assertEquals($expectedArray, $this->model->getAddressInfo());
     $this->assertFalse($this->model->isOn('address1'));
     $this->assertFalse($this->model->isOn('address3'));
 }
 public function success_text()
 {
     $txt = MaintenanceMode::is_on() ? 'on' : 'off';
     return "<center>Maintenance mode is now <strong>{$txt}</strong></center>";
 }
Beispiel #5
0
            if ($status == 'noaccesstobackend') {
                $returnval .= __('(Access to administration denied by administrator)', $this->g_info['ShortName']);
            } else {
                $returnval .= '<a rel="nofollow" href="' . $adminurl . '">' . __('Administration', $this->g_info['ShortName']) . '</a>';
            }
            $returnval .= ' | <a rel="nofollow" href="' . $logouturl . '">' . __('Log Out', $this->g_info['ShortName']) . '</a>';
        } else {
            $returnval .= '<a rel="nofollow" href="' . $loginurl . '">' . __('Log In', $this->g_info['ShortName']) . '</a>';
        }
        return $returnval;
    }
}
// class
if (!isset($myMaMo)) {
    // Create a new instance of your plugin that utilizes the WordpressPluginFramework and initialize the instance.
    $myMaMo = new MaintenanceMode();
    $myMaMo->Initialize(array('Name' => 'Modo Mantenimiento', 'Author' => 'acidc00l & Michael W&ouml;hrer', 'AuthorURI' => 'http://www.acidc00l.com/', 'PluginURI' => 'http://www.acidc00l.com/', 'SupportURI' => 'http://www.acidc00l.com/contacto/', 'OptionName' => 'plugin_maintenance-mode', 'DeleteOldOpt' => array('plugin_maintenancemode', 'plugin_maintenancemode2', 'plugin_maintenance-mode_5'), 'Version' => '8.0', 'UseOldOpt' => '1.0', 'CopyrightYear' => '2011', 'MinWP' => '3.1', 'PluginFile' => __FILE__, 'ShortName' => 'modo-mantenimiento'), array('mamo_activate' => 'off', 'mamo_excludedpaths' => '', 'mamo_include_feeds' => '', 'mamo_include_trackbacks' => '', 'mamo_include_xmlrpc' => '', 'mamo_backtime_days' => '0', 'mamo_backtime_hours' => '1', 'mamo_backtime_mins' => '0', 'mamo_pagetitle' => 'Modo Mantenimiento', 'mamo_pagemsg' => '<h1>Modo Mantenimiento: </h1>' . "\n\n" . '<p><a title="[blogtitle]" href="[blogurl]">[blogtitle]</a> se encuentra actualmente en mantenimiento programado.<br />' . "\n<br />\n" . 'Por favor, inténtelo de nuevo en [until].</p>' . "\n\n" . '<p>Disculpa las molestias.</p>', 'mamo_placeholder_until' => 'Vuelve <strong>en [days] días, [hours] horas, y [minutes] minutos</strong><br />(en [date] a las [time])', 'mamo_placeholder_until_exc' => 'de nuevo pronto', 'mamo_503_splashpage' => '', 'mamo_theme' => 'WP', 'mamo_role_frontend' => 'manage_options', 'mamo_role_backend' => 'read'));
    add_action('plugins_loaded', array($myMaMo, 'ApplyMaintenanceMode'));
    ############################################################################
    # Template Tags for using in themes
    ############################################################################
    /**
     * You can display a warning message in the front-end if you are logged in and the Maintenance Mode is activated
     * to remember you to deactivate the Maintenance Mode.
     */
    function is_maintenance()
    {
        global $myMaMo;
        if (substr($myMaMo->g_opt['mamo_activate'], 0, 2) == 'on') {
            return true;
        } else {
Beispiel #6
0
    protected function perform_update_end()
    {
        $this->turn_on_maintenance_mode();

        Base_ThemeCommon::themeup();
        Base_LangCommon::update_translations();
        ModuleManager::create_load_priority_array();

        Variable::set('version', EPESI_VERSION);
        MaintenanceMode::turn_off();
    }
Beispiel #7
0
    {
        if (self::is_on()) {
            unlink(self::get_file());
        }
    }
    public static function generate_file($key, $message = null)
    {
        $user = Base_UserCommon::get_my_user_login();
        $date = date('Y-m-d H:i:s');
        $str = "<?php\n";
        $str .= "// by {$user} on {$date}\n";
        $str .= '$maintenance_mode_key = ' . var_export($key, true);
        $str .= ";\n";
        $str .= '$maintenance_mode_message = ' . var_export($message, true);
        $str .= ";\n";
        file_put_contents(self::get_file(), $str);
    }
}
if (!MaintenanceMode::can_access()) {
    if (defined('JS_OUTPUT') && JS_OUTPUT) {
        header("Content-type: text/javascript");
        header("Cache-Control: no-cache, must-revalidate");
        header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
        // date in the past
        die('window.location = "index.php";');
    } else {
        global $maintenance_mode_message;
        $msg = isset($maintenance_mode_message) ? $maintenance_mode_message : "System is in the maintenance mode. Please wait until your system administrator will turn it off.";
        die($msg);
    }
}
            if ($status == 'noaccesstobackend') {
                $returnval .= __('(Access to administration denied by administrator)', $this->g_info['ShortName']);
            } else {
                $returnval .= '<a rel="nofollow" href="' . $adminurl . '">' . __('Administration', $this->g_info['ShortName']) . '</a>';
            }
            $returnval .= ' | <a rel="nofollow" href="' . $logouturl . '">' . __('Log Out', $this->g_info['ShortName']) . '</a>';
        } else {
            $returnval .= '<a rel="nofollow" href="' . $loginurl . '">' . __('Log In', $this->g_info['ShortName']) . '</a>';
        }
        return $returnval;
    }
}
// class
if (!isset($myMaMo)) {
    // Create a new instance of your plugin that utilizes the WordpressPluginFramework and initialize the instance.
    $myMaMo = new MaintenanceMode();
    $myMaMo->Initialize(array('Name' => 'Maintenance Mode', 'Author' => 'Michael W&ouml;hrer', 'AuthorURI' => 'http://sw-guide.de/', 'PluginURI' => 'http://sw-guide.de/wordpress/plugins/maintenance-mode/', 'SupportURI' => 'http://wordpress.org/tags/maintenance-mode', 'OptionName' => 'plugin_maintenance-mode', 'DeleteOldOpt' => array('plugin_maintenancemode', 'plugin_maintenancemode2', 'plugin_maintenance-mode_5'), 'Version' => '5.4', 'UseOldOpt' => '5.0', 'CopyrightYear' => '2006-2010', 'MinWP' => '2.7', 'PluginFile' => __FILE__, 'ShortName' => 'maintenance-mode'), array('mamo_activate' => 'off', 'mamo_excludedpaths' => '', 'mamo_include_feeds' => '', 'mamo_include_trackbacks' => '', 'mamo_include_xmlrpc' => '', 'mamo_backtime_days' => '0', 'mamo_backtime_hours' => '1', 'mamo_backtime_mins' => '0', 'mamo_pagetitle' => 'Maintenance Mode', 'mamo_pagemsg' => '<h1>Maintenance Mode</h1>' . "\n\n" . '<p><a title="[blogtitle]" href="[blogurl]">[blogtitle]</a> is currently undergoing scheduled maintenance.<br />' . "\n<br />\n" . 'Please try back [until].</p>' . "\n\n" . '<p>Sorry for the inconvenience.</p>', 'mamo_placeholder_until' => '<strong>in [days] days, [hours] hours, and [minutes] minutes</strong><br />(on [date] at [time])', 'mamo_placeholder_until_exc' => 'again soon', 'mamo_503_splashpage' => '', 'mamo_theme' => 'default', 'mamo_role_frontend' => 'manage_options', 'mamo_role_backend' => 'read'));
    #	$myMaMo->ApplyMaintenanceMode();	// commented out and added the line below since plugin version 5.3 -- http://radiok.info/blog/the-case-of-maintenance-mode/
    add_action('plugins_loaded', array($myMaMo, 'ApplyMaintenanceMode'));
    ############################################################################
    # Template Tags for using in themes
    ############################################################################
    /**
     * You can display a warning message in the front-end if you are logged in and the Maintenance Mode is activated
     * to remember you to deactivate the Maintenance Mode.
     */
    function is_maintenance()
    {
        global $myMaMo;
        if (substr($myMaMo->g_opt['mamo_activate'], 0, 2) == 'on') {
            return true;