| 1 | <?php |
|---|
| 2 | $now_date = getdate(); |
|---|
| 3 | |
|---|
| 4 | $data['rss'] = ""; |
|---|
| 5 | $data['rss_full'] = ""; |
|---|
| 6 | $data['sub'] = ""; |
|---|
| 7 | |
|---|
| 8 | if(JLOG_SUB_CURRENT < 15) $limit = "LIMIT 15"; |
|---|
| 9 | else $limit = "LIMIT ".JLOG_SUB_CURRENT; |
|---|
| 10 | |
|---|
| 11 | $sql = "SELECT id, url, topic, UNIX_TIMESTAMP(date) AS date, |
|---|
| 12 | teaser, teaserpic, teaserpiconblog, keywords, content, |
|---|
| 13 | comments, allowpingback, section |
|---|
| 14 | FROM ".JLOG_DB_CONTENT." |
|---|
| 15 | WHERE section = 'weblog' |
|---|
| 16 | ORDER BY date DESC |
|---|
| 17 | ".$limit.";"; |
|---|
| 18 | |
|---|
| 19 | $rss_sub = new Query($sql); |
|---|
| 20 | if($rss_sub->error()) { |
|---|
| 21 | echo "<pre>\n"; |
|---|
| 22 | echo $rss_sub->getError(); |
|---|
| 23 | echo "</pre>\n"; |
|---|
| 24 | die(); |
|---|
| 25 | } |
|---|
| 26 | if(defined('JLOG_ADMIN') AND !defined('JLOG_COMMENTS')) { |
|---|
| 27 | $data['rss'] = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?" . "> |
|---|
| 28 | <rss version=\"2.0\"> |
|---|
| 29 | <channel> |
|---|
| 30 | <title>".htmlspecialchars(JLOG_WEBSITE)."</title> |
|---|
| 31 | <link>".htmlspecialchars(JLOG_PATH)."</link> |
|---|
| 32 | <description>".htmlspecialchars(JLOG_DESCRIPTION)."</description> |
|---|
| 33 | <language>".$l['language']."</language> |
|---|
| 34 | <lastBuildDate>".date('r')."</lastBuildDate> |
|---|
| 35 | <docs>http://blogs.law.harvard.edu/tech/rss</docs> |
|---|
| 36 | <generator><a href="".JLOG_SOFTWARE_URL."">Jlog v".JLOG_SOFTWARE_VERSION."</a></generator> |
|---|
| 37 | <managingEditor>".htmlspecialchars(JLOG_PUBLISHER)." ".htmlspecialchars(JLOG_EMAIL)."</managingEditor> |
|---|
| 38 | <copyright>&copy;".$now_date['year']." by ".htmlspecialchars(JLOG_PUBLISHER)."</copyright>\n\n"; |
|---|
| 39 | |
|---|
| 40 | $data['rss_full'] = $data['rss']; |
|---|
| 41 | } |
|---|
| 42 | $data['sub'] = "<ul class='subcurrentlist'>\n"; |
|---|
| 43 | |
|---|
| 44 | if(!isset($cc)) $cc = count_comments(); |
|---|
| 45 | |
|---|
| 46 | $sub = 0; |
|---|
| 47 | while ($row = $rss_sub->fetch()) { |
|---|
| 48 | ++$sub; |
|---|
| 49 | |
|---|
| 50 | if($sub <= JLOG_SUB_CURRENT) { |
|---|
| 51 | $tmp_comments = ""; |
|---|
| 52 | if(isset($cc[$row['id']]) AND $cc[$row['id']] != 0) $tmp_comments = " <a class='comments' title='".$l['content_comments_title']."' href='".blog($row['date'], $row['url'])."#comments'>(".$cc[$row['id']].")</a>"; |
|---|
| 53 | $data['sub'] .= " <li>".strftime(JLOG_DATE_SUBCURRENT, $row['date'])." <a href='".blog($row['date'], $row['url'])."'>".htmlspecialchars($row['topic'], ENT_QUOTES)."</a>".$tmp_comments."</li>\n"; |
|---|
| 54 | } |
|---|
| 55 | |
|---|
| 56 | if($sub <= 15 AND defined('JLOG_ADMIN')) { |
|---|
| 57 | |
|---|
| 58 | # Kopfdaten |
|---|
| 59 | $data['rss'] .= " <item>\n <title>".htmlspecialchars($row['topic'], ENT_QUOTES)."</title>\n"; |
|---|
| 60 | $data['rss_full'] .= " <item>\n <title>".htmlspecialchars($row['topic'], ENT_QUOTES)."</title>\n"; |
|---|
| 61 | |
|---|
| 62 | $data['rss'] .= " <guid isPermaLink=\"true\">".blog($row['date'], $row['url'])."</guid>\n"; |
|---|
| 63 | $data['rss_full'] .= " <guid isPermaLink=\"true\">".blog($row['date'], $row['url'])."</guid>\n"; |
|---|
| 64 | |
|---|
| 65 | $data['rss'] .= " <pubDate>".date('r', $row['date'])."</pubDate>\n"; |
|---|
| 66 | $data['rss_full'] .= " <pubDate>".date('r', $row['date'])."</pubDate>\n"; |
|---|
| 67 | |
|---|
| 68 | $data['rss'] .= " <link>".blog($row['date'], $row['url'])."</link>\n"; |
|---|
| 69 | $data['rss_full'] .= " <link>".blog($row['date'], $row['url'])."</link>\n"; |
|---|
| 70 | |
|---|
| 71 | $data['rss'] .= " <comments>".blog($row['date'], $row['url'])."#comments</comments>\n"; |
|---|
| 72 | $data['rss_full'] .= " <comments>".blog($row['date'], $row['url'])."#comments</comments>\n"; |
|---|
| 73 | |
|---|
| 74 | $data['rss'] .= $categories->output_rss($row['id']); |
|---|
| 75 | $data['rss_full'] .= $categories->output_rss($row['id']); |
|---|
| 76 | |
|---|
| 77 | |
|---|
| 78 | # Inhaltsdaten |
|---|
| 79 | $data['rss'] .= " <description>\n".htmlspecialchars($bbcode->parse($row['teaser']))."\n </description>\n"; |
|---|
| 80 | $data['rss_full'] .= " <description>\n"; |
|---|
| 81 | |
|---|
| 82 | if($row['teaserpiconblog'] == 1) $data['rss_full'] .= htmlspecialchars("<img src='".JLOG_PATH."/personal/img/t_".$row['teaserpic']."' alt='' />"); |
|---|
| 83 | $data['rss_full'] .= htmlspecialchars($bbcode->parse($row['content']))."\n </description>\n"; |
|---|
| 84 | |
|---|
| 85 | $data['rss'] .= " </item>\n\n"; |
|---|
| 86 | $data['rss_full'] .= " </item>\n\n"; |
|---|
| 87 | } |
|---|
| 88 | } |
|---|
| 89 | if(defined('JLOG_ADMIN') AND !defined('JLOG_COMMENTS')) { |
|---|
| 90 | $data['rss'] .= "</channel>\n</rss>"; |
|---|
| 91 | $data['rss_full'] .= "</channel>\n</rss>"; |
|---|
| 92 | } |
|---|
| 93 | $data['sub'] .= " </ul>"; |
|---|
| 94 | |
|---|
| 95 | if(defined('JLOG_ADMIN') AND !defined('JLOG_COMMENTS')) { |
|---|
| 96 | $file['rss'] = JLOG_BASEPATH.'personal'.DIRECTORY_SEPARATOR.'rss.xml'; |
|---|
| 97 | $file['rss_full'] = JLOG_BASEPATH.'personal'.DIRECTORY_SEPARATOR.'rss-full.xml'; |
|---|
| 98 | } |
|---|
| 99 | |
|---|
| 100 | $file['sub'] = JLOG_BASEPATH.'personal'.DIRECTORY_SEPARATOR.'subcurrent.inc'; |
|---|
| 101 | |
|---|
| 102 | ### Plugin Hook |
|---|
| 103 | if (isset($plugins) and is_object($plugins)) { |
|---|
| 104 | $data = $plugins->callHook('onUpdate', $data); |
|---|
| 105 | } |
|---|
| 106 | |
|---|
| 107 | $i = 0; |
|---|
| 108 | |
|---|
| 109 | foreach($file AS $d => $filename) { |
|---|
| 110 | if (is_writable($filename)) { |
|---|
| 111 | if (!$handle = fopen($filename, 'w')) { |
|---|
| 112 | $errors[] .= $l['admin']['can_not_open']." ($filename)"; |
|---|
| 113 | exit; |
|---|
| 114 | } |
|---|
| 115 | if (!fwrite($handle, $data[$d])) { |
|---|
| 116 | $errors[] .= $l['admin']['can_not_write']." ($filename)"; |
|---|
| 117 | exit; |
|---|
| 118 | } |
|---|
| 119 | ++$i; |
|---|
| 120 | fclose($handle); |
|---|
| 121 | } else { |
|---|
| 122 | $errors[] .= $l['admin']['no_wrtitenable']." ($filename)"; |
|---|
| 123 | } |
|---|
| 124 | } |
|---|
| 125 | |
|---|
| 126 | |
|---|
| 127 | if(count($errors) > 0) { |
|---|
| 128 | $c['main'] .= error_output($errors); |
|---|
| 129 | } |
|---|
| 130 | |
|---|
| 131 | if($i == 4 AND defined('JLOG_ADMIN') AND !defined('JLOG_COMMENTS')) $c['main'] .= "<p>".$l['admin']['rss_ok']."</p>"; |
|---|
| 132 | unset($i); |
|---|
| 133 | unset($sub); |
|---|
| 134 | |
|---|
| 135 | ?> |
|---|