meeting-room-booking-system / mrbs-code

MRBS application code
Other
117 stars 58 forks source link

Moving MRBS 1.7.1 from Joomla to Word Press #3365

Open jberanek opened 1 year ago

jberanek commented 1 year ago

Hello Team . We are running MRBS for about 10 years now in a Joomla installation. We wnt (need) to get our website refreshed and considering WP as new alternativ as base webside. How can we most easily get our MBRS incluse date to the new installation? Is there a way to copy and change the folders, but leave the MRBS Data in the Mysql 5.7 database? (the WP runs in MariaDB 10.5 database) Best regrds Horst Becker

Reported by: *anonymous

Original Ticket: mrbs/support-requests/2682

jberanek commented 1 year ago

All you need to do is change your MRBS configuration file so that $auth['type'] and $auth['session'] are set to wordpress instead of joomla and then change the settings for wordpress so that they point to your WP folder and set the admin settings. All this assumes that your WordPress site will run on the same server as your Joomla site.

Original comment by: campbell-m

jberanek commented 1 year ago

Thank you for the fast reply. Will try this. Best regards Horst Becker

Original comment by: *anonymous

jberanek commented 1 year ago

Hi Campbell. I think I am getting stucked here:

What is meant by this or where is the file I have to change that - can you help again?

...... then change the settings for wordpress so that they point to your WP folder and set the admin settings.....*

Is this something in MRBS Folder or on the Server software side? Thanks in advance.

Original comment by: *anonymous

jberanek commented 1 year ago

I mean these settings in your MRBS config file:

// 'auth_wordpress' configuration settings
$auth['wordpress']['rel_path'] = '..';   // Path to the WordPress installation relative to MRBS.
// List of WordPress roles that have MRBS Admin capabilities.  The default is 'administrator'.
// Note that these role names are the keys used to store the name, which are typically in lower case
// English, eg 'administrator', and not the values which are displayed on the dashboard form, which will
// generally start with a capital and be translated, eg 'Administrator' or 'Administrateur' (French),
// depending on the site language you have chosen for WordPress.
// You can define more than one WordPress role that maps to the MRBS Admin role by using
// an array.   The comment below assumes that you have created a new WordPress role (probably by using
// a WordPress plugin) called "MRBS Admin", which will typically (depending on the plugin) have a key of
// 'mrbs_admin', and that you assigned that role to those users that you want to be MRBS admins.
$auth['wordpress']['admin_roles'] = 'administrator';  // can also be an array, eg = array('administrator', 'mrbs_admin');
// List of WordPress roles that have MRBS User capabilities.  This allows you to have some WordPress users
// who are authorised to use MRBS and some who are not.
$auth['wordpress']['user_roles'] = array('subscriber', 'contributor', 'author', 'editor', 'administrator');
// List of WordPress roles that are blacklisted.  In other words if a user has a blacklisted role then they
// will be assigned MRBS access level 0, even if they also have a user or admin role.   This feature can be
// useful for disabling MRBS access for certain users by assigning them a WordPress role.
$auth['wordpress']['blacklisted_roles'] = array();

I assume you previously had the Joomla equivalents set.

Original comment by: campbell-m

jberanek commented 1 year ago

Thanks Campbell.
My imoression is that I get an error already when mrbs is called even before the admin and user roles are needed. I am in a "system-domain" where i am in process to build up the webpages before they get switched over to the final domain name. I think I do not get the MRBS called from the place I call it from. However I can call mrbs from wordpress when I use the link to the adress where it is in joomla.

Does this description make sense? The error is :

Fatal error: Uncaught Error: Call to undefined function MRBS\get_magic_quotes_runtime() in /xxxxxxxxx/mrbs/internalconfig.inc.php:502 Stack trace: #0 /xxxxxxxxx/mrbs/defaultincludes.inc(24): require_once() #1 /xxxxxxxxxx/mrbs/index.php(9): require('/xxxxxxx..') #2 {main} thrown in /xxxxxxxxx/mrbs/internalconfig.inc.php on line 502

This is the content I put in "config.inc.php" // 'auth_wordpress' configuration settings $auth['wordpress']['rel_path'] = '..';
//$auth['wordpress']['admin_access_levels'] = array(8); //$auth['wordpress']['user_access_levels'] = array(11); $auth['wordpress']['admin_roles'] = array('administrator', 'mrbs_admin'); $auth['wordpress']['user_roles'] = array('subscriber', 'contributor', 'author', 'editor', 'administrator');

Original comment by: *anonymous

jberanek commented 1 year ago

Are your Joomla and WordPress sites on different servers? It sounds like they may be and that the PHP version on your WordPress site is higher than that on your Joomla site, which would explain the get_magic_quotes_runtime() error: this function was removed from PHP in PHP 8.

And if they are on different servers then none of my advice above applies and a different solution will be needed.

Original comment by: campbell-m

jberanek commented 1 year ago

Thanks for the fast reply - I am not totally sure about the servers - however, when I use filezilla to show my joomla installation folders, than I can also see the new wordpress folders. They are in different folders but under the same root. (" Server: /" is shown). They are certainly running on different PHP Versions - my joomla is on 7.4 (not working on 8.xx), the wp is on 8.2.

Original comment by: *anonymous

jberanek commented 1 year ago

I tried to change the Joomla side to 8.2 (i know it is not working with it ) to make the PHP Versions the same = same error. second trial was to change both to 7.4. I do get access to MRBS then but I have very much extended Header line( where the calendars are) and an error in the same aerea :

E_DEPRECATED in /xxxxxxxx/mrbs/functions.inc at line 1790 Function get_magic_quotes_gpc() is deprecated MRBS GET: Array ( [year] => 2023 [month] => 01 [day] => 22 [area] => 2 [room] => 1 ) MRBS POST: Array ( ) MRBS SESSION: Array ( )

Original comment by: *anonymous

jberanek commented 1 year ago

You should upgrade to the latest version of MRBS.

Also, once you have finished testing don't forget to set $debug = false; in your MRBS config file.

Original comment by: campbell-m

jberanek commented 1 year ago

Hello Campbell, I have upgraded mrbs now to 1.11.0. still based in the current Joomla environment - Joomla 3.10.x - PHP 7.4. The issue I now have is that my access to the Booking system is gone. I tried with joomla login but that does not work, than I changed in config.inc.php to $auth["type"] = "config";
and specified user here like described in auth_config.inc $auth["user"]["username"] = "userpassword";

I can see the table, but i cannot do anything. Can you help? Rgrds

Original comment by: *anonymous

jberanek commented 1 year ago

What happens (or doesn't happen) when you have

$auth["type"] = "joomla";
$auth["session"] = "joomla";

Original comment by: campbell-m

jberanek commented 1 year ago

Initially the system has this in the config.inc.php /* Joomla authorization / $auth['type'] = 'joomla'; $auth['session'] = 'joomla';

// 'auth_joomla' configuration settings

$auth['joomla']['rel_path'] = '..';
$auth['joomla']['admin_access_levels'] = array(8); $auth['joomla']['user_access_levels'] = array(11);

What it does is that it still shows the login fileds, when using them to login nothing happens except the user is logged into the user side.

Original comment by: *anonymous

jberanek commented 1 year ago

Are you getting any error messages in your PHP error log?

Original comment by: campbell-m

jberanek commented 1 year ago

There is no error log at all.

Original comment by: *anonymous

jberanek commented 1 year ago

I am searching the folder for everything with "error" in the filename - let me see what I find

Original comment by: *anonymous

jberanek commented 1 year ago

Do you get any output in the browser if you set

$debug = true;

in your MRBS config file?

Original comment by: campbell-m

jberanek commented 1 year ago

If you run the attached program it will tell you where your error log is.

Original comment by: campbell-m

Attachments: https://sourceforge.net/p/mrbs/support-requests/_discuss/thread/8077143c78/92bf/2e8a/attachment/test.php

jberanek commented 1 year ago

No, there is no message in the browser - when I log in mrbs than it logs me into joomla, but in mrbs i cannot do anything. Seems to be a conflict n user7admin rights or pw differencdes?

i found a file "error.php" which contains numerous attempts to log into my joomla webside - seem to be "hackers? These are examples: "Username or pw wrong or not exist"

2023-01-30T15:46:17+00:00 INFO 178.255.46.64 joomlafailure Benutzername und Passwort falsch oder das Benutzerkonto existiert noch nicht! 2023-01-30T16:14:02+00:00 INFO 54.38.144.149 joomlafailure Benutzername und Passwort falsch oder das Benutzerkonto existiert noch nicht! 2023-01-30T18:03:45+00:00 INFO 185.231.207.7 joomlafailure Benutzername und Passwort falsch oder das Benutzerkonto existiert noch nicht! 2023-01-30T18:04:23+00:00 INFO 45.95.11.26 joomlafailure Benutzername und Passwort falsch oder das Benutzerkonto existiert noch nicht! Possibly I first take off my login from the joomla frontend to prevent those to spoil anything.

Original comment by: *anonymous

jberanek commented 1 year ago

There shouldn't be any differences between your old version of MRBS and 1.11.0. If it worked with Joomla before then it should still work. Have you changed any of the config settings?

Also, when you say you can't do anything, do you mean you get the "Access Denied" message?

Original comment by: campbell-m

jberanek commented 1 year ago

I have not changed the config settings. i am getting the same message as if i am not logged in at all when having the "Joomla auth" enabled. Seem to be access denied , although it does not give a message back. Is there any way to get the user PW and rights fixed in the sql tables or through other entries in files of mrbs?

Original comment by: *anonymous

jberanek commented 1 year ago

Do you get your name in the top right corner after logging in?

Original comment by: campbell-m

jberanek commented 1 year ago

Not with joomla auth. I guess I have pw conflict between mrbs and joomla. I have swithes today so often forward and backward maybe I have screwed something up. i will chnge my pw in joomla to something which is maybe what I think I have screwed maybe that can help

Original comment by: *anonymous

jberanek commented 1 year ago

The change did not help.

How can I set the User " admin " directly in MRBS, taking interimly the joomla auth off? is it correct to put this in the config.inc.php? $auth["type"] = "config";

// Then for each user, add an entry formatted as: // $auth["user"]["username"] = "userpassword";

$auth["admin"]["xxx"] = "xxx"; //auth["user"]["horst"] = "xxx";

Or can I create another admin user from scratch?

Original comment by: *anonymous

jberanek commented 1 year ago

This is how it looks after logged in on MRBS. (A login in Joomla does not do anything)-still wants a login on mrbs page , but won't do.

Original comment by: *anonymous

Attachments: https://sourceforge.net/p/mrbs/support-requests/_discuss/thread/8077143c78/1023/attachment/afterlogin.JPG

jberanek commented 1 year ago

You need to set

$auth["type"] = "config";
$auth["session"] = "php";

// Then for each user (including admins), add an entry formatted as:
$auth["user"]["username"] = "userpassword";

// Then denote which of those users are admins
$auth['admin'] = ['horst', 'campbell', 'anotheradmin'];

Original comment by: campbell-m

jberanek commented 1 year ago

ok, I will try this

Original comment by: *anonymous

jberanek commented 1 year ago

I can access mrbs and start creating an entry but get an error starting with: "E_USER_NOTICE in /xxxxx/htdocs/xxxxx/mrbs/functions_mail.inc at line 174 invalid e-mail adress

Original comment by: *anonymous

jberanek commented 1 year ago

Ok, tried this. Can login now and see the entries. When entering a new one, i get an error message E_USER_NOTICE in /xxxxxxx/htdocs/xxxxxxx/mrbs/functions_mail.inc at line 174 missing e-mail adress

where can i differtiate between admin 1 and admin 2 and users who simply can enter and change their own entries without having access to rooms config ?

Can I maintain the users in mrbs?

Original comment by: *anonymous

jberanek commented 1 year ago

When you upgraded to MRBS 1.11.0 did you change the folder in which MRBS is installed? If so, I wonder whether the problem is the cookie path in your Joomla config:

// Be sure to set the cookie path in your Joomla administrator Global Configuration Site settings
// to cover both the Joomla and MRBS installations, eg '/'.

Original comment by: campbell-m

jberanek commented 1 year ago

Interestingly, I have got the confirmation mail that I made the entry and the entry is in mrbs. I also can delete it, getting the same error message.

Original comment by: *anonymous

jberanek commented 1 year ago

After getting this error fixed - which might be something on the user adress maintenance side ?? I certainly would like to switch to get it "joomla auth" controlled. Thanks so far.

Original comment by: *anonymous

jberanek commented 1 year ago

When you upgraded to MRBS 1.11.0 did you change the folder in which MRBS is installed? If so, I wonder whether the problem is the cookie path in your Joomla config:

= No. the folder was before and after = mrbs . I just copied the content of the "Web" subdirectory into mrbs.

I am going to check where at all the cookie path in my joomla is. i should have one, shouldn't i ?

Original comment by: *anonymous

jberanek commented 1 year ago

in my configuration file of joomla backend the are two empty fields

Original comment by: *anonymous

Attachments: https://sourceforge.net/p/mrbs/support-requests/_discuss/thread/8077143c78/641a/attachment/cookipath.JPG

jberanek commented 1 year ago

I have set the Domain and the cookypath to "/" Hope this helps. What has changed so far , the error message about the missing mail had gone. Not sure why .....( i have set a different name in SQl user for my login)

Original comment by: *anonymous

jberanek commented 1 year ago

I have lost track of what you have changed and what you haven't! There must be something simple that is wrong. Could you post a copy of your config.inc.php file here with sensitive data such as usernames, passwords, email addresses, etc. removed?

If you are trying to use a different authentication type just in order to access the system, then it would be better to use the 'db' scheme and not the 'config' scheme. Set:

$auth["type"] = "db";
$auth["session"] = "php";

The 'db' scheme is easier to manage and also allows you to set email addresses. Even better would be to copy your mrbs folder to mrbs2 or something and configure mrbs2 to use the 'db' scheme while mrbs uses 'joomla'.

The only thing to watch out for when using the 'db' scheme is to make sure that you duplicate the Joomla usernames exactly. Otherwise a booking created by somebody under one scheme will nit be able to be edited by the same person under the other scheme.

Original comment by: campbell-m

jberanek commented 1 year ago

This morning I changed the config file back to joomla auth. I found the my Joomla PW differed from my Mrbs PW. That maybe explained why Login attempt on MRBS side logged me into Joomly, but not into mrbs. After change of PW in Joomly to the mrbs pw, it works in FIREFOX sofar that I can see now the full header and seem to be able to enter -in MS Edge same behaviour as desribed befroe I entered a new booking and that worked. I deleted it that worked. Also got the mails about the entry and deletion. HOWEVER, when changing an existing record I get the below message: *0 MRBS\createbodytablerow(): Argument #3 ($old) must be of type string, null given, called in /xxxxx/htdocs/xxxx/mrbs/functionsmail.inc on line 608

You may not be able ........

I was able to change an newly created entry with booking allowed. Once I took all this off, the error above showed up again.

Original comment by: *anonymous

jberanek commented 1 year ago

I need to add an observation I made - re MS Edge: The misfunction not to login happened on a w10 pc with a user who is not admin in w10. Doing the same with an admin user of w10 works also in MS Edge,i.e. the loging funtions fine from Joomly to MRBS.

This error message on change still exists. MRBS\createbodytablerow(): Argument #3 ($old) m.......

Original comment by: *anonymous

jberanek commented 1 year ago

I'm not clear what the current status is. Is everything now working properly, apart from the "MRBS\createbodytablerow(): Argument #3 ($old)" problem? And can you give exact steps please on how to reproduce that problem?

Original comment by: campbell-m

jberanek commented 1 year ago

Thanks for asking - the Login works ok now with Joomla except on instance with MS Edge where the Windows 10 User is NOT an admin on the PC. I did not had this effect with a Windows 10 user where the W10 user is PC Admin. This does not happen in firefox and did not happen on a tablet

Original comment by: *anonymous

jberanek commented 1 year ago

The error message "MRBS\createbodytablerow(): Argument #3 ($old)" "appears simply every time I change an existing entry. - no matter if it is mine or someone elses booking.

Original comment by: *anonymous

jberanek commented 1 year ago

Last, once this is fixed I would like to ask questions about correct setup of user for different type of behaviours in mrbs entry maintenance.

Original comment by: *anonymous

jberanek commented 1 year ago

The error message "MRBS\createbodytablerow(): Argument #3 ($old)" "appears simply every time I change an existing entry. - no matter if it is mine or someone elses booking. it happens at the time of saving it.

Original comment by: *anonymous

jberanek commented 1 year ago

Can you give me the complete error message please, so that I can try and reproduce it?

Original comment by: campbell-m

jberanek commented 1 year ago

Could you raise a new ticket for those questions please, so that this ticket doesn't get too complicated? Thanks.

Original comment by: campbell-m

jberanek commented 1 year ago

Sorry, I had overseen your message from about 6 hrs ago - here is the config file.

Original comment by: *anonymous

Attachments: https://sourceforge.net/p/mrbs/support-requests/_discuss/thread/8077143c78/bf54/attachment/config.inc.php.txt

jberanek commented 1 year ago

0 MRBS\create_body_table_row(): Argument #3 ($old) must be of type string, null given, called in /x/x/x/htdocs/x/mrbs/functions_mail.inc on line 608

You may not be able to visit this page because of:

an out-of-date bookmark/favourite
a search engine that has an out-of-date listing for this site
a mistyped address
you have no access to this page
The requested resource was not found.
An error has occurred while processing your request.

Please try one of the following pages: Home Page

If difficulties persist, please contact the System Administrator of this site and report the error below.

MRBS\create_body_table_row(): Argument #3 ($old) must be of type string, null given, called in /x/x/x/htdocs/x/mrbs/functions_mail.inc on line 608

Original comment by: *anonymous

jberanek commented 1 year ago

sure

Original comment by: *anonymous

jberanek commented 1 year ago

Thanks to your config file which pointed me in the right direction I was able to reproduce and then fix this problem in 54efd8e. (The problem occurs when you have a nullable custom field, which is allowed.)

I recommend you upgrade to the latest version of the development code which contains a number of other fixes besides this one. You can download it by following the green Code button on this page. Treat it like a new release.

Original comment by: campbell-m

jberanek commented 1 year ago

thank you for the research. What Do I have do do ? just copy the content of the "web" folder to my mrbs folder ? If yes, what will happen next - again an sql-table conversion like the one which appeared when upgrading to 1.11.0 ?

Original comment by: *anonymous

jberanek commented 1 year ago

I cannot reproduce the Windows 10 MS Edge problem. Are you able to reproduce it?

Original comment by: campbell-m