Welcome to Geeklog Thursday, November 21 2019 @ 05:48 am EST

Geeklog Forums

Autotag plugin

Page navigation


Status: offline

jmucchiello

Forum User
Full Member
Registered: 29/08/05
Posts: 985
Actually, I need you to look at your database because when I put [code]<a href="http://en.wikipedia.org/wiki/#1">#2</a>[/code] into the replacement text of an autotag, it behaves as one would expect. So the first question is, is that what yours looks like or is yours somehow different?
 Quote

Status: offline

ronack

Forum User
Full Member
Registered: 27/05/03
Posts: 612
Here is what I type in

[code]#2 [/code]

I save it then it looks like this

[code]#2 [/code]

I'm pretty sure the extra slashes are because of Magic Quotes which it didn't seem to matter where I put this

[code] $subject = stripslashes($record['replacement']);[/code]

I can't get rid of them. I think maybe my line numbers aren't matching up. So if you give me the line number also tell me what should be above or below.

 Quote

Status: offline

ronack

Forum User
Full Member
Registered: 27/05/03
Posts: 612
I tried to use actual screen shots but it kept telling me my post was spam.

 Quote

Status: offline

jmucchiello

Forum User
Full Member
Registered: 29/08/05
Posts: 985
Quote by: ronack
[code]<a href=\"http://en.wikipedia.org/wiki/#1\">#2</a> [/code]
That is the source of the weirdness. If you look at the page source the backslash and quote are ascii-fied as &5c;&22;

Do you have magic quotes on in your php.ini?
 Quote

Status: offline

ronack

Forum User
Full Member
Registered: 27/05/03
Posts: 612
Yes they are on.

At least the source of half of the weirdness.
 Quote

Status: offline

jmucchiello

Forum User
Full Member
Registered: 29/08/05
Posts: 985
Yeah, I just turned them on and could recreate the problem. The autotags admin page isn't cleaning it's input very well. Hey, it was my first plugin....

Find the call to saveautotags toward the end of /public_html/admin/plugins/autotags/index.php and replace the call with:
[code] $display = saveautotags($tag,
COM_applyFilter($_POST['old_tag']),
COM_applyFilter($_POST['description']),
COM_applyFilter($_POST['is_enabled']),
COM_applyFilter($_POST['is_function']),
COM_stripslashes($_POST['replacement']));[/code]
I'll package and release a real update shortly.
 Quote

Status: offline

ronack

Forum User
Full Member
Registered: 27/05/03
Posts: 612
Yep that does it

Something interesting happened, it fixed both issues.

Also here's another interesting feature, I use Snap Shots on that site. Check out the link now.

http://www.nc-emt.com/article.php?story=20071115180224368
I'll leave the link there for awhile so folks can look at it but since it was a test area it will be removed in a few weeks.

Thank

I really like your plug in, Great Job

Ron
 Quote

Status: offline

ronack

Forum User
Full Member
Registered: 27/05/03
Posts: 612
I just got to thinking, I wonder how hard it would be to make it just a tag vs a link..... Hmmm!
 Quote

Status: offline

Benta

Forum User
Regular Poster
Registered: 11/03/05
Posts: 80
I like this plugin, but I also had the problem with the extra slash. The fix for it, well, fixed it.

Another issue I have is that the base url for a site is not the site name but really http:sitename.com/somesubdirectory.

That last part, some subdirectory isn't coming out with #U...only http:sitename.com.

Otherwise the idea is splendid!
 Quote

Status: offline

Benta

Forum User
Regular Poster
Registered: 11/03/05
Posts: 80
And, oh yeah, since you asked what people do with it:

I am too lazy to write real plugins because my mods are things only I need. My mods are simply static pages and functions that look into tables with data having zilch to do with blogging (it is an intranet site used keep track of development).

Since autotags are resolved in static pages, I wanted to use autotags to make it unnecessary to ever write PHP myself in the pages.... 8)
 Quote

Status: offline

Benta

Forum User
Regular Poster
Registered: 11/03/05
Posts: 80
Quote by: Benta[p]

That last part, some subdirectory isn't coming out with #U...only http:sitename.com.
[/p]


I was wrong about that. It works. The problem was another one:

I looked at the code, and you are sometimes (in the topic function) using the curly bracket replacing (the one for the themes). That doesn't work in static pages.... LOL
 Quote

Status: offline

jmucchiello

Forum User
Full Member
Registered: 29/08/05
Posts: 985
Quote by: Benta[p]
I looked at the code, and you are sometimes (in the topic function) using the curly bracket replacing (the one for the themes). That doesn't work in static pages.... LOL [/p]
That's just lazy of me. It should be
[code]
return "<a href=\"{$_CONF['site_url']}/index.php?topic=".urlencode($p1)."\">".htmlspecialchars($topic)."</a>";
[/code]
The global $_CONF is even there for it. I add that to my list of bug fixes.
 Quote

Status: offline

ronack

Forum User
Full Member
Registered: 27/05/03
Posts: 612
Where does this go?

I"m guessing at line 339 of functions.inc is that correct?
 Quote

Status: offline

Benta

Forum User
Regular Poster
Registered: 11/03/05
Posts: 80
Quote by: ronack[p]Where does this go?

I"m guessing at line 339 of functions.inc is that correct?[/p]


I think it is more like 354 or something. In the phpautotags_topic function anyway.

But I think that one is there more as an example on how to make php functions for autotags, which I think is very clever. A topic autotag, on the other hand, should simply have [code]<a "href=#U/index.php?topic=#1">#2</a>[/code] in the replacement field instead, it is just a link...
 Quote

Status: offline

ronack

Forum User
Full Member
Registered: 27/05/03
Posts: 612
We may be working off of different versions.

I thinking here at the bottom where it says return.
[code]function phpautotags_topic($p1, $p2, $fulltag)
{
global $_TABLES, $_CONF;

$topic = DB_getItem($_TABLES['topics'], 'topic', "tid = '$p1'" . COM_getTopicSQL('AND'Wink);
// Comment out the line above and uncomment the line below if you
// don't care whether or not users can see the names of topic they
// cannot access.
// $topic = DB_getItem($_TABLES['topics'], 'topic', "tid = '$p1'"Wink;

if (empty($topic))
return "<B>Unknown Topic</B>";
$topic = stripslashes($topic);
return "<a href=\"{site_url}/index.php?topic=$p1\">$topic</a>";
}[/code]
 Quote

Status: offline

jmucchiello

Forum User
Full Member
Registered: 29/08/05
Posts: 985
Yes, ronack, that last line of that function should be the line in my prior message.

Benta, the reason to have a topic function (aside from as an example) is to have it obey your permissions settings. Read the comment.
 Quote

Status: offline

beewee

Forum User
Full Member
Registered: 05/08/03
Posts: 969
Location:The Netherlands, where else?
Hmm, bad luck for me, the plugin doesn't work in GL 1.5 TC2, I can edit the excisting autotags, but there's no link to make a new one....

A pity, since this is one of the best plugins ever!
Dutch Geeklog sites about camping/hiking: www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net
 Quote

Status: offline

jmucchiello

Forum User
Full Member
Registered: 29/08/05
Posts: 985
I haven't tried it on 1.5 yet. I'll look into it soon.
 Quote

Status: offline

beewee

Forum User
Full Member
Registered: 05/08/03
Posts: 969
Location:The Netherlands, where else?
Quote by: jmucchiello[p]I haven't tried it on 1.5 yet. I'll look into it soon.[/p]
Well, many thanks in advance Big Grin . I'm no developer, but I saw a comment about a changed plugin API in GL 1.5RC2 somewhere.
Dutch Geeklog sites about camping/hiking: www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net
 Quote

Status: offline

mst3kroqs

Forum User
Regular Poster
Registered: 18/10/05
Posts: 78
Location:Cary, NC USA
Quote by: beewee[p]
Quote by: jmucchiello[p]I haven't tried it on 1.5 yet. I'll look into it soon.[/p]
Well, many thanks in advance Big Grin . I'm no developer, but I saw a comment about a changed plugin API in GL 1.5RC2 somewhere.[/p]

I believe it is in the area of rendering admin menus ... I think Joe may have actually written a 'compatibility wrapper' for that.

BTW - autotags did not work for me on my local 1.5.0rc2 testsite.

It seemed to install just fine, but the 'built-in' cipher/topic/lang tags show as Enabled=No, and also the poll/youtube autotags don't expand. Disable autolinks is 'False' in Configuration.
 Quote

Page navigation

All times are EST. The time is now 05:48 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content