I really love that we have a site turn off feature in 1.3.5 so I wanted to add to it, because as of right now, it only allows you to shut the site off. You can't edit things and see what you're working on onsite during the site being off. So I made a mod that allows admins and mod groups access to the site still but everyone else has no access. I wanted it as a weekly maintenance feature. There probably is a better way to do this I'm sure, but I only know basic HTML, CSS, and a bit of PHP. So this was the best I could come up with lol. This will work for 1.3.4 if the turn site off feature is added before this mod. If I figure that out I'll add a post to this thread with how to install that feature to 1.3.4. The same goes for 1.3.6 I'll try to add that in later if I find out how to add it to that one as well.
Anyway, this mod edit is all within the index.php file and you'll be working in the public function handleRequest(){ area around 15.
You want to find this section here:
and replace it with this:
So essentially, this makes it where if a user is usergroup 1 or 2 (admin = 1 | mod = 2) then it will allow you access still to the site if the turn off site is enabled.
If the user is anything other than usergroup 1 or 2 then it switches the site to display the:
Again, this is for 1.3.5 mod only, because I haven't tested anything yet with 1.3.6 and 1.3.4 needs to have the site turn off feature added before this will work and you may need to make edits, I forgot if usergroup 1 and 2 is mod groups already.
Anyway, this mod edit is all within the index.php file and you'll be working in the public function handleRequest(){ area around 15.
You want to find this section here:
public function handleRequest(){
$mysidia = Registry::get("mysidia");
$class = $mysidia->input->get("appcontroller")->capitalize();
$controller = "{$class}Controller";
$action = $mysidia->input->action();
try{
if($mysidia->systems->site != "enabled") throw new NoPermissionException("The admin has turned off the site for maintenance, please come back and visit later.");
$this->appController = new $controller;
$this->appController->setFrontController($this);
$this->appController->$action();
$this->action = $action;
return TRUE;
}
catch(GuestNoaccessException $gne){
$this->setFlags("global_guest_title", $gne->getmessage());
return FALSE;
}
catch(InvalidActionException $iae){
$this->setFlags("global_action_title", $iae->getmessage());
return FALSE;
}
catch(NoPermissionException $npe){
$this->setFlags("global_error", $npe->getmessage());
return FALSE;
}
catch(InvalidIDException $iie){
$this->setFlags("global_id_title", $iie->getmessage());
return FALSE;
}
catch(DuplicateIDException $die){
$this->setFlags("global_id_title", $die->getmessage());
return FALSE;
}
catch(AlreadyLoggedinException $ale){
$this->setFlags("global_login_title", $ale->getmessage());
return FALSE;
}
catch(MemberNotfoundException $mne){
$this->setFlags("global_id_title", $mne->getmessage());
return FALSE;
}
catch(Exception $e){
$error = strtolower(str_replace("Exception", "_error", get_class($e)));
$this->setFlags($error, $e->getmessage());
return FALSE;
}
}
and replace it with this:
Essentially, that first bit of code I said to find is a try and catch statement thing I had to find a way to put it all in an if and else statement. It took me 4 hours to figure out how to get stuff to function without breaking haha. I tested this as different usergroups, and while site was disabled and enabled I got no more errors and things work correctly. Hope I didn't miss anything.public function handleRequest(){
$mysidia = Registry::get("mysidia");
$class = $mysidia->input->get("appcontroller")->capitalize();
$controller = "{$class}Controller";
$action = $mysidia->input->action();
$group = $mysidia->db->select("users", array("usergroup"), "username ='{$mysidia->user->username}'")->fetchColumn();
if($mysidia->systems->site != "disabled"){
try{
$this->appController = new $controller;
$this->appController->setFrontController($this);
$this->appController->$action();
$this->action = $action;
return TRUE;
}
catch(GuestNoaccessException $gne){
$this->setFlags("global_guest_title", $gne->getmessage());
return FALSE;
}
catch(InvalidActionException $iae){
$this->setFlags("global_action_title", $iae->getmessage());
return FALSE;
}
catch(NoPermissionException $npe){
$this->setFlags("global_error", $npe->getmessage());
return FALSE;
}
catch(InvalidIDException $iie){
$this->setFlags("global_id_title", $iie->getmessage());
return FALSE;
}
catch(DuplicateIDException $die){
$this->setFlags("global_id_title", $die->getmessage());
return FALSE;
}
catch(AlreadyLoggedinException $ale){
$this->setFlags("global_login_title", $ale->getmessage());
return FALSE;
}
catch(MemberNotfoundException $mne){
$this->setFlags("global_id_title", $mne->getmessage());
return FALSE;
}
catch(Exception $e){
$error = strtolower(str_replace("Exception", "_error", get_class($e)));
$this->setFlags($error, $e->getmessage());
return FALSE;
}}
if($group <= 2){
try {
if($mysidia->systems->site != "enabled" && ($group <= 2))
$this->appController = new $controller;
$this->appController->setFrontController($this);
$this->appController->$action();
$this->action = $action;
return FALSE;
}
catch(GuestNoaccessException $gne){
$this->setFlags("global_guest_title", $gne->getmessage());
return FALSE;
}
catch(InvalidActionException $iae){
$this->setFlags("global_action_title", $iae->getmessage());
return FALSE;
}
catch(NoPermissionException $npe){
$this->setFlags("global_error", $npe->getmessage());
return FALSE;
}
catch(InvalidIDException $iie){
$this->setFlags("global_id_title", $iie->getmessage());
return FALSE;
}
catch(DuplicateIDException $die){
$this->setFlags("global_id_title", $die->getmessage());
return FALSE;
}
catch(AlreadyLoggedinException $ale){
$this->setFlags("global_login_title", $ale->getmessage());
return FALSE;
}
catch(MemberNotfoundException $mne){
$this->setFlags("global_id_title", $mne->getmessage());
return FALSE;
}
catch(Exception $e){
$error = strtolower(str_replace("Exception", "_error", get_class($e)));
$this->setFlags($error, $e->getmessage());
return FALSE;
}}
else{
try{
if($mysidia->systems->site != "enabled") throw new NoPermissionException("<br><b>The site has been temporarily shut down for routine maintenance.</b>");
$this->appController = new $controller;
$this->appController->setFrontController($this);
$this->appController->$action();
$this->action = $action;
return TRUE;
}
catch(GuestNoaccessException $gne){
$this->setFlags("global_guest_title", $gne->getmessage());
return FALSE;
}
catch(InvalidActionException $iae){
$this->setFlags("global_action_title", $iae->getmessage());
return FALSE;
}
catch(NoPermissionException $npe){
$this->setFlags("global_error", $npe->getmessage());
return FALSE;
}
catch(InvalidIDException $iie){
$this->setFlags("global_id_title", $iie->getmessage());
return FALSE;
}
catch(DuplicateIDException $die){
$this->setFlags("global_id_title", $die->getmessage());
return FALSE;
}
catch(AlreadyLoggedinException $ale){
$this->setFlags("global_login_title", $ale->getmessage());
return FALSE;
}
catch(MemberNotfoundException $mne){
$this->setFlags("global_id_title", $mne->getmessage());
return FALSE;
}
catch(Exception $e){
$error = strtolower(str_replace("Exception", "_error", get_class($e)));
$this->setFlags($error, $e->getmessage());
return FALSE;
}
}
}
So essentially, this makes it where if a user is usergroup 1 or 2 (admin = 1 | mod = 2) then it will allow you access still to the site if the turn off site is enabled.
If the user is anything other than usergroup 1 or 2 then it switches the site to display the:
Then else if the site turn off is disabled, then nothing happens."The site has been temporarily shut down for routine maintenance."
Again, this is for 1.3.5 mod only, because I haven't tested anything yet with 1.3.6 and 1.3.4 needs to have the site turn off feature added before this will work and you may need to make edits, I forgot if usergroup 1 and 2 is mod groups already.