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
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
US4.1.5 - Table 'Pages' emptied by users/admin_pages.php
#1
Hi,

I did a fresh installation of UserSpice 4.1.5
All seems to be working flawless except when I connect to the Admin panel and click on "users/admin_pages.php".

Got those messages 3 times each :

( ! ) Notice: Undefined variable: row in /var/www/html/mlm08/users/helpers/us_helpers.php on line 166
Call Stack
# Time Memory Function Location
1 0.0003 262696 {main}( ) .../admin_pages.php:0
2 0.0066 702056 getPathPhpFiles( ) .../admin_pages.php:52

( ! ) Warning: Invalid argument supplied for foreach() in /var/www/html/mlm08/users/admin_pages.php on line 53
Call Stack
# Time Memory Function Location
1 0.0003 262696 {main}( ) .../admin_pages.php:0

and then the list of files from "Manage Page Access" is blank.
Go back to Admin panel and got this message :
"You must go into the Admin Panel and click the Manage Pages button to add this page to the database. Doing so will make this error go away."

Unfortunately, the 'pages' table of the database has been emptied and can't add new ones from the site, only from the database.

Reinstall but same behavior.
How can I get rid of this ?

Config : local install on Fedora 24 (Files user : apache, group : mylocaluser & SELinux enabled, Php 5.6.25).
Idem on my server Centos 7.2, php 7.

Thank you for your support.
  Reply
#2
Is that table blank after install or is the act of going to that admin_pages page deleting all your pages from the db?

It's definitely designed to remove pages it doesn't see, so there could be some sort of path issue going on.
  Reply
#3
IF the pages are there when you first install, try copying your admin_pages.php file (not moving) to the usersc folder.

Make these two changes (you don't need to reinstall).

1. On the usersc/admin_pages.php change line 21 to
Code:
<?php require_once '../users/init.php'; ?>

2. Comment out lines 84-98

See what happens.

  Reply
#4
I confirm, the table became blank only after accessing to admin_pages.php.
I made change directly on users/admin_pages.php
The page is loaded fine, no error message, db table is still filled and header of the html table (Id Page Access) appears but without any content (no file listed).
  Reply
#5
Ok. Well that helps narrow down some problems.

That pages is designed to search your directories. If it doesn't find php files, it deletes them (we stopped that).

If it does find php files, it adds them. So now it's not deleting them, but we need to make sure it adds them.

Starting on Line 111, can you put
dump($abs_us_root);
dump($us_url_root);
dump($path);

And report back what those 3 variables are seeing?


  Reply
#6
Sorry. I forgot to say, that should be

<?php

dump($abs_us_root);

dump($us_url_root);

dump($path);

?>
  Reply
#7
Sorry for the delay, messed up my prod by mixing local and production sites, so previous result wasn't completely right.

The result of the 3 variables are :
/var/www/html/mlm09/users/helpers/helpers.php:186Confusedtring '/var/www/html' (length=13)
/var/www/html/mlm09/users/helpers/helpers.php:186Confusedtring '/mlm09/' (length=7)
/var/www/html/mlm09/users/helpers/helpers.php:186Confusedtring 'mlm09/usersc/' (length=13)

and from z_us_root.php :
$path=['mlm09/','mlm09/users/','mlm09/usersc/'];

Still these messages if that can help :
( ! ) Notice: Undefined variable: row in /var/www/html/mlm09/users/helpers/us_helpers.php on line 166
Call Stack
# Time Memory Function Location
1 0.0002 258856 {main}( ) .../admin_pages.php:0
2 0.0059 695552 getPathPhpFiles( ) .../admin_pages.php:52

! ) Warning: Invalid argument supplied for foreach() in /var/www/html/mlm09/users/admin_pages.php on line 53
Call Stack
# Time Memory Function Location
1 0.0002 258856 {main}( ) .../admin_pages.php:0

And the files are now listed on the page (with deletion part commented out) !
  Reply
#8
This will be a tough nut to crack I think. I'm going to take a look at it now to see what I can find, if anything.
  Reply
#9
I think I just found it...In the z_us_root.php file, remove the 'mlm09' part of the string from each of the $path entries. The values there should be "relative to the z_us_root.php file". That part of the path should be accounted for by $us_url_root in the functions that are called. If you start from a fresh install again, leave z_us_root as is from install, and it should be good to go, even though you have it in a subfolder.
  Reply
#10
Nice shot ! Removing mlm09 did it. No more messages too.

Will it be possible add a control on the page admin_pages.php, like this one : if no php file found, don't update the DB ?

Thank you very much.
  Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)