<?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.
*/
  include ("../includes/error_reporting.php");
  header("content-type: text/html; charset=utf-8");
  include ("../gigkalender.ini.php");
  include ("../functions/standard.php");
  include ('install_language_selector.php');
  include ('../includes/header.php');

  echo '</head><body>
    <div id="Install">
      <div class="Head">
        <div class="Title"><img src="../images/gigkalender-logo.png" alt="GigKalender-Logo" /></div>
      </div>';
      $timer = startTime();
      if (isset($_POST['uninstall']))
      {
        if ($_POST['uninstall']==$L_Button23)
        {
          
          if ( getDatabasePresent() )
          {
            $SQL = "DROP TABLE ".DB_PREFIX."gigs;";
            if (mysql_query($SQL))
            {
              echo $L_Table_deleted.' (gigs)<br />';
            }

            $SQL = "DROP TABLE ".DB_PREFIX."user;";
            if (mysql_query($SQL))
            {
              echo $L_Table_deleted.' (user)<br />';
            }

            $SQL = "DROP TABLE ".DB_PREFIX."setup;";
            if (mysql_query($SQL))
            {
              echo $L_Table_deleted.' (setup)<br />';
            }

            $SQL = "DROP TABLE ".DB_PREFIX."guestbook;";
            if (mysql_query($SQL))
            {
              echo $L_Table_deleted.' (guestbook)<br />';
            }
            
            $SQL = "DROP TABLE ".DB_PREFIX."news;";
            if (mysql_query($SQL))
            {
              echo $L_Table_deleted.' (news)<br />';
            }
            $SQL = "DROP TABLE ".DB_PREFIX."menu;";
            if (mysql_query($SQL))
            {
              echo $L_Table_deleted.' (menu)<br />';
            }
            $SQL = "DROP TABLE ".DB_PREFIX."venues;";
            if (mysql_query($SQL))
            {
              echo $L_Table_deleted.' (venues)<br />';
            }
            $SQL = "DROP TABLE ".DB_PREFIX."artists;";
            if (mysql_query($SQL))
            {
              echo $L_Table_deleted.' (artists)<br />';
            }
            $SQL = "DROP TABLE ".DB_PREFIX."organizers;";
            if (mysql_query($SQL))
            {
              echo $L_Table_deleted.' (organizers)<br />';
            }
            clearCache ();
            echo '<br/><b>'.$L_Deinstallation_successful.'</b><br />';
          }
          else { echo '<span class="ERROR">'.$L_ERROR_No_installation_of_gigkalender_present.'</span><br />'; }
        }
        if ($_POST['uninstall']=="Nein")
        {
          echo '<span class="ERROR">'.$L_ERROR_GigKalender_not_deinstalled.'</span><br />';
        }
      }
      else
      {
        echo $L_Are_you_sure_you_want_to_uninstall_gigkalender.'<br /><br />';
        echo '<span class="ERROR">'.$L_WARNING_all_data_will_be_deleted.'</span><br /><br />';
        echo '
          <form method="post" action="deinstall.php" accept-charset="UTF-8">
            <fieldset>
              <input name="uninstall" type="submit" value="'.$L_Button23.'" class="button" />
              <input name="uninstall" type="submit" value="'.$L_Button24.'" class="button" />
            </fieldset>
          </form>
        ';
      }
      include ('../includes/footer.php');
    echo '</div></body></html>'; ?>