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
Warning [2] Undefined property: MyLanguage::$archive_pages - Line: 2 - File: printthread.php(287) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/printthread.php(287) : eval()'d code 2 errorHandler->error
/printthread.php 287 eval
/printthread.php 117 printthread_multipage



UserSpice
US4.1.5 - Table 'Pages' emptied by users/admin_pages.php - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Support Center (https://userspice.com/forums/forumdisplay.php?fid=23)
+--- Forum: UserSpice 4.3 and Below (https://userspice.com/forums/forumdisplay.php?fid=26)
+--- Thread: US4.1.5 - Table 'Pages' emptied by users/admin_pages.php (/showthread.php?tid=277)

Pages: 1 2


US4.1.5 - Table 'Pages' emptied by users/admin_pages.php - yolo - 09-22-2016

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.


US4.1.5 - Table 'Pages' emptied by users/admin_pages.php - mudmin - 09-22-2016

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.


US4.1.5 - Table 'Pages' emptied by users/admin_pages.php - mudmin - 09-22-2016

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.




US4.1.5 - Table 'Pages' emptied by users/admin_pages.php - yolo - 09-22-2016

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).


US4.1.5 - Table 'Pages' emptied by users/admin_pages.php - mudmin - 09-22-2016

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?





US4.1.5 - Table 'Pages' emptied by users/admin_pages.php - mudmin - 09-22-2016

Sorry. I forgot to say, that should be

<?php

dump($abs_us_root);

dump($us_url_root);

dump($path);

?>


US4.1.5 - Table 'Pages' emptied by users/admin_pages.php - yolo - 09-22-2016

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) !


US4.1.5 - Table 'Pages' emptied by users/admin_pages.php - brian - 09-22-2016

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.


US4.1.5 - Table 'Pages' emptied by users/admin_pages.php - brian - 09-22-2016

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.


US4.1.5 - Table 'Pages' emptied by users/admin_pages.php - yolo - 09-22-2016

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.