header("Content-Type: application/xml; charset=ISO-8859-1");
require_once ('scripts/bbdd.mysql.php');
$this_web_dominio = str_replace('www.', "", strtolower($_SERVER['SERVER_NAME']));
require_once ('scripts/bbdd.funciones.php');
require_once ('scripts/autopublish.php');
function html2txt2($document){
$search = array('@@si', // Strip out javascript
'@@siU', // Strip style tags properly
'@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags
'@@' // Strip multi-line comments including CDATA
);
$text = preg_replace($search, '', $document);
return $text;
}
// REGISTRO DE WEBSITE _________________________________________________________________________________________________________________
$this_web_sql_query = "SELECT * FROM websites WHERE visible=1 AND dominio='" . $this_web_dominio . "' ORDER BY id DESC";
$this_web_sql_rs = mysql_query($this_web_sql_query, $mysql_connect);
$this_web_sql_row_rs = mysql_fetch_assoc($this_web_sql_rs);
$this_web_sql_totalrows_rs = mysql_num_rows($this_web_sql_rs);
if ($this_web_sql_totalrows_rs<1) {
$end = 'No Web found!';
echo end($end);
}
$dominio_ext = array(".com", ".net", ".es", ".info", ".org");
$this_web_dominio2 = str_replace($dominio_ext, "", $this_web_dominio);
$this_web_dominio3 = str_replace("oh", "oh!", $this_web_dominio2);
class RSS {
public function RSS()
{
global $mysql_user, $mysql_pass, $mysql_hostname, $mysql_database;
DEFINE ('DB_USER', $mysql_user);
DEFINE ('DB_PASSWORD', $mysql_pass);
DEFINE ('DB_HOST', $mysql_hostname);
DEFINE ('DB_NAME', $mysql_database);
// Make the connnection and then select the database.
$dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySQL: ' . mysql_error() );
mysql_select_db (DB_NAME) OR die ('Could not select the database: ' . mysql_error() );
}
public function GetFeed()
{
return $this->getDetails() . $this->getItems();
}
private function dbConnect()
{
DEFINE ('LINK', mysql_connect (DB_HOST, DB_USER, DB_PASSWORD));
}
private function getDetails()
{
global $this_web_dominio3, $this_web_sql_row_rs;
$details = '
'. $this_web_dominio3 .'
http://www.'. $this_web_sql_row_rs['dominio'] .'
'. $this_web_sql_row_rs['meta_desc'] .'
'. $this_web_sql_row_rs['idioma'] .'';
return $details;
}
private function getItems()
{
global $this_web_dominio2, $this_web_sql_row_rs;
$itemsTable = $this_web_dominio2;
$this->dbConnect($itemsTable);
$query = "SELECT * FROM cnt_to_cat,contenidos WHERE cnt_to_cat.id_cnt=contenidos.id AND cnt_to_cat.visible=1 AND cnt_to_cat.id_web=". intval($this_web_sql_row_rs['id']) ." GROUP BY id_cnt ORDER BY cnt_to_cat.publicado_fecha DESC, cnt_to_cat.publicado_hora DESC";
$result = mysql_db_query (DB_NAME, $query, LINK);
$items = '';
while($row = mysql_fetch_array($result))
{
$ano = substr($row["publicado_fecha"], 0, 4);
$mes = substr($row["publicado_fecha"], 5, 2);
$dia = substr($row["publicado_fecha"], 8, 2);
$hora = substr($row["publicado_hora"], 0, 2);
$min = substr($row["publicado_hora"], 3, 2);
$seg = substr($row["publicado_hora"], 6, 2);
$pubdate = date('D, d M Y H:i:s O', mktime($hora, $min, $seg, $mes, $dia, $ano));
$url_img = str_replace("php", "jpg", $row["url"]);
$items .= '-
http://www.'. $this_web_sql_row_rs['dominio'] .'/'. $row["url"] .'
'. $row["titulo"] .'
http://www.'. $this_web_sql_row_rs['dominio'] .'/'. $row["url"] .'
<img src='http://www.'. $this_web_sql_row_rs['dominio'] .'/images/'. $url_img .'' width='73' height='73' />
'. $pubdate .'
';
}
$items .= '
';
return $items;
}
}
$rss = new RSS();
echo $rss->GetFeed();
?>