1
mrphilong
class/pagenav.php X2.5.5
  • 2012/10/6 1:51

  • mrphilong

  • Quite a regular

  • Posts: 351

  • Since: 2006/7/14


http://validator.w3.org complaints about

id="xo-pagenav"


could someone please change id to class.

Anyone usinghttp://validator.w3.org to check for XHTML compliance ?

Xoops.org has 26 Errors, 32 warning(s) using the validator.

2
irmtfan
Re: class/pagenav.php X2.5.5
  • 2012/10/6 5:01

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


This is an issue in xoops.org theme/templates and not in XOOPS.
correcting xoops.org theme/templates to make it W3 validate is good job but is very time consuming.

3
voltan
Re: class/pagenav.php X2.5.5
  • 2012/10/6 5:24

  • voltan

  • Theme Designer

  • Posts: 724

  • Since: 2006/12/5


This is a core problem , class/pagenav.php line 72

$ret .= '<div id="xo-pagenav">';


But for fix it you have two way :
1- fix core : after this all themes need change ( it corect way )
2- fix all module templates and use just one pagenav in each page.

I hope see more options in pagenav

4
mrphilong
Re: class/pagenav.php X2.5.5
  • 2012/10/6 9:07

  • mrphilong

  • Quite a regular

  • Posts: 351

  • Since: 2006/7/14


I'd put a change in the core, thanks.

Quote:


I hope see more options in pagenav



Is there a hack for pagenav not to display ALL pages for a module ABC unless you are an admin member?

The reason for this, I don't want data extraction software used on my site.

5
easyb9
Re: class/pagenav.php X2.5.5
  • 2012/10/7 3:31

  • easyb9

  • Just popping in

  • Posts: 41

  • Since: 2011/8/10


I dont understand why XHTML validation so important for you even google have 24 Errors, 3 warning(s)
http://validator.w3.org/check?uri=google.com&charset=%28detect+automatically%29&doctype=Inline&group=0

facebook also 46 Errors.
http://validator.w3.org/check?uri=facebook.com&charset=%28detect+automatically%29&doctype=Inline&group=0

valid W3C Compliance not improve seo score over 1 %.

6
irmtfan
Re: class/pagenav.php X2.5.5
  • 2012/10/7 4:57

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


Thanks Voltan. I said that without take a look at the file and i was wrong.

that is very bad hardcode in XOOPS Core in 2.5.5 and 2.6 versions.
Also 2 weeks ago i found another hardcode in that pagenav class.
$ret '<form action="" name="pagenavform">';

// some codes ....

$ret .= '</form>';


No need a form without any action. core team should remove that form because it will cause problems when you have another form.

As i said above the final solution is removing those hardcodes.

But for this time we can use smarty replace function in templates like this.
<{$pagenav|replace:'form':'div'|replace:'id="xo-pagenav"':''}>


Quote:

Is there a hack for pagenav not to display ALL pages for a module ABC unless you are an admin member?

what do you exactly want to do?
1- show the pagenav only for admins?
2- show other pages than page=1 only for admins?
I think you mean (2).
for that purpose you should control the $_GET['start'] value in the URL. eg like this:
$start = isset($_GET['start']) ? $_GET['start'] : 0;
if (!
$isadmin$start=0;


then you are sure that regular user cannot use start value other than 0.

easyb9:
W3C validation is a guide. as you said some issues and errors are not important. but some of them are important.
for example this id="xo-pagenav" issue is very important because for example the css code will just affect the first pagenav (in the top) in viewtopic.php in newbb.


7
mrphilong
Re: class/pagenav.php X2.5.5
  • 2012/10/8 6:19

  • mrphilong

  • Quite a regular

  • Posts: 351

  • Since: 2006/7/14


Quote:

what do you exactly want to do?
1- show the pagenav only for admins?
2- show other pages than page=1 only for admins?
I think you mean (2).


for example pagenav has the following pages:

1,2,3,4.....1000

I only want guest/registred user to browse to from page 1 to 15, but able to see there are a total of 1000 pages.

However, if guest/registred search a keyword and the module returns 1,2,3,4....50, only page 1 to 15 are accessible but display there are a total of 50 pages on the search result.

I would like the pagenav hack on some modules, other modules just ignore the hack.


8
irmtfan
Re: class/pagenav.php X2.5.5
  • 2012/10/9 5:49

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


mrphilong :
I was right and this is not a pagenav hack and you need to control the $_GET['start'] in the url.
to do it for the whole website you can do the following.
open include/common.php in the end of the file above the xoopsLogger stop add this:
// START irmtfan hack to restrict access to pages.
$restrict_page_access true;
$restrict_module_names=array('newbb','news');
$restrict_items 15*10;
if (
$restrict_page_access && !$xoopsUserIsAdmin && in_array($xoopsModule->getVar('dirname''n') ,$restrict_module_names) && isset($_GET['start']) && !empty($_GET['start']) && intval($_GET['start']) > $restrict_items ) {
    
redirect_header($_SERVER['HTTP_REFERER'], 2_MD_ERROR);
}
// END irmtfan hack to restrict access to pages.
$xoopsLogger->stopTime('XOOPS Boot');

you should modify the below variables for your needs.
$restrict_module_names=array('newbb','news');
$restrict_items = 150;
eg: there is a $restrict_items = 15*10 and it shows you have 10 items in 15 pages.
it is because you have different settings for pages in modules. eg in newbb you can change the posts per pages and topics per pages.


Anyway, you should know user can access to each item by using the direct link.
for example in newbb using the post_id

I still dont know if you want to do the above or you really want users to not access to items in the other pages.
IMO to do a real restrict you should hack modules one by one.





9
mrphilong
Re: class/pagenav.php X2.5.5
  • 2012/10/10 12:49

  • mrphilong

  • Quite a regular

  • Posts: 351

  • Since: 2006/7/14


Quote:

Anyway, you should know user can access to each item by using the direct link.
for example in newbb using the post_id


I'd like to restrict direct link as well. For example the module news, what file do you think I need to hack?

10
irmtfan
Re: class/pagenav.php X2.5.5
  • 2012/10/11 7:41

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


mrphilong:
restrict the access to a item by direct link just can be achieved by finding the place of that item in the "parent item"
eg:
in news: find the place of article_id=XXXX in the index page.
OR
find the place of article_id=XXXX in its "parent cat_id"

The above should be done in module and IMO it is not an easy task especially for an old full of hardcodes module like news. it is easier for new modules like newbb and publisher.

I repeat "pagenav" is nothing more than a nice looking feature to access to other pages easily. without a pagenav you can always can get access to pages by changing the "start" value in the URL.

but that start value is another nice looking feature too and it is useless when you use direct link.

IMO page navs cause server overloading issues in big websites.
It seems to me that the only solution is disabling page nav in big websites.
see this:
https://xoops.org/modules/newbb/viewtopic.php?post_id=349698
im really interested to have your ideas.


Login

Who's Online

139 user(s) are online (97 user(s) are browsing Support Forums)


Members: 0


Guests: 139


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits