Пример #1
0
 function config_xml_normalize($config)
 {
     // DEBUG
     //  echo '<pre><tt>';
     //  print_r ($config);
     //exit;
     // turn XML into array
     for ($i = 0; isset($config[$i]); $i++) {
         $a[] = rss2array($config[$i]);
     }
     // merge multiple config XML
     for ($i = 1; isset($a[$i]); $i++) {
         for ($j = 0; isset($a[$i]['item'][$j]); $j++) {
             $a[0]['item'][] = $a[$i]['item'][$j];
         }
         //      unset ($a[$i]);
     }
     $a = $a[0];
     // DEBUG
     //  echo '<pre><tt>';
     //  print_r ($a);
     //exit;
     // sanity check
     /*
       $insane = 0;
       for ($i = 0; isset ($a['item'][$i]); $i++)
         for ($j = $i + 1; isset ($a['item'][$j]); $j++)
           if (trim ($a['item'][$i]['category']) == trim ($a['item'][$j]['category']) &&  trim ($a['item'][$j]['category']) != '')
             {
               echo 'ERROR: duplicate category: '.$a['item'][$j]['category']."<br>";
               $insane = 1;
             }
       if ($insane == 1)
         exit;
     */
     // DEBUG
     //  echo '<pre><tt>';
     //  print_r ($a);
     //  echo generate_rss2 ($a['channel'], $a['item'], 1, 1);
     //  exit;
     return array('channel' => rsscache_default_channel(), 'item' => $a['item']);
 }
Пример #2
0
 function rsscache_sql_normalize($d)
 {
     global $rsscache_root, $rsscache_link, $rsscache_related_search;
     $debug = 0;
     for ($i = 0; isset($d[$i]); $i++) {
         // trim and lower-case categories
         //      $d[$i]['tv2_category'] = strtolower (trim ($d[$i]['tv2_category']));
         $d[$i]['tv2_moved'] = strtolower(trim($d[$i]['tv2_moved']));
         //      $d[$i]['rsstool_related_id'] = misc_related_string_id ($d[$i]['rsstool_title']);
         $d[$i]['rsstool_related_id'] = sprintf("%u", $d[$i]['rsstool_related_id']);
     }
     return array('channel' => rsscache_default_channel(), 'item' => rsscache_sql2array($d));
 }
Пример #3
0
     header('Content-type: text/plain');
     echo rsscache_write_robots();
     exit;
 }
 rsscache_sql_open();
 if ($f == 'cache') {
     if ($c) {
         ob_start();
         rsscache_download_feeds_by_category($c);
         $p = str_replace("\n", "<br>\n", ob_get_contents());
         ob_end_clean();
         $p .= '<br><br>success';
     } else {
         $p = '&c=CATEGORY required';
     }
     $a = array('channel' => rsscache_default_channel(), 'item' => NULL);
     $a['channel']['description'] = $p;
 } else {
     if ($f == 'config' || $f == 'stats' || $output == 'sitemap') {
         $config = rsscache_add_stats($config);
         $a = $config;
     } else {
         // use SQL
         if ($item) {
             $a = rsscache_sql($c, NULL, $f, $item, 0, 0);
         } else {
             $a = rsscache_sql($c, $q, $f, NULL, $start, $num ? $num : 0);
         }
     }
 }
 rsscache_sql_close();