Commit 2281a746 authored by Stefan Bublies's avatar Stefan Bublies
Browse files

Initial Upload

parent 98af5f55
Pipeline #27 canceled with stages
<?php
namespace Dtihiorg\DtiHiorg\Controller;
/***************************************************************
*
* Copyright notice
*
* (c) 2015 Stefan Bublies <bublies@dt-internet.de>, D&T Internet GmbH
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* HiOrgServerLoginController
*/
class HiOrgServerLoginController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
/**
* hiOrgServerLoginRepository
*
* @var \Dtihiorg\DtiHiorg\Domain\Repository\HiOrgServerLoginRepository
* @inject
*/
protected $hiOrgServerLoginRepository = NULL;
/**
* action list
*
* @return void
*/
public function listAction() {
$aHiorgLogin = array();
$adisplaylogin = $this->settings['hiorg']['displaylogin'];
$iFEGroup = $this->settings['hiorg']['usergroup'];
$sKuerzel = $this->settings['hiorg']['includelogin'];
$iSignonTyp = $this->settings['hiorg']['signon'];
$iZielseite = $this->settings['hiorg']['welcomepage'];
$iUserStorage = ($this->settings['hiorg']['userstorage']>0 ? $this->settings['hiorg']['userstorage'] : 533);
if ($_SERVER['HTTPS']) {
$sMe = 'https://' . $_SERVER['HTTP_HOST'] . '/nc' . $_SERVER['REQUEST_URI'];
} else {
$sMe = 'http://' . $_SERVER['HTTP_HOST'] . '/nc' . $_SERVER['REQUEST_URI'];
}
$sURL = 'https://www.hiorg-server.de/logmein.php?ov='.$sKuerzel.'&weiter='.urlencode($sMe).'&getuserinfo=name%2Cvorname%2Ckuerzel%2Cusername%2Cemail%2Cuser_id';
if ($_GET['token']) {
// Kommt zurueck. Holen wir uns die Session-Data:
$rCurl = curl_init("https://www.hiorg-server.de/logmein.php?token=".urlencode($_GET['token']));
curl_setopt($rCurl,CURLOPT_RETURNTRANSFER,1);
$sAusgabe = trim(curl_exec($rCurl));
curl_close($rCurl);
if(mb_substr( $sAusgabe ,0,2)== "OK") {
// Login erfolgreich. User ggf. anlegen:
$aHiorgUser = unserialize(base64_decode(mb_substr( $sAusgabe , 3)));
print_r($aHiorgUser);
$sUsername = 'hiorg_'.$sKuerzel.'_'.$aHiorgUser['username'];
$rVorhanden = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'fe_users', 'username="'.$sUsername.'" AND deleted=0');
if ($rVorhanden->num_rows==0) {
$GLOBALS['TYPO3_DB']->exec_INSERTquery('fe_users', array(
'username' => $sUsername,
'usergroup' => $iFEGroup,
'pid' => $iUserStorage,
'crdate' => time(),
));
}
$sPasswort = rand(0,1000000).time();
$GLOBALS['TYPO3_DB']->exec_UPDATEquery('fe_users', 'username="'.$sUsername.'"', array(
'password' => md5($sPasswort),
'first_name' => $aHiorgUser['vorname'],
'name' => $aHiorgUser['name'],
'email' => $aHiorgUser['email'],
));
$loginData=array(
'uname' => $sUsername,
'uident' => $sPasswort,
'status' => 'login'
);
$GLOBALS['TSFE']->fe_user->checkPid=0; //do not use a particular pid
$info= $GLOBALS['TSFE']->fe_user->getAuthInfoArray();
$user=$GLOBALS['TSFE']->fe_user->fetchUserRecord($info['db_user'],$loginData['uname']);
$ok=$GLOBALS['TSFE']->fe_user->compareUident($user,$loginData);
$GLOBALS['TSFE']->fe_user->createUserSession($user);
$reflection = new \ReflectionClass($GLOBALS['TSFE']->fe_user);
$setSessionCookieMethod = $reflection->getMethod('setSessionCookie');
$setSessionCookieMethod->setAccessible(TRUE);
$setSessionCookieMethod->invoke($GLOBALS['TSFE']->fe_user);
$GLOBALS['TSFE']->fe_user->user = $GLOBALS['TSFE']->fe_user->fetchUserSession();
$GLOBALS['TSFE']->fe_user->fetchGroupData();
header('Location: /index.php?id='.$iZielseite);
die();
}
}
if ($iSignonTyp==1) {
// Wir zeigen nur den Login-Knopf an:
$sHTML = "<a class=\"o-btn\" href= \"".$sURL."\" >Anmelden via HiOrg-Server</a>";
} else {
// leiten sofort auf den Hiorg-Loginbildschirm um.
header('Location: '.$sURL);
die();
}
$aHiorgLogin[] = $sHTML;
$this->view->assign('hiorglogin', $aHiorgLogin);
}
}
<?php
namespace Dtihiorg\DtiHiorg\Controller;
/***************************************************************
*
* Copyright notice
*
* (c) 2015 Stefan Bublies <bublies@dt-internet.de>, D&T Internet GmbH
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* HiOrgServerSchnittstelleController
*/
class HiOrgServerSchnittstelleController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
/**
* hiOrgServerSchnittstelleRepository
*
* @var \Dtihiorg\DtiHiorg\Domain\Repository\HiOrgServerSchnittstelleRepository
* @TYPO3\\CMS\\Extbase\\Annotation\\Inject
*/
protected $hiOrgServerSchnittstelleRepository = NULL;
/**
* action list
*
* @return void
*/
public function listAction() {
// HiOrg Anzeige
$hiorginclude = array();
$adisplay = $this->settings['hiorg']['display'];
$aparams01 = $this->settings['hiorg']['params01'];
$aparams02 = $this->settings['hiorg']['params02'];
$aparams03 = $this->settings['hiorg']['params03'];
$akurstyp = $this->settings['hiorg']['kurstyp'];
$aintern = $this->settings['hiorg']['intern'];
$akuerzel = $this->settings['hiorg']['include'];
$url = "https://www.hiorg-server.de/".$adisplay.($akurstyp ? 'kurstyp='.$akurstyp : '').($aintern ? 'nurint='.$aintern : '')."&ov=$akuerzel&onlytable=1".($aparams01 ? '&monate='.$aparams01 : '').($aparams02? '&anz='.$aparams02 : '').($aparams03? '&gruppe='.$aparams03 : '');
if(function_exists("curl_init")) {
$ch = curl_init($url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$data = curl_exec($ch);
curl_close($ch);
} else {
if(!ini_get("allow_url_fopen")) {
if(version_compare(phpversion(), "4.3.4", "<=")) ini_set("allow_url_fopen", "1");
else die("Ihr Server unterstützt das Laden externer Dateien nicht: lib_curl -oder- allow_url_fopen müssen aktiviert sein!");
}
if($fp = fopen($url,"r")) {
$data = "";
while(!feof($fp)) $data.= fread($fp,1024);
fclose($fp);
}
}
$hiorginclude[] = $data;
$this->view->assign('hiorgframe', $hiorginclude);
}
}
<?php
namespace Dtihiorg\DtiHiorg\Domain\Model;
/***************************************************************
*
* Copyright notice
*
* (c) 2015 Stefan Bublies <bublies@dt-internet.de>, D&T Internet GmbH
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* HiOrgServerLogin
*/
class HiOrgServerLogin extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
}
\ No newline at end of file
<?php
namespace Dtihiorg\DtiHiorg\Domain\Model;
/***************************************************************
*
* Copyright notice
*
* (c) 2015 Stefan Bublies <bublies@dt-internet.de>, D&T Internet GmbH
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* HiOrgServerSchnittstelle
*/
class HiOrgServerSchnittstelle extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
}
\ No newline at end of file
<?php
namespace Dtihiorg\DtiHiorg\Domain\Repository;
/***************************************************************
*
* Copyright notice
*
* (c) 2015 Stefan Bublies <bublies@dt-internet.de>, D&T Internet GmbH
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* The repository for HiOrgServerLogins
*/
class HiOrgServerLoginRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
}
\ No newline at end of file
<?php
namespace Dtihiorg\DtiHiorg\Domain\Repository;
/***************************************************************
*
* Copyright notice
*
* (c) 2015 Stefan Bublies <bublies@dt-internet.de>, D&T Internet GmbH
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* The repository for HiOrgServerSchnittstelles
*/
class HiOrgServerSchnittstelleRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
}
\ No newline at end of file
<T3DataStructure>
<sheets>
<sDEF>
<ROOT>
<TCEforms>
<sheetTitle>Konfiguration der HiOrg-Server-Terminanzeige</sheetTitle>
</TCEforms>
<type>array</type>
<el>
<settings.hiorg.include>
<TCEforms>
<label>HiOrg-Server Kürzel</label>
<config>
<type>input</type>
<size>10</size>
<eval>string</eval>
<default>000000</default>
</config>
</TCEforms>
</settings.hiorg.include>
<settings.hiorg.display>
<TCEforms>
<label>Ansicht auswählen</label>
<config>
<type>select</type>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0">Öffentliche Termine</numIndex>
<numIndex index="1">termine.php?</numIndex>
</numIndex>
<numIndex index="1" type="array">
<numIndex index="0">Kursanzeige</numIndex>
<numIndex index="1">kurse.php?</numIndex>
</numIndex>
</items>
</config>
</TCEforms>
</settings.hiorg.display>
<settings.hiorg.params01>
<TCEforms>
<label>Anzahl der Monate (Ansicht)</label>
<config>
<type>input</type>
<size>2</size>
<eval>int</eval>
<default>12</default>
</config>
</TCEforms>
</settings.hiorg.params01>
<settings.hiorg.params02>
<TCEforms>
<label>Anzahl der Ergebnisse</label>
<config>
<type>input</type>
<size>4</size>
<eval>int</eval>
<default>20</default>
</config>
</TCEforms>
</settings.hiorg.params02>
<settings.hiorg.params03>
<TCEforms>
<label>Gruppen-Filter</label>
<config>
<type>input</type>
<size>4</size>
<eval>int</eval>
</config>
</TCEforms>
</settings.hiorg.params03>
<settings.hiorg.kurstyp>
<TCEforms>
<label>Kurstyp</label>
<config>
<type>input</type>
<size>8</size>
<default></default>
</config>
</TCEforms>
</settings.hiorg.kurstyp>
<settings.hiorg.intern>
<TCEforms>
<label>Nur intern</label>
<config>
<type>check</type>
</config>
</TCEforms>
</settings.hiorg.intern>
</el>
</ROOT>
</sDEF>
</sheets>
</T3DataStructure>
<T3DataStructure>
<sheets>
<sDEF>
<ROOT>
<TCEforms>
<sheetTitle>HiOrg Server Anmeldung</sheetTitle>
</TCEforms>
<type>array</type>
<el>
<settings.hiorg.includelogin>
<TCEforms>
<label>HiOrg-Server Kürzel</label>
<config>
<type>input</type>
<size>10</size>
<eval>string</eval>
<default>000000</default>
</config>
</TCEforms>
</settings.hiorg.includelogin>
<!--settings.hiorg.displaylogin>
<TCEforms>
<label>Ansicht auswählen</label>
<config>
<type>select</type>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0">Login für Mitglieder</numIndex>
<numIndex index="1">1</numIndex>
</numIndex>
</items>
</config>
</TCEforms>
</settings.hiorg.displaylogin-->
<settings.hiorg.usergroup>
<TCEforms>
<label>Frontend-User-Gruppe, in die Nutzer beim erstmaligen Login zugeordnet werden</label>
<config>
<type>select</type>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0"></numIndex>
<numIndex index="1"></numIndex>
</numIndex>
</items>
<foreign_table>fe_groups</foreign_table>
</config>
</TCEforms>
</settings.hiorg.usergroup>
<settings.hiorg.signon>
<TCEforms>
<label>Anmeldemethode</label>
<config>
<type>select</type>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0">Login-Button zum HiOrg-Server anzeigen</numIndex>
<numIndex index="1">1</numIndex>
</numIndex>
<numIndex index="1" type="array">
<numIndex index="0">Sofortige Umleitung zum HiOrg-Server</numIndex>
<numIndex index="1">2</numIndex>
</numIndex>
</items>
</config>
</TCEforms>
</settings.hiorg.signon>
<settings.hiorg.welcomepage>
<TCEforms>
<label>Ziel-Seite nach erfolgreichem Login</label>
<config>
<type>group</type>
<internal_type>db</internal_type>
<allowed>pages</allowed>
<size>1</size>
<maxitems>1</maxitems>
<minitems>0</minitems>
<show_thumbs>1</show_thumbs>
</config>
</TCEforms>
</settings.hiorg.welcomepage>
<settings.hiorg.userstorage>
<TCEforms>
<label>User-Storage Systemordner (sofern abweichend)</label>
<config>
<type>group</type>
<internal_type>db</internal_type>
<allowed>pages</allowed>
<size>1</size>
<maxitems>1</maxitems>
<minitems>0</minitems>
<show_thumbs>1</show_thumbs>
</config>
</TCEforms>
</settings.hiorg.userstorage>
</el>
</ROOT>
</sDEF>
</sheets>
</T3DataStructure>
<?php
if (!defined ('TYPO3_MODE')) {
die ('Access denied.');
}
$GLOBALS['TCA']['tx_dtihiorg_domain_model_hiorgserverlogin'] = array(
'ctrl' => $GLOBALS['TCA']['tx_dtihiorg_domain_model_hiorgserverlogin']['ctrl'],
'interface' => array(
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, ',
),
'types' => array(
'1' => array('showitem' => 'sys_language_uid;;;;1-1-1, l10n_parent, l10n_diffsource, hidden;;1, --div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access, starttime, endtime'),
),
'palettes' => array(
'1' => array('showitem' => ''),
),
'columns' => array(
'sys_language_uid' => array(
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.language',
'config' => array(
'type' => 'select',
'foreign_table' => 'sys_language',
'foreign_table_where' => 'ORDER BY sys_language.title',
'items' => array(
array('LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages', -1),
array('LLL:EXT:lang/locallang_general.xlf:LGL.default_value', 0)
),
),
),
'l10n_parent' => array(
'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.l18n_parent',
'config' => array(
'type' => 'select',