Forums

Unfortunately no one can be told what FluxBB is - you have to see it for yourself.

You are not logged in.

#1 2012-06-27 08:59:14

Otomatic
FluxBB Donor
From: Paris - France
Registered: 2010-01-26
Posts: 493
Website

Real name of the generated page

Hello,

To differentiate actions based on the displayed page (index, viewforum, viewtopic, etc..), I had thought to use a constant that is defined in the index.php page:

define('PUN_ACTIVE_PAGE', 'index');

But the problem is that this constant PUN_ACTIVE_PAGE is defined with the value index for many other files as edit.php, misc.php, moderate.php, viewforum.php, viewtopic.php, etc.. .

We could use $_SERVER ['REQUEST_URI'], but this preset system constant is unreliable and is easily modifiable.

I ask that a constant is added in the header of each file that generates a page, which includes the constant name of the page, eg

define ('PUN_REAL_PAGE', 'index');

define ('PUN_REAL_PAGE', 'viewforum');

define ('PUN_REAL_PAGE', 'viewtopic);

and so on.

Ce n'est pas parce que l'erreur se propage qu'elle devient vérité. Ghandi
An error does not become truth by reason of multiplied propagation. Ghandi

Offline

#2 2012-06-27 21:45:51

jacob
Member
From: United States
Registered: 2011-09-25
Posts: 101
Website

Re: Real name of the generated page

There's also $_SERVER['PHP_SELF'].


Jacob G.
Developer at FutureSight Technologies

Offline

#3 2012-06-28 10:50:02

adaur
Developer
From: France
Registered: 2010-01-07
Posts: 738
Website

Re: Real name of the generated page

jacob wrote:

There's also $_SERVER['PHP_SELF'].

I would not rely on a $_SERVER variable personally.


Please excuse my bad english, I'm french tongue.

Offline

#4 2012-06-28 12:12:38

Paul
Developer
From: Wales, UK
Registered: 2008-04-27
Posts: 1,653

Re: Real name of the generated page

FluxBB already uses PHP_SELF to set the id on the top level div wrapper and there doesn't seem to be any problem with it.  The code is in header.php.

The real problem with trying to determine the page using $_SERVER or getenv() is that all you can determine is the running script not the page.  Scripts such as profile.php, moderate.php, misc.php each produce several distinct types of page.  For example, PHP_SELF will return 'profile' regardless of whether you are viewing a member profile, editing your own profile or displaying the change password dialogue.  The only way around that is to define a constant or variable for each individual page that is output.

Last edited by Paul (2012-06-28 12:46:21)


The only thing worse than finding a bug is knowing I created it in the first place.

Offline

#5 2012-06-28 14:31:35

Otomatic
FluxBB Donor
From: Paris - France
Registered: 2010-01-26
Posts: 493
Website

Re: Real name of the generated page

Paul wrote:

... The only way around that is to define a constant or variable for each individual page that is output.

Hi,
That's why I request the addition of a variable or a constant for each individual page.


Ce n'est pas parce que l'erreur se propage qu'elle devient vérité. Ghandi
An error does not become truth by reason of multiplied propagation. Ghandi

Offline

#6 2012-06-29 22:37:24

arw
Member
Registered: 2012-03-20
Posts: 117

Re: Real name of the generated page

what would be the use ?

easing the making of mod, for example in header.php you could just add :

if(PUN_REAL_PAGE=='viewforum') /* code to do */;

while now you would have to modify viewforum.php ( or use  a $_SERVER value ) to do that ?

adaur wrote:
jacob wrote:

There's also $_SERVER['PHP_SELF'].

I would not rely on a $_SERVER variable personally.

it's server side, so it's as reliable as intval()

Offline

Board footer

Powered by FluxBB 1.5.8