Initialer Commit in GIT

This commit is contained in:
Carsten Götzinger 2014-10-01 07:31:51 +02:00
parent 4e95f399da
commit edb41e47b2
32 changed files with 3156 additions and 0 deletions

58
AeoCE.php Normal file
View File

@ -0,0 +1,58 @@
<?php
/**
* Contao Open Source CMS
* Copyright (C) 2005-2011 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2012-2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package aeo
* @license GNU/LGPL
* @filesource
*/
namespace cgoIT\aeo;
/**
* Class AeoModule
*/
class AeoCE extends AeoHybrid {
/**
* Key
* @var string
*/
protected $strKey = 'id';
/**
* Table
* @var string
*/
protected $strTable = 'tl_content';
/**
* Initialize the object
* @param array
*/
public function __construct($objElement, $strColumn='main') {
parent::__construct($objElement, $strColumn);
}
}
?>

241
AeoHybrid.php Normal file
View File

@ -0,0 +1,241 @@
<?php
/**
* Contao Open Source CMS
* Copyright (C) 2005-2011 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2012-2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package aeo
* @license GNU/LGPL
* @filesource
*/
namespace cgoIT\aeo;
/**
* Class AeoModule
*/
class AeoHybrid extends \Hybrid
{
/**
* Primary key
* @var string
*/
protected $strPk = 'id';
/**
* Template
* @var string
*/
protected $strTemplate = 'aeo_default_no_js';
/**
* Use additional ROT13 encryption, default is 1
* @var int
*/
protected $use_rot_13 = 1;
/**
* Show standard-info to frontend user, default is true
* @var int
*/
protected $show_standard_info = true;
/**
* custom info to frontend user, default is ''
* @var int
*/
protected $info = '';
protected $objCaptcha;
/**
* Initialize the object
* @param array
*/
public function __construct($objElement, $strColumn='main') {
parent::__construct($objElement, $strColumn);
}
/**
* Display a wildcard in the back end
* @return string
*/
public function generate()
{
global $objPage;
$GLOBALS['TL_LANGUAGE'] = $objPage->language;
if (TL_MODE == 'BE')
{
$objTemplate = new \BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### AEO JavaScript Fallback ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $this->name;
$objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
return $objTemplate->parse();
}
$this->use_rot_13 = $GLOBALS['TL_CONFIG']['aeo_use_rot_13'] === true;
// Fallback auf default template
$strTemplate = deserialize($this->getParent()->aeo_custom_template, true);
if (!is_array($strTemplate) || count($strTemplate) < 1) {
$this->strTemplate = 'aeo_default_no_js';
} else {
$this->strTemplate = $strTemplate[0];
}
// Default Info für Frontend-User anzeigen
$numShowInfo = deserialize($this->getParent()->aeo_show_info, true);
if (is_array($numShowInfo) && count($numShowInfo) >= 1) {
$this->show_standard_info = $numShowInfo[0];
} else {
$this->show_standard_info = false;
}
// Eigene Info für Frontend-User anzeigen
$strInfo = deserialize($this->getParent()->aeo_info_text, true);
if (is_array($strInfo) && count($strInfo) >= 1) {
$this->info = $strInfo[0];
}
if (strlen($this->info) == 0) {
$this->show_standard_info = true;
}
return parent::generate();
}
/**
* Generate the module
*/
protected function compile()
{
global $objPage;
$GLOBALS['TL_LANGUAGE'] = $objPage->language;
$this->loadLanguageFile('default');
// Auf E-Mail-Adresse weiterleiten
$this->Template = new \FrontendTemplate($this->strTemplate);
if ($this->getParent() instanceof \ModuleModel) {
$this->Template->setData($this->getParent()->row());
// Überschrift setzen
$arrHeadline = deserialize($this->getParent()->headline);
if (is_array($arrHeadline)) {
$this->Template->hl = $arrHeadline['unit'];
$this->Template->headline = $arrHeadline['value'];
}
} else {
$this->Template->setData($this->arrData);
}
$doSubmit = true;
$arrCaptcha = array
(
'id' => 'aeo',
'label' => $GLOBALS['TL_LANG']['MSC']['securityQuestion'],
'type' => 'captcha',
'mandatory' => true,
'required' => true,
'tableless' => true
);
$strClass = $GLOBALS['TL_FFL']['captcha'];
// Fallback auf Default Captcha, falls Klasse nicht existiert
if (!$this->classFileExists($strClass))
{
$strClass = '\\FormCaptcha';
}
$objCaptcha = new $strClass($arrCaptcha);
$this->objCaptcha = $objCaptcha;
if ($this->Input->post('FORM_SUBMIT') == 'tl_aeo') {
$this->objCaptcha->validate();
if ($this->objCaptcha->hasErrors()) {
$doSubmit = false;
}
}
$objResult = $this->Database->prepare("SELECT * FROM tl_page WHERE id=?")
->limit(1)
->execute($this->Input->get('p'))
->fetchAssoc();
$pageDetails = $this->getPageDetails($objResult['id']);
$backLink = $this->generateFrontendUrl($objResult);
/**
* Template variables
*/
$this->import('String');
$this->Template->action = $this->getIndexFreeRequest();
$this->Template->n = $this->Input->get('n');
$this->Template->d = $this->Input->get('d');
$this->Template->t = $this->Input->get('t');
$this->Template->p = $this->Input->get('param');
$this->Template->captcha = $this->objCaptcha;
$this->Template->captchaDetails = $GLOBALS['TL_LANG']['MSC']['securityQuestion'];
if ($this->show_standard_info) {
$this->Template->info = $GLOBALS['TL_LANG']['aeo']['info'];
} else {
$this->Template->info = $this->info;
}
$this->Template->formId = 'tl_aeo';
$this->Template->buttonLabel = $GLOBALS['TL_LANG']['aeo']['buttonLabel'];
$this->Template->backLink = $backLink;
$this->Template->backLabel = $GLOBALS['TL_LANG']['MSC']['goBack'];
if ($this->Input->post('FORM_SUBMIT') == 'tl_aeo' && $doSubmit) {
if ($this->use_rot_13) {
$email = strip_tags(str_rot13($this->Input->post('n')).'@'.str_rot13($this->Input->post('d')).'.'.str_rot13($this->Input->post('t')));
} else {
$email = strip_tags($this->Input->post('n').'@'.$this->Input->post('d').'.'.$this->Input->post('t'));
}
if ($this->Input->post('p')) {
$email .= $this->String->decodeEntities(base64_decode($this->String->decodeEntities($this->Input->post('p'))));
}
$this->Template->isHuman = true;
$this->Template->success = sprintf($GLOBALS['TL_LANG']['aeo']['success'], $this->String->encodeEmail($email), $this->String->encodeEmail(preg_replace('/\?.*$/', '', $email)));
if (!headers_sent()) {
header('HTTP/1.1 303 See Other');
header('Location: mailto:'.$email);
}
else {
die('<html><head><meta http-equiv="refresh" content="0; url=mailto:'.$email.'"></head><body></body></html>');
}
}
}
}
?>

84
AeoJavaScript.php Normal file
View File

@ -0,0 +1,84 @@
<?php
/**
* Contao Open Source CMS
* Copyright (C) 2005-2011 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2012-2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package aeo
* @license GNU/LGPL
* @filesource
*/
namespace cgoIT\aeo;
/**
* Class AeoJavaScript
*/
class AeoJavaScript
{
/**
* Current object instance (Singleton)
* @var Cache
*/
protected static $objInstance;
/**
* Template
* @var string
*/
protected static $strTemplate = 'js_aeo_deobfuscate';
/**
* Prevent direct instantiation (Singleton)
*/
protected function __construct() {}
/**
* Prevent cloning of the object (Singleton)
*/
final private function __clone() {}
public function getContent($folder, $rot13 = true) {
$Template = new \FrontendTemplate(self::$strTemplate);
$Template->rot13 = $rot13;
$Template->folder = $folder;
$Template->tooltip_js_on = $GLOBALS['TL_LANG']['aeo']['tooltip_js'];
$Template->tooltip_js_off = $GLOBALS['TL_LANG']['aeo']['tooltip_no_js'];
return $Template->parse();
}
/**
* Instantiate a new cache object and return it (Factory)
* @return Cache
*/
public static function getInstance() {
if (!is_object(self::$objInstance)) {
self::$objInstance = new self();
}
return self::$objInstance;
}
}
?>

62
AeoModule.php Normal file
View File

@ -0,0 +1,62 @@
<?php
/**
* Contao Open Source CMS
* Copyright (C) 2005-2011 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2012-2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package aeo
* @license GNU/LGPL
* @filesource
*/
namespace cgoIT\aeo;
/**
* Class AeoModule
*/
class AeoModule extends AeoHybrid {
/**
* Key
* @var string
*/
protected $strKey = 'module';
/**
* Table
* @var string
*/
protected $strTable = 'tl_module';
/**
* Initialize the object
* @param array
*/
public function __construct($objElement, $strColumn='main') {
parent::__construct($objElement, $strColumn);
}
protected function getType() {
return 'module';
}
}
?>

64
PageRoot_Aeo.php Normal file
View File

@ -0,0 +1,64 @@
<?php
/**
* Contao Open Source CMS
* Copyright (C) 2005-2011 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2012-2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package aeo
* @license GNU/LGPL
* @filesource
*/
namespace cgoIT\aeo;
/**
* Class PageRoot_Aeo
*/
class PageRoot_Aeo extends \PageRoot {
/**
* Referenz auf AeoRedirectUtil
* @var AeoRedirectUtil
*/
public function __construct() {
parent::__construct();
$this->import('\\Database', 'Database');
$this->import('aeo\\AeoRedirectUtil', 'AeoRedirectUtil');
}
/**
* Redirect to the first active regular page
* @param integer
* @param boolean
* @return integer
*/
public function generate($pageId, $blnReturn=false) {
$id = $this->AeoRedirectUtil->redirectFromRootPage();
if ($id !== FALSE) {
return $id;
} else {
return parent::generate($pageId, $blnReturn);
}
}
}
?>

7
config/autoload.ini Normal file
View File

@ -0,0 +1,7 @@
;;
; Configure what you want the autoload creator to register
;;
register_namespaces = true
register_classes = true
register_templates = true

48
config/autoload.php Normal file
View File

@ -0,0 +1,48 @@
<?php
/**
* Contao Open Source CMS
*
* Copyright (C) 2005-2013 Leo Feyer
*
* @package Zaeo
* @link http://contao.org
* @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL
*/
/**
* Register the namespaces
*/
ClassLoader::addNamespaces(array
(
'cgoIT',
));
/**
* Register the classes
*/
ClassLoader::addClasses(array
(
'cgoIT\aeo\AeoJavaScript' => 'system/modules/zaeo/AeoJavaScript.php',
'cgoIT\aeo\AeoHybrid' => 'system/modules/zaeo/AeoHybrid.php',
'cgoIT\aeo\AeoCE' => 'system/modules/zaeo/AeoCE.php',
'cgoIT\aeo\AeoModule' => 'system/modules/zaeo/AeoModule.php',
'cgoIT\aeo\PageRoot_Aeo' => 'system/modules/zaeo/PageRoot_Aeo.php',
// Util
'cgoIT\aeo\AeoFrontendUtil' => 'system/modules/zaeo/util/AeoFrontendUtil.php',
'cgoIT\aeo\AeoRedirectUtil' => 'system/modules/zaeo/util/AeoRedirectUtil.php',
'cgoIT\aeo\AeoUtil' => 'system/modules/zaeo/util/AeoUtil.php',
'cgoIT\aeo\McwPageTree' => 'system/modules/zaeo/widgets/McwPageTree.php',
));
/**
* Register the templates
*/
TemplateLoader::addFiles(array
(
'aeo_default_no_js' => 'system/modules/zaeo/templates',
'js_aeo_deobfuscate' => 'system/modules/zaeo/templates',
));

54
config/config.php Normal file
View File

@ -0,0 +1,54 @@
<?php if (!defined('TL_ROOT')) die('You can not access this file directly!');
/**
* Contao Open Source CMS
* Copyright (C) 2005-2011 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2012-2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package aeo
* @license GNU/LGPL
* @filesource
*/
/**
* Hooks
*/
$GLOBALS['TL_HOOKS']['getFrontendModule'][] = array('aeo\\AeoFrontendUtil', 'aeoGetFrontendModule');
$GLOBALS['TL_HOOKS']['getContentElement'][] = array('aeo\\AeoFrontendUtil', 'aeoGetContentElement');
$GLOBALS['TL_HOOKS']['outputFrontendTemplate'][] = array('aeo\\AeoFrontendUtil', 'obfuscateEmails');
$GLOBALS['TL_HOOKS']['getPageIdFromUrl'][] = array('aeo\\AeoRedirectUtil', 'getRedirectPageAeo');
/**
* frontend moduls
*/
$GLOBALS['FE_MOD']['application']['aeo'] = 'aeo\\AeoModule';
/**
* content elements
*/
$GLOBALS['TL_CTE']['includes']['aeo'] = 'aeo\\AeoCE';
/**
* PageTypes
*/
$GLOBALS['TL_PTY']['root'] = 'aeo\\PageRoot_Aeo';
?>

29
config/database.sql Normal file
View File

@ -0,0 +1,29 @@
-- **********************************************************
-- * *
-- * IMPORTANT NOTE *
-- * *
-- * Do not import this file manually but use the TYPOlight *
-- * install tool to create and maintain database tables! *
-- * *
-- **********************************************************
--
-- Table `tl_module`
--
CREATE TABLE `tl_module` (
`aeo_custom_template` varchar(32) NOT NULL default '',
`aeo_show_info` char(1) NOT NULL default '',
`aeo_info_text` mediumtext NULL,
`aeo_disable` char(1) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Table `tl_content`
--
CREATE TABLE `tl_content` (
`aeo_custom_template` varchar(32) NOT NULL default '',
`aeo_show_info` char(1) NOT NULL default '',
`aeo_info_text` mediumtext NULL,
`aeo_disable` char(1) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

112
dca/tl_content.php Normal file
View File

@ -0,0 +1,112 @@
<?php
/**
* Contao Open Source CMS
* Copyright (C) 2005-2011 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2012-2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package aeo
* @license GNU/LGPL
* @filesource
*/
/**
* palettes
*/
$GLOBALS['TL_DCA']['tl_content']['palettes']['aeo'] = '{type_legend},type,headline;{aeo_legend},aeo_show_info,aeo_info_text,aeo_disable;{template_legend:hide},aeo_custom_template;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space';
/**
* extend existing expert_legend
*/
foreach ($GLOBALS['TL_DCA']['tl_content']['palettes'] as $key => $palette) {
if (!is_array($palette) && $key != 'aeo') {
$GLOBALS['TL_DCA']['tl_content']['palettes'][$key] = $palette.';{aeo_legend:hide},aeo_disable';
}
}
/**
* fields
*/
$GLOBALS['TL_DCA']['tl_content']['fields']['aeo_custom_template'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_content']['aeo_custom_template'],
'default' => 'aeo_default_no_js',
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('tl_content_aeo', 'getAeoTemplates'),
'eval' => array('tl_class'=>'w50')
);
$GLOBALS['TL_DCA']['tl_content']['fields']['aeo_show_info'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_content']['aeo_show_info'],
'exclude' => true,
'filter' => true,
'search' => false,
'inputType' => 'checkbox',
'eval' => array('tl_class'=>'w50')
);
$GLOBALS['TL_DCA']['tl_content']['fields']['aeo_info_text'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_content']['aeo_info_text'],
'exclude' => true,
'filter' => true,
'search' => true,
'inputType' => 'textarea',
'eval' => array('rte'=>'tinyMCE', 'tl_class'=>'clr')
);
$GLOBALS['TL_DCA']['tl_content']['fields']['aeo_disable'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_content']['aeo_disable'],
'default' => '',
'exclude' => true,
'filter' => true,
'search' => false,
'inputType' => 'checkbox',
'eval' => array('tl_class'=>'long')
);
/**
* Class tl_content_aeo
*/
class tl_content_aeo extends \Backend
{
/**
* Return all navigation templates as array
* @param DataContainer
* @return array
*/
public function getAeoTemplates(\DataContainer $dc)
{
$intPid = $dc->activeRecord->pid;
if ($this->Input->get('act') == 'overrideAll')
{
$intPid = $this->Input->get('id');
}
return $this->getTemplateGroup('aeo_', $intPid);
}
}
?>

117
dca/tl_module.php Normal file
View File

@ -0,0 +1,117 @@
<?php
/**
* Contao Open Source CMS
* Copyright (C) 2005-2011 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2012-2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package aeo
* @license GNU/LGPL
* @filesource
*/
/**
* palettes
*/
$GLOBALS['TL_DCA']['tl_module']['palettes']['aeo'] = '{title_legend},name,headline,type;{aeo_legend},aeo_show_info,aeo_info_text,aeo_disable;{template_legend:hide},aeo_custom_template;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space';
/**
* extend existing expert_legend
*/
foreach ($GLOBALS['TL_DCA']['tl_module']['palettes'] as $key => $palette) {
if (!is_array($palette) && $key != 'aeo') {
$GLOBALS['TL_DCA']['tl_module']['palettes'][$key] = $palette.';{aeo_legend:hide},aeo_disable';
}
}
//foreach ($GLOBALS['TL_DCA']['tl_module']['palettes'] as $key => $palette) {
// if (!is_array($palette)) {
// print "<h1>$key => $palette </h1>\n";
// }
//}
/**
* fields
*/
$GLOBALS['TL_DCA']['tl_module']['fields']['aeo_custom_template'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_module']['aeo_custom_template'],
'default' => 'aeo_default_no_js',
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('tl_module_aeo', 'getAeoTemplates'),
'eval' => array('tl_class'=>'w50')
);
$GLOBALS['TL_DCA']['tl_module']['fields']['aeo_show_info'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_module']['aeo_show_info'],
'exclude' => true,
'filter' => true,
'search' => false,
'inputType' => 'checkbox',
'eval' => array('tl_class'=>'w50')
);
$GLOBALS['TL_DCA']['tl_module']['fields']['aeo_info_text'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_module']['aeo_info_text'],
'exclude' => true,
'filter' => true,
'search' => true,
'inputType' => 'textarea',
'eval' => array('rte'=>'tinyMCE', 'tl_class'=>'clr')
);
$GLOBALS['TL_DCA']['tl_module']['fields']['aeo_disable'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_module']['aeo_disable'],
'default' => '',
'exclude' => true,
'filter' => true,
'search' => false,
'inputType' => 'checkbox',
'eval' => array('tl_class'=>'long')
);
/**
* Class tl_module_aeo
*/
class tl_module_aeo extends \Backend
{
/**
* Return all navigation templates as array
* @param DataContainer
* @return array
*/
public function getAeoTemplates(\DataContainer $dc)
{
$intPid = $dc->activeRecord->pid;
if ($this->Input->get('act') == 'overrideAll')
{
$intPid = $this->Input->get('id');
}
return $this->getTemplateGroup('aeo_', $intPid);
}
}
?>

245
dca/tl_settings.php Normal file
View File

@ -0,0 +1,245 @@
<?php
/**
* Contao Open Source CMS
* Copyright (C) 2005-2011 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2012-2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package aeo
* @license GNU/LGPL
* @filesource
*/
/**
* palettes
*/
$GLOBALS['TL_DCA']['tl_settings']['palettes']['__selector__'][] = 'aeo_replace_standard_obfuscation';
$GLOBALS['TL_DCA']['tl_settings']['palettes']['default'] .= ';{aeo_legend:hide},aeo_replace_standard_obfuscation';
/**
* Add subpalettes to tl_settings
*/
$GLOBALS['TL_DCA']['tl_settings']['subpalettes']['aeo_replace_standard_obfuscation'] = 'aeo_use_rot_13,aeo_obfuscation_method,aeo_virtual_path,aeo_jump_to_no_js';
/**
* fields
*/
$GLOBALS['TL_DCA']['tl_settings']['fields']['aeo_replace_standard_obfuscation'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_settings']['aeo_replace_standard_obfuscation'],
'default' => '',
'exclude' => true,
'inputType' => 'checkbox',
'eval' => array('tl_class'=>'w50', 'submitOnChange'=>true)
);
$GLOBALS['TL_DCA']['tl_settings']['fields']['aeo_use_rot_13'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_settings']['aeo_use_rot_13'],
'default' => '',
'exclude' => true,
'inputType' => 'checkbox',
'eval' => array('tl_class'=>'w50')
);
$GLOBALS['TL_DCA']['tl_settings']['fields']['aeo_virtual_path'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_settings']['aeo_virtual_path'],
'default' => '',
'exclude' => true,
'inputType' => 'text',
'eval' => array('decodeEntities'=>true, 'mandatory'=>true, 'tl_class'=>'w50', 'trailingSlash'=>false)
);
$GLOBALS['TL_DCA']['tl_settings']['fields']['aeo_obfuscation_method'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_settings']['aeo_obfuscation_method'],
'default' => 'shorten',
'exclude' => true,
'inputType' => 'select',
'options' => array('shorten', 'rtl', 'nullspan'),
'reference' => &$GLOBALS['TL_LANG']['tl_settings'],
'eval' => array('helpwizard'=>true, 'mandatory'=>true, 'tl_class'=>'w50')
);
$GLOBALS['TL_DCA']['tl_settings']['fields']['aeo_jump_to_no_js'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_settings']['aeo_jump_to_no_js'],
'exclude' => true,
'inputType' => 'multiColumnWizard',
'save_callback' => array(
array("tl_settings_aeo", "checkForDuplicateOrNoLanguageFallback"),
array("tl_settings_aeo", "checkForDuplicateLanguage"),
array("tl_settings_aeo", "checkForModuleOrCE")
),
'eval' => array(
'style' => 'width:100%;',
'tl_class' => 'clr',
'columnFields' => array(
'aeo_language_fallback' => array(
'label' => &$GLOBALS['TL_LANG']['tl_settings']['aeo_language_fallback'],
'default' => '',
'exclude' => true,
'inputType' => 'checkbox',
'eval' => array(doNotCopy => true, multiple => false, 'tl_class' => 'm12', 'style' => 'width:50px; padding-bottom: 3px;', 'includeBlankOption' => true),
),
'aeo_language' => array(
'label' => &$GLOBALS['TL_LANG']['tl_settings']['aeo_language'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array("tl_settings_aeo", "getAvailableLanguages"),
'eval' => array(doNotCopy => true, 'mandatory' => true, 'tl_class' => 'm12', 'style' => 'width:210px; padding-bottom: 3px; margin-top: 3px;', 'includeBlankOption' => true),
),
'aeo_redirecturl' => array(
'label' => &$GLOBALS['TL_LANG']['tl_settings']['aeo_redirecturl'],
'exclude' => true,
'inputType' => 'pageTree',
'eval' => array('mandatory' => true, 'fieldType' => 'radio', 'tl_class' => 'clr'),
'foreignKey' => 'tl_page.title',
'sql' => "int(10) unsigned NOT NULL default '0'",
'relation' => array('type'=>'hasOne', 'load'=>'lazy')
)
)
)
);
class tl_settings_aeo extends \Backend
{
/**
* Alle unterschiedlichen Seitensprachen suchen und zurückgeben
*
* @return array
*/
public function getAvailableLanguages() {
$this->loadLanguageFile('languages');
include(TL_ROOT . '/system/config/languages.php');
$arrReturn = array();
$arrLanguages = array();
$objResult = $this->Database->prepare("SELECT DISTINCT language FROM tl_page WHERE type = 'root'")->execute()->fetchAllAssoc();
foreach (array_values($objResult) as $value) {
array_push($arrLanguages, strtolower($value['language']));
}
if (in_array('i18nl10n', $this->Config->getActiveModules())) {
$languages = deserialize($GLOBALS['TL_CONFIG']['i18nl10n_languages']);
foreach ($languages as $language) {
array_push($arrLanguages, strtolower($language));
}
$arrLanguages = array_unique($arrLanguages);
}
foreach ($arrLanguages as $language) {
$arrReturn[$language] = strlen($GLOBALS['TL_LANG']['LNG'][$language]) ?
utf8_romanize($GLOBALS['TL_LANG']['LNG'][$language]).' ('.strtoupper($language).')' : strtoupper($language);
}
return $arrReturn;
}
public function checkForDuplicateOrNoLanguageFallback($varVal, \DataContainer $dc) {
$arrValue = deserialize($varVal);
$count = 0;
foreach ($arrValue as $key => $value) {
if ($value['aeo_language_fallback']) {
$count++;
}
if ($count > 1) {
$_SESSION["TL_ERROR"][] = sprintf($GLOBALS['TL_LANG']['aeo']['aeo_error_duplicate'], $GLOBALS['TL_LANG']['tl_settings']['aeo_language_fallback'][0]);
}
}
if ($count == 0) {
$_SESSION["TL_ERROR"][] = sprintf($GLOBALS['TL_LANG']['ERR']['mandatory'], $GLOBALS['TL_LANG']['tl_settings']['aeo_language_fallback'][0]);
}
return serialize($arrValue);
}
/**
* Prüfen, ob eine Sprache zwei mal gewählt wurde
*
* @param string $varVal
* @param DataContainer $dc
* @return string
*/
public function checkForDuplicateLanguage($varVal, \DataContainer $dc) {
$arrValue = deserialize($varVal);
$arrValueFound = array();
foreach ($arrValue as $key => $value) {
if (in_array($value["aeo_language"], $arrValueFound)) {
$_SESSION["TL_ERROR"][] = sprintf($GLOBALS['TL_LANG']['aeo']['aeo_error_duplicate'], $GLOBALS['TL_LANG']['tl_settings']['aeo_language'][0]);
}
else {
$arrValueFound[] = $value["aeo_language"];
}
}
return serialize($arrValue);
}
/**
* Prüfen, ob die Weiterleitungsseiten alle das Modul oder CE
* "AEO" beinhalten.
*
* @param string $varVal
* @param DataContainer $dc
* @return string
*/
public function checkForModuleOrCE($varVal, \DataContainer $dc) {
$this->import('\\Database', 'Database');
$this->import('aeo\\AeoUtil', 'AeoUtil');
$arrValue = deserialize($varVal);
foreach ($arrValue as $key => $value) {
$objResult = $this->Database->prepare("SELECT count(*) as anzahl FROM tl_page p, tl_article a, tl_content c LEFT JOIN tl_module m ON c.module = m.id
WHERE p.id = a.pid AND a.id = c.pid AND c.invisible <> 1 AND
( m.type = 'aeo' OR c.type = 'aeo' ) AND p.id = ?")->limit(1)->execute($value["aeo_redirecturl"]);
if (($objResult->anzahl) == 0) {
$_SESSION["TL_ERROR"][] = &$GLOBALS['TL_LANG']['aeo']['aeo_error_redirect'];
}
}
return serialize($arrValue);
}
public function getUserFullName() {
$this->import('jicw\\JICWHelper', 'JICWHelper');
return $this->JICWHelper->getUserFullName();
}
public function getUserEmail() {
$this->import('jicw\\JICWHelper', 'JICWHelper');
return $this->JICWHelper->getUserEmail();
}
public function getInstalledModules() {
$this->import('jicw\\JICWHelper', 'JICWHelper');
return $this->JICWHelper->getInstalledModules();
}
}
?>

56
languages/de/default.php Normal file
View File

@ -0,0 +1,56 @@
<?php if (!defined('TL_ROOT')) die('You can not access this file directly!');
/**
* Contao Open Source CMS
* Copyright (C) 2005-2011 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2012-2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package aeo
* @license GNU/LGPL
* @filesource
*/
/**
* front end modules
*/
$GLOBALS['TL_LANG']['FMD']['aeo'] = array('Advanced eMail Obfuscation', 'Erzeugt ein Formular zur Entschlüsselung von E-Mail-Adressen Frontend-Benutzer ohne JavaScript.');
/**
* content Elements
*/
$GLOBALS['TL_LANG']['CTE']['aeo'] = array('Advanced eMail Obfuscation', 'Erzeugt ein Formular zur Entschlüsselung von E-Mail-Adressen Frontend-Benutzer ohne JavaScript.');
/**
* errors
*/
$GLOBALS['TL_LANG']['aeo']['aeo_error_duplicate'] = 'Advanced eMail Obfuscation: Es sind Einträge im Feld %s doppelt vorhanden.';
$GLOBALS['TL_LANG']['aeo']['aeo_error_redirect'] = 'Advanced eMail Obfuscation: Bitte achten Sie darauf, dass alle Weiterleitungsseiten ein Modul oder Inhaltselement vom Typ "Advanced eMail Obfuscation" enthalten.';
/**
* others
*/
$GLOBALS['TL_LANG']['aeo']['tooltip_no_js'] = 'Da Sie JavaScript deaktiviert haben müssen sie eine einfache Frage beantworten, um ihr E-Mail-Programm automatisch zu öffnen.';
$GLOBALS['TL_LANG']['aeo']['tooltip_js'] = 'E-Mail senden';
$GLOBALS['TL_LANG']['aeo']['buttonLabel'] = 'E-Mail-Programm öffnen';
$GLOBALS['TL_LANG']['aeo']['info'] = '<h2>Warum muss ich diese Frage beantworten?</h2><p>Das Ziel dieser Überprüfung ist es, den Inhaber der angegebenen E-Mail-Adresse vor dem Empfang von unerwünschten E-Mails zu schützen.</p><p>Da Sie kein JavaScript aktiviert haben, überprüfen wir durch diese Sicherheitsfrage, ob Sie wirklich ein Mensch sind. Mit aktiviertem JavaScript entfällt diese zusätzliche Frage.</p><p>Obwohl Spammer bestehende E-Mail-Listen mieten oder kaufen können, entscheiden viele sich eine Software als "E-Mail-Harvester" (oft auch "Spam Bots" genannt) einzusetzen, die E-Mail-Adressen auf Webseiten sucht. Diese "E-Mail-Harvester" arbeiten oft auf die gleiche Weise wie Suchmaschinen es tun und versuchen, jede E-Mail-Adresse, die sie im Internet finden, zu sammeln. Allerdings sind die Brute-Force-Algorithmen die sie verwenden nicht in der Lage, die einfache Frage oben zu beantworten.</p><p><a href="http://de.wikipedia.org/wiki/Spam" title="Artikel bei Wikipedia" target="_blank">Lesen Sie mehr über Spam und wie man es verhindern kann.</a></p>';
$GLOBALS['TL_LANG']['aeo']['success'] = 'Wir haben ihr E-Mail-Programm geöffnet. Wenn dies nicht geklappt hat, klicken sie bitte auf die E-Mail-Adresse: <a href="mailto:%s">%s</a>.';
?>

36
languages/de/modules.php Normal file
View File

@ -0,0 +1,36 @@
<?php if (!defined('TL_ROOT')) die('You can not access this file directly!');
/**
* Contao Open Source CMS
* Copyright (C) 2005-2011 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2012-2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package aeo
* @license GNU/LGPL
* @filesource
*/
/**
* Extension folder
*/
$GLOBALS['TL_LANG']['MOD']['zaeo'] = array('Advanced eMail Obfuscation', 'Diese Erweiterung stellt die Verschleierung von E-Mail-Adressen zur Verfügung.');

View File

@ -0,0 +1,43 @@
<?php if (!defined('TL_ROOT')) die('You cannot access this file directly!');
/**
* Contao Open Source CMS
* Copyright (C) 2005-2011 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2012-2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package aeo
* @license GNU/LGPL
* @filesource
*/
/**
* legends
*/
$GLOBALS['TL_LANG']['tl_content']['aeo_legend'] = 'Advanced eMail Obfuscation Einstellungen';
/**
* fields
*/
$GLOBALS['TL_LANG']['tl_content']['aeo_custom_template'] = array('Template', 'Hier können Sie das Template für das Formular auswählen.');
$GLOBALS['TL_LANG']['tl_content']['aeo_show_info'] = array('Standard-Info anzeigen', 'Zeigt dem Frontend-Benutzer eine Standard-Information an, warum er eine Sicherheitsfrage beantworten muss. Gilt nur für Frontend-Benutzer ohne JavaScript.');
$GLOBALS['TL_LANG']['tl_content']['aeo_info_text'] = array('Eigener Info-Text', 'Informations-Text, der dem Frontend-Benutzer angezeigt wird. Gilt nur für Frontend-Benutzer ohne JavaScript.');
$GLOBALS['TL_LANG']['tl_content']['aeo_disable'] = array('Advanced eMail Obfuscation deaktivieren', 'Deaktiviert die Funktionalität von Advanced eMail Obfuscation für dieses Inhaltselement.');
?>

View File

@ -0,0 +1,43 @@
<?php if (!defined('TL_ROOT')) die('You cannot access this file directly!');
/**
* Contao Open Source CMS
* Copyright (C) 2005-2011 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2012-2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package aeo
* @license GNU/LGPL
* @filesource
*/
/**
* legends
*/
$GLOBALS['TL_LANG']['tl_content']['aeo_legend'] = 'Advanced eMail Obfuscation Einstellungen';
/**
* fields
*/
$GLOBALS['TL_LANG']['tl_module']['aeo_custom_template'] = array('Template', 'Hier können Sie das Template für das Formular auswählen.');
$GLOBALS['TL_LANG']['tl_module']['aeo_show_info'] = array('Standard-Info anzeigen', 'Zeigt dem Frontend-Benutzer eine Standard-Information an, warum er eine Sicherheitsfrage beantworten muss. Gilt nur für Frontend-Benutzer ohne JavaScript.');
$GLOBALS['TL_LANG']['tl_module']['aeo_info_text'] = array('Eigener Info-Text', 'Informations-Text, der dem Frontend-Benutzer angezeigt wird.');
$GLOBALS['TL_LANG']['tl_module']['aeo_disable'] = array('Advanced eMail Obfuscation deaktivieren', 'Deaktiviert die Funktionalität von Advanced eMail Obfuscation für dieses Modul.');
?>

View File

@ -0,0 +1,60 @@
<?php if (!defined('TL_ROOT')) die('You can not access this file directly!');
/**
* Contao Open Source CMS
* Copyright (C) 2005-2011 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2012-2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package aeo
* @license GNU/LGPL
* @filesource
*/
/**
* Name
*/
$GLOBALS['TL_LANG']['tl_settings']['aeo'] = "Advanced eMail Obfuscation";
/**
* legends
*/
$GLOBALS['TL_LANG']['tl_settings']['aeo_legend'] = 'Advanced eMail Obfuscation Einstellungen';
/**
* fields
*/
$GLOBALS['TL_LANG']['tl_settings']['aeo_replace_standard_obfuscation'] = array('Aktiv', 'Ist diese Option aktiviert, wird die Standard-Verschleierung von E-Mail-Adressen durch Contao durch "Advanced eMail Obfuscation" ersetzt.');
$GLOBALS['TL_LANG']['tl_settings']['aeo_use_rot_13'] = array('ROT13-Verschlüsselung nutzen', 'ROT13 (engl. rotate by 13 places, zu Deutsch in etwa "rotiere um 13 Stellen") ist eine Verschiebechiffre (auch Caesar-Chiffre genannt), mit der auf einfache Weise Texte verschlüsselt werden können. Dies geschieht durch Ersetzung von Buchstaben bei ROT13 im Speziellen wird jeder Buchstabe des lateinischen Alphabets durch den im Alphabet um 13 Stellen davor bzw. dahinter liegenden Buchstaben ersetzt.');
$GLOBALS['TL_LANG']['tl_settings']['aeo_virtual_path'] = array('Virtueller Pfad', 'Der virtuelle Pfad wird für Frontend-Benutzer verwendet, die über kein JavaScript verfügen.');
$GLOBALS['TL_LANG']['tl_settings']['aeo_jump_to_no_js'] = array('Weiterleitungsseite bei deaktiviertem JavaScript', 'Bei deaktiviertem JavaScript wird der Benutzer bei einem Klick auf eine E-Mail-Adresse je nach der Sprache der Seite auf die entsprechende Seite weitergeleitet. Auf dieser Seite muss das Modul oder Inhaltselement "Advanced eMail Obfuscation" eingebunden sein. Existiert keine Weiterleitungsseite für die entsprechende Sprache wird die Fallback-Weiterleitungsseite gewählt.');
$GLOBALS['TL_LANG']['tl_settings']['aeo_obfuscation_method'] = array('Verschleierungs-Methode', 'Art der Verschleierung. Betrifft nur die Anzeige auf der Webseite. Mailto-Links werden über den virtuellen Pfad (und optionale ROT13-Verschlüsselung) abgebildet.');
$GLOBALS['TL_LANG']['tl_settings']['aeo_language_fallback'] = array('Fallback', '');
$GLOBALS['TL_LANG']['tl_settings']['aeo_language'] = array('Sprache', '');
$GLOBALS['TL_LANG']['tl_settings']['aeo_redirecturl'] = array('Weiterleitungsseite', '');
/**
* options
*/
$GLOBALS['TL_LANG']['tl_settings']['shorten'] = array('Verkürzung', 'Die E-Mail-Adressen werden gekürzt auf der Webseite dargestellt (z.B. hal...@domain.de)');
$GLOBALS['TL_LANG']['tl_settings']['rtl'] = array('RTL', 'right-to-left. Die E-Mail-Adresse wird im Quellcode von rechts nach links geschrieben, per CSS auf der Webseite von links nach rechts angezeigt.');
$GLOBALS['TL_LANG']['tl_settings']['nullspan'] = array('"null" Span', 'In die E-Mail-Adresse werden span-Tags mit dem Wert "null" eingebaut. Diese Tags werden per CSS auf der Webseite ausgeblendet.');
?>

56
languages/en/default.php Normal file
View File

@ -0,0 +1,56 @@
<?php if (!defined('TL_ROOT')) die('You can not access this file directly!');
/**
* Contao Open Source CMS
* Copyright (C) 2005-2011 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2012-2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package aeo
* @license GNU/LGPL
* @filesource
*/
/**
* front end modules
*/
$GLOBALS['TL_LANG']['FMD']['aeo'] = array('Advanced eMail Obfuscation', 'Creates a form for decryption of e-mail addresses for front-end users without JavaScript.');
/**
* content Elements
*/
$GLOBALS['TL_LANG']['CTE']['aeo'] = array('Advanced eMail Obfuscation', 'Creates a form for decryption of e-mail addresses for front-end users without JavaScript.');
/**
* errors
*/
$GLOBALS['TL_LANG']['aeo']['aeo_error_duplicate'] = 'Advanced eMail Obfuscation: There is a duplicate entry in field %s.';
$GLOBALS['TL_LANG']['aeo']['aeo_error_redirect'] = 'Advanced eMail Obfuscation: Please make sure that the redirect pages all include a module or content element of type "Advanced eMail Obfuscation".';
/**
* others
*/
$GLOBALS['TL_LANG']['aeo']['tooltip_no_js'] = 'Since you have disabled JavaScript, you have to answer a simple question, to open your e-mail program automatically.';
$GLOBALS['TL_LANG']['aeo']['tooltip_js'] = 'send email';
$GLOBALS['TL_LANG']['aeo']['buttonLabel'] = 'Open email programm';
$GLOBALS['TL_LANG']['aeo']['info'] = '<h2>Why must I answer this question?</h2><p>The aim of this check is to protect the owner of the e-mail address from receiving unsolicited e-mail.</p><p>Since you have not activated JavaScript, we check by this security question whether you really are human. With JavaScript enabled this additional question will not show.</p><p>Although spammers can rent or buy existing e-mail lists, many opt to use software known as \'e-mail harvesters\' (often referred to as \'spam bots\') that extract e-mail addresses from web pages. These e-mail harvesters work very much the same way search engine spiders do and try to collect every e-mail adress they encounter on the web. However, the brute force algorithms they use, are not able to answer the simple question above.</p><p><a href="http://en.wikipedia.org/wiki/E-mail_spam" title="Article on Wikipedia" target="_blank">Read more about spam and how to prevent it.</a></p>';
$GLOBALS['TL_LANG']['aeo']['success'] = 'We\'ve opened up your e-mail program. If that didn\'t work, please click <a href="mailto:%s">%s</a>.';
?>

36
languages/en/modules.php Normal file
View File

@ -0,0 +1,36 @@
<?php if (!defined('TL_ROOT')) die('You can not access this file directly!');
/**
* Contao Open Source CMS
* Copyright (C) 2005-2011 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2012-2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package aeo
* @license GNU/LGPL
* @filesource
*/
/**
* Extension folder
*/
$GLOBALS['TL_LANG']['MOD']['zaeo'] = array('Advanced eMail Obfuscation', 'This extension provides the obfuscation of email addresses.');

View File

@ -0,0 +1,43 @@
<?php if (!defined('TL_ROOT')) die('You cannot access this file directly!');
/**
* Contao Open Source CMS
* Copyright (C) 2005-2011 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2012-2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package aeo
* @license GNU/LGPL
* @filesource
*/
/**
* legends
*/
$GLOBALS['TL_LANG']['tl_content']['aeo_legend'] = 'Advanced eMail Obfuscation Settings';
/**
* fields
*/
$GLOBALS['TL_LANG']['tl_content']['aeo_custom_template'] = array('Template', 'Here you can select the template for the form.');
$GLOBALS['TL_LANG']['tl_content']['aeo_show_info'] = array('Show standard info', 'Shows the front-end user a standarized information why he has to answer a security question. Applies only for front-end users without JavaScript.');
$GLOBALS['TL_LANG']['tl_content']['aeo_info_text'] = array('Own info text', 'Information text to the front-end user. Applies only for front-end users without JavaScript.');
$GLOBALS['TL_LANG']['tl_content']['aeo_disable'] = array('Disable Advanced eMail Obfuscation', 'Disables the functionality of Advanced eMail Obfuscation for this content element.');
?>

View File

@ -0,0 +1,43 @@
<?php if (!defined('TL_ROOT')) die('You cannot access this file directly!');
/**
* Contao Open Source CMS
* Copyright (C) 2005-2011 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2012-2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package aeo
* @license GNU/LGPL
* @filesource
*/
/**
* legends
*/
$GLOBALS['TL_LANG']['tl_content']['aeo_legend'] = 'Advanced eMail Obfuscation Settings';
/**
* fields
*/
$GLOBALS['TL_LANG']['tl_module']['aeo_custom_template'] = array('Template', 'Here you can select the template for the form.');
$GLOBALS['TL_LANG']['tl_module']['aeo_show_info'] = array('Show standard info', 'Shows the front-end user a standarized information why he has to answer a security question. Applies only for front-end users without JavaScript.');
$GLOBALS['TL_LANG']['tl_module']['aeo_info_text'] = array('Own info text', 'Information text to the front-end user. Applies only for front-end users without JavaScript.');
$GLOBALS['TL_LANG']['tl_module']['aeo_disable'] = array('Disable Advanced eMail Obfuscation', 'Disables the functionality of Advanced eMail Obfuscation for this module.');
?>

View File

@ -0,0 +1,60 @@
<?php if (!defined('TL_ROOT')) die('You can not access this file directly!');
/**
* Contao Open Source CMS
* Copyright (C) 2005-2011 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2012-2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package aeo
* @license GNU/LGPL
* @filesource
*/
/**
* Name
*/
$GLOBALS['TL_LANG']['tl_settings']['aeo'] = "Advanced eMail Obfuscation";
/**
* legends
*/
$GLOBALS['TL_LANG']['tl_settings']['aeo_legend'] = 'Advanced eMail Obfuscation Settings';
/**
* fields
*/
$GLOBALS['TL_LANG']['tl_settings']['aeo_replace_standard_obfuscation'] = array('Active', 'If this option is enabled, the default obfuscation of e-mail addresses by TYPOlight is replaced by Advanced Mail Obfuscation.');
$GLOBALS['TL_LANG']['tl_settings']['aeo_use_rot_13'] = array('Use ROT13 encryption', 'ROT13 (rotate by 13 places) is a shift cipher (also called the Caesar cipher) by which texts can be encrypted easily. This is done by replacing charactersw with other characters.');
$GLOBALS['TL_LANG']['tl_settings']['aeo_virtual_path'] = array('Virtual path', 'The virtual path is used for front-end users who do not have JavaScript.');
$GLOBALS['TL_LANG']['tl_settings']['aeo_jump_to_no_js'] = array('Redirect page with JavaScript disabled', 'If JavaScript is disabled, the user is redirected - according to the language of the page - to the relevant page when clicking on an e-mail address. On this page, the module or content element "Advanced eMail Obfuscation" must be included. If there is no redirect page for the appropriate language the fallback redirect page is selected.');
$GLOBALS['TL_LANG']['tl_settings']['aeo_obfuscation_method'] = array('Obfuscation-Method', 'Type of obfuscation. Affects only the display on the site. Mailto links are obfuscated through the virtual path (and optional ROT13 encryption).');
$GLOBALS['TL_LANG']['tl_settings']['aeo_language_fallback'] = array('Fallback', '');
$GLOBALS['TL_LANG']['tl_settings']['aeo_language'] = array('Language', '');
$GLOBALS['TL_LANG']['tl_settings']['aeo_redirecturl'] = array('Redirect page', '');
/**
* options
*/
$GLOBALS['TL_LANG']['tl_settings']['shorten'] = array('Reduction', 'The e-mail addresses are displayd shortened on the website (e.g. hel...@domain.de)');
$GLOBALS['TL_LANG']['tl_settings']['rtl'] = array('RTL', 'right-to-left. The e-mail address in the source code is written from right to left and displayed from left to right via CSS on the website.');
$GLOBALS['TL_LANG']['tl_settings']['nullspan'] = array('"null" span', 'Span tags with the value "null" are inserted within the e-mail address. These tags are hidden by CSS on the website.');
?>

7
public/.htaccess Normal file
View File

@ -0,0 +1,7 @@
<IfModule !mod_authz_core.c>
Order allow,deny
Allow from all
</IfModule>
<IfModule mod_authz_core.c>
Require all granted
</IfModule>

393
public/js/aeo.js Normal file
View File

@ -0,0 +1,393 @@
var map;
onReadyAeo(function() {
aeo_dom_ready();
});
function aeo_dom_ready() {
if (window.MooTools) {
doWithMootols();
} else if (window.jQuery) {
doWithJQuery();
}
}
function doWithMootols() {
$$('a').filter(function(el) {
return el.getAttribute('name') != null &&
el.getAttribute('name').match('^aeo-obfuscated-') == 'aeo-obfuscated-'
}).each(function(el) {
if (!el.hasClass('aeo-with-title')) {
el.setAttribute('title',tooltip_js_on);
}
aeo_prepare_link(el);
}
);
}
function doWithJQuery() {
jQuery('a[name^="aeo-obfuscated-"]').each(function(i, el) {
if (!$(el).hasClass('aeo-with-title')) {
$(el).attr('title',tooltip_js_on);
}
aeo_prepare_link(el);
}
);
}
function aeo_prepare_link(el) {
el.setAttribute('href', 'javascript:aeo_link_decode(\'' + el.getAttribute('href') + '\');');
}
function rot13init() {
this.map = new Array();
var s = "abcdefghijklmnopqrstuvwxyz";
for (var i = 0 ; i < s.length ; i++)
this.map[s.charAt(i)] = s.charAt((i+13)%26);
for (var i = 0 ; i < s.length ; i++)
this.map[s.charAt(i).toUpperCase()] = s.charAt((i+13)%26).toUpperCase();
}
function str_rot13(a) {
if (this.map === undefined) {
rot13init();
}
var s = "";
for (var i = 0 ; i < a.length ; i++) {
var b = a.charAt(i);
s += (b>='A' && b<='Z' || b>='a' && b<='z' ? this.map[b] : b);
}
return s;
}
function base64_decode (data) {
// Decodes string using MIME base64 algorithm
//
// version: 1109.2015
// discuss at: http://phpjs.org/functions/base64_decode
// + original by: Tyler Akins (http://rumkin.com)
// + improved by: Thunder.m
// + input by: Aman Gupta
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + bugfixed by: Onno Marsman
// + bugfixed by: Pellentesque Malesuada
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + input by: Brett Zamir (http://brett-zamir.me)
// + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// - depends on: utf8_decode
// * example 1: base64_decode('S2V2aW4gdmFuIFpvbm5ldmVsZA==');
// * returns 1: 'Kevin van Zonneveld'
// mozilla has this native
// - but breaks in 2.0.0.12!
// if (typeof this.window['btoa'] == 'function') {
// return btoa(data);
// }
var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,
ac = 0,
dec = "",
tmp_arr = [];
if (!data) {
return data;
}
data += '';
do { // unpack four hexets into three octets using index points in b64
h1 = b64.indexOf(data.charAt(i++));
h2 = b64.indexOf(data.charAt(i++));
h3 = b64.indexOf(data.charAt(i++));
h4 = b64.indexOf(data.charAt(i++));
bits = h1 << 18 | h2 << 12 | h3 << 6 | h4;
o1 = bits >> 16 & 0xff;
o2 = bits >> 8 & 0xff;
o3 = bits & 0xff;
if (h3 == 64) {
tmp_arr[ac++] = String.fromCharCode(o1);
} else if (h4 == 64) {
tmp_arr[ac++] = String.fromCharCode(o1, o2);
} else {
tmp_arr[ac++] = String.fromCharCode(o1, o2, o3);
}
} while (i < data.length);
dec = tmp_arr.join('');
dec = this.utf8_decode(dec);
return dec;
}
function utf8_decode (str_data) {
// Converts a UTF-8 encoded string to ISO-8859-1
//
// version: 1109.2015
// discuss at: http://phpjs.org/functions/utf8_decode
// + original by: Webtoolkit.info (http://www.webtoolkit.info/)
// + input by: Aman Gupta
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + improved by: Norman "zEh" Fuchs
// + bugfixed by: hitwork
// + bugfixed by: Onno Marsman
// + input by: Brett Zamir (http://brett-zamir.me)
// + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// * example 1: utf8_decode('Kevin van Zonneveld');
// * returns 1: 'Kevin van Zonneveld'
var tmp_arr = [],
i = 0,
ac = 0,
c1 = 0,
c2 = 0,
c3 = 0;
str_data += '';
while (i < str_data.length) {
c1 = str_data.charCodeAt(i);
if (c1 < 128) {
tmp_arr[ac++] = String.fromCharCode(c1);
i++;
} else if (c1 > 191 && c1 < 224) {
c2 = str_data.charCodeAt(i + 1);
tmp_arr[ac++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63));
i += 2;
} else {
c2 = str_data.charCodeAt(i + 1);
c3 = str_data.charCodeAt(i + 2);
tmp_arr[ac++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
return tmp_arr.join('');
}
function strpos (haystack, needle, offset) {
// Finds position of first occurrence of a string within another
//
// version: 1109.2015
// discuss at: http://phpjs.org/functions/strpos
// + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + improved by: Onno Marsman
// + bugfixed by: Daniel Esteban
// + improved by: Brett Zamir (http://brett-zamir.me)
// * example 1: strpos('Kevin van Zonneveld', 'e', 5);
// * returns 1: 14
var i = (haystack + '').indexOf(needle, (offset || 0));
return i === -1 ? false : i;
}
function html_entity_decode (string, quote_style) {
// Convert all HTML entities to their applicable characters
//
// version: 1109.2015
// discuss at: http://phpjs.org/functions/html_entity_decode
// + original by: john (http://www.jd-tech.net)
// + input by: ger
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + bugfixed by: Onno Marsman
// + improved by: marc andreu
// + revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + input by: Ratheous
// + bugfixed by: Brett Zamir (http://brett-zamir.me)
// + input by: Nick Kolosov (http://sammy.ru)
// + bugfixed by: Fox
// - depends on: get_html_translation_table
// * example 1: html_entity_decode('Kevin &amp; van Zonneveld');
// * returns 1: 'Kevin & van Zonneveld'
// * example 2: html_entity_decode('&amp;lt;');
// * returns 2: '&lt;'
var hash_map = {},
symbol = '',
tmp_str = '',
entity = '';
tmp_str = string.toString();
if (false === (hash_map = this.get_html_translation_table('HTML_ENTITIES', quote_style))) {
return false;
}
// fix &amp; problem
// http://phpjs.org/functions/get_html_translation_table:416#comment_97660
delete(hash_map['&']);
hash_map['&'] = '&amp;';
for (symbol in hash_map) {
entity = hash_map[symbol];
tmp_str = tmp_str.split(entity).join(symbol);
}
tmp_str = tmp_str.split('&#039;').join("'");
return tmp_str;
}
function get_html_translation_table (table, quote_style) {
// Returns the internal translation table used by htmlspecialchars and htmlentities
//
// version: 1109.2015
// discuss at: http://phpjs.org/functions/get_html_translation_table
// + original by: Philip Peterson
// + revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + bugfixed by: noname
// + bugfixed by: Alex
// + bugfixed by: Marco
// + bugfixed by: madipta
// + improved by: KELAN
// + improved by: Brett Zamir (http://brett-zamir.me)
// + bugfixed by: Brett Zamir (http://brett-zamir.me)
// + input by: Frank Forte
// + bugfixed by: T.Wild
// + input by: Ratheous
// % note: It has been decided that we're not going to add global
// % note: dependencies to php.js, meaning the constants are not
// % note: real constants, but strings instead. Integers are also supported if someone
// % note: chooses to create the constants themselves.
// * example 1: get_html_translation_table('HTML_SPECIALCHARS');
// * returns 1: {'"': '&quot;', '&': '&amp;', '<': '&lt;', '>': '&gt;'}
var entities = {},
hash_map = {},
decimal = null;
var constMappingTable = {},
constMappingQuoteStyle = {};
var useTable = {},
useQuoteStyle = {};
// Translate arguments
constMappingTable[0] = 'HTML_SPECIALCHARS';
constMappingTable[1] = 'HTML_ENTITIES';
constMappingQuoteStyle[0] = 'ENT_NOQUOTES';
constMappingQuoteStyle[2] = 'ENT_COMPAT';
constMappingQuoteStyle[3] = 'ENT_QUOTES';
useTable = !isNaN(table) ? constMappingTable[table] : table ? table.toUpperCase() : 'HTML_SPECIALCHARS';
useQuoteStyle = !isNaN(quote_style) ? constMappingQuoteStyle[quote_style] : quote_style ? quote_style.toUpperCase() : 'ENT_COMPAT';
if (useTable !== 'HTML_SPECIALCHARS' && useTable !== 'HTML_ENTITIES') {
throw new Error("Table: " + useTable + ' not supported');
// return false;
}
entities['38'] = '&amp;';
if (useTable === 'HTML_ENTITIES') {
entities['160'] = '&nbsp;';
entities['161'] = '&iexcl;';
entities['162'] = '&cent;';
entities['163'] = '&pound;';
entities['164'] = '&curren;';
entities['165'] = '&yen;';
entities['166'] = '&brvbar;';
entities['167'] = '&sect;';
entities['168'] = '&uml;';
entities['169'] = '&copy;';
entities['170'] = '&ordf;';
entities['171'] = '&laquo;';
entities['172'] = '&not;';
entities['173'] = '&shy;';
entities['174'] = '&reg;';
entities['175'] = '&macr;';
entities['176'] = '&deg;';
entities['177'] = '&plusmn;';
entities['178'] = '&sup2;';
entities['179'] = '&sup3;';
entities['180'] = '&acute;';
entities['181'] = '&micro;';
entities['182'] = '&para;';
entities['183'] = '&middot;';
entities['184'] = '&cedil;';
entities['185'] = '&sup1;';
entities['186'] = '&ordm;';
entities['187'] = '&raquo;';
entities['188'] = '&frac14;';
entities['189'] = '&frac12;';
entities['190'] = '&frac34;';
entities['191'] = '&iquest;';
entities['192'] = '&Agrave;';
entities['193'] = '&Aacute;';
entities['194'] = '&Acirc;';
entities['195'] = '&Atilde;';
entities['196'] = '&Auml;';
entities['197'] = '&Aring;';
entities['198'] = '&AElig;';
entities['199'] = '&Ccedil;';
entities['200'] = '&Egrave;';
entities['201'] = '&Eacute;';
entities['202'] = '&Ecirc;';
entities['203'] = '&Euml;';
entities['204'] = '&Igrave;';
entities['205'] = '&Iacute;';
entities['206'] = '&Icirc;';
entities['207'] = '&Iuml;';
entities['208'] = '&ETH;';
entities['209'] = '&Ntilde;';
entities['210'] = '&Ograve;';
entities['211'] = '&Oacute;';
entities['212'] = '&Ocirc;';
entities['213'] = '&Otilde;';
entities['214'] = '&Ouml;';
entities['215'] = '&times;';
entities['216'] = '&Oslash;';
entities['217'] = '&Ugrave;';
entities['218'] = '&Uacute;';
entities['219'] = '&Ucirc;';
entities['220'] = '&Uuml;';
entities['221'] = '&Yacute;';
entities['222'] = '&THORN;';
entities['223'] = '&szlig;';
entities['224'] = '&agrave;';
entities['225'] = '&aacute;';
entities['226'] = '&acirc;';
entities['227'] = '&atilde;';
entities['228'] = '&auml;';
entities['229'] = '&aring;';
entities['230'] = '&aelig;';
entities['231'] = '&ccedil;';
entities['232'] = '&egrave;';
entities['233'] = '&eacute;';
entities['234'] = '&ecirc;';
entities['235'] = '&euml;';
entities['236'] = '&igrave;';
entities['237'] = '&iacute;';
entities['238'] = '&icirc;';
entities['239'] = '&iuml;';
entities['240'] = '&eth;';
entities['241'] = '&ntilde;';
entities['242'] = '&ograve;';
entities['243'] = '&oacute;';
entities['244'] = '&ocirc;';
entities['245'] = '&otilde;';
entities['246'] = '&ouml;';
entities['247'] = '&divide;';
entities['248'] = '&oslash;';
entities['249'] = '&ugrave;';
entities['250'] = '&uacute;';
entities['251'] = '&ucirc;';
entities['252'] = '&uuml;';
entities['253'] = '&yacute;';
entities['254'] = '&thorn;';
entities['255'] = '&yuml;';
}
if (useQuoteStyle !== 'ENT_NOQUOTES') {
entities['34'] = '&quot;';
}
if (useQuoteStyle === 'ENT_QUOTES') {
entities['39'] = '&#39;';
}
entities['60'] = '&lt;';
entities['62'] = '&gt;';
// ascii decimals to real symbols
for (decimal in entities) {
if (entities.hasOwnProperty(decimal)) {
hash_map[String.fromCharCode(decimal)] = entities[decimal];
}
}
return hash_map;
}

75
public/js/onReadyAeo.js Normal file
View File

@ -0,0 +1,75 @@
var readyListAeo = [];
function onReadyAeo(handler) {
function executeHandlers() {
for ( var i = 0; i < readyListAeo.length; i++) {
readyListAeo[i]();
}
}
if (!readyListAeo.length) { // set handler on first run
bindReady(executeHandlers);
}
readyListAeo.push(handler);
}
function bindReady(handler) {
var called = false;
function ready() {
if (called)
return
called = true;
handler();
}
if (document.addEventListener) { // native event
document.addEventListener("DOMContentLoaded", ready, false);
} else if (document.attachEvent) { // IE
try {
var isFrame = window.frameElement != null;
} catch (e) {
}
// IE, the document is not inside a frame
if (document.documentElement.doScroll && !isFrame) {
function tryScroll() {
if (called)
return;
try {
document.documentElement.doScroll("left");
ready();
} catch (e) {
setTimeout(tryScroll, 10);
}
}
tryScroll();
}
// IE, the document is inside a frame
document.attachEvent("onreadystatechange", function() {
if (document.readyState === "complete") {
ready();
}
});
}
// Old browsers
if (window.addEventListener)
window.addEventListener('load', ready, false);
else if (window.attachEvent)
window.attachEvent('onload', ready);
else {
var fn = window.onload; // very old browser, copy old onload
window.onload = function() { // replace by new onload and call the
// old one
fn && fn();
ready();
};
}
}

View File

@ -0,0 +1,35 @@
<div class="<?php echo $this->class; ?> block"<?php echo $this->cssID; ?><?php if ($this->style): ?> style="<?php echo $this->style; ?>"<?php endif; ?>>
<?php if ($this->headline): ?>
<<?php echo $this->hl; ?>><?php echo $this->headline; ?></<?php echo $this->hl; ?>>
<?php endif; ?>
<?php if ($this->isHuman): ?>
<div class="mod_aeo success">
<p><?php echo $this->success; ?></p>
<p><a href="<?php echo $this->backLink; ?>"><?php echo $this->backLabel; ?></a></p>
</div>
<?php else: ?>
<div class="mod_aeo question">
<form class="<?php echo $this->formId; ?>" action="<?php echo $this->action; ?>" method="post">
<input type="hidden" name="FORM_SUBMIT" value="<?php echo $this->formId; ?>">
<input type="hidden" name="REQUEST_TOKEN" value="{{request_token}}">
<input type="hidden" name="n" value="<?php echo $this->n; ?>">
<input type="hidden" name="d" value="<?php echo $this->d; ?>">
<input type="hidden" name="t" value="<?php echo $this->t; ?>">
<input type="hidden" name="p" value="<?php echo $this->p; ?>">
<fieldset>
<legend><?php echo $this->captchaDetails; ?></legend>
<?php echo $this->captcha->generateWithError(); ?> <label for="ctrl_captcha"><?php echo $this->captcha->generateQuestion(); ?><span class="mandatory">*</span></label>
<div class="submit_container">
<input type="submit" class="submit" value="<?php echo $this->buttonLabel; ?>">
</div>
</fieldset>
</form>
</div>
<?php if (strlen($this->info) > 0): ?>
<div class="mod_aeo info">
<?php echo $this->info; ?>
</div>
<?php endif; ?>
<?php endif; ?>
</div>

View File

@ -0,0 +1,35 @@
<div class="<?php echo $this->class; ?> block"<?php echo $this->cssID; ?><?php if ($this->style): ?> style="<?php echo $this->style; ?>"<?php endif; ?>>
<?php if ($this->headline): ?>
<<?php echo $this->hl; ?>><?php echo $this->headline; ?></<?php echo $this->hl; ?>>
<?php endif; ?>
<?php if ($this->isHuman): ?>
<div class="mod_aeo success">
<p><?php echo $this->success; ?></p>
<p><a href="<?php echo $this->backLink; ?>"><?php echo $this->backLabel; ?></a></p>
</div>
<?php else: ?>
<div class="mod_aeo question">
<form class="<?php echo $this->formId; ?>" action="<?php echo $this->action; ?>" method="post">
<input type="hidden" name="FORM_SUBMIT" value="<?php echo $this->formId; ?>"></input>
<input type="hidden" name="REQUEST_TOKEN" value="{{request_token}}"></input>
<input type="hidden" name="n" value="<?php echo $this->n; ?>"></input>
<input type="hidden" name="d" value="<?php echo $this->d; ?>"></input>
<input type="hidden" name="t" value="<?php echo $this->t; ?>"></input>
<input type="hidden" name="p" value="<?php echo $this->p; ?>"></input>
<fieldset>
<legend><?php echo $this->captchaDetails; ?></legend>
<?php echo $this->captcha->generateWithError(); ?> <label for="ctrl_captcha"><?php echo $this->captcha->generateQuestion(); ?><span class="mandatory">*</span></label>
<div class="submit_container">
<input type="submit" class="submit" value="<?php echo $this->buttonLabel; ?>"></input>
</div>
</fieldset>
</form>
</div>
<?php if (strlen($this->info) > 0): ?>
<div class="mod_aeo info">
<?php echo $this->info; ?>
</div>
<?php endif; ?>
<?php endif; ?>
</div>

View File

@ -0,0 +1,23 @@
function aeo_link_decode(href) {
var address = href.replace(/.*<?php echo ((strstr($this->folder, '\\\\') ? stripslashes($this->folder) : $this->folder));?>\/aeo\/([a-z0-9._%-]+)\+([a-z0-9._%-]+)\+([a-z.]+)\+[0-9]+\+{0,1}([^\.]*)\..*/i, '$1' + '@' + '$2' + '.' + '$3' + '|' + '$4');
var i = strpos(address, '|', 0);
var params = '';
if (i) {
var params = address.substr(i + 1);
address = address.substr(0, i);
if (params.length > 0) {
params = base64_decode(params);
}
}
address = rot13 ? str_rot13(address) : address;
if (params.length > 0) {
address = address + html_entity_decode(params);
}
window.location.replace('mailto:' + address);
}
var rot13 = <?php echo ($this->rot13 ? 'true' : 'false');?>;
var tooltip_js_on = '<?php echo (stripslashes($this->tooltip_js_on));?>';

View File

@ -0,0 +1,23 @@
function aeo_link_decode(href) {
var address = href.replace(/.*<?php echo ((strstr($this->folder, '\\\\') ? stripslashes($this->folder) : $this->folder));?>\/aeo\/([a-z0-9._%-]+)\+([a-z0-9._%-]+)\+([a-z.]+)\+[0-9]+\+{0,1}([^\.]*)\..*/i, '$1' + '@' + '$2' + '.' + '$3' + '|' + '$4');
var i = strpos(address, '|', 0);
var params = '';
if (i) {
var params = address.substr(i + 1);
address = address.substr(0, i);
if (params.length > 0) {
params = base64_decode(params);
}
}
address = rot13 ? str_rot13(address) : address;
if (params.length > 0) {
address = address + html_entity_decode(params);
}
window.location.replace('mailto:' + address);
}
var rot13 = <?php echo ($this->rot13 ? 'true' : 'false');?>;
var tooltip_js_on = '<?php echo (stripslashes($this->tooltip_js_on));?>';

632
util/AeoFrontendUtil.php Normal file
View File

@ -0,0 +1,632 @@
<?php
/**
* Contao Open Source CMS
* Copyright (C) 2005-2011 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2012-2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package aeo
* @license GNU/LGPL
* @filesource
*/
namespace cgoIT\aeo;
/**
* Class AeoFrontendUtil
*/
define('REGEXP_EMAIL_PREFIX', '(\w[-._\w]*\w)\@');
define('REGEXP_EMAIL', '\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,18}');
define('REGEXP_MAILTO_LINK', '/(?P<all>\<a(?P<before>[^>]+)href\=["\']mailto\:(?P<email>\w[-._\w]*\w)\@(?P<domain>\w[-._\w]*\w)\.(?P<suffix>\w{2,18})(?P<params>\?{0,1}[\w=&; ]*)["\'](?P<after>[^>]*)\>).*?\<\/a\>/ism');
class AeoFrontendUtil extends \Frontend {
/**
* Replace default obfuscation, default is 1
* @var int
*/
protected $replace_standard_obfuscation = 1;
/**
* Use additional ROT13 encryption, default is 1
* @var int
*/
protected $use_rot_13 = 1;
/**
* Virtual path for non javascript users, default is 'contact'
* @var string
*/
protected $virtual_path = 'contact';
/**
* Weiterleitungsseite für nicht JavaScript Nutzer
* @var string
*/
protected $jump_to_no_js;
/**
* Methode zum Verschleiern der angezeigten E-Mail-Adresse im Frontend
* @var string
*/
protected $obfuscation_method;
/**
* Instance of AEOUtility
* @var AEOUtility
*/
protected $aeo;
/**
* Initialize the object
* @param array
*/
public function __construct($arrAttributes=false) {
parent::__construct($arrAttributes);
if (TL_MODE == 'FE') {
global $objPage;
$this->import('aeo\\AeoUtil', 'AeoUtil');
if ($GLOBALS['TL_CONFIG']['aeo_replace_standard_obfuscation'] === true) {
$this->use_rot_13 = $GLOBALS['TL_CONFIG']['aeo_use_rot_13'];
$this->virtual_path = $GLOBALS['TL_CONFIG']['aeo_virtual_path'];
$this->jump_to_no_js = $GLOBALS['TL_CONFIG']['aeo_jump_to_no_js'];
$this->obfuscation_method = $GLOBALS['TL_CONFIG']['aeo_obfuscation_method'];
$this->aeo = new Aeo();
$this->aeo->setTooltipNoJS($GLOBALS['TL_LANG']['aeo']['tooltip_no_js']);
$folder = '';
if (!$GLOBALS['TL_CONFIG']['rewriteURL']) {
$folder .= 'index.php/';
}
if ($GLOBALS['TL_CONFIG']['addLanguageToUrl']) {
$folder .= $objPage->rootLanguage.'/';
}
if (in_array('i18nl10n', $this->Config->getActiveModules())) {
$this->AeoUtil->fixupCurrentLanguage();
if ($GLOBALS['TL_CONFIG']['i18nl10n_addLanguageToUrl']) {
$folder .= $GLOBALS['TL_LANGUAGE'] . '/';
}
$folder .= $this->virtual_path.'/'.$GLOBALS['TL_LANGUAGE'];
} else {
$folder .= $this->virtual_path.'/'.$objPage->rootLanguage;
}
$this->aeo->setFolder($folder);
$this->aeo->setMethod($this->obfuscation_method);
if ($this->use_rot_13) {
$this->aeo->setROT13(true);
} else {
$this->aeo->setROT13(false);
}
$urlSuffix = '';
if (strlen($GLOBALS['TL_CONFIG']['urlSuffix']) > 0) {
if (in_array('i18nl10n', $this->Config->getActiveModules()) &&
$GLOBALS['TL_CONFIG']['i18nl10n_alias_suffix']) {
$this->AeoUtil->fixupCurrentLanguage();
$urlSuffix .= '.'.$GLOBALS['TL_LANGUAGE'];
}
$urlSuffix .= $GLOBALS['TL_CONFIG']['urlSuffix'];
}
$objResult = $this->Database->prepare("SELECT * FROM tl_page WHERE id=?")
->limit(1)
->execute($objPage->id)
->fetchAssoc();
$url = $this->generateFrontendUrl($objResult);
if (strstr($url, '?')) {
$arrParams = explode('?', $url);
if (count($arrParams) == 2) {
$arrParamValues = explode('&', $arrParams[1]);
$added = false;
foreach ($arrParamValues as $param) {
if (!strstr($param, 'id=')) {
$urlSuffix .= ($added ? '&' : '?').$param;
$added = true;
}
}
}
}
$this->aeo->urlSuffix = $urlSuffix;
$this->includeStaticJs();
} else {
// global deaktiviert
$this->replace_standard_obfuscation = 0;
}
}
}
/**
* Fügt dem Frontend-Modul ggf. die stop- und continue-Marker hinzu.
*
* @param unknown_type $objRow
* @param unknown_type $strBuffer
*/
public function aeoGetFrontendModule($objRow, $strBuffer) {
return $this->checkAeoDisabled($objRow, $strBuffer);
}
/**
* Fügt dem Inhaltelement ggf. die stop- und continue-Marker hinzu.
*
* @param unknown_type $objRow
* @param unknown_type $strBuffer
*/
public function aeoGetContentElement($objRow, $strBuffer) {
return $this->checkAeoDisabled($objRow, $strBuffer);
}
/**
* Verschleierung der E-Mail-Adressen.
*
* @param $strContent
* @param $strTemplate
*/
public function obfuscateEmails($strContent, $strTemplate)
{
global $objPage;
$objPage = $this->getPageDetails($objPage->id);
$redirectPageId = $this->AeoUtil->getRedirectPageForLanguage(deserialize($this->jump_to_no_js), $objPage->rootLanguage);
if (TL_MODE == 'FE' && $this->replace_standard_obfuscation && $objPage->id != $redirectPageId) {
$strContent = $this->aeoReplaceInsertTags($strContent);
$this->import('String');
// erst alle Mailadresse decodieren (Verschleierung von Contao rückgänging machen)
$intOffset = 0;
$arrNoAeoAreas = $this->aeo->getNoAeoAreas($strContent);
while (preg_match('/(&#[x]?\w+;)+/i', $strContent, $arrEmail, PREG_OFFSET_CAPTURE, $intOffset)) {
if ($this->aeo->isEnabled($arrEmail[0][1], $arrNoAeoAreas)) {
$strDecodedMail = $this->String->decodeEntities($arrEmail[0][0]);
if (preg_match('/mailto:'.REGEXP_EMAIL.'/i', $strDecodedMail)) {
// erst alle verlinkten eMail-Adressen entschleiern
$strContent = $this->aeo->str_replace($arrEmail[0][0], $strDecodedMail, $strContent, $arrEmail[0][1]);
$intOffset = $arrEmail[0][1] + strlen($strDecodedMail);
// Array muss neu aufgebaut werden, da sich die offsets geändert haben
$arrNoAeoAreas = $this->aeo->getNoAeoAreas($strContent);
} else if (preg_match('/'.REGEXP_EMAIL.'/i', $strDecodedMail)) {
// dann alle nicht verlinkten eMail-Adressen entschleiern
$strContent = $this->aeo->str_replace($arrEmail[0][0], $strDecodedMail, $strContent, $arrEmail[0][1]);
$intOffset = $arrEmail[0][1] + strlen($strDecodedMail);
// Array muss neu aufgebaut werden, da sich die offsets geändert haben
$arrNoAeoAreas = $this->aeo->getNoAeoAreas($strContent);
} else {
$intOffset = $arrEmail[0][1] + 1;
}
} else {
$intOffset = $arrEmail[0][1] + 1;
}
}
$strContent = $this->aeo->prepareOutput($strContent, $objPage->id);
}
return $strContent;
}
private function includeStaticJs() {
global $objPage;
$objPage = $this->getPageDetails($objPage);
$objLayout = $this->Database->prepare("SELECT * FROM tl_layout WHERE id=?")
->limit(1)
->execute($objPage->layout)
->fetchAssoc();
// if ($objLayout['addMooTools']) {
// $GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/zaeo/public/js/aeo-mootools.js';
// } else if ($objLayout['addJQuery']) {
// $GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/zaeo/public/js/aeo-jquery.js';
// }
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/zaeo/public/js/onReadyAeo.js';
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/zaeo/public/js/aeo.js';
}
/**
* Zusätzliches InsertTag für E-Mail-Verschleierung
* {{aeo-email::value@domain.tld::<method>}} <method>: Angabe der Verschleierungmethode im Frontend.
* Mögliche Werte:
* - none = keine Verschleierung
* - rtl = Right-to-Left
* - nullspan = Null-Span
* - shorten = Verkürzung
*/
private function aeoReplaceInsertTags($strContent) {
// Preserve insert tags
if ($GLOBALS['TL_CONFIG']['disableInsertTags'])
{
return parent::restoreBasicEntities($strBuffer);
}
$arrPossibleValues = array('none', 'rtl', 'nullspan', 'shorten');
$intOffset = 0;
$arrNoAeoAreas = $this->aeo->getNoAeoAreas($strContent);
while (preg_match('/\{\{([^\}]+)\}\}/', $strContent, $arrTags, PREG_OFFSET_CAPTURE, $intOffset)) {
global $objPage;
$position = $arrTags[0][1];
$arrTag = explode('::', $arrTags[1][0]);
// aeo-email-Tag ohne Verschleierungsmethode angegeben --> zu normalem email-Tag umwandeln
if (is_array($arrTag) && count($arrTag) == 2 && $arrTag[0] === 'aeo-email') {
$strValue = '{{email::'.$arrTag[1].'}}';
$strContent = $this->aeo->str_replace($arrTags[0][0], $strValue, $strContent, $position);
$intOffset += strlen($strValue);
continue;
}
// Es handelt sich nicht um ein aeo-email-Tag
if(!is_array($arrTag) || count($arrTag) != 3 ||
$arrTag[0] !== 'aeo-email' || !in_array($arrTag[2], $arrPossibleValues, true)) {
$intOffset += strlen($arrTags[0][0]);
continue;
}
$this->import('String');
if ($GLOBALS['TL_CONFIG']['aeo_replace_standard_obfuscation'] === true &&
$this->aeo->isEnabled($position, $arrNoAeoAreas)) {
// AEO aktiv und Bereich nicht auf deaktiviert gestellt
$strValue = $this->aeo->obfuscateSingle($this->String->decodeEntities($arrTag[1]), $objPage->id, $arrTag[2]);
$strContent = $this->aeo->str_replace($arrTags[0][0], $strValue, $strContent, $position);
$intOffset += strlen($strValue);
} else {
// AEO nicht aktiv oder Bereich auf deaktiviert gestellt
$strEmail = $this->String->encodeEmail($this->String->decodeEntities($arrTag[1]));
$strValue = '<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;' . $this->String->encodeEmail($strEmail) . '" class="email">' . $this->String->encodeEmail(preg_replace('/\?.*$/', '', $strEmail)) . '</a>';
$strContent = $this->aeo->str_replace($arrTags[0][0], $strValue, $strContent, $position);
$intOffset += strlen($strValue);
}
// Positionen aktualisieren, da sich die Positionen geändert haben
$arrNoAeoAreas = $this->aeo->getNoAeoAreas($strContent);
}
// normale Methode aufrufen
$strContent = parent::replaceInsertTags($strContent);
return $strContent;
}
/**
* Einfügen der stop- und continue-Marker
*
* @param $objRow
* @param $strBuffer
*/
private function checkAeoDisabled($objRow, $strBuffer) {
if ($objRow->aeo_disable == '1') {
$strBuffer = "\n<!-- aeo::stop -->". $strBuffer ."<!-- aeo::continue -->\n";
}
return $strBuffer;
}
}
class Aeo extends \System {
var $buffer;
var $folder = "contact";
var $tooltip_js_off;
var $rot13 = true;
var $urlSuffix = '';
var $method;
var $i = 2;
/**
* Verschleierung der E-Mail-Adressen. Parsen des Codes einer Seite und ersetzen der normalen
* E-Mail-Links durch verschleierte.
*
* @param $output
* @param $pageId
*/
function prepareOutput($output, $pageId) {
// Erst alle verlinkten eMail-Adressen verschleiern
$arrNoAeoAreas = $this->getNoAeoAreas($output);
$intOffset = 0;
while(preg_match(REGEXP_MAILTO_LINK, $output, $arrLink, PREG_OFFSET_CAPTURE, $intOffset)) {
if ($this->isEnabled($arrLink['all'][1], $arrNoAeoAreas)) {
$output = $this->obfuscate($arrLink, $output, $pageId, $this->urlSuffix == null ? '' : $this->urlSuffix, $arrLink['all'][1], $intOffset);
// Array muss neu aufgebaut werden, da sich die offsets geändert haben
$arrNoAeoAreas = $this->getNoAeoAreas($output);
} else {
$intOffset = strlen($arrLink['all'][0]) + $arrLink['all'][1];
}
}
// jetzt alle nicht verlinkten eMail-Adressen verschleiern.
$arrNoAeoAreas = $this->getNoAeoAreas($output);
$intOffset = 0;
while(preg_match('/'.REGEXP_EMAIL_PREFIX.'/esm', $output, $arrNonLinkedeMail, PREG_OFFSET_CAPTURE, $intOffset)) {
if ($this->isEnabled($arrNonLinkedeMail[0][1], $arrNoAeoAreas)) {
$output = $this->str_replace($arrNonLinkedeMail[0][0], $this->obfuscateWithMethod($arrNonLinkedeMail[0][0], $this->method, false, $arrNonLinkedeMail[0][1], $intOffset), $output, $arrNonLinkedeMail[0][1]);
// Array muss neu aufgebaut werden, da sich die offsets geändert haben
$arrNoAeoAreas = $this->getNoAeoAreas($output);
} else {
$intOffset = strlen($arrNonLinkedeMail[0][0]) + $arrNonLinkedeMail[0][1];
}
}
$close_head = array("</head>", "</HEAD>");
$output = str_replace($close_head, $this->dropJS() . "\n</head>", $output);
if ($this->method != 'shorten') {
$output = str_replace($close_head, $this->dropCSS() . "\n</head>", $output);
}
return $this->restoreBasisEntities($output);
}
/**
* Verschleierung eines einzelnen Links. Dazu kann die zu verwendendet Verschleierungsmethode
* angegeben werden.
*
* @param $email
* @param $pageId
* @param $method
*/
function obfuscateSingle($email, $pageId, $method) {
$arrEmail = explode('@', $email);
$strDomain = substr($arrEmail[1], 0, strrpos($arrEmail[1], '.'));
$strTld = substr($arrEmail[1], strrpos($arrEmail[1], '.') + 1);
$uId = microtime();
$uId = substr($uId, 0, strpos($uId, ' '));
$strLink = '<a title="'.$this->tooltip_js_off.'"';
$strLink .= ' href="'.$this->folder.'/aeo/'.
($this->rot13 ? str_rot13($arrEmail[0]) : $arrEmail[0]).'+'.
($this->rot13 ? str_rot13($strDomain) : $strDomain).'+'.
($this->rot13 ? str_rot13($strTld) : $strTld).'+'.
$pageId.($this->urlSuffix == null ? '' : $this->urlSuffix).
'" rel="nofollow" name="'.uniqid('aeo-obfuscated-', true).'" class="email aeo">';
if ($method !== 'none') {
// passendes CSS hinzufügen
$strLink .= $this->obfuscateWithMethod($arrEmail[0], $method, true, 0, 0).'@'.$strDomain.'.'.$strTld;
} else {
$this->import('String');
$strLink .= $this->String->encodeEmail($email);
}
$strLink .= '</a>';
return $this->createSpecialEntities($strLink);
}
/**
* Aufbau des verschleierten E-Mail-Links
*
* @param $arrLink
* @param $output
* @param $pageId
* @param $urlSuffix
* @param $intPos
* @param $intOffset
*/
function obfuscate($arrLink, $output, $pageId, $urlSuffix, $intPos, &$intOffset) {
$newLink = '<a';
// Originalen title auswerten
$originalTitle = $this->getOrigValue('title', $arrLink);
// Originalen class auswerten
$originalClass = $this->getOrigValue('class', $arrLink);
if (strpos($originalClass, 'aeo')) {
// Adresse wurde bereits behandelt
return $output;
}
if (strlen(trim($arrLink['before'][0]))) {
$newLink .= ' '.trim($arrLink['before'][0]);
}
if (strlen(trim($arrLink['after'][0]))) {
$newLink .= ' '.trim($arrLink['after'][0]);
}
if (strlen($originalTitle)) {
$newLink .= ' title="'.$originalTitle.'"';
if (strlen($originalClass)) {
$newLink .= ' class="'.$originalClass.' aeo-with-title"';
} else {
$newLink .= ' class="aeo-with-title"';
}
} else {
$newLink .= ' title="'.$this->tooltip_js_off.'"';
if (strlen($originalClass)) {
$newLink .= ' class="'.$originalClass.'"';
}
}
$strParams = '';
if (strlen($arrLink['params'][0]) && '?' === substr($arrLink['params'][0], 0, 1)) {
$strParams = base64_encode($arrLink['params'][0]);
}
$newLink .= ' href="'.$this->folder.'/aeo/'.
($this->rot13 ? str_rot13($arrLink['email'][0]) : $arrLink['email'][0]).'+'.
($this->rot13 ? str_rot13($arrLink['domain'][0]) : $arrLink['domain'][0]).'+'.
($this->rot13 ? str_rot13($arrLink['suffix'][0]) : $arrLink['suffix'][0]).'+'.
$pageId.'+'.$strParams.$urlSuffix.'" rel="nofollow" name="aeo-obfuscated-'.$intPos.'"';
$newLink .= '>';
$output = $this->str_replace($arrLink['all'][0], $newLink, $output, $intOffset);
$intOffset = $intPos + strlen($newLink);
return $output;
}
/**
* Ursprünglichen Wert eines Attributs ermitteln.
*
* @param $strAttr
* @param $arrLink
*/
function getOrigValue($strAttr, &$arrLink) {
$strOriginal = '';
if (stristr($arrLink['before'][0], $strAttr)) {
preg_match('/'.$strAttr.'=[\"\'](?P<'.$strAttr.'>.*)[\"\']/i', $arrLink['before'][0], $matches);
$strOriginal = $matches[$strAttr];
$arrLink['before'][0] = preg_replace('/(.*)'.$strAttr.'=[\"\'].*[\"\'](.*)/i', '$1 $2', $arrLink['before'][0]);
}
if (stristr($arrLink['after'][0], $strAttr)) {
preg_match('/'.$strAttr.'=[\"\'](?P<'.$strAttr.'>.*)[\"\']/i', $arrLink['after'][0], $matches);
$strOriginal = $matches[$strAttr];
$arrLink['after'][0] = preg_replace('/(.*)'.$strAttr.'=[\"\'].*[\"\'](.*)/i', '$1 $2', $arrLink['after'][0]);
}
return $strOriginal;
}
function dropJS() {
$this->import('aeo\\AeoJavaScript', 'AeoJavaScript');
$strContentJs = $this->AeoJavaScript->getContent(str_replace("/", "\/", $this->folder), $this->rot13);
$strContentJs = "\n<script type=\"text/javascript\">\n$strContentJs\n</script>\n";
// $strContentJs .= "<script src=\"system/modules/zaeo/public/js/onReadyAeo.js\" type=\"text/javascript\"></script>";
// $strContentJs .= "<script src=\"system/modules/zaeo/public/js/aeo.js\" type=\"text/javascript\"></script>";
return $strContentJs;
}
function dropCSS() {
$css = "\n<style type=\"text/css\">\n\t";
switch ($this->method) {
case 'rtl':
$css .= '.obfuscated { unicode-bidi: bidi-override; direction: rtl; }';
break;
case 'nullspan':
$css .= 'span.obfuscated { display: none; }';
break;
}
$css .= "\n</style>";
return $css;
}
function setTooltipJS($tooltip) {
$this->tooltip_js_on = $tooltip;
}
function setTooltipNoJS($tooltip) {
$this->tooltip_js_off = $tooltip;
}
function setFolder($folder) {
$this->folder = $folder;
}
function setROT13($rot13) {
$this->rot13 = $rot13;
}
function setMethod($method) {
$this->method = $method;
}
function obfuscateWithMethod($email, $method, $includeCss, $intPos, &$intOffset) {
switch ($method) {
case 'rtl' :
$strEmail = $this->rtl($email, $includeCss);
break;
case 'nullspan' :
$strEmail = $this->nullspan($email, $includeCss);
break;
default:
$strEmail = $this->shorten($email, $includeCss);
}
// Offset korrigieren
$intOffset = $intPos + strlen($strEmail);
return $strEmail;
}
function shorten ($email, $includeCss) {
if (strlen ($email) <= 4) {
$email = substr ($email, 0, 1);
} else if (strlen ($email) <= 6) {
$email = substr ($email, 0, 3);
} else {
$email = substr ($email, 0, 4);
}
return $email.'...'.($includeCss ? '' : '&#64;');
}
function rtl ($email, $includeCss) {
$strEmail = strrev($email);
if ($includeCss) {
return '<span style="unicode-bidi: bidi-override; direction: rtl;">'.$strEmail.'</span>';
}
return '<span class="obfuscated">'.strrev($email).'</span>';
}
function nullspan ($email, $includeCss) {
if (strlen ($email) <= 4) {
$email1 = substr ($email, 0, 1);
$email2 = substr ($email, 1);
} else if (strlen ($email) <= 6) {
$email1 = substr ($email, 0, 3);
$email2 = substr ($email, 3);
} else {
$email1 = substr ($email, 0, 4);
$email2 = substr ($email, 4);
}
if ($includeCss) {
return $email1.'<span style="display: none;">null</span>'.$email2;
}
return $email1.'<span class="obfuscated">null</span>'.$email2;
}
function getNoAeoAreas($output) {
$arrNoAeoAreas = array();
$intOffset = 0;
while (preg_match('/<!-- aeo::stop -->/', $output, $arrOuter, PREG_OFFSET_CAPTURE, $intOffset)) {
$intOffset = strlen($arrOuter[0][0]) + $arrOuter[0][1];
preg_match('/<!-- aeo::continue -->/', $output, $arrInner, PREG_OFFSET_CAPTURE, $intOffset);
$arrNoAeoAreas[] = array('start' => $arrOuter[0][1], 'end' => $arrInner[0][1]);
$intOffset = strlen($arrInner[0][0]) + $arrInner[0][1];
}
return $arrNoAeoAreas;
}
function isEnabled($intPos, $arrNoAeoAreas) {
foreach ($arrNoAeoAreas as $arrDisabledArea) {
if ($arrDisabledArea['start'] < $intPos &&
$arrDisabledArea['end'] > $intPos) {
return false;
}
}
return true;
}
function str_replace($search, $replacement, $subject, $offset) {
$mysubject = substr($subject, 0, $offset);
$strRest = substr($subject, $offset);
$mysubject .= preg_replace('/'.preg_quote($search, '/').'/sm', $replacement, $strRest, 1);
return $mysubject;
}
function createSpecialEntities($strContent) {
return str_replace(array('@', '&#x40;', '&#64;'), array('[at]', '[at]', '[at]'), $strContent);
}
function restoreBasisEntities($strContent) {
return str_replace(array('[at]'), array('&#64;'), $strContent);
}
}
?>

228
util/AeoRedirectUtil.php Normal file
View File

@ -0,0 +1,228 @@
<?php
/**
* Contao Open Source CMS
* Copyright (C) 2005-2011 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2012-2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package aeo
* @license GNU/LGPL
* @filesource
*/
namespace cgoIT\aeo;
/**
* Class AeoRedirectUtil
*/
class AeoRedirectUtil extends \Frontend {
/**
* Initialize the object
* @param array
*/
public function __construct($arrAttributes=false) {
parent::__construct($arrAttributes);
$this->import('aeo\\AeoUtil', 'AeoUtil');
}
/**
* Sofern Aliase deaktiviert sind oder die RootPage aufgerufen wird,
* ermittelt diese Methode die passende ID der Seite.
*/
function redirectFromRootPage() {
$this->import('\\Environment', 'Environment');
$strRequest = preg_replace(array('/^index.php\/?/', '/\?.*$/'), '', $this->Environment->request);
$params = '';
if (strstr($strRequest, '?')) {
$arrRequest = explode('?', $strRequest);
$strRequest = $arrRequest[0];
$params = $arrRequest[1];
}
$strRequest = $this->removeUrlSuffix($strRequest);
$arrFragments = explode('/', $strRequest);
$arrFragments = $this->getRedirectPageAeo($arrFragments, true);
if (is_numeric($arrFragments[0])) {
// Add the fragments to the $_GET array
for ($i=1; $i<count($arrFragments); $i+=2) {
$this->Input->setGet($arrFragments[$i], $arrFragments[$i+1]);
}
return $arrFragments[0];
}
return FALSE;
}
/**
* Leitet den User ohne JavaScript auf die passende Formular-Seite weiter.
* @param $arrFragments
* @param $blnReturnId
*/
public function getRedirectPageAeo($arrFragments, $blnReturnId=false) {
if ($GLOBALS['TL_CONFIG']['aeo_replace_standard_obfuscation'] === true) {
if (in_array('folderurl', $this->Config->getActiveModules())) {
$arrFragments = preg_split('~/~i', $arrFragments[0]);
}
$i18nl10nLanguage = '';
if (in_array('i18nl10n', $this->Config->getActiveModules())) {
if ($GLOBALS['TL_CONFIG']['i18nl10n_addLanguageToUrl']) {
$i18nl10nLanguage = $arrFragments[count($arrFragments) - 1];
}
}
$indexAeo = 2;
if ($GLOBALS['TL_CONFIG']['useAutoItem']) {
// auto-item-paramenter beruecksichtigen
$indexAeo = 3;
}
if (is_array($arrFragments) && count($arrFragments) > 3
&& $arrFragments[0] == $GLOBALS['TL_CONFIG']['aeo_virtual_path']
&& $arrFragments[$indexAeo] == 'aeo') {
$arrJumpTo = deserialize($GLOBALS['TL_CONFIG']['aeo_jump_to_no_js']);
if ($GLOBALS['TL_CONFIG']['useAutoItem'] && $arrFragments[1] == 'auto_item') {
// auto-item-paramenter entfernen
unset($arrFragments[1]);
$arrFragments = array_values($arrFragments);
}
// Sprache ermitteln
$strLanguage = $arrFragments[1];
$arrFallbackValue = array();
foreach ($arrJumpTo as $key => $value) {
if ($value['aeo_language'] == $strLanguage) {
$url = $this->getUrl($value, $blnReturnId);
break;
}
if ($value['aeo_language_fallback']) {
$arrFallbackValue = $value;
}
}
if (!isset($url) || strlen($url) == 0) {
$url = $this->getUrl($arrFallbackValue, $blnReturnId);
}
$i = 0;
$arrFragments[$i++] = $url;
$strObfuscatedValues = $arrFragments[3];
if (in_array('i18nl10n', $this->Config->getActiveModules()) &&
$GLOBALS['TL_CONFIG']['i18nl10n_alias_suffix']) {
$this->AeoUtil->fixupCurrentLanguage();
$strObfuscatedValues = str_replace('.'.$GLOBALS['TL_LANGUAGE'], '', $strObfuscatedValues);
}
$arrObfuscatedValues = explode('+', $strObfuscatedValues, 5);
$arrFragments[$i++] = 'n';
$arrFragments[$i++] = $arrObfuscatedValues[0];
$arrFragments[$i++] = 'd';
$arrFragments[$i++] = $arrObfuscatedValues[1];
$arrFragments[$i++] = 't';
$arrFragments[$i++] = $arrObfuscatedValues[2];
$arrFragments[$i++] = 'p';
$arrFragments[$i++] = $arrObfuscatedValues[3];
$arrFragments[$i++] = 'param';
$arrFragments[$i++] = $arrObfuscatedValues[4];
if (strlen($params) > 0) {
$arrParams = explode('=', $params);
$addNext = true;
foreach ($arrParams as $param) {
if (!$addNext) {
continue;
}
if ($param == 'id') {
$addNext = false;
continue;
}
$arrFragments[$i++] = $param;
}
}
if (in_array('i18nl10n', $this->Config->getActiveModules()) &&
$GLOBALS['TL_CONFIG']['i18nl10n_addLanguageToUrl'] &&
strlen($i18nl10nLanguage)) {
$arrFragments[$i++] = 'language';
$arrFragments[$i++] = $i18nl10nLanguage;
}
}
}
return $arrFragments;
}
private function getUrl($arrValue, $blnReturnId) {
if ($blnReturnId) {
$url = $arrValue['aeo_redirecturl'];
} else {
$objPage = \PageModel::findPublishedByIdOrAlias($arrValue['aeo_redirecturl']);
$objPage = $this->getPageDetails($objPage);
$url = $this->generateFrontendUrl($objPage->row());
$url = $this->removeUrlPrefix($url);
if ($GLOBALS['TL_CONFIG']['addLanguageToUrl'] ||
(in_array('i18nl10n', $this->Config->getActiveModules()) &&
$GLOBALS['TL_CONFIG']['i18nl10n_addLanguageToUrl'])) {
$arrUrlFragments = explode('/', $url);
$url = $arrUrlFragments[1];
}
$params = '';
if (strstr($url, '?')) {
$arrUrl = explode('?', $url);
$url = $arrUrl[0];
$params = $arrUrl[1];
}
$url = $this->removeUrlSuffix($url);
}
return $url;
}
private function removeUrlPrefix($strUrl) {
if (!$GLOBALS['TL_CONFIG']['rewriteURL']) {
$strUrl = str_replace('index.php/', '', $strUrl);
}
return $strUrl;
}
private function removeUrlSuffix($strUrl) {
// Remove the URL suffix if not just a language root (e.g. en/) is requested
if ($strUrl != '' && (!$GLOBALS['TL_CONFIG']['addLanguageToUrl'] || !preg_match('@^[a-z]{2}/$@', $strUrl))) {
$intSuffixLength = strlen($GLOBALS['TL_CONFIG']['urlSuffix']);
// Return false if the URL suffix does not match (see #2864)
if ($intSuffixLength > 0) {
if (substr($strUrl, -$intSuffixLength) != $GLOBALS['TL_CONFIG']['urlSuffix']) {
return -1;
}
$strUrl = substr($strUrl, 0, -$intSuffixLength);
}
}
if (in_array('i18nl10n', $this->Config->getActiveModules()) &&
$GLOBALS['TL_CONFIG']['i18nl10n_alias_suffix']) {
$this->AeoUtil->fixupCurrentLanguage();
$strUrl = str_replace('.'.$GLOBALS['TL_LANGUAGE'], '', $strUrl);
}
return $strUrl;
}
}
?>

108
util/AeoUtil.php Normal file
View File

@ -0,0 +1,108 @@
<?php
/**
* Contao Open Source CMS
* Copyright (C) 2005-2011 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2012-2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package aeo
* @license GNU/LGPL
* @filesource
*/
namespace cgoIT\aeo;
/**
* Class AeoUtil
*/
class AeoUtil extends \Controller {
/**
* Initialize the object
* @param array
*/
public function __construct() {
parent::__construct();
$this->import('\\Database', 'Database');
}
/**
* Liefert die Redirect-Page je nach Sprache
* @param $pageId
*/
public function getRedirectPageForLanguage($arrRedirectPages, $language) {
$defaultLanguage = $this->Database->prepare("SELECT language FROM tl_page WHERE type = 'root' and fallback = 1")->limit(1)->execute();
if (is_array($arrRedirectPages)) {
foreach ($arrRedirectPages as $key => $value) {
if ($value['aeo_language'] == $language) {
return $this->getPageId($value['aeo_redirecturl']);
}
if ($value['aeo_language'] == $defaultLanguage->language) {
$defaultPage = $this->getPageId($value['aeo_redirecturl']);
}
}
}
return $defaultPage;
}
/**
* Liefert die PageId zu einem InsertTag
* @param $tag
*/
public function getPageId($tag) {
$tags = preg_split('/\{\{([^\}]+)\}\}/', $tag, -1, PREG_SPLIT_DELIM_CAPTURE);
foreach ($tags as $strTag) {
if ($strTag == '') {
continue;
}
$elements = explode('::', $strTag);
return $elements[1];
}
}
/**
* Fix up current language depending on momentary user preference.
* Strangely $GLOBALS['TL_LANGUAGE'] is switched to the current user language if user is just
* authentitcating and has the language property set.
* See system/libraries/User.php:202
* We override this behavior and let the user temporarily use the selected by him language.
* One workaround would be to not let the members have a language property.
* Then this method will not be needed any more.
*/
public function fixupCurrentLanguage(){
$selected_language = $this->Input->post('language');
//allow GET request for language
if(!$selected_language){
$selected_language = $this->Input->get('language');
}
if(
($selected_language) &&
in_array($selected_language,
deserialize($GLOBALS['TL_CONFIG']['i18nl10n_languages']))
) {
$_SESSION['TL_LANGUAGE'] = $GLOBALS['TL_LANGUAGE'] = $selected_language;
} elseif(isset($_SESSION['TL_LANGUAGE'])) {
$GLOBALS['TL_LANGUAGE'] = $_SESSION['TL_LANGUAGE'];
}
}
}
?>