false ) ); $conn = NULL; } catch( PDOException $pdoe ) { die( "Exception: " . $pdoe -> getCode() . "\n" ); } catch( Exception $e ) { die( "Exception: " . $e -> getCode() . "\n" ); } ?> true //persistent connection ); //tablenames $cfg['db_tables'] = array(); $cfg['db_tables']['configuration'] = "configuration"; $cfg['db_tables']['exception'] = "exception"; $cfg['db_tables']['images'] = "images"; $cfg['db_tables']['css'] = "css"; $cfg['db_tables']['text'] = "text"; /* Paths [end dir with a forward slash!] --------------------------------------------------------------------------------------------------------------*/ $cfg['path'] = array(); //base $cfg['path']['base'] = "/websites/awarox/awaroxweb/"; //attention!: requires automatic determination! //homepage $cfg['path']['homepage'] = "pages/home/"; //dirs $cfg['path']['js_dir'] = "javascript/"; $cfg['path']['image_dir'] = "images/"; $cfg['path']['css_dir'] = "css/"; $cfg['path']['module_dir'] = "modules/"; /* Modules --------------------------------------------------------------------------------------------------------------*/ $cfg['module']['include_file'] = "include.php"; $cfg['module']['action_file'] = "action.php"; $cfg['module']['install_file'] = "install.php"; $cfg['module']['uninstall_file'] = "uninstall.php"; $cfg['module']['check_file'] = "check.php"; ?> output() ); /* HTTP Headers --------------------------------------------------------------------------------------------------------------*/ header( "Content-Type: text/css" ); header( "Pragma: no-cache" ); /* Close --------------------------------------------------------------------------------------------------------------*/ require_once( 'close.inc.php' ); ?> makePathSafe(); $file = (string) $file; //make sizes secure //attention!: requires class for secure input if( !is_numeric( $newheight ) || !is_numeric( $newwidth ) ) { throw new AwaroxException( "One of the specified REQUEST width / height is not an Integer.", 6401, $db ); } //file to path $file= $cfg['path']['image_dir'] . $file; //file exists + is image if( !file_exists( $file ) ) { throw new AwaroxException( "Requested image does not exist.", 6501, $db ); } if( !is_file( $file ) ) { throw new AwaroxException( "Image is not a regular file, though does exist.", 6502, $db ); } $size = getimagesize( $file ); if( $size === "false" ) { throw new AwaroxException( "Requested image does not seem an image.", 6503, $db ); } //image properties $oldheight = $size[1]; $oldwidth = $size[0]; $mime = $size["mime"]; //useless to increase the size by the server, we only want to decrease it if( $newheight > $oldheight || $newwidth > $oldwidth ) { header( "Location: " . $cfg['path']['base'] . $file ); } //get old image switch( $mime ) { case "image/png": $oldimg = imagecreatefrompng( $file ); break; case "image/jpeg": $oldimg = imagecreatefromjpeg( $file ); break; case "image/gif": $olding = imagecreatefromgif( $file ); break; default: header( "Location: " . $cfg['path']['base'] . $file ); die(); } //create new image $newimg = imagecreatetruecolor( $newwidth, $newheight ); //resize image imagecopyresampled( $newimg, $oldimg, 0, 0, 0, 0, $newwidth, $newheight, $oldwidth, $oldheight ) or die( "Troubles..." ); //sent header header( "Content-Type: " . $mime ); //sent image switch( $mime ) { case "image/png": imagepng( $newimg ); break; case "image/jpeg": imagejpeg( $newimg ); break; case "image/gif": imagegif( $newimg ); break; default: } } catch( AwaroxException $awe ) { echo $awe; } require_once( 'close.inc.php' ); ?> setPage( $_REQUEST['p'] ); /* Page //attention: needs a mod_error( "Inactive"... --------------------------------------------------------------------------------------------------------------*/ //int page $page = $_REQUEST['p']; //page set? if( !isset( $page ) ) { header( "Location: " . $cfg['path']['base'].$cfg['path']['homepage'] ); } //get config $stmt = $db -> prepare( "select ConfigName from page where PagePath = :page" ); $stmt -> bindParam( ":page", $page ); $stmt -> execute(); foreach( $stmt -> fetchAll() as $modcfg ) { $configname = $modcfg["ConfigName"]; } $stmt = $db -> prepare( "select ModuleConfigModuleName from moduleconfig where ModuleConfigName = :configname" ); $stmt -> bindParam( ":configname", $configname ); $stmt -> execute(); $ispage = false; foreach( $stmt -> fetchAll() as $modcfg ) { $ispage = true; $pagemodule = $modcfg["ModuleConfigModuleName"]; } if( !$ispage ) { echo( "

404

Sorry, the page could not be found.
" ); } if( isset( $pagemodule ) && !empty( $pagemodule ) ) { eval( "\$" . $pagemodule . " = new " . $pagemodule . "( \$configname, \$cfg, \$db );" ); } /* Copyright & Links --------------------------------------------------------------------------------------------------------------*/ $infob = new mod_text( "systemFooter", $cfg, $db ); /* Bottom XHTML --------------------------------------------------------------------------------------------------------------*/ require_once( 'library/bottom.php' ); /* Close --------------------------------------------------------------------------------------------------------------*/ require_once( 'close.inc.php' ); ?> getCode() . "\n"; } /* Error Reporting --------------------------------------------------------------------------------------------------------------*/ //attention!: uncomment // below for security reasons //error_reporting( 0 ); /* Exceptions --------------------------------------------------------------------------------------------------------------*/ function exception_handler( $exception ) { die( "Uncaught Exception." ); //attention!: do report? } set_exception_handler('exception_handler'); /* Autoloading Classes --------------------------------------------------------------------------------------------------------------*/ function __autoload( $classname ) { try { if( substr( $classname, 0, 3) === "mod" ) { if( !file_exists( MODULE_DIR . $classname . "/" . "include.php" ) ) { throw new Exception( "", "6101" ); } if( !is_file( MODULE_DIR . $classname . "/" . "include.php" ) ) { throw new Exception( "", "6102" ); } require_once( MODULE_DIR. $classname . "/" . "include.php" ); } else { if( !file_exists( CLASS_DIR . $classname . ".class.php" ) ) { throw new Exception( "", "6101" ); } if( !is_file( CLASS_DIR . $classname . ".class.php" ) ) { throw new Exception( "", "6102" ); } require_once( CLASS_DIR . $classname . ".class.php" ); } } catch( Exception $e ) { ob_clean(); die( "Exception: " . $e->getCode() ); } } /* Regular Checks --------------------------------------------------------------------------------------------------------------*/ require_once( 'check.inc.php' ); /* Set-up database connection --------------------------------------------------------------------------------------------------------------*/ $db = new PDO( $cfg['pdo'], $cfg['db_user'], $cfg['db_pass'], $cfg['pdo_attributes'] ); /* Fetch Configuration from Database --------------------------------------------------------------------------------------------------------------*/ try { $query = $db -> prepare("select * from {$cfg['db_tables']['configuration']}"); $query -> execute(); foreach( $query -> fetchAll() as $row ) { $param = $row["ConfigurationParameter"]; $value = $row["ConfigurationValue"]; if( isset( $cfg[$param] ) ) { throw new Exception( "", "4003" ); } $cfg[$param] = $value; } } catch( Exception $e ) { die( "Exception: " . $e -> getCode() . "\n" ); } /* Start Output Buffering --------------------------------------------------------------------------------------------------------------*/ ob_start(); /* Start Session --------------------------------------------------------------------------------------------------------------*/ session_start(); /* Gather user info for session --------------------------------------------------------------------------------------------------------------*/ if( !isset( $_SESSION['user'] ) || empty( $_SESSION['user'] ) ) { //make user $_SESSION['user'] = new User( $_SERVER['REMOTE_ADDR'] ); //attention!: ip itself not safe enough as user identification //set language //attention!: make a automatic language detect $_SESSION['user'] -> setLanguage( "en-US" ); //set useragent $_SESSION['user'] -> setUserAgent( $_SERVER['HTTP_USER_AGENT'] ); } /* Create CSS in Session --------------------------------------------------------------------------------------------------------------*/ if( !isset( $_SESSION['css'] ) || empty( $_SESSION['css'] ) ) { //make css $_SESSION['css'] = new CSS( $cfg ); $_SESSION['css'] -> load( "basic", $db ); } ?> "center", "text" => array( 0 => array( 0 => array( "id" => "InformationLogo", "class" => NULL, "corners" => false, "content" => "" ), 1 => array( "id" => "InformationLinks", "class" => NULL, "corners" => false, "content" => "" ), 2 => array( "id" => "InformationAddress", "class" => NULL, "corners" => false, "content" => "
Awarox
Rembrandtlaan 22
3443EG Woerden
info@awarox.com
KVK 30227342
" ) ) ) ); $confbottom = array( "align" => "center", "text" => array( 0 => array( 0 => array( "id" => "footer", "class" => NULL, "corners" => false, "content" => "Copyright © Awarox " . date('Y') ) ) ) ); $confhome = array( "align" => "center", "text" => array( 0 => array( 0 => array( "id" => "Homepage00", "class" => NULL, "corners" => true, "content" => NULL ) ), 1 => array( 0 => array( "id" => "Homepage10", "class" => "head", "corners" => false, "content" => "

Proudly
Announcing!

" ), 1 => array( "id" => "Homepage11", "class" => "text", "corners" => false, "content" => "

We, Awarox, are proudly announcing the start of our company. This is a dummy-text. We deliver Internet Security services, Penetration Testings and Webapplication-development. Please feel free to browse our website to learn more about our products and services. Have a very special and nice day, the Awarox Security Team. This is a dummy-text.

We, Awarox, are proudly announcing the start of our company. This is a dummy-text. We deliver Internet Security services, Penetration Testings and Webapplication-development. Please feel free to browse our website to learn more about our products and services. Have a very special and nice day, the Awarox Security Team. This is a dummy-text.

" ) ), 2 => array( 0 => array( "id" => "Homepage20", "class" => "text", "corners" => false, "content" => "

We, Awarox, are proudly announcing the start of our company. This is a dummy-text. We deliver Internet Security services, Penetration Testings and Webapplication-development. Please feel free to browse our website to learn more about our products and services. Have a very special and nice day, the Awarox Security Team. This is a dummy-text.

We, Awarox, are proudly announcing the start of our company. This is a dummy-text. We deliver Internet Security services, Penetration Testings and Webapplication-development. Please feel free to browse our website to learn more about our products and services. Have a very special and nice day, the Awarox Security Team. This is a dummy-text. We, Awarox, are proudly announcing the start of our company. This is a dummy-text. We deliver Internet Security services, Penetration Testings and Webapplication-development. Please feel free to browse our website to learn more about our products and services. Have a very special and nice day, the Awarox Security Team. This is a dummy-text.

We, Awarox, are proudly announcing the start of our company. This is a dummy-text. We deliver Internet Security services, Penetration Testings and Webapplication-development. Please feel free to browse our website to learn more about our products and services. Have a very special and nice day, the Awarox Security Team. This is a dummy-text.

" ), 1 => array( "id" => "Homepage21", "class" => "head", "corners" => false, "content" => "

Security is a
serious issue.

" ) ) ) ); $confnav = array( "layout" => "horizontal", "align" => "center", "id" => "NavHorizontal", "class" => NULL, "corners" => true ); echo(serialize($confnav)); ?>