From c98c458ca718ef3c2e532f258810ce13baee386a Mon Sep 17 00:00:00 2001 From: rabe69 Date: Tue, 30 Aug 2011 13:16:40 +0000 Subject: [PATCH] Add new country zone select, uses jQuery and eID instead of xajax. Code cleanup. git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/powermail/trunk@51550 735d13b6-9817-0410-8766-e36946ffe9aa --- class.ext_update.php | 333 +++++---- cli/class.tx_powermail_scheduler.php | 169 +++-- ...class.tx_powermail_scheduler_addFields.php | 410 +++++------ cli/conf.php | 8 +- cli/cronjob.php | 128 ++-- ext_autoload.php | 10 +- ext_emconf.php | 5 +- ext_localconf.php | 4 +- ext_tables.php | 186 +++-- lib/class.tx_powermail_countryzones.php | 219 ++---- lib/class.tx_powermail_db.php | 117 ++-- lib/class.tx_powermail_dynamicmarkers.php | 2 +- lib/class.tx_powermail_functions_div.php | 42 +- lib/class.tx_powermail_geoip.php | 64 +- lib/class.tx_powermail_markers.php | 26 +- lib/class.tx_powermail_removexss.php | 93 --- lib/class.tx_powermail_sessions.php | 65 +- lib/class.tx_powermail_tsparserext.php | 111 ++- ...ss.user_powermail_tx_powermail_example.php | 62 +- ...powermail_tx_powermail_fields_fe_field.php | 77 +-- ...ser_powermail_tx_powermail_fields_type.php | 58 +- ..._powermail_tx_powermail_fieldsetchoose.php | 56 +- ...r_powermail_tx_powermail_forms_preview.php | 54 +- ..._powermail_tx_powermail_forms_recip_id.php | 62 +- ...wermail_tx_powermail_forms_recip_table.php | 68 +- ...ermail_tx_powermail_forms_sender_field.php | 49 +- lib/class.user_powermail_tx_powermail_uid.php | 57 +- lib/user_powermailCheckT3jquery.php | 48 +- lib/user_powermailCheckT3jqueryCDNMode.php | 74 +- lib/user_powermailOnCurrentPage.php | 68 +- lib/user_powermail_misc.php | 70 +- lib/user_powermail_updateError.php | 48 +- mod1/class.tx_powermail_action.php | 58 +- mod1/class.tx_powermail_ajax.php | 48 +- mod1/class.tx_powermail_charts.php | 66 +- mod1/class.tx_powermail_export.php | 547 +++++++-------- mod1/class.tx_powermail_repository.php | 237 ++++--- mod1/conf.php | 10 +- mod1/index.php | 75 +- pageTSconfig.txt | 5 + pi1/class.tx_powermail_confirmation.php | 109 ++- pi1/class.tx_powermail_form.php | 215 +++--- pi1/class.tx_powermail_html.php | 646 +++++++++--------- pi1/class.tx_powermail_mandatory.php | 237 +++---- pi1/class.tx_powermail_pi1.php | 165 +++-- pi1/class.tx_powermail_submit.php | 609 +++++++++-------- pi1/locallang.xml | 3 + res/css/powermail_frontend_basic.css | 69 +- res/less/powermail_frontend_basic.less | 339 +++++---- static/pi1/setup.txt | 12 +- tca.php | 519 +++++++------- templates/tmpl_fieldwrap.html | 27 +- templates/tmpl_frontend.js | 131 +++- 53 files changed, 3431 insertions(+), 3539 deletions(-) delete mode 100644 lib/class.tx_powermail_removexss.php diff --git a/class.ext_update.php b/class.ext_update.php index 06b3fcd6..3a5f701b 100644 --- a/class.ext_update.php +++ b/class.ext_update.php @@ -2,7 +2,7 @@ /*************************************************************** * Copyright notice * - * (c) 2011 Alexander Grein + * (c) 2011 powermail development team (details on http://forge.typo3.org/projects/show/extension-powermail) * All rights reserved * * This script is part of the TYPO3 project. The TYPO3 project is @@ -13,9 +13,6 @@ * * The GNU General Public License can be found at * http://www.gnu.org/copyleft/gpl.html. - * A copy is found in the textfile GPL.txt and important notices to the license - * from the author is found in LICENSE.txt distributed with these scripts. - * * * This script is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -28,33 +25,33 @@ /** * Class for updating powermail content elements * - * @author Alexander Grein - * @package TYPO3 + * @author Alexander Grein + * @package TYPO3 * @subpackage tx_powermail */ class ext_update { - private $storagePageEmpty = array(); - private $ll = 'LLL:EXT:powermail/locallang.xml:updater.'; - - /** - * Main function, returning the HTML content of the module - * - * @return string HTML - */ - public function main() { - $out = ''; - if (t3lib_div::int_from_ver(TYPO3_version) < 4003000) { - // add flash messages styles - $cssPath = $GLOBALS['BACK_PATH'] . t3lib_extMgm::extRelPath('powermail'); - $out .= ''; - } - // analyze - $this->storagePageEmpty = $this->getStoragePageEmpty(); - if (t3lib_div::_GP('do_update')) { - $out .= '' . $GLOBALS['LANG']->sL($this->ll . 'back') . '
'; - $func = trim(t3lib_div::_GP('func')); - if (method_exists($this, $func)) { - $out .= ' + private $storagePageEmpty = array(); + private $ll = 'LLL:EXT:powermail/locallang.xml:updater.'; + + /** + * Main function, returning the HTML content of the module + * + * @return string HTML + */ + public function main() { + $out = ''; + if (t3lib_div::int_from_ver(TYPO3_version) < 4003000) { + // add flash messages styles + $cssPath = $GLOBALS['BACK_PATH'] . t3lib_extMgm::extRelPath('powermail'); + $out .= ''; + } + // analyze + $this->storagePageEmpty = $this->getStoragePageEmpty(); + if (t3lib_div::_GP('do_update')) { + $out .= '' . $GLOBALS['LANG']->sL($this->ll . 'back') . '
'; + $func = trim(t3lib_div::_GP('func')); + if (method_exists($this, $func)) { + $out .= '
' . $GLOBALS['LANG']->sL($this->ll . 'updateresults') . '
@@ -63,58 +60,58 @@ public function main() {
'; - } else { - $out .= ' + } else { + $out .= '
ERROR: ' . $func . '() not found
'; - } - } else { - $out .= '' . $GLOBALS['LANG']->sL($this->ll . 'reload') . ' + } + } else { + $out .= '' . $GLOBALS['LANG']->sL($this->ll . 'reload') . '
'; - $out .= $this->displayWarning(); - $out .= '

' . $GLOBALS['LANG']->sL($this->ll . 'actions') . '

'; - // Update all flexform - $out .= $this->displayUpdateOption('searchStoragePageEmpty', count($this->storagePageEmpty), 'updateStoragePageEmpty'); - } - - return $out; - } - - /** - * Display the html of the update option - * @param string $k - * @param integer $count - * @param string $func - * @return hteml - */ - private function displayUpdateOption($k, $count, $func) { - $msg = $GLOBALS['LANG']->sL($this->ll . 'msg_' . $k) . ' '; - $msg .= '
' . str_replace('###COUNT###', $count, $GLOBALS['LANG']->sL($this->ll . 'foundMsg_' . $k)) . ''; - $msg .= ' '; - if ($count) { - $msg .= '

' . $GLOBALS['LANG']->sL($this->ll . 'question_' . $k) . '

'; - $msg .= '

' . $GLOBALS['LANG']->sL($this->ll . 'questionInfo_' . $k) . '

'; - $msg .= $this->getButton($func); - } else { - $msg .= '
' . $GLOBALS['LANG']->sL($this->ll . 'nothingtodo'); - } - $out = $this->wrapForm($msg, $GLOBALS['LANG']->sL($this->ll . 'lbl_' . $k)); - $out .= '

'; - - return $out; - } - - /** - * Display the warningmessage - * - * @return html - */ - private function displayWarning() { - $out = ' + $out .= $this->displayWarning(); + $out .= '

' . $GLOBALS['LANG']->sL($this->ll . 'actions') . '

'; + // Update all flexform + $out .= $this->displayUpdateOption('searchStoragePageEmpty', count($this->storagePageEmpty), 'updateStoragePageEmpty'); + } + + return $out; + } + + /** + * Display the html of the update option + * @param string $k + * @param integer $count + * @param string $func + * @return hteml + */ + private function displayUpdateOption($k, $count, $func) { + $msg = $GLOBALS['LANG']->sL($this->ll . 'msg_' . $k) . ' '; + $msg .= '
' . str_replace('###COUNT###', $count, $GLOBALS['LANG']->sL($this->ll . 'foundMsg_' . $k)) . ''; + $msg .= ' '; + if ($count) { + $msg .= '

' . $GLOBALS['LANG']->sL($this->ll . 'question_' . $k) . '

'; + $msg .= '

' . $GLOBALS['LANG']->sL($this->ll . 'questionInfo_' . $k) . '

'; + $msg .= $this->getButton($func); + } else { + $msg .= '
' . $GLOBALS['LANG']->sL($this->ll . 'nothingtodo'); + } + $out = $this->wrapForm($msg, $GLOBALS['LANG']->sL($this->ll . 'lbl_' . $k)); + $out .= '

'; + + return $out; + } + + /** + * Display the warningmessage + * + * @return html + */ + private function displayWarning() { + $out = '

' . $GLOBALS['LANG']->sL($this->ll . 'warningHeader') . '
@@ -124,18 +121,18 @@ private function displayWarning() {
'; - return $out; - } - - /** - * Returns the fieldset of updatesection - * - * @param string $content - * @param string $fsLabel - * @return html - */ - private function wrapForm($content, $fsLabel) { - $out = ' + return $out; + } + + /** + * Returns the fieldset of updatesection + * + * @param string $content + * @param string $fsLabel + * @return html + */ + private function wrapForm($content, $fsLabel) { + $out = '
' . $fsLabel . ' @@ -143,90 +140,90 @@ private function wrapForm($content, $fsLabel) {
'; - return $out; - } - - /** - * Return the button for update - * - * @param string $func - * @param string $lbl - * @return html - */ - private function getButton($func, $lbl = 'DO IT') { - $params = array('do_update' => 1, 'func' => $func); - $onClick = "document.location='" . t3lib_div::linkThisScript($params) . "'; return false;"; - $button = ''; - - return $button; - } - - /** - * Returns all content elements with old values - * - * @return array - */ - private function getStoragePageEmpty() { - if (count($GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid', 'sys_log', 'type = 4 AND details LIKE \'%updateStoragePage%\'' . t3lib_BEfunc::deleteClause('sys_log')))) { - return array(); - } - $select_fields = '*'; - $from_table = 'tt_content'; - $where_clause = 'tx_powermail_pages=\'\' AND CType=\'powermail_pi1\''; - $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select_fields, $from_table, $where_clause); - $resultRows = array(); - if ($res) { - while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))) { - $resultRows[] = $row; - } - } - if (count($resultRows) < 1) { - // write log to ensure it will be used only once - $GLOBALS['BE_USER']->simplelog('updateStoragePage nothing to do', 'powermail', 0); - } - - return $resultRows; - } - - /** - * Update the content elements - * - * @return string - */ - private function updateStoragePageEmpty() { - $msg = null; - if (count($this->storagePageEmpty) > 0) { - foreach ($this->storagePageEmpty as $content) { - // Update the content - $table = 'tt_content'; - $where = 'uid= ' . $content['uid']; - $fields_values = array( - 'tx_powermail_pages' => $content['pid'] - ); - if ($GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, $where, $fields_values)) { - $msg[] = 'Updated tt_content uid: ' . $content['uid']; - } - } - } - // write log to ensure it will be used only once - $GLOBALS['BE_USER']->simplelog('updateStoragePage successful', 'powermail', 0); - - return implode('
', $msg); - } - - /** - * Checks how many rows are found and returns true if there are any - * (this function is called from the extension manager) - * - * @param string $what: what should be updated - * @return boolean - */ - public function access($what = 'all') { - return TRUE; - } + return $out; + } + + /** + * Return the button for update + * + * @param string $func + * @param string $lbl + * @return html + */ + private function getButton($func, $lbl = 'DO IT') { + $params = array('do_update' => 1, 'func' => $func); + $onClick = "document.location='" . t3lib_div::linkThisScript($params) . "'; return false;"; + $button = ''; + + return $button; + } + + /** + * Returns all content elements with old values + * + * @return array + */ + private function getStoragePageEmpty() { + if (count($GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid', 'sys_log', 'type = 4 AND details LIKE \'%updateStoragePage%\'' . t3lib_BEfunc::deleteClause('sys_log')))) { + return array(); + } + $select_fields = '*'; + $from_table = 'tt_content'; + $where_clause = 'tx_powermail_pages=\'\' AND CType=\'powermail_pi1\''; + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select_fields, $from_table, $where_clause); + $resultRows = array(); + if ($res) { + while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))) { + $resultRows[] = $row; + } + } + if (count($resultRows) < 1) { + // write log to ensure it will be used only once + $GLOBALS['BE_USER']->simplelog('updateStoragePage nothing to do', 'powermail', 0); + } + + return $resultRows; + } + + /** + * Update the content elements + * + * @return string + */ + private function updateStoragePageEmpty() { + $msg = null; + if (count($this->storagePageEmpty) > 0) { + foreach ($this->storagePageEmpty as $content) { + // Update the content + $table = 'tt_content'; + $where = 'uid= ' . $content['uid']; + $fields_values = array( + 'tx_powermail_pages' => $content['pid'] + ); + if ($GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, $where, $fields_values)) { + $msg[] = 'Updated tt_content uid: ' . $content['uid']; + } + } + } + // write log to ensure it will be used only once + $GLOBALS['BE_USER']->simplelog('updateStoragePage successful', 'powermail', 0); + + return implode('
', $msg); + } + + /** + * Checks how many rows are found and returns true if there are any + * (this function is called from the extension manager) + * + * @param string $what: what should be updated + * @return boolean + */ + public function access($what = 'all') { + return TRUE; + } } if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/class.ext_update.php']) { - include_once ($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/class.ext_update.php']); + include_once ($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/class.ext_update.php']); } ?> \ No newline at end of file diff --git a/cli/class.tx_powermail_scheduler.php b/cli/class.tx_powermail_scheduler.php index 48ce0944..18cf74c6 100644 --- a/cli/class.tx_powermail_scheduler.php +++ b/cli/class.tx_powermail_scheduler.php @@ -1,26 +1,26 @@ msg = 'No Page ID given!'; return false; } - + // tsconfig - $tmp_defaultconfig = array ( + $tmp_defaultconfig = array( 'time' => 86400, // default setting 1 day 'body' => 'See XLS file in attachment', // default body 'subject' => 'New powermail export email', // default subject @@ -64,39 +64,39 @@ public function execute() { 'attachedFilename' => '' // overwrite filename ); $tmp_tsconfig = t3lib_BEfunc::getModTSconfig($this->pid, 'tx_powermail_cli'); // get whole tsconfig from backend - $tsconfig = array_merge((array) $tmp_defaultconfig, (array) $tmp_tsconfig['properties']['exportmail.']); // overwrite from page tsconfig + $tsconfig = array_merge((array)$tmp_defaultconfig, (array)$tmp_tsconfig['properties']['exportmail.']); // overwrite from page tsconfig if (t3lib_div::validEmail($this->email)) { $tsconfig['email_receiver'] = $this->email; // overwrite from scheduler settings } - if (t3lib_div::validEmail($this->email_sender)) { - $tsconfig['email_sender'] = $this->email_sender; // overwrite from scheduler settings - } - if (trim($this->sender) != '') { - $tsconfig['sender'] = $this->sender; // overwrite from scheduler settings - } - if (trim($this->subject) != '') { - $tsconfig['subject'] = $this->subject; // overwrite from scheduler settings - } - if (trim($this->body) != '') { - $tsconfig['body'] = $this->body; // overwrite from scheduler settings - } + if (t3lib_div::validEmail($this->email_sender)) { + $tsconfig['email_sender'] = $this->email_sender; // overwrite from scheduler settings + } + if (trim($this->sender) != '') { + $tsconfig['sender'] = $this->sender; // overwrite from scheduler settings + } + if (trim($this->subject) != '') { + $tsconfig['subject'] = $this->subject; // overwrite from scheduler settings + } + if (trim($this->body) != '') { + $tsconfig['body'] = $this->body; // overwrite from scheduler settings + } if (intval($this->timeframe) > 0) { $tsconfig['time'] = intval($this->timeframe); // overwrite from scheduler settings } - if (trim($this->format) != '') { - $tsconfig['format'] = $this->format; // overwrite from scheduler settings - } + if (trim($this->format) != '') { + $tsconfig['format'] = $this->format; // overwrite from scheduler settings + } if (!t3lib_div::validEmail($tsconfig['email_receiver'])) { // if receiver email is set $this->msg = 'Wrong receiver mail given!'; return false; } - + if (!t3lib_extMgm::isLoaded('phpexcel_library') && $tsconfig['format'] == 'email_xls') { $this->msg = 'Please use csv or install extension phpexcel_library'; return false; } - + // Generate the xls file $export = t3lib_div::makeInstance('tx_powermail_export'); $export->pid = $this->pid; // set page id @@ -125,36 +125,36 @@ public function execute() { if ($export->resNumRows > 0) { // if file is not empty // Generate the mail - if (t3lib_div::compat_version('4.5')){ - // new TYPO3 swiftmailer code - $mail = t3lib_div::makeInstance('t3lib_mail_Message'); - $mail->setTo(array($tsconfig['email_receiver'])) - ->setFrom(array($tsconfig['email_sender'] => $tsconfig['sender'])) - ->setSubject($tsconfig['subject']) - ->addPart($tsconfig['body'], 'text/plain') - ->setBody($tsconfig['body'], 'text/html') - ->attach(Swift_Attachment::fromPath($file)) - ->setCharset($GLOBALS['TSFE']->metaCharset); - - if ($tsconfig['email_receiver_cc'] !== ''){ - $mail->setCc(t3lib_div::trimExplode(',', $tsconfig['email_receiver_cc'])); - } - $mail->send(); - $success = $mail->isSent(); - - } else { - $mail = t3lib_div::makeInstance('t3lib_htmlmail'); // New object: TYPO3 mail class - $mail->start(); // start htmlmail - $mail->recipient = $tsconfig['email_receiver']; // main receiver - $mail->recipient_copy = $tsconfig['email_receiver_cc']; // cc - $mail->subject = $tsconfig['subject']; // mail subject - $mail->from_email = $tsconfig['email_sender']; // sender email - $mail->from_name = $tsconfig['sender']; // sender name - $mail->addAttachment($file); // add attachment - $mail->addPlain($tsconfig['body']); // add plaintext - $mail->setHTML($mail->encodeMsg($tsconfig['body'])); // html format if active via constants - $success = $mail->send(); - } + if (t3lib_div::compat_version('4.5')) { + // new TYPO3 swiftmailer code + $mail = t3lib_div::makeInstance('t3lib_mail_Message'); + $mail->setTo(array($tsconfig['email_receiver'])) + ->setFrom(array($tsconfig['email_sender'] => $tsconfig['sender'])) + ->setSubject($tsconfig['subject']) + ->addPart($tsconfig['body'], 'text/plain') + ->setBody($tsconfig['body'], 'text/html') + ->attach(Swift_Attachment::fromPath($file)) + ->setCharset($GLOBALS['TSFE']->metaCharset); + + if ($tsconfig['email_receiver_cc'] !== '') { + $mail->setCc(t3lib_div::trimExplode(',', $tsconfig['email_receiver_cc'])); + } + $mail->send(); + $success = $mail->isSent(); + + } else { + $mail = t3lib_div::makeInstance('t3lib_htmlmail'); // New object: TYPO3 mail class + $mail->start(); // start htmlmail + $mail->recipient = $tsconfig['email_receiver']; // main receiver + $mail->recipient_copy = $tsconfig['email_receiver_cc']; // cc + $mail->subject = $tsconfig['subject']; // mail subject + $mail->from_email = $tsconfig['email_sender']; // sender email + $mail->from_name = $tsconfig['sender']; // sender name + $mail->addAttachment($file); // add attachment + $mail->addPlain($tsconfig['body']); // add plaintext + $mail->setHTML($mail->encodeMsg($tsconfig['body'])); // html format if active via constants + $success = $mail->send(); + } if ($success) { $this->msg = 'Mail successfully sent. Generated and attached file: ' . $file; } else { @@ -164,16 +164,15 @@ public function execute() { } else { $this->msg = 'There are no mails to export in the last ' . intval($tsconfig['time']) . ' seconds in pid ' . $this->pid; } - //t3lib_div::devlog($this->msg, 'powermail', 0); unlink($file); return true; } - + /** - * Return message for backend - * - * @return string - */ + * Return message for backend + * + * @return string + */ public function getAdditionalInformation() { $format = ''; switch ($this->format) { @@ -191,7 +190,7 @@ public function getAdditionalInformation() { } } -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/cli/class.tx_powermail_scheduler.php']) { - include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/cli/class.tx_powermail_scheduler.php']); +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/cli/class.tx_powermail_scheduler.php']) { + include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/cli/class.tx_powermail_scheduler.php']); } ?> \ No newline at end of file diff --git a/cli/class.tx_powermail_scheduler_addFields.php b/cli/class.tx_powermail_scheduler_addFields.php index cf69bb6a..486fc263 100644 --- a/cli/class.tx_powermail_scheduler_addFields.php +++ b/cli/class.tx_powermail_scheduler_addFields.php @@ -1,27 +1,27 @@ CMD == 'edit') { - $taskInfo['pid'] = $task->pid; - } else { - $taskInfo['pid'] = ''; - } - } - - if (empty($taskInfo['filename'])) { - if ($parentObject->CMD == 'edit') { - $taskInfo['filename'] = $task->filename; - } else { - $taskInfo['filename'] = ''; - } - } - - if (empty($taskInfo['email'])) { - if ($parentObject->CMD == 'edit') { - $taskInfo['email'] = $task->email; - } else { - $taskInfo['email'] = ''; - } - } - - if (empty($taskInfo['email_sender'])) { - if ($parentObject->CMD == 'edit') { - $taskInfo['email_sender'] = $task->email_sender; - } else { - $taskInfo['email_sender'] = ''; - } - } - - if (empty($taskInfo['sender'])) { - if ($parentObject->CMD == 'edit') { - $taskInfo['sender'] = $task->sender; - } else { - $taskInfo['sender'] = ''; - } - } - - if (empty($taskInfo['subject'])) { - if ($parentObject->CMD == 'edit') { - $taskInfo['subject'] = $task->subject; - } else { - $taskInfo['subject'] = ''; - } - } - - if (empty($taskInfo['body'])) { - if ($parentObject->CMD == 'edit') { - $taskInfo['body'] = $task->body; - } else { - $taskInfo['body'] = ''; - } - } - - if (empty($taskInfo['timeframe'])) { - if ($parentObject->CMD == 'edit') { - $taskInfo['timeframe'] = $task->timeframe; - } else { - $taskInfo['timeframe'] = ''; - } - } - - if (empty($taskInfo['format'])) { - if ($parentObject->CMD == 'edit') { - $taskInfo['format'] = $task->format; - } else { - $taskInfo['format'] = ''; - } - } - - // Write the code for the pid field - $fieldID = 'task_pid'; - $fieldCode = ''; - $additionalFields[$fieldID] = array( - 'code' => $fieldCode, - 'label' => 'Page ID with powermails' - ); - - // Write the code for the filename field - $fieldID = 'task_filename'; - $fieldCode = ''; - $additionalFields[$fieldID] = array( - 'code' => $fieldCode, - 'label' => 'Filename for export without extension (leave empty for automatic generated filename)' - ); - - // Write the code for the email field - $fieldID = 'task_email'; - $fieldCode = ''; - $additionalFields[$fieldID] = array( - 'code' => $fieldCode, - 'label' => 'Email receiver' - ); - - // Write the code for the email_sender field - $fieldID = 'task_email_sender'; - $fieldCode = ''; - $additionalFields[$fieldID] = array( - 'code' => $fieldCode, - 'label' => 'Email sender' - ); - - // Write the code for the sender field - $fieldID = 'task_sender'; - $fieldCode = ''; - $additionalFields[$fieldID] = array( - 'code' => $fieldCode, - 'label' => 'Sender Name' - ); - - // Write the code for the subject field - $fieldID = 'task_subject'; - $fieldCode = ''; - $additionalFields[$fieldID] = array( - 'code' => $fieldCode, - 'label' => 'Email subject' - ); - - // Write the code for the body field - $fieldID = 'task_body'; - $fieldCode = ''; - $additionalFields[$fieldID] = array( - 'code' => $fieldCode, - 'label' => 'Email body' - ); - - // Write the code for the timeframe field - $fieldID = 'task_timeframe'; - $fieldCode = ''; - $additionalFields[$fieldID] = array( - 'code' => $fieldCode, - 'label' => 'Timeframe in seconds' - ); - - // Write the code for the export format field - $fieldID = 'task_format'; - $fieldCode = ''; + $additionalFields[$fieldID] = array( + 'code' => $fieldCode, + 'label' => 'Page ID with powermails' + ); + + // Write the code for the filename field + $fieldID = 'task_filename'; + $fieldCode = ''; + $additionalFields[$fieldID] = array( + 'code' => $fieldCode, + 'label' => 'Filename for export without extension (leave empty for automatic generated filename)' + ); + + // Write the code for the email field + $fieldID = 'task_email'; + $fieldCode = ''; + $additionalFields[$fieldID] = array( + 'code' => $fieldCode, + 'label' => 'Email receiver' + ); + + // Write the code for the email_sender field + $fieldID = 'task_email_sender'; + $fieldCode = ''; + $additionalFields[$fieldID] = array( + 'code' => $fieldCode, + 'label' => 'Email sender' + ); + + // Write the code for the sender field + $fieldID = 'task_sender'; + $fieldCode = ''; + $additionalFields[$fieldID] = array( + 'code' => $fieldCode, + 'label' => 'Sender Name' + ); + + // Write the code for the subject field + $fieldID = 'task_subject'; + $fieldCode = ''; + $additionalFields[$fieldID] = array( + 'code' => $fieldCode, + 'label' => 'Email subject' + ); + + // Write the code for the body field + $fieldID = 'task_body'; + $fieldCode = ''; + $additionalFields[$fieldID] = array( + 'code' => $fieldCode, + 'label' => 'Email body' + ); + + // Write the code for the timeframe field + $fieldID = 'task_timeframe'; + $fieldCode = ''; + $additionalFields[$fieldID] = array( + 'code' => $fieldCode, + 'label' => 'Timeframe in seconds' + ); + + // Write the code for the export format field + $fieldID = 'task_format'; + $fieldCode = ''; - $additionalFields[$fieldID] = array( - 'code' => $fieldCode, - 'label' => 'Export format' - ); + $additionalFields[$fieldID] = array( + 'code' => $fieldCode, + 'label' => 'Export format' + ); - return $additionalFields; - } + return $additionalFields; + } /** - * Validate user values - * - * @return bool - */ - public function validateAdditionalFields(array &$submittedData, tx_scheduler_Module $parentObject) { - $submittedData['pid'] = intval($submittedData['pid']); // should be integer - $submittedData['filename'] = trim($submittedData['filename']); // should be integer - $submittedData['timeframe'] = intval($submittedData['timeframe']); // should be integer - if (!t3lib_div::validEmail($submittedData['email'])) { // should be a valid email address + * Validate user values + * + * @return bool + */ + public function validateAdditionalFields(array &$submittedData, tx_scheduler_Module $parentObject) { + $submittedData['pid'] = intval($submittedData['pid']); // should be integer + $submittedData['filename'] = trim($submittedData['filename']); // should be integer + $submittedData['timeframe'] = intval($submittedData['timeframe']); // should be integer + if (!t3lib_div::validEmail($submittedData['email'])) { // should be a valid email address $submittedData['email'] = ''; // clean } - if (!t3lib_div::validEmail($submittedData['email_sender'])) { // should be a valid email address + if (!t3lib_div::validEmail($submittedData['email_sender'])) { // should be a valid email address $submittedData['email_sender'] = ''; // clean } - return true; - } - + return true; + } + /** - * make values available in scheduler object - * - * @return void - */ - public function saveAdditionalFields(array $submittedData, tx_scheduler_Task $task) { - $task->pid = $submittedData['pid']; - $task->filename = $submittedData['filename']; - $task->email = $submittedData['email']; - $task->email_sender = $submittedData['email_sender']; - $task->sender = $submittedData['sender']; - $task->subject = $submittedData['subject']; - $task->body = $submittedData['body']; - $task->timeframe = $submittedData['timeframe']; - $task->format = $submittedData['format']; - } + * make values available in scheduler object + * + * @return void + */ + public function saveAdditionalFields(array $submittedData, tx_scheduler_Task $task) { + $task->pid = $submittedData['pid']; + $task->filename = $submittedData['filename']; + $task->email = $submittedData['email']; + $task->email_sender = $submittedData['email_sender']; + $task->sender = $submittedData['sender']; + $task->subject = $submittedData['subject']; + $task->body = $submittedData['body']; + $task->timeframe = $submittedData['timeframe']; + $task->format = $submittedData['format']; + } } -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/cli/class.tx_powermail_scheduler_addFields.php']) { - include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/cli/class.tx_powermail_scheduler_addFields.php']); +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/cli/class.tx_powermail_scheduler_addFields.php']) { + include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/cli/class.tx_powermail_scheduler_addFields.php']); } ?> \ No newline at end of file diff --git a/cli/conf.php b/cli/conf.php index c6b94885..97cd936c 100644 --- a/cli/conf.php +++ b/cli/conf.php @@ -1,11 +1,11 @@ -* All rights reserved -* -* This script is part of the TYPO3 project. The TYPO3 project is -* free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* The GNU General Public License can be found at -* http://www.gnu.org/copyleft/gpl.html. -* -* This script is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* This copyright notice MUST APPEAR in all copies of the script! -***************************************************************/ + * Copyright notice + * + * (c) 2010 powermail development team (details on http://forge.typo3.org/projects/show/extension-powermail) + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ - - // Defining circumstances for CLI mode: + +// Defining circumstances for CLI mode: define('TYPO3_cliMode', TRUE); define('PATH_thisScript', $_SERVER['SCRIPT_FILENAME']); if (!PATH_thisScript) define('PATH_thisScript', $_ENV['_'] ? $_ENV['_'] : $_SERVER['_']); require(dirname(PATH_thisScript) . '/conf.php'); -require(dirname(PATH_thisScript) . '/' . $BACK_PATH.'init.php'); +require(dirname(PATH_thisScript) . '/' . $BACK_PATH . 'init.php'); require_once(PATH_t3lib . 'class.t3lib_admin.php'); require_once(PATH_t3lib . 'class.t3lib_cli.php'); require_once(PATH_typo3 . 'template.php'); require_once(PATH_t3lib . 'class.t3lib_htmlmail.php'); -if (t3lib_div::compat_version('4.5')){ - require_once(PATH_t3lib . 'class.t3lib_mail_message.php'); +if (t3lib_div::compat_version('4.5')) { + require_once(PATH_t3lib . 'class.t3lib_mail_message.php'); } require_once('../mod1/class.tx_powermail_export.php'); // include div functions require_once(t3lib_extMgm::extPath('lang', 'lang.php')); // include lang class @@ -45,9 +45,9 @@ $content = $file = ''; if ($pid > 0) { // if Page id given from GET param - + // tsconfig - $tmp_defaultconfig = array ( + $tmp_defaultconfig = array( 'time' => 86400, // default setting 1 day 'body' => 'See attached file', // default body 'subject' => 'New powermail export email', // default subject @@ -59,10 +59,10 @@ 'attachedFilename' => '' // overwrite filename ); $tmp_tsconfig = t3lib_BEfunc::getModTSconfig($pid, 'tx_powermail_cli'); // get whole tsconfig from backend - $tsconfig = array_merge((array) $tmp_defaultconfig, (array) $tmp_tsconfig['properties']['exportmail.']); // get tsconfig from powermail cli - + $tsconfig = array_merge((array)$tmp_defaultconfig, (array)$tmp_tsconfig['properties']['exportmail.']); // get tsconfig from powermail cli + if (t3lib_div::validEmail($tsconfig['email_receiver'])) { // if receiver email is set - + if (t3lib_extMgm::isLoaded('phpexcel_library') || $tsconfig['format'] != 'email_xls') { // Generate the xls file @@ -78,46 +78,46 @@ $export->main(); // generate file if ($export->resNumRows > 0) { // if file is not empty - - $file = t3lib_div::getFileAbsFileName('typo3temp/' . $export->filename); // read filename - if (t3lib_div::compat_version('4.5')){ - // new TYPO3 swiftmailer code - $mail = t3lib_div::makeInstance('t3lib_mail_Message'); - $mail->setTo(array($tsconfig['email_receiver'])) - ->setFrom(array($tsconfig['email_sender'] => $tsconfig['sender'])) - ->setSubject($tsconfig['subject']) - ->addPart($tsconfig['body'], 'text/plain') - ->setBody($tsconfig['body'], 'text/html') - ->attach(Swift_Attachment::fromPath($file)) - ->setCharset($GLOBALS['TSFE']->metaCharset); - if ($tsconfig['email_receiver_cc'] !== ''){ - $mail->setCc(t3lib_div::trimExplode(',', $tsconfig['email_receiver_cc'])); - } - $mail->send(); - $success = $mail->isSent(); + $file = t3lib_div::getFileAbsFileName('typo3temp/' . $export->filename); // read filename + if (t3lib_div::compat_version('4.5')) { + // new TYPO3 swiftmailer code + $mail = t3lib_div::makeInstance('t3lib_mail_Message'); + $mail->setTo(array($tsconfig['email_receiver'])) + ->setFrom(array($tsconfig['email_sender'] => $tsconfig['sender'])) + ->setSubject($tsconfig['subject']) + ->addPart($tsconfig['body'], 'text/plain') + ->setBody($tsconfig['body'], 'text/html') + ->attach(Swift_Attachment::fromPath($file)) + ->setCharset($GLOBALS['TSFE']->metaCharset); - } else { - // Generate the mail - $mail = t3lib_div::makeInstance('t3lib_htmlmail'); // New object: TYPO3 mail class - $mail->start(); // start htmlmail - $mail->recipient = $tsconfig['email_receiver']; // main receiver - $mail->recipient_copy = $tsconfig['email_receiver_cc']; // cc - $mail->subject = $tsconfig['subject']; // mail subject - $mail->from_email = $tsconfig['email_sender']; // sender email - $mail->from_name = $tsconfig['sender']; // sender name - $mail->addAttachment($file); // add attachment - $mail->addPlain($tsconfig['body']); // add plaintext - $mail->setHTML($mail->encodeMsg($tsconfig['body'])); // html format if active via constants - $success = $mail->send(); - } + if ($tsconfig['email_receiver_cc'] !== '') { + $mail->setCc(t3lib_div::trimExplode(',', $tsconfig['email_receiver_cc'])); + } + $mail->send(); + $success = $mail->isSent(); + + } else { + // Generate the mail + $mail = t3lib_div::makeInstance('t3lib_htmlmail'); // New object: TYPO3 mail class + $mail->start(); // start htmlmail + $mail->recipient = $tsconfig['email_receiver']; // main receiver + $mail->recipient_copy = $tsconfig['email_receiver_cc']; // cc + $mail->subject = $tsconfig['subject']; // mail subject + $mail->from_email = $tsconfig['email_sender']; // sender email + $mail->from_name = $tsconfig['sender']; // sender name + $mail->addAttachment($file); // add attachment + $mail->addPlain($tsconfig['body']); // add plaintext + $mail->setHTML($mail->encodeMsg($tsconfig['body'])); // html format if active via constants + $success = $mail->send(); + } if ($success) { $content .= 'Mail successfully sent'; } else { $content .= 'Powermail Error in sending mail'; } - unlink($file); - + unlink($file); + } else { $content .= 'There are no mails to export in the last ' . intval($tsconfig['time']) . ' seconds in pid ' . $pid; } diff --git a/ext_autoload.php b/ext_autoload.php index ba198759..dea2c33b 100644 --- a/ext_autoload.php +++ b/ext_autoload.php @@ -7,17 +7,17 @@ $arr = array( - /* ajax actions*/ + /* ajax actions*/ 'tx_powermail_action' => $powermailExtPath . 'mod1/class.tx_powermail_action.php', - /* ajax repositories */ + /* ajax repositories */ 'tx_powermail_repository' => $powermailExtPath . 'mod1/class.tx_powermail_repository.php', 'tx_powermail_export' => $powermailExtPath . 'mod1/class.tx_powermail_export.php', - /* div */ + /* div */ 'tx_powermail_functions_div' => $powermailExtPath . 'lib/class.tx_powermail_functions_div.php', - - /* scheduler */ + + /* scheduler */ 'tx_powermail_scheduler' => $powermailExtPath . 'cli/class.tx_powermail_scheduler.php', 'tx_powermail_scheduler_addFields' => $powermailExtPath . 'cli/class.tx_powermail_scheduler_addFields.php' diff --git a/ext_emconf.php b/ext_emconf.php index 9f496183..0b73f41f 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -3,7 +3,7 @@ ######################################################################## # Extension Manager/Repository config file for ext "powermail". # -# Auto generated 24-08-2011 09:18 +# Auto generated 30-08-2011 15:15 # # Manual updates: # Only the data in the array - everything else is removed by next @@ -42,9 +42,10 @@ 'suggests' => array( 'phpexcel_library' => '1.7.4-0.0.0', 't3jquery' => '1.9.0-0.0.0', + 'static_info_tables' => '2.1.0-0.0.0', ), ), - '_md5_values_when_last_written' => 'a:192:{s:9:"ChangeLog";s:4:"7b8c";s:20:"class.ext_update.php";s:4:"1544";s:16:"ext_autoload.php";s:4:"0e1e";s:21:"ext_conf_template.txt";s:4:"75d6";s:12:"ext_icon.gif";s:4:"be45";s:17:"ext_localconf.php";s:4:"2fe7";s:14:"ext_tables.php";s:4:"01ea";s:14:"ext_tables.sql";s:4:"4f21";s:23:"ext_tables_flexform.php";s:4:"271e";s:13:"locallang.xml";s:4:"6aaf";s:16:"locallang_db.xml";s:4:"1638";s:16:"pageTSconfig.txt";s:4:"12df";s:12:"t3jquery.txt";s:4:"f3b4";s:7:"tca.php";s:4:"808d";s:36:"cli/class.tx_powermail_scheduler.php";s:4:"b8fa";s:46:"cli/class.tx_powermail_scheduler_addFields.php";s:4:"9af9";s:12:"cli/conf.php";s:4:"e1ca";s:15:"cli/cronjob.php";s:4:"dde9";s:14:"doc/manual.sxw";s:4:"867b";s:31:"doc/database_relation/Thumbs.db";s:4:"482f";s:53:"doc/database_relation/powermail_database_relation.gif";s:4:"20e9";s:19:"doc/hook/hooks.html";s:4:"0b4b";s:18:"doc/hook/hooks.ods";s:4:"3d0b";s:32:"doc/powermail_graphics/Thumbs.db";s:4:"06ab";s:35:"doc/powermail_graphics/db_icons.psd";s:4:"442c";s:35:"doc/powermail_graphics/ext_icon.gif";s:4:"4fcc";s:51:"doc/powermail_graphics/icon_tx_powermail_fields.gif";s:4:"9a15";s:54:"doc/powermail_graphics/icon_tx_powermail_fields__h.gif";s:4:"e819";s:55:"doc/powermail_graphics/icon_tx_powermail_fields__ht.gif";s:4:"3c06";s:54:"doc/powermail_graphics/icon_tx_powermail_fields__t.gif";s:4:"976c";s:54:"doc/powermail_graphics/icon_tx_powermail_fieldsets.gif";s:4:"35ac";s:57:"doc/powermail_graphics/icon_tx_powermail_fieldsets__h.gif";s:4:"c8e0";s:58:"doc/powermail_graphics/icon_tx_powermail_fieldsets__ht.gif";s:4:"4f86";s:57:"doc/powermail_graphics/icon_tx_powermail_fieldsets__t.gif";s:4:"14bb";s:50:"doc/powermail_graphics/icon_tx_powermail_forms.gif";s:4:"80fe";s:53:"doc/powermail_graphics/icon_tx_powermail_forms__h.gif";s:4:"bcd5";s:54:"doc/powermail_graphics/icon_tx_powermail_forms__ht.gif";s:4:"f7e7";s:53:"doc/powermail_graphics/icon_tx_powermail_forms__t.gif";s:4:"4893";s:50:"doc/powermail_graphics/icon_tx_powermail_mails.gif";s:4:"fcba";s:53:"doc/powermail_graphics/icon_tx_powermail_mails__h.gif";s:4:"d40c";s:37:"doc/powermail_graphics/moduleicon.gif";s:4:"93ca";s:34:"doc/powermail_graphics/pm_logo.gif";s:4:"02dd";s:34:"doc/powermail_graphics/pm_logo.psd";s:4:"dabe";s:35:"doc/realurl/example_realurlpart.php";s:4:"37d3";s:39:"lib/class.tx_powermail_countryzones.php";s:4:"a1cb";s:29:"lib/class.tx_powermail_db.php";s:4:"5ed5";s:41:"lib/class.tx_powermail_dynamicmarkers.php";s:4:"08aa";s:40:"lib/class.tx_powermail_functions_div.php";s:4:"3498";s:32:"lib/class.tx_powermail_geoip.php";s:4:"81c8";s:34:"lib/class.tx_powermail_markers.php";s:4:"ea91";s:36:"lib/class.tx_powermail_removexss.php";s:4:"2780";s:35:"lib/class.tx_powermail_sessions.php";s:4:"be27";s:38:"lib/class.tx_powermail_tsparserext.php";s:4:"ff13";s:49:"lib/class.user_powermail_tx_powermail_example.php";s:4:"d39f";s:57:"lib/class.user_powermail_tx_powermail_fields_fe_field.php";s:4:"9d1b";s:53:"lib/class.user_powermail_tx_powermail_fields_type.php";s:4:"9aee";s:56:"lib/class.user_powermail_tx_powermail_fieldsetchoose.php";s:4:"8017";s:55:"lib/class.user_powermail_tx_powermail_forms_preview.php";s:4:"0db1";s:56:"lib/class.user_powermail_tx_powermail_forms_recip_id.php";s:4:"7ccb";s:59:"lib/class.user_powermail_tx_powermail_forms_recip_table.php";s:4:"46aa";s:60:"lib/class.user_powermail_tx_powermail_forms_sender_field.php";s:4:"300e";s:45:"lib/class.user_powermail_tx_powermail_uid.php";s:4:"236a";s:35:"lib/user_powermailCheckT3jquery.php";s:4:"f6a8";s:42:"lib/user_powermailCheckT3jqueryCDNMode.php";s:4:"e8db";s:35:"lib/user_powermailOnCurrentPage.php";s:4:"0d7e";s:27:"lib/user_powermail_misc.php";s:4:"dc24";s:34:"lib/user_powermail_updateError.php";s:4:"688a";s:28:"lib/def/def_field_button.xml";s:4:"ef8c";s:29:"lib/def/def_field_captcha.xml";s:4:"4fe1";s:27:"lib/def/def_field_check.xml";s:4:"ab50";s:29:"lib/def/def_field_content.xml";s:4:"e76e";s:35:"lib/def/def_field_countryselect.xml";s:4:"f5eb";s:41:"lib/def/def_field_countryselect_error.xml";s:4:"80f5";s:26:"lib/def/def_field_date.xml";s:4:"ee65";s:32:"lib/def/def_field_date_error.xml";s:4:"753f";s:30:"lib/def/def_field_datetime.xml";s:4:"77c8";s:27:"lib/def/def_field_error.xml";s:4:"0f3d";s:26:"lib/def/def_field_file.xml";s:4:"dcf6";s:28:"lib/def/def_field_hidden.xml";s:4:"6b31";s:26:"lib/def/def_field_html.xml";s:4:"943d";s:27:"lib/def/def_field_label.xml";s:4:"c62e";s:30:"lib/def/def_field_password.xml";s:4:"1aea";s:27:"lib/def/def_field_radio.xml";s:4:"0537";s:27:"lib/def/def_field_reset.xml";s:4:"21f7";s:28:"lib/def/def_field_select.xml";s:4:"353e";s:28:"lib/def/def_field_submit.xml";s:4:"405b";s:35:"lib/def/def_field_submitgraphic.xml";s:4:"c989";s:26:"lib/def/def_field_text.xml";s:4:"7f4f";s:30:"lib/def/def_field_textarea.xml";s:4:"6d73";s:32:"lib/def/def_field_typoscript.xml";s:4:"6944";s:35:"lib/example/examplefield_button.gif";s:4:"10e0";s:36:"lib/example/examplefield_captcha.gif";s:4:"6201";s:34:"lib/example/examplefield_check.gif";s:4:"32a9";s:36:"lib/example/examplefield_content.gif";s:4:"8f01";s:42:"lib/example/examplefield_countryselect.gif";s:4:"54d0";s:33:"lib/example/examplefield_date.gif";s:4:"19a8";s:37:"lib/example/examplefield_datetime.gif";s:4:"2fae";s:33:"lib/example/examplefield_file.gif";s:4:"9a1b";s:33:"lib/example/examplefield_html.gif";s:4:"6f6b";s:34:"lib/example/examplefield_label.gif";s:4:"9658";s:37:"lib/example/examplefield_password.gif";s:4:"a16d";s:34:"lib/example/examplefield_radio.gif";s:4:"8abe";s:34:"lib/example/examplefield_reset.gif";s:4:"395c";s:35:"lib/example/examplefield_select.gif";s:4:"fae2";s:35:"lib/example/examplefield_submit.gif";s:4:"522e";s:42:"lib/example/examplefield_submitgraphic.gif";s:4:"d39c";s:33:"lib/example/examplefield_text.gif";s:4:"3279";s:37:"lib/example/examplefield_textarea.gif";s:4:"eecb";s:33:"lib/example/examplefield_time.gif";s:4:"a8b3";s:39:"lib/example/examplefield_typoscript.gif";s:4:"77dd";s:34:"mod1/class.tx_powermail_action.php";s:4:"d15c";s:32:"mod1/class.tx_powermail_ajax.php";s:4:"4d51";s:34:"mod1/class.tx_powermail_charts.php";s:4:"37bd";s:34:"mod1/class.tx_powermail_export.php";s:4:"a1b3";s:38:"mod1/class.tx_powermail_repository.php";s:4:"8372";s:14:"mod1/clear.gif";s:4:"cc11";s:13:"mod1/conf.php";s:4:"62ef";s:14:"mod1/index.php";s:4:"8c9f";s:18:"mod1/locallang.xml";s:4:"5119";s:22:"mod1/locallang_mod.xml";s:4:"9cf7";s:19:"mod1/moduleicon.gif";s:4:"24d3";s:14:"pi1/ce_wiz.gif";s:4:"631a";s:39:"pi1/class.tx_powermail_confirmation.php";s:4:"c0d2";s:31:"pi1/class.tx_powermail_form.php";s:4:"e4e3";s:31:"pi1/class.tx_powermail_html.php";s:4:"f92e";s:36:"pi1/class.tx_powermail_mandatory.php";s:4:"4ec7";s:30:"pi1/class.tx_powermail_pi1.php";s:4:"4870";s:38:"pi1/class.tx_powermail_pi1_wizicon.php";s:4:"2d6c";s:33:"pi1/class.tx_powermail_submit.php";s:4:"2e82";s:19:"pi1/flexform_ds.xml";s:4:"da24";s:17:"pi1/locallang.xml";s:4:"0acc";s:25:"res/css/flashmessages.css";s:4:"1fd2";s:29:"res/css/powermail_backend.css";s:4:"272c";s:36:"res/css/powermail_frontend_basic.css";s:4:"6452";s:36:"res/css/powermail_frontend_fancy.css";s:4:"13ea";s:20:"res/img/calendar.png";s:4:"5307";s:17:"res/img/error.png";s:4:"e4dd";s:15:"res/img/h30.png";s:4:"5af3";s:20:"res/img/icon_csv.gif";s:4:"ddf9";s:20:"res/img/icon_del.gif";s:4:"90c6";s:23:"res/img/icon_deloff.gif";s:4:"bb91";s:22:"res/img/icon_delon.gif";s:4:"f1d2";s:28:"res/img/icon_exclamation.gif";s:4:"9878";s:21:"res/img/icon_info.gif";s:4:"16a6";s:22:"res/img/icon_print.gif";s:4:"99dc";s:29:"res/img/icon_select_chart.gif";s:4:"a4de";s:29:"res/img/icon_select_table.gif";s:4:"b878";s:22:"res/img/icon_table.gif";s:4:"cb96";s:36:"res/img/icon_tx_powermail_fields.gif";s:4:"9a15";s:39:"res/img/icon_tx_powermail_fields__h.gif";s:4:"07b3";s:40:"res/img/icon_tx_powermail_fields__ht.gif";s:4:"3c06";s:39:"res/img/icon_tx_powermail_fields__t.gif";s:4:"976c";s:39:"res/img/icon_tx_powermail_fieldsets.gif";s:4:"35ac";s:42:"res/img/icon_tx_powermail_fieldsets__h.gif";s:4:"ebeb";s:43:"res/img/icon_tx_powermail_fieldsets__ht.gif";s:4:"4f86";s:42:"res/img/icon_tx_powermail_fieldsets__t.gif";s:4:"14bb";s:35:"res/img/icon_tx_powermail_forms.gif";s:4:"80fe";s:38:"res/img/icon_tx_powermail_forms__h.gif";s:4:"b151";s:39:"res/img/icon_tx_powermail_forms__ht.gif";s:4:"f7e7";s:38:"res/img/icon_tx_powermail_forms__t.gif";s:4:"4893";s:35:"res/img/icon_tx_powermail_mails.gif";s:4:"fcba";s:38:"res/img/icon_tx_powermail_mails__h.gif";s:4:"2f4b";s:38:"res/img/icon_tx_powermail_mails__t.gif";s:4:"2f4b";s:20:"res/img/icon_xls.gif";s:4:"f031";s:23:"res/img/information.png";s:4:"3750";s:19:"res/img/loading.gif";s:4:"afe8";s:16:"res/img/next.gif";s:4:"d1d0";s:16:"res/img/next.png";s:4:"294d";s:18:"res/img/notice.png";s:4:"a882";s:14:"res/img/ok.png";s:4:"8bfe";s:16:"res/img/prev.gif";s:4:"b749";s:16:"res/img/prev.png";s:4:"305a";s:19:"res/img/warning.png";s:4:"c847";s:30:"res/js/Ext.grid.RowExpander.js";s:4:"77f8";s:30:"res/js/Ext.ux.form.DateTime.js";s:4:"c902";s:35:"res/js/Ext.ux.plugin.FitToParent.js";s:4:"bbd3";s:44:"res/js/Ext.ux.plugin.PagingToolbarResizer.js";s:4:"1af6";s:27:"res/js/powermail_backend.js";s:4:"c8a2";s:26:"static/css_basic/setup.txt";s:4:"cdec";s:30:"static/css_fancy/constants.txt";s:4:"735c";s:26:"static/css_fancy/setup.txt";s:4:"69d4";s:24:"static/pi1/constants.txt";s:4:"d0a5";s:20:"static/pi1/setup.txt";s:4:"9e89";s:23:"templates/tmpl_all.html";s:4:"2b61";s:32:"templates/tmpl_confirmation.html";s:4:"1d00";s:26:"templates/tmpl_emails.html";s:4:"b3cb";s:29:"templates/tmpl_fieldwrap.html";s:4:"5dbd";s:28:"templates/tmpl_formwrap.html";s:4:"4956";s:26:"templates/tmpl_frontend.js";s:4:"bf1f";s:29:"templates/tmpl_mandatory.html";s:4:"8b61";s:30:"templates/tmpl_multiplejs.html";s:4:"a661";s:23:"templates/tmpl_thx.html";s:4:"d07f";}', + '_md5_values_when_last_written' => 'a:193:{s:9:"ChangeLog";s:4:"7b8c";s:20:"class.ext_update.php";s:4:"241c";s:16:"ext_autoload.php";s:4:"70d0";s:21:"ext_conf_template.txt";s:4:"75d6";s:12:"ext_icon.gif";s:4:"be45";s:17:"ext_localconf.php";s:4:"2825";s:14:"ext_tables.php";s:4:"3fc0";s:14:"ext_tables.sql";s:4:"4f21";s:23:"ext_tables_flexform.php";s:4:"271e";s:13:"locallang.xml";s:4:"6aaf";s:16:"locallang_db.xml";s:4:"1638";s:16:"pageTSconfig.txt";s:4:"c27e";s:12:"t3jquery.txt";s:4:"f3b4";s:7:"tca.php";s:4:"dd13";s:36:"cli/class.tx_powermail_scheduler.php";s:4:"d23c";s:46:"cli/class.tx_powermail_scheduler_addFields.php";s:4:"9328";s:12:"cli/conf.php";s:4:"67e1";s:15:"cli/cronjob.php";s:4:"a616";s:14:"doc/manual.sxw";s:4:"867b";s:31:"doc/database_relation/Thumbs.db";s:4:"482f";s:53:"doc/database_relation/powermail_database_relation.gif";s:4:"20e9";s:19:"doc/hook/hooks.html";s:4:"0b4b";s:18:"doc/hook/hooks.ods";s:4:"3d0b";s:32:"doc/powermail_graphics/Thumbs.db";s:4:"06ab";s:35:"doc/powermail_graphics/db_icons.psd";s:4:"442c";s:35:"doc/powermail_graphics/ext_icon.gif";s:4:"4fcc";s:51:"doc/powermail_graphics/icon_tx_powermail_fields.gif";s:4:"9a15";s:54:"doc/powermail_graphics/icon_tx_powermail_fields__h.gif";s:4:"e819";s:55:"doc/powermail_graphics/icon_tx_powermail_fields__ht.gif";s:4:"3c06";s:54:"doc/powermail_graphics/icon_tx_powermail_fields__t.gif";s:4:"976c";s:54:"doc/powermail_graphics/icon_tx_powermail_fieldsets.gif";s:4:"35ac";s:57:"doc/powermail_graphics/icon_tx_powermail_fieldsets__h.gif";s:4:"c8e0";s:58:"doc/powermail_graphics/icon_tx_powermail_fieldsets__ht.gif";s:4:"4f86";s:57:"doc/powermail_graphics/icon_tx_powermail_fieldsets__t.gif";s:4:"14bb";s:50:"doc/powermail_graphics/icon_tx_powermail_forms.gif";s:4:"80fe";s:53:"doc/powermail_graphics/icon_tx_powermail_forms__h.gif";s:4:"bcd5";s:54:"doc/powermail_graphics/icon_tx_powermail_forms__ht.gif";s:4:"f7e7";s:53:"doc/powermail_graphics/icon_tx_powermail_forms__t.gif";s:4:"4893";s:50:"doc/powermail_graphics/icon_tx_powermail_mails.gif";s:4:"fcba";s:53:"doc/powermail_graphics/icon_tx_powermail_mails__h.gif";s:4:"d40c";s:37:"doc/powermail_graphics/moduleicon.gif";s:4:"93ca";s:34:"doc/powermail_graphics/pm_logo.gif";s:4:"02dd";s:34:"doc/powermail_graphics/pm_logo.psd";s:4:"dabe";s:35:"doc/realurl/example_realurlpart.php";s:4:"37d3";s:39:"lib/class.tx_powermail_countryzones.php";s:4:"9cc3";s:29:"lib/class.tx_powermail_db.php";s:4:"19f5";s:41:"lib/class.tx_powermail_dynamicmarkers.php";s:4:"6d72";s:40:"lib/class.tx_powermail_functions_div.php";s:4:"741d";s:32:"lib/class.tx_powermail_geoip.php";s:4:"0755";s:34:"lib/class.tx_powermail_markers.php";s:4:"e069";s:35:"lib/class.tx_powermail_sessions.php";s:4:"9d0c";s:38:"lib/class.tx_powermail_tsparserext.php";s:4:"ed0b";s:49:"lib/class.user_powermail_tx_powermail_example.php";s:4:"478c";s:57:"lib/class.user_powermail_tx_powermail_fields_fe_field.php";s:4:"eb1b";s:53:"lib/class.user_powermail_tx_powermail_fields_type.php";s:4:"3d5e";s:56:"lib/class.user_powermail_tx_powermail_fieldsetchoose.php";s:4:"bb5c";s:55:"lib/class.user_powermail_tx_powermail_forms_preview.php";s:4:"0ab1";s:56:"lib/class.user_powermail_tx_powermail_forms_recip_id.php";s:4:"cf19";s:59:"lib/class.user_powermail_tx_powermail_forms_recip_table.php";s:4:"f70d";s:60:"lib/class.user_powermail_tx_powermail_forms_sender_field.php";s:4:"ba69";s:45:"lib/class.user_powermail_tx_powermail_uid.php";s:4:"f5c3";s:35:"lib/user_powermailCheckT3jquery.php";s:4:"4d34";s:42:"lib/user_powermailCheckT3jqueryCDNMode.php";s:4:"0f02";s:35:"lib/user_powermailOnCurrentPage.php";s:4:"79ca";s:27:"lib/user_powermail_misc.php";s:4:"39a3";s:34:"lib/user_powermail_updateError.php";s:4:"3748";s:28:"lib/def/def_field_button.xml";s:4:"ef8c";s:29:"lib/def/def_field_captcha.xml";s:4:"4fe1";s:27:"lib/def/def_field_check.xml";s:4:"ab50";s:29:"lib/def/def_field_content.xml";s:4:"e76e";s:35:"lib/def/def_field_countryselect.xml";s:4:"f5eb";s:41:"lib/def/def_field_countryselect_error.xml";s:4:"80f5";s:26:"lib/def/def_field_date.xml";s:4:"ee65";s:32:"lib/def/def_field_date_error.xml";s:4:"753f";s:30:"lib/def/def_field_datetime.xml";s:4:"77c8";s:27:"lib/def/def_field_error.xml";s:4:"0f3d";s:26:"lib/def/def_field_file.xml";s:4:"dcf6";s:28:"lib/def/def_field_hidden.xml";s:4:"6b31";s:26:"lib/def/def_field_html.xml";s:4:"943d";s:27:"lib/def/def_field_label.xml";s:4:"c62e";s:30:"lib/def/def_field_password.xml";s:4:"1aea";s:27:"lib/def/def_field_radio.xml";s:4:"0537";s:27:"lib/def/def_field_reset.xml";s:4:"21f7";s:28:"lib/def/def_field_select.xml";s:4:"353e";s:28:"lib/def/def_field_submit.xml";s:4:"405b";s:35:"lib/def/def_field_submitgraphic.xml";s:4:"c989";s:26:"lib/def/def_field_text.xml";s:4:"7f4f";s:30:"lib/def/def_field_textarea.xml";s:4:"6d73";s:32:"lib/def/def_field_typoscript.xml";s:4:"6944";s:35:"lib/example/examplefield_button.gif";s:4:"10e0";s:36:"lib/example/examplefield_captcha.gif";s:4:"6201";s:34:"lib/example/examplefield_check.gif";s:4:"32a9";s:36:"lib/example/examplefield_content.gif";s:4:"8f01";s:42:"lib/example/examplefield_countryselect.gif";s:4:"54d0";s:33:"lib/example/examplefield_date.gif";s:4:"19a8";s:37:"lib/example/examplefield_datetime.gif";s:4:"2fae";s:33:"lib/example/examplefield_file.gif";s:4:"9a1b";s:33:"lib/example/examplefield_html.gif";s:4:"6f6b";s:34:"lib/example/examplefield_label.gif";s:4:"9658";s:37:"lib/example/examplefield_password.gif";s:4:"a16d";s:34:"lib/example/examplefield_radio.gif";s:4:"8abe";s:34:"lib/example/examplefield_reset.gif";s:4:"395c";s:35:"lib/example/examplefield_select.gif";s:4:"fae2";s:35:"lib/example/examplefield_submit.gif";s:4:"522e";s:42:"lib/example/examplefield_submitgraphic.gif";s:4:"d39c";s:33:"lib/example/examplefield_text.gif";s:4:"3279";s:37:"lib/example/examplefield_textarea.gif";s:4:"eecb";s:33:"lib/example/examplefield_time.gif";s:4:"a8b3";s:39:"lib/example/examplefield_typoscript.gif";s:4:"77dd";s:34:"mod1/class.tx_powermail_action.php";s:4:"ccaf";s:32:"mod1/class.tx_powermail_ajax.php";s:4:"3431";s:34:"mod1/class.tx_powermail_charts.php";s:4:"b2fa";s:34:"mod1/class.tx_powermail_export.php";s:4:"45a1";s:38:"mod1/class.tx_powermail_repository.php";s:4:"bd03";s:14:"mod1/clear.gif";s:4:"cc11";s:13:"mod1/conf.php";s:4:"3cd3";s:14:"mod1/index.php";s:4:"3fb6";s:18:"mod1/locallang.xml";s:4:"5119";s:22:"mod1/locallang_mod.xml";s:4:"9cf7";s:19:"mod1/moduleicon.gif";s:4:"24d3";s:14:"pi1/ce_wiz.gif";s:4:"631a";s:39:"pi1/class.tx_powermail_confirmation.php";s:4:"39c8";s:31:"pi1/class.tx_powermail_form.php";s:4:"ae37";s:31:"pi1/class.tx_powermail_html.php";s:4:"b3ad";s:36:"pi1/class.tx_powermail_mandatory.php";s:4:"9730";s:30:"pi1/class.tx_powermail_pi1.php";s:4:"f3cc";s:38:"pi1/class.tx_powermail_pi1_wizicon.php";s:4:"2d6c";s:33:"pi1/class.tx_powermail_submit.php";s:4:"d189";s:19:"pi1/flexform_ds.xml";s:4:"da24";s:17:"pi1/locallang.xml";s:4:"0353";s:25:"res/css/flashmessages.css";s:4:"1fd2";s:29:"res/css/powermail_backend.css";s:4:"272c";s:36:"res/css/powermail_frontend_basic.css";s:4:"9b9d";s:37:"res/css/powermail_frontend_basic_.css";s:4:"6452";s:36:"res/css/powermail_frontend_fancy.css";s:4:"670a";s:20:"res/img/calendar.png";s:4:"5307";s:17:"res/img/error.png";s:4:"e4dd";s:15:"res/img/h30.png";s:4:"5af3";s:20:"res/img/icon_csv.gif";s:4:"ddf9";s:20:"res/img/icon_del.gif";s:4:"90c6";s:23:"res/img/icon_deloff.gif";s:4:"bb91";s:22:"res/img/icon_delon.gif";s:4:"f1d2";s:28:"res/img/icon_exclamation.gif";s:4:"9878";s:21:"res/img/icon_info.gif";s:4:"16a6";s:22:"res/img/icon_print.gif";s:4:"99dc";s:29:"res/img/icon_select_chart.gif";s:4:"a4de";s:29:"res/img/icon_select_table.gif";s:4:"b878";s:22:"res/img/icon_table.gif";s:4:"cb96";s:36:"res/img/icon_tx_powermail_fields.gif";s:4:"9a15";s:39:"res/img/icon_tx_powermail_fields__h.gif";s:4:"07b3";s:40:"res/img/icon_tx_powermail_fields__ht.gif";s:4:"3c06";s:39:"res/img/icon_tx_powermail_fields__t.gif";s:4:"976c";s:39:"res/img/icon_tx_powermail_fieldsets.gif";s:4:"35ac";s:42:"res/img/icon_tx_powermail_fieldsets__h.gif";s:4:"ebeb";s:43:"res/img/icon_tx_powermail_fieldsets__ht.gif";s:4:"4f86";s:42:"res/img/icon_tx_powermail_fieldsets__t.gif";s:4:"14bb";s:35:"res/img/icon_tx_powermail_forms.gif";s:4:"80fe";s:38:"res/img/icon_tx_powermail_forms__h.gif";s:4:"b151";s:39:"res/img/icon_tx_powermail_forms__ht.gif";s:4:"f7e7";s:38:"res/img/icon_tx_powermail_forms__t.gif";s:4:"4893";s:35:"res/img/icon_tx_powermail_mails.gif";s:4:"fcba";s:38:"res/img/icon_tx_powermail_mails__h.gif";s:4:"2f4b";s:38:"res/img/icon_tx_powermail_mails__t.gif";s:4:"2f4b";s:20:"res/img/icon_xls.gif";s:4:"f031";s:23:"res/img/information.png";s:4:"3750";s:19:"res/img/loading.gif";s:4:"afe8";s:16:"res/img/next.gif";s:4:"d1d0";s:16:"res/img/next.png";s:4:"294d";s:18:"res/img/notice.png";s:4:"a882";s:14:"res/img/ok.png";s:4:"8bfe";s:16:"res/img/prev.gif";s:4:"b749";s:16:"res/img/prev.png";s:4:"305a";s:19:"res/img/warning.png";s:4:"c847";s:30:"res/js/Ext.grid.RowExpander.js";s:4:"77f8";s:30:"res/js/Ext.ux.form.DateTime.js";s:4:"c902";s:35:"res/js/Ext.ux.plugin.FitToParent.js";s:4:"bbd3";s:44:"res/js/Ext.ux.plugin.PagingToolbarResizer.js";s:4:"1af6";s:27:"res/js/powermail_backend.js";s:4:"c8a2";s:38:"res/less/powermail_frontend_basic.less";s:4:"267b";s:26:"static/css_basic/setup.txt";s:4:"cdec";s:30:"static/css_fancy/constants.txt";s:4:"735c";s:26:"static/css_fancy/setup.txt";s:4:"69d4";s:24:"static/pi1/constants.txt";s:4:"d0a5";s:20:"static/pi1/setup.txt";s:4:"fd46";s:23:"templates/tmpl_all.html";s:4:"2b61";s:32:"templates/tmpl_confirmation.html";s:4:"1d00";s:26:"templates/tmpl_emails.html";s:4:"b3cb";s:29:"templates/tmpl_fieldwrap.html";s:4:"a6dc";s:28:"templates/tmpl_formwrap.html";s:4:"4956";s:26:"templates/tmpl_frontend.js";s:4:"7c32";s:29:"templates/tmpl_mandatory.html";s:4:"8b61";s:30:"templates/tmpl_multiplejs.html";s:4:"a661";s:23:"templates/tmpl_thx.html";s:4:"d07f";}', 'suggests' => array( ), ); diff --git a/ext_localconf.php b/ext_localconf.php index fb3e62c6..293a5492 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -1,5 +1,5 @@ ajaxController'; +$TYPO3_CONF_VARS['FE']['eID_include']['tx_powermail::countryzones'] = t3lib_extMgm::extPath('powermail') . 'lib/class.tx_powermail_countryzones.php'; + $confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['powermail']); // Get backend config include_once(t3lib_extMgm::extPath('powermail') . 'lib/user_powermailOnCurrentPage.php'); // Conditions for JS including include_once(t3lib_extMgm::extPath('powermail') . 'lib/user_powermail_misc.php'); // Some powermail userFunc (Conditions if any further step) diff --git a/ext_tables.php b/ext_tables.php index a5ec5cc3..bbbd3087 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -1,5 +1,5 @@ array ( - 'title' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_fieldsets', - 'label' => 'title', - 'tstamp' => 'tstamp', - 'crdate' => 'crdate', +$GLOBALS['TCA']['tx_powermail_fieldsets'] = array( + 'ctrl' => array( + 'title' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_fieldsets', + 'label' => 'title', + 'tstamp' => 'tstamp', + 'crdate' => 'crdate', 'cruser_id' => 'cruser_id', 'versioningWS' => TRUE, 'origUid' => 't3_origuid', - 'languageField' => 'sys_language_uid', - 'transOrigPointerField' => 'l18n_parent', + 'languageField' => 'sys_language_uid', + 'transOrigPointerField' => 'l18n_parent', 'transOrigDiffSourceField' => 'l18n_diffsource', 'sortby' => 'sorting', 'default_sortby' => 'ORDER BY crdate', 'delete' => 'deleted', - 'enablecolumns' => array ( + 'enablecolumns' => array( 'disabled' => 'hidden', 'starttime' => 'starttime', 'endtime' => 'endtime' ), 'dynamicConfigFile' => $extPath . 'tca.php', - 'iconfile' => $extIconPath . 'icon_tx_powermail_fieldsets.gif', + 'iconfile' => $extIconPath . 'icon_tx_powermail_fieldsets.gif', ), - 'feInterface' => array ( + 'feInterface' => array( 'fe_admin_fieldList' => 'fe_group, form, title, felder, hidden', ) ); @@ -62,30 +62,30 @@ t3lib_extMgm::addToInsertRecords('tx_powermail_fields'); -$GLOBALS['TCA']['tx_powermail_fields'] = array ( - 'ctrl' => array ( - 'title' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_fields', +$GLOBALS['TCA']['tx_powermail_fields'] = array( + 'ctrl' => array( + 'title' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_fields', 'requestUpdate' => 'formtype', - 'label' => 'title', - 'tstamp' => 'tstamp', - 'crdate' => 'crdate', + 'label' => 'title', + 'tstamp' => 'tstamp', + 'crdate' => 'crdate', 'cruser_id' => 'cruser_id', 'versioningWS' => TRUE, 'origUid' => 't3_origuid', - 'languageField' => 'sys_language_uid', - 'transOrigPointerField' => 'l18n_parent', + 'languageField' => 'sys_language_uid', + 'transOrigPointerField' => 'l18n_parent', 'transOrigDiffSourceField' => 'l18n_diffsource', 'sortby' => 'sorting', 'delete' => 'deleted', - 'enablecolumns' => array ( + 'enablecolumns' => array( 'disabled' => 'hidden', 'starttime' => 'starttime', 'endtime' => 'endtime' ), 'dynamicConfigFile' => $extPath . 'tca.php', - 'iconfile' => $extIconPath . 'icon_tx_powermail_fields.gif', + 'iconfile' => $extIconPath . 'icon_tx_powermail_fields.gif', ), - 'feInterface' => array ( + 'feInterface' => array( 'fe_admin_fieldList' => 'fieldset, title, name, flexform, value, size, maxsize, max, min, step, pattern, placeholder, mandantory, more, fe_field, hidden', ) ); @@ -94,22 +94,22 @@ t3lib_extMgm::addToInsertRecords('tx_powermail_mails'); -$GLOBALS['TCA']['tx_powermail_mails'] = array ( - 'ctrl' => array ( - 'title' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails', - 'label' => 'sender', - 'tstamp' => 'tstamp', - 'crdate' => 'crdate', +$GLOBALS['TCA']['tx_powermail_mails'] = array( + 'ctrl' => array( + 'title' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails', + 'label' => 'sender', + 'tstamp' => 'tstamp', + 'crdate' => 'crdate', 'cruser_id' => 'cruser_id', 'default_sortby' => 'ORDER BY crdate DESC', 'delete' => 'deleted', - 'enablecolumns' => array ( + 'enablecolumns' => array( 'disabled' => 'hidden' ), 'dynamicConfigFile' => $extPath . 'tca.php', - 'iconfile' => $extIconPath . 'icon_tx_powermail_mails.gif', + 'iconfile' => $extIconPath . 'icon_tx_powermail_mails.gif', ), - 'feInterface' => array ( + 'feInterface' => array( 'fe_admin_fieldList' => 'formid, recipient, subject_r, sender, content, piVars, senderIP, UserAgent, Referer, SP_TZ, hidden', ) ); @@ -118,55 +118,55 @@ t3lib_extMgm::addPlugin( array( - 'LLL:EXT:powermail/locallang_db.xml:tt_content.CType_pi1', - $_EXTKEY . '_pi1', - $extRelPath . 'ext_icon.gif' + 'LLL:EXT:powermail/locallang_db.xml:tt_content.CType_pi1', + $_EXTKEY . '_pi1', + $extRelPath . 'ext_icon.gif' ), 'CType' ); -$tempColumns = Array ( - 'tx_powermail_title' => Array ( +$tempColumns = Array( + 'tx_powermail_title' => Array( 'exclude' => 1, 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.title', - 'config' => Array ( + 'config' => Array( 'type' => 'input', 'size' => '30', 'max' => '30', 'eval' => 'required,trim,lower,alphanum_x,nospace', ) ), - 'tx_powermail_recipient' => Array ( + 'tx_powermail_recipient' => Array( 'exclude' => 1, 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.recipient', - 'config' => Array ( + 'config' => Array( 'type' => 'text', 'cols' => '60', 'rows' => '2', ) ), - 'tx_powermail_subject_r' => Array ( + 'tx_powermail_subject_r' => Array( 'exclude' => 1, 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.subject_r', - 'config' => Array ( + 'config' => Array( 'type' => 'input', 'size' => '30', ) ), - 'tx_powermail_subject_s' => Array ( + 'tx_powermail_subject_s' => Array( 'exclude' => 1, 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.subject_s', - 'config' => Array ( + 'config' => Array( 'type' => 'input', 'size' => '30', ) ), - 'tx_powermail_sender' => Array ( + 'tx_powermail_sender' => Array( 'exclude' => 1, 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.sender', - 'config' => Array ( + 'config' => Array( 'type' => 'select', - 'items' => Array ( + 'items' => Array( Array('LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.recip_table.I.0', '0'), ), 'itemsProcFunc' => 'user_powermail_tx_powermail_forms_sender_field->main', @@ -174,10 +174,10 @@ 'maxitems' => 1, ) ), - 'tx_powermail_sendername' => Array ( + 'tx_powermail_sendername' => Array( 'exclude' => 1, 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.sendername', - 'config' => Array ( + 'config' => Array( 'type' => 'select', 'items' => array(), 'itemsProcFunc' => 'user_powermail_tx_powermail_forms_sender_field->main', @@ -185,50 +185,50 @@ 'maxitems' => 10, ) ), - 'tx_powermail_confirm' => Array ( + 'tx_powermail_confirm' => Array( 'exclude' => 1, 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.confirm', - 'config' => Array ( + 'config' => Array( 'type' => 'check', 'default' => 1, ) ), - 'tx_powermail_pages' => Array ( + 'tx_powermail_pages' => Array( 'exclude' => 1, 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.savemailstopage', - 'config' => Array ( + 'config' => Array( 'type' => 'group', 'internal_type' => 'db', 'allowed' => 'pages', 'size' => '1', 'maxitems' => '1', - 'minitems' => '0', + 'minitems' => '0', 'show_thumbs' => '1', - 'wizards' => array( - 'suggest' => array( - 'type' => 'suggest' - ) - ) + 'wizards' => array( + 'suggest' => array( + 'type' => 'suggest' + ) + ) ) ), - 'tx_powermail_multiple' => Array ( + 'tx_powermail_multiple' => Array( 'exclude' => 1, 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.multiple', - 'config' => Array ( - 'type' => 'select', - 'items' => array ( + 'config' => Array( + 'type' => 'select', + 'items' => array( Array('LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.multiple.I.0', '0'), Array('LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.multiple.I.1', '1'), Array('LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.multiple.I.2', '2'), ), ) ), - 'tx_powermail_recip_table' => Array ( + 'tx_powermail_recip_table' => Array( 'exclude' => 1, 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.recip_table', - 'config' => Array ( + 'config' => Array( 'type' => 'select', - 'items' => Array ( + 'items' => Array( Array('', '0'), ), 'itemsProcFunc' => 'user_powermail_tx_powermail_forms_recip_table->main', @@ -236,13 +236,13 @@ 'maxitems' => 1, ) ), - 'tx_powermail_recip_id' => Array ( + 'tx_powermail_recip_id' => Array( 'exclude' => 1, 'displayCond' => 'FIELD:tx_powermail_recip_table:REQ:true', 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.recip_id', - 'config' => Array ( + 'config' => Array( 'type' => 'select', - 'items' => Array ( + 'items' => Array( ), 'itemsProcFunc' => 'user_powermail_tx_powermail_forms_recip_id->main', 'size' => 5, @@ -250,40 +250,40 @@ 'allowNonIdValues' => 1, ) ), - 'tx_powermail_thanks' => Array ( + 'tx_powermail_thanks' => Array( 'exclude' => 1, 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.thanks', - 'config' => Array ( + 'config' => Array( 'type' => 'text', 'cols' => '60', 'rows' => '2', 'default' => '###POWERMAIL_ALL###', ) ), - 'tx_powermail_mailsender' => Array ( + 'tx_powermail_mailsender' => Array( 'exclude' => 1, 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.mailsender', - 'config' => Array ( + 'config' => Array( 'type' => 'text', 'cols' => '60', 'rows' => '2', 'default' => '###POWERMAIL_ALL###', ) ), - 'tx_powermail_mailreceiver' => Array ( + 'tx_powermail_mailreceiver' => Array( 'exclude' => 1, 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.mailreceiver', - 'config' => Array ( + 'config' => Array( 'type' => 'text', 'cols' => '60', 'rows' => '2', 'default' => '###POWERMAIL_ALL###', ) ), - 'tx_powermail_redirect' => Array ( + 'tx_powermail_redirect' => Array( 'exclude' => 1, 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.redirect', - 'config' => Array ( + 'config' => Array( 'type' => 'input', 'size' => '30', 'wizards' => Array( @@ -298,16 +298,16 @@ ), ) ), - 'user_powermail_updateError' => Array ( + 'user_powermail_updateError' => Array( 'label' => 'Powermail error', - 'config' => Array ( + 'config' => Array( 'type' => 'user', 'userFunc' => 'user_powermail_updateError->user_updateError' ) ), 'tx_powermail_fieldsets' => Array( 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.fieldsets', - 'config' => Array ( + 'config' => Array( 'type' => 'inline', 'foreign_table' => 'tx_powermail_fieldsets', 'foreign_field' => 'tt_content', @@ -331,32 +331,32 @@ ), ) ), - 'tx_powermail_users' => Array ( + 'tx_powermail_users' => Array( 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.users', - 'config' => Array ( + 'config' => Array( 'type' => 'passthrough' ) ), - 'tx_powermail_preview' => Array ( + 'tx_powermail_preview' => Array( 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.preview', - 'config' => Array ( + 'config' => Array( 'type' => 'user', 'userFunc' => 'user_powermail_tx_powermail_forms_preview->main', ) ), ); - // If db-storing is disabled, clear tx_powermail_pages +// If db-storing is disabled, clear tx_powermail_pages if ($confArr['disableBackendModule'] == 1) { unset($tempColumns['tx_powermail_pages']); } - // If preview window is deactivated, clear tx_powermail_preview +// If preview window is deactivated, clear tx_powermail_preview if ($confArr['usePreview'] != 1) { unset($tempColumns['tx_powermail_preview']); } - // If settings for powermail found in localconf, clear user_powermail_updateError +// If settings for powermail found in localconf, clear user_powermail_updateError if (strlen($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['powermail']) > 1) { unset($tempColumns['user_powermail_updateError']); } @@ -373,17 +373,7 @@ --div--;LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.div5, tx_powermail_thanks;;;richtext:rte_transform[mode=ts], tx_powermail_redirect, --div--;LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.div8, starttime, endtime, fe_group'; -/* - // If preview window is deactivated, clear tx_powermail_preview -if ($confArr['usePreview'] != 1) { - $GLOBALS['TCA']['tt_content']['types'][$_EXTKEY . '_pi1']['showitem'] = str_replace('tx_powermail_preview,', '', $GLOBALS['TCA']['tt_content']['types'][$_EXTKEY . '_pi1']['showitem']); -} - -if ($confArr['disableDBStorage'] == 1) { - $GLOBALS['TCA']['tt_content']['types'][$_EXTKEY . '_pi1']['showitem'] = str_replace('tx_powermail_preview,', '', $GLOBALS['TCA']['tt_content']['types'][$_EXTKEY . '_pi1']['showitem']); -} -*/ - // Add "tx_powermail_recip_table" to the requestUpdate +// Add "tx_powermail_recip_table" to the requestUpdate $GLOBALS['TCA']['tt_content']['ctrl']['requestUpdate'] .= $GLOBALS['TCA']['tt_content']['ctrl']['requestUpdate'] ? ',tx_powermail_recip_table' : 'tx_powermail_recip_table'; if (TYPO3_MODE == 'BE') { diff --git a/lib/class.tx_powermail_countryzones.php b/lib/class.tx_powermail_countryzones.php index 1a445183..71051dc5 100644 --- a/lib/class.tx_powermail_countryzones.php +++ b/lib/class.tx_powermail_countryzones.php @@ -1,175 +1,90 @@ -* All rights reserved -* -* This script is part of the TYPO3 project. The TYPO3 project is -* free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* The GNU General Public License can be found at -* http://www.gnu.org/copyleft/gpl.html. -* -* This script is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* This copyright notice MUST APPEAR in all copies of the script! -***************************************************************/ + * Copyright notice + * + * (c) 2011 powermail development team (details on http://forge.typo3.org/projects/show/extension-powermail) + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + + +if (!defined('PATH_typo3conf')) die ('Could not access this script directly!'); require_once(PATH_tslib . 'class.tslib_pibase.php'); -require_once(t3lib_extMgm::extPath('powermail') . 'lib/class.tx_powermail_dynamicmarkers.php'); // file for dynamicmarker functions -// This class saves powermail values in OTHER db tables if wanted (this class is not the main database class for storing) class tx_powermail_countryzones extends tslib_pibase { - var $extKey = 'powermail'; - var $scriptRelPath = 'pi1/class.tx_powermail_pi1.php'; // Path to pi1 to get locallang.xml from pi1 folder - var $prefixId = 'tx_powermail_pi1'; // Same as class name - var $add = 100000; // workarround: add this number to countryselector uid for countryzone uid - - - // Function preflight() prepares xajax use for countryzone selector - function preflight($uid, $xml, &$markerArray, &$tmpl, $formtitle, $conf, $piVars, $cObj) { - // config - $this->tmpl = &$tmpl; // Template string - $this->conf = $conf; // conf from ts - $this->cObj = $cObj; // cObj - $this->xml = $xml; // Flexform XML - $this->piVars = &$piVars; // piVars - $this->uid = $uid; // current field uid - $this->formtitle = $formtitle; // form id - $this->dynamicMarkers = t3lib_div::makeInstance('tx_powermail_dynamicmarkers'); // New object: TYPO3 marker function - $this->markerArray = &$markerArray; // marker Array - - // let's go - if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'countryzone')) { // if in backend selected - - // Load xajax file - if (t3lib_extMgm::isLoaded('xajax', 0) && !class_exists('tx_xajax')) { // if xajax extension is loaded and if class "tx_xajax" don't exists yet - require_once (t3lib_extMgm::extPath('xajax') . 'class.tx_xajax.php'); // load xajax file - } - - // let's go - if (class_exists('tx_xajax')) { // make available if xajax is loaded - # make XAJAX available - $this->xajax = t3lib_div::makeInstance('tx_xajax'); - $this->xajax->decodeUTF8InputOn(); - $this->xajax->setCharEncoding('utf-8'); - $this->xajax->setWrapperPrefix($this->prefixId); - $this->xajax->statusMessagesOn(); - $this->xajax->debugOff(); - - // Register all my functions - $this->xajax->registerFunction(array('addZoneSelector', &$this, 'addZoneSelector')); - - // Return to HTML header - $this->xajax->processRequests(); - $GLOBALS['TSFE']->additionalHeaderData[$this->prefixId] = $this->xajax->getJavascript(t3lib_extMgm::siteRelPath('xajax')); - - // Insert code of zone selector via php (if preselected country or in session) - if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'preselect') > 0 && empty($this->piVars['uid' . ($this->uid + $this->add)])) { // if there is a country preselected and no other country chosen meanwhile - $this->tmpl['html_countryselect']['all'] = str_replace('
', '
' . $this->codeForZoneSelector($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'preselect'), '') . '
', $this->tmpl['html_countryselect']['all']); // add countryzoneselector code to html template - } - if (!empty($this->piVars['uid' . ($this->uid + $this->add)])) { // if there is already a value in the session for countryzoneselect - $this->tmpl['html_countryselect']['all'] = str_replace('
', '
' . $this->codeForZoneSelector(0, $this->piVars['uid' . $this->uid]) . '
', $this->tmpl['html_countryselect']['all']); // add countryzoneselector code to html template - } - - $this->markerArray['###JS###'] = 'onchange="tx_powermail_pi1addZoneSelector(this.value);"'; - - } - } - - } - + public function main($data) { + //$value = 'DE'; + $value = $data['iso2']; + $content = array(); + $content[] = array('id' => intval(str_replace('uid', '', $data['uid']))); + tslib_eidtools::connectDB(); //Connect to database - // Function addZoneSelector() adds zone selectorbox to countryselectorbox via AJAX - function addZoneSelector($value) { - // config - $objResponse = t3lib_div::makeInstance('tx_xajax_response'); - - // return - $objResponse->addClear('powermail_countryzoneselect' . $this->uid, 'innerHTML'); // clear div container vor selector box - if ($this->codeForZoneSelector(0, $value)) $objResponse->addAppend('powermail_countryzoneselect' . $this->uid, 'innerHTML', $this->codeForZoneSelector(0, $value)); // add new content // if there are results - - return $objResponse->getXML(); // return xml für javascript - } - - - // Function codeForZoneSelector() only generates code for zoneselctorbox - function codeForZoneSelector($uid = 0, $value = '') { - // config - $value = preg_replace('/[^\sa-zA-Z0-9]/', '', $value); // allow only letters, numbers and space - $this->tmpl['html_countryzoneselect']['all'] = tslib_cObj::getSubpart($this->tmpl['all'], '###POWERMAIL_FIELDWRAP_HTML_COUNTRYZONESELECT###'); // work on subpart 1 - $this->tmpl['html_countryzoneselect']['item'] = tslib_cObj::getSubpart($this->tmpl['html_countryzoneselect']['all'], '###ITEM###'); // work on subpart 2 - $content_item = ''; $markerArray = array(); $outerMarkerArray = array(); $i=0; - - // change markers of countryzoneselect - $outerMarkerArray['###NAME###'] = 'name="' . $this->prefixId . '[uid' . ($this->add + $this->uid) . ']" '; // name in markerArray tx_powermail_pi1[55][1] - $outerMarkerArray['###ID###'] = 'id="uid' . ($this->add + $this->uid) . '" '; // id in markerArray uid55_1 - $outerMarkerArray['###CLASS###'] = str_replace($this->uid, ($this->add + $this->uid), $this->markerArray['###CLASS###']); // change class="... uid55" -> class="... uid100055" - - // where clause - if ($uid==0) { - $where_clause = 'static_countries.cn_iso_2 = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($value); - $where_clause .= ' OR static_countries.cn_iso_3 = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($value); - $where_clause .= ' OR static_countries.cn_short_en = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($value); // where clause if value of country given + $res1 = $GLOBALS['TYPO3_DB']->exec_SELECTquery( + 'tt_content.uid', + 'tx_powermail_fields LEFT JOIN tt_content ON tx_powermail_fields.pid = tt_content.pid', + 'tx_powermail_fields.uid = ' . $content[0]['id'] + ); + + if ($res1 !== false) { + $row1 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res1); + $TSFE = tslib_eidtools::initFeUser(); + $sessionvars = $TSFE->getKey('ses', 'powermail_' . $row1['uid']); + $content[0]['selected'] = $sessionvars['uid' . (100000 + $content[0]['id'])]; + $GLOBALS['TYPO3_DB']->sql_free_result($res1); } - else $where_clause = 'static_countries.uid = "' . intval($uid) . '"'; // where clause if uid of country given - - // select - $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery ( - '*', + + $where_clause = 'static_countries.cn_iso_2 = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($value); + $where_clause .= ' OR static_countries.cn_iso_3 = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($value); + $where_clause .= ' OR static_countries.cn_short_en = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($value); // where clause if value of country given + + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( + 'zn_code, zn_name_local', 'static_countries LEFT JOIN static_country_zones ON static_countries.cn_iso_2 = static_country_zones.zn_country_iso_2', $where_clause, $groupBy = '', - $orderBy = 'static_country_zones.zn_code', + $orderBy = 'static_country_zones.zn_name_local', $limit = '' ); - if ($res) { // If there is a result + + if ($res !== false) { // If there is a result while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { // One loop for every country_zone - // markers - - // old fill - $markerArray['###LONGVALUE###'] = $row['zn_name_local']; // Name of state - $markerArray['###VALUE###'] = $row['zn_code']; // Shortage of state - - //new fill - foreach ((array) $row as $key => $value) { // one loop for every field in the database - if (!empty($value)) { // if value is not empty - $markerArray['###' . strtoupper($key) . '###'] = $value; // write value to marker - } - } - - if ($this->piVars['uid' . ($this->uid + $this->add)] == $row['zn_code'] || $this->piVars['uid' . ($this->uid + $this->add)] == $row['zn_name_local']) { - $markerArray['###SELECTED###'] = ' selected="selected"'; // preselect one countryzone - } else { - $markerArray['###SELECTED###'] = ''; // clear selected marker - } - - // add code - $content_item .= $this->cObj->substituteMarkerArrayCached($this->tmpl['html_countryzoneselect']['item'], $markerArray); - $i++; + $content[] = array('zn_code' => $row['zn_code'], 'zn_name_local' => $row['zn_name_local']); + } + $GLOBALS['TYPO3_DB']->sql_free_result($res); + if ($content[1]['zn_code'] == null) { + $content[0]['selected'] = ''; + unset($sessionvars['uid' . (10000 + $content[0]['id'])]); + $TSFE->setKey('ses', 'powermail_' . $row1['uid'], $sessionvars); + $TSFE->storeSessionData(); } } - $subpartArray['###CONTENT###'] = $content_item; // subpart 3 - - $content = $this->cObj->substituteMarkerArrayCached($this->tmpl['html_countryzoneselect']['all'], $outerMarkerArray, $subpartArray); // substitute Marker in Template - $content = $this->dynamicMarkers->main($this->conf, $this->cObj, $content); // Fill dynamic locallang or typoscript markers - $content = preg_replace('|###.*?###|i', '', $content); // Finally clear not filled markers - - if ($i > 1) return $content; // only if there are results - else return false; + + return $content; } - } -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.tx_powermail_countryzones.php']) { +$output = t3lib_div::makeInstance('tx_powermail_countryzones'); +$response = $output->main(t3lib_div::_GET()); +echo json_encode($response); + +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.tx_powermail_countryzones.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.tx_powermail_countryzones.php']); } diff --git a/lib/class.tx_powermail_db.php b/lib/class.tx_powermail_db.php index bd2084fc..59841aa6 100644 --- a/lib/class.tx_powermail_db.php +++ b/lib/class.tx_powermail_db.php @@ -1,29 +1,29 @@ conf['dbEntry.'][$key] as $kk => $vv) { // One loop for every field to insert in current table if (substr($kk, 0, 1) != '_' && substr($kk, -1) != '.') { // if fieldname is not _enable or _mm and not with . at the end - if ($this->fieldExists($kk, str_replace('.','',$key))) { // if db table and field exists - $this->db_values[$key][$kk] = $this->cObj->cObjGetSingle($this->conf['dbEntry.'][$key][$kk], $this->conf['dbEntry.'][$key][$kk.'.']); // write current TS value to array + if ($this->fieldExists($kk, str_replace('.', '', $key))) { // if db table and field exists + $this->db_values[$key][$kk] = $this->cObj->cObjGetSingle($this->conf['dbEntry.'][$key][$kk], $this->conf['dbEntry.'][$key][$kk . '.']); // write current TS value to array } } @@ -98,7 +98,7 @@ public function main($conf, $sessiondata, $cObj, $ok) { is_numeric($this->cObj->cObjGetSingle($this->conf['dbEntry.'][$key]['_mm.'][$kkk]['3'], $this->conf['dbEntry.'][$key]['_mm.'][$kkk]['3.'])) ) { // 1. is db table && 2. is db table && 3. is a number if ($this->uid[str_replace('.', '', $key)] > 0) { // if uid_local exists - $this->db_values_mm[$key] = array ( + $this->db_values_mm[$key] = array( 'uid_local' => $this->uid[str_replace('.', '', $key)], 'uid_foreign' => $this->cObj->cObjGetSingle($this->conf['dbEntry.'][$key]['_mm.'][$kkk]['3'], $this->conf['dbEntry.'][$key]['_mm.'][$kkk]['3.']) ); @@ -127,22 +127,23 @@ public function main($conf, $sessiondata, $cObj, $ok) { private function dbUpdate($table, $values) { if (count($values) > 0) { // if there are values - if (!isset($this->conf['dbEntry.'][$table.'.']['_ifUnique.']) || $this->conf['dbEntry.'][$table.'.']['_ifUnique.'] == 'disable') { // no unique values + if (!isset($this->conf['dbEntry.'][$table . '.']['_ifUnique.']) || $this->conf['dbEntry.'][$table . '.']['_ifUnique.'] == 'disable') { // no unique values if ($this->dbInsert) { // if allowed $GLOBALS['TYPO3_DB']->exec_INSERTquery($table, $values); // DB entry for every table - $this->uid[$table] = $GLOBALS['TYPO3_DB']->sql_insert_id(); + $this->uid[$table] = $GLOBALS['TYPO3_DB']->sql_insert_id(); } } else { // unique values - $uniqueField = key($this->conf['dbEntry.'][$table.'.']['_ifUnique.']); // get first entry of this array - $mode = $this->conf['dbEntry.'][$table.'.']['_ifUnique.'][$uniqueField]; // mode could be "none" or "update" + $uniqueField = key($this->conf['dbEntry.'][$table . '.']['_ifUnique.']); // get first entry of this array + $mode = $this->conf['dbEntry.'][$table . '.']['_ifUnique.'][$uniqueField]; // mode could be "none" or "update" if ($this->fieldExists('uid', $table)) { // check if field uid exists in table - $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery ( // get uid of existing value + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( // get uid of existing value 'uid', $table, - $where_clause = $uniqueField . ' = "'.$this->cObj->cObjGetSingle($this->conf['dbEntry.'][$table.'.'][$uniqueField], $this->conf['dbEntry.'][$table.'.'][$uniqueField.'.']).'"' . ($this->fieldExists('deleted', $table) ? ' AND deleted = 0' : ''), + $where_clause = $uniqueField . ' = "' . $this->cObj->cObjGetSingle($this->conf['dbEntry.'][$table . '.'][$uniqueField], $this->conf['dbEntry.'][$table . '.'][$uniqueField . '.']) . '"' . ($this->fieldExists('deleted', $table) + ? ' AND deleted = 0' : ''), $groupBy = '', $orderBy = '', $limit = 1 @@ -154,7 +155,7 @@ private function dbUpdate($table, $values) { switch ($mode) { case 'update': // mode is update $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid = ' . intval($row['uid']), $values); // update old entry with new values - // Make row uid global + // Make row uid global $this->uid[$table] = $row['uid']; break; @@ -164,17 +165,12 @@ private function dbUpdate($table, $values) { $this->db_values = 'Entry already exists, won\'t be overwritten'; break; } - } else { // there is no entry in the database - $GLOBALS['TYPO3_DB']->exec_INSERTquery($table, $values); // New DB entry $this->uid[$table] = $GLOBALS['TYPO3_DB']->sql_insert_id(); // Get uid of current db entry - } - } } - } /** @@ -187,25 +183,25 @@ private function dbUpdate($table, $values) { private function fieldExists($field = '', $table = '') { if (!empty($field) && !empty($table) && strpos($field, ".") === false) { // check if table and field exits in db - $res1 = $GLOBALS['TYPO3_DB']->sql_query('SHOW TABLES LIKE "' . $table . '"'); + $res1 = $GLOBALS['TYPO3_DB']->sql_query('SHOW TABLES LIKE "' . $table . '"'); $row1 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res1); // check if table exist if ($row1 !== false) { - $res2 = $GLOBALS['TYPO3_DB']->sql_query('DESCRIBE ' . $table . ' ' . $field); + $res2 = $GLOBALS['TYPO3_DB']->sql_query('DESCRIBE ' . $table . ' ' . $field); $row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res2); // check if field exist (if table is wrong - error message) - // debug values - if ($row2 === false) { - $this->debug_array['ERROR'][] = 'Field "' . $field . '" don\'t exists in db table "' . $table . '"'; // error message if field don't exits - } + // debug values + if ($row2 === false) { + $this->debug_array['ERROR'][] = 'Field "' . $field . '" don\'t exists in db table "' . $table . '"'; // error message if field don't exits + } } else { - $this->debug_array['ERROR'][] = 'Table "' . $table . '" don\'t exists in db'; // error message if table don't exits - } - $GLOBALS['TYPO3_DB']->sql_free_result($res1); - $GLOBALS['TYPO3_DB']->sql_free_result($res2); + $this->debug_array['ERROR'][] = 'Table "' . $table . '" don\'t exists in db'; // error message if table don't exits + } + $GLOBALS['TYPO3_DB']->sql_free_result($res1); + $GLOBALS['TYPO3_DB']->sql_free_result($res2); // return true if field and table exists return ($row1 && $row2); } else { - return false; - } + return false; + } } /** @@ -227,18 +223,17 @@ private function debug() { * @return void */ private function hook_AfterDbImport() { - if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_AfterDbImportHook'])) { // Adds hook for processing - foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_AfterDbImportHook'] as $_classRef) { - $_procObj = &t3lib_div::getUserObj($_classRef); - $_procObj->PM_AfterDbImportHook($this); // Get new marker Array from other extensions - } - } - } + if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_AfterDbImportHook'])) { // Adds hook for processing + foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_AfterDbImportHook'] as $_classRef) { + $_procObj = &t3lib_div::getUserObj($_classRef); + $_procObj->PM_AfterDbImportHook($this); // Get new marker Array from other extensions + } + } + } } -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.tx_powermail_db.php']) { +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.tx_powermail_db.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.tx_powermail_db.php']); } - ?> \ No newline at end of file diff --git a/lib/class.tx_powermail_dynamicmarkers.php b/lib/class.tx_powermail_dynamicmarkers.php index 766292de..5d96f070 100644 --- a/lib/class.tx_powermail_dynamicmarkers.php +++ b/lib/class.tx_powermail_dynamicmarkers.php @@ -2,7 +2,7 @@ /*************************************************************** * Copyright notice * -* (c) 2007 Alexander Kellner, Mischa Hei�mann +* (c) 2010 powermail development team (details on http://forge.typo3.org/projects/show/extension-powermail) * All rights reserved * * This script is part of the TYPO3 project. The TYPO3 project is diff --git a/lib/class.tx_powermail_functions_div.php b/lib/class.tx_powermail_functions_div.php index e5a636b1..bf94652e 100644 --- a/lib/class.tx_powermail_functions_div.php +++ b/lib/class.tx_powermail_functions_div.php @@ -1,26 +1,26 @@ -* All rights reserved -* -* This script is part of the TYPO3 project. The TYPO3 project is -* free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* The GNU General Public License can be found at -* http://www.gnu.org/copyleft/gpl.html. -* -* This script is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* This copyright notice MUST APPEAR in all copies of the script! -***************************************************************/ + * Copyright notice + * + * (c) 2010 powermail development team (details on http://forge.typo3.org/projects/show/extension-powermail) + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ -require_once(PATH_tslib.'class.tslib_pibase.php'); +require_once(PATH_tslib . 'class.tslib_pibase.php'); // This class offers geoip datas if available from extension geoip class tx_powermail_geoip extends tslib_pibase { var $extKey = 'powermail'; - var $scriptRelPath = 'pi1/class.tx_powermail_pi1.php'; // Path to pi1 to get locallang.xml from pi1 folder + var $scriptRelPath = 'pi1/class.tx_powermail_pi1.php'; // Path to pi1 to get locallang.xml from pi1 folder var $ipOverride = false; + //var $ipOverride = '83.236.183.130';// set a hardcoded user ip (only for testing) - + // Main Function for inserting datas to other tables function main($conf) { $this->conf = $conf; $this->getGeo(); // Get geo info - + if (count($this->GEOinfos) > 0) return $this->GEOinfos; } - + // Get info from geoip extension function getGeo() { // use geo ip if loaded if (t3lib_extMgm::isLoaded('geoip')) { - require_once( t3lib_extMgm::extPath('geoip').'/pi1/class.tx_geoip_pi1.php'); + require_once(t3lib_extMgm::extPath('geoip') . '/pi1/class.tx_geoip_pi1.php'); $this->media = t3lib_div::makeInstance('tx_geoip_pi1'); - + if ($this->conf['geoip.']['file']) { // only if file for geoip is set $this->media->init($this->conf['geoip.']['file']); // Initialize the geoip Ext $this->GEOinfos = $this->media->getGeoIP($this->ipOverride ? $this->ipOverride : t3lib_div::getIndpEnv('REMOTE_ADDR')); // get all the infos of current user ip } } - + } - + } -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.tx_powermail_geoip.php']) { +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.tx_powermail_geoip.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.tx_powermail_geoip.php']); } - ?> \ No newline at end of file diff --git a/lib/class.tx_powermail_markers.php b/lib/class.tx_powermail_markers.php index 30401fe7..e34683ea 100644 --- a/lib/class.tx_powermail_markers.php +++ b/lib/class.tx_powermail_markers.php @@ -83,13 +83,18 @@ public function GetMarkerArray($conf, $sessionfields, $cObj, $what = '') { ); if ($res !== false) { + $orderedSessionData = array(); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)){ if ($this->sessiondata['uid' . $row['uid']] != "") { $orderedSessionData['uid' . $row['uid']] = $this->sessiondata['uid' . $row['uid']]; + if (isset($this->sessiondata['uid' . ($row['uid'] + 100000)])) { // handle session var with offset of 100000 as countryzone + $orderedSessionData['uid' . ($row['uid'] + 100000)] = $this->sessiondata['uid' . ($row['uid'] + 100000)]; + unset($this->sessiondata['uid' . $row['uid'] + 100000]); + } } - unset($this->sessiondata['uid' . $row['uid']]); + unset($this->sessiondata['uid' . $row['uid']]); } - $this->sessiondata = array_merge((array) $orderedSessionData, $this->sessiondata); + $this->sessiondata = array_merge($orderedSessionData, $this->sessiondata); $GLOBALS['TYPO3_DB']->sql_free_result($res); } @@ -210,6 +215,23 @@ private function setLabelAndType() { if ($row !== false) { $this->label = $this->div->parseFunc($row['title'], $this->cObj, $this->conf['label.']['parse']); // set label to title $this->type = $row['formtype']; // set type to formtype + } else { + // if no result found, check for country zone select + $res2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery ( + 'tx_powermail_fields.title, tx_powermail_fields.formtype', + 'tx_powermail_fields + LEFT JOIN tx_powermail_fieldsets ON tx_powermail_fields.fieldset = tx_powermail_fieldsets.uid + LEFT JOIN tt_content ON tt_content.uid = tx_powermail_fieldsets.tt_content', + 'tx_powermail_fields.uid = ' . (intval(str_replace('uid', '', $this->label)) - 100000) + ); + $row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res2); + if ($row2 !== false) { + $this->LOCAL_LANG_loaded = 0; + $this->pi_loadLL(); + $this->label = sprintf($this->pi_getLL('country_zone_of', 'State of %s'), $this->div->parseFunc($row2['title'], $this->cObj, $this->conf['label.']['parse'])); + $this->type = 'select'; + $GLOBALS['TYPO3_DB']->sql_free_result($res2); + } } $GLOBALS['TYPO3_DB']->sql_free_result($res); } diff --git a/lib/class.tx_powermail_removexss.php b/lib/class.tx_powermail_removexss.php deleted file mode 100644 index 6fc1c794..00000000 --- a/lib/class.tx_powermail_removexss.php +++ /dev/null @@ -1,93 +0,0 @@ - - * @package RemoveXSS - */ -class tx_powermail_removexss { - - /** - * Wrapper for the RemoveXSS function. - * Removes potential XSS code from an input string. - * - * Using an external class by Travis Puderbaugh - * - * @param string Input string - * @return string Input string with potential XSS code removed - */ - function RemoveXSS($val) { - // remove all non-printable characters. CR(0a) and LF(0b) and TAB(9) are allowed - // this prevents some character re-spacing such as - // note that you have to handle splits with \n, \r, and \t later since they *are* allowed in some inputs - $val = preg_replace('/([\x00-\x08][\x0b-\x0c][\x0e-\x20])/', '', $val); - - // straight replacements, the user should never need these since they're normal characters - // this prevents like - $search = 'abcdefghijklmnopqrstuvwxyz'; - $search.= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; - $search.= '1234567890!@#$%^&*()'; - $search.= '~`";:?+/={}[]-_|\'\\'; - - for ($i = 0; $i < strlen($search); $i++) { - // ;? matches the ;, which is optional - // 0{0,7} matches any padded zeros, which are optional and go up to 8 chars - - // @ @ search for the hex values - $val = preg_replace('/(&#[x|X]0{0,8}'.dechex(ord($search[$i])).';?)/i', $search[$i], $val); // with a ; - // @ @ 0{0,7} matches '0' zero to seven times - $val = preg_replace('/(�{0,8}'.ord($search[$i]).';?)/', $search[$i], $val); // with a ; - } - - // now the only remaining whitespace attacks are \t, \n, and \r - $ra1 = array('javascript', 'vbscript', 'expression', 'applet', 'meta', 'xml', 'blink', 'link', 'style', 'script', 'embed', 'object', 'iframe', 'frame', 'frameset', 'ilayer', 'layer', 'bgsound', 'title', 'base'); - $ra2 = array('onabort', 'onactivate', 'onafterprint', 'onafterupdate', 'onbeforeactivate', 'onbeforecopy', 'onbeforecut', 'onbeforedeactivate', 'onbeforeeditfocus', 'onbeforepaste', 'onbeforeprint', 'onbeforeunload', 'onbeforeupdate', 'onblur', 'onbounce', 'oncellchange', 'onchange', 'onclick', 'oncontextmenu', 'oncontrolselect', 'oncopy', 'oncut', 'ondataavailable', 'ondatasetchanged', 'ondatasetcomplete', 'ondblclick', 'ondeactivate', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'onerror', 'onerrorupdate', 'onfilterchange', 'onfinish', 'onfocus', 'onfocusin', 'onfocusout', 'onhelp', 'onkeydown', 'onkeypress', 'onkeyup', 'onlayoutcomplete', 'onload', 'onlosecapture', 'onmousedown', 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onmove', 'onmoveend', 'onmovestart', 'onpaste', 'onpropertychange', 'onreadystatechange', 'onreset', 'onresize', 'onresizeend', 'onresizestart', 'onrowenter', 'onrowexit', 'onrowsdelete', 'onrowsinserted', 'onscroll', 'onselect', 'onselectionchange', 'onselectstart', 'onstart', 'onstop', 'onsubmit', 'onunload'); - $ra = array_merge($ra1, $ra2); - - $found = true; // keep replacing as long as the previous round replaced something - while ($found == true) { - $val_before = $val; - for ($i = 0; $i < sizeof($ra); $i++) { - $pattern = '/'; - for ($j = 0; $j < strlen($ra[$i]); $j++) { - if ($j > 0) { - $pattern .= '('; - $pattern .= '(&#[x|X]0{0,8}([9][a][b]);?)?'; - $pattern .= '|(�{0,8}([9][10][13]);?)?'; - $pattern .= ')?'; - } - $pattern .= $ra[$i][$j]; - } - $pattern .= '/i'; - $replacement = substr($ra[$i], 0, 2).''.substr($ra[$i], 2); // add in <> to nerf the tag - $val = preg_replace($pattern, $replacement, $val); // filter out the hex tags - if ($val_before == $val) { - // no replacements were made, so exit the loop - $found = false; - } - } - } - - return $val; - } -} - -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.tx_powermail_removexss.php']) { - include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.tx_powermail_removexss.php']); -} - -?> \ No newline at end of file diff --git a/lib/class.tx_powermail_sessions.php b/lib/class.tx_powermail_sessions.php index 62f57fb9..d3b30ec3 100644 --- a/lib/class.tx_powermail_sessions.php +++ b/lib/class.tx_powermail_sessions.php @@ -1,26 +1,26 @@ -* All rights reserved -* -* This script is part of the TYPO3 project. The TYPO3 project is -* free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* The GNU General Public License can be found at -* http://www.gnu.org/copyleft/gpl.html. -* -* This script is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* This copyright notice MUST APPEAR in all copies of the script! -***************************************************************/ + * Copyright notice + * + * (c) 2011 powermail development team (details on http://forge.typo3.org/projects/show/extension-powermail) + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ require_once(PATH_tslib.'class.tslib_pibase.php'); require_once(t3lib_extMgm::extPath('powermail').'lib/class.tx_powermail_functions_div.php'); // file for div functions @@ -56,7 +56,7 @@ function setSession($conf, $piVars, $cObj, $overwrite = 1) { $piVars = $this->urldecodeArrayRecursive($piVars); // Set Session (overwrite all values) - $GLOBALS['TSFE']->fe_user->setKey('ses', $this->extKey.'_'.($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']), $piVars); // Generate Session with piVars array + $GLOBALS['TSFE']->fe_user->setKey('ses', $this->extKey . '_' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']), $piVars); // Generate Session with piVars array $GLOBALS['TSFE']->storeSessionData(); // Save session } } @@ -73,7 +73,7 @@ protected function urldecodeArrayRecursive(array $dataArray) { foreach ($dataArray as $key => $val) { if (is_array($val)){ $this->urldecodeArrayRecursive($val); - }else { + } else { $val = rawurldecode($val); } @@ -90,12 +90,12 @@ function getSession($conf, $cObj, $all = 1) { $this->cObj = $cObj; // start - $piVars = $GLOBALS['TSFE']->fe_user->getKey('ses', $this->extKey.'_'.($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid'])); // Get piVars from Session + $piVars = $GLOBALS['TSFE']->fe_user->getKey('ses', $this->extKey . '_' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid'])); // Get piVars from Session if ($all == 0) { // delete not allowed values from piVars if (isset($piVars) && is_array($piVars)) { foreach($piVars as $key => $value) { // one loop for every piVar - if (!is_numeric(str_replace('uid','',$key)) && !in_array($key, $this->extendedSessionValues)) { // all values which are not like uid3 && Not especially values + if (!is_numeric(str_replace('uid', '', $key)) && !in_array($key, $this->extendedSessionValues)) { // all values which are not like uid3 && Not especially values unset($piVars[$key]); // delete current value (like mailID or sendnow) } } @@ -114,20 +114,20 @@ function deleteSession($conf, $cObj, $uid) { if (!is_array($uid)) { // is not an array if ($uid == -1) { // delete all - $GLOBALS['TSFE']->fe_user->setKey('ses', $this->extKey.'_'.($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']), array()); // Overwrite Session with empty array + $GLOBALS['TSFE']->fe_user->setKey('ses', $this->extKey . '_' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']), array()); // Overwrite Session with empty array $GLOBALS['TSFE']->storeSessionData(); // Save session } elseif ($uid > 0) { // delete only one value from session $oldPiVars = $this->getSession($this->conf, $this->cObj); // Get all old piVars from Session - $oldvalue = $oldPiVars['uid'.$uid]; // filename + $oldvalue = $oldPiVars['uid' . $uid]; // filename if (count($oldPiVars['FILE']) > 0) { // if there are values in the FILE array foreach ($oldPiVars['FILE'] as $key => $value) { // one loop for every file in array if ($value == $oldvalue) unset($oldPiVars['FILE'][$key]); // delete FILE array value } } unset($oldPiVars['uid'.$uid]); // Delete one uid - $GLOBALS['TSFE']->fe_user->setKey('ses', $this->extKey.'_'.($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']), $oldPiVars); // Overwrite Session with array + $GLOBALS['TSFE']->fe_user->setKey('ses', $this->extKey . '_' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']), $oldPiVars); // Overwrite Session with array $GLOBALS['TSFE']->storeSessionData(); // Save session } @@ -137,7 +137,7 @@ function deleteSession($conf, $cObj, $uid) { foreach ($uid as $key => $value) { unset($oldPiVars['FILE'][$key]); // delete FILE array value } - $GLOBALS['TSFE']->fe_user->setKey('ses', $this->extKey.'_'.($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']), $oldPiVars); // Overwrite Session with array + $GLOBALS['TSFE']->fe_user->setKey('ses', $this->extKey . '_' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']), $oldPiVars); // Overwrite Session with array $GLOBALS['TSFE']->storeSessionData(); // Save session } } @@ -188,7 +188,7 @@ function changeData($piVars, $contentElementData = array()) { $res = $GLOBALS['TYPO3_DB']->sql_query($query); - if ($res) { // If there is a result + if ($res !== false) { // If there is a result while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { // One loop for every uploadfield if ($_FILES['tx_powermail_pi1']['name']['uid' . $row['uid']]) { // if there is a content in current upload field if (is_array($_FILES['tx_powermail_pi1']['name']['uid' . $row['uid']])) { // is this an array? Can be for multiple file-upload @@ -267,11 +267,10 @@ function changeData($piVars, $contentElementData = array()) { } } } - - } + } + $GLOBALS['TYPO3_DB']->sql_free_result($res); } } - return $piVars; } } diff --git a/lib/class.tx_powermail_tsparserext.php b/lib/class.tx_powermail_tsparserext.php index dcb7a9e9..019fcb59 100644 --- a/lib/class.tx_powermail_tsparserext.php +++ b/lib/class.tx_powermail_tsparserext.php @@ -2,7 +2,7 @@ /*************************************************************** * Copyright notice * - * (c) 2009 Alexander Grein + * (c) 2010 powermail development team (details on http://forge.typo3.org/projects/show/extension-powermail) * All rights reserved * * This script is part of the TYPO3 project. The TYPO3 project is @@ -13,9 +13,6 @@ * * The GNU General Public License can be found at * http://www.gnu.org/copyleft/gpl.html. - * A copy is found in the textfile GPL.txt and important notices to the license - * from the author is found in LICENSE.txt distributed with these scripts. - * * * This script is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -28,44 +25,44 @@ /** * Class that renders fields for the extension manager configuration * - * @author Alexander Grein - * @package TYPO3 + * @author Alexander Grein + * @package TYPO3 * @subpackage tx_powermail */ class tx_powermail_tsparserext { - /** - * Shows the update Message - * - * @return string - */ - function displayMessage(&$params, &$tsObj) { - $out = ''; + /** + * Shows the update Message + * + * @return string + */ + function displayMessage(&$params, &$tsObj) { + $out = ''; - if (t3lib_div::int_from_ver(TYPO3_version) < 4003000) { - // 4.3.0 comes with flashmessages styles. For older versions we include the needed styles here - $cssPath = $GLOBALS['BACK_PATH'] . t3lib_extMgm::extRelPath('powermail'); - $out .= ''; - } + if (t3lib_div::int_from_ver(TYPO3_version) < 4003000) { + // 4.3.0 comes with flashmessages styles. For older versions we include the needed styles here + $cssPath = $GLOBALS['BACK_PATH'] . t3lib_extMgm::extRelPath('powermail'); + $out .= ''; + } - $checkConfig = null; - if ($this->checkConfig() === false) { - $checkConfig = ' + $checkConfig = null; + if ($this->checkConfig() === false) { + $checkConfig = '
' . $GLOBALS['LANG']->sL('LLL:EXT:powermail/locallang.xml:extmng.classInnerHeader') . '
' . $GLOBALS['LANG']->sL('LLL:EXT:powermail/locallang.xml:extmng.classInner') . '
'; - } + } - if (t3lib_div::int_from_ver(TYPO3_version) < 4005000) { - $url = 'index.php?&id=0&CMD[showExt]=powermail&SET[singleDetails]=updateModule'; - } else { - $url = 'mod.php?&id=0&M=tools_em&CMD[showExt]=powermail&SET[singleDetails]=updateModule'; - } + if (t3lib_div::int_from_ver(TYPO3_version) < 4005000) { + $url = 'index.php?&id=0&CMD[showExt]=powermail&SET[singleDetails]=updateModule'; + } else { + $url = 'mod.php?&id=0&M=tools_em&CMD[showExt]=powermail&SET[singleDetails]=updateModule'; + } - if (count($GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid', 'sys_log', 'type = 4 AND details LIKE \'%updateStoragePage%\'' . t3lib_BEfunc::deleteClause('sys_log'))) == 0) { - $out .= ' + if (count($GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid', 'sys_log', 'type = 4 AND details LIKE \'%updateStoragePage%\'' . t3lib_BEfunc::deleteClause('sys_log'))) == 0) { + $out .= '
' . $GLOBALS['LANG']->sL('LLL:EXT:powermail/locallang.xml:extmng.updatermsgHeader') . '
@@ -77,39 +74,39 @@ function displayMessage(&$params, &$tsObj) {
' . $checkConfig . '
'; - } + } - return $out; - } + return $out; + } - /** - * Check the config for a given feature - * - * @return boolean - */ - function checkConfig() { - $confDefault = array( - 'usePreview', - 'cssSelection', - 'feusersPrefill', - 'disableIPlog', - 'disableBackendModule', - 'disableStartStop', - 'useIRRE', - 'fileToolPath', - ); - $confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['powermail']); - foreach ($confDefault as $val) { - if (!isset($confArr[$val]) && !isset($_POST['data'][$val])) { - return false; - } - } - return true; - } + /** + * Check the config for a given feature + * + * @return boolean + */ + function checkConfig() { + $confDefault = array( + 'usePreview', + 'cssSelection', + 'feusersPrefill', + 'disableIPlog', + 'disableBackendModule', + 'disableStartStop', + 'useIRRE', + 'fileToolPath', + ); + $confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['powermail']); + foreach ($confDefault as $val) { + if (!isset($confArr[$val]) && !isset($_POST['data'][$val])) { + return false; + } + } + return true; + } } if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.tx_powermail_tsparserext.php']) { - include_once ($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.tx_powermail_tsparserext.php']); + include_once ($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.tx_powermail_tsparserext.php']); } ?> \ No newline at end of file diff --git a/lib/class.user_powermail_tx_powermail_example.php b/lib/class.user_powermail_tx_powermail_example.php index 76c6dc0a..259ad658 100644 --- a/lib/class.user_powermail_tx_powermail_example.php +++ b/lib/class.user_powermail_tx_powermail_example.php @@ -1,51 +1,47 @@ -* All rights reserved -* -* This script is part of the TYPO3 project. The TYPO3 project is -* free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* The GNU General Public License can be found at -* http://www.gnu.org/copyleft/gpl.html. -* -* This script is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* This copyright notice MUST APPEAR in all copies of the script! -***************************************************************/ - + * Copyright notice + * + * (c) 2010 powermail development team (details on http://forge.typo3.org/projects/show/extension-powermail) + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ /** * Class/Function which manipulates the item-array for table/field tx_powermail_forms_recip_field. * - * @author Mischa Heißmann, Alexander Kellner + * @author Mischa Heißmann, Alexander Kellner * @package TYPO3 * @subpackage tx_powermail */ class user_powermail_tx_powermail_example { - function main($PA, $fobj) { - + function main($PA, $fobj) { + $content = '
'; - $content .= 'Example picture could not be shown'; + $content .= 'Example picture could not be shown'; $content .= '
'; - - if($PA['fieldConf']['config']['field']) return $content; - - } -} + if ($PA['fieldConf']['config']['field']) return $content; + } +} -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.user_powermail_tx_powermail_example.php']) { +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.user_powermail_tx_powermail_example.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.user_powermail_tx_powermail_example.php']); } - ?> \ No newline at end of file diff --git a/lib/class.user_powermail_tx_powermail_fields_fe_field.php b/lib/class.user_powermail_tx_powermail_fields_fe_field.php index 13cc29d0..392b5b89 100644 --- a/lib/class.user_powermail_tx_powermail_fields_fe_field.php +++ b/lib/class.user_powermail_tx_powermail_fields_fe_field.php @@ -1,28 +1,26 @@ -* All rights reserved -* -* This script is part of the TYPO3 project. The TYPO3 project is -* free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* The GNU General Public License can be found at -* http://www.gnu.org/copyleft/gpl.html. -* -* This script is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* This copyright notice MUST APPEAR in all copies of the script! -***************************************************************/ - - + * Copyright notice + * + * (c) 2010 powermail development team (details on http://forge.typo3.org/projects/show/extension-powermail) + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ /** @@ -33,43 +31,38 @@ * @subpackage tx_powermail */ class user_powermail_tx_powermail_fields_fe_field { - function main(&$params,&$pObj) { + function main(&$params, &$pObj) { // Adding an item! $tableName = 'fe_users'; $res = $GLOBALS['TYPO3_DB']->admin_get_fields($tableName); - - if(isset($res)) { + + if (isset($res)) { $confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['powermail']); // Get backandconfig - $AllowedFeuserFields = t3lib_div::trimExplode(',',$confArr['feusersPrefill'],1); // Allowed feuser fields in an array - - foreach($res as $k=>$v) { // Adding an item! - + $AllowedFeuserFields = t3lib_div::trimExplode(',', $confArr['feusersPrefill'], 1); // Allowed feuser fields in an array + + foreach ($res as $k => $v) { // Adding an item! $label = ''; - $label = $pObj->sL('LLL:EXT:cms/locallang_tca.xml:fe_users.'.$k); - if($label == '') { // if label is still empty - $label = $pObj->sL('LLL:EXT:lang/locallang_general.php:LGL.'.$k); // get label + $label = $pObj->sL('LLL:EXT:cms/locallang_tca.xml:fe_users.' . $k); + if ($label == '') { // if label is still empty + $label = $pObj->sL('LLL:EXT:lang/locallang_general.php:LGL.' . $k); // get label } - if($k == 'telephone') { // if key is telephone + if ($k == 'telephone') { // if key is telephone $label = $pObj->sL('LLL:EXT:lang/locallang_general.php:LGL.phone'); // get this label } - if($label == '') { // if label is still empty + if ($label == '') { // if label is still empty $label = $k; // take key as label } - if($label != '' && in_array($k, $AllowedFeuserFields)) { // only if $label is not empty and is allowed - $params['items'][] = array(preg_replace('/:$/','',$label), $k); + if ($label != '' && in_array($k, $AllowedFeuserFields)) { // only if $label is not empty and is allowed + $params['items'][] = array(preg_replace('/:$/', '', $label), $k); } - } } // No return - the $params and $pObj variables are passed by reference, so just change content in then and it is passed back automatically... } } - - -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.user_powermail_tx_powermail_fields_fe_field.php']) { +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.user_powermail_tx_powermail_fields_fe_field.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.user_powermail_tx_powermail_fields_fe_field.php']); } - ?> \ No newline at end of file diff --git a/lib/class.user_powermail_tx_powermail_fields_type.php b/lib/class.user_powermail_tx_powermail_fields_type.php index 3697923d..f930f207 100644 --- a/lib/class.user_powermail_tx_powermail_fields_type.php +++ b/lib/class.user_powermail_tx_powermail_fields_type.php @@ -1,28 +1,26 @@ -* All rights reserved -* -* This script is part of the TYPO3 project. The TYPO3 project is -* free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* The GNU General Public License can be found at -* http://www.gnu.org/copyleft/gpl.html. -* -* This script is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* This copyright notice MUST APPEAR in all copies of the script! -***************************************************************/ - - + * Copyright notice + * + * (c) 2010 powermail development team (details on http://forge.typo3.org/projects/show/extension-powermail) + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ /** @@ -33,19 +31,15 @@ * @subpackage tx_powermail */ class user_powermail_tx_powermail_fields_type { - - function main(&$params,&$pObj) { - - $params['items'][] = array($pObj->sL("Added label by PHP function|Tilføjet Dansk tekst med PHP funktion"), 'text'); - + + function main(&$params, &$pObj) { + $params['items'][] = array($pObj->sL("Added label by PHP function|Tilf�jet Dansk tekst med PHP funktion"), 'text'); } - -} +} -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.user_powermail_tx_powermail_fields_type.php']) { +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.user_powermail_tx_powermail_fields_type.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.user_powermail_tx_powermail_fields_type.php']); } - ?> \ No newline at end of file diff --git a/lib/class.user_powermail_tx_powermail_fieldsetchoose.php b/lib/class.user_powermail_tx_powermail_fieldsetchoose.php index 0c4397cd..95b3e338 100644 --- a/lib/class.user_powermail_tx_powermail_fieldsetchoose.php +++ b/lib/class.user_powermail_tx_powermail_fieldsetchoose.php @@ -1,28 +1,26 @@ -* All rights reserved -* -* This script is part of the TYPO3 project. The TYPO3 project is -* free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* The GNU General Public License can be found at -* http://www.gnu.org/copyleft/gpl.html. -* -* This script is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* This copyright notice MUST APPEAR in all copies of the script! -***************************************************************/ - - + * Copyright notice + * + * (c) 2010 powermail development team (details on http://forge.typo3.org/projects/show/extension-powermail) + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ /** @@ -33,22 +31,20 @@ * @subpackage tx_powermail */ class user_powermail_tx_powermail_fieldsetchoose { - function main(&$params,&$pObj) { + function main(&$params, &$pObj) { if (count($params['items']) > 0) { // if min one fieldset in list - for ($i=0; $i \ No newline at end of file diff --git a/lib/class.user_powermail_tx_powermail_forms_preview.php b/lib/class.user_powermail_tx_powermail_forms_preview.php index dbbef57f..27203791 100644 --- a/lib/class.user_powermail_tx_powermail_forms_preview.php +++ b/lib/class.user_powermail_tx_powermail_forms_preview.php @@ -1,26 +1,26 @@ -* All rights reserved -* -* This script is part of the TYPO3 project. The TYPO3 project is -* free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* The GNU General Public License can be found at -* http://www.gnu.org/copyleft/gpl.html. -* -* This script is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* This copyright notice MUST APPEAR in all copies of the script! -***************************************************************/ + * Copyright notice + * + * (c) 2010 powermail development team (details on http://forge.typo3.org/projects/show/extension-powermail) + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ /** @@ -31,20 +31,18 @@ * @subpackage tx_powermail */ class user_powermail_tx_powermail_forms_preview { - function main(&$params,&$pObj) { + function main(&$params, &$pObj) { //$rootfolder = substr($_SERVER['SCRIPT_NAME'], 0 , strpos($_SERVER['SCRIPT_NAME'],'/typo3')); //$http_host = 'http://'.$GLOBALS['_SERVER']['HTTP_HOST'].$rootfolder.'/index.php?id='.$params['row']['pid'].'&no_cache=1'; - $http_host = t3lib_div::getIndpEnv('TYPO3_SITE_URL').'index.php?id='.$params['row']['pid'].'&no_cache=1'; - return ''; - + $http_host = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . 'index.php?id=' . $params['row']['pid'] . '&no_cache=1'; + return ''; + } } - -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.user_powermail_tx_powermail_forms_preview.php']) { +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.user_powermail_tx_powermail_forms_preview.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.user_powermail_tx_powermail_forms_preview.php']); } - ?> \ No newline at end of file diff --git a/lib/class.user_powermail_tx_powermail_forms_recip_id.php b/lib/class.user_powermail_tx_powermail_forms_recip_id.php index 839ee9c3..93c74f64 100644 --- a/lib/class.user_powermail_tx_powermail_forms_recip_id.php +++ b/lib/class.user_powermail_tx_powermail_forms_recip_id.php @@ -1,26 +1,26 @@ -* All rights reserved -* -* This script is part of the TYPO3 project. The TYPO3 project is -* free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* The GNU General Public License can be found at -* http://www.gnu.org/copyleft/gpl.html. -* -* This script is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* This copyright notice MUST APPEAR in all copies of the script! -***************************************************************/ + * Copyright notice + * + * (c) 2010 powermail development team (details on http://forge.typo3.org/projects/show/extension-powermail) + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ /** @@ -31,12 +31,12 @@ * @subpackage tx_powermail */ class user_powermail_tx_powermail_forms_recip_id { - + // function main() lists email addresses of chosen tables - function main(&$params, &$pObj) { - + function main(&$params, &$pObj) { + if (!empty($params['row']['tx_powermail_recip_table'])) { // if a table was selected in flexform - + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( // db query - get all of selected table $select = '*', // get all fields $from = $params['row']['tx_powermail_recip_table'], // of selected table @@ -46,7 +46,7 @@ function main(&$params, &$pObj) { $limit = '100000' // limit for performance reasons ); if ($res) { // if there is a result - + /* // TODO: Select a group and send mail to whole group if (preg_match('/group/', $params['row']['tx_powermail_recip_table'])) { // if chosen table contents "group" @@ -57,26 +57,22 @@ function main(&$params, &$pObj) { } else { // chosen table don't contents "group" in its name */ - + while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { // one loop for every record $uid = $row['uid']; // get uid of current record - foreach ((array) $row as $k => $v) { // one loop for every field of current record + foreach ((array)$row as $k => $v) { // one loop for every field of current record if (t3lib_div::validEmail($v)) { // if current fieldvalue is an email address $params['items'][] = array($pObj->sL($v), $v); // add email to array for returning } } } - } } - } } - -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.user_powermail_tx_powermail_forms_recip_id.php']) { +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.user_powermail_tx_powermail_forms_recip_id.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.user_powermail_tx_powermail_forms_recip_id.php']); } - ?> \ No newline at end of file diff --git a/lib/class.user_powermail_tx_powermail_forms_recip_table.php b/lib/class.user_powermail_tx_powermail_forms_recip_table.php index b4e55646..7c2210a1 100644 --- a/lib/class.user_powermail_tx_powermail_forms_recip_table.php +++ b/lib/class.user_powermail_tx_powermail_forms_recip_table.php @@ -1,28 +1,26 @@ -* All rights reserved -* -* This script is part of the TYPO3 project. The TYPO3 project is -* free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* The GNU General Public License can be found at -* http://www.gnu.org/copyleft/gpl.html. -* -* This script is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* This copyright notice MUST APPEAR in all copies of the script! -***************************************************************/ - - + * Copyright notice + * + * (c) 2010 powermail development team (details on http://forge.typo3.org/projects/show/extension-powermail) + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ /** @@ -33,30 +31,28 @@ * @subpackage tx_powermail */ class user_powermail_tx_powermail_forms_recip_table { - - function main(&$params,&$pObj) { + + function main(&$params, &$pObj) { $tables = $GLOBALS['TYPO3_DB']->admin_get_tables(); - - if(isset($tables) && is_array($tables)) { - if(t3lib_div::int_from_ver(TYPO3_version) < t3lib_div::int_from_ver('4.2.0')) { - foreach($tables as $v) { - $params['items'][] = array($pObj->sL($v),$v); + + if (isset($tables) && is_array($tables)) { + if (t3lib_div::int_from_ver(TYPO3_version) < t3lib_div::int_from_ver('4.2.0')) { + foreach ($tables as $v) { + $params['items'][] = array($pObj->sL($v), $v); } } else { - foreach($tables as $k => $v) { - $params['items'][] = array($pObj->sL($k),$k); + foreach ($tables as $k => $v) { + $params['items'][] = array($pObj->sL($k), $k); } } } - + } } - -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.user_powermail_tx_powermail_forms_recip_table.php']) { +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.user_powermail_tx_powermail_forms_recip_table.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.user_powermail_tx_powermail_forms_recip_table.php']); } - ?> \ No newline at end of file diff --git a/lib/class.user_powermail_tx_powermail_forms_sender_field.php b/lib/class.user_powermail_tx_powermail_forms_sender_field.php index 3ef82c5a..50014f76 100644 --- a/lib/class.user_powermail_tx_powermail_forms_sender_field.php +++ b/lib/class.user_powermail_tx_powermail_forms_sender_field.php @@ -1,26 +1,26 @@ -* All rights reserved -* -* This script is part of the TYPO3 project. The TYPO3 project is -* free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* The GNU General Public License can be found at -* http://www.gnu.org/copyleft/gpl.html. -* -* This script is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* This copyright notice MUST APPEAR in all copies of the script! -***************************************************************/ + * Copyright notice + * + * (c) 2010 powermail development team (details on http://forge.typo3.org/projects/show/extension-powermail) + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ /** * Class/Function which manipulates the item-array for the sender-name AND the sender-email field. @@ -30,7 +30,7 @@ * @subpackage tx_powermail */ class user_powermail_tx_powermail_forms_sender_field { - + /** * Show field values in backend * @@ -38,7 +38,7 @@ class user_powermail_tx_powermail_forms_sender_field { * @param array Parent Object * @return void */ - public function main(&$params, &$pObj) { + public function main(&$params, &$pObj) { $select = 'tx_powermail_fields.uid, tx_powermail_fields.title, tx_powermail_fields.sorting'; $from = ' tx_powermail_fieldsets @@ -66,8 +66,7 @@ public function main(&$params, &$pObj) { } } -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.user_powermail_tx_powermail_forms_sender_field.php']) { +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.user_powermail_tx_powermail_forms_sender_field.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.user_powermail_tx_powermail_forms_sender_field.php']); } - ?> \ No newline at end of file diff --git a/lib/class.user_powermail_tx_powermail_uid.php b/lib/class.user_powermail_tx_powermail_uid.php index 96b9425d..a63aa0dd 100644 --- a/lib/class.user_powermail_tx_powermail_uid.php +++ b/lib/class.user_powermail_tx_powermail_uid.php @@ -1,27 +1,26 @@ -* All rights reserved -* -* This script is part of the TYPO3 project. The TYPO3 project is -* free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* The GNU General Public License can be found at -* http://www.gnu.org/copyleft/gpl.html. -* -* This script is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* This copyright notice MUST APPEAR in all copies of the script! -***************************************************************/ - + * Copyright notice + * + * (c) 2010 powermail development team (details on http://forge.typo3.org/projects/show/extension-powermail) + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ /** * Class/Function which manipulates the item-array for table/field tx_powermail_forms_recip_field. @@ -33,22 +32,20 @@ class user_powermail_tx_powermail_uid { function main($PA, $fobj) { $content = ''; - $content .= ''; - - if(!empty($PA['row']['uid'])) return $content; + + if (!empty($PA['row']['uid'])) return $content; } - + function noReturn($PA, $fobj) { return FALSE; } } - -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.user_powermail_tx_powermail_uid.php']) { +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.user_powermail_tx_powermail_uid.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.user_powermail_tx_powermail_uid.php']); } - ?> \ No newline at end of file diff --git a/lib/user_powermailCheckT3jquery.php b/lib/user_powermailCheckT3jquery.php index f89c3ffd..9e6c0454 100644 --- a/lib/user_powermailCheckT3jquery.php +++ b/lib/user_powermailCheckT3jquery.php @@ -1,36 +1,36 @@ \ No newline at end of file diff --git a/lib/user_powermailCheckT3jqueryCDNMode.php b/lib/user_powermailCheckT3jqueryCDNMode.php index eeffc6f6..8c56a6eb 100644 --- a/lib/user_powermailCheckT3jqueryCDNMode.php +++ b/lib/user_powermailCheckT3jqueryCDNMode.php @@ -1,53 +1,53 @@ \ No newline at end of file diff --git a/lib/user_powermailOnCurrentPage.php b/lib/user_powermailOnCurrentPage.php index 0125c46b..1bfc4eab 100644 --- a/lib/user_powermailOnCurrentPage.php +++ b/lib/user_powermailOnCurrentPage.php @@ -1,26 +1,26 @@ exec_SELECTquery ('uid, CType, records', 'tt_content', $where, '', $orderBy, ''); + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid, CType, records', 'tt_content', $where, '', $orderBy, ''); - while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { - switch($row['CType']) { - // Normal content element + while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { + switch ($row['CType']) { + // Normal content element case 'powermail_pi1': $result = isPowermailOnCurrentPage($mode, $row['uid']); break; - // Content element "Insert plugin" + // Content element "Insert plugin" case 'shortcut': $recordUids = array(); $records = t3lib_div::trimExplode(',', $row['records'], TRUE); @@ -63,7 +65,7 @@ function user_powermailOnCurrentPage($mode = '') { } $recordUids = $GLOBALS['TYPO3_DB']->cleanIntList(implode(',', $recordUids)); - if(!$recordUids) { + if (!$recordUids) { break; } @@ -92,12 +94,12 @@ function user_powermailOnCurrentPage($mode = '') { function getCorrectPageIdForPowermailOnCurrentPageUserfunc() { $pid = $GLOBALS['TSFE']->id; - // This part is copied and modified from TSpagegen::pagegenInit(); - // because we can`t call it directly. It is to early. + // This part is copied and modified from TSpagegen::pagegenInit(); + // because we can`t call it directly. It is to early. if ($GLOBALS['TSFE']->page['content_from_pid'] > 0) { - // make REAL copy of TSFE object - not reference! + // make REAL copy of TSFE object - not reference! $temp_copy_TSFE = clone($GLOBALS['TSFE']); - // Set ->id to the content_from_pid value - we are going to evaluate this pid as was it a given id for a page-display! + // Set ->id to the content_from_pid value - we are going to evaluate this pid as was it a given id for a page-display! $temp_copy_TSFE->id = $GLOBALS['TSFE']->page['content_from_pid']; $temp_copy_TSFE->getPageAndRootlineWithDomain($GLOBALS['TSFE']->tmpl->setup['config.']['content_from_pid_allowOutsideDomain'] ? 0 : $GLOBALS['TSFE']->domainStartPage); $pid = intval($temp_copy_TSFE->id); @@ -117,7 +119,7 @@ function isPowermailOnCurrentPage($mode, $uid) { } -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/user_powermailOnCurrentPage.php']) { +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/user_powermailOnCurrentPage.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/user_powermailOnCurrentPage.php']); } ?> \ No newline at end of file diff --git a/lib/user_powermail_misc.php b/lib/user_powermail_misc.php index d8a38357..1e514adb 100644 --- a/lib/user_powermail_misc.php +++ b/lib/user_powermail_misc.php @@ -1,41 +1,41 @@ -* All rights reserved -* -* This script is part of the TYPO3 project. The TYPO3 project is -* free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* The GNU General Public License can be found at -* http://www.gnu.org/copyleft/gpl.html. -* -* This script is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* This copyright notice MUST APPEAR in all copies of the script! -***************************************************************/ + * Copyright notice + * + * (c) 2010 powermail development team (details on http://forge.typo3.org/projects/show/extension-powermail) + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ +// Function user_step() could be used as condition instead of globalVar in Backend +// This won't work: [globalVar = GP:tx_powermail_pi1|mailID > 0] +// This will work: [userFunc = user_powermail_step()] // submitted form +// This will work: [userFunc = user_powermail_step(2)] // user ist on step 2 if multiple step form +function user_powermail_step($id = 0) { + $piVars = t3lib_div::_GP('tx_powermail_pi1'); // get params from powermail - // Function user_step() could be used as condition instead of globalVar in Backend - // This won't work: [globalVar = GP:tx_powermail_pi1|mailID > 0] - // This will work: [userFunc = user_powermail_step()] // submitted form - // This will work: [userFunc = user_powermail_step(2)] // user ist on step 2 if multiple step form - function user_powermail_step($id = 0) { - $piVars = t3lib_div::_GP('tx_powermail_pi1'); // get params from powermail - - if (!$id) { // if no id given from outside - if (intval($piVars['mailID']) > 0) return true; // if there is a mailID, return true - } else { // if there is an id given from outside - if (intval($piVars['multiple']) == $id) return true; // if multiple == given param, return true - } - - return false; + if (!$id) { // if no id given from outside + if (intval($piVars['mailID']) > 0) return true; // if there is a mailID, return true + } else { // if there is an id given from outside + if (intval($piVars['multiple']) == $id) return true; // if multiple == given param, return true } + + return false; +} + ?> \ No newline at end of file diff --git a/lib/user_powermail_updateError.php b/lib/user_powermail_updateError.php index 4e3e5e06..0058dfad 100644 --- a/lib/user_powermail_updateError.php +++ b/lib/user_powermail_updateError.php @@ -1,32 +1,32 @@ -* All rights reserved -* -* This script is part of the TYPO3 project. The TYPO3 project is -* free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* The GNU General Public License can be found at -* http://www.gnu.org/copyleft/gpl.html. -* -* This script is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* This copyright notice MUST APPEAR in all copies of the script! -***************************************************************/ + * Copyright notice + * + * (c) 2010 powermail development team (details on http://forge.typo3.org/projects/show/extension-powermail) + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ class user_powermail_updateError { - + function user_updateError($PA, $fobj) { if (strlen($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['powermail']) < 1) { // settings for powermail missing - return '
'.$fobj->sL('LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.updateError').'
'; + return '
' . $fobj->sL('LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.updateError') . '
'; } else { return $fobj->sL('LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.noErrors'); } @@ -35,7 +35,7 @@ function user_updateError($PA, $fobj) { } -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/user_powermail_updateError.php']) { +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/user_powermail_updateError.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/user_powermail_updateError.php']); } ?> \ No newline at end of file diff --git a/mod1/class.tx_powermail_action.php b/mod1/class.tx_powermail_action.php index 610dc56e..068137c0 100644 --- a/mod1/class.tx_powermail_action.php +++ b/mod1/class.tx_powermail_action.php @@ -1,26 +1,26 @@ exec_UPDATEquery( 'tx_powermail_mails', 'uid = ' . intval($uid), - array ( - 'deleted' => 1 + array( + 'deleted' => 1 ) ); } @@ -72,9 +72,9 @@ function deleteItem($uids) { * @return void */ function deleteFiles() { - $fileArray = t3lib_div::getFilesInDir(t3lib_div::getIndpEnv('TYPO3_DOCUMENT_ROOT').'/typo3temp/', 'csv,gz', 1, 1); + $fileArray = t3lib_div::getFilesInDir(t3lib_div::getIndpEnv('TYPO3_DOCUMENT_ROOT') . '/typo3temp/', 'csv,gz', 1, 1); - foreach ((array) $fileArray as $value) { + foreach ((array)$fileArray as $value) { if (strpos($value, 'powermail_export') !== false) { unlink($value); } diff --git a/mod1/class.tx_powermail_ajax.php b/mod1/class.tx_powermail_ajax.php index ab62cdac..a7432488 100644 --- a/mod1/class.tx_powermail_ajax.php +++ b/mod1/class.tx_powermail_ajax.php @@ -1,27 +1,27 @@ belist = t3lib_div::makeInstance('tx_powermail_repository'); $this->belist->pid = intval(t3lib_div::_GP('pid')); @@ -106,7 +106,7 @@ private function ajaxGetItems($params, $ajaxObj) { $ajaxObj->setContent($this->belist->main()); $ajaxObj->setContentFormat('jsonbody'); } - + private function ajaxGetLabelsAndFormtypes($params, $ajaxObj) { $this->labelsAndFormtypes = t3lib_div::makeInstance('tx_powermail_repository'); $this->labelsAndFormtypes->pid = intval(t3lib_div::_GP('pid')); diff --git a/mod1/class.tx_powermail_charts.php b/mod1/class.tx_powermail_charts.php index 7be1a7a2..bd0b93e4 100644 --- a/mod1/class.tx_powermail_charts.php +++ b/mod1/class.tx_powermail_charts.php @@ -1,26 +1,26 @@ array ( - 'config.' => array ( - 'chart.' => array ( + var $tsconfig = array( + 'properties' => array( + 'config.' => array( + 'chart.' => array( // Default settings for timeframe (1 month in seconds) 'timeframe' => 2678400, // Default settings for sectionframe (1 week in seconds) @@ -118,7 +118,7 @@ function main($pObj) { $where = ' pid = ' . intval($pObj->id) . ' AND crdate < ' . (time() - $delta1) . ' - AND crdate > ' . (time() - $this->tsconfig['properties']['config.']['chart.']['timeframe'] + $delta2) . ' + AND crdate > ' . (time() - $this->tsconfig['properties']['config.']['chart.']['timeframe'] + $delta2) . ' AND hidden = 0 AND deleted = 0'; $groupBy = $orderBy = ''; @@ -133,10 +133,10 @@ function main($pObj) { $no += $GLOBALS['TYPO3_DB']->sql_num_rows($res2); } - if($row['no'] > 0) { + if ($row['no'] > 0) { $values .= $row['no']; - }else{ + } else { $values .= '0'; } $values .= ','; @@ -148,7 +148,7 @@ function main($pObj) { $url = 'http://chart.apis.google.com/chart?cht=lc&chd=t:' . $this->reverseList($values) . '&chs=700x200&chxt=x,y&chl=' . $this->urlencode2($this->tsconfig['properties']['config.']['chart.']['title'], '|'); $content .= '

' . $pObj->lang->getLL('chart_chart') . '

- '; + '; } // Make listview @@ -174,7 +174,7 @@ function main($pObj) { */ function urlencode2($string, $delimiter) { $parts = t3lib_div::trimExplode($delimiter, $string, 1); - foreach ((array) $parts as $key => $value) { + foreach ((array)$parts as $key => $value) { $parts[$key] = rawurlencode($value); } $string = implode($delimiter, $parts); diff --git a/mod1/class.tx_powermail_export.php b/mod1/class.tx_powermail_export.php index db534955..d5564291 100644 --- a/mod1/class.tx_powermail_export.php +++ b/mod1/class.tx_powermail_export.php @@ -1,32 +1,32 @@ init(); } @@ -83,12 +83,12 @@ class tx_powermail_export { */ var $timeFormat = 'H:i:s'; - /** - * dateTimeFormat for datetime values - * - * @var string - */ - var $datetimeFormat = 'Y-m-d H:i'; + /** + * dateTimeFormat for datetime values + * + * @var string + */ + var $datetimeFormat = 'Y-m-d H:i'; /** * Time filter prefix for export file @@ -193,7 +193,7 @@ class tx_powermail_export { * * @var array */ - var $rowConfig = array ( + var $rowConfig = array( 'number' => '#', 'date' => 'Date', 'time' => 'Time', @@ -229,12 +229,12 @@ class tx_powermail_export { */ var $overwriteFilename; - /** - * number of results - * - * @var int - */ - var $resNumRows; + /** + * number of results + * + * @var int + */ + var $resNumRows; /** * Dispatcher main method for export @@ -255,16 +255,15 @@ public function main() { $i = 0; - // Set absolute path to typo3temp dir $this->absFilePath = PATH_site . 'typo3temp/'; $this->timeFilter = ''; - if ($this->startDateTime > 0){ + if ($this->startDateTime > 0) { $this->timeFilter .= ' AND crdate > ' . intval($this->startDateTime); $this->timeFilePrefix .= strftime('_%Y-%m-%d_%H.%M', intval($this->startDateTime)); } - if ($this->endDateTime > 0){ + if ($this->endDateTime > 0) { $this->timeFilter .= ' AND crdate < ' . intval($this->endDateTime); $this->timeFilePrefix .= strftime('_%Y-%m-%d_%H.%M', intval($this->endDateTime)); } @@ -274,34 +273,34 @@ public function main() { $this->tsConfig = t3lib_BEfunc::getModtsConfig($this->pid, 'tx_powermail_mod1'); $this->useTitle = true; - if (isset($this->tsConfig['properties']['config.']['export.']['useTitle'])){ + if (isset($this->tsConfig['properties']['config.']['export.']['useTitle'])) { $this->useTitle = ($this->tsConfig['properties']['config.']['export.']['useTitle'] == '0') ? false : true; } $this->exportHeaderLanguageUid = 0; - if (isset($this->tsConfig['properties']['config.']['export.']['allTitleLanguageUid'])){ + if (isset($this->tsConfig['properties']['config.']['export.']['allTitleLanguageUid'])) { $this->exportHeaderLanguageUid = intval($this->tsConfig['properties']['config.']['export.']['allTitleLanguageUid']); } - if (isset($this->tsConfig['properties']['config.']['export.']['dateFormat'])){ - $this->dateFormat = $this->tsConfig['properties']['config.']['export.']['dateFormat']; - } + if (isset($this->tsConfig['properties']['config.']['export.']['dateFormat'])) { + $this->dateFormat = $this->tsConfig['properties']['config.']['export.']['dateFormat']; + } - if (isset($this->tsConfig['properties']['config.']['export.']['timeFormat'])){ - $this->timeFormat = $this->tsConfig['properties']['config.']['export.']['timeFormat']; - } + if (isset($this->tsConfig['properties']['config.']['export.']['timeFormat'])) { + $this->timeFormat = $this->tsConfig['properties']['config.']['export.']['timeFormat']; + } - if (isset($this->tsConfig['properties']['config.']['export.']['datetimeFormat'])){ - $this->datetimeFormat = $this->tsConfig['properties']['config.']['export.']['datetimeFormat']; - } + if (isset($this->tsConfig['properties']['config.']['export.']['datetimeFormat'])) { + $this->datetimeFormat = $this->tsConfig['properties']['config.']['export.']['datetimeFormat']; + } // Not used Yet! $this->excludeFromAll = array(); - if (isset($this->tsConfig['properties']['config.']['export.']['excludeFromAll'])){ + if (isset($this->tsConfig['properties']['config.']['export.']['excludeFromAll'])) { $this->excludeFromAll = explode(',', $this->tsConfig['properties']['config.']['export.']['excludeFromAll']); } - if (isset($this->tsConfig['properties']['config.']['export.']['xls.']['format'])){ + if (isset($this->tsConfig['properties']['config.']['export.']['xls.']['format'])) { $this->xlsFileFormat = $this->tsConfig['properties']['config.']['export.']['xls.']['format']; } @@ -309,18 +308,19 @@ public function main() { $this->xlsFileSuffix = '.xls'; } - if (isset($this->tsConfig['properties']['config.']['export.']['xls.']['autoSize'])){ - $this->xlsAutoSize = ($this->tsConfig['properties']['config.']['export.']['xls.']['autoSize'] == '1') ? true : false; + if (isset($this->tsConfig['properties']['config.']['export.']['xls.']['autoSize'])) { + $this->xlsAutoSize = ($this->tsConfig['properties']['config.']['export.']['xls.']['autoSize'] == '1') ? true + : false; } - if (count($this->tsConfig['properties']['export.']) > 0){ + if (count($this->tsConfig['properties']['export.']) > 0) { $this->rowConfig = $this->tsConfig['properties']['export.']; } $this->setDateTimeFormat(); $this->setEncoding(); $this->setFilenames(); - $this->generateFormtypesArray(); + $this->generateFormtypesArray(); $this->generalRecordsFilter = ' AND hidden = 0 AND deleted = 0'; $select = '*'; @@ -329,7 +329,7 @@ public function main() { $groupBy = $limit = ''; $orderBy = 'crdate DESC'; $this->res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $from, $where, $groupBy, $orderBy, $limit); - $this->resNumRows = $GLOBALS['TYPO3_DB']->sql_num_rows($this->res); + $this->resNumRows = $GLOBALS['TYPO3_DB']->sql_num_rows($this->res); // If on current page is a result if ($this->res) { @@ -365,11 +365,11 @@ public function main() { // Delete all exported mails now if (t3lib_div::_GET('delafterexport') == 1) { - $GLOBALS['TYPO3_DB']->exec_UPDATEquery ( + $GLOBALS['TYPO3_DB']->exec_UPDATEquery( 'tx_powermail_mails', 'pid = ' . $this->pid . $this->generalRecordsFilter, - array ( - 'deleted' => 1 + array( + 'deleted' => 1 ) ); } @@ -408,7 +408,7 @@ protected function generateHtmlTable() { $GLOBALS['TYPO3_DB']->sql_data_seek($this->res, $this->getRowWithMostPiVars()); $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($this->res); $headerPiVars = t3lib_div::xml2array($row['piVars'], 'piVars'); - // Get form type of piVars + // Get form type of piVars $tableHeaderContent .= ''; foreach ($this->rowConfig as $key => $value) { @@ -419,7 +419,9 @@ protected function generateHtmlTable() { } else { if (isset($headerPiVars) && is_array($headerPiVars)) { foreach ($headerPiVars as $key => $value) { - $label = $this->charConvert($this->getLabelfromBackend($key, $value)); + $this->fieldUid = $key; + $this->getFieldLabelFromBackend(); + $label = $this->charConvert($this->fieldLabel); $tableHeaderContent .= '' . $label . ''; } } @@ -435,43 +437,45 @@ protected function generateHtmlTable() { $htmlContent .= ''; $GLOBALS['TYPO3_DB']->sql_data_seek($this->res, 0); while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($this->res))) { - $uploadURLPath = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $row['uploadPath']; + $uploadURLPath = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $row['uploadPath']; if ($row['piVars']) { $piVars = t3lib_div::xml2array($row['piVars'], 'piVars'); $i++; $htmlContent .= ($i % 2 === 0) ? '' : ''; foreach ($this->rowConfig as $key => $value) { - // If current row is number - if ($key == 'number'){ + // If current row is number + if ($key == 'number') { $htmlContent .= '' . $i . '.'; - // If current row is date + // If current row is date } elseif ($key == 'date') { $htmlContent .= '' . date($this->dateFormat, $row['crdate']) . ''; - // If current row is time + // If current row is time } elseif ($key == 'time') { $htmlContent .= '' . date($this->timeFormat, $row['crdate']) . ''; - // If current row should show all dynamic values (piVars) + // If current row should show all dynamic values (piVars) } elseif ($key == 'uid') { if (isset($piVars) && is_array($piVars)) { // One loop for every piVar foreach ($piVars as $key => $value) { if (!is_array($value)) { - $value = $this->charConvert($this->cleanString($value)); - switch ($this->formtypes[$key]){ - case 'date': - $value = ($value == intval($value)) ? gmdate($this->dateFormat, $value) : $value; - break; - case 'datetime': - $value = ($value == intval($value)) ? gmdate($this->datetimeFormat, $value) : $value; - break; - case 'file': - $value = '' . $value . ''; - break; - } + $value = $this->charConvert($this->cleanString($value)); + switch ($this->formtypes[$key]) { + case 'date': + $value = ($value == intval($value)) ? gmdate($this->dateFormat, $value) + : $value; + break; + case 'datetime': + $value = ($value == intval($value)) ? gmdate($this->datetimeFormat, $value) + : $value; + break; + case 'file': + $value = '' . $value . ''; + break; + } $htmlContent .= '' . $value . ''; } else { $htmlContentSecondLevel = array(); @@ -487,11 +491,11 @@ protected function generateHtmlTable() { $piVarsCounter = count($piVars); while ($piVarsCounter < count($headerPiVars)) { $htmlContent .= ''; - $piVarsCounter ++; + $piVarsCounter++; } } - // Dynamic value like uid45 + // Dynamic value like uid45 } elseif (is_numeric(str_replace(array('uid', '_'), '', $key))) { // Explode uid44_0 to uid44 and 0 @@ -510,26 +514,27 @@ protected function generateHtmlTable() { //$htmlContent .= '' . $this->charConvert($this->cleanString($piVars[$key])) . ''; $value = $this->charConvert($this->cleanString($piVars[$key])); - switch ($this->formtypes[$key]){ - case 'date': - $value = ($value == intval($value)) ? gmdate($this->dateFormat, $value) : $value; - break; - case 'datetime': - $value = ($value == intval($value)) ? gmdate($this->datetimeFormat, $value) : $value; - break; - case 'file': - $value = '' . $value . ''; - break; + switch ($this->formtypes[$key]) { + case 'date': + $value = ($value == intval($value)) ? gmdate($this->dateFormat, $value) : $value; + break; + case 'datetime': + $value = ($value == intval($value)) ? gmdate($this->datetimeFormat, $value) + : $value; + break; + case 'file': + $value = '' . $value . ''; + break; } $htmlContent .= '' . $value . ''; - // PiVars in second level + // PiVars in second level } else { - if($orgkey != $key) { + if ($orgkey != $key) { $newkey = explode('_', $orgkey); } $htmlContentSecondLevel = array(); - foreach($piVars[$newkey[0]] as $key2 => $value2) { + foreach ($piVars[$newkey[0]] as $key2 => $value2) { if ($value2 != '') { $htmlContentSecondLevel[] .= $this->charConvert($this->cleanString($value2)); } @@ -562,7 +567,7 @@ protected function generateCsvTable() { $headerPiVars = t3lib_div::xml2array(($row['piVars']), 'piVars'); foreach ($this->rowConfig as $key => $value) { $newValue = $this->charConvert($value); - if(trim($newValue != '')) { + if (trim($newValue != '')) { $value = $newValue; } // Static values @@ -571,13 +576,15 @@ protected function generateCsvTable() { } else { if (isset($headerPiVars) && is_array($headerPiVars)) { foreach ($headerPiVars as $key => $value) { - $label = $this->charConvert($this->getLabelfromBackend($key, $value)); + $this->fieldUid = $key; + $this->getFieldLabelFromBackend(); + $label = $this->charConvert($this->fieldLabel); $csvHeader .= '"' . $this->cleanString($label) . '"' . $this->seperator; } } } } - $csvHeader = substr($csvHeader,0,-1) . "\n"; + $csvHeader = substr($csvHeader, 0, -1) . "\n"; if ($this->useTitle) { $csvContent .= $csvHeader; @@ -585,45 +592,47 @@ protected function generateCsvTable() { // Generate CSV Rows $GLOBALS['TYPO3_DB']->sql_data_seek($this->res, 0); - $i = 0; + $i = 0; while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($this->res))) { - $uploadURLPath = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $row['uploadPath']; + $uploadURLPath = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $row['uploadPath']; if ($row['piVars']) { $i++; $piVars = t3lib_div::xml2array(($row['piVars']), 'piVars'); - //if($this->debug) t3lib_div::devLog('piVars found: ' . $i, $this->extKey, 0, $piVars); + //if($this->debug) t3lib_div::devLog('piVars found: ' . $i, $this->extKey, 0, $piVars); foreach ($this->rowConfig as $key => $value) { // If current row is number if ($key == 'number') { $csvContent .= '"' . $i . '."' . $this->seperator; - // If current row is date + // If current row is date } elseif ($key == 'date') { $csvContent .= '"' . date($this->dateFormat, $row['crdate']) . '"' . $this->seperator; - // If current row is time + // If current row is time } elseif ($key == 'time') { $csvContent .= '"' . date($this->timeFormat, $row['crdate']) . '"' . $this->seperator; - // If current row should show all dynamic values (piVars) + // If current row should show all dynamic values (piVars) } elseif ($key == 'uid') { if (isset($piVars) && is_array($piVars)) { // One loop for every piVar foreach ($piVars as $key => $value) { - if (!is_array($value)){ - $value = $this->charConvert($this->cleanString($value)); - switch ($this->formtypes[$key]){ - case 'date': - $value = ($value == intval($value)) ? gmdate($this->dateFormat, $value) : $value; - break; - case 'datetime': - $value = ($value == intval($value)) ? gmdate($this->datetimeFormat, $value) : $value; - break; - case 'file': - $value = $uploadURLPath . $value; - break; - } + if (!is_array($value)) { + $value = $this->charConvert($this->cleanString($value)); + switch ($this->formtypes[$key]) { + case 'date': + $value = ($value == intval($value)) ? gmdate($this->dateFormat, $value) + : $value; + break; + case 'datetime': + $value = ($value == intval($value)) ? gmdate($this->datetimeFormat, $value) + : $value; + break; + case 'file': + $value = $uploadURLPath . $value; + break; + } $csvContent .= '"' . $value . '"' . $this->seperator; } else { @@ -640,11 +649,11 @@ protected function generateCsvTable() { $piVarsCounter = count($piVars); while ($piVarsCounter < count($headerPiVars)) { $csvContent .= $this->seperator; - $piVarsCounter ++; + $piVarsCounter++; } } - // Dynamic value like uid45 + // Dynamic value like uid45 } elseif (is_numeric(str_replace(array('uid', '_'), '', $key))) { // Explode uid44_0 to uid44 and 0 @@ -663,26 +672,27 @@ protected function generateCsvTable() { //$csvContent .= '"' . $this->charConvert($this->cleanString($piVars[$key])) . '"' . $this->seperator; $value = $this->charConvert($this->cleanString($piVars[$key])); - switch ($this->formtypes[$key]){ - case 'date': - $value = ($value == intval($value)) ? gmdate($this->dateFormat, $value) : $value; - break; - case 'datetime': - $value = ($value == intval($value)) ? gmdate($this->datetimeFormat, $value) : $value; - break; - case 'file': - $value = $uploadURLPath . $value; - break; + switch ($this->formtypes[$key]) { + case 'date': + $value = ($value == intval($value)) ? gmdate($this->dateFormat, $value) : $value; + break; + case 'datetime': + $value = ($value == intval($value)) ? gmdate($this->datetimeFormat, $value) + : $value; + break; + case 'file': + $value = $uploadURLPath . $value; + break; } $csvContent .= '"' . $value . '"' . $this->seperator; - // PiVars in second level + // PiVars in second level } else { - if($orgkey != $key) { + if ($orgkey != $key) { $newkey = explode('_', $orgkey); } $csvContentSecondLevel = array(); - foreach($piVars[$newkey[0]] as $key2 => $value2) { + foreach ($piVars[$newkey[0]] as $key2 => $value2) { if ($value2 != '') { $csvContentSecondLevel[] .= $this->charConvert($this->cleanString($value2)); } @@ -696,12 +706,12 @@ protected function generateCsvTable() { } // Delete last seperator - $csvContent = substr($csvContent,0,-1); + $csvContent = substr($csvContent, 0, -1); $csvContent .= "\n"; } } $this->content .= $csvContent; - //if($this->debug) t3lib_div::devLog($this->content, $this->extKey, 0); + //if($this->debug) t3lib_div::devLog($this->content, $this->extKey, 0); } /** @@ -755,14 +765,16 @@ protected function generateXlsTable() { if ($key != 'uid') { $excelObject->getActiveSheet()->setCellValue($excelColNames[$sheetHeaderCol] . '1', $value); $sheetHeaderCols[$sheetHeaderCol] = $colname; - $sheetHeaderCol ++; + $sheetHeaderCol++; } else { if (isset($headerPiVars) && is_array($headerPiVars)) { foreach ($headerPiVars as $key => $value) { - $label = $this->getLabelfromBackend($key, $value); + $this->fieldUid = $key; + $this->getFieldLabelFromBackend(); + $label = $this->charConvert($this->fieldLabel); $excelObject->getActiveSheet()->setCellValue($excelColNames[$sheetHeaderCol] . '1', $this->cleanString($this->charConvert($label))); $sheetHeaderCols[$sheetHeaderCol] = $colname; - $sheetHeaderCol ++; + $sheetHeaderCol++; } } } @@ -774,13 +786,13 @@ protected function generateXlsTable() { // Generate EXCEL Rows $GLOBALS['TYPO3_DB']->sql_data_seek($this->res, 0); while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($this->res))) { - $uploadURLPath = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $row['uploadPath']; + $uploadURLPath = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $row['uploadPath']; if ($row['piVars']) { - if($sheetRow == 1) { + if ($sheetRow == 1) { // if no header row was set, generate 1000 ExcelColNames $excelColNames = $this->getExcelColNames(1000); } - $i ++; + $i++; $piVars = t3lib_div::xml2array($row['piVars'], 'piVars'); $sheetCol = 0; @@ -789,36 +801,38 @@ protected function generateXlsTable() { // If current row is number if ($key == 'number') { $excelObject->getActiveSheet()->setCellValue($colname, $i); - $sheetCol ++; + $sheetCol++; - // If current row is date + // If current row is date } elseif ($key == 'date') { $excelObject->getActiveSheet()->setCellValue($colname, date($this->dateFormat, $row['crdate'])); - $sheetCol ++; + $sheetCol++; - // If current row is time + // If current row is time } elseif ($key == 'time') { $excelObject->getActiveSheet()->setCellValue($colname, date($this->timeFormat, $row['crdate'])); - $sheetCol ++; + $sheetCol++; - // If current row should show all dynamic values (piVars) + // If current row should show all dynamic values (piVars) } elseif ($key == 'uid') { if (isset($piVars) && is_array($piVars)) { // One loop for every piVar foreach ($piVars as $key => $value) { - if (!is_array($value)){ - $value = $this->charConvert($this->cleanString(t3lib_div::htmlspecialchars_decode($value))); - switch ($this->formtypes[$key]){ - case 'date': - $value = ($value == intval($value) && $value !== '') ? gmdate($this->dateFormat, $value) : $value; - break; - case 'datetime': - $value = ($value == intval($value) && $value !== '') ? gmdate($this->datetimeFormat, $value) : $value; - break; - case 'file': - $value = $uploadURLPath . $value; - break; - } + if (!is_array($value)) { + $value = $this->charConvert($this->cleanString(t3lib_div::htmlspecialchars_decode($value))); + switch ($this->formtypes[$key]) { + case 'date': + $value = ($value == intval($value) && $value !== '') + ? gmdate($this->dateFormat, $value) : $value; + break; + case 'datetime': + $value = ($value == intval($value) && $value !== '') + ? gmdate($this->datetimeFormat, $value) : $value; + break; + case 'file': + $value = $uploadURLPath . $value; + break; + } $excelObject->getActiveSheet()->setCellValue($excelColNames[$sheetCol] . $sheetRow, $value); } else { @@ -831,12 +845,12 @@ protected function generateXlsTable() { } $excelObject->getActiveSheet()->setCellValue($excelColNames[$sheetCol] . $sheetRow, implode(', ', $xlsContentSecondLevel)); } - $sheetCol ++; + $sheetCol++; } $sheetCol += intval(count($headerPiVars) - count($piVars)); } - // Dynamic value like uid45 + // Dynamic value like uid45 } elseif (is_numeric(str_replace(array('uid', '_'), '', $key))) { // Explode uid44_0 to uid44 and 0 @@ -852,26 +866,28 @@ protected function generateXlsTable() { //$excelObject->getActiveSheet()->setCellValue($colname, $this->charConvert($this->cleanString(t3lib_div::htmlspecialchars_decode($piVars[$key])))); $value = $this->charConvert($this->cleanString(t3lib_div::htmlspecialchars_decode($piVars[$key]))); - switch ($this->formtypes[$key]){ - case 'date': - $value = ($value == intval($value) && $value !== '') ? gmdate($this->dateFormat, $value) : $value; - break; - case 'datetime': - $value = ($value == intval($value) && $value !== '') ? gmdate($this->datetimeFormat, $value) : $value; - break; - case 'file': - $value = $uploadURLPath . $value; - break; + switch ($this->formtypes[$key]) { + case 'date': + $value = ($value == intval($value) && $value !== '') + ? gmdate($this->dateFormat, $value) : $value; + break; + case 'datetime': + $value = ($value == intval($value) && $value !== '') + ? gmdate($this->datetimeFormat, $value) : $value; + break; + case 'file': + $value = $uploadURLPath . $value; + break; } $excelObject->getActiveSheet()->setCellValue($excelColNames[$sheetCol] . $sheetRow, $value); - // PiVars in second level + // PiVars in second level } else { - if($orgkey != $key) { + if ($orgkey != $key) { $newkey = explode('_', $orgkey); } $excelContentSecondLevel = array(); - foreach($piVars[$newkey[0]] as $key2 => $value2) { + foreach ($piVars[$newkey[0]] as $key2 => $value2) { if ($value2 != '') { $excelContentSecondLevel[] .= $this->charConvert($this->cleanString(t3lib_div::htmlspecialchars_decode($value2))); } @@ -879,20 +895,20 @@ protected function generateXlsTable() { $csvContent .= '"' . implode(', ', $excelContentSecondLevel) . '"' . $this->seperator; $excelObject->getActiveSheet()->setCellValue($colname, implode(', ', $excelContentSecondLevel)); } - $sheetCol ++; + $sheetCol++; } else { $excelObject->getActiveSheet()->setCellValue($colname, $this->charConvert($row[$key])); - $sheetCol ++; + $sheetCol++; } } - $sheetRow ++; + $sheetRow++; } } if ($this->xlsAutoSize) { // Set width of all columns to autosize - for ($autosize = 0; $autosize < $sheetCol; $autosize ++) { + for ($autosize = 0; $autosize < $sheetCol; $autosize++) { $excelObject->getActiveSheet()->getColumnDimension($excelColNames[$autosize])->setAutoSize(true); } } @@ -921,7 +937,7 @@ protected function generateXlsTable() { protected function setEncoding() { // Define output encoding -> No encoding is defined, set default if (empty($this->tsConfig['properties']['config.']['export.'][$this->export . '.']['encoding'])) { - if ($this->export == 'csv'){ + if ($this->export == 'csv') { $this->outputEncoding = $this->csvDefaultEncoding; } else { // Take standard charset from BE @@ -941,11 +957,11 @@ protected function setEncoding() { * @param string $raw is the filename to clean * @return string the new filename */ - protected function cleanFileName($raw){ - $raw = $this->LANG->csConvObj->specCharsToASCII($this->LANG->charSet, trim($raw)); - $removeChars = array( "([\40])" , "([^a-zA-Z0-9-_])", "(-{2,})" ); - $replaceWith = array("-", "", "-"); - return preg_replace($removeChars, $replaceWith, $raw); + protected function cleanFileName($raw) { + $raw = $this->LANG->csConvObj->specCharsToASCII($this->LANG->charSet, trim($raw)); + $removeChars = array("([\40])", "([^a-zA-Z0-9-_])", "(-{2,})"); + $replaceWith = array("-", "", "-"); + return preg_replace($removeChars, $replaceWith, $raw); } /** @@ -985,19 +1001,19 @@ protected function setDateTimeFormat() { if (!empty($this->tsConfig['properties']['config.']['export.']['dateformat'])) { $this->dateFormat = $this->tsConfig['properties']['config.']['export.']['dateformat']; } - if($this->debug) t3lib_div::devLog('dateFormat was set to ' . $this->dateFormat, $this->extKey, 0); + if ($this->debug) t3lib_div::devLog('dateFormat was set to ' . $this->dateFormat, $this->extKey, 0); if (!empty($this->tsConfig['properties']['config.']['export.']['timeformat'])) { $this->timeFormat = $this->tsConfig['properties']['config.']['export.']['timeformat']; } - if($this->debug) t3lib_div::devLog('timeFormat was set to ' . $this->timeFormat, $this->extKey, 0); + if ($this->debug) t3lib_div::devLog('timeFormat was set to ' . $this->timeFormat, $this->extKey, 0); } /** * Compress a file (not used any more) * * @param string $source Defines Source file to compress - * @param boolean $level Defines Compression level + * @param boolean $level Defines Compression level * @return string */ protected function gzcompressfile($source, $level = false) { @@ -1034,7 +1050,7 @@ protected function gzcompressfile($source, $level = false) { * @return void */ protected function generateFileHeader() { - if (strstr(t3lib_div::getIndpEnv('HTTP_USER_AGENT'),'MSIE')) { + if (strstr(t3lib_div::getIndpEnv('HTTP_USER_AGENT'), 'MSIE')) { $this->header .= header('Content-Type: application/force-download; charset=' . $this->outputEncoding); $this->header .= header('Content-Disposition: attachment; filename="' . $this->filename . '"'); } else { @@ -1090,11 +1106,11 @@ protected function getRowWithMostPiVars() { if ($row['piVars']) { $piVars = t3lib_div::xml2array($row['piVars'], 'piVars'); $countPiVars = count($piVars); - if ($countPiVars > $mostPiVars && $this->piVarsFromExportLanguageUid($piVars) ) { + if ($countPiVars > $mostPiVars && $this->piVarsFromExportLanguageUid($piVars)) { $mostPiVars = $countPiVars; $rowWithMostPiVars = $rowCounter; } - $rowCounter ++; + $rowCounter++; } } return $rowWithMostPiVars; @@ -1106,10 +1122,10 @@ protected function getRowWithMostPiVars() { * @param array $piVars this are the piVars to check * @return boolean returns true if piVars are from export header language uid */ - protected function piVarsFromExportLanguageUid($piVars) { - $piVarsKeys = array_keys($piVars); - $fieldUid = $piVarsKeys[0]; - $fieldUidInt = intval(str_replace(array('uid', '_'), '', $fieldUid)); + protected function piVarsFromExportLanguageUid($piVars) { + $piVarsKeys = array_keys($piVars); + $fieldUid = $piVarsKeys[0]; + $fieldUidInt = intval(str_replace(array('uid', '_'), '', $fieldUid)); $select = 'uid'; $from = 'tx_powermail_fields'; $where = 'pid = ' . $this->pid . ' AND uid = ' . $fieldUidInt . ' AND sys_language_uid = ' . $this->exportHeaderLanguageUid . $this->generalRecordsFilter; @@ -1120,47 +1136,45 @@ protected function piVarsFromExportLanguageUid($piVars) { $lookupRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($lookupRes); //if($this->debug) t3lib_div::devLog('SELECT ' . $select . ' FROM ' . $from . ' WHERE ' . $where . ' LIMIT ' . $limit, $this->extKey, 0); return $lookupRow ? true : false; - } - - /** - * generateFormtypesArray method Generate form types array of powermail on selected page as array - * - * @return void - */ - protected function generateFormtypesArray() { - $this->formtypes = array(); - - $select = 'uid,formtype'; - $from = 'tx_powermail_fields'; - //$where = 'pid = ' . intval($this->pid); - $where = ''; - $orderBy = ''; - $groupBy = ''; - $limit = ''; - - $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $from, $where, $groupBy, $orderBy, $limit); - if ($res) { - while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { - $this->formtypes['uid' . $row['uid']] = $row['formtype']; - } - } - $GLOBALS['TYPO3_DB']->sql_free_result($res); - } - - /** - * Method getLabelfromBackend() to get label to current field for emails and thx message + } + + /** + * generateFormtypesArray method Generate form types array of powermail on selected page as array + * + * @return void + */ + protected function generateFormtypesArray() { + $this->formtypes = array(); + + $select = 'uid,formtype'; + $from = 'tx_powermail_fields'; + //$where = 'pid = ' . intval($this->pid); + $where = ''; + $orderBy = ''; + $groupBy = ''; + $limit = ''; + + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $from, $where, $groupBy, $orderBy, $limit); + if ($res !== false) { + while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { + $this->formtypes['uid' . $row['uid']] = $row['formtype']; + } + $GLOBALS['TYPO3_DB']->sql_free_result($res); + } + } + + /** + * Method getFieldLabelFromBackend() to get label to current field for emails and thx message * - * @param string $name The uid with "uid" prefix - * @param string $value I have no dam idea about this var - * @return string */ - protected function getLabelfromBackend($name, $value) { + protected function getFieldLabelFromBackend() { + + $this->fieldLabel = $this->fieldUid; - // $name like uid55 - if (strpos($name, 'uid') !== FALSE) { - $uid = str_replace('uid', '', $name); + if (strpos($this->fieldUid, 'uid') !== FALSE) { + $uid = intval(str_replace('uid', '', $this->fieldUid)); - $select = 'f.title'; + $select = 'f.title, f.formtype'; $from = ' tx_powermail_fields f LEFT JOIN tx_powermail_fieldsets fs @@ -1198,30 +1212,31 @@ protected function getLabelfromBackend($name, $value) { OR c.fe_group = "-1" ) ) - AND f.uid = ' . intval($uid) . ' + AND f.uid = ' . $uid . ' AND f.deleted = 0'; - $groupBy = $orderBy = $limit = ''; + // GET title where fields.flexform LIKE vorname - $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $from, $where, $groupBy, $orderBy, $limit); + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $from, $where); - if ($res) { + if ($res !== false) { $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); + $GLOBALS['TYPO3_DB']->sql_free_result($res); + if (count($row) > 0) { + if (!empty($row['title'])) { + $this->fieldLabel = $row['title']; + $this->fieldType = $row['formtype']; + } else if ($uid >= 100000) { + // check for country select + $this->fieldUid = 'uid' . ($uid - 100000); + $this->getFieldLabelFromBackend(); + if ($this->fieldType == 'countryselect') { + $this->fieldLabel = sprintf($this->tsConfig['properties']['config.']['export.'][$this->export . '.']['country_zone_label'], $this->fieldLabel); + } + } + } } - - // If title was found return it - if (isset($row['title'])) { - return $row['title']; - - // If no title was found return - } else if ($uid < 100000) { - return 'POWERMAIL ERROR: No title to current field found in DB'; - } - - // No uid55 so return $name - } else { - return $name; } - } + } /** * Method getOriginalLanguageFieldUid() get the original language field uid @@ -1231,9 +1246,9 @@ protected function getLabelfromBackend($name, $value) { * @param string $fieldUidLevel2 this is the original field uid from level 2 (used by checkboxes and multiselect) * @return string returns the new field uid with 'uid' prefix */ - protected function getOriginalLanguageFieldUid($piVars, $fieldUid, $fieldUidLevel2 = '') { - $newFieldUid = $fieldUid; - $fieldUidInt = intval(str_replace(array('uid', '_'), '', $fieldUid)); + protected function getOriginalLanguageFieldUid($piVars, $fieldUid, $fieldUidLevel2 = '') { + $newFieldUid = $fieldUid; + $fieldUidInt = intval(str_replace(array('uid', '_'), '', $fieldUid)); $select = 'uid'; $from = 'tx_powermail_fields'; $where = 'pid = ' . $this->pid . ' AND l18n_parent = ' . $fieldUidInt . $this->generalRecordsFilter; @@ -1247,7 +1262,7 @@ protected function getOriginalLanguageFieldUid($piVars, $fieldUid, $fieldUidLeve } $GLOBALS['TYPO3_DB']->sql_free_result($lookupRes); return $newFieldUid; - } + } /** * Method charConvert() converts a string from backend charset to outputEncoding charset @@ -1259,38 +1274,38 @@ protected function charConvert($string2convert) { return $this->LANG->csConvObj->conv($string2convert, $this->LANG->charSet, $this->outputEncoding); } - /** + /** * Method cleanString() cleans up a string * * @param string $string2clean this is the string to clean * @return string returns the cleaned string */ protected function cleanString($string2clean) { - switch ($this->export){ + switch ($this->export) { case 'csv': $string2clean = str_replace(array("\n\r", "\r\n", "\n", "\r"), '', $string2clean); $string2clean = str_replace('"', "'", $string2clean); $string2clean = stripslashes($string2clean); - break; + break; default: $string2clean = stripslashes($string2clean); } - return $string2clean; - } + return $string2clean; + } - /** + /** * Method getExcelColNames() returns an array with Excel column names like A or AA * * @param integer $cols this is the number of cols who should be generated * @return array returns the excelColNames array; */ - protected function getExcelColNames($cols = 1000) { - $excelColNames = array(); - for ($excelCol = 0; $excelCol < $cols; $excelCol ++) { + protected function getExcelColNames($cols = 1000) { + $excelColNames = array(); + for ($excelCol = 0; $excelCol < $cols; $excelCol++) { $excelColNames[] .= $this->num2alpha($excelCol); - } - return $excelColNames; - } + } + return $excelColNames; + } /** * Method num2alpha() returns a string with a Excel column name like A or AA of a give column position @@ -1299,8 +1314,8 @@ protected function getExcelColNames($cols = 1000) { * @return string returns the excel column value; */ protected function num2alpha($n) { - for($r = ''; $n >= 0; $n = intval($n / 26) - 1) { - $r = chr($n %26 + 0x41) . $r; + for ($r = ''; $n >= 0; $n = intval($n / 26) - 1) { + $r = chr($n % 26 + 0x41) . $r; } return $r; } diff --git a/mod1/class.tx_powermail_repository.php b/mod1/class.tx_powermail_repository.php index de6d4b67..afc496f0 100644 --- a/mod1/class.tx_powermail_repository.php +++ b/mod1/class.tx_powermail_repository.php @@ -1,26 +1,26 @@ ajaxContentArray['success'] = false; - + // Count numbers of all entries $startDateAdd = ''; $endDateAdd = ''; - if ($this->startDateTime > 0){ + if ($this->startDateTime > 0) { $startDateAdd = ' AND crdate > ' . $this->startDateTime; } - if ($this->endDateTime > 0){ + if ($this->endDateTime > 0) { $endDateAdd = ' AND crdate < ' . $this->endDateTime; } @@ -107,8 +106,8 @@ public function main() { $from = 'tx_powermail_mails'; $where = ' pid = ' . intval($this->pid) . - $startDateAdd . - $endDateAdd . ' + $startDateAdd . + $endDateAdd . ' AND hidden = 0 AND deleted = 0'; $orderBy = $this->sort . ' ' . $this->dir; @@ -117,55 +116,55 @@ public function main() { // Get number of results $res1 = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $from, $where, $groupBy, $orderBy, $limit); - if ($res1 !== false) { - $row1 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res1); - $this->ajaxContentArray['results'] = $row1['results']; - $this->ajaxContentArray['mindatetime'] = $row1['mindate']; - $this->ajaxContentArray['maxdatetime'] = $row1['maxdate']; - - // Get entries - $select = '*'; - $limit = intval($this->pointer) . ',' . intval($this->perpage); - $res2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $from, $where, $groupBy, $orderBy, $limit); - - // If on current page is a result - if ($res2 !== false) { - $this->ajaxContentArray['success'] = true; - $i = $this->pointer; - while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res2)) { - $i++; - $this->ajaxContentArray['rows'][] = array( - 'id' => $i, - 'uid' => $row['uid'], - 'crdate' => date($this->timeformat, $row['crdate']), - 'sender' => $row['sender'], - 'recipient' => $row['recipient'], - 'senderIP' => $row['senderIP'], - 'piVars' => $this->transformPiVars($row['piVars']), - 'uploadPath' => $row['uploadPath'] - ); - } - $GLOBALS['TYPO3_DB']->sql_free_result($res2); - } - $GLOBALS['TYPO3_DB']->sql_free_result($res1); - } + if ($res1 !== false) { + $row1 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res1); + $this->ajaxContentArray['results'] = $row1['results']; + $this->ajaxContentArray['mindatetime'] = $row1['mindate']; + $this->ajaxContentArray['maxdatetime'] = $row1['maxdate']; + + // Get entries + $select = '*'; + $limit = intval($this->pointer) . ',' . intval($this->perpage); + $res2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $from, $where, $groupBy, $orderBy, $limit); + + // If on current page is a result + if ($res2 !== false) { + $this->ajaxContentArray['success'] = true; + $i = $this->pointer; + while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res2)) { + $i++; + $this->ajaxContentArray['rows'][] = array( + 'id' => $i, + 'uid' => $row['uid'], + 'crdate' => date($this->timeformat, $row['crdate']), + 'sender' => $row['sender'], + 'recipient' => $row['recipient'], + 'senderIP' => $row['senderIP'], + 'piVars' => $this->transformPiVars($row['piVars']), + 'uploadPath' => $row['uploadPath'] + ); + } + $GLOBALS['TYPO3_DB']->sql_free_result($res2); + } + $GLOBALS['TYPO3_DB']->sql_free_result($res1); + } return $this->ajaxContentArray; } - - /** - * transformPiVars method Returns labels of powermail on selected page as array - * - * @return array - */ - - protected function transformPiVars($piVars){ - if (!is_array(t3lib_div::xml2array($piVars))) return t3lib_div::xml2array($piVars); - $piVarsArray = t3lib_div::removeArrayEntryByValue(t3lib_div::xml2array($piVars), ''); - if(array_key_exists('FILE', $piVarsArray)) { - unset($piVarsArray['FILE']); - } - return $piVarsArray; - } + + /** + * transformPiVars method Returns labels of powermail on selected page as array + * + * @return array + */ + + protected function transformPiVars($piVars) { + if (!is_array(t3lib_div::xml2array($piVars))) return t3lib_div::xml2array($piVars); + $piVarsArray = t3lib_div::removeArrayEntryByValue(t3lib_div::xml2array($piVars), ''); + if (array_key_exists('FILE', $piVarsArray)) { + unset($piVarsArray['FILE']); + } + return $piVarsArray; + } /** * getLabels method Returns labels of powermail on selected page as array @@ -186,58 +185,58 @@ public function getLabelsAndFormtypes() { $labels['labels'][] = array( 'uid' => $row['uid'], 'title' => $row['title'], - 'formtype' => $row['formtype'] + 'formtype' => $row['formtype'] ); - $i ++; + $i++; } $labels['results'] = $i; $labels['success'] = true; - $GLOBALS['TYPO3_DB']->sql_free_result($res); + $GLOBALS['TYPO3_DB']->sql_free_result($res); } return $labels; } - /** - * getPidOfFormFromMailsOnGivenPage method Returns the correct pid of the form from mails on given page - * - * @param $pid The pid where the mails are stored - * @return integer The pid where the form to this mails are stored - */ - protected function getPidOfFormFromMailsOnGivenPage($pid){ - - $formIdPid = $pid; - - $select = 'formid'; - $from = 'tx_powermail_mails'; - $where = 'pid = ' . intval($pid); - $orderBy = ''; - $groupBy = ''; - $limit = '1'; - - $res1 = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $from, $where, $groupBy, $orderBy, $limit); - if($res1 !== false){ - $row1 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res1); - $formid = $row1['formid']; - - $select = 'pid'; - $from = 'tt_content'; - $where = 'uid = ' . intval($formid); - $orderBy = ''; - $groupBy = ''; - $limit = '1'; - - $res2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $from, $where, $groupBy, $orderBy, $limit); - if($res2 !== false){ - $row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res2); - $formIdPid = $row2['pid']; - $GLOBALS['TYPO3_DB']->sql_free_result($res2); - } - $GLOBALS['TYPO3_DB']->sql_free_result($res1); - } - - return $formIdPid; - } + /** + * getPidOfFormFromMailsOnGivenPage method Returns the correct pid of the form from mails on given page + * + * @param $pid The pid where the mails are stored + * @return integer The pid where the form to this mails are stored + */ + protected function getPidOfFormFromMailsOnGivenPage($pid) { + + $formIdPid = $pid; + + $select = 'formid'; + $from = 'tx_powermail_mails'; + $where = 'pid = ' . intval($pid); + $orderBy = ''; + $groupBy = ''; + $limit = '1'; + + $res1 = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $from, $where, $groupBy, $orderBy, $limit); + if ($res1 !== false) { + $row1 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res1); + $formid = $row1['formid']; + + $select = 'pid'; + $from = 'tt_content'; + $where = 'uid = ' . intval($formid); + $orderBy = ''; + $groupBy = ''; + $limit = '1'; + + $res2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $from, $where, $groupBy, $orderBy, $limit); + if ($res2 !== false) { + $row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res2); + $formIdPid = $row2['pid']; + $GLOBALS['TYPO3_DB']->sql_free_result($res2); + } + $GLOBALS['TYPO3_DB']->sql_free_result($res1); + } + + return $formIdPid; + } } if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/mod1/class.tx_powermail_repository.php']) { diff --git a/mod1/conf.php b/mod1/conf.php index ef391e6b..f2ec7a85 100644 --- a/mod1/conf.php +++ b/mod1/conf.php @@ -1,14 +1,14 @@ id) === 0) { @@ -54,7 +54,7 @@ public function init() { * * @return void */ - public function main() { + public function main() { global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS; $this->LANG = $LANG; @@ -73,7 +73,7 @@ public function main() { $this->perpage = 25; // Get hits per page if set by tsconfig - if($this->tsconfig['properties']['config.']['list.']['perPage'] > 0) { + if ($this->tsconfig['properties']['config.']['list.']['perPage'] > 0) { $this->perpage = intval($this->tsconfig['properties']['config.']['list.']['perPage']); } @@ -83,7 +83,7 @@ public function main() { $this->pageRenderer = $this->doc->getPageRenderer(); // Add CSS for backend modul - $this->pageRenderer->addCssFile( $BACK_PATH . t3lib_extMgm::extRelPath('powermail') . 'res/css/powermail_backend.css' ); + $this->pageRenderer->addCssFile($BACK_PATH . t3lib_extMgm::extRelPath('powermail') . 'res/css/powermail_backend.css'); // Include Ext JS stuff $this->pageRenderer->loadExtJS(); @@ -100,13 +100,13 @@ public function main() { // Include Ext JS inline code $this->pageRenderer->addJsInlineCode( 'Powermail_Overview', - + 'Ext.namespace("Powermail"); // Parameter definition Powermail.statics = { "pagingSize": ' . $this->perpage . ', - "pid": ' . $this->id .', + "pid": ' . $this->id . ', "sort": "crdate", "dir": "DESC", "filterIcon": "' . $this->enableQuotes(t3lib_iconWorks::getSpriteIcon('actions-system-tree-search-open')) . '", @@ -150,7 +150,8 @@ public function main() { "records": "' . $LANG->getLL('rows') . '", "recordsPerPage": "' . $LANG->getLL('perpage') . '", "createShortcut": "' . $LANG->getLL('shortcut') . '", - "exportAs": "' . (($this->tsconfig['properties']['config.']['export.']['csv.']['enable'] || $this->tsconfig['properties']['config.']['export.']['html.']['enable'] || $this->tsconfig['properties']['config.']['export.']['xls.']['enable'] || $this->tsconfig['properties']['config.']['export.']['pdf.']['enable']) ? $LANG->getLL('exportformat') : '') . '", + "exportAs": "' . (($this->tsconfig['properties']['config.']['export.']['csv.']['enable'] || $this->tsconfig['properties']['config.']['export.']['html.']['enable'] || $this->tsconfig['properties']['config.']['export.']['xls.']['enable'] || $this->tsconfig['properties']['config.']['export.']['pdf.']['enable']) + ? $LANG->getLL('exportformat') : '') . '", "exportPdfText": "' . $LANG->getLL('exportpdf') . '", "exportHtmlText": "' . $LANG->getLL('exporthtml') . '", "exportCsvText": "' . $LANG->getLL('exportcsv') . '", @@ -163,10 +164,10 @@ public function main() { "receiver": "' . $LANG->getLL('receiver') . '", "senderIP": "' . $LANG->getLL('ip') . '", "noExcel": "' . $LANG->getLL('phpexcel_library') . '", - "noPdf": "' . $LANG->getLL('noPdf' , 'This export format is currently not implemented. Please contact the powermail development team, if you want to sponsor this feature.') . '", + "noPdf": "' . $LANG->getLL('noPdf', 'This export format is currently not implemented. Please contact the powermail development team, if you want to sponsor this feature.') . '", "noMails1": "' . $LANG->getLL('nopowermails1') . '", "noMails2": "' . $LANG->getLL('nopowermails2') . '", - "uploadPath": "' . $LANG->getLL('uploadPath' , 'uploadPath') . '" + "uploadPath": "' . $LANG->getLL('uploadPath', 'uploadPath') . '" }; '); @@ -224,7 +225,7 @@ private function mailsOnCurrentPage() { $groupBy = ''; $orderBy = ''; $limit = 1; - $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery ($select, $from, $where, $groupBy, $orderBy, $limit); + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $from, $where, $groupBy, $orderBy, $limit); if ($res) { $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); // Result in array if ($row['uid'] > 0) { @@ -239,11 +240,11 @@ private function mailsOnCurrentPage() { * * @return void */ - public function menuConfig() { + public function menuConfig() { global $LANG; - $this->MOD_MENU = array ( - 'function' => array ( + $this->MOD_MENU = array( + 'function' => array( '1' => '[icon_table]' . $LANG->getLL('function1'), '2' => '[icon_chart]' . $LANG->getLL('function2') ) @@ -267,12 +268,12 @@ private function enableQuotes($string) { * * @return void */ - public function printContent() { + public function printContent() { echo $this->content; } } -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/mod1/index.php']) { +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/mod1/index.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/mod1/index.php']); } @@ -280,7 +281,7 @@ public function printContent() { $SOBE = t3lib_div::makeInstance('tx_powermail_module1'); $SOBE->init(); // Include files? -foreach($SOBE->include_once as $INC_FILE) { +foreach ($SOBE->include_once as $INC_FILE) { include_once($INC_FILE); } $SOBE->main(); diff --git a/pageTSconfig.txt b/pageTSconfig.txt index bf4a8282..c9804783 100644 --- a/pageTSconfig.txt +++ b/pageTSconfig.txt @@ -12,6 +12,7 @@ tx_powermail_mod1.config { datetimeFormat = d.m.Y H:i dateFormat = d.m.Y timeFormat = H:i + country_zone_label = State of %s } export { datetimeFormat = d.m.Y H:i @@ -23,16 +24,20 @@ tx_powermail_mod1.config { encoding = utf-8 autoSize = 1 enable = 1 + country_zone_label = State of %s } csv { encoding = utf-8 enable = 1 + country_zone_label = State of %s } html { enable = 1 + country_zone_label = State of %s } pdf { enable = 0 + country_zone_label = State of %s } } } diff --git a/pi1/class.tx_powermail_confirmation.php b/pi1/class.tx_powermail_confirmation.php index 3718ea21..228e9060 100644 --- a/pi1/class.tx_powermail_confirmation.php +++ b/pi1/class.tx_powermail_confirmation.php @@ -1,34 +1,35 @@ -* All rights reserved -* -* This script is part of the TYPO3 project. The TYPO3 project is -* free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* The GNU General Public License can be found at -* http://www.gnu.org/copyleft/gpl.html. -* -* This script is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* This copyright notice MUST APPEAR in all copies of the script! -***************************************************************/ + * Copyright notice + * + * (c) 2011 powermail development team (details on http://forge.typo3.org/projects/show/extension-powermail) + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ -require_once(PATH_tslib.'class.tslib_pibase.php'); -require_once(t3lib_extMgm::extPath('powermail').'lib/class.tx_powermail_functions_div.php'); // file for div functions -require_once(t3lib_extMgm::extPath('powermail').'lib/class.tx_powermail_markers.php'); // file for marker functions -require_once(t3lib_extMgm::extPath('powermail').'lib/class.tx_powermail_dynamicmarkers.php'); // file for dynamicmarker functions + +require_once(PATH_tslib . 'class.tslib_pibase.php'); +require_once(t3lib_extMgm::extPath('powermail') . 'lib/class.tx_powermail_functions_div.php'); // file for div functions +require_once(t3lib_extMgm::extPath('powermail') . 'lib/class.tx_powermail_markers.php'); // file for marker functions +require_once(t3lib_extMgm::extPath('powermail') . 'lib/class.tx_powermail_dynamicmarkers.php'); // file for dynamicmarker functions class tx_powermail_confirmation extends tslib_pibase { - var $extKey = 'powermail'; // The extension key. + var $extKey = 'powermail'; // The extension key. var $pi_checkCHash = true; function main($conf, $sessionfields, $cObj) { @@ -38,61 +39,59 @@ function main($conf, $sessionfields, $cObj) { $this->pi_setPiVarDefaults(); $this->pi_loadLL(); $this->pi_initPIflexform(); // Init and get the flexform data of the plugin - + // Instances $this->dynamicMarkers = t3lib_div::makeInstance('tx_powermail_dynamicmarkers'); // New object: TYPO3 dynamicmarker function $this->markers = t3lib_div::makeInstance('tx_powermail_markers'); // New object: TYPO3 marker functions $this->div = t3lib_div::makeInstance('tx_powermail_functions_div'); // New object: div functions - + // Template $this->tmpl = array(); - $this->tmpl['all'] = $this->cObj->getSubpart(tslib_cObj::fileResource($this->conf['template.']['confirmation']),'###POWERMAIL_CONFIRMATION###'); // Load HTML Template (work on subpart) - + $this->tmpl['all'] = $this->cObj->getSubpart(tslib_cObj::fileResource($this->conf['template.']['confirmation']), '###POWERMAIL_CONFIRMATION###'); // Load HTML Template (work on subpart) + // Fill Markers $this->markerArray = $this->markers->GetMarkerArray($this->conf, $this->sessionfields, $this->cObj, 'confirmation'); // Fill markerArray - $this->markerArray['###POWERMAIL_NAME_BACK###'] = $this->cObj->data['tx_powermail_title'].'_confirmation_back'; // Fill Marker with formname - $this->markerArray['###POWERMAIL_NAME_SUBMIT###'] = $this->cObj->data['tx_powermail_title'].'_confirmation_submit'; // Fill Marker with formname + $this->markerArray['###POWERMAIL_NAME_BACK###'] = $this->cObj->data['tx_powermail_title'] . '_confirmation_back'; // Fill Marker with formname + $this->markerArray['###POWERMAIL_NAME_SUBMIT###'] = $this->cObj->data['tx_powermail_title'] . '_confirmation_submit'; // Fill Marker with formname $this->markerArray['###POWERMAIL_METHOD###'] = $this->conf['form.']['method']; // Form method - //$this->markerArray['###POWERMAIL_TARGET_BACK###'] = $this->cObj->typolink('x', array('returnLast' => 'url', 'parameter' => $GLOBALS['TSFE']->id, 'section' => ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']), 'useCacheHash'=>1)); // Create target url - //$this->markerArray['###POWERMAIL_TARGET_BACK###'] = $this->cObj->typolink('x', array('returnLast' => 'url', 'parameter' => $GLOBALS['TSFE']->id, 'useCacheHash'=>1)); // Create target url - //$this->markerArray['###POWERMAIL_TARGET_SUBMIT###'] = $this->cObj->typolink('x', array('returnLast' => 'url', 'parameter' => $GLOBALS['TSFE']->id, 'section' => ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']), 'additionalParams' => '&tx_powermail_pi1[mailID]='.($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']).'&tx_powermail_pi1[sendNow]=1', 'useCacheHash' => 1)); // Create target url - $this->markerArray['###POWERMAIL_TARGET_BACK###'] = $this->cObj->typolink('x', array( - 'returnLast' => 'url', - 'parameter' => $GLOBALS['TSFE']->id, - 'useCacheHash' => 1, - 'no_cache' => $this->conf['caching'] - )); + $this->markerArray['###POWERMAIL_TARGET_BACK###'] = $this->cObj->typolink('x', array( + 'returnLast' => 'url', + 'parameter' => $GLOBALS['TSFE']->id, + 'useCacheHash' => 1, + 'no_cache' => $this->conf['caching'] + )); $this->markerArray['###POWERMAIL_TARGET_SUBMIT###'] = $this->cObj->typolink('x', array( - 'returnLast' => 'url', - 'parameter' => $GLOBALS['TSFE']->id, - 'section' => ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']), - 'additionalParams' => '&tx_powermail_pi1[mailID]='.($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']).'&tx_powermail_pi1[sendNow]=1', - 'useCacheHash' => 1, - )); + 'returnLast' => 'url', + 'parameter' => $GLOBALS['TSFE']->id, + 'section' => ($this->cObj->data['_LOCALIZED_UID'] > 0 + ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']), + 'additionalParams' => '&tx_powermail_pi1[mailID]=' . ($this->cObj->data['_LOCALIZED_UID'] > 0 + ? $this->cObj->data['_LOCALIZED_UID'] + : $this->cObj->data['uid']) . '&tx_powermail_pi1[sendNow]=1', + 'useCacheHash' => 1, + )); $this->hook(); // adds hook - $this->content = $this->cObj->substituteMarkerArrayCached($this->tmpl['all'],$this->markerArray); // substitute Marker in Template + $this->content = $this->cObj->substituteMarkerArrayCached($this->tmpl['all'], $this->markerArray); // substitute Marker in Template $this->content = $this->dynamicMarkers->main($this->conf, $this->cObj, $this->content); // Fill dynamic locallang or typoscript markers $this->content = preg_replace("|###.*?###|i", "", $this->content); // Finally clear not filled markers - if (!$this->div->subpartsExists($this->tmpl)) $this->content = $this->pi_getLL('error_templateNotFound', 'Template not found, check path to your powermail templates').'
'; + if (!$this->div->subpartsExists($this->tmpl)) $this->content = $this->pi_getLL('error_templateNotFound', 'Template not found, check path to your powermail templates') . '
'; return $this->content; // return HTML } - - + // Function hook() to enable manipulation data with another extension(s) function hook() { if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_ConfirmationHook'])) { // Adds hook for processing of extra global markers - foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_ConfirmationHook'] as $_classRef) { + foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_ConfirmationHook'] as $_classRef) { $_procObj = & t3lib_div::getUserObj($_classRef); - $_procObj->PM_ConfirmationHook($this->markerArray,$this); // Open function to manipulate data + $_procObj->PM_ConfirmationHook($this->markerArray, $this); // Open function to manipulate data } } } } - -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/pi1/class.tx_powermail_confirmation.php']) { +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/pi1/class.tx_powermail_confirmation.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/pi1/class.tx_powermail_confirmation.php']); } diff --git a/pi1/class.tx_powermail_form.php b/pi1/class.tx_powermail_form.php index 307d00f8..a8d22224 100644 --- a/pi1/class.tx_powermail_form.php +++ b/pi1/class.tx_powermail_form.php @@ -1,26 +1,26 @@ cObj->data['tx_powermail_multiple'] == 2) { // If multiple (PHP) active (load tmpl_multiple.html) // Set limit - $limitArray = array(0,1); // If multiple (PHP) set limit + $limitArray = array(0, 1); // If multiple (PHP) set limit if (isset($this->piVars['multiple'])) { $limitArray[0] = ($this->piVars['multiple'] - 1); // Set current fieldset } @@ -74,8 +74,6 @@ public function main($conf, $sessionfields, $cObj) { } elseif ($this->cObj->data['tx_powermail_multiple'] == 1) { // If multiple (JS) active - // add css for multiple javascript - //$GLOBALS['TSFE']->additionalHeaderData[$this->extKey] .= "\t" . ''; $limit = ''; // no limit for SQL select } elseif ($this->cObj->data['tx_powermail_multiple'] == 0) { // Standardmode @@ -97,8 +95,9 @@ public function main($conf, $sessionfields, $cObj) { */ private function form($limit = '') { // Configuration - $this->InnerMarkerArray = $this->OuterMarkerArray = $this->tmpl = array(); $this->content_item = ''; // init - $i=1; // counter for automatic tabindex + $this->InnerMarkerArray = $this->OuterMarkerArray = $this->tmpl = array(); + $this->content_item = ''; // init + $i = 1; // counter for automatic tabindex $this->tmpl['all'] = tslib_cObj::fileResource($this->conf['template.']['formWrap']); // Load HTML Template $this->tmpl['formwrap']['all'] = $this->cObj->getSubpart($this->tmpl['all'], '###POWERMAIL_FORMWRAP###'); // work on subpart 1 $this->tmpl['formwrap']['item'] = $this->cObj->getSubpart($this->tmpl['formwrap']['all'], '###POWERMAIL_ITEM###'); // work on subpart 2 @@ -108,80 +107,85 @@ private function form($limit = '') { $this->cObj->start($this->cObj->data, 'tx_powermail_fieldsets'); // enable .field in typoscript $this->OuterMarkerArray['###POWERMAIL_ACTION###'] = $this->cObj->cObjGetSingle($this->conf['formaction'], $this->conf['formaction.']); $this->OuterMarkerArray['###POWERMAIL_NAME###'] = $this->cObj->data['tx_powermail_title']; // Fill Marker with formname - $formUid = $this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']; + $formUid = $this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']; $this->OuterMarkerArray['###POWERMAIL_FORM_UID###'] = $formUid; // Form method if ($this->cObj->data['tx_powermail_multiple'] == 2) { // If multiple PHP is set $this->OuterMarkerArray['###POWERMAIL_MULTIPLE_BACKLINK###'] = $this->multipleLink(-1); // Backward Link (-1) $this->OuterMarkerArray['###POWERMAIL_MULTIPLE_FORWARDLINK###'] = $this->multipleLink(1); // Forward Link (+1) $this->OuterMarkerArray['###POWERMAIL_MULTIPLE_PAGEBROWSER###'] = $this->multipleLink(0); // Pagebrowser - $this->OuterMarkerArray['###POWERMAIL_MULTIPLE###'] = ' powermail_multiple_php'; + $this->OuterMarkerArray['###POWERMAIL_MULTIPLE###'] = ' powermail_multiple_php'; if ($this->multiple['numberoffieldsets'] != $this->multiple['currentpage']) { // On last fieldset, don't overwrite Target $linkVars = array( - 'returnLast' => 'url', - 'parameter' => $GLOBALS['TSFE']->id, - 'additionalParams' => '&tx_powermail_pi1[mailID]=' . intval($formUid) . '&tx_powermail_pi1[multiple]=' . ($this->multiple['currentpage'] + 1), + 'returnLast' => 'url', + 'parameter' => $GLOBALS['TSFE']->id, + 'additionalParams' => '&tx_powermail_pi1[mailID]=' . intval($formUid) . '&tx_powermail_pi1[multiple]=' . ($this->multiple['currentpage'] + 1), 'useCacheHash' => 1 ); $this->OuterMarkerArray['###POWERMAIL_ACTION###'] = $this->cObj->typolink('x', $linkVars); // Overwrite Target } } elseif ($this->cObj->data['tx_powermail_multiple'] == 1) { // If multiple JS is set $this->OuterMarkerArray['###POWERMAIL_MULTIPLE_PAGEBROWSER###'] = $this->multipleLink('js'); // JavaScript switch - $this->OuterMarkerArray['###POWERMAIL_MULTIPLE###'] = ' powermail_multiple_js'; + $this->OuterMarkerArray['###POWERMAIL_MULTIPLE###'] = ' powermail_multiple_js'; } // UID of the last fieldset to current tt_content $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( 'uid', 'tx_powermail_fieldsets', - 'tt_content = ' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']) . tslib_cObj::enableFields('tx_powermail_fieldsets'), + 'tt_content = ' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] + : $this->cObj->data['uid']) . tslib_cObj::enableFields('tx_powermail_fieldsets'), '', 'sorting DESC', '1' ); $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); $this->lastfieldset = $row['uid']; // uid of last fieldset to current tt_content (needed to show only on the last fieldset the captcha code) + $GLOBALS['TYPO3_DB']->sql_free_result($res); // Give me all needed fieldsets - $res1 = $GLOBALS['TYPO3_DB']->exec_SELECTquery ( + $res1 = $GLOBALS['TYPO3_DB']->exec_SELECTquery( '*', // 'uid,title', before 'tx_powermail_fieldsets', - $where_clause = 'tt_content = ' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']) . tslib_cObj::enableFields('tx_powermail_fieldsets'), + $where_clause = 'tt_content = ' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] + : $this->cObj->data['uid']) . tslib_cObj::enableFields('tx_powermail_fieldsets'), $groupBy = '', $orderBy = 'sorting ASC', $limit ); - if ($res1) { // If there is a result + if ($res1 !== false) { // If there is a result while ($row_fs = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res1)) { // One loop for every fieldset $this->InnerMarkerArray['###POWERMAIL_FIELDS###'] = ''; // init // Give me all fields in current fieldset, which are related to current content - $res2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery ( + $res2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery( 'tx_powermail_fieldsets.uid fs_uid, tx_powermail_fields.uid f_uid, tx_powermail_fieldsets.felder fs_fields, tx_powermail_fieldsets.title fs_title, tx_powermail_fieldsets.class fs_class, tx_powermail_fields.title f_title, tx_powermail_fields.formtype f_type, tx_powermail_fields.flexform f_field, tt_content.tx_powermail_title c_title, tx_powermail_fields.fe_field f_fefield, tx_powermail_fields.description f_description, tx_powermail_fields.class f_class', 'tx_powermail_fieldsets LEFT JOIN tx_powermail_fields ON tx_powermail_fieldsets.uid = tx_powermail_fields.fieldset LEFT JOIN tt_content ON tx_powermail_fieldsets.tt_content = tt_content.uid', - $where_clause = 'tx_powermail_fieldsets.tt_content = ' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']) . ' AND tx_powermail_fields.fieldset = ' . $row_fs['uid'] . tslib_cObj::enableFields('tx_powermail_fieldsets') . tslib_cObj::enableFields('tx_powermail_fields'), + $where_clause = 'tx_powermail_fieldsets.tt_content = ' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] + : $this->cObj->data['uid']) . ' AND tx_powermail_fields.fieldset = ' . $row_fs['uid'] . tslib_cObj::enableFields('tx_powermail_fieldsets') . tslib_cObj::enableFields('tx_powermail_fields'), $groupBy = '', $orderBy = 'tx_powermail_fieldsets.sorting, tx_powermail_fields.sorting', $limit1 = '' ); - if ($res2) { // If there is a result - while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res2)) { // One loop for every field - if($this->conf['moveSubmitToOuterMarker'] && $row['f_type'] == 'submit') { - $this->OuterMarkerArray['###POWERMAIL_SUBMIT_FIELDS###'] .= $this->html_input_field->main($this->conf, $this->sessionfields, $this->cObj, $row, $this->tabindexArray(), $i); // Submit button - } else { - $this->InnerMarkerArray['###POWERMAIL_FIELDS###'] .= $this->html_input_field->main($this->conf, $this->sessionfields, $this->cObj, $row, $this->tabindexArray(), $i); // Get HTML code for each field - } - $i++; // increase counter + if ($res2 !== false) { // If there is a result + while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res2)) { // One loop for every field + if ($this->conf['moveSubmitToOuterMarker'] && $row['f_type'] == 'submit') { + $this->OuterMarkerArray['###POWERMAIL_SUBMIT_FIELDS###'] .= $this->html_input_field->main($this->conf, $this->sessionfields, $this->cObj, $row, $this->tabindexArray(), $i); // Submit button + } else { + $this->InnerMarkerArray['###POWERMAIL_FIELDS###'] .= $this->html_input_field->main($this->conf, $this->sessionfields, $this->cObj, $row, $this->tabindexArray(), $i); // Get HTML code for each field + } } + $GLOBALS['TYPO3_DB']->sql_free_result($res2); } $this->InnerMarkerArray['###POWERMAIL_FIELDSETNAME###'] = htmlspecialchars($row_fs['title']); // Name of fieldset $this->InnerMarkerArray['###POWERMAIL_FIELDSETNAME_small###'] = $this->div->clearName($row_fs['title'], 1, 32); // Fieldsetname clear (strtolower = 1 / cut after 32 letters) $this->InnerMarkerArray['###POWERMAIL_FIELDSET_UID###'] = $row_fs['uid']; // uid of fieldset - // own css for fieldset + // own css for fieldset $this->InnerMarkerArray['###OWNCSS###'] = htmlspecialchars($row_fs['class']) . ' '; $this->hookInner($row_fs); // adds hookInner $this->content_item .= $this->cObj->substituteMarkerArrayCached($this->tmpl['formwrap']['item'], $this->InnerMarkerArray); } + $GLOBALS['TYPO3_DB']->sql_free_result($res1); } $this->subpartArray = array('###POWERMAIL_CONTENT###' => $this->content_item); // work on subpart 3 @@ -208,26 +212,36 @@ private function tabindexArray() { $array = array(); //init // Let's go - $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery ( + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( 'tx_powermail_fields.uid, tx_powermail_fields.formtype, tx_powermail_fields.flexform', 'tx_powermail_fields LEFT JOIN tx_powermail_fieldsets ON tx_powermail_fields.fieldset = tx_powermail_fieldsets.uid LEFT JOIN tt_content ON tx_powermail_fieldsets.tt_content = tt_content.uid', - $where_clause = 'tx_powermail_fieldsets.tt_content = ' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']) . tslib_cObj::enableFields('tx_powermail_fieldsets') . tslib_cObj::enableFields('tx_powermail_fields'), + $where_clause = 'tx_powermail_fieldsets.tt_content = ' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] + : $this->cObj->data['uid']) . tslib_cObj::enableFields('tx_powermail_fieldsets') . tslib_cObj::enableFields('tx_powermail_fields'), $groupBy = '', $orderBy = 'tx_powermail_fieldsets.sorting, tx_powermail_fields.sorting', $limit = '' ); - if ($res) { // If there is a result + if ($res !== false) { // If there is a result while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { // One loop for every field - if ($row['formtype'] != 'check' && $row['formtype'] != 'radio') { // if not checkbox or radiobuttons - $array[] = $row['uid']; // increase array with this uid - } else { // if checkbox or radiobuttons - $options = t3lib_div::trimExplode("\n", $this->pi_getFFvalue(t3lib_div::xml2array($row['flexform']), 'options'), 1); // all options in an array - - for ($i=0; $ipi_getFFvalue(t3lib_div::xml2array($row['flexform']), 'options'), 1); // all options in an array + for ($i = 0; $i < count($options); $i++) { // one loop for every option + $array[] = $row['uid'] . '_' . $i; // increase array with this uid + } + break; + case 'countryselect': + $array[] = $row['uid']; + if ($this->pi_getFFvalue(t3lib_div::xml2array($row['flexform']), 'countryzone') == 1) { + $array[] = $row['uid'] + 100000; + } + break; + default: + $array[] = $row['uid']; // increase array with this uid } } + $GLOBALS['TYPO3_DB']->sql_free_result($res); } return $array; @@ -241,15 +255,19 @@ private function tabindexArray() { private function multipleLink($add = 0) { // Get number of pages of current form $this->multiple = array(); - $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery ( + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( 'count(*) no', 'tx_powermail_fieldsets', - $where_clause = 'tt_content = ' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']) . tslib_cObj::enableFields('tx_powermail_fieldsets'), + $where_clause = 'tt_content = ' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] + : $this->cObj->data['uid']) . tslib_cObj::enableFields('tx_powermail_fieldsets'), $groupBy = '', $orderBy = '', $limit ); - if ($res) $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); + if ($res !== false) { + $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); + $GLOBALS['TYPO3_DB']->sql_free_result($res); + } // Configuration $this->multiple['numberoffieldsets'] = $row['no']; // Numbers of all fieldsets @@ -271,9 +289,10 @@ private function multipleLink($add = 0) { if ($this->multiple['currentpage'] > 1) { // If current fieldset is not the first $linkVars = array( - 'parameter' => $GLOBALS['TSFE']->id, - 'returnLast' => 'url', - 'additionalParams' => '&tx_powermail_pi1[multiple]=' . ($this->multiple['currentpage'] + $add) . '&tx_powermail_pi1[mailID]=' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']), + 'parameter' => $GLOBALS['TSFE']->id, + 'returnLast' => 'url', + 'additionalParams' => '&tx_powermail_pi1[multiple]=' . ($this->multiple['currentpage'] + $add) . '&tx_powermail_pi1[mailID]=' . ($this->cObj->data['_LOCALIZED_UID'] > 0 + ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']), 'useCacheHash' => 1 ); $link = ($GLOBALS['TSFE']->tmpl->setup['config.']['absRefPrefix'] == '' ? $this->baseurl : ''); @@ -285,39 +304,31 @@ private function multipleLink($add = 0) { } elseif ($add === 0) { // show pagebrowser - /* - // e.g. page1 page2 page3 page4 - $content = ''; - for($i=0;$i<$this->multiple['numberoffieldsets'];$i++) { - if(($i+1) == $this->multiple['currentpage']) $classadd = ' powermail_bagebrowser_current'; else $classadd = ''; - $content .= 'Seite '.($i+1).''."\n"; - } - */ - - // e.g. 3 of 8 $content = $this->multiple['currentpage'] . ' ' . $this->pi_getLL('pagebrowser_inner') . ' ' . $this->multiple['numberoffieldsets']; // 1 of 4 $content = $this->cObj->wrap($content, $this->conf['pagebrowser.']['wrap'], '|'); // wrap this - $this->hookPageBrowser($content); + $this->hookPageBrowser($content); } elseif ($add === 'js') { // Pagebrowser Multiple JS $this->tmpl['multiplejs']['item'] = $this->cObj->getSubpart($this->tmpl['multiplejs']['all'], '###POWERMAIL_ITEM###'); $content_item = ''; - $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery ( + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( 'uid,title', 'tx_powermail_fieldsets', - $where_clause = 'tt_content = ' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']) . tslib_cObj::enableFields('tx_powermail_fieldsets'), + $where_clause = 'tt_content = ' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] + : $this->cObj->data['uid']) . tslib_cObj::enableFields('tx_powermail_fieldsets'), $groupBy = '', $orderBy = 'sorting ASC', '' ); - if ($res) { // If there is a result + if ($res !== false) { // If there is a result while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { // One loop for every fieldset - $markerArray['###POWERMAIL_MULTIPLEJS_PAGEBROWSER_LINK###'] = htmlentities($this->cObj->typolink('x',array('parameter'=>$GLOBALS['TSFE']->id, 'returnLast'=>'url', 'useCacheHash' => 1)).'#tx-powermail-pi1_fieldset_' . $row['uid']); - $markerArray['###POWERMAIL_MULTIPLEJS_PAGEBROWSER_TITLE###'] = $row['title']; + $markerArray['###POWERMAIL_MULTIPLEJS_PAGEBROWSER_LINK###'] = htmlentities($this->cObj->typolink('x', array('parameter' => $GLOBALS['TSFE']->id, 'returnLast' => 'url', 'useCacheHash' => 1)) . '#tx-powermail-pi1_fieldset_' . $row['uid']); + $markerArray['###POWERMAIL_MULTIPLEJS_PAGEBROWSER_TITLE###'] = $row['title']; $content_item .= $this->cObj->substituteMarkerArrayCached($this->tmpl['multiplejs']['item'], $markerArray); } + $GLOBALS['TYPO3_DB']->sql_free_result($res); $subpartArray['###POWERMAIL_CONTENT###'] = $content_item; $content = $this->cObj->substituteMarkerArrayCached($this->tmpl['multiplejs']['all'], array(), $subpartArray); $content = $this->dynamicMarkers->main($this->conf, $this->cObj, $content); // Fill dynamic locallang or typoscript markers @@ -340,7 +351,7 @@ private function multipleLink($add = 0) { */ private function dynamicFields($array) { // Give me current field details - $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery ( + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( ' tx_powermail_fieldsets.uid fs_uid, tx_powermail_fields.uid f_uid, @@ -358,20 +369,16 @@ private function dynamicFields($array) { LEFT JOIN tx_powermail_fields ON tx_powermail_fieldsets.uid = tx_powermail_fields.fieldset LEFT JOIN tt_content ON tx_powermail_fieldsets.tt_content = tt_content.uid ', - $where_clause = 'tx_powermail_fields.uid = ' . intval($array[1]), - $groupBy = '', - $orderBy = '', - $limit1 = '' + $where_clause = 'tx_powermail_fields.uid = ' . intval($array[1]) ); - if ($res) { + if ($res !== false) { $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); + $GLOBALS['TYPO3_DB']->sql_free_result($res); + if (count($row) > 1) { + return $this->html_input_field->main($this->conf, $this->sessionfields, $this->cObj, $row, $this->tabindexArray()); // Get HTML code for each field + } } - - if (count($row) > 1) { - return $this->html_input_field->main($this->conf, $this->sessionfields, $this->cObj, $row, $this->tabindexArray()); // Get HTML code for each field - } else { - return 'No details found to Field ' . htmlspecialchars($array[0]) . '
'; - } + return 'No details found to Field ' . htmlspecialchars($array[0]) . '
'; } /** @@ -381,21 +388,21 @@ private function dynamicFields($array) { */ private function hookInner(&$row) { if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FormWrapMarkerHookInner'])) { // Adds hook for processing of extra global markers - foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FormWrapMarkerHookInner'] as $_classRef) { + foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FormWrapMarkerHookInner'] as $_classRef) { $_procObj = & t3lib_div::getUserObj($_classRef); $_procObj->PM_FormWrapMarkerHookInner($this->InnerMarkerArray, $this->conf, $row, $this); // Open function to manipulate datas } } } - /** - * Function hookPageBrowser() to enable manipulation of the php-pagebrowser - * @param $content - * @return void - */ + /** + * Function hookPageBrowser() to enable manipulation of the php-pagebrowser + * @param $content + * @return void + */ function hookPageBrowser(&$content) { if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FormPageBrowserHook'])) { - foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FormPageBrowserHook'] as $_classRef) { + foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FormPageBrowserHook'] as $_classRef) { $_procObj = & t3lib_div::getUserObj($_classRef); $_procObj->PM_FormPageBrowserHook($this->multiple, $content, $this->conf, $this); } @@ -409,7 +416,7 @@ function hookPageBrowser(&$content) { */ private function hook() { if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FormWrapMarkerHook'])) { // Adds hook for processing of extra global markers - foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FormWrapMarkerHook'] as $_classRef) { + foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FormWrapMarkerHook'] as $_classRef) { $_procObj = & t3lib_div::getUserObj($_classRef); $_procObj->PM_FormWrapMarkerHook($this->OuterMarkerArray, $this->subpartArray, $this->conf, $this); // Open function to manipulate datas } @@ -418,7 +425,7 @@ private function hook() { } -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/pi1/class.tx_powermail_form.php']) { +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/pi1/class.tx_powermail_form.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/pi1/class.tx_powermail_form.php']); } diff --git a/pi1/class.tx_powermail_html.php b/pi1/class.tx_powermail_html.php index 0a74ed40..697a8ed1 100644 --- a/pi1/class.tx_powermail_html.php +++ b/pi1/class.tx_powermail_html.php @@ -1,26 +1,26 @@ type) { // If type exists - switch($this->type) { + switch ($this->type) { case 'text': $this->content = $this->html_text(); // generate text field content = $this->html_textarea(); // generate textarea content = $this->html_check(); // generate textarea content = $this->html_select(); // generate selectorbox content = $this->html_submit(); // generate submitbutton content = $this->html_reset(); // generate resetbutton content = $this->html_label(); // generate textlabel - break; + break; case 'html': $this->content = $this->html_html(); // generate pure html - break; + break; case 'content': $this->content = $this->html_content(); // returns page content - break; + break; case 'file': $this->content = $this->html_file(); // generate file field - break; + break; case 'password': $this->content = $this->html_password(); // generate password field - break; + break; case 'hidden': $this->content = $this->html_hidden(); // generate hidden field - break; + break; case 'datetime': $this->content = $this->html_datetime(); // generate datetime field - break; + break; case 'date': $this->content = $this->html_date(); // generate date field - break; + break; case 'button': $this->content = $this->html_button(); // generate button field - break; + break; case 'submitgraphic': $this->content = $this->html_submitgraphic(); // generate submitgraphic button - break; + break; case 'countryselect': $this->content = $this->html_countryselect(); // generate select fields with countries from static_info_tables - break; + break; case 'typoscript': $this->content = $this->html_typoscript(); // gets typoscript element and output the result of it - break; + break; default: // default settings if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FieldHook'][$this->type])) { // Adds hook for processing of extra fields - foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FieldHook'][$this->type] as $_classRef) { + foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FieldHook'][$this->type] as $_classRef) { $_procObj = &t3lib_div::getUserObj($_classRef); $this->content = $_procObj->PM_FieldHook($this->xml, $this->title, $this->type, $this->uid, $this->markerArray, $this->piVarsFromSession, $this); } } else { // no hook so write errormessage $this->content = 'POWERMAIL: wrong input field required: ' . $this->type . ' in tx_powermail_pi1_html (field uid ' . $row['f_uid'] . ')
'; // errormessage } - break; + break; } } else { // no type selected $this->content = 'POWERMAIL: no field type in backend selected (field uid ' . $row['f_uid'] . ')
'; // errormessage @@ -204,36 +204,44 @@ private function html_select() { $this->tmpl['html_select']['item'] = tslib_cObj::getSubpart($this->tmpl['html_select']['all'], '###ITEM###'); // work on subpart 2 if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'options')) { // Only if options are set - $content_item = ''; $options = $set = array(); // init + $content_item = ''; + $options = $set = array(); // init $optionlines = t3lib_div::trimExplode("\n", $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'options'), 1); // Every row is a new option - for ($i=0; $i < count($optionlines); $i++) { // Every loop for every option + for ($i = 0; $i < count($optionlines); $i++) { // Every loop for every option $options[$i] = t3lib_div::trimExplode('|', $optionlines[$i], 0); // Every row is a new option } // preparing an array for preselection of multi fields if ($this->conf['prefill.']['uid' . $this->uid . '.']['selectedIndexes'] || is_array($this->conf['prefill.']['uid' . $this->uid . '.']['selectedIndexes.'])) { // if there are values in the array selectedIndexes. $selected = t3lib_div::intExplode(',', $this->cObj->stdWrap($this->conf['prefill.']['uid' . $this->uid . '.']['selectedIndexes'], $this->conf['prefill.']['uid' . $this->uid . '.']['selectedIndexes.'])); - } elseif ($this->conf['prefill.']['uid' . $this->uid . '.']['selectedValues'] || is_array($this->conf['prefill.']['uid' . $this->uid . '.']['selectedValues.'])) { + } else if ($this->conf['prefill.']['uid' . $this->uid . '.']['selectedValues'] || is_array($this->conf['prefill.']['uid' . $this->uid . '.']['selectedValues.'])) { $selected = t3lib_div::trimExplode(',', $this->cObj->stdWrap($this->conf['prefill.']['uid' . $this->uid . '.']['selectedValues'], $this->conf['prefill.']['uid' . $this->uid . '.']['selectedValues.'])); } else { $selected = array(); } - for ($i=0; $i < count($optionlines); $i++) { // One tag for every option + for ($i = 0; $i < count($optionlines); $i++) { // One tag for every option $markerArray['###LABEL###'] = htmlspecialchars($options[$i][0]); - $markerArray['###VALUE###'] = (isset($options[$i][1]) ? htmlspecialchars($options[$i][1]) : htmlspecialchars($options[$i][0])); + $markerArray['###VALUE###'] = (isset($options[$i][1]) ? htmlspecialchars($options[$i][1]) + : htmlspecialchars($options[$i][0])); // ###SELECTED### if (!is_array($this->piVarsFromSession['uid' . $this->uid])) { // no multiple - if ($options[$i][2] == '*') $markerArray['###SELECTED###'] = ' selected="selected"'; // selected from backend - else $markerArray['###SELECTED###'] = ''; // clear + if ($options[$i][2] == '*') { + $markerArray['###SELECTED###'] = ' selected="selected"'; + } else { + $markerArray['###SELECTED###'] = ''; + } // clear if (isset($this->piVarsFromSession['uid' . $this->uid])) { // if session was set - if ($this->piVarsFromSession['uid' . $this->uid] == ($options[$i][1] ? $options[$i][1] : $options[$i][0])) $markerArray['###SELECTED###'] = 'selected="selected" '; // mark as selected - else $markerArray['###SELECTED###'] = ''; // clear + if ($this->piVarsFromSession['uid' . $this->uid] == ($options[$i][1] ? $options[$i][1] : $options[$i][0])) { + $markerArray['###SELECTED###'] = 'selected="selected" '; // mark as selected + } else { + $markerArray['###SELECTED###'] = ''; + } // clear } } else { // multiple - for ($j=0; $jpiVarsFromSession['uid' . $this->uid]); $j++) { + for ($j = 0; $j < count($this->piVarsFromSession['uid' . $this->uid]); $j++) { if ($this->piVarsFromSession['uid' . $this->uid][$j] == ($options[$i][1] ? $options[$i][1] : $options[$i][0])) { $markerArray['###SELECTED###'] = ' selected="selected"'; // mark as selected $set[$i] = 1; @@ -244,14 +252,15 @@ private function html_select() { // Preselection from typoscript if (!$set[$i] && !empty($this->conf['prefill.']['uid' . $this->uid])) { - if ($this->isPrefilled($i, $selected, ($options[$i][1] ? $options[$i][1] : $options[$i][0])) != false) { + if ($this->isPrefilled($i, $selected, ($options[$i][1] ? $options[$i][1] + : $options[$i][0])) != false + ) { $markerArray['###SELECTED###'] = ' selected="selected"'; // mark as selected } else { $markerArray['###SELECTED###'] = ''; // clear } } - $this->html_hookwithinfieldsinner($markerArray); // adds hook to manipulate the markerArray for any field $content_item .= $this->cObj->substituteMarkerArrayCached($this->tmpl['html_select']['item'], $markerArray); } @@ -274,73 +283,86 @@ private function html_select() { * @return string $content */ private function html_check() { - $this->tmpl['html_check']['all'] = $this->cObj->getSubpart($this->tmpl['all'], '###POWERMAIL_FIELDWRAP_HTML_CHECK' . ($this->conf['field.']['checkboxJS']==1 ? 'JS' : '') . '###'); // work on subpart 1 (###POWERMAIL_FIELDWRAP_HTML_CHECK### OR ###POWERMAIL_FIELDWRAP_HTML_CHECKJS###) + $this->tmpl['html_check']['all'] = $this->cObj->getSubpart($this->tmpl['all'], '###POWERMAIL_FIELDWRAP_HTML_CHECK' . ($this->conf['field.']['checkboxJS'] == 1 + ? 'JS' + : '') . '###'); // work on subpart 1 (###POWERMAIL_FIELDWRAP_HTML_CHECK### OR ###POWERMAIL_FIELDWRAP_HTML_CHECKJS###) $this->tmpl['html_check']['item'] = $this->cObj->getSubpart($this->tmpl['html_check']['all'], '###ITEM###'); // work on subpart 2 if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'options')) { // Only if options are set - $content_item = ''; $options = array(); // init + $content_item = ''; + $options = array(); // init $optionlines = t3lib_div::trimExplode("\n", $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'options'), 1); // Every row is a new option - for ($i=0; $i < count($optionlines); $i++) { // One tag for every option + for ($i = 0; $i < count($optionlines); $i++) { // One tag for every option $options[$i] = t3lib_div::trimExplode('|', $optionlines[$i], 0); // Every row is a new option $markerArray['###NAME###'] = 'name="' . $this->prefixId . '[uid' . $this->uid . '][' . $i . ']" '; // add name to markerArray $markerArray['###LABEL###'] = $this->div->parseFunc($options[$i][0], $this->cObj, $this->conf['label.']['parse']); - $markerArray['###LABEL###'] = ($this->conf['label.']['parse']) ? $markerArray['###LABEL###'] : htmlspecialchars($markerArray['###LABEL###']); + $markerArray['###LABEL###'] = ($this->conf['label.']['parse']) ? $markerArray['###LABEL###'] + : htmlspecialchars($markerArray['###LABEL###']); $markerArray['###LABEL_NAME###'] = 'uid' . $this->uid . '_' . $i; // add labelname $markerArray['###ID###'] = 'id="uid' . $this->uid . '_' . $i . '" '; // add labelname - $markerArray['###VALUE###'] = 'value="' . (isset($options[$i][1]) ? htmlspecialchars($options[$i][1]) : htmlspecialchars($options[$i][0])) . '" '; + $markerArray['###VALUE###'] = 'value="' . (isset($options[$i][1]) ? htmlspecialchars($options[$i][1]) + : htmlspecialchars($options[$i][0])) . '" '; $markerArray['###CLASS###'] = 'class="'; // start class tag // Add required class if needed - if($i == 0 && $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'mandatory') == 1){ - if(count($optionlines) > 1) { + if ($i == 0 && $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'mandatory') == 1) { + if (count($optionlines) > 1) { $markerArray['###CLASS###'] .= 'required_one '; } else { $markerArray['###CLASS###'] .= 'required '; - $markerArray['###REQUIRED###'] = ' required="required"'; + $markerArray['###REQUIRED###'] = ' required="required"'; } } - + $markerArray['###CLASS###'] .= 'powermail_' . $this->formtitle; // add form title $markerArray['###CLASS###'] .= ' powermail_' . $this->type; // add input type $markerArray['###CLASS###'] .= ' powermail_uid' . $this->uid; // add input uid $markerArray['###CLASS###'] .= ' powermail_subuid' . $this->uid . '_' . $i; // add input subuid - $markerArray['###CLASS###'] .= ($this->class_f != '' && $this->additionalCssToInputField) ? ' ' . htmlspecialchars($this->class_f) : ''; // add manual class + $markerArray['###CLASS###'] .= ($this->class_f != '' && $this->additionalCssToInputField) + ? ' ' . htmlspecialchars($this->class_f) : ''; // add manual class $markerArray['###CLASS###'] .= '" '; // close tag $markerArray['###HIDDENVALUE###'] = 'value="' . $this->piVarsFromSession['uid' . $this->uid][$i] . '"'; // add value for hidden field to markerArray - if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml),'mandatory') == 1) { - $markerArray['###MANDATORY_SYMBOL###'] = $this->cObj->wrap($this->conf['mandatory.']['symbol'], $this->conf['mandatory.']['wrap'],'|'); // add mandatory symbol if current field is a mandatory field + if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'mandatory') == 1) { + $markerArray['###MANDATORY_SYMBOL###'] = $this->cObj->wrap($this->conf['mandatory.']['symbol'], $this->conf['mandatory.']['wrap'], '|'); // add mandatory symbol if current field is a mandatory field } - $this->turnedtabindex[$this->uid . '_' . $i] !== '' ? $markerArray['###TABINDEX###'] = 'tabindex="' . ($this->turnedtabindex[$this->uid . '_' . $i] + 1) . '" ' : $markerArray['###TABINDEX###'] = ''; // tabindex for every checkbox - isset($this->newaccesskey[$this->uid][$i]) ? $markerArray['###ACCESSKEY###'] = 'accesskey="' . $this->newaccesskey[$this->uid][$i] . '" ' : $markerArray['###ACCESSKEY###'] = ''; // accesskey for every checkbox + $this->turnedtabindex[$this->uid . '_' . $i] !== '' + ? $markerArray['###TABINDEX###'] = 'tabindex="' . ($this->turnedtabindex[$this->uid . '_' . $i] + 1) . '" ' + : $markerArray['###TABINDEX###'] = ''; // tabindex for every checkbox + isset($this->newaccesskey[$this->uid][$i]) + ? $markerArray['###ACCESSKEY###'] = 'accesskey="' . $this->newaccesskey[$this->uid][$i] . '" ' + : $markerArray['###ACCESSKEY###'] = ''; // accesskey for every checkbox // ###CHECKED### - if ($options[$i][2] == '*') { + if ($options[$i][2] == '*') { $markerArray['###CHECKED###'] = 'checked="checked" '; // checked from backend - $markerArray['###HIDDENVALUE###'] = 'value="' . (isset($options[$i][1]) ? $options[$i][1] : $options[$i][0]) . '" '; + $markerArray['###HIDDENVALUE###'] = 'value="' . (isset($options[$i][1]) ? $options[$i][1] : $options[$i][0]) . '" '; - } elseif (!empty($this->conf['prefill.']['uid' . $this->uid . '_' . $i])) { // prechecking with typoscript for current field enabled + } else if (!empty($this->conf['prefill.']['uid' . $this->uid . '_' . $i])) { // prechecking with typoscript for current field enabled if ($this->cObj->cObjGetSingle($this->conf['prefill.']['uid' . $this->uid . '_' . $i], $this->conf['prefill.']['uid' . $this->uid . '_' . $i . '.']) == 1) { $markerArray['###CHECKED###'] = 'checked="checked" '; // checked from backend - $markerArray['###HIDDENVALUE###'] = 'value="' . (isset($options[$i][1]) ? $options[$i][1] : $options[$i][0]) . '" '; - } else $markerArray['###CHECKED###'] = ''; // clear + $markerArray['###HIDDENVALUE###'] = 'value="' . (isset($options[$i][1]) ? $options[$i][1] + : $options[$i][0]) . '" '; + } else { + $markerArray['###CHECKED###'] = ''; + } // clear } - // AST end + // AST end else $markerArray['###CHECKED###'] = ''; // clear if (isset($this->piVarsFromSession['uid' . $this->uid])) { // Preselection from session if (isset($this->piVarsFromSession['uid' . $this->uid][$i]) && $this->piVarsFromSession['uid' . $this->uid][$i] != '') { - $markerArray['###CHECKED###'] = 'checked="checked" '; // mark as checked - $markerArray['###HIDDENVALUE###'] = 'value="' . $this->piVarsFromSession['uid' . $this->uid][$i] . '"'; // add value for hidden field to markerArray - } - - else $markerArray['###CHECKED###'] = ''; // clear + $markerArray['###CHECKED###'] = 'checked="checked" '; // mark as checked + $markerArray['###HIDDENVALUE###'] = 'value="' . $this->piVarsFromSession['uid' . $this->uid][$i] . '"'; // add value for hidden field to markerArray + } else { + $markerArray['###CHECKED###'] = ''; + } // clear } $this->html_hookwithinfieldsinner($markerArray); // adds hook to manipulate the markerArray for any field $content_item .= $this->cObj->substituteMarkerArrayCached($this->tmpl['html_check']['item'], $markerArray); // substitute Marker in Template (subpart 2) - } + } } $subpartArray = array(); // init @@ -365,42 +387,44 @@ private function html_check() { private function html_radio() { $this->tmpl['html_radio']['all'] = $this->cObj->getSubpart($this->tmpl['all'], '###POWERMAIL_FIELDWRAP_HTML_RADIO###'); // work on subpart 1 $this->tmpl['html_radio']['item'] = $this->cObj->getSubpart($this->tmpl['html_radio']['all'], '###ITEM###'); // work on subpart 2 - //$this->tmpl['html_radio']['mandatory_helper'] = $this->cObj->getSubpart($this->tmpl['html_radio']['all'], '###MANDATORY_HELPER###'); // work on subpart 3 + //$this->tmpl['html_radio']['mandatory_helper'] = $this->cObj->getSubpart($this->tmpl['html_radio']['all'], '###MANDATORY_HELPER###'); // work on subpart 3 if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'options')) { // Only if options are set $content_item = ''; - $options = array(); // init - $options_temp = array(); - $preSelectionFound = false; + $options = array(); // init + $options_temp = array(); + $preSelectionFound = false; $optionlines = t3lib_div::trimExplode("\n", $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'options'), 1); // Every row is a new option - for ($i = 0; $i < count($optionlines); $i ++) { // One tag for every option - $options_temp[$i] = t3lib_div::trimExplode('|', $optionlines[$i], 0); // To split: label | value | * - if (isset($options_temp[$i][2]) && $options_temp[$i][2] == '*') { - $preSelectionFound = true; - break; - } - } - if ($preSelectionFound == false && $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'mandatory') == 1) { - // if no pre selection is found, add a mandatory helper radio button - $optionlines = array_merge(array(' ||*'), $optionlines); - } - for ($i = 0; $i < count($optionlines); $i ++) { // One tag for every option - $options[$i] = t3lib_div::trimExplode('|', $optionlines[$i], 0); // To split: label | value | * + for ($i = 0; $i < count($optionlines); $i++) { // One tag for every option + $options_temp[$i] = t3lib_div::trimExplode('|', $optionlines[$i], 0); // To split: label | value | * + if (isset($options_temp[$i][2]) && $options_temp[$i][2] == '*') { + $preSelectionFound = true; + break; + } + } + if ($preSelectionFound == false && $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'mandatory') == 1) { + // if no pre selection is found, add a mandatory helper radio button + $optionlines = array_merge(array(' ||*'), $optionlines); + } + for ($i = 0; $i < count($optionlines); $i++) { // One tag for every option + $options[$i] = t3lib_div::trimExplode('|', $optionlines[$i], 0); // To split: label | value | * $markerArray['###NAME###'] = 'name="' . $this->prefixId . '[uid' . $this->uid . ']" '; // add name to markerArray $markerArray['###LABEL###'] = $this->div->parseFunc($options[$i][0], $this->cObj, $this->conf['label.']['parse']); - $markerArray['###LABEL###'] = ($this->conf['label.']['parse']) ? $markerArray['###LABEL###'] : htmlspecialchars($markerArray['###LABEL###']); + $markerArray['###LABEL###'] = ($this->conf['label.']['parse']) ? $markerArray['###LABEL###'] + : htmlspecialchars($markerArray['###LABEL###']); $markerArray['###LABEL_NAME###'] = 'uid' . $this->uid . '_' . $i; // add labelname $markerArray['###ID###'] = 'id="uid' . $this->uid . '_' . $i . '" '; // add labelname - $markerArray['###VALUE###'] = 'value="' . (isset($options[$i][1]) ? htmlspecialchars($options[$i][1]) : htmlspecialchars($options[$i][0])) . '" '; + $markerArray['###VALUE###'] = 'value="' . (isset($options[$i][1]) ? htmlspecialchars($options[$i][1]) + : htmlspecialchars($options[$i][0])) . '" '; $markerArray['###CLASS###'] = 'class="'; // start class tag - $markerArray['###MANDATORY_HELPER###'] = ''; - // Add required class if needed - if ($preSelectionFound == false && $i == 0 && $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'mandatory') == 1){ + $markerArray['###MANDATORY_HELPER###'] = ''; + // Add required class if needed + if ($preSelectionFound == false && $i == 0 && $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'mandatory') == 1) { $markerArray['###CLASS###'] .= 'required_one '; - $markerArray['###VALUE###'] = 'value="" '; - $markerArray['###CHECKED###'] = 'checked="checked" '; - $markerArray['###MANDATORY_HELPER###'] = ' powermail_mandatory_helper'; - } + $markerArray['###VALUE###'] = 'value="" '; + $markerArray['###CHECKED###'] = 'checked="checked" '; + $markerArray['###MANDATORY_HELPER###'] = ' powermail_mandatory_helper'; + } if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'mandatory') == 1) { $markerArray['###REQUIRED###'] = ' required="required"'; } @@ -408,28 +432,35 @@ private function html_radio() { $markerArray['###CLASS###'] .= ' powermail_' . $this->type; // add input type $markerArray['###CLASS###'] .= ' powermail_uid' . $this->uid; // add input uid $markerArray['###CLASS###'] .= ' powermail_subuid' . $this->uid . '_' . $i; // add input subuid - $markerArray['###CLASS###'] .= ($this->class_f != '' && $this->additionalCssToInputField) ? ' ' . htmlspecialchars($this->class_f) : ''; // add manual class + $markerArray['###CLASS###'] .= ($this->class_f != '' && $this->additionalCssToInputField) + ? ' ' . htmlspecialchars($this->class_f) : ''; // add manual class $markerArray['###CLASS###'] .= '" '; // close tag - $this->turnedtabindex[$this->uid . '_' . $i] !== '' ? $markerArray['###TABINDEX###'] = 'tabindex="' . ($this->turnedtabindex[$this->uid . '_' . $i] + 1) . '" ' : $markerArray['###TABINDEX###'] = ''; // tabindex for every radiobutton - isset($this->newaccesskey[$this->uid][$i]) ? $markerArray['###ACCESSKEY###'] = 'accesskey="' . $this->newaccesskey[$this->uid][$i] . '" ' : $markerArray['###ACCESSKEY###'] = ''; // accesskey for every radiobutton + $this->turnedtabindex[$this->uid . '_' . $i] !== '' + ? $markerArray['###TABINDEX###'] = 'tabindex="' . ($this->turnedtabindex[$this->uid . '_' . $i] + 1) . '" ' + : $markerArray['###TABINDEX###'] = ''; // tabindex for every radiobutton + isset($this->newaccesskey[$this->uid][$i]) + ? $markerArray['###ACCESSKEY###'] = 'accesskey="' . $this->newaccesskey[$this->uid][$i] . '" ' + : $markerArray['###ACCESSKEY###'] = ''; // accesskey for every radiobutton // ###CHECKED### if ($options[$i][2] == '*') { // Preselection from backend $markerArray['###CHECKED###'] = 'checked="checked" '; // precheck radiobutton } else { - $markerArray['###CHECKED###'] = ''; // clear - } + $markerArray['###CHECKED###'] = ''; // clear + } if (isset($this->piVarsFromSession['uid' . $this->uid])) { // Preselection from session - if ($this->piVarsFromSession['uid' . $this->uid] == ($options[$i][1] ? $options[$i][1] : $options[$i][0])) { // mark as selected + if ($this->piVarsFromSession['uid' . $this->uid] == ($options[$i][1] ? $options[$i][1] + : $options[$i][0]) + ) { // mark as selected $markerArray['###CHECKED###'] = 'checked="checked" '; // precheck radiobutton } else { - $markerArray['###CHECKED###'] = ''; - } // clear + $markerArray['###CHECKED###'] = ''; + } // clear } $this->html_hookwithinfieldsinner($markerArray); // adds hook to manipulate the markerArray for any field $content_item .= $this->cObj->substituteMarkerArrayCached($this->tmpl['html_radio']['item'], $markerArray); // substitute Marker in Template (subpart 2) - } + } } @@ -438,7 +469,6 @@ private function html_radio() { $this->markerArray['###LABEL_MAIN###'] = $this->div->parseFunc($this->title, $this->cObj, $this->conf['label.']['parse']); $this->markerArray['###LABEL_MAIN###'] = ($this->conf['label.']['parse']) ? $this->title : htmlspecialchars($this->title); - $this->markerArray['###POWERMAIL_FIELD_UID###'] = $this->uid; if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'mandatory') == 1) { @@ -459,7 +489,7 @@ private function html_radio() { * @return string $content */ private function html_submit() { - $this->tmpl['html_submit'] = tslib_cObj::getSubpart($this->tmpl['all'],'###POWERMAIL_FIELDWRAP_HTML_SUBMIT###'); // work on subpart + $this->tmpl['html_submit'] = tslib_cObj::getSubpart($this->tmpl['all'], '###POWERMAIL_FIELDWRAP_HTML_SUBMIT###'); // work on subpart // add class name to markerArray $this->markerArray['###CLASS###'] = 'class="powermail_' . $this->formtitle; // add formname @@ -483,7 +513,7 @@ private function html_submit() { */ private function html_reset() { - $this->tmpl['html_reset'] = tslib_cObj::getSubpart($this->tmpl['all'],'###POWERMAIL_FIELDWRAP_HTML_RESET###'); // work on subpart + $this->tmpl['html_reset'] = tslib_cObj::getSubpart($this->tmpl['all'], '###POWERMAIL_FIELDWRAP_HTML_RESET###'); // work on subpart if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'clearSession')) { // if checkbox clearSession is checked $this->markerArray['###JS###'] = 'onclick="location=\''; // Fill marker ###JS### with eventhandler @@ -502,7 +532,7 @@ private function html_reset() { $this->html_hookwithinfields(); // adds hook to manipulate the markerArray for any field $content = tslib_cObj::substituteMarkerArrayCached($this->tmpl['html_reset'], $this->markerArray); // substitute Marker in Template $content = $this->dynamicMarkers->main($this->conf, $this->cObj, $content); // Fill dynamic locallang or typoscript markers - $content = preg_replace('|###.*?###|i' ,'', $content); // Finally clear not filled markers + $content = preg_replace('|###.*?###|i', '', $content); // Finally clear not filled markers return $content; // return HTML } @@ -513,25 +543,25 @@ private function html_reset() { * @return string $content */ private function html_label() { - $this->tmpl['html_label'] = tslib_cObj::getSubpart($this->tmpl['all'], '###POWERMAIL_FIELDWRAP_HTML_LABEL###'); // work on subpart - - // ###CONTENT### - if (isset($this->piVarsFromSession['uid' . $this->uid])) { // 1. if value is in piVars - $this->markerArray['###CONTENT###'] = stripslashes($this->div->nl2nl2($this->piVarsFromSession['uid' . $this->uid])); - } elseif ($this->fe_field && $GLOBALS['TSFE']->fe_user->user[$this->fe_field]) { // 2. if value should be filled from current logged in user - $this->markerArray['###CONTENT###'] = t3lib_div::removeXSS($GLOBALS['TSFE']->fe_user->user[$this->fe_field]); - } elseif ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'value')) { // 3. take value from backend (default value) - $this->markerArray['###CONTENT###'] = t3lib_div::removeXSS($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'value'), $this->conf['label.']['allowTags']); - } elseif (!empty($this->conf['prefill.']['uid' . $this->uid])) { // 4. prefilling with typoscript for current field enabled - $this->markerArray['###CONTENT###'] = $this->cObj->cObjGetSingle($this->conf['prefill.']['uid' . $this->uid], $this->conf['prefill.']['uid' . $this->uid . '.']); // add typoscript value - } else { // 5. no prefilling - so clear value marker - $this->markerArray['###CONTENT###'] = ''; // clear - } - - // add hidden field - if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'send')) { // label should be send with email - $this->markerArray['###HIDDEN###'] = ''; // create hidden field - } + $this->tmpl['html_label'] = tslib_cObj::getSubpart($this->tmpl['all'], '###POWERMAIL_FIELDWRAP_HTML_LABEL###'); // work on subpart + + // ###CONTENT### + if (isset($this->piVarsFromSession['uid' . $this->uid])) { // 1. if value is in piVars + $this->markerArray['###CONTENT###'] = stripslashes($this->div->nl2nl2($this->piVarsFromSession['uid' . $this->uid])); + } elseif ($this->fe_field && $GLOBALS['TSFE']->fe_user->user[$this->fe_field]) { // 2. if value should be filled from current logged in user + $this->markerArray['###CONTENT###'] = t3lib_div::removeXSS($GLOBALS['TSFE']->fe_user->user[$this->fe_field]); + } elseif ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'value')) { // 3. take value from backend (default value) + $this->markerArray['###CONTENT###'] = t3lib_div::removeXSS($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'value'), $this->conf['label.']['allowTags']); + } elseif (!empty($this->conf['prefill.']['uid' . $this->uid])) { // 4. prefilling with typoscript for current field enabled + $this->markerArray['###CONTENT###'] = $this->cObj->cObjGetSingle($this->conf['prefill.']['uid' . $this->uid], $this->conf['prefill.']['uid' . $this->uid . '.']); // add typoscript value + } else { // 5. no prefilling - so clear value marker + $this->markerArray['###CONTENT###'] = ''; // clear + } + + // add hidden field + if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'send')) { // label should be send with email + $this->markerArray['###HIDDEN###'] = ''; // create hidden field + } $this->markerArray['###CLASS###'] = 'class="powermail_' . $this->formtitle; $this->markerArray['###CLASS###'] .= ' powermail_' . $this->type; @@ -539,12 +569,12 @@ private function html_label() { $this->markerArray['###CLASS###'] .= ($this->class_f != '' && $this->additionalCssToInputField) ? ' ' . htmlspecialchars($this->class_f) : ''; $this->markerArray['###CLASS###'] .= '" '; - $this->html_hookwithinfields(); // adds hook to manipulate the markerArray for any field - $content = tslib_cObj::substituteMarkerArrayCached($this->tmpl['html_label'], $this->markerArray); // substitute Marker in Template - $content = $this->dynamicMarkers->main($this->conf, $this->cObj, $content); // Fill dynamic locallang or typoscript markers - $content = preg_replace('|###.*?###|i', '', $content); // Finally clear not filled markers - return $content; // return HTML - } + $this->html_hookwithinfields(); // adds hook to manipulate the markerArray for any field + $content = tslib_cObj::substituteMarkerArrayCached($this->tmpl['html_label'], $this->markerArray); // substitute Marker in Template + $content = $this->dynamicMarkers->main($this->conf, $this->cObj, $content); // Fill dynamic locallang or typoscript markers + $content = preg_replace('|###.*?###|i', '', $content); // Finally clear not filled markers + return $content; // return HTML + } /** * Function html_html() returns pure HTML @@ -614,21 +644,16 @@ private function html_password() { private function html_file() { if (!$this->piVarsFromSession['uid' . $this->uid]) { // There is no uploaded file in the session $this->tmpl['html_file'] = tslib_cObj::getSubpart($this->tmpl['all'], '###POWERMAIL_FIELDWRAP_HTML_FILE###'); // work on subpart - } else { // There is an uploaded file in the session $this->tmpl['html_file'] = tslib_cObj::getSubpart($this->tmpl['all'], '###POWERMAIL_FIELDWRAP_HTML_FILE_LIST###'); // work on subpart - $this->markerArray['###FILE###'] = $this->piVarsFromSession['uid' . $this->uid]; $this->markerArray['###DELETEFILE_URL###'] = $this->pi_linkTP_keepPIvars_url(array('clearSession' => $this->uid)); $this->markerArray['###DELETEFILE###'] .= t3lib_extMgm::siteRelPath('powermail') . 'res/img/icon_del.gif'; - } - $this->html_hookwithinfields(); // adds hook to manipulate the markerArray for any field $content = tslib_cObj::substituteMarkerArrayCached($this->tmpl['html_file'], $this->markerArray); // substitute Marker in Template $content = $this->dynamicMarkers->main($this->conf, $this->cObj, $content); // Fill dynamic locallang or typoscript markers $content = preg_replace('|###.*?###|i', '', $content); // Finally clear not filled markers - if (!empty($content)) return $content; // return HTML } @@ -639,7 +664,6 @@ private function html_file() { */ private function html_hidden() { $this->tmpl['html_hidden'] = tslib_cObj::getSubpart($this->tmpl['all'], '###POWERMAIL_FIELDWRAP_HTML_HIDDEN###'); // work on subpart - $this->html_hookwithinfields(); // adds hook to manipulate the markerArray for any field $content = tslib_cObj::substituteMarkerArrayCached($this->tmpl['html_hidden'], $this->markerArray); // substitute Marker in Template $content = $this->dynamicMarkers->main($this->conf, $this->cObj, $content); // Fill dynamic locallang or typoscript markers @@ -654,17 +678,14 @@ private function html_hidden() { */ private function html_datetime() { $this->tmpl['html_datetime'] = tslib_cObj::getSubpart($this->tmpl['all'], '###POWERMAIL_FIELDWRAP_HTML_DATETIME###'); // work on subpart - - //$this->markerArray['###LABEL###'] = htmlspecialchars($this->title); // add label $this->markerArray['###LABEL_NAME###'] = 'dateinput_uid' . $this->uid; // add name for label $this->markerArray['###POWERMAIL_FIELD_UID###'] = $this->uid; // UID to marker - $value = ''; // use value from flexform if not empty - if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'value') && intval($this->pi_getFFvalue(t3lib_div::xml2array($this->xml),'value')) != 0) { + if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'value') && intval($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'value')) != 0) { $value = intval($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'value')); - if($value > 0) { + if ($value > 0) { // convert timestamp to gmt timestamp $value = gmmktime(date("H", $value), date("i", $value), date("s", $value), date("m", $value), date("d", $value), date("Y", $value)); } @@ -672,36 +693,36 @@ private function html_datetime() { if ($this->fe_field && $GLOBALS['TSFE']->fe_user->user[$this->fe_field]) { $value = intval(strip_tags($GLOBALS['TSFE']->fe_user->user[$this->fe_field])); - if($value > 0) { + if ($value > 0) { // convert timestamp to gmt timestamp $value = gmmktime(date("H", $value), date("i", $value), date("s", $value), date("m", $value), date("d", $value), date("Y", $value)); } } if (isset($this->piVarsFromSession['uid' . $this->uid]) && $this->piVarsFromSession['uid' . $this->uid] != '') { - if ($this->piVarsFromSession['uid' . $this->uid] == intval($this->div->nl2nl2($this->piVarsFromSession['uid' . $this->uid]))) { - // value from session is an integer -> javascript seems to be activated -> return integer from session - $value = intval($this->div->nl2nl2($this->piVarsFromSession['uid' . $this->uid])); - } else { - // value from session is not an integer -> javascript seems to be deactivated -> return value from session - $value = t3lib_div::removeXSS($this->piVarsFromSession['uid' . $this->uid]); - } + if ($this->piVarsFromSession['uid' . $this->uid] == intval($this->div->nl2nl2($this->piVarsFromSession['uid' . $this->uid]))) { + // value from session is an integer -> javascript seems to be activated -> return integer from session + $value = intval($this->div->nl2nl2($this->piVarsFromSession['uid' . $this->uid])); + } else { + // value from session is not an integer -> javascript seems to be deactivated -> return value from session + $value = t3lib_div::removeXSS($this->piVarsFromSession['uid' . $this->uid]); + } } $this->markerArray['###VALUE###'] = 'value="' . $value . '" '; $this->markerArray['###MIN###'] = 'min="' . htmlentities($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'min')) . '" '; - + if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'min') != 0) { - $this->markerArray['###MIN###'] = 'min="' . strftime('%Y-%m-%d', $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'min')). '" '; // add min to markerArray + $this->markerArray['###MIN###'] = 'min="' . strftime('%Y-%m-%d', $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'min')) . '" '; // add min to markerArray } elseif (trim($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'mincalc')) != '') { $this->markerArray['###MIN###'] = 'min="' . htmlentities($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'mincalc')) . '" '; } else { $this->markerArray['###MIN###'] = ''; } - + if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'max') != 0) { - $this->markerArray['###MAX###'] = 'max="' . strftime('%Y-%m-%d', $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'max')). '" '; // add max to markerArray + $this->markerArray['###MAX###'] = 'max="' . strftime('%Y-%m-%d', $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'max')) . '" '; // add max to markerArray } elseif (trim($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'maxcalc')) != '') { $this->markerArray['###MAX###'] = 'max="' . htmlentities($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'maxcalc')) . '" '; } else { @@ -711,7 +732,7 @@ private function html_datetime() { $this->markerArray['###MIN###'] = 'min="' . htmlentities($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'min')) . '" '; if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'min') != 0) { - $this->markerArray['###MIN###'] = 'min="' . strftime('%Y-%m-%d', $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'min')). '" '; // add min to markerArray + $this->markerArray['###MIN###'] = 'min="' . strftime('%Y-%m-%d', $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'min')) . '" '; // add min to markerArray } elseif (trim($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'mincalc')) != '') { $this->markerArray['###MIN###'] = 'min="' . htmlentities($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'mincalc')) . '" '; } else { @@ -719,19 +740,19 @@ private function html_datetime() { } if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'max') != 0) { - $this->markerArray['###MAX###'] = 'max="' . strftime('%Y-%m-%d', $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'max')). '" '; // add max to markerArray + $this->markerArray['###MAX###'] = 'max="' . strftime('%Y-%m-%d', $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'max')) . '" '; // add max to markerArray } elseif (trim($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'maxcalc')) != '') { $this->markerArray['###MAX###'] = 'max="' . htmlentities($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'maxcalc')) . '" '; } else { $this->markerArray['###MAX###'] = ''; } - $this->markerArray['###PLACEHOLDER###'] = 'placeholder="'. $this->pi_getLL('JSvalidation_dateinput_format', 'yyyy-mm-dd') . ' hh:mm" '; + $this->markerArray['###PLACEHOLDER###'] = 'placeholder="' . $this->pi_getLL('JSvalidation_dateinput_format', 'yyyy-mm-dd') . ' hh:mm" '; if ($this->markerArray['###ACCESSKEY###'] != '') { // if there is a defined accesskey $params['inputField']['accesskey'] = $this->accesskeyarray[$i][2]; // set accesskey for datefield } - + $this->html_hookwithinfields(); // adds hook to manipulate the markerArray for any field $content = tslib_cObj::substituteMarkerArrayCached($this->tmpl['html_datetime'], $this->markerArray); // substitute Marker in Template $content = $this->dynamicMarkers->main($this->conf, $this->cObj, $content); // Fill dynamic locallang or typoscript markers @@ -751,13 +772,13 @@ private function html_date() { //$this->markerArray['###LABEL###'] = htmlspecialchars($this->title); // add label $this->markerArray['###LABEL_NAME###'] = 'dateinput_uid' . $this->uid; // add name for label $this->markerArray['###POWERMAIL_FIELD_UID###'] = $this->uid; // UID to marker - + $value = ''; // use value from flexform if not empty - if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'value') && intval($this->pi_getFFvalue(t3lib_div::xml2array($this->xml),'value')) != 0) { + if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'value') && intval($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'value')) != 0) { $value = intval($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'value')); - if($value > 0) { + if ($value > 0) { // convert timestamp to gmt timestamp $value = gmmktime(date("H", $value), date("i", $value), date("s", $value), date("m", $value), date("d", $value), date("Y", $value)); } @@ -765,36 +786,36 @@ private function html_date() { if ($this->fe_field && $GLOBALS['TSFE']->fe_user->user[$this->fe_field]) { $value = intval(strip_tags($GLOBALS['TSFE']->fe_user->user[$this->fe_field])); - if($value > 0) { + if ($value > 0) { // convert timestamp to gmt timestamp $value = gmmktime(date("H", $value), date("i", $value), date("s", $value), date("m", $value), date("d", $value), date("Y", $value)); } } if (isset($this->piVarsFromSession['uid' . $this->uid]) && $this->piVarsFromSession['uid' . $this->uid] != '') { - if ($this->piVarsFromSession['uid' . $this->uid] == intval($this->div->nl2nl2($this->piVarsFromSession['uid' . $this->uid]))) { - // value from session is a integer -> javascript seems to be activated -> return integer from session - $value = intval($this->div->nl2nl2($this->piVarsFromSession['uid' . $this->uid])); - } else { - // value from session is not a integer -> javascript seems to be deactivated -> return value from session - $value = t3lib_div::removeXSS($this->piVarsFromSession['uid' . $this->uid]); - } + if ($this->piVarsFromSession['uid' . $this->uid] == intval($this->div->nl2nl2($this->piVarsFromSession['uid' . $this->uid]))) { + // value from session is a integer -> javascript seems to be activated -> return integer from session + $value = intval($this->div->nl2nl2($this->piVarsFromSession['uid' . $this->uid])); + } else { + // value from session is not a integer -> javascript seems to be deactivated -> return value from session + $value = t3lib_div::removeXSS($this->piVarsFromSession['uid' . $this->uid]); + } } $this->markerArray['###VALUE###'] = 'value="' . $value . '" '; - + $this->markerArray['###MIN###'] = 'min="' . htmlentities($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'min')) . '" '; - + if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'min') != 0) { - $this->markerArray['###MIN###'] = 'min="' . strftime('%Y-%m-%d', $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'min')). '" '; // add min to markerArray + $this->markerArray['###MIN###'] = 'min="' . strftime('%Y-%m-%d', $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'min')) . '" '; // add min to markerArray } elseif (trim($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'mincalc')) != '') { $this->markerArray['###MIN###'] = 'min="' . htmlentities($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'mincalc')) . '" '; } else { $this->markerArray['###MIN###'] = ''; } - + if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'max') != 0) { - $this->markerArray['###MAX###'] = 'max="' . strftime('%Y-%m-%d', $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'max')). '" '; // add max to markerArray + $this->markerArray['###MAX###'] = 'max="' . strftime('%Y-%m-%d', $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'max')) . '" '; // add max to markerArray } elseif (trim($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'maxcalc')) != '') { $this->markerArray['###MAX###'] = 'max="' . htmlentities($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'maxcalc')) . '" '; } else { @@ -805,13 +826,13 @@ private function html_date() { $params['inputField']['accesskey'] = $this->accesskeyarray[$i][2]; // set accesskey for datefield } - $this->markerArray['###PLACEHOLDER###'] = 'placeholder="'. $this->pi_getLL('JSvalidation_dateinput_format', 'yyyy-mm-dd') . '" '; + $this->markerArray['###PLACEHOLDER###'] = 'placeholder="' . $this->pi_getLL('JSvalidation_dateinput_format', 'yyyy-mm-dd') . '" '; $this->html_hookwithinfields(); // adds hook to manipulate the markerArray for any field $content = tslib_cObj::substituteMarkerArrayCached($this->tmpl['html_date'], $this->markerArray); // substitute Marker in Template $content = $this->dynamicMarkers->main($this->conf, $this->cObj, $content); // Fill dynamic locallang or typoscript markers - $content = preg_replace('|###.*?###|i', '', $content); // Finally clear not filled markers - + $content = preg_replace('|###.*?###|i', '', $content); // Finally clear not filled markers + return $content; // return HTML } @@ -833,7 +854,7 @@ private function html_button() { /** * Function html_countryselect() returns select field with countries from static_info_tables * - * @return string $content: HTML content of current field + * @return string $content: HTML content of current field */ private function html_countryselect() { @@ -841,63 +862,68 @@ private function html_countryselect() { // config $this->tmpl['html_countryselect']['all'] = tslib_cObj::getSubpart($this->tmpl['all'], '###POWERMAIL_FIELDWRAP_HTML_COUNTRYSELECT###'); // work on subpart 1 $this->tmpl['html_countryselect']['item'] = tslib_cObj::getSubpart($this->tmpl['html_countryselect']['all'], '###ITEM###'); // work on subpart 2 - $valuearray = $longvaluearray = array(); - $localfield = $whereadd = $content_item = ''; - $sort = 'cn_short_en'; // sort for a field + $content_item = ''; + $localfield = false; + $sorting = ''; + $orderBy = 'cn_short_en'; // set default sorting to short english county name // Filter for some countries - if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'within')) { // if some countries for include where selected + if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'within')) { // if some countries to include are selected $within_flexform = $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'within'); $within_flexform = $GLOBALS['TYPO3_DB']->cleanIntList($within_flexform); - $whereadd = ' AND uid IN (' . $within_flexform . ')'; - } elseif ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'without')) { // if some country for exclude where selected + $where = 'uid IN (' . $within_flexform . ')'; + } else if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'without')) { // if some country to exclude are selected $without_flexform = $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'without'); $without_flexform = $GLOBALS['TYPO3_DB']->cleanIntList($without_flexform); - $whereadd = ' AND uid NOT IN (' . $without_flexform . ')'; // whereadd for eclude values + $where = 'uid NOT IN (' . $without_flexform . ')'; // whereadd for exclude values } // Look for another lang version (maybe static_info_tables_de or _fr) if ($GLOBALS['TSFE']->tmpl->setup['config.']['language']) { // if language was set in ts - $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc( mysql_query('DESCRIBE static_countries cn_short_' . $GLOBALS['TSFE']->tmpl->setup['config.']['language']) ); // check for localized version of static_info_tables - } - if ($row['Field']) { // if there is a localized version of static_info_tables - $localfield = ', cn_short_' . $GLOBALS['TSFE']->tmpl->setup['config.']['language'] . ' cn_short_lang'; // add to query - $sort = 'cn_short_lang'; // change sort + $res1 = $GLOBALS['TYPO3_DB']->sql_query('DESCRIBE static_countries cn_short_' . $GLOBALS['TSFE']->tmpl->setup['config.']['language']); + if ($res1 !== false) { + $row1 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res1); // check for localized version of static_info_tables + if (!empty($row1['Field'])) { // if there is a localized version of static_info_tables + $localfield = 'cn_short_' . $GLOBALS['TSFE']->tmpl->setup['config.']['language']; + // workaround for wrong sorting of umlauts in some mysql installations and some empty localization values + $sorting = ", REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( IF($localfield <> '', $localfield, cn_short_en), 'Ä', 'A'), 'Ö', 'O'), 'Ãœ', 'U'), 'ä', 'a'), 'ö', 'o'), 'ü','u'), 'ß', 's'), 'Ã…','A') AS sorting, IF($localfield <> '', $localfield, cn_short_en) AS cn_short_merged"; + $orderBy = 'sorting'; // change sort + } + $GLOBALS['TYPO3_DB']->sql_free_result($res1); + } } // Give me all needed fields from static_info_tables - $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery ( - //'uid, cn_iso_2, cn_short_local, cn_short_en' . $localfield, - '*' . $localfield, + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( + "*" . $sorting, 'static_countries', - $where_clause = '1' . $whereadd, - $groupBy = '', - $orderBy = $sort, - $limit = '' + $where, + '', + $orderBy ); - if ($res) { // If there is a result + if ($res !== false) { // If there is a result while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { // One loop for every country - if ($row['cn_short_lang']) $row['cn_short_lang'] = $this->div->charset($row['cn_short_lang'], $this->conf['countryselect.']['charset']); // change charset of value + $row['cn_short_local'] = $this->div->charset($row['cn_short_local'], $this->conf['countryselect.']['charset']); $row['cn_short_en'] = $this->div->charset($row['cn_short_en'], $this->conf['countryselect.']['charset']); // change charset of value // Fill markers - // old fill (for old html templates) $markerArray['###VALUE###'] = $row['cn_iso_2']; - $markerArray['###LONGVALUE###'] = ($row['cn_short_lang'] ? $row['cn_short_lang'] : $row['cn_short_en']); - - // new fill - $markerArray['###CN_SHORT_MERGE###'] = ($row['cn_short_lang'] ? $row['cn_short_lang'] : $row['cn_short_en']); - foreach ((array) $row as $key => $value) { // one loop for every field in the database + foreach ((array)$row as $key => $value) { // one loop for every field in the database if (!empty($value)) { // if value is not empty $markerArray['###' . strtoupper($key) . '###'] = $value; } } + $markerArray['###CN_SHORT_MERGE###'] = $row['cn_short_local'] ? $row['cn_short_local'] + : $row['cn_short_en']; + if ($localfield !== false) { + $markerArray['###CN_SHORT_MERGE###'] = $this->div->charset($row['cn_short_merged'], $this->conf['countryselect.']['charset']); + } // Preselection if ($row['uid'] == $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'preselect') && $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'preselect') > 0) $markerArray['###SELECTED###'] = ' selected="selected"'; // preselect one country else $markerArray['###SELECTED###'] = ''; if (isset($this->piVarsFromSession['uid' . $this->uid])) { // if there is a session entry - if ($this->piVarsFromSession['uid' . $this->uid] == $row['cn_iso_2'] || $this->piVarsFromSession['uid' . $this->uid] == $row['cn_short_lang'] || $this->piVarsFromSession['uid' . $this->uid] == $row['cn_short_en']) { // check for short or long value + if ($this->piVarsFromSession['uid' . $this->uid] == $row['cn_iso_2'] || $this->piVarsFromSession['uid' . $this->uid] == $row['cn_short_local'] || $this->piVarsFromSession['uid' . $this->uid] == $row['cn_short_en']) { // check for short or long value $markerArray['###SELECTED###'] = ' selected="selected"'; // preselect one country } else $markerArray['###SELECTED###'] = ''; } @@ -905,20 +931,18 @@ private function html_countryselect() { $this->html_hookwithinfieldsinner($markerArray); // adds hook to manipulate the markerArray for any field $content_item .= $this->cObj->substituteMarkerArrayCached($this->tmpl['html_countryselect']['item'], $markerArray); } + $GLOBALS['TYPO3_DB']->sql_free_result($res); } $subpartArray['###CONTENT###'] = $content_item; // subpart 3 - $this->countryzones = t3lib_div::makeInstance('tx_powermail_countryzones'); - $this->countryzones->preflight($this->uid, $this->xml, $this->markerArray, $this->tmpl, $this->formtitle, $this->conf, $this->piVarsFromSession, $this->cObj); - $this->html_hookwithinfields(); // adds hook to manipulate the markerArray for any field $content = $this->cObj->substituteMarkerArrayCached($this->tmpl['html_countryselect']['all'], $this->markerArray, $subpartArray); // substitute Marker in Template $content = $this->dynamicMarkers->main($this->conf, $this->cObj, $content); // Fill dynamic locallang or typoscript markers $content = preg_replace('|###.*?###|i', '', $content); // Finally clear not filled markers } else { // Extension static_info_tables is missing - $content = 'Please install extension static_info_tables to use countryselect feature'; + $content = 'Please install extension static_info_tables to use country select feature'; } return $content; // return HTML @@ -930,12 +954,12 @@ private function html_countryselect() { * @return string $content */ private function html_captcha() { - if (t3lib_extMgm::isLoaded('captcha',0) || t3lib_extMgm::isLoaded('sr_freecap',0) || t3lib_extMgm::isLoaded('jm_recaptcha',0) || t3lib_extMgm::isLoaded('wt_calculating_captcha',0)) { // only if a captcha extension is loaded + if (t3lib_extMgm::isLoaded('captcha', 0) || t3lib_extMgm::isLoaded('sr_freecap', 0) || t3lib_extMgm::isLoaded('jm_recaptcha', 0) || t3lib_extMgm::isLoaded('wt_calculating_captcha', 0)) { // only if a captcha extension is loaded $this->tmpl['html_captcha'] = tslib_cObj::getSubpart($this->tmpl['all'], '###POWERMAIL_FIELDWRAP_HTML_CAPTCHA###'); // work on subpart if (t3lib_extMgm::isLoaded('sr_freecap', 0) && $this->conf['captcha.']['use'] == 'sr_freecap') { // use sr_freecap if available - require_once(t3lib_extMgm::extPath('sr_freecap').'pi2/class.tx_srfreecap_pi2.php'); // include freecap class + require_once(t3lib_extMgm::extPath('sr_freecap') . 'pi2/class.tx_srfreecap_pi2.php'); // include freecap class $this->freeCap = t3lib_div::makeInstance('tx_srfreecap_pi2'); // new object $freecaparray = $this->freeCap->makeCaptcha(); // array with freecap marker @@ -1016,12 +1040,14 @@ private function html_submitgraphic() { private function html_typoscript() { if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'typoscriptobject') != '') { // only if object field was set // config - $str = array(); $array = array(); // init + $str = array(); + $array = array(); // init $tsarray = t3lib_div::trimExplode('.', $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'typoscriptobject'), 1); // $tsarray[0] = lib // $tsarray[1] = object // let's go - for ($i=0; $itmpl->setup$str[0];"); // $newarray = $array['lib.']['object'] @@ -1029,29 +1055,28 @@ private function html_typoscript() { $localCObj = t3lib_div::makeInstance('tslib_cObj'); - $row = array ( // $row for using .field in typoscript + $row = array( // $row for using .field in typoscript 'uid' => $this->uid, // make current field uid available 'label' => $this->title, - 'ttcontent_uid' => $this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid'] // make current tt_content uid available + 'ttcontent_uid' => $this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] + : $this->cObj->data['uid'] // make current tt_content uid available ); $localCObj->start($row, 'tx_powermail_fields'); // enable .field to use uid and label in typoscript $content = $localCObj->cObjGetSingle($array[0], $array[1]); // parse typoscript } - + return $content; } - ################################################################################################################ - /** - * Function setGlobalMarkers() to fill global markers with values - * - * @return void - */ + * Function setGlobalMarkers() to fill global markers with values + * + * @return void + */ private function setGlobalMarkers() { // set global markers @@ -1068,7 +1093,7 @@ private function setGlobalMarkers() { // ###TYPE### $this->markerArray['###TYPE###'] = 'text'; - + // ###CLASS### $this->required = ''; if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'mandatory') == 1 || $this->type == 'captcha') { @@ -1076,7 +1101,7 @@ private function setGlobalMarkers() { } if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'validate') != '' && $this->type == 'text') { // Set input type to be HTML5 conform - switch ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'validate')){ + switch ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'validate')) { case 'validate-email': $this->markerArray['###TYPE###'] = 'email'; break; @@ -1099,21 +1124,26 @@ private function setGlobalMarkers() { $this->markerArray['###CLASS###'] .= 'powermail_' . $this->formtitle; // add formtitle $this->markerArray['###CLASS###'] .= ' powermail_' . $this->type; // add type of field $this->markerArray['###CLASS###'] .= ' powermail_uid' . $this->uid; // add uid of field - + + if ($this->type == 'countryselect' && $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'countryzone') == 1) { + $this->markerArray['###CLASS###'] .= ' powermail_with_countryzone'; // add css to enable countryzone detection over jQuery + } + // Add manual class $this->markerArray['###CLASS###'] .= ($this->class_f != '' && $this->additionalCssToInputField) ? ' ' . htmlspecialchars($this->class_f) : ''; - if ($this->type == 'datetime') { - $this->markerArray['###CLASS_TIME###'] = $this->markerArray['###CLASS###'] . ' powermail_time' . '" '; - } + if ($this->type == 'datetime') { + $this->markerArray['###CLASS_TIME###'] = $this->markerArray['###CLASS###'] . ' powermail_time' . '" '; + } $this->markerArray['###CLASS###'] .= '" '; // close tag - // Add manual class to outer div $this->markerArray['###CLASS_ADDITIONAL###'] .= ($this->class_f != '' && !$this->additionalCssToInputField) ? ' ' . htmlspecialchars($this->class_f) : ''; - + // ###SIZE### if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'size')) { // if size is set in flexform - $this->markerArray['###SIZE###'] = ($this->conf['input.']['style'] == 1 ? 'style="width: ' . intval($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'size')) . 'px;" ' : 'size="' . intval($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'size')) . '" '); // add size to markerArray + $this->markerArray['###SIZE###'] = ($this->conf['input.']['style'] == 1 + ? 'style="width: ' . intval($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'size')) . 'px;" ' + : 'size="' . intval($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'size')) . '" '); // add size to markerArray } // ###COLS### @@ -1151,17 +1181,17 @@ private function setGlobalMarkers() { if (($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'validate') == 'validate-number' || $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'validate') == 'validate-digits') && ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'min') || $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'min') === '0')) { // if there is value in the min field $this->markerArray['###MIN###'] = 'min="' . intval($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'min')) . '" '; // add min to markerArray } - + // ###MAX### if (($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'validate') == 'validate-number' || $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'validate') == 'validate-digits') && $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'max')) { // if there is value in the max field $this->markerArray['###MAX###'] = 'max="' . intval($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'max')) . '" '; // add max to markerArray } - + // ###STEP### if (($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'validate') == 'validate-number' || $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'validate') == 'validate-digits') && $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'step')) { // if there is value in the step field $this->markerArray['###STEP###'] = 'step="' . intval($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'step')) . '" '; // add step to markerArray } - + // ###PATTERN### if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'validate') == 'validate-pattern' && $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'pattern')) { // if there is value in the pattern field $this->markerArray['###PATTERN###'] = 'pattern="' . t3lib_div::removeXSS($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'pattern')) . '" '; // add pattern to markerArray @@ -1177,32 +1207,32 @@ private function setGlobalMarkers() { $this->markerArray['###PATTERN###'] = 'pattern="^[a-zA-Z0-9\s]*$" '; // add only alphanum pattern to markerArray break; case 'validate-alpha-w-umlaut': - $this->markerArray['###PATTERN###'] = 'pattern="^[a-zA-ZŠ€š…Ÿ†§‡ˆŽ“ï™\s]*$" '; // add only alpha pattern to markerArray + $this->markerArray['###PATTERN###'] = 'pattern="^[a-zA-Z��������������\s]*$" '; // add only alpha pattern to markerArray break; case 'validate-alphanum-w-umlaut': - $this->markerArray['###PATTERN###'] = 'pattern="^[0-9a-zA-ZŠ€š…Ÿ†§‡ˆŽ“ï™\s]*$" '; // add only alpha pattern to markerArray + $this->markerArray['###PATTERN###'] = 'pattern="^[0-9a-zA-Z��������������\s]*$" '; // add only alpha pattern to markerArray break; } } - + // ###PLACEHOLDER### if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'placeholder')) { // if there is value in the pattern field $this->markerArray['###PLACEHOLDER###'] = 'placeholder="' . htmlspecialchars($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'placeholder')) . '" '; // add placeholder to markerArray } - + // ###VALUE### if (isset($this->sessionfields['uid' . $this->uid]) && !is_array($this->sessionfields['uid' . $this->uid])) { // 1. if value is in session $this->markerArray['###VALUE###'] = 'value="' . stripslashes($this->div->nl2nl2($this->sessionfields['uid' . $this->uid])) . '" '; } elseif ($this->fe_field && $GLOBALS['TSFE']->fe_user->user[$this->fe_field]) { // 2. else if value should be filled from current logged in user $this->markerArray['###VALUE###'] = 'value="' . strip_tags($GLOBALS['TSFE']->fe_user->user[$this->fe_field]) . '" '; - } elseif ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml),'value') || $this->pi_getFFvalue(t3lib_div::xml2array($this->xml),'value') === '0') { // 3. take value from backend (default value) + } elseif ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'value') || $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'value') === '0') { // 3. take value from backend (default value) $this->markerArray['###VALUE###'] = 'value="' . htmlspecialchars($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'value')) . '" '; } elseif (!empty($this->conf['prefill.']['uid' . $this->uid])) { // 4. prefilling with typoscript for current field enabled $this->markerArray['###VALUE###'] = 'value="' . $this->cObj->cObjGetSingle($this->conf['prefill.']['uid' . $this->uid], $this->conf['prefill.']['uid' . $this->uid . '.']) . '" '; // add typoscript value } else { // 5. no prefilling - so clear value marker $this->markerArray['###VALUE###'] = 'value="" '; // clear } - + // ###LABEL### if (!empty($this->title)) { $this->markerArray['###LABEL###'] = $this->title; @@ -1224,26 +1254,28 @@ private function setGlobalMarkers() { // ###POWERMAIL_TARGET### #$this->markerArray['###POWERMAIL_TARGET###'] = $GLOBALS['TSFE']->absRefPrefix.$this->cObj->typolink('x', array("returnLast" => "url", "parameter" => $GLOBALS['TSFE']->id, "useCacheHash"=>1)); // Global marker with form target - $this->markerArray['###POWERMAIL_TARGET###'] = $this->cObj->typolink('x', array('returnLast' => 'url', 'parameter' => $GLOBALS['TSFE']->id, 'additionalParams' => '&tx_powermail_pi1[mailID]=' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']), 'useCacheHash' => 1)); + $this->markerArray['###POWERMAIL_TARGET###'] = $this->cObj->typolink('x', array('returnLast' => 'url', 'parameter' => $GLOBALS['TSFE']->id, 'additionalParams' => '&tx_powermail_pi1[mailID]=' . ($this->cObj->data['_LOCALIZED_UID'] > 0 + ? $this->cObj->data['_LOCALIZED_UID'] + : $this->cObj->data['uid']), 'useCacheHash' => 1)); // ###POWERMAIL_NAME### $this->markerArray['###POWERMAIL_NAME###'] = htmlspecialchars($this->formtitle); // Global Marker with formname // ###ALTERNATE### - $this->markerArray['###ALTERNATE###'] = ($this->div->alternate($this->counter) ? ' odd' : ' even'); // Fill class with "odd" or "even" + $this->markerArray['###ALTERNATE###'] = $this->div->alternate($this->counter) ? ' odd' : ' even'; // Fill class with "odd" or "even" // ###TABINDEX### - // 1. add tabindex automaticly + // 1. add tabindex automatically if (in_array($this->uid, $this->tabindex)) { // if current uid within tabindex array $this->turnedtabindex = array_flip($this->tabindex); // array flipped (values and keys) - $this->markerArray['###TABINDEX###'] = 'tabindex="' . ($this->turnedtabindex[$this->uid] + 1) . '" '; // add tabindex automaticly + $this->markerArray['###TABINDEX###'] = 'tabindex="' . ($this->turnedtabindex[$this->uid] + 1) . '" '; // add tabindex automatically } // 2. set tabindex from ts if (!empty($this->conf['barrier-free.']['tabindex'])) { // If manually set tabindex in ts $this->tabindex = t3lib_div::trimExplode(',', str_replace('uid', '', $this->conf['barrier-free.']['tabindex']), 1); // Array with uids $this->turnedtabindex = array_flip($this->tabindex); // array flipped (values and keys) if (in_array($this->uid, $this->tabindex)) { // If current uid exists in tabindex settings from ts - $this->markerArray['###TABINDEX###'] = 'tabindex="' . ($this->turnedtabindex[$this->uid] + 1) . '" '; // add tabindex automaticly + $this->markerArray['###TABINDEX###'] = 'tabindex="' . ($this->turnedtabindex[$this->uid] + 1) . '" '; // add tabindex automatically } } @@ -1251,7 +1283,7 @@ private function setGlobalMarkers() { if (!empty($this->conf['barrier-free.']['accesskey'])) { // If manually set accesskey in ts $array = t3lib_div::trimExplode(',', $this->conf['barrier-free.']['accesskey'], 1); // Array with uids and subuids - for ($i=0; $iaccesskeyarray[$i] = t3lib_div::trimExplode('_', str_replace('uid', '', $temparray[$i][0]), 1); // split on _ $this->accesskeyarray[$i][2] = $temparray[$i][1]; // [2] = accesskey value @@ -1269,34 +1301,28 @@ private function setGlobalMarkers() { $this->markerArray['###ONCHANGE###'] = 'onchange="this.form.submit()"'; // onchange js for select fields } -// // ###ONFOCUS### Marker -// $this->markerArray['###ONFOCUS###'] = ''; -// if ($this->conf['js.']['onfocus']) { // only allowed if jsinit or onfocus set -// if ($this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'value') && $this->conf['js.']['onfocus'] && !$this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'readonly')) { // if value exists -// $js = 'onfocus="if (this.value==\'' . $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'value') . '\') this.value=\'\';" onblur="if (this.value==\'\') this.value=\'' . $this->pi_getFFvalue(t3lib_div::xml2array($this->xml), 'value') . '\'; ' . $init . '" '; // add onfocus js to markerArray -// } -// $this->markerArray['###ONFOCUS###'] = $js; // Fill markerArray with JS -// } + $this->markerArray['###PLEASE_SELECT###'] = $this->pi_getLL('please_select', 'Please select...'); + } /** - * Function GetSessionValue() to get any field value which is already in the session - * - * @return void - */ + * Function GetSessionValue() to get any field value which is already in the session + * + * @return void + */ private function GetSessionValue() { $this->sessions = t3lib_div::makeInstance('tx_powermail_sessions'); $this->piVarsFromSession = $this->sessions->getSession($this->conf, $this->cObj, 0); } /** - * Function html_hook1() to add a hook to manipulate some content - * - * @return void - */ + * Function html_hook1() to add a hook to manipulate some content + * + * @return void + */ private function html_hook1() { if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FieldWrapMarkerHook1'])) { // Adds hook for processing of extra global markers - foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FieldWrapMarkerHook1'] as $_classRef) { + foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FieldWrapMarkerHook1'] as $_classRef) { $_procObj = & t3lib_div::getUserObj($_classRef); $_procObj->PM_FieldWrapMarkerHook1($this->uid, $this->xml, $this->type, $this->title, $this->markerArray, $this->piVarsFromSession, $this); // Get new marker Array from other extensions } @@ -1304,13 +1330,13 @@ private function html_hook1() { } /** - * Function html_hook2() to add a hook at the end of this file to manipulate content - * - * @return void - */ + * Function html_hook2() to add a hook at the end of this file to manipulate content + * + * @return void + */ private function html_hook2() { if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FieldWrapMarkerHook'])) { // Adds hook for processing of extra global markers - foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FieldWrapMarkerHook'] as $_classRef) { + foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FieldWrapMarkerHook'] as $_classRef) { $_procObj = & t3lib_div::getUserObj($_classRef); $_procObj->PM_FieldWrapMarkerHook($this->uid, $this->xml, $this->type, $this->title, $this->markerArray, $this->content, $this->piVarsFromSession, $this); // Get new marker Array from other extensions } @@ -1318,13 +1344,13 @@ private function html_hook2() { } /** - * Function html_hookwithinfields() to add a hook in every field generation to manipulate markerArray - * - * @return void - */ + * Function html_hookwithinfields() to add a hook in every field generation to manipulate markerArray + * + * @return void + */ private function html_hookwithinfields() { if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FieldWrapMarkerArrayHook'])) { // Adds hook for processing of extra global markers - foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FieldWrapMarkerArrayHook'] as $_classRef) { + foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FieldWrapMarkerArrayHook'] as $_classRef) { $_procObj = & t3lib_div::getUserObj($_classRef); $_procObj->PM_FieldWrapMarkerArrayHook($this->uid, $this->xml, $this->type, $this->title, $this->markerArray, $this->piVarsFromSession, $this); // Get new marker Array from other extensions } @@ -1332,14 +1358,14 @@ private function html_hookwithinfields() { } /** - * Function html_hookwithinfieldsinner($markerArray) to add a hook in every field generation to manipulate markerArray in the inner loop (checkboxes, radiobuttons, etc..) - * - * @param $markerArray: markerArray - * @return void - */ + * Function html_hookwithinfieldsinner($markerArray) to add a hook in every field generation to manipulate markerArray in the inner loop (checkboxes, radiobuttons, etc..) + * + * @param $markerArray: markerArray + * @return void + */ private function html_hookwithinfieldsinner(&$markerArray) { if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FieldWrapMarkerArrayHookInner'])) { // Adds hook for processing of extra global markers - foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FieldWrapMarkerArrayHookInner'] as $_classRef) { + foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FieldWrapMarkerArrayHookInner'] as $_classRef) { $_procObj = & t3lib_div::getUserObj($_classRef); $_procObj->PM_FieldWrapMarkerHookInner($this->uid, $this->xml, $this->type, $this->title, $markerArray, $this->piVarsFromSession, $this); // Get new marker Array from other extensions } @@ -1347,20 +1373,20 @@ private function html_hookwithinfieldsinner(&$markerArray) { } /** - * Function isPrefilled returns whether a option is prefilled or not - * - * @param int current index - * @param array array of values or indexes to select/check - * @param value current value - * - * @return boolean - */ + * Function isPrefilled returns whether a option is prefilled or not + * + * @param int current index + * @param array array of values or indexes to select/check + * @param value current value + * + * @return boolean + */ private function isPrefilled($index, $selected, $value) { if ($this->cObj->stdWrap($this->conf['prefill.']['uid' . $this->uid . '_' . $index], $this->conf['prefill.']['uid' . $this->uid . '_' . $index . '.'])) { return true; // by field - } elseif (is_int($selected[0]) && in_array($index, (array) $selected)) { + } elseif (is_int($selected[0]) && in_array($index, (array)$selected)) { return true; // by index - } elseif (in_array($value, (array) $selected)) { + } elseif (in_array($value, (array)$selected)) { return true; // by value } @@ -1368,7 +1394,7 @@ private function isPrefilled($index, $selected, $value) { } } -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/pi1/class.tx_powermail_html.php']) { +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/pi1/class.tx_powermail_html.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/pi1/class.tx_powermail_html.php']); } ?> \ No newline at end of file diff --git a/pi1/class.tx_powermail_mandatory.php b/pi1/class.tx_powermail_mandatory.php index a185e6aa..c041eedd 100644 --- a/pi1/class.tx_powermail_mandatory.php +++ b/pi1/class.tx_powermail_mandatory.php @@ -1,26 +1,26 @@ markers = t3lib_div::makeInstance('tx_powermail_markers'); // New object: TYPO3 mail functions // Template - $content_item = ''; $this->error = 0; $this->innerMarkerArray = $this->tmpl = $fieldarray = array(); + $content_item = ''; + $this->error = 0; + $this->innerMarkerArray = $this->tmpl = $fieldarray = array(); $this->tmpl['mandatory']['all'] = $this->cObj->getSubpart(tslib_cObj::fileResource($this->conf['template.']['mandatory']), '###POWERMAIL_MANDATORY_ALL###'); // Load HTML Template outer (work on subpart) $this->tmpl['mandatory']['item'] = $this->cObj->getSubpart($this->tmpl['mandatory']['all'], '###ITEM###'); // Load HTML Template inner (work on subpart) $this->tmpl['mandatory']['backbutton'] = $this->cObj->getSubpart($this->tmpl['mandatory']['all'], '###BACKBUTTON###'); // Load HTML Template inner (work on subpart) @@ -70,13 +72,13 @@ public function main($conf, $sessionfields, $cObj) { // Fill Markers $this->markerArray = $this->markers->GetMarkerArray($this->conf, $this->sessionfields, $this->cObj, 'mandatory'); // Fill markerArray - + $anchorId = ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']); $targetLinkParams = array( - 'returnLast' => 'url', - 'parameter' => $GLOBALS['TSFE']->id, + 'returnLast' => 'url', + 'parameter' => $GLOBALS['TSFE']->id, 'useCacheHash' => 1, - #'no_cache' => 1 + #'no_cache' => 1 #'section' => ); $this->markerArray['###POWERMAIL_TARGET###'] = $this->cObj->typolink('x', $targetLinkParams) . '#c' . $anchorId; @@ -108,12 +110,12 @@ public function main($conf, $sessionfields, $cObj) { // Return $this->hook(); // adds hook - $this->content = $this->cObj->substituteMarkerArrayCached($this->tmpl['mandatory']['all'], $this->markerArray,$subpartArray); // substitute Marker in Template + $this->content = $this->cObj->substituteMarkerArrayCached($this->tmpl['mandatory']['all'], $this->markerArray, $subpartArray); // substitute Marker in Template $this->content = $this->dynamicMarkers->main($this->conf, $this->cObj, $this->content); // Fill dynamic locallang or typoscript markers $this->content = preg_replace('|###.*?###|i', '', $this->content); // Finally clear not filled markers $this->overwriteSession(); // write $this->sessionfields to session if there is an ok for an error - if ($this->error == 1) { // if there is an error + if ($this->error == 1) { // if there is an error $this->clearErrorsInSession(); return $this->content; // return HTML } @@ -123,27 +125,27 @@ public function main($conf, $sessionfields, $cObj) { * Function mandatoryCheck() checks if a field has to contain anything * * @return void - */ + */ public function mandatoryCheck() { - // Give me all fields of current content uid - $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery ( + // Give me all fields of current content uid + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( 'tx_powermail_fields.uid, tx_powermail_fields.title, tx_powermail_fields.flexform, tx_powermail_fields.class', 'tx_powermail_fields LEFT JOIN tx_powermail_fieldsets ON tx_powermail_fields.fieldset = tx_powermail_fieldsets.uid LEFT JOIN tt_content ON tx_powermail_fieldsets.tt_content = tt_content.uid', - $where_clause = 'tx_powermail_fieldsets.tt_content = ' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']) . tslib_cObj::enableFields('tt_content') . tslib_cObj::enableFields('tx_powermail_fieldsets') . tslib_cObj::enableFields('tx_powermail_fields'), + $where_clause = 'tx_powermail_fieldsets.tt_content = ' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] + : $this->cObj->data['uid']) . tslib_cObj::enableFields('tt_content') . tslib_cObj::enableFields('tx_powermail_fieldsets') . tslib_cObj::enableFields('tx_powermail_fields'), $groupBy = '', $orderBy = 'tx_powermail_fieldsets.sorting ASC, tx_powermail_fields.sorting ASC', $limit = 10000 ); if ($res) { // If there is a result while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { // One loop for every field - //t3lib_div::devlog('class found: ' . $row['class'], 'powermail', 0); /** * Modified for Bel: do not validate on server side if class of field is set to "donotcheckmandatory" */ if (($this->pi_getFFvalue(t3lib_div::xml2array($row['flexform']), 'mandatory') == 1 || $this->conf['validate.']['uid' . $row['uid'] . '.']['required'] == 1) && $row['class'] != 'donotcheckmandatory') { // if in current xml mandatory == 1 OR mandatory was set via TS for current field if (!is_array($this->sessionfields['uid' . $row['uid']])) { // first level - if (trim($this->sessionfields['uid' . $row['uid']]) === '' || !isset($this->sessionfields['uid'.$row['uid']])) { // only if current value is not set in session (piVars) + if (trim($this->sessionfields['uid' . $row['uid']]) === '' || !isset($this->sessionfields['uid' . $row['uid']])) { // only if current value is not set in session (piVars) $this->sessionfields['ERROR'][$row['uid']][] = $this->pi_getLL('locallangmarker_mandatory_emptyfield') . ' ' . $row['title'] . ''; // set current error to sessionlist } } else { // second level (maybe for checkboxes) @@ -165,7 +167,7 @@ public function mandatoryCheck() { * Function uniqueCheck() checks (if activated via constants) if a field is already filled with this value (like email addresses) * * @return void - */ + */ public function uniqueCheck() { // config $uniquearray = t3lib_div::trimExplode(',', $this->conf['enable.']['unique'], 1); // Get unique constants from ts @@ -184,7 +186,7 @@ public function uniqueCheck() { // DB Select $likeValue = $GLOBALS['TYPO3_DB']->escapeStrForLike($GLOBALS['TYPO3_DB']->quoteStr($this->sessionfields[strtolower($value)], 'tx_powermail_mails'), 'tx_powermail_mails'); - $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery ( // Get all emails with any entry of current value + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( // Get all emails with any entry of current value 'piVars', 'tx_powermail_mails', $where_clause = 'pid = ' . intval($this->save_PID) . ' AND piVars LIKE "%' . $likeValue . '%"' . tslib_cObj::enableFields('tx_powermail_mails'), @@ -208,12 +210,13 @@ public function uniqueCheck() { } - // check for IP address + // check for IP address elseif (strtolower($value) == 'ip' && $confarray['disableIPlog'] != 1) { // value == ip AND IP log is not disabled - $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery ( // get any entry with same IP address like current user + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( // get any entry with same IP address like current user 'senderIP', 'tx_powermail_mails', - $where_clause = 'pid = ' . ($this->conf['PID.']['dblog'] ? intval($this->conf['PID.']['dblog']) : $GLOBALS['TSFE']->id) . ' AND senderIP = "' . $_SERVER['REMOTE_ADDR'] . '"' . tslib_cObj::enableFields('tx_powermail_mails'), + $where_clause = 'pid = ' . ($this->conf['PID.']['dblog'] ? intval($this->conf['PID.']['dblog']) + : $GLOBALS['TSFE']->id) . ' AND senderIP = "' . $_SERVER['REMOTE_ADDR'] . '"' . tslib_cObj::enableFields('tx_powermail_mails'), $groupBy = '', $orderBy = '', $limit = 1 @@ -231,10 +234,10 @@ public function uniqueCheck() { * Functions regulareExpressions() checks if values from the form fits to an expression * * @return void - */ + */ public function regulareExpressions() { // Config - set regulare expressions for autocheck - $autoarray = array ( + $autoarray = array( 'email' => "#^[_a-z0-9!#$%&\\'*+-\/=?^_`.{|}~]+(\.[_a-z0-9!#$%&\'*+-\\/=?^_`.{|}~]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,6})$#", 'url' => "#^(http://|https://)?([a-z0-9-]+\.)+([a-z0-9-]{2,3})$#", 'numbers' => "/^[0-9]+$/", @@ -252,7 +255,8 @@ public function regulareExpressions() { // Check if (!preg_match($autoarray[$this->conf['validate.'][$key]['auto']], $this->sessionfields[str_replace('.', '', $key)])) { // If check failed - $this->sessionfields['ERROR'][str_replace(array('.', 'uid'), '', $key)][] = ($this->conf['validate.'][$key]['errormsg'] ? $this->conf['validate.'][$key]['errormsg'] : $this->pi_getLL('error_expression_validation')); // write errormessage + $this->sessionfields['ERROR'][str_replace(array('.', 'uid'), '', $key)][] = ($this->conf['validate.'][$key]['errormsg'] + ? $this->conf['validate.'][$key]['errormsg'] : $this->pi_getLL('error_expression_validation')); // write errormessage } } @@ -261,8 +265,9 @@ public function regulareExpressions() { if ($this->sessionfields[str_replace('.', '', $key)]) { // if there is a value in the field, which to check // Check - if (!preg_match($this->div->marker2value($this->conf['validate.'][$key]['expression'],$this->sessionfields), $this->sessionfields[str_replace('.', '', $key)])) { // If check failed - $this->sessionfields['ERROR'][str_replace(array('.', 'uid'), '', $key)][] = ($this->conf['validate.'][$key]['errormsg'] ? $this->conf['validate.'][$key]['errormsg'] : $this->pi_getLL('error_expression_validation')); // write errormessage + if (!preg_match($this->div->marker2value($this->conf['validate.'][$key]['expression'], $this->sessionfields), $this->sessionfields[str_replace('.', '', $key)])) { // If check failed + $this->sessionfields['ERROR'][str_replace(array('.', 'uid'), '', $key)][] = ($this->conf['validate.'][$key]['errormsg'] + ? $this->conf['validate.'][$key]['errormsg'] : $this->pi_getLL('error_expression_validation')); // write errormessage } } @@ -275,7 +280,7 @@ public function regulareExpressions() { * Function emailCheck() checks if sender email address is a real email address, if not write error to session * * @return void - */ + */ public function emailCheck() { if ($this->cObj->data['tx_powermail_sender'] && is_array($this->sessionfields)) { // If email address from sender is set in backend if ($this->sessionfields[$this->cObj->data['tx_powermail_sender']]) { // if there is content in the email sender field @@ -283,8 +288,8 @@ public function emailCheck() { $this->sessionfields['ERROR'][str_replace('uid', '', $this->cObj->data['tx_powermail_sender'])][] = $this->pi_getLL('error_validemail'); // write error message to session } else { // Syntax of email address is correct - check for MX Record (if activated via constants) if ($this->conf['email.']['checkMX'] && !t3lib_div::validEmail($this->sessionfields[$this->cObj->data['tx_powermail_sender']])) { - $this->sessionfields['ERROR'][str_replace('uid', '', $this->cObj->data['tx_powermail_sender'])][] = $this->pi_getLL('error_nomx'); // write error message to session - } + $this->sessionfields['ERROR'][str_replace('uid', '', $this->cObj->data['tx_powermail_sender'])][] = $this->pi_getLL('error_nomx'); // write error message to session + } } } } @@ -294,7 +299,7 @@ public function emailCheck() { * Function captchaCheck check if captcha fields are within current content and set errof if value is wrong * * @return void - */ + */ public function captchaCheck() { if ( // only if a supported captcha extension is loaded t3lib_extMgm::isLoaded('captcha', 0) || @@ -304,10 +309,12 @@ public function captchaCheck() { ) { // Give me all captcha fields of current tt_content - $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery ( + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( 'tx_powermail_fields.uid', 'tx_powermail_fields LEFT JOIN tx_powermail_fieldsets ON tx_powermail_fields.fieldset = tx_powermail_fieldsets.uid LEFT JOIN tt_content ON tx_powermail_fieldsets.tt_content = tt_content.uid', - $where_clause = 'tx_powermail_fields.formtype = "captcha" AND tx_powermail_fieldsets.tt_content = ' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']) . tslib_cObj::enableFields('tt_content') . tslib_cObj::enableFields('tx_powermail_fieldsets') . tslib_cObj::enableFields('tx_powermail_fields'), + $where_clause = 'tx_powermail_fields.formtype = "captcha" AND tx_powermail_fieldsets.tt_content = ' . ($this->cObj->data['_LOCALIZED_UID'] > 0 + ? $this->cObj->data['_LOCALIZED_UID'] + : $this->cObj->data['uid']) . tslib_cObj::enableFields('tt_content') . tslib_cObj::enableFields('tx_powermail_fieldsets') . tslib_cObj::enableFields('tx_powermail_fields'), $groupBy = '', $orderBy = 'tx_powermail_fieldsets.sorting ASC, tx_powermail_fields.sorting ASC', $limit = 1 @@ -328,7 +335,7 @@ public function captchaCheck() { } elseif ( ($_SESSION['sr_freecap_word_hash'] != md5($this->sessionfields['uid' . $row['uid']])) && - ($_SESSION['sr_freecap_word_hash'] != md5($this->sessionfields['uid' . $row['uid']]."\n")) && + ($_SESSION['sr_freecap_word_hash'] != md5($this->sessionfields['uid' . $row['uid']] . "\n")) && ($GLOBALS['TSFE']->fe_user->sesData['tx_sr_freecap']['sr_freecap_word_hash'] != md5($this->sessionfields['uid' . $row['uid']])) && (is_object($this->freeCap) && !$this->freeCap->checkWord($this->sessionfields['uid' . $row['uid']])) ) { @@ -339,50 +346,50 @@ public function captchaCheck() { } - // captcha + // captcha elseif (t3lib_extMgm::isLoaded('captcha', 0) && $this->conf['captcha.']['use'] == 'captcha') { // use captcha if available session_start(); // start session $captchaStr = $_SESSION['tx_captcha_string']; // get captcha value from session - if ($this->sessionfields['uid'.$row['uid']] == '') { // if captcha value is empty + if ($this->sessionfields['uid' . $row['uid']] == '') { // if captcha value is empty $this->sessionfields['ERROR'][$row['uid']][] = $this->pi_getLL('error_captcha_empty'); // write error message to session } - elseif ($this->sessionfields['uid'.$row['uid']] != $captchaStr) { // if captcha value is wrong + elseif ($this->sessionfields['uid' . $row['uid']] != $captchaStr) { // if captcha value is wrong $this->sessionfields['ERROR'][$row['uid']][] = $this->pi_getLL('error_captcha_wrong'); // write error message to session } } - // jm_recaptcha + // jm_recaptcha elseif (t3lib_extMgm::isLoaded('jm_recaptcha', 0) && $this->conf['captcha.']['use'] == 'recaptcha') { // use recaptcha if available - if (!$this->sessionfields['OK'][$row['uid']]) { // do this check only if recaptcha gave not ok before // if ok, you don't have to check again if captcha is right - require_once(t3lib_extMgm::extPath('jm_recaptcha').'class.tx_jmrecaptcha.php'); // include recaptcha class - $recaptcha = t3lib_div::makeInstance('tx_jmrecaptcha'); // new object + if (!$this->sessionfields['OK'][$row['uid']]) { // do this check only if recaptcha gave not ok before // if ok, you don't have to check again if captcha is right + require_once(t3lib_extMgm::extPath('jm_recaptcha') . 'class.tx_jmrecaptcha.php'); // include recaptcha class + $recaptcha = t3lib_div::makeInstance('tx_jmrecaptcha'); // new object - $status = $recaptcha->validateReCaptcha(); // get status - if (!$status['verified']) { // if code is ok - $this->sessionfields['ERROR'][$row['uid']][] = $this->pi_getLL('error_captcha_wrong'); // error message - } else { // code ok - $this->sessionfields['OK'][$row['uid']] = 'recaptcha'; // recaptcha code is ok - set an ok to the session for further checks - } - } + $status = $recaptcha->validateReCaptcha(); // get status + if (!$status['verified']) { // if code is ok + $this->sessionfields['ERROR'][$row['uid']][] = $this->pi_getLL('error_captcha_wrong'); // error message + } else { // code ok + $this->sessionfields['OK'][$row['uid']] = 'recaptcha'; // recaptcha code is ok - set an ok to the session for further checks + } + } } - // wt_calculating_captcha + // wt_calculating_captcha elseif (t3lib_extMgm::isLoaded('wt_calculating_captcha', 0) && $this->conf['captcha.']['use'] == 'wt_calculating_captcha') { // use wt_calculating_captcha if available - require_once(t3lib_extMgm::extPath('wt_calculating_captcha').'class.tx_wtcalculatingcaptcha.php'); // include captcha class + require_once(t3lib_extMgm::extPath('wt_calculating_captcha') . 'class.tx_wtcalculatingcaptcha.php'); // include captcha class $captcha = t3lib_div::makeInstance('tx_wtcalculatingcaptcha'); // generate object - if ($this->sessionfields['uid'.$row['uid']] == '') { // if captcha value is empty + if ($this->sessionfields['uid' . $row['uid']] == '') { // if captcha value is empty $this->sessionfields['ERROR'][$row['uid']][] = $this->pi_getLL('error_captcha_empty'); // write error message to session } - elseif (!$captcha->correctCode($this->sessionfields['uid'.$row['uid']])) { // if captcha value is wrong + elseif (!$captcha->correctCode($this->sessionfields['uid' . $row['uid']])) { // if captcha value is wrong $this->sessionfields['ERROR'][$row['uid']][] = $this->pi_getLL('error_captcha_wrong'); // write error message to session } @@ -394,30 +401,30 @@ public function captchaCheck() { } /******************************************** - * Custom php validation - * Loop all 'customvalidation' keys for possible requests. A custom validation requires 3 - * configuration keys: - * - includelib - the files to include (file that contains definition for the function - * to call for validation). Can be an absolute path or it can be in any - * file path that TypoScript allows to configure. This key is optional. - * - userfunc - the user function to call for validation. This has teh same format as - * the 'userFunc' TypoScript page setting. The function receives an array, - * having 3 items, 'value' with the value of the control, 'uid' with the id - * of the control (without the 'uid' prefix), 'conf' as the configuration - * of powermail ($this->conf) - * - errormsg - the error message to be displayed to the user. This can contain JS code, - * as the error message is writen directly to the page without being escaped. - * (You might wan't a global configuration at server level it to escape the - * error messages writen by powermail). - * - * The called function has two type of return values: - * - true/false - if the validation succeded or not - * - an array with 2 elements: 'result' that has to be true/false (as above) and - * 'errormsg' as the custom error message to be displayed. If the 'errormsg' info is - * missing the configured errormsg for this control is used (or the default message). - * In case the called user function throws an exception, this is treated as a failed - * validation. - ********************************************/ + * Custom php validation + * Loop all 'customvalidation' keys for possible requests. A custom validation requires 3 + * configuration keys: + * - includelib - the files to include (file that contains definition for the function + * to call for validation). Can be an absolute path or it can be in any + * file path that TypoScript allows to configure. This key is optional. + * - userfunc - the user function to call for validation. This has teh same format as + * the 'userFunc' TypoScript page setting. The function receives an array, + * having 3 items, 'value' with the value of the control, 'uid' with the id + * of the control (without the 'uid' prefix), 'conf' as the configuration + * of powermail ($this->conf) + * - errormsg - the error message to be displayed to the user. This can contain JS code, + * as the error message is writen directly to the page without being escaped. + * (You might wan't a global configuration at server level it to escape the + * error messages writen by powermail). + * + * The called function has two type of return values: + * - true/false - if the validation succeded or not + * - an array with 2 elements: 'result' that has to be true/false (as above) and + * 'errormsg' as the custom error message to be displayed. If the 'errormsg' info is + * missing the configured errormsg for this control is used (or the default message). + * In case the called user function throws an exception, this is treated as a failed + * validation. + ********************************************/ public function customValidation() { $configKey = 'customvalidation.'; @@ -428,7 +435,7 @@ public function customValidation() { $method = $value['userfunc']; $message = $value['errormsg']; - if ($file){ + if ($file) { $file = t3lib_div::getFileAbsFileName($file); require_once($file); } @@ -438,19 +445,19 @@ public function customValidation() { $paramsValue['conf'] = $this->conf; $paramsRef = null; - try { + try { $result = t3lib_div::callUserFunction($method, $paramsValue, $paramsRef, null, 2); $resultStatus = false; // Get the actual validation result and eventual error message - if (is_object($result)){ // check if userFunc returns an object + if (is_object($result)) { // check if userFunc returns an object $resultStatus = $result->result; - if (isset($result->errormsg)){ + if (isset($result->errormsg)) { $message = $result->errormsg; } } elseif (is_array($result)) { // check if userFunc returns an array $resultStatus = $result['result']; - if (isset($result->errormsg)){ + if (isset($result->errormsg)) { $message = $result['errormsg']; } } elseif (is_bool($result)) { // check if userFunc returns true or false @@ -460,7 +467,7 @@ public function customValidation() { } } catch (Exception $e) { $resultStatus = false; - $message = 'Unable to validate field ' . $this->markerArray['###LABEL_' . str_replace('.', '', $key) . '###']; // error in using userFunc + $message = 'Unable to validate field ' . $this->markerArray['###LABEL_' . str_replace('.', '', $key) . '###']; // error in using userFunc } if ($resultStatus !== true) { if (!$message) { @@ -476,23 +483,25 @@ public function customValidation() { * Function overwriteSession() saves $this->sessionfields to session to overwrite errors (recaptcha can set an OK for errors in future) * * @return void - */ + */ private function overwriteSession() { - if (count($this->sessionfields['OK']) > 0) { // only if min 1 OK value - $GLOBALS['TSFE']->fe_user->setKey('ses', $this->extKey . '_' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']), $this->sessionfields); // Generate Session without ERRORS - $GLOBALS['TSFE']->storeSessionData(); // Save session - } - } + if (count($this->sessionfields['OK']) > 0) { // only if min 1 OK value + $GLOBALS['TSFE']->fe_user->setKey('ses', $this->extKey . '_' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] + : $this->cObj->data['uid']), $this->sessionfields); // Generate Session without ERRORS + $GLOBALS['TSFE']->storeSessionData(); // Save session + } + } /** * Function clearErrorsInSession() removes all global errors, which are marked as an error in the session * * @return void - */ + */ private function clearErrorsInSession() { // Set Session (overwrite all values) unset($this->sessionfields['ERROR']); // remove all error messages - $GLOBALS['TSFE']->fe_user->setKey('ses', $this->extKey . '_' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']), $this->sessionfields); // Generate Session without ERRORS + $GLOBALS['TSFE']->fe_user->setKey('ses', $this->extKey . '_' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] + : $this->cObj->data['uid']), $this->sessionfields); // Generate Session without ERRORS $GLOBALS['TSFE']->storeSessionData(); // Save session } @@ -500,10 +509,10 @@ private function clearErrorsInSession() { * Function hookBefore() to enable manipulation datas with another extension(s) before mandatory message creation * * @return void - */ + */ private function hookBefore() { if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_MandatoryHookBefore'])) { // Adds hook for processing of extra global markers - foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_MandatoryHookBefore'] as $_classRef) { + foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_MandatoryHookBefore'] as $_classRef) { $_procObj = &t3lib_div::getUserObj($_classRef); $_procObj->PM_MandatoryHookBefore($this->error, $this->markerArray, $this->sessionfields, $this); // Open function to manipulate data } @@ -514,10 +523,10 @@ private function hookBefore() { * Function hook() to enable manipulation datas with another extension(s) after mandatory message creation * * @return void - */ + */ private function hook() { if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_MandatoryHook'])) { // Adds hook for processing of extra global markers - foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_MandatoryHook'] as $_classRef) { + foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_MandatoryHook'] as $_classRef) { $_procObj = &t3lib_div::getUserObj($_classRef); $_procObj->PM_MandatoryHook($this->error, $this->markerArray, $this->innerMarkerArray, $this->sessionfields, $this); // Open function to manipulate data } @@ -525,7 +534,7 @@ private function hook() { } } -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/pi1/class.tx_powermail_mandatory.php']) { +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/pi1/class.tx_powermail_mandatory.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/pi1/class.tx_powermail_mandatory.php']); } diff --git a/pi1/class.tx_powermail_pi1.php b/pi1/class.tx_powermail_pi1.php index 1f67c3c0..90d35dd1 100644 --- a/pi1/class.tx_powermail_pi1.php +++ b/pi1/class.tx_powermail_pi1.php @@ -1,28 +1,28 @@ conf = $conf; $this->content = $content; $this->pi_setPiVarDefaults(); $this->pi_loadLL(); - + // disable caching if needed if ($this->switchToUserInt()) { // if switch is done return; // stop duplicated output of powermail } - + // Instances $this->div = t3lib_div::makeInstance('tx_powermail_functions_div'); // Create new instance for div class $this->sessions = t3lib_div::makeInstance('tx_powermail_sessions'); // New object: session functions @@ -62,10 +62,10 @@ public function main($content, $conf) { $this->submit = t3lib_div::makeInstance('tx_powermail_submit'); // Create new instance for submit class $this->confirmation = t3lib_div::makeInstance('tx_powermail_confirmation'); // Create new instance for confirmation class $this->mandatory = t3lib_div::makeInstance('tx_powermail_mandatory'); // Create new instance for mandatory class - + // Security for piVars $this->piVars = $this->div->sec($this->piVars); // first of all clean piVars - + // Sessionwork $this->sessions->deleteSession($this->conf, $this->cObj, $this->piVars['clearSession']); // If GET Param clearSession is set, delete complete Session $this->sessions->setSession($this->conf, $this->piVars, $this->cObj, 0); // Set piVars to session (but don't overwrite old values) @@ -75,19 +75,19 @@ public function main($content, $conf) { if ($this->conf['debug.']['output'] == 'all' || $this->conf['debug.']['output'] == 'session') { // if debug $this->div->debug($this->sessionfields, 'Values from session'); // Debug function (Array from Session) } - + // Start main choose $this->hook_main_content_before(); // hook for content manipulation 1 - + // IF multiple and correct mailID OR IF sendNow and correct mailID OR IF only correct mailID if ($this->piVars['mailID'] == ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid'])) { // if mailID is correct // What kind of function should be shown in frontend if (!$this->piVars['multiple']) { // if multiple is not set if ($this->piVars['mailID']) { // submitted if ($this->cObj->data['tx_powermail_confirm']) { // Confirm page activated - + if (!$this->piVars['sendNow']) { // If sendNow is not set - + if (!$this->check()) { // if all needed fields in backend where filled if (!$this->mandatory->main($this->conf, $this->sessionfields, $this->cObj)) { // Mandatory check negative $this->content = $this->confirmation->main($this->conf, $this->sessionfields, $this->cObj); // Call the confirmation function. @@ -97,9 +97,9 @@ public function main($content, $conf) { } } else $this->content = $this->check(); // Error message - + } else { // sendNow is set - so call submit function - + if (!$this->check()) { // if all needed fields in backend where filled if (!$this->mandatory->main($this->conf, $this->sessionfields, $this->cObj)) { // Mandatory check negative $this->content = $this->submit->main($this->conf, $this->sessionfields, $this->cObj); // Call the submit function. @@ -109,34 +109,34 @@ public function main($content, $conf) { } } else $this->content = $this->check(); // Error message - + } - + } else { // No confirm page active, so start submit - + if (!$this->check()) { if (!$this->mandatory->main($this->conf, $this->sessionfields, $this->cObj)) { // Mandatory check negative $this->content = $this->submit->main($this->conf, $this->sessionfields, $this->cObj); // Call the submit function. } else { // Mandatory check positive $this->content = $this->mandatory->main($this->conf, $this->sessionfields, $this->cObj); // Call the mandatory function if ($this->conf['mandatory.']['messages']) $this->content .= $this->form->main($this->conf, $this->sessionfields, $this->cObj); // Show form below mandatory message - } + } } else $this->content = $this->check(); // Error message - + } } - + } else { // multiple link is set, so show form again if (!$this->check()) $this->content = $this->form->main($this->conf, $this->sessionfields, $this->cObj); // Show form else $this->content = $this->check(); // Error message } - - } elseif(empty($this->piVars['mailID'])) { // No piVars so show form + + } elseif (empty($this->piVars['mailID'])) { // No piVars so show form if (!$this->check()) $this->content = $this->form->main($this->conf, $this->sessionfields, $this->cObj); // Show form else $this->content = $this->check(); // Error message } - + $this->content = $this->div->charset($this->content, $this->conf['powermail.']['charset']); // use utf8_encode or _decode if wanted (set via constants) $this->hook_main_content_after(); // hook for content manipulation 2 @@ -150,12 +150,8 @@ public function main($content, $conf) { * @return boolean Was switched? */ private function switchToUserInt() { - //t3lib_div::devlog('piVars', 'powermail', 0, $this->piVars); - //t3lib_div::devlog('captchaCheck: ' . (($this->captchaCheck2()) ? 'found' : 'not found'), 'powermail', 0, $this->piVars); - //t3lib_div::devlog('caching: ' . $this->conf['caching'], 'powermail', 0); - if (count($this->piVars) || $this->captchaCheck2() || $this->conf['caching'] != '1') { // if any powermail GET or POST param given + if (count($this->piVars) || $this->captchaCheck2() || $this->conf['caching'] != '1') { // if any powermail GET or POST param given $this->cObj->convertToUserIntObject(); // Convert object to user_int (do not cache it) - //t3lib_div::devlog('piVars', 'powermail', 0, $this->piVars); if ($this->cObj->getUserObjectType() == 2) { // if USER return true; // stop process (avoid double output) } @@ -163,36 +159,38 @@ private function switchToUserInt() { return false; } - /** - * Function captchaCheck2 check if captcha fields are within current content - * - * @return boolean - */ - private function captchaCheck2() { - if ( // only if a supported captcha extension is loaded - t3lib_extMgm::isLoaded('captcha', 0) || - t3lib_extMgm::isLoaded('sr_freecap', 0) || - t3lib_extMgm::isLoaded('jm_recaptcha', 0) || - t3lib_extMgm::isLoaded('wt_calculating_captcha', 0) - ) { - - // Give me all captcha fields of current tt_content - $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery ( - 'tx_powermail_fields.uid', - 'tx_powermail_fields LEFT JOIN tx_powermail_fieldsets ON tx_powermail_fields.fieldset = tx_powermail_fieldsets.uid LEFT JOIN tt_content ON tx_powermail_fieldsets.tt_content = tt_content.uid', - $where_clause = 'tx_powermail_fields.formtype = "captcha" AND tx_powermail_fieldsets.tt_content = ' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']) . tslib_cObj::enableFields('tt_content') . tslib_cObj::enableFields('tx_powermail_fieldsets') . tslib_cObj::enableFields('tx_powermail_fields'), - $groupBy = '', - $orderBy = 'tx_powermail_fieldsets.sorting ASC, tx_powermail_fields.sorting ASC', - $limit = 1 - ); - if ($res) { // If there is a result - while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { // One loop for every captcha field - return true; - } - } - } - return false; - } + /** + * Function captchaCheck2 check if captcha fields are within current content + * + * @return boolean + */ + private function captchaCheck2() { + if ( // only if a supported captcha extension is loaded + t3lib_extMgm::isLoaded('captcha', 0) || + t3lib_extMgm::isLoaded('sr_freecap', 0) || + t3lib_extMgm::isLoaded('jm_recaptcha', 0) || + t3lib_extMgm::isLoaded('wt_calculating_captcha', 0) + ) { + + // Give me all captcha fields of current tt_content + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( + 'tx_powermail_fields.uid', + 'tx_powermail_fields LEFT JOIN tx_powermail_fieldsets ON tx_powermail_fields.fieldset = tx_powermail_fieldsets.uid LEFT JOIN tt_content ON tx_powermail_fieldsets.tt_content = tt_content.uid', + $where_clause = 'tx_powermail_fields.formtype = "captcha" AND tx_powermail_fieldsets.tt_content = ' . ($this->cObj->data['_LOCALIZED_UID'] > 0 + ? $this->cObj->data['_LOCALIZED_UID'] + : $this->cObj->data['uid']) . tslib_cObj::enableFields('tt_content') . tslib_cObj::enableFields('tx_powermail_fieldsets') . tslib_cObj::enableFields('tx_powermail_fields'), + $groupBy = '', + $orderBy = 'tx_powermail_fieldsets.sorting ASC, tx_powermail_fields.sorting ASC', + $limit = 1 + ); + if ($res) { // If there is a result + while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { // One loop for every captcha field + return true; + } + } + } + return false; + } /** * Check if typoscript is loaded @@ -234,11 +232,10 @@ public function hook_main_content_after() { } } } - + } -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/pi1/class.tx_powermail_pi1.php']) { +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/pi1/class.tx_powermail_pi1.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/pi1/class.tx_powermail_pi1.php']); } - ?> \ No newline at end of file diff --git a/pi1/class.tx_powermail_submit.php b/pi1/class.tx_powermail_submit.php index 0dff455b..49d15a30 100644 --- a/pi1/class.tx_powermail_submit.php +++ b/pi1/class.tx_powermail_submit.php @@ -1,26 +1,26 @@ -* All rights reserved -* -* This script is part of the TYPO3 project. The TYPO3 project is -* free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* The GNU General Public License can be found at -* http://www.gnu.org/copyleft/gpl.html. -* -* This script is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* This copyright notice MUST APPEAR in all copies of the script! -***************************************************************/ + * Copyright notice + * + * (c) 2010 powermail development team (details on http://forge.typo3.org/projects/show/extension-powermail) + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ require_once(PATH_tslib . 'class.tslib_pibase.php'); require_once(PATH_t3lib . 'class.t3lib_htmlmail.php'); @@ -31,15 +31,15 @@ class tx_powermail_submit extends tslib_pibase { - var $prefixId = 'tx_powermail_submit'; // Same as class name - var $scriptRelPath = 'pi1/class.tx_powermail_submit.php'; // Path to this script relative to the extension dir. - var $extKey = 'powermail'; // The extension key. + var $prefixId = 'tx_powermail_submit'; // Same as class name + var $scriptRelPath = 'pi1/class.tx_powermail_submit.php'; // Path to this script relative to the extension dir. + var $extKey = 'powermail'; // The extension key. var $pi_checkCHash = true; var $email_send = 1; // Enable email send function (disable for testing only) var $dbInsert = 1; // Enable db insert of every sent item (disable for testing only) var $ok = 0; // disallow sending (standard false) var $PM_SubmitBeforeMarkerHook_return; - var $useSwiftMailer = false; + var $useSwiftMailer = false; function main($conf, $sessionfields, $cObj) { $this->conf = $conf; @@ -55,25 +55,25 @@ function main($conf, $sessionfields, $cObj) { $this->dynamicMarkers = t3lib_div::makeInstance('tx_powermail_dynamicmarkers'); // New object: TYPO3 dynamicmarker function $this->markers = t3lib_div::makeInstance('tx_powermail_markers'); // New object: TYPO3 mail functions $this->confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$this->extKey]); // Get config from localconf.php - + // Configuration - $this->noReplyEmail = str_replace('###DOMAIN###', str_replace(array('www.','www1.','www2.','www3.','www4.','www5.'), '', $_SERVER['SERVER_NAME']), $this->conf['email.']['noreply']); // no reply email address from TS setup + $this->noReplyEmail = str_replace('###DOMAIN###', str_replace(array('www.', 'www1.', 'www2.', 'www3.', 'www4.', 'www5.'), '', $_SERVER['SERVER_NAME']), $this->conf['email.']['noreply']); // no reply email address from TS setup $this->sessiondata = $GLOBALS['TSFE']->fe_user->getKey('ses', $this->extKey . '_' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid'])); // Get piVars from session $this->emailSettings(); // emailSettings $this->markerArray = array(); - + // Templates $this->tmpl = array(); $this->mailcontent = array(); $this->tmpl['thx'] = $this->cObj->getSubpart(tslib_cObj::fileResource($this->conf['template.']['thxMessage']), '###POWERMAIL_THX###'); // Load HTML Template: THX (works on subpart ###POWERMAIL_THX###) $this->tmpl['all'] = $this->cObj->getSubpart(tslib_cObj::fileResource($this->conf['template.']['all']), '###POWERMAIL_ALL###'); // Load HTML Template: ALL (works on subpart ###POWERMAIL_ALL###) $this->tmpl['emails']['all'] = tslib_cObj::fileResource($this->conf['template.']['emails']); // Load HTML Template: Emails - - + + // 1. add hook for manipulation of data after E-Mails where sent $submitBeforeEmailsHookResult = $this->hook_submit_beforeEmails(); if (!$submitBeforeEmailsHookResult) { // All is ok (no spam maybe) - + $this->ok = 1; // sending allowed if ($this->cObj->cObjGetSingle($this->conf['allow.']['email2receiver'], $this->conf['allow.']['email2receiver.'])) { // main email is allowed $this->sendMail('recipient_mail'); // 2a. Email: Generate the Mail for the recipient (if allowed via TS) @@ -84,20 +84,15 @@ function main($conf, $sessionfields, $cObj) { ) { $this->sendMail('sender_mail'); // 2b. Email: Generate the Mail for the sender (if allowed via TS and sender is selected and email exists) } - /* - if ($this->cObj->cObjGetSingle($this->conf['allow.']['dblog'], $this->conf['allow.']['dblog.']) && !$this->cObj->data['tx_powermail_disableSaveToPage']) { - $this->saveMail(); // 2c. Safe values to DB (if allowed via TS) - } - */ - if ($this->confArr['disableBackendModule'] == 0 && ($this->cObj->cObjGetSingle($this->conf['allow.']['dblog'], $this->conf['allow.']['dblog.']) || intval($this->cObj->data['tx_powermail_pages']) > 0)) { - $this->saveMail(); // 2c. Safe values to DB (if db storage is set in extension setting and storage page in plugin is defined) - } - + if ($this->confArr['disableBackendModule'] == 0 && ($this->cObj->cObjGetSingle($this->conf['allow.']['dblog'], $this->conf['allow.']['dblog.']) || intval($this->cObj->data['tx_powermail_pages']) > 0)) { + $this->saveMail(); // 2c. Safe values to DB (if db storage is set in extension setting and storage page in plugin is defined) + } + } else { // Spam hook is true (maybe spam recognized) $this->markerArray = array(); // clear markerArray $this->markerArray['###POWERMAIL_THX_ERROR###'] = $submitBeforeEmailsHookResult; // Fill ###POWERMAIL_THX_MESSAGE### with error message from Hook } - + // 2. Return Message to FE if ($this->ok == 1) $this->markerArray = $this->markers->GetMarkerArray($this->conf, $this->sessionfields, $this->cObj, 'thx'); // Fill markerArray $this->hook_submit_afterEmails(); // add hook for manipulation of data after E-Mails where sent @@ -105,22 +100,22 @@ function main($conf, $sessionfields, $cObj) { $this->content = $this->dynamicMarkers->main($this->conf, $this->cObj, $this->content); // Fill dynamic locallang or typoscript markers $this->content = preg_replace('|###.*?###|i', '', $this->content); // Finally clear not filled markers $this->hook_submit_LastOne(); // add hook for manipulation thx message - + // 3. Additional db storing if wanted $this->dbImport->main($this->conf, $this->sessiondata, $this->cObj, $this->ok); - + // 4. Redirect if wanted $this->redirect(); - + // 5. Now clear the session if option is set in TS $this->clearSession(); - + // 6. Clear sessions of captcha $this->clearCaptchaSession(); - + // 7. Check html templates if (!$this->div->subpartsExists($this->tmpl)) $this->content = $this->pi_getLL('error_templateNotFound', 'Template not found, check path to your powermail templates'); - + return $this->content; // return HTML for THX Message } @@ -138,198 +133,198 @@ protected function quoteStringWithComma($string) { return $string; } - - + + /** Function sendMail() generates mail for sender and receiver - * - * @param string $subpart subpart to set - * @return void - */ + * + * @param string $subpart subpart to set + * @return void + */ function sendMail($subpart) { - // Configuration - $this->subpart = $subpart; - $this->tmpl['emails'][$this->subpart] = $this->cObj->getSubpart($this->tmpl['emails']['all'], '###POWERMAIL_' . strtoupper($this->subpart) . '###'); // Content for HTML Template - $this->markerArray = $this->markers->GetMarkerArray($this->conf, $this->sessionfields, $this->cObj, $this->subpart); // Fill markerArray - $this->mailcontent[$this->subpart] = $this->cObj->substituteMarkerArrayCached(trim($this->tmpl['emails'][$this->subpart]), $this->markerArray); // substitute markerArray for HTML content - $this->mailcontent[$this->subpart] = $this->dynamicMarkers->main($this->conf, $this->cObj, $this->mailcontent[$this->subpart]); // Fill dynamic locallang or typoscript markers - $this->mailcontent[$this->subpart] = preg_replace('|###.*?###|i', '', $this->mailcontent[$this->subpart]); // Finally clear not filled markers - $this->maildata = array(); - $this->attachments = array(); - - // Set emails and names - if ($this->subpart == 'recipient_mail') { // default settings: mail to receiver - $this->maildata['receiver'] = $this->MainReceiver; // set receiver - $this->maildata['sender'] = $this->sender; // set sender - if (t3lib_div::validEmail($this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart . '.']['sender.']['email'], $this->conf['email.'][$this->subpart . '.']['sender.']['email.']))) { // if overwrite value was set in ts - $this->maildata['sender'] = $this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart . '.']['sender.']['email'], $this->conf['email.'][$this->subpart . '.']['sender.']['email.']); // overwrite sender email - } - $this->maildata['sendername'] = $this->username; // set sendername - if (strlen($this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart . '.']['sender.']['name'], $this->conf['email.'][$this->subpart . '.']['sender.']['name.'])) > 1) { // if sendername should be overwritten by typoscript - $this->maildata['sendername'] = $this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart . '.']['sender.']['name'], $this->conf['email.'][$this->subpart . '.']['sender.']['name.']); // overwrite sender name - } - $this->maildata['subject'] = $this->subject_r; // set subject - $this->maildata['cc'] = (isset($this->CCReceiver) ? $this->CCReceiver : ''); // carbon copy (take email addresses or nothing if not available) - } elseif ($this->subpart == 'sender_mail') { // extended settings: mail to sender - $this->maildata['receiver'] = $this->sender; // set receiver - $this->maildata['sender'] = $this->MainReceiver; // set sender email address (take from ts or from first receiver) - if (t3lib_div::validEmail($this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart . '.']['sender.']['email'], $this->conf['email.'][$this->subpart . '.']['sender.']['email.']))) { // if overwrite value was set in ts - $this->maildata['sender'] = $this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart . '.']['sender.']['email'], $this->conf['email.'][$this->subpart . '.']['sender.']['email.']); // overwrite sender email - } - $this->maildata['sendername'] = $this->sendername; // set sendername - if (strlen($this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart . '.']['sender.']['name'], $this->conf['email.'][$this->subpart . '.']['sender.']['name.'])) > 1) { // if sendername should be overwritten by typoscript - $this->maildata['sendername'] = $this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart . '.']['sender.']['name'], $this->conf['email.'][$this->subpart . '.']['sender.']['name.']); // overwrite sender name - } - $this->maildata['subject'] = $this->subject_s; // set subject - $this->maildata['cc'] = ''; // no cc - } - - $this->hook_submit_changeEmail(); // Last chance to manipulate the mail via hook - $this->debug($this->subpart); // Debug output - - if ($this->email_send) { - $subject = $this->dynamicMarkers->main($this->conf, $this->cObj, $this->div->marker2value($this->maildata['subject'], $this->sessiondata)); // mail subject (with dynamicmarkers and markers2value) - $receiver = $this->maildata['receiver']; - $from = $this->maildata['sender']; - $fromName = ($this->maildata['sendername'] !== '') ? $this->quoteStringWithComma($this->maildata['sendername']) : $this->extKey; - $returnPath = $this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart . '.']['returnpath'], $this->conf['email.'][$this->subpart . '.']['returnpath.']); - $returnPath = (t3lib_div::validEmail($returnPath)) ? $returnPath : $from; // return path - $replyToEmail = $this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart . '.']['reply.']['email'], $this->conf['email.'][$this->subpart . '.']['reply.']['email.']); // set replyto email - $replyToName = $this->quoteStringWithComma($this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart . '.']['reply.']['name'], $this->conf['email.'][$this->subpart . '.']['reply.']['name.'])); // set replyto name - $this->useSwiftMailer = t3lib_div::compat_version('4.5'); - - if ($this->useSwiftMailer){ - // new TYPO3 swiftmailer code - $this->mail = t3lib_div::makeInstance('t3lib_mail_Message'); - $this->mail->setTo(array($receiver)) - ->setFrom(array($from => $fromName)) - ->setSubject($subject) - ->setReturnPath($returnPath) - ->setCharset($GLOBALS['TSFE']->metaCharset); - - if ($this->maildata['cc'] !== ''){ - $this->mail->setBcc(t3lib_div::trimExplode(',', $this->maildata['cc'])); - } - - if ($replyToEmail !== '') { - if($replyToName !== '') { - $this->mail->setReplyTo(array($replyToEmail => $replyToName)); - } else { - $this->mail->setReplyTo(array($replyToEmail)); - } - } - } else { - // old TYPO3 mail system code - $this->mail = t3lib_div::makeInstance('t3lib_htmlmail'); // New object: TYPO3 mail class - $this->mail->start(); // start htmlmail - $this->mail->recipient = $receiver; // main receiver email address - $this->mail->recipient_copy = $this->maildata['cc']; // cc field (other email addresses) - $this->mail->subject = $subject; - $this->mail->from_email = $from; // sender email address - $this->mail->from_name = $fromName; // sender email name - $this->mail->returnPath = $returnPath; - $this->mail->replyto_email = $replyToEmail; - $this->mail->replyto_name = $replyToName; - $this->mail->charset = $GLOBALS['TSFE']->metaCharset; // set current charset - $this->mail->defaultCharset = $GLOBALS['TSFE']->metaCharset; // set current charset - } - - // add attachment (from user upload) - if (isset($this->sessiondata['FILE']) && $this->conf['upload.']['attachment'] == 1) { // if there are uploaded files AND attachment to emails is activated via constants - if (is_array($this->sessiondata['FILE']) && $this->subpart == 'recipient_mail') { // only if array and mail to receiver - $path = $this->div->correctPath($this->conf['upload.']['folder']) . ((!!$this->conf['upload.']['useTitleAsUploadSubFolderName']) ? $this->cObj->data['tx_powermail_title'] . '/' : ''); - foreach ($this->sessiondata['FILE'] as $fileName) { // one loop for every file - $file = $path . $fileName; - if (is_file(t3lib_div::getFileAbsFileName($file))) { // If file exists - - // stdWrap for each file - $localCObj = t3lib_div::makeInstance('tslib_cObj'); // local cObj - $row = array ( // $row for using .field in typoscript - 'file' => $file, // whole file with path - 'filename' => $fileName, // filename - 'path' => $path // path - ); - $localCObj->start($row, 'tx_powermail_fields'); // enable .field in typoscript - $attachment = t3lib_div::getFileAbsFileName($localCObj->cObjGetSingle($this->conf['email.']['recipient_mail.']['attachment'], $this->conf['email.']['recipient_mail.']['attachment.'])); - - // add attachment - if ($this->useSwiftMailer){ - $this->mail->attach(Swift_Attachment::fromPath($attachment)); - } else { - $this->mail->addAttachment($attachment); - } - $this->attachments[] .= $attachment; - } - } - } - } - - // add attachment (from typoscript) - if ($this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart . '.']['addAttachment'], $this->conf['email.'][$this->subpart . '.']['addAttachment.'])) { // if there is an entry in the typoscript - $files = t3lib_div::trimExplode(',', $this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart . '.']['addAttachment'], $this->conf['email.'][$this->subpart . '.']['addAttachment.']), 1); // get an array with all files to add - for ($i = 0; $i < count($files); $i ++) { // one loop for every file to add - if ($this->useSwiftMailer){ - $this->mail->attach(Swift_Attachment::fromPath($files[$i])); - } else { - $this->mail->addAttachment(t3lib_div::getFileAbsFileName($files[$i])); // add attachment - } - } - } - - // add plain text part - if ($this->conf['emailformat.'][$this->subpart] != 'html') { // add plaintext only if emailformat "both" or "plain" - $plainText = $this->div->makePlain($this->mailcontent[$this->subpart]); - - if ($this->conf['emailformat.']['enableTagsInPlainTextPart'] == 1) { - $plainText = htmlspecialchars_decode($plainText); - } - - if($this->useSwiftMailer) { - $this->mail->addPart($plainText, 'text/plain'); - } else { - $this->mail->addPlain($plainText); - } - } - - // add html part - if ($this->conf['emailformat.'][$this->subpart] != 'plain') { // add html only if emailformat "both" or "html" - $html = $this->mailcontent[$this->subpart]; - if($this->useSwiftMailer) { - $this->mail->setBody($html, 'text/html'); - } else { - $this->mail->setHTML($this->mail->encodeMsg($html)); - } - } - - $this->hook_submit_changeEmail2(); // hook with last chance to manipulate email values like attachment, etc... - - // send mail - if ($this->useSwiftMailer){ - $this->mail->send(); - } else { - $this->mail->send($receiver); - } - if ($this->conf['upload.']['delete'] == 1 && count($this->attachments) > 0) { - foreach ($this->attachments as $attachment) { - t3lib_div::devlog('delete file ' . $attachment, 'powermail', 0); + // Configuration + $this->subpart = $subpart; + $this->tmpl['emails'][$this->subpart] = $this->cObj->getSubpart($this->tmpl['emails']['all'], '###POWERMAIL_' . strtoupper($this->subpart) . '###'); // Content for HTML Template + $this->markerArray = $this->markers->GetMarkerArray($this->conf, $this->sessionfields, $this->cObj, $this->subpart); // Fill markerArray + $this->mailcontent[$this->subpart] = $this->cObj->substituteMarkerArrayCached(trim($this->tmpl['emails'][$this->subpart]), $this->markerArray); // substitute markerArray for HTML content + $this->mailcontent[$this->subpart] = $this->dynamicMarkers->main($this->conf, $this->cObj, $this->mailcontent[$this->subpart]); // Fill dynamic locallang or typoscript markers + $this->mailcontent[$this->subpart] = preg_replace('|###.*?###|i', '', $this->mailcontent[$this->subpart]); // Finally clear not filled markers + $this->maildata = array(); + $this->attachments = array(); + + // Set emails and names + if ($this->subpart == 'recipient_mail') { // default settings: mail to receiver + $this->maildata['receiver'] = $this->MainReceiver; // set receiver + $this->maildata['sender'] = $this->sender; // set sender + if (t3lib_div::validEmail($this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart . '.']['sender.']['email'], $this->conf['email.'][$this->subpart . '.']['sender.']['email.']))) { // if overwrite value was set in ts + $this->maildata['sender'] = $this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart . '.']['sender.']['email'], $this->conf['email.'][$this->subpart . '.']['sender.']['email.']); // overwrite sender email + } + $this->maildata['sendername'] = $this->username; // set sendername + if (strlen($this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart . '.']['sender.']['name'], $this->conf['email.'][$this->subpart . '.']['sender.']['name.'])) > 1) { // if sendername should be overwritten by typoscript + $this->maildata['sendername'] = $this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart . '.']['sender.']['name'], $this->conf['email.'][$this->subpart . '.']['sender.']['name.']); // overwrite sender name + } + $this->maildata['subject'] = $this->subject_r; // set subject + $this->maildata['cc'] = (isset($this->CCReceiver) ? $this->CCReceiver : ''); // carbon copy (take email addresses or nothing if not available) + } elseif ($this->subpart == 'sender_mail') { // extended settings: mail to sender + $this->maildata['receiver'] = $this->sender; // set receiver + $this->maildata['sender'] = $this->MainReceiver; // set sender email address (take from ts or from first receiver) + if (t3lib_div::validEmail($this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart . '.']['sender.']['email'], $this->conf['email.'][$this->subpart . '.']['sender.']['email.']))) { // if overwrite value was set in ts + $this->maildata['sender'] = $this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart . '.']['sender.']['email'], $this->conf['email.'][$this->subpart . '.']['sender.']['email.']); // overwrite sender email + } + $this->maildata['sendername'] = $this->sendername; // set sendername + if (strlen($this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart . '.']['sender.']['name'], $this->conf['email.'][$this->subpart . '.']['sender.']['name.'])) > 1) { // if sendername should be overwritten by typoscript + $this->maildata['sendername'] = $this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart . '.']['sender.']['name'], $this->conf['email.'][$this->subpart . '.']['sender.']['name.']); // overwrite sender name + } + $this->maildata['subject'] = $this->subject_s; // set subject + $this->maildata['cc'] = ''; // no cc + } + + $this->hook_submit_changeEmail(); // Last chance to manipulate the mail via hook + $this->debug($this->subpart); // Debug output + + if ($this->email_send) { + $subject = $this->dynamicMarkers->main($this->conf, $this->cObj, $this->div->marker2value($this->maildata['subject'], $this->sessiondata)); // mail subject (with dynamicmarkers and markers2value) + $receiver = $this->maildata['receiver']; + $from = $this->maildata['sender']; + $fromName = ($this->maildata['sendername'] !== '') ? $this->quoteStringWithComma($this->maildata['sendername']) : $this->extKey; + $returnPath = $this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart . '.']['returnpath'], $this->conf['email.'][$this->subpart . '.']['returnpath.']); + $returnPath = (t3lib_div::validEmail($returnPath)) ? $returnPath : $from; // return path + $replyToEmail = $this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart . '.']['reply.']['email'], $this->conf['email.'][$this->subpart . '.']['reply.']['email.']); // set replyto email + $replyToName = $this->quoteStringWithComma($this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart . '.']['reply.']['name'], $this->conf['email.'][$this->subpart . '.']['reply.']['name.'])); // set replyto name + $this->useSwiftMailer = t3lib_div::compat_version('4.5'); + + if ($this->useSwiftMailer) { + // new TYPO3 swiftmailer code + $this->mail = t3lib_div::makeInstance('t3lib_mail_Message'); + $this->mail->setTo(array($receiver)) + ->setFrom(array($from => $fromName)) + ->setSubject($subject) + ->setReturnPath($returnPath) + ->setCharset($GLOBALS['TSFE']->metaCharset); + + if ($this->maildata['cc'] !== '') { + $this->mail->setBcc(t3lib_div::trimExplode(',', $this->maildata['cc'])); + } + + if ($replyToEmail !== '') { + if ($replyToName !== '') { + $this->mail->setReplyTo(array($replyToEmail => $replyToName)); + } else { + $this->mail->setReplyTo(array($replyToEmail)); + } + } + } else { + // old TYPO3 mail system code + $this->mail = t3lib_div::makeInstance('t3lib_htmlmail'); // New object: TYPO3 mail class + $this->mail->start(); // start htmlmail + $this->mail->recipient = $receiver; // main receiver email address + $this->mail->recipient_copy = $this->maildata['cc']; // cc field (other email addresses) + $this->mail->subject = $subject; + $this->mail->from_email = $from; // sender email address + $this->mail->from_name = $fromName; // sender email name + $this->mail->returnPath = $returnPath; + $this->mail->replyto_email = $replyToEmail; + $this->mail->replyto_name = $replyToName; + $this->mail->charset = $GLOBALS['TSFE']->metaCharset; // set current charset + $this->mail->defaultCharset = $GLOBALS['TSFE']->metaCharset; // set current charset + } + + // add attachment (from user upload) + if (isset($this->sessiondata['FILE']) && $this->conf['upload.']['attachment'] == 1) { // if there are uploaded files AND attachment to emails is activated via constants + if (is_array($this->sessiondata['FILE']) && $this->subpart == 'recipient_mail') { // only if array and mail to receiver + $path = $this->div->correctPath($this->conf['upload.']['folder']) . ((!!$this->conf['upload.']['useTitleAsUploadSubFolderName']) + ? $this->cObj->data['tx_powermail_title'] . '/' : ''); + foreach ($this->sessiondata['FILE'] as $fileName) { // one loop for every file + $file = $path . $fileName; + if (is_file(t3lib_div::getFileAbsFileName($file))) { // If file exists + + // stdWrap for each file + $localCObj = t3lib_div::makeInstance('tslib_cObj'); // local cObj + $row = array( // $row for using .field in typoscript + 'file' => $file, // whole file with path + 'filename' => $fileName, // filename + 'path' => $path // path + ); + $localCObj->start($row, 'tx_powermail_fields'); // enable .field in typoscript + $attachment = t3lib_div::getFileAbsFileName($localCObj->cObjGetSingle($this->conf['email.']['recipient_mail.']['attachment'], $this->conf['email.']['recipient_mail.']['attachment.'])); + + // add attachment + if ($this->useSwiftMailer) { + $this->mail->attach(Swift_Attachment::fromPath($attachment)); + } else { + $this->mail->addAttachment($attachment); + } + $this->attachments[] .= $attachment; + } + } + } + } + + // add attachment (from typoscript) + if ($this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart . '.']['addAttachment'], $this->conf['email.'][$this->subpart . '.']['addAttachment.'])) { // if there is an entry in the typoscript + $files = t3lib_div::trimExplode(',', $this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart . '.']['addAttachment'], $this->conf['email.'][$this->subpart . '.']['addAttachment.']), 1); // get an array with all files to add + for ($i = 0; $i < count($files); $i++) { // one loop for every file to add + if ($this->useSwiftMailer) { + $this->mail->attach(Swift_Attachment::fromPath($files[$i])); + } else { + $this->mail->addAttachment(t3lib_div::getFileAbsFileName($files[$i])); // add attachment + } + } + } + + // add plain text part + if ($this->conf['emailformat.'][$this->subpart] != 'html') { // add plaintext only if emailformat "both" or "plain" + $plainText = $this->div->makePlain($this->mailcontent[$this->subpart]); + + if ($this->conf['emailformat.']['enableTagsInPlainTextPart'] == 1) { + $plainText = htmlspecialchars_decode($plainText); + } + + if ($this->useSwiftMailer) { + $this->mail->addPart($plainText, 'text/plain'); + } else { + $this->mail->addPlain($plainText); + } + } + + // add html part + if ($this->conf['emailformat.'][$this->subpart] != 'plain') { // add html only if emailformat "both" or "html" + $html = $this->mailcontent[$this->subpart]; + if ($this->useSwiftMailer) { + $this->mail->setBody($html, 'text/html'); + } else { + $this->mail->setHTML($this->mail->encodeMsg($html)); + } + } + + $this->hook_submit_changeEmail2(); // hook with last chance to manipulate email values like attachment, etc... + + // send mail + if ($this->useSwiftMailer) { + $this->mail->send(); + } else { + $this->mail->send($receiver); + } + if ($this->conf['upload.']['delete'] == 1 && count($this->attachments) > 0) { + foreach ($this->attachments as $attachment) { unlink($attachment); // delete attachment - } - } - } + } + } + } } - - + + // Function saveMail() to save piVars and some more infos via xml to DB (tx_powermail_mails) function saveMail() { - + // Configuration //$this->save_PID = $GLOBALS['TSFE']->id; // PID where to save: Take current page - $this->save_PID = 0; + $this->save_PID = 0; if (intval($this->conf['PID.']['dblog']) > 0) $this->save_PID = $this->conf['PID.']['dblog']; // PID where to save: Get it from TS if set if (intval($this->cObj->data['tx_powermail_pages']) > 0) $this->save_PID = $this->cObj->data['tx_powermail_pages']; // PID where to save: Get it from plugin - + // DB entry for table Tabelle: tx_powermail_mails - $this->db_values = array ( + $this->db_values = array( 'pid' => intval($this->save_PID), // PID 'tstamp' => time(), // save current time 'crdate' => time(), // save current time @@ -346,50 +341,52 @@ function saveMail() { 'UserAgent' => t3lib_div::getIndpEnv('HTTP_USER_AGENT'), // save user agent 'Referer' => t3lib_div::getIndpEnv('HTTP_REFERER'), // save referer 'SP_TZ' => $_SERVER['SP_TZ'], // save sp_tz if available - 'uploadPath' => t3lib_div::dirname($this->conf['upload.']['folder']) . '/' . ((!!$this->conf['upload.']['useTitleAsUploadSubFolderName'])? $this->cObj->data['tx_powermail_title'] . '/' : '') + 'uploadPath' => t3lib_div::dirname($this->conf['upload.']['folder']) . '/' . ((!!$this->conf['upload.']['useTitleAsUploadSubFolderName']) + ? $this->cObj->data['tx_powermail_title'] . '/' : '') ); if ($this->dbInsert && intval($this->save_PID) > 0) $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_powermail_mails', $this->db_values); // DB entry $this->debug('db'); // Debug output } - - + + // Function emailSettings() defines some sender and receiver settings (name, email, etc...) function emailSettings() { // config - $emails = ''; + $emails = ''; $this->sendername = ''; - $this->sender = ($this->cObj->data['tx_powermail_sender'] && t3lib_div::validEmail($this->sessiondata[$this->cObj->data['tx_powermail_sender']]) ? $this->sessiondata[$this->cObj->data['tx_powermail_sender']] : $this->noReplyEmail); // email sender (if sender is selected and email exists) + $this->sender = ($this->cObj->data['tx_powermail_sender'] && t3lib_div::validEmail($this->sessiondata[$this->cObj->data['tx_powermail_sender']]) + ? $this->sessiondata[$this->cObj->data['tx_powermail_sender']] : $this->noReplyEmail); // email sender (if sender is selected and email exists) $this->username = $this->userName(); // name of sender (if field is selected) $this->subject_r = $this->cObj->data['tx_powermail_subject_r']; // Subject of mails (receiver) $this->subject_s = $this->cObj->data['tx_powermail_subject_s']; // Subject of mails (sender) - + // 1. Field receiver (and sendername!) if ($this->cObj->data['tx_powermail_recipient']) { // If receivers are listed in field receiver $emails = str_replace(array("\r\n", "\n\r", "\n", "\r", ";", "|"), ',', $this->cObj->data['tx_powermail_recipient']); // commaseparated list of emails $emails = $this->dynamicMarkers->main($this->conf, $this->cObj, $emails); // set dynamic markers receiver $emails = $this->div->marker2value($emails, $this->sessiondata); // make markers available in email receiver field $emailarray = t3lib_div::trimExplode(',', $emails, 1); // write every part to an array - - for ($i=0,$emails='';$isendername .= $emailarray[$i] . ' '; // if current value is no email, take it for sender name and write to $this->sendername } if ($emails) $emails = substr(trim($emails), 0, -1); // delete last , if (!empty($this->sendername)) $this->sendername = trim($this->sendername); // trim name } - - // 2. Field receiver from table + + // 2. Field receiver from table elseif ($this->cObj->data['tx_powermail_recip_id'] && $this->cObj->data['tx_powermail_recip_table']) { // If emails from table was chosen $emails = $this->cObj->data['tx_powermail_recip_id']; // commaseparated list of emails } - - // 3. Field receiver query + + // 3. Field receiver query elseif ($this->conf['email.']['recipient_mail.']['email_query.']) { // If own select query is chosen $query = $this->secQuery($this->cObj->cObjGetSingle($this->conf['email.']['recipient_mail.']['email_query'], $this->conf['email.']['recipient_mail.']['email_query.'])); // secure function of query $query = $this->div->marker2value($query, $this->sessiondata, 1); // make markers available in email query - + $res = mysql_query($query); // mysql query - + if ($res && $query) { // If there is a result while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { // One loop for every result if (is_array($row)) { // if $row is an array @@ -403,44 +400,44 @@ function emailSettings() { if ($emails) $emails = substr(trim($emails), 0, -1); // delete last , } } - + // 4. Split to main receiver and to all other receivers (aa@aa.com, bb@bb.com, cc@cc.com => 1. aa@aa.com / 2. bb@bb.com, cc@cc.com) if (isset($emails)) { // if email string is set - if (strpos($emails,',') > 1) { // if there is a , in the string (more than only one email is set) + if (strpos($emails, ',') > 1) { // if there is a , in the string (more than only one email is set) $this->MainReceiver = substr($emails, 0, strpos($emails, ',')); // aa@aa.com - $this->CCReceiver = substr($emails, trim(strpos($emails, ',') +1)); // bb@bb.com, cc@cc.com + $this->CCReceiver = substr($emails, trim(strpos($emails, ',') + 1)); // bb@bb.com, cc@cc.com } else { // only one email is set $this->MainReceiver = $emails; // set mail } } - + // 5. If Sendername is not set, take default value if (empty($this->sendername)) { // if no sendername was defined (see 1.) $this->sendername = $this->extKey; // take "powermail" as sendername } - + return false; } - - + + // Function userName() defines sendername for email to receiver function userName() { if ($this->cObj->data['tx_powermail_sendername']) { // if name of sender was defined in flexform // config $fields = t3lib_div::trimExplode(',', $this->cObj->data['tx_powermail_sendername'], 1); // get array with list of all uids (0=>uid3, 1=>uid4) $sendername = ''; - + // let's go - for ($i=0; $isessiondata[$fields[$i]]) $sendername .= $this->sessiondata[$fields[$i]].' '; // add value from current field + for ($i = 0; $i < count($fields); $i++) { // one loop for every selected field + if ($this->sessiondata[$fields[$i]]) $sendername .= $this->sessiondata[$fields[$i]] . ' '; // add value from current field } - + return trim($sendername); // return sendername - + } else return $this->extKey; // take "powermail" as sendername } - + /** * Function redirect() forward the user to a new location after submit * @@ -448,73 +445,76 @@ function userName() { */ function redirect() { if ($this->ok) { // only if spamhook is not set - + // 1. Get Target from Flexform or Typoscript $redirectPidFromFlexform = trim($this->cObj->data['tx_powermail_redirect']); if (!empty($redirectPidFromFlexform)) { $target = $redirectPidFromFlexform; // get target from flexform in Backend - + } elseif (is_array($this->conf['redirect.']) && count($this->conf['redirect.']) > 0) { $target = $this->cObj->cObjGetSingle($this->conf['redirect'], $this->conf['redirect.']); // get target from TS - + } else { $target = 0; // disable target } - - + + // 2. Create Redirection Header if ($target) { // only if there is a redirect target - - $typolink_conf = array ( - 'returnLast' => 'url', // Give me only the string - 'parameter' => $target, // target pid - 'useCacheHash' => 0, // Don't use cache - 'section' => '' // clear section value if any + + $typolink_conf = array( + 'returnLast' => 'url', // Give me only the string + 'parameter' => $target, // target pid + 'useCacheHash' => 0, // Don't use cache + 'section' => '' // clear section value if any ); $link = t3lib_div::locationHeaderUrl($this->cObj->typolink('x', $typolink_conf)); // Create target url // Set Header for redirect - header('Location: ' . $link); + header('Location: ' . $link); header('Connection: close'); - + } } } - - + + // Function debug() enables debug output function debug($subpart) { if ($subpart != 'db') { // If debug output for email if ($this->conf['debug.']['output'] == 'all' || $this->conf['debug.']['output'] == 'email') { // only if debug output activated via constants $fileArray1 = $this->sessiondata['FILE']; // file array from session (user upload) - $fileArray2 = t3lib_div::trimExplode(',', $this->cObj->cObjGetSingle($this->conf['email.'][$subpart.'.']['addAttachment'], $this->conf['email.'][$subpart.'.']['addAttachment.']), 1); // get an array with all files to add from typoscript - $fileArray = array_merge((array) $fileArray1, (array) $fileArray2); // overall fileArray - - $debugarray = array ( + $fileArray2 = t3lib_div::trimExplode(',', $this->cObj->cObjGetSingle($this->conf['email.'][$subpart . '.']['addAttachment'], $this->conf['email.'][$subpart . '.']['addAttachment.']), 1); // get an array with all files to add from typoscript + $fileArray = array_merge((array)$fileArray1, (array)$fileArray2); // overall fileArray + + $debugarray = array( 'receiver' => $this->maildata['receiver'] ? $this->maildata['receiver'] : 'SYSTEM NOTE: No receiver email address', 'cc receiver' => $this->maildata['cc'] ? $this->maildata['cc'] : 'SYSTEM NOTE: No cc addresses', 'sender' => $this->maildata['sender'] ? $this->maildata['sender'] : 'SYSTEM NOTE: No sender email address', 'sendername' => $this->maildata['sendername'] ? $this->maildata['sendername'] : 'SYSTEM NOTE: No sender name', - 'reply email' => $this->cObj->cObjGetSingle($this->conf['email.'][$subpart.'.']['reply.']['email'], $this->conf['email.'][$subpart.'.']['reply.']['email.']), - 'reply name' => $this->cObj->cObjGetSingle($this->conf['email.'][$subpart.'.']['reply.']['name'], $this->conf['email.'][$subpart.'.']['reply.']['name.']), - 'return path' => (t3lib_div::validEmail($this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart.'.']['returnpath'], $this->conf['email.'][$this->subpart.'.']['returnpath.'])) ? $this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart.'.']['returnpath'], $this->conf['email.'][$this->subpart.'.']['returnpath.']) : $this->maildata['sender']), // Return path + 'reply email' => $this->cObj->cObjGetSingle($this->conf['email.'][$subpart . '.']['reply.']['email'], $this->conf['email.'][$subpart . '.']['reply.']['email.']), + 'reply name' => $this->cObj->cObjGetSingle($this->conf['email.'][$subpart . '.']['reply.']['name'], $this->conf['email.'][$subpart . '.']['reply.']['name.']), + 'return path' => (t3lib_div::validEmail($this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart . '.']['returnpath'], $this->conf['email.'][$this->subpart . '.']['returnpath.'])) + ? $this->cObj->cObjGetSingle($this->conf['email.'][$this->subpart . '.']['returnpath'], $this->conf['email.'][$this->subpart . '.']['returnpath.']) + : $this->maildata['sender']), // Return path 'charset' => $GLOBALS['TSFE']->metaCharset ? $GLOBALS['TSFE']->metaCharset : 'SYSTEM NOTE: No charset set', 'attachment' => (count($fileArray) > 0 ? $fileArray : 'SYSTEM NOTE: No attachments'), 'subject' => $this->maildata['subject'] ? $this->maildata['subject'] : 'SYSTEM NOTE: No subject', 'mailcontent (html)' => ($this->conf['emailformat.'][$this->subpart] != 'plain' ? $this->mailcontent[$subpart] : 'SYSTEM NOTE: Disabled via typoscript'), - 'mailcontent (plaintext)' => ($this->conf['emailformat.'][$this->subpart] != 'html' ? $this->div->makePlain($this->mailcontent[$subpart]) : 'SYSTEM NOTE: Disabled via typoscript') + 'mailcontent (plaintext)' => ($this->conf['emailformat.'][$this->subpart] != 'html' ? $this->div->makePlain($this->mailcontent[$subpart]) + : 'SYSTEM NOTE: Disabled via typoscript') ); - $this->div->debug($debugarray, 'Email values ('.$subpart.')'); // Debug function (Array from Session) + $this->div->debug($debugarray, 'Email values (' . $subpart . ')'); // Debug function (Array from Session) } } else { if ($this->conf['debug.']['output'] == 'all' || $this->conf['debug.']['output'] == 'db') { // only if debug output activated via constants $this->div->debug($this->db_values, 'DB values'); // Debug function (Array from Session) } } - + } - + // Function hook_submit_changeEmail() to add a hook and change the email datas (changing subject, receiver, sender, sendername) function hook_submit_changeEmail() { @@ -525,19 +525,19 @@ function hook_submit_changeEmail() { } } } - + // Function hook_submit_changeEmail2() to add a hook and change the email datas short before sending (changing attachments, subject, receiver, sender, sendername) function hook_submit_changeEmail2() { if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_SubmitEmailHook2'])) { // Adds hook for processing foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_SubmitEmailHook2'] as $_classRef) { $_procObj = & t3lib_div::getUserObj($_classRef); - $_procObj->PM_SubmitEmailHook2($this->subpart, $this->mail, $this); // Get new marker Array from other extensions + $_procObj->PM_SubmitEmailHook2($this->subpart, $this->mail, $this); // Get new marker Array from other extensions } } } - - + + // Function hook_submit_beforeEmails() to add a hook at the end of this file to manipulate markers and content before emails where sent function hook_submit_beforeEmails() { if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_SubmitBeforeMarkerHook'])) { // Adds hook for processing of extra global markers @@ -550,7 +550,7 @@ function hook_submit_beforeEmails() { return FALSE; // Return False is default (no spam, so emails could be sent) } } - + // Function hook_submit_LastOne() to add a hook and maybe change thx message function hook_submit_LastOne() { @@ -561,30 +561,31 @@ function hook_submit_LastOne() { } } } - + // Function hook_submit_afterEmails() to add a hook at the end of this file to manipulate markers and content after emails where sent function hook_submit_afterEmails() { if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_SubmitAfterMarkerHook'])) { // Adds hook for processing of extra global markers foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_SubmitAfterMarkerHook'] as $_classRef) { $_procObj = & t3lib_div::getUserObj($_classRef); - $_procObj->PM_SubmitAfterMarkerHook($this,$this->markerArray,$this->sessiondata); // Get new marker Array from other extensions + $_procObj->PM_SubmitAfterMarkerHook($this, $this->markerArray, $this->sessiondata); // Get new marker Array from other extensions } } } - - + + // Function to clear the Session after submitting the form. Will only be cleared when option is selected in Constant-Editor oder set by TS function clearSession() { if ($this->ok) { // only if spamhook is not set if ($this->conf['clear.']['session'] == 1) { // If set in constants // setup - $GLOBALS['TSFE']->fe_user->setKey('ses', $this->extKey.'_'.($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']), array()); // Generate Session without ERRORS + $GLOBALS['TSFE']->fe_user->setKey('ses', $this->extKey . '_' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] + : $this->cObj->data['uid']), array()); // Generate Session without ERRORS $GLOBALS['TSFE']->storeSessionData(); // Save session*/ } } } - - + + // Function clearCaptchaSession() clears already filled captcha sessions from captcha or sr_freecap function clearCaptchaSession() { if (t3lib_extMgm::isLoaded('sr_freecap', 0) || t3lib_extMgm::isLoaded('captcha', 0)) { // if captcha or freecap is loaded @@ -596,14 +597,16 @@ function clearCaptchaSession() { if (t3lib_extMgm::isLoaded('wt_calculating_captcha', 0)) { // if wt_calculating_captcha is loaded unset($GLOBALS['TSFE']->fe_user->sesData['wt_calculating_captcha_value']); // delete value in session of wt_calculating_captcha } - unset($GLOBALS['TSFE']->fe_user->sesData['powermail_'.($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid'])]['OK']); // clear all OK from Session (used e.g. from recaptcha) + unset($GLOBALS['TSFE']->fe_user->sesData['powermail_' . ($this->cObj->data['_LOCALIZED_UID'] > 0 ? $this->cObj->data['_LOCALIZED_UID'] + : $this->cObj->data['uid'])]['OK']); // clear all OK from Session (used e.g. from recaptcha) } - - + + // Function secQuery() disables query functions like UPDATE, TRUNCATE, DELETE, and so on function secQuery($string) { - $error = 0; $failure = ''; // init - $notAllowed = array ( // list of all not allowed strings for querycheck + $error = 0; + $failure = ''; // init + $notAllowed = array( // list of all not allowed strings for querycheck 'UPDATE', 'TRUNCATE', 'DELETE ', // deleted with space at the end (to allow "... where deleted = 0") @@ -623,30 +626,30 @@ function secQuery($string) { 'REVOKE', 'GRANT' ); - + if (is_array($notAllowed)) { // only if array foreach ($notAllowed as $key => $value) { // one loop for every not allowed string if (strpos(strtolower($string), strtolower($value)) !== false) { // search for (e.g.) "delete" in string if (1) { $error = 1; // set error if found - $failure .= '"'.$value.'", '; // Save error string + $failure .= '"' . $value . '", '; // Save error string } } } } if ($failure) $failure = substr(trim($failure), 0, -1); // delete last , - + if ($error === 0) return $string; // return query if no error else { // if error - echo 'Not allowed string ('.$failure.') in receiver sql query!'; // print error message + echo 'Not allowed string (' . $failure . ') in receiver sql query!'; // print error message return false; // no return } } } -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/pi1/class.tx_powermail_submit.php']) { +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/pi1/class.tx_powermail_submit.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/pi1/class.tx_powermail_submit.php']); } -?> +?> \ No newline at end of file diff --git a/pi1/locallang.xml b/pi1/locallang.xml index 6fe241df..3dcb40dc 100644 --- a/pi1/locallang.xml +++ b/pi1/locallang.xml @@ -36,6 +36,9 @@ + + + diff --git a/res/css/powermail_frontend_basic.css b/res/css/powermail_frontend_basic.css index 6827873d..3c273048 100644 --- a/res/css/powermail_frontend_basic.css +++ b/res/css/powermail_frontend_basic.css @@ -1,57 +1,50 @@ -fieldset.tx-powermail-pi1_fieldset{padding:10px;margin-bottom:10px;clear:both;border:1px solid #cccccc;background-color:#f0f0f0;}fieldset.tx-powermail-pi1_fieldset legend{font-weight:bold;color:#000000;} -fieldset.tx-powermail-pi1_fieldset label,fieldset.tx-powermail-pi1_fieldset fieldset legend{display:block;width:200px;float:left;font-weight:bold;color:#515151;white-space:normal;} -fieldset.tx-powermail-pi1_fieldset fieldset{border:0 none;padding:0;margin:0;position:relative;} -fieldset.tx-powermail-pi1_fieldset fieldset legend{position:absolute;left:0;padding:0;margin:0;} -fieldset.tx-powermail-pi1_fieldset input{margin-left:0;} -fieldset.tx-powermail-pi1_fieldset input.powermail_text,fieldset.tx-powermail-pi1_fieldset input.powermail_date,fieldset.tx-powermail-pi1_fieldset input.powermail_datetime,fieldset.tx-powermail-pi1_fieldset input.powermail_time,fieldset.tx-powermail-pi1_fieldset textarea.powermail_textarea,fieldset.tx-powermail-pi1_fieldset input.powermail_captcha{border:1px solid #cccccc;background:#f8f8f8 none;padding:2px;width:400px;-moz-box-shadow:0 0 5px #eee inset;-webkit-box-shadow:0 0 5px #eee inset;box-shadow:0 0 5px #eee inset;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;} -fieldset.tx-powermail-pi1_fieldset input.powermail_datetime.date{width:330px;} -fieldset.tx-powermail-pi1_fieldset input.powermail_time,fieldset.tx-powermail-pi1_fieldset input[type=time]{width:60px;margin-left:8px;} -fieldset.tx-powermail-pi1_fieldset textarea:focus,fieldset.tx-powermail-pi1_fieldset input:not([type="submit"]):focus{background:#ffffff none;border:1px solid #333333;-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none;} -fieldset.tx-powermail-pi1_fieldset input.powermail_radio{margin:3px 0;} -fieldset.tx-powermail-pi1_fieldset .powermail_check_inner,fieldset.tx-powermail-pi1_fieldset .powermail_radio_inner{margin-left:200px;clear:both;} -fieldset.tx-powermail-pi1_fieldset .powermail_check_inner label,fieldset.tx-powermail-pi1_fieldset .powermail_radio_inner label{float:none;width:auto;display:inline;font-weight:normal;margin-left:7px;} -fieldset.tx-powermail-pi1_fieldset .powermail_check_inner input,fieldset.tx-powermail-pi1_fieldset .powermail_radio_inner input{float:left;position:relative;clear:left;} -fieldset.tx-powermail-pi1_fieldset input.powermail_text.range{float:left;margin:0 0 0 15px;padding:3px 0;text-align:center;width:50px;} -fieldset.tx-powermail-pi1_fieldset input.powermail_submit{margin:20px 0 10px 200px;font-weight:bold;} -fieldset.tx-powermail-pi1_fieldset div.countryzone{margin:10px 0 0 200px;} -fieldset.tx-powermail-pi1_fieldset div.tx_powermail_pi1_fieldwrap_html{margin-bottom:1em;clear:both;} -fieldset.tx-powermail-pi1_fieldset label a,fieldset.tx-powermail-pi1_fieldset fieldset legend.tx_powermail_pi1_fieldwrap_html_checkbox_title a,fieldset.tx-powermail-pi1_fieldset fieldset legend.tx_powermail_pi1_fieldwrap_html_radio_title a{cursor:help;text-decoration:none;} -fieldset.tx-powermail-pi1_fieldset label a dfn,fieldset.tx-powermail-pi1_fieldset legend.tx_powermail_pi1_fieldwrap_html_checkbox_title a dfn,fieldset.tx-powermail-pi1_fieldset legend.tx_powermail_pi1_fieldwrap_html_radio_title a dfn{display:none;text-decoration:none;position:absolute;z-index:1;width:auto;padding:3px 10px 5px 10px;background-color:#00559e;border:1px solid #00559e;font-size:11px;color:#fff;white-space:normal;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;-moz-box-shadow:0 0 10px rgba(0, 0, 0, 0.5);-webkit-box-shadow:0 0 10px rgba(0, 0, 0, 0.5);box-shadow:0 0 10px rgba(0, 0, 0, 0.5);} -fieldset.tx-powermail-pi1_fieldset label a:hover dfn,fieldset.tx-powermail-pi1_fieldset legend.tx_powermail_pi1_fieldwrap_html_checkbox_title a:hover dfn,fieldset.tx-powermail-pi1_fieldset legend.tx_powermail_pi1_fieldwrap_html_radio_title a:hover dfn{display:block;} -fieldset.tx-powermail-pi1_fieldset img.icon_info{padding:2px 2px 0 2px;} +.tx-powermail-pi1_fieldset{padding:10px;margin-bottom:10px;clear:both;border:1px solid #cccccc;background-color:#f0f0f0;}.tx-powermail-pi1_fieldset legend{font-weight:bold;color:#000000;} +.tx-powermail-pi1_fieldset label,.tx-powermail-pi1_fieldset fieldset legend{display:block;width:200px;float:left;font-weight:bold;color:#515151;white-space:normal;} +.tx-powermail-pi1_fieldset fieldset{border:0 none;padding:0;margin:0;position:relative;}.tx-powermail-pi1_fieldset fieldset legend{position:absolute;left:0;padding:0;margin:0;} +.tx-powermail-pi1_fieldset input,.tx-powermail-pi1_fieldset select,.tx-powermail-pi1_fieldset textarea{margin-left:0;} +.tx-powermail-pi1_fieldset .powermail_text,.tx-powermail-pi1_fieldset .powermail_date,.tx-powermail-pi1_fieldset .powermail_datetime,.tx-powermail-pi1_fieldset .powermail_time,.tx-powermail-pi1_fieldset .powermail_textarea,.tx-powermail-pi1_fieldset .powermail_captcha{border:1px solid #cccccc;background:#f8f8f8 none;padding:2px;width:400px;-moz-box-shadow:inset 0 0 2px rgba(0, 0, 0, 0.1);-webkit-box-shadow:inset 0 0 2px rgba(0, 0, 0, 0.1);box-shadow:inset 0 0 2px rgba(0, 0, 0, 0.1);border-radius:0px;-webkit-border-radius:0px;-moz-border-radius:0px;} +.tx-powermail-pi1_fieldset .powermail_datetime.date{width:330px;} +.tx-powermail-pi1_fieldset .powermail_time,.tx-powermail-pi1_fieldset input[type=time]{width:60px;margin-left:6px;} +.tx-powermail-pi1_fieldset textarea:focus,.tx-powermail-pi1_fieldset input:not([type="submit"]):focus{background:#ffffff none;border:1px solid #333333;-moz-box-shadow:inset 0 0 0 rgba(0, 0, 0, 0);-webkit-box-shadow:inset 0 0 0 rgba(0, 0, 0, 0);box-shadow:inset 0 0 0 rgba(0, 0, 0, 0);} +.tx-powermail-pi1_fieldset .powermail_radio{margin:3px 0;} +.tx-powermail-pi1_fieldset .powermail_check_inner,.tx-powermail-pi1_fieldset .powermail_radio_inner{margin-left:200px;clear:both;}.tx-powermail-pi1_fieldset .powermail_check_inner label,.tx-powermail-pi1_fieldset .powermail_radio_inner label{float:none;width:auto;display:inline;font-weight:normal;margin-left:7px;} +.tx-powermail-pi1_fieldset .powermail_check_inner input,.tx-powermail-pi1_fieldset .powermail_radio_inner input{float:left;position:relative;clear:left;} +.tx-powermail-pi1_fieldset .powermail_text.range{float:left;margin:0 0 0 15px;padding:3px 0;text-align:center;width:50px;} +.tx-powermail-pi1_fieldset .powermail_submit{margin:20px 0 10px 200px;font-weight:bold;} +.tx-powermail-pi1_fieldset .countryzone{margin:10px 0 0 200px;} +.tx-powermail-pi1_fieldset .tx_powermail_pi1_fieldwrap_html{margin-bottom:1em;clear:both;} +.tx-powermail-pi1_fieldset label a,.tx-powermail-pi1_fieldset fieldset legend.tx_powermail_pi1_fieldwrap_html_checkbox_title a,.tx-powermail-pi1_fieldset fieldset legend.tx_powermail_pi1_fieldwrap_html_radio_title a{cursor:help;text-decoration:none;}.tx-powermail-pi1_fieldset label a dfn,.tx-powermail-pi1_fieldset fieldset legend.tx_powermail_pi1_fieldwrap_html_checkbox_title a dfn,.tx-powermail-pi1_fieldset fieldset legend.tx_powermail_pi1_fieldwrap_html_radio_title a dfn{display:none;text-decoration:none;position:absolute;z-index:1;width:auto;padding:3px 10px 5px 10px;background-color:#00559e;border:1px solid #00559e;font-size:11px;color:#fff;white-space:normal;border-radius:0px;-webkit-border-radius:0px;-moz-border-radius:0px;-moz-box-shadow:0 0 10px rgba(0, 0, 0, 0.5);-webkit-box-shadow:0 0 10px rgba(0, 0, 0, 0.5);box-shadow:0 0 10px rgba(0, 0, 0, 0.5);} +.tx-powermail-pi1_fieldset label a:hover dfn,.tx-powermail-pi1_fieldset fieldset legend.tx_powermail_pi1_fieldwrap_html_checkbox_title a:hover dfn,.tx-powermail-pi1_fieldset fieldset legend.tx_powermail_pi1_fieldwrap_html_radio_title a:hover dfn{display:block;} +.tx-powermail-pi1_fieldset img.icon_info{padding:2px 2px 0 2px;} .powermail_mandatory{color:#ff0000;} .placeholder{color:#999999;} .powermail_mandatory_helper{position:absolute;visibility:hidden;height:1px;} .wtcalculatingcaptcha{margin-left:200px;} -.error{background-color:#ff0000;border:1px solid #ff0000;font-size:11px;color:#ffffff;padding:3px 10px 5px 10px;margin-left:-2px;z-index:10;text-align:left;height:auto;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;-moz-box-shadow:0 0 10px rgba(0, 0, 0, 0.5);-webkit-box-shadow:0 0 10px rgba(0, 0, 0, 0.5);box-shadow:0 0 10px rgba(0, 0, 0, 0.5);}.error p{margin:0;padding:0;font-weight:bold;} +.error{background-color:#ff0000;border:1px solid #ff0000;font-size:11px;color:#ffffff;padding:3px 10px 5px 10px;margin-left:-2px;z-index:10;text-align:left;height:auto;border-radius:0px;-webkit-border-radius:0px;-moz-border-radius:0px;-moz-box-shadow:0 0 10px rgba(0, 0, 0, 0.5);-webkit-box-shadow:0 0 10px rgba(0, 0, 0, 0.5);box-shadow:0 0 10px rgba(0, 0, 0, 0.5);}.error p{margin:0;padding:0;font-weight:bold;} html:root .error em{display:block;width:0;height:0;border:10px solid;border-color:#ff0000 transparent transparent;position:absolute;bottom:-10px;left:5px;border-bottom:0 none;} -#calroot{z-index:10000;margin-top:-1px;width:198px;padding:2px;background-color:#fff;font-size:11px;border:1px solid #ccc;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;-moz-box-shadow:0 0 10px rgba(0, 0, 0, 0.5);-webkit-box-shadow:0 0 10px rgba(0, 0, 0, 0.5);box-shadow:0 0 10px rgba(0, 0, 0, 0.5);} +#calroot{z-index:10000;margin-top:-1px;width:198px;padding:2px;background-color:#fff;font-size:11px;border:1px solid #ccc;border-radius:0px;-webkit-border-radius:0px;-moz-border-radius:0px;-moz-box-shadow:0 0 10px rgba(0, 0, 0, 0.5);-webkit-box-shadow:0 0 10px rgba(0, 0, 0, 0.5);box-shadow:0 0 10px rgba(0, 0, 0, 0.5);} #calhead{padding:2px 0;height:22px;} #caltitle{font-size:14px;color:#fa8800;float:left;text-align:center;width:155px;line-height:20px;text-shadow:0 1px 0 #ddd;} -#calnext,#calprev{display:block;width:20px;height:20px;background:transparent url('../img/prev.gif') no-repeat scroll center center;float:left;cursor:pointer;} -#calnext{background-image:url('../img/next.gif');float:right;} +#calnext,#calprev{display:block;width:20px;height:20px;background:transparent url("../img/prev.gif") no-repeat scroll center center;float:left;cursor:pointer;} +#calnext{background-image:url("../img/next.gif");float:right;} #calprev.caldisabled,#calnext.caldisabled{visibility:hidden;} #caltitle select{font-size:10px;} -#caldays{height:18px;border-bottom:1px solid #ddd;} -#caldays span{display:block;float:left;width:28px;text-align:center;} +#caldays{height:18px;border-bottom:1px solid #ddd;}#caldays span{display:block;float:left;width:28px;text-align:center;} #calweeks{background-color:#fff;margin-top:4px;} -.calweek{clear:left;height:22px;} -.calweek a{display:block;float:left;width:27px;height:20px;text-decoration:none;font-size:11px;margin-left:1px;text-align:center;line-height:20px;color:#666666;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;} +.calweek{clear:left;height:22px;}.calweek a{display:block;float:left;width:27px;height:20px;text-decoration:none;font-size:11px;margin-left:1px;text-align:center;line-height:20px;color:#666666;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;} .calweek a:hover,.calfocus{background-color:#ddd;} a.calsun{color:#ff0000;} -a.caloff{color:#ccc;} -a.caloff:hover{background-color:#f5f5fa;} +a.caloff{color:#ccc;}a.caloff:hover{background-color:#f5f5fa;} a.caldisabled{background-color:#efefef !important;color:#ccc !important;cursor:default;} #calcurrent{background-color:#498ce2;color:#ffffff;} #caltoday{background-color:#333333;color:#ffffff;} -a.caltrigger{position:relative;display:inline-block;margin-left:-18px;margin-top:3px;vertical-align:top;background:url('../img/calendar.png') no-repeat 0 0;width:16px;height:16px;} -.slider{background:#3c72e6 url('../img/h30.png') repeat-x 0 0;height:9px;position:relative;cursor:pointer;border:1px solid #333;width:400px;float:left;clear:right;margin-top:10px;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;-moz-box-shadow:inset 0 0 8px #000;-webkit-box-shadow:inset 0 0 8px #000;box-shadow:inset 0 0 8px #000;} +a.caltrigger{position:relative;display:inline-block;margin-left:-18px;margin-top:3px;vertical-align:top;background:url("../img/calendar.png") no-repeat 0 0;width:16px;height:16px;} +.slider{background:#3c72e6 url("../img/h30.png") repeat-x 0 0;height:9px;position:relative;cursor:pointer;border:1px solid #333;width:400px;float:left;clear:right;margin-top:10px;border-radius:0px;-webkit-border-radius:0px;-moz-border-radius:0px;-moz-box-shadow:inset 0 0 8px #000000;-webkit-box-shadow:inset 0 0 8px #000000;box-shadow:inset 0 0 8px #000000;} .progress{height:9px;background-color:#c5ff00;display:none;opacity:0.6;} -.handle{background:#ffffff url('../img/h30.png') repeat-x 0 0;height:28px;width:28px;top:-12px;position:absolute;display:block;margin-top:1px;border:1px solid #000;cursor:move;-moz-box-shadow:0 0 6px #000;-webkit-box-shadow:0 0 6px #000;box-shadow:0 0 6px #000;-moz-border-radius:14px;-webkit-border-radius:14px;border-radius:14px;} -div.powermail_multiple_js fieldset.tx-powermail-pi1_fieldset legend,div.powermail_multiple_js fieldset.tx-powermail-pi1_fieldset.ui-tabs-hide{display:none;} -div.powermail_multiple_js fieldset.tx-powermail-pi1_fieldset{padding-top:15px;-moz-box-shadow:0 0 0 rgba(0, 0, 0, 0.2);-webkit-box-shadow:0 0 0 rgba(0, 0, 0, 0.2);box-shadow:0 0 0 rgba(0, 0, 0, 0.2);}div.powermail_multiple_js fieldset.tx-powermail-pi1_fieldset fieldset legend{display:block;} -ul.powermail_multiplejs_tabs{list-style-type:none;padding:0;margin:0;}ul.powermail_multiplejs_tabs li{float:left;margin:0 1px 0 0;padding:0;list-style-type:none;}ul.powermail_multiplejs_tabs li a{display:block;padding:5px 10px;color:#666666;font-weight:bold;text-decoration:none;background:#e0e0e0;-webkit-border-top-left-radius:2px;-webkit-border-top-right-radius:2px;-moz-border-radius-topleft:2px;-moz-border-radius-topright:2px;border-top-left-radius:2px;border-top-right-radius:2px;border-top:1px solid #cccccc;border-left:1px solid #cccccc;border-right:1px solid #cccccc;outline:none;} -ul.powermail_multiplejs_tabs li a.act{background:#f0f0f0;color:#333333;padding:5px 10px 6px 10px;position:relative;margin-bottom:-1px;-moz-box-shadow:0 0 0 rgba(0, 0, 0, 0.2);-webkit-box-shadow:0 0 0 rgba(0, 0, 0, 0.2);box-shadow:0 0 0 rgba(0, 0, 0, 0.2);} +.handle{background:#ffffff url("../img/h30.png") repeat-x 0 0;height:28px;width:28px;top:-12px;position:absolute;display:block;margin-top:1px;border:1px solid #000;cursor:move;-moz-box-shadow:0 0 6px #000000;-webkit-box-shadow:0 0 6px #000000;box-shadow:0 0 6px #000000;border-radius:14px;-webkit-border-radius:14px;-moz-border-radius:14px;} +div.powermail_multiple_js fieldset.tx-powermail-pi1_fieldset{padding-top:15px;-moz-box-shadow:0 0 0 rgba(0, 0, 0, 0.5);-webkit-box-shadow:0 0 0 rgba(0, 0, 0, 0.5);box-shadow:0 0 0 rgba(0, 0, 0, 0.5);}div.powermail_multiple_js fieldset.tx-powermail-pi1_fieldset legend,div.powermail_multiple_js fieldset.tx-powermail-pi1_fieldset.ui-tabs-hide{display:none;} +div.powermail_multiple_js fieldset.tx-powermail-pi1_fieldset fieldset legend{display:block;} +ul.powermail_multiplejs_tabs{list-style-type:none;padding:0;margin:0;}ul.powermail_multiplejs_tabs li{float:left;margin:0 1px 0 0;padding:0;list-style-type:none;}ul.powermail_multiplejs_tabs li a{display:block;padding:5px 10px;color:#666666;font-weight:bold;text-decoration:none;background:#e0e0e0;-webkit-border-top-left-radius:2px;-webkit-border-top-right-radius:2px;-moz-border-radius-topleft:2px;-moz-border-radius-topright:2px;border-top-left-radius:2px;border-top-right-radius:2px;border-top:1px solid #cccccc;border-left:1px solid #cccccc;border-right:1px solid #cccccc;outline:none;}ul.powermail_multiplejs_tabs li a.act{background:#f0f0f0;color:#333333;padding:5px 10px 6px 10px;position:relative;margin-bottom:-1px;-moz-box-shadow:0 0 0 rgba(0, 0, 0, 0.5);-webkit-box-shadow:0 0 0 rgba(0, 0, 0, 0.5);box-shadow:0 0 0 rgba(0, 0, 0, 0.5);} input.tx_powermail_pi1_submitmultiple_forward,input.tx_powermail_pi1_submitmultiple_back{margin-top:1em;} input.tx_powermail_pi1_submitmultiple_forward{float:right;} .powermail_multiple_php form>div.tx_powermail_pi1_fieldwrap_html_submit{display:inline;float:right;clear:none;margin-top:1em;} diff --git a/res/less/powermail_frontend_basic.less b/res/less/powermail_frontend_basic.less index 5d5c5c9b..1463cebf 100644 --- a/res/less/powermail_frontend_basic.less +++ b/res/less/powermail_frontend_basic.less @@ -5,6 +5,7 @@ /* More info about less.app: http://incident57.com/less/ */ /**********************************************************/ +/* Dimensions definitions start */ @labelWidth: 200px; @fieldWidth: 400px; @timeFieldWidth: 60px; @@ -13,20 +14,9 @@ @calTriggerIconWidth: 16px; @calTriggerIconHeight: 16px; @errorArrowSize: 10px; +/* Dimensions definitions end */ -@borderRadius: 5px; -@inputBorderRadius: @borderRadius; -@errorBorderRadius: @borderRadius; -@descriptionBorderRadius: @borderRadius; -@calBorderRadius: @borderRadius; -@sliderBorderRadius: @borderRadius; - -@shadowWidth: 10px; -@descriptionShadowWidth: @shadowWidth; -@errorShadowWidth: @shadowWidth; -@calShadowWidth: @shadowWidth; -@fieldsetShadowWidth: 0; - +/* Colors definitions start */ @fieldsetBackgroundColor: #f0f0f0; @multipleTabBackgroundColor: #e0e0e0; @multipleTabActiveBackgroundColor: @fieldsetBackgroundColor; @@ -36,11 +26,6 @@ @mandatoryColor: #f00; @errorColor: #fff; @errorBackgroundColor: @mandatoryColor; -@shadowColor: rgba(0,0,0,0.5); -@fieldsetShadowColor: rgba(0,0,0,0.2); -@errorShadowColor: @shadowColor; -@calShadowColor: @shadowColor; -@descriptionShadowColor: @shadowColor; @placeHolderColor: #999; @legendColor: #000; @labelColor: #515151; @@ -57,14 +42,60 @@ @calCurrentDayColor: #fff; @calTodayBackgroundColor: #333; @calTodayColor: #fff; +/* Colors definitions end */ + +/* Imagepath definitions start */ +@imagePath: '../img/'; +@calPrevIcon: %('%sprev.gif', @imagePath); +@calNextIcon: %('%snext.gif', @imagePath); +@calTriggerIcon: %('%scalendar.png', @imagePath); +@calH30: %('%sh30.png', @imagePath); +/* Imagepath definitions end */ + +/* CSS3 var definitions start */ +@borderRadius: 0px; +@inputBorderRadius: @borderRadius; +@errorBorderRadius: @borderRadius; +@descriptionBorderRadius: @borderRadius; +@calBorderRadius: @borderRadius; +@sliderBorderRadius: @borderRadius; -@calPrevIcon: '../img/prev.gif'; -@calNextIcon: '../img/next.gif'; -@calTriggerIcon: '../img/calendar.png'; -@calH30: '../img/h30.png'; +@shadowWidth: 10px; +@fieldsetShadowWidth: 0; +@descriptionShadowWidth: @shadowWidth; +@errorShadowWidth: @shadowWidth; +@calShadowWidth: @shadowWidth; + +@shadowStrength: 0.5; +@fieldsetShadowStrength: @shadowStrength; +@descriptionShadowStrength: @shadowStrength; +@errorShadowStrength: @shadowStrength; +@calShadowStrength: @shadowStrength; +/* CSS3 var definitions end */ + +/* Mixins definitions start */ +.rounded-corners (@radius: 5px) { + border-radius: @radius; + -webkit-border-radius: @radius; + -moz-border-radius: @radius; +} + +.box-shadow (@x: 0, @y: 0, @shadowWidth: 10px, @shadowStrength: 0.5) { + -moz-box-shadow:@x @y @shadowWidth rgba(0,0,0,@shadowStrength); + -webkit-box-shadow:@x @y @shadowWidth rgba(0,0,0,@shadowStrength); + box-shadow:@x @y @shadowWidth rgba(0,0,0,@shadowStrength); +} + +.box-shadow-inset (@x: 0, @y: 0, @shadowWidth: 10px, @shadowStrength: 0.5) { + -moz-box-shadow:inset @x @y @shadowWidth rgba(0,0,0,@shadowStrength); + -webkit-box-shadow:inset @x @y @shadowWidth rgba(0,0,0,@shadowStrength); + box-shadow:inset @x @y @shadowWidth rgba(0,0,0,@shadowStrength); +} +/* Mixins definitions end */ -fieldset.tx-powermail-pi1_fieldset { +/* Main CSS definitions start */ +.tx-powermail-pi1_fieldset { /* Fieldset */ padding: 10px; margin-bottom:10px; @@ -72,7 +103,6 @@ fieldset.tx-powermail-pi1_fieldset { border: 1px solid @fieldsetBorderColor; background-color: @fieldsetBackgroundColor; legend { - /* legend of Fieldset */ font-weight: bold; color: @legendColor; } @@ -92,53 +122,45 @@ fieldset.tx-powermail-pi1_fieldset { padding: 0; margin: 0; position: relative; + /* use legend as label for radio and checkboxes */ + legend { + position: absolute; + left: 0; + padding: 0; + margin: 0; + } } - /* radio and checkboxes use legend as label */ - fieldset legend { - position: absolute; - left: 0; - padding: 0; - margin: 0; - } - input { + input,select,textarea { margin-left:0; } - input.powermail_text, - input.powermail_date, - input.powermail_datetime, - input.powermail_time, - textarea.powermail_textarea, - input.powermail_captcha { - /* Input and textarea */ + .powermail_text, + .powermail_date, + .powermail_datetime, + .powermail_time, + .powermail_textarea, + .powermail_captcha { border:1px solid @inputBorderColor; background:@inputBackgroundColor none; padding:@inputPadding; width:@fieldWidth; - /* CSS3 spicing for mozilla and webkit */ - -moz-box-shadow:0 0 5px #eee inset; - -webkit-box-shadow:0 0 5px #eee inset; - box-shadow:0 0 5px #eee inset; - -moz-border-radius:@inputBorderRadius; - -webkit-border-radius:@inputBorderRadius; - border-radius:@inputBorderRadius; + .box-shadow-inset(0, 0, 2px, 0.1); + .rounded-corners(@inputBorderRadius); } - input.powermail_datetime.date { + .powermail_datetime.date { width: (@fieldWidth - @timeFieldWidth - 10); } - input.powermail_time, + .powermail_time, input[type=time] { width:@timeFieldWidth; - margin-left:8px; + margin-left:6px; } textarea:focus, input:not([type="submit"]):focus { background:@inputFocusBackgroundColor none; border:1px solid @inputFocusBorderColor; - -moz-box-shadow:none; - -webkit-box-shadow:none; - box-shadow:none; + .box-shadow-inset(0, 0, 0, 0); } - input.powermail_radio { + .powermail_radio { /* Radiobuttons */ margin: 3px 0; } @@ -146,37 +168,35 @@ fieldset.tx-powermail-pi1_fieldset { .powermail_radio_inner { margin-left: @labelWidth; clear: both; + label { + float: none; + width: auto; + display: inline; + font-weight: normal; + margin-left: 7px; + } + input { + float: left; + position: relative; + clear: left; + } } - .powermail_check_inner label, - .powermail_radio_inner label { - float: none; - width: auto; - display: inline; - font-weight: normal; - margin-left: 7px; - } - .powermail_check_inner input, - .powermail_radio_inner input { - float: left; - position: relative; - clear: left; - } - input.powermail_text.range { + .powermail_text.range { float:left; margin:0 0 0 15px; padding:3px 0; text-align:center; width:50px; } - input.powermail_submit { + .powermail_submit { /* submit button */ margin: 20px 0 10px @labelWidth; font-weight: bold; } - div.countryzone { + .countryzone { margin: 10px 0 0 @labelWidth; } - div.tx_powermail_pi1_fieldwrap_html { + .tx_powermail_pi1_fieldwrap_html { /* DIV container around every field */ margin-bottom: @fieldMarginBottom; clear:both; @@ -187,35 +207,26 @@ fieldset.tx-powermail-pi1_fieldset { /* Description */ cursor: help; text-decoration: none; - } - label a dfn, - legend.tx_powermail_pi1_fieldwrap_html_checkbox_title a dfn, - legend.tx_powermail_pi1_fieldwrap_html_radio_title a dfn{ - /* Description */ - display: none; - text-decoration: none; - position:absolute; - z-index:1; - width: auto; - padding:3px 10px 5px 10px; - background-color:@descriptionBackgroundColor; - border:1px solid @descriptionBackgroundColor; - font-size:11px; - color:#fff; - white-space: normal; - /* CSS3 spicing for mozilla and webkit */ - -moz-border-radius:@descriptionBorderRadius; - -webkit-border-radius:@descriptionBorderRadius; - border-radius:@descriptionBorderRadius; - -moz-box-shadow:0 0 @descriptionShadowWidth @descriptionShadowColor; - -webkit-box-shadow:0 0 @descriptionShadowWidth @descriptionShadowColor; - box-shadow:0 0 @descriptionShadowWidth @descriptionShadowColor; - } - label a:hover dfn, - legend.tx_powermail_pi1_fieldwrap_html_checkbox_title a:hover dfn, - legend.tx_powermail_pi1_fieldwrap_html_radio_title a:hover dfn{ - /* Description on mouseover */ - display: block; + dfn { + /* Description */ + display: none; + text-decoration: none; + position:absolute; + z-index:1; + width: auto; + padding:3px 10px 5px 10px; + background-color:@descriptionBackgroundColor; + border:1px solid @descriptionBackgroundColor; + font-size:11px; + color:#fff; + white-space: normal; + .rounded-corners(@descriptionBorderRadius); + .box-shadow(0, 0, @descriptionShadowWidth, @descriptionShadowStrength); + } + &:hover dfn { + /* Description on mouseover */ + display: block; + } } img.icon_info { /* Description icon */ @@ -258,14 +269,8 @@ fieldset.tx-powermail-pi1_fieldset { padding: 0; font-weight: bold; } - - /* CSS3 spicing for mozilla and webkit */ - -moz-border-radius:@errorBorderRadius; - -webkit-border-radius:@errorBorderRadius; - border-radius:@errorBorderRadius; - -moz-box-shadow:0 0 @errorShadowWidth @errorShadowColor; - -webkit-box-shadow:0 0 @errorShadowWidth @errorShadowColor; - box-shadow:0 0 @errorShadowWidth @errorShadowColor; + .rounded-corners(@errorBorderRadius); + .box-shadow(0, 0, @errorShadowWidth, @errorShadowStrength); } /* pure CSS arrow */ @@ -275,7 +280,6 @@ html:root .error em { height:0; border:@errorArrowSize solid; border-color:@errorBackgroundColor transparent transparent; - /* positioning */ position:absolute; bottom:-@errorArrowSize; @@ -292,19 +296,13 @@ html:root .error em { z-index:10000; margin-top:-1px; - width:@labelWidth - 2; + width:198px; padding:2px; background-color:#fff; font-size:11px; border:1px solid #ccc; - - -moz-border-radius:@calBorderRadius; - -webkit-border-radius:@calBorderRadius; - border-radius:@calBorderRadius; - - -moz-box-shadow: 0 0 @calShadowWidth @calShadowColor; - -webkit-box-shadow: 0 0 @calShadowWidth @calShadowColor; - box-shadow:0 0 @calShadowWidth @calShadowColor; + .rounded-corners(@calBorderRadius); + .box-shadow(0, 0, @calShadowWidth, @calShadowStrength); } /* head. contains title, prev/next month controls and possible month/year selectors */ @@ -350,13 +348,12 @@ html:root .error em { #caldays { height:18px; border-bottom:1px solid #ddd; -} - -#caldays span { - display:block; - float:left; - width:28px; - text-align:center; + span { + display:block; + float:left; + width:28px; + text-align:center; + } } /* container for weeks */ @@ -369,24 +366,24 @@ html:root .error em { .calweek { clear:left; height:22px; + a { + display:block; + float:left; + width:27px; + height:20px; + text-decoration:none; + font-size:11px; + margin-left:1px; + text-align:center; + line-height:20px; + color:@calWeekColor; + -moz-border-radius:3px; + -webkit-border-radius:3px; + border-radius:3px; + } } /* single day */ -.calweek a { - display:block; - float:left; - width:27px; - height:20px; - text-decoration:none; - font-size:11px; - margin-left:1px; - text-align:center; - line-height:20px; - color:@calWeekColor; - -moz-border-radius:3px; - -webkit-border-radius:3px; - border-radius:3px; -} /* different states */ .calweek a:hover, .calfocus { @@ -400,14 +397,12 @@ a.calsun { /* offmonth day */ a.caloff { - color:#ccc; -} - -a.caloff:hover { - background-color:rgb(245, 245, 250); + color:#ccc; + &:hover { + background-color:rgb(245, 245, 250); + } } - /* unselecteble day */ a.caldisabled { background-color:#efefef !important; @@ -449,12 +444,8 @@ a.caltrigger { float:left; clear:right; margin-top:10px; - -moz-border-radius:@sliderBorderRadius; - -webkit-border-radius:@sliderBorderRadius; - border-radius:@sliderBorderRadius; - -moz-box-shadow:inset 0 0 8px #000; - -webkit-box-shadow:inset 0 0 8px #000; - box-shadow:inset 0 0 8px #000; + .rounded-corners(@sliderBorderRadius); + .box-shadow-inset(0, 0, 8px, 1); } /* progress bar (enabled with progress: true) */ @@ -476,29 +467,21 @@ a.caltrigger { margin-top:1px; border:1px solid #000; cursor:move; - -moz-box-shadow:0 0 6px #000; - -webkit-box-shadow:0 0 6px #000; - box-shadow:0 0 6px #000; - -moz-border-radius:14px; - -webkit-border-radius:14px; - border-radius:14px; + .box-shadow(0, 0, 6px, 1); + .rounded-corners(14px); } /* Multiple JS */ -div.powermail_multiple_js { - fieldset.tx-powermail-pi1_fieldset legend, - fieldset.tx-powermail-pi1_fieldset.ui-tabs-hide { +div.powermail_multiple_js fieldset.tx-powermail-pi1_fieldset { + padding-top:15px; + .box-shadow(@fieldsetShadowWidth, @fieldsetShadowWidth, @fieldsetShadowWidth, @fieldsetShadowStrength); + legend, + &.ui-tabs-hide { display:none; } - fieldset.tx-powermail-pi1_fieldset { - padding-top:15px; - -moz-box-shadow:@fieldsetShadowWidth @fieldsetShadowWidth @fieldsetShadowWidth @fieldsetShadowColor; - -webkit-box-shadow:@fieldsetShadowWidth @fieldsetShadowWidth @fieldsetShadowWidth @fieldsetShadowColor; - box-shadow:@fieldsetShadowWidth @fieldsetShadowWidth @fieldsetShadowWidth @fieldsetShadowColor; - fieldset legend { - display:block; - } + fieldset legend { + display:block; } } @@ -528,16 +511,14 @@ ul.powermail_multiplejs_tabs { border-left: 1px solid @fieldsetBorderColor; border-right: 1px solid @fieldsetBorderColor; outline: none; - } - a.act { - background: @multipleTabActiveBackgroundColor; - color: @multipleTabActiveColor; - padding:5px 10px 6px 10px; - position:relative; - margin-bottom:-1px; - -moz-box-shadow:@fieldsetShadowWidth 0 0 @fieldsetShadowColor; - -webkit-box-shadow:@fieldsetShadowWidth 0 0 @fieldsetShadowColor; - box-shadow:@fieldsetShadowWidth 0 0 @fieldsetShadowColor; + &.act { + background: @multipleTabActiveBackgroundColor; + color: @multipleTabActiveColor; + padding:5px 10px 6px 10px; + position:relative; + margin-bottom:-1px; + .box-shadow(@fieldsetShadowWidth, 0, 0, @fieldsetShadowStrength); + } } } } diff --git a/static/pi1/setup.txt b/static/pi1/setup.txt index b1c6580a..2a5f1d2e 100644 --- a/static/pi1/setup.txt +++ b/static/pi1/setup.txt @@ -411,13 +411,9 @@ plugin.tx_powermail_pi1 { # adding (or changing) flexible locallang markers in any HTML template or RTE field (example) - _LOCAL_LANG.en { + _LOCAL_LANG.default { # define your own locallang markers - locallangmarker_yourvalue = this is a new text - # define date format of datepicker in frontend -# JSvalidation_dateinput_format = dd.mm.yyyy - # define first day of week of datepicker in frontend -# JSvalidation_dateinput_firstDay = 0 +# locallangmarker_yourvalue = this is a new text } @@ -607,6 +603,10 @@ lib.powermailjs { VALIDATOR_MESSAGE.value = {$plugin.powermail.js.validationMessage} VALIDATOR_SINGLE_ERROR = TEXT VALIDATOR_SINGLE_ERROR.value = false + PLEASE_SELECT = TEXT + PLEASE_SELECT.data = LLL:EXT:powermail/pi1/locallang.xml:please_select + COUNTRY_ZONE = TEXT + COUNTRY_ZONE.data = LLL:EXT:powermail/pi1/locallang.xml:country_zone } } } diff --git a/tca.php b/tca.php index e1486d61..a27a5913 100644 --- a/tca.php +++ b/tca.php @@ -1,5 +1,5 @@ $TCA['tx_powermail_fieldsets']['ctrl'], - 'interface' => array ( + 'interface' => array( 'showRecordFieldList' => 'sys_language_uid,l18n_parent,l18n_diffsource,starttime,endtime,fe_group,form,title,class' ), 'feInterface' => $TCA['tx_powermail_fieldsets']['feInterface'], - 'columns' => array ( - 't3ver_label' => array ( - 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.versionLabel', - 'config' => array ( + 'columns' => array( + 't3ver_label' => array( + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.versionLabel', + 'config' => array( 'type' => 'input', 'size' => '30', - 'max' => '30', + 'max' => '30', ) ), - 'sys_language_uid' => array ( + 'sys_language_uid' => array( 'exclude' => 1, - 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.language', - 'config' => array ( - 'type' => 'select', - 'foreign_table' => 'sys_language', + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.language', + 'config' => array( + 'type' => 'select', + 'foreign_table' => 'sys_language', 'foreign_table_where' => 'ORDER BY sys_language.title', 'items' => array( array('LLL:EXT:lang/locallang_general.xml:LGL.allLanguages', -1), @@ -35,29 +35,29 @@ ) ) ), - 'l18n_parent' => array ( + 'l18n_parent' => array( 'displayCond' => 'FIELD:sys_language_uid:>:0', - 'exclude' => 1, - 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.l18n_parent', - 'config' => array ( - 'type' => 'select', - 'items' => array ( + 'exclude' => 1, + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.l18n_parent', + 'config' => array( + 'type' => 'select', + 'items' => array( array('', 0), ), - 'foreign_table' => 'tx_powermail_fieldsets', + 'foreign_table' => 'tx_powermail_fieldsets', 'foreign_table_where' => 'AND tx_powermail_fieldsets.pid=###CURRENT_PID### AND tx_powermail_fieldsets.sys_language_uid IN (-1,0)', ) ), - 'l18n_diffsource' => array ( - 'config' => array ( + 'l18n_diffsource' => array( + 'config' => array( 'type' => 'passthrough' ) ), - 'starttime' => array ( + 'starttime' => array( 'exclude' => 1, - 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.starttime', - 'config' => array ( - 'type' => 'input', + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.starttime', + 'config' => array( + 'type' => 'input', 'size' => '8', 'max' => '20', 'eval' => 'date', @@ -65,37 +65,37 @@ 'default' => 0 ) ), - 'endtime' => array ( + 'endtime' => array( 'exclude' => 1, - 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.endtime', - 'config' => array ( - 'type' => 'input', + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.endtime', + 'config' => array( + 'type' => 'input', 'size' => '8', 'max' => '20', 'eval' => 'date', 'checkbox' => 0, 'default' => 0, - 'range' => array ( + 'range' => array( 'upper' => 1609369200 ) ) ), - 'hidden' => array ( + 'hidden' => array( 'exclude' => 1, - 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden', - 'config' => array ( - 'type' => 'check', + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden', + 'config' => array( + 'type' => 'check', 'default' => '0' ) ), - 'fe_group' => array ( + 'fe_group' => array( 'exclude' => 1, 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.fe_group', - 'config' => array ( - 'type' => 'select', + 'config' => array( + 'type' => 'select', 'size' => 5, 'maxitems' => 20, - 'items' => array ( + 'items' => array( array('LLL:EXT:lang/locallang_general.xml:LGL.hide_at_login', -1), array('LLL:EXT:lang/locallang_general.xml:LGL.any_login', -2), array('LLL:EXT:lang/locallang_general.xml:LGL.usergroups', '--div--') @@ -105,23 +105,23 @@ 'foreign_table_where' => 'ORDER BY fe_groups.title' ) ), - 'tt_content' => array ( - 'config' => array ( + 'tt_content' => array( + 'config' => array( 'type' => 'passthrough' ) ), - 'title' => array ( - 'exclude' => 1, - 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_fieldsets.title', - 'config' => array ( - 'type' => 'input', - 'size' => '30', + 'title' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_fieldsets.title', + 'config' => array( + 'type' => 'input', + 'size' => '30', 'eval' => 'required', ) ), 'felder' => array( - 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_fieldsets.fields', - 'config' => array ( + 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_fieldsets.fields', + 'config' => array( 'type' => 'inline', 'foreign_table' => 'tx_powermail_fields', 'foreign_field' => 'fieldset', @@ -132,10 +132,10 @@ 'useSortable' => 1, 'newRecordLinkAddTitle' => 1, 'levelLinksPosition' => 'both', - 'showSynchronizationLink' => 0, - 'showAllLocalizationLink' => 1, - 'showPossibleLocalizationRecords' => 1, - 'showRemovedLocalizationRecords' => 1, + 'showSynchronizationLink' => 0, + 'showAllLocalizationLink' => 1, + 'showPossibleLocalizationRecords' => 1, + 'showRemovedLocalizationRecords' => 1, ), 'behaviour' => array( 'localizeChildrenAtParentLocalization' => 1, @@ -143,26 +143,26 @@ ), ) ), - 'class' => array ( + 'class' => array( 'exclude' => 1, - 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_fieldsets.class', - 'config' => array ( + 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_fieldsets.class', + 'config' => array( 'type' => 'select', 'eval' => 'trim,lower,alphanum_x', - 'items' => array ( - array ( - '', + 'items' => array( + array( + '', '' ), - array ( + array( 'Style 1', 'style1' ), - array ( + array( 'Style 2', 'style2' ), - array ( + array( 'Style 3', 'style3' ) @@ -171,14 +171,14 @@ ) ) ), - 'types' => array ( - '0' => array ( + 'types' => array( + '0' => array( 'showitem' => '--palette--;LLL:EXT:powermail/locallang_db.xml:tx_powermail_fields.fieldset;1, felder', 'canNotCollapse' => '1' ) - ), - 'palettes' => array ( - '1' => array ( + ), + 'palettes' => array( + '1' => array( 'showitem' => 'form, title, class, hidden, starttime, endtime', 'canNotCollapse' => '1' ) @@ -186,13 +186,12 @@ ); - // Check if css input field should be shown instead of selection if ($confArr['cssSelection'] == 0) { // selector box is not wanted - $TCA['tx_powermail_fieldsets']['columns']['class'] = array ( - 'exclude' => 1, - 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_fieldsets.class', - 'config' => array ( + $TCA['tx_powermail_fieldsets']['columns']['class'] = array( + 'exclude' => 1, + 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_fieldsets.class', + 'config' => array( 'type' => 'input', 'size' => '10', 'eval' => 'trim' @@ -204,9 +203,9 @@ * If IRRE deactivated in extension manager */ if ($confArr['useIRRE'] == 0) { - $TCA['tx_powermail_fieldsets']['columns']['tt_content'] = array ( + $TCA['tx_powermail_fieldsets']['columns']['tt_content'] = array( 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_fieldsets.tt_content', - 'config' => array ( + 'config' => array( 'type' => 'select', 'foreign_table' => 'tt_content', 'foreign_table_where' => 'AND tt_content.pid=###CURRENT_PID### ', @@ -219,35 +218,31 @@ } - - - - ####################################### ### TABLE 2: tx_powermail_fields ###### ####################################### -$TCA['tx_powermail_fields'] = array ( +$TCA['tx_powermail_fields'] = array( 'ctrl' => $TCA['tx_powermail_fields']['ctrl'], - 'interface' => array ( + 'interface' => array( 'showRecordFieldList' => 'hidden,starttime,endtime,fe_group,fieldset,title,name,type,value,valueto,valuefrom,size,maxsize,mandantory,more,fe_field,description,class' ), 'feInterface' => $TCA['tx_powermail_fields']['feInterface'], - 'columns' => array ( - 't3ver_label' => array ( - 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.versionLabel', - 'config' => array ( + 'columns' => array( + 't3ver_label' => array( + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.versionLabel', + 'config' => array( 'type' => 'input', 'size' => '30', - 'max' => '30', + 'max' => '30', ) ), - 'sys_language_uid' => array ( + 'sys_language_uid' => array( 'exclude' => 1, - 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.language', - 'config' => array ( - 'type' => 'select', - 'foreign_table' => 'sys_language', + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.language', + 'config' => array( + 'type' => 'select', + 'foreign_table' => 'sys_language', 'foreign_table_where' => 'ORDER BY sys_language.title', 'items' => array( array('LLL:EXT:lang/locallang_general.xml:LGL.allLanguages', -1), @@ -255,29 +250,29 @@ ) ) ), - 'l18n_parent' => array ( + 'l18n_parent' => array( 'displayCond' => 'FIELD:sys_language_uid:>:0', - 'exclude' => 1, - 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.l18n_parent', - 'config' => array ( - 'type' => 'select', - 'items' => array ( + 'exclude' => 1, + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.l18n_parent', + 'config' => array( + 'type' => 'select', + 'items' => array( array('', 0), ), - 'foreign_table' => 'tx_powermail_fields', + 'foreign_table' => 'tx_powermail_fields', 'foreign_table_where' => 'AND tx_powermail_fields.pid=###CURRENT_PID### AND tx_powermail_fields.sys_language_uid IN (-1,0)', ) ), - 'l18n_diffsource' => array ( - 'config' => array ( + 'l18n_diffsource' => array( + 'config' => array( 'type' => 'passthrough' ) ), - 'starttime' => array ( + 'starttime' => array( 'exclude' => 1, - 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.starttime', - 'config' => array ( - 'type' => 'input', + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.starttime', + 'config' => array( + 'type' => 'input', 'size' => '8', 'max' => '20', 'eval' => 'date', @@ -285,29 +280,29 @@ 'default' => 0 ) ), - 'endtime' => array ( + 'endtime' => array( 'exclude' => 1, - 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.endtime', - 'config' => array ( - 'type' => 'input', + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.endtime', + 'config' => array( + 'type' => 'input', 'size' => '8', 'max' => '20', 'eval' => 'date', 'checkbox' => 0, 'default' => 0, - 'range' => array ( + 'range' => array( 'upper' => 1609369200 ) ) ), - 'fe_group' => array ( + 'fe_group' => array( 'exclude' => 1, 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.fe_group', - 'config' => array ( - 'type' => 'select', + 'config' => array( + 'type' => 'select', 'size' => 5, 'maxitems' => 20, - 'items' => array ( + 'items' => array( array('LLL:EXT:lang/locallang_general.xml:LGL.hide_at_login', -1), array('LLL:EXT:lang/locallang_general.xml:LGL.any_login', -2), array('LLL:EXT:lang/locallang_general.xml:LGL.usergroups', '--div--') @@ -317,34 +312,34 @@ 'foreign_table_where' => 'ORDER BY fe_groups.title' ) ), - 'hidden' => array ( + 'hidden' => array( 'exclude' => 1, - 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden', - 'config' => array ( - 'type' => 'check', + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden', + 'config' => array( + 'type' => 'check', 'default' => '0' ) ), - 'fieldset' => array ( - 'config' => array ( + 'fieldset' => array( + 'config' => array( 'type' => 'passthrough' ) ), - 'title' => array ( - 'exclude' => 1, - 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_fields.title', - 'config' => array ( - 'type' => 'input', - 'size' => '30', + 'title' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_fields.title', + 'config' => array( + 'type' => 'input', + 'size' => '30', 'eval' => 'required', ) ), - 'formtype' => array ( - 'exclude' => 1, - 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_fields.type', - 'config' => array ( + 'formtype' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_fields.type', + 'config' => array( 'type' => 'select', - 'items' => array ( + 'items' => array( array('LLL:EXT:powermail/locallang_db.xml:tx_powermail_fields.type.I.0', '0',), array('LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.fieldtitle.div1', '--div--'), array('LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.fieldtitle.text', 'text'), @@ -370,14 +365,14 @@ array('LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.fieldtitle.typoscript', 'typoscript'), array('LLL:EXT:powermail/locallang_db.xml:tx_powermail_forms.fieldtitle.div3', '--div--'), ), - 'size' => 1, + 'size' => 1, 'maxitems' => 1, ) ), - 'flexform' => array ( - 'exclude' => 1, - 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_fields.field', - 'config' => array ( + 'flexform' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_fields.field', + 'config' => array( 'type' => 'flex', 'ds_pointerField' => 'formtype', 'ds' => array( @@ -405,44 +400,44 @@ ), ) ), - 'description' => array ( - 'exclude' => 1, - 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_fields.description', - 'config' => array ( - 'type' => 'text', - 'cols' => '30', - 'rows' => '2', - ) - ), - 'fe_field' => array ( - 'exclude' => 1, - 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_fields.fe_field', - 'config' => array ( + 'description' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_fields.description', + 'config' => array( + 'type' => 'text', + 'cols' => '30', + 'rows' => '2', + ) + ), + 'fe_field' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_fields.fe_field', + 'config' => array( 'type' => 'select', - 'items' => array ( + 'items' => array( array('LLL:EXT:powermail/locallang_db.xml:tx_powermail_fields.fe_field.I.0', '0'), ), 'itemsProcFunc' => 'user_powermail_tx_powermail_fields_fe_field->main', - 'size' => 1, + 'size' => 1, 'maxitems' => 1, ) ), - 'class' => array ( + 'class' => array( 'exclude' => 1, - 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_fields.class', - 'config' => array ( + 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_fields.class', + 'config' => array( 'type' => 'select', - 'items' => array ( - array ( - 'style1', + 'items' => array( + array( + 'style1', 'style1' ), - array ( - 'style2', + array( + 'style2', 'style2' ), - array ( - 'style3', + array( + 'style3', 'style3' ) ), @@ -450,18 +445,18 @@ ) ) ), - 'types' => array ( - '0' => array ( + 'types' => array( + '0' => array( 'showitem' => '--palette--;LLL:EXT:powermail/locallang_db.xml:tx_powermail_fieldsets.fields;1, formtype;;;;3-3-3, flexform;;;;3-3-3, --palette--;LLL:EXT:powermail/locallang_db.xml:tx_powermail_fieldsets.addition;2', 'canNotCollapse' => '1' ) - ), - 'palettes' => array ( - '1' => array ( + ), + 'palettes' => array( + '1' => array( 'showitem' => 'title, hidden, starttime, endtime', 'canNotCollapse' => '1' ), - '2' => array ( + '2' => array( 'showitem' => 'description, fe_field, class', 'canNotCollapse' => '1' ) @@ -470,10 +465,10 @@ // Check if css input field should be shown instead of selection if ($confArr['cssSelection'] == 0) { // selector box is not wanted - $TCA['tx_powermail_fields']['columns']['class'] = array ( - 'exclude' => 1, - 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_fields.class', - 'config' => array ( + $TCA['tx_powermail_fields']['columns']['class'] = array( + 'exclude' => 1, + 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_fields.class', + 'config' => array( 'type' => 'input', 'size' => '10', 'eval' => 'trim' @@ -482,17 +477,17 @@ } // Check if static_info_tables is loaded. If not, display error on flexform and prevent from executing an SQL-Query -if (!t3lib_extMgm::isLoaded('static_info_tables',0)) { +if (!t3lib_extMgm::isLoaded('static_info_tables', 0)) { $TCA['tx_powermail_fields']['columns']['flexform']['config']['ds']['countryselect'] = 'FILE:EXT:powermail/lib/def/def_field_countryselect_error.xml'; } /** * If IRRE deactivated in extension manager */ -if($confArr['useIRRE'] == 0) { - $TCA['tx_powermail_fields']['columns']['fieldset'] = array ( +if ($confArr['useIRRE'] == 0) { + $TCA['tx_powermail_fields']['columns']['fieldset'] = array( 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_fields.fieldset', - 'config' => array ( + 'config' => array( 'type' => 'select', 'foreign_table' => 'tx_powermail_fieldsets', 'maxitems' => 1, @@ -506,152 +501,152 @@ ### TABLE 3: tx_powermail_mails ####### ####################################### -$TCA['tx_powermail_mails'] = array ( +$TCA['tx_powermail_mails'] = array( 'ctrl' => $TCA['tx_powermail_mails']['ctrl'], - 'interface' => array ( + 'interface' => array( 'showRecordFieldList' => 'hidden,formid,recipient,cc_recipient,subject_r,sender,content' ), 'feInterface' => $TCA['tx_powermail_mails']['feInterface'], - 'columns' => array ( - 'hidden' => array ( + 'columns' => array( + 'hidden' => array( 'exclude' => 1, - 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden', - 'config' => array ( - 'type' => 'check', + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden', + 'config' => array( + 'type' => 'check', 'default' => '0' ) ), - 'formid' => array ( - 'exclude' => 1, - 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails.formid', - 'config' => array ( + 'formid' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails.formid', + 'config' => array( 'type' => 'group', 'internal_type' => 'db', 'allowed' => 'tt_content', - 'size' => 1, + 'size' => 1, 'minitems' => 0, 'maxitems' => 1, 'show_thumbs' => 1 ) ), - 'recipient' => array ( - 'exclude' => 1, - 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails.recipient', - 'config' => array ( - 'type' => 'input', + 'recipient' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails.recipient', + 'config' => array( + 'type' => 'input', 'size' => '30', ) ), - 'cc_recipient' => array ( - 'exclude' => 1, - 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails.cc_recipient', - 'config' => array ( - 'type' => 'input', + 'cc_recipient' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails.cc_recipient', + 'config' => array( + 'type' => 'input', 'size' => '30', ) ), - 'subject_r' => array ( - 'exclude' => 1, - 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails.subject_r', - 'config' => array ( - 'type' => 'input', + 'subject_r' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails.subject_r', + 'config' => array( + 'type' => 'input', 'size' => '30', ) ), - 'sender' => array ( - 'exclude' => 1, - 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails.sender', - 'config' => array ( - 'type' => 'input', + 'sender' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails.sender', + 'config' => array( + 'type' => 'input', 'size' => '30', ) - ), - 'content' => array ( - 'exclude' => 1, - 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails.content', - 'config' => array ( - 'type' => 'text', - 'cols' => '30', - 'rows' => '5', - 'wizards' => array ( - '_PADDING' => 2, - 'RTE' => array( - 'notNewRecords' => 1, - 'RTEonly' => 1, - 'type' => 'script', - 'title' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails.content_RTE', - 'icon' => 'wizard_rte2.gif', - 'script' => 'wizard_rte.php', - ), - ), - ) - ), - 'piVars' => array ( - 'exclude' => 1, - 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails.piVars', - 'config' => array ( + ), + 'content' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails.content', + 'config' => array( 'type' => 'text', - 'cols' => '30', + 'cols' => '30', 'rows' => '5', + 'wizards' => array( + '_PADDING' => 2, + 'RTE' => array( + 'notNewRecords' => 1, + 'RTEonly' => 1, + 'type' => 'script', + 'title' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails.content_RTE', + 'icon' => 'wizard_rte2.gif', + 'script' => 'wizard_rte.php', + ), + ), ) ), - 'feuser' => array ( - 'exclude' => 1, - 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails.feuser', - 'config' => array ( + 'piVars' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails.piVars', + 'config' => array( + 'type' => 'text', + 'cols' => '30', + 'rows' => '5', + ) + ), + 'feuser' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails.feuser', + 'config' => array( 'type' => 'group', 'internal_type' => 'db', 'allowed' => 'fe_users', - 'size' => 1, + 'size' => 1, 'minitems' => 0, 'maxitems' => 1 ) ), - 'senderIP' => array ( - 'exclude' => 1, - 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails.senderIP', - 'config' => array ( - 'type' => 'input', + 'senderIP' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails.senderIP', + 'config' => array( + 'type' => 'input', 'size' => '30', ) ), - 'UserAgent' => array ( - 'exclude' => 1, - 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails.UserAgent', - 'config' => array ( - 'type' => 'input', + 'UserAgent' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails.UserAgent', + 'config' => array( + 'type' => 'input', 'size' => '40', ) ), - 'Referer' => array ( - 'exclude' => 1, - 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails.Referer', - 'config' => array ( - 'type' => 'input', + 'Referer' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails.Referer', + 'config' => array( + 'type' => 'input', 'size' => '40', ) ), - 'SP_TZ' => array ( - 'exclude' => 1, - 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails.SP_TZ', - 'config' => array ( - 'type' => 'input', + 'SP_TZ' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails.SP_TZ', + 'config' => array( + 'type' => 'input', 'size' => '30', ) ), - 'Additional' => array ( + 'Additional' => array( 'exclude' => 1, - 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails.Additional', - 'config' => array ( - 'type' => 'input', + 'label' => 'LLL:EXT:powermail/locallang_db.xml:tx_powermail_mails.Additional', + 'config' => array( + 'type' => 'input', 'size' => '30', ) ), ), - 'types' => array ( + 'types' => array( '0' => array('showitem' => 'hidden;;1;;1-1-1, formid, recipient, cc_recipient, subject_r, sender, content;;;richtext[cut|copy|paste|formatblock|textcolor|bold|italic|underline|left|center|right|orderedlist|unorderedlist|outdent|indent|link|table|image|line|chMode]:rte_transform[mode=ts_css|imgpath=uploads/tx_powermail/rte/], piVars, feuser, senderIP, UserAgent, Referer, SP_TZ, Additional') ), - 'palettes' => array ( + 'palettes' => array( '1' => array('showitem' => '') ) ); diff --git a/templates/tmpl_fieldwrap.html b/templates/tmpl_fieldwrap.html index 5429140f..b23a4cea 100644 --- a/templates/tmpl_fieldwrap.html +++ b/templates/tmpl_fieldwrap.html @@ -352,7 +352,7 @@ ###CN_PARENT_TR_ISO_NR### Another ISO No. ###CN_OFFICIAL_NAME_LOCAL### Local name of country ###CN_OFFICIAL_NAME_EN### English name of country - ###CN_CAPITOL### Counry capital + ###CN_CAPITOL### Country capital ###CN_TLDOMAIN### Top level domain of country ###CN_CURRENCY_ISO_3### Currency ###CN_CURRENCY_ISO_NR### Currency No. @@ -366,37 +366,16 @@ ###CN_UNO_MEMBER### Boolean code: 1 if UNO member / 0 if not ###SELECTED### Preselection (if selected in backend or if in session) - Special markers (Countryzoneselect): - ###UID### UID in tabel static_country_zones - ###ZN_COUNTRY_ISO_2### Country name in 2 letters - ###ZN_COUNTRY_ISO_2### Country name in 3 letters - ###ZN_COUNTRY_ISO_NR### Country ISO No. - ###ZN_CODE### Short countryzone code with 2 letters - ###ZN_NAME_LOCAL### Local countryzone name - ###ZN_NAME_EN### English countryzone name (if filled) -
-
- - - - - + \ No newline at end of file diff --git a/templates/tmpl_frontend.js b/templates/tmpl_frontend.js index 1bb9e106..be2bb427 100644 --- a/templates/tmpl_frontend.js +++ b/templates/tmpl_frontend.js @@ -25,13 +25,13 @@ $('form.tx_powermail_pi1_form input.powermail_date').each( function() { var uid = $(this).attr('id'); - var value = $(this).attr('value'); + var value = $(this).attr('value') != '' ? $(this).attr('value'): ''; $(this).removeAttr('name').removeAttr('placeholder').removeAttr('value').after(''); }); $('form.tx_powermail_pi1_form input.powermail_datetime').each( function() { var uid = $(this).attr('id'); - var value = $(this).attr('value'); + var value = $(this).val() != '' ? $(this).val() : ''; $(this).removeAttr('name').removeAttr('placeholder').removeAttr('value').after(''); }); @@ -109,22 +109,24 @@ if (value != '' && !/\d\d:\d\d/.test(value)) { return false; } else { - var time = value.split(':'); - var hour = parseInt(time[0]); - var minute = parseInt(time[1]); - if (hour > 23 || hour < 0 || minute > 59 || minute < 0) { - return false; - } - if (input.prevAll('input.powermail_datetime').length > 0) { - var oldDate = new Date(input.prev('input').val() * 1000); - var year = oldDate.getUTCFullYear(); - var month = oldDate.getUTCMonth(); - var day = oldDate.getUTCDate(); - var secondsToAdd = hour * 3600 + minute * 60; - var timestamp = (new Date(year, month, day, hour, minute, 0).getTime() / 1000); - var timezoneOffset = new Date(year, month, day, hour, minute, 0).getTimezoneOffset() * 60; - input.prev('input').val(timestamp - timezoneOffset); - } + if (input.prev('input').val() != '') { + var time = value.split(':'); + var hour = parseInt(time[0]); + var minute = parseInt(time[1]); + if (hour > 23 || hour < 0 || minute > 59 || minute < 0) { + return false; + } + if (input.prevAll('input.powermail_datetime').length > 0) { + var oldDate = new Date(input.prev('input').val() * 1000); + var year = oldDate.getUTCFullYear(); + var month = oldDate.getUTCMonth(); + var day = oldDate.getUTCDate(); + var secondsToAdd = hour * 3600 + minute * 60; + var timestamp = (new Date(year, month, day, hour, minute, 0).getTime() / 1000); + var timezoneOffset = new Date(year, month, day, hour, minute, 0).getTimezoneOffset() * 60; + input.prev('input').val(timestamp - timezoneOffset); + } + } return true; } } @@ -141,8 +143,6 @@ h = (h < 10) ? '0' + h : h; m = (m < 10) ? '0' + m : m; $(this).val(h + ':' + m); - } else { - $(this).attr('placeholder', '00:00'); } } }); @@ -201,6 +201,95 @@ } + reinitializeValidator = function() { + if (!###VALIDATOR_DISABLE###) { + var validatorConf = powermail_validator.data('validator').getConf(); + powermail_validator.data('validator').destroy(); + powermail_validator = $('form.tx_powermail_pi1_form').validator(validatorConf); + } + } + + $.fn.getCountryZones = function() { + $.ajax({ + url: '/index.php', + type: "GET", + data: { + eID: 'tx_powermail::countryzones', + iso2: $(this).val(), + uid: $(this).attr('id') + }, + dataType: 'json', + success: function(response) { + if (!###VALIDATOR_DISABLE###) { + powermail_validator.data('validator').reset(); + } + var idCountry = parseInt(response[0]['id']); + var idCountryZone = idCountry + 100000; + var uidCountryZone = 'uid' + idCountryZone; + var countyClass = $('#uid' + idCountry).attr('class'); + var selectedZone = response[0]['selected']; + $('#powermaildiv_' + uidCountryZone).remove(); + if(response.length > 1 && response[1]['zn_code'] != null) { + var new_content = ''; + var option = 0; + $.each(response, function(i, row) { + if (option == 0) { + new_content += ''; + option ++; + } else { + new_content += ''; + } + }); + // TODO: Labelname in piVars + + $('#powermaildiv_uid' + idCountry) + .clone().removeAttr('id') + .attr('id', 'powermaildiv_' + uidCountryZone) + .removeClass('tx_powermail_pi1_fieldwrap_html_' + idCountry) + .addClass('tx_powermail_pi1_fieldwrap_html_' + idCountryZone) + .insertAfter('#powermaildiv_uid' + idCountry) + .find('label').html('###COUNTRY_ZONE###') + .attr('for', uidCountryZone) + .parent().find('select') + .replaceWith(''); + $('#' + uidCountryZone) + .removeClass('powermail_uid' + idCountry) + .addClass('powermail_' + uidCountryZone) + .attr('tabindex', parseInt($('#uid' + idCountry).attr('tabindex')) + 1); + if ($('#uid' + idCountry).attr('required') == 'required') { + $('#' + uidCountryZone).attr('required', 'required'); + } + reinitializeValidator(); + } + }, + error: function(error) { + alert('Ajax request not successful.'); + } + }); + } + + if ($('.powermail_countryselect.powermail_with_countryzone').length > 0) { + $('.powermail_countryselect.powermail_with_countryzone').each(function () { + if ($(this).val() != '') { + $(this).getCountryZones(); + } + }); + }; + + $('.powermail_countryselect.powermail_with_countryzone').change(function () { + if ($(this).val() != '') { + $(this).getCountryZones(); + } else { + if (!###VALIDATOR_DISABLE###) { + powermail_validator.data('validator').reset(); + } + idCountryZone = parseInt($(this).attr('id').substr(3)) + 100000; + $('#powermaildiv_uid' + idCountryZone).remove(); + reinitializeValidator(); + } + }); + + if (###SHOW_TRIGGER_ICON###) { $('.tx_powermail_pi1_fieldwrap_html_datetime, .tx_powermail_pi1_fieldwrap_html_date').addClass('calendar_icon'); } @@ -287,7 +376,7 @@ $(this).parent().parent().find('a').not('.current').each(function(id, item) { var temp = item.href.split('#'); var resetSelector = $('#' + temp[temp.length - 1] + ' :input'); - powermail_validator.data('validator').reset(resetSelector); + powermail_validator.data('validator').reset(resetSelector); }); } });