Ejemplo n.º 1
0
 $ftp = new FTP_data();
 //
 // set file names and generade result xml
 //
 $res = mysql_query("select xControl from meeting where xMeeting = " . $_COOKIE['meeting_id']);
 $row = mysql_fetch_Array($res);
 $eventnr = $row[0];
 $local = dirname($_SERVER['SCRIPT_FILENAME']) . "/tmp/results.xml.gz";
 $remote = date("Ymd") . "_" . $eventnr . ".gz";
 $nbr_effort = $xml->gen_result_xml($local);
 // upload result file
 if ($nbr_effort > 0) {
     //upload only if file contains at least one results
     $ftp->open_connection($cfgSLVhost, $cfgSLVuser, $cfgSLVpass);
     $success = $ftp->put_file($local, $remote);
     $ftp->close_connection();
 } else {
     $success = true;
 }
 if ($success) {
     // output message and set round status to results_sent
     foreach ($GLOBALS['rounds'] as $xRunde) {
         mysql_query("UPDATE runde SET StatusUpload = 1 WHERE xRunde = {$xRunde}");
         if (mysql_errno() > 0) {
             AA_printErrorMsg(mysql_errno() . ": " . mysql_error());
         }
     }
     if ($nbr_effort > 0) {
         echo "<p><b>{$strResultsUploaded}</b></p>";
         echo $strNumberEfforts . ": " . $nbr_effort;
     } else {
Ejemplo n.º 2
0
 /**
  *	show timetable
  *	-------------------
  */
 function AA_timetable_display()
 {
     require_once './lib/cl_http_data.lib.php';
     //include class
     require_once './lib/common.lib.php';
     //include class
     require './config.inc.php';
     require './config.inc.end.php';
     $p = "./tmp";
     $fp = @fopen($p . "/index.html", 'w');
     if (!$fp) {
         AA_printErrorMsg($GLOBALS['strErrFileOpenFailed']);
         return;
     }
     $content = $cfgHtmlStart1;
     $content .= "<meta http-equiv='refresh' content='" . $GLOBALS['cfgMonitorReload'] . ";  url=http://" . $GLOBALS['cfgUrl'] . "/" . $GLOBALS['cfgDir'] . "/index.html'>";
     $content .= $GLOBALS['cfgHtmlStart2'];
     $content .= "<div id='navi'>\r\n";
     $content_navi = "<div id='navi_pc'>\r\n";
     $content .= "<div id='navi_left'>\r\n";
     require './lib/rankinglist_single.lib.php';
     require './lib/results_track.lib.php';
     require './lib/results_tech.lib.php';
     require './lib/results_high.lib.php';
     require './config.inc.php';
     require "./lib/cl_ftp_data.lib.php";
     $result = mysql_query("\r\n\t\tSELECT DISTINCT\r\n\t\t\tk.Name\r\n\t\tFROM\r\n\t\t\tathletica.wettkampf AS w\r\n\t\t\tLEFT JOIN athletica.kategorie AS k ON (w.xKategorie = k.xKategorie)\r\n\t\tWHERE w.xMeeting = " . $_COOKIE['meeting_id'] . "  \t\t\r\n\t\tORDER BY\r\n\t\t\tk.Anzeige,\r\n            k.Kurzname\r\n\t");
     if (mysql_errno() > 0) {
         AA_printErrorMsg(mysql_errno() . ": " . mysql_error());
     } else {
         // all rounds ordered by date/categorie/time
         // - count nbr of present athletes or relays (don't include
         //   athletes starting in relays)
         // - group by r.xRunde to show event-rounds entered more than once
         // - group by s.xWettkampf to count athletes per event
         // (the different date and time fields are required to properly set
         // up the table)
         $sql = "SELECT\r\n                r.xRunde\r\n                , r.Status\r\n                , rt.Typ\r\n                , k.Name\r\n                , d.Kurzname\r\n                , IF(s.xWettkampf IS NULL,0,COUNT(*))\r\n                , TIME_FORMAT(r.Startzeit, '{$cfgDBtimeFormat}')\r\n                , TIME_FORMAT(r.Startzeit, '%H')\r\n                , DATE_FORMAT(r.Datum, '{$cfgDBdateFormat}')\r\n                , r.Datum\r\n                , r.xWettkampf\r\n                , k.xKategorie\r\n                , r.Speakerstatus\r\n                , w.Info\r\n                , r.StatusZeitmessung\r\n                , r.Gruppe\r\n                , w.Typ\r\n                , w.Mehrkampfende\r\n                , w.Mehrkampfcode\r\n                , rs.xRundenset\r\n                , rs.Hauptrunde\r\n                , d.Name\r\n                , rt.Name\r\n                , r.StatusChanged\r\n                , m.StatusChanged\r\n            FROM\r\n                athletica.runde AS r\r\n                LEFT JOIN athletica.wettkampf AS w ON (r.xWettkampf = w.xWettkampf)\r\n                LEFT JOIN athletica.kategorie AS k ON (w.xKategorie = k.xKategorie)\r\n                LEFT JOIN athletica.disziplin_" . $_COOKIE['language'] . " AS d ON (w.xDisziplin = d.xDisziplin)\r\n            LEFT JOIN athletica.rundentyp_" . $_COOKIE['language'] . " AS rt\r\n                ON r.xRundentyp = rt.xRundentyp\r\n            LEFT JOIN athletica.start AS s\r\n                ON w.xWettkampf = s.xWettkampf\r\n                AND s.Anwesend = 0\r\n                AND ((d.Staffellaeufer = 0\r\n                    AND s.xAnmeldung > 0)\r\n                    OR (d.Staffellaeufer > 0\r\n                    AND s.xStaffel > 0))\r\n            LEFT JOIN athletica.rundenset AS rs ON (rs.xRunde = r.xRunde AND rs.xMeeting = " . $_COOKIE['meeting_id'] . ") \r\n            LEFT JOIN athletica.meeting AS m ON (w.xMeeting = m.xMeeting)\r\n            WHERE w.xMeeting=" . $_COOKIE['meeting_id'] . "  \r\n            AND w.Mehrkampfcode = 0\r\n            GROUP BY\r\n                r.xRunde\r\n                , s.xWettkampf\r\n             ORDER BY\r\n                r.Datum\r\n                , k.Anzeige \r\n                , r.Startzeit                \r\n                , k.Kurzname\r\n                , d.Anzeige";
         $res = mysql_query($sql);
         if (mysql_errno() > 0) {
             AA_printErrorMsg(mysql_errno() . ": " . mysql_error());
         } else {
             $date = 0;
             $hour = '';
             $time = 0;
             $i = 0;
             $l = 0;
             $s = 0;
             $k = '';
             $m_statusChanged = 'n';
             $events = array();
             // array to hold last processed round per event
             $content .= "<table class='timetable' >\r\n ";
             $content_navi .= "<table class='timetable' >\r\n ";
             $count_navi = mysql_num_rows($res);
             $count_navi_half = round($count_navi / 2, 0);
             while ($row = mysql_fetch_row($res)) {
                 /*
                  if ($i == $count_navi_half){                  
                      $content .= "</table>\r\n ";
                      $content .= "</div>\r\n ";
                      $content .= "<div id='navi_right'>\r\n";                      
                      $content .= "<table class='timetable' >\r\n ";  
                  }
                 */
                 $event = $row[10];
                 $combGroup = "";
                 // combined group if set
                 $combined = false;
                 // is combined event
                 $teamsm = false;
                 // is team sm event
                 if ($row[16] == $cfgEventType[$strEventTypeSingleCombined]) {
                     $combined = true;
                 }
                 if ($row[16] == $cfgEventType[$strEventTypeTeamSM]) {
                     $teamsm = true;
                 }
                 $roundSet = $row[19];
                 // set if round is merged
                 $roundSetMain = $row[20];
                 // main round flag of round set
                 // if main round -> count athletes from all merged rounds
                 // new date or time: start a new line
                 //if(($date != $row[8]) || ($time != $row[6]) || ($time == $row[6]) && $k != $row[3] || ($i == $count_navi_half))	// new date or time
                 if ($date != $row[8] || $time != $row[6] || $time == $row[6] && $k != $row[3]) {
                     if ($date != 0) {
                         // not first item
                         $content .= "</td>\r\n</tr> \r\n ";
                         $content_navi .= "</td>\r\n</tr> \r\n ";
                     }
                     if ($date != $row[8]) {
                         // new date -> headerline with date
                         $content .= "<tr>\r\n<th class='date' id='" . $row[9] . $row[7] . "'>" . $row[8] . "</th>\r\n<th width='100%' class='timetable'>" . $row[3] . "</th>\r\n</tr>\r\n";
                         $content_navi .= "<tr>\r\n<th class='date' id='" . $row[9] . $row[7] . "'>" . $row[8] . "</th>\r\n<th width='100%' class='timetable'>" . $row[3] . "</th>\r\n</tr>\r\n";
                     } else {
                         if ($k != $row[3]) {
                             $content .= "<tr>\r\n<th class='timetable_sub' id='" . $row[9] . $row[7] . "' /></th>\r\n<th class='timetable'>" . $row[3] . "</th>\r\n</tr>\r\n</tr>\r\n";
                             $content_navi .= "<tr>\r\n<th class='timetable_sub' id='" . $row[9] . $row[7] . "' /></th>\r\n<th class='timetable'>" . $row[3] . "</th>\r\n</tr>\r\n</tr>\r\n";
                         }
                     }
                     // ET new date or new hour
                     if ($i % 2 == 0) {
                         // even row number
                         $class = 'even';
                     } else {
                         // odd row number
                         $class = 'odd';
                     }
                     $k = '';
                     $content .= "<tr class='" . $class . "'>\r\n<th class='timetable_sub'>" . $row[6] . "</th>\r\n";
                     $content_navi .= "<tr class='" . $class . "'>\r\n<th class='timetable_sub'>" . $row[6] . "</th>\r\n";
                 } else {
                     if ($k != $row[3]) {
                         $content .= "<tr>\r\n<th class='timetable_sub' id='" . $row[9] . $row[7] . "' /></th>\r\n<th class='timetable'>" . $row[3] . "</th></tr>";
                         $content_navi .= "<tr>\r\n<th class='timetable_test' id='" . $row[9] . $row[7] . "' /></th>\r\n<th class='timetable'>" . $row[3] . "</th></tr>";
                     }
                 }
                 $i++;
                 $time = $row[6];
                 $hour = $row[7];
                 $date = $row[8];
                 $href_class = '';
                 // check round status and set correct link
                 if ($row[23] == 'y' || $row[24] == 'y') {
                     // only upload the changes rounds
                     if ($row[24] == 'y') {
                         $m_statusChanged = 'y';
                     }
                     if ($row[1] == $cfgRoundStatus['results_done'] || $row[1] == $cfgRoundStatus['results_in_progress']) {
                         if ($row[1] == $cfgRoundStatus['results_done']) {
                             $href_class = "timetable_heat_done";
                         } else {
                             $href_class = "timetable_heat_process";
                         }
                         $arr_link[$l] = $row[0];
                         $arr_link_evt[$l] = $row[10];
                         $l++;
                     } elseif ($row[1] == $cfgRoundStatus['heats_done']) {
                         $href_class = "timetable_sub";
                         $arr_link_start[$s] = $row[0];
                         $arr_cat[$s] = $row[3];
                         $arr_disc[$s] = $row[21];
                         if ($row[2] == '0') {
                             // Typ: (ohne)
                             $arr_rtyp[$s] = '';
                         } else {
                             $arr_rtyp[$s] = $row[22];
                         }
                         $arr_event[$s] = $row[10];
                         $s++;
                     }
                 }
                 // next event is in a different category: go to next cell
                 if ($k != $row[3]) {
                     if ($k != 0) {
                         // not first category
                         $content .= "</td>\r\n";
                         $content_navi .= "</td>\r\n";
                     }
                     $k = $row[3];
                     // keep current category
                     if (array_key_exists($row[10], $events) == TRUE && $combined == false && $teamsm == false) {
                         $starts = "-";
                         // get number of athletes/relays with valid result
                         if ($row[2] == 'S' || $row[2] == 'O') {
                             // round typ: S = Serie ,  O = ohne
                             $sql = "\r\n\t\t\t\t\t\t\t    SELECT\r\n\t\t\t\t\t\t\t\t    COUNT(*)\r\n\t\t\t\t\t\t\t    FROM\r\n\t\t\t\t\t\t\t\t    athletica.serienstart AS ss\r\n\t\t\t\t\t\t\t\t    LEFT JOIN athletica.serie AS s ON (s.xSerie = ss.xSerie)\r\n\t\t\t\t\t\t\t    WHERE \r\n\t\t\t\t\t\t\t         s.xRunde =" . $events[$row[10]];
                         } else {
                             $sql = "SELECT\r\n                                COUNT(*)\r\n                            FROM\r\n                                athletica.serienstart AS ss\r\n                                LEFT JOIN athletica.serie AS s ON (s.xSerie = ss.xSerie)\r\n                            WHERE ss.Qualifikation > 0   \r\n                                AND s.xRunde =" . $events[$row[10]];
                         }
                         $result = mysql_query($sql);
                         if (mysql_errno() > 0) {
                             // DB error
                             AA_printErrorMsg(mysql_errno() . ": " . mysql_error());
                         } else {
                             $start_row = mysql_fetch_row($result);
                             $starts = $start_row[0];
                             mysql_free_result($result);
                         }
                     } elseif ($combined || $teamsm) {
                         // for combined rounds, count starts for correct group
                         if ($row[17] == 1) {
                             // if this is a combined last event, every athlete starts
                             $starts = $row[5];
                         } elseif (empty($row[15])) {
                             // if no group is set
                             $starts = $row[5];
                         } else {
                             $result = mysql_query("SELECT COUNT(*) FROM\r\n\t\t\t\t\t\t\t\t\t\t\tathletica.start as st\r\n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN athletica.anmeldung as a ON (st.xAnmeldung = a.xAnmeldung)\r\n\t\t\t\t\t\t\t\t\t\tWHERE\t\r\n\t\t\t\t\t\t\t\t\t\t\tst.xWettkampf = {$row['10']}\r\n\t\t\t\t\t\t\t\t\t\t    AND\ta.Gruppe = '{$row['15']}'");
                             if (mysql_errno() > 0) {
                                 AA_printErrorMsg(mysql_errno() . ": " . mysql_error());
                             } else {
                                 $start_row = mysql_fetch_array($result);
                                 $starts = $start_row[0];
                                 mysql_free_result($result);
                             }
                             $combGroup = "&nbsp;g" . $row[15];
                         }
                     } elseif ($roundSet > 0) {
                         if ($roundSetMain == 0) {
                             $starts = "m";
                         } else {
                             $result = mysql_query("SELECT COUNT(*) FROM\r\n\t\t\t\t\t\t\t\t\t\t\tathletica.rundenset AS rs\r\n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN athletica.runde AS r ON (r.xRunde = rs.xRunde)\r\n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN athletica.wettkampf AS w ON (w.xWettkampf = r.xWettkampf)\r\n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN athletica.disziplin_" . $_COOKIE['language'] . " AS d ON (d.xDisziplin = w.xDisziplin)\r\n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN athletica.start AS s\r\n\t\t\t\t\t\t\t\t\t\t\t\tON w.xWettkampf = s.xWettkampf\r\n\t\t\t\t\t\t\t\t\t\t\t\tAND s.Anwesend = 0\r\n\t\t\t\t\t\t\t\t\t\t\t\tAND ((d.Staffellaeufer = 0\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND s.xAnmeldung > 0)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tOR (d.Staffellaeufer > 0\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND s.xStaffel > 0))\r\n\t\t\t\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\t\t\t\trs.xRundenset = {$roundSet} \t\t\t\t\t\t\t\t\t\t\r\n                                            AND s.xWettkampf > 0 \r\n                                            AND rs.xMeeting = " . $_COOKIE['meeting_id'] . "  \r\n                                            AND w.xMeeting = " . $_COOKIE['meeting_id'] . "                                         \r\n\t\t\t\t\t\t\t\t\t\t");
                             if (mysql_errno() > 0) {
                                 // DB error
                                 AA_printErrorMsg(mysql_errno() . ": " . mysql_error());
                             } else {
                                 $start_row = mysql_fetch_array($result);
                                 $starts = $start_row[0];
                                 mysql_free_result($result);
                             }
                         }
                     } else {
                         $starts = $row[5];
                     }
                     if (!empty($href_class)) {
                         $link = "live" . $row[0] . ".html";
                         $content .= "<td ><a class='{$href_class}' href='" . $link . "'>&nbsp;" . $row[4] . "&nbsp;" . $row[2] . $combGroup . "&nbsp;" . $row[13] . "</a>\r\n";
                         $content_navi .= "<td ><a class='{$href_class}' href='" . $link . "'>&nbsp;" . $row[4] . "&nbsp;" . $row[2] . $combGroup . "&nbsp;" . $row[13] . "</a>\r\n";
                     } else {
                         $content .= "<td>\r\n";
                         $content_navi .= "<td>\r\n";
                     }
                 } else {
                     if (array_key_exists($row[10], $events) == TRUE && $combined == false && $teamsm == false) {
                         $starts = "-";
                         // get number of athletes/relays with valid result
                         $result = mysql_query("\r\n\t\t\t\t\t\t\tSELECT\r\n\t\t\t\t\t\t\t\tCOUNT(*)\r\n\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t\tathletica.serienstart AS ss\r\n\t\t\t\t\t\t\t\tLEFT JOIN athletica.serie AS s ON (s.xSerie = ss.xSerie  )\r\n\t\t\t\t\t\t\tWHERE ss.Qualifikation > 0  \t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t    AND s.xRunde =" . $events[$row[10]]);
                         if (mysql_errno() > 0) {
                             // DB error
                             AA_printErrorMsg(mysql_errno() . ": " . mysql_error());
                         } else {
                             $start_row = mysql_fetch_row($result);
                             $starts = $start_row[0];
                             mysql_free_result($result);
                         }
                     } elseif ($combined || $teamsm) {
                         // for combined rounds, count starts for correct group
                         if ($row[17] == 1) {
                             // if this is a combined last event, every athlete starts
                             $starts = $row[5];
                         } elseif (empty($row[15])) {
                             // if no group is set
                             $starts = $row[5];
                         } else {
                             $result = mysql_query("SELECT COUNT(*) FROM   \r\n\t\t\t\t\t\t\t\t\t\t\tathletica.start as st\r\n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN athletica.anmeldung as a ON (st.xAnmeldung = a.xAnmeldung)\r\n\t\t\t\t\t\t\t\t\t\tWHERE\t\r\n\t\t\t\t\t\t\t\t\t\t\tst.xWettkampf = {$row['10']}\r\n\t\t\t\t\t\t\t\t\t\t    AND\ta.Gruppe = '{$row['15']}'");
                             if (mysql_errno() > 0) {
                                 // DB error
                                 AA_printErrorMsg(mysql_errno() . ": " . mysql_error());
                             } else {
                                 $start_row = mysql_fetch_array($result);
                                 $starts = $start_row[0];
                                 mysql_free_result($result);
                             }
                             $combGroup = "&nbsp;g" . $row[15];
                         }
                     } elseif ($roundSet > 0) {
                         if ($roundSetMain == 0) {
                             $starts = "m";
                         } else {
                             $result = mysql_query("SELECT COUNT(*) FROM\r\n                                            athletica.rundenset AS rs\r\n                                            LEFT JOIN athletica.runde AS r ON (r.xRunde = rs.xRunde)\r\n                                            LEFT JOIN athletica.wettkampf AS w ON ( w.xWettkampf = r.xWettkampf)\r\n                                            LEFT JOIN athletica.disziplin_" . $_COOKIE['language'] . " AS d ON ( d.xDisziplin = w.xDisziplin )\r\n                                            LEFT JOIN athletica.start AS s\r\n                                                ON w.xWettkampf = s.xWettkampf\r\n                                                AND s.Anwesend = 0\r\n                                                AND ((d.Staffellaeufer = 0\r\n                                                    AND s.xAnmeldung > 0)\r\n                                                    OR (d.Staffellaeufer > 0\r\n                                                    AND s.xStaffel > 0))\r\n                                        WHERE\r\n                                            rs.xRundenset = {$roundSet}                                         \r\n                                            AND s.xWettkampf > 0 \r\n                                            AND rs.xMeeting = " . $_COOKIE['meeting_id'] . "  \r\n                                            AND w.xMeeting = " . $_COOKIE['meeting_id'] . "   \r\n                                        ");
                             if (mysql_errno() > 0) {
                                 // DB error
                                 AA_printErrorMsg(mysql_errno() . ": " . mysql_error());
                             } else {
                                 $start_row = mysql_fetch_array($result);
                                 $starts = $start_row[0];
                                 mysql_free_result($result);
                             }
                         }
                     } else {
                         $starts = $row[5];
                     }
                     if (!empty($href_class)) {
                         $link = "live" . $row[0] . ".html";
                         $content .= "<div class='" . $class . "'>\r\n<a  class='{$href_class}'  href='" . $link . "'>&nbsp;" . $row[4] . "&nbsp;" . $row[2] . $combGroup . "&nbsp;&nbsp;" . $row[13] . "</a>\r\n";
                         $content_navi .= "<div class='" . $class . "'>\r\n<a  class='{$href_class}'  href='" . $link . "'>&nbsp;" . $row[4] . "&nbsp;" . $row[2] . $combGroup . "&nbsp;&nbsp;" . $row[13] . "</a>\r\n";
                     } else {
                         if ($time != $row[6]) {
                             $content .= "<td>\r\n";
                             $content_navi .= "<td>\r\n";
                         }
                     }
                 }
                 $events[$row[10]] = $row[0];
                 // keep last processed round per event
             }
             // END while every event round
             mysql_free_result($res);
         }
         // ET DB error event rounds
     }
     // ET DB timetable item error
     $formaction = 'view';
     $break = 'none';
     $biglist = true;
     $sepu23 = false;
     $show_efforts = 'none';
     $disc_nr = 99;
     $athleteCat = false;
     $heatSeparate = false;
     $date = '%';
     $catFrom = 0;
     $catTo = 0;
     $discFrom = 0;
     $discto = 0;
     $heatFrom = 0;
     $heatTo = 0;
     $cover = FALSE;
     $cover_timing = false;
     $content .= "</tr>\r\n</table>\r\n";
     $content_navi .= "</tr>\r\n</table>\r\n";
     // create rankinglist for every round from array link
     foreach ($arr_link as $key => $round) {
         $event = $arr_link_evt[$key];
         // Ranking list single event and all attempts
         AA_rankinglist_Single(0, $event, $round, $formaction, $break, $cover, $biglist, $cover_timing, $date, $show_efforts, $heatSeparate, $catFrom, $catTo, $discFrom, $discTo, $heatFrom, $heatTo, $athleteCat, $content_navi);
     }
     foreach ($arr_link_start as $key => $round) {
         // start list
         $layout = AA_getDisciplineType($round);
         // type determines layout
         // track disciplines, with or without wind
         if ($layout == $cfgDisciplineType[$strDiscTypeNone] || $layout == $cfgDisciplineType[$strDiscTypeTrack] || $layout == $cfgDisciplineType[$strDiscTypeTrackNoWind] || $layout == $cfgDisciplineType[$strDiscTypeDistance] || $layout == $cfgDisciplineType[$strDiscTypeRelay]) {
             AA_results_Track($round, $layout, $content_navi, $arr_cat[$key], $arr_disc[$key], $arr_rtyp[$key], $arr_event[$key]);
         } else {
             if ($layout == $cfgDisciplineType[$strDiscTypeJump] || $layout == $cfgDisciplineType[$strDiscTypeJumpNoWind] || $layout == $cfgDisciplineType[$strDiscTypeThrow]) {
                 AA_results_Tech($round, $layout, $content_navi, $arr_cat[$key], $arr_disc[$key], $arr_rtyp[$key]);
             } else {
                 if ($layout == $cfgDisciplineType[$strDiscTypeHigh]) {
                     AA_results_High($round, $layout, $singleRound, $content_navi, $arr_cat[$key], $arr_disc[$key], $arr_rtyp[$key]);
                 }
             }
         }
     }
     $content .= "</div></div>\r\n<div id='content'></div>\r\n";
     $content .= $GLOBALS['cfgHtmlEnd'];
     if (!fwrite($fp, $content)) {
         AA_printErrorMsg($GLOBALS['strErrFileWriteFailed']);
         return;
     }
     fclose($fp);
     // get ftp data
     $result = mysql_query("\r\n            SELECT\r\n                *\r\n            FROM\r\n                athletica_liveResultate.config");
     if (mysql_errno() > 0) {
         AA_printErrorMsg(mysql_errno() . ": " . mysql_error());
     } else {
         $row = mysql_fetch_row($result);
         $host = $row[1];
         $user = $row[2];
         $pwd = $row[3];
         $url = $row[4];
         mysql_free_result($result);
     }
     $ftp = new FTP_data();
     // send files per ftp
     $local = dirname($_SERVER['SCRIPT_FILENAME']) . "/tmp/index.html";
     if (empty($GLOBALS['cfgDir'])) {
         $remote = "index.html";
     } else {
         $remote = $GLOBALS['cfgDir'] . "/index.html";
     }
     // upload result file
     $ftp->open_connection($host, $user, $pwd);
     if ($m_statusChanged == 'y') {
         $success = $ftp->put_file($local, $remote);
         if (!$success) {
             AA_printErrorMsg($strErrFtpNoPut);
         }
     }
     foreach ($arr_link as $key => $round) {
         $local = dirname($_SERVER['SCRIPT_FILENAME']) . "/tmp/live" . $round . ".html";
         if (empty($GLOBALS['cfgDir'])) {
             $remote = "live" . $round . ".html";
         } else {
             $remote = $GLOBALS['cfgDir'] . "/live" . $round . ".html";
         }
         $success = $ftp->put_file($local, $remote);
     }
     foreach ($arr_link_start as $key => $round) {
         $local = dirname($_SERVER['SCRIPT_FILENAME']) . "/tmp/live" . $round . ".html";
         if (empty($GLOBALS['cfgDir'])) {
             $remote = "live" . $round . ".html";
         } else {
             $remote = $GLOBALS['cfgDir'] . "/live" . $round . ".html";
         }
         $success = $ftp->put_file($local, $remote);
     }
     $ftp->close_connection();
 }