From 01a7241f69b7d1602244ce3fb1e09bef3280098b Mon Sep 17 00:00:00 2001 From: root Date: Thu, 17 Aug 2006 22:11:00 +0000 Subject: [PATCH] house keeping --- pages/index/0.php | 62 ++++++++++++++++++++++-------------------- scripts/updatesort.php | 3 ++ 2 files changed, 36 insertions(+), 29 deletions(-) diff --git a/pages/index/0.php b/pages/index/0.php index 1004fc4..3c1d4ac 100644 --- a/pages/index/0.php +++ b/pages/index/0.php @@ -23,8 +23,6 @@
  • -
    -

    - [ ]

    <", ">\n<", $rss); - $lines = explode("\n", $rss); - foreach($lines as $line) + $fp = @fopen("http://blog.CAcert.org/feed/rss/", "r"); + if($fp) { - $line = trim($line); + echo '

    '._('Latest News').' - [ '._('More News Items').' ]

    '; - if($line != "" && $open == 0) - continue; - if($line == "" && $open == 0) + while(!feof($fp)) + $rss .= trim(fgets($fp, 4096)); + fclose($fp); + $rss = str_replace("><", ">\n<", $rss); + $lines = explode("\n", $rss); + foreach($lines as $line) { - $open = 1; - continue; - } + $line = trim($line); - if($line == "" && $open == 1) - { - $items++; - if($items >= 2) - break; - $open == 0; - continue; + if($line != "" && $open == 0) + continue; + + if($line == "" && $open == 0) + { + $open = 1; + continue; + } + + if($line == "" && $open == 1) + { + $items++; + if($items >= 2) + break; + $open == 0; + continue; + } + if(substr($line, 0, 7) == "") + echo "<h3>".str_replace("&#", "&#", recode_string("UTF8..html", str_replace("&", "", trim(substr($line, 7, -8)))))."</h3>\n"; + if(substr($line, 0, 13) == "<description>") + echo "<p>".str_replace("&#", "&#", recode_string("UTF8..html", str_replace("&", "", trim(substr($line, 13, -14)))))."</p>\n"; + if(substr($line, 0, 6) == "<link>") + echo "<p>[ <a href='".trim(substr($line, 6, -7))."'>"._("Full Story")."</a> ]</p>\n"; } - if(substr($line, 0, 7) == "<title>") - echo "<h3>".str_replace("&#", "&#", recode_string("UTF8..html", str_replace("&", "", trim(substr($line, 7, -8)))))."</h3>\n"; - if(substr($line, 0, 13) == "<description>") - echo "<p>".str_replace("&#", "&#", recode_string("UTF8..html", str_replace("&", "", trim(substr($line, 13, -14)))))."</p>\n"; - if(substr($line, 0, 6) == "<link>") - echo "<p>[ <a href='".trim(substr($line, 6, -7))."'>"._("Full Story")."</a> ]</p>\n"; } ?> diff --git a/scripts/updatesort.php b/scripts/updatesort.php index 9a6f140..53b784d 100755 --- a/scripts/updatesort.php +++ b/scripts/updatesort.php @@ -2,6 +2,8 @@ <? include_once("../includes/mysql.php"); + mysql_query("update `locations` set `acount`=0"); + $query = "SELECT `users`.`locid` AS `locid`, count(*) AS `total` FROM `users`, `notary` WHERE `users`.`id` = `notary`.`to` AND `users`.`locid` != 0 GROUP BY `users`.`id`, `users`.`locid` @@ -10,6 +12,7 @@ while($row = mysql_fetch_assoc($res)) { $query = "update `locations` set `acount`='${row['total']}' where `id`='${row['locid']}'"; +// echo $query."\n"; mysql_query($query); } ?>