1
kakos
xoops preferences "site close" override
  • 2020/4/27 11:16

  • kakos

  • Friend of XOOPS

  • Posts: 79

  • Since: 2002/6/6 2


Hi from Greece, hope you are all well and healthy

I need to have 2 xoops installations in my server http://www.myserver.com/xoops1 and http://www.myserver.com/xoops2 with one common db for both but the 1st need to be open so users can see the public stuff and the 2nd need to be closed so users need first to login.

Is it possible to override "site close" from Preferences --> general option --> general settings in a way?
Due to the common database any change applies to both.

The 2 sites have exactly the same content, theme, users, groups etc.

2
Mamba
Re: xoops preferences "site close" override
  • 2020/4/27 20:16

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


Hmm, interesting question.

You probably would need to hack it, i.e. with each new XOOPS upgrade, you would have to do it again.

One way would be:

1) add to the Config table a new entry:
closesite2 with the value of 1

2) in your website2 change in the files that check for closesite:

if ($xoopsConfig['closesite'] == 1) {


to

if ($xoopsConfig['closesite2'] == 1) {


It seems that there are three files that do that:

login.php
include/checklogin.php
include/common.php

This is not tested, so I don't know if it will cause any other problems as side effects, therefore you can do it on your own risk.
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

3
kakos
Re: xoops preferences "site close" override
  • 2020/4/29 6:10

  • kakos

  • Friend of XOOPS

  • Posts: 79

  • Since: 2002/6/6 2


Thank you very much!!!

It seems to work perfectly...

The version that I applied the changes is 2.5.5, I'm stuck on it due to lack of some modules (Gijoe, formulize etc)

Perhaps a config file that override some of the system settings in future versions of xoops would help especially in multi-site cases.

4
liomj
Re: xoops preferences "site close" override
  • 2020/10/9 1:49

  • liomj

  • Just popping in

  • Posts: 94

  • Since: 2012/4/10


Hi

i made a proof of concept mobile page with login but when the site is close it is redirect to
xoopssite.com/index.php instead of xoopsite.com/mobileapp/index.php

how do i override when a xoops site is closed it will redirect to a custom login page and
not the default login in index.php ?

5
Mamba
Re: xoops preferences "site close" override
  • 2020/10/9 9:54

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


You will need to hack XOOPS, and every time you update XOOPS to a new version, you'll have to do it again.

In /include/checklogin.php in line 55-57 you have:

if (!$allowed) {
            
redirect_header(XOOPS_URL '/index.php'1_NOPERM);
        }


You probably would need to change the redirect there to:

redirect_header(XOOPS_URL '/mobileapp/index.php'1_NOPERM);

This is not tested, so test it and use it at your own risk.
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

6
liomj
Re: xoops preferences "site close" override
  • 2020/10/9 12:10

  • liomj

  • Just popping in

  • Posts: 94

  • Since: 2012/4/10


Thank you Mamba, its not working, ill try and look again

i uploaded it here on what im trying to do..so far what i did
https://github.com/liomj/mobile/

it is working fine if the site is opened but not if it is close

7
Mamba
Re: xoops preferences "site close" override
  • 2020/10/12 3:43

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


So I looked into it, and the issue is that when the Website is closed, XOOPS goes to
/site_closed.php

and from there it calls the
system_siteclosed.tpl

that is located in the current theme, e.g.:
/themes/xswatch/modules/system/

So there would be a lot of hacking involved, starting in
/include/common.php

in line 325:
if ($xoopsConfig['closesite'] == 1) {
    include_once 
$xoops->path('include/site-closed.php');
}


to redirect to your "site_closed.php", or you can changed the "site_closed.php" file itself.

Because of the constant hacking that you would have to do for each new version of XOOPS, it might be easier to simply create a new "mobile" theme, and use that?
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

8
liomj
Re: xoops preferences "site close" override
  • 2020/10/12 21:37

  • liomj

  • Just popping in

  • Posts: 94

  • Since: 2012/4/10


Thank you Mamba

Login

Who's Online

389 user(s) are online (332 user(s) are browsing Support Forums)


Members: 0


Guests: 389


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits