Location: PHPKode > scripts > GigKalender > install/iniSetup.php
<?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.
*/
  function iniSetup ()
  {
    global $allBackendCalenderFormAttributes;
    global $CharsSetupNewsChannelCopyright;
    global $CharsSetupNewsChannelDescription;
    global $CharsSetupNewsChannelLanguage;
    global $CharsSetupNewsChannelTitle;
    global $CharsURLs;
    
    global $GigKalenderPath;
    global $prefix;
    global $StandardFrontendAttributes;
    global $StandardFrontendDetailAttributes;
    global $language;

    switch ( substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 3, 2) )
    {
      case 'US': $DateFormat = 'm/d/Y'; $FirstDayOfWeek='Sunday'; break;
      case 'CA': $DateFormat = 'm/d/Y'; $FirstDayOfWeek='Sunday'; break;
      case 'AU': $DateFormat = 'm/d/Y'; $FirstDayOfWeek='Sunday'; break;
      default: $DateFormat = 'd.m.Y'; $FirstDayOfWeek='Monday';
    }
    
    $SQL1 = 'CREATE TABLE '.$prefix.'setup
    (
      SetupID INTEGER NOT NULL AUTO_INCREMENT,
      SetupAllowDoubleDates TINYINT(1),
      SetupBackendCalendarGigTypes TEXT,
      SetupBackendDateFormat CHAR(20),
      SetupBackendTimeFormat CHAR(20),
      SetupBackendUseCache TINYINT(1),
      SetupCalendarAttributeInAddGigForm TEXT,
      SetupExportSeparator CHAR(1),
      SetupFrontendAllowOptionalGigs TINYINT(1),
      SetupFrontendAllowPrivateGigs TINYINT(1),
      SetupFrontendAttributes TEXT,
      SetupFrontendCalendarCharsInFields INT,
      SetupFrontendCalendarCurrentMonthLimitFuture TINYINT(2),
      SetupFrontendCalendarCurrentMonthLimitPast TINYINT(2),
      SetupFrontendCalendarCurrentMonthShowPastGigs TINYINT(1),
      SetupFrontendCalendarCurrentMonthURL CHAR('.$CharsURLs.'),
      SetupFrontendCalendarDateFormat CHAR(20),
      SetupFrontendCalendarGigDetailsDateFormat CHAR(20),
      SetupFrontendCalendarGigDetailsShowEmptyAttributes TINYINT(1),
      SetupFrontendCalendarGigDetailsURL CHAR('.$CharsURLs.'),
      SetupFrontendCalendarMaxAmountOfGigs INT,
      SetupFrontendCalendarMaxAmountOfGigsPast INT,
      SetupFrontendCalendarPeriodSelector CHAR(10),
      SetupFrontendCalendarSelector CHAR(10),
      SetupFrontendCalendarShowMonthlySeparator TINYINT(1),
      SetupFrontendCalendarShowTableHeads TINYINT(1),
      SetupFrontendCalendarURL CHAR('.$CharsURLs.'),
      SetupFrontendCssFile CHAR('.$CharsURLs.'),
      SetupFrontendDetailAttributes TEXT,
      SetupFrontendFirstDayOfWeek CHAR(9),
      SetupFrontendGalleryURL CHAR('.$CharsURLs.'),
      SetupFrontendGuestbookDateFormat CHAR(20),
      SetupFrontendLanguage CHAR(32),
      SetupFrontendNewsDateFormat CHAR(20),
      SetupGalleryAlbumsOrder CHAR(20),
      SetupGalleryAlbumsThumbsHeight INT,
      SetupGalleryAlbumsThumbsRandomly TINYINT(1),
      SetupGalleryAlbumsThumbsWidth INT,
      SetupGuestbookEmailURL CHAR('.$CharsURLs.'),
      SetupGuestbookEntriesPerPage TINYINT(2),
      SetupGuestbookEntriesUnlock TINYINT(1),
      SetupGuestbookFormURL CHAR('.$CharsURLs.'),
      SetupGuestbookMail CHAR(50),
      SetupGuestbookSpamDomains TEXT,
      SetupGuestbookSpamIPs TEXT,
      SetupGuestbookSpamWords TEXT,
      SetupGuestbookURL CHAR('.$CharsURLs.'),
      SetupGuestbookWriteSpamLog TINYINT(1),
      SetupNewsChannelCopyright CHAR('.$CharsSetupNewsChannelCopyright.'),
      SetupNewsChannelDescription CHAR('.$CharsSetupNewsChannelDescription.'),
      SetupNewsChannelLanguage CHAR('.$CharsSetupNewsChannelLanguage.'),
      SetupNewsChannelTitle CHAR('.$CharsSetupNewsChannelTitle.'),
      SetupNewsChannelURL CHAR('.$CharsURLs.'),
      SetupNewsEntriesPerPage TINYINT(2),
      SetupRefreshtime TINYINT(2),
      SetupRowsTextareas TINYINT(2),
      SetupShowEditorInAddGigForm TINYINT(1),
      SetupUserMaximumInactivityTime TINYINT(2),
      PRIMARY KEY (SetupID)
    ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci';

      if (mysql_query($SQL1))
      {
        $SetupAllowDoubleDates = 1;
        $SetupBackendCalendarGigTypes = 'Gig, 37A537, Blocked, C80000, Option, DC6D00, Rehearsal, 0000bb';
        $SetupBackendDateFormat = $DateFormat;
        $SetupBackendTimeFormat = 'H:i';
        $SetupBackendUseCache = true;
        $SetupCalendarAttributeInAddGigForm = $allBackendCalenderFormAttributes;
        $SetupExportSeparator = ';';
        $SetupFrontendAllowOptionalGigs = 0;
        $SetupFrontendAllowPrivateGigs = 0;
        $SetupFrontendAttributes = $StandardFrontendAttributes;
        $SetupFrontendCalendarCharsInFields = 20;
        $SetupFrontendCalendarCurrentMonthLimitFuture = 12;
        $SetupFrontendCalendarCurrentMonthLimitPast = 6;
        $SetupFrontendCalendarCurrentMonthShowPastGigs = true;
        $SetupFrontendCalendarCurrentMonthURL = '';
        $SetupFrontendCalendarDateFormat = $DateFormat;
        $SetupFrontendCalendarGigDetailsDateFormat = $DateFormat;
        $SetupFrontendCalendarGigDetailsShowEmptyAttributes = false;
        $SetupFrontendCalendarGigDetailsURL = '';
        $SetupFrontendCalendarMaxAmountOfGigs = 999;
        $SetupFrontendCalendarMaxAmountOfGigsPast = 999;
        $SetupFrontendCalendarPeriodSelector = 'future';
        $SetupFrontendCalendarSelector = 'list';
        $SetupFrontendCalendarShowMonthlySeparator = 1;
        $SetupFrontendCalendarShowTableHeads = 1;
        $SetupFrontendCalendarURL = '';
        $SetupFrontendCssFile = '../styles/gigkalender.css';
        $SetupFrontendDetailAttributes = $StandardFrontendDetailAttributes;
        $SetupFrontendFirstDayOfWeek = $FirstDayOfWeek;
        $SetupFrontendGalleryURL = '';
        $SetupFrontendGuestbookDateFormat = $DateFormat.' - H:i';
        $SetupFrontendLanguage = $language;
        $SetupFrontendNewsDateFormat = $DateFormat.' - H:i';
        $SetupGalleryAlbumsOrder = '';
        $SetupGalleryAlbumsThumbsHeight = 100;
        $SetupGalleryAlbumsThumbsRandomly = 1;
        $SetupGalleryAlbumsThumbsWidth = 100;
        $SetupGuestbookEmailURL = '';
        $SetupGuestbookEntriesPerPage = 10;
        $SetupGuestbookEntriesUnlock = 1;
        $SetupGuestbookFormURL = '';
        $SetupGuestbookMail = 'hide@address.com';
        $SetupGuestbookSpamDomains = "rubyurl.com";
        $SetupGuestbookSpamIPs = "212.12.41.130";
        $SetupGuestbookSpamWords = "pussy, mature, ass, porn, fetish, anal, gay, xxx, ilovecoolgirl, adultsitepoint, sexpasspussy, showforlove, adult, lesbian, viagra, nude, tits, tgp, teenundressed, fucking, busty, naked, hardcore, doyoulovepussy, couple";
        $SetupGuestbookURL = '';
        $SetupGuestbookWriteSpamLog = false;
        $SetupNewsChannelCopyright = "Max Mustermann";
        $SetupNewsChannelDescription = "Band-News...";
        $SetupNewsChannelLanguage = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 5);
        $SetupNewsChannelTitle = "Band-News";
        $SetupNewsChannelURL = $GigKalenderPath."frontend/example_news.php";
        $SetupNewsEntriesPerPage = 10;
        $SetupRefreshtime = 1;
        $SetupRowsTextareas = 5;
        $SetupShowEditorInAddGigForm = 1;
        $SetupUserMaximumInactivityTime = 30;
        
        $SQL2 = "INSERT INTO ".$prefix."setup
        (
          SetupAllowDoubleDates,
          SetupBackendCalendarGigTypes,
          SetupBackendDateFormat,
          SetupBackendTimeFormat,
          SetupBackendUseCache,
          SetupCalendarAttributeInAddGigForm,
          SetupExportSeparator,
          SetupFrontendAllowOptionalGigs,
          SetupFrontendAllowPrivateGigs,
          SetupFrontendAttributes,
          SetupFrontendCalendarCharsInFields,
          SetupFrontendCalendarCurrentMonthLimitFuture,
          SetupFrontendCalendarCurrentMonthLimitPast,
          SetupFrontendCalendarCurrentMonthShowPastGigs,
          SetupFrontendCalendarCurrentMonthURL,
          SetupFrontendCalendarDateFormat,
          SetupFrontendCalendarGigDetailsDateFormat,
          SetupFrontendCalendarGigDetailsShowEmptyAttributes,
          SetupFrontendCalendarGigDetailsURL,
          SetupFrontendCalendarMaxAmountOfGigs,
          SetupFrontendCalendarMaxAmountOfGigsPast,
          SetupFrontendCalendarPeriodSelector,
          SetupFrontendCalendarSelector,
          SetupFrontendCalendarShowMonthlySeparator,
          SetupFrontendCalendarShowTableHeads,
          SetupFrontendCalendarURL,
          SetupFrontendCssFile,
          SetupFrontendDetailAttributes,
          SetupFrontendFirstDayOfWeek,
          SetupFrontendGalleryURL,
          SetupFrontendGuestbookDateFormat,
          SetupFrontendLanguage,
          SetupFrontendNewsDateFormat,
          SetupGalleryAlbumsOrder,
          SetupGalleryAlbumsThumbsHeight,
          SetupGalleryAlbumsThumbsRandomly,
          SetupGalleryAlbumsThumbsWidth,
          SetupGuestbookEmailURL,
          SetupGuestbookEntriesPerPage,
          SetupGuestbookEntriesUnlock,
          SetupGuestbookFormURL,
          SetupGuestbookMail,
          SetupGuestbookSpamDomains,
          SetupGuestbookSpamIPs,
          SetupGuestbookSpamWords,
          SetupGuestbookURL,
          SetupGuestbookWriteSpamLog,
          SetupNewsChannelCopyright,
          SetupNewsChannelDescription,
          SetupNewsChannelLanguage,
          SetupNewsChannelTitle,
          SetupNewsChannelURL,
          SetupNewsEntriesPerPage,
          SetupRefreshtime,
          SetupRowsTextareas,
          SetupShowEditorInAddGigForm,
          SetupUserMaximumInactivityTime
        )
        VALUES
        (
          '$SetupAllowDoubleDates',
          '$SetupBackendCalendarGigTypes',
          '$SetupBackendDateFormat',
          '$SetupBackendTimeFormat',
          '$SetupBackendUseCache',
          '$SetupCalendarAttributeInAddGigForm',
          '$SetupExportSeparator',
          '$SetupFrontendAllowOptionalGigs',
          '$SetupFrontendAllowPrivateGigs',
          '$SetupFrontendAttributes',
          '$SetupFrontendCalendarCharsInFields',
          '$SetupFrontendCalendarCurrentMonthLimitFuture',
          '$SetupFrontendCalendarCurrentMonthLimitPast',
          '$SetupFrontendCalendarCurrentMonthShowPastGigs',
          '$SetupFrontendCalendarCurrentMonthURL',
          '$SetupFrontendCalendarDateFormat',
          '$SetupFrontendCalendarGigDetailsDateFormat',
          '$SetupFrontendCalendarGigDetailsShowEmptyAttributes',
          '$SetupFrontendCalendarGigDetailsURL',
          '$SetupFrontendCalendarMaxAmountOfGigs',
          '$SetupFrontendCalendarMaxAmountOfGigsPast',
          '$SetupFrontendCalendarPeriodSelector',
          '$SetupFrontendCalendarSelector',
          '$SetupFrontendCalendarShowMonthlySeparator',
          '$SetupFrontendCalendarShowTableHeads',
          '$SetupFrontendCalendarURL',
          '$SetupFrontendCssFile',
          '$SetupFrontendDetailAttributes',
          '$SetupFrontendFirstDayOfWeek',
          '$SetupFrontendGalleryURL',
          '$SetupFrontendGuestbookDateFormat',
          '$SetupFrontendLanguage',
          '$SetupFrontendNewsDateFormat',
          '$SetupGalleryAlbumsOrder',
          '$SetupGalleryAlbumsThumbsHeight',
          '$SetupGalleryAlbumsThumbsRandomly',
          '$SetupGalleryAlbumsThumbsWidth',
          '$SetupGuestbookEmailURL',
          '$SetupGuestbookEntriesPerPage',
          '$SetupGuestbookEntriesUnlock',
          '$SetupGuestbookFormURL',
          '$SetupGuestbookMail',
          '$SetupGuestbookSpamDomains',
          '$SetupGuestbookSpamIPs',
          '$SetupGuestbookSpamWords',
          '$SetupGuestbookURL',
          '$SetupGuestbookWriteSpamLog',
          '$SetupNewsChannelCopyright',
          '$SetupNewsChannelDescription',
          '$SetupNewsChannelLanguage',
          '$SetupNewsChannelTitle',
          '$SetupNewsChannelURL',
          '$SetupNewsEntriesPerPage',
          '$SetupRefreshtime',
          '$SetupRowsTextareas',
          '$SetupShowEditorInAddGigForm',
          '$SetupUserMaximumInactivityTime'
        )";

        $resultat = mysql_query($SQL2);
        if ($resultat) return true;
          else return false;
        return true;
      }
      else return false;
  }
?>
Return current item: GigKalender