The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once



UserSpice
Maintenance mode - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Miscellaneous (https://userspice.com/forums/forumdisplay.php?fid=28)
+--- Forum: Modifications and Hackery (https://userspice.com/forums/forumdisplay.php?fid=29)
+--- Thread: Maintenance mode (/showthread.php?tid=443)



Maintenance mode - emanresu - 01-27-2017

I just set my website to "offline", in the admin panel. But I was missing a maintenance mode. So I did the following;

added this to header.php

<pre>
Code:
if ($user->data()->username == 'admin'){ $maintenance_text=' your website is in maintance mode! ';}

else{
if ($settings->site_offline==1){

        $urlasstring = $_SERVER['REQUEST_URI'];
        $findme   = 'login.php';
        $pos = strpos($urlasstring, $findme);
                //not login.php
        if ($pos === false) {
            Redirect::to($us_url_root.'users/login.php');
        }
        else {$maintenance_text = ' Website is not available due to maintenance. ';}
}}
</pre>


in the login.php

I added an echo for the $maintenance_text.

I guess you should remove
Code:
if ($settings->site_offline==1){die("The site is currently offline.");}?>

from line 10 in the user_settings.php or you won't be able to see this as "admin"

Now I can work on my site, without the user using the website Smile


Maintenance mode - mudmin - 02-03-2017

I love it! I need to do this!


Maintenance mode - firestorm - 05-03-2017

heres what I've done,

create a new file maintenance.php, add the usual require init.php, header.php & navigation.php. add your html as you please and don't forget to require your footers aswell. anything is possible here including the use of fancy coming soon pages with countdowns etc.

in header.php

i changed:

<pre>
Code:
//dealing with if the user is logged in
if($user->isLoggedIn()){
    if (($settings->site_offline==1) && (!in_array($user->data()->id, $master_account)) && ($currentPage != 'login.php')){
        die("The site is currently offline.");
    }
}

//deal with non logged in users
if(!$user->isLoggedIn()){
    if (($settings->site_offline==1) && ($currentPage != 'login.php')){
        die("The site is currently offline.");
    }
}
//notifiy master_account that the site is offline
if($user->isLoggedIn()){
    if (($settings->site_offline==1) && (in_array($user->data()->id, $master_account)) && ($currentPage != 'login.php')){
        err("<br>The site is currently offline.");
    }
}
</pre>


and replaced with:

`//dealing with if the user is logged in
if($user->isLoggedIn() && !checkMenu(2,$user->data()->id)){
if (($settings->site_offline==1) && (!in_array($user->data()->id, $master_account)) && ($currentPage != 'login.php') && ($currentPage != 'maintenance.php')){
Redirect::to($us_url_root.'users/maintenance.php');
}
}

//deal with non logged in users
if(!$user->isLoggedIn() && !checkMenu(2,$user->data()->id)){
if (($settings->site_offline==1) && ($currentPage != 'login.php') && ($currentPage != 'maintenance.php')){
Redirect::to($us_url_root.'users/maintenance.php');
}
}

//notifiy master_account that the site is offline
if($user->isLoggedIn()){
if (($settings->site_offline==1) && (in_array($user->data()->id, $master_account)) && ($currentPage != 'login.php') && ($currentPage != 'maintenance.php')){

err("<br>The site is currently offline.");
}
}
'

now users are redirected to the maintenance page, you can go one further and have a link available only to admins to login

hope thats some use



Maintenance mode - Brandin - 05-06-2017

This is similar to what I did, and it works quite well! It is much nicer to have a full page than it is to just die the page and say offline lol.

In addition, I also added a setting in the db called offlinemsg and modified my offline page to echo this. The admin_panels.php page has this added:

https://hastebin.com/owiciluhuj.php

https://hastebin.com/xutucowupu.xml

That way you can modify the offline message to whatever you want without manually coding everytime!


Maintenance mode - firestorm - 05-08-2017

over looked that lol ? perfect.


Maintenance mode - mudmin - 05-09-2017

Love this. I'm adding it to my list.