Author: rhari
Date: Fri Jun 1 08:36:29 2007
New Revision: 490
URL: http://svn.gna.org/viewcvs/phplinker?rev=490&view=rev
Log:
#223
Added:
trunk/www/admin/api/update_url_info.php
Added: trunk/www/admin/api/update_url_info.php
URL:
http://svn.gna.org/viewcvs/phplinker/trunk/www/admin/api/update_url_info.php?rev=490&view=auto
==============================================================================
--- trunk/www/admin/api/update_url_info.php (added)
+++ trunk/www/admin/api/update_url_info.php Fri Jun 1 08:36:29 2007
@@ -1,0 +1,101 @@
+<?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
+*/
+?>
+<?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;
+ }
+
+extract($_GET);
+if (!isset ($id)){
+ echo ("error\t"._("Missing site ids"));
+ exit;
+ }
+
+if (!isset ($email)){
+ echo ("error\t"._("Missing webmaster email address"));
+ exit;
+ }
+
+if (!isset ($description)){
+ echo ("error\t"._("Missing description"));
+ exit;
+ }
+
+if (!isset ($login)){
+ echo ("error\t"._("Missing webmaster logins"));
+ exit;
+ }
+
+$qry = "SELECT count(*) AS nb FROM url WHERE id = ".$id;
+$qry = sql_query('die',__FILE__,__LINE__,__FUNCTION__,$qry);
+$nb = mysql_result($qry, 0, "nb");
+if ($nb < 1){
+ echo ("error\t"._("This id (".$id.") does not exist"));
+ exit;
+ }
+
+if (!isset($category) or sizeof($category) == 0)
+ $categorized = 0;
+else
+ $categorized = 1;
+
+if (!isset($debug)){
+ $debug = 0;
+ }
+
+// echo 'url : '.$url.'<br>';
+// echo 'email : '.$email.'<br>';
+// echo 'description : '.utf8_decode($description).'<br>';
+// echo '<pre>';
+// print_r ($category);
+// echo '</pre>';
+// echo sizeof($category);
+
+$qry = "UPDATE url SET
+ description = '".utf8_decode($description)."',
+ last_update = '".date("Y-m-d h:i:s")."'
+ WHERE
+ id = ".$id;
+sql_query('die',__FILE__,__LINE__,__FUNCTION__,$qry);
+
+$qry = "UPDATE webmaster SET
+ email = '".utf8_decode($email)."',
+ login = '".utf8_decode($login)."'
+ WHERE
+ id IN (SELECT id_webmaster FROM url WHERE id = ".$id.")";
+sql_query('die',__FILE__,__LINE__,__FUNCTION__,$qry);
+
+if ($categorized == 1){
+ $know_first = sql_query('die',__FILE__,__LINE__,__FUNCTION__,"DELETE FROM
url2category WHERE id_url = ".$id);
+ foreach($category as $value){
+ $qry = "SELECT count(*) AS nb FROM category WHERE id = ".$value;
+ $qry = sql_query('die',__FILE__,__LINE__,__FUNCTION__,$qry);
+ $nb_cat = mysql_result($qry, 0, "nb");
+ if (is_numeric($value) && $nb_cat > 0)
+ $update_cat_url =
sql_query('die',__FILE__,__LINE__,__FUNCTION__,"INSERT INTO url2category
(id_url, id_category) VALUES (".$id.",".$value.")");
+ }
+ }
+
+linker_log("[API : ".$_SERVER['REMOTE_ADDR'] ."] Update URL url_".$id);
+printf("OK");
+?>
_______________________________________________
PHPLinker-commits mailing list
[email protected]
https://mail.gna.org/listinfo/phplinker-commits