00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 ini_set('display_errors', 1);
00019 error_reporting(E_ALL);
00020
00021
00022 if( !function_exists( 'file_get_contents' ) )
00023 {
00024 function file_get_contents( $file, $var )
00025 {
00026 $aFile = @file( $file );
00027 if( $aFile === false ) return false;
00028 return implode( '', $aFile );
00029 }
00030 }
00031
00032
00033 if( !is_array( $_POST ) && is_array( $HTTP_POST_VARS ) )
00034 {
00035 $_POST =& $HTTP_POST_VARS;
00036 }
00037 if( !is_array( $_GET ) && is_array( $HTTP_GET_VARS ) )
00038 {
00039 $_GET =& $HTTP_GET_VARS;
00040 }
00041 if( !is_array( $_COOKIE ) && is_array( $HTTP_COOKIE_VARS ) )
00042 {
00043 $_COOKIE =& $HTTP_COOKIE_VARS;
00044 }
00045
00046
00047 if( !get_magic_quotes_gpc() )
00048 {
00049
00050 function addslashes_array( &$array )
00051 {
00052 reset( $array );
00053 while( list( $key, $val ) = each( $array ) )
00054 {
00055 if( is_string( $val ) ) $array[$key] = addslashes( $val );
00056 elseif( is_array( $val ) ) $array[$key] = addslashes_array( $val );
00057 }
00058 return $array;
00059 }
00060
00061 $_REQUEST = addslashes_array( $_REQUEST );
00062 $_POST = addslashes_array( $_POST );
00063 $_GET = addslashes_array( $_GET );
00064 $_COOKIE = addslashes_array( $_COOKIE );
00065 }
00066
00070 function output()
00071 {
00072 global $oStyle, $oUser, $strTmpl_inhalt, $x, $y, $booMapUseLastPos;
00073
00074
00075
00076
00077 if( $oUser->booLoggedIn )
00078 {
00079 $intMap_x = $oUser->intLastX;
00080 $intMap_y = $oUser->intLastY;
00081 $strMap_url = "?x=$intMap_x&y=$intMap_y";
00082 $strHome_url = "?x=".$oUser->intHomeX."&y=".$oUser->intHomeY;
00083 }
00084 else
00085 {
00086 $strMap_url = '';
00087 $strHome_url = '';
00088 }
00089
00090 $oStyle->setTemplate( 'navigation.html' );
00091
00092 $strMenuExtra = '';
00093
00094 if( $oUser->isAdmin( 'search' ) )
00095 {
00096 $strMenuExtra .= $oStyle->get_area( 'SearchNav' );
00097 }
00098 if( !empty( $booMapUseLastPos ) && $oUser->booLoggedIn )
00099 {
00100 $oStyle->addReplacements( array( 'MAP_URL' => $strHome_url ) );
00101 $strHome = $oStyle->get_area( 'HomeNav' );
00102 }
00103 if( $oUser->isAdmin( 'admin_menu' ) )
00104 {
00105 $strMenuExtra .= $oStyle->get_area( 'AdminNav' );
00106 }
00107
00108 if( !empty ( $booMapUseLastPos ) )
00109 {
00110 $oStyle->addReplacements( array( 'MAP_URL' => $strHome_url,
00111 'HOME_URL' => $strMap_url,
00112 'MENU_EXTRA' => $strMenuExtra,
00113 'HOME' => $strHome,
00114 'X' => $x,
00115 'Y' => $y ));
00116 }
00117 else
00118 {
00119 $oStyle->addReplacements( array( 'MAP_URL' => $strMap_url,
00120 'HOME_URL' => $strHome_url,
00121 'MENU_EXTRA' => $strMenuExtra,
00122 'X' => $x,
00123 'Y' => $y ));
00124 }
00125
00126 $strTmplNav = $oStyle->get_area( 'Navigation' );
00127
00128 if( empty( $GLOBALS['booMap'] ) )
00129 {
00130 $oStyle->setTemplate( 'main.html' );
00131 $oStyle->addReplacements( array( 'TMPL_NAV' => $strTmplNav, 'TMPL_MAIN' => $strTmpl_inhalt ));
00132 $oStyle->addReplacements( array( 'MAIN_TABLE' => $oStyle->get_area( 'MainTable' ) ) );
00133 }
00134 else
00135 {
00136 $oStyle->setTemplate( 'main.html' );
00137 $oStyle->addReplacements( array( 'TMPL_NAV' => $strTmplNav, 'MAIN_TABLE' => $strTmpl_inhalt ));
00138 }
00139 echo trim( $oStyle->get_area( 'Main' ) );
00140
00141
00142
00143
00144
00145
00146
00147 die();
00148 }
00149
00150
00151 require_once( './conf/config.php' );
00152 require_once( './conf/adminconfig.php' );
00153 require_once( './lib/mysql.php' );
00154 require_once( './lib/user.php' );
00155 require_once( './lib/template.php' );
00156 require_once( './lib/logdb.php' );
00157
00158 $oStyle = new Template( $strTmplPath );
00159 $oStyle->addReplacements( array( 'TITLE' => $strTmplTitle,
00160 'REFRESH' => $intTmplRefresh,
00161 'PHPSELF' => $_SERVER['PHP_SELF'],
00162 'LOGIN_URL' => $_SERVER['PHP_SELF'].'?action=login',
00163 'LOGOUT_URL' => $_SERVER['PHP_SELF'].'?action=logout',
00164 'SERVER_CHANGE' => $_SERVER['PHP_SELF'].'?action=server',
00165 'SERVERNAME' => $strServerName,
00166 'SERVERID' => $intServerId,
00167 'TEMPLATES' => $oStyle->getPath(),
00168 'STYLE' => &$strStyle,
00169 'VERSION' => $strPhpMapVersion
00170 ) );
00171
00172
00173 $oStyle->setTemplate( 'login.html' );
00174
00175 $oStyle->split_area( 'Refresh' );
00176 $oStyle->split_area( 'Message' );
00177 $oStyle->split_area( 'Errortext' );
00178 $oStyle->split_area( 'Option' );
00179 $oStyle->split_area( 'Select' );
00180 $oStyle->split_area( 'NoDbMsg' );
00181
00182 $oMysql = new Mysql( $strMysqlHost, $strMysqlUser, $strMysqlPwd, $strMysqlDb );
00183 $oMysql->setPrefix( $strMysqlPrefix );
00184 unset( $strMysqlHost, $strMysqlUser, $strMysqlPwd, $strMysqlDb, $strMysqlPrefix );
00185
00186
00187 $aReplacements = array();
00188 foreach( $aDiploFgColor AS $intKey => $strColor )
00189 {
00190 $aReplacements['DIPLO_FG_'.$intKey] = $strColor;
00191 }
00192 foreach( $aDiploBgColor AS $intKey => $strColor )
00193 {
00194 $aReplacements['DIPLO_BG_'.$intKey] = $strColor;
00195 }
00196 $oStyle->addReplacements( $aReplacements );
00197
00198
00199 $oUser = new User( $oMysql, $oLog, $aAdmin, $aAdminArrays, $strCookiePrefix );
00200
00201
00202 $oLog = new LogDB( $oMysql, $oUser );
00203
00204
00205 $strArea = $oUser->checklogin() ? 'UserPanel' : 'LoginForm';
00206
00207
00208 if( isset( $_GET['action'] ) && $_GET['action']=='login' )
00209 {
00210 if( $oUser->login( $_POST['f_name'], $_POST['f_pass'] ) )
00211 {
00212 $strTmplMessage = 'Sie sind jetzt Angemeldet!';
00213 $oLog->write( 'Login ok', 3 );
00214 $strArea = 'Refresh';
00215 }
00216 else
00217 {
00218 $strTmplMessage = 'User existiert nicht oder falsches Passwort!';
00219 $oLog->write( 'Login failed for: "'.$_POST['f_name'].'"', 3 );
00220 $strArea = 'Refresh';
00221 }
00222 }
00223
00224 elseif( isset( $_GET['action'] ) && $_GET['action']=='logout' )
00225 {
00226 $oUser->logout();
00227 $strTmplMessage = 'Sie sind jetzt Abgemeldet!';
00228 $strArea = 'Refresh';
00229 }
00230
00231 if( $strArea == 'Refresh' )
00232 {
00233 $oStyle->addReplacements( array( 'REFRESH_URL' => $_SERVER['PHP_SELF'], 'REFRESH_MSG' => $strTmplMessage ) );
00234 echo trim( $oStyle->get_area( 'Refresh' ) );
00235 die();
00236 }
00237
00238 $oStyle->addReplacements( array( 'USERNAME' => $oUser->strUser ) );
00239 $strLoginArea = $oStyle->get_area( $strArea );
00240 $oStyle->addReplacements( array( 'LOGIN' => $strLoginArea ) );
00241
00242
00243 if( isset( $_GET['x'] ) && is_numeric( $_GET['x'] ) && isset( $_GET['y'] ) && is_numeric( $_GET['y'] ) )
00244 {
00245
00246 $x = max( 1, min( $_GET['x'], $intMapSize ) );
00247 $y = max( 1, min( $_GET['y'], $intMapSize ) );
00248
00249 $_GET['x'] = $x;
00250 $_GET['y'] = $y;
00251
00252
00253 $booUpdate = true;
00254 }
00255 else
00256 {
00257 $x = $oUser->intLastX;
00258 $y = $oUser->intLastY;
00259 $booUpdate = false;
00260 }
00261
00262 $intZoom = ( isset( $_GET['zoom'] ) && is_numeric( $_GET['zoom'] ) ) ? $_GET['zoom'] : $oUser->intZoom;
00263
00264 if( $booUpdate && $oUser->booLoggedIn )
00265 {
00266 $oMysql->query( "UPDATE ".$oMysql->tblUser." SET last_x=$x, last_y=$y, zoom_last=$intZoom WHERE user_id='".$oUser->intUserID."';" );
00267 $oUser->intLastX = $x;
00268 $oUser->intLastY = $y;
00269 $oUser->intZoom = $intZoom;
00270 }
00271
00272
00273 if( $oUser->isAdmin( 'banned' ) )
00274 {
00275
00276 $strTmpl_inhalt = '<br /><b>Der Account ist gesperrt.</b>';
00277 output();
00278 }
00279
00280 if( !$oUser->booLoggedIn )
00281 {
00282 $strTmpl_inhalt = '<br><div align="center">Bitte logge dich erst mal ein :-)</div>';
00283 output();
00284 }
00285
00286
00287 if(isset($_POST['p_start'])) $intPagerStart = intval( $_POST['p_start'] );
00288 elseif(isset($_GET['p_start'])) $intPagerStart = intval( $_GET['p_start'] );
00289 else $intPagerStart = 0;
00290
00291 if(isset($_POST['p_count'])) $intPagerCount = intval( $_POST['p_count'] );
00292 elseif(isset($_GET['p_count'])) $intPagerCount = intval( $_GET['p_count'] );
00293 else $intPagerCount = 25;
00294
00295
00296
00297
00298 $strUpdateString = ", `last_update`='".time()."', `last_update_by`='".$oUser->intUserID."'";
00299 $strCreatedString = ", `created`='".time()."', `created_by`='".$oUser->intUserID."'";
00300 $strUpdateFields = ',last_update,last_update_by';
00301 $strUpdateValues = ','.time().','.$oUser->intUserID;