\n"; $rss .= "\n\n"; $rss .= " \n"; $rss .= " DarwinPorts Project News\n"; $rss .= " http://www.darwinports.org/\n"; $rss .= " DarwinPorts Project News\n"; $rss .= " en-us\n"; $rss .= " Jim Mock (mij@opendarwin.org)\n"; $rss .= " Copyright 2002-2003\n"; $rss .= " $rssdate\n"; $rss .= " \n"; if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_objects($result)) { $rss .= " \n"; $rss .= " $row->title\n"; $rss .= " http://www.darwinports.org/es/archives.php?id=$row->id\n"; $desc_query = "SELECT SUBSTRING_INDEX(news, ' ',26) FROM headlines WHERE id=$row->id"; $desc_result = mysql_query($desc_query); $desc_row = mysql_fetch_row($desc_result); $description = $desc_row[0]; $rss .= " ]]>\n"; $rss .= " http://www.darwinports.org/es/archives.php?id=$row->id\n"; $rss .= " news]]>\n"; $rss .= " \n"; } } $rss .= " \n"; $rss .= "\n"; $write = fwrite($open, $rss); $close = fclose($open); } ######################################################################## # print the project news: function print_headlines() { global $connect; $query = "SELECT id, DATE_FORMAT(timestamp, '%e %b %Y, %l:%i %p') AS f_timestamp, title, news FROM headlines ORDER BY id DESC LIMIT 5"; $result = mysql_query($query) or die("Error: $query."); if (!$result) { die("Error: $result."); } if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_object($result)) { echo "
$row->title
\n"; echo "
$row->f_timestamp
\n"; echo "$row->news\n\n"; } } else { echo "

No hay titulares disponibles en este momento.

\n"; } } ######################################################################## # display a single headline: function print_headline() { global $connect; $id = $_GET['id']; $query = "SELECT id, DATE_FORMAT(timestamp, '%e %b %Y, %l:%i %p') AS f_timestamp, title, news FROM headlines WHERE id='$id'"; $result = mysql_query($query) or die("Error: $query."); if (!result) { die("Error: $result."); } $row = mysql_fetch_object($result); if ($row) { echo "
$row->title
\n"; echo "
$row->f_timestamp
\n"; echo "$row->news\n\n"; } else { echo "

Error!

\n"; echo "

El titular seleccionado no se pudo encontrar. Puede ser que no se encuentre en la base de datos o que un error ha ocurrido.

\n"; } } ######################################################################## # print the form used to add project news function print_add_headline() { global $PHP_SELF, $connect; if (!$_POST['submit']) { echo "

Utilice el formulario que se presenta abajo para agregar noticias del proyecto.

\n\n"; echo "
\n"; echo "

Título:  

\n"; echo "

Noticias:

\n"; echo "

\n"; echo "

\n"; echo "
\n\n"; } else { $title = $_POST['title']; $news = $_POST['news']; $errorList = array(); $count = 0; if (!$title) { $errorList[$count] = 'Invalid entry: Title'; $count++; } if (!$news) { $errorList[$count] = 'Invalid entry: News'; $count++; } if (sizeof($errorList) == 0) { $query = "INSERT INTO headlines (timestamp, title, news) VALUES (NOW(), '$title', '$news')"; $result = mysql_query($query) or die("Error: $query."); if (!$result) { die("Error: $result."); } echo "

La entrada fue agregada exitosamente. Puede bien sea ver todos los titulares, agregar otro titular o volver a la página principal de DarwinPorts.

\n\n"; create_rss(); } else { echo "

Han ocurrido los siguientes errores:

\n\n"; echo "\n\n"; } } } ######################################################################## # print the form used to edit project news: function print_edit_headline($id) { global $PHP_SELF, $connect; if (!$_POST['submit']) { $id = $_GET['id']; $query = "SELECT title, news FROM headlines WHERE id='$id'"; $result = mysql_query($query) or die("Error: $query."); if (!$result) { die("Error: $result."); } if (mysql_num_rows($result) > 0) { $row = mysql_fetch_object($result); echo "

Use el formulario abajo mostrado para editar las noticias del proyecto.

\n\n"; echo "
\n"; echo "

Título:  title\" />

\n"; echo "

Noticias:

\n"; echo "

\n"; echo "

\n"; echo "
\n\n"; } else { echo "

El tilular buscado no se pudo encontrar. Puede ser que no se encuentre en la base de datos o que un error ha ocurrido. Por vafor intente de nuevo.

\n\n"; } } else { $title = $_POST['title']; $news = $_POST['news']; $errorList = array(); $count = 0; if (!$title) { $errorList[$count] = 'Invalid entry: Title'; $count++; } if (!$news) { $errorList[$count] = 'Invalid entry: News'; $count++; } if (sizeof($errorList) == 0) { $query = "UPDATE headlines SET title='$title', news='$news' WHERE id='$id'"; $result = mysql_query($query) or die("Error: $query."); if (!$result) { die("Error: $result."); } echo "

El update fue exitoso. Puede bien sea ver todos los titulares, agregar otro titular o volver a la página principal de DarwinPorts.

\n\n"; create_rss(); } else { echo "

Han ocurrido los siguientes errores:

\n\n"; echo "\n\n"; } } } ######################################################################## # print a list of all existing headlines: function print_all_headlines() { global $connect; echo "

Abajo se muestra una lista de todos los titulares existentes. Pueden ser leidos, editados o borrados desde esta interface. Además, también puede agregar noticias al proyecto.

\n\n"; $query = "SELECT id, title, DATE_FORMAT(timestamp, '%e %b %Y, %l:%i %p') AS f_timestamp FROM headlines ORDER BY id DESC"; $result = mysql_query($query) or die("Error: $query."); if (!$result) { die("Error: $result."); } if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_object($result)) { echo "

id.php\">$row->title
  $row->f_timestamp  |  id\">editar

\n\n"; } } else { echo "

No hay titulares disponibles.

\n\n"; } } ###################################################################### # print a list of all existing headlines wihtout the admin foobage # (this is cheap and could be better) function print_all_headlines_nonadmin() { global $connect; $query = "SELECT id, title, DATE_FORMAT(timestamp, '%e %b %Y, %l:%i %p') AS f_timestamp FROM headlines ORDER BY id DESC"; $result = mysql_query($query) or die("Error: $query."); if (!$result) { die("Error: $result."); } if (mysql_num_rows($result)>0) { while ($row = mysql_fetch_object($result)) { echo "

id\">$row->title
  $row->f_timestamp

\n\n"; } } else { echo "

No hay titulares disponibles.

\n\n"; } } ###################################################################### ?>