1847 lines
60 KiB
PHP
1847 lines
60 KiB
PHP
|
<?php
|
|||
|
|
|||
|
// diese Seite stellt Orga-Funktionen f<>r die eh1005-Seite zur Verf<72>gung
|
|||
|
// (Topics: ~ hei<65>t geplant, - hei<65>t im Bau, + hei<65>t implementiert.)
|
|||
|
// + diese Seite liegt im <20>ffentlichen Serverbereich, dieser darf *.php nicht als plain/text ausliefern ;)
|
|||
|
// + diese Seite verlangt zwingend https
|
|||
|
// + diese Seite fragt ein Authentifikationspasswort ab
|
|||
|
// + die Authentifikation l<>uft nach einer gewissen Zeitspanne (Konstante) ab
|
|||
|
// + es d<>rfen von dieser Seite aus keine anderen orga-spezifischen Seiten aufgerufen werden,
|
|||
|
// da dies eventuell eine Umgehungsm<73>glichkeit der Authentifizierung zur Folge haben k<>nnte
|
|||
|
|
|||
|
/*
|
|||
|
Struktur dieser Seite:
|
|||
|
+ write HTTP header
|
|||
|
+ recall session
|
|||
|
+ check, defuse and shorten input variables
|
|||
|
+ Pr<EFBFBD>fung auf https
|
|||
|
= OK => continue
|
|||
|
= FAIL => Session-Zwangslogout, Abbruchmeldung und Schlu<EFBFBD>verarbeitung
|
|||
|
+ Pr<EFBFBD>fung auf g<EFBFBD>ltigen Loginstatus, inkl. Timeout
|
|||
|
= OK => continue
|
|||
|
= FAIL => Authentifizierungsformular, Abbruchmeldung und Schlu<EFBFBD>verarbeitung
|
|||
|
+ Pr<EFBFBD>fung auf Wartungsstatus
|
|||
|
= OK => continue
|
|||
|
= FAIL => Abbruchmeldung und Schlu<EFBFBD>verarbeitung
|
|||
|
+ Login
|
|||
|
= OK => continue
|
|||
|
= FAIL => Authentifizierungsformular, Abbruchmeldung und Schlu<EFBFBD>verarbeitung
|
|||
|
+ Verarbeitung der Submit-Aktionen (POST), Anzeige der einzelnen Orga-Formulare
|
|||
|
*/
|
|||
|
|
|||
|
|
|||
|
/*
|
|||
|
known bugs / todo
|
|||
|
|
|||
|
- Script rennt in einen Loop-of-Death, wenn man auf einen Button klickt, w<EFBFBD>hrend die Seite (z.B. wegen dem Fahrplan-Editor) noch nicht fertig aufgebaut war
|
|||
|
-> Session h<EFBFBD>ngt sich auf.
|
|||
|
|
|||
|
Dieses Problem taucht auf webtest.hamburg.ccc.de auf, ist aber lokal (auf Rainers Notebook) nicht reproduzierbar.
|
|||
|
-> php-Version oder "nur" Config-Problem? (deadlock-timeout?)
|
|||
|
*/
|
|||
|
|
|||
|
// this script needs following additional server modules for PHP
|
|||
|
// - Database: (e.g. pgsql)
|
|||
|
|
|||
|
// write HTTP header (anti-cache)
|
|||
|
header('Expires: Sun, 31 Dec 1989 23:59:59 GMT');
|
|||
|
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
|||
|
header('Cache-Control: no-store, no-cache, must-revalidate');
|
|||
|
header('Cache-Control: post-check=0, pre-check=0');
|
|||
|
header('Pragma: no-cache');
|
|||
|
|
|||
|
// recall session
|
|||
|
session_cache_limiter('nocache');
|
|||
|
session_cache_expire(1);
|
|||
|
session_start();
|
|||
|
|
|||
|
//deactivate automatic use of addslashes
|
|||
|
set_magic_quotes_runtime(0);
|
|||
|
|
|||
|
// include library files
|
|||
|
// ja genau, die ist hier jetzt auch direkt aus dem htdocs abrufbar;
|
|||
|
// ist aber egal, denn da steht nix kritisches drin und die Seite ist auch rein passiv
|
|||
|
require( "clsdb.php" );
|
|||
|
|
|||
|
// define general server constants
|
|||
|
define( "SERVER_SITE_MAINTENANCE", false ); // maintenance state, set to TRUE to lock this page temporarily
|
|||
|
define( "SERVER_LOCALHOST_IP", "127.0.0.1" ); // localhost IP, which does not need authentication
|
|||
|
define( "SERVER_PROTOCOL_HTTPS", "HTTPS" ); // HTTPS protocol name
|
|||
|
|
|||
|
// define server file constants
|
|||
|
define( "SERVER_FILE_TEMPLATE", "template.shtml" ); // template file
|
|||
|
define( "SERVER_FILE_WORKSHOPS", "workshops.shtml" ); // workshops file
|
|||
|
define( "SERVER_FILE_FAHRPLAN", "fahrplan.shtml" ); // fahrplan file
|
|||
|
define( "SERVER_FILE_HEADER", "ssi_site_header.html" ); // SSI file for site header
|
|||
|
define( "SERVER_FILE_INTRO", "ssi_site_intro.html" ); // SSI file for site intro
|
|||
|
define( "SERVER_FILE_EXTRO", "ssi_site_extro.html" ); // SSI file for site extro
|
|||
|
define( "SERVER_FILE_AUTOGEN", "ssi_site_autogen.html" ); // SSI file for site autogeneration warning
|
|||
|
|
|||
|
define( "SERVER_FILE_ANMELDUNGSLISTE", "anmeldung-data/anmeldung.csv" ); // path and file for registered participants
|
|||
|
|
|||
|
// define server file constants
|
|||
|
define( "ORGA_DAYS_BREAKFAST", 3 ); // path and file for registered participants
|
|||
|
|
|||
|
// define display constants
|
|||
|
define( "DISPLAY_TEXT_NONE", " " );
|
|||
|
define( "DISPLAY_VALUE_SEPARATOR", chr(9));
|
|||
|
|
|||
|
// define auth constants
|
|||
|
define( "AUTH_TIMEOUT_MINUTES", 20 ); // idle timeout for login session
|
|||
|
define( "AUTH_SERVER_PASS", "?!?!BunnY2007!?!" ); // login password, [todo:] should be outsourced to an external, secured data file
|
|||
|
|
|||
|
// define constants for database data
|
|||
|
define( "DB_ID_NONE", 0 );
|
|||
|
define( "DB_ID_NEW", -1 );
|
|||
|
|
|||
|
$dbsmain = new clsdb;
|
|||
|
// define constants for database access
|
|||
|
// define db type as supported type
|
|||
|
$dbsmain->setdbtype( clsdb::DB_TYPE_MYSQL );
|
|||
|
$dbsmain->setdbhost( 'localhost' );
|
|||
|
$dbsmain->setdbport( 3306 );
|
|||
|
$dbsmain->setdbname( 'eh2007' );
|
|||
|
$dbsmain->setdbuser( 'eh2007' );
|
|||
|
$dbsmain->setdbpass( 'Osterhase2007' );
|
|||
|
|
|||
|
// init references to $_SESSION variables ($sxxx)
|
|||
|
$sbolauthloggedin = & $_SESSION['bolauthloginok'];
|
|||
|
$sintauthprevtime = & $_SESSION['intauthprevtime'];
|
|||
|
|
|||
|
// init session variables
|
|||
|
if ( !isset($sbolauthloggedin) ) $sbolauthloggedin = false;
|
|||
|
if ( !isset($sintauthprevtime) ) $sintauthprevtime = time();
|
|||
|
|
|||
|
// init references to $_POST variables ($pxxx)
|
|||
|
$pstrauth = & $_POST['txtauth'];
|
|||
|
$pbollogin = & $_POST['cmdlogin'];
|
|||
|
$pbollogout = & $_POST['cmdlogout'];
|
|||
|
$pbolshowanmeldungen = & $_POST['cmdshowanmeldungen'];
|
|||
|
$pbolshowkassenliste = & $_POST['cmdshowkassenliste'];
|
|||
|
$pbolmakeworkshops = & $_POST['cmdmakeworkshops'];
|
|||
|
$pbolmakefahrplan = & $_POST['cmdmakefahrplan'];
|
|||
|
$pbolrunsql = & $_POST['cmdrunsql'];
|
|||
|
$pbolwsupdate = & $_POST['cmdwsupdate'];
|
|||
|
$pbolsdactivate = & $_POST['cmdsdactivate'];
|
|||
|
$pbolsdupdate = & $_POST['cmdsdupdate'];
|
|||
|
$plstschedule = & $_POST['cboschedule'];
|
|||
|
|
|||
|
$pintwsid = & $_POST['txtwsid'];
|
|||
|
if ( !isset( $pintwsid ) ) { $pintwsid = & $_POST['cboworkshop']; }
|
|||
|
$pstrwsname = & $_POST['txtwsname'];
|
|||
|
$pstrwsspeakers = & $_POST['txtwsspeakers'];
|
|||
|
$pintwsduration = & $_POST['txtwsduration'];
|
|||
|
$pstrwscontent = & $_POST['txtwscontent'];
|
|||
|
$pstrwscomment = & $_POST['txtwscomment'];
|
|||
|
//$pstrsql = & $_POST['txtsql'];
|
|||
|
$pstrsql = stripslashes( & $_POST['txtsql'] );
|
|||
|
|
|||
|
// init post variables (only for mandatory variables, ignore variables submitted by special forms!)
|
|||
|
if ( !isset($pstrauth) ) $pstrauth = '';
|
|||
|
if ( !isset($pintwsid) ) $pintwsid = constant("DB_ID_NONE");
|
|||
|
if ( !isset($pstrwsname) ) $pstrwsname = '';
|
|||
|
if ( !isset($pstrwsspeakers) ) $pstrwsspeakers = '';
|
|||
|
if ( !isset($pintwsduration) ) $pintwsduration = 0;
|
|||
|
if ( !isset($pstrwscontent) ) $pstrwscontent = '';
|
|||
|
if ( !isset($pstrwscomment) ) $pstrwscomment = '';
|
|||
|
if ( !isset($pstrsql) ) $pstrsql = '';
|
|||
|
if ( !isset($plstschedule) ) $plstschedule = array();
|
|||
|
|
|||
|
// init instance variables
|
|||
|
$intnow = time();
|
|||
|
|
|||
|
$strmsg = ''; // (status/error/etc.) message to user
|
|||
|
$bolauthabort = false; // auth check will be aborted: show authentication page
|
|||
|
$bolauthlogoutnow = false; // user will be logged out
|
|||
|
|
|||
|
$strdbfields = array();
|
|||
|
$strdbsql = '';
|
|||
|
$strdbsql2 = '';
|
|||
|
$strdbrow = '';
|
|||
|
|
|||
|
$strweekdayname = array (1 => 'Sonntag',
|
|||
|
2 => 'Montag',
|
|||
|
3 => 'Dienstag',
|
|||
|
4 => 'Mittwoch',
|
|||
|
5 => 'Donnerstag',
|
|||
|
6 => 'Freitag',
|
|||
|
7 => 'Samstag');
|
|||
|
|
|||
|
$strvalue = '';
|
|||
|
$intindex = 0;
|
|||
|
$intcolrotate = 1;
|
|||
|
$strinput = '';
|
|||
|
$stroutput = '';
|
|||
|
$intfileid = 0;
|
|||
|
$intcount = 0;
|
|||
|
|
|||
|
$strauth = '';
|
|||
|
$bollogin = false;
|
|||
|
$bollogout = false;
|
|||
|
$bolshowanmeldungen = false;
|
|||
|
$bolshowkassenliste = false;
|
|||
|
$bolmakefahrplan = false;
|
|||
|
$bolmakeworkshops = false;
|
|||
|
$bolrunsql = false;
|
|||
|
$bolwsupdate = false;
|
|||
|
$bolsdactivate = false;
|
|||
|
$bolsdupdate = false;
|
|||
|
|
|||
|
$strtablehead = '';
|
|||
|
$intcolrot = 0;
|
|||
|
$intsdyear = 0;
|
|||
|
$intsdmonth = 0;
|
|||
|
$intsdday = 0;
|
|||
|
$intsdhour = 0;
|
|||
|
$strroname = '';
|
|||
|
$boleof = false;
|
|||
|
$strworkshoplist = '';
|
|||
|
$intwsid = constant("DB_ID_NONE");
|
|||
|
$strwsname = '';
|
|||
|
$strwsspeakers = '';
|
|||
|
$intwsduration = 0;
|
|||
|
$strwscontent = '';
|
|||
|
$strwscomment = '';
|
|||
|
$strsql= '';
|
|||
|
$strdbfields = '';
|
|||
|
$lstschedule = array();
|
|||
|
$strscheduleindex = '';
|
|||
|
$intscheduleindex = constant("DB_ID_NONE");
|
|||
|
$intschedulevalue = constant("DB_ID_NONE");
|
|||
|
|
|||
|
$bolok = false; // action feedback, triggers confirmation if true or warning if false
|
|||
|
|
|||
|
// function library
|
|||
|
|
|||
|
function addmsg ($straddmsg)
|
|||
|
{
|
|||
|
// adds $straddmsg to $strmsg
|
|||
|
global $strmsg;
|
|||
|
if ( $straddmsg != '' )
|
|||
|
{
|
|||
|
$strmsg = $strmsg . '<li>' . $straddmsg . '</li>';
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
function showmsg ()
|
|||
|
{
|
|||
|
// shows messages in $strmsg if available
|
|||
|
global $strmsg, $bolok;
|
|||
|
if ( $strmsg != '' )
|
|||
|
{
|
|||
|
echo'
|
|||
|
<div class="announcement">
|
|||
|
<h1 class="';
|
|||
|
if ( $bolok )
|
|||
|
{
|
|||
|
echo 'confirmation';
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
echo 'warning';
|
|||
|
}
|
|||
|
echo '">Feedback</h1>
|
|||
|
<ul>' . $strmsg . '</ul>
|
|||
|
</div>';
|
|||
|
$strmsg = '';
|
|||
|
$bolok = false;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
function selectws ( $intwsid )
|
|||
|
{
|
|||
|
// selects workshop with $intwsid of $strworkshoplist
|
|||
|
global $strworkshoplist;
|
|||
|
return str_replace(
|
|||
|
'<option value="' . $intwsid . '">',
|
|||
|
'<option value="' . $intwsid . '" selected="selected">',
|
|||
|
$strworkshoplist );
|
|||
|
}
|
|||
|
|
|||
|
// check input variables
|
|||
|
//$bollogin = isset( $pbollogin ); // does not work in IE when submitted from within a text field by pressing Return key, reason unknown
|
|||
|
$bollogin = ( isset( $pbollogin ) || $pstrauth != '' ); //workaround for IE problem, see line above
|
|||
|
$bollogout = ( isset( $pbollogout ) || $bollogin ); //also fire a logout before (re-)login
|
|||
|
$bolshowanmeldungen = ( isset( $pbolshowanmeldungen ) );
|
|||
|
$bolshowkassenliste = ( isset( $pbolshowkassenliste ) );
|
|||
|
$bolmakefahrplan = ( isset( $pbolmakefahrplan ) );
|
|||
|
$bolmakeworkshops = ( isset( $pbolmakeworkshops ) );
|
|||
|
$bolrunsql = ( isset( $pbolrunsql ) );
|
|||
|
$bolwsupdate = ( isset( $pbolwsupdate ) );
|
|||
|
$bolsdactivate = ( isset( $pbolsdactivate ) );
|
|||
|
$bolsdupdate = ( isset( $pbolsdupdate ) );
|
|||
|
|
|||
|
$intwsid = $pintwsid;
|
|||
|
$strwsname = $pstrwsname;
|
|||
|
$strwsspeakers = $pstrwsspeakers;
|
|||
|
$intwsduration = $pintwsduration;
|
|||
|
$strwscontent = $pstrwscontent;
|
|||
|
$strwscomment = $pstrwscomment;
|
|||
|
$strsql = $pstrsql;
|
|||
|
|
|||
|
// todo: check control lists for invalid values!
|
|||
|
$lstschedule = $plstschedule;
|
|||
|
|
|||
|
// defuse input variables
|
|||
|
$strauth = trim( htmlentities( $pstrauth, ENT_QUOTES ));
|
|||
|
$intwsid = intval( $intwsid );
|
|||
|
$strwsname = trim( htmlentities( $strwsname, ENT_QUOTES ));
|
|||
|
$strwsspeakers = trim( htmlentities( $strwsspeakers, ENT_QUOTES ));
|
|||
|
$intwsduration = intval( $intwsduration );
|
|||
|
$strwscontent = trim( htmlentities( $strwscontent, ENT_QUOTES ));
|
|||
|
$strwscomment = trim( htmlentities( $strwscomment, ENT_QUOTES ));
|
|||
|
$strsql = trim( htmlentities( $strsql, ENT_QUOTES ));
|
|||
|
|
|||
|
// shorten input variables
|
|||
|
if ( strlen( $strauth ) > 255 ) $strauth = substr( $strauth, 0, 255 ); //cut it, do not modify
|
|||
|
if ( strlen( $strwsname ) > 255 ) $strwsname = substr( $strwsname, 0, 252 ) . "...";
|
|||
|
if ( strlen( $strwsspeakers ) > 255 ) $strwsspeakers = substr( $strwsspeakers, 0, 252 ) . "...";
|
|||
|
if ( strlen( $strwscontent ) > 4095 ) $strwscontent = substr( $strwscontent, 0, 4092 ) . "...";
|
|||
|
if ( strlen( $strwscomment ) > 4095 ) $strwscomment = substr( $strwscomment, 0, 4092 ) . "...";
|
|||
|
if ( strlen( $strsql ) > 4095 ) $strsql = substr( $strsql, 0, 4095 ); //cut it, do not modify
|
|||
|
|
|||
|
|
|||
|
if
|
|||
|
(
|
|||
|
// localhost access
|
|||
|
(
|
|||
|
// direkter Aufruf von localhost
|
|||
|
htmlspecialchars( $_SERVER['HTTP_X_FORWARDED_FOR'], ENT_QUOTES ) == ''
|
|||
|
&&
|
|||
|
htmlspecialchars( $_SERVER['REMOTE_ADDR'], ENT_QUOTES ) == constant("SERVER_LOCALHOST_IP")
|
|||
|
)
|
|||
|
||
|
|||
|
(
|
|||
|
// indirekter Aufruf (z.B. transparenter SSL-Proxy) mit <20>bergebenem localhost
|
|||
|
htmlspecialchars( $_SERVER['HTTP_X_FORWARDED_FOR'], ENT_QUOTES ) == constant("SERVER_LOCALHOST_IP")
|
|||
|
)
|
|||
|
)
|
|||
|
{
|
|||
|
// localhost ist immer eingeloggt
|
|||
|
$sbolauthloggedin = true;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// check protocol and timeout
|
|||
|
// check secure connection
|
|||
|
// possible results:
|
|||
|
// - secure => continue
|
|||
|
// - insecure => force logout ($bolauthlogoutnow), show error page and prepare message ($strmsg)
|
|||
|
if
|
|||
|
(
|
|||
|
(
|
|||
|
// direct connection without HTTPS
|
|||
|
$_SERVER['HTTPS'] == ''
|
|||
|
&&
|
|||
|
$_SERVER['HTTP_X_FORWARDED_PROTO'] == ''
|
|||
|
)
|
|||
|
||
|
|||
|
(
|
|||
|
// indirect connection without local HTTPS proxy, e.g. orenosp
|
|||
|
strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) != strtolower(constant("SERVER_PROTOCOL_HTTPS"))
|
|||
|
&& $_SERVER['HTTP_X_FORWARDED_PROTO'] != ''
|
|||
|
)
|
|||
|
)
|
|||
|
{
|
|||
|
// insecure connection -> abort
|
|||
|
if ( !$bolauthlogoutnow && $sbolauthloggedin )
|
|||
|
{
|
|||
|
// active login over insecure connection -> force logout
|
|||
|
$bolauthlogoutnow = true;
|
|||
|
addmsg ( 'Du wirst ausgeloggt, da Deine Verbindung unsicher (unverschl<68>sselt) geworden ist.' );
|
|||
|
}
|
|||
|
addmsg ( '<a href="https://' . $_SERVER['HTTP_HOST'] . $_SERVER["PHP_SELF"] . '">Dein Verbindungsprotokoll ist HTTP. Bitte verwende f<>r die Orga-Seite Verschl<68>sselung mittels HTTPS.</a>' );
|
|||
|
$bolauthabort = true;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
// check auth timeout
|
|||
|
// possible results:
|
|||
|
// - auth active => continue
|
|||
|
// - auth timeout => force logout ($bolauthlogoutnow), prepare message ($strmsg) and continue
|
|||
|
|
|||
|
if ( $sbolauthloggedin && !$bolauthlogoutnow && ( $intnow > ( $sintauthprevtime + 60 * constant("AUTH_TIMEOUT_MINUTES") )))
|
|||
|
{
|
|||
|
// write message on user authentication expired -> also fire a logout ($bolauthlogoutnow)
|
|||
|
// echo '<div class="warning">Du wurdest ausgeloggt wegen mehr als ' . constant("AUTH_TIMEOUT_MINUTES") . ' Minuten Inaktivität.</div><br>';
|
|||
|
$bolauthlogoutnow = true;
|
|||
|
addmsg ( 'Du wirst ausgeloggt wegen mehr als ' . constant("AUTH_TIMEOUT_MINUTES") . ' Minuten Inaktivität.' );
|
|||
|
}
|
|||
|
// restart timeout
|
|||
|
$sintauthprevtime = $intnow;
|
|||
|
}
|
|||
|
|
|||
|
if ( $bolauthlogoutnow || $bollogout )
|
|||
|
{
|
|||
|
// logout
|
|||
|
if ( $bolauthlogoutnow )
|
|||
|
{
|
|||
|
addmsg ( 'Du wurdest automatisch ausgeloggt. Bitte gegebenenfalls erneut einloggen.' );
|
|||
|
}
|
|||
|
$sbolauthloggedin = false;
|
|||
|
}
|
|||
|
|
|||
|
// check maintenance state
|
|||
|
if ( constant("SERVER_SITE_MAINTENANCE") )
|
|||
|
{
|
|||
|
// cancel because of maintenance
|
|||
|
addmsg ( 'Die Orga-Seite ist zurzeit wegen Wartungsarbeiten deaktiviert. Bitte später wiederkommen. Danke.' );
|
|||
|
$bolauthabort = true;
|
|||
|
}
|
|||
|
|
|||
|
// Well, Checkpoint.
|
|||
|
// Now a defined and normal state of checking has been reached.
|
|||
|
// Possible states are now:
|
|||
|
// - $sbolauthloggedin = true: user has successfully authenticated and is still logged in
|
|||
|
// - $sbolauthloggedin = false: user is either not (yet) authenticated or authentication has been expired
|
|||
|
// If there were any messages on the way up to here, they are stored as list items (<li>) in variable $strmsg.
|
|||
|
|
|||
|
|
|||
|
// check auth phrase if user tries to login
|
|||
|
if ( !$bolauthabort && $bollogin && $strauth > '' )
|
|||
|
{
|
|||
|
if ( $strauth == constant("AUTH_SERVER_PASS") )
|
|||
|
{
|
|||
|
// login accepted
|
|||
|
$sbolauthloggedin = true;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// login failed
|
|||
|
$sbolauthloggedin = false;
|
|||
|
addmsg ( 'Das klappt so nicht. Vermutlich hast Du Dich vertippt.' );
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// prepare orga page
|
|||
|
// assume that all ssi files are there. No, I won't check _that_ explicitely.
|
|||
|
// If they ain't there, the user gets a partial page. ...so what? ;o)
|
|||
|
|
|||
|
readfile( constant("SERVER_FILE_HEADER") );
|
|||
|
echo'
|
|||
|
<!-- begin of specific page header -->
|
|||
|
<title>Easterhegg 2007 - Orga</title>
|
|||
|
<!-- end of specific page header -->';
|
|||
|
|
|||
|
readfile( constant("SERVER_FILE_INTRO") );
|
|||
|
echo'
|
|||
|
<!-- begin of specific page content -->
|
|||
|
';
|
|||
|
|
|||
|
echo
|
|||
|
'
|
|||
|
<div id="main">
|
|||
|
|
|||
|
<h1>interne Orga</h1>
|
|||
|
|
|||
|
';
|
|||
|
|
|||
|
// show msg, if available
|
|||
|
if ( $strmsg != '' )
|
|||
|
{
|
|||
|
echo'
|
|||
|
<div class="announcement">
|
|||
|
<h1 class="warning">Authentifizierungshinweis:</h1>
|
|||
|
<ul>' . $strmsg . '</ul>
|
|||
|
</div>';
|
|||
|
$strmsg = '';
|
|||
|
}
|
|||
|
|
|||
|
if ( !$sbolauthloggedin )
|
|||
|
{
|
|||
|
// show authentication page and then die
|
|||
|
|
|||
|
if ( !$bolauthabort )
|
|||
|
{
|
|||
|
// show login form
|
|||
|
echo'
|
|||
|
<div class="chapter">
|
|||
|
<h1>*knock-knock*</h1>
|
|||
|
<form id="loginform" name="loginform" action="' . $_SERVER["PHP_SELF"] . '" method="post">
|
|||
|
<input name="txtauth" type="password">
|
|||
|
<input name="cmdlogin" type="submit" value="Lass mich rein!">
|
|||
|
</form>
|
|||
|
</div>';
|
|||
|
}
|
|||
|
|
|||
|
// close page and stoprun.
|
|||
|
echo'
|
|||
|
|
|||
|
<!-- end of specific page content -->
|
|||
|
|
|||
|
';
|
|||
|
readfile( constant("SERVER_FILE_EXTRO") );
|
|||
|
|
|||
|
die();
|
|||
|
}
|
|||
|
|
|||
|
// Well, Checkpoint.
|
|||
|
// Now the user is proofed to be successfully logged in. (All others are wiped out.)
|
|||
|
// From here on the user is authorized to enjoy all the following features.
|
|||
|
// default sequence within each chapter:
|
|||
|
// 1. headline
|
|||
|
// 2. submit action
|
|||
|
// 3. showmsg();
|
|||
|
// 4. user forms
|
|||
|
// 5. showmsg();
|
|||
|
// 6. five empty rows to separate from next chapter ;)
|
|||
|
|
|||
|
// show logout chapter
|
|||
|
echo'
|
|||
|
<div class="chapter">
|
|||
|
<h1>Logout</h1>
|
|||
|
</div>';
|
|||
|
showmsg();
|
|||
|
echo '
|
|||
|
<div>
|
|||
|
<form id="logoutform" name="logoutform" action="' . $_SERVER["PHP_SELF"] . '" method="post">
|
|||
|
<p>
|
|||
|
<input name="cmdlogout" type="submit" value="Habe fertig!" />
|
|||
|
</p>
|
|||
|
</form>
|
|||
|
</div>';
|
|||
|
showmsg();
|
|||
|
|
|||
|
|
|||
|
// show anmeldungen
|
|||
|
echo'
|
|||
|
<a name="anmeldungen"></a>
|
|||
|
<div class="chapter">
|
|||
|
<h1>Anmeldungen anzeigen</h1>
|
|||
|
<form id="showanmeldungenform" name="showanmeldungen" action="' . $_SERVER["PHP_SELF"] . '#anmeldungen" method="post">
|
|||
|
<p>
|
|||
|
<input name="cmdshowanmeldungen" type="submit" value="Anmeldungen anzeigen" />
|
|||
|
</p>
|
|||
|
</form>
|
|||
|
</div>';
|
|||
|
|
|||
|
if ( $bolshowanmeldungen )
|
|||
|
{
|
|||
|
// Anmeldungen anzeigen
|
|||
|
// hmm, das hier musste jetzt mal schnell gehen, sch<63>ner oder gar effizienter Code ist das nat<61>rlich absolut nicht ;-)
|
|||
|
|
|||
|
$strinput = file_get_contents( constant("SERVER_FILE_ANMELDUNGSLISTE") );
|
|||
|
$strinput = htmlentities( $strinput, ENT_QUOTES );
|
|||
|
$strinput = str_replace( chr(13), '', $strinput );
|
|||
|
$strinput = str_replace( chr(10), '</td></tr><tr><td class="db">', $strinput );
|
|||
|
$strinput = str_replace( chr(9), '</td><td class="db">', $strinput );
|
|||
|
$stroutput = '<table><tr class="dbhead"><td class="db">' . $strinput . '</td></tr></table>';
|
|||
|
$stroutput = str_replace( '<tr><td class="db"></td></tr>', '', $stroutput );
|
|||
|
|
|||
|
$strinput = file( constant("SERVER_FILE_ANMELDUNGSLISTE") );
|
|||
|
|
|||
|
$intsumanmeldungen = 0;
|
|||
|
$intsumeinnahmen = 0;
|
|||
|
$intsumwurst = 0;
|
|||
|
$intsumkaese = 0;
|
|||
|
$intsummarmelade = 0;
|
|||
|
$intsumobst = 0;
|
|||
|
$intsummuesli = 0;
|
|||
|
$eintritt = array( 'Normal' => 50, 'Mitglied' => 35, 'Engel' => 25, 'Ermaeszigt' => 25 );
|
|||
|
foreach ($strinput as $intlinenum => $strline) {
|
|||
|
if ( $intlinenum != 0 && strlen( $strline ) > 0)
|
|||
|
{
|
|||
|
list($strnick, $strstatus, $stremail, $intwurst, $intkaese, $intmarmelade, $intobst, $intmuesli, $strtimestamp) = explode(chr(9), $strline);
|
|||
|
|
|||
|
$intsumanmeldungen = $intsumanmeldungen + 1;
|
|||
|
$intsumeinnahmen = $intsumeinnahmen + $eintritt[$strstatus];
|
|||
|
|
|||
|
$intsumwurst = $intsumwurst + $intwurst;
|
|||
|
$intsumkaese = $intsumkaese + $intkaese;
|
|||
|
$intsummarmelade = $intsummarmelade + $intmarmelade;
|
|||
|
$intsumobst = $intsumobst + $intobst;
|
|||
|
$intsummuesli = $intsummuesli + $intmuesli;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
echo '<div class="box">';
|
|||
|
echo '<span class="topic">nach Status:</span>';
|
|||
|
echo '<span class="line">Normal: ' . substr_count( $stroutput, '>Normal<' ) . '</span>';
|
|||
|
echo '<span class="line">Mitglieder: ' . substr_count( $stroutput, '>Mitglied<' ) . '</span>';
|
|||
|
echo '<span class="line">Engel: ' . substr_count( $stroutput, '>Engel<' ) . '</span>';
|
|||
|
echo '<span class="line">Ermäßigt: ' . substr_count( $stroutput, '>Ermaeszigt<' ) . '</span>';
|
|||
|
echo '<hr />';
|
|||
|
echo '<span class="line important">Gesamt: ' . $intsumanmeldungen . '</span>';
|
|||
|
echo '<span class="line important">Einnahmen: ' . $intsumeinnahmen . ' Euro</span>';
|
|||
|
echo '</div>';
|
|||
|
|
|||
|
echo '<div class="box">';
|
|||
|
echo '<span class="topic">nach Futter: pro Tag (' . constant("ORGA_DAYS_BREAKFAST") . ' Tage)</span>';
|
|||
|
echo '<span class="line">Wurst: ' . $intsumwurst . ' (' . ( constant("ORGA_DAYS_BREAKFAST") * $intsumwurst ) . ')' . '</span>';
|
|||
|
echo '<span class="line">Käse: ' . $intsumkaese . ' (' . ( constant("ORGA_DAYS_BREAKFAST") * $intsumkaese ) . ')' . '</span>';
|
|||
|
echo '<span class="line">Marmelade: ' . $intsummarmelade . ' (' . ( constant("ORGA_DAYS_BREAKFAST") * $intsummarmelade ) . ')' . '</span>';
|
|||
|
echo '<span class="line">Obst: ' . $intsumobst . ' (' . ( constant("ORGA_DAYS_BREAKFAST") * $intsumobst ) . ')' . '</span>';
|
|||
|
echo '<span class="line">Müsli: ' . $intsummuesli . ' (' . ( constant("ORGA_DAYS_BREAKFAST") * $intsummuesli ) . ')' . '</span>';
|
|||
|
echo '<hr />';
|
|||
|
echo '<span class="line important">Br<42>tchen gesamt: ' . ( $intsumwurst + $intsumkaese + $intsummarmelade ) . ' (' . ( 4 * ( $intsumwurst + $intsumkaese + $intsummarmelade ) ) . ')' . '</span>';
|
|||
|
echo '</div>';
|
|||
|
|
|||
|
echo '<div class="box">' . $stroutput . '</div>';
|
|||
|
|
|||
|
}
|
|||
|
showmsg();
|
|||
|
|
|||
|
|
|||
|
// show kassenliste
|
|||
|
echo'
|
|||
|
<a name="kassenliste"></a>
|
|||
|
<div class="chapter">
|
|||
|
<h1>Kassenliste anzeigen</h1>
|
|||
|
<form id="showkassenlisteform" name="showkassenliste" action="' . $_SERVER["PHP_SELF"] . '#kassenliste" method="post">
|
|||
|
<p>
|
|||
|
<input name="cmdshowkassenliste" type="submit" value="Kassenliste anzeigen" />
|
|||
|
</p>
|
|||
|
</form>
|
|||
|
</div>';
|
|||
|
|
|||
|
if ( $bolshowkassenliste )
|
|||
|
{
|
|||
|
// Kassenliste anzeigen
|
|||
|
// hmm, das hier musste jetzt mal schnell gehen, sch<63>ner oder gar effizienter Code ist das nat<61>rlich absolut nicht ;-)
|
|||
|
|
|||
|
$strinput = file( constant("SERVER_FILE_ANMELDUNGSLISTE") );
|
|||
|
natcasesort ( $strinput );
|
|||
|
|
|||
|
$eintritt = array( 'Normal' => 50, 'Mitglied' => 35, 'Engel' => 25, 'Ermaeszigt' => 25 );
|
|||
|
$stroutput = '';
|
|||
|
foreach ($strinput as $intlinenum => $strline)
|
|||
|
{
|
|||
|
if ( $intlinenum != 0 && strlen( $strline ) > 0)
|
|||
|
{
|
|||
|
list($strnick, $strstatus, $stremail, $intwurst, $intkaese, $intmarmelade, $intobst, $intmuesli, $strtimestamp) = explode(chr(9), $strline);
|
|||
|
|
|||
|
$strnick = htmlentities( $strnick, ENT_QUOTES );
|
|||
|
|
|||
|
$stroutput = $stroutput . chr(13) . '<tr><td class="db">' . $strstatus . ' </td><td class="db ';
|
|||
|
switch ( $strstatus )
|
|||
|
{
|
|||
|
case 'Ermaeszigt':
|
|||
|
case 'Engel':
|
|||
|
$stroutput = $stroutput . 'left';
|
|||
|
break;
|
|||
|
case 'Mitglied':
|
|||
|
$stroutput = $stroutput . 'center';
|
|||
|
break;
|
|||
|
case 'Normal':
|
|||
|
$stroutput = $stroutput . 'right';
|
|||
|
break;
|
|||
|
}
|
|||
|
$stroutput = $stroutput . '">' . $eintritt[$strstatus] . '</td><td class="db">' . $strnick . '</td></tr>';
|
|||
|
}
|
|||
|
}
|
|||
|
$stroutput = '<table><tr class="dbhead"><td class="db">Status</td><td class="db">Eintritt</td><td class="db">Nick</td>' . $stroutput . '</table>';
|
|||
|
|
|||
|
echo '<div class="box">' . $stroutput . '</div>';
|
|||
|
|
|||
|
}
|
|||
|
showmsg();
|
|||
|
|
|||
|
|
|||
|
/* ignore this for 2007
|
|||
|
|
|||
|
// show make workshops chapter
|
|||
|
echo'
|
|||
|
<div class="chapter">
|
|||
|
<h1>make install Workshops</h1>
|
|||
|
</div>';
|
|||
|
|
|||
|
if ( $bolmakeworkshops )
|
|||
|
{
|
|||
|
//make workshops
|
|||
|
|
|||
|
$bolok = false;
|
|||
|
|
|||
|
$stroutput = '';
|
|||
|
|
|||
|
// read workshops
|
|||
|
$strdbsql = " select ws_id, ws_name, ws_speakers, ws_content" .
|
|||
|
" from tbl_workshops ws" .
|
|||
|
" order by ws_name";
|
|||
|
addmsg ( 'Running SQL: ' . $strdbsql );
|
|||
|
if ( $dbsmain->runsql( $strdbsql ) )
|
|||
|
{
|
|||
|
if ( $dbsmain->getdbrowcount() > 0 )
|
|||
|
{
|
|||
|
// workshops found
|
|||
|
// -> use them
|
|||
|
|
|||
|
while ( $dbsmain->getdbrow ( $strdbrow ))
|
|||
|
{
|
|||
|
// for each workshop:
|
|||
|
$stroutput = $stroutput .'
|
|||
|
<p>
|
|||
|
<a id="ws' . $strdbrow['ws_id'] . '" class="linktarget"> </a>
|
|||
|
<h1>' . $strdbrow['ws_name'] . '</h1>
|
|||
|
<p>
|
|||
|
<span class="topic">' . $strdbrow['ws_speakers'] . '</span>
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
' . html_entity_decode( $strdbrow['ws_content'], ENT_QUOTES ) . '
|
|||
|
</p>
|
|||
|
</p>';
|
|||
|
}
|
|||
|
// don't allow to finish properly until finished developing!
|
|||
|
$bolok = true;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// no workshops found
|
|||
|
// -> hmm, that should not happen, but even then there should be no data anyway...
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// error accessing database
|
|||
|
addmsg ( 'Sorry, die Datenbank ist momentan nicht f<>r die Abfrage der Workshops verf<72>gbar.<br />Die Datenbank sagt: ' . $dbsmain->getdberror() );
|
|||
|
}
|
|||
|
if ( $bolok )
|
|||
|
{
|
|||
|
// operation has succeeded -> now generate workshop file
|
|||
|
|
|||
|
$stroutput = '
|
|||
|
<div id="main">
|
|||
|
<h1>Workshops</h1>
|
|||
|
Stand: ' . date( "d.m.Y H:i:s", $intnow ) . '
|
|||
|
|
|||
|
<div>
|
|||
|
' . $stroutput . '
|
|||
|
</div>
|
|||
|
</div>';
|
|||
|
|
|||
|
// add autogeneration-warning
|
|||
|
$stroutput = file_get_contents( constant("SERVER_FILE_AUTOGEN") ) . $stroutput;
|
|||
|
$strinput = file_get_contents( constant("SERVER_FILE_TEMPLATE") );
|
|||
|
$strinput = str_replace( "[%title%]", "Workshops", $strinput );
|
|||
|
$stroutput = str_replace( "[%content%]", $stroutput, $strinput );
|
|||
|
|
|||
|
if ( is_writable( constant("SERVER_FILE_WORKSHOPS") ))
|
|||
|
{
|
|||
|
file_put_contents( constant("SERVER_FILE_WORKSHOPS"), $stroutput );
|
|||
|
// file_put_contents does not work with PHP 4.x, so use instead: fopen, fwrite, fclose
|
|||
|
//$intfileid = fopen( constant("SERVER_FILE_WORKSHOPS"), "w" );
|
|||
|
//fwrite( $intfileid, $stroutput );
|
|||
|
//fclose( $intfileid );
|
|||
|
$bolok = true;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
addmsg ( 'Die Workshopdatei "' . constant("SERVER_FILE_WORKSHOPS") . '" konnte nicht geschrieben werden. (Rechteproblem?)');
|
|||
|
$bolok = false;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// write result
|
|||
|
if ( $bolok )
|
|||
|
{
|
|||
|
addmsg ( 'Die Workshopdatei wurde erfolgreich aktualisiert.' );
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
addmsg ( 'Die Workshopdatei wurde nicht aktualisiert.' );
|
|||
|
}
|
|||
|
}
|
|||
|
showmsg();
|
|||
|
|
|||
|
echo'
|
|||
|
<div>
|
|||
|
<form id="makeworkshopsform" name="makeworkshopsform" action="' . $_SERVER["PHP_SELF"] . '" method="post">
|
|||
|
<p>Hier wird die (statische) Workshopseite auf Basis der aktuellen Datenbank neu erstellt. <br />Achtung: Die alte Workshopseite wird dabei unwiderruflich <EFBFBD>berschrieben!</p>
|
|||
|
<p>
|
|||
|
<input name="cmdmakeworkshops" type="submit" value="Workshopdatei jetzt erstellen!" />
|
|||
|
</p>
|
|||
|
</form>
|
|||
|
</div>';
|
|||
|
showmsg();
|
|||
|
|
|||
|
// show make fahrplan chapter
|
|||
|
echo'
|
|||
|
<div class="chapter">
|
|||
|
<h1>make install Fahrplan</h1>
|
|||
|
</div>';
|
|||
|
|
|||
|
if ( $bolmakefahrplan )
|
|||
|
{
|
|||
|
//make fahrplan
|
|||
|
|
|||
|
$bolok = false;
|
|||
|
$stroutput = '';
|
|||
|
|
|||
|
// prepare table header with room names
|
|||
|
// read rooms
|
|||
|
$strdbsql = " select ro_name" .
|
|||
|
" from tbl_rooms ro" .
|
|||
|
" order by ro_schedpos";
|
|||
|
addmsg ( 'Running SQL: ' . $strdbsql );
|
|||
|
if ( $dbsmain->runsql( $strdbsql ) )
|
|||
|
{
|
|||
|
if ( $dbsmain->getdbrowcount() > 0 )
|
|||
|
{
|
|||
|
// rooms found
|
|||
|
// -> use them
|
|||
|
|
|||
|
$strtablehead = '';
|
|||
|
|
|||
|
while ( $dbsmain->getdbrow ( $strdbrow, clsdb::DB_ROW_NEXT ))
|
|||
|
{
|
|||
|
// for each room:
|
|||
|
$strtablehead = $strtablehead .'
|
|||
|
<td class="db">' . $strdbrow['ro_name'] . '</td>';
|
|||
|
}
|
|||
|
$bolok = true;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// no rooms found
|
|||
|
// -> hmm, that should not happen, but even then there should be no data anyway...
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// error accessing database
|
|||
|
addmsg ( 'Sorry, die Datenbank ist momentan nicht f<>r die Abfrage der Raumliste verf<72>gbar.<br />Die Datenbank sagt: ' . $dbsmain->getdberror() );
|
|||
|
}
|
|||
|
if ( $bolok )
|
|||
|
{
|
|||
|
// read schedule slots with workshops
|
|||
|
$strdbsql = " select extract(hour from sd_begintime) as sd_begintime_hour, extract(day from sd_begintime) as sd_begintime_day," .
|
|||
|
" extract(month from sd_begintime) as sd_begintime_month, extract(year from sd_begintime) as sd_begintime_year," .
|
|||
|
" DAYOFWEEK(sd_begintime) as sd_begintime_weekday, sd_begintime," .
|
|||
|
" ws_id, ws_name, ws_speakers,".
|
|||
|
" ro_name" .
|
|||
|
" from tbl_schedule sd" .
|
|||
|
" left join tbl_workshops ws on sd.sd_ws_id = ws.ws_id" .
|
|||
|
" left join tbl_rooms ro on sd.sd_ro_id = ro.ro_id" .
|
|||
|
" order by sd_begintime, ro_schedpos";
|
|||
|
addmsg ( 'Running SQL: ' . $strdbsql );
|
|||
|
if ( $dbsmain->runsql( $strdbsql ) )
|
|||
|
{
|
|||
|
if ( $dbsmain->getdbrowcount() > 0 )
|
|||
|
{
|
|||
|
// scheduled events found
|
|||
|
// -> use them
|
|||
|
|
|||
|
// es folgt: Gruppenwechsel <20>ber Tag, Timeslot, Raum, Schedule-Event
|
|||
|
|
|||
|
// Gesamtvorlauf
|
|||
|
$intsdyear = 0;
|
|||
|
$intsdmonth = 0;
|
|||
|
$intsdday = 0;
|
|||
|
$intsdhour = 0;
|
|||
|
$strroname = '';
|
|||
|
$boleof = false;
|
|||
|
|
|||
|
$boleof = !$dbsmain->getdbrow ( $strdbrow, clsdb::DB_ROW_NEXT );
|
|||
|
|
|||
|
while ( !$boleof )
|
|||
|
{
|
|||
|
// Gruppenvorlauf Tag
|
|||
|
$intsdyear = $strdbrow['sd_begintime_year'];
|
|||
|
$intsdmonth = $strdbrow['sd_begintime_month'];
|
|||
|
$intsdday = $strdbrow['sd_begintime_day'];
|
|||
|
// neue Tabelle initialisieren
|
|||
|
$intcolrot = 1;
|
|||
|
$stroutput = $stroutput .'
|
|||
|
<div class="chapter">
|
|||
|
<table class="db">
|
|||
|
<tr class="dbhead">
|
|||
|
<td class="db" width="10%">
|
|||
|
' . $strweekdayname[ $strdbrow['sd_begintime_weekday'] ] . '<br />
|
|||
|
' . $intsdday . '.' . $intsdmonth . '.
|
|||
|
</td>';
|
|||
|
$stroutput = $stroutput . $strtablehead;
|
|||
|
$stroutput = $stroutput .'
|
|||
|
</tr>';
|
|||
|
while
|
|||
|
(
|
|||
|
!$boleof
|
|||
|
&&
|
|||
|
(
|
|||
|
$intsdyear == $strdbrow['sd_begintime_year']
|
|||
|
&&
|
|||
|
$intsdmonth == $strdbrow['sd_begintime_month']
|
|||
|
&&
|
|||
|
$intsdday == $strdbrow['sd_begintime_day']
|
|||
|
)
|
|||
|
)
|
|||
|
{
|
|||
|
// Gruppenvorlauf Timeslot
|
|||
|
$intsdhour = $strdbrow['sd_begintime_hour'];
|
|||
|
// neue Tabellenzeile initialisieren
|
|||
|
$intcolrot = abs( $intcolrot - 1 );
|
|||
|
$stroutput = $stroutput .'
|
|||
|
<tr class="db' . $intcolrot . '">
|
|||
|
<td class="db" width="10%">' . $intsdhour.'
|
|||
|
<span class="small">:00</span>
|
|||
|
</td>';
|
|||
|
while
|
|||
|
(
|
|||
|
!$boleof
|
|||
|
&&
|
|||
|
(
|
|||
|
$intsdyear == $strdbrow['sd_begintime_year']
|
|||
|
&&
|
|||
|
$intsdmonth == $strdbrow['sd_begintime_month']
|
|||
|
&&
|
|||
|
$intsdday == $strdbrow['sd_begintime_day']
|
|||
|
)
|
|||
|
&&
|
|||
|
(
|
|||
|
$intsdhour == $strdbrow['sd_begintime_hour']
|
|||
|
)
|
|||
|
)
|
|||
|
{
|
|||
|
// Gruppenvorlauf Schedule-Event
|
|||
|
$strroname = $strdbrow['ro_name'];
|
|||
|
// neue Tabellenzelle initialisieren
|
|||
|
$stroutput = $stroutput .'
|
|||
|
<td class="db" width="10%">';
|
|||
|
while
|
|||
|
(
|
|||
|
!$boleof
|
|||
|
&&
|
|||
|
(
|
|||
|
$intsdyear == $strdbrow['sd_begintime_year']
|
|||
|
&&
|
|||
|
$intsdmonth == $strdbrow['sd_begintime_month']
|
|||
|
&&
|
|||
|
$intsdday == $strdbrow['sd_begintime_day']
|
|||
|
)
|
|||
|
&&
|
|||
|
(
|
|||
|
$intsdhour == $strdbrow['sd_begintime_hour']
|
|||
|
)
|
|||
|
&&
|
|||
|
(
|
|||
|
$strroname == $strdbrow['ro_name']
|
|||
|
)
|
|||
|
)
|
|||
|
{
|
|||
|
// Datensatz (Schedule-Event) verarbeiten
|
|||
|
if ( $strdbrow['ws_name'] > '')
|
|||
|
{
|
|||
|
$stroutput = $stroutput . '<a class="db" href="' . constant("SERVER_FILE_WORKSHOPS") . '#ws' . $strdbrow['ws_id'] . '">' . $strdbrow['ws_name'];
|
|||
|
if ( $strdbrow['ws_speakers'] > '')
|
|||
|
{
|
|||
|
$stroutput = $stroutput . '<span class="line small"> (' . $strdbrow['ws_speakers'] . ')</span>';
|
|||
|
}
|
|||
|
$stroutput = $stroutput . '</a>';
|
|||
|
}
|
|||
|
|
|||
|
// neuen Datensatz lesen
|
|||
|
$boleof = !$dbsmain->getdbrow ( $strdbrow, clsdb::DB_ROW_NEXT );
|
|||
|
}
|
|||
|
// Gruppennachlauf Schedule-Event
|
|||
|
// Tabellenzelle finalisieren
|
|||
|
$stroutput = $stroutput .'
|
|||
|
</td>';
|
|||
|
}
|
|||
|
// Gruppennachlauf Timeslot
|
|||
|
// Tabellenzeile finalisieren
|
|||
|
$stroutput = $stroutput .'
|
|||
|
</tr>';
|
|||
|
}
|
|||
|
// Gruppennachlauf Tag
|
|||
|
// Tabelle finalisieren
|
|||
|
$stroutput = $stroutput .'
|
|||
|
</table>
|
|||
|
</div>';
|
|||
|
}
|
|||
|
// Gesamtnachlauf
|
|||
|
// Gesamtausgabe finalisieren
|
|||
|
addmsg ( 'Die Fahrplandaten wurden erfolgreich zusammengestellt. Die Fahrplandatei kann jetzt geschrieben werden.' );
|
|||
|
$bolok = true;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// no scheduled events found
|
|||
|
// -> hmm, that should not happen, but even then there should be no data anyway...
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// error accessing database
|
|||
|
addmsg ( 'Sorry, die Datenbank ist momentan nicht f<>r die Abfrage des Fahrplans verf<72>gbar.<br />Die Datenbank sagt: ' . $dbsmain->getdberror() );
|
|||
|
}
|
|||
|
}
|
|||
|
if ( $bolok )
|
|||
|
{
|
|||
|
// operation has succeeded -> now generate schedule file
|
|||
|
$stroutput = '
|
|||
|
|
|||
|
<div id="main">
|
|||
|
<h1>Fahrplan</h1>
|
|||
|
Stand: ' . date( "d.m.Y H:i:s", $intnow ) . '
|
|||
|
|
|||
|
|
|||
|
' . $stroutput .
|
|||
|
'
|
|||
|
<div class="chapter">
|
|||
|
<h1>feste Einrichtungen</h1>
|
|||
|
<p>
|
|||
|
<span class="topic">Orga / Projektleitung:</span>
|
|||
|
B<EFBFBD>ro (EG) bei Work4
|
|||
|
</p>
|
|||
|
|
|||
|
<p>
|
|||
|
<span class="topic">Infrastruktur:</span>
|
|||
|
NOC (OG), POC (OG)
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
<span class="topic">CERT (Rot-Kreuz):</span>
|
|||
|
Flur (OG) vor dem Heimatmuseum
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
<span class="topic">CAcert</a>:</span>
|
|||
|
Bei den Funkamateuren
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
<span class="topic">Funk-Amateure:</span>
|
|||
|
Work3 (OG), hinter der Werkstatt (Freifunker)
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
<span class="topic">Freifunker:</span>
|
|||
|
Werkstatt (OG)
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
<span class="topic">Fest- und Fl<EFBFBD>ssignahrung:</span>
|
|||
|
Cafe, vorderer Teil (EG)
|
|||
|
</p>
|
|||
|
</div>
|
|||
|
</div>';
|
|||
|
|
|||
|
// add autogeneration-warning
|
|||
|
$stroutput = file_get_contents( constant("SERVER_FILE_AUTOGEN") ) . $stroutput;
|
|||
|
$strinput = file_get_contents( constant("SERVER_FILE_TEMPLATE") );
|
|||
|
$strinput = str_replace( "[%title%]", "Fahrplan", $strinput );
|
|||
|
$stroutput = str_replace( "[%content%]", $stroutput, $strinput );
|
|||
|
|
|||
|
if ( is_writable( constant("SERVER_FILE_FAHRPLAN") ))
|
|||
|
{
|
|||
|
file_put_contents( constant("SERVER_FILE_FAHRPLAN"), $stroutput );
|
|||
|
// file_put_contents does not work with PHP 4.x, so use instead: fopen, fwrite, fclose
|
|||
|
//$intfileid = fopen( constant("SERVER_FILE_FAHRPLAN"), "w" );
|
|||
|
//fwrite( $intfileid, $stroutput );
|
|||
|
//fclose( $intfileid );
|
|||
|
$bolok = true;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
addmsg ( 'Die Fahrplandatei "' . constant("SERVER_FILE_FAHRPLAN") . '" konnte nicht geschrieben werden. (Rechteproblem?)');
|
|||
|
$bolok = false;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// write result
|
|||
|
if ( $bolok )
|
|||
|
{
|
|||
|
addmsg ( 'Die Fahrplandatei wurde erfolgreich aktualisiert.' );
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
addmsg ( 'Die Fahrplandatei wurde nicht aktualisiert.' );
|
|||
|
}
|
|||
|
}
|
|||
|
showmsg();
|
|||
|
echo'
|
|||
|
<div>
|
|||
|
<form id="makefahrplanform" name="makefahrplanform" action="' . $_SERVER["PHP_SELF"] . '" method="post">
|
|||
|
<p>
|
|||
|
Hier wird die (statische) Fahrplanseite auf Basis der aktuellen Datenbank neu erstellt. <br />
|
|||
|
Achtung: Die alte Fahrplanseite wird dabei unwiderruflich <EFBFBD>berschrieben!
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
<input name="cmdmakefahrplan" type="submit" value="Fahrplandatei jetzt erstellen!" />
|
|||
|
</p>
|
|||
|
</form>
|
|||
|
</div>';
|
|||
|
showmsg();
|
|||
|
|
|||
|
|
|||
|
|
|||
|
// todo:
|
|||
|
// Diese verdammten Einr<6E>ckungen m<>ssten bei Gelegenheit mal wieder komplett repariert werden!
|
|||
|
// Urspr<70>nglich waren mal alle Einr<6E>ckungen (pro Ebene) durch zwei Leerzeichen dargestellt.
|
|||
|
// Anscheinend waren da aber zwischenzeitlich "intelligente" Editoren dran, die sich gegenseitig
|
|||
|
// eine wilde Schlacht mittels mehrerer inkompatibler Space- und Tab-Konventionen geliefert haben.
|
|||
|
// HTML-Anker und orga-Chapter sollten jedenfalls absolut linksb<73>ndig stehen... *seufz*
|
|||
|
// Eigentlich auch alles halb so schlimm, falls man einen Editor mit Block-Highlighting hat... ;-)
|
|||
|
|
|||
|
|
|||
|
// show workshop editor chapter
|
|||
|
|
|||
|
echo '
|
|||
|
<div class="chapter">
|
|||
|
<h1>Workshop Editor</h1>
|
|||
|
</div>
|
|||
|
<a id="wseditor"';
|
|||
|
if ( $intwsid != constant("DB_ID_NONE") ) { echo ' class="linktarget" '; }
|
|||
|
echo '><!-- space to avoid anchor being displayed below topbars --></a>';
|
|||
|
|
|||
|
if ( $bolwsupdate && $intwsid != constant("DB_ID_NONE") )
|
|||
|
{
|
|||
|
// update workshop
|
|||
|
// if $intwsid == constant("DB_ID_NEW") create new workshop else update existing
|
|||
|
|
|||
|
$bolok = false;
|
|||
|
|
|||
|
if ( $intwsid != constant("DB_ID_NEW") )
|
|||
|
{
|
|||
|
// update existing workshop
|
|||
|
|
|||
|
$strdbsql = " ws_name = '" . $strwsname . "'," .
|
|||
|
" ws_speakers = '" . $strwsspeakers . "'," .
|
|||
|
" ws_content = '" . $strwscontent . "'," .
|
|||
|
" ws_comment = '" . $strwscomment . "',";
|
|||
|
if ( $intwsduration != '' )
|
|||
|
{
|
|||
|
$strdbsql = $strdbsql . " ws_duration = " . $intwsduration . ",";
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
$strdbsql = $strdbsql . " ws_duration = NULL,";
|
|||
|
}
|
|||
|
|
|||
|
$strdbsql = " update tbl_workshops set " .
|
|||
|
substr( $strdbsql, 0, strlen( $strdbsql ) - 1 ) .
|
|||
|
" where ws_id = " . $intwsid;
|
|||
|
|
|||
|
addmsg ( 'Running SQL: ' . $strdbsql );
|
|||
|
if ( $dbsmain->runsql( $strdbsql ) )
|
|||
|
{
|
|||
|
if ( $dbsmain->getdbrowcount() > 0 )
|
|||
|
{
|
|||
|
// update successful
|
|||
|
addmsg ( 'Erfolgreich aktualisiert: ' . $dbsmain->getdbrowcount() . ' Workshop(s).' );
|
|||
|
$bolok = true;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// update failed
|
|||
|
addmsg ( 'Aktualisierung fehlgeschlagen!<br />Die Datenbank sagt: ' . $dbsmain->getdberror() );
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// error accessing database
|
|||
|
addmsg ( 'Sorry, die Datenbank ist momentan nicht f<>r die Workshop-Aktualisierung verf<72>gbar.<br />Die Datenbank sagt: ' . $dbsmain->getdberror() );
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// insert new workshop
|
|||
|
|
|||
|
$strdbsql = '';
|
|||
|
if ( $strwsname != '' )
|
|||
|
{
|
|||
|
$strdbfields = $strdbfields . " ws_name,";
|
|||
|
$strdbsql = $strdbsql . " '" . $strwsname . "',";
|
|||
|
}
|
|||
|
if ( $intwsduration != '' )
|
|||
|
{
|
|||
|
$strdbfields = $strdbfields . " ws_duration,";
|
|||
|
$strdbsql = $strdbsql . " " . $intwsduration . ",";
|
|||
|
}
|
|||
|
if ( $strwsspeakers != '' )
|
|||
|
{
|
|||
|
$strdbfields = $strdbfields . " ws_speakers,";
|
|||
|
$strdbsql = $strdbsql . " '" . $strwsspeakers . "',";
|
|||
|
}
|
|||
|
if ( $strwscontent != '' )
|
|||
|
{
|
|||
|
$strdbfields = $strdbfields . " ws_content,";
|
|||
|
$strdbsql = $strdbsql . " '" . $strwscontent . "',";
|
|||
|
}
|
|||
|
if ( $strwscomment != '' )
|
|||
|
{
|
|||
|
$strdbfields = $strdbfields . " ws_comment,";
|
|||
|
$strdbsql = $strdbsql . " '" . $strwscomment . "',";
|
|||
|
}
|
|||
|
if ( $strdbsql != '' )
|
|||
|
{
|
|||
|
// get nextval
|
|||
|
$strdbsql2 = "select MAX(ws_id)+1 as nextval from tbl_workshops";
|
|||
|
addmsg ( 'Running SQL: ' . $strdbsql2 );
|
|||
|
|
|||
|
if ( $dbsmain->runsql( $strdbsql2 ) )
|
|||
|
{
|
|||
|
if ( $dbsmain->getdbrowcount() > 0 )
|
|||
|
{
|
|||
|
if ( $dbsmain->getdbrow ( $strdbrow, clsdb::DB_ROW_FIRST ))
|
|||
|
{
|
|||
|
// nextval succeeded
|
|||
|
addmsg ( 'Nextval erhalten: ' . $strdbrow['nextval'] );
|
|||
|
$intwsid = $strdbrow['nextval'];
|
|||
|
|
|||
|
$strdbfields = " ws_id," . $strdbfields;
|
|||
|
$strdbsql = " " . $intwsid . "," . $strdbsql;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// this should never happen, at all
|
|||
|
addmsg ( 'Nextval nicht lesbar!<br />Die Datenbank sagt: ' . $dbsmain->getdberror() );
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// nextval failed
|
|||
|
addmsg ( 'Keinen Nextval erhalten!<br />Die Datenbank sagt: ' . $dbsmain->getdberror() );
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// error accessing database
|
|||
|
addmsg ( 'Sorry, die Datenbank ist momentan nicht f<>r die Workshop-Erstellung verf<72>gbar.<br />Die Datenbank sagt: ' . $dbsmain->getdberror() );
|
|||
|
}
|
|||
|
|
|||
|
if ( $intwsid != constant("DB_ID_NEW") )
|
|||
|
{
|
|||
|
// nextval available
|
|||
|
|
|||
|
$strdbsql = " insert into tbl_workshops (" .
|
|||
|
substr( $strdbfields, 0, strlen( $strdbfields ) - 1 ) .
|
|||
|
") values ("
|
|||
|
. substr( $strdbsql, 0, strlen( $strdbsql ) - 1 ) .
|
|||
|
")";
|
|||
|
|
|||
|
addmsg ( 'Running SQL: ' . $strdbsql );
|
|||
|
if ( $dbsmain->runsql( $strdbsql ) )
|
|||
|
{
|
|||
|
if ( $dbsmain->getdbrowcount() > 0 )
|
|||
|
{
|
|||
|
// insert successful
|
|||
|
addmsg ( 'Erfolgreich erstellt: ' . $dbsmain->getdbrowcount() . ' Workshop(s).' );
|
|||
|
$bolok = true;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// insert failed
|
|||
|
addmsg ( 'Erstellung fehlgeschlagen!<br />Die Datenbank sagt: ' . $dbsmain->getdberror() );
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// error accessing database
|
|||
|
addmsg ( 'Sorry, die Datenbank ist momentan nicht f<>r die Workshop-Erstellung verf<72>gbar.<br />Die Datenbank sagt: ' . $dbsmain->getdberror() );
|
|||
|
}
|
|||
|
if ( !$bolok )
|
|||
|
{
|
|||
|
$intwsid = constant("DB_ID_NEW");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// no fields filled
|
|||
|
addmsg ( 'Wenn Du einen neuen Workshop anlegen willst, w<>re es geschickt, zumindest schonmal den Namen auszuf<75>llen. ;o) ' );
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
showmsg();
|
|||
|
|
|||
|
echo '
|
|||
|
<div>
|
|||
|
<p>
|
|||
|
Hier k<EFBFBD>nnen Workshops manuell bearbeitet - oder eben auch kaputtgemacht - werden, bitte also aufpassen ;)
|
|||
|
</p>
|
|||
|
';
|
|||
|
|
|||
|
echo '
|
|||
|
<form id="wsselectform " ';
|
|||
|
echo ' name="wsselectform" action="' . $_SERVER["PHP_SELF"] . '#wseditor" method="post">
|
|||
|
<div>
|
|||
|
';
|
|||
|
|
|||
|
$bolok = false;
|
|||
|
|
|||
|
// read workshops
|
|||
|
$strdbsql = " select *" .
|
|||
|
" from tbl_workshops ws" .
|
|||
|
" order by ws_name";
|
|||
|
if ( $dbsmain->runsql( $strdbsql ) )
|
|||
|
{
|
|||
|
if ( $dbsmain->getdbrowcount() > 0 )
|
|||
|
{
|
|||
|
// workshops found
|
|||
|
// -> use them
|
|||
|
|
|||
|
$strworkshoplist = '<option value="' . constant("DB_ID_NONE") . '"';
|
|||
|
if ( $intwsid == constant("DB_ID_NONE") || $intwsid == constant("DB_ID_NEW") )
|
|||
|
{
|
|||
|
// extracted to function "selectws": $strworkshoplist = $strworkshoplist . ' selected="selected"';
|
|||
|
if ( !$bolwsupdate )
|
|||
|
{
|
|||
|
// clear workshop fields, except user tried to update
|
|||
|
$strwsname = '';
|
|||
|
$strwsspeakers = '';
|
|||
|
$intwsduration = 0;
|
|||
|
$strwscontent = '';
|
|||
|
$strwscomment = '';
|
|||
|
}
|
|||
|
}
|
|||
|
$strworkshoplist = $strworkshoplist . '>' . constant("DISPLAY_TEXT_NONE") . '</option>';
|
|||
|
|
|||
|
while ( $dbsmain->getdbrow ( $strdbrow, clsdb::DB_ROW_NEXT ))
|
|||
|
{
|
|||
|
// for each workshop:
|
|||
|
$strworkshoplist = $strworkshoplist . '<option value="' . $strdbrow["ws_id"] . '"';
|
|||
|
if ( $intwsid == $strdbrow["ws_id"] )
|
|||
|
{
|
|||
|
// extracted to function "selectws": $strworkshoplist = $strworkshoplist . ' selected="selected"';
|
|||
|
// init workshop fields
|
|||
|
$intwsid = $strdbrow["ws_id"];
|
|||
|
$strwsname = $strdbrow["ws_name"];
|
|||
|
$strwsspeakers = $strdbrow["ws_speakers"];
|
|||
|
$intwsduration = $strdbrow["ws_duration"];
|
|||
|
$strwscontent = $strdbrow["ws_content"];
|
|||
|
$strwscomment = $strdbrow["ws_comment"];
|
|||
|
}
|
|||
|
$strworkshoplist = $strworkshoplist . '>' . $strdbrow["ws_name"] . '</option>';
|
|||
|
}
|
|||
|
echo
|
|||
|
'
|
|||
|
<span class="topic">Auswahl:</span><select name="cboworkshop" onchange="document.wsselectform.submit();">' . selectws( $intwsid ) . '</select>
|
|||
|
';
|
|||
|
$bolok = true;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// no workshops found
|
|||
|
// -> hmm, that should not happen, but even then there should be no data anyway...
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// error accessing database
|
|||
|
addmsg ( 'Sorry, die Datenbank ist momentan nicht f<>r die Abfrage der Workshopliste verf<72>gbar.<br />Die Datenbank sagt: ' . $dbsmain->getdberror() );
|
|||
|
}
|
|||
|
|
|||
|
echo
|
|||
|
'
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
<form id="wscreateform" name="wscreateform" action="' . $_SERVER["PHP_SELF"] . '#wseditor" method="post">
|
|||
|
<div>
|
|||
|
<input name="txtwsid" type="hidden" value="' . constant("DB_ID_NEW") . '" />
|
|||
|
<input name="cmdwscreate" type="submit" value="Neuen Workshop erstellen..." />
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
';
|
|||
|
|
|||
|
if ( $intwsid != constant("DB_ID_NONE") )
|
|||
|
{
|
|||
|
// show workshop update form with selected workshop
|
|||
|
|
|||
|
echo
|
|||
|
'
|
|||
|
<form id="wsupdateform" name="wsupdateform" action="' . $_SERVER["PHP_SELF"] . '#wseditor" method="post">
|
|||
|
<div class="box">
|
|||
|
|
|||
|
<input name="txtwsid" type="hidden" value="' . $intwsid . '" />
|
|||
|
<span class="topic">Name:</span><input class="db" name="txtwsname" type="text" value="' . $strwsname . '" />
|
|||
|
<span class="topic">Referenten:</span><input class="db" name="txtwsspeakers" type="text" value="' . $strwsspeakers .'" />
|
|||
|
<span class="topic">Dauer (Min.):</span><input class="db" name="txtwsduration" type="text" value="' . $intwsduration .'" />
|
|||
|
<span class="topic">Inhalt:</span><textarea class="db verybig" name="txtwscontent">'. $strwscontent .'</textarea>
|
|||
|
<span class="topic">Bemerkung:</span><textarea class="db" name="txtwscomment">'. $strwscomment .'</textarea>
|
|||
|
<input name="cmdwsupdate" type="submit" value="Workshop jetzt aktualisieren!" />
|
|||
|
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
';
|
|||
|
}
|
|||
|
|
|||
|
echo
|
|||
|
'
|
|||
|
</div>
|
|||
|
';
|
|||
|
showmsg();
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
// show fahrplan editor chapter
|
|||
|
echo
|
|||
|
'
|
|||
|
<div class="chapter">
|
|||
|
<h1>Fahrplan Editor</h1>
|
|||
|
</div>
|
|||
|
';
|
|||
|
|
|||
|
// update fahrplan
|
|||
|
|
|||
|
if ( $bolsdupdate )
|
|||
|
{
|
|||
|
// save all selected workshops (from downlists) into schedule
|
|||
|
|
|||
|
$bolok = true;
|
|||
|
$intcount = 0;
|
|||
|
|
|||
|
reset( $lstschedule );
|
|||
|
foreach ( $lstschedule as $strscheduleindex => $intschedulevalue)
|
|||
|
{
|
|||
|
$intscheduleindex = intval( substr( $strscheduleindex, 0, strpos( $strscheduleindex . constant("DISPLAY_VALUE_SEPARATOR"), constant("DISPLAY_VALUE_SEPARATOR") )));
|
|||
|
if ( $intschedulevalue != intval( substr( $strscheduleindex, strpos( $strscheduleindex . constant("DISPLAY_VALUE_SEPARATOR"), constant("DISPLAY_VALUE_SEPARATOR") ) + 1 )))
|
|||
|
{
|
|||
|
// dropdownbox had been changed
|
|||
|
// -> update
|
|||
|
|
|||
|
$strdbsql = "NULL";
|
|||
|
if ( $intschedulevalue != constant("DB_ID_NONE") )
|
|||
|
{
|
|||
|
$strdbsql = strval( intval( $intschedulevalue ));
|
|||
|
}
|
|||
|
|
|||
|
$strdbsql = " update tbl_schedule " .
|
|||
|
" set sd_ws_id = " . $strdbsql .
|
|||
|
" where sd_id = " . strval( intval( $intscheduleindex ));
|
|||
|
|
|||
|
addmsg ( 'Running SQL: ' . $strdbsql );
|
|||
|
if ( $dbsmain->runsql( $strdbsql ) )
|
|||
|
{
|
|||
|
if ( $dbsmain->getdbrowcount() > 0 )
|
|||
|
{
|
|||
|
// schedule updated
|
|||
|
// continue
|
|||
|
$intcount = $intcount + 1;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// schedule not updated
|
|||
|
addmsg ( 'Sorry, die Scheduleposition mit der ID ' . strval( intval( $intscheduleindex )) . ' konnte nicht geschrieben werden.<br />Die Datenbank sagt: ' . $dbsmain->getdberror() );
|
|||
|
$bolok = false;
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// error accessing database
|
|||
|
addmsg ( 'Sorry, die Datenbank ist momentan nicht f<>r die Aktualisierung des Schedules verf<72>gbar.<br />Die Datenbank sagt: ' . $dbsmain->getdberror() );
|
|||
|
$bolok = false;
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// dropdownbox had not been changed
|
|||
|
// -> ignore
|
|||
|
}
|
|||
|
}
|
|||
|
addmsg ( 'Es wurden ' . $intcount . ' Slots erfolgreich aktualisiert.' );
|
|||
|
showmsg();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
if ( $bolsdupdate || $bolsdactivate )
|
|||
|
{
|
|||
|
$bolok = false;
|
|||
|
$strtablehead = '';
|
|||
|
|
|||
|
// prepare table header with room names
|
|||
|
// read rooms
|
|||
|
$strdbsql = " select ro_name" .
|
|||
|
" from tbl_rooms ro" .
|
|||
|
" order by ro_schedpos";
|
|||
|
//addmsg ( 'Running SQL: ' . $strdbsql );
|
|||
|
if ( $dbsmain->runsql( $strdbsql ) )
|
|||
|
{
|
|||
|
if ( $dbsmain->getdbrowcount() > 0 )
|
|||
|
{
|
|||
|
// rooms found
|
|||
|
// -> use them
|
|||
|
|
|||
|
$strtablehead = '';
|
|||
|
|
|||
|
while ( $dbsmain->getdbrow ( $strdbrow, clsdb::DB_ROW_NEXT ))
|
|||
|
{
|
|||
|
// for each room:
|
|||
|
{
|
|||
|
$strtablehead = $strtablehead .
|
|||
|
'
|
|||
|
<td class="db">' . $strdbrow['ro_name'] . '</td>
|
|||
|
';
|
|||
|
}
|
|||
|
}
|
|||
|
$bolok = true;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// no rooms found
|
|||
|
// -> hmm, that should not happen, but even then there should be no data anyway...
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// error accessing database
|
|||
|
addmsg ( 'Sorry, die Datenbank ist momentan nicht f<>r die Abfrage der Raumliste verf<72>gbar.<br />Die Datenbank sagt: ' . $dbsmain->getdberror() );
|
|||
|
}
|
|||
|
|
|||
|
// Achtung:
|
|||
|
// Der "Fahrplan Editor" ben<65>tigt f<>r die Dropdownlisten auch die Variable $strworkshoplist,
|
|||
|
// welche weiter oben im Rahmen des Kapitels "Workshop Editor" erstellt wurde.
|
|||
|
|
|||
|
showmsg();
|
|||
|
}
|
|||
|
|
|||
|
echo
|
|||
|
'
|
|||
|
<div>
|
|||
|
<form id="sdeditorform" name="sdeditorform" action="' . $_SERVER["PHP_SELF"] . '" method="post">
|
|||
|
<p>
|
|||
|
Hier kann der Fahrplan bearbeitet werden, der anschlie<EFBFBD>end mittels "make install Fahrplan" ver<EFBFBD>ffentlicht werden kann. <br />
|
|||
|
Achtung: Der alte Fahrplan wird dabei in der Datenbank unwiderruflich <EFBFBD>berschrieben! <br />
|
|||
|
</p>
|
|||
|
';
|
|||
|
|
|||
|
|
|||
|
//write fahrplan
|
|||
|
|
|||
|
if ( $bolsdupdate || $bolsdactivate )
|
|||
|
{
|
|||
|
$stroutput = '';
|
|||
|
|
|||
|
if ( $bolok )
|
|||
|
{
|
|||
|
// read schedule slots with workshops
|
|||
|
$strdbsql = " select extract(hour from sd_begintime) as sd_begintime_hour, extract(day from sd_begintime) as sd_begintime_day," .
|
|||
|
" extract(month from sd_begintime) as sd_begintime_month, extract(year from sd_begintime) as sd_begintime_year," .
|
|||
|
" DAYOFWEEK(sd_begintime) as sd_begintime_weekday, sd_begintime," .
|
|||
|
" sd_id, ws_id, ws_name, ws_speakers,".
|
|||
|
" ro_name" .
|
|||
|
" from tbl_schedule sd" .
|
|||
|
" left join tbl_workshops ws on sd.sd_ws_id = ws.ws_id" .
|
|||
|
" left join tbl_rooms ro on sd.sd_ro_id = ro.ro_id" .
|
|||
|
" order by sd_begintime, ro_schedpos";
|
|||
|
//addmsg ( 'Running SQL: ' . $strdbsql );
|
|||
|
if ( $dbsmain->runsql( $strdbsql ) )
|
|||
|
{
|
|||
|
if ( $dbsmain->getdbrowcount() > 0 )
|
|||
|
{
|
|||
|
// scheduled events found
|
|||
|
// -> use them
|
|||
|
|
|||
|
// es folgt: Gruppenwechsel <20>ber Tag, Timeslot, Raum, Schedule-Event
|
|||
|
|
|||
|
// Gesamtvorlauf
|
|||
|
$intsdyear = 0;
|
|||
|
$intsdmonth = 0;
|
|||
|
$intsdday = 0;
|
|||
|
$intsdhour = 0;
|
|||
|
$strroname = '';
|
|||
|
$boleof = false;
|
|||
|
|
|||
|
$boleof = !$dbsmain->getdbrow ( $strdbrow, clsdb::DB_ROW_NEXT );
|
|||
|
|
|||
|
while ( !$boleof )
|
|||
|
{
|
|||
|
// Gruppenvorlauf Tag
|
|||
|
$intsdyear = $strdbrow['sd_begintime_year'];
|
|||
|
$intsdmonth = $strdbrow['sd_begintime_month'];
|
|||
|
$intsdday = $strdbrow['sd_begintime_day'];
|
|||
|
// neue Tabelle initialisieren
|
|||
|
$intcolrot = 1;
|
|||
|
$stroutput = $stroutput .
|
|||
|
'
|
|||
|
<div class="chapter">
|
|||
|
<table class="db">
|
|||
|
<tr class="dbhead">
|
|||
|
<td class="db">
|
|||
|
' . $strweekdayname[ $strdbrow['sd_begintime_weekday'] ] . '<br />
|
|||
|
' . $intsdday . '.' . $intsdmonth . '.
|
|||
|
</td>
|
|||
|
';
|
|||
|
$stroutput = $stroutput . $strtablehead;
|
|||
|
$stroutput = $stroutput .
|
|||
|
'
|
|||
|
</tr>
|
|||
|
';
|
|||
|
|
|||
|
while
|
|||
|
(
|
|||
|
!$boleof
|
|||
|
&&
|
|||
|
(
|
|||
|
$intsdyear == $strdbrow['sd_begintime_year']
|
|||
|
&&
|
|||
|
$intsdmonth == $strdbrow['sd_begintime_month']
|
|||
|
&&
|
|||
|
$intsdday == $strdbrow['sd_begintime_day']
|
|||
|
)
|
|||
|
)
|
|||
|
{
|
|||
|
// Gruppenvorlauf Timeslot
|
|||
|
$intsdhour = $strdbrow['sd_begintime_hour'];
|
|||
|
// neue Tabellenzeile initialisieren
|
|||
|
$intcolrot = abs( $intcolrot - 1 );
|
|||
|
$stroutput = $stroutput .
|
|||
|
'
|
|||
|
<tr class="db' . $intcolrot.'">
|
|||
|
<td class="db">
|
|||
|
' . $intsdhour.'<span class="small">:00</span>
|
|||
|
</td>
|
|||
|
';
|
|||
|
|
|||
|
while
|
|||
|
(
|
|||
|
!$boleof
|
|||
|
&&
|
|||
|
(
|
|||
|
$intsdyear == $strdbrow['sd_begintime_year']
|
|||
|
&&
|
|||
|
$intsdmonth == $strdbrow['sd_begintime_month']
|
|||
|
&&
|
|||
|
$intsdday == $strdbrow['sd_begintime_day']
|
|||
|
)
|
|||
|
&&
|
|||
|
(
|
|||
|
$intsdhour == $strdbrow['sd_begintime_hour']
|
|||
|
)
|
|||
|
)
|
|||
|
{
|
|||
|
|
|||
|
// Gruppenvorlauf Schedule-Event
|
|||
|
$strroname = $strdbrow['ro_name'];
|
|||
|
// neue Tabellenzelle initialisieren
|
|||
|
$stroutput = $stroutput .
|
|||
|
'
|
|||
|
<td class="dbdata">
|
|||
|
';
|
|||
|
|
|||
|
while
|
|||
|
(
|
|||
|
!$boleof
|
|||
|
&&
|
|||
|
(
|
|||
|
$intsdyear == $strdbrow['sd_begintime_year']
|
|||
|
&&
|
|||
|
$intsdmonth == $strdbrow['sd_begintime_month']
|
|||
|
&&
|
|||
|
$intsdday == $strdbrow['sd_begintime_day']
|
|||
|
)
|
|||
|
&&
|
|||
|
(
|
|||
|
$intsdhour == $strdbrow['sd_begintime_hour']
|
|||
|
)
|
|||
|
&&
|
|||
|
(
|
|||
|
$strroname == $strdbrow['ro_name']
|
|||
|
)
|
|||
|
)
|
|||
|
{
|
|||
|
// Datensatz (Schedule-Event) verarbeiten
|
|||
|
$stroutput = $stroutput . '<select class="dbdata" name="cboschedule[' . $strdbrow["sd_id"] . constant("DISPLAY_VALUE_SEPARATOR") . $strdbrow['ws_id'] . ']">' . selectws( $strdbrow['ws_id'] ) . '</select>';
|
|||
|
|
|||
|
// neuen Datensatz lesen
|
|||
|
$boleof = !$dbsmain->getdbrow ( $strdbrow, clsdb::DB_ROW_NEXT );
|
|||
|
}
|
|||
|
// Gruppennachlauf Schedule-Event
|
|||
|
// Tabellenzelle finalisieren
|
|||
|
$stroutput = $stroutput .
|
|||
|
'
|
|||
|
</td>
|
|||
|
';
|
|||
|
|
|||
|
}
|
|||
|
// Gruppennachlauf Timeslot
|
|||
|
// Tabellenzeile finalisieren
|
|||
|
$stroutput = $stroutput .
|
|||
|
'
|
|||
|
</tr>
|
|||
|
';
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
// Gruppennachlauf Tag
|
|||
|
// Tabelle finalisieren
|
|||
|
$stroutput = $stroutput .
|
|||
|
'
|
|||
|
</table>
|
|||
|
</div>
|
|||
|
';
|
|||
|
}
|
|||
|
|
|||
|
// Gesamtnachlauf
|
|||
|
// Gesamtausgabe finalisieren
|
|||
|
|
|||
|
//addmsg ( 'Die Fahrplandaten wurden erfolgreich zusammengestellt. Die Fahrplandatei kann jetzt geschrieben werden.' );
|
|||
|
$bolok = true;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// no scheduled events found
|
|||
|
// -> hmm, that should not happen, but even then there should be no data anyway...
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// error accessing database
|
|||
|
addmsg ( 'Sorry, die Datenbank ist momentan nicht f<>r die Abfrage der Workshops verf<72>gbar.<br />Die Datenbank sagt: ' . $dbsmain->getdberror() );
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if ( $bolok )
|
|||
|
{
|
|||
|
// operation has succeeded -> now write fahrplan
|
|||
|
echo
|
|||
|
'
|
|||
|
<div class="box">' . $stroutput .
|
|||
|
'
|
|||
|
<p>
|
|||
|
<input name="cmdsdupdate" type="submit" value="Fahrplan jetzt aktualisieren!" />
|
|||
|
</p>
|
|||
|
</div>
|
|||
|
';
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
echo
|
|||
|
'
|
|||
|
<p>
|
|||
|
<input name="cmdsdactivate" type="submit" value="Fahrplan editieren..." />
|
|||
|
</p>
|
|||
|
';
|
|||
|
}
|
|||
|
|
|||
|
echo
|
|||
|
'
|
|||
|
</form>
|
|||
|
</div>
|
|||
|
';
|
|||
|
showmsg();
|
|||
|
|
|||
|
|
|||
|
|
|||
|
ignore this for 2007 */
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
// show run SQL chapter
|
|||
|
|
|||
|
echo
|
|||
|
'
|
|||
|
<a name="sql"></a>
|
|||
|
<div class="chapter">
|
|||
|
<h1>run SQL</h1>
|
|||
|
</div>
|
|||
|
';
|
|||
|
|
|||
|
$bolok = false;
|
|||
|
|
|||
|
if ( $bolrunsql && $strsql != '' )
|
|||
|
{
|
|||
|
// runs SQL statement
|
|||
|
|
|||
|
// be careful now:
|
|||
|
// fire raw sql statement to database
|
|||
|
$strdbsql = $pstrsql;
|
|||
|
// write defused sql statement to screen
|
|||
|
addmsg ( 'Running SQL: ' . $strsql );
|
|||
|
|
|||
|
if ( $dbsmain->runsql ( $strdbsql ) )
|
|||
|
{
|
|||
|
addmsg ( $dbsmain->getdbrowcount() . ' records found.' );
|
|||
|
|
|||
|
if ( $dbsmain->getdbfields( $strdbfields ))
|
|||
|
{
|
|||
|
|
|||
|
echo
|
|||
|
'
|
|||
|
<div>
|
|||
|
<table class="db">
|
|||
|
<tr class="dbhead">
|
|||
|
';
|
|||
|
|
|||
|
foreach ( $strdbfields[clsdb::DB_FIELD_NAME] as $intindex => $strvalue )
|
|||
|
{
|
|||
|
echo
|
|||
|
'
|
|||
|
<td class="db">' . $strvalue . '</td>
|
|||
|
';
|
|||
|
}
|
|||
|
|
|||
|
echo
|
|||
|
'
|
|||
|
</tr>
|
|||
|
';
|
|||
|
|
|||
|
//if ( $dbsmain->getdbrow( $strdbrow, clsdb::DB_ROW_FIRST ))
|
|||
|
$intcolrot = 0;
|
|||
|
while ( $dbsmain->getdbrow( $strdbrow, clsdb::DB_ROW_NEXT ))
|
|||
|
{
|
|||
|
echo
|
|||
|
'
|
|||
|
<tr class="db' . $intcolrot . '">
|
|||
|
';
|
|||
|
|
|||
|
$intindex = 1;
|
|||
|
foreach ( $strdbfields[clsdb::DB_FIELD_NAME] as $intindex => $strvalue )
|
|||
|
{
|
|||
|
echo
|
|||
|
'
|
|||
|
<td class="db">' . $strdbrow[ $strvalue ] . '</td>
|
|||
|
';
|
|||
|
}
|
|||
|
|
|||
|
echo
|
|||
|
'
|
|||
|
</tr>
|
|||
|
';
|
|||
|
|
|||
|
$intcolrot = abs( $intcolrot - 1 );
|
|||
|
}
|
|||
|
|
|||
|
echo '</table></div>';
|
|||
|
|
|||
|
$bolok = true;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
addmsg ( 'Error reading the fields!<br />Database says: ' . $dbsmain->getdberror() );
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
addmsg ( 'Error accessing the database!<br />Database says: ' . $dbsmain->getdberror() );
|
|||
|
}
|
|||
|
}
|
|||
|
showmsg();
|
|||
|
|
|||
|
echo
|
|||
|
'
|
|||
|
<div>
|
|||
|
<form id="runsqlform" name="runsqlform" action="' . $_SERVER["PHP_SELF"] . '#sql" method="post">
|
|||
|
<p>
|
|||
|
Hier k<EFBFBD>nnen beliebige SQL-Kommandos (getrennt durch Semikoli, Zeilenumbr<EFBFBD>che m<EFBFBD>glich) auf die Datenbank abgesetzt werden.<br />
|
|||
|
Vorsicht: Dabei l<EFBFBD>sst sich auf sehr einfache und hochperformante Weise die Datenbank schrotten. ;-) <br />
|
|||
|
<span class="line important"><span class="topic">Erste und einzige Regel:</span>Pr<EFBFBD>fe immer zuerst mit SELECT, was Du mit UPDATE oder DELETE anfassen willst!</span>
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
<span class="topic">SQL:</span><textarea class="db" name="txtsql">'. $strsql .'</textarea>
|
|||
|
<input name="cmdrunsql" type="submit" value="Three-Two-One...Fire!" />
|
|||
|
</p>
|
|||
|
</form>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
';
|
|||
|
showmsg();
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
// close page and stoprun.
|
|||
|
echo
|
|||
|
'
|
|||
|
<!-- end of specific page content -->
|
|||
|
|
|||
|
';
|
|||
|
readfile( constant("SERVER_FILE_EXTRO") );
|
|||
|
|
|||
|
die();
|
|||
|
|
|||
|
?>
|