<?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.gif" alt="GigKalender-Logo" /></div>
      </div>
      <p class="Headline">'.$L_Headline37.'</p>';
      
      $timer = startTime();
      if (isset($_POST['uninstall']))
      {
        if ($_POST['uninstall']==$L_Button23)
        {
          
          if ( isDatabasePresent() )
          {
            $SQLQuery = "DROP TABLE ".$prefix."gigs;";
            if (mysqli_query($db, $SQLQuery))
            {
              echo $L_Table_deleted.' (gigs)<br />';
            }

            $SQLQuery = "DROP TABLE ".$prefix."user;";
            if (mysqli_query($db, $SQLQuery))
            {
              echo $L_Table_deleted.' (user)<br />';
            }

            $SQLQuery = "DROP TABLE ".$prefix."setup;";
            if (mysqli_query($db, $SQLQuery))
            {
              echo $L_Table_deleted.' (setup)<br />';
            }

            $SQLQuery = "DROP TABLE ".$prefix."guestbook;";
            if (mysqli_query($db, $SQLQuery))
            {
              echo $L_Table_deleted.' (guestbook)<br />';
            }
            
            $SQLQuery = "DROP TABLE ".$prefix."news;";
            if (mysqli_query($db, $SQLQuery))
            {
              echo $L_Table_deleted.' (news)<br />';
            }
            $SQLQuery = "DROP TABLE ".$prefix."menu;";
            if (mysqli_query($db, $SQLQuery))
            {
              echo $L_Table_deleted.' (menu)<br />';
            }
            echo '<br/><b>'.$L_Deinstallation_successful.'</b><br />';
          }
          else { echo '<span class="ErrorMessage">'.$L_ERROR_No_installation_of_gigkalender_present.'</span><br />'; }
        }
        if ($_POST['uninstall']=="Nein")
        {
          echo '<span class="ErrorMessage">'.$L_ERROR_GigKalender_not_deinstalled.'</span><br />';
        }
      }
      else
      {
        echo $L_Are_you_sure_you_want_to_uninstall_gigkalender.'<br /><br />';
        echo '<span class="ErrorMessage">'.$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>'; ?>