| 1 | 
<?php | 
|---|
| 2 | 
 | 
|---|
| 3 | 
 | 
|---|
| 4 | 
 | 
|---|
| 5 | 
 | 
|---|
| 6 | 
 | 
|---|
| 7 | 
 | 
|---|
| 8 | 
 | 
|---|
| 9 | 
 | 
|---|
| 10 | 
 | 
|---|
| 11 | 
 | 
|---|
| 12 | 
 | 
|---|
| 13 | 
 | 
|---|
| 14 | 
 | 
|---|
| 15 | 
 | 
|---|
| 16 | 
 | 
|---|
| 17 | 
 | 
|---|
| 18 | 
 | 
|---|
| 19 | 
 | 
|---|
| 20 | 
 | 
|---|
| 21 | 
header('Content-Type: application/rss+xml'); | 
|---|
| 22 | 
header('Content-Disposition: attachment; filename="folcast.xml"'); | 
|---|
| 23 | 
 | 
|---|
| 24 | 
include("./foltialib.php"); | 
|---|
| 25 | 
$con = m_connect(); | 
|---|
| 26 | 
 | 
|---|
| 27 | 
 | 
|---|
| 28 | 
 | 
|---|
| 29 | 
 | 
|---|
| 30 | 
 | 
|---|
| 31 | 
 | 
|---|
| 32 | 
 | 
|---|
| 33 | 
 | 
|---|
| 34 | 
 | 
|---|
| 35 | 
 | 
|---|
| 36 | 
 | 
|---|
| 37 | 
 | 
|---|
| 38 | 
$now = date("YmdHi");    | 
|---|
| 39 | 
$nowrfc822 =  date("r"); | 
|---|
| 40 | 
 | 
|---|
| 41 | 
$max = getgetnumform(max); | 
|---|
| 42 | 
 | 
|---|
| 43 | 
if ($max > 0 ){ | 
|---|
| 44 | 
     | 
|---|
| 45 | 
}else{ | 
|---|
| 46 | 
    $max = 45; | 
|---|
| 47 | 
} | 
|---|
| 48 | 
$tid = getgetnumform(tid); | 
|---|
| 49 | 
if (($tid >= 0 ) && ($tid != "")){ | 
|---|
| 50 | 
 | 
|---|
| 51 | 
$query = " | 
|---|
| 52 | 
SELECT  foltia_program.tid,foltia_program.title, | 
|---|
| 53 | 
foltia_subtitle.countno , foltia_subtitle.subtitle , foltia_subtitle.startdatetime, foltia_subtitle.pspfilename,foltia_subtitle.lengthmin,foltia_subtitle.enddatetime   FROM foltia_subtitle , foltia_program   WHERE \"pspfilename\" LIKE 'M%%'  AND foltia_program.tid = foltia_subtitle.tid AND foltia_program.tid = $tid    | 
|---|
| 54 | 
ORDER BY enddatetime DESC  | 
|---|
| 55 | 
 limit ? offset 0  | 
|---|
| 56 | 
"; | 
|---|
| 57 | 
 | 
|---|
| 58 | 
$titlequery = " | 
|---|
| 59 | 
SELECT  foltia_program.tid,foltia_program.title  | 
|---|
| 60 | 
FROM  foltia_program    | 
|---|
| 61 | 
WHERE foltia_program.tid = ?    | 
|---|
| 62 | 
"; | 
|---|
| 63 | 
 | 
|---|
| 64 | 
$titlers = sql_query($con, $query, "DBクエリに失敗しました",array($tid)); | 
|---|
| 65 | 
 | 
|---|
| 66 | 
$rowdata = $titlers->fetch(); | 
|---|
| 67 | 
$rsstitle = $rowdata[1]; | 
|---|
| 68 | 
 | 
|---|
| 69 | 
 | 
|---|
| 70 | 
$query = " | 
|---|
| 71 | 
SELECT  foltia_program.tid,foltia_program.title, | 
|---|
| 72 | 
foltia_subtitle.countno , foltia_subtitle.subtitle , foltia_subtitle.startdatetime, foltia_subtitle.pspfilename,foltia_subtitle.lengthmin,foltia_subtitle.enddatetime   FROM foltia_subtitle , foltia_program   WHERE \"pspfilename\" LIKE 'M%%'  AND foltia_program.tid = foltia_subtitle.tid ORDER BY enddatetime DESC  | 
|---|
| 73 | 
limit  ? offset 0  | 
|---|
| 74 | 
    "; | 
|---|
| 75 | 
 | 
|---|
| 76 | 
 | 
|---|
| 77 | 
 | 
|---|
| 78 | 
    $rsstitle = "新規録画"; | 
|---|
| 79 | 
} | 
|---|
| 80 | 
 | 
|---|
| 81 | 
$header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>  | 
|---|
| 82 | 
<rss xmlns:itunes=\"http://www.itunes.com/DTDs/Podcast-1.0.dtd\" version=\"2.0\">  | 
|---|
| 83 | 
    <channel>  | 
|---|
| 84 | 
        <title>$rsstitle:Folcast</title>  | 
|---|
| 85 | 
        <itunes:author>DCC-JPL Japan/foltia project</itunes:author>  | 
|---|
| 86 | 
        <link>http://www.dcc-jpl.com/soft/foltia/</link>  | 
|---|
| 87 | 
        <description>フォルティアが未読処理をお助けしちゃいます</description>  | 
|---|
| 88 | 
        <itunes:subtitle>foltia video podcast :$rsstitle:Folcast</itunes:subtitle>  | 
|---|
| 89 | 
        <itunes:summary>フォルティアが未読処理をお助けしちゃいます</itunes:summary>  | 
|---|
| 90 | 
        <language>ja</language> | 
|---|
| 91 | 
        <copyright>foltia</copyright>  | 
|---|
| 92 | 
        <itunes:owner>  | 
|---|
| 93 | 
            <itunes:name>$rsstitle:Folcast</itunes:name>  | 
|---|
| 94 | 
            <itunes:email>foltia@dcc-jpl.com</itunes:email>  | 
|---|
| 95 | 
        </itunes:owner>           | 
|---|
| 96 | 
        <category>Technology</category>  | 
|---|
| 97 | 
        <itunes:category text=\"Technology\"></itunes:category>  | 
|---|
| 98 | 
 | 
|---|
| 99 | 
"; | 
|---|
| 100 | 
$header = mb_convert_encoding($header,"UTF-8", "EUC-JP"); | 
|---|
| 101 | 
print $header; | 
|---|
| 102 | 
 | 
|---|
| 103 | 
 | 
|---|
| 104 | 
$rs = sql_query($con, $query, "DBクエリに失敗しました",array($max)); | 
|---|
| 105 | 
$rowdata = $rs->fetch(); | 
|---|
| 106 | 
 | 
|---|
| 107 | 
if (! $rowdata) { | 
|---|
| 108 | 
                 | 
|---|
| 109 | 
}else{ | 
|---|
| 110 | 
    do { | 
|---|
| 111 | 
 | 
|---|
| 112 | 
$tid =  $rowdata[0]; | 
|---|
| 113 | 
$title = $rowdata[1]; | 
|---|
| 114 | 
$title = htmlspecialchars($title); | 
|---|
| 115 | 
$countno = $rowdata[2]; | 
|---|
| 116 | 
if ($countno > 0 ){ | 
|---|
| 117 | 
    $countprint = "第".$countno."回"; | 
|---|
| 118 | 
}else{ | 
|---|
| 119 | 
    $countprint=""; | 
|---|
| 120 | 
} | 
|---|
| 121 | 
$subtitle = $rowdata[3]; | 
|---|
| 122 | 
$subtitle = htmlspecialchars($subtitle); | 
|---|
| 123 | 
$onairdate = $rowdata[4]; | 
|---|
| 124 | 
$day = substr($onairdate,0,4)."/".substr($onairdate,4,2)."/".substr($onairdate,6,2); | 
|---|
| 125 | 
$time = substr($onairdate,8,2).":".substr($onairdate,10,2); | 
|---|
| 126 | 
$onairdate = "$day $time"; | 
|---|
| 127 | 
 | 
|---|
| 128 | 
$starttimerfc822 = foldate2rfc822($rowdata[4]); | 
|---|
| 129 | 
 | 
|---|
| 130 | 
$mp4filename = $rowdata[5]; | 
|---|
| 131 | 
$mp4uri = "http://". getserverfqdn()  .$httpmediamappath ."/$tid.localized/mp4/$mp4filename"; | 
|---|
| 132 | 
$mp4thmname = $rowdata[5]; | 
|---|
| 133 | 
$mp4thmname = ereg_replace(".MP4", ".THM", $mp4thmname); | 
|---|
| 134 | 
$mp4thmnameuri = "http://". getserverfqdn() . $httpmediamappath ."/$tid.localized/mp4/$mp4thmname"; | 
|---|
| 135 | 
 | 
|---|
| 136 | 
if (file_exists("$recfolderpath/$tid.localized/mp4/$mp4filename")) { | 
|---|
| 137 | 
    $mp4filestat = stat("$recfolderpath/$tid.localized/mp4/$mp4filename"); | 
|---|
| 138 | 
    $mp4filesize = $mp4filestat[7]; | 
|---|
| 139 | 
} else { | 
|---|
| 140 | 
    $mp4filesize = 0; | 
|---|
| 141 | 
} | 
|---|
| 142 | 
 | 
|---|
| 143 | 
if ($rowdata[0] == 0 ){ | 
|---|
| 144 | 
    $showntitle = "$title $subtitle"; | 
|---|
| 145 | 
}else{ | 
|---|
| 146 | 
    $showntitle = "$title $countprint"; | 
|---|
| 147 | 
} | 
|---|
| 148 | 
 | 
|---|
| 149 | 
 | 
|---|
| 150 | 
$item ="    <item>  | 
|---|
| 151 | 
          <title>$showntitle</title>  | 
|---|
| 152 | 
          <itunes:author>foltia</itunes:author>  | 
|---|
| 153 | 
          <description>$title $countprint $subtitle</description>  | 
|---|
| 154 | 
          <itunes:subtitle>$title $countprint $subtitle</itunes:subtitle>  | 
|---|
| 155 | 
          <itunes:summary>$title $countprint $subtitle</itunes:summary>  | 
|---|
| 156 | 
          <enclosure url=\"$mp4uri\" length=\"$mp4filesize\" type=\"video/mov\" />  | 
|---|
| 157 | 
          <guid isPermaLink=\"true\">$mp4thmnameuri</guid> | 
|---|
| 158 | 
          <pubDate>$starttimerfc822</pubDate>  | 
|---|
| 159 | 
          <itunes:explicit>no</itunes:explicit> | 
|---|
| 160 | 
          <itunes:keywords>foltia,Folcast,DCC-JPL Japan,$title,$subtitle</itunes:keywords>   | 
|---|
| 161 | 
          <itunes:image href=\"$mp4thmnameuri\" /> | 
|---|
| 162 | 
        </item>  | 
|---|
| 163 | 
"; | 
|---|
| 164 | 
 | 
|---|
| 165 | 
$item = mb_convert_encoding($item,"UTF-8", "EUC-JP"); | 
|---|
| 166 | 
print $item ; | 
|---|
| 167 | 
 | 
|---|
| 168 | 
    } while ($rowdata = $rs->fetch());  | 
|---|
| 169 | 
 | 
|---|
| 170 | 
} | 
|---|
| 171 | 
        ?> | 
|---|
| 172 | 
     | 
|---|
| 173 | 
    </channel>  | 
|---|
| 174 | 
</rss>  | 
|---|
| 175 | 
 | 
|---|