Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict with Sleeky Theme: QR code only displaying for logged in users #37

Open
P14M opened this issue May 21, 2020 · 2 comments
Open

Comments

@P14M
Copy link

P14M commented May 21, 2020

Hi. I'm having a strange issue which has left me completely stumped.

I'm trying to generate QR codes for a publicly available service.

When I'm logged in, everything works fine. The QR code shows in the share box and using .qr after the short link displays the code as it should.

However, when logged out as my public users will be, the QR code in the share box is broken and when using .qr the sort of garbled code you get when opening an image in a text editor is displayed instead of the QR code image.
It seems QR code images are not rendering for public users, only for logged in users.
No CSS is loading for public users either which I guess is related.
When logged in element.style background and margin load ok.

It's not a problem generating the original QR code, logging in instantly fixes the problem for links which were created when logged out.
It's just an issue displaying them to public users.

Screenshot 2020-05-21 at 14 26 04

I have tried everything I can think of but nothing is fixing the problem.
All permissions seem to be ok.
I've tested this problem and I'm getting the same results in Chrome, Firefox, Explorer and Safari so it's not browser related.
I have also tried changing the permissions on every instance of the qrchk.php and srv.php file with no effect.

Also, possibly connected and equally strange... when pages are generated with /srv/ in the URL, such as when displaying a QR code or an error message, the original YOURLS favicon shows instead of my own.
I have no idea how to change this or even where its coming from as I have replaced the original favicon in the YOURLS images folder.

I'm fairly inexperienced so I'm probably missing something simple, but thank you in advance for your help.

My current configuration is:
YOURLS v 1.7.9
YOURLS-IQRCodes v 2.1.2
YOURLS-U-SRV v 2.1.0
Running Sleeky Theme v 2.4.1
Server = Linux Apache
PHP v 7.2.3
MySQL v 10.3.23

In admin, U-SRV checks shows, SRV.php: Success: installed and up to date.
IQR-Codes shows, Plugin: Success: U-SRV is installed and enabled.
srv.php satus: Success: installed and up to date. (That typo is in the plugin code by the way).

Files qrchk.php & srv.php copied into:
/pages and /user/pages (It seems to require both to show success in admin checks).

QR codes show ok in YOURLS_CACHE.

Permissions =

YOURLS_CACHE /fu and /qr all 777.
Codes showing in /qr.
/fu empty.

/pages 755
/pages/qrchk.php 644
/pages/srv.php 755

The same permissions on the same files in /user/pages and /plugins/iqrcodes/assets.
Cache folder in /plugins/iqrcodes set to 777.

@P14M P14M changed the title QR code only working for logged in users QR code only displaying for logged in users May 21, 2020
@P14M
Copy link
Author

P14M commented May 23, 2020

Update: I have identified the main problem but haven't worked out a fix. And I have fixed the favicon issue.

The issue seems to be a conflict with the Sleeky backend.
I am getting the error:
PHP Warning: Cannot modify header information - headers already sent by (output started at /home/USERNAME/public_html/user/plugins/sleeky-backend/plugin.php:145) in /home/USERNAME/public_html/user/pages/srv.php on line 40

The same error is happening for lines 156, 157 and 158 of srv.php.

Line 145 in the sleeky backend plugin is the <style> line below.

// Hide admin links for non-authenticated users
if (yourls_is_valid_user() != 1) {
	echo <<<HEAD
		<style>ul#admin_menu li:not(.frontend_link) {display: none}</style>
HEAD;

If I block these lines from loading, then the QR code displays as expected for logged out users.
However, this is not a fix because I need this code to run to hide admin links from public users.

I have tried placing a php.ini file in public_html containing buffer_output = on and adding

<IfModule mod_suphp.c>
suPHP_ConfigPath /home/USERNAME/public_html
</IfModule>

to htaccess to make it apply to subdirectories, but this did not work.

As for the favicon issue... Hopefully this'll help someone else with the same issue... It seems yourls_loader.php has a favicon hardcoded in base64 code right at the top on line 3, for use on pages where the main favicon doesn't load. I just replaced the code with base64 for my own favicon gif.

Anyway, any help on how to fix this conflict would be brilliant.
I'll ask on the Sleeky page too and update this if anyone helps there.

@P14M
Copy link
Author

P14M commented May 24, 2020

I've fixed this conflict now I think, by removing

if (yourls_is_valid_user() != 1) {
	echo <<<HEAD
		<style>ul#admin_menu li:not(.frontend_link) {display: none}</style>
HEAD;
}

from the bottom of /sleeky-backend/plugin.php.
And adding

	<?php 
if (yourls_is_valid_user() != 1) {
	echo <<<HEAD
		<style>ul#admin_menu li:not(.frontend_link) {display: none}</style>
HEAD;
}
?>

to just above the closing head tag in /includes/functions-html.php.

This seems to have fixed the 'headers already sent' conflict.
Which was preventing IQRCodes from loading content types, which prevented QR code images from rendering for logged out users, while keeping admin links hidden.

@P14M P14M closed this as completed May 24, 2020
@P14M P14M changed the title QR code only displaying for logged in users Conflict with Sleeky Theme: QR code only displaying for logged in users May 24, 2020
@joshp23 joshp23 reopened this Jul 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants