[geeklog-hg] geeklog: Tweaks to the [topic:] autotag: Use the Topic Name as t...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sat May 11 13:38:17 EDT 2013


changeset 9065:cc72bb2d6ad6
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/cc72bb2d6ad6
user: Dirk Haun <dirk at haun-online.de>
date: Sat May 11 19:14:27 2013 +0200
description:
Tweaks to the [topic:] autotag: Use the Topic Name as the default link text; also check topic permissions (feature request #0001490)

diffstat:

 system/lib-topic.php |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (30 lines):

diff -r 95ba39b996f4 -r cc72bb2d6ad6 system/lib-topic.php
--- a/system/lib-topic.php	Sat May 11 19:01:40 2013 +0200
+++ b/system/lib-topic.php	Sat May 11 19:14:27 2013 +0200
@@ -203,21 +203,22 @@
 
     elseif ($op == 'parse') {
         $tid = COM_applyFilter($autotag['parm1']);
-        $tid = DB_escapeString($tid);
-        if(! empty($tid)) {
-            $sql = "SELECT COUNT(*) as count FROM {$_TABLES['topics']} where tid = '$tid'";
+        if (!empty($tid) && (SEC_hasTopicAccess($tid) > 0)) {
+            $tid = DB_escapeString($tid);
+            $sql = "SELECT COUNT(*) AS count FROM {$_TABLES['topics']} WHERE tid = '$tid'";
             $result = DB_query($sql);
             $A = DB_fetchArray($result);
             if ($A['count'] == 1) {
                 $url = COM_buildUrl($_CONF['site_url'] . '/index.php?topic=' . $tid);
                 $linktext = $autotag['parm2'];
                 if (empty($linktext)) {
-                    $linktext = stripslashes(DB_getItem($_TABLES['topics'],'meta_description', "tid = '$tid'"));
+                    $linktext = stripslashes(DB_getItem($_TABLES['topics'], 'topic', "tid = '$tid'"));
                 }
                 $link = COM_createLink($linktext, $url);
                 $content = str_replace($autotag['tagstr'], $link, $content);
             }
         }
+
         return $content;
     }
 }



More information about the geeklog-cvs mailing list