DATA_COMMENT_DELETED on deleting trackback

Found a bug? Tell us!!
Post Reply
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

DATA_COMMENT_DELETED on deleting trackback

Post by LazyBadger »

Text in such form means (usually) "No string constant found", referecnce found only once, in index.php

Code: Select all

if (preg_match(PAT_DELETE, $uri, $res) && $serendipity['serendipityAuthedUser'] === true) {
    if ($res[1] == 'comment' && serendipity_deleteComment($res[2], $res[3], 'comments')) {
        define('DATA_COMMENT_DELETED', sprintf(COMMENT_DELETED, $res[2]));
Quis custodiet ipsos custodes?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: DATA_COMMENT_DELETED on deleting trackback

Post by garvinhicking »

Hi!

I don't understand, what do you mean?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

Re: DATA_COMMENT_DELETED on deleting trackback

Post by LazyBadger »

DATA_COMMENT_DELETED string must be defined in lang-file or some other way, but this doesn't happen,when it needed
Is it more clean?
Quis custodiet ipsos custodes?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: DATA_COMMENT_DELETED on deleting trackback

Post by garvinhicking »

Hi!

The problem is, DATA_COMMENT_DELETED is emitted that way in templates, without sprintf() substitution. We cannot change it to a language file because then the substitution would need to take place in the template, and that would mean every template author had to change their template.

Since the %s substitution is already done through COMMENT_DELETED, I do not think this is a problem.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

Re: DATA_COMMENT_DELETED on deleting trackback

Post by LazyBadger »

garvinhicking wrote:Since the %s substitution is already done through COMMENT_DELETED, I do not think this is a problem
I don't know there and how it's (substitution) broken, but it happens, in other case I never saw "DATA_COMMENT_DELETED" instead of normal "human-ready" text. This IS a ploblem (well, annoyance) now,because it make frontend of Serendipity not perfect
Quis custodiet ipsos custodes?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: DATA_COMMENT_DELETED on deleting trackback

Post by garvinhicking »

Hi!

What do you mean, you never saw DATA_COMMENT_DELETED? It should get the content of "COMMENT_DELETED" of the langauge file.

COMMENT_DELETED is set to "Comment #%s has successfully been deleted" in the language file. Now the code puts the ID of the deleted comment inside that string and saves it as the constant DATA_COMMENT_DELETED. So this contains "Comment #4711 has successfully been deleted" for example, and the templates output this from the entries.tpl file...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

Re: DATA_COMMENT_DELETED on deleting trackback

Post by LazyBadger »

garvinhicking wrote:Hi!

What do you mean, you never saw DATA_COMMENT_DELETED? It should get the content of "COMMENT_DELETED" of the langauge file.
It should, but not get - I try to say it from the first message. I see human-readable text for trackback deleted from @define('TRACKBACK_DELETED'..., but second line below this is pure "DATA_COMMENT_DELETED" as-is without expanding and substitution. Do you want screenshot?
Quis custodiet ipsos custodes?
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

Re: DATA_COMMENT_DELETED on deleting trackback

Post by LazyBadger »

You can delete pingback from me to "IE9 has trouble with CSS Content-Types" entry in blog for testing purposes
Quis custodiet ipsos custodes?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: DATA_COMMENT_DELETED on deleting trackback

Post by garvinhicking »

Hi!

Maybe the problem is deleting pingbacks.

Can you modify your code like this:

Code: Select all

if (preg_match(PAT_DELETE, $uri, $res) && $serendipity['serendipityAuthedUser'] === true) {
    if ($res[1] == 'comment' && serendipity_deleteComment($res[2], $res[3], 'comments')) {
        define('DATA_COMMENT_DELETED', sprintf(COMMENT_DELETED, $res[2]));
    } elseif ( $res[1] == 'trackback' && serendipity_deleteComment($res[2], $res[3], 'trackbacks') ) {
        define('DATA_TRACKBACK_DELETED', sprintf(TRACKBACK_DELETED, $res[2]));
    } else {
      define('DATA_COMMENT_DELETED', sprintf(COMMENT_DELETED, $res[2]));
    }
} else {
    define('DATA_COMMENT_DELETED', false);
    define('DATA_TRACKBACK_DELETED', false);
}
The additional line should take care that the constants are ALWAYS defined, also when the type is neither "comments" nor "trackbacks".

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

Re: DATA_COMMENT_DELETED on deleting trackback

Post by LazyBadger »

If you said about such diff as result

Code: Select all

--- mayorat.e-city.net.ru/web/blog/index.php	Чт июн 11 15:14:16 2009
+++ index.php	Пн апр  4 17:46:38 2011
@@ -63,6 +63,8 @@
         define('DATA_COMMENT_DELETED', sprintf(COMMENT_DELETED, $res[2]));
     } elseif ( $res[1] == 'trackback' && serendipity_deleteComment($res[2], $res[3], 'trackbacks') ) {
         define('DATA_TRACKBACK_DELETED', sprintf(TRACKBACK_DELETED, $res[2]));
+    } else {
+      define('DATA_COMMENT_DELETED', sprintf(COMMENT_DELETED, $res[2]));
     }
 } else {
     define('DATA_COMMENT_DELETED', false);
I test it now
Quis custodiet ipsos custodes?
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

Re: DATA_COMMENT_DELETED on deleting trackback

Post by LazyBadger »

With patched version of index.php - same bad result, sorry
Обратная ссылка #14 была успешно удалена
DATA_COMMENT_DELETED
Quis custodiet ipsos custodes?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: DATA_COMMENT_DELETED on deleting trackback

Post by garvinhicking »

Hi!

Hm, then I don't really understand it...DATA_COMMENT_DELETED should always be defined now (with "false") so it should show an empty string, not the constant name...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

Re: DATA_COMMENT_DELETED on deleting trackback

Post by LazyBadger »

Can I ask to poke my nose in a place in the code, where the visualization result of the substitution happens? Maybe I'm dumb, but I can't find it - I'll try to start debug session
Quis custodiet ipsos custodes?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: DATA_COMMENT_DELETED on deleting trackback

Post by garvinhicking »

Hi!

I'd suggest to do a grep/find in all files for "DATA_COMMENT_DELETED". As far as I can see, the output happens in the entries.tpl file...?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply