Difference between revisions of "Template:Mainpage-rssfeeds"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
(Usage:)
Line 32: Line 32:
 
{|
 
{|
 
|-
 
|-
||charset=...   ||         The charset used by the feed. iconv is used to convert this.
+
|| <tt>charset = ...</tt>            ||The charset used by the feed. iconv is used to convert this.
 
|-
 
|-
|| short         ||         Do not show the description text for each news item.
+
|| <tt>short</tt>                  ||Do not show the description text for each news item.
 
|-
 
|-
|| max=x         ||         Shows x most recent headlines.
+
|| <tt>max = x</tt>                  ||Shows x most recent headlines.
 
|-
 
|-
|| highlight= term1 term2 || The terms separated by a space are highlighted.
+
|| <tt>highlight = term1 term2</tt>  ||The terms separated by a space are highlighted.
 
|-
 
|-
|| filter= term1 term2    ||Show only rss items containing at least one of the terms.
+
|| <tt>filter = term1 term2</tt>     ||Show only rss items containing at least one of the terms.
 
|-
 
|-
|| reverse                ||display the rss items in reverse order.
+
|| <tt>reverse</tt>                 ||display the rss items in reverse order.
 
|-
 
|-
|| title=x                ||display an alternative title instead of chanel name.
+
|| <tt>title = x</tt>                 ||display an alternative title instead of chanel name.
 
|-
 
|-
|| title = none            ||dont display any title.
+
|| <tt>title = none</tt>           ||dont display any title.
 
|}
 
|}
  
 
===Example:===  
 
===Example:===  
<nowiki><rss>http://slashdot.org/slashdot.rss|charset=UTF-8|short|max=5</rss></nowiki>
+
<tt><nowiki><rss>http://slashdot.org/slashdot.rss|charset=UTF-8|short|max=5</rss></nowiki></tt>
  
 
<rss>http://slashdot.org/slashdot.rss|charset=UTF-8|short|max=5</rss>
 
<rss>http://slashdot.org/slashdot.rss|charset=UTF-8|short|max=5</rss>
  
<pre><nowiki>
 
  
 
===rss.php===  
 
===rss.php===  
 
+
<pre><nowiki>
 
<?php
 
<?php
 
# RSS-Feed Mediawiki extension
 
# RSS-Feed Mediawiki extension

Revision as of 16:31, 29 July 2006

UNIQ95e293c31af278dc-rss-00000000-QINU UNIQ95e293c31af278dc-rss-00000001-QINU

GISWiki/RSS

Uses an extension from: http://meta.wikimedia.org/wiki/GISWiki/RSS

RSS-Feed Mediawiki extension

  • original by mutante 25.03.2005
  • extended by Duesentrieb 30.04.2005
  • extended by Rdb78 07.07.2005
  • extended by Mafs 10.07.2005, 24.07.2005
  • extended by User:Arcy 07.09.2005
  • Updated for MediaWiki 1.6 by User:piku 13.06.2006
  • Update for Wikicode output, by User:cogdog 14.jul.2006

Requires:

Installation:

  • put this file (rss.php) into the extension directory of your mediawiki installation
  • add the following to the end of LocalSettings.php: include("extensions/rss.php");
  • make sure magpie can be found by PHP.

Usage:

Use one section between <rss>-tags for each feed. The rss section may contain parameters separated by a pipe ("|"), just like links and templates. These parameters are supported:

charset = ... The charset used by the feed. iconv is used to convert this.
short Do not show the description text for each news item.
max = x Shows x most recent headlines.
highlight = term1 term2 The terms separated by a space are highlighted.
filter = term1 term2 Show only rss items containing at least one of the terms.
reverse display the rss items in reverse order.
title = x display an alternative title instead of chanel name.
title = none dont display any title.

Example:

<rss>http://slashdot.org/slashdot.rss|charset=UTF-8|short|max=5</rss>

Fasting Diet 'Regenerates Diabetic Pancreas'

Sat, 25 Feb 2017 03:30:00

According to a new study published in the journal Cell, a certain type of fasting diet can trigger the pancreas to regenerate itself. Of course, the researchers advise people not to try this without medical advice. BBC reports: In the experiments, mice were put on a modified form of the "fasting-mimicking diet." It is like the human form of the diet when people spend five days on a low calorie, low protein, low carbohydrate but high unsaturated-fat diet. It resembles a vegan diet with nuts and soups, but with around 800 to 1,100 calories a day. Then they have 25 days eating what they want -- so overall it mimics periods of feast and famine. Previous research has suggested it can slow the pace of aging. But animal experiments showed the diet regenerated a special type of cell in the pancreas called a beta cell. These are the cells that detect sugar in the blood and release the hormone insulin if it gets too high. There were benefits in both type 1 and type 2 diabetes in the mouse experiments. Type 1 is caused by the immune system destroying beta cells and type 2 is largely caused by lifestyle and the body no longer responding to insulin. Further tests on tissue samples from people with type 1 diabetes produced similar effects.

Share on Google+


Read more of this story at Slashdot.

Appeals Court: You Have the Right To Film the Police

Sat, 25 Feb 2017 02:05:00

An anonymous reader quotes a report from Ars Technica: A divided federal appeals court is ruling for the First Amendment, saying the public has a right to film the police. But the 5th U.S. Circuit Court of Appeals, in upholding the bulk of a lower court's decision against an activist who was conducting what he called a "First Amendment audit" outside a Texas police station, noted that this right is not absolute and is not applicable everywhere. The facts of the dispute are simple. Phillip Turner was 25 in September 2015 when he decided to go outside the Fort Worth police department to test officers' knowledge of the right to film the police. While filming, he was arrested for failing to identify himself to the police. Officers handcuffed and briefly held Turner before releasing him without charges. Turner sued, alleging violations of his Fourth Amendment right against unlawful arrest and detention and his First Amendment right of speech. The 2-1 decision Thursday by Judge Jacques Wiener is among a slew of rulings on the topic, and it provides fresh legal backing for the so-called YouTube society where people are constantly using their mobile phones to film themselves and the police. A dissenting appellate judge on the case -- Edith Brown Clement -- wrote Turner was not unlawfully arrested and that the majority opinion from the Texas-based appeals court jumped the gun to declare a First Amendment right here because one "is not clearly established."

Share on Google+


Read more of this story at Slashdot.

ZeniMax Files Injunction To Stop Oculus From Selling VR Headsets

Sat, 25 Feb 2017 01:25:00

ZeniMax, the parent company of Fallout and Skyrim developer Bethesda, has filed for an injunction against virtual-reality company Oculus over the recent stolen technology case. The company had accused Oculus of stealing VR-related code, and was subsequently awarded $500 million by a Dallas court earlier this month. ZeniMax has now filed additional papers against Oculus, requesting that Oculus' products using the stolen code be removed from sale. GameSpot reports: Specifically, ZeniMax is seeking to block sales of its mobile and PC developer kits, as well as technology allowing the integration of Oculus Rift with development engines Unreal and Unity, reports Law360. If the injunction isn't granted, ZeniMax wants a share of "revenues derived from products incorporating its intellectual properties," suggesting a 20 percent cut for at least 10 years. ZeniMax argues the previous settlement of $500 million is "insufficient incentive for [Oculus] to cease infringing." Oculus, meanwhile, says that "ZeniMax's motion does not change the fact that the [original] verdict was legally flawed and factually unwarranted. We look forward to filing our own motion to set aside the jury's verdict and, if necessary, filing an appeal that will allow us to put this litigation behind us," the virtual reality company stated.

Share on Google+


Read more of this story at Slashdot.

Slashdot Asks: Are Curved TVs Worth It?

Sat, 25 Feb 2017 00:45:00

New submitter cherishjoo shares a report written by David Katzmaier via CNET: When the first curved TVs appeared more than three years ago I asked whether they were a gimmick. As a TV reviewer I had to give the curve a fighting chance, however, so I took a curved Samsung home to live with my family for awhile, in addition to subjecting it to a full CNET review. In the end, I answered my own question with the headline "Great picture quality, but the curved screen is a flat-out gimmick." Since then most of the video geeks I know, including just about everybody I hear from on Twitter, Facebook and article comments, pooh-poohs curved TV screens as a useless distraction. A curved TV takes the traditional flat screen and bends it along a gentle arc. The edges end up a bit closer, ostensibly providing a slight wraparound effect. Curved TV makers, citing huge curved screens like IMAX, call their sets more "immersive" than their flat counterparts, but in my experience that claim doesn't hold water at in-home (as opposed to theatrical) screen sizes and viewing distances. The only real image-quality benefit I saw to the curve was a reduction in reflections in some cases. That benefit wasn't worth the slight geometric distortions introduced by the curve, not to mention its awkwardness when hung on the wall. That said, the curve doesn't ruin an otherwise good picture. In TVs, assuming similar prices, curved vs. flat boils down to a choice of aesthetics. As Katzmaier mentioned, curved TVs have been on the market for several years now, and while manufacturers continue to produce them, the verdict on whether or not the pros outweigh the cons is still murky. Here's our question for you: Are curved televisions worth the inflated price tag? If you are in the market for a new TV, does the fact that the display is curved entice you or steer you away?

Share on Google+


Read more of this story at Slashdot.

World's Largest Spam Botnet Adds DDoS Feature

Sat, 25 Feb 2017 00:05:00

An anonymous reader writes from a report via BleepingComputer: Necurs, the world's largest spam botnet with nearly five million infected bots, of which one million are active each day, has added a new module that can be used for launching DDoS attacks. The sheer size of the Necurs botnet, even in its worst days, dwarfs all of today's IoT botnets. The largest IoT botnet ever observed was Mirai Botnet #14 that managed to rack up around 400,000 bots towards the end of 2016 (albeit the owner of that botnet has now been arrested). If this new feature were to ever be used, a Necurs DDoS attack would easily break every DDoS record there is. Fortunately, no such attack has been seen until now. Until now, the Necurs botnet has been seen spreading the Dridex banking trojan and the Locky ransomware. According to industry experts, there's a low chance we'd see the Necurs botnet engage in DDoS attacks because the criminal group behind the botnet is already making too much money to risk exposing their full infrastructure in DDoS attacks.

Share on Google+


Read more of this story at Slashdot.


rss.php

<?php
# RSS-Feed Mediawiki extension
# 
# original by mutante 25.03.2005
# extended by Duesentrieb 30.04.2005
# extended by Rdb78 07.07.2005
# extended by Mafs  10.07.2005, 24.07.2005
# extended by User:Arcy  07.09.2005
# Updated for MediaWiki 1.6 by User:piku 13.06.2006
# Update for Wikicode output, by User:cogdog 14.jul.2006
#
# Requires: 
#  * magpie rss parser <http://magpierss.sourceforge.net/>
#  * iconv <http://www.gnu.org/software/libiconv/>, see also <http://www.php.net/iconv>
#
# Installation:
#  * put this file (rss.php) into the extension directory of your mediawiki installation 
#  * add the following to the end of LocalSettings.php: include("extensions/rss.php");
#  * make sure magpie can be found by PHP.
#
# Usage:
#  Use one section between <rss>-tags for each feed. The rss section may contain parameters
#  separated by a pipe ("|"), just like links and templates. These parameters are supported:
#
#    * charset=...             The charset used by the feed. iconv is used to convert this.
#    * short                   Do not show the description text for each news item.
#    * max=x                   Shows x most recent headlines.
#    * highlight= term1 term2  The terms separated by a space are highlighted.
#    * filter= term1 term2     Show only rss items containing at least one of the terms.
#    * reverse                 display the rss items in reverse order.
#    * title=x                 display an alternative title instead of chanel name.
#    * title = none            dont display any title.
#
# Example: 
#    <rss>http://slashdot.org/slashdot.rss|charset=UTF-8|short|max=5</rss>
#

#change this according to your magpie installation!
require_once('rss_fetch.inc'); 

#install extension hook
$wgExtensionFunctions[] = "wfRssExtension"; 

#extension hook callback function
function wfRssExtension() { 
  global $wgParser;

  #install parser hook for <rss> tags
  $wgParser->setHook( "rss", "renderRss" );
}

#parser hook callback function
function renderRss($input, $argv, $parser = null) {
  if (!$parser) $parser =& $GLOBALS['wgParser'];
  global $wgOutputEncoding;

  $DefaultEncoding = "ISO-8859-1";
  $DisableCache = true;

  # $input = mysql_escape_string($input);

  if (!$input) return ""; #if <rss>-section is empty, return nothing

  #parse fields in rss-section
  $fields= explode("|",$input);
  $url= @$fields[0];

  $args= array();
  for ($i=1; $i<sizeof($fields); $i++) {
    $f= $fields[$i];

    if (strpos($f,"=")===False) $args[strtolower(trim($f))]= False;
    else {
      list($k,$v)= explode("=",$f,2);
      if (trim($v)==False) $args[strtolower(trim($k))] = False; 
      else $args[strtolower(trim($k))]= trim($v);
    }
  }

  #get charset from argument-array    
  $charset= @$args["charset"];
  if (!$charset) $charset= $DefaultEncoding;

  #get max number of headlines from argument-array
  $maxheads = @$args["max"];
  $headcnt = 0;

  #get short-flag from argument-array
  #if short is set, no description text is printed
  if (isset($args["short"])) $short = True; else $short = False;

  #get reverse-flag from argument-array
  if (isset($args["reverse"])) $reverse = True; else $reverse = False;

  #get highlight terms from argument-array    
  $rssHighlight= @$args["highlight"];
  $rssHighlight= str_replace("  "," ", $rssHighlight);
  $rssHighlight= explode(" ", trim($rssHighlight));

  #get filter terms from argument-array    
  $rssFilter= @$args["filter"];
  $rssFilter= str_replace("  "," ", $rssFilter);
  $rssFilter= explode(" ", trim($rssFilter));    

  #fetch rss. may be cached locally.
  #Refer to the documentation of magpie for details.
  $rss = @fetch_rss($url);


  #check for errors.
  if ($rss->ERROR) {
     # return "Feed error"; #localize...
      #return "<div>Failed to load RSS feed from $url: ".$rss->ERROR."</div>"; #localize...
  }

  if (!is_array($rss->items)) {
     # return "Feed error"; #localize...
      #return "<div>Failed to load RSS feed from $url!</div>"; #localize...
  }

  #Bild title line    
  #get title from argument-array    
  
  $rssTitle= @$args["title"];
  $rssTitle= trim($rssTitle);

  if ($rssTitle !=='none') {
    if ($rssTitle=='') {
        $title= iconv($charset,$wgOutputEncoding,$rss->channel['title']);
        if ($rss->channel['link']) $title= "[".$rss->channel['link']." $title]";
        $output = "=== $title ===\n";
    }
    else
    {
      $title= "[".$rss->channel['link']." $rssTitle]";
      $output="=== $title ===\n";
    }
  } else {
      $output="\n\n\n";
  }
  
  if ($reverse) $rss->items = array_reverse($rss->items);

  $description = False; 
  foreach ($rss->items as $item) {
      if ($item['description']) {$description = True; break;}
  }

  #Bild items
  if (!$short and $description) { #full item list

    $output.="";
    foreach ($rss->items as $item) {

      $d_text = true;
      $d_title = true;

      $href = trim(iconv($charset,$wgOutputEncoding,$item['link']));
      $title = trim(iconv($charset,$wgOutputEncoding,$item['title']));

      $d_title = wfRssFilter ($title, $rssFilter);
      $title= wfRssHighlight($title, $rssHighlight);

      #bild description text if desired
      if ($item["description"]) {
        $text= trim(iconv($charset,$wgOutputEncoding,$item['description']));

        #avoid pre-tags
        $text= str_replace("\r"," ",$text);
        $text= str_replace("\n"," ",$text);
        $text= str_replace("\t"," ",$text);

        $d_text = wfRssFilter ($text, $rssFilter);
        $text= wfRssHighlight($text, $rssHighlight);

        $display = $d_text or $d_title;

      }
        else   {
          $text = "";
          $display = $d_title;
        }       

      if ($display) {
        $output.="* [$href $title]";
        if ($text) $output.="<br>$text";
        $output .= "\n";
      }

    #Cut off output when maxheads is reached:
    if (++$headcnt == $maxheads)  break;

    }
    # $output.="</dl>";
  }
  else { #short item list
   #  $output.="<ul>";
    foreach ($rss->items as $item) {
      $href = trim(iconv($charset,$wgOutputEncoding,$item['link']));
      $title = trim(iconv($charset,$wgOutputEncoding,$item['title']));

        $d_title = wfRssFilter ($title, $rssFilter);
        $title= wfRssHighlight($title, $rssHighlight);

        if ($d_title ) $output.="* [$href $title]\n";

      #Cut off output when maxheads is reached:
      if (++$headcnt == $maxheads)  break;
    }
    # $output.="</ul>";
  }


  if ($DisableCache) {

    global $wgVersion;

    # Do not cache this wiki page.
    # for details see http://public.kitware.com/Wiki/User:Barre/MediaWiki/Extensions
    global $wgTitle, $wgDBprefix;
    $ts = mktime();
    $now = gmdate("YmdHis", $ts + 120);
    $ns = $wgTitle->getNamespace();
    $ti = wfStrencode($wgTitle->getDBkey());

    $version = preg_replace("/^([1-9]).([1-9]).*/", "\\1\\2", $wgVersion);
    if ($version>14) $sql = "UPDATE $wgDBprefix"."page SET page_touched='$now' WHERE page_namespace=$ns AND page_title='$ti'";
    else             $sql = "UPDATE $wgDBprefix"."cur SET cur_touched='$now' WHERE cur_namespace=$ns AND cur_title='$ti'";

    wfQuery($sql, DB_WRITE, "");
  }

  $out = $parser->parse ($output, $parser->mTitle,$parser->mOptions, true, false);
  return $out->getText();
}


function wfRssFilter ($text, $rssFilter) {

  $display = true;

  if (is_array($rssFilter)) {
    foreach($rssFilter as $term) {

      if ($term) {
        $display = false;
        if (preg_match("|$term|i", $text, $a))  {  $display = true; return $display; }
      }
    if ($display) break;
    }
  }
  return $display;
}


function wfRssHighlight($text, $rssHighlight) {

  $i=0;
  $starttag = "v8x5u3t3u8h";
  $endtag   = "q8n4f6n4n4x";

  $color[]="coral";
  $color[]="greenyellow";
  $color[]="lightskyblue";
  $color[]="gold";
  $color[]="violet";

  $count_color = count($color);

  if (is_array($rssHighlight)) {
    foreach($rssHighlight as $term) {
      if ($term) {
        $text = preg_replace("|\b(\w*?".$term."\w*?)\b|i", "$starttag"."_".$i."\\1$endtag", $text);
        $i++;
        if ($i == $count_color) $i=0;
        }
      }
    }
  # to avoid trouble should someone wants to highlight the terms "span", "style", ...
  for ($i=0; $i<5; $i++) {
    $text = preg_replace("|$starttag"."_".$i."|", "<span style=\"background-color:".$color[$i]."; font-weight: bold;\">", $text);
    $text = preg_replace("|$endtag|", "</span>", $text);
    }

  return $text;
}

?>