| Server IP : 180.180.241.3 / Your IP : 216.73.216.25 Web Server : Microsoft-IIS/7.5 System : Windows NT NETWORK-NHRC 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586 User : IUSR ( 0) PHP Version : 5.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/AppServ/www/umedia3/ |
Upload File : |
<?php
;
include ("./inc/config.inc.php");
include ("./inc/feedcreator.class.php");
function local_md($r,$adddescr="") {
global $dcrURL;
global $rss;
$item = new FeedItem();
$item->title = iconvutf(marc_gettitle($r[randid]));;
$item->link = "$dcrURL/index.php?mode=viewrecord&mid=$r[randid]";
$cover=tmq("select * from media_ftitems where iscover='yes' and mid='$r[randid]' ");
if (tmq_num_rows($cover)!=0) {
$cover=tmq_fetch_array($cover);
$coverurl=get_fturl($cover);
if ($cover[uploadtype]=="upload") {
$coverurl.=".thumb.jpg";
}
} else {
$coverurl="$dcrURL/neoimg/nocovergray.png";
}
$item->description = "$adddescr<img src='".$coverurl."' width=45>";;
$rss->addItem($item);
}
$feed=trim($feed);
//define channel
$rss = new UniversalFeedCreator();
$rss->useCached();
$to_title=getlang(getval("global", "HEAD"));;
$to_title2=getlang(getval("global", "HEAD 2"));
$to_title=iconvutf($to_title);
$to_title2=iconvutf($to_title2);
$rss->title=$to_title;
$rss->description=$to_title2;
$rss->link=$dcrURL;
$rss->syndicationURL="$dcrURL/getfeed.php?feed=$feed";
if ($feed=="") {
die("feed [$feed] not found");
}
/////////////////////////////////////////////////////////////
if ($feed=="all") {
$rss->description=iconvutf("รายการทั้งหมด");
$s="select * from media order by lastactive desc limit 50";
$s=tmq($s);
while ($r=tmq_fetch_array($s)) {
local_md($r);
}
}
/////////////////////////////////////////////////////////////
if ($feed=="showcase") {
$rss->description=iconvutf("รายการที่น่าสนใจ");
$s="select * from media where webpageshowcaseall='yes' order by lastactive desc limit 50";
$s=tmq($s);
while ($r=tmq_fetch_array($s)) {
local_md($r);
}
}
/////////////////////////////////////////////////////////////
if ($feed=="category") {
$s=tmq("select * from cate_sub where id='$categoryid' ",false);
$r=tmq_fetch_array($s);
$rss->description=iconvutf("หัวข้อ $r[name]");
$s="select * from media where cate='$categoryid' order by lastactive desc limit 50";
$s=tmq($s);
while ($r=tmq_fetch_array($s)) {
local_md($r);
}
}
/////////////////////////////////////////////////////////////
if ($feed=="maxrating") {
$rss->description=iconvutf("รายการที่ได้คะแนนโหวทมากที่สุด");
$s="select *,bibid as randid from webpage_bibrating_sum where 1 order by votescore desc,votecount desc limit 50";
$s=tmq($s);
while ($r=tmq_fetch_array($s)) {
$scoredsp=number_format($r[votescore],1);
$scoretxt=floor(($r[votescore]*20)/5);
$scorecounttxt=number_format($r[votecount]);
$scoretxt=floor($scoretxt*5);
local_md($r,"Rated: ".$scoredsp."/$scorecounttxt<BR>");
}
}
/////////////////////////////////////////////////////////////
if ($feed=="metadata") {
//channel items/entries
$m=tmq("select * from media where randid='$mid' ");
if (tmq_num_rows($m)==0) {
die("Sorry, record $mid not found");
}
$m=tmq_fetch_array($m);
$displaydb=tmq_dump("filenamedisplay","id","val");
$fordspname=$m[filenamedisplay];
if ($fordspname=="") {
$fordspname=tmq("select * from filenamedisplay where isdef='yes' ");;
$fordspname=tmq_fetch_array($fordspname);
$fordspname=$fordspname[id];
}
$fordspname=getlang($displaydb[$fordspname]);
$to_title2=iconvutf(marc_gettitle($mid));
$rss->description=$to_title2;
$s="select * from media_ftitems where mid='$mid' order by iscover desc,ordr,text,id desc";
$s=tmq($s);
$i=0;
while ($r=tmq_fetch_array($s)) {
$fulltitle=$fordspname;
$fulltitle=str_replace('[no]',$i,$fulltitle);
$fulltitle=str_replace('[text]',stripslashes($r[text]),$fulltitle);
$item = new FeedItem();
$titl=$fulltitle;
$titl4url=$fulltitle;
$titl=trim($titl);
$auth=$r[auth];
$auth='';
$titl=str_remspecialsign($titl);
$auth=str_remspecialsign($auth);
$titl=iconvutf($titl);
$auth=iconvutf($auth);
if (strlen($titl)>105) { $titl=substr($titl,0,105).'..'; }
if (strlen($auth)>95) { $auth=substr($auth,0,95).'..'; }
$titl=iconvutf($titl);
$auth=iconvutf($auth);
if ($titl=="") {
$titl="Untitled";
}
// $item->title = $titl.":".isUTF8($titl);
$item->title = $titl;
if ($mode=="thumb") {
$ext=explode('.',$r[filename]);
$ext=$ext[count($ext)-1];
$ext=strtolower($ext);
$imgext=explode(',',barcodeval_get("sysconfig-o-imageextension"));
if (in_array($ext,$imgext)) {
if ($r[uploadtype]=="url") {
$coverurl=$r[filename];
} else {
$coverurl="$dcrURL/_fulltext/$r[mid]/$r[filename].thumb.jpg";
}
} else {
$covericon=get_fttypecode($r);
if ($r[uploadtype]=="url") {
$coverurl="$dcrURL/_tmp/mediatype/$covericon.png";
} else {
if (file_exists($dcrs."/_fulltext/$r[mid]/$r[filename].thumbimg.jpg")) {
$coverurl="$dcrURL/_fulltext/$r[mid]/$r[filename].thumbimg.jpg";
} else {
$coverurl="$dcrURL/_tmp/mediatype/$covericon.png";
}
}
}
$item->description = "<img src='".$coverurl."' width=45>";;
}
//http://www.ulibm.net/intermedia//index.php?startrow=0&mode=viewrecord&mid=20090625144920_2627&viewsinglefile=6239&viewmode=icon&setdisplayname=Atomic+Kitten+-+10+-+Last+Goodbye.mp3#midnameposition
$item->link = "$dcrURL/index.php?mode=viewrecord&mid=$mid&viewsinglefile=$r[id]&setdisplayname=".urlencode(iconvth($titl4url))."";
//$item->description = $auth;
$item->source = $rss->title;
$item->author = $auth;
$rss->addItem($item);
}
//optional enclosure support
$item->enclosure = new EnclosureItem();
$item->enclosure->url=$dcrURL."/_tmp/logo/_weblogoicon.png";
$item->enclosure->length=filesize($dcrs."/_tmp/logo/_weblogoicon.png");
$item->enclosure->type= 'image/png';
$rss->title=stripslashes($rss->title);
$rss->description=stripslashes($rss->description);
//$rss->outputFeed("RSS2.0");
}
/////////////////////////////////////////////////////////////
//optional enclosure support
$item->enclosure = new EnclosureItem();
$item->enclosure->url=$dcrURL."/_tmp/logo/_weblogoicon.png";
$item->enclosure->length=filesize($dcrs."/_tmp/logo/_weblogoicon.png");
$item->enclosure->type= 'image/png';
$rss->title=stripslashes($rss->title);
$rss->description=stripslashes($rss->description);
$rss->outputFeed("RSS2.0");
/////////////////////////////////////////////////////////////
//$rss->saveFeed("ATOM1.0", "news/feed.xml");
//Valid parameters are RSS0.91, RSS1.0, RSS2.0, PIE0.1 (deprecated),
// MBOX, OPML, ATOM, ATOM1.0, ATOM0.3, HTML, JS
?>