A tumblelog CMS built on AJAX, PHP and MySQL.

feeds.php 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <?php
  2. if(!defined('entry')) define('entry', true);
  3. /* ===========================
  4. gelato CMS - A PHP based tumblelog CMS
  5. development version
  6. http://www.gelatocms.com/
  7. gelato CMS is a free software licensed under the GPL 2.0
  8. Copyright (C) 2007 by Pedro Santana <pecesama at gmail dot com>
  9. =========================== */
  10. ?>
  11. <?php
  12. require('../entry.php');
  13. global $user, $conf, $tumble;
  14. $template = new plantillas("admin");
  15. $user= new User();
  16. if ($user->isAdmin()) {
  17. $message = '';
  18. $f = new feeds();
  19. if(isset($_POST['add'], $_POST['url'])){
  20. $credits =(isset($_POST['credits']))? 1 : 0;
  21. if($f->addFeed($_POST['url'],$_POST['type'],$_POST['source'], $credits)){
  22. $message = __('Feed added');
  23. $messageStatus = 'exito';
  24. }
  25. }
  26. if(isset($_GET['delete']) && is_numeric($_GET['delete'])){
  27. if($f->removeFeed((int)$_GET['delete'])){
  28. $message = __('Feed deleted');
  29. $messageStatus = 'error';
  30. }
  31. }
  32. ?>
  33. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  34. <html xmlns="http://www.w3.org/1999/xhtml">
  35. <head>
  36. <title>gelato :: <?php echo __("Feeds")?></title>
  37. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  38. <meta name="generator" content="gelato cms <?php echo version();?>" />
  39. <link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
  40. <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/jquery.js"></script>
  41. <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/tools.js"></script>
  42. <script type="text/javascript">
  43. $(document).ready(function(){
  44. $("#divMessages").fadeOut(5000,function(){
  45. $("#divMessages").css({display:"none"});
  46. });
  47. $("#source").change(function (){selectFeedType('<?php echo __("Feed Url:")?>','<?php echo __(" username:")?>')})
  48. });
  49. </script>
  50. <style type="text/css" media="screen">
  51. @import "<?php echo $conf->urlGelato;?>/admin/css/style.css";
  52. </style>
  53. </head>
  54. <body>
  55. <div id="cont">
  56. <div id="head">
  57. <h1><a href="<?php echo $conf->urlGelato;?>/" title="gelato :: <?php echo __("home")?>">gelato cms</a></h1>
  58. <ul id="nav">
  59. <li><a href="<?php echo $conf->urlGelato;?>/" title="<?php echo __("Take me to the tumblelog")?>"><?php echo __("Back to the Tumblelog")?></a></li>
  60. </ul>
  61. </div>
  62. <div id="main">
  63. <div class="box">
  64. <h3><?php echo __("Configure your feeds")?></h3>
  65. <ul class="menu manage">
  66. <li><a href="index.php"><?php echo __("Post")?></a></li>
  67. <li><a href="options.php"><?php echo __("Options")?></a></li>
  68. </ul>
  69. <?php echo (!(empty($message))? '<div class="'.$messageStatus.'" id="divMessages"> '.$message.'</div>' : ''); ?>
  70. <div class="tabla">
  71. <form action="feeds.php" method="post" class="newpost">
  72. <fieldset>
  73. <ul>
  74. <li>
  75. <label for="source"><?php echo __("Import data from:")?></label>
  76. <select name="source" id="source">
  77. <option value="Rss" selected="selected">Rss/atom Feed</option>
  78. <option value="Twitter">Twitter</option>
  79. <option value="Youtube">Youtube</option>
  80. <option value="Last.fm">Last.fm</option>
  81. <option value="Tumblr">Tumblr</option>
  82. <option value="Wordpress.com">Wordpress.com</option>
  83. <option value="Blogger">Blogger</option>
  84. <option value="VOX">VOX</option>
  85. </select>
  86. </li>
  87. <li id="import_as"><label for="type"><?php echo __("Import As:")?></label>
  88. <select name="type" id="type">
  89. <option value="1" selected="selected"><?php echo __("Text")?></option>
  90. <option value="2"><?php echo __("Photos")?></option>
  91. </select>
  92. </li>
  93. <li>
  94. <label for="url" id="url_label"><?php echo __("Feed Url (double check):")?></label>
  95. <input type="text" name="url" id="url" class="txt" />
  96. </li>
  97. <li><label for="credits"><?php echo __('Show credits on each post?')?></label><input type="checkbox" name="credits" checked="checked" class="check" /></li>
  98. <li>
  99. <input name="add" type="submit" value="<?php echo __("Add"); ?>" />
  100. </li>
  101. </ul>
  102. </fieldset>
  103. </form>
  104. <div id="feedlist">
  105. <ul>
  106. <?php
  107. $actual_feeds = $f->getFeedList();
  108. foreach($actual_feeds as $feed){
  109. if($feed['error']>0){
  110. echo '<li class="feederror"><a href="feeds.php?delete='.$feed['id_feed'].'" title="'.__('Delete this Feed').'" class="action"><img title="" alt="" src="css/images/delete.png"/></a><span class="status">'.__('Error updating').'</span> '.((!empty($feed['title']))? $feed['title'] : $feed['url']).'</li>';
  111. }else{
  112. echo '<li><a href="feeds.php?delete='.$feed['id_feed'].'" title="'.__('Delete this Feed').'" class="action"><img title="" alt="" src="css/images/delete.png"/></a><span class="status" title="'.__('Last update').': '.$feed['updated_at'].'">'.__('Importing').'</span> '.((!empty($feed['title']))? $feed['title'] : $feed['url']).'</li>';
  113. }
  114. }
  115. ?>
  116. </ul>
  117. </div>
  118. </div>
  119. <div class="footer-box">&nbsp;</div>
  120. </div>
  121. </div>
  122. <div id="foot">
  123. <a href="http://www.gelatocms.com/" title="gelato CMS">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
  124. </div>
  125. </div>
  126. </body>
  127. </html>
  128. <?php
  129. } else {
  130. header("Location: ".$conf->urlGelato."/login.php");
  131. }
  132. ?>