echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
echo "<!DOCTYPE rss PUBLIC \"-//Netscape Communications//DTD RSS 0.91//EN\"\n";
echo "           \"http://my.netscape.com/publish/formats/rss-0.91.dtd\">\n";
echo "<rss version=\"0.91\">\n";
echo "  <channel>\n";
echo "    <title>" . $sys_name . "</title>\n";
echo "    <link>http:" . $sys_url . "</link>\n";
echo "    <description>" . $sys_name . " - " . $sys_title . "</description>\n";
echo "    <language>en-us</language>\n";
echo "  <image>\n";
echo "    <title>" . $sys_name . "</title>\n";
echo "    <url>http:" . $sys_logo_small_image . "</url>\n";
echo "    <link>http:" . $sys_url . "</link>\n";
echo "    <description>" . $sys_name . " - " . $sys_title . "</description>\n";
echo "    <width>124</width>\n";
echo "    <height>32</height>\n";
echo "  </image>\n";
$db = new DB_SourceWell();
$db->query("SELECT * FROM software,counter,auth_user WHERE software.appid=counter.appid AND software.user=auth_user.username AND software.status='A' ORDER BY software.modification DESC limit 10");
$i = 0;
while ($db->next_record()) {
    echo "  <item>\n";
    echo "    <title>" . htmlspecialchars($db->f("name")) . " " . $db->f("version") . "</title>\n";
    echo "    <link>http:" . $sys_url . "appbyid.php?id=" . $db->f("appid") . "</link>\n";
    //  echo "    <description>".wrap($db->f("description"))."</description>\n";
    echo "    <guid>http:" . $sys_url . "appbyid.php?id=" . $db->f("appid") . "</guid>\n";
    echo "  </item>\n";
    $i++;
}
echo "  </channel>\n";
echo "</rss>\n";
 if (!isset($action)) {
     $action = "check";
 }
 $where = "WHERE status='A'";
 if (isset($id)) {
     $where .= " AND appid='{$id}'";
 }
 // Check application
 $db->query("SELECT * FROM software {$where}");
 // echo"<p>SELECT * FROM software $where\n";
 $i = 0;
 while ($db->next_record()) {
     $db_appid = $db->f("appid");
     $db2 = new DB_SourceWell();
     $db2->query("SELECT * FROM history WHERE appid='{$db_appid}' ORDER BY creation_his DESC");
     $db2_exists = $db2->next_record();
     $db_modification = $db->f("modification");
     $db2_creation_his = $db2->f("creation_his");
     if ($db_modification != $db2_creation_his) {
         $timestamp = mktimestamp($db_modification);
         $title = "<b><a href=\"" . htmlentities($sess->url("appbyid.php") . $sess->add_query(array("id" => $db->f(appid)))) . "\">" . $db->f(name) . "</a> (" . $db->f(appid) . ")</b>";
         $bx->box_begin();
         $bx->box_title($title);
         $body = "Modification date: " . timestr($timestamp) . "\n";
         $timestamp = mktimestamp($db2_creation_his);
         $body .= "<br>History date: " . timestr($timestamp) . "\n";
         $bx->box_body($body);
         switch ($action) {
             case "check":
                 if ($db2_exists) {
                     $action2 = "update";
    $limit = "{$iter},10";
    $db->query("SELECT DISTINCT developer,email FROM software WHERE developer LIKE '{$by}' ORDER BY developer ASC LIMIT {$limit}");
    $bx->box_begin();
    $bx->box_title($t->translate("Authors"));
    $bx->box_body_begin();
    ?>
<table border=0 align=center cellspacing=1 cellpadding=1 width=100%>
<?php 
    echo "<tr><td><b>" . $t->translate("No") . ".</b></td><td><b>#&nbsp;" . $t->translate("Apps") . "</b></td><td><b>" . $t->translate("Names") . "</b></td><td><b>" . $t->translate("E-Mail") . "</b></td></tr>\n";
    $i = 1;
    while ($db->next_record()) {
        $developer = addslashes($db->f("developer"));
        $email = $db->f("email");
        $db2 = new DB_SourceWell();
        $db2->query("SELECT COUNT(*) FROM software WHERE developer='{$developer}' AND email='{$email}' AND status='A'");
        $db2->next_record();
        if ($db2->f("COUNT(*)")) {
            $num = "[" . sprintf("%03d", $db2->f("COUNT(*)")) . "]";
            echo "<tr><td>" . sprintf("%d", $i) . "</td>\n";
            if (empty($developer)) {
                echo "<td><a href=\"" . htmlentities($sess->url("appbydev.php") . $sess->add_query(array("developer" => "", "email" => "{$email}"))) . "\">{$num}</a></td>\n";
                echo "<td>" . $t->translate("Unknown") . "</td>\n";
            } else {
                echo "<td><a href=\"" . htmlentities($sess->url("appbydev.php") . $sess->add_query(array("developer" => $db->f("developer"), "email" => "{$email}"))) . "\">{$num}</a></td>\n";
                echo "<td>" . $db->f("developer") . "</td>\n";
            }
            if (!empty($email)) {
                echo "<td>&lt;<a href=\"mailto:" . mailtoencode($email) . "\">" . ereg_replace("\\.", " dot ", ereg_replace("@", " at ", htmlentities($email))) . "</a>&gt;</td>\n";
            } else {
                echo "<td>&nbsp;</td>\n";
            }