"Fossies" - the Fresh Open Source Software Archive

Member "mythreads/lib/lib_rdf.php3" (23 Jan 2018, 1886 Bytes) of package /linux/privat/mythreads-links_1.2.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "lib_rdf.php3": 1.2.0_vs_1.2.1.

    1 <?php
    2 #----------------------------------------------------------------->
    3 # $Id: lib_rdf.php3,v 1.5 2003/12/10 22:04:38 ldrolez Exp $
    4 #
    5 # Website: http://mythreads.sourceforge.net
    6 #
    7 # Desc: lib_rdf.php3. Functions to write rdf/rss files
    8 #
    9 #
   10 # License: This code is released under the terms of the GNU GPL
   11 # version 2 or later. Please refer to www.gnu.org for a copy
   12 # of this license.
   13 #
   14 #----------------------------------------------------------------->
   15 
   16 #################################################
   17 # 
   18 #################################################
   19 function updateRSS()
   20 {
   21     global $start_script, $start_script_t, $tpl, $config, $mylink;
   22 
   23     $rss_file = $config["cache_dir"] . "news.rdf";
   24     $max_new_links = $config["max_new_links"];
   25     $max_upd_links = $config["max_upd_links"];
   26     
   27     $tpl->set_file("rss", "rss.tpl");
   28     $tpl->set_block("rss", "rss_row", "rss_rows");
   29 
   30     $result = mysqli_query($mylink, "SELECT title,idx,message,date,updated,hits,GREATEST(updated,date) AS mx, (date > updated) AS isnew FROM "
   31     .$config["pre"]."links WHERE status=0 ORDER BY mx DESC LIMIT 0,". ($max_new_links+$max_upd_links));
   32     # as we append data, make sure to reset rss_rows
   33     $tpl->set_var("rss_rows", "");
   34     while ($list = mysqli_fetch_array($result) )
   35     {
   36         $idx = $list["idx"];
   37         if ($list["isnew"] == 1) {
   38         $list["title"] .= " (".Message("new").")";
   39         }
   40         $tpl->set_var( array(
   41             "LINK_TITLE" => $list["title"], 
   42             "LINK_MESSAGE" => $list["message"],
   43             "LINK_ADDED" => $list["date"],
   44             "LINK_HITS" => $list["hits"],
   45             "LINK_GO" => $start_script_t."count=$idx",
   46             "LINK_MORE" => $start_script_t."more=$idx",
   47             "LINK_EDIT" => "$update_link&link=$idx"
   48             ));         
   49         $tpl->parse ("rss_rows", "rss_row", true);
   50     }
   51 
   52     $content = $tpl->subst("rss");
   53 
   54     $fpwrite = fopen($rss_file, 'w');
   55     fputs($fpwrite, "$content");
   56     fclose($fpwrite);
   57 }
   58