Commit 496ded0b authored by spoinsar's avatar spoinsar
Browse files

rss: fix descr and add add featured selection mode


git-svn-id: http://subversion.utc/svn/webtv@199 6dbbdbe0-869d-41b9-a499-9a762c387331
parent 6d080b04
......@@ -823,6 +823,58 @@
return $data;
}
function video_clean_description($vdetails) {
$preg = array(
'/(?<!\\\\)\[color(?::\w+)?=(.*?)\](.*?)\[\/color(?::\w+)?\]/si' => "\\2",
'/(?<!\\\\)\[size(?::\w+)?=(.*?)\](.*?)\[\/size(?::\w+)?\]/si' => "\\2",
'/(?<!\\\\)\[font(?::\w+)?=(.*?)\](.*?)\[\/font(?::\w+)?\]/si' => "\\2",
'/(?<!\\\\)\[align(?::\w+)?=(.*?)\](.*?)\[\/align(?::\w+)?\]/si' => "\\2",
'/(?<!\\\\)\[b(?::\w+)?\](.*?)\[\/b(?::\w+)?\]/si' => "\\1",
'/(?<!\\\\)\[i(?::\w+)?\](.*?)\[\/i(?::\w+)?\]/si' => "\\1",
'/(?<!\\\\)\[u(?::\w+)?\](.*?)\[\/u(?::\w+)?\]/si' => "\\1",
'/(?<!\\\\)\[center(?::\w+)?\](.*?)\[\/center(?::\w+)?\]/si' => "\\1",
// [code] & [php]
'/(?<!\\\\)\[code(?::\w+)?\](.*?)\[\/code(?::\w+)?\]/si' => "\\1",
'/(?<!\\\\)\[php(?::\w+)?\](.*?)\[\/php(?::\w+)?\]/si' => "\\1",
// [email]
'/(?<!\\\\)\[email(?::\w+)?\](.*?)\[\/email(?::\w+)?\]/si' => "\\1",
'/(?<!\\\\)\[email(?::\w+)?=(.*?)\](.*?)\[\/email(?::\w+)?\]/si' => "\\2",
// [url]
'/(?<!\\\\)\[url(?::\w+)?\]www\.(.*?)\[\/url(?::\w+)?\]/si' => "\\1",
'/(?<!\\\\)\[url(?::\w+)?\](.*?)\[\/url(?::\w+)?\]/si' => "\\1",
'/(?<!\\\\)\[url(?::\w+)?=(.*?)?\](.*?)\[\/url(?::\w+)?\]/si' => "\\2",
// [img]
'/(?<!\\\\)\[img(?::\w+)?\](.*?)\[\/img(?::\w+)?\]/si' => "",
'/(?<!\\\\)\[img(?::\w+)?=(.*?)x(.*?)\](.*?)\[\/img(?::\w+)?\]/si' => "",
// [quote]
'/(?<!\\\\)\[quote(?::\w+)?\](.*?)\[\/quote(?::\w+)?\]/si' => "\\1",
'/(?<!\\\\)\[quote(?::\w+)?=(?:&quot;|"|\')?(.*?)["\']?(?:&quot;|"|\')?\](.*?)\[\/quote\]/si' => "\\2",
// [list]
'/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[\*(?::\w+)?\](.*?)(?=(?:\s*<br\s*\/?>\s*)?\[\*|(?:\s*<br\s*\/?>\s*)?\[\/?list)/si' => "\\1\n<br>",
'/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[\/list(:(?!u|o)\w+)?\](?:<br\s*\/?>)?/si' => "\n<br>",
'/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[\/list:u(:\w+)?\](?:<br\s*\/?>)?/si' => "\n<br>",
'/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[\/list:o(:\w+)?\](?:<br\s*\/?>)?/si' => "\n<br>",
'/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[list(:(?!u|o)\w+)?\]\s*(?:<br\s*\/?>)?/si' => "\n",
'/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[list:u(:\w+)?\]\s*(?:<br\s*\/?>)?/si' => "\n",
'/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[list:o(:\w+)?\]\s*(?:<br\s*\/?>)?/si' => "\n",
'/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[list(?::o)?(:\w+)?=1\]\s*(?:<br\s*\/?>)?/si' => "\n",
'/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[list(?::o)?(:\w+)?=i\]\s*(?:<br\s*\/?>)?/s' => "\n",
'/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[list(?::o)?(:\w+)?=I\]\s*(?:<br\s*\/?>)?/s' => "\n",
'/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[list(?::o)?(:\w+)?=a\]\s*(?:<br\s*\/?>)?/s' => "\n",
'/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[list(?::o)?(:\w+)?=A\]\s*(?:<br\s*\/?>)?/s' => "\n",
// escaped tags like \[b], \[color], \[url], ...
'/\\\\(\[\/?\w+(?::\w+)*\])/' => "\\1",
'/(?<!\\\\)&lt;b(?::\w+)?&gt;(.*?)&lt;\/b(?::\w+)?&gt;/si' => "\\1",
// change quotes
'/&quot;/s' => "\"",
'/&#8217;/s' => "’",
'/\n/s' => "<br>"
);
$message = preg_replace(array_keys($preg), array_values($preg), $vdetails['description']);
return $message;
}
/**
* Function used to get video link
* @param ARRAY video details
......
......@@ -13,44 +13,67 @@ header ("Content-type: text/xml; charset=utf-8");
echo '<?xml version=\'1.0\' encoding=\'UTF-8\'?>'."\n";
$limit = 20;
/*
// page code is dead... add it back in query if needed
$page = $_GET['page'];
if($page<1 || !is_numeric )
if($page<1 || !is_numeric($page))
$page = 1;
if($page)
{
$from = ($page-1)*$limit;
$limit = "$from,$limit";
}*/
$cat = $_GET['cat'];
if($cat<1 && !is_numeric($cat)) {
$cat='all';
}
$mode = $_GET['mode'];
switch($mode)
{
case 'recent':
default:
{
$videos = get_videos(array('limit'=>$limit,'order'=>'date_added DESC'));
$title = "Recently Added Videos";
$videos = get_videos(array('limit'=>$limit,'order'=>'date_added DESC', 'category'=>$cat));
$title = "Vidéos récentes";
}
break;
case 'featured':
{
$videos = get_videos(array('limit'=>$limit,'featured'=>'yes','order'=>'featured_date DESC', 'category'=>$cat));
$title = "Vidéos à la une";
}
break;
case 'homepage':
{
$videos = get_videos(array('limit'=>$limit,'featured'=>'yes', 'tags'=>'homepage','order'=>'featured_date DESC', 'category'=>$cat));
$title = "Vidéos en page d'Accueil";
}
break;
case 'views':
{
$videos = get_videos(array('limit'=>$limit,'order'=>'views DESC'));
$videos = get_videos(array('limit'=>$limit,'order'=>'views DESC', 'category'=>$cat));
$title = "Most Viewed Videos";
}
break;
case 'rating':
{
$videos = get_videos(array('limit'=>$limit,'order'=>'rating DESC'));
$videos = get_videos(array('limit'=>$limit,'order'=>'rating DESC', 'category'=>$cat));
$title = "Top Rated Videos";
}
break;
case 'watching':
{
$videos = get_videos(array('limit'=>$limit,'order'=>'last_viewed DESC'));
$videos = get_videos(array('limit'=>$limit,'order'=>'last_viewed DESC', 'category'=>$cat));
$title = "Videos Being Watched";
}
break;
......@@ -60,7 +83,7 @@ switch($mode)
//Get userid from username
$uid = $userquery->get_user_field_only($user,'userid');
$uid = $uid ? $uid : 'x';
$videos = get_videos(array('limit'=>$limit,'user'=>$uid,'order'=>'date_added DESC'));
$videos = get_videos(array('limit'=>$limit,'user'=>$uid,'order'=>'date_added DESC', 'category'=>$cat));
//Count Total Videos of this user
$total_vids = get_videos(array('count_only'=>true,'user'=>$uid));
$title = "Videos uploaded by ".$user;
......@@ -113,28 +136,24 @@ subtitle($title);
<title><?=substr($video['title'],0,250)?></title>
<link><?=video_link($video)?></link>
<description>
<![CDATA[
<![CDATA[
<table width="600" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="130" height="90" align="center" valign="middle"><img src="<?=get_thumb($video)?>" border="0"/></td>
<td valign="top">
<a href="<?=video_link($video)?>"><?=$video['title']?></a><br />
<?=$video['description']?>
<?=video_clean_description($video)?>
</td>
<td width="100" valign="top" align="right">
<?=$video['views']?> Vues<br />
<?=SetTime($video['duration'])?>
</tr>
</table>
]]>
</description>
]]></description>
<category><?=strip_tags(categories($video['category'],'video'))?></category>
<guid isPermaLink="true"><?=video_link($video)?></guid>
<pubDate><?=date_format(date_create($video['date_added']),DateTime::RSS)?></pubDate>
<media:player url="<?=video_link($video)?>" />
<media:thumbnail url="<?=get_thumb($video)?>" />
<media:thumbnail url="<?=get_thumb($video, 'med')?>" />
<media:title><?=substr($video['title'],0,250)?></media:title>
<media:category label="Tags"><?=strip_tags(tags($video['tags'],'video'))?></media:category>
<media:credit><?=$video['username']?></media:credit>
......@@ -142,6 +161,6 @@ subtitle($title);
<?php
}
?>
<!-- si vous développez des outils qui exploitent ce flux et que vous avez des demandes pour modifier les infos qu'il contient, laissez un mail à stephane.poinsart@utc.fr -->
</channel>
</rss>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment