A tumblelog CMS built on AJAX, PHP and MySQL.

feeds.php 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. });
  48. </script>
  49. <style type="text/css" media="screen">
  50. @import "<?php echo $conf->urlGelato;?>/admin/css/style.css";
  51. </style>
  52. </head>
  53. <body>
  54. <div id="cont">
  55. <div id="head">
  56. <h1><a href="<?php echo $conf->urlGelato;?>/" title="gelato :: <?php echo __("home")?>">gelato cms</a></h1>
  57. <ul id="nav">
  58. <li><a href="<?php echo $conf->urlGelato;?>/" title="<?php echo __("Take me to the tumblelog")?>"><?php echo __("Back to the Tumblelog")?></a></li>
  59. </ul>
  60. </div>
  61. <div id="main">
  62. <div class="box">
  63. <h3><?php echo __("Configure your feeds")?></h3>
  64. <ul class="menu manage">
  65. <li><a href="index.php"><?php echo __("Post")?></a></li>
  66. <li><a href="options.php"><?php echo __("Options")?></a></li>
  67. </ul>
  68. <?php echo (!(empty($message))? '<div class="'.$messageStatus.'" id="divMessages"> '.$message.'</div>' : ''); ?>
  69. <div class="tabla">
  70. <form action="feeds.php" method="post" class="newpost">
  71. <fieldset>
  72. <ul>
  73. <li>
  74. <label for="source"><?php echo __("Import data from:")?></label>
  75. <select name="source" id="source" onchange="selectFeedType('<?php echo __("Feed Url:")?>','<?php echo __(" username:")?>' )">
  76. <option value="Rss" selected="selected">Rss/atom Feed</option>
  77. <option value="Twitter">Twitter</option>
  78. <option value="Youtube">Youtube</option>
  79. <option value="Last.fm">Last.fm</option>
  80. <option value="Tumblr">Tumblr</option>
  81. <option value="Wordpress.com">Wordpress.com</option>
  82. <option value="Blogger">Blogger</option>
  83. <option value="VOX">VOX</option>
  84. </select>
  85. </li>
  86. <li id="import_as"><label for="type"><?php echo __("Import As:")?></label>
  87. <select name="type" id="type">
  88. <option value="1" selected="selected"><?php echo __("Text")?></option>
  89. <option value="2"><?php echo __("Photos")?></option>
  90. </select>
  91. </li>
  92. <li>
  93. <label for="url" id="url_label"><?php echo __("Feed Url (double check):")?></label>
  94. <input type="text" name="url" id="url" class="txt" />
  95. </li>
  96. <li><label for="credits"><?php echo __('Show credits on each post?')?></label><input type="checkbox" name="credits" checked="checked" class="check" /></li>
  97. <li>
  98. <input name="add" type="submit" value="<?php echo __("Add"); ?>" />
  99. </li>
  100. </ul>
  101. </fieldset>
  102. </form>
  103. <div id="feedlist">
  104. <ul>
  105. <?php
  106. $actual_feeds = $f->getFeedList();
  107. foreach($actual_feeds as $feed){
  108. if($feed['error']>0){
  109. 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>';
  110. }else{
  111. 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>';
  112. }
  113. }
  114. ?>
  115. </ul>
  116. </div>
  117. </div>
  118. <div class="footer-box">&nbsp;</div>
  119. </div>
  120. </div>
  121. <div id="foot">
  122. <a href="http://www.gelatocms.com/" title="gelato CMS">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
  123. </div>
  124. </div>
  125. </body>
  126. </html>
  127. <?php
  128. } else {
  129. header("Location: ".$conf->urlGelato."/login.php");
  130. }
  131. ?>