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

tags in "blog pagination" has a bug! #123

Open
WeTogetherDo opened this issue Sep 6, 2017 · 6 comments
Open

tags in "blog pagination" has a bug! #123

WeTogetherDo opened this issue Sep 6, 2017 · 6 comments
Labels

Comments

@WeTogetherDo
Copy link

When you want to use "tags" in , it can't been executed.

So I read the source code, I found a bug in file "helper/entry.php".

public function xhtml_pagination($conf){
...
$query = 'SELECT A.pid, A.page
FROM entries A'.$tag_table.'
WHERE '.$blog_query.$tag_query.'
AND GETACCESSLEVEL(page) >= '.AUTH_READ;
...
}

It should be change to

$query = 'SELECT A.pid, A.page
FROM entries A'.$tag_table.'
WHERE GETACCESSLEVEL(page) >='.AUTH_READ.' AND '.$blog_query.$tag_query;

@Klap-in
Copy link
Member

Klap-in commented Sep 6, 2017

I don't understand what I should use to reproduce this. What should I do?

And your solution is just switching the execution sequence, is that really helping??

@WeTogetherDo
Copy link
Author

Yes.
If you don't change the execution sequence,for example,when you use tags, the sql may be

SELECT A.pid, A.page
FROM entries A, tags B
WHERE (blog = 'default') AND (tag = 'wiki' OR tag = 'tips') AND A.p
id = B.pid GROUP BY A.pid
AND GETACCESSLEVEL(page) >= 1

But the sql must be

SELECT A.pid, A.page
FROM entries A, tags B
WHERE GETACCESSLEVEL(page) >= 1 and (blog = 'default') AND (tag = 'wiki' OR tag = 'tips') AND A.p
id = B.pid GROUP BY A.pid

@Klap-in Klap-in reopened this Sep 6, 2017
@Klap-in
Copy link
Member

Klap-in commented Sep 6, 2017

I think I understand the case. Thanks for explaining!
So the issue is that the GROUP BY A.pid part is placed before the GETACCESSLEVEL(page) >= 1 part of the query.

I prefer that the GETACCESSLEVEL(page) >= 1 is executed as latest part of the WHERE, for performance reasons (it calls php functions from MySQL).
Another approach is storing the GROUP BY in a separate variable, and joining it after the GETACCESSLEVEL part.

@WeTogetherDo
Copy link
Author

Problem is in line 291 of file "helper/entry.php".

line 291: ') AND A.pid = B.pid GROUP BY A.pid'

When you have tags ,the query will be like as
") AND A.pid = B.pid GROUP BY A.pid and GETACCESSLEVEL(page) >=1"

This is the problem.

@Klap-in Klap-in reopened this Sep 6, 2017
@Klap-in Klap-in added the Bug label Sep 6, 2017
@kp-org
Copy link

kp-org commented Sep 24, 2018

Not sure if this is related what I did recognize, but it looks similar. To me it looks like syntax extensions of plugins will not be parsed - more worse at least not all.

The 'abstract' 'line is limited to 50 chars by default, so "tags" have to be exist inside this limit. Lets say you use the bbcode plugin and use the "monospace" tag [b][/b] against the initial syntax of 2 apostrophes.

[m]something[/m] was written .... --> doesn't work (tags will be displayed)
''something" was written ... --> is parsed correctly, the "abstract" line doesn't show tags

Unfortunately bbcode's [color] tag is removed correct, so it seems that not all tags are effected. Additional entries in entities.(local.)conf will not be parsed and removed.

I tried the changes from @WeTogetherDo, but it doesn'work for me.

@Klap-in
Copy link
Member

Klap-in commented Sep 24, 2018

@kp-org abstract creation is offtopic. Please create separate issue.
(the abstract is about 250 characters. It is stored using the metadata render, not xhtml renderer. Plugins should just use (indirectly) the $renderer->cdata() method for the text. https://github.com/splitbrain/dokuwiki/blob/master/inc/parser/metadata.php )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants