Welcome to Geeklog Monday, October 23 2017 @ 09:57 pm EDT


Status: offline

jmucchiello

Forum User
Full Member
Registered: 29/08/2005
Posts: 985
Actually, I need you to look at your database because when I put
PHP Formatted Code
<a href="http://en.wikipedia.org/wiki/#1">#2</a>
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?

Status: offline

ronack

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

PHP Formatted Code
<a href="http://en.wikipedia.org/wiki/#1">#2</a>

I save it then it looks like this

PHP Formatted Code
<a href=\"http://en.wikipedia.org/wiki/#1\">#2</a>

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

PHP Formatted Code
               $subject = stripslashes($record['replacement']);

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.


Status: offline

ronack

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


Status: offline

jmucchiello

Forum User
Full Member
Registered: 29/08/2005
Posts: 985
Quote by: ronack
PHP Formatted Code
<a href=\"http://en.wikipedia.org/wiki/#1\">#2</a>
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?

Status: offline

ronack

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

At least the source of half of the weirdness.

Status: offline

jmucchiello

Forum User
Full Member
Registered: 29/08/2005
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:
PHP Formatted 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']));

I'll package and release a real update shortly.

Status: offline

ronack

Forum User
Full Member
Registered: 27/05/2003
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

Status: offline

ronack

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

Status: offline

Benta

Forum User
Regular Poster
Registered: 11/03/2005
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!

Status: offline

Benta

Forum User
Regular Poster
Registered: 11/03/2005
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)

Status: offline

Benta

Forum User
Regular Poster
Registered: 11/03/2005
Posts: 80
Quote by: Benta



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



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

Status: offline

jmucchiello

Forum User
Full Member
Registered: 29/08/2005
Posts: 985
Quote by: Benta


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

That's just lazy of me. It should be
PHP Formatted Code

    return "<a href=\"{$_CONF['site_url']}/index.php?topic=".urlencode($p1)."\">".htmlspecialchars($topic)."</a>";
 

The global $_CONF is even there for it. I add that to my list of bug fixes.

Status: offline

ronack

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

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

Status: offline

Benta

Forum User
Regular Poster
Registered: 11/03/2005
Posts: 80
Quote by: ronack

Where does this go?

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



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
PHP Formatted Code
<a "href=#U/index.php?topic=#1">#2</a>
in the replacement field instead, it is just a link...

Status: offline

ronack

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

I thinking here at the bottom where it says return.
PHP Formatted Code
function phpautotags_topic($p1, $p2, $fulltag)
{
    global $_TABLES, $_CONF;
   
    $topic = DB_getItem($_TABLES['topics'], 'topic', "tid = '$p1'" . COM_getTopicSQL('AND'));
    // 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'");
   
    if (empty($topic))
        return "<B>Unknown Topic</B>";
    $topic = stripslashes($topic);
    return "<a href=\"{site_url}/index.php?topic=$p1\">$topic</a>";
}

Status: offline

jmucchiello

Forum User
Full Member
Registered: 29/08/2005
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.

Status: offline

beewee

Forum User
Full Member
Registered: 05/08/2003
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

Status: offline

jmucchiello

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

Status: offline

beewee

Forum User
Full Member
Registered: 05/08/2003
Posts: 969
Location:The Netherlands, where else?
Quote by: jmucchiello

I haven't tried it on 1.5 yet. I'll look into it soon.

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

Status: offline

mst3kroqs

Forum User
Regular Poster
Registered: 18/10/2005
Posts: 78
Location:Cary, NC USA
Quote by: beewee

Quote by: jmucchiello

I haven't tried it on 1.5 yet. I'll look into it soon.

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.


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.

All times are EDT. The time is now 09:57 pm.

  • 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