From 73c64c5f65e76374b5c617e9333ab4c013d94110 Mon Sep 17 00:00:00 2001 From: Christian Steinle Date: Mon, 12 Sep 2016 22:24:04 +0000 Subject: [PATCH] Code-Formatierungen und Anpassungen an neue Editoren --- .actions/portal_actions.php | 186 +- .actions/usermanagement_actions.php | 278 ++- .classes/generic/renderClass.php | 916 +++++----- .classes/generic/renderClass_abstract.php | 42 +- .classes/generic/renderFormClass.php | 200 ++- .classes/generic/renderFunctionsClass.php | 166 +- .classes/generic/renderImageClass.php | 62 +- .classes/generic/renderNavigationClass.php | 207 ++- .classes/generic/renderPopupClass.php | 540 +++--- .../generic/renderSpecialContentClass.php | 100 +- .classes/generic/renderWidgetClass.php | 56 +- .classes/rendering/viewClass.php | 262 +-- .classes/rendering/viewClass_abstract.php | 60 +- .config/config_global.php | 178 +- .config/config_svjf.php | 43 +- .config/config_version.php | 90 +- .functions/fnc_portal.php | 758 ++++---- .functions/fnc_webservices.php | 403 +++-- .helpers/berichte2chronik.php | 136 +- .helpers/einzelne_berichte2navPoint.php | 67 +- .helpers/fehlende_content_elemente.php | 92 +- .helpers/jugend_teams.php | 64 +- .helpers/team_untermenu.php | 70 +- .helpers/update_user_table.php | 60 +- .htaccess | 16 + .includes/global_header.php | 55 +- .includes/website_header.php | 80 +- .includes/website_rights.php | 74 +- .lang/informal/lang_de.php | 21 +- .lang/lang_de.php | 288 +-- administrator/css/svjf_editor.css | 1082 ++++++----- administrator/index.php | 274 ++- administrator/js/portal.js | 2 +- administrator/popups/editor/index.php | 423 ++--- administrator/popups/logfiles/index.php | 144 +- administrator/popups/usermanagement/index.php | 326 ++-- administrator/webservices/.htaccess | 3 + administrator/webservices/remote_data.php | 1584 ++++++++--------- administrator/webservices/test_data.php | 10 + index.php | 433 ++--- templates/svjf/tpl_definitions.php | 8 +- templates/svjf/tpl_editor.php | 3 +- templates/svjf/tpl_main.php | 605 ++++--- templates/svjf/tpl_pageContents.php | 16 +- templates/svjf/tpl_textimage.php | 42 +- templates/svjf/tpl_widget.php | 16 +- 46 files changed, 5167 insertions(+), 5374 deletions(-) create mode 100644 .htaccess create mode 100644 administrator/webservices/.htaccess create mode 100644 administrator/webservices/test_data.php diff --git a/.actions/portal_actions.php b/.actions/portal_actions.php index 5cf241b..65271e9 100644 --- a/.actions/portal_actions.php +++ b/.actions/portal_actions.php @@ -1,100 +1,98 @@ query('SELECT * FROM ' . TBL_USER . ' WHERE userUsername = "' . $_POST['userName'] . '" AND userPasswordCrypt = "' . md5($_POST['passWord']) . '" AND userDelete = "N";'); + if ($result->num_rows === 0) + { + /* Fehlerhafte Benutzeranmeldung */ + $arrError[] = 'login_001'; + fnc_writeLog('00000001', array($_SERVER['REMOTE_ADDR'], $_POST['userName']), 0); + } + else + { + $dat_user = $result->fetch_assoc(); + if ($dat_user['userActive'] === 'N') { - /* Nur nicht gelöschte Benutzer */ - $result = $db -> query ( 'SELECT * FROM ' . TBL_USER . ' WHERE userUsername = "' . $_POST[ 'userName' ] . '" AND userPasswordCrypt = "' . md5 ( $_POST[ 'passWord' ] ) . '" AND userDelete = "N";' ); - if ( $result -> num_rows === 0 ) - { - /* Fehlerhafte Benutzeranmeldung */ - $arrError[ ] = 'login_001'; - fnc_writeLog ( '00000001' , array ( $_SERVER[ 'REMOTE_ADDR' ] , $_POST[ 'userName' ] ) , 0 ); - } - else - { - $dat_user = $result -> fetch_assoc ( ); - if ( $dat_user[ 'userActive' ] === 'N' ) - { - /* User ist deaktiviert */ - $arrError[ ] = 'login_002'; - fnc_writeLog ( '00000002' , array ( ) , $dat_user[ 'userId' ] ); - } - else - { - /* Anmeldung erfolgreich und Prüfung, ob Passwort geändert werden muss */ - /* Bearbeitungsrechte abfragen */ - $editingRights = $db -> query ( 'SELECT * FROM ' . TBL_RIGHTS . ' WHERE userId = "' . $dat_user[ 'userId' ] . '";' ); - - $_SESSION[ 'sess_userId' ] = $dat_user[ 'userId' ]; - $_SESSION[ 'sess_loginDate' ] = date( 'YmdHis' ); - $_SESSION[ 'sess_loginStatus' ] = ( $dat_user[ 'userPasswordOrgCrypt' ] === $dat_user[ 'userPasswordCrypt' ] ) - ? 'changePW' - : 'loggedIn'; - $_SESSION[ 'sess_sessionId' ] = session_id( ); - $_SESSION[ 'sess_sessionName' ] = session_name( ); - $_SESSION[ 'sess_loginLang' ] = 'de'; - $_SESSION[ 'sess_portalRightsType' ] = $dat_user[ 'userPortalRightsType' ]; - $_SESSION[ 'sess_portalRights' ] = explode ( ';' , $dat_user[ 'userPortalRights' ] ); - while ( $singleRights = $editingRights -> fetch_assoc ( ) ) - { - $_SESSION[ 'sess_' . $singleRights[ 'rightsPrefix' ] . 'Type' ] = $singleRights[ 'rightsType' ]; - $_SESSION[ 'sess_' . $singleRights[ 'rightsPrefix' ] ] = $singleRights[ 'rights' ]; - } - - if ( $dat_user[ 'userPasswordOrgCrypt' ] === $dat_user[ 'userPasswordCrypt' ] ) - { - $_GET[ 'siteId' ] = 'changePW'; - fnc_writeLog ( '00000005' , array ( ) , $dat_user[ 'userId' ] ); - } - else - { - $_GET[ 'siteId' ] = '1'; - fnc_writeLog ( '00000003' , array ( ) , $dat_user[ 'userId' ] ); - } - - header( 'Location: index.php?siteId=' . $_GET[ 'siteId' ] ); - die( ); - } - } + /* User ist deaktiviert */ + $arrError[] = 'login_002'; + fnc_writeLog('00000002', array(), $dat_user['userId']); } - - /* Abmelden */ - if ( isset ( $_GET[ 'siteId' ] ) && $_GET[ 'siteId' ] === 'logout' ) + else { - if ( isset ( $_SESSION[ 'sess_userId' ] ) ) - { - fnc_writeLog ( '00000004' , array ( ) , $_SESSION[ 'sess_userId' ] ); - } - session_destroy( ); - header( 'Location: index.php?siteId=login' ); - die( ); - } - - /* Passwort ändern */ - if ( isset ( $_POST[ 'formAction' ] ) && $_POST[ 'formAction' ] === 'changePW' ) - { - if ( $_POST[ 'newPassWord' ] !== $_POST[ 'passWordRepeat' ] ) - { - $arrError[ ] = 'pw_001'; - } - else - { - $result = $db -> query ( 'SELECT * FROM ' . TBL_USER . ' WHERE userUsername = "' . $_POST[ 'userName' ] . '" AND userPasswordOrg = "' . $_POST[ 'passWord' ] . '" AND userDelete = "N";' ); - if ( $result -> num_rows === 0 ) - { - $arrError[ ] = 'login_001'; - } - else - { - $_SESSION[ 'sess_loginStatus' ] = 'loggedIn'; - $user = $result -> fetch_assoc ( ); - $db -> query ( 'UPDATE ' . TBL_USER . ' SET userPasswordCrypt = "' . md5 ( $_POST[ 'newPassWord' ] ) . '" WHERE userId = "' . $user[ 'userId' ] . '" LIMIT 1;' ); - fnc_writeLog ( '00000016' , array ( fnc_getUsernameById ( $user[ 'userId' ] ) ) , $_SESSION[ 'sess_userId' ] ); - header( 'Location:index.php?siteId=1' ); - die( ); - } - } - } + /* Anmeldung erfolgreich und Prüfung, ob Passwort geändert werden muss */ + /* Bearbeitungsrechte abfragen */ + $editingRights = $db->query('SELECT * FROM ' . TBL_RIGHTS . ' WHERE userId = "' . $dat_user['userId'] . '";'); -?> \ No newline at end of file + $_SESSION['sess_userId'] = $dat_user['userId']; + $_SESSION['sess_loginDate'] = date('YmdHis'); + $_SESSION['sess_loginStatus'] = ($dat_user['userPasswordOrgCrypt'] === $dat_user['userPasswordCrypt']) + ? 'changePW' + : 'loggedIn'; + $_SESSION['sess_sessionId'] = session_id(); + $_SESSION['sess_sessionName'] = session_name(); + $_SESSION['sess_loginLang'] = 'de'; + $_SESSION['sess_portalRightsType'] = $dat_user['userPortalRightsType']; + $_SESSION['sess_portalRights'] = explode(';', $dat_user['userPortalRights']); + while ($singleRights = $editingRights->fetch_assoc()) + { + $_SESSION['sess_' . $singleRights['rightsPrefix'] . 'Type'] = $singleRights['rightsType']; + $_SESSION['sess_' . $singleRights['rightsPrefix']] = $singleRights['rights']; + } + + if ($dat_user['userPasswordOrgCrypt'] === $dat_user['userPasswordCrypt']) + { + $_GET['siteId'] = 'changePW'; + fnc_writeLog('00000005', array(), $dat_user['userId']); + } + else + { + $_GET['siteId'] = '1'; + fnc_writeLog('00000003', array(), $dat_user['userId']); + } + + header('Location: index.php?siteId=' . $_GET['siteId']); + die(); + } + } +} + +/* Abmelden */ +if (isset ($_GET['siteId']) && $_GET['siteId'] === 'logout') +{ + if (isset ($_SESSION['sess_userId'])) + { + fnc_writeLog('00000004', array(), $_SESSION['sess_userId']); + } + session_destroy(); + header('Location: index.php?siteId=login'); + die(); +} + +/* Passwort ändern */ +if (isset ($_POST['formAction']) && $_POST['formAction'] === 'changePW') +{ + if ($_POST['newPassWord'] !== $_POST['passWordRepeat']) + { + $arrError[] = 'pw_001'; + } + else + { + $result = $db->query('SELECT * FROM ' . TBL_USER . ' WHERE userUsername = "' . $_POST['userName'] . '" AND userPasswordOrg = "' . $_POST['passWord'] . '" AND userDelete = "N";'); + if ($result->num_rows === 0) + { + $arrError[] = 'login_001'; + } + else + { + $_SESSION['sess_loginStatus'] = 'loggedIn'; + $user = $result->fetch_assoc(); + $db->query('UPDATE ' . TBL_USER . ' SET userPasswordCrypt = "' . md5($_POST['newPassWord']) . '" WHERE userId = "' . $user['userId'] . '" LIMIT 1;'); + fnc_writeLog('00000016', array(fnc_getUsernameById($user['userId'])), $_SESSION['sess_userId']); + header('Location:index.php?siteId=1'); + die(); + } + } +} \ No newline at end of file diff --git a/.actions/usermanagement_actions.php b/.actions/usermanagement_actions.php index 7c41a0a..0c91de5 100644 --- a/.actions/usermanagement_actions.php +++ b/.actions/usermanagement_actions.php @@ -1,151 +1,149 @@ query('UPDATE ' . TBL_USER . ' SET userActive = "N" , userActiveUser = "' . $_SESSION['sess_userId'] . '" , userActiveTS = NOW( ) WHERE userId = "' . $_POST['userId'] . '" LIMIT 1;'); + fnc_writeLog('00000011', array(fnc_getUsernameById($_POST['userId'])), $_SESSION['sess_userId']); + header('Location:index.php?siteId=' . $_POST['siteId']); + die(); +} + +if (isset ($_POST['formAction']) && $_POST['formAction'] === 'enableUser') +{ + $db->query('UPDATE ' . TBL_USER . ' SET userActive = "Y" WHERE userId = "' . $_POST['userId'] . '" LIMIT 1;'); + fnc_writeLog('00000012', array(fnc_getUsernameById($_POST['userId'])), $_SESSION['sess_userId']); + header('Location:index.php?siteId=' . $_POST['siteId']); + die(); +} + +if (isset ($_POST['formAction']) && $_POST['formAction'] === 'deleteUser') +{ + $db->query('UPDATE ' . TBL_USER . ' SET userDelete = "Y" , userDeleteUser = "' . $_SESSION['sess_userId'] . '" , userDeleteTS = NOW( ) WHERE userId = "' . $_POST['userId'] . '" LIMIT 1;'); + fnc_writeLog('00000014', array(fnc_getUsernameById($_POST['userId'])), $_SESSION['sess_userId']); + header('Location:index.php?siteId=' . $_POST['siteId']); + die(); +} + +if (isset ($_POST['formAction']) && $_POST['formAction'] === 'resetPW') +{ + $status = fnc_sendEmailToUser('00000015', $_POST['userId'], $_SESSION['sess_userId']); + if ($status === 'OK') + { + $db->query('UPDATE ' . TBL_USER . ' SET userPasswordCrypt = "' . $_POST['userPasswordOrgCrypt'] . '" WHERE userId = "' . $_POST['userId'] . '" LIMIT 1;'); + fnc_writeLog('00000015', array(fnc_getUsernameById($_POST['userId'])), $_SESSION['sess_userId']); + header('Location:index.php?siteId=' . $_POST['siteId']); + die(); + } + else + { + $arrError[] = 'mail_001'; + } + die(); +} + +if (isset ($_POST['formAction']) && $_POST['formAction'] === 'createUser') +{ + if (!isset ($_POST['user_portalRightsType'])) + { + $_POST['user_portalRightsType'] = 'DEF'; + } + $userPortalRights = ($_POST['user_portalRightsType'] === 'ALL' || !isset ($_POST['user_portalRights'])) + ? '' + : implode(';', $_POST['user_portalRights']); + + if (!fnc_validateEmailAddress($_POST['userEmail'])) + { + $arrError[] = 'mail_002'; + } + if (!fnc_checkUniqueEmailAddress($_POST['userEmail'])) + { + $arrError[] = 'mail_003'; + } + + if (isset ($arrError) && !empty ($arrError)) + { + $_GET['siteId'] = $_POST['siteId']; + $_GET['todoId'] = $_POST['todoId']; + } + else + { + $userName = fnc_generateUniqueUsername($_POST['userLastname'], $_POST['userFirstname']); + $passWord = fnc_generatePW(); + $crypt = md5($passWord); + $insert = $db->query('INSERT INTO ' . TBL_USER . ' ( userUsername , userEmail , userPhone , userPasswordCrypt , userPasswordOrgCrypt , userPasswordOrg , userFirstname , userLastname , userCreateUser , userActive , userDelete , userPortalRightsType , userPortalRights ) VALUES ( "' . $userName . '" , "' . $_POST['userEmail'] . '" , "' . $_POST['userPhone'] . '" , "' . $crypt . '" , "' . $crypt . '" , "' . $passWord . '" , "' . $_POST['userFirstname'] . '" , "' . $_POST['userLastname'] . '" , "' . $_SESSION['sess_userId'] . '" , "Y" , "N" , "' . $_POST['user_portalRightsType'] . '" , "' . $userPortalRights . '" );'); + $userId = $db->insert_id; + + foreach ($vC['portal']['website']['prefix'] as $website) { - $db -> query ( 'UPDATE ' . TBL_USER . ' SET userActive = "N" , userActiveUser = "' . $_SESSION[ 'sess_userId' ] . '" , userActiveTS = NOW( ) WHERE userId = "' . $_POST[ 'userId' ] . '" LIMIT 1;' ); - fnc_writeLog ( '00000011' , array ( fnc_getUsernameById ( $_POST[ 'userId' ] ) ) , $_SESSION[ 'sess_userId' ] ); - header( 'Location:index.php?siteId=' . $_POST[ 'siteId' ] ); - die( ); + if (!isset ($_POST['user' . $website . 'RightsType'])) + { + $_POST['user' . $website . 'RightsType'] = 'DEF'; + } + $userWebsiteRights = ($_POST['user_' . $website . 'RightsType'] === 'ALL' || !isset ($_POST['user_' . $website . 'Rights'])) + ? '' + : implode(';', $_POST['user' . $website . 'Rights']); + + $db->query('INSERT INTO ' . TBL_RIGHTS . ' SET userId = "' . $userId . '" , rightsPrefix = "' . $website . '" , rightsType = "' . $_POST['user_' . $website . 'RightsType'] . '" , rights = "' . $userWebsiteRights . '";'); } - if ( isset ( $_POST[ 'formAction' ] ) && $_POST[ 'formAction' ] === 'enableUser' ) - { - $db -> query ( 'UPDATE ' . TBL_USER . ' SET userActive = "Y" WHERE userId = "' . $_POST[ 'userId' ] . '" LIMIT 1;' ); - fnc_writeLog ( '00000012' , array ( fnc_getUsernameById ( $_POST[ 'userId' ] ) ) , $_SESSION[ 'sess_userId' ] ); - header( 'Location:index.php?siteId=' . $_POST[ 'siteId' ] ); - die( ); - } + fnc_sendEmailToUser('00000010', $userId, $_SESSION['sess_userId']); + fnc_writeLog('00000010', array(fnc_getUsernameById($userId)), $_SESSION['sess_userId']); + header('Location:index.php?siteId=' . $_POST['siteId']); + die (); + } +} - if ( isset ( $_POST[ 'formAction' ] ) && $_POST[ 'formAction' ] === 'deleteUser' ) - { - $db -> query ( 'UPDATE ' . TBL_USER . ' SET userDelete = "Y" , userDeleteUser = "' . $_SESSION[ 'sess_userId' ] . '" , userDeleteTS = NOW( ) WHERE userId = "' . $_POST[ 'userId' ] . '" LIMIT 1;' ); - fnc_writeLog ( '00000014' , array ( fnc_getUsernameById ( $_POST[ 'userId' ] ) ) , $_SESSION[ 'sess_userId' ] ); - header( 'Location:index.php?siteId=' . $_POST[ 'siteId' ] ); - die( ); - } +if (isset ($_POST['formAction']) && $_POST['formAction'] === 'editUser') +{ + if (!isset ($_POST['user_portalRightsType'])) + { + $_POST['user_portalRightsType'] = 'DEF'; + } + $userPortalRights = ($_POST['user_portalRightsType'] === 'ALL' || !isset ($_POST['user_portalRights'])) + ? '' + : implode(';', $_POST['user_portalRights']); - if ( isset ( $_POST[ 'formAction' ] ) && $_POST[ 'formAction' ] === 'resetPW' ) + if (!fnc_validateEmailAddress($_POST['userEmail'])) + { + $arrError[] = 'mail_002'; + } + if (!fnc_checkUniqueEmailAddress($_POST['userEmail'], $_POST['userId'])) + { + $arrError[] = 'mail_003'; + } + + if (isset ($arrError) && !empty ($arrError)) + { + $_GET['siteId'] = $_POST['siteId']; + $_GET['todoId'] = $_POST['todoId']; + $_GET['userId'] = $_POST['userId']; + } + else + { + $db->query('UPDATE ' . TBL_USER . ' SET userLastname = "' . $_POST['userLastname'] . '" , userFirstname = "' . $_POST['userFirstname'] . '" , userEmail = "' . $_POST['userEmail'] . '" , userPhone = "' . $_POST['userPhone'] . '" , userPortalRightsType = "' . $_POST['user_portalRightsType'] . '" , userPortalRights = "' . $userPortalRights . '" WHERE userId = "' . $_POST['userId'] . '" LIMIT 1;'); + + foreach ($vC['portal']['website']['prefix'] as $website) { - $status = fnc_sendEmailToUser ( '00000015' , $_POST[ 'userId' ] , $_SESSION[ 'sess_userId' ] ); - if ( $status === 'OK' ) - { - $db -> query ( 'UPDATE ' . TBL_USER . ' SET userPasswordCrypt = "' . $_POST[ 'userPasswordOrgCrypt' ] . '" WHERE userId = "' . $_POST[ 'userId' ] . '" LIMIT 1;' ); - fnc_writeLog ( '00000015' , array ( fnc_getUsernameById ( $_POST[ 'userId' ] ) ) , $_SESSION[ 'sess_userId' ] ); - header( 'Location:index.php?siteId=' . $_POST[ 'siteId' ] ); - die( ); - } + if (!isset ($_POST['user_' . $website . 'RightsType'])) + { + $_POST['user_' . $website . 'RightsType'] = 'DEF'; + } + $userWebsiteRights = ($_POST['user_' . $website . 'RightsType'] === 'ALL' || !isset ($_POST['user_' . $website . 'Rights'])) + ? '' + : implode(';', $_POST['user_' . $website . 'Rights']); + $rights = $db->query('SELECT * FROM ' . TBL_RIGHTS . ' WHERE userId = "' . $_POST['userId'] . '" AND rightsPrefix = "' . $website . '";'); + if ($rights->num_rows === 0) + { + $db->query('INSERT INTO ' . TBL_RIGHTS . ' SET userId = "' . $_POST['userId'] . '" , rightsPrefix = "' . $website . '" , rightsType = "' . $_POST['user' . $website . 'RightsType'] . '" , rights = "' . $userWebsiteRights . '";'); + } else - { - $arrError[ ] = 'mail_001'; - } - die( ); - } - - if ( isset ( $_POST[ 'formAction' ] ) && $_POST[ 'formAction' ] === 'createUser' ) - { - if ( ! isset ( $_POST[ 'user_portalRightsType' ] ) ) - { - $_POST[ 'user_portalRightsType' ] = 'DEF'; - } - $userPortalRights = ( $_POST[ 'user_portalRightsType' ] === 'ALL' || ! isset ( $_POST[ 'user_portalRights' ] ) ) - ? '' - : implode ( ';' , $_POST[ 'user_portalRights' ] ); - - if ( ! fnc_validateEmailAddress ( $_POST[ 'userEmail' ] ) ) - { - $arrError[ ] = 'mail_002'; - } - if ( ! fnc_checkUniqueEmailAddress ( $_POST[ 'userEmail' ] ) ) - { - $arrError[ ] = 'mail_003'; - } - - if ( isset ( $arrError ) && ! empty ( $arrError ) ) - { - $_GET[ 'siteId' ] = $_POST[ 'siteId' ]; - $_GET[ 'todoId' ] = $_POST[ 'todoId' ]; - } - else - { - $userName = fnc_generateUniqueUsername ( $_POST[ 'userLastname' ] , $_POST[ 'userFirstname' ] ); - $passWord = fnc_generatePW ( ); - $crypt = md5 ( $passWord ); - $insert = $db -> query ( 'INSERT INTO ' . TBL_USER . ' ( userUsername , userEmail , userPhone , userPasswordCrypt , userPasswordOrgCrypt , userPasswordOrg , userFirstname , userLastname , userCreateUser , userActive , userDelete , userPortalRightsType , userPortalRights ) VALUES ( "' . $userName . '" , "' . $_POST[ 'userEmail' ] . '" , "' . $_POST[ 'userPhone' ] . '" , "' . $crypt . '" , "' . $crypt . '" , "' . $passWord . '" , "' . $_POST[ 'userFirstname' ] . '" , "' . $_POST[ 'userLastname' ] . '" , "' . $_SESSION[ 'sess_userId' ] . '" , "Y" , "N" , "' . $_POST[ 'user_portalRightsType' ] . '" , "' . $userPortalRights . '" );' ); - $userId = $db -> insert_id; - - foreach ( $vC[ 'portal' ][ 'website' ][ 'prefix' ] as $website ) - { - if ( ! isset ( $_POST[ 'user' . $website . 'RightsType' ] ) ) - { - $_POST[ 'user' . $website . 'RightsType' ] = 'DEF'; - } - $userWebsiteRights = ( $_POST[ 'user_' . $website . 'RightsType' ] === 'ALL' || ! isset ( $_POST[ 'user_' . $website . 'Rights' ] ) ) - ? '' - : implode ( ';' , $_POST[ 'user' . $website . 'Rights' ] ); - - $db -> query ( 'INSERT INTO ' . TBL_RIGHTS . ' SET userId = "' . $userId . '" , rightsPrefix = "' . $website . '" , rightsType = "' . $_POST[ 'user_' . $website . 'RightsType' ] . '" , rights = "' . $userWebsiteRights . '";' ); - } - - fnc_sendEmailToUser ( '00000010' , $userId , $_SESSION[ 'sess_userId' ] ); - fnc_writeLog ( '00000010' , array ( fnc_getUsernameById ( $userId ) ) , $_SESSION[ 'sess_userId' ] ); - header( 'Location:index.php?siteId=' . $_POST[ 'siteId' ] ); - die ( ); - } - } - - if ( isset ( $_POST[ 'formAction' ] ) && $_POST[ 'formAction' ] === 'editUser' ) - { - if ( ! isset ( $_POST[ 'user_portalRightsType' ] ) ) - { - $_POST[ 'user_portalRightsType' ] = 'DEF'; - } - $userPortalRights = ( $_POST[ 'user_portalRightsType' ] === 'ALL' || ! isset ( $_POST[ 'user_portalRights' ] ) ) - ? '' - : implode ( ';' , $_POST[ 'user_portalRights' ] ); - - if ( ! fnc_validateEmailAddress ( $_POST[ 'userEmail' ] ) ) - { - $arrError[ ] = 'mail_002'; - } - if ( ! fnc_checkUniqueEmailAddress ( $_POST[ 'userEmail' ] , $_POST[ 'userId' ] ) ) - { - $arrError[ ] = 'mail_003'; - } - - if ( isset ( $arrError ) && ! empty ( $arrError ) ) - { - $_GET[ 'siteId' ] = $_POST[ 'siteId' ]; - $_GET[ 'todoId' ] = $_POST[ 'todoId' ]; - $_GET[ 'userId' ] = $_POST[ 'userId' ]; - } - else - { - $db -> query ( 'UPDATE ' . TBL_USER . ' SET userLastname = "' . $_POST[ 'userLastname' ] . '" , userFirstname = "' . $_POST[ 'userFirstname' ] . '" , userEmail = "' . $_POST[ 'userEmail' ] . '" , userPhone = "' . $_POST[ 'userPhone' ] . '" , userPortalRightsType = "' . $_POST[ 'user_portalRightsType' ] . '" , userPortalRights = "' . $userPortalRights . '" WHERE userId = "' . $_POST[ 'userId' ] . '" LIMIT 1;' ); - - foreach ( $vC[ 'portal' ][ 'website' ][ 'prefix' ] as $website ) - { - if ( ! isset ( $_POST[ 'user_' . $website . 'RightsType' ] ) ) - { - $_POST[ 'user_' . $website . 'RightsType' ] = 'DEF'; - } - $userWebsiteRights = ( $_POST[ 'user_' . $website . 'RightsType' ] === 'ALL' || ! isset ( $_POST[ 'user_' . $website . 'Rights' ] ) ) - ? '' - : implode ( ';' , $_POST[ 'user_' . $website . 'Rights' ] ); - $rights = $db -> query ( 'SELECT * FROM ' . TBL_RIGHTS . ' WHERE userId = "' . $_POST[ 'userId' ] . '" AND rightsPrefix = "' . $website . '";' ); - if ( $rights -> num_rows === 0 ) - { - $db -> query ( 'INSERT INTO ' . TBL_RIGHTS . ' SET userId = "' . $_POST[ 'userId' ] . '" , rightsPrefix = "' . $website . '" , rightsType = "' . $_POST[ 'user' . $website . 'RightsType' ] . '" , rights = "' . $userWebsiteRights . '";' ); - } - else - { - $db -> query ( 'UPDATE ' . TBL_RIGHTS . ' SET rightsType = "' . $_POST[ 'user_' . $website . 'RightsType' ] . '" , rights = "' . $userWebsiteRights . '" WHERE userId = "' . $_POST[ 'userId' ] . '" AND rightsPrefix = "' . $website . '";' ); - } - } - - fnc_writeLog ( '00000013' , array ( fnc_getUsernameById ( $_POST[ 'userId' ] ) ) , $_SESSION[ 'sess_userId' ] ); - header( 'Location:index.php?siteId=' . $_POST[ 'siteId' ] ); - die ( ); - } + { + $db->query('UPDATE ' . TBL_RIGHTS . ' SET rightsType = "' . $_POST['user_' . $website . 'RightsType'] . '" , rights = "' . $userWebsiteRights . '" WHERE userId = "' . $_POST['userId'] . '" AND rightsPrefix = "' . $website . '";'); + } } -?> \ No newline at end of file + fnc_writeLog('00000013', array(fnc_getUsernameById($_POST['userId'])), $_SESSION['sess_userId']); + header('Location:index.php?siteId=' . $_POST['siteId']); + die (); + } +} \ No newline at end of file diff --git a/.classes/generic/renderClass.php b/.classes/generic/renderClass.php index 8d82682..5d1aa9c 100644 --- a/.classes/generic/renderClass.php +++ b/.classes/generic/renderClass.php @@ -1,468 +1,464 @@ _pathTpl = $pathTpl; + } + + public function setConfig($config) + { + $this->_config = $config; + if (isset ($this->_config['portal']['website'])) { - private $_editable = false; - private $_tplElements = array ( ); - private $_data = array ( ); - private $_db = null; - private $_html = null; - - public $_renderSearch = array ( "\r\n" , "\n" , "\r" , "\t" ); - public $_renderReplace = ''; - - public $_pathTpl = PATH_PORTAL_TPL; - public $_config = array ( ); - public $_layout = ''; - public $_template = ''; - public $_langArray = array ( ); - public $_textsFromConfig = true; - public $_navpath = array ( ); - public $_postData = null; - public $_errors = null; - public $_tpl = null; - public $_subTemplate = ''; - public $_siteId = ''; - public $_dataParameter = array ( ); - public $_website = array ( ); - public $_webkey = 0; - public $_modrewrite = false; - public $_specialSite = false; - - public function setPathTpl ( $pathTpl ) - { - $this -> _pathTpl = $pathTpl; - } - - public function setConfig ( $config ) - { - $this -> _config = $config; - if ( isset ( $this -> _config[ 'portal' ][ 'website' ] ) ) - { - $this -> setWebsite ( $this -> _config[ 'portal' ][ 'website' ] ); - } - } - - public function setLayout ( $layout ) - { - $this -> _layout = $layout; - } - - public function setTemplate ( $template ) - { - $this -> _template = $template; - } - - public function setEditable ( $editable ) - { - $this -> _editable = $editable; - } - - public function setSubTemplate ( $subtemplate ) - { - $this -> _subTemplate = $subtemplate; - } - - public function setTplElements ( $tplElements ) - { - $this -> _tplElements = $tplElements; - } - - public function setSiteId ( $siteId ) - { - $this -> _siteId = $siteId; - } - - public function setDataParameter ( $dataParameter ) - { - $this -> _dataParameter = $dataParameter; - } - - public function setLang ( $langArray ) - { - $this -> _langArray = $langArray; - } - - public function setTextsFromConfig ( $fromConfig ) - { - $this -> _textsFromConfig = $fromConfig; - } - - public function setWebkey ( $_webkey ) - { - $this -> _webkey = $_webkey; - } - - private function setWebsite ( $website ) - { - $return_array = array ( ); - $tmp_array = array_flip ( $website[ 'navId' ] ); - foreach ( $tmp_array as $key => $value ) - { - foreach ( $website as $tmp_key => $tmp_value ) - { - $return_array[ $key ][ $tmp_key ] = $website[ $tmp_key ][ $value ]; - } - } - $this -> _website = $return_array; - } - - public function setData ( $data ) - { - $this -> _data = $data; - } - - public function setNavpath ( $navpath ) - { - $this -> _navpath = $navpath; - } - - public function setDb ( $db ) - { - $this -> _db = $db; - } - - public function setErrors ( $errors ) - { - $this -> _errors = $errors; - } - - public function setPostData ( $postData ) - { - $this -> _postData = $postData; - } - - public function setSpecialSite ( $specialSite ) - { - $this -> _specialSite = $specialSite; - } - - public function output ( ) - { - $html = $this -> readTemplate ( ); - echo $html -> saveHTML ( ); - } - - public function applySortRules ( $tpl , $node , $xpath ) - { - $elements = $xpath -> query ( ".//*[@data-sortable]" , $node ); - foreach ( $elements as $sortNode ) - { - $sortImg = $tpl -> createElement ( 'img' ); - $sortText = $sortNode -> firstChild; - $href = $this -> _postData; - if ( $sortNode -> getAttribute ( 'data-sortable' ) === $this -> _postData[ 'orderBy' ] ) - { - if ( $this -> _postData[ 'orderDir' ] === 'ASC' ) - { - $sortImg -> setAttributeNode ( new DOMAttr ( 'src' , PATH_IMG . 'icon-sortup.png' ) ); - $href[ 'orderDir' ] = 'DESC'; - } - else - { - $sortImg -> setAttributeNode ( new DOMAttr ( 'src' , PATH_IMG . 'icon-sortdown.png' ) ); - $href[ 'orderDir' ] = 'ASC'; - } - } - else - { - $sortImg -> setAttributeNode ( new DOMAttr ( 'src' , PATH_IMG . 'icon-sortwo.png' ) ); - $href[ 'orderBy' ] = $sortNode -> getAttribute ( 'data-sortable' ); - } - - $newLink = ''; - foreach ( $href as $key => $value ) - { - $newLink .= '&' . $key . '=' . $value; - } - - $sortNode -> setAttribute ( 'href' , $sortNode -> getAttribute ( 'href' ) . '?' . substr ( $newLink , 1 ) ); - $sortNode -> replaceChild ( $sortImg , $sortText ); - $sortNode -> appendChild ( new DOMText ( $sortText -> nodeValue ) ); - } - } - - public function applyFunction ( $name , $data , $tpl , $node , $prefix ) - { - switch ( $name ) - { - case 'createNavigationRights' : - $rights = renderFunctionsClass :: createNavigationRights ( $data , $tpl , $node ); - break; - default : - break; - } - } - - private function readTemplate ( ) - { - $html = file_get_contents ( $this -> _pathTpl . $this -> _layout . '/tpl_' . $this -> _template . '.php' ); - $html = str_replace ( $this -> _renderSearch , $this -> _renderReplace , $html ); - $html = str_replace ( array ( 'PHP_ROOT_PATH/' , 'PHP_SITE_PATH/' ) , array ( PATH_ROOT , PATH_SITE ) , $html ); - $tpl = new DOMDocument ( ); - $tpl -> preserveWhitespace = false; - $tpl -> formatOutput = false; - $tpl -> loadHTML ( $html ); - $this -> _tpl = $tpl; - - if ( $this -> _template === 'portal' ) - { - if ( ! isset ( $this -> _data [ 'keyvisual' ] ) ) - { - if ( file_exists ( PATH_IMG . $this -> _layout . '/keyvisual_' . $this -> _siteId . '.jpg' ) ) - { - $this -> _data[ 'keyvisual' ][ ] = array ( 'id' => $this -> _siteId , 'path' => PATH_IMG . $this -> _layout . '/' , 'navId' => '' , 'src' => 'keyvisual_' . $this -> _siteId . '.jpg' , 'title' => null ); - } - else - { - $this -> _data[ 'keyvisual' ][ ] = array ( 'id' => 0 , 'path' => PATH_IMG . $this -> _layout . '/' , 'navId' => '' , 'src' => 'keyvisual_0.jpg', 'title' => null ); - } - } + $this->setWebsite($this->_config['portal']['website']); + } + } - $this -> _data [ 'headline_main' ] = $this -> _langArray [ 'portal' ][ 'headline_main' ]; - $this -> _data [ 'headline_site' ] = $this -> _langArray [ 'headline' ][ $this -> _siteId ]; - } - - foreach ( $this -> _data as $id => $content ) - { - $tmp_content = null; - switch ( $id ) - { - case 'headline_main' : - $tmp_content = $this -> _tpl -> createDocumentFragment ( ); - $tmp_content -> appendChild ( new DOMText ( $content ) ); - break; - - case 'headline_site' : - $tmp_content = $this -> _tpl -> createDocumentFragment ( ); - - foreach ( $content as $arrHeadline ) - { - $headline = $this -> _tpl -> createElement ( 'h1' ); - $headline -> setAttributeNode ( new DOMAttr ( 'class' , $arrHeadline[ 1 ] ) ); - $headline -> appendChild ( new DOMText ( $arrHeadline[ 0 ] ) ); - $tmp_content -> appendChild ( $headline ); - } - break; - - case 'sub_content' : - $tmp_content = renderPopupClass :: createPopup ( $content ); - break; - - case 'content' : - case 'login' : - $tmp_content = ( is_null ( $content[ 'siteContents' ] ) ) - ? null - : $this -> getPageContents ( $content[ 'siteContents' ] ); - break; - - case 'keyvisual' : - $tmp_content = $this -> _tpl -> createDocumentFragment( ); - foreach ( $content as $img_data ) - { - $tmp_content -> appendChild ( renderImageClass :: createImage ( $img_data , false , $id ) ); - } - break; - - case 'navi_main' : - case 'navi_special' : - case 'navi_sub' : - case 'navi_last' : - $tmp_content = renderNavigationClass :: createNavigation ( $content ); - break; - - case 'spielbericht_gespielt' : - case 'spielbericht_abgesagt' : - case 'spielbericht_pokal' : - case 'spielbericht_spielfrei' : - case 'uebersicht' : - $tmp_content = renderSpecialContentClass :: createSpecialContent ( $id , $content , ( ( $id === 'uebersicht' ) ? 'spielbericht_gespielt' : $id ) ); - break; - - case 'widget' : - $tmp_content = renderWidgetClass :: createWidget ( $content ); - break; - - default : - break; - } - - if ( ! is_null ( $tmp_content ) ) - { - if ( in_array ( $id , array ( 'uebersicht' , 'spielbericht' , 'spielbericht_gespielt' , 'spielbericht_abgesagt' , 'spielbericht_pokal' , 'spielbericht_spielfrei' , 'widget' ) ) ) - { - $node = $tpl -> getElementById ( 'content' ); - } - else if ( in_array ( $id , array ( 'keyvisual' ) ) ) - { - $node = $tpl -> getElementById ( $id ); - $node -> setAttributeNode ( new DOMAttr ( 'data-editable' , $id ) ); - $node -> setAttributeNode ( new DOMAttr ( 'id' , $id . '_' . $content[ 0 ][ 'id' ] ) ); - } - else - { - $node = $tpl -> getElementById ( $id ); - } - $node -> appendChild ( $tmp_content ); - } - } - - if ( $this -> _editable === true ) - { - /* Editor Layer einbinden */ - $html = file_get_contents ( $this -> _pathTpl . $this -> _layout . '/tpl_editor.php' ); - $html = str_replace ( $this -> _renderSearch , $this -> _renderReplace , $html ); - $html = str_replace ( array ( 'PHP_ROOT_PATH/' , 'PHP_SITE_PATH' ) , array ( PATH_ROOT , PATH_SITE ) , $html ); - $editor = new DOMDocument ( ); - $editor -> preserveWhitespace = false; - $editor -> formatOutput = false; - $editor -> loadHTML ( $html ); - $eCont = $editor -> getElementById ( 'editor_layer' ); - $new_node = $tpl -> importNode ( $eCont , true ); - $body = $tpl -> getElementsByTagName( 'body' ) -> item( 0 ); - $body -> insertBefore ( $new_node , $body -> firstChild ); - - /* Editor Elemente einbinden - Nur für Standardseiten */ - if ( ! $this -> _specialSite ) - { - $html = file_get_contents ( $this -> _pathTpl . $this -> _layout . '/tpl_elements.php' ); - $html = str_replace ( $this -> _renderSearch , $this -> _renderReplace , $html ); - $html = str_replace ( array ( 'PHP_ROOT_PATH/' , 'PHP_SITE_PATH' ) , array ( PATH_ROOT , PATH_SITE ) , $html ); - $elements = new DOMDocument ( ); - $elements -> preserveWhitespace = false; - $elements -> formatOutput = false; - $elements -> loadHTML ( $html ); - $eCont = $elements -> getElementById ( 'editor_elements' ); - $eCont = $tpl -> importNode ( $eCont , true ); - $elemCont = $tpl -> getElementById ( 'element_content' ); - foreach ( $this -> _website[ $this -> _webkey ][ 'contentElems' ] as $subTpl ) - { - $node = renderSpecialContentClass :: createSpecialContent ( $subTpl , array ( 0 => array ( 'content' => 'text' ) ) , null ); - $node -> setAttribute( 'class' , $node -> getAttribute( 'class' ) . ' elem_button' ); - $node -> setAttributeNode ( new DOMAttr ( 'data-editable' , $subTpl ) ); - $new_node = $tpl -> importNode ( $node , true ); - $elemCont -> appendChild ( $new_node ); - } - $body = $tpl -> getElementsByTagName( 'body' ) -> item( 0 ); - $body -> insertBefore ( $eCont , $body -> firstChild ); - } - - $head = $tpl -> getElementsByTagName( 'head' ) -> item( 0 ); - - /* Editor CSS ( lokal ) einbinden */ - $css = $this -> _tpl -> createElement ( 'link' ); - $css -> setAttributeNode ( new DOMAttr ( 'href' , PATH_CSS . $this -> _layout . '_editor.css' ) ); - $css -> setAttributeNode ( new DOMAttr ( 'type' , 'text/css' ) ); - $css -> setAttributeNode ( new DOMAttr ( 'rel' , 'stylesheet' ) ); - $head -> appendChild ( $css ); - - /* Editor JS - Variablen einbinden */ - $data = 'var userId = "' . $_SESSION[ 'sess_userId' ] . '";' . "\n"; - $data .= 'var sessLang = "' . $_SESSION[ 'sess_loginLang' ] . '";' . "\n"; - $data .= 'var navigationId = "' . $this -> _siteId . '";' . "\n"; - $data .= 'var pathMed = "' . PATH_MED . '";' . "\n"; - $data .= 'var stdKeyvisual = "' . PATH_MED . $this -> _website[ $this -> _webkey ][ 'prefix' ] . '/sample_keyvis.jpg";' . "\n"; - $data .= 'var stdImage = "' . PATH_MED . $this -> _website[ $this -> _webkey ][ 'prefix' ] . '/sample_image.jpg";' . "\n"; - - foreach ( $this -> _website[ $this -> _webkey ] as $var => $value ) - { - if ( is_array( $value ) ) - { - $data .= 'var ' . $var . ' = ' . json_encode ( $value ) . ';' . "\n"; - continue; - } - $data .= 'var ' . $var . ' = "' . $value . '";' . "\n"; - } - - $data .= ( $this -> _specialSite ) - ? 'var specialSite = true;' - : 'var specialSite = false;'; - - $js = $this -> _tpl -> createElement ( 'script' ); - $js -> setAttributeNode ( new DOMAttr ( 'type' , 'text/javascript' ) ); - $js -> appendChild ( new DOMCdataSection ( utf8_encode ( $data ) ) ); - $head -> appendChild ( $js ); - - /* Editor Sprachdatei ( remote ) einbinden */ - $js = $this -> _tpl -> createElement ( 'script' ); - $js -> setAttributeNode ( new DOMAttr ( 'type' , 'text/javascript' ) ); - $js -> setAttributeNode ( new DOMAttr ( 'src' , $this -> _website[ $this -> _webkey ][ 'editorUrl' ] . 'v' . $this -> _website[ $this -> _webkey ][ 'editorVersion' ] . '/js/lang.js.php?lang=' . $_SESSION[ 'sess_loginLang' ] ) ); - $head -> appendChild ( $js ); - - /* Editor JS ( remote ) einbinden */ - $js = $this -> _tpl -> createElement ( 'script' ); - $js -> setAttributeNode ( new DOMAttr ( 'type' , 'text/javascript' ) ); - $js -> setAttributeNode ( new DOMAttr ( 'src' , $this -> _website[ $this -> _webkey ][ 'editorUrl' ] . 'v' . $this -> _website[ $this -> _webkey ][ 'editorVersion' ] . '/js/editor.js' ) ); - $head -> appendChild ( $js ); - - $js = $this -> _tpl -> createElement ( 'script' ); - $js -> setAttributeNode ( new DOMAttr ( 'type' , 'text/javascript' ) ); - $js -> setAttributeNode ( new DOMAttr ( 'src' , $this -> _website[ $this -> _webkey ][ 'editorUrl' ] . 'v' . $this -> _website[ $this -> _webkey ][ 'editorVersion' ] . '/js/ckeditor/ckeditor.js' ) ); - $head -> appendChild ( $js ); - - } - - /* Nicht benötigte Elemente entfernen */ - foreach ( $this -> _tplElements as $element ) - { - if ( ! isset ( $this -> _data [ $element ] ) ) - { - $oldNode = $tpl -> getElementById ( $element ); - $oldNode -> parentNode -> removeChild ( $oldNode ); - } - } - - return $tpl; - } - - private function getPageContents ( $content ) - { - $arrContent = explode ( ';' , $content ); - - $tbl_prefix = ( $this -> _webkey !== 0 ) - ? $this -> _website[ $this -> _webkey ][ 'prefix' ] - : 'portal'; + private function setWebsite($website) + { + $return_array = array(); + $tmp_array = array_flip($website['navId']); + foreach ($tmp_array as $key => $value) + { + foreach ($website as $tmp_key => $tmp_value) + { + $return_array[$key][$tmp_key] = $website[$tmp_key][$value]; + } + } + $this->_website = $return_array; + } - $new_node = $this -> _tpl -> createDocumentFragment ( ); - - foreach ( $arrContent as $singleContent ) - { - $tmp_content = explode ( '_' , $singleContent ); - $tmp_result = $this -> _db -> query ( 'SELECT * FROM ' . $tbl_prefix . '_content_' . $tmp_content [ 0 ] . ' WHERE id = "' . $tmp_content [ 1 ] . '";' ); - $tmp_data = $tmp_result -> fetch_assoc ( ); - - switch ( $tmp_content[ 0 ] ) - { - case 'form' : - $new_node = renderFormClass :: createForm ( $tmp_data ); - break; - - default : - $node = renderSpecialContentClass :: createSpecialContent ( $tmp_content[ 0 ] , array ( $tmp_data ) , $tmp_content[ 0 ] ); - - if ( $this -> _editable ) - { - $node -> setAttributeNode ( new DOMAttr ( 'data-editable' , $tmp_content[ 0 ] ) ); - $node -> setAttributeNode ( new DOMAttr ( 'id' , 'content_' . $tmp_content[ 0 ] . '_' . $tmp_content[ 1 ] ) ); - } - - $new_node -> appendChild ( $node ); - break; - - } - } - - return $new_node; + public function setLayout($layout) + { + $this->_layout = $layout; + } + + public function setTemplate($template) + { + $this->_template = $template; + } + + public function setEditable($editable) + { + $this->_editable = $editable; + } + + public function setSubTemplate($subtemplate) + { + $this->_subTemplate = $subtemplate; + } + + public function setTplElements($tplElements) + { + $this->_tplElements = $tplElements; + } + + public function setSiteId($siteId) + { + $this->_siteId = $siteId; + } + + public function setDataParameter($dataParameter) + { + $this->_dataParameter = $dataParameter; + } + + public function setLang($langArray) + { + $this->_langArray = $langArray; + } + + public function setTextsFromConfig($fromConfig) + { + $this->_textsFromConfig = $fromConfig; + } + + public function setWebkey($_webkey) + { + $this->_webkey = $_webkey; + } + + public function setData($data) + { + $this->_data = $data; + } + + public function setNavpath($navpath) + { + $this->_navpath = $navpath; + } + + public function setDb($db) + { + $this->_db = $db; + } + + public function setErrors($errors) + { + $this->_errors = $errors; + } + + public function setPostData($postData) + { + $this->_postData = $postData; + } + + public function setSpecialSite($specialSite) + { + $this->_specialSite = $specialSite; + } + + public function output() + { + $html = $this->readTemplate(); + echo $html->saveHTML(); + } + + private function readTemplate() + { + $html = file_get_contents($this->_pathTpl . $this->_layout . '/tpl_' . $this->_template . '.php'); + $html = str_replace($this->_renderSearch, $this->_renderReplace, $html); + $html = str_replace(array('PHP_ROOT_PATH/', 'PHP_SITE_PATH/'), array(PATH_ROOT, PATH_SITE), $html); + $tpl = new DOMDocument (); + $tpl->preserveWhitespace = false; + $tpl->formatOutput = false; + $tpl->loadHTML($html); + $this->_tpl = $tpl; + + if ($this->_template === 'portal') + { + if (!isset ($this->_data ['keyvisual'])) + { + if (file_exists(PATH_IMG . $this->_layout . '/keyvisual_' . $this->_siteId . '.jpg')) + { + $this->_data['keyvisual'][] = array('id' => $this->_siteId, 'path' => PATH_IMG . $this->_layout . '/', 'navId' => '', 'src' => 'keyvisual_' . $this->_siteId . '.jpg', 'title' => null); } + else + { + $this->_data['keyvisual'][] = array('id' => 0, 'path' => PATH_IMG . $this->_layout . '/', 'navId' => '', 'src' => 'keyvisual_0.jpg', 'title' => null); + } + } + + $this->_data ['headline_main'] = $this->_langArray ['portal']['headline_main']; + $this->_data ['headline_site'] = $this->_langArray ['headline'][$this->_siteId]; } -?> \ No newline at end of file + foreach ($this->_data as $id => $content) + { + $tmp_content = null; + switch ($id) + { + case 'headline_main' : + $tmp_content = $this->_tpl->createDocumentFragment(); + $tmp_content->appendChild(new DOMText ($content)); + break; + + case 'headline_site' : + $tmp_content = $this->_tpl->createDocumentFragment(); + + foreach ($content as $arrHeadline) + { + $headline = $this->_tpl->createElement('h1'); + $headline->setAttributeNode(new DOMAttr ('class', $arrHeadline[1])); + $headline->appendChild(new DOMText ($arrHeadline[0])); + $tmp_content->appendChild($headline); + } + break; + + case 'sub_content' : + $tmp_content = renderPopupClass:: createPopup($content); + break; + + case 'content' : + case 'login' : + $tmp_content = (is_null($content['siteContents'])) + ? null + : $this->getPageContents($content['siteContents']); + break; + + case 'keyvisual' : + $tmp_content = $this->_tpl->createDocumentFragment(); + foreach ($content as $img_data) + { + $tmp_content->appendChild(renderImageClass:: createImage($img_data, false, $id)); + } + break; + + case 'navi_main' : + case 'navi_special' : + case 'navi_sub' : + case 'navi_last' : + $tmp_content = renderNavigationClass:: createNavigation($content); + break; + + case 'spielbericht_gespielt' : + case 'spielbericht_abgesagt' : + case 'spielbericht_pokal' : + case 'spielbericht_spielfrei' : + case 'uebersicht' : + $tmp_content = renderSpecialContentClass:: createSpecialContent($id, $content, (($id === 'uebersicht') ? 'spielbericht_gespielt' : $id)); + break; + + case 'widget' : + $tmp_content = renderWidgetClass:: createWidget($content); + break; + + default : + break; + } + + if (!is_null($tmp_content)) + { + if (in_array($id, array('uebersicht', 'spielbericht', 'spielbericht_gespielt', 'spielbericht_abgesagt', 'spielbericht_pokal', 'spielbericht_spielfrei', 'widget'))) + { + $node = $tpl->getElementById('content'); + } + else if (in_array($id, array('keyvisual'))) + { + $node = $tpl->getElementById($id); + $node->setAttributeNode(new DOMAttr ('data-editable', $id)); + $node->setAttributeNode(new DOMAttr ('id', $id . '_' . $content[0]['id'])); + } + else + { + $node = $tpl->getElementById($id); + } + $node->appendChild($tmp_content); + } + } + + if ($this->_editable === true) + { + /* Editor Layer einbinden */ + $html = file_get_contents($this->_pathTpl . $this->_layout . '/tpl_editor.php'); + $html = str_replace($this->_renderSearch, $this->_renderReplace, $html); + $html = str_replace(array('PHP_ROOT_PATH/', 'PHP_SITE_PATH'), array(PATH_ROOT, PATH_SITE), $html); + $editor = new DOMDocument (); + $editor->preserveWhitespace = false; + $editor->formatOutput = false; + $editor->loadHTML($html); + $eCont = $editor->getElementById('editor_layer'); + $new_node = $tpl->importNode($eCont, true); + $body = $tpl->getElementsByTagName('body')->item(0); + $body->insertBefore($new_node, $body->firstChild); + + /* Editor Elemente einbinden - Nur für Standardseiten */ + if (!$this->_specialSite) + { + $html = file_get_contents($this->_pathTpl . $this->_layout . '/tpl_elements.php'); + $html = str_replace($this->_renderSearch, $this->_renderReplace, $html); + $html = str_replace(array('PHP_ROOT_PATH/', 'PHP_SITE_PATH'), array(PATH_ROOT, PATH_SITE), $html); + $elements = new DOMDocument (); + $elements->preserveWhitespace = false; + $elements->formatOutput = false; + $elements->loadHTML($html); + $eCont = $elements->getElementById('editor_elements'); + $eCont = $tpl->importNode($eCont, true); + $elemCont = $tpl->getElementById('element_content'); + foreach ($this->_website[$this->_webkey]['contentElems'] as $subTpl) + { + $node = renderSpecialContentClass:: createSpecialContent($subTpl, array(0 => array('content' => 'text')), null); + $node->setAttribute('class', $node->getAttribute('class') . ' elem_button'); + $node->setAttributeNode(new DOMAttr ('data-editable', $subTpl)); + $new_node = $tpl->importNode($node, true); + $elemCont->appendChild($new_node); + } + $body = $tpl->getElementsByTagName('body')->item(0); + $body->insertBefore($eCont, $body->firstChild); + } + + $head = $tpl->getElementsByTagName('head')->item(0); + + /* Editor CSS ( lokal ) einbinden */ + $css = $this->_tpl->createElement('link'); + $css->setAttributeNode(new DOMAttr ('href', PATH_CSS . $this->_layout . '_editor.css')); + $css->setAttributeNode(new DOMAttr ('type', 'text/css')); + $css->setAttributeNode(new DOMAttr ('rel', 'stylesheet')); + $head->appendChild($css); + + /* Editor JS - Variablen einbinden */ + $data = 'var userId = "' . $_SESSION['sess_userId'] . '";' . "\n"; + $data .= 'var sessLang = "' . $_SESSION['sess_loginLang'] . '";' . "\n"; + $data .= 'var navigationId = "' . $this->_siteId . '";' . "\n"; + $data .= 'var pathMed = "' . PATH_MED . '";' . "\n"; + $data .= 'var stdKeyvisual = "' . PATH_MED . $this->_website[$this->_webkey]['prefix'] . '/sample_keyvis.jpg";' . "\n"; + $data .= 'var stdImage = "' . PATH_MED . $this->_website[$this->_webkey]['prefix'] . '/sample_image.jpg";' . "\n"; + + foreach ($this->_website[$this->_webkey] as $var => $value) + { + if (is_array($value)) + { + $data .= 'var ' . $var . ' = ' . json_encode($value) . ';' . "\n"; + continue; + } + $data .= 'var ' . $var . ' = "' . $value . '";' . "\n"; + } + + $data .= ($this->_specialSite) + ? 'var specialSite = true;' + : 'var specialSite = false;'; + + $js = $this->_tpl->createElement('script'); + $js->setAttributeNode(new DOMAttr ('type', 'text/javascript')); + $js->appendChild(new DOMCdataSection (utf8_encode($data))); + $head->appendChild($js); + + /* Editor Sprachdatei ( remote ) einbinden */ + $js = $this->_tpl->createElement('script'); + $js->setAttributeNode(new DOMAttr ('type', 'text/javascript')); + $js->setAttributeNode(new DOMAttr ('src', $this->_website[$this->_webkey]['editorUrl'] . '' . $this->_website[$this->_webkey]['editorVersion'] . '/js/lang.js.php?lang=' . $_SESSION['sess_loginLang'])); + $head->appendChild($js); + + /* Editor JS ( remote ) einbinden */ + $js = $this->_tpl->createElement('script'); + $js->setAttributeNode(new DOMAttr ('type', 'text/javascript')); + $js->setAttributeNode(new DOMAttr ('src', $this->_website[$this->_webkey]['editorUrl'] . '' . $this->_website[$this->_webkey]['editorVersion'] . '/js/editor.js')); + $head->appendChild($js); + + $js = $this->_tpl->createElement('script'); + $js->setAttributeNode(new DOMAttr ('type', 'text/javascript')); + $js->setAttributeNode(new DOMAttr ('src', $this->_website[$this->_webkey]['editorUrl'] . '' . $this->_website[$this->_webkey]['editorVersion'] . '/js/ckeditor/ckeditor.js')); + $head->appendChild($js); + + } + + /* Nicht benötigte Elemente entfernen */ + foreach ($this->_tplElements as $element) + { + if (!isset ($this->_data [$element])) + { + $oldNode = $tpl->getElementById($element); + $oldNode->parentNode->removeChild($oldNode); + } + } + + return $tpl; + } + + private function getPageContents($content) + { + $arrContent = explode(';', $content); + + $tbl_prefix = ($this->_webkey !== 0) + ? $this->_website[$this->_webkey]['prefix'] + : 'portal'; + + $new_node = $this->_tpl->createDocumentFragment(); + + foreach ($arrContent as $singleContent) + { + $tmp_content = explode('_', $singleContent); + $tmp_result = $this->_db->query('SELECT * FROM ' . $tbl_prefix . '_content_' . $tmp_content [0] . ' WHERE id = "' . $tmp_content [1] . '";'); + $tmp_data = $tmp_result->fetch_assoc(); + + switch ($tmp_content[0]) + { + case 'form' : + $new_node = renderFormClass:: createForm($tmp_data); + break; + + default : + $node = renderSpecialContentClass:: createSpecialContent($tmp_content[0], array($tmp_data), $tmp_content[0]); + + if ($this->_editable) + { + $node->setAttributeNode(new DOMAttr ('data-editable', $tmp_content[0])); + $node->setAttributeNode(new DOMAttr ('id', 'content_' . $tmp_content[0] . '_' . $tmp_content[1])); + } + + $new_node->appendChild($node); + break; + + } + } + + return $new_node; + } + + public function applySortRules($tpl, $node, $xpath) + { + $elements = $xpath->query(".//*[@data-sortable]", $node); + foreach ($elements as $sortNode) + { + $sortImg = $tpl->createElement('img'); + $sortText = $sortNode->firstChild; + $href = $this->_postData; + if ($sortNode->getAttribute('data-sortable') === $this->_postData['orderBy']) + { + if ($this->_postData['orderDir'] === 'ASC') + { + $sortImg->setAttributeNode(new DOMAttr ('src', PATH_IMG . 'icon-sortup.png')); + $href['orderDir'] = 'DESC'; + } + else + { + $sortImg->setAttributeNode(new DOMAttr ('src', PATH_IMG . 'icon-sortdown.png')); + $href['orderDir'] = 'ASC'; + } + } + else + { + $sortImg->setAttributeNode(new DOMAttr ('src', PATH_IMG . 'icon-sortwo.png')); + $href['orderBy'] = $sortNode->getAttribute('data-sortable'); + } + + $newLink = ''; + foreach ($href as $key => $value) + { + $newLink .= '&' . $key . '=' . $value; + } + + $sortNode->setAttribute('href', $sortNode->getAttribute('href') . '?' . substr($newLink, 1)); + $sortNode->replaceChild($sortImg, $sortText); + $sortNode->appendChild(new DOMText ($sortText->nodeValue)); + } + } + + public function applyFunction($name, $data, $tpl, $node, $prefix) + { + switch ($name) + { + case 'createNavigationRights' : + $rights = renderFunctionsClass::createNavigationRights($data, $tpl, $node); + break; + default : + break; + } + } +} \ No newline at end of file diff --git a/.classes/generic/renderClass_abstract.php b/.classes/generic/renderClass_abstract.php index 2bb6356..70e50aa 100644 --- a/.classes/generic/renderClass_abstract.php +++ b/.classes/generic/renderClass_abstract.php @@ -1,25 +1,23 @@ \ No newline at end of file + /** + * Konstruktor + */ + public function __construct() + { + + } + + /** + * Destruktor + */ + public function __destruct() + { + + } + +} \ No newline at end of file diff --git a/.classes/generic/renderFormClass.php b/.classes/generic/renderFormClass.php index ed8adc3..4193cb7 100644 --- a/.classes/generic/renderFormClass.php +++ b/.classes/generic/renderFormClass.php @@ -1,107 +1,105 @@ _tpl->createDocumentFragment(); + $node = $this->_tpl->createElement('form'); + $node->setAttributeNode(new DOMAttr ('action', $formData['action'])); + $node->setAttributeNode(new DOMAttr ('method', $formData['method'])); + $node->setAttributeNode(new DOMAttr ('class', $formData['class'])); + + if (!is_null($this->_errors)) { - private $_formData = array ( ); - - public function createForm ( $formData ) - { - $arrFields = explode ( ';' , $formData[ 'content' ] ); - $fieldCounter = 0; - - $new_node = $this -> _tpl -> createDocumentFragment ( ); - $node = $this -> _tpl -> createElement ( 'form' ); - $node -> setAttributeNode ( new DOMAttr ( 'action' , $formData[ 'action' ] ) ); - $node -> setAttributeNode ( new DOMAttr ( 'method' , $formData[ 'method' ] ) ); - $node -> setAttributeNode ( new DOMAttr ( 'class' , $formData[ 'class' ] ) ); + foreach ($this->_errors as $error) + { + $errorNode = $this->_tpl->createElement('p'); + $errorNode->setAttributeNode(new DOMAttr ('class', 'error')); + $errorNode->appendChild(new DOMText ($this->_langArray['error'][$error])); + $node->appendChild($errorNode); + } - if ( ! is_null ( $this -> _errors ) ) - { - foreach ( $this -> _errors as $error ) - { - $errorNode = $this -> _tpl -> createElement ( 'p' ); - $errorNode -> setAttributeNode ( new DOMAttr ( 'class' , 'error' ) ); - $errorNode -> appendChild ( new DOMText ( $this -> _langArray[ 'error' ][ $error ] ) ); - $node -> appendChild ( $errorNode ); - } - - } - - foreach ( $arrFields as $singleField ) - { - $arrData = explode ( ':' , $singleField ); - $arrDefinition = explode ( '_' , $arrData[ 0 ] ); - $arrValue = explode ( '_' , $arrData[ 1 ] ); - - /* Inputs */ - if ( $arrDefinition[ 0 ] === 'input' && ( $arrDefinition[ 1 ] !== 'hidden' && $arrDefinition[ 1 ] !== 'submit' ) ) - { - $tmp_div = $this -> _tpl -> createElement ( 'div' ); - ++$fieldCounter; - if ( $fieldCounter % 2 === 1 ) - { - $tmp_div -> setAttributeNode ( new DOMAttr ( 'class' , 'left' ) ); - } - } - - $tmp_node = $this -> _tpl -> createElement ( $arrDefinition[ 0 ] ); - - if ( $arrDefinition[ 0 ] === 'input' ) - { - $tmp_node -> setAttributeNode ( new DOMAttr ( 'type' , $arrDefinition[ 1 ] ) ); - $tmp_node -> setAttributeNode ( new DOMAttr ( 'id' , $arrValue[ 0 ] ) ); - $tmp_node -> setAttributeNode ( new DomAttr ( 'name' , $arrValue[ 0 ] ) ); - $tmp_node -> setAttributeNode ( new DomAttr ( 'autocomplete' , 'off' ) ); - - if ( $arrDefinition[ 1 ] !== 'hidden' && $arrDefinition[ 1 ] !== 'submit' && isset ( $this -> _postData[ $arrValue[ 0 ] ] ) ) - { - $tmp_node -> setAttributeNode ( new DomAttr ( 'value' , $this -> _postData[ $arrValue[ 0 ] ] ) ); - } - } - - if ( $arrDefinition[ 1 ] === 'submit' && isset ( $this -> _langArray[ 'form' ][ $arrValue[ 0 ] ] ) ) - { - $tmp_node -> setAttributeNode ( new DOMAttr ( 'value' , $this -> _langArray[ 'form' ][ $arrValue[ 0 ] ] ) ); - } - elseif ( isset ( $arrValue[ 1 ] ) ) - { - $tmp_node -> setAttributeNode ( new DOMAttr ( 'value' , $arrValue[ 1 ] ) ); - } - elseif ( isset ( $this -> _langArray[ 'formText' ][ $arrValue[ 0 ] ] ) ) - { - $tmp_node -> appendChild ( new DOMText ( $this -> _langArray[ 'formText' ][ $arrValue[ 0 ] ] ) ); - } - - if ( $arrDefinition[ 0 ] === 'input'&& ( $arrDefinition[ 1 ] !== 'hidden' && $arrDefinition[ 1 ] !== 'submit' ) ) - { - $tmp_div -> appendChild ( $tmp_node ); - - $tmp_node = $this -> _tpl -> createElement ( 'label' ); - $tmp_node -> setAttributeNode ( new DOMAttr ( 'for' , $arrValue[ 0 ] ) ); - $tmp_node -> appendChild ( new DOMText ( $this -> _langArray[ 'form' ][ $arrValue[ 0 ] ] ) ); - $tmp_div -> appendChild ( $tmp_node ); - - $node -> appendChild ( $tmp_div ); - if ( $fieldCounter % 2 === 0 ) - { - $tmp_br = $this -> _tpl -> createElement ( 'br' ); - $tmp_br -> setAttributeNode ( new DOMAttr ( 'class' , 'fix' ) ); - $node -> appendChild ( $tmp_br ); - } - - } - else - { - $node -> appendChild ( $tmp_node ); - } - - } - $new_node -> appendChild ( $node ); - - return $new_node; - } - - } -?> \ No newline at end of file + foreach ($arrFields as $singleField) + { + $arrData = explode(':', $singleField); + $arrDefinition = explode('_', $arrData[0]); + $arrValue = explode('_', $arrData[1]); + + /* Inputs */ + if ($arrDefinition[0] === 'input' && ($arrDefinition[1] !== 'hidden' && $arrDefinition[1] !== 'submit')) + { + $tmp_div = $this->_tpl->createElement('div'); + ++$fieldCounter; + if ($fieldCounter % 2 === 1) + { + $tmp_div->setAttributeNode(new DOMAttr ('class', 'left')); + } + } + + $tmp_node = $this->_tpl->createElement($arrDefinition[0]); + + if ($arrDefinition[0] === 'input') + { + $tmp_node->setAttributeNode(new DOMAttr ('type', $arrDefinition[1])); + $tmp_node->setAttributeNode(new DOMAttr ('id', $arrValue[0])); + $tmp_node->setAttributeNode(new DomAttr ('name', $arrValue[0])); + $tmp_node->setAttributeNode(new DomAttr ('autocomplete', 'off')); + + if ($arrDefinition[1] !== 'hidden' && $arrDefinition[1] !== 'submit' && isset ($this->_postData[$arrValue[0]])) + { + $tmp_node->setAttributeNode(new DomAttr ('value', $this->_postData[$arrValue[0]])); + } + } + + if ($arrDefinition[1] === 'submit' && isset ($this->_langArray['form'][$arrValue[0]])) + { + $tmp_node->setAttributeNode(new DOMAttr ('value', $this->_langArray['form'][$arrValue[0]])); + } + elseif (isset ($arrValue[1])) + { + $tmp_node->setAttributeNode(new DOMAttr ('value', $arrValue[1])); + } + elseif (isset ($this->_langArray['formText'][$arrValue[0]])) + { + $tmp_node->appendChild(new DOMText ($this->_langArray['formText'][$arrValue[0]])); + } + + if ($arrDefinition[0] === 'input' && ($arrDefinition[1] !== 'hidden' && $arrDefinition[1] !== 'submit')) + { + $tmp_div->appendChild($tmp_node); + + $tmp_node = $this->_tpl->createElement('label'); + $tmp_node->setAttributeNode(new DOMAttr ('for', $arrValue[0])); + $tmp_node->appendChild(new DOMText ($this->_langArray['form'][$arrValue[0]])); + $tmp_div->appendChild($tmp_node); + + $node->appendChild($tmp_div); + if ($fieldCounter % 2 === 0) + { + $tmp_br = $this->_tpl->createElement('br'); + $tmp_br->setAttributeNode(new DOMAttr ('class', 'fix')); + $node->appendChild($tmp_br); + } + + } + else + { + $node->appendChild($tmp_node); + } + + } + $new_node->appendChild($node); + + return $new_node; + } + + +} \ No newline at end of file diff --git a/.classes/generic/renderFunctionsClass.php b/.classes/generic/renderFunctionsClass.php index b5a9902..159dc2a 100644 --- a/.classes/generic/renderFunctionsClass.php +++ b/.classes/generic/renderFunctionsClass.php @@ -1,89 +1,87 @@ _navData = $navData; - $this -> _subtpl = $tpl; - $this -> _node = $node; - $this -> _prefix = renderFunctionsClass :: getNavigationPrefix ( ); - - $node = renderFunctionsClass :: getNavigationNode ( 0 ); - if ( $node !== false ) - { - $this -> _node -> appendChild ( $node ); - } +class renderFunctionsClass extends renderClass_abstract +{ + private $_navData = array(); + private $_subtpl = null; + private $_node = null; + private $_websiteIds = array(); + private $_prefix = ''; - return $this -> _node; - } - - private function getNavigationPrefix ( ) - { - foreach ( $this -> _navData[ 0 ] as $tmp_data ) - { - foreach ( $tmp_data as $key => $value ) - { - if ( strpos ( $key , '_' ) !== false ) - { - return substr ( $key , 0 , strpos ( $key , '_' ) + 1 ); - } - else - { - return ''; - } - } - } - } - - private function getNavigationNode ( $navStart ) - { - if ( ! isset ( $this -> _navData[ $navStart ] ) || count ( $this -> _navData [ $navStart ] ) == 0 ) - { - return false; - } - $newNode = $this -> _subtpl -> createElement ( 'ul' ); - foreach ( $this -> _navData [ $navStart ] AS $key => $value ) - { - $newLi = $this -> _subtpl -> createElement ( 'li' ); - - $input = $this -> _subtpl -> createElement ( 'input' ); - $input -> setAttributeNode ( new DOMAttr ( 'type' , 'checkbox' ) ); - $input -> setAttributeNode ( new DOMAttr ( 'name' , str_replace ( '_outer' , '' , $this -> _node -> getAttribute ( 'id' ) . '[ ]' ) ) ); - $input -> setAttributeNode ( new DOMAttr ( 'value' , $this -> _prefix . $value[ $this -> _prefix . 'navId' ] ) ); - $input -> setAttributeNode ( new DOMAttr ( 'id' , $this -> _prefix . $value[ $this -> _prefix . 'navId' ] ) ); - if ( $this -> _prefix === 'portal_' && array_key_exists ( $value[ $this -> _prefix . 'navId' ] , $this -> _website ) ) - { - $input -> setAttributeNode ( new DOMAttr ( 'data-referer' , $this -> _website[ $value[ $this -> _prefix . 'navId' ] ][ 'prefix' ] . 'Rights' ) ); - } - $label = $this -> _subtpl -> createElement ( 'label' ); - $label -> setAttributeNode ( new DOMAttr ( 'for' , $this -> _prefix . $value[ $this -> _prefix . 'navId' ] ) ); - $label -> appendChild ( new DOMText ( $value[ $this -> _prefix . 'navName' ] ) ); - - $newLi -> appendChild ( $input ); - $newLi -> appendChild ( $label ); - - $sub_node = renderFunctionsClass :: getNavigationNode ( $value [ $this -> _prefix . 'navId' ] ); - if ( $sub_node !== false ) - { - $newLi -> setAttributeNode ( new DOMAttr ( 'class' , 'hasChild' ) ); - $newLi -> appendChild ( $sub_node ); - } - $newNode -> appendChild ( $newLi ); - - } - - unset ( $this -> _navData [ $navStart ] ); - - return $newNode; - - } + public function createNavigationRights($navData, $tpl, $node) + { + $this->_navData = $navData; + $this->_subtpl = $tpl; + $this->_node = $node; + $this->_prefix = renderFunctionsClass::getNavigationPrefix(); + + $node = renderFunctionsClass::getNavigationNode(0); + if ($node !== false) + { + $this->_node->appendChild($node); } -?> \ No newline at end of file + return $this->_node; + } + + private function getNavigationPrefix() + { + foreach ($this->_navData[0] as $tmp_data) + { + foreach ($tmp_data as $key => $value) + { + if (strpos($key, '_') !== false) + { + return substr($key, 0, strpos($key, '_') + 1); + } + else + { + return ''; + } + } + } + } + + private function getNavigationNode($navStart) + { + if (!isset ($this->_navData[$navStart]) || count($this->_navData [$navStart]) == 0) + { + return false; + } + $newNode = $this->_subtpl->createElement('ul'); + foreach ($this->_navData [$navStart] AS $key => $value) + { + $newLi = $this->_subtpl->createElement('li'); + + $input = $this->_subtpl->createElement('input'); + $input->setAttributeNode(new DOMAttr ('type', 'checkbox')); + $input->setAttributeNode(new DOMAttr ('name', str_replace('_outer', '', $this->_node->getAttribute('id') . '[ ]'))); + $input->setAttributeNode(new DOMAttr ('value', $this->_prefix . $value[$this->_prefix . 'navId'])); + $input->setAttributeNode(new DOMAttr ('id', $this->_prefix . $value[$this->_prefix . 'navId'])); + if ($this->_prefix === 'portal_' && array_key_exists($value[$this->_prefix . 'navId'], $this->_website)) + { + $input->setAttributeNode(new DOMAttr ('data-referer', $this->_website[$value[$this->_prefix . 'navId']]['prefix'] . 'Rights')); + } + $label = $this->_subtpl->createElement('label'); + $label->setAttributeNode(new DOMAttr ('for', $this->_prefix . $value[$this->_prefix . 'navId'])); + $label->appendChild(new DOMText ($value[$this->_prefix . 'navName'])); + + $newLi->appendChild($input); + $newLi->appendChild($label); + + $sub_node = renderFunctionsClass:: getNavigationNode($value [$this->_prefix . 'navId']); + if ($sub_node !== false) + { + $newLi->setAttributeNode(new DOMAttr ('class', 'hasChild')); + $newLi->appendChild($sub_node); + } + $newNode->appendChild($newLi); + + } + + unset ($this->_navData [$navStart]); + + return $newNode; + + } +} \ No newline at end of file diff --git a/.classes/generic/renderImageClass.php b/.classes/generic/renderImageClass.php index b77562e..8da59b3 100644 --- a/.classes/generic/renderImageClass.php +++ b/.classes/generic/renderImageClass.php @@ -1,37 +1,35 @@ _imgData = $imgData; - $new_node = $this -> _tpl -> createDocumentFragment ( ); - $node = $this -> _tpl -> createElement ( 'img' ); - - $node -> setAttributeNode ( new DOMAttr ( 'src' , $this -> _imgData[ 'path' ] . $this -> _imgData[ 'navId' ] . $this -> _imgData[ 'src' ] ) ); - if ( ! is_null ( $imgData[ 'title' ] ) && $imgData[ 'title' ] !== '' ) - { - $node -> setAttributeNode ( new DOMAttr ( 'title' , $this -> _imgData[ 'title' ] ) ); - } - - if ( isset ( $imgData[ 'id' ] ) && $isEditable ) - { - $node -> setAttributeNode ( new DOMAttr ( 'data-editable' , $type ) ); - $node -> setAttributeNode ( new DOMAttr ( 'id' , $type . '_' . $this -> _imgData[ 'id' ] ) ); - } - else if ( $isEditable ) - { - $node -> setAttributeNode ( new DOMAttr ( 'data-editable' , $type ) ); - $node -> setAttributeNode ( new DOMAttr ( 'id' , $type . '_0' ) ); - } - - $new_node -> appendChild ( $node ); +class renderImageClass extends renderClass_abstract +{ + private $_imgData = array(); - return $new_node; - } - + public function createImage($imgData, $isEditable, $type) + { + $this->_imgData = $imgData; + $new_node = $this->_tpl->createDocumentFragment(); + $node = $this->_tpl->createElement('img'); + + $node->setAttributeNode(new DOMAttr ('src', $this->_imgData['path'] . $this->_imgData['navId'] . $this->_imgData['src'])); + if (!is_null($imgData['title']) && $imgData['title'] !== '') + { + $node->setAttributeNode(new DOMAttr ('title', $this->_imgData['title'])); } -?> \ No newline at end of file + if (isset ($imgData['id']) && $isEditable) + { + $node->setAttributeNode(new DOMAttr ('data-editable', $type)); + $node->setAttributeNode(new DOMAttr ('id', $type . '_' . $this->_imgData['id'])); + } + else if ($isEditable) + { + $node->setAttributeNode(new DOMAttr ('data-editable', $type)); + $node->setAttributeNode(new DOMAttr ('id', $type . '_0')); + } + + $new_node->appendChild($node); + + return $new_node; + } + +} \ No newline at end of file diff --git a/.classes/generic/renderNavigationClass.php b/.classes/generic/renderNavigationClass.php index c28bb16..ef002ce 100644 --- a/.classes/generic/renderNavigationClass.php +++ b/.classes/generic/renderNavigationClass.php @@ -1,109 +1,108 @@ _navData = $navData; - $this -> _node = $this -> _tpl -> createDocumentFragment ( ); - $navKeys = array_keys ( $navData ); - $firstKey = $navKeys[ 0 ]; - $this -> _firstKey = $firstKey; - $this -> _prefix = renderNavigationClass :: getNavigationPrefix ( ); - - $node = renderNavigationClass :: getNavigationNode ( $this -> _firstKey ); - if ( $node !== false ) - { - $this -> _node -> appendChild ( $node ); - } +class renderNavigationClass extends renderClass_abstract +{ + private $_navData = array(); + private $_node = null; + private $_prefix = ''; + private $_firstKey = 0; - return $this -> _node; - } - - private function getNavigationPrefix ( ) - { - foreach ( $this -> _navData[ $this -> _firstKey ][ 0 ] as $key => $value ) - { - if ( strpos ( $key , '_' ) !== false ) - { - return substr ( $key , 0 , strpos ( $key , '_' ) + 1 ); - } - else - { - return ''; - } - } - } - - private function getNavigationNode ( $navStart ) - { - if ( ! isset ( $this -> _navData[ $navStart ] ) || count ( $this -> _navData [ $navStart ] ) == 0 ) - { - return false; - } - - $newNode = $this -> _tpl -> createElement ( 'ul' ); - foreach ( $this -> _navData [ $navStart ] AS $key => $value ) - { - if ( $this -> _textsFromConfig ) - { - if ( array_key_exists ( $value [ $this -> _prefix . 'navId' ] , $this -> _website ) ) - { - $navTitle = $this -> _website[ $value [ $this -> _prefix . 'navId' ] ][ 'names' ]; - } - else - { - $navTitle = $this -> _langArray [ 'navi' ][ 'site_' . $value [ $this -> _prefix . 'navId' ] ]; - } - } - else - { - $navTitle = $value[ $this -> _prefix . 'navName' ]; - } - if ( $this -> _modrewrite ) - { - $navHref = $value[ $this -> _prefix . 'navLink' ]; - } - else - { - $navHref = ( ! isset ( $value[ $this -> _prefix . 'navType' ] ) || ( isset ( $value[ $this -> _prefix . 'navType' ] ) && $value[ $this -> _prefix . 'navType' ] === 'html' ) ) - ? $value [ $this -> _prefix . 'navTarget' ] - : 'javascript:void( 0 );'; - } - - $newLi = $this -> _tpl -> createElement ( 'li' ); - $newHref = $this -> _tpl -> createElement ( 'a' ); - if ( in_array ( $value[ $this -> _prefix . 'navId' ] , $this -> _navpath ) ) - { - $newHref -> setAttributeNode ( new DOMAttr ( 'class' , 'active' ) ); - } - $newHref -> appendChild ( new DOMText ( $navTitle ) ); - $newHref -> setAttributeNode ( new DOMAttr ( 'href' , $navHref ) ); - if ( isset ( $value[ $this -> _prefix . 'navType' ] ) && $value[ $this -> _prefix . 'navType' ] === 'js' ) - { - $newHref -> setAttributeNode ( new DOMAttr ( 'onclick' , $value[ $this -> _prefix . 'navTarget' ] ) ); - } - $newLi -> appendChild ( $newHref ); - - $sub_node = renderNavigationClass :: getNavigationNode ( $value[ $this -> _prefix . 'navId' ] ); - if ( $sub_node !== false ) - { - $newLi -> appendChild ( $sub_node ); - } - $newNode -> appendChild ( $newLi ); - - } - - unset ( $this -> _navData [ $navStart ] ); - - return $newNode; - - } + public function createNavigation($navData) + { + $this->_navData = $navData; + $this->_node = $this->_tpl->createDocumentFragment(); + $navKeys = array_keys($navData); + $firstKey = $navKeys[0]; + $this->_firstKey = $firstKey; + $this->_prefix = renderNavigationClass:: getNavigationPrefix(); + + $node = renderNavigationClass:: getNavigationNode($this->_firstKey); + if ($node !== false) + { + $this->_node->appendChild($node); } -?> \ No newline at end of file + return $this->_node; + } + + private function getNavigationPrefix() + { + foreach ($this->_navData[$this->_firstKey][0] as $key => $value) + { + if (strpos($key, '_') !== false) + { + return substr($key, 0, strpos($key, '_') + 1); + } + else + { + return ''; + } + } + return ''; + } + + private function getNavigationNode($navStart) + { + if (!isset ($this->_navData[$navStart]) || count($this->_navData [$navStart]) == 0) + { + return false; + } + + $newNode = $this->_tpl->createElement('ul'); + foreach ($this->_navData [$navStart] AS $key => $value) + { + if ($this->_textsFromConfig) + { + if (array_key_exists($value [$this->_prefix . 'navId'], $this->_website)) + { + $navTitle = $this->_website[$value [$this->_prefix . 'navId']]['names']; + } + else + { + $navTitle = $this->_langArray ['navi']['site_' . $value [$this->_prefix . 'navId']]; + } + } + else + { + $navTitle = $value[$this->_prefix . 'navName']; + } + if ($this->_modrewrite) + { + $navHref = $value[$this->_prefix . 'navLink']; + } + else + { + $navHref = (!isset ($value[$this->_prefix . 'navType']) || (isset ($value[$this->_prefix . 'navType']) && $value[$this->_prefix . 'navType'] === 'html')) + ? $value [$this->_prefix . 'navTarget'] + : 'javascript:void( 0 );'; + } + + $newLi = $this->_tpl->createElement('li'); + $newHref = $this->_tpl->createElement('a'); + if (in_array($value[$this->_prefix . 'navId'], $this->_navpath)) + { + $newHref->setAttributeNode(new DOMAttr ('class', 'active')); + } + $newHref->appendChild(new DOMText ($navTitle)); + $newHref->setAttributeNode(new DOMAttr ('href', $navHref)); + if (isset ($value[$this->_prefix . 'navType']) && $value[$this->_prefix . 'navType'] === 'js') + { + $newHref->setAttributeNode(new DOMAttr ('onclick', $value[$this->_prefix . 'navTarget'])); + } + $newLi->appendChild($newHref); + + $sub_node = renderNavigationClass:: getNavigationNode($value[$this->_prefix . 'navId']); + if ($sub_node !== false) + { + $newLi->appendChild($sub_node); + } + $newNode->appendChild($newLi); + + } + + unset ($this->_navData [$navStart]); + + return $newNode; + + } +} \ No newline at end of file diff --git a/.classes/generic/renderPopupClass.php b/.classes/generic/renderPopupClass.php index 9deea1b..6d639fa 100644 --- a/.classes/generic/renderPopupClass.php +++ b/.classes/generic/renderPopupClass.php @@ -1,278 +1,276 @@ _subTemplate !== '') { - private $_imgData = array ( ); - - public function createPopup ( $popupData ) + $html = file_get_contents($this->_pathTpl . $this->_layout . '/tpl_' . $this->_template . '_' . $this->_subTemplate . '.php'); + $html = str_replace($this->_renderSearch, $this->_renderReplace, $html); + $subTpl = new DOMDocument (); + $subTpl->preserveWhitespace = false; + $subTpl->formatOutput = true; + $subTpl->loadHTML($html); + $subCont = $subTpl->getElementById('sub_content')->firstChild; + + $xpath = new DOMXpath ($subTpl); + + /* Textersetzungen */ + foreach ($this->_langArray [$this->_template] as $key => $value) + { + $replaces = $xpath->query("//*[starts-with( . , '%" . $key . "%' )]"); + foreach ($replaces as $replace) { - if ( $this -> _subTemplate !== '' ) - { - $html = file_get_contents ( $this -> _pathTpl . $this -> _layout . '/tpl_' . $this -> _template . '_' . $this -> _subTemplate . '.php' ); - $html = str_replace ( $this -> _renderSearch , $this -> _renderReplace , $html ); - $subTpl = new DOMDocument ( ); - $subTpl -> preserveWhitespace = false; - $subTpl -> formatOutput = true; - $subTpl -> loadHTML ( $html ); - $subCont = $subTpl -> getElementById ( 'sub_content' ) -> firstChild; - - $xpath = new DOMXpath ( $subTpl ); - - /* Textersetzungen */ - foreach ( $this -> _langArray [ $this -> _template ] as $key => $value ) - { - $replaces = $xpath -> query ( "//*[starts-with( . , '%" . $key . "%' )]" ); - foreach ( $replaces as $replace ) - { - if ( $replace -> firstChild -> nodeType === 3 ) - { - $replace -> replaceChild ( new DOMCdataSection ( $value ) , $replace -> firstChild ); - } - } - } - - /* Funktionen */ - if ( isset ( $popupData[ 'functions' ] ) && ! empty ( $popupData[ 'functions' ] ) ) - { - foreach ( $popupData[ 'functions' ] as $function ) - { - if ( $function[ 'position' ] === 'userWebsiteRights' ) - { - $node = $subTpl -> getElementById ( 'websiteRights' ) -> cloneNode ( true ); - $node -> firstChild -> nodeValue = $node -> firstChild -> nodeValue . ': ' . $this -> _website[ $function[ 'key' ] ][ 'names' ]; - $node -> removeAttribute ( 'id' ); - $node -> setAttributeNode ( new DOMAttr ( 'id' , $function[ 'prefix' ] . 'Rights' ) ); - - $newNode = $subTpl -> getElementById ( 'websiteRights' ) -> parentNode -> insertBefore ( $node , $subTpl -> getElementById ( 'websiteRights' ) ); - - /* Elemente ersetzen */ - $arr_replaces = array ( 'for' , 'id' , 'name' , 'onclick' ); - foreach ( $arr_replaces as $str_replace ) - { - $replaces = $xpath -> query ( ".//*[contains(@" . $str_replace . " , 'Website')]" , $newNode ); - foreach ( $replaces as $replace ) - { - $attribute = $replace -> getAttribute ( $str_replace ); - $replace -> removeAttribute ( $str_replace ); - $replace -> setAttributeNode ( new DOMAttr ( $str_replace , str_replace ( 'Website' , $function[ 'prefix' ] , $attribute ) ) ); - } - } - - $elem = $xpath -> query ( ".//*[@id='user" . $function[ 'prefix' ] . "Rights_outer']" , $newNode ); - $node = $elem -> item( 0 ); - } - else - { - $node = $subTpl -> getElementById ( $function[ 'position' ] . '_outer' ); - } - - if ( ! is_null ( $node ) ) - { - $this -> applyFunction ( $function[ 'name' ] , $function[ 'data' ] , $subTpl , $node , $function[ 'prefix' ] ); - } - } - - $node = $subTpl -> getElementById ( 'websiteRights' ); - $node -> parentNode -> removeChild ( $node ); - } - - /* Headerdaten */ - if ( isset ( $popupData[ 'header' ] ) && ! empty ( $popupData[ 'header' ] ) ) - { - $header_node = $subTpl -> getElementById ( 'sub_content_header' ); - foreach ( $popupData[ 'header' ] as $key => $value ) - { - $replaces = $xpath -> query ( ".//*[@id='" . $key . "']" , $header_node ); - foreach ( $replaces as $replaceNode ) - { - switch ( $replaceNode -> tagName ) - { - case 'select' : - foreach ( $value as $optionValue => $optionName ) - { - $option = $subTpl -> createElement ( 'option' ); - $option -> setAttributeNode ( new DOMAttr ( 'value' , $optionValue ) ); - if ( isset ( $this -> _postData[ $key ] ) && $this -> _postData[ $key ] == $optionValue ) - { - $option -> setAttributeNode ( new DOMAttr ( 'selected' , 'selected' ) ); - } - $option -> appendChild ( new DOMText ( $optionName ) ); - $replaceNode -> appendChild ( $option ); - } - break; - case 'input' : - $replaceNode -> setAttributeNode ( new DOMAttr ( 'value' , $value ) ); - $replaceNode -> setAttributeNode ( new DOMAttr ( 'autocomplete' , 'off' ) ); - default : - break; - } - } - } - } - - $this -> applySortRules ( $subTpl , $subCont , $xpath); - - /* Ausgabedaten */ - if ( isset ( $popupData[ 'main' ] ) && ! empty ( $popupData[ 'main' ] ) ) - { - $main = $subTpl -> getElementById ( 'sub_content_main' ); - $subNode = $main -> firstChild; - - $testArray = $popupData[ 'main' ][ 0 ]; - - /* Datenfelder */ - $arr_mainKeys = array ( ); - foreach ( $testArray as $key => $value ) - { - $elements = $xpath -> query ( "//*[@data-name='" . $key . "']" , $main ); - if ( $elements -> length !== 0 ) - { - $arr_mainKeys[ ] = $key; - } - } - - /* Eingabefelder */ - $arr_mainInputs = array ( ); - foreach ( $testArray as $key => $value ) - { - $elements = $xpath -> query ( "//form//*[@name='" . $key . "' or @name='" . $key . "[ ]']" , $main ); - if ( $elements -> length !== 0 ) - { - $arr_mainInputs[ ] = $key; - } - } - - /* Hauptdaten */ - foreach ( $popupData[ 'main' ] as $dataArray ) - { - $dataNode = $main -> firstChild -> cloneNode ( true ); - - /* Schaltflächen ( Links ) für die Bearbeitung in den Übersichtsseiten */ - foreach ( $this -> _dataParameter as $key => $new_parameter ) - { - $data_navigation = $xpath -> query ( ".//*[@data-navigation='" . $key . "']//a" , $dataNode ); - if ( $data_navigation -> length !== 0 ) - { - foreach ( $data_navigation as $navigation_item ) - { - if ( $navigation_item -> hasAttribute ( 'href' ) ) - { - $navigation_item -> setAttribute ( 'href' , $navigation_item -> getAttribute ( 'href' ) . '&' . $new_parameter . '=' . $dataArray[ $new_parameter ] ); - } - } - - } - } - - /* Spezielle Regeln anwenden */ - switch ( $this -> _template ) - { - /* Aktive - inaktive Elemente Unterscheiden */ - case 'usermanagement' : - if ( isset ( $dataArray[ 'userActive' ] ) && $dataArray[ 'userActive' ] === 'Y') - { - $dataNode -> setAttributeNode ( new DOMAttr ( 'class' , 'data_active' ) ); - } - else - { - $dataNode -> setAttributeNode ( new DOMAttr ( 'class' , 'data_inactive' ) ); - } - break; - default : - break; - } - - /* Werte zuweisen */ - foreach ( $arr_mainKeys as $key => $value ) - { - $elements = $xpath -> query ( ".//*[@data-name='" . $value . "']" , $dataNode ); - if ( $elements -> item( 0 ) -> hasChildNodes( ) ) - { - $elements -> item( 0 ) -> removeChild ( $elements -> item( 0 ) -> firstChild ); - } - /* TODO : Warum ist ein utf8_encode nötig? Evtl Server - Konfig */ - // $elements -> item( 0 ) -> appendChild ( new DOMText ( ( mb_detect_encoding ( $dataArray[ $value ] ) === 'UTF-8' ) ? $dataArray[ $value ] : utf8_encode ( $dataArray[ $value ] ) ) ); - $elements -> item( 0 ) -> appendChild ( new DOMText ( $dataArray[ $value ] ) ); - } - - foreach ( $arr_mainInputs as $key => $value ) - { - $elements = $xpath -> query ( ".//form//*[@name='" . $value . "' or @name='" . $value . "[ ]']" , $dataNode ); - foreach ( $elements as $element ) - { - switch ( $element -> tagName ) - { - case 'input' : - if ( $element -> hasAttribute ( 'type' ) ) - { - switch ( $element -> getAttribute ( 'type' ) ) - { - case 'text' : - case 'hidden' : - $element -> removeAttribute ( 'value' ); - $element -> setAttributeNode ( new DOMAttr ( 'value' , $dataArray[ $value ] ) ); - break; - case 'radio' : - if ( $element -> hasAttribute ( 'id' ) && $element -> getAttribute ( 'id' ) === ( $value . '_' . $dataArray[ $value ] ) ) - { - $element -> setAttributeNode ( new DOMAttr ( 'checked' , 'checked' ) ); - } - break; - case 'checkbox' : - if ( is_array ( $dataArray[ $value ] ) ) - { - if ( $element -> hasAttribute ( 'id' ) && in_array ( $element -> getAttribute ( 'id' ) , $dataArray[ $value ] ) ) - { - $element -> setAttributeNode ( new DOMAttr ( 'checked' , 'checked' ) ); - } - } - break; - default : - break; - } - } - else - { - $element -> removeAttribute ( 'value' ); - $element -> setAttributeNode ( new DOMAttr ( 'value' , $dataArray[ $value ] ) ); - } - break; - default : - break; - } - } - } - $main -> appendChild ( $dataNode ); - } - - $subNode -> parentNode -> removeChild ( $subNode ); - } - else - { - /* TODO : Keine Daten */ - $oldNode = $subTpl -> getElementById ( 'sub_content_main' ); - $oldNode -> parentNode -> removeChild ( $oldNode ); - } - } - - /* Fehlermeldungen */ - if ( ! is_null ( $this -> _errors ) ) - { - $main = $subTpl -> getElementById ( 'sub_content_main' ); - $subNode = $main -> firstChild; - foreach ( $this -> _errors as $error ) - { - $errorNode = $subTpl -> createElement ( 'p' ); - $errorNode -> setAttributeNode ( new DOMAttr ( 'class' , 'error' ) ); - $errorNode -> appendChild ( new DOMText ( $this -> _langArray[ 'error' ][ $error ] ) ); - $main -> insertBefore ( $errorNode , $subNode); - } - } - - $new_node = $this -> _tpl -> importNode ( $subCont , true ); - return $new_node; + if ($replace->firstChild->nodeType === 3) + { + $replace->replaceChild(new DOMCdataSection ($value), $replace->firstChild); + } } - + } + + /* Funktionen */ + if (isset ($popupData['functions']) && !empty ($popupData['functions'])) + { + foreach ($popupData['functions'] as $function) + { + if ($function['position'] === 'userWebsiteRights') + { + $node = $subTpl->getElementById('websiteRights')->cloneNode(true); + $node->firstChild->nodeValue = $node->firstChild->nodeValue . ': ' . $this->_website[$function['key']]['names']; + $node->removeAttribute('id'); + $node->setAttributeNode(new DOMAttr ('id', $function['prefix'] . 'Rights')); + + $newNode = $subTpl->getElementById('websiteRights')->parentNode->insertBefore($node, $subTpl->getElementById('websiteRights')); + + /* Elemente ersetzen */ + $arr_replaces = array('for', 'id', 'name', 'onclick'); + foreach ($arr_replaces as $str_replace) + { + $replaces = $xpath->query(".//*[contains(@" . $str_replace . " , 'Website')]", $newNode); + foreach ($replaces as $replace) + { + $attribute = $replace->getAttribute($str_replace); + $replace->removeAttribute($str_replace); + $replace->setAttributeNode(new DOMAttr ($str_replace, str_replace('Website', $function['prefix'], $attribute))); + } + } + + $elem = $xpath->query(".//*[@id='user" . $function['prefix'] . "Rights_outer']", $newNode); + $node = $elem->item(0); + } + else + { + $node = $subTpl->getElementById($function['position'] . '_outer'); + } + + if (!is_null($node)) + { + $this->applyFunction($function['name'], $function['data'], $subTpl, $node, $function['prefix']); + } + } + + $node = $subTpl->getElementById('websiteRights'); + $node->parentNode->removeChild($node); + } + + /* Headerdaten */ + if (isset ($popupData['header']) && !empty ($popupData['header'])) + { + $header_node = $subTpl->getElementById('sub_content_header'); + foreach ($popupData['header'] as $key => $value) + { + $replaces = $xpath->query(".//*[@id='" . $key . "']", $header_node); + foreach ($replaces as $replaceNode) + { + switch ($replaceNode->tagName) + { + case 'select' : + foreach ($value as $optionValue => $optionName) + { + $option = $subTpl->createElement('option'); + $option->setAttributeNode(new DOMAttr ('value', $optionValue)); + if (isset ($this->_postData[$key]) && $this->_postData[$key] == $optionValue) + { + $option->setAttributeNode(new DOMAttr ('selected', 'selected')); + } + $option->appendChild(new DOMText ($optionName)); + $replaceNode->appendChild($option); + } + break; + case 'input' : + $replaceNode->setAttributeNode(new DOMAttr ('value', $value)); + $replaceNode->setAttributeNode(new DOMAttr ('autocomplete', 'off')); + default : + break; + } + } + } + } + + $this->applySortRules($subTpl, $subCont, $xpath); + + /* Ausgabedaten */ + if (isset ($popupData['main']) && !empty ($popupData['main'])) + { + $main = $subTpl->getElementById('sub_content_main'); + $subNode = $main->firstChild; + + $testArray = $popupData['main'][0]; + + /* Datenfelder */ + $arr_mainKeys = array(); + foreach ($testArray as $key => $value) + { + $elements = $xpath->query("//*[@data-name='" . $key . "']", $main); + if ($elements->length !== 0) + { + $arr_mainKeys[] = $key; + } + } + + /* Eingabefelder */ + $arr_mainInputs = array(); + foreach ($testArray as $key => $value) + { + $elements = $xpath->query("//form//*[@name='" . $key . "' or @name='" . $key . "[ ]']", $main); + if ($elements->length !== 0) + { + $arr_mainInputs[] = $key; + } + } + + /* Hauptdaten */ + foreach ($popupData['main'] as $dataArray) + { + $dataNode = $main->firstChild->cloneNode(true); + + /* Schaltflächen ( Links ) für die Bearbeitung in den Übersichtsseiten */ + foreach ($this->_dataParameter as $key => $new_parameter) + { + $data_navigation = $xpath->query(".//*[@data-navigation='" . $key . "']//a", $dataNode); + if ($data_navigation->length !== 0) + { + foreach ($data_navigation as $navigation_item) + { + if ($navigation_item->hasAttribute('href')) + { + $navigation_item->setAttribute('href', $navigation_item->getAttribute('href') . '&' . $new_parameter . '=' . $dataArray[$new_parameter]); + } + } + + } + } + + /* Spezielle Regeln anwenden */ + switch ($this->_template) + { + /* Aktive - inaktive Elemente Unterscheiden */ + case 'usermanagement' : + if (isset ($dataArray['userActive']) && $dataArray['userActive'] === 'Y') + { + $dataNode->setAttributeNode(new DOMAttr ('class', 'data_active')); + } + else + { + $dataNode->setAttributeNode(new DOMAttr ('class', 'data_inactive')); + } + break; + default : + break; + } + + /* Werte zuweisen */ + foreach ($arr_mainKeys as $key => $value) + { + $elements = $xpath->query(".//*[@data-name='" . $value . "']", $dataNode); + if ($elements->item(0)->hasChildNodes()) + { + $elements->item(0)->removeChild($elements->item(0)->firstChild); + } + /* TODO : Warum ist ein utf8_encode nötig? Evtl Server - Konfig */ + // $elements -> item( 0 ) -> appendChild ( new DOMText ( ( mb_detect_encoding ( $dataArray[ $value ] ) === 'UTF-8' ) ? $dataArray[ $value ] : utf8_encode ( $dataArray[ $value ] ) ) ); + $elements->item(0)->appendChild(new DOMText ($dataArray[$value])); + } + + foreach ($arr_mainInputs as $key => $value) + { + $elements = $xpath->query(".//form//*[@name='" . $value . "' or @name='" . $value . "[ ]']", $dataNode); + foreach ($elements as $element) + { + switch ($element->tagName) + { + case 'input' : + if ($element->hasAttribute('type')) + { + switch ($element->getAttribute('type')) + { + case 'text' : + case 'hidden' : + $element->removeAttribute('value'); + $element->setAttributeNode(new DOMAttr ('value', $dataArray[$value])); + break; + case 'radio' : + if ($element->hasAttribute('id') && $element->getAttribute('id') === ($value . '_' . $dataArray[$value])) + { + $element->setAttributeNode(new DOMAttr ('checked', 'checked')); + } + break; + case 'checkbox' : + if (is_array($dataArray[$value])) + { + if ($element->hasAttribute('id') && in_array($element->getAttribute('id'), $dataArray[$value])) + { + $element->setAttributeNode(new DOMAttr ('checked', 'checked')); + } + } + break; + default : + break; + } + } + else + { + $element->removeAttribute('value'); + $element->setAttributeNode(new DOMAttr ('value', $dataArray[$value])); + } + break; + default : + break; + } + } + } + $main->appendChild($dataNode); + } + + $subNode->parentNode->removeChild($subNode); + } + else + { + /* TODO : Keine Daten */ + $oldNode = $subTpl->getElementById('sub_content_main'); + $oldNode->parentNode->removeChild($oldNode); + } } -?> \ No newline at end of file + /* Fehlermeldungen */ + if (!is_null($this->_errors)) + { + $main = $subTpl->getElementById('sub_content_main'); + $subNode = $main->firstChild; + foreach ($this->_errors as $error) + { + $errorNode = $subTpl->createElement('p'); + $errorNode->setAttributeNode(new DOMAttr ('class', 'error')); + $errorNode->appendChild(new DOMText ($this->_langArray['error'][$error])); + $main->insertBefore($errorNode, $subNode); + } + } + + $new_node = $this->_tpl->importNode($subCont, true); + return $new_node; + } + +} \ No newline at end of file diff --git a/.classes/generic/renderSpecialContentClass.php b/.classes/generic/renderSpecialContentClass.php index 3f7a412..5c2ea24 100644 --- a/.classes/generic/renderSpecialContentClass.php +++ b/.classes/generic/renderSpecialContentClass.php @@ -1,60 +1,58 @@ _pathTpl . $this->_layout . '/tpl_' . $this->_template . '_' . $id . '.php'); + $html = str_replace($this->_renderSearch, $this->_renderReplace, $html); + $subTpl = new DOMDocument (); + $subTpl->preserveWhitespace = false; + $subTpl->formatOutput = true; + $subTpl->loadHTML($html); + + $xpath = new DOMXpath ($subTpl); + $subCont = $xpath->query(".//*[contains(concat(' ', @class, ' '), ' " . $id . " ')]")->item(0); + + foreach ($popupData as $singleData) { - public function createSpecialContent ( $id , $popupData , $type ) + $tmp_node = $subCont->firstChild->cloneNode(true); + if (isset ($singleData['id'])) + { + $subCont->setAttributeNode(new DOMAttr ('id', $type . '_' . $singleData['id'])); + } + + foreach ($singleData as $key => $data) + { + $nodeList = $xpath->query(".//*[contains(concat(' ', @class, ' '), ' " . $key . " ')]", $tmp_node); + if ($nodeList->length !== 0) { - $html = file_get_contents ( $this -> _pathTpl . $this -> _layout . '/tpl_' . $this -> _template . '_' . $id . '.php' ); - $html = str_replace ( $this -> _renderSearch , $this -> _renderReplace , $html ); - $subTpl = new DOMDocument ( ); - $subTpl -> preserveWhitespace = false; - $subTpl -> formatOutput = true; - $subTpl -> loadHTML ( $html ); - - $xpath = new DOMXpath ( $subTpl ); - $subCont = $xpath -> query ( ".//*[contains(concat(' ', @class, ' '), ' " . $id . " ')]" ) -> item( 0 ); - - foreach ( $popupData as $singleData ) + + foreach ($nodeList as $node) + { + switch ($key) { - $tmp_node = $subCont -> firstChild -> cloneNode ( true ); - if ( isset ( $singleData[ 'id' ] ) ) - { - $subCont -> setAttributeNode ( new DOMAttr ( 'id' , $type . '_' . $singleData[ 'id' ] ) ); - } - - foreach ( $singleData as $key => $data ) - { - $nodeList = $xpath -> query ( ".//*[contains(concat(' ', @class, ' '), ' " . $key . " ')]" , $tmp_node ); - if ( $nodeList -> length !== 0 ) - { - - foreach ( $nodeList as $node ) - { - switch ( $key ) - { - case 'link' : - $node -> setAttributeNode ( new DOMAttr ( 'href' , $data ) ); - break; - - default : - $node -> appendChild ( new DOMCdataSection ( $data ) ); - break; - } - } - - } - } - - $subCont -> appendChild ( $tmp_node ); + case 'link' : + $node->setAttributeNode(new DOMAttr ('href', $data)); + break; + + default : + $node->appendChild(new DOMCdataSection ($data)); + break; } - - $subCont -> removeChild ( $subCont -> firstChild ); - - - $new_node = $this -> _tpl -> importNode ( $subCont , true ); - return $new_node; + } + } - + } + + $subCont->appendChild($tmp_node); } -?> \ No newline at end of file + $subCont->removeChild($subCont->firstChild); + + + $new_node = $this->_tpl->importNode($subCont, true); + return $new_node; + } + +} \ No newline at end of file diff --git a/.classes/generic/renderWidgetClass.php b/.classes/generic/renderWidgetClass.php index b79adc7..e2dba1e 100644 --- a/.classes/generic/renderWidgetClass.php +++ b/.classes/generic/renderWidgetClass.php @@ -1,34 +1,32 @@ _pathTpl . $this->_layout . '/tpl_' . $this->_template . '_widget_' . $widgetData['tpl'] . '.php'); + $html = str_replace($this->_renderSearch, $this->_renderReplace, $html); + + foreach ($widgetData as $key => $value) { - - public function createWidget ( $widgetData ) - { - $html = file_get_contents ( $this -> _pathTpl . $this -> _layout . '/tpl_' . $this -> _template . '_widget_' . $widgetData[ 'tpl' ] . '.php' ); - $html = str_replace ( $this -> _renderSearch , $this -> _renderReplace , $html ); - - foreach ( $widgetData as $key => $value ) - { - $html = str_replace ( '%%' . $key . '%%' , $value , $html ); - } - - $subTpl = new DOMDocument ( ); - $subTpl -> preserveWhitespace = false; - $subTpl -> formatOutput = true; - $subTpl -> loadHTML ( $html ); - - $xpath = new DOMXpath ( $subTpl ); - $subCont = $xpath -> query ( ".//*[contains(concat(' ', @class, ' '), ' " . $widgetData[ 'tpl' ] . " ')]" ) -> item( 0 ); - - if ( isset ( $widgetData[ 'id' ] ) ) - { - $subCont -> setAttributeNode ( new DOMAttr ( 'id' , 'widget_' . $widgetData[ 'id' ] ) ); - } - - $new_node = $this -> _tpl -> importNode ( $subCont , true ); - return $new_node; - } + $html = str_replace('%%' . $key . '%%', $value, $html); } -?> \ No newline at end of file + $subTpl = new DOMDocument (); + $subTpl->preserveWhitespace = false; + $subTpl->formatOutput = true; + $subTpl->loadHTML($html); + + $xpath = new DOMXpath ($subTpl); + $subCont = $xpath->query(".//*[contains(concat(' ', @class, ' '), ' " . $widgetData['tpl'] . " ')]")->item(0); + + if (isset ($widgetData['id'])) + { + $subCont->setAttributeNode(new DOMAttr ('id', 'widget_' . $widgetData['id'])); + } + + $new_node = $this->_tpl->importNode($subCont, true); + return $new_node; + } +} \ No newline at end of file diff --git a/.classes/rendering/viewClass.php b/.classes/rendering/viewClass.php index 4a3253d..4b9297e 100644 --- a/.classes/rendering/viewClass.php +++ b/.classes/rendering/viewClass.php @@ -1,135 +1,139 @@ _config = $config; + if (isset ($this->_config['portal']['website'])) { - private $_config = array( ); - private $_prefix = ''; - private $_pathTpl = ''; - private $_template = ''; - private $_siteId = 0; - private $_editable = false; - private $_webkey = 0; - private $_website = array( ); - private $_navpath = array( ); - private $_data = array( ); - private $_param = null; - private $_specialSite = false; - private $_formdata = array( ); - private $_error = array( ); - private $_lang = array( ); - - public function setConfig( $config ) - { - $this -> _config = $config; - if ( isset ( $this -> _config[ 'portal' ][ 'website' ] ) ) - { - $this -> setWebsite ( $this -> _config[ 'portal' ][ 'website' ] ); - } - } - - private function setWebsite( $website ) - { - $return_array = array ( ); - $tmp_array = array_flip ( $website[ 'navId' ] ); - foreach ( $tmp_array as $key => $value ) - { - foreach ( $website as $tmp_key => $tmp_value ) - { - $return_array[ $key ][ $tmp_key ] = $website[ $tmp_key ][ $value ]; - } - } - $this -> _website = $return_array; - } - - public function setPrefix( $prefix ) - { - $this -> _prefix = $prefix; - } - - public function setPathTpl( $pathTpl ) - { - if ( is_dir ( $pathTpl . $this -> _prefix ) ) - { - $this -> _pathTpl = $pathTpl . $this -> _prefix . '/'; - } - else - { - throw new Exception( 'Template Path does not exist' ); - } - } - - public function setTemplate( $template ) - { - if ( file_exists ( $this -> _pathTpl . 'tpl_' . $template . '.php' ) ) - { - $this -> _template = $this -> _pathTpl . 'tpl_' . $template . '.php'; - } - else - { - throw new Exception( 'Template "' . $this -> _pathTpl . 'tpl_' . $template . '.php" does not exist' ); - } - } - - public function setSiteId( $siteId ) - { - $this -> _siteId = $siteId; - } - - public function setEditable( $editable ) - { - $this -> _editable = $editable; - } - - public function setErrors( $error ) - { - $this -> _error = $error; - } - - public function setWebkey( $webkey ) - { - $this -> _webkey = $webkey; - } - - public function setNavpath( $navpath ) - { - $this -> _navpath = $navpath; - } - - public function setData( $data , $param = null ) - { - $this -> _data = $data; - $this -> _param = $param; - } - - public function setSpecialSite( $specialSite ) - { - $this -> _specialSite = $specialSite; - } - - public function setFormdata( $formdata ) - { - $this -> _formdata = $formdata; - } - - public function setError( $error ) - { - $this -> _error = $error; - } - - public function setLang( $lang ) - { - $this -> _lang = $lang; - } - - public function output( ) - { - ob_start( ); - require $this -> _template; - return ob_get_clean( ); - } - + $this->setWebsite($this->_config['portal']['website']); } + } -?> \ No newline at end of file + private function setWebsite($website) + { + $return_array = array(); + $tmp_array = array_flip($website['navId']); + foreach ($tmp_array as $key => $value) + { + foreach ($website as $tmp_key => $tmp_value) + { + $return_array[$key][$tmp_key] = $website[$tmp_key][$value]; + } + } + $this->_website = $return_array; + } + + public function setPrefix($prefix) + { + $this->_prefix = $prefix; + } + + public function setPathTpl($pathTpl) + { + if (is_dir($pathTpl . '/' . $this->_prefix)) + { + $this->_pathTpl = $pathTpl . $this->_prefix . '/'; + } + else + { + echo '
';
+			var_dump($this->_pathTpl = $pathTpl . $this->_prefix . '/');
+			echo '
'; + //throw new Exception('Template Path does not exist'); + } + } + + public function setTemplate($template) + { + if (file_exists($this->_pathTpl . 'tpl_' . $template . '.php')) + { + $this->_template = $this->_pathTpl . 'tpl_' . $template . '.php'; + } + else + { + echo '
';
+			var_dump($this->_template = $this->_pathTpl . 'tpl_' . $template . '.php');
+			echo '
'; + //throw new Exception('Template "' . $this->_pathTpl . 'tpl_' . $template . '.php" does not exist'); + } + } + + public function setSiteId($siteId) + { + $this->_siteId = $siteId; + } + + public function setEditable($editable) + { + $this->_editable = $editable; + } + + public function setErrors($error) + { + $this->_error = $error; + } + + public function setWebkey($webkey) + { + $this->_webkey = $webkey; + } + + public function setNavpath($navpath) + { + $this->_navpath = $navpath; + } + + public function setData($data, $param = null) + { + $this->_data = $data; + $this->_param = $param; + } + + public function setSpecialSite($specialSite) + { + $this->_specialSite = $specialSite; + } + + public function setFormdata($formdata) + { + $this->_formdata = $formdata; + } + + public function setError($error) + { + $this->_error = $error; + } + + public function setLang($lang) + { + $this->_lang = $lang; + } + + public function output() + { + ob_start(); + require $this->_template; + return ob_get_clean(); + } + +} \ No newline at end of file diff --git a/.classes/rendering/viewClass_abstract.php b/.classes/rendering/viewClass_abstract.php index 96d7e5c..ddd0fc0 100644 --- a/.classes/rendering/viewClass_abstract.php +++ b/.classes/rendering/viewClass_abstract.php @@ -1,34 +1,32 @@ _instance = $this; - } - - /** - * Destruktor - */ - public function __destruct( ) - { - } - - public function getInstance( ) - { - if ( ! isset( self::$_instance ) ) - { - $class = __CLASS__; - $instance = new $class; - } - return self::$_instance; - } - - } +class viewClass_abstract +{ + protected static $_instance = null; -?> \ No newline at end of file + /** + * Konstruktor + */ + public function __construct() + { + $this->_instance = $this; + } + + /** + * Destruktor + */ + public function __destruct() + { + } + + public function getInstance() + { + if (!isset(self::$_instance)) + { + $class = __CLASS__; + self::$_instance = new $class; + } + return self::$_instance; + } + +} \ No newline at end of file diff --git a/.config/config_global.php b/.config/config_global.php index f4e4035..57808bd 100644 --- a/.config/config_global.php +++ b/.config/config_global.php @@ -1,52 +1,132 @@ 'image/jpeg' , - 'png' => 'image/png' , - 'gif' => 'image/gif' - ); - - /* Weitere Includes */ - include_once ( PATH_CNF . 'config_version.php' ); - include_once ( PATH_INC . 'global_header.php' ); +/** + * Umgebung definieren + */ +$environment = getenv('ENVIRONMENT'); +if ($environment === false) +{ + $tmpPath = __DIR__; + $found = false; + while ($tmpPath != '/') + { + $htFile = $tmpPath . '/.htaccess'; + if (is_file($htFile) && is_readable($htFile)) + { + $htContent = file($htFile); + foreach ($htContent as $line => $text) + { + if (strpos($text, 'SetEnv') !== false && strpos($text, 'ENVIRONMENT') !== false) + { + $found = true; + $environment = trim(str_replace(array('SetEnv', 'ENVIRONMENT'), '', $text)); + break; + } + } + } + if ($found) + { + break; + } + $tmpPath = dirname($tmpPath); + } +} -?> \ No newline at end of file +define('ENVIRONMENT', $environment); + +if (isset($_SERVER['HTTPS'])) +{ + define('SCHEME', 'https'); +} +else +{ + define('SCHEME', 'http'); +} + +if (ENVIRONMENT === 'local') +{ + define('HOST_URL', SCHEME . '://192.168.178.66/svj/'); + define('PATH_PREFIX', '/svj'); +} +elseif (ENVIRONMENT === 'testing') +{ + define('HOST_URL', SCHEME . '://'); +} +elseif (ENVIRONMENT === 'production') +{ + define('HOST_URL', SCHEME . '://www.svj-fussball.de/'); + define('PATH_PREFIX', ''); +} +else +{ + die('Umgebungsvariable ist nicht gesetzt!'); +} +define('ADMIN_URL', HOST_URL . 'administrator'); + +/** + * Pfade definieren + */ +define('PATH_ROOT', dirname(__DIR__) . '/'); +define('PATH_SITE', PATH_PREFIX . '/administrator'); +define('PATH_ACT', PATH_ROOT . '.actions/'); +define('PATH_CLS', PATH_ROOT . '.classes/'); +define('PATH_CNF', PATH_ROOT . '.config/'); +define('PATH_FNC', PATH_ROOT . '.functions/'); +define('PATH_INC', PATH_ROOT . '.includes/'); +define('PATH_LANG', PATH_ROOT . '.lang/'); + + +/** + * Relative URLs für die Templates definieren + */ +define('HTML_IMG', PATH_PREFIX . '/images/'); +define('HTML_CSS', PATH_PREFIX . '/css/'); +define('PATH_CSS', PATH_SITE . '/css/'); +define('PATH_IMG', PATH_SITE . '/images/'); +define('PATH_JS', PATH_SITE . '/js/'); +define('PATH_MED', PATH_PREFIX . '/media/'); + +define('PATH_PORTAL_TPL', PATH_ROOT . 'administrator/templates/'); +define('PATH_WEBSITE_TPL', PATH_ROOT . 'templates/'); + + +/** + * Datenbank konfigurieren + */ +define('DB_TYPE', 'mysqli'); +define('DB_HOST', 'localhost'); +define('DB_NAME', 'c9svj'); +define('DB_USER', 'c9svj'); +define('DB_PASS', 'rXzmeEM@3'); + + +/** + * Tabellennamen definieren + */ +define('TBL_NAVI', 'navi'); +define('TBL_CONTENT', 'content'); +define('TBL_HEAD', 'content_headline'); +define('TBL_IMAGE', 'content_image'); +define('TBL_TEXT', 'content_text'); +define('TBL_TEXTIMAGE', 'content_textimage'); + +define('TBL_LOG', 'portal_log'); +define('TBL_RIGHTS', 'portal_rights'); +define('TBL_USER', 'portal_user'); + + +/** + * Mimetypes + */ +$vC['mimetypes'] = array +( + 'jpg' => 'image/jpeg', + 'png' => 'image/png', + 'gif' => 'image/gif' +); + +/** + * Weitere Includes + */ +include_once(PATH_CNF . 'config_version.php'); +include_once(PATH_INC . 'global_header.php'); \ No newline at end of file diff --git a/.config/config_svjf.php b/.config/config_svjf.php index 83fe6ab..1d88203 100644 --- a/.config/config_svjf.php +++ b/.config/config_svjf.php @@ -1,21 +1,26 @@ 'content' , 'uebersicht' => 'uebersicht' , 'spielbericht' => 'spielbericht' , 'turnier' => 'turnier' , 'widget' => 'widget' ); - $svjf[ 'host' ] = 'svj-fussball.de'; - $svjf[ 'fussballde' ] = '01M9R8HJO8000000VS541L4KVSEIO2C1'; - $svjf[ 'editorUrl' ] = $vC[ 'portal' ][ 'arrHost' ][ 'scheme' ] . '://steinle.no-ip.biz/rist_editors/'; - $svjf[ 'editorVersion' ] = '1.0'; - $svjf[ 'webserviceUrl' ] = $vC[ 'portal' ][ 'hostUrl' ] . '/webservices/remote_data.php'; - $svjf[ 'grid' ] = 24; - $svjf[ 'gridCount' ] = 40; - $svjf[ 'dimOrig' ] = array ( 'width' => 2560 , 'height' => 2560 ); - $svjf[ 'dimKeyvisual' ] = array ( 'width' => 864 , 'height' => 288 ); - $svjf[ 'dimImage' ] = array ( 'width' => 312 , 'height' => 234 ); - $svjf[ 'imageTypes' ] = array ( 'image/png' , 'image/jpeg' , 'image/gif' ); - $svjf[ 'keyvisualThumb' ] = array ( 'width' => 216 , 'height' => 72 ); - $svjf[ 'imageThumb' ] = array ( 'width' => 216 , 'height' => 324 ); - $svjf[ 'contentElems' ] = array ( 'subline' , 'text' , 'textimage' ); - -?> \ No newline at end of file +$svjf['names'] = 'SVJ-Fussball'; +$svjf['tpl'] = 'svjf'; +$svjf['host'] = 'svj-fussball.de'; +$svjf['fussballde'] = '01M9R8HJO8000000VS541L4KVSEIO2C1'; +if (ENVIRONMENT === 'local') +{ + $svjf['editorUrl'] = $vC['portal']['arrHost']['scheme'] . '://csteinle.ddns.net/rist-editors/'; + $svjf['editorVersion'] = '1.0.0'; +} +elseif (ENVIRONMENT === 'production') +{ + $svjf['editorUrl'] = $vC['portal']['arrHost']['scheme'] . '://rist-editors.ri-st.de/'; + $svjf['editorVersion'] = '1.0.0'; +} +$svjf['webserviceUrl'] = $vC['portal']['hostUrl'] . '/webservices/remote_data.php'; +$svjf['grid'] = 24; +$svjf['gridCount'] = 40; +$svjf['dimOrig'] = array('width' => 2560, 'height' => 2560); +$svjf['dimKeyvisual'] = array('width' => 864, 'height' => 288); +$svjf['dimImage'] = array('width' => 312, 'height' => 234); +$svjf['imageTypes'] = array('image/png', 'image/jpeg', 'image/gif'); +$svjf['keyvisualThumb'] = array('width' => 216, 'height' => 72); +$svjf['imageThumb'] = array('width' => 216, 'height' => 324); +$svjf['contentElems'] = array('subline', 'text', 'textimage'); \ No newline at end of file diff --git a/.config/config_version.php b/.config/config_version.php index 445b952..ea1b683 100644 --- a/.config/config_version.php +++ b/.config/config_version.php @@ -1,45 +1,49 @@ $value ) - { - $vC[ 'portal' ][ 'website' ][ $key ][ ] = $value; - } - } - - /* E-Mail Versand */ - $vC[ 'portal' ][ 'mail' ][ 'type' ] = 'smtp'; /* sendmail || smtp || mail */ - - /* Nur ausfüllen, falls 'type' === 'smtp' */ - $vC[ 'portal' ][ 'mail' ][ 'smtpAuth' ] = true; /* true || false */ - $vC[ 'portal' ][ 'mail' ][ 'smtpHost' ] = 'mail.arcor.de'; - $vC[ 'portal' ][ 'mail' ][ 'smtpUser' ] = 'christiansteinle'; - $vC[ 'portal' ][ 'mail' ][ 'smtpPass' ] = 'lmaa2dw'; - - $vC[ 'portal' ][ 'mail' ][ 'from' ] = 'noreply@svj-fussball.de'; - $vC[ 'portal' ][ 'mail' ][ 'fromName' ] = 'noreply SVJ'; - $vC[ 'portal' ][ 'mail' ][ 'returnPath' ] = 'christiansteinle@arocr.de'; - $vC[ 'portal' ][ 'mail' ][ 'html' ] = false; /* true || false */ - $vC[ 'portal' ][ 'mail' ][ 'charset' ] = 'UTF-8'; - - -?> \ No newline at end of file +/** + * Portal - Definitionen + */ +$vC['portal']['name'] = 'SVJ Fussball'; +$vC['portal']['hostUrl'] = ADMIN_URL; +$vC['portal']['arrHost'] = parse_url($vC['portal']['hostUrl']); +$vC['portal']['adminUserId'] = 3; +$vC['portal']['languages'] = array('de'); +$vC['portal']['address'] = 'informal'; /* formal || informal */ +$vC['portal']['layout'] = 'cs_l1'; +$vC['portal']['tplElements'] = array('login', 'navi_main', 'content'); +$vC['portal']['imgQuality'] = 90; + +/** + * Websitebearbeitung - Definitionen + */ +$vC['portal']['website']['navId'] = array('20'); +$vC['portal']['website']['prefix'] = array('svjf'); + +foreach ($vC['portal']['website']['prefix'] as $config) +{ + include_once(PATH_CNF . 'config_' . $config . '.php'); + + foreach ($$config as $key => $value) + { + $vC['portal']['website'][$key][] = $value; + } +} + +/** + * E-Mail Versand + */ +$vC['portal']['mail']['type'] = 'smtp'; /* sendmail || smtp || mail */ + +/** + * Nur ausfüllen, falls 'type' === 'smtp' + */ +$vC['portal']['mail']['smtpAuth'] = true; /* true || false */ +$vC['portal']['mail']['smtpHost'] = 'mail.arcor.de'; +$vC['portal']['mail']['smtpUser'] = 'christiansteinle'; +$vC['portal']['mail']['smtpPass'] = 'lmaa2dw'; + +$vC['portal']['mail']['from'] = 'noreply@svj-fussball.de'; +$vC['portal']['mail']['fromName'] = 'noreply SVJ'; +$vC['portal']['mail']['returnPath'] = 'christiansteinle@arocr.de'; +$vC['portal']['mail']['html'] = false; /* true || false */ +$vC['portal']['mail']['charset'] = 'UTF-8'; \ No newline at end of file diff --git a/.functions/fnc_portal.php b/.functions/fnc_portal.php index 744567b..4f2dc76 100644 --- a/.functions/fnc_portal.php +++ b/.functions/fnc_portal.php @@ -1,430 +1,431 @@ 0 ) - ? '( ' . $prefix . '_navPosition = "' . implode ( '" OR ' . $prefix . '_navPosition = "' , $navPositions ) . '" )' - : ''; - $str_filter .= ( $onlyActive ) - ? ( $str_filter === '' ) - ? $prefix . '_navActive = "Y"' - : ' AND ' . $prefix . '_navActive = "Y"' - : ''; - $str_filter = ( $str_filter !== '' ) - ? ' WHERE ' . $str_filter - : ''; +function fnc_getNavigationArray($prefix, $onlyActive = true, $navPositions = array(), $namesFromConfig = array()) +{ + global $db; + $return = array(); - $navi = $db -> query - ( - 'SELECT + $str_filter = (count($navPositions) > 0) + ? '( ' . $prefix . '_navPosition = "' . implode('" OR ' . $prefix . '_navPosition = "', $navPositions) . '" )' + : ''; + $str_filter .= ($onlyActive) + ? ($str_filter === '') + ? $prefix . '_navActive = "Y"' + : ' AND ' . $prefix . '_navActive = "Y"' + : ''; + $str_filter = ($str_filter !== '') + ? ' WHERE ' . $str_filter + : ''; + + $navi = $db->query + ( + 'SELECT * FROM - ' . $prefix . '_' . TBL_NAVI . - $str_filter . ' + ' . $prefix . '_' . TBL_NAVI . + $str_filter . ' ORDER BY ' . $prefix . '_navStart ASC , ' . $prefix . '_navSort ASC;' - ); - while ( $dat_navi = $navi -> fetch_assoc( ) ) - { - if ( ! empty( $namesFromConfig ) ) - { - $dat_navi[ $prefix . '_navName' ] = $namesFromConfig[ 'site_' . $dat_navi[ $prefix . '_navId' ] ]; - } - $return[ $dat_navi[ $prefix . '_navStart' ] ][ ] = $dat_navi; - } - - return $return; - } - - function fnc_getSingleNavigationArrays ( $prefix , $navArray , $params , $pathWay ) + ); + while ($dat_navi = $navi->fetch_assoc()) + { + if (!empty($namesFromConfig)) { - $i = 0; - - foreach ( $params[ 'navLevel' ] as $key => $depth ) - { - if ( $params[ 'navDepth' ][ $key ] ) - { - if ( isset ( $pathWay[ $i ] ) && isset ( $navArray[ $pathWay[ $i ] ] ) ) - { - $return[ $key ][ $pathWay[ $i ] ] = $navArray[ $pathWay[ $i ] ]; - ++$i; - while ( $i < $depth ) - { - foreach ( $return[ $key ] as $subArray ) - { - foreach ( $subArray as $navPoint ) - { - if ( isset ( $navArray[ $navPoint[ $prefix . '_navId' ] ] ) ) - { - $return[ $key ][ $navPoint[ $prefix . '_navId' ] ] = $navArray[ $navPoint[ $prefix . '_navId' ] ]; - } - } - } - ++$i; - } - } - else - { - if ( ! isset ( $return[ $key ] ) ) - { - $return[ $key ] = null; - } - } - } - else - { - /* Nur die aktuelle Unternavigation */ - while ( $i < $depth && isset ( $pathWay [ $i ] ) ) - { - if ( isset ( $navArray[ $pathWay[ $i ] ] ) ) - { - $return[ $key ][ $pathWay[ $i ] ] = $navArray[ $pathWay[ $i ] ]; - } - else - { - if ( ! isset ( $return[ $key ] ) ) - { - $return[ $key ] = null; - } - } - ++$i; - } - } - } + $dat_navi[$prefix . '_navName'] = $namesFromConfig['site_' . $dat_navi[$prefix . '_navId']]; + } + $return[$dat_navi[$prefix . '_navStart']][] = $dat_navi; + } - return $return; - } - - function fnc_getPortalNavigationArray ( $prefix , $navArray , $rightsArray ) + return $return; +} + +function fnc_getSingleNavigationArrays($prefix, $navArray, $params, $pathWay) +{ + $i = 0; + + foreach ($params['navLevel'] as $key => $depth) + { + if ($params['navDepth'][$key]) { - foreach ( $navArray as $navStart => $navLevels ) + if (isset ($pathWay[$i]) && isset ($navArray[$pathWay[$i]])) + { + $return[$key][$pathWay[$i]] = $navArray[$pathWay[$i]]; + ++$i; + while ($i < $depth) { - if ( $navStart > 0 ) + foreach ($return[$key] as $subArray) + { + foreach ($subArray as $navPoint) { - if ( ! in_array ( $prefix . '_' . $navStart , $rightsArray ) && ! in_array( $navStart , $rightsArray )) - { - unset ( $navArray[ $navStart ] ); - } + if (isset ($navArray[$navPoint[$prefix . '_navId']])) + { + $return[$key][$navPoint[$prefix . '_navId']] = $navArray[$navPoint[$prefix . '_navId']]; + } } + } + ++$i; } - foreach ( $navArray as $key => $navLevels ) + } + else + { + if (!isset ($return[$key])) { - foreach ( $navLevels as $subKey => $navPoint ) - { - if ( intval( $navPoint[ $prefix . '_navId' ] ) > 1 && ( ! in_array ( $prefix . '_' . $navPoint[ $prefix . '_navId' ] , $rightsArray ) ) && ! in_array( $navPoint[ $prefix . '_navId'] , $rightsArray ) ) - { - unset ( $navArray[ $key ][ $subKey ] ); - } - } - + $return[$key] = null; } - return ( $navArray ); + } } - - function fnc_createPathHome ( $prefix , $navActive ) + else { - global $db; - - $navi = $db -> query - ( - 'SELECT + /* Nur die aktuelle Unternavigation */ + while ($i < $depth && isset ($pathWay [$i])) + { + if (isset ($navArray[$pathWay[$i]])) + { + $return[$key][$pathWay[$i]] = $navArray[$pathWay[$i]]; + } + else + { + if (!isset ($return[$key])) + { + $return[$key] = null; + } + } + ++$i; + } + } + } + + return $return; +} + +function fnc_getPortalNavigationArray($prefix, $navArray, $rightsArray) +{ + foreach ($navArray as $navStart => $navLevels) + { + if ($navStart > 0) + { + if (!in_array($prefix . '_' . $navStart, $rightsArray) && !in_array($navStart, $rightsArray)) + { + unset ($navArray[$navStart]); + } + } + } + foreach ($navArray as $key => $navLevels) + { + foreach ($navLevels as $subKey => $navPoint) + { + if (intval($navPoint[$prefix . '_navId']) > 1 && (!in_array($prefix . '_' . $navPoint[$prefix . '_navId'], $rightsArray)) && !in_array($navPoint[$prefix . '_navId'], $rightsArray)) + { + unset ($navArray[$key][$subKey]); + } + } + + } + return ($navArray); +} + +function fnc_createPathHome($prefix, $navActive) +{ + global $db; + + $navi = $db->query + ( + 'SELECT * FROM ' . $prefix . '_' . TBL_NAVI . ' WHERE ' . $prefix . '_navId = "' . $navActive . '";' - ); - $arr_navi = $navi -> fetch_assoc ( ); - if ( $arr_navi[ $prefix . '_navStart' ] !== '0' && !is_null($arr_navi) ) - { - $return = fnc_createPathHome ( $prefix , $arr_navi[ $prefix . '_navStart' ] ); - } - else - { - $return[ ] = '0'; - } - $return[ ] = $navActive; - - return $return; - } - - function fnc_getNavType ( $prefix , $navActive ) - { - global $db; - - $navi = $db -> query - ( - 'SELECT + ); + $arr_navi = $navi->fetch_assoc(); + if ($arr_navi[$prefix . '_navStart'] !== '0' && !is_null($arr_navi)) + { + $return = fnc_createPathHome($prefix, $arr_navi[$prefix . '_navStart']); + } + else + { + $return[] = '0'; + } + $return[] = $navActive; + + return $return; +} + +function fnc_getNavType($prefix, $navActive) +{ + global $db; + + $navi = $db->query + ( + 'SELECT * FROM ' . $prefix . '_' . TBL_NAVI . ' WHERE ' . $prefix . '_navId = "' . $navActive . '";' - ); - $navPoint = $navi -> fetch_assoc ( ); - - if ( $navPoint[ $prefix . '_specialSite' ] === 'Y' ) - { - return $navPoint[ $prefix . '_specialType' ]; - } - else - { - return false; - } - } - function fnc_getUsernameById ( $userId ) - { - global $db; - $return = ''; - - $user = $db -> query - ( - 'SELECT + ); + $navPoint = $navi->fetch_assoc(); + + if ($navPoint[$prefix . '_specialSite'] === 'Y') + { + return $navPoint[$prefix . '_specialType']; + } + else + { + return false; + } +} + +function fnc_getUsernameById($userId) +{ + global $db; + $return = ''; + + $user = $db->query + ( + 'SELECT * FROM ' . TBL_USER . ' WHERE userId = "' . $userId . '";' - ); - if ( $user -> num_rows > 0 ) - { - $dat_user = $user -> fetch_assoc ( ); - $return = $dat_user[ 'userLastname' ] . ', ' . $dat_user[ 'userFirstname' ]; - } - - return $return; - } + ); + if ($user->num_rows > 0) + { + $dat_user = $user->fetch_assoc(); + $return = $dat_user['userLastname'] . ', ' . $dat_user['userFirstname']; + } - function fnc_getTimeByTS ( $timeStamp ) - { - $time = new DateTime ( $timeStamp ); - - return $time -> format ( 'd.m.Y - H:i:s' ); - } - - function fnc_generatePW ( $length = 8 ) - { - $passWord = ''; - - $pool = "qwertzupasdfghkyxcvbnm"; - $pool .= "23456789"; - $pool .= "WERTZUPLKJHGFDSAYXCVBNM"; - $pool .= "!§$%&/()="; - - srand ( ( double ) microtime ( ) * 1000000 ); - - for ( $i = 0 ; $i < $length ; $i++ ) - { - $passWord .= substr ( $pool , ( rand ( ) % ( strlen ( $pool ) ) ) , 1 ); - } - - return $passWord; - } - - function fnc_generateUniqueUsername ( $lastName , $firstName ) - { - global $db; - - $username = mb_strtolower ( substr ( $firstName , 0 , 1 ) , 'UTF-8' ) . mb_strtolower ( $lastName , 'UTF-8' ); - $count = $db -> query - ( - 'SELECT + return $return; +} + +function fnc_getTimeByTS($timeStamp) +{ + $time = new DateTime ($timeStamp); + + return $time->format('d.m.Y - H:i:s'); +} + +function fnc_generatePW($length = 8) +{ + $passWord = ''; + + $pool = "qwertzupasdfghkyxcvbnm"; + $pool .= "23456789"; + $pool .= "WERTZUPLKJHGFDSAYXCVBNM"; + $pool .= "!�$%&/()="; + + srand(( double )microtime() * 1000000); + + for ($i = 0; $i < $length; $i++) + { + $passWord .= substr($pool, (rand() % (strlen($pool))), 1); + } + + return $passWord; +} + +function fnc_generateUniqueUsername($lastName, $firstName) +{ + global $db; + + $username = mb_strtolower(substr($firstName, 0, 1), 'UTF-8') . mb_strtolower($lastName, 'UTF-8'); + $count = $db->query + ( + 'SELECT * FROM ' . TBL_USER . ' WHERE userUsername = "' . $username . '" OR userUsername LIKE "' . $username . '_%";' - ); - - if ( $count -> num_rows !== 0 ) - { - $username .= '_' . $count -> num_rows; - } - - return $username; - } - - function fnc_writeLog ( $entry , $params , $userId ) - { - global $db; - - $log = $db -> query - ( - 'INSERT INTO + ); + + if ($count->num_rows !== 0) + { + $username .= '_' . $count->num_rows; + } + + return $username; +} + +function fnc_writeLog($entry, $params, $userId) +{ + global $db; + + $db->query + ( + 'INSERT INTO ' . TBL_LOG . ' ( logEntry , logParams , logUser ) VALUES - ( "' . $entry . '" , "' . implode ( '::' , $params ) . '" , "' . $userId . '" );' - ); - } - - function fnc_readLog ( $entry , $params ) + ( "' . $entry . '" , "' . implode('::', $params) . '" , "' . $userId . '" );' + ); +} + +function fnc_readLog($entry, $params) +{ + if ($params !== '') + { + $arr_params = explode('::', $params); + foreach ($arr_params as $key => $value) { - if ( $params !== '' ) - { - $arr_params = explode ( '::' , $params ); - foreach ( $arr_params as $key => $value ) - { - $entry = str_replace ( '%' . $key . '%' , $value , $entry ); - } - } - return $entry; + $entry = str_replace('%' . $key . '%', $value, $entry); } - - function fnc_sendEmailToUser ( $mailId , $userId , $sessionUserId ) - { - global $db; - global $vC; - global $lang; - - $result = $db -> query - ( - 'SELECT + } + return $entry; +} + +function fnc_sendEmailToUser($mailId, $userId, $sessionUserId) +{ + global $db; + global $vC; + global $lang; + + $result = $db->query + ( + 'SELECT * FROM ' . TBL_USER . ' WHERE userId = "' . $userId . '" LIMIT 1;' - ); - $recipient = $result -> fetch_assoc ( ); - - $result = $db -> query - ( - 'SELECT + ); + $recipient = $result->fetch_assoc(); + + $result = $db->query + ( + 'SELECT * FROM ' . TBL_USER . ' WHERE userId = "' . $sessionUserId . '" LIMIT 1;' - ); - $sender = $result -> fetch_assoc ( ); - - $mailSubj = $lang[ 'mail' ][ 'subj' ][ $mailId ]; - $mailBody = $lang[ 'mail' ][ 'body' ][ $mailId ]; - - foreach ( $recipient as $key => $value ) - { - $mailBody = str_replace ( '%' . $key . '%' , $value , $mailBody ); - } - foreach ( $sender as $key => $value ) - { - $mailBody = str_replace ( '%sess_' . $key . '%' , $value , $mailBody ); - } - - require_once ( PATH_CLS . 'phpmailer/PHPMailerAutoload.php' ); - $mail = new PHPMailer; - - if ( $vC[ 'portal' ][ 'mail' ][ 'type' ] === 'smtp' ) - { - $mail -> isSMTP( ); - $mail -> Host = $vC[ 'portal' ][ 'mail' ][ 'smtpHost' ]; - $mail -> SMTPAuth = $vC[ 'portal' ][ 'mail' ][ 'smtpAuth' ]; - $mail -> Username = $vC[ 'portal' ][ 'mail' ][ 'smtpUser' ]; - $mail -> Password = $vC[ 'portal' ][ 'mail' ][ 'smtpPass' ]; - } - - $mail -> From = $vC[ 'portal' ][ 'mail' ][ 'from' ]; - $mail -> FromName = $vC[ 'portal' ][ 'mail' ][ 'fromName' ]; - $mail -> ReturnPath = $vC[ 'portal' ][ 'mail' ][ 'returnPath' ]; - $mail -> CharSet = $vC[ 'portal' ][ 'mail' ][ 'charset' ]; - $mail -> addAddress ( $recipient[ 'userEmail' ] , $recipient[ 'userFirstname' ] . ' ' . $recipient[ 'userLastname' ] ); - $mail -> isHTML ( $vC[ 'portal' ][ 'mail' ][ 'html' ] ); - - $mail -> Subject = $mailSubj; - $mail -> Body = $mailBody; - - if ( ! $mail -> send( ) ) - { - $return = $mail -> ErrorInfo; - } - else - { - $return = 'OK'; - } - return $return; - } - - function fnc_validateEmailAddress ( $emailAddress ) - { - if ( filter_var ( $emailAddress , FILTER_VALIDATE_EMAIL ) === false ) - { - return false; - } - return true; - } - - function fnc_checkUniqueEmailAddress ( $emailAddress , $userId = '' ) - { - global $db; - $return = false; - - if ( $userId !== '' ) - { - $count = $db -> query - ( - 'SELECT + ); + $sender = $result->fetch_assoc(); + + $mailSubj = $lang['mail']['subj'][$mailId]; + $mailBody = $lang['mail']['body'][$mailId]; + + foreach ($recipient as $key => $value) + { + $mailBody = str_replace('%' . $key . '%', $value, $mailBody); + } + foreach ($sender as $key => $value) + { + $mailBody = str_replace('%sess_' . $key . '%', $value, $mailBody); + } + + require_once(PATH_CLS . 'phpmailer/PHPMailerAutoload.php'); + $mail = new PHPMailer; + + if ($vC['portal']['mail']['type'] === 'smtp') + { + $mail->isSMTP(); + $mail->Host = $vC['portal']['mail']['smtpHost']; + $mail->SMTPAuth = $vC['portal']['mail']['smtpAuth']; + $mail->Username = $vC['portal']['mail']['smtpUser']; + $mail->Password = $vC['portal']['mail']['smtpPass']; + } + + $mail->From = $vC['portal']['mail']['from']; + $mail->FromName = $vC['portal']['mail']['fromName']; + $mail->ReturnPath = $vC['portal']['mail']['returnPath']; + $mail->CharSet = $vC['portal']['mail']['charset']; + $mail->addAddress($recipient['userEmail'], $recipient['userFirstname'] . ' ' . $recipient['userLastname']); + $mail->isHTML($vC['portal']['mail']['html']); + + $mail->Subject = $mailSubj; + $mail->Body = $mailBody; + + if (!$mail->send()) + { + $return = $mail->ErrorInfo; + } + else + { + $return = 'OK'; + } + return $return; +} + +function fnc_validateEmailAddress($emailAddress) +{ + if (filter_var($emailAddress, FILTER_VALIDATE_EMAIL) === false) + { + return false; + } + return true; +} + +function fnc_checkUniqueEmailAddress($emailAddress, $userId = '') +{ + global $db; + $return = false; + + if ($userId !== '') + { + $count = $db->query + ( + 'SELECT * FROM ' . TBL_USER . ' WHERE userId != "' . $userId . '" AND userEmail = "' . $emailAddress . '";' - ); - } - else - { - $count = $db -> query - ( - 'SELECT + ); + } + else + { + $count = $db->query + ( + 'SELECT * FROM ' . TBL_USER . ' WHERE userEmail = "' . $emailAddress . '";' - ); - } - if ( $count -> num_rows === 0 ) - { - $return = true; - } - return $return; - } - - function fnc_getSiteContents ( $contentParts , $prefix ) + ); + } + if ($count->num_rows === 0) + { + $return = true; + } + return $return; +} + +function fnc_getSiteContents($contentParts, $prefix) +{ + global $db; + $return = array(); + + $siteContents = explode(';', $contentParts); + foreach ($siteContents as $tmp_content) + { + if ($tmp_content === '') { - global $db; - $return = array( ); - - $siteContents = explode ( ';' , $contentParts ); - foreach ( $siteContents as $tmp_content ) - { - if ( $tmp_content === '' ) - { - continue; - } - $tmp_data = explode ( '_' , $tmp_content ); - - $id = end ( $tmp_data ); - unset ( $tmp_data[ count ( $tmp_data ) - 1 ] ); - $table = implode( '_' , $tmp_data ); - - if( $table === '' ) - { - continue; - } - - if ( $table === 'textimage' ) - { - $tmp_content = $db -> query - ( - 'SELECT + continue; + } + $tmp_data = explode('_', $tmp_content); + + $id = end($tmp_data); + unset ($tmp_data[count($tmp_data) - 1]); + $table = implode('_', $tmp_data); + + if ($table === '') + { + continue; + } + + if ($table === 'textimage') + { + $tmp_content = $db->query + ( + 'SELECT * , ' . $prefix . '_' . TBL_TEXTIMAGE . '.id AS text_image_id FROM ' . $prefix . '_' . TBL_TEXTIMAGE . ', @@ -435,31 +436,30 @@ ' . $prefix . '_' . TBL_TEXTIMAGE . '.content_image_id = ' . $prefix . '_' . TBL_IMAGE . '.id and ' . $prefix . '_' . TBL_TEXTIMAGE . '.id = ' . $id . ' LIMIT 1;' - ); - } - else - { - $tmp_content = $db -> query - ( - 'SELECT + ); + } + else + { + $tmp_content = $db->query + ( + 'SELECT * FROM ' . $prefix . '_content_' . $table . ' WHERE id = ' . $id . ';' - ); - } - - if ( $tmp_content -> num_rows === 0 ) - { - continue; - } - - $singleContent = $tmp_content -> fetch_assoc( ); - $singleContent[ 'type' ] = $table; - $return[ ] = $singleContent; - - } - return $return; + ); } -?> \ No newline at end of file + + if ($tmp_content->num_rows === 0) + { + continue; + } + + $singleContent = $tmp_content->fetch_assoc(); + $singleContent['type'] = $table; + $return[] = $singleContent; + + } + return $return; +} \ No newline at end of file diff --git a/.functions/fnc_webservices.php b/.functions/fnc_webservices.php index fedd60c..669275b 100644 --- a/.functions/fnc_webservices.php +++ b/.functions/fnc_webservices.php @@ -1,219 +1,216 @@ query('SELECT * FROM ' . $tblPrefix . '_' . TBL_NAVI . ' WHERE ' . $tblPrefix . '_navId = "' . $navId . '";'); + if ($result->num_rows !== 0) { - global $db; - - $return = $navId; - - if ( $navId !== '0' ) - { - $result = $db -> query ( 'SELECT * FROM ' . $tblPrefix . '_' . TBL_NAVI . ' WHERE ' . $tblPrefix . '_navId = "' . $navId . '";' ); - if ( $result -> num_rows !== 0 ) - { - $navPoint = $result -> fetch_assoc( ); - $return .= ' ' . fnc_getNavPathArray ( $tblPrefix , $navPoint[ $tblPrefix . '_navStart' ] ); - } - } - - return $return; + $navPoint = $result->fetch_assoc(); + $return .= ' ' . fnc_getNavPathArray($tblPrefix, $navPoint[$tblPrefix . '_navStart']); + } + } + + return $return; +} + +function fnc_buildUniqueLinkName($tblPrefix, $navStart, $navName) +{ + global $db; + + $search = array('ä', 'ö', 'ü', 'ß', ' ', '.', '/'); + $replace = array('ae', 'oe', 'ue', 'ss', '_', '', ''); + $ent = array_keys(get_html_translation_table(ENT_HTML5)); + + $return = str_replace($search, $replace, mb_strtolower($navName, mb_detect_encoding($navName))); + $return = str_replace($ent, '', $return); + + $result = $db->query('SELECT * FROM ' . $tblPrefix . '_' . TBL_NAVI . ' WHERE ' . $tblPrefix . '_navStart = "' . $navStart . '" AND ( ' . $tblPrefix . '_navLink = "' . $return . '" OR ' . $tblPrefix . '_navLink REGEXP "' . $return . '\_[0-9]" );'); + $count = $result->num_rows; + + $return = ($count > 0) + ? $return . '_' . $count + : $return; + + return $return; +} + +function fnc_buildUniqueFileName($prefix, $navId, $fileName, $fileExt) +{ + $search = array('ä', 'ö', 'ü', 'ß', ' ', '/'); + $replace = array('ae', 'oe', 'ue', 'ss', '_', ''); + $ent = array_keys(get_html_translation_table(ENT_HTML5)); + + $return = str_replace($search, $replace, mb_strtolower($fileName, mb_detect_encoding($fileName))); + $return = str_replace($ent, '', $return); + + $result = glob(PATH_MED . $prefix . '/' . $navId . '/' . $return . '*_orig.' . $fileExt); + $count = count($result); + $return = ($count > 0) + ? $return . '_' . $count + : $return; + + $return .= '.' . $fileExt; + + return $return; +} + +function fnc_checkOrigResize($filePath, $fileName_orig, $fileName_temp, $fileExt, $newSize) +{ + global $vC; + list ($width, $height) = getimagesize($filePath . $fileName_temp); + + if ($width > $newSize['width'] || $height > $newSize['height']) + { + if ($newSize['width'] / $width < $newSize['height'] / $height) + { + $newWidth = $newSize['width']; + $newHeight = $height * $newSize['width'] / $width; + } + else + { + $newWidth = $width * $newSize['height'] / $height; + $newHeight = $newSize['height']; + } + $newImage = imagecreatetruecolor($newWidth, $newHeight); + + if ($fileExt === 'jpg') + { + $origImg = imagecreatefromjpeg($filePath . $fileName_temp); + } + else if ($fileExt === 'png') + { + $origImg = imagecreatefrompng($filePath . $fileName_temp); + } + else if ($fileExt === 'gif') + { + $origImg = imagecreatefromgif($filePath . $fileName_temp); + } + else + { + return false; } - function fnc_buildUniqueLinkName ( $tblPrefix , $navStart , $navName ) - { - global $db; - - $return = false; - $search = array ( 'ä' , 'ö' , 'ü' , 'ß' , ' ' , '.' , '/' ); - $replace = array ( 'ae' , 'oe' , 'ue' , 'ss' , '_' , '' , '' ); - $ent = array_keys( get_html_translation_table( ENT_HTML5 ) ); - - $return = str_replace ( $search , $replace , mb_strtolower( $navName , mb_detect_encoding ( $navName ) ) ); - $return = str_replace ( $ent , '' , $return ); - - $result = $db -> query ( 'SELECT * FROM ' . $tblPrefix . '_' . TBL_NAVI . ' WHERE ' . $tblPrefix . '_navStart = "' . $navStart . '" AND ( ' . $tblPrefix . '_navLink = "' . $return . '" OR ' . $tblPrefix . '_navLink REGEXP "' . $return . '\_[0-9]" );' ); - $count = $result -> num_rows; + $return = imagecopyresampled($newImage, $origImg, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height); - $return = ( $count > 0 ) - ? $return . '_' . $count - : $return; - - return $return; + if ($return === true) + { + if ($fileExt === 'jpg') + { + $return = imagejpeg($newImage, $filePath . $fileName_orig, $vC['portal']['imgQuality']); + } + else if ($fileExt === 'png') + { + $return = imagepng($newImage, $filePath . $fileName_orig); + } + else if ($fileExt === 'gif') + { + $return = imagegif($newImage, $filePath . $fileName_orig); + } } - function fnc_buildUniqueFileName ( $prefix , $navId , $fileName , $fileExt ) + unlink($filePath . $fileName_temp); + return $return; + } + else + { + rename($filePath . $fileName_temp, $filePath . $fileName_orig); + } + + return true; +} + +function fnc_buildImage($filePath, $fileName, $fileExt, $newSize, $previewParams) +{ + global $vC; + + list ($width, $height) = getimagesize($filePath . $fileName); + $newImage = imagecreatetruecolor($newSize['width'], $newSize['height']); + + if ($fileExt === 'jpg') + { + $origImg = imagecreatefromjpeg($filePath . $fileName); + } + else if ($fileExt === 'png') + { + $origImg = imagecreatefrompng($filePath . $fileName); + } + else if ($fileExt === 'gif') + { + $origImg = imagecreatefromgif($filePath . $fileName); + } + else + { + return false; + } + + $return = imagecopyresampled($newImage, $origImg, 0, 0, $previewParams['previewLeft'] * ($width / $newSize['width']), $previewParams['previewTop'] * ($width / $newSize['width']), $newSize['width'], $newSize['height'], $width * ($previewParams['previewWidth'] / $newSize['width']), $newSize['height'] * ($width / $newSize['width']) * ($previewParams['previewWidth'] / $newSize['width'])); + + if ($return === true) + { + if ($fileExt === 'jpg') { - $return = false; - $search = array ( 'ä' , 'ö' , 'ü' , 'ß' , ' ' , '/' ); - $replace = array ( 'ae' , 'oe' , 'ue' , 'ss' , '_' , '' ); - $ent = array_keys( get_html_translation_table( ENT_HTML5 ) ); - - $return = str_replace ( $search , $replace , mb_strtolower( $fileName , mb_detect_encoding ( $fileName ) ) ); - $return = str_replace ( $ent , '' , $return ); - - $result = glob ( PATH_MED . $prefix . '/' . $navId . '/' . $return . '*_orig.' . $fileExt ); - $count = count ( $result ); - $return = ( $count > 0 ) - ? $return . '_' . $count - : $return; - - $return .= '.' . $fileExt; - - return $return; + $return = imagejpeg($newImage, $filePath . str_replace('_orig', '', $fileName), $vC['portal']['imgQuality']); } - - function fnc_checkOrigResize ( $filePath , $fileName_orig , $fileName_temp , $fileExt , $newSize ) + else if ($fileExt === 'png') { - global $vC; - list ( $width , $height ) = getimagesize( $filePath . $fileName_temp ); - - if ( $width > $newSize[ 'width' ] || $height > $newSize[ 'height' ] ) - { - if ( $newSize[ 'width' ] / $width < $newSize[ 'height' ] / $height ) - { - $newWidth = $newSize[ 'width' ]; - $newHeight = $height * $newSize[ 'width' ] / $width; - } - else - { - $newWidth = $width * $newSize[ 'height' ] / $height; - $newHeight = $newSize[ 'height' ]; - } - $newImage = imagecreatetruecolor ( $newWidth , $newHeight ); - - if ( $fileExt === 'jpg' ) - { - $origImg = imagecreatefromjpeg( $filePath . $fileName_temp ); - } - else if ( $fileExt === 'png' ) - { - $origImg = imagecreatefrompng( $filePath . $fileName_temp ); - } - else if ( $fileExt === 'gif' ) - { - $origImg = imagecreatefromgif( $filePath . $fileName_temp ); - } - else - { - return false; - } - - $return = imagecopyresampled( $newImage , $origImg , 0 , 0 , 0 , 0 , $newWidth , $newHeight , $width , $height ); - - if ( $return === true ) - { - if ( $fileExt === 'jpg' ) - { - $return = imagejpeg( $newImage , $filePath . $fileName_orig , $vC[ 'portal' ][ 'imgQuality' ] ); - } - else if ( $fileExt === 'png' ) - { - $return = imagepng( $newImage , $filePath . $fileName_orig ); - } - else if ( $fileExt === 'gif' ) - { - $return = imagegif( $newImage , $filePath . $fileName_orig ); - } - } - - unlink ( $filePath . $fileName_temp ); - return $return; - } - else - { - rename ( $filePath . $fileName_temp , $filePath . $fileName_orig ); - } - - return true; + $return = imagepng($newImage, $filePath . str_replace('_orig', '', $fileName)); } - - function fnc_buildImage ( $filePath , $fileName , $fileExt , $newSize , $previewParams ) + else if ($fileExt === 'gif') { - global $vC; - - list ( $width , $height ) = getimagesize( $filePath . $fileName ); - $newImage = imagecreatetruecolor ( $newSize[ 'width' ] , $newSize[ 'height' ] ); - - if ( $fileExt === 'jpg' ) - { - $origImg = imagecreatefromjpeg( $filePath . $fileName ); - } - else if ( $fileExt === 'png' ) - { - $origImg = imagecreatefrompng( $filePath . $fileName ); - } - else if ( $fileExt === 'gif' ) - { - $origImg = imagecreatefromgif( $filePath . $fileName ); - } - else - { - return false; - } - - $return = imagecopyresampled( $newImage , $origImg , 0 , 0 , $previewParams[ 'previewLeft' ] * ( $width / $newSize[ 'width' ] ) , $previewParams[ 'previewTop' ] * ( $width / $newSize[ 'width' ] ) , $newSize[ 'width' ] , $newSize[ 'height' ] , $width * ( $previewParams[ 'previewWidth' ] / $newSize[ 'width' ] ) , $newSize[ 'height' ] * ( $width / $newSize[ 'width' ] ) * ( $previewParams[ 'previewWidth' ] / $newSize[ 'width' ] ) ); - - if ( $return === true ) - { - if ( $fileExt === 'jpg' ) - { - $return = imagejpeg( $newImage , $filePath . str_replace ( '_orig' , '' , $fileName ) , $vC[ 'portal' ][ 'imgQuality' ] ); - } - else if ( $fileExt === 'png' ) - { - $return = imagepng( $newImage , $filePath . str_replace ( '_orig' , '' , $fileName ) ); - } - else if ( $fileExt === 'gif' ) - { - $return = imagegif( $newImage , $filePath . str_replace ( '_orig' , '' , $fileName ) ); - } - } - - return $return; + $return = imagegif($newImage, $filePath . str_replace('_orig', '', $fileName)); } - - function fnc_buildThumbnail ( $filePath , $fileName , $fileExt , $newSize ) + } + + return $return; +} + +function fnc_buildThumbnail($filePath, $fileName, $fileExt, $newSize) +{ + global $vC; + + list ($width, $height) = getimagesize($filePath . $fileName); + $newImage = imagecreatetruecolor($newSize['width'], $newSize['height']); + + if ($fileExt === 'jpg') + { + $origImg = imagecreatefromjpeg($filePath . $fileName); + } + else if ($fileExt === 'png') + { + $origImg = imagecreatefrompng($filePath . $fileName); + } + else if ($fileExt === 'gif') + { + $origImg = imagecreatefromgif($filePath . $fileName); + } + else + { + return false; + } + + $return = imagecopyresampled($newImage, $origImg, 0, 0, 0, 0, $newSize['width'], $newSize['height'], $width, $height); + + if ($return === true) + { + if ($fileExt === 'jpg') { - global $vC; - - list ( $width , $height ) = getimagesize( $filePath . $fileName ); - $newImage = imagecreatetruecolor ( $newSize[ 'width' ] , $newSize[ 'height' ] ); - - if ( $fileExt === 'jpg' ) - { - $origImg = imagecreatefromjpeg( $filePath . $fileName ); - } - else if ( $fileExt === 'png' ) - { - $origImg = imagecreatefrompng( $filePath . $fileName ); - } - else if ( $fileExt === 'gif' ) - { - $origImg = imagecreatefromgif( $filePath . $fileName ); - } - else - { - return false; - } - - $return = imagecopyresampled( $newImage , $origImg , 0 , 0 , 0 , 0 , $newSize[ 'width' ] , $newSize[ 'height' ] , $width , $height ); - - if ( $return === true ) - { - if ( $fileExt === 'jpg' ) - { - $return = imagejpeg( $newImage , $filePath . str_replace ( '.' . $fileExt , '_thumb.' . $fileExt , $fileName ) , $vC[ 'portal' ][ 'imgQuality' ] ); - } - else if ( $fileExt === 'png' ) - { - $return = imagepng( $newImage , $filePath . str_replace ( '.' . $fileExt , '_thumb.' . $fileExt , $fileName ) ); - } - else if ( $fileExt === 'gif' ) - { - $return = imagegif( $newImage , $filePath . str_replace ( '.' . $fileExt , '_thumb.' . $fileExt , $fileName ) ); - } - } - - return $return; + $return = imagejpeg($newImage, $filePath . str_replace('.' . $fileExt, '_thumb.' . $fileExt, $fileName), $vC['portal']['imgQuality']); } -?> \ No newline at end of file + else if ($fileExt === 'png') + { + $return = imagepng($newImage, $filePath . str_replace('.' . $fileExt, '_thumb.' . $fileExt, $fileName)); + } + else if ($fileExt === 'gif') + { + $return = imagegif($newImage, $filePath . str_replace('.' . $fileExt, '_thumb.' . $fileExt, $fileName)); + } + } + + return $return; +} \ No newline at end of file diff --git a/.helpers/berichte2chronik.php b/.helpers/berichte2chronik.php index d7aeb71..714e68f 100644 --- a/.helpers/berichte2chronik.php +++ b/.helpers/berichte2chronik.php @@ -1,79 +1,77 @@ set_charset ( 'utf8' ); +$siteId = 20; +$saisonStart = array(2013, 2012, 2011, 2010, 2009); +$bereichArray = array('Frauen', 'Herren'); +$chronikIds = array(array(36, 42), array(48, 54)); +$teams = array(array(1, 2), array(1, 2)); +$teamNames = array(array('Verbandsliga', 'Bezirksliga'), array('Kreisliga A Alb', 'Reserve')); +$navPoints = array('Spielberichte', 'Tabelle', 'Mannschaft'); +$navSpecial = array('Y', 'Y', 'N'); +$navType = array('uebersicht', 'widget', null); - $yearOrder = 1; - - foreach ( $saisonStart as $startYear ) + +define('PATH_ROOT', '../'); +include_once(PATH_ROOT . '.config/config_global.php'); +include_once(PATH_FNC . 'fnc_portal.php'); + +$db = new mysqli (DB_HOST, DB_USER, DB_PASS, DB_NAME); +$db->set_charset('utf8'); + +$yearOrder = 1; + +foreach ($saisonStart as $startYear) +{ + $startDate = $startYear . '-08-01'; + $endDate = ($startYear + 1) . '-07-31'; + + foreach ($bereichArray as $key => $bereich) + { + foreach ($teams[$key] as $teamKey => $nummer) { - $startDate = $startYear . '-08-01'; - $endDate = ( $startYear + 1 ) . '-07-31'; + $berichte = $db->query('SELECT * FROM berichte WHERE Datum >= "' . $startDate . '" AND Datum <= "' . $endDate . '" AND Bereich = "' . $bereich . '" AND Nummer = "' . $nummer . '" ORDER BY Datum DESC;'); + $count = $berichte->num_rows; + $i = 0; + $teamName = $teamNames[$key][$teamKey]; + $chronikId = $chronikIds[$key][$teamKey]; - foreach ( $bereichArray as $key => $bereich ) + if ($count > 0) + { + $insertTeam = $db->query('INSERT INTO svjf_navi VALUES ( NULL , "' . $chronikId . '" , "' . $db->real_escape_string($teamName . ' ' . $startYear . '/' . ($startYear + 1)) . '" , "" , "' . mb_strtolower($teamName, 'UTF-8') . '_' . $startYear . '" , "Y" , "' . $yearOrder . '" , "N" , NULL );'); + $teamId = $db->insert_id; + $updateTeam = $db->query('UPDATE svjf_navi SET svjf_navTarget = "index.php?siteId=' . $siteId . '&navId=' . $teamId . '" WHERE svjf_navId = "' . $teamId . '";'); + + foreach ($navPoints as $navKey => $navPoint) { - foreach ( $teams[ $key ] as $teamKey => $nummer ) - { - $berichte = $db -> query ( 'SELECT * FROM berichte WHERE Datum >= "' . $startDate . '" AND Datum <= "' . $endDate . '" AND Bereich = "' . $bereich . '" AND Nummer = "' . $nummer . '" ORDER BY Datum DESC;' ); - $count = $berichte -> num_rows; - $i = 0; - $teamName = $teamNames[ $key ][ $teamKey ]; - $chronikId = $chronikIds[ $key ][ $teamKey ]; - - if ( $count > 0 ) - { - $insertTeam = $db -> query ( 'INSERT INTO svjf_navi VALUES ( NULL , "' . $chronikId . '" , "' . $db -> real_escape_string ( $teamName . ' ' . $startYear . '/' . ( $startYear + 1 ) ) . '" , "" , "' . mb_strtolower ( $teamName , 'UTF-8' ) . '_' . $startYear . '" , "Y" , "' . $yearOrder . '" , "N" , NULL );' ); - $teamId = $db -> insert_id; - $updateTeam = $db -> query ( 'UPDATE svjf_navi SET svjf_navTarget = "index.php?siteId=' . $siteId . '&navId=' . $teamId . '" WHERE svjf_navId = "' . $teamId . '";' ); - - foreach ( $navPoints as $navKey => $navPoint ) - { - $insertAreas = $db -> query ( 'INSERT INTO svjf_navi VALUES ( NULL , "' . $teamId . '" , "' . $navPoint . '" , "" , "' . mb_strtolower ( $navPoint , 'UTF-8' ) . '" , "Y" , "' . ( $navKey + 1 ) . '" , "' . $navSpecial[ $navKey ] . '" , "' . $navType[ $navKey ] . '" );' ); - $newNavStart = $db -> insert_id; - $updateAreas = $db -> query ( 'UPDATE svjf_navi SET svjf_navTarget = "index.php?siteId=' . $siteId . '&navId=' . $newNavStart . '" WHERE svjf_navId = "' . $newNavStart . '";' ); - - if ( $navPoint = 'Spielberichte' ) - { - while ( $bericht = $berichte -> fetch_assoc ( ) ) - { - foreach ( $bericht as $tmp_key => $value ) - { - $bericht[ $tmp_key ] = $db -> real_escape_string ( $value ); - } - $insert = $db -> query ( 'INSERT INTO svjf_navi VALUES ( NULL , "' . $newNavStart . '" , "' . ( $count - $i ) . '. Spieltag" , "" , "spieltag_' . ( $count - $i ) . '" , "Y" , "' . ( $i + 1 ) . '" , "Y" , "spielbericht" );' ); - $navId = $db -> insert_id; - $update = $db -> query ( 'UPDATE svjf_navi SET svjf_navTarget = "index.php?siteId=' . $siteId . '&navId=' . $navId . '" WHERE svjf_navId = "' . $navId . '";' ); - $insert = $db -> query ( 'INSERT INTO svjf_spielbericht VALUES ( "' . $navId . '" , "' . $bericht[ 'Head' ] . '" , "' . $bericht[ 'Heim' ] . '" , "' . $bericht[ 'ErgH' ] . '" , "' . $bericht[ 'ErgG' ] . '" , "' . $bericht[ 'HalbH' ] . '" , "' . $bericht[ 'HalbG' ] . '" , "' . $bericht[ 'Gegner' ] . '" , "' . $bericht[ 'Text' ] . '" , "' . $bericht[ 'Bild' ] . '" , "' . $bericht[ 'Spieler' ] . '" , "' . $bericht[ 'Tore' ] . '" , "' . $bericht[ 'Besonderes' ] . '" , "' . $bericht[ 'Vorschau' ] . '" , "' . $bericht[ 'Datum' ] . '" );' ); - - $i++; - } - } - else - { - /* TODO: svjf_content und andere Parts schreiben */ - } - } + $insertAreas = $db->query('INSERT INTO svjf_navi VALUES ( NULL , "' . $teamId . '" , "' . $navPoint . '" , "" , "' . mb_strtolower($navPoint, 'UTF-8') . '" , "Y" , "' . ($navKey + 1) . '" , "' . $navSpecial[$navKey] . '" , "' . $navType[$navKey] . '" );'); + $newNavStart = $db->insert_id; + $updateAreas = $db->query('UPDATE svjf_navi SET svjf_navTarget = "index.php?siteId=' . $siteId . '&navId=' . $newNavStart . '" WHERE svjf_navId = "' . $newNavStart . '";'); - } + if ($navPoint = 'Spielberichte') + { + while ($bericht = $berichte->fetch_assoc()) + { + foreach ($bericht as $tmp_key => $value) + { + $bericht[$tmp_key] = $db->real_escape_string($value); + } + $insert = $db->query('INSERT INTO svjf_navi VALUES ( NULL , "' . $newNavStart . '" , "' . ($count - $i) . '. Spieltag" , "" , "spieltag_' . ($count - $i) . '" , "Y" , "' . ($i + 1) . '" , "Y" , "spielbericht" );'); + $navId = $db->insert_id; + $update = $db->query('UPDATE svjf_navi SET svjf_navTarget = "index.php?siteId=' . $siteId . '&navId=' . $navId . '" WHERE svjf_navId = "' . $navId . '";'); + $insert = $db->query('INSERT INTO svjf_spielbericht VALUES ( "' . $navId . '" , "' . $bericht['Head'] . '" , "' . $bericht['Heim'] . '" , "' . $bericht['ErgH'] . '" , "' . $bericht['ErgG'] . '" , "' . $bericht['HalbH'] . '" , "' . $bericht['HalbG'] . '" , "' . $bericht['Gegner'] . '" , "' . $bericht['Text'] . '" , "' . $bericht['Bild'] . '" , "' . $bericht['Spieler'] . '" , "' . $bericht['Tore'] . '" , "' . $bericht['Besonderes'] . '" , "' . $bericht['Vorschau'] . '" , "' . $bericht['Datum'] . '" );'); + + $i++; } + } + else + { + /* TODO: svjf_content und andere Parts schreiben */ + } } - - $yearOrder++; + + } } - -?> \ No newline at end of file + } + + $yearOrder++; +} \ No newline at end of file diff --git a/.helpers/einzelne_berichte2navPoint.php b/.helpers/einzelne_berichte2navPoint.php index e1b3268..0581ad0 100644 --- a/.helpers/einzelne_berichte2navPoint.php +++ b/.helpers/einzelne_berichte2navPoint.php @@ -1,37 +1,36 @@ 2011 , 'end' => 2012 ); - $bereich = 'Frauen'; - $nummer = '1'; - $newNavStart = '277'; - $siteId = '20'; - - - $startDate = $saison[ 'start' ] . '-08-01'; - $endDate = $saison[ 'end' ] . '-07-31'; - - define ( 'PATH_ROOT' , '../' ); - include_once ( PATH_ROOT . '.config/config_global.php' ); - include_once ( PATH_FNC . 'fnc_portal.php' ); - - $db = new mysqli ( DB_HOST , DB_USER , DB_PASS , DB_NAME ); - $db -> set_charset ( 'utf8' ); +$saison = array('start' => 2011, 'end' => 2012); +$bereich = 'Frauen'; +$nummer = '1'; +$newNavStart = '277'; +$siteId = '20'; - $berichte = $db -> query ( 'SELECT * FROM berichte WHERE Datum >= "' . $startDate . '" AND Datum <= "' . $endDate . '" AND Bereich = "' . $bereich . '" AND Nummer = "' . $nummer . '" ORDER BY Datum DESC;' ); - $count = $berichte -> num_rows; - $i = 0; - - while ( $bericht = $berichte -> fetch_assoc ( ) ) - { - foreach ( $bericht as $key => $value ) - { - $bericht[ $key ] = $db -> real_escape_string ( $value ); - } - $insert = $db -> query ( 'INSERT INTO svjf_navi VALUES ( NULL , "' . $newNavStart . '" , "' . ( $count - $i ) . '. Spieltag" , "" , "spieltag_' . ( $count - $i ) . '" , "Y" , "' . ( $i + 1 ) . '" , "Y" , "spielbericht" );' ); - $navId = $db -> insert_id; - $update = $db -> query ( 'UPDATE svjf_navi SET svjf_navTarget = "index.php?siteId=' . $siteId . '&navId=' . $navId . '" WHERE svjf_navId = "' . $navId . '";' ); - $insert = $db -> query ( 'INSERT INTO svjf_spielbericht VALUES ( "' . $navId . '" , "' . $bericht[ 'Head' ] . '" , "' . $bericht[ 'Heim' ] . '" , "' . $bericht[ 'ErgH' ] . '" , "' . $bericht[ 'ErgG' ] . '" , "' . $bericht[ 'HalbH' ] . '" , "' . $bericht[ 'HalbG' ] . '" , "' . $bericht[ 'Gegner' ] . '" , "' . $bericht[ 'Text' ] . '" , "' . $bericht[ 'Bild' ] . '" , "' . $bericht[ 'Spieler' ] . '" , "' . $bericht[ 'Tore' ] . '" , "' . $bericht[ 'Besonderes' ] . '" , "' . $bericht[ 'Vorschau' ] . '" , "' . $bericht[ 'Datum' ] . '" );' ); - - $i++; - } -?> \ No newline at end of file + +$startDate = $saison['start'] . '-08-01'; +$endDate = $saison['end'] . '-07-31'; + +define('PATH_ROOT', '../'); +include_once(PATH_ROOT . '.config/config_global.php'); +include_once(PATH_FNC . 'fnc_portal.php'); + +$db = new mysqli (DB_HOST, DB_USER, DB_PASS, DB_NAME); +$db->set_charset('utf8'); + +$berichte = $db->query('SELECT * FROM berichte WHERE Datum >= "' . $startDate . '" AND Datum <= "' . $endDate . '" AND Bereich = "' . $bereich . '" AND Nummer = "' . $nummer . '" ORDER BY Datum DESC;'); +$count = $berichte->num_rows; +$i = 0; + +while ($bericht = $berichte->fetch_assoc()) +{ + foreach ($bericht as $key => $value) + { + $bericht[$key] = $db->real_escape_string($value); + } + $insert = $db->query('INSERT INTO svjf_navi VALUES ( NULL , "' . $newNavStart . '" , "' . ($count - $i) . '. Spieltag" , "" , "spieltag_' . ($count - $i) . '" , "Y" , "' . ($i + 1) . '" , "Y" , "spielbericht" );'); + $navId = $db->insert_id; + $update = $db->query('UPDATE svjf_navi SET svjf_navTarget = "index.php?siteId=' . $siteId . '&navId=' . $navId . '" WHERE svjf_navId = "' . $navId . '";'); + $insert = $db->query('INSERT INTO svjf_spielbericht VALUES ( "' . $navId . '" , "' . $bericht['Head'] . '" , "' . $bericht['Heim'] . '" , "' . $bericht['ErgH'] . '" , "' . $bericht['ErgG'] . '" , "' . $bericht['HalbH'] . '" , "' . $bericht['HalbG'] . '" , "' . $bericht['Gegner'] . '" , "' . $bericht['Text'] . '" , "' . $bericht['Bild'] . '" , "' . $bericht['Spieler'] . '" , "' . $bericht['Tore'] . '" , "' . $bericht['Besonderes'] . '" , "' . $bericht['Vorschau'] . '" , "' . $bericht['Datum'] . '" );'); + + $i++; +} \ No newline at end of file diff --git a/.helpers/fehlende_content_elemente.php b/.helpers/fehlende_content_elemente.php index 88fd8ac..3e4f717 100644 --- a/.helpers/fehlende_content_elemente.php +++ b/.helpers/fehlende_content_elemente.php @@ -1,69 +1,67 @@ set_charset( 'utf8' ); +/* Array mit NavIds */ +$nav_ids = array(); - $r_navi = $db -> query - ( - 'SELECT +define('PATH_ROOT', '../'); +include_once(PATH_ROOT . '.config/config_global.php'); + +$db = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME); +$db->set_charset('utf8'); + +$r_navi = $db->query +( + 'SELECT * FROM ' . $prefix . TBL_NAVI . ' WHERE ' . $prefix . 'specialType = "content";' - ); - - while( $navi = $r_navi -> fetch_assoc( ) ) - { - $r_content = $db -> query - ( - 'SELECT +); + +while ($navi = $r_navi->fetch_assoc()) +{ + $r_content = $db->query + ( + 'SELECT * FROM - ' . $prefix . TBL_CONTENT . ' + ' . $prefix . TBL_CONTENT . ' WHERE - siteId = "' . $navi[ $prefix . 'navId' ] . '";' - ); - - if ( $r_content -> num_rows === 0 ) - { - $head = $db -> query - ( - 'INSERT INTO + siteId = "' . $navi[$prefix . 'navId'] . '";' + ); + + if ($r_content->num_rows === 0) + { + $head = $db->query + ( + 'INSERT INTO ' . $prefix . TBL_HEAD . ' ( content ) VALUES - ( "' . $navi[ $prefix . 'navName' ] . '" );' - ); - $h_id = $db -> insert_id; - $text = $db -> query - ( - 'INSERT INTO + ( "' . $navi[$prefix . 'navName'] . '" );' + ); + $h_id = $db->insert_id; + $text = $db->query + ( + 'INSERT INTO ' . $prefix . TBL_TEXT . ' ( content ) VALUES ( "Hier fehlt ein sinnvoller neuer Text" );' - ); - $t_id = $db -> insert_id; - - $cont = $db -> query - ( - 'INSERT INTO + ); + $t_id = $db->insert_id; + + $cont = $db->query + ( + 'INSERT INTO ' . $prefix . TBL_CONTENT . ' ( siteId , siteContents ) VALUES - ( "' . $navi[ $prefix . 'navId' ] . '" , "headline_' . $h_id . ';text_' . $t_id . '" );' - ); - } - } - -?> \ No newline at end of file + ( "' . $navi[$prefix . 'navId'] . '" , "headline_' . $h_id . ';text_' . $t_id . '" );' + ); + } +} \ No newline at end of file diff --git a/.helpers/jugend_teams.php b/.helpers/jugend_teams.php index 83a7435..56a1218 100644 --- a/.helpers/jugend_teams.php +++ b/.helpers/jugend_teams.php @@ -1,36 +1,34 @@ array ( 'A SGM Mähringen/Jungingen/Lehr' , 'B SGM Jungingen/Lehr/Mähringen' , 'C SGM Lehr/Jungingen/Mähringen' , 'D1/2 SVJ Jg. 2001/2002' , 'E1/2 SVJ Jg. 2003' , 'E3/4 SVJ Jg. 2004' , 'F1 SVJ Jg. 2005' , 'F2/3 SVJ Jg. 2006' , 'Bambini SG Lehr/Mähringen ab 2007' , 'Bambini SV Jungingen ab 2007' ) , 14 => array ( 'B SV Jungingen Jg. 1997/1998' , 'D SV Jungingen Jg. 2001/02' , 'E SV Jungingen bis Jg. 2003' ) ); - define ( 'PATH_ROOT' , '../' ); - include_once ( PATH_ROOT . '.config/config_global.php' ); - $db = new mysqli ( DB_HOST , DB_USER , DB_PASS , DB_NAME ); - $db -> set_charset ( 'utf8' ); +$siteId = 20; +$prefix = 'svjf'; +$navArray = array(13 => array('A SGM Mähringen/Jungingen/Lehr', 'B SGM Jungingen/Lehr/Mähringen', 'C SGM Lehr/Jungingen/Mähringen', 'D1/2 SVJ Jg. 2001/2002', 'E1/2 SVJ Jg. 2003', 'E3/4 SVJ Jg. 2004', 'F1 SVJ Jg. 2005', 'F2/3 SVJ Jg. 2006', 'Bambini SG Lehr/Mähringen ab 2007', 'Bambini SV Jungingen ab 2007'), 14 => array('B SV Jungingen Jg. 1997/1998', 'D SV Jungingen Jg. 2001/02', 'E SV Jungingen bis Jg. 2003')); +define('PATH_ROOT', '../'); +include_once(PATH_ROOT . '.config/config_global.php'); +$db = new mysqli (DB_HOST, DB_USER, DB_PASS, DB_NAME); +$db->set_charset('utf8'); - $i = 1; - foreach ( $navArray as $navStart => $navArray ) - { - foreach ( $navArray as $navName ) - { - $navLink = createLinkFromName ( $navName ); - $insert = $db -> query ( 'INSERT INTO ' . $prefix . '_navi VALUES ( NULL , "' . $navStart . '" , "' . $navName . '" , "" , "' . $navLink . '" , "Y" , "' . $i . '" , "N" , NULL );' ); - $navId = $db -> insert_id; - $update = $db -> query ( 'UPDATE svjf_navi SET svjf_navTarget = "index.php?siteId=' . $siteId . '&navId=' . $navId . '" WHERE svjf_navId = "' . $navId . '";' ); - - ++$i; - } - } - - function createLinkFromName ( $name ) - { - $search = array ( 'ä' , 'ö' , 'ü' , '.' , ' ' ); - $replace = array ( 'ae' , 'oe' , 'ue' , '' , '_' ); - - $newName = mb_strtolower ( $name , 'UTF-8' ); - $link = str_replace ( $search , $replace , $newName ); - - return $link; - } - -?> \ No newline at end of file +$i = 1; +foreach ($navArray as $navStart => $navArray) +{ + foreach ($navArray as $navName) + { + $navLink = createLinkFromName($navName); + $insert = $db->query('INSERT INTO ' . $prefix . '_navi VALUES ( NULL , "' . $navStart . '" , "' . $navName . '" , "" , "' . $navLink . '" , "Y" , "' . $i . '" , "N" , NULL );'); + $navId = $db->insert_id; + $update = $db->query('UPDATE svjf_navi SET svjf_navTarget = "index.php?siteId=' . $siteId . '&navId=' . $navId . '" WHERE svjf_navId = "' . $navId . '";'); + + ++$i; + } +} + +function createLinkFromName($name) +{ + $search = array('ä', 'ö', 'ü', '.', ' '); + $replace = array('ae', 'oe', 'ue', '', '_'); + + $newName = mb_strtolower($name, 'UTF-8'); + $link = str_replace($search, $replace, $newName); + + return $link; +} \ No newline at end of file diff --git a/.helpers/team_untermenu.php b/.helpers/team_untermenu.php index 1bb4488..40481f1 100644 --- a/.helpers/team_untermenu.php +++ b/.helpers/team_untermenu.php @@ -1,39 +1,37 @@ set_charset ( 'utf8' ); +$siteId = 20; +$prefix = 'svjf'; +$navArray = array(7, 8, 10, 11); +$newArray = array('Spielberichte', 'Tabelle', 'Mannschaft', 'Aktuelles', 'Training'); - foreach ( $navArray as $navStart ) - { - $i = 1; - foreach ( $newArray as $navName ) - { - $navLink = createLinkFromName ( $navName ); - - $insert = $db -> query ( 'INSERT INTO ' . $prefix . '_navi VALUES ( NULL , "' . $navStart . '" , "' . $navName . '" , "" , "' . $navLink . '" , "Y" , "' . $i . '" , "N" , NULL );' ); - $navId = $db -> insert_id; - $update = $db -> query ( 'UPDATE svjf_navi SET svjf_navTarget = "index.php?siteId=' . $siteId . '&navId=' . $navId . '" WHERE svjf_navId = "' . $navId . '";' ); - - ++$i; - } - } - - function createLinkFromName ( $name ) - { - $search = array ( 'ä' , 'ö' , 'ü' , '.' , ' ' ); - $replace = array ( 'ae' , 'oe' , 'ue' , '' , '_' ); - - $newName = mb_strtolower ( $name , 'UTF-8' ); - $link = str_replace ( $search , $replace , $newName ); - - return $link; - } - -?> \ No newline at end of file +define('PATH_ROOT', '../'); +include_once(PATH_ROOT . '.config/config_global.php'); +$db = new mysqli (DB_HOST, DB_USER, DB_PASS, DB_NAME); +$db->set_charset('utf8'); + +foreach ($navArray as $navStart) +{ + $i = 1; + foreach ($newArray as $navName) + { + $navLink = createLinkFromName($navName); + + $insert = $db->query('INSERT INTO ' . $prefix . '_navi VALUES ( NULL , "' . $navStart . '" , "' . $navName . '" , "" , "' . $navLink . '" , "Y" , "' . $i . '" , "N" , NULL );'); + $navId = $db->insert_id; + $update = $db->query('UPDATE svjf_navi SET svjf_navTarget = "index.php?siteId=' . $siteId . '&navId=' . $navId . '" WHERE svjf_navId = "' . $navId . '";'); + + ++$i; + } +} + +function createLinkFromName($name) +{ + $search = array('ä', 'ö', 'ü', '.', ' '); + $replace = array('ae', 'oe', 'ue', '', '_'); + + $newName = mb_strtolower($name, 'UTF-8'); + $link = str_replace($search, $replace, $newName); + + return $link; +} \ No newline at end of file diff --git a/.helpers/update_user_table.php b/.helpers/update_user_table.php index 05c2f65..313ae1b 100644 --- a/.helpers/update_user_table.php +++ b/.helpers/update_user_table.php @@ -1,37 +1,33 @@ set_charset ( 'utf8' ); - - $users = $db -> query ( 'SELECT * FROM users;' ); - - while ( $dat_user = $users -> fetch_assoc ( ) ) - { - $update = ''; - - if ( $dat_user [ 'userUsername' ] === '' ) - { - $update .= 'userUsername = "' . mb_strtolower ( substr ( $dat_user [ 'userFirstname' ] , 0 , 1 ) . $dat_user [ 'userLastname' ] ) . '"'; - } - if ( $dat_user [ 'userPasswordOrg' ] === '' ) - { - $update .= ( $update === '' ) - ? '' - : ' , '; - $newPassword = fnc_generatePW ( ); - $update .= 'userPasswordOrgCrypt = "' . md5 ( $newPassword ) . '" , userPasswordOrg = "' . $newPassword . '"'; - } - - if ( $update !== '' ) - { - $user_update = $db -> query ( 'UPDATE users SET ' . $update . ' WHERE userId = "' . $dat_user [ 'userId' ] . '" LIMIT 1;' ); - } - } +define('PATH_ROOT', '../'); +include_once(PATH_ROOT . '.config/config_global.php'); +include_once(PATH_FNC . 'fnc_portal.php'); +$db = new mysqli (DB_HOST, DB_USER, DB_PASS, DB_NAME); +$db->set_charset('utf8'); +$users = $db->query('SELECT * FROM users;'); -?> \ No newline at end of file +while ($dat_user = $users->fetch_assoc()) +{ + $update = ''; + + if ($dat_user ['userUsername'] === '') + { + $update .= 'userUsername = "' . mb_strtolower(substr($dat_user ['userFirstname'], 0, 1) . $dat_user ['userLastname']) . '"'; + } + if ($dat_user ['userPasswordOrg'] === '') + { + $update .= ($update === '') + ? '' + : ' , '; + $newPassword = fnc_generatePW(); + $update .= 'userPasswordOrgCrypt = "' . md5($newPassword) . '" , userPasswordOrg = "' . $newPassword . '"'; + } + + if ($update !== '') + { + $user_update = $db->query('UPDATE users SET ' . $update . ' WHERE userId = "' . $dat_user ['userId'] . '" LIMIT 1;'); + } +} \ No newline at end of file diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..8eb2dd0 --- /dev/null +++ b/.htaccess @@ -0,0 +1,16 @@ + + + Options -MultiViews + + + RewriteEngine On + + # Redirect Trailing Slashes If Not A Folder... + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule ^(.*)/$ /$1 [L,R=301] + + # Handle Front Controller... + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^ index.php [L] + diff --git a/.includes/global_header.php b/.includes/global_header.php index 5f57052..dedef8d 100644 --- a/.includes/global_header.php +++ b/.includes/global_header.php @@ -1,37 +1,34 @@ set_charset ( 'utf8' ); +/* Datenbank-Verbindung herstellen */ +$db = new mysqli (DB_HOST, DB_USER, DB_PASS, DB_NAME); +$db->set_charset('utf8'); - /* Sprachdateien einbinden */ - if ( ! isset ( $_SESSION[ 'sess_loginLang' ] ) || empty ( $_SESSION[ 'sess_loginLang' ] ) ) +/* Sprachdateien einbinden */ +if (!isset ($_SESSION['sess_loginLang']) || empty ($_SESSION['sess_loginLang'])) +{ + include_once(PATH_LANG . 'lang_' . $vC['portal']['languages'][0] . '.php'); + if (isset ($vC['portal']['address']) && file_exists(PATH_LANG . $vC['portal']['address'] . '/lang_' . $vC['portal']['languages'][0] . '.php')) + { + include_once(PATH_LANG . $vC['portal']['address'] . '/lang_' . $vC['portal']['languages'][0] . '.php'); + } +} +else +{ + if (file_exists(PATH_LANG . 'lang_' . $_SESSION['sess_loginLang'] . '.php')) + { + include_once(PATH_LANG . 'lang_' . $_SESSION['sess_loginLang'] . '.php'); + if (isset ($vC['portal']['address']) && file_exists(PATH_LANG . $vC['portal']['address'] . '/lang_' . $_SESSION['sess_loginLang'] . '.php')) { - include_once ( PATH_LANG . 'lang_' . $vC[ 'portal' ][ 'languages' ][ 0 ] . '.php' ); - if ( isset ( $vC[ 'portal' ][ 'address' ] ) && file_exists ( PATH_LANG . $vC[ 'portal' ][ 'address' ] . '/lang_' . $vC[ 'portal' ][ 'languages' ][ 0 ] . '.php' ) ) - { - include_once ( PATH_LANG . $vC[ 'portal' ][ 'address' ] . '/lang_' . $vC[ 'portal' ][ 'languages' ][ 0 ] . '.php' ); - } + include_once(PATH_LANG . $vC['portal']['address'] . '/lang_' . $_SESSION['sess_loginLang'] . '.php'); } + } else + { + include_once(PATH_LANG . 'lang_' . $vC['portal']['languages'][0] . '.php'); + if (isset ($vC['portal']['address']) && file_exists(PATH_LANG . $vC['portal']['address'] . '/lang_' . $vC['portal']['languages'][0] . '.php')) { - if ( file_exists ( PATH_LANG . 'lang_' . $_SESSION[ 'sess_loginLang' ] . '.php' ) ) - { - include_once ( PATH_LANG . 'lang_' . $_SESSION[ 'sess_loginLang' ] . '.php' ); - if ( isset ( $vC[ 'portal' ][ 'address' ] ) && file_exists ( PATH_LANG . $vC[ 'portal' ][ 'address' ] . '/lang_' . $_SESSION[ 'sess_loginLang' ] . '.php' ) ) - { - include_once ( PATH_LANG . $vC[ 'portal' ][ 'address' ] . '/lang_' . $_SESSION[ 'sess_loginLang' ] . '.php' ); - } - } - else - { - include_once ( PATH_LANG . 'lang_' . $vC[ 'portal' ][ 'languages' ][ 0 ] . '.php' ); - if ( isset ( $vC[ 'portal' ][ 'address' ] ) && file_exists ( PATH_LANG . $vC[ 'portal' ][ 'address' ] . '/lang_' . $vC[ 'portal' ][ 'languages' ][ 0 ] . '.php' ) ) - { - include_once ( PATH_LANG . $vC[ 'portal' ][ 'address' ] . '/lang_' . $vC[ 'portal' ][ 'languages' ][ 0 ] . '.php' ); - } - } + include_once(PATH_LANG . $vC['portal']['address'] . '/lang_' . $vC['portal']['languages'][0] . '.php'); } - - -?> \ No newline at end of file + } +} \ No newline at end of file diff --git a/.includes/website_header.php b/.includes/website_header.php index b4b0801..b35194e 100644 --- a/.includes/website_header.php +++ b/.includes/website_header.php @@ -1,47 +1,45 @@ '; - var_dump ( $pathWay ); - var_dump ( $arr_rights ); - - echo ''; - } - - } - } + $editable = true; } + else + { + if ($_SESSION['sess_' . $prefix] === '') + { + $editable = false; + } + else + { + $arr_rights = explode(';', $_SESSION['sess_' . $prefix]); + $pathWay = fnc_createPathHome($prefix, '7'); + foreach ($arr_rights as $navRight) + { + $navId = str_replace($prefix . '_', '', $navRight); + var_dump($navId); + } + echo '
';
+				var_dump($pathWay);
+				var_dump($arr_rights);
 
-?>
\ No newline at end of file
+				echo '
'; + } + + } + } +} \ No newline at end of file diff --git a/.includes/website_rights.php b/.includes/website_rights.php index 02a8e70..98bae98 100644 --- a/.includes/website_rights.php +++ b/.includes/website_rights.php @@ -1,44 +1,42 @@ \ No newline at end of file + foreach ($arr_rights as $navRight) + { + $navId = str_replace($prefix . '_', '', $navRight); + if (in_array($navId, $pathWay)) + { + $editable = true; + break; + } + } + + } + } + } +} \ No newline at end of file diff --git a/.lang/informal/lang_de.php b/.lang/informal/lang_de.php index 57c8c31..f4dd37d 100644 --- a/.lang/informal/lang_de.php +++ b/.lang/informal/lang_de.php @@ -1,12 +1,11 @@ \ No newline at end of file + +/* Überschreiben der formellen Anreden mit informellen */ + +/* Formulare */ +$lang['formText']['login'] = 'Bitte gib Deine Benutzerdaten hier ein:'; +$lang['formText']['pwRepeat'] = 'Gib hier Dein neues Passwort ein und wiederhole die Eingabe zur Bestätigung:'; + +/* Mailtexte */ +$lang['mail']['body']['00000010'] = 'Hallo %userFirstname% %userLastname%,' . "\n\n" . '%sess_userFirstname% %sess_userLastname% hat Dir einen Zugang auf ' . $vC['portal']['hostUrl'] . ' eingerichtet. Deine Benutzerdaten lauten:' . "\n" . 'Anmeldename: %userUsername%' . "\n" . 'Password: %userPasswordOrg%' . "\n\n" . 'Bei der ersten Anmeldung am Portal mußt Du aus Sicherheitsgründen Dein Passwort ändern.' . "\n\n"; +$lang['mail']['body']['00000015'] = 'Hallo %userFirstname% %userLastname%,' . "\n\n" . 'Dein Passwort auf ' . $vC ['portal']['hostUrl'] . ' wurde von %sess_userFirstname% %sess_userLastname% zurückgesetzt. Es lautet:' . "\n" . '%userPasswordOrg%' . "\n\n" . 'Bei der ersten Anmeldung am Portal mußt Du aus Sicherheitsgründen Dein Passwort ändern.' . "\n\n"; \ No newline at end of file diff --git a/.lang/lang_de.php b/.lang/lang_de.php index c010582..f277a63 100644 --- a/.lang/lang_de.php +++ b/.lang/lang_de.php @@ -1,146 +1,148 @@ Hinweis:
Die Website - Rechte werden nur eingeblendet, wenn der Benutzer Rechte für die Bearbeitung der Website erhält!'; - $lang[ 'usermanagement' ][ 'websiteRights' ] = 'Website - Rechte'; - $lang[ 'usermanagement' ][ 'hintWebsiteRights' ] = 'Hinweis:
Der Benutzer erhält automatisch Rechte zur Bearbeitung aller untergeordneten Seiten eines gewählten Navigationspunkts!'; - $lang[ 'usermanagement' ][ 'allRights:' ] = 'Alle Rechte :'; - $lang[ 'usermanagement' ][ 'defRights:' ] = 'Definierte Rechte :'; - - $lang[ 'usermanagement' ][ 'new' ] = 'Neuer Benutzer'; - $lang[ 'usermanagement' ][ 'activate' ] = 'Aktivieren'; - $lang[ 'usermanagement' ][ 'deactivate' ] = 'Deaktivieren'; - $lang[ 'usermanagement' ][ 'edit' ] = 'Bearbeiten'; - $lang[ 'usermanagement' ][ 'delete' ] = 'Löschen'; - $lang[ 'usermanagement' ][ 'pw_reset' ] = 'Passwort rücksetzen'; - $lang[ 'usermanagement' ][ 'cancel' ] = 'Abbrechen'; - $lang[ 'usermanagement' ][ 'save' ] = 'Speichern'; - - $lang[ 'usermanagement' ][ 'QUE_001' ] = 'Soll folgender Benutzer wirklich deaktiviert werden?'; - $lang[ 'usermanagement' ][ 'QUE_002' ] = 'Soll folgender Benutzer wieder aktiviert werden?'; - $lang[ 'usermanagement' ][ 'QUE_003' ] = 'Soll folgender Benutzer endgültig gelöscht werden?'; - $lang[ 'usermanagement' ][ 'QUE_004' ] = 'Soll das Passwort des folgenden Benutzers wirklich zurück gesetz werden?'; - - /* Logfiles */ - $lang[ 'logfiles' ][ 'entry' ] = 'Log-Eintrag'; - $lang[ 'logfiles' ][ 'name' ] = 'Benutzer'; - $lang[ 'logfiles' ][ 'time' ] = 'Datum - Uhrzeit'; - - /* Logeinträge */ - $lang[ 'log' ][ '00000001' ] = 'Fehler bei der Anmeldung von IP: %0% (Benutzername: %1%)'; - $lang[ 'log' ][ '00000002' ] = 'Versuchte Anmeldung eines deaktivierten Benutzers'; - $lang[ 'log' ][ '00000003' ] = 'Erfolgreiche Benutzeranmeldung'; - $lang[ 'log' ][ '00000004' ] = 'Benutzer hat sich abgemeldet'; - $lang[ 'log' ][ '00000005' ] = 'Erfolgreiche Benutzeranmeldung - Passwort muss geändert werden'; - $lang[ 'log' ][ '00000006' ] = 'Passwort wurde geändert (Benutzer: %0%)'; - $lang[ 'log' ][ '00000007' ] = 'Passwort wurde zurückgesetzt (Benutzer: %0%)'; - - - $lang[ 'log' ][ '00000010' ] = 'Neuer Benutzer %0% wurde erstellt'; - $lang[ 'log' ][ '00000011' ] = 'Benutzer %0% wurde deaktivert'; - $lang[ 'log' ][ '00000012' ] = 'Benutzer %0% wurde aktiviert'; - $lang[ 'log' ][ '00000013' ] = 'Benutzer %0% wurde bearbeitet'; - $lang[ 'log' ][ '00000014' ] = 'Benutzer %0% wurde gelöscht'; - $lang[ 'log' ][ '00000015' ] = 'Passwort von Benutzer %0% wurde zurückgesetzt'; - $lang[ 'log' ][ '00000016' ] = 'Passwort von Benutzer %0% wurde geändert'; - - /* Mailtexte */ - $lang[ 'mail' ][ 'subj' ][ '00000010' ] = 'Zugang auf ' . $vC[ 'portal' ][ 'name' ] . ' wurde erstellt'; - $lang[ 'mail' ][ 'body' ][ '00000010' ] = 'Sehr geehrte(r) %userFirstname% %userLastname%,' . "\n\n" . '%sess_userFirstname% %sess_userLastname% hat Ihnen einen Zugang auf ' . $vC[ 'portal' ][ 'hostUrl' ] . ' eingerichtet. Ihre Benutzerdaten lauten:' . "\n" . 'Anmeldename: %userUsername%' . "\n" . 'Password: %userPasswordOrg%' . "\n\n" . 'Bei der ersten Anmeldung am Portal müssen Sie aus Sicherheitsgründen Ihr Passwort ändern.' . "\n\n"; - $lang[ 'mail' ][ 'subj' ][ '00000015' ] = 'Passwort auf ' . $vC[ 'portal' ][ 'name' ] . ' wurde geändert'; - $lang[ 'mail' ][ 'body' ][ '00000015' ] = 'Sehr geehrte(r) %userFirstname% %userLastname%,' . "\n\n" . 'Ihr Passwort auf ' . $vC[ 'portal' ][ 'hostUrl' ] . ' wurde von %sess_userFirstname% %sess_userLastname% zurückgesetzt. Es lautet:' . "\n" . '%userPasswordOrg%' . "\n\n" . 'Bei der ersten Anmeldung am Portal müssen Sie aus Sicherheitsgründen Ihr Passwort ändern.' . "\n\n"; - - /* Bereich Webseiten: SPORT */ - $lang[ 'website' ][ 'sport' ][ 'abgesagt' ] = 'Abgesagt'; - $lang[ 'website' ][ 'sport' ][ 'abgesagt_text' ] = 'Das Nachholspiel findet am %datum% statt.'; - $lang[ 'website' ][ 'sport' ][ 'spielfrei' ] = 'Spielfrei'; - $lang[ 'website' ][ 'sport' ][ 'heim' ] = '%heim% - %gegner% %ergebnis% (%halbzeit%)'; - $lang[ 'website' ][ 'sport' ][ 'auswaerts' ] = '%gegner% - %heim% %ergebnis% (%halbzeit%)'; - $lang[ 'website' ][ 'sport' ][ 'turnier' ] = '%platzierung% Platz beim Turnier in %ort%'; - - $lang[ 'website' ][ 'select' ][ 'spielbericht' ][ 'teamname' ] = array('SV Jungingen I' , 'SV Jungingen II', 'SGM Blautal/Jungingen II'); -?> \ No newline at end of file +/* Seitenüberschriften */ +$lang['headline']['login'] = array(array('Willkommen', 'white'), array('auf dem SVJ Bearbeitungsportal', 'white')); +$lang['headline']['changePW'] = array(array('Passwort ändern', 'white')); +$lang['headline']['requestPW'] = array(array('Passwort vergessen', 'white')); +$lang['headline']['requestUN'] = array(array('Benutzernamen vergessen', 'white')); +$lang['headline']['1'] = array(array('Willkommen', 'white'), array('auf dem SVJ Bearbeitungsportal', 'white')); +$lang['headline']['2'] = array(array('Bearbeitung', 'white'), array('der SVJ Website', 'white')); + +/* Navigationstitel */ +$lang['navi']['site_1'] = 'Home'; +$lang['navi']['site_2'] = 'Website'; +$lang['navi']['site_3'] = 'Benutzerverwaltung'; +$lang['navi']['site_4'] = 'Logfiles'; + +$lang['navi']['site_20'] = 'Bearbeitung'; +$lang['navi']['site_21'] = 'Status'; + +$lang['navi']['site_1000'] = 'Passwort ändern'; +$lang['navi']['site_1001'] = 'Passwort vergessen'; +$lang['navi']['site_1002'] = 'Benutzernamen vergessen'; +$lang['navi']['site_1111'] = 'Abmelden'; + +/* Datum und Zeit */ +$lang['month'][1] = 'Januar'; +$lang['month'][2] = 'Februar'; +$lang['month'][3] = 'März'; +$lang['month'][4] = 'April'; +$lang['month'][5] = 'Mai'; +$lang['month'][6] = 'Juni'; +$lang['month'][7] = 'Juli'; +$lang['month'][8] = 'August'; +$lang['month'][9] = 'September'; +$lang['month'][10] = 'Oktober'; +$lang['month'][11] = 'November'; +$lang['month'][12] = 'Dezember'; + +/* Layer */ +$lang['popup']['usermanagement'] = 'Benutzerverwaltung'; +$lang['popup']['logfiles'] = 'Logfiles'; + +/* Fehlermeldungen */ +$lang['error']['login_001'] = 'Die eingegebenen Anmeldedaten sind nicht korrekt!'; +$lang['error']['login_002'] = 'Der Benutzeraccount wurde deaktiviert!'; + +$lang['error']['pw_001'] = 'Die eingegebenen Passwörter stimmen nicht überein!'; + +$lang['error']['mail_001'] = 'Die E-Mail konnte nicht versendet werden!'; +$lang['error']['mail_002'] = 'Die E-Mail Adresse ist nicht gültig!'; +$lang['error']['mail_003'] = 'Die E-Mail Adresse ist bereits einem anderen Benutzer zugeordnet!'; + +/* Formulare */ +$lang['form']['userName'] = 'Benutzername :'; +$lang['form']['passWord'] = 'Passwort :'; +$lang['form']['newPassWord'] = 'neues Passwort :'; +$lang['form']['passWordRepeat'] = 'Passwort wiederholen :'; +$lang['form']['logIn'] = 'Anmelden'; +$lang['form']['save'] = 'Speichern'; +$lang['form']['send'] = 'Absenden'; +$lang['form']['loginText'] = 'Bitte geben Sie Ihre Benutzerdaten hier ein:'; + +$lang['formText']['login'] = 'Bitte geben Sie Ihre Benutzerdaten hier ein:'; +$lang['formText']['pwRepeat'] = 'Geben Sie hier Ihr neues Passwort ein und wiederholen die Eingabe zur Bestätigung:'; + +/* Usermanagement */ +$lang['usermanagement']['name'] = 'Name'; +$lang['usermanagement']['lastname'] = 'Nachname'; +$lang['usermanagement']['lastname:'] = 'Nachname :'; +$lang['usermanagement']['firstname'] = 'Vorname'; +$lang['usermanagement']['firstname:'] = 'Vorname :'; +$lang['usermanagement']['email'] = 'E-Mail'; +$lang['usermanagement']['email:'] = 'E-Mail :'; +$lang['usermanagement']['phone'] = 'Telefon'; +$lang['usermanagement']['phone:'] = 'Telefon :'; +$lang['usermanagement']['createdBy:'] = 'Angelegt von :'; +$lang['usermanagement']['createdOn:'] = 'Angelegt am :'; +$lang['usermanagement']['disabledBy:'] = 'Deaktiviert von :'; +$lang['usermanagement']['disabledOn:'] = 'Deaktiviert am :'; +$lang['usermanagement']['search'] = 'Suche'; +$lang['usermanagement']['userCreate'] = 'Neuen Benutzer anlegen'; +$lang['usermanagement']['userEdit'] = 'Benutzer bearbeiten'; +$lang['usermanagement']['commonFields'] = 'Allgemeine Angaben'; +$lang['usermanagement']['portalRights'] = 'Portal - Rechte'; +$lang['usermanagement']['hintPortalRights'] = 'Hinweis:
Die Website - Rechte werden nur eingeblendet, wenn der Benutzer Rechte für die Bearbeitung der Website erhält!'; +$lang['usermanagement']['websiteRights'] = 'Website - Rechte'; +$lang['usermanagement']['hintWebsiteRights'] = 'Hinweis:
Der Benutzer erhält automatisch Rechte zur Bearbeitung aller untergeordneten Seiten eines gewählten Navigationspunkts!'; +$lang['usermanagement']['allRights:'] = 'Alle Rechte :'; +$lang['usermanagement']['defRights:'] = 'Definierte Rechte :'; + +$lang['usermanagement']['new'] = 'Neuer Benutzer'; +$lang['usermanagement']['activate'] = 'Aktivieren'; +$lang['usermanagement']['deactivate'] = 'Deaktivieren'; +$lang['usermanagement']['edit'] = 'Bearbeiten'; +$lang['usermanagement']['delete'] = 'Löschen'; +$lang['usermanagement']['pw_reset'] = 'Passwort rücksetzen'; +$lang['usermanagement']['cancel'] = 'Abbrechen'; +$lang['usermanagement']['save'] = 'Speichern'; + +$lang['usermanagement']['QUE_001'] = 'Soll folgender Benutzer wirklich deaktiviert werden?'; +$lang['usermanagement']['QUE_002'] = 'Soll folgender Benutzer wieder aktiviert werden?'; +$lang['usermanagement']['QUE_003'] = 'Soll folgender Benutzer endgültig gelöscht werden?'; +$lang['usermanagement']['QUE_004'] = 'Soll das Passwort des folgenden Benutzers wirklich zurück gesetz werden?'; + +/* Logfiles */ +$lang['logfiles']['entry'] = 'Log-Eintrag'; +$lang['logfiles']['name'] = 'Benutzer'; +$lang['logfiles']['time'] = 'Datum - Uhrzeit'; + +/* Logeinträge */ +$lang['log']['00000001'] = 'Fehler bei der Anmeldung von IP: %0% (Benutzername: %1%)'; +$lang['log']['00000002'] = 'Versuchte Anmeldung eines deaktivierten Benutzers'; +$lang['log']['00000003'] = 'Erfolgreiche Benutzeranmeldung'; +$lang['log']['00000004'] = 'Benutzer hat sich abgemeldet'; +$lang['log']['00000005'] = 'Erfolgreiche Benutzeranmeldung - Passwort muss geändert werden'; +$lang['log']['00000006'] = 'Passwort wurde geändert (Benutzer: %0%)'; +$lang['log']['00000007'] = 'Passwort wurde zurückgesetzt (Benutzer: %0%)'; + + +$lang['log']['00000010'] = 'Neuer Benutzer %0% wurde erstellt'; +$lang['log']['00000011'] = 'Benutzer %0% wurde deaktivert'; +$lang['log']['00000012'] = 'Benutzer %0% wurde aktiviert'; +$lang['log']['00000013'] = 'Benutzer %0% wurde bearbeitet'; +$lang['log']['00000014'] = 'Benutzer %0% wurde gelöscht'; +$lang['log']['00000015'] = 'Passwort von Benutzer %0% wurde zurückgesetzt'; +$lang['log']['00000016'] = 'Passwort von Benutzer %0% wurde geändert'; + +/* Mailtexte */ +$lang['mail']['subj']['00000010'] = 'Zugang auf ' . $vC['portal']['name'] . ' wurde erstellt'; +$lang['mail']['body']['00000010'] = 'Sehr geehrte(r) %userFirstname% %userLastname%,' . "\n\n" . '%sess_userFirstname% %sess_userLastname% hat Ihnen einen Zugang auf ' . $vC['portal']['hostUrl'] . ' eingerichtet. Ihre Benutzerdaten lauten:' . "\n" . 'Anmeldename: %userUsername%' . "\n" . 'Password: %userPasswordOrg%' . "\n\n" . 'Bei der ersten Anmeldung am Portal müssen Sie aus Sicherheitsgründen Ihr Passwort ändern.' . "\n\n"; +$lang['mail']['subj']['00000015'] = 'Passwort auf ' . $vC['portal']['name'] . ' wurde geändert'; +$lang['mail']['body']['00000015'] = 'Sehr geehrte(r) %userFirstname% %userLastname%,' . "\n\n" . 'Ihr Passwort auf ' . $vC['portal']['hostUrl'] . ' wurde von %sess_userFirstname% %sess_userLastname% zurückgesetzt. Es lautet:' . "\n" . '%userPasswordOrg%' . "\n\n" . 'Bei der ersten Anmeldung am Portal müssen Sie aus Sicherheitsgründen Ihr Passwort ändern.' . "\n\n"; + +/* Bereich Webseiten: SPORT */ +$lang['website']['sport']['abgesagt'] = 'Abgesagt'; +$lang['website']['sport']['abgesagt_text'] = 'Das Nachholspiel findet am %datum% statt.'; +$lang['website']['sport']['spielfrei'] = 'Spielfrei'; +$lang['website']['sport']['heim'] = '%heim% - %gegner% %ergebnis% (%halbzeit%)'; +$lang['website']['sport']['auswaerts'] = '%gegner% - %heim% %ergebnis% (%halbzeit%)'; +$lang['website']['sport']['turnier'] = '%platzierung% Platz beim Turnier in %ort%'; + +$lang['website']['select']['spielbericht']['teamname'] = array('SV Jungingen I', 'SV Jungingen II', 'SGM Blautal/Jungingen II'); +$lang['website']['select']['spielbericht']['spieltyp'] = array('gespielt', 'abgesagt', 'pokal', 'spielfrei'); +$lang['website']['select']['spielbericht']['spieldauer'] = array('regular' => 'reguläre Spielzeit', 'nV' => 'nach Verlängerung', 'nE' => 'nach Elfmeterschießen'); +$lang['website']['select']['pageTypes'] = array('content', 'uebersicht', 'spielbericht', 'turnier', 'widget'); \ No newline at end of file diff --git a/administrator/css/svjf_editor.css b/administrator/css/svjf_editor.css index 452b710..9f20762 100644 --- a/administrator/css/svjf_editor.css +++ b/administrator/css/svjf_editor.css @@ -1,617 +1,561 @@ -.grid_44col - { - width : 1056px; - float : none; - } - -.grid_43col - { - width : 1032px; - float : left; - } - -.grid_42col - { - width : 1008px; - float : left; - } - -.editor_wrapper - { - margin : 0px auto; - height : 99%; - padding : 35px 0px 0px 0px; - width : 1058px; - } +.grid_44col { + width: 1056px; + float: none; +} -.editable_hover - { - cursor : crosshair; - opacity : .5; - background-color : #ff0000; - } +.grid_43col { + width: 1032px; + float: left; +} -.spacer24 - { - height : 24px; - } - -.onright - { - float : right; - } - -#rist_editor - { - height : 100%; - } - -#editor_layer - { - position : fixed; - height : 100%; - width : 100%; - left : 0px; - top : 0px; - z-index : 999; - background-color : rgba( 255 , 255 , 255 , .3 ); - padding : 0px; - margin : 0px; - display : none; - } - -#editor_layer .grid_40col - { - float : left; - clear : none; - } +.grid_42col { + width: 1008px; + float: left; +} -#editor_header - { - background-color : #000000; - height : 36px; - position : absolute; - top : 0px; - } +.editor_wrapper { + position: relative; + margin: 0 auto; + height: 99%; + padding: 35px 0 0 0; + width: 1058px; +} -#editor_title - { - height : 36px; - line-height : 36px; - color : #ffffff; - font-size : 1.25rem; - font-weight : bold; - } +.editable_hover { + cursor: crosshair; + opacity: .5; + background-color: #ff0000; +} -#editor_layer_close - { - margin : 6px 0px; - cursor : pointer; - } - -#editor_content_outer - { - height : 100%; - background-color : #ffffff; - background-image : linear-gradient(0deg, transparent 23px, #cccccc 24px ), - linear-gradient(90deg, transparent 23px, #cccccc 24px); - background-image : -webkit-linear-gradient(0deg, transparent 23px, #cccccc 24px ), - -webkit-linear-gradient(90deg, transparent 23px, #cccccc 24px); - background-size : 24px 24px; - } - -#editor_content - { - position : relative; - height : 100%; - padding : 24px 39px 48px 39px; - } +.spacer24 { + height: 24px; +} -#editor_content > div - { - height : 100%; - overflow-y : auto; - overflow-x : hidden; - width : 1000px; - } +.onright { + float: right; +} -#editor_content .bottom - { - position : absolute; - bottom : 12px; - left : 48px; - width : 100%; - padding-right : 96px; - } - -.submitButton - { - padding : 4px 0px; - background-color : #cccccc; - line-height : 1.0rem; - text-align : center; - font-weight : bold; - text-decoration : none; - color : #000000; - float : right; - margin-top : 24px; - min-width : 144px; - cursor : pointer; - } +#rist_editor { + height: 100%; +} -.submitButton:not(:first-of-type) - { - float : left; - } - -.submitButton:hover - { - background-color : #e3000b; - color : #ffffff; - } +#editor_layer { + position: fixed; + height: 100%; + width: 100%; + left: 0; + top: 0; + z-index: 999; + background-color: rgba(255, 255, 255, .3); + padding: 0; + margin: 0; + display: none; +} -.buttonGroup - { - width : 193px; - float : left; - border : 1px solid #666666; - padding : 0px 22px 22px 23px; - } +#editor_layer .grid_40col { + float: left; + clear: none; +} -.buttonGroup.onright - { - margin-right : -1px; - float : right; - } - -.buttonGroup .submitButton - { - float : left; - margin-top : 0px; - } +#editor_header { + background-color: #000000; + height: 36px; + position: absolute; + top: 0; +} -.buttonGroup .submitButton - { - margin-top : -1px; - } +#editor_title { + height: 36px; + line-height: 36px; + color: #ffffff; + font-size: 1.25rem; + font-weight: bold; +} -.editor_slider - { - height : 100%; - } - -.editor_slider > div - { - height : 100%; - display : none; - } +#editor_layer_close { + margin: 6px 0; + cursor: pointer; +} -.editor_slider > div:first-of-type - { - display : block; - } +#editor_content_outer { + height: 100%; + background-color: #ffffff; + background-image: linear-gradient(0deg, transparent 23px, #cccccc 24px), + linear-gradient(90deg, transparent 23px, #cccccc 24px); + background-image: -webkit-linear-gradient(0deg, transparent 23px, #cccccc 24px), + -webkit-linear-gradient(90deg, transparent 23px, #cccccc 24px); + background-size: 24px 24px; +} -.editor_slider .inner - { - padding : 1px 9px; - } +#editor_content { + position: relative; + height: 100%; + padding: 24px 39px 48px 39px; +} -input , select , textarea, label - { - font-family : verdana; - font-size : 1.0rem; - line-height : 1.0rem; - float : left; - } - -label - { - margin-top : 6px; - padding-bottom : 2px; - } - -input[type=radio] , input[type=checkbox] - { - margin-top : 6px; - margin-left : 5px; - margin-right : 6px; - } - -input[type=text] , input[type=password] - { - border : 0px none; - border-bottom : 1px solid #666666; - width : 383px; - padding-top : 4px; - padding-left : 6px; - height : 24px; - } +#editor_content > div { + height: 100%; + overflow-y: auto; + overflow-x: hidden; + width: 1000px; +} -textarea - { - width : 755px; - height : 114px; - border : 0px none; - padding : 2px 6px; - border-bottom : 1px solid #666666; - margin-top : 1px; - line-height : 1.5rem; - } - -label - { - width : 192px; - display : inline-block; - color : #666666; - } - -input.date_picker , input.short - { - width : 191px; - } - -input.tiny - { - width : 47px; - margin-right : 1px; - } - -label.tiny - { - width : 24px; - text-align : center; - } - -label.tinyleft - { - width : 96px; - } - -input.max - { - width : 768px; - } +#editor_content .bottom { + position: absolute; + bottom: 12px; + left: 48px; + width: 100%; + padding-right: 96px; +} -li.navclose ul - { - display : none; - } +.submitButton { + padding: 4px 0; + background-color: #cccccc; + line-height: 1.0rem; + text-align: center; + font-weight: bold; + text-decoration: none; + color: #000000; + float: right; + margin-top: 24px; + min-width: 144px; + cursor: pointer; +} -#struktur - { - margin : 0px 16px 0px 8px; - font-size : 0.75rem; - line-height : 0.875rem; - border : 2px solid #666666; - background-color : #FFFFFF; - height : 100%; - width : 472px; - overflow-y : auto; - float : left; - position : relative; - } +.submitButton:not(:first-of-type) { + float: left; +} -#struktur ul , #otherMain_box ul - { - padding-left : 24px; - } -#otherMain_box > ul - { - padding-left : 0px; - } +.submitButton:hover { + background-color: #e3000b; + color: #ffffff; +} -#struktur > ul - { - padding-left : 0px; - } - -#navPoint - { - display : none; - width : 472px; - height : 100%; - float : left; - border : 2px solid #666666; - padding : 23px 22px 10px 14px; - position : relative; - overflow-y : auto; - } +.buttonGroup { + width: 193px; + float: left; + border: 1px solid #666666; + padding: 0 22px 22px 23px; +} -#imageEditor - { - margin : 0px 0px 0px 8px; - padding : 0; - width : 960px; - background-color : transparent; - position : relative; - } +.buttonGroup.onright { + margin-right: -1px; + float: right; +} -#rist_editor .ui-widget-content - { - background-image: none; - } - -.ui-datepicker - { - background-color: #ffffff; - } - -#imgHolder - { - padding : 0px; - position : relative; - left : 22px; - margin-bottom : 48px; - } +.buttonGroup .submitButton { + float: left; + margin-top: 0; +} -#imgImage - { - position : absolute; - z-index : 10; - } +.buttonGroup .submitButton { + margin-top: -1px; +} -#imgBlende - { - position : absolute; - z-index : 100; - } +.editor_slider { + height: 100%; +} -#imgPreview - { - left : 0px; - top : 0px; - cursor : move; - } +.editor_slider > div { + height: 100%; + display: none; +} -#blendeTop, #blendeLeft, #blendeRight, #blendeBottom - { - position : absolute; - background-color : rgba( 255 , 255 ,255 , .7 ); - } +.editor_slider > div:first-of-type { + display: block; +} -.preserveChanges - { - width : 100%; - height : 100%; - position : absolute; - top : 0px; - left : 0px; - z-index : 50; - background-color : rgba( 100 , 100 , 100 , .5); - display : none; - } - -li.open > span - { - content : '-'; - } - -li.navclose > span - { - content : '+'; - } - -li.open > span , li.navclose > span , li.empty > span - { - width : 24px; - display : inline-block; - cursor : pointer; - background-image : url('../images/folders.png'); - } +.editor_slider .inner { + padding: 1px 9px; +} -li.open > span - { - background-position : 0px -27px; - } - -li.navclose > span - { - background-position : 0px -2px; - } - -li.empty > span - { - cursor : default; - background-position : 0px -51px; - } - -li.not_editable - { - color : #AAAAAA; - cursor : default; - } +input, select, textarea, label { + font-family: verdana; + font-size: 1.0rem; + line-height: 1.0rem; + float: left; +} -li.editable - { - color : #222222; - cursor : crosshair; - } +label { + margin-top: 6px; + padding-bottom: 2px; +} -li.editorDeactive - { - color : #AAAAAA; - font-style : italic; - } +input[type=radio], input[type=checkbox] { + margin-top: 6px; + margin-left: 5px; + margin-right: 6px; +} -li.editorChosen - { - font-weight : bold; - } +input[type=text], input[type=password] { + border: 0 none; + border-bottom: 1px solid #666666; + width: 383px; + padding-top: 4px; + padding-left: 6px; + height: 24px; +} -li.editorChosen li - { - font-weight : normal; - } - -.hidden - { - display : none; - } +textarea { + width: 755px; + height: 114px; + border: 0 none; + padding: 2px 6px; + border-bottom: 1px solid #666666; + margin-top: 1px; + line-height: 1.5rem; +} -.disabled - { - background-color : #eeeeee; - color : #cccccc; - font-style : italic; - cursor : default; - } - -.disabled:hover - { - background-color : #eeeeee; - color : #cccccc; - font-style : italic; - } +label { + width: 192px; + display: inline-block; + color: #666666; +} -.highlight - { - background-color : #e3000b; - color : #ffffff; - } +input.date_picker, input.short { + width: 191px; +} -input#content - { - padding-top : 4px; - } +input.tiny { + width: 47px; + margin-right: 1px; +} -input.headline - { - font-size : 1.25rem; - border : none; - width : 960px; - } +label.tiny { + width: 24px; + text-align: center; +} -#editor_elements - { - position : absolute; - z-index : 100; - right : 0px; - top : 462px; - border : 1px solid #000000; - overflow : hidden; - background-color : #ffffff; - } +label.tinyleft { + width: 96px; +} -#element_title - { - background-color : #000000; - color : #ffffff; - font-weight : bold; - padding : 0px 11px; - cursor : move; - } +input.max { + width: 768px; +} -#element_content - { - padding : 12px 11px 4px 11px; - } +li.navclose ul { + display: none; +} -#element_content .grid_40col - { - width : 100%; - float : none; - height : 24px; - background-color : #999999; - display : inline-block; - overflow : hidden; - text-align : center; - font-weight : bold; - color : #ffffff; - cursor : move; - } - -#element_content .grid_40col p - { - text-align : center; - } +#struktur { + margin: 0 16px 0 8px; + font-size: 0.75rem; + line-height: 0.875rem; + border: 2px solid #666666; + background-color: #FFFFFF; + height: 100%; + width: 472px; + overflow-y: auto; + float: left; + position: relative; +} -#element_content h2 , p - { - font-size : 1.0rem; - } - -#element_content img - { - display : none; - } - -#element_content .content - { - text-align : center; - } - -#content.highlight - { - background-color : rgba( 160 , 160 , 160 , .2 ); - color : #000000; - } +#struktur ul, #otherMain_box ul { + padding-left: 24px; +} -#content .new_box - { - border : 1px dashed #000000; - background-color : #ffffff; - } +#otherMain_box > ul { + padding-left: 0; +} -#content .sort_handle , #rist_editor .sort_handle - { - background-color : #ffffff; - position : absolute; - right : 0px; - top : 0px; - width : 24px; - height : 24px; - background-image : url( '../images/svjf/icon-sortable.png' ); - cursor : move; - } -#content .del_handle, #rist_editor .del_handle - { - background-color : #ffffff; - position : absolute; - right : 24px; - top : 0px; - width : 24px; - height : 24px; - background-image : url( '../images/svjf/icon-delete.png' ); - cursor : pointer; - } +#struktur > ul { + padding-left: 0; +} -#newSort_box li - { - position : relative; - list-style-type : none; - } +#navPoint { + display: none; + width: 472px; + height: 100%; + float: left; + border: 2px solid #666666; + padding: 2px 22px 10px 14px; + position: relative; + overflow-y: auto; +} -#generalSettings - { - padding-bottom : 96px; - } - -#generalSettings .bottom - { - left : 48px; - } +#imageEditor { + margin: 0 0 0 8px; + padding: 0; + width: 960px; + background-color: transparent; + position: relative; +} -#imgThumbs img - { - display : block; - float : none; - } +#rist_editor .ui-widget-content { + background-image: none; +} -#wait - { - position : absolute; - width : 100%; - height : 100%; - background-color : rgba( 255 , 255 , 255 , .7 ); - z-index : 99; - display : none; - } +.ui-datepicker { + background-color: #ffffff; +} + +#imgHolder { + padding: 0; + position: relative; + left: 22px; + margin-bottom: 48px; +} + +#imgImage { + position: absolute; + z-index: 10; +} + +#imgBlende { + position: absolute; + z-index: 100; +} + +#imgPreview { + left: 0; + top: 0; + cursor: move; +} + +#blendeTop, #blendeLeft, #blendeRight, #blendeBottom { + position: absolute; + background-color: rgba(255, 255, 255, .7); +} + +.preserveChanges { + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; + z-index: 50; + background-color: rgba(100, 100, 100, .5); + display: none; +} + +li.open > span { + content: '-'; +} + +li.navclose > span { + content: '+'; +} + +li.open > span, li.navclose > span, li.empty > span { + width: 24px; + display: inline-block; + cursor: pointer; + background-image: url('../images/folders.png'); +} + +li.open > span { + background-position: 0 -27px; +} + +li.navclose > span { + background-position: 0 -2px; +} + +li.empty > span { + cursor: default; + background-position: 0 -51px; +} + +li.not_editable { + color: #AAAAAA; + cursor: default; +} + +li.editable { + color: #222222; + cursor: crosshair; +} + +li.editorDeactive { + color: #AAAAAA; + font-style: italic; +} + +li.editorChosen { + font-weight: bold; +} + +li.editorChosen li { + font-weight: normal; +} + +.hidden { + display: none; +} + +.disabled { + background-color: #eeeeee; + color: #cccccc; + font-style: italic; + cursor: default; +} + +.disabled:hover { + background-color: #eeeeee; + color: #cccccc; + font-style: italic; +} + +.highlight { + background-color: #e3000b; + color: #ffffff; +} + +input#content { + padding-top: 4px; +} + +input.headline { + font-size: 1.5rem; + font-weight: bold; + border: none; + width: 960px; +} + +input.subline { + font-size: 1.25rem; + font-weight: bold; + border: none; + width: 960px; +} + +#editor_elements { + position: absolute; + z-index: 100; + right: 0; + top: 462px; + border: 1px solid #000000; + overflow: hidden; + background-color: #ffffff; +} + +#element_title { + background-color: #000000; + color: #ffffff; + font-weight: bold; + padding: 0 11px; + cursor: move; +} + +#element_content { + padding: 12px 11px 4px 11px; +} + +#element_content .grid_40col { + width: 100%; + float: none; + height: 24px; + background-color: #999999; + display: inline-block; + overflow: hidden; + text-align: center; + font-weight: bold; + color: #ffffff; + cursor: move; +} + +#element_content .grid_40col p { + text-align: center; +} + +#element_content h2, p { + font-size: 1.0rem; +} + +#element_content img { + display: none; +} + +#element_content .content { + text-align: center; +} + +#content.highlight { + background-color: rgba(160, 160, 160, .2); + color: #000000; +} + +#content .new_box { + border: 1px dashed #000000; + background-color: #ffffff; +} + +#content .sort_handle, #rist_editor .sort_handle { + background-color: #ffffff; + position: absolute; + right: 0; + top: 0; + width: 24px; + height: 24px; + background-image: url('../images/svjf/icon-sortable.png'); + cursor: move; +} + +#content .del_handle, #rist_editor .del_handle { + background-color: #ffffff; + position: absolute; + right: 24px; + top: 0; + width: 24px; + height: 24px; + background-image: url('../images/svjf/icon-delete.png'); + cursor: pointer; +} + +#newSort_box li { + position: relative; + list-style-type: none; +} + +#generalSettings { + padding-bottom: 96px; +} + +#generalSettings .bottom { + left: 48px; +} + +#imgThumbs img { + display: block; + float: none; +} + +#wait { + position: absolute; + width: 100%; + height: 100%; + background-color: rgba(255, 255, 255, .7); + z-index: 99; + display: none; +} + +#wait img { + position: absolute; + top: 50%; + left: 50%; + margin-top: -48px; + margin-left: -48px; +} + +#breadCrumb { + font-size: .75rem; + margin-bottom: 14px; +} + +#showAction { + padding-top: 13px; +} + +.actionChooser { + margin-top: -13px; +} + +.actionChooser span { + float: none; + margin-top: 12px; + width: 168px; + display: inline-block; + font-size: .75rem; +} -#wait img - { - position : absolute; - top : 50%; - left : 50%; - margin-top : -48px; - margin-left : -48px; - } \ No newline at end of file diff --git a/administrator/index.php b/administrator/index.php index f84e994..59ed451 100644 --- a/administrator/index.php +++ b/administrator/index.php @@ -1,143 +1,141 @@ query('SELECT * FROM ' . TBL_PREFIX . '_' . TBL_CONTENT . ' WHERE siteName = "' . $_GET['siteId'] . '";'); + if ($content->num_rows !== 0) + { + $content_data = $content->fetch_assoc(); + $table = explode('_', $content_data['siteContents'])[0]; + $id = explode('_', $content_data['siteContents'])[1]; + + $form = $db->query('SELECT * FROM ' . TBL_PREFIX . '_' . TBL_CONTENT . '_' . $table . ' WHERE id = "' . $id . '";'); + $form_data = $form->fetch_assoc(); + $fields = explode(';', $form_data['content']); + unset ($form_data['id']); + unset ($form_data['content']); + + $data['content'] = $form_data; + $data['content']['type'] = $table; + $data['content']['elems'] = array(); + + foreach ($fields as $field) { - $content = $db -> query ( 'SELECT * FROM ' . TBL_PREFIX . '_' . TBL_CONTENT . ' WHERE siteName = "' . $_GET[ 'siteId' ] . '";' ); - if ( $content -> num_rows !== 0 ) - { - $content_data = $content -> fetch_assoc ( ); - $table = explode( '_' , $content_data[ 'siteContents' ] )[ 0 ]; - $id = explode( '_' , $content_data[ 'siteContents' ] )[ 1 ]; - - $form = $db -> query( 'SELECT * FROM ' . TBL_PREFIX . '_' . TBL_CONTENT . '_' . $table . ' WHERE id = "' . $id . '";' ); - $form_data = $form -> fetch_assoc( ); - $fields = explode( ';' , $form_data[ 'content' ] ); - unset ( $form_data[ 'id' ] ); - unset ( $form_data[ 'content' ] ); - - $data[ 'content' ] = $form_data; - $data[ 'content' ][ 'type' ] = $table; - $data[ 'content' ][ 'elems' ] = array( ); - - foreach ( $fields as $field ) - { - $tmp_field = explode( ':' , $field ); - $elem = explode( '_' , $tmp_field[ 0 ] ); - $elem_data = explode( '_' , $tmp_field[ 1 ] ); - $tmp_data = ( isset( $elem[ 1 ] ) ) - ? array( 'tag_name' => $elem[ 0 ] , 'type' => $elem[ 1 ] ) - : array( 'tag_name' => $elem[ 0 ] ); - $tmp_data[ 'name' ] = $elem_data[ 0 ]; - $tmp_data[ 'value' ] = ( isset ( $elem_data[ 1 ] ) ) - ? $elem_data[ 1 ] - : ''; - $tmp_data[ 'text' ] = ( isset ( $lang[ $table ][ $elem_data[ 0 ] ] ) ) - ? $lang[ $table ][ $elem_data[ 0 ] ] - : ''; - $data[ 'content' ][ 'elems' ][ ] = $tmp_data; - } - - } + $tmp_field = explode(':', $field); + $elem = explode('_', $tmp_field[0]); + $elem_data = explode('_', $tmp_field[1]); + $tmp_data = (isset($elem[1])) + ? array('tag_name' => $elem[0], 'type' => $elem[1]) + : array('tag_name' => $elem[0]); + $tmp_data['name'] = $elem_data[0]; + $tmp_data['value'] = (isset ($elem_data[1])) + ? $elem_data[1] + : ''; + $tmp_data['text'] = (isset ($lang[$table][$elem_data[0]])) + ? $lang[$table][$elem_data[0]] + : ''; + $data['content']['elems'][] = $tmp_data; } - - elseif ( isset ( $_SESSION[ 'sess_loginStatus' ] ) && $_SESSION[ 'sess_loginStatus' ] === 'loggedIn' ) - { - /* Angemeldet */ - $data[ 'navi_special' ] = fnc_getNavigationArray ( TBL_PREFIX , true , $navPositions = array( 'special' , 'login' ) , $lang[ 'navi' ] ); - $navi_main = fnc_getNavigationArray ( TBL_PREFIX , true , $navPositions = array( 'main' ) , $lang[ 'navi' ] ); - $data[ 'navi_main' ] = ( $_SESSION[ 'sess_portalRightsType' ] === 'ALL' ) - ? $navi_main - : fnc_getPortalNavigationArray ( TBL_PREFIX , $navi_main , $_SESSION[ 'sess_portalRights' ] ); - } - else - { - $data[ 'navi_special' ] = fnc_getNavigationArray( TBL_PREFIX , true , $navPositions = array( 'special' , 'logout' ) , $lang[ 'navi' ] ); - $login = $db -> query( 'SELECT * FROM ' . TBL_PREFIX . '_' . TBL_CONTENT . ' WHERE siteName = "login";' ); - $login_data = $login -> fetch_assoc( ); - $table = explode( '_' , $login_data[ 'siteContents' ] )[ 0 ]; - $id = explode( '_' , $login_data[ 'siteContents' ] )[ 1 ]; - - $form = $db -> query( 'SELECT * FROM ' . TBL_PREFIX . '_' . TBL_CONTENT . '_' . $table . ' WHERE id = "' . $id . '";' ); - $form_data = $form -> fetch_assoc( ); - $fields = explode( ';' , $form_data[ 'content' ] ); - unset ( $form_data[ 'id' ] ); - unset ( $form_data[ 'content' ] ); - - $data[ 'login' ] = $form_data; - $data[ 'login' ][ 'elems' ] = array( ); - foreach ( $fields as $field ) - { - $tmp_field = explode( ':' , $field ); - $elem = explode( '_' , $tmp_field[ 0 ] ); - $elem_data = explode( '_' , $tmp_field[ 1 ] ); - $tmp_data = ( isset( $elem[ 1 ] ) ) - ? array( 'tag_name' => $elem[ 0 ] , 'type' => $elem[ 1 ] ) - : array( 'tag_name' => $elem[ 0 ] ); - $tmp_data[ 'name' ] = $elem_data[ 0 ]; - $tmp_data[ 'value' ] = ( isset ( $elem_data[ 1 ] ) ) - ? $elem_data[ 1 ] - : ''; - $tmp_data[ 'text' ] = ( isset ( $lang[ $table ][ $elem_data[ 0 ] ] ) ) - ? $lang[ $table ][ $elem_data[ 0 ] ] - : ''; - $data[ 'login' ][ 'elems' ][ ] = $tmp_data; - } - } - - $data[ 'headline_main' ] = $lang[ 'headline_main' ]; - $data[ 'headline_site' ] = $lang[ 'headline' ][ $_GET[ 'siteId' ] ]; - $data[ 'keyvisual' ] = ( file_exists( PATH_IMG . $vC[ 'portal' ][ 'layout' ] . '/keyvisual_' . $_GET[ 'siteId' ] . '.jpg' ) ) - ? PATH_IMG . $vC[ 'portal' ][ 'layout' ] . '/keyvisual_' . $_GET[ 'siteId' ] . '.jpg' - : PATH_IMG . $vC[ 'portal' ][ 'layout' ] . '/keyvisual_0.jpg'; - - /* Template rendern */ - $render = new viewClass ( ); - $render -> setPrefix ( $vC['portal']['layout'] ); - $render -> setPathTpl ( PATH_PORTAL_TPL ); - $render -> setConfig ( $vC ); - $render -> setTemplate ( 'portal' ); - $render -> setSiteId ( $_GET[ 'siteId' ] ); - $render -> setEditable ( false ); - $render -> setData ( $data ); - $render -> setLang( $lang ); - if ( isset ( $arrError ) && ! empty ( $arrError ) ) - { - /* ToDo: Fehlerbehandlung */ - $render -> setErrors ( $arrError ); - } - if ( isset ( $_POST ) && ! empty ( $_POST ) ) - { - /* ToDo: POST Daten */ - $render -> setFormData ( $_POST ); - } - - $html = $render -> output ( ); - $html = str_replace ( array ( 'PHP_ROOT_PATH/' , 'PHP_SITE_PATH/' ) , array ( PATH_ROOT , PATH_SITE ) , $html ); - $html = str_replace ( array ( "\r" , "\n" , "\t" ) , array ( '' , '' , '' ) , $html ); - echo $html; - -?> \ No newline at end of file + + } +} + +elseif (isset ($_SESSION['sess_loginStatus']) && $_SESSION['sess_loginStatus'] === 'loggedIn') +{ + /* Angemeldet */ + $data['navi_special'] = fnc_getNavigationArray(TBL_PREFIX, true, $navPositions = array('special', 'login'), $lang['navi']); + $navi_main = fnc_getNavigationArray(TBL_PREFIX, true, $navPositions = array('main'), $lang['navi']); + $data['navi_main'] = ($_SESSION['sess_portalRightsType'] === 'ALL') + ? $navi_main + : fnc_getPortalNavigationArray(TBL_PREFIX, $navi_main, $_SESSION['sess_portalRights']); +} +else +{ + $data['navi_special'] = fnc_getNavigationArray(TBL_PREFIX, true, $navPositions = array('special', 'logout'), $lang['navi']); + $login = $db->query('SELECT * FROM ' . TBL_PREFIX . '_' . TBL_CONTENT . ' WHERE siteName = "login";'); + $login_data = $login->fetch_assoc(); + $table = explode('_', $login_data['siteContents'])[0]; + $id = explode('_', $login_data['siteContents'])[1]; + + $form = $db->query('SELECT * FROM ' . TBL_PREFIX . '_' . TBL_CONTENT . '_' . $table . ' WHERE id = "' . $id . '";'); + $form_data = $form->fetch_assoc(); + $fields = explode(';', $form_data['content']); + unset ($form_data['id']); + unset ($form_data['content']); + + $data['login'] = $form_data; + $data['login']['elems'] = array(); + foreach ($fields as $field) + { + $tmp_field = explode(':', $field); + $elem = explode('_', $tmp_field[0]); + $elem_data = explode('_', $tmp_field[1]); + $tmp_data = (isset($elem[1])) + ? array('tag_name' => $elem[0], 'type' => $elem[1]) + : array('tag_name' => $elem[0]); + $tmp_data['name'] = $elem_data[0]; + $tmp_data['value'] = (isset ($elem_data[1])) + ? $elem_data[1] + : ''; + $tmp_data['text'] = (isset ($lang[$table][$elem_data[0]])) + ? $lang[$table][$elem_data[0]] + : ''; + $data['login']['elems'][] = $tmp_data; + } +} + +$data['headline_main'] = $lang['headline_main']; +$data['headline_site'] = $lang['headline'][$_GET['siteId']]; +$data['keyvisual'] = (file_exists(PATH_IMG . $vC['portal']['layout'] . '/keyvisual_' . $_GET['siteId'] . '.jpg')) + ? PATH_IMG . $vC['portal']['layout'] . '/keyvisual_' . $_GET['siteId'] . '.jpg' + : PATH_IMG . $vC['portal']['layout'] . '/keyvisual_0.jpg'; + +/* Template rendern */ +$render = new viewClass (); +$render->setPrefix($vC['portal']['layout']); +$render->setPathTpl(PATH_PORTAL_TPL); +$render->setConfig($vC); +$render->setTemplate('portal'); +$render->setSiteId($_GET['siteId']); +$render->setEditable(false); +$render->setData($data); +$render->setLang($lang); +if (isset ($arrError) && !empty ($arrError)) +{ + /* ToDo: Fehlerbehandlung */ + $render->setErrors($arrError); +} +if (isset ($_POST) && !empty ($_POST)) +{ + /* ToDo: POST Daten */ + $render->setFormdata($_POST); +} + +$html = $render->output(); +$html = str_replace(array('PHP_ROOT_PATH/', 'PHP_SITE_PATH'), array(PATH_ROOT, PATH_SITE), $html); +//$html = str_replace(array("\r", "\n", "\t"), array('', '', ''), $html); +echo $html; \ No newline at end of file diff --git a/administrator/js/portal.js b/administrator/js/portal.js index 431cd7e..49f0d01 100644 --- a/administrator/js/portal.js +++ b/administrator/js/portal.js @@ -30,7 +30,7 @@ $( '#' + $( this ).attr( 'data-referer' ) ).show( ); } } ); - } + }; $ ( document ).ready ( function ( ) { diff --git a/administrator/popups/editor/index.php b/administrator/popups/editor/index.php index bb13ba2..fdbfed4 100644 --- a/administrator/popups/editor/index.php +++ b/administrator/popups/editor/index.php @@ -1,244 +1,187 @@ query - ( - 'SELECT - * - FROM - ' . $prefix . '_' . TBL_NAVI . ' - WHERE - ' . $prefix . '_navId = "' . $_GET[ 'navId' ] . '";' - ); - $navpoint = $navpointData -> fetch_assoc ( ); - - if ( ! is_null ( $navpoint[ $prefix . '_keyvisual' ] ) ) - { - /* Keyvisual */ - $keyvisualData = $db -> query - ( - 'SELECT - * - FROM - ' . $prefix . '_' . TBL_IMAGE . ' - WHERE - id = "' . $navpoint[ $prefix . '_keyvisual' ] . '";' - ); - $keyvisual = $keyvisualData -> fetch_assoc ( ); - $data[ 'keyvisual' ][ ] = array ( 'id' => $keyvisual[ 'id' ] , 'path' => PATH_MED . $prefix . '/' . $_GET[ 'navId' ] . '/' , 'src' => $keyvisual[ 'imgName' ] . '.' . $keyvisual[ 'imgExtension' ] , 'title' => $keyvisual[ 'imgTitle' ] ); - $data[ 'galery' ][ ] = array ( 'id' => $keyvisual[ 'id' ] , 'path' => PATH_MED . $prefix . '/' . $_GET[ 'navId' ] . '/' , 'src' => $keyvisual[ 'imgName' ] . '_orig.' . $keyvisual[ 'imgExtension' ] , 'title' => $keyvisual[ 'imgTitle' ] ); - - /* Slider - Daten */ - if ( $keyvisual[ 'sliderContent' ] !== '' ) - { - $sliders = explode ( ';' , $keyvisual[ 'sliderContent' ] ); - - foreach ( $sliders as $imageId ) - { - $imageData = $db -> query - ( - 'SELECT - * - FROM - ' . $prefix . '_' . TBL_IMAGE . ' - WHERE - id = "' . $imageId . '";' - ); - $image = $imageData -> fetch_assoc ( ); - $data[ 'keyvisual' ][ ] = array ( 'id' => $image[ 'id' ] , 'path' => PATH_MED . $prefix . '/' . $_GET[ 'navId' ] . '/' , 'src' => $image[ 'imgName' ] . '.' . $image[ 'imgExtension' ] , 'title' => $image[ 'imgTitle' ] ); - $data[ 'galery' ][ ] = array ( 'id' => $image[ 'id' ] , 'path' => PATH_MED . $prefix . '/' . $_GET[ 'navId' ] . '/' , 'src' => $image[ 'imgName' ] . '_orig.' . $image[ 'imgExtension' ] , 'title' => $image[ 'imgTitle' ] ); - } - - } - } - else - { - $data[ 'keyvisual' ][ ] = array ( 'id' => null , 'path' => PATH_MED . $prefix . '/' , 'navId' => '' , 'src' => 'keyvisual_0.jpg' , 'title' => null ); - } - - if ( $specialSite !== false ) - { - if ( $specialSite === 'uebersicht' ) - { - $contents = $db -> query - ( - 'SELECT - * - FROM - ' . $prefix . '_' . TBL_NAVI . ' - WHERE - ' . $prefix . '_navStart = "' . $_GET[ 'navId' ] . '" - ORDER BY - ' . $prefix . '_navSort ASC;' - ); - while ( $content = $contents -> fetch_assoc ( ) ) - { - $tmp_content[ 'headline' ] = $content[ $prefix . '_navName' ]; - $tmp_content[ 'link' ] = $content[ $prefix . '_navTarget' ]; - $tmp_special = fnc_getNavType ( $prefix , $content[ $prefix . '_navId' ] ); - if ( $tmp_special !== false ) - { - $sub_contents = $db -> query - ( - 'SELECT - * - FROM - ' . $prefix . '_' . $tmp_special . ' - WHERE - siteId = "' . $content[ $prefix . '_navId' ] . '";' - ); - if ( $sub_contents === false ) - { - continue; - } - $sub_content = $sub_contents -> fetch_assoc ( ); - $sub_content[ 'type' ] = $tmp_special; - } - $data[ 'content' ][ 'uebersicht' ][ ] = $sub_content; - } - } - elseif ( $specialSite === 'spielbericht' ) - { - $contents = $db -> query - ( - 'SELECT - * - FROM - ' . $prefix . '_' . $specialSite . ' - WHERE - siteId = "' . $_GET[ 'navId' ] . '";' - ); - $content = $contents -> fetch_assoc ( ); - - $dateTime = DateTime::createFromFormat ( 'Y-m-d' , $content[ 'datum' ] ); - $data[ 'content' ][ 'spielbericht' ] = $content; - } - elseif ( $specialSite === 'turnier' ) - { - $contents = $db -> query - ( - 'SELECT - * - FROM - ' . $prefix . '_' . $specialSite . ' - WHERE - siteId = "' . $_GET[ 'navId' ] . '";' - ); - $content = $contents -> fetch_assoc ( ); - - $dateTime = DateTime::createFromFormat ( 'Y-m-d' , $content[ 'datum' ] ); - $data[ 'content' ][ 'turnier' ] = $content; - } - elseif ( $specialSite === 'widget' ) - { - $contents = $db -> query - ( - 'SELECT - * - FROM - ' . $prefix . '_' . $specialSite . ' - WHERE - siteId = "' . $_GET[ 'navId' ] . '";' - ); - if ( $contents -> num_rows !== 0 ) - { - $content = $contents -> fetch_assoc ( ); - $data[ 'content' ][ 'widget' ] = array ( 'id' => $content[ 'id' ] , 'tpl' => $content[ 'widget' ] , 'schluessel' => $vC[ 'portal' ][ 'website' ][ $content[ 'widget' ] ][ $web_key ] , 'wettbewerb' => $content[ 'wettbewerb' ] ); - } - } - } - else - { - $contents = $db -> query - ( - 'SELECT - * - FROM - ' . $prefix . '_content - WHERE - siteId = "' . $_GET[ 'navId' ] . '";' - ); - if ( $contents -> num_rows !== 0 ) - { - $content = $contents -> fetch_assoc ( ); - if ( $content[ 'siteContents' ] !== '' ) - { - $data[ 'content' ][ 'pageContents' ] = fnc_getSiteContents( $content[ 'siteContents' ] , $prefix ); - foreach ( $data[ 'content' ][ 'pageContents' ] as $tmp_content ) - { - if ( isset( $tmp_content[ 'type' ] ) && $tmp_content[ 'type' ] === 'textimage' ) - { - $data[ 'galery' ][ ] = array ( 'id' => $tmp_content[ 'content_image_id' ] , 'path' => PATH_MED . $prefix . '/' . $_GET[ 'navId' ] . '/' , 'src' => $tmp_content[ 'imgName' ] . '_orig.' . $tmp_content[ 'imgExtension' ] , 'title' => $tmp_content[ 'imgTitle' ] ); - } - } - } - } - } - - foreach ( $arr_navs as $key => $value ) - { - if ( $value !== null ) - { - $data[ $def[ 'navPostion' ][ $key ] ] = $value; - } - } - - /* Template rendern */ - $render = new viewClass ( ); - $render -> setConfig ( $vC ); - $render -> setPrefix ( $prefix ); - $render -> setPathTpl ( PATH_WEBSITE_TPL ); - $render -> setLang ( $lang[ 'website' ] ); - $render -> setTemplate ( 'main' ); - if ( $specialSite !== false ) - { - $render -> setSpecialSite ( true ); - } - $render -> setSiteId ( $_GET[ 'navId' ] ); - $render -> setEditable ( $editable ); - $render -> setWebkey ( $_GET[ 'siteId' ] ); - $render -> setData ( $data ); - $render -> setNavpath ( $pathWay ); - - $html = $render -> output ( ); - $html = str_replace ( array ( 'PHP_ROOT_PATH/' , 'PHP_SITE_PATH/' ) , array ( PATH_ROOT , PATH_SITE ) , $html ); - // $html = str_replace ( array ( "\r" , "\n" , "\t" ) , array ( '' , '' , '' ) , $html ); - echo $html; +$pathRoot = dirname(dirname(dirname(__DIR__))) . '/'; +include_once($pathRoot . '.config/config_global.php'); +require_once(PATH_CLS . 'rendering/viewClass.php'); -?> +/* Funktionen und Aktionen einbinden */ +include_once(PATH_FNC . 'fnc_portal.php'); + +/* Variablen aufbereiten */ +$editable = false; +$_GET['navId'] = (isset ($_GET['navId']) && !empty ($_GET['navId'])) + ? $_GET['navId'] + : '1'; +$web_key = array_search($_GET['siteId'], $vC['portal']['website']['navId']); +$prefix = ($web_key !== false) + ? $vC['portal']['website']['prefix'][$web_key] + : ''; +$pathWay = ($prefix !== '') + ? fnc_createPathHome($prefix, $_GET['navId']) + : array(); + +/* Portal Zugriffsrechte prüfen */ +include_once(PATH_INC . 'portal_rights.php'); + +/* Website Bearbeitungsrechte prüfen */ +include_once(PATH_INC . 'website_rights.php'); + +/* Template - Definitionen einbinden */ +include_once(PATH_WEBSITE_TPL . $prefix . '/tpl_definitions.php'); + +/* Daten für Template aufbereiten */ +$navComplete = fnc_getNavigationArray($prefix); +$arr_navs = fnc_getSingleNavigationArrays($prefix, $navComplete, $def, $pathWay); + +$specialSite = fnc_getNavType($prefix, $_GET['navId']); + +$navpointData = $db->query('SELECT * FROM ' . $prefix . '_' . TBL_NAVI . ' WHERE ' . $prefix . '_navId = ' . $_GET['navId'] . ';'); +$navpoint = $navpointData->fetch_assoc(); + +if (!is_null($navpoint[$prefix . '_keyvisual'])) +{ + /* Keyvisual */ + $keyvisualData = $db->query('SELECT * FROM ' . $prefix . '_' . TBL_IMAGE . ' WHERE id = ' . $navpoint[$prefix . '_keyvisual'] . ';'); + $keyvisual = $keyvisualData->fetch_assoc(); + $data['keyvisual'][] = array('id' => $keyvisual['id'], 'path' => PATH_MED . $prefix . '/' . $_GET['navId'] . '/', 'src' => $keyvisual['imgName'] . '.' . $keyvisual['imgExtension'], 'title' => $keyvisual['imgTitle']); + $data['galery'][] = array('id' => $keyvisual['id'], 'path' => PATH_MED . $prefix . '/' . $_GET['navId'] . '/', 'src' => $keyvisual['imgName'] . '_orig.' . $keyvisual['imgExtension'], 'title' => $keyvisual['imgTitle']); + + /* Slider - Daten */ + if ($keyvisual['sliderContent'] !== '') + { + $sliders = explode(';', $keyvisual['sliderContent']); + + foreach ($sliders as $imageId) + { + $imageData = $db->query('SELECT * FROM ' . $prefix . '_' . TBL_IMAGE . ' WHERE id = ' . $imageId . ';'); + $image = $imageData->fetch_assoc(); + $data['keyvisual'][] = array('id' => $image['id'], 'path' => PATH_MED . $prefix . '/' . $_GET['navId'] . '/', 'src' => $image['imgName'] . '.' . $image['imgExtension'], 'title' => $image['imgTitle']); + $data['galery'][] = array('id' => $image['id'], 'path' => PATH_MED . $prefix . '/' . $_GET['navId'] . '/', 'src' => $image['imgName'] . '_orig.' . $image['imgExtension'], 'title' => $image['imgTitle']); + } + + } +} +else +{ + $data['keyvisual'][] = array('id' => null, 'path' => PATH_MED . $prefix . '/', 'navId' => '', 'src' => 'keyvisual_0.jpg', 'title' => null); +} + +if ($specialSite !== false) +{ + if ($specialSite === 'uebersicht') + { + $contents = $db->query('SELECT * FROM ' . $prefix . '_' . TBL_NAVI . ' WHERE ' . $prefix . '_navStart = ' . $_GET['navId'] . ' ORDER BY ' . $prefix . '_navSort ASC;'); + + while ($content = $contents->fetch_assoc()) + { + $tmp_content['headline'] = $content[$prefix . '_navName']; + $tmp_content['link'] = $content[$prefix . '_navTarget']; + $tmp_special = fnc_getNavType($prefix, $content[$prefix . '_navId']); + + if ($tmp_special !== false) + { + $sub_contents = $db->query('SELECT * FROM ' . $prefix . '_' . $tmp_special . ' WHERE siteId = ' . $content[$prefix . '_navId'] . ';'); + if ($sub_contents === false) + { + continue; + } + $sub_content = $sub_contents->fetch_assoc(); + $sub_content['type'] = $tmp_special; + } + else + { + $sub_contents = $db->query('SELECT * FROM ' . $prefix . '_' . TBL_CONTENT . ' WHERE siteId = ' . $content[$prefix . '_navId'] . ';'); + if ($sub_contents === false) + { + continue; + } + $tmp_content = $sub_contents->fetch_assoc(); + if ($tmp_content['siteContents'] !== '') + { + $tmp_data['content']['pageContents'] = fnc_getSiteContents($tmp_content['siteContents'], $prefix); + $sub_content = $tmp_data['content']['pageContents']; + $sub_content['type'] = 'standard'; + } + } + $data['content']['uebersicht'][] = $sub_content; + } + } + elseif ($specialSite === 'spielbericht') + { + $contents = $db->query('SELECT * FROM ' . $prefix . '_' . $specialSite . ' WHERE siteId = ' . $_GET['navId'] . ';'); + $content = $contents->fetch_assoc(); + + $dateTime = DateTime::createFromFormat('Y-m-d', $content['datum']); + $data['content']['spielbericht'] = $content; + } + elseif ($specialSite === 'turnier') + { + $contents = $db->query('SELECT * FROM ' . $prefix . '_' . $specialSite . ' WHERE siteId = ' . $_GET['navId'] . ';'); + $content = $contents->fetch_assoc(); + + $dateTime = DateTime::createFromFormat('Y-m-d', $content['datum']); + $data['content']['turnier'] = $content; + } + elseif ($specialSite === 'widget') + { + $contents = $db->query('SELECT * FROM ' . $prefix . '_' . $specialSite . ' WHERE siteId = ' . $_GET['navId'] . ';'); + if ($contents->num_rows !== 0) + { + $content = $contents->fetch_assoc(); + $data['content']['widget'] = array('id' => $content['id'], 'tpl' => $content['widget'], 'schluessel' => $vC['portal']['website'][$content['widget']][$web_key], 'wettbewerb' => $content['wettbewerb']); + } + } +} +else +{ + $contents = $db->query('SELECT * FROM ' . $prefix . '_content WHERE siteId = ' . $_GET['navId'] . ';'); + if ($contents->num_rows !== 0) + { + $content = $contents->fetch_assoc(); + if ($content['siteContents'] !== '') + { + $data['content']['pageContents'] = fnc_getSiteContents($content['siteContents'], $prefix); + + foreach ($data['content']['pageContents'] as $tmp_content) + { + if (isset($tmp_content['type']) && $tmp_content['type'] === 'textimage') + { + $data['galery'][] = array('id' => $tmp_content['content_image_id'], 'path' => PATH_MED . $prefix . '/' . $_GET['navId'] . '/', 'src' => $tmp_content['imgName'] . '_orig.' . $tmp_content['imgExtension'], 'title' => $tmp_content['imgTitle']); + } + } + + } + } +} + +foreach ($arr_navs as $key => $value) +{ + if ($value !== null) + { + $data[$def['navPostion'][$key]] = $value; + } +} + +/* Template rendern */ +$render = new viewClass (); +$render->setConfig($vC); +$render->setPrefix($prefix); +$render->setPathTpl(PATH_WEBSITE_TPL); +$render->setLang($lang['website']); +$render->setTemplate('main'); +if ($specialSite !== false) +{ + $render->setSpecialSite(true); +} +$render->setSiteId($_GET['navId']); +$render->setEditable($editable); +$render->setWebkey($_GET['siteId']); +$render->setData($data); +$render->setNavpath($pathWay); + +$html = $render->output(); +$html = str_replace(array('PHP_ROOT_PATH/', 'PHP_SITE_PATH'), array(PATH_ROOT, PATH_SITE), $html); +// $html = str_replace ( array ( "\r" , "\n" , "\t" ) , array ( '' , '' , '' ) , $html ); +echo $html; \ No newline at end of file diff --git a/administrator/popups/logfiles/index.php b/administrator/popups/logfiles/index.php index da0c7a2..9cf8f02 100644 --- a/administrator/popups/logfiles/index.php +++ b/administrator/popups/logfiles/index.php @@ -1,79 +1,77 @@ query ( 'SELECT * FROM ' . TBL_LOG . ' WHERE YEAR ( logTS ) = "' . $_GET[ 'year' ] . '" AND MONTH ( logTS ) = "' . $_GET[ 'month' ] . '" ORDER BY ' . $_GET[ 'orderBy' ] . ' ' . $_GET[ 'orderDir' ] . ';' ); - while ( $tmp_content = $content -> fetch_assoc ( ) ) - { - $tmp_content[ 'logEntry' ] = fnc_readLog ( $lang[ 'log' ][ $tmp_content[ 'logEntry' ] ] , $tmp_content[ 'logParams' ] ); - $tmp_content[ 'logUser' ] = fnc_getUsernameById ( $tmp_content[ 'logUser' ] ); - $tmp_content[ 'logTS' ] = fnc_getTimeByTS ( $tmp_content[ 'logTS' ] ); - $sort[ ] = $tmp_content[ $_GET[ 'orderBy' ] ]; - $data[ 'sub_content' ][ 'main' ][ ] = $tmp_content; - } +define('PATH_ROOT', '../../../'); +include_once(PATH_ROOT . '.config/config_global.php'); +require_once(PATH_CLS . 'rendering/viewClass.php'); - if ( $_GET[ 'orderBy' ] === 'logUser' ) - { - $order = ( $_GET[ 'orderDir' ] === 'DESC' ) - ? SORT_DESC - : SORT_ASC; - array_multisort( $sort , $order , $data[ 'sub_content' ][ 'main' ] ); - } +/* Funktionen und Aktionen einbinden */ +include_once(PATH_FNC . 'fnc_portal.php'); - $year = $db -> query ( 'SELECT YEAR ( logTS ) AS firstYear FROM ' . TBL_LOG . ' ORDER BY logTS ASC LIMIT 1; ' ); - $tmp_year = $year -> fetch_assoc ( ); - $tmp_year = $tmp_year[ 'firstYear' ]; - for ( $tmp_year ; $tmp_year <= date ( 'Y' ) ; $tmp_year++ ) - { - $data[ 'sub_content' ][ 'header' ][ 'year' ][ $tmp_year ] = $tmp_year; - } - - for ( $month = 1; $month <= 12 ; $month++ ) - { - $data[ 'sub_content' ][ 'header' ][ 'month' ][ $month ] = $lang[ 'month' ][ $month ]; - } - - /* Template rendern */ - $render = new viewClass ( ); - $render -> setPrefix ( $vC[ 'portal' ][ 'layout' ] ); - $render -> setPathTpl ( PATH_PORTAL_TPL ); - $render -> setConfig ( $vC ); - $render -> setTemplate ( 'logfiles' ); - $render -> setEditable ( false ); - $render -> setData ( $data ); - $render -> setLang ( $lang[ 'logfiles' ] ); - $render -> setFormdata ( array_merge ( $_GET , $_POST ) ); - - $html = $render -> output ( ); - $html = str_replace ( array ( 'PHP_ROOT_PATH/' , 'PHP_SITE_PATH/' ) , array ( PATH_ROOT , PATH_SITE ) , $html ); - $html = str_replace ( array ( "\r" , "\n" , "\t" ) , array ( '' , '' , '' ) , $html ); - echo $html; +/* Variablen aufbereiten */ +$_GET['siteId'] = '100'; +$_GET['year'] = (isset ($_GET['year']) && !empty ($_GET['year'])) + ? $_GET['year'] + : date('Y'); +$_GET['month'] = (isset ($_GET['month']) && !empty ($_GET['month'])) + ? $_GET['month'] + : date('n'); +$_GET['orderBy'] = (isset ($_GET['orderBy']) && !empty ($_GET['orderBy'])) + ? $_GET['orderBy'] + : 'logTS'; +$_GET['orderDir'] = (isset ($_GET['orderDir']) && !empty ($_GET['orderDir'])) + ? $_GET['orderDir'] + : 'DESC'; +$sort = array(); -?> \ No newline at end of file +/* Portal Zugriffsrechte prüfen */ +include_once(PATH_INC . 'portal_rights.php'); + +/* Daten für Template aufbereiten */ +$content = $db->query('SELECT * FROM ' . TBL_LOG . ' WHERE YEAR ( logTS ) = "' . $_GET['year'] . '" AND MONTH ( logTS ) = "' . $_GET['month'] . '" ORDER BY ' . $_GET['orderBy'] . ' ' . $_GET['orderDir'] . ';'); +while ($tmp_content = $content->fetch_assoc()) +{ + $tmp_content['logEntry'] = fnc_readLog($lang['log'][$tmp_content['logEntry']], $tmp_content['logParams']); + $tmp_content['logUser'] = fnc_getUsernameById($tmp_content['logUser']); + $tmp_content['logTS'] = fnc_getTimeByTS($tmp_content['logTS']); + $sort[] = $tmp_content[$_GET['orderBy']]; + $data['sub_content']['main'][] = $tmp_content; +} + +if ($_GET['orderBy'] === 'logUser') +{ + $order = ($_GET['orderDir'] === 'DESC') + ? SORT_DESC + : SORT_ASC; + array_multisort($sort, $order, $data['sub_content']['main']); +} + +$year = $db->query('SELECT YEAR ( logTS ) AS firstYear FROM ' . TBL_LOG . ' ORDER BY logTS ASC LIMIT 1; '); +$tmp_year = $year->fetch_assoc(); +$tmp_year = $tmp_year['firstYear']; +for ($tmp_year; $tmp_year <= date('Y'); $tmp_year++) +{ + $data['sub_content']['header']['year'][$tmp_year] = $tmp_year; +} + +for ($month = 1; $month <= 12; $month++) +{ + $data['sub_content']['header']['month'][$month] = $lang['month'][$month]; +} + +/* Template rendern */ +$render = new viewClass (); +$render->setPrefix($vC['portal']['layout']); +$render->setPathTpl(PATH_PORTAL_TPL); +$render->setConfig($vC); +$render->setTemplate('logfiles'); +$render->setEditable(false); +$render->setData($data); +$render->setLang($lang['logfiles']); +$render->setFormdata(array_merge($_GET, $_POST)); + +$html = $render->output(); +$html = str_replace(array('PHP_ROOT_PATH', 'PHP_SITE_PATH'), array(PATH_ROOT, PATH_SITE), $html); +$html = str_replace(array("\r", "\n", "\t"), array('', '', ''), $html); +echo $html; \ No newline at end of file diff --git a/administrator/popups/usermanagement/index.php b/administrator/popups/usermanagement/index.php index f58453a..0112a73 100644 --- a/administrator/popups/usermanagement/index.php +++ b/administrator/popups/usermanagement/index.php @@ -1,177 +1,175 @@ array ( 'dataEditing' => 'userId' ) - ); - - $arr_todoIds = array - ( - '1' => 'overview' , /* Übersicht */ - '2' => 'create' , /* Benutzer anlegen */ - '3' => 'activate' , /* Benutzer aktivieren */ - '4' => 'deactivate' , /* Benutzer deaktivieren */ - '5' => 'edit' , /* Benutzer bearbeiten */ - '6' => 'delete' , /* Benutzer löschen */ - '7' => 'pwreset' /* Passwort zurücksetzen */ - ); - - $form_data = null; - $lang[ 'usermanagement' ][ 'error' ] = $lang[ 'error' ]; +/* Funktionen und Aktionen einbinden */ +include_once(PATH_FNC . 'fnc_portal.php'); +// include_once ( PATH_FNC . 'fnc_usermanagement.php' ); +include_once(PATH_ACT . 'usermanagement_actions.php'); + +/* Variablen aufbereiten */ +$_GET['siteId'] = '3'; +$_GET['todoId'] = (isset ($_GET['todoId']) && !empty ($_GET['todoId'])) + ? $_GET['todoId'] + : '1'; +$_GET['filter'] = (isset ($_GET['filter']) && !empty ($_GET['filter'])) + ? $_GET['filter'] + : ''; +$_GET['orderBy'] = (isset ($_GET['orderBy']) && !empty ($_GET['orderBy'])) + ? $_GET['orderBy'] + : 'userName'; +$_GET['orderDir'] = (isset ($_GET['orderDir']) && !empty ($_GET['orderDir'])) + ? $_GET['orderDir'] + : 'ASC'; + +$sqlOrder = ($_GET['orderBy'] === 'userName') + ? 'userLastname ' . $_GET['orderDir'] . ' , userFirstname ' . $_GET['orderDir'] + : $_GET['orderBy'] . ' ' . $_GET['orderDir']; + +$dataParameter = array +( + '1' => array('dataEditing' => 'userId') +); + +$arr_todoIds = array +( + '1' => 'overview', /* Übersicht */ + '2' => 'create', /* Benutzer anlegen */ + '3' => 'activate', /* Benutzer aktivieren */ + '4' => 'deactivate', /* Benutzer deaktivieren */ + '5' => 'edit', /* Benutzer bearbeiten */ + '6' => 'delete', /* Benutzer löschen */ + '7' => 'pwreset' /* Passwort zurücksetzen */ +); + +$form_data = null; +$lang['usermanagement']['error'] = $lang['error']; - /* Portal Zugriffsrechte prüfen */ - include_once ( PATH_INC . 'portal_rights.php' ); - - /* Daten für Template aufbereiten */ - if ( $_GET[ 'todoId' ] === '1' ) +/* Portal Zugriffsrechte prüfen */ +include_once(PATH_INC . 'portal_rights.php'); + +/* Daten für Template aufbereiten */ +if ($_GET['todoId'] === '1') +{ + $content = $db->query('SELECT * FROM ' . TBL_USER . ' WHERE userDelete = "N" AND userId != "1" AND ( userFirstname LIKE "%' . $_GET['filter'] . '%" OR userLastname LIKE "%' . $_GET['filter'] . '%" ) ORDER BY ' . $sqlOrder . ';'); + $data['sub_content']['header']['filter'] = $_GET['filter']; +} +else +{ + if (in_array($_GET['todoId'], array('2', '5'))) + { + $portalNav = fnc_getNavigationArray('portal', true, array('main'), $lang['navi']); + foreach ($portalNav as $navStart => $navArray) { - $content = $db -> query ( 'SELECT * FROM ' . TBL_USER . ' WHERE userDelete = "N" AND userId != "1" AND ( userFirstname LIKE "%' . $_GET[ 'filter' ] . '%" OR userLastname LIKE "%' . $_GET[ 'filter' ] . '%" ) ORDER BY ' . $sqlOrder . ';' ); - $data[ 'sub_content' ][ 'header' ][ 'filter' ] = $_GET[ 'filter' ]; - } - else - { - if ( in_array ( $_GET[ 'todoId' ] , array ( '2' , '5' ) ) ) + foreach ($navArray as $key => $value) + { + $websiteKey = array_search($value['portal_navId'], $vC['portal']['website']['navId']); + + if ($websiteKey !== false) { - $portalNav = fnc_getNavigationArray ( 'portal' , true , array ( 'main' ) , $lang[ 'navi' ] ); - foreach ( $portalNav as $navStart => $navArray ) - { - foreach ( $navArray as $key => $value ) - { - $websiteKey = array_search ( $value[ 'portal_navId' ] , $vC[ 'portal' ][ 'website' ][ 'navId' ] ); - - if ( $websiteKey !== false ) - { - $portalNav[ $navStart ][ $key ][ 'portal_navName' ] = $vC[ 'portal' ][ 'website' ][ 'names' ][ $websiteKey ]; - } - else - { - $portalNav[ $navStart ][ $key ][ 'portal_navName' ] = $lang[ 'navi' ][ 'site_' . $value[ 'portal_navId' ] ]; - } - - if ( $value[ 'portal_navId' ] === '1' ) - { - unset ( $portalNav[ $navStart ][ $key ] ); - } - } - } - $data[ 'main' ][ $arr_todoIds[ $_GET[ 'todoId' ] ] ][ 'portal_nav' ] = ( $_SESSION[ 'sess_portalRightsType' ] === 'ALL' ) - ? $portalNav - : fnc_getPortalNavigationArray ( 'portal' , $portalNav , $_SESSION[ 'sess_portalRights' ] ); - - - if ( ! empty ( $vC[ 'portal' ][ 'website' ][ 'navId' ] ) ) - { - foreach ( $vC[ 'portal' ][ 'website' ][ 'navId' ] as $key => $navId ) - { - $prefix = $vC[ 'portal' ][ 'website' ][ 'prefix' ][ $key ]; - $websiteNav = fnc_getNavigationArray ( $prefix , false ); - $data[ 'main' ][ $arr_todoIds[ $_GET[ 'todoId' ] ] ][ 'website_nav' ][ $prefix ] = array ( 'data' => $websiteNav , 'key' => $navId ); - } - } - - if ( isset ( $_POST ) && ! empty ( $_POST ) ) - { - $form_data = $_POST; - } + $portalNav[$navStart][$key]['portal_navName'] = $vC['portal']['website']['names'][$websiteKey]; } - - if ( ! in_array ( $_GET[ 'todoId' ] , array ( '2' ) ) ) + else { - $content = $db -> query ( 'SELECT * FROM ' . TBL_USER . ' WHERE userId = "' . $_GET[ 'userId' ] . '";' ); + $portalNav[$navStart][$key]['portal_navName'] = $lang['navi']['site_' . $value['portal_navId']]; } - } - - if ( isset ( $_POST ) && count ( $_POST ) > 0 ) - { - $data[ 'main' ][ $arr_todoIds[ $_GET[ 'todoId' ] ] ][ ] = $_POST; - } - elseif ( isset ( $content ) && $content -> num_rows !== 0 ) - { - while ( $tmp_content = $content -> fetch_assoc ( ) ) - { - $tmp_content[ 'userCreateUser' ] = fnc_getUsernameById ( $tmp_content[ 'userCreateUser' ] ); - $tmp_content[ 'userCreateTS' ] = fnc_getTimeByTS ( $tmp_content[ 'userCreateTS' ] ); - $tmp_content[ 'userActiveUser' ] = fnc_getUsernameById ( $tmp_content[ 'userActiveUser' ] ); - $tmp_content[ 'userActiveTS' ] = fnc_getTimeByTS ( $tmp_content[ 'userActiveTS' ] ); - $tmp_content[ 'user_portalRightsType' ] = $tmp_content[ 'userPortalRightsType' ]; - $tmp_content[ 'user_portalRights' ] = explode ( ';' , $tmp_content[ 'userPortalRights' ] ); - - foreach ( $vC[ 'portal' ][ 'website' ][ 'prefix' ] as $website ) - { - $tmp_right = $db -> query ( 'SELECT * FROM ' . TBL_RIGHTS . ' WHERE userId = "' . $tmp_content[ 'userId' ] . '" AND rightsPrefix = "' . $website . '" LIMIT 1;' ); - if ( $tmp_right -> num_rows === 0 ) - { - $tmp_content[ 'user_' . $website . 'RightsType' ] = 'DEF'; - $tmp_content[ 'user_' . $website . 'Rights' ] = ''; - } - else - { - $right = $tmp_right -> fetch_assoc ( ); - $tmp_content[ 'user_' . $website . 'RightsType' ] = $right[ 'rightsType' ]; - $tmp_content[ 'user_' . $website . 'Rights' ] = explode ( ';' , $right[ 'rights' ] ); - } - } - - $data[ 'main' ][ $arr_todoIds[ $_GET[ 'todoId' ] ] ][ ] = $tmp_content; - $form_data = $tmp_content; - } - } - else - { - $data[ 'main' ][ $arr_todoIds[ $_GET[ 'todoId' ] ] ][ 0 ] = array ( ); - } - - /* Template rendern */ - $render = new viewClass ( ); - $render -> setPrefix ( $vC[ 'portal' ][ 'layout' ] ); - $render -> setPathTpl ( PATH_PORTAL_TPL ); - $render -> setConfig ( $vC ); - $render -> setTemplate ( 'usermanagement' ); - $render -> setSiteId ( $_GET[ 'siteId' ] ); - $render -> setEditable ( false ); - $render -> setLang ( $lang[ 'usermanagement' ] ); - $render -> setData ( $data ); - $render -> setFormdata( $form_data ); - if ( isset ( $arrError ) && ! empty ( $arrError ) ) - { - $render -> setErrors ( $arrError ); - } - - $html = $render -> output ( ); - $html = str_replace ( array ( 'PHP_ROOT_PATH/' , 'PHP_SITE_PATH/' ) , array ( PATH_ROOT , PATH_SITE ) , $html ); - $html = str_replace ( array ( "\r" , "\n" , "\t" ) , array ( '' , '' , '' ) , $html ); - echo $html; -?> \ No newline at end of file + if ($value['portal_navId'] === '1') + { + unset ($portalNav[$navStart][$key]); + } + } + } + $data['main'][$arr_todoIds[$_GET['todoId']]]['portal_nav'] = ($_SESSION['sess_portalRightsType'] === 'ALL') + ? $portalNav + : fnc_getPortalNavigationArray('portal', $portalNav, $_SESSION['sess_portalRights']); + + + if (!empty ($vC['portal']['website']['navId'])) + { + foreach ($vC['portal']['website']['navId'] as $key => $navId) + { + $prefix = $vC['portal']['website']['prefix'][$key]; + $websiteNav = fnc_getNavigationArray($prefix, false); + $data['main'][$arr_todoIds[$_GET['todoId']]]['website_nav'][$prefix] = array('data' => $websiteNav, 'key' => $navId); + } + } + + if (isset ($_POST) && !empty ($_POST)) + { + $form_data = $_POST; + } + } + + if (!in_array($_GET['todoId'], array('2'))) + { + $content = $db->query('SELECT * FROM ' . TBL_USER . ' WHERE userId = "' . $_GET['userId'] . '";'); + } +} + +if (isset ($_POST) && count($_POST) > 0) +{ + $data['main'][$arr_todoIds[$_GET['todoId']]][] = $_POST; +} +elseif (isset ($content) && $content->num_rows !== 0) +{ + while ($tmp_content = $content->fetch_assoc()) + { + $tmp_content['userCreateUser'] = fnc_getUsernameById($tmp_content['userCreateUser']); + $tmp_content['userCreateTS'] = fnc_getTimeByTS($tmp_content['userCreateTS']); + $tmp_content['userActiveUser'] = fnc_getUsernameById($tmp_content['userActiveUser']); + $tmp_content['userActiveTS'] = fnc_getTimeByTS($tmp_content['userActiveTS']); + $tmp_content['user_portalRightsType'] = $tmp_content['userPortalRightsType']; + $tmp_content['user_portalRights'] = explode(';', $tmp_content['userPortalRights']); + + foreach ($vC['portal']['website']['prefix'] as $website) + { + $tmp_right = $db->query('SELECT * FROM ' . TBL_RIGHTS . ' WHERE userId = "' . $tmp_content['userId'] . '" AND rightsPrefix = "' . $website . '" LIMIT 1;'); + if ($tmp_right->num_rows === 0) + { + $tmp_content['user_' . $website . 'RightsType'] = 'DEF'; + $tmp_content['user_' . $website . 'Rights'] = ''; + } + else + { + $right = $tmp_right->fetch_assoc(); + $tmp_content['user_' . $website . 'RightsType'] = $right['rightsType']; + $tmp_content['user_' . $website . 'Rights'] = explode(';', $right['rights']); + } + } + + $data['main'][$arr_todoIds[$_GET['todoId']]][] = $tmp_content; + $form_data = $tmp_content; + } +} +else +{ + $data['main'][$arr_todoIds[$_GET['todoId']]][0] = array(); +} + +/* Template rendern */ +$render = new viewClass (); +$render->setPrefix($vC['portal']['layout']); +$render->setPathTpl(PATH_PORTAL_TPL); +$render->setConfig($vC); +$render->setTemplate('usermanagement'); +$render->setSiteId($_GET['siteId']); +$render->setEditable(false); +$render->setLang($lang['usermanagement']); +$render->setData($data); +$render->setFormdata($form_data); +if (isset ($arrError) && !empty ($arrError)) +{ + $render->setErrors($arrError); +} + +$html = $render->output(); +$html = str_replace(array('PHP_ROOT_PATH', 'PHP_SITE_PATH'), array(PATH_ROOT, PATH_SITE), $html); +$html = str_replace(array("\r", "\n", "\t"), array('', '', ''), $html); +echo $html; \ No newline at end of file diff --git a/administrator/webservices/.htaccess b/administrator/webservices/.htaccess new file mode 100644 index 0000000..b4cdba0 --- /dev/null +++ b/administrator/webservices/.htaccess @@ -0,0 +1,3 @@ + + RewriteEngine Off + \ No newline at end of file diff --git a/administrator/webservices/remote_data.php b/administrator/webservices/remote_data.php index 6237f60..cc509a8 100644 --- a/administrator/webservices/remote_data.php +++ b/administrator/webservices/remote_data.php @@ -1,890 +1,798 @@ query('SELECT * FROM ' . TBL_RIGHTS . ' WHERE userId = ' . $_POST['userId'] . ' AND rightsPrefix = "' . $_POST['prefix'] . '";'); + + if ($result->num_rows !== 0) { - if ( $table === 'navi' ) + $rights = $result->fetch_assoc(); + $result = $db->query('SELECT * FROM ' . $_POST['prefix'] . '_' . $table . ' ORDER BY ' . $_POST['prefix'] . '_navStart ASC, ' . $_POST['prefix'] . '_navSort ASC;'); + $arr_rights = explode(';', $rights['rights']); + + while ($fetch_data = $result->fetch_assoc()) + { + $fetch_data[$_POST['prefix'] . '_navEditable'] = 'false'; + $fetch_data[$_POST['prefix'] . '_navName'] = $fetch_data[$_POST['prefix'] . '_navName']; + + if ($rights['rightsType'] === 'ALL' || ($rights['rightsType'] === 'DEF' && (in_array($_POST['prefix'] . '_' . $fetch_data[$_POST['prefix'] . '_navId'], $arr_rights) || in_array($_POST['prefix'] . '_' . $fetch_data[$_POST['prefix'] . '_navStart'], $arr_rights)))) { - $result = $db -> query - ( - 'SELECT - * - FROM - ' . TBL_RIGHTS . ' - WHERE - userId = "' . $_POST[ 'userId' ] . '" AND - rightsPrefix = "' . $_POST[ 'prefix' ] . '";' - ); - - if ( $result -> num_rows !== 0 ) + if (!in_array($_POST['prefix'] . '_' . $fetch_data[$_POST['prefix'] . '_navId'], $arr_rights)) + { + $arr_rights[] = $_POST['prefix'] . '_' . $fetch_data[$_POST['prefix'] . '_navId']; + } + $fetch_data[$_POST['prefix'] . '_navEditable'] = 'true'; + } + elseif ($rights['rightsType'] === 'DEF' && (in_array($fetch_data[$_POST['prefix'] . '_navId'], $arr_rights) || in_array($fetch_data[$_POST['prefix'] . '_navStart'], $arr_rights))) + { + if (!in_array($fetch_data[$_POST['prefix'] . '_navId'], $arr_rights)) + { + $arr_rights[] = $fetch_data[$_POST['prefix'] . '_navId']; + } + $fetch_data[$_POST['prefix'] . '_navEditable'] = 'true'; + } + $data['navigation']['navStart_' . $fetch_data[$_POST['prefix'] . '_navStart']]['navId_' . $fetch_data[$_POST['prefix'] . '_navId']] = $fetch_data; + } + $data['navPath'] = explode(' ', fnc_getNavPathArray($_POST['prefix'], $_POST['navId'])); + } + else + { + $data = 'ERROR FETCHING USER RIGHTS'; + } + } + else + { + $result = $db->query('SELECT * FROM ' . $_POST['prefix'] . '_' . $table . ' WHERE id = ' . $id . ';'); + $fetch_data = $result->fetch_assoc(); + $data = $fetch_data; + } + + echo json_encode($data, JSON_UNESCAPED_UNICODE); +} + +else if ($_POST['request'] === 'updateData') +{ + $error = false; + + if ($table === 'navi') + { + + switch ($_POST['formAction']) + { + case 'renameNavPoint' : + $result = $db->query('UPDATE ' . $_POST['prefix'] . '_' . $table . ' SET ' . $_POST['prefix'] . '_navName = "' . $_POST['navName'] . '" WHERE ' . $_POST['prefix'] . '_navId = ' . $_POST['navId'] . ' LIMIT 1;'); + break; + + case 'updateActive' : + $result = $db->query('UPDATE ' . $_POST['prefix'] . '_' . $table . ' SET ' . $_POST['prefix'] . '_navActive = "' . $_POST['navActive'] . '" WHERE ' . $_POST['prefix'] . '_navId = ' . $_POST['navId'] . ' LIMIT 1;'); + break; + + case 'sortNavPoint' : + $sort = 1; + $newSort = json_decode($_POST['newSort']); + + foreach ($newSort as $sortPoint) + { + $navPointArray = explode('_', $sortPoint); + $navId = $navPointArray[1]; + $update = $db->query('UPDATE ' . $_POST['prefix'] . '_' . $table . ' SET ' . $_POST['prefix'] . '_navSort = "' . $sort . '" WHERE ' . $_POST['prefix'] . '_navId = ' . $navId . ' LIMIT 1;'); + ++$sort; + } + + $result = true; + break; + + case 'moveNavPoint' : + $result = $db->query('UPDATE ' . $_POST['prefix'] . '_' . $table . ' SET ' . $_POST['prefix'] . '_navStart = ' . $_POST['navStart'] . ' WHERE ' . $_POST['prefix'] . '_navId = ' . $_POST['navId'] . ' LIMIT 1;'); + break; + + default : + var_dump($_POST); + break; + + } + + if (!$result) + { + $error = true; + } + } + else + { + $columns = $db->query('SHOW COLUMNS FROM ' . $_POST['prefix'] . '_' . $table . ';'); + $fieldNames = array(); + while ($column = $columns->fetch_assoc()) + { + $fieldNames[] = $column['Field']; + } + + foreach ($_POST as $key => $value) + { + if (in_array($key, $fieldNames)) + { + $data[] = $key . ' = "' . $db->real_escape_string($value) . '"'; + } + } + + + /* Behandlung Keyvisual und Content-Image */ + if ($table === 'content_image') + { + if (!is_dir(PATH_MED . $_POST['prefix'] . '/' . $_POST['navId'])) + { + mkdir(PATH_MED . $_POST['prefix'] . '/' . $_POST['navId'], 0755); + } + + if (isset ($_POST['uploadFile']) && !empty ($_POST['uploadFile'])) + { + $old = $db->query('SELECT * FROM ' . $_POST['prefix'] . '_' . $table . ' WHERE id = ' . $id . ';'); + $old_data = $old->fetch_assoc(); + + if (!isset ($_POST['formAction']) || (isset ($_POST['formAction']) && $_POST['formAction'] !== 'appendImage')) + { + $file_path = PATH_MED . $_POST['prefix'] . '/' . $_POST['navId'] . '/' . $old_data['imgName']; + + /* Alte Bilddaten löschen */ + unlink($file_path . '.' . $old_data['imgExtension']); + unlink($file_path . '_orig.' . $old_data['imgExtension']); + unlink($file_path . '_thumb.' . $old_data['imgExtension']); + } + + /* Bilddaten auslesen */ + $imageData = explode(',', $_POST['uploadFile']); + + /* Bilddaten dekodieren */ + $mimetype = str_replace(array('data:', ';base64'), '', $imageData[0]); + $encodedData = str_replace(' ', '+', $imageData[1]); + $decodedData = base64_decode($encodedData); + + /* Bildnamen und Erweiterung generieren */ + $keys = (array_keys($vC['mimetypes'], $mimetype)); + $extension = $keys[0]; + $file_name = fnc_buildUniqueFileName($_POST['prefix'], $_POST['navId'], $_POST['imgName'], $extension); + + /* Originales Bild speichern */ + $file_name_temp = substr($file_name, 0, strrpos($file_name, '.')) . '_temp' . substr($file_name, strrpos($file_name, '.')); + $file_name_orig = substr($file_name, 0, strrpos($file_name, '.')) . '_orig' . substr($file_name, strrpos($file_name, '.')); + + file_put_contents(PATH_MED . $_POST['prefix'] . '/' . $_POST['navId'] . '/' . $file_name_temp, $decodedData); + fnc_checkOrigResize(PATH_MED . $_POST['prefix'] . '/' . $_POST['navId'] . '/', $file_name_orig, $file_name_temp, $extension, ${$_POST['prefix']}['dimOrig']); + + if (isset ($_POST['formAction']) && $_POST['formAction'] === 'appendImage') + { + /* Werte für Datenbank aktualisieren */ + foreach ($data as $key => $value) + { + if (strpos($value, 'imgExtension') !== false) { - $rights = $result -> fetch_assoc( ); - $result = $db -> query - ( - 'SELECT - * - FROM - ' . $_POST[ 'prefix' ] . '_' . $table . ' - ORDER BY - ' . $_POST[ 'prefix' ] . '_navStart ASC , - ' . $_POST[ 'prefix' ] . '_navSort ASC;' - ); - $arr_rights = explode( ';' , $rights[ 'rights' ] ); - - while ( $fetch_data = $result -> fetch_assoc( ) ) - { - $fetch_data[ $_POST[ 'prefix' ] . '_navEditable' ] = 'false'; - $fetch_data[ $_POST[ 'prefix' ] . '_navName' ] = $fetch_data[ $_POST[ 'prefix' ] . '_navName' ]; - - if ( $rights[ 'rightsType' ] === 'ALL' || ( $rights[ 'rightsType' ] === 'DEF' && ( in_array ( $_POST[ 'prefix' ] . '_' . $fetch_data[ $_POST[ 'prefix' ] . '_navId' ] , $arr_rights ) || in_array ( $_POST[ 'prefix' ] . '_' . $fetch_data[ $_POST[ 'prefix' ] . '_navStart' ] , $arr_rights ) ) ) ) - { - if ( ! in_array ( $_POST[ 'prefix' ] . '_' . $fetch_data[ $_POST[ 'prefix' ] . '_navId' ] , $arr_rights ) ) - { - $arr_rights[ ] = $_POST[ 'prefix' ] . '_' . $fetch_data[ $_POST[ 'prefix' ] . '_navId' ]; - } - $fetch_data[ $_POST[ 'prefix' ] . '_navEditable' ] = 'true'; - } - elseif ( $rights[ 'rightsType' ] === 'DEF' && ( in_array ( $fetch_data[ $_POST[ 'prefix' ] . '_navId' ] , $arr_rights ) || in_array ( $fetch_data[ $_POST[ 'prefix' ] . '_navStart' ] , $arr_rights ) ) ) - { - if ( ! in_array ( $fetch_data[ $_POST[ 'prefix' ] . '_navId' ] , $arr_rights ) ) - { - $arr_rights[ ] = $fetch_data[ $_POST[ 'prefix' ] . '_navId' ]; - } - $fetch_data[ $_POST[ 'prefix' ] . '_navEditable' ] = 'true'; - file_put_contents ( 'test.log' , var_export( $arr_rights , true ) . "\n", FILE_APPEND ); - //$fetch_data[ $_POST[ 'prefix' ] . '_navEditable' ] = 'true'; - } - $data[ 'navigation' ][ 'navStart_' . $fetch_data[ $_POST[ 'prefix' ] . '_navStart' ] ][ 'navId_' . $fetch_data[ $_POST[ 'prefix' ] . '_navId' ] ] = $fetch_data; - } - $data[ 'navPath' ] = explode ( ' ' , fnc_getNavPathArray( $_POST[ 'prefix' ] , $_POST[ 'navId' ] ) ); + $data[$key] = 'imgExtension = "' . $db->real_escape_string($extension) . '"'; } + else if (strpos($value, 'imgName') !== false) + { + $data[$key] = 'imgName = "' . $db->real_escape_string(str_replace('.' . $extension, '', $file_name)) . '"'; + } + } + + $new = $db->query + ( + 'INSERT INTO + ' . $_POST['prefix'] . '_' . $table . ' + SET + ' . implode(' , ', $data) + ); + $new_id = $db->insert_id; + + unset ($data); + + if ($old_data['sliderContent'] === '') + { + $slider = array($new_id); + } else - { - $data = 'ERROR FETCHING USER RIGHTS'; - } + { + $slider = explode(';', $old_data['sliderContent']); + $slider[] = $new_id; + } + + $data = array(); + $data[] = 'sliderContent = "' . $db->real_escape_string(implode(';', $slider)) . '"'; + $data[] = 'hasSlider = "Y"'; } + } else + { + if (isset ($_POST['formAction']) && $_POST['formAction'] === 'updateSort') { - $result = $db -> query - ( - 'SELECT - * - FROM - ' . $_POST[ 'prefix' ] . '_' . $table . ' - WHERE - id = "' . $id . '";' - ); - $fetch_data = $result -> fetch_assoc( ); - $data = $fetch_data; + $db->query('UPDATE ' . $_POST['prefix'] . '_' . TBL_NAVI . ' SET ' . $_POST['prefix'] . '_keyvisual = ' . $id . ' WHERE ' . $_POST['prefix'] . '_navId = ' . $_POST['navId'] . ' LIMIT 1;'); } - - echo json_encode( $data , JSON_UNESCAPED_UNICODE ); - } - - else if ( $_POST[ 'request' ] === 'updateData' ) - { - $error = false; - - if ( $table === 'navi' ) + else { - - switch ( $_POST[ 'formAction' ] ) - { - case 'renameNavPoint' : - - $result = $db -> query - ( - 'UPDATE - ' . $_POST[ 'prefix' ] . '_' . $table . ' - SET - ' . $_POST[ 'prefix' ] . '_navName = "' . $_POST[ 'navName' ] . '" - WHERE - ' . $_POST[ 'prefix' ] . '_navId = "' . $id . '" - LIMIT 1;' - ); - break; - - case 'updateActive' : - - $result = $db -> query - ( - 'UPDATE - ' . $_POST[ 'prefix' ] . '_' . $table . ' - SET - ' . $_POST[ 'prefix' ] . '_navActive = "' . $_POST[ 'navActive' ] . '" - WHERE - ' . $_POST[ 'prefix' ] . '_navId = "' . $id . '" - LIMIT 1;' - ); - break; - - case 'sortNavPoint' : - - $sort = 1; - $newSort = json_decode ( $_POST[ 'newSort' ] ); - - foreach ( $newSort as $sortPoint ) - { - $navPointArray = explode( '_' , $sortPoint ); - $navId = $navPointArray[ 1 ]; - $update = $db -> query - ( - 'UPDATE - ' . $_POST[ 'prefix' ] . '_' . $table . ' - SET - ' . $_POST[ 'prefix' ] . '_navSort = "' . $sort . '" - WHERE - ' . $_POST[ 'prefix' ] . '_navId = "' . $navId . '" - LIMIT 1;' - ); - ++$sort; - } - - $result = true; - break; - - case 'moveNavPoint' : - - $result = $db -> query - ( - 'UPDATE - ' . $_POST[ 'prefix' ] . '_' . $table . ' - SET - ' . $_POST[ 'prefix' ] . '_navStart = "' . $_POST[ 'navStart' ] . '" - WHERE - ' . $_POST[ 'prefix' ] . '_navId = "' . $_POST[ 'navId' ] . '" - LIMIT 1;' - ); - break; - - default : - - var_dump ( $_POST ); - break; - - } - - if ( ! $result ) - { - $error = true; - } - } - else - { - $columns = $db -> query - ( - 'SHOW - COLUMNS - FROM - ' . $_POST[ 'prefix' ] . '_' . $table . ';' - ); - - while ( $column = $columns -> fetch_assoc( ) ) - { - $fieldNames[ ] = $column[ 'Field' ]; - } - - foreach ( $_POST as $key => $value ) - { - if ( in_array ( $key , $fieldNames ) ) - { - $data[ ] = $key . ' = "' . $db -> real_escape_string( $value ) . '"'; - } - } + /* Altes Bild umbenennen und neue Koordinaten speichern */ + $img = $db->query('SELECT * FROM ' . $_POST['prefix'] . '_' . $table . ' WHERE id = ' . $id . ';'); + $img_data = $img->fetch_assoc(); - /* Behandlung Keyvisual und Content-Image */ - if ( $table === 'content_image' ) + $extension = $img_data['imgExtension']; + $old_name = $img_data['imgName'] . '.' . $extension; + $old_name_orig = substr($old_name, 0, strrpos($old_name, '.')) . '_orig' . substr($old_name, strrpos($old_name, '.')); + $old_name_thmb = substr($old_name, 0, strrpos($old_name, '.')) . '_thumb' . substr($old_name, strrpos($old_name, '.')); + + $img_name = $_POST['imgName']; + $img_name = explode('_', $img_name); + foreach ($img_name as $key => $value) + { + if (is_numeric($value)) { - if ( ! is_dir ( PATH_MED . $_POST[ 'prefix' ] . '/' . $_POST[ 'navId' ] ) ) - { - mkdir ( PATH_MED . $_POST[ 'prefix' ] . '/' . $_POST[ 'navId' ] , 0755 ); - } - - if ( isset ( $_POST[ 'uploadFile' ] ) && ! empty ( $_POST[ 'uploadFile' ] ) ) - { - $old = $db -> query - ( - 'SELECT - * - FROM - ' . $_POST[ 'prefix' ] . '_' . $table . ' - WHERE - id = "' . $id . '";' - ); - $old_data = $old -> fetch_assoc( ); - - if ( ! isset ( $_POST[ 'formAction' ] ) || ( isset ( $_POST[ 'formAction' ] ) && $_POST[ 'formAction' ] !== 'appendImage' ) ) - { - $file_path = PATH_MED . $_POST[ 'prefix' ] . '/' . $_POST[ 'navId' ] . '/' . $old_data[ 'imgName' ]; - - /* Alte Bilddaten löschen */ - unlink ( $file_path . '.' . $old_data[ 'imgExtension' ] ); - unlink ( $file_path . '_orig.' . $old_data[ 'imgExtension' ] ); - unlink ( $file_path . '_thumb.' . $old_data[ 'imgExtension' ] ); - } - - /* Bilddaten auslesen */ - $imageData = explode( ',' , $_POST[ 'uploadFile' ] ); - - /* Bilddaten dekodieren */ - $mimetype = str_replace ( array ( 'data:' , ';base64' ) , '' , $imageData[ 0 ] ); - $encodedData = str_replace( ' ' , '+' , $imageData[ 1 ] ); - $decodedData = base64_decode( $encodedData ); - - /* Bildnamen und Erweiterung generieren */ - $keys = ( array_keys ( $vC['mimetypes'] , $mimetype ) ); - $extension = $keys[ 0 ]; - $file_name = fnc_buildUniqueFileName ( $_POST[ 'prefix' ] , $_POST[ 'navId' ] , $_POST[ 'imgName' ] , $extension ); - - /* Originales Bild speichern */ - $file_name_temp = substr( $file_name , 0 , strrpos ( $file_name , '.' ) ) . '_temp' . substr( $file_name , strrpos ( $file_name , '.' ) ); - $file_name_orig = substr( $file_name , 0 , strrpos ( $file_name , '.' ) ) . '_orig' . substr( $file_name , strrpos ( $file_name , '.' ) ); - - file_put_contents( PATH_MED . $_POST[ 'prefix' ] . '/' . $_POST[ 'navId' ] . '/' . $file_name_temp , $decodedData ); - fnc_checkOrigResize( PATH_MED . $_POST[ 'prefix' ] . '/' . $_POST[ 'navId' ] . '/' , $file_name_orig , $file_name_temp , $extension , ${ $_POST['prefix'] }[ 'dimOrig' ] ); - - if ( isset ( $_POST[ 'formAction' ] ) && $_POST[ 'formAction' ] === 'appendImage' ) - { - /* Werte für Datenbank aktualisieren */ - foreach ( $data as $key => $value ) - { - if ( strpos ( $value , 'imgExtension' ) !== false ) - { - $data[ $key ] = 'imgExtension = "' . $db -> real_escape_string( $extension ) . '"'; - } - else if ( strpos ( $value , 'imgName' ) !== false ) - { - $data[ $key ] = 'imgName = "' . $db -> real_escape_string( str_replace ( '.' . $extension , '' , $file_name ) ) . '"'; - } - } - - $new = $db -> query - ( - 'INSERT INTO - ' . $_POST[ 'prefix' ] . '_' . $table . ' - SET - ' . implode ( ' , ' , $data ) - ); - $new_id = $db -> insert_id; - - unset ( $data ); - - if ( $old_data[ 'sliderContent' ] === '' ) - { - $slider = array ( $new_id ); - } - else - { - $slider = explode ( ';' , $old_data[ 'sliderContent' ] ); - $slider[ ] = $new_id; - } - - $data = array( ); - $data[ ] = 'sliderContent = "' . $db -> real_escape_string( implode ( ';' , $slider ) ) . '"'; - $data[ ] = 'hasSlider = "Y"'; - } - } - else - { - if ( isset ( $_POST[ 'formAction' ] ) && $_POST[ 'formAction' ] === 'updateSort' ) - { - $db -> query - ( - 'UPDATE - ' . $_POST[ 'prefix' ] . '_' . TBL_NAVI . ' - SET - ' . $_POST[ 'prefix' ] . '_keyvisual = "' . $id . '" - WHERE - ' . $_POST[ 'prefix' ] . '_navId = "' . $_POST[ 'navId' ] . '" - LIMIT 1;' - ); - } - else - { - /* Altes Bild umbenennen und neue Koordinaten speichern */ - $img = $db -> query - ( - 'SELECT - * - FROM - ' . $_POST[ 'prefix' ] . '_' . $table . ' - WHERE - id = "' . $id . '";' - ); - $img_data = $img -> fetch_assoc( ); - - $extension = $img_data[ 'imgExtension' ]; - $old_name = $img_data[ 'imgName' ] . '.' . $extension; - $old_name_orig = substr( $old_name , 0 , strrpos ( $old_name , '.' ) ) . '_orig' . substr( $old_name , strrpos ( $old_name , '.' ) ); - $old_name_thmb = substr( $old_name , 0 , strrpos ( $old_name , '.' ) ) . '_thumb' . substr( $old_name , strrpos ( $old_name , '.' ) ); - - $img_name = $_POST[ 'imgName' ]; - $img_name = explode ( '_' , $img_name ); - foreach ( $img_name as $key => $value ) - { - if ( is_numeric ( $value ) ) - { - unset ( $img_name[ $key ] ); - } - } - $img_name = implode ( '_' , $img_name ); - - if ( $_POST[ 'imgName' ] . '.' . $_POST[ 'imgExtension' ] !== $old_name ) - { - $file_name = fnc_buildUniqueFileName ( $_POST[ 'prefix' ] , $_POST[ 'navId' ] , $img_name , $extension , -1 ); - $file_name_orig = substr( $file_name , 0 , strrpos ( $file_name , '.' ) ) . '_orig' . substr( $file_name , strrpos ( $file_name , '.' ) ); - $file_name_thmb = substr( $file_name , 0 , strrpos ( $file_name , '.' ) ) . '_thumb' . substr( $file_name , strrpos ( $file_name , '.' ) ); - - rename( PATH_MED . $_POST[ 'prefix' ] . '/' . $_POST[ 'navId' ] . '/' . $old_name_thmb , PATH_MED . $_POST[ 'prefix' ] . '/' . $_POST[ 'navId' ] . '/' . $file_name_thmb ); - rename( PATH_MED . $_POST[ 'prefix' ] . '/' . $_POST[ 'navId' ] . '/' . $old_name_orig , PATH_MED . $_POST[ 'prefix' ] . '/' . $_POST[ 'navId' ] . '/' . $file_name_orig ); - rename( PATH_MED . $_POST[ 'prefix' ] . '/' . $_POST[ 'navId' ] . '/' . $old_name , PATH_MED . $_POST[ 'prefix' ] . '/' . $_POST[ 'navId' ] . '/' . $file_name ); - } - else - { - $file_name = $old_name; - $file_name_orig = $old_name_orig; - $file_name_thmb = $old_name_thmb; - } - } - } - - if ( ! isset ( $_POST[ 'formAction' ] ) || ( isset ( $_POST[ 'formAction' ] ) && $_POST[ 'formAction' ] !== 'updateSort' ) ) - { - $dataSet = str_replace( 'content_' , '' , $_POST[ 'dataSet' ] ); - - /* Bilddaten aus Editor generieren */ - if ( strpos( $dataSet , 'image' ) === 0 ) - { - ${ $_POST['prefix'] }[ 'dim' . strtoupper( substr( $dataSet , 0 , 1 ) ) . substr( $dataSet , 1 , strrpos ( $dataSet , '_' ) - 1 ) ][ 'height' ] = ${ $_POST['prefix'] }[ 'dim' . strtoupper( substr( $dataSet , 0 , 1 ) ) . substr( $dataSet , 1 , strrpos ( $dataSet , '_' ) - 1 ) ][ 'width' ] * $_POST[ 'previewHeight' ] / $_POST[ 'previewWidth' ]; - } - $img_created = fnc_buildImage ( PATH_MED . $_POST[ 'prefix' ] . '/' . $_POST[ 'navId' ] . '/' , $file_name_orig , $extension , ${ $_POST['prefix'] }[ 'dim' . strtoupper( substr( $dataSet , 0 , 1 ) ) . substr( $dataSet , 1 , strrpos ( $dataSet , '_' ) - 1 ) ] , $_POST ); - - /* Thumbnail aus generiertem Bild erzeugen */ - if ( ! is_null ( ${ $_POST['prefix'] }[ substr ( $dataSet , 0 , strrpos ( $dataSet , '_' ) ) . 'Thumb' ] ) ) - { - if ( strpos( $dataSet , 'image' ) === 0 ) - { - ${ $_POST['prefix'] }[ substr ( $dataSet , 0 , strrpos ( $dataSet , '_' ) ) . 'Thumb' ][ 'height' ] = ${ $_POST['prefix'] }[ substr ( $dataSet , 0 , strrpos ( $dataSet , '_' ) ) . 'Thumb' ][ 'width' ] * $_POST[ 'previewHeight' ] / $_POST[ 'previewWidth' ]; - } - $thumb = fnc_buildThumbnail ( PATH_MED . $_POST[ 'prefix' ] . '/' . $_POST[ 'navId' ] . '/' , $file_name , $extension , ${ $_POST['prefix'] }[ substr ( $dataSet , 0 , strrpos ( $dataSet , '_' ) ) . 'Thumb' ] ); - } - - /* Werte für Datenbank aktualisieren */ - foreach ( $data as $key => $value ) - { - if ( strpos ( $value , 'imgExtension' ) !== false ) - { - $data[ $key ] = 'imgExtension = "' . $db -> real_escape_string( $extension ) . '"'; - } - else if ( strpos ( $value , 'imgName' ) !== false ) - { - $data[ $key ] = 'imgName = "' . $db -> real_escape_string( str_replace ( '.' . $extension , '' , $file_name ) ) . '"'; - } - } - - if ( ! $img_created || ! $thumb ) - { - $error = true; - } - } + unset ($img_name[$key]); } - - if ( ! $error ) - { - /* Daten in Tabelle schreiben */ - $dataString = implode ( ' , ' , $data ); + } + $img_name = implode('_', $img_name); - if ( $dataString != '' ) - { - $result = ( $table === 'content' ) - ? $db -> query ( 'UPDATE ' . $_POST[ 'prefix' ] . '_' . $table . ' SET ' . $dataString . ' WHERE siteId = "' . $id . '";' ) - : $db -> query ( 'UPDATE ' . $_POST[ 'prefix' ] . '_' . $table . ' SET ' . $dataString . ' WHERE id = "' . $id . '";' ); - - if ( ! $result ) - { - $error = true; - } - } - else - { - $error = true; - } - } - } - - if ( $error ) - { - echo 'ERROR'; - } - else - { - echo json_encode( 'SUCCESS' ); - } - } - else if ( $_POST[ 'request' ] === 'insertData' ) - { - - $error = false; - if ( $table === 'navi' ) - { - - switch ( $_POST[ 'formAction' ] ) - { - case 'addNavPoint' : - $navis = $db -> query ( 'SELECT * FROM ' . $_POST[ 'prefix' ] . '_' . $table . ' WHERE ' . $_POST[ 'prefix' ] . '_navStart = "' . $_POST[ 'navStart' ] . '" ORDER BY ' . $_POST['prefix'] . '_navSort ASC;' ); - $sort = 1; + if ($_POST['imgName'] . '.' . $_POST['imgExtension'] !== $old_name) + { + $file_name = fnc_buildUniqueFileName($_POST['prefix'], $_POST['navId'], $img_name, $extension); + $file_name_orig = substr($file_name, 0, strrpos($file_name, '.')) . '_orig' . substr($file_name, strrpos($file_name, '.')); + $file_name_thmb = substr($file_name, 0, strrpos($file_name, '.')) . '_thumb' . substr($file_name, strrpos($file_name, '.')); - while ( $navi = $navis -> fetch_assoc( ) ) - { - $update = $db -> query ( 'UPDATE ' . $_POST[ 'prefix' ] . '_' . $table . ' SET ' . $_POST[ 'prefix' ] . '_navSort = "' . $sort . '" WHERE ' . $_POST[ 'prefix' ] . '_navId = "' . $navi[ $_POST[ 'prefix' ] . '_navId' ] . '" LIMIT 1;' ) || $error = true; - - if ( $error ) { break; } - if ( $navi[ $_POST[ 'prefix' ] . '_navId' ] == $_POST[ 'navId' ] ) - { - ++$sort; - $special = ( $_POST[ 'new_navType' ] === 'content' ) - ? 'N' - : 'Y'; - $navLink = fnc_buildUniqueLinkName ( $_POST[ 'prefix' ] , $_POST[ 'navStart' ] , $_POST[ 'new_navName' ] ); - - $insert = $db -> query ( 'INSERT INTO ' . $_POST[ 'prefix' ] . '_' . $table . ' ( ' . $_POST[ 'prefix' ] . '_navId , ' . $_POST[ 'prefix' ] . '_navStart , ' . $_POST[ 'prefix' ] . '_navName , ' . $_POST[ 'prefix' ] . '_navTarget , ' . $_POST[ 'prefix' ] . '_navLink , ' . $_POST[ 'prefix' ] . '_navActive , ' . $_POST[ 'prefix' ] . '_navSort , ' . $_POST[ 'prefix' ] . '_specialSite , ' . $_POST[ 'prefix' ] . '_specialType ) VALUES ( NULL , "' . $_POST[ 'navStart' ] . '" , "' . $_POST[ 'new_navName' ] . '" , "" , "' . $navLink . '" , "Y" , "' . $sort . '" , "' . $special . '" , "' . $_POST[ 'new_navType' ] . '" );' ) || $error = true; - $new_navId = $db -> insert_id; - $update = $db -> query ( 'UPDATE ' . $_POST[ 'prefix' ] . '_' . $table . ' SET ' . $_POST[ 'prefix' ] . '_navTarget = "index.php?siteId=' . $_POST[ 'siteId' ] . '&navId=' . $new_navId . '" WHERE ' . $_POST[ 'prefix' ] . '_navId = "' . $new_navId . '" LIMIT 1;' ) || $error = true; - - if ( $error ) { break; } - - if ( $_POST[ 'new_navType' ] !== 'uebersicht' ) - { - - if ( $_POST[ 'new_navType' ] === 'content' ) - { - $headline = $db -> query ( 'INSERT INTO ' . $_POST[ 'prefix' ] . '_content_headline ( id , content ) VALUES ( null , "Neue Überschrift" );' ); - $h_id = $db -> insert_id; - $test = $db -> query ( 'INSERT INTO ' . $_POST[ 'prefix' ] . '_content_text ( id , content ) VALUES ( null , "Neuer Standardtext" );' ); - $t_id = $db -> insert_id; - $site = $db -> query ( 'INSERT INTO ' . $_POST[ 'prefix' ] . '_content ( id , siteId , siteContents ) VALUES ( null , "' . $new_navId . '" , "headline_' . $h_id . ';text_' . $t_id . '" );' ); - } - else - { - $site = $db -> query ( 'INSERT INTO ' . $_POST[ 'prefix' ] . '_' . $_POST[ 'new_navType' ] . ' ( id , siteId ) VALUES ( null , "' . $new_navId . '" );' ); - } - } - - } - ++$sort; - } - - break; - - case 'addSubNav' : - $navis = $db -> query - ( - 'SELECT - * - FROM - ' . $_POST[ 'prefix' ] . '_' . $table . ' - WHERE - ' . $_POST[ 'prefix' ] . '_navStart = "' . $_POST[ 'navId' ] . '" - ORDER BY - ' . $_POST[ 'prefix' ] . '_navSort - ASC;' - ); - $sort = 1; - - $special = ( $_POST[ 'new_subnavType' ] === 'content' ) - ? 'N' - : 'Y'; - $navLink = fnc_buildUniqueLinkName ( $_POST[ 'prefix' ] , $_POST[ 'navId' ] , $_POST[ 'new_subnavName' ] ); - - $insert = $db -> query ( 'INSERT INTO ' . $_POST[ 'prefix' ] . '_' . $table . ' ( ' . $_POST[ 'prefix' ] . '_navId , ' . $_POST[ 'prefix' ] . '_navStart , ' . $_POST[ 'prefix' ] . '_navName , ' . $_POST[ 'prefix' ] . '_navTarget , ' . $_POST[ 'prefix' ] . '_navLink , ' . $_POST[ 'prefix' ] . '_navActive , ' . $_POST[ 'prefix' ] . '_navSort , ' . $_POST[ 'prefix' ] . '_specialSite , ' . $_POST[ 'prefix' ] . '_specialType ) VALUES ( NULL , "' . $_POST[ 'navId' ] . '" , "' . $_POST[ 'new_subnavName' ] . '" , "" , "' . $navLink . '" , "Y" , "' . $sort . '" , "' . $special . '" , "' . $_POST[ 'new_subnavType' ] . '" );' ) || $error = true; - $new_navId = $db -> insert_id; - $update = $db -> query ( 'UPDATE ' . $_POST[ 'prefix' ] . '_' . $table . ' SET ' . $_POST[ 'prefix' ] . '_navTarget = "index.php?siteId=' . $_POST[ 'siteId' ] . '&navId=' . $new_navId . '" WHERE ' . $_POST[ 'prefix' ] . '_navId = "' . $new_navId . '" LIMIT 1;' ) || $error = true; - - if ( $error ) { break; } - - if ( $_POST[ 'new_subnavType' ] !== 'uebersicht' ) - { - - if ( $_POST[ 'new_subnavType' ] === 'content' ) - { - $headline = $db -> query ( 'INSERT INTO ' . $_POST[ 'prefix' ] . '_content_headline ( id , content ) VALUES ( null , "Neue Überschrift" );' ); - $h_id = $db -> insert_id; - $test = $db -> query ( 'INSERT INTO ' . $_POST[ 'prefix' ] . '_content_text ( id , content ) VALUES ( null , "Neuer Standardtext" );' ); - $t_id = $db -> insert_id; - $site = $db -> query ( 'INSERT INTO ' . $_POST[ 'prefix' ] . '_content ( id , siteId , siteContents ) VALUES ( null , "' . $new_navId . '" , "headline_' . $h_id . ';text_' . $t_id . '" );' ); - } - else - { - $site = $db -> query ( 'INSERT INTO ' . $_POST[ 'prefix' ] . '_' . $_POST[ 'new_subnavType' ] . ' ( id , siteId ) VALUES ( null , "' . $new_navId . '" );' ); - } - } - - ++$sort; - - while ( $navi = $navis -> fetch_assoc( ) ) - { - $update = $db -> query ( 'UPDATE ' . $_POST[ 'prefix' ] . '_' . $table . ' SET ' . $_POST[ 'prefix' ] . '_navSort = "' . $sort . '" WHERE ' . $_POST[ 'prefix' ] . '_navId = "' . $navi[ $_POST[ 'prefix' ] . '_navId' ] . '" LIMIT 1;' ) || $error = true; - - if ( $error ) { break; } - ++$sort; - } - - break; - - default : - var_dump ( $_POST ); - break; - - } - - if ( ! $error ) - { - echo 'SUCCESS'; - } + rename(PATH_MED . $_POST['prefix'] . '/' . $_POST['navId'] . '/' . $old_name_thmb, PATH_MED . $_POST['prefix'] . '/' . $_POST['navId'] . '/' . $file_name_thmb); + rename(PATH_MED . $_POST['prefix'] . '/' . $_POST['navId'] . '/' . $old_name_orig, PATH_MED . $_POST['prefix'] . '/' . $_POST['navId'] . '/' . $file_name_orig); + rename(PATH_MED . $_POST['prefix'] . '/' . $_POST['navId'] . '/' . $old_name, PATH_MED . $_POST['prefix'] . '/' . $_POST['navId'] . '/' . $file_name); + } else - { - echo 'ERROR'; - } + { + $file_name = $old_name; + $file_name_orig = $old_name_orig; + $file_name_thmb = $old_name_thmb; + } } - else + } + + if (!isset ($_POST['formAction']) || (isset ($_POST['formAction']) && $_POST['formAction'] !== 'updateSort')) + { + $dataSet = str_replace('content_', '', $_POST['dataSet']); + + /* Bilddaten aus Editor generieren */ + if (strpos($dataSet, 'image') === 0) { - $columns = $db -> query ( 'SHOW COLUMNS FROM ' . $_POST[ 'prefix' ] . '_' . $table . ';' ); - - while ( $column = $columns -> fetch_assoc( ) ) + ${$_POST['prefix']}['dim' . strtoupper(substr($dataSet, 0, 1)) . substr($dataSet, 1, strrpos($dataSet, '_') - 1)]['height'] = ${$_POST['prefix']}['dim' . strtoupper(substr($dataSet, 0, 1)) . substr($dataSet, 1, strrpos($dataSet, '_') - 1)]['width'] * $_POST['previewHeight'] / $_POST['previewWidth']; + } + $img_created = fnc_buildImage(PATH_MED . $_POST['prefix'] . '/' . $_POST['navId'] . '/', $file_name_orig, $extension, ${$_POST['prefix']}['dim' . strtoupper(substr($dataSet, 0, 1)) . substr($dataSet, 1, strrpos($dataSet, '_') - 1)], $_POST); + + /* Thumbnail aus generiertem Bild erzeugen */ + if (!is_null(${$_POST['prefix']}[substr($dataSet, 0, strrpos($dataSet, '_')) . 'Thumb'])) + { + if (strpos($dataSet, 'image') === 0) + { + ${$_POST['prefix']}[substr($dataSet, 0, strrpos($dataSet, '_')) . 'Thumb']['height'] = ${$_POST['prefix']}[substr($dataSet, 0, strrpos($dataSet, '_')) . 'Thumb']['width'] * $_POST['previewHeight'] / $_POST['previewWidth']; + } + $thumb = fnc_buildThumbnail(PATH_MED . $_POST['prefix'] . '/' . $_POST['navId'] . '/', $file_name, $extension, ${$_POST['prefix']}[substr($dataSet, 0, strrpos($dataSet, '_')) . 'Thumb']); + } + + /* Werte für Datenbank aktualisieren */ + foreach ($data as $key => $value) + { + if (strpos($value, 'imgExtension') !== false) + { + $data[$key] = 'imgExtension = "' . $db->real_escape_string($extension) . '"'; + } + else if (strpos($value, 'imgName') !== false) + { + $data[$key] = 'imgName = "' . $db->real_escape_string(str_replace('.' . $extension, '', $file_name)) . '"'; + } + } + + if (!$img_created || !$thumb) + { + $error = true; + } + } + } + + if (!$error) + { + /* Daten in Tabelle schreiben */ + $dataString = implode(' , ', $data); + + file_put_contents(__DIR__ . '/test.log', var_export($data, true) . "\n\n"); + file_put_contents(__DIR__ . '/test.log', var_export($table, true) . "\n\n", FILE_APPEND); + file_put_contents(__DIR__ . '/test.log', var_export($error, true) . "\n\n", FILE_APPEND); + file_put_contents(__DIR__ . '/test.log', var_export($dataString, true) . "\n\n", FILE_APPEND); + if ($dataString != '') + { + file_put_contents(__DIR__ . '/test.log', var_export($id, true) . "\n\n", FILE_APPEND); + $result = ($table === 'content') + ? $db->query('UPDATE ' . $_POST['prefix'] . '_' . $table . ' SET ' . $dataString . ' WHERE siteId = ' . $id . ';') + : $db->query('UPDATE ' . $_POST['prefix'] . '_' . $table . ' SET ' . $dataString . ' WHERE id = ' . $id . ';'); + + file_put_contents(__DIR__ . '/test.log', var_export($db->error_list, true) . "\n\n", FILE_APPEND); + if (!$result) + { + $error = true; + } + } + else + { + $error = true; + } + } + } + + if ($error) + { + echo 'ERROR'; + } + else + { + echo 'SUCCESS'; + } +} +else if ($_POST['request'] === 'insertData') +{ + + $error = false; + if ($table === 'navi') + { + + switch ($_POST['formAction']) + { + case 'addNavPoint' : + $navis = $db->query('SELECT * FROM ' . $_POST['prefix'] . '_' . $table . ' WHERE ' . $_POST['prefix'] . '_navStart = "' . $_POST['navStart'] . '" ORDER BY ' . $_POST['prefix'] . '_navSort ASC;'); + $sort = 1; + + while ($navi = $navis->fetch_assoc()) + { + $update = $db->query('UPDATE ' . $_POST['prefix'] . '_' . $table . ' SET ' . $_POST['prefix'] . '_navSort = "' . $sort . '" WHERE ' . $_POST['prefix'] . '_navId = "' . $navi[$_POST['prefix'] . '_navId'] . '" LIMIT 1;') || $error = true; + + if ($error) + { + break; + } + if ($navi[$_POST['prefix'] . '_navId'] == $_POST['navId']) + { + ++$sort; + $special = ($_POST['new_navType'] === 'content') + ? 'N' + : 'Y'; + $navLink = fnc_buildUniqueLinkName($_POST['prefix'], $_POST['navStart'], $_POST['new_navName']); + + $insert = $db->query('INSERT INTO ' . $_POST['prefix'] . '_' . $table . ' ( ' . $_POST['prefix'] . '_navId , ' . $_POST['prefix'] . '_navStart , ' . $_POST['prefix'] . '_navName , ' . $_POST['prefix'] . '_navTarget , ' . $_POST['prefix'] . '_navLink , ' . $_POST['prefix'] . '_navActive , ' . $_POST['prefix'] . '_navSort , ' . $_POST['prefix'] . '_specialSite , ' . $_POST['prefix'] . '_specialType ) VALUES ( NULL , "' . $_POST['navStart'] . '" , "' . $_POST['new_navName'] . '" , "" , "' . $navLink . '" , "Y" , "' . $sort . '" , "' . $special . '" , "' . $_POST['new_navType'] . '" );') || $error = true; + $new_navId = $db->insert_id; + $update = $db->query('UPDATE ' . $_POST['prefix'] . '_' . $table . ' SET ' . $_POST['prefix'] . '_navTarget = "index.php?siteId=' . $_POST['siteId'] . '&navId=' . $new_navId . '" WHERE ' . $_POST['prefix'] . '_navId = "' . $new_navId . '" LIMIT 1;') || $error = true; + + if ($error) { - $fieldNames[ ] = $column[ 'Field' ]; + break; } - - foreach ( $_POST as $key => $value ) + + if ($_POST['new_navType'] !== 'uebersicht') { - if ( in_array ( $key , $fieldNames ) ) - { - $data[ $key ] = $db -> real_escape_string( $value ); - } + + if ($_POST['new_navType'] === 'content') + { + $headline = $db->query('INSERT INTO ' . $_POST['prefix'] . '_content_headline ( id , content ) VALUES ( null , "Neue Überschrift" );'); + $h_id = $db->insert_id; + $test = $db->query('INSERT INTO ' . $_POST['prefix'] . '_content_text ( id , content ) VALUES ( null , "Neuer Standardtext" );'); + $t_id = $db->insert_id; + $site = $db->query('INSERT INTO ' . $_POST['prefix'] . '_content ( id , siteId , siteContents ) VALUES ( null , "' . $new_navId . '" , "headline_' . $h_id . ';text_' . $t_id . '" );'); + } + else + { + $site = $db->query('INSERT INTO ' . $_POST['prefix'] . '_' . $_POST['new_navType'] . ' ( id , siteId ) VALUES ( null , "' . $new_navId . '" );'); + } } - - if ( $table === 'content_image' ) - { - if ( ! is_dir ( PATH_MED . $_POST[ 'prefix' ] . '/' . $_POST[ 'navId' ] ) ) - { - mkdir ( PATH_MED . $_POST[ 'prefix' ] . '/' . $_POST[ 'navId' ] , 0755 ); - } - - /* Bilddaten auslesen */ - $imageData = explode( ',' , $_POST[ 'uploadFile' ] ); - - /* Bilddaten dekodieren */ - $mimetype = str_replace ( array ( 'data:' , ';base64' ) , '' , $imageData[ 0 ] ); - $encodedData = str_replace( ' ' , '+' , $imageData[ 1 ] ); - $decodedData = base64_decode( $encodedData ); - - /* Bildnamen und Erweiterung generieren */ - $keys = ( array_keys ( $vC['mimetypes'] , $mimetype ) ); - $extension = $keys[ 0 ]; - $file_name = fnc_buildUniqueFileName ( $_POST[ 'prefix' ] , $_POST[ 'navId' ] , $_POST[ 'imgName' ] , $extension ); - - /* Originales Bild speichern */ - $file_name_orig = substr( $file_name , 0 , strrpos ( $file_name , '.' ) ) . '_orig' . substr( $file_name , strrpos ( $file_name , '.' ) ); - file_put_contents ( PATH_MED . $_POST[ 'prefix' ] . '/' . $_POST[ 'navId' ] . '/' . $file_name_orig , $decodedData ); - - /* Bilddaten aus Editor generieren */ - $img_created = fnc_buildImage ( PATH_MED . $_POST[ 'prefix' ] . '/' . $_POST[ 'navId' ] . '/' , $file_name_orig , $extension , ${ $_POST['prefix'] }[ 'dim' . strtoupper( substr( $_POST[ 'dataSet' ] , 0 , 1 ) ) . substr( $_POST[ 'dataSet' ] , 1 ) ] , $_POST ); - - /* Thumbnail aus generiertem Bild erzeugen */ - if ( ! is_null ( ${ $_POST['prefix'] }[ $_POST[ 'dataSet' ] . 'Thumb' ] ) ) - { - $thumb = fnc_buildThumbnail ( PATH_MED . $_POST[ 'prefix' ] . '/' . $_POST[ 'navId' ] . '/' , $file_name , $extension , ${ $_POST['prefix'] }[ $_POST[ 'dataSet' ] . 'Thumb' ] ); - } - - /* Werte für Datenbank aktualisieren */ - $data[ 'imgExtension' ] = $db -> real_escape_string( $extension ); - $data[ 'imgName' ] = $db -> real_escape_string( str_replace ( '.' . $extension , '' , $file_name ) ); - - if ( ! $img_created || ! $thumb ) - { - $error = true; - } - - } - - else if ( $table === 'content_textimage' ) - { - if ( ! is_dir ( PATH_MED . $_POST[ 'prefix' ] . '/' . $_POST[ 'navId' ] ) ) - { - mkdir ( PATH_MED . $_POST[ 'prefix' ] . '/' . $_POST[ 'navId' ] , 0755 ); - } - - /* Bildnamen und Erweiterung generieren */ - $extension = 'jpg'; - $file_name = fnc_buildUniqueFileName ( $_POST[ 'prefix' ] , $_POST[ 'navId' ] , 'sample_image' , $extension ); - - /* Originales Bild speichern */ - $file_name_orig = substr( $file_name , 0 , strrpos ( $file_name , '.' ) ) . '_orig' . substr( $file_name , strrpos ( $file_name , '.' ) ); - copy ( PATH_MED . $_POST[ 'prefix' ] . '/sample_image.jpg' , PATH_MED . $_POST[ 'prefix' ] . '/' . $_POST[ 'navId' ] . '/' . $file_name_orig ); - copy ( PATH_MED . $_POST[ 'prefix' ] . '/sample_image.jpg' , PATH_MED . $_POST[ 'prefix' ] . '/' . $_POST[ 'navId' ] . '/' . $file_name ); - - /* Thumbnail aus generiertem Bild erzeugen */ - if ( ! is_null ( ${ $_POST['prefix'] }[ 'imageThumb' ] ) ) - { - $thumb = fnc_buildThumbnail ( PATH_MED . $_POST[ 'prefix' ] . '/' . $_POST[ 'navId' ] . '/' , $file_name , $extension , ${ $_POST['prefix'] }[ 'imageThumb' ] ); - } - - if ( ! $thumb ) - { - $error = true; - } - - $img_extension = $db -> real_escape_string( $extension ); - $img_name = $db -> real_escape_string( str_replace ( '.' . $extension , '' , $file_name ) ); - $img_title = $db -> real_escape_string( 'Sample Image' ); - - $image = $db -> query - ( - 'INSERT INTO - ' . $_POST[ 'prefix' ] . '_' . TBL_IMAGE . ' + + } + ++$sort; + } + + break; + + case 'addSubNav' : + $navis = $db->query('SELECT * FROM ' . $_POST['prefix'] . '_' . $table . ' WHERE ' . $_POST['prefix'] . '_navStart = ' . $_POST['navId'] . ' ORDER BY ' . $_POST['prefix'] . '_navSort ASC;'); + $sort = 1; + + $special = ($_POST['new_subnavType'] === 'content') ? 'N' : 'Y'; + $navLink = fnc_buildUniqueLinkName($_POST['prefix'], $_POST['navId'], $_POST['new_subnavName']); + + $insert = $db->query('INSERT INTO ' . $_POST['prefix'] . '_' . $table . ' ( ' . $_POST['prefix'] . '_navId , ' . $_POST['prefix'] . '_navStart , ' . $_POST['prefix'] . '_navName , ' . $_POST['prefix'] . '_navTarget , ' . $_POST['prefix'] . '_navLink , ' . $_POST['prefix'] . '_navActive , ' . $_POST['prefix'] . '_navSort , ' . $_POST['prefix'] . '_specialSite , ' . $_POST['prefix'] . '_specialType ) VALUES ( NULL , "' . $_POST['navId'] . '" , "' . $_POST['new_subnavName'] . '" , "" , "' . $navLink . '" , "Y" , "' . $sort . '" , "' . $special . '" , "' . $_POST['new_subnavType'] . '" );') || $error = true; + $new_navId = $db->insert_id; + $update = $db->query('UPDATE ' . $_POST['prefix'] . '_' . $table . ' SET ' . $_POST['prefix'] . '_navTarget = "index.php?siteId=' . $_POST['siteId'] . '&navId=' . $new_navId . '" WHERE ' . $_POST['prefix'] . '_navId = "' . $new_navId . '" LIMIT 1;') || $error = true; + + if ($error) + { + break; + } + + if ($_POST['new_subnavType'] !== 'uebersicht') + { + + if ($_POST['new_subnavType'] === 'content') + { + $headline = $db->query('INSERT INTO ' . $_POST['prefix'] . '_content_headline ( id , content ) VALUES ( null , "Neue Überschrift" );'); + $h_id = $db->insert_id; + $test = $db->query('INSERT INTO ' . $_POST['prefix'] . '_content_text ( id , content ) VALUES ( null , "Neuer Standardtext" );'); + $t_id = $db->insert_id; + $site = $db->query('INSERT INTO ' . $_POST['prefix'] . '_content ( id , siteId , siteContents ) VALUES ( null , "' . $new_navId . '" , "headline_' . $h_id . ';text_' . $t_id . '" );'); + } + else + { + $site = $db->query('INSERT INTO ' . $_POST['prefix'] . '_' . $_POST['new_subnavType'] . ' ( id , siteId ) VALUES ( null , "' . $new_navId . '" );'); + } + } + + ++$sort; + + while ($navi = $navis->fetch_assoc()) + { + $update = $db->query('UPDATE ' . $_POST['prefix'] . '_' . $table . ' SET ' . $_POST['prefix'] . '_navSort = "' . $sort . '" WHERE ' . $_POST['prefix'] . '_navId = "' . $navi[$_POST['prefix'] . '_navId'] . '" LIMIT 1;') || $error = true; + + if ($error) + { + break; + } + ++$sort; + } + + break; + + default : + var_dump($_POST); + break; + + } + + if (!$error) + { + echo 'SUCCESS'; + } + else + { + echo 'ERROR'; + } + } + else + { + $columns = $db->query('SHOW COLUMNS FROM ' . $_POST['prefix'] . '_' . $table . ';'); + + while ($column = $columns->fetch_assoc()) + { + $fieldNames[] = $column['Field']; + } + + foreach ($_POST as $key => $value) + { + if (in_array($key, $fieldNames)) + { + $data[$key] = $db->real_escape_string($value); + } + } + + if ($table === 'content_image') + { + if (!is_dir(PATH_MED . $_POST['prefix'] . '/' . $_POST['navId'])) + { + mkdir(PATH_MED . $_POST['prefix'] . '/' . $_POST['navId'], 0755); + } + + /* Bilddaten auslesen */ + $imageData = explode(',', $_POST['uploadFile']); + + /* Bilddaten dekodieren */ + $mimetype = str_replace(array('data:', ';base64'), '', $imageData[0]); + $encodedData = str_replace(' ', '+', $imageData[1]); + $decodedData = base64_decode($encodedData); + + /* Bildnamen und Erweiterung generieren */ + $keys = (array_keys($vC['mimetypes'], $mimetype)); + $extension = $keys[0]; + $file_name = fnc_buildUniqueFileName($_POST['prefix'], $_POST['navId'], $_POST['imgName'], $extension); + + /* Originales Bild speichern */ + $file_name_orig = substr($file_name, 0, strrpos($file_name, '.')) . '_orig' . substr($file_name, strrpos($file_name, '.')); + file_put_contents(PATH_MED . $_POST['prefix'] . '/' . $_POST['navId'] . '/' . $file_name_orig, $decodedData); + + /* Bilddaten aus Editor generieren */ + $img_created = fnc_buildImage(PATH_MED . $_POST['prefix'] . '/' . $_POST['navId'] . '/', $file_name_orig, $extension, ${$_POST['prefix']}['dim' . strtoupper(substr($_POST['dataSet'], 0, 1)) . substr($_POST['dataSet'], 1)], $_POST); + + /* Thumbnail aus generiertem Bild erzeugen */ + if (!is_null(${$_POST['prefix']}[$_POST['dataSet'] . 'Thumb'])) + { + $thumb = fnc_buildThumbnail(PATH_MED . $_POST['prefix'] . '/' . $_POST['navId'] . '/', $file_name, $extension, ${$_POST['prefix']}[$_POST['dataSet'] . 'Thumb']); + } + + /* Werte für Datenbank aktualisieren */ + $data['imgExtension'] = $db->real_escape_string($extension); + $data['imgName'] = $db->real_escape_string(str_replace('.' . $extension, '', $file_name)); + + if (!$img_created || !$thumb) + { + $error = true; + } + + } + + else if ($table === 'content_textimage') + { + if (!is_dir(PATH_MED . $_POST['prefix'] . '/' . $_POST['navId'])) + { + mkdir(PATH_MED . $_POST['prefix'] . '/' . $_POST['navId'], 0755); + } + + /* Bildnamen und Erweiterung generieren */ + $extension = 'jpg'; + $file_name = fnc_buildUniqueFileName($_POST['prefix'], $_POST['navId'], 'sample_image', $extension); + + /* Originales Bild speichern */ + $file_name_orig = substr($file_name, 0, strrpos($file_name, '.')) . '_orig' . substr($file_name, strrpos($file_name, '.')); + copy(PATH_MED . $_POST['prefix'] . '/sample_image.jpg', PATH_MED . $_POST['prefix'] . '/' . $_POST['navId'] . '/' . $file_name_orig); + copy(PATH_MED . $_POST['prefix'] . '/sample_image.jpg', PATH_MED . $_POST['prefix'] . '/' . $_POST['navId'] . '/' . $file_name); + + /* Thumbnail aus generiertem Bild erzeugen */ + if (!is_null(${$_POST['prefix']}['imageThumb'])) + { + $thumb = fnc_buildThumbnail(PATH_MED . $_POST['prefix'] . '/' . $_POST['navId'] . '/', $file_name, $extension, ${$_POST['prefix']}['imageThumb']); + } + + if (!$thumb) + { + $error = true; + } + + $img_extension = $db->real_escape_string($extension); + $img_name = $db->real_escape_string(str_replace('.' . $extension, '', $file_name)); + $img_title = $db->real_escape_string('Sample Image'); + + $image = $db->query + ( + 'INSERT INTO + ' . $_POST['prefix'] . '_' . TBL_IMAGE . ' ( imgName , imgExtension , imgOrigname , imgTitle , previewWidth , previewHeight ) VALUES - ( "' . $img_name . '" , "' . $img_extension . '" , "' . $img_name . '.' . $img_extension . '" , "' . $img_title . '" , "' . ${ $_POST['prefix'] }[ 'dimImage' ][ 'width' ] . '" , "' . ${ $_POST['prefix'] }[ 'dimImage' ][ 'width' ] * 4 / 3 . '" );' - ); - $image_id = $db -> insert_id; + ( "' . $img_name . '" , "' . $img_extension . '" , "' . $img_name . '.' . $img_extension . '" , "' . $img_title . '" , "' . ${$_POST['prefix']}['dimImage']['width'] . '" , "' . ${$_POST['prefix']}['dimImage']['width'] * 4 / 3 . '" );' + ); + $image_id = $db->insert_id; - $text = $db -> query - ( - 'INSERT INTO - ' . $_POST[ 'prefix' ] . '_' . TBL_TEXT . ' - VALUES ( NULL , "' . $_POST[ 'content' ] . '" );' - ); - $text_id = $db -> insert_id; - - $data[ 'content_text_id' ] = $text_id; - $data[ 'content_image_id' ] = $image_id; - } + $text = $db->query + ( + 'INSERT INTO + ' . $_POST['prefix'] . '_' . TBL_TEXT . ' + VALUES ( NULL , "' . $_POST['content'] . '" );' + ); + $text_id = $db->insert_id; - $keys = array ( ); - $values = array ( ); - foreach ( $data as $key => $value ) + $data['content_text_id'] = $text_id; + $data['content_image_id'] = $image_id; + } + + $keys = array(); + $values = array(); + foreach ($data as $key => $value) + { + $keys[] = $key; + $values[] = '"' . $value . '"'; + } + + /* Daten in Tabelle schreiben */ + if (!empty ($data) && $error === false) + { + $result = $db->query('INSERT INTO ' . $_POST['prefix'] . '_' . $table . ' ( ' . implode(' , ', $keys) . ' ) VALUES ( ' . implode(' , ', $values) . ' );'); + + if ($result !== false) + { + if ($_POST['dataSet'] === 'keyvisual') + { + $insert = $db->insert_id; + $update = $db->query + ( + 'UPDATE + ' . $_POST['prefix'] . '_' . TBL_NAVI . ' + SET + ' . $_POST['prefix'] . '_keyvisual = "' . $insert . '" + WHERE + ' . $_POST['prefix'] . '_navId = "' . $_POST['navId'] . '" + LIMIT 1;' + ); + + if ($update) + { + $error = false; + } + else + { + $error = true; + } + } + elseif ($table === 'content_text' || $table === 'content_subline' || $table === 'content_textimage') + { + $insert = $db->insert_id; + $siteContents = json_decode($_POST['order']); + + foreach ($siteContents as $key => $value) + { + $content = explode('_', $value); + $siteContents[$key] = str_replace('content_', '', $value); + if (!is_numeric(end($content))) { - $keys[ ] = $key; - $values[ ] = '"' . $value . '"'; + $siteContents[$key] .= '_' . $insert; } - - /* Daten in Tabelle schreiben */ - if ( ! empty ( $data ) && $error === false ) - { - $result = $db -> query ( 'INSERT INTO ' . $_POST[ 'prefix' ] . '_' . $table . ' ( ' . implode ( ' , ' , $keys ) . ' ) VALUES ( ' . implode ( ' , ' , $values ) . ' );' ); - - if ( $result !== false ) - { - if ( $_POST[ 'dataSet' ] === 'keyvisual' ) - { - $insert = $db -> insert_id; - $update = $db -> query - ( - 'UPDATE - ' . $_POST[ 'prefix' ] . '_' . TBL_NAVI . ' + } + + $update = $db->query + ( + 'UPDATE + ' . $_POST['prefix'] . '_' . TBL_CONTENT . ' SET - ' . $_POST[ 'prefix' ] . '_keyvisual = "' . $insert . '" + siteContents = "' . implode(';', $siteContents) . '" WHERE - ' . $_POST[ 'prefix' ] . '_navId = "' . $_POST[ 'navId' ] . '" + siteId = "' . $_POST['navId'] . '" LIMIT 1;' - ); - - if ( $update ) - { - $error = false; - } - else - { - $error = true; - } - } - elseif ( $table === 'content_text' || $table === 'content_subline' || $table === 'content_textimage' ) - { - $insert = $db -> insert_id; - $siteContents = json_decode( $_POST[ 'order' ] ); - - foreach ( $siteContents as $key => $value ) - { - $content = explode ( '_' , $value ); - $siteContents[ $key ] = str_replace( 'content_' , '' , $value ); - if ( ! is_numeric ( end ( $content ) ) ) - { - $siteContents[ $key ] .= '_' . $insert; - } - } - - $update = $db -> query - ( - 'UPDATE - ' . $_POST[ 'prefix' ] . '_' . TBL_CONTENT . ' - SET - siteContents = "' . implode ( ';' , $siteContents ) . '" - WHERE - siteId = "' . $_POST[ 'navId' ] . '" - LIMIT 1;' - ); - - if ( $update ) - { - echo json_encode ( $insert ); - die( ); - } - else - { - $error = true; - } - - } - elseif ( isset ( $_POST[ 'formAction' ] ) && $_POST[ 'formAction' ] === 'appendContent' ) - { - $newId = $table . '_' . $db -> insert_id; - $mainSet = explode ( '_' , $_POST[ 'mainContent' ] ); - - $oldContent = $db -> query - ( - 'SELECT + ); + + if ($update) + { + echo json_encode($insert); + die(); + } + else + { + $error = true; + } + + } + elseif (isset ($_POST['formAction']) && $_POST['formAction'] === 'appendContent') + { + $newId = $table . '_' . $db->insert_id; + $mainSet = explode('_', $_POST['mainContent']); + + $oldContent = $db->query + ( + 'SELECT * FROM - ' . $_POST[ 'prefix' ] . '_' . $mainSet[ 0 ] . ' + ' . $_POST['prefix'] . '_' . $mainSet[0] . ' WHERE - id = "' . $mainSet[ 1 ] . '";' - ); - $content = $oldContent -> fetch_assoc( ); - $siteContent = ( $content[ 'siteContents' ] === '' ) - ? $newId - : $content[ 'siteContents' ] . ';' . $newId; - $update = $db -> query - ( - 'UPDATE - ' . $_POST[ 'prefix' ] . '_' . $mainSet[ 0 ] . ' + id = "' . $mainSet[1] . '";' + ); + $content = $oldContent->fetch_assoc(); + $siteContent = ($content['siteContents'] === '') + ? $newId + : $content['siteContents'] . ';' . $newId; + $update = $db->query + ( + 'UPDATE + ' . $_POST['prefix'] . '_' . $mainSet[0] . ' SET siteContents = "' . $siteContent . '" WHERE - id = "' . $mainSet[ 1 ] . '" + id = "' . $mainSet[1] . '" LIMIT 1;' - ); - if ( $update ) - { - json_encode ( $update ); - die( ); - } - else - { - $error = true; - } - } - else - { - $error = false; - } - } - else - { - $error = true; - } - } - - if ( $error === false ) - { - echo 'SUCCESS'; - } + ); + if ($update) + { + json_encode($update); + die(); + } else - { - echo 'ERROR'; - } + { + $error = true; + } } - } - else if ( $_POST[ 'request' ] === 'deleteData' ) - { - $error = false; - $result = ( $table === 'content' ) - ? $db -> query ( 'DELETE FROM ' . $_POST[ 'prefix' ] . '_' . $table . ' WHERE siteId = "' . $id . '" LIMIT 1;' ) - : $db -> query ( 'DELETE FROM ' . $_POST[ 'prefix' ] . '_' . $table . ' WHERE id = "' . $id . '" LIMIT 1;' ); - - if ( $result && strpos( $table , 'content_' ) !== false ) + else { - $content_part = str_replace( 'content_' , '' , $_POST[ 'dataSet' ] ); - $content_data = $db -> query - ( - 'SELECT + $error = false; + } + } + else + { + $error = true; + } + } + + if ($error === false) + { + echo 'SUCCESS'; + } + else + { + echo 'ERROR'; + } + } +} +else if ($_POST['request'] === 'deleteData') +{ + $error = false; + $result = ($table === 'content') + ? $db->query('DELETE FROM ' . $_POST['prefix'] . '_' . $table . ' WHERE siteId = "' . $id . '" LIMIT 1;') + : $db->query('DELETE FROM ' . $_POST['prefix'] . '_' . $table . ' WHERE id = "' . $id . '" LIMIT 1;'); + + if ($result && strpos($table, 'content_') !== false) + { + $content_part = str_replace('content_', '', $_POST['dataSet']); + $content_data = $db->query + ( + 'SELECT * FROM - ' . $_POST[ 'prefix' ] . '_' . TBL_CONTENT . ' + ' . $_POST['prefix'] . '_' . TBL_CONTENT . ' WHERE - siteId = "' . $_POST[ 'navId' ] . '";' - ); - - $content = $content_data -> fetch_assoc( ); - $siteContents = explode ( ';' , $content[ 'siteContents' ] ); - $content_key = array_keys ( $siteContents , $content_part ); - - if ( ! empty ( $content_key ) ) - { - unset ( $siteContents[ $content_key[ 0 ] ] ); - $db -> query - ( - 'UPDATE - ' . $_POST[ 'prefix' ] . '_' . TBL_CONTENT . ' + siteId = "' . $_POST['navId'] . '";' + ); + + $content = $content_data->fetch_assoc(); + $siteContents = explode(';', $content['siteContents']); + $content_key = array_keys($siteContents, $content_part); + + if (!empty ($content_key)) + { + unset ($siteContents[$content_key[0]]); + $db->query + ( + 'UPDATE + ' . $_POST['prefix'] . '_' . TBL_CONTENT . ' SET - siteContents = "' . implode ( ';' , $siteContents ) . '" + siteContents = "' . implode(';', $siteContents) . '" WHERE - id = "' . $content[ 'id' ] . '" + id = "' . $content['id'] . '" LIMIT 1;' - ) || $error = true; - } - } - - if ( ! $error ) - { - echo 'SUCCESS'; - } - else - { - echo 'ERROR'; - } + ) || $error = true; } + } -?> \ No newline at end of file + if (!$error) + { + echo 'SUCCESS'; + } + else + { + echo 'ERROR'; + } +} \ No newline at end of file diff --git a/administrator/webservices/test_data.php b/administrator/webservices/test_data.php new file mode 100644 index 0000000..7901d04 --- /dev/null +++ b/administrator/webservices/test_data.php @@ -0,0 +1,10 @@ + query - ( - 'SELECT - * - FROM - ' . $prefix . '_' . TBL_NAVI . ' - WHERE - ' . $prefix . '_navId = "' . $_GET[ 'navId' ] . '";' - ); - $navpoint = $navpointData -> fetch_assoc ( ); - - if ( ! is_null ( $navpoint[ $prefix . '_keyvisual' ] ) ) - { - /* Keyvisual */ - $keyvisualData = $db -> query - ( - 'SELECT - * - FROM - ' . $prefix . '_' . TBL_IMAGE . ' - WHERE - id = "' . $navpoint[ $prefix . '_keyvisual' ] . '";' - ); - $keyvisual = $keyvisualData -> fetch_assoc ( ); - $data[ 'keyvisual' ][ ] = array ( 'id' => $keyvisual[ 'id' ] , 'path' => PATH_MED . $prefix . '/' . $_GET[ 'navId' ] . '/' , 'src' => $keyvisual[ 'imgName' ] . '.' . $keyvisual[ 'imgExtension' ] , 'title' => $keyvisual[ 'imgTitle' ] ); - $data[ 'galery' ][ ] = array ( 'id' => $keyvisual[ 'id' ] , 'path' => PATH_MED . $prefix . '/' . $_GET[ 'navId' ] . '/' , 'src' => $keyvisual[ 'imgName' ] . '_orig.' . $keyvisual[ 'imgExtension' ] , 'title' => $keyvisual[ 'imgTitle' ] ); - - /* Slider - Daten */ - if ( $keyvisual[ 'sliderContent' ] !== '' ) - { - $sliders = explode ( ';' , $keyvisual[ 'sliderContent' ] ); - - foreach ( $sliders as $imageId ) - { - $imageData = $db -> query - ( - 'SELECT - * - FROM - ' . $prefix . '_' . TBL_IMAGE . ' - WHERE - id = "' . $imageId . '";' - ); - $image = $imageData -> fetch_assoc ( ); - $data[ 'keyvisual' ][ ] = array ( 'id' => $image[ 'id' ] , 'path' => PATH_MED . $prefix . '/' . $_GET[ 'navId' ] . '/' , 'src' => $image[ 'imgName' ] . '.' . $image[ 'imgExtension' ] , 'title' => $image[ 'imgTitle' ] ); - $data[ 'galery' ][ ] = array ( 'id' => $image[ 'id' ] , 'path' => PATH_MED . $prefix . '/' . $_GET[ 'navId' ] . '/' , 'src' => $image[ 'imgName' ] . '_orig.' . $image[ 'imgExtension' ] , 'title' => $image[ 'imgTitle' ] ); - } - - } - } - else - { - $data[ 'keyvisual' ][ ] = array ( 'id' => null , 'path' => PATH_MED . $prefix . '/' , 'navId' => '' , 'src' => 'keyvisual_0.jpg' , 'title' => null ); - } - - if ( $specialSite !== false ) - { - if ( $specialSite === 'uebersicht' ) - { - $contents = $db -> query - ( - 'SELECT - * - FROM - ' . $prefix . '_' . TBL_NAVI . ' - WHERE - ' . $prefix . '_navStart = "' . $_GET[ 'navId' ] . '" - ORDER BY - ' . $prefix . '_navSort ASC;' - ); - while ( $content = $contents -> fetch_assoc ( ) ) - { - $tmp_content[ 'headline' ] = $content[ $prefix . '_navName' ]; - $tmp_content[ 'link' ] = $content[ $prefix . '_navTarget' ]; - $tmp_special = fnc_getNavType ( $prefix , $content[ $prefix . '_navId' ] ); - - if ( $tmp_special !== false ) - { - $sub_contents = $db -> query - ( - 'SELECT - * - FROM - ' . $prefix . '_' . $tmp_special . ' - WHERE - siteId = "' . $content[ $prefix . '_navId' ] . '";' - ); - if ( $sub_contents === false ) - { - continue; - } - $sub_content = $sub_contents -> fetch_assoc ( ); - $sub_content[ 'type' ] = $tmp_special; - } - else - { - $sub_contents = $db->query( - 'SELECT - * - FROM - ' . $prefix . '_' . TBL_CONTENT . ' - WHERE - siteId = "' . $content[ $prefix . '_navId' ] . '";' - ); - if( $sub_contents === false) - { - continue; - } - $tmp_content = $sub_contents->fetch_assoc(); - if ( $tmp_content[ 'siteContents' ] !== '' ) - { - $tmp_data[ 'content' ][ 'pageContents' ] = fnc_getSiteContents( $tmp_content[ 'siteContents' ] , $prefix ); - $sub_content = $tmp_data['content']['pageContents']; - $sub_content['type'] = 'standard'; - } - } - $data[ 'content' ][ 'uebersicht' ][ ] = $sub_content; - } - } - elseif ( $specialSite === 'spielbericht' ) - { - $contents = $db -> query - ( - 'SELECT - * - FROM - ' . $prefix . '_' . $specialSite . ' - WHERE - siteId = "' . $_GET[ 'navId' ] . '";' - ); - $content = $contents -> fetch_assoc ( ); - - $dateTime = DateTime::createFromFormat ( 'Y-m-d' , $content[ 'datum' ] ); - $data[ 'content' ][ 'spielbericht' ] = $content; - } - elseif ( $specialSite === 'turnier' ) - { - $contents = $db -> query - ( - 'SELECT - * - FROM - ' . $prefix . '_' . $specialSite . ' - WHERE - siteId = "' . $_GET[ 'navId' ] . '";' - ); - $content = $contents -> fetch_assoc ( ); - - $dateTime = DateTime::createFromFormat ( 'Y-m-d' , $content[ 'datum' ] ); - $data[ 'content' ][ 'turnier' ] = $content; - } - elseif ( $specialSite === 'widget' ) - { - $contents = $db -> query - ( - 'SELECT - * - FROM - ' . $prefix . '_' . $specialSite . ' - WHERE - siteId = "' . $_GET[ 'navId' ] . '";' - ); - if ( $contents -> num_rows !== 0 ) - { - $content = $contents -> fetch_assoc ( ); - $data[ 'content' ][ 'widget' ] = array ( 'id' => $content[ 'id' ] , 'tpl' => $content[ 'widget' ] , 'schluessel' => $vC[ 'portal' ][ 'website' ][ $content[ 'widget' ] ][ $web_key ] , 'wettbewerb' => $content[ 'wettbewerb' ] ); - } - } - } - else - { - $contents = $db -> query - ( - 'SELECT - * - FROM - ' . $prefix . '_content - WHERE - siteId = "' . $_GET[ 'navId' ] . '";' - ); - if ( $contents -> num_rows !== 0 ) - { - $content = $contents -> fetch_assoc ( ); - if ( $content[ 'siteContents' ] !== '' ) - { - $data[ 'content' ][ 'pageContents' ] = fnc_getSiteContents( $content[ 'siteContents' ] , $prefix ); - foreach ( $data[ 'content' ][ 'pageContents' ] as $tmp_content ) - { - if ( isset( $tmp_content[ 'type' ] ) && $tmp_content[ 'type' ] === 'textimage' ) - { - $data[ 'galery' ][ ] = array ( 'id' => $tmp_content[ 'content_image_id' ] , 'path' => PATH_MED . $prefix . '/' . $_GET[ 'navId' ] . '/' , 'src' => $tmp_content[ 'imgName' ] . '_orig.' . $tmp_content[ 'imgExtension' ] , 'title' => $tmp_content[ 'imgTitle' ] ); - } - } - } - } - } - - foreach ( $arr_navs as $key => $value ) - { - if ( $value !== null ) - { - $data[ $def[ 'navPostion' ][ $key ] ] = $value; - } - } - - /* Template rendern */ - $render = new viewClass ( ); - $render -> setConfig ( $vC ); - $render -> setPrefix ( $prefix ); - $render -> setPathTpl ( PATH_WEBSITE_TPL ); - $render -> setLang ( $lang[ 'website' ] ); - $render -> setTemplate ( 'main' ); - if ( $specialSite !== false ) - { - $render -> setSpecialSite ( true ); - } - $render -> setSiteId ( $_GET[ 'navId' ] ); - $render -> setEditable ( $editable ); - $render -> setWebkey ( $_GET[ 'siteId' ] ); - $render -> setData ( $data ); - $render -> setNavpath ( $pathWay ); - - $html = $render -> output ( ); - $html = str_replace ( array ( 'PHP_ROOT_PATH/' , 'PHP_SITE_PATH/' ) , array ( PATH_ROOT , PATH_SITE ) , $html ); - // $html = str_replace ( array ( "\r" , "\n" , "\t" ) , array ( '' , '' , '' ) , $html ); - echo $html; +require_once($pathRoot . '.config/config_global.php'); +require_once(PATH_CLS . 'rendering/viewClass.php'); -?> +/* Funktionen und Aktionen einbinden */ +include_once(PATH_FNC . 'fnc_portal.php'); + +/* Variablen aufbereiten */ +$editable = false; +$_GET['siteId'] = '20'; +$_GET['navId'] = (isset ($_GET['navId']) && !empty ($_GET['navId'])) + ? $_GET['navId'] + : '1'; +$web_key = array_search($_GET['siteId'], $vC['portal']['website']['navId']); +$prefix = ($web_key !== false) + ? $vC['portal']['website']['prefix'][$web_key] + : ''; +$pathWay = ($prefix !== '') + ? fnc_createPathHome($prefix, $_GET['navId']) + : array(); + +/* Template - Definitionen einbinden */ +include_once(PATH_WEBSITE_TPL . $prefix . '/tpl_definitions.php'); + +/* Daten für Template aufbereiten */ +$navComplete = fnc_getNavigationArray($prefix); +$arr_navs = fnc_getSingleNavigationArrays($prefix, $navComplete, $def, $pathWay); + +$specialSite = fnc_getNavType($prefix, $_GET['navId']); + +$navpointData = $db->query('SELECT * FROM ' . $prefix . '_' . TBL_NAVI . ' WHERE ' . $prefix . '_navId = ' . $_GET['navId'] . ';'); +$navpoint = $navpointData->fetch_assoc(); + +if (!is_null($navpoint[$prefix . '_keyvisual'])) +{ + /* Keyvisual */ + $keyvisualData = $db->query('SELECT * FROM ' . $prefix . '_' . TBL_IMAGE . ' WHERE id = ' . $navpoint[$prefix . '_keyvisual'] . ';'); + $keyvisual = $keyvisualData->fetch_assoc(); + $data['keyvisual'][] = array('id' => $keyvisual['id'], 'path' => PATH_MED . $prefix . '/' . $_GET['navId'] . '/', 'src' => $keyvisual['imgName'] . '.' . $keyvisual['imgExtension'], 'title' => $keyvisual['imgTitle']); + $data['galery'][] = array('id' => $keyvisual['id'], 'path' => PATH_MED . $prefix . '/' . $_GET['navId'] . '/', 'src' => $keyvisual['imgName'] . '_orig.' . $keyvisual['imgExtension'], 'title' => $keyvisual['imgTitle']); + + /* Slider - Daten */ + if ($keyvisual['sliderContent'] !== '') + { + $sliders = explode(';', $keyvisual['sliderContent']); + + foreach ($sliders as $imageId) + { + $imageData = $db->query('SELECT * FROM ' . $prefix . '_' . TBL_IMAGE . ' WHERE id = ' . $imageId . ';'); + $image = $imageData->fetch_assoc(); + $data['keyvisual'][] = array('id' => $image['id'], 'path' => PATH_MED . $prefix . '/' . $_GET['navId'] . '/', 'src' => $image['imgName'] . '.' . $image['imgExtension'], 'title' => $image['imgTitle']); + $data['galery'][] = array('id' => $image['id'], 'path' => PATH_MED . $prefix . '/' . $_GET['navId'] . '/', 'src' => $image['imgName'] . '_orig.' . $image['imgExtension'], 'title' => $image['imgTitle']); + } + + } +} +else +{ + $data['keyvisual'][] = array('id' => null, 'path' => PATH_MED . $prefix . '/', 'navId' => '', 'src' => 'keyvisual_0.jpg', 'title' => null); +} + +if ($specialSite !== false) +{ + if ($specialSite === 'uebersicht') + { + $contents = $db->query('SELECT * FROM ' . $prefix . '_' . TBL_NAVI . ' WHERE ' . $prefix . '_navStart = ' . $_GET['navId'] . ' ORDER BY ' . $prefix . '_navSort ASC;'); + + while ($content = $contents->fetch_assoc()) + { + $tmp_content['headline'] = $content[$prefix . '_navName']; + $tmp_content['link'] = $content[$prefix . '_navTarget']; + $tmp_special = fnc_getNavType($prefix, $content[$prefix . '_navId']); + + if ($tmp_special !== false) + { + $sub_contents = $db->query('SELECT * FROM ' . $prefix . '_' . $tmp_special . ' WHERE siteId = ' . $content[$prefix . '_navId'] . ';'); + if ($sub_contents === false) + { + continue; + } + $sub_content = $sub_contents->fetch_assoc(); + $sub_content['type'] = $tmp_special; + } + else + { + $sub_contents = $db->query('SELECT * FROM ' . $prefix . '_' . TBL_CONTENT . ' WHERE siteId = ' . $content[$prefix . '_navId'] . ';'); + if ($sub_contents === false) + { + continue; + } + $tmp_content = $sub_contents->fetch_assoc(); + if ($tmp_content['siteContents'] !== '') + { + $tmp_data['content']['pageContents'] = fnc_getSiteContents($tmp_content['siteContents'], $prefix); + $sub_content = $tmp_data['content']['pageContents']; + $sub_content['type'] = 'standard'; + } + } + $data['content']['uebersicht'][] = $sub_content; + } + } + elseif ($specialSite === 'spielbericht') + { + $contents = $db->query('SELECT * FROM ' . $prefix . '_' . $specialSite . ' WHERE siteId = ' . $_GET['navId'] . ';'); + $content = $contents->fetch_assoc(); + + $dateTime = DateTime::createFromFormat('Y-m-d', $content['datum']); + $data['content']['spielbericht'] = $content; + } + elseif ($specialSite === 'turnier') + { + $contents = $db->query('SELECT * FROM ' . $prefix . '_' . $specialSite . ' WHERE siteId = ' . $_GET['navId'] . ';'); + $content = $contents->fetch_assoc(); + + $dateTime = DateTime::createFromFormat('Y-m-d', $content['datum']); + $data['content']['turnier'] = $content; + } + elseif ($specialSite === 'widget') + { + $contents = $db->query('SELECT * FROM ' . $prefix . '_' . $specialSite . ' WHERE siteId = ' . $_GET['navId'] . ';'); + if ($contents->num_rows !== 0) + { + $content = $contents->fetch_assoc(); + $data['content']['widget'] = array('id' => $content['id'], 'tpl' => $content['widget'], 'schluessel' => $vC['portal']['website'][$content['widget']][$web_key], 'wettbewerb' => $content['wettbewerb']); + } + } +} +else +{ + $contents = $db->query('SELECT * FROM ' . $prefix . '_content WHERE siteId = ' . $_GET['navId'] . ';'); + if ($contents->num_rows !== 0) + { + $content = $contents->fetch_assoc(); + if ($content['siteContents'] !== '') + { + $data['content']['pageContents'] = fnc_getSiteContents($content['siteContents'], $prefix); + foreach ($data['content']['pageContents'] as $tmp_content) + { + if (isset($tmp_content['type']) && $tmp_content['type'] === 'textimage') + { + $data['galery'][] = array('id' => $tmp_content['content_image_id'], 'path' => PATH_MED . $prefix . '/' . $_GET['navId'] . '/', 'src' => $tmp_content['imgName'] . '_orig.' . $tmp_content['imgExtension'], 'title' => $tmp_content['imgTitle']); + } + } + } + } +} + +foreach ($arr_navs as $key => $value) +{ + if ($value !== null) + { + $data[$def['navPostion'][$key]] = $value; + } +} + +/* Template rendern */ +$render = new viewClass (); +$render->setConfig($vC); +$render->setPrefix($prefix); +$render->setPathTpl(PATH_WEBSITE_TPL); +$render->setLang($lang['website']); +$render->setTemplate('main'); +if ($specialSite !== false) +{ + $render->setSpecialSite(true); +} +$render->setSiteId($_GET['navId']); +$render->setEditable($editable); +$render->setWebkey($_GET['siteId']); +$render->setData($data); +$render->setNavpath($pathWay); + +$html = $render->output(); +$html = str_replace(array('PHP_ROOT_PATH/', 'PHP_SITE_PATH/'), array(PATH_ROOT, PATH_SITE), $html); +// $html = str_replace ( array ( "\r" , "\n" , "\t" ) , array ( '' , '' , '' ) , $html ); +echo $html; \ No newline at end of file diff --git a/templates/svjf/tpl_definitions.php b/templates/svjf/tpl_definitions.php index 90d8fbb..98cb592 100644 --- a/templates/svjf/tpl_definitions.php +++ b/templates/svjf/tpl_definitions.php @@ -1,7 +1,5 @@ \ No newline at end of file +$def['navLevel'] = array(3, 4, 5); +$def['navDepth'] = array(true, false, false); +$def['navPostion'] = array('navi_main', 'navi_sub', 'navi_last'); \ No newline at end of file diff --git a/templates/svjf/tpl_editor.php b/templates/svjf/tpl_editor.php index 632d690..77f6c47 100644 --- a/templates/svjf/tpl_editor.php +++ b/templates/svjf/tpl_editor.php @@ -1,10 +1,11 @@
+
R!ST %%type%% Editor
- +

diff --git a/templates/svjf/tpl_main.php b/templates/svjf/tpl_main.php index 49b2162..c968930 100644 --- a/templates/svjf/tpl_main.php +++ b/templates/svjf/tpl_main.php @@ -1,316 +1,331 @@ - - SVJ Fussball - - - - - - - - - - - - - - _editable === true ) - { - ?> - - + SVJ Fussball + + + + + + + + + + + + + + _editable === true) + { ?> - _editable === true ) - { - ?> - - - - _website[$this->_webkey] as $var => $value ) + { + if ( is_array($value) ) + { ?> - - + var = ; + + var =""; + + + var specialSite = _specialSite) + ? 'true' + : 'false'; ?>; + _editable === true ) - { - $editor = clone $this; - $editor -> setTemplate ( 'editor' ); - $editor -> setData ( null ); - echo $editor -> output ( ); - - /* Seitenelemente für Standardseiten */ - if ( ! $this -> _specialSite ) - { - $elements = clone $this; - $elements -> setTemplate ( 'elements' ); - $elements -> setData ( $this -> _website[ $this -> _webkey ][ 'contentElems' ] ); - echo $elements -> output ( ); - } - } - + } ?> - _data[ 'galery' ] ) && ! empty( $this -> _data[ 'galery' ] ) ) - { - $galery = clone( $this ); - $galery -> setTemplate( 'galery' ); - $galery -> setData( $this -> _data[ 'galery' ] ); - echo $galery -> output( ); - ?> - - - -
-
-
-
- _data[ 'keyvisual' ] ) ) - { - ?> -
_editable ) ? 'data-editable="keyvisual"' : ''; ?>> - _data[ 'keyvisual' ] as $keyvisual ) - { - ?> - /> - -
- -
-
-
-
- _data[ 'navi_sub' ] ) ) + + $(window).load(function () { + if ($('img', '.keyvisual').length > 1) { + $('.keyvisual').nivoSlider( { - ?> - - _data[ 'navi_last' ] ) ) + prevText: '<', + nextText: '>' + }); + } + + if ($('.slider img', '#galeryslider').length > 1) { + $('.slider', '#galeryslider').nivoSlider( { - ?> - - -
+ controlNav: false, + controlNavThumbs: false, + directionNavHide: true, + prevText: '<', + nextText: '>', + manualAdvance: true + }); + _data[ 'content' ] ) ) - { - ?> -
- _data[ 'content' ] as $type => $data ) - { - $content = clone( $this ); - $content -> setTemplate ( $type ); - $content -> setData ( $data ); - echo $content -> output ( ); - } - - ?> -
- _editable === false ) + { + ?> + $('.keyvisual img').on('click', function () { + $('#galeryslider').show(); + }); + $('img.floatright').on('click', function () { + $('#galeryslider').show(); + }); + + } + + }); + + + _editable === true) + { + ?> + + + + + + +_editable === true) +{ + $editor = clone $this; + $editor->setTemplate('editor'); + $editor->setData(null); + echo $editor->output(); + + /** + * Seitenelemente für Standardseiten + */ + if (!$this->_specialSite) + { + $elements = clone $this; + $elements->setTemplate('elements'); + $elements->setData($this->_website[$this->_webkey]['contentElems']); + echo $elements->output(); + } +} + +/** + * Galerielayer + */ +if (isset($this->_data['galery']) && !empty($this->_data['galery'])) +{ + $galery = clone($this); + $galery->setTemplate('galery'); + $galery->setData($this->_data['galery']); + echo $galery->output(); +} + +?> + +
+
+
+
+ _data['keyvisual'])) + { + ?> +
_editable) ? 'data-editable="keyvisual"' : ''; ?>> + _data['keyvisual'] as $keyvisual) + { + ?> + /> + +
+ +
+
+
+
+ _data['navi_sub'])) + { + ?> + - _editable === false ) - { - ?> - - _data['navi_last'])) + { ?> - + + +
+ _data['content'])) + { + ?> +
+ _data['content'] as $type => $data) + { + $content = clone($this); + $content->setTemplate($type); + $content->setData($data); + echo $content->output(); + } + + ?> +
+ +
+
+ +_editable === false) +{ + ?> + + + \ No newline at end of file diff --git a/templates/svjf/tpl_pageContents.php b/templates/svjf/tpl_pageContents.php index d796520..d25c43f 100644 --- a/templates/svjf/tpl_pageContents.php +++ b/templates/svjf/tpl_pageContents.php @@ -1,11 +1,9 @@ _data as $data ) - { - $content = clone( $this ); - $content -> setTemplate ( $data[ 'type' ] ); - $content -> setData ( $data ); - echo $content -> output ( ); - } - - ?> \ No newline at end of file +foreach ($this->_data as $data) +{ + $content = clone($this); + $content->setTemplate($data['type']); + $content->setData($data); + echo $content->output(); +} \ No newline at end of file diff --git a/templates/svjf/tpl_textimage.php b/templates/svjf/tpl_textimage.php index 0390668..0d40e0f 100644 --- a/templates/svjf/tpl_textimage.php +++ b/templates/svjf/tpl_textimage.php @@ -1,24 +1,24 @@ _data ); - - if ( $this -> _editable ) - { - ?> -
- -
- _data); + +if ($this->_editable) +{ ?> -
- _editable ) ? 'data-editable="image"' : '' ; ?>src=" _prefix . '/' . $this -> _siteId . '/' . $imgName . '.' . $imgExtension ) ) ? PATH_MED . $this -> _prefix . '/' . $this -> _siteId . '/' . $imgName . '.' . $imgExtension : '' ; ?>" title=""/> -
_editable ) ? 'data-editable="text"' : '' ; ?>> - +
+ +
+ +
+ _editable) ? 'data-editable="image"' : ''; ?>src="_prefix . '/' . $this->_siteId . '/' . $imgName . '.' . $imgExtension; ?>" title=""/> +
_editable) ? 'data-editable="text"' : ''; ?>> + +
+
-
-
-
\ No newline at end of file +
\ No newline at end of file diff --git a/templates/svjf/tpl_widget.php b/templates/svjf/tpl_widget.php index 4c621a6..c8f108f 100644 --- a/templates/svjf/tpl_widget.php +++ b/templates/svjf/tpl_widget.php @@ -1,11 +1,9 @@ setPrefix ( $this -> _prefix ); - $widget -> setPathTpl ( PATH_WEBSITE_TPL ); - $widget -> setTemplate ( 'widget_' . $this -> _data[ 'tpl' ] ); - $widget -> setEditable ( $this -> _editable ); - $widget -> setData ( $this -> _data ); - echo $widget -> output ( ); - -?> \ No newline at end of file +$widget = new viewClass(); +$widget->setPrefix($this->_prefix); +$widget->setPathTpl(PATH_WEBSITE_TPL); +$widget->setTemplate('widget_' . $this->_data['tpl']); +$widget->setEditable($this->_editable); +$widget->setData($this->_data); +echo $widget->output(); \ No newline at end of file