Author: gassla
Date: Mon Jun  4 12:56:41 2007
New Revision: 497

URL: http://svn.gna.org/viewcvs/phplinker?rev=497&view=rev
Log:
#147

Added:
    trunk/www/admin/api/fetch_login_tag.php   (with props)
Modified:
    trunk/www/lib/url.php

Added: trunk/www/admin/api/fetch_login_tag.php
URL: 
http://svn.gna.org/viewcvs/phplinker/trunk/www/admin/api/fetch_login_tag.php?rev=497&view=auto
==============================================================================
--- trunk/www/admin/api/fetch_login_tag.php (added)
+++ trunk/www/admin/api/fetch_login_tag.php Mon Jun  4 12:56:41 2007
@@ -1,0 +1,52 @@
+<?php
+/*
+    This file is part of PHPLinker.
+
+    PHPLinker is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    PHPLinker is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with PHPLinker; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+  /**
+   * @version $Id$
+   * @copyright Copyright (c) by ISVTEC
+   * @license GPL v2
+   */
+?>
+<?php
+require($_SERVER['DOCUMENT_ROOT']."/includes/start.php");
+
+if ( !is_allowed_ip($_SERVER['REMOTE_ADDR']) ){
+  echo("error\t"._("You're not allowed to access this script!"));
+  exit;
+ }
+
+$q="SELECT webmaster.login, url.id FROM ".
+  " webmaster INNER JOIN url ON webmaster.id=url.id_webmaster" ;
+$res =  sql_query('die',__FILE__,__LINE__,__FUNCTION__,$q);
+
+header("Content-type: text/plain");
+while(list($login,$id_url)=mysql_fetch_array($res)){
+  $categories=linker_url_get_categories($id_url);
+  $tag="default";
+  foreach($categories as $id_categ){
+    $tags=linker_category_get_tags($id_categ);
+    foreach($tags as $tag_info){
+      if( !empty($tag_info['description']) ){
+         $tag=$tag_info['description'];
+         break 2;
+       }
+    }
+  }
+  printf("%s\t%s\n",$login,$tag);
+}
+?>

Propchange: trunk/www/admin/api/fetch_login_tag.php
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: trunk/www/lib/url.php
URL: 
http://svn.gna.org/viewcvs/phplinker/trunk/www/lib/url.php?rev=497&r1=496&r2=497&view=diff
==============================================================================
--- trunk/www/lib/url.php (original)
+++ trunk/www/lib/url.php Mon Jun  4 12:56:41 2007
@@ -141,4 +141,15 @@
   return false;
 }
 
+function linker_url_get_categories($id_url){
+  $result=array();
+  if( osh_check_unsigned_int($id_url) ){
+    $q="SELECT id_category FROM url2category WHERE id_url=$id_url ";
+    $res=sql_query('die', __FILE__, __LINE__, __FUNCTION__,$q);
+    while(list($id_categ)=mysql_fetch_array($res))
+      $result[]=$id_categ;
+  }
+  return $result;
+}
+
 ?>


_______________________________________________
PHPLinker-commits mailing list
[email protected]
https://mail.gna.org/listinfo/phplinker-commits

Reply via email to