<?php
/*
    CREATIVE COMMONS - Attribution-No Derivative Works 3.0 Germany:
    - You may not alter, transform, or build upon this work.
    - Dieses Werk darf nicht bearbeitet oder in anderer Weise verändert werden.
*/
  // Variablen definieren
    
    global $DB_PREFIX;
    global $Path;
    $ImportFehler = '0';
    $FileName = 'gigs.csv';
  // Datei checken
    if ( !$datei = fopen($Path."/".$FileName, 'r') )
       { echo 'Error: File not Found! ('.$FileName.')<br /><br />'; }
    else
    {
      // Alte Datensätze löschen
        if ( $_SESSION["ImportOverwriteGigs"] )
        {
          $SQL = "DELETE FROM ".DB_PREFIX."gigs";
          $resultat = mysql_query($SQL);
          if ( $resultat ) { echo $L_Old_gigs_were_deleted.'<br />'; }
          else  { echo '<span class="ERROR">'.$_ERROR_Old_gigs_NOT_deleted.'</span><br />'; }
          
          $SQL = "DELETE FROM ".DB_PREFIX."artists";
          $resultat = mysql_query($SQL);
          if ( $resultat ) { echo $L_Old_artists_were_deleted.'<br />'; }
          else  { echo '<span class="ERROR">'.$_ERROR_Old_artists_NOT_deleted.'</span><br />'; }

          $SQL = "DELETE FROM ".DB_PREFIX."organizers";
          $resultat = mysql_query($SQL);
          if ( $resultat ) { echo $L_Old_organizers_were_deleted.'<br />'; }
          else  { echo '<span class="ERROR">'.$_ERROR_Old_organizers_NOT_deleted.'</span><br />'; }

          $SQL = "DELETE FROM ".DB_PREFIX."venues";
          $resultat = mysql_query($SQL);
          if ( $resultat ) { echo $L_Old_venues_were_deleted.'<br />'; }
          else  { echo '<span class="ERROR">'.$_ERROR_Old_venues_NOT_deleted.'</span><br />'; }
        }
      // Datensätze importieren
        include ('functions/import/'.$Version.'/gigs.php');
    }
    if ( $ImportFehler=='0' ) { echo $L_Gigs_successfully_imported.'<br />'; }
    else { echo '<span class="ERROR">'.$L_ERROR_Gigs_NOT_imported.' ('.$ImportFehler.')</span><br />'; }
  echo '<br />';
  clearCache();
?>
