[geeklog-cvs] Geeklog-1.x/plugins/links functions.inc,1.102,1.103

Dirk Haun dhaun at qs1489.pair.com
Wed Jan 2 04:42:09 EST 2008


Update of /cvsroot/geeklog/Geeklog-1.x/plugins/links
In directory qs1489.pair.com:/tmp/cvs-serv35400/plugins/links

Modified Files:
	functions.inc 
Log Message:
Reinstate the target site's URL as the link title (since it's obscured by the reidirect via portal.php and the site's title is usually redundant)


Index: functions.inc
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/plugins/links/functions.inc,v
retrieving revision 1.102
retrieving revision 1.103
diff -C2 -d -r1.102 -r1.103
*** functions.inc	1 Jan 2008 20:03:22 -0000	1.102
--- functions.inc	2 Jan 2008 09:42:07 -0000	1.103
***************
*** 125,159 ****
      // Get newest links
      $sql = "SELECT lid,title FROM {$_TABLES['links']} WHERE (date >= (DATE_SUB(NOW(), INTERVAL {$_LI_CONF['newlinksinterval']} SECOND)))" . COM_getPermSQL( 'AND' ) . ' ORDER BY date DESC LIMIT 15';
!     $result = DB_query( $sql );
!     $nrows = DB_numRows( $result );
  
!     if( $nrows > 0 )
!     {
          $newlinks = array();
!         for( $x = 0; $x < $nrows; $x++ )
!         {
!             $A = DB_fetchArray( $result );
!             $A['title'] = stripslashes( $A['title'] );
  
              // redirect link via portal.php so we can count the clicks
!             $lcount = COM_buildUrl( $_CONF['site_url']
!                     . '/links/portal.php?what=link&item=' . $A['lid'] );
  
!             $title = COM_truncate( $A['title'], $_CONF['title_trim_length'],
!                                    '...' );
              $link_title = array();
!             if( $title != $A['title'] )
!             {
!                 $link_title = array('title'=>$A['title']);
              }
  
!             $newlinks[] = COM_createLink(
!                 $title, $lcount, $link_title) . LB;
          }
  
!         $retval .= COM_makeList( $newlinks, 'list-new-plugins' );
!     }
!     else
!     {
          $retval .= $LANG_LINKS[88] . '<br' . XHTML . '>' . LB;
      }
--- 125,153 ----
      // Get newest links
      $sql = "SELECT lid,title FROM {$_TABLES['links']} WHERE (date >= (DATE_SUB(NOW(), INTERVAL {$_LI_CONF['newlinksinterval']} SECOND)))" . COM_getPermSQL( 'AND' ) . ' ORDER BY date DESC LIMIT 15';
!     $result = DB_query($sql);
!     $nrows = DB_numRows($result);
  
!     if ($nrows > 0) {
          $newlinks = array();
!         for ($x = 0; $x < $nrows; $x++) {
!             $A = DB_fetchArray($result);
!             $A['title'] = stripslashes($A['title']);
  
              // redirect link via portal.php so we can count the clicks
!             $lcount = COM_buildUrl($_CONF['site_url']
!                     . '/links/portal.php?what=link&item=' . $A['lid']);
  
!             $title = COM_truncate($A['title'], $_CONF['title_trim_length'],
!                                   '...');
              $link_title = array();
!             if ($title != $A['title']) {
!                 $link_title = array('title' => $A['title']);
              }
  
!             $newlinks[] = COM_createLink($title, $lcount, $link_title) . LB;
          }
  
!         $retval .= COM_makeList($newlinks, 'list-new-plugins');
!     } else {
          $retval .= $LANG_LINKS[88] . '<br' . XHTML . '>' . LB;
      }
***************
*** 182,192 ****
                              . '/links/portal.php?what=link&item=' . $lid);
          if (empty($autotag['parm2'])) {
!             $linktext = stripslashes(DB_getItem($_TABLES['links'],
!                                      'title', "lid = '$lid'"));
          } else {
              $linktext = $autotag['parm2'];
          }
          $attr = array(
!                     'title' => $linktext,
                      'class' => 'ext-link'
                       );
--- 176,187 ----
                              . '/links/portal.php?what=link&item=' . $lid);
          if (empty($autotag['parm2'])) {
!             $result = DB_query("SELECT url, title FROM {$_TABLES['links']} WHERE lid = '$lid'");
!             list($siteurl, $linktext) = DB_fetchArray($result);
          } else {
              $linktext = $autotag['parm2'];
+             $siteurl = DB_getItem($_TABLES['links'], 'url', "lid = '$lid'");
          }
          $attr = array(
!                     'title' => $siteurl,
                      'class' => 'ext-link'
                       );
***************
*** 274,279 ****
              $url = COM_buildUrl ($_CONF['site_url']
                          . '/links/portal.php?what=link&item=' . $A['lid']);
!             $sid = '<a href="' . $url . '" title="' . $A['url'] . '">' . $title
!                  . '</a>';
              $hits = COM_numberFormat ($A['hits']);
              $data_arr[] = array('title' => $title,
--- 269,273 ----
              $url = COM_buildUrl ($_CONF['site_url']
                          . '/links/portal.php?what=link&item=' . $A['lid']);
!             $sid = COM_createLink($title, $url, array('title' => $A['url']));
              $hits = COM_numberFormat ($A['hits']);
              $data_arr[] = array('title' => $title,
***************
*** 455,462 ****
              $profile = $submitter;
          }
!         $linkUrl = COM_buildURL ($_CONF['site_url']
!                                  . '/links/portal.php?what=link&item='
!                                  . $A['lid']);
!         $anchor = COM_createLink($A['title'], $linkUrl, array('title'=> $A['url']));
          $row = array ($anchor, $thetime[0], $profile,
                        COM_NumberFormat ($A['hits']));
--- 449,457 ----
              $profile = $submitter;
          }
!         $linkUrl = COM_buildUrl($_CONF['site_url']
!                                 . '/links/portal.php?what=link&item='
!                                 . $A['lid']);
!         $anchor = COM_createLink($A['title'], $linkUrl,
!                                  array('title' => $A['url']));
          $row = array ($anchor, $thetime[0], $profile,
                        COM_NumberFormat ($A['hits']));
***************
*** 1476,1480 ****
      if (!empty($topic)) {
          $tid = addslashes($topic);
!         $result = DB_query("SELECT l.lid, l.title, c.cid FROM {$_TABLES['links']} AS l LEFT JOIN {$_TABLES['linkcategories']} AS c ON l.cid=c.cid WHERE c.tid='{$tid}' OR c.tid='all'" . COM_getPermSQL('AND', 0, 2, 'c'));
          $nrows = DB_numRows($result);
          if ($nrows > 0) {
--- 1471,1475 ----
      if (!empty($topic)) {
          $tid = addslashes($topic);
!         $result = DB_query("SELECT l.lid, l.title, l.url, c.cid FROM {$_TABLES['links']} AS l LEFT JOIN {$_TABLES['linkcategories']} AS c ON l.cid=c.cid WHERE c.tid='{$tid}' OR c.tid='all'" . COM_getPermSQL('AND', 0, 2, 'c'));
          $nrows = DB_numRows($result);
          if ($nrows > 0) {
***************
*** 1482,1487 ****
                  $A = DB_fetchArray($result);
                  $content = stripslashes($A['title']);
!                 $url = $_CONF['site_url'] . '/links/portal.php?what=link&item=' . $A['lid'];
!                 $retval .= COM_createLink($content, $url) . '<br' . XHTML . '>';
              }
          }
--- 1477,1485 ----
                  $A = DB_fetchArray($result);
                  $content = stripslashes($A['title']);
!                 $url = COM_buildUrl($_CONF['site_url']
!                      . '/links/portal.php?what=link&item=' . $A['lid']);
!                 $retval .= COM_createLink($content, $url,
!                                           array('title' => $A['url']))
!                         . '<br' . XHTML . '>';
              }
          }




More information about the geeklog-cvs mailing list