当前位置: 首页>>代码示例>>PHP>>正文


PHP t3lib_div::validEmail方法代码示例

本文整理汇总了PHP中t3lib_div::validEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP t3lib_div::validEmail方法的具体用法?PHP t3lib_div::validEmail怎么用?PHP t3lib_div::validEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在t3lib_div的用法示例。


在下文中一共展示了t3lib_div::validEmail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isValid

	/**
	 * Spam-Validation of given Params
	 * 		see powermail/doc/SpamDetection for formula
	 *
	 * @param array $params
	 * @return bool
	 */
	public function isValid($params) {
		if (!$this->settings['spamshield.']['_enable']) {
			return true;
		}
		$this->div = t3lib_div::makeInstance('Tx_Powermail_Utility_Div');
		$spamFactor = $this->settings['spamshield.']['factor'] / 100;

		// Different checks to increase spam indicator
		$this->honeypodCheck($params, $this->settings['spamshield.']['indicator.']['honeypod']);
		$this->linkCheck($params, $this->settings['spamshield.']['indicator.']['link'], $this->settings['spamshield.']['indicator.']['linkLimit']);
		$this->nameCheck($params, $this->settings['spamshield.']['indicator.']['name']);
		$this->sessionCheck($this->settings['spamshield.']['indicator.']['session']);
		$this->uniqueCheck($params, $this->settings['spamshield.']['indicator.']['unique']);
		$this->blacklistStringCheck($params, $this->settings['spamshield.']['indicator.']['blacklistString']);
		$this->blacklistIpCheck($this->settings['spamshield.']['indicator.']['blacklistIp']);

		// spam formula with asymptote 1 (100%)
		if ($this->spamIndicator > 0) {
			$thisSpamFactor = -1 / $this->spamIndicator + 1;
		} else {
			$thisSpamFactor = 0;
		}

		// Save Spam Factor in session for db storage
		$GLOBALS['TSFE']->fe_user->setKey('ses', 'powermail_spamfactor', $this->formatSpamFactor($thisSpamFactor));
		$GLOBALS['TSFE']->storeSessionData();

		// Spam debugging
		if ($this->settings['debug.']['spamshield']) {
			t3lib_utility_Debug::debug($this->msg, 'powermail debug: Show Spamchecks - Spamfactor ' . $this->formatSpamFactor($thisSpamFactor));
		}

		// if spam
		if ($thisSpamFactor >= $spamFactor) {
			$this->addError('spam_details', $this->formatSpamFactor($thisSpamFactor));

			// Send notification email to admin
			if (t3lib_div::validEmail($this->settings['spamshield.']['email'])) {
				$subject = 'Spam in powermail form recognized';
				$message = 'Possible spam in powermail form on page with PID ' . $GLOBALS['TSFE']->id;
				$message .= "\n\n";
				$message .= 'Spamfactor of this mail: ' . $this->formatSpamFactor($thisSpamFactor) . "\n";
				$message .= "\n\n";
				$message .= 'Failed Spamchecks:' . "\n";
				$message .= Tx_Powermail_Utility_Div::viewPlainArray($this->msg);
				$message .= "\n\n";
				$message .= 'Given Form variables:' . "\n";
				$message .= Tx_Powermail_Utility_Div::viewPlainArray($params);
				$header  = 'MIME-Version: 1.0' . "\r\n";
				$header .= 'Content-type: text/html; charset=utf-8' . "\r\n";
				$header .= 'From: powermail@' . t3lib_div::getIndpEnv('TYPO3_HOST_ONLY') . "\r\n";
				t3lib_div::plainMailEncoded($this->settings['spamshield.']['email'], $subject, $message, $header);
			}

			return false;
		}

		return true;
	}
开发者ID:rafu1987,项目名称:t3bootstrap-project,代码行数:66,代码来源:SpamShieldValidator.php

示例2: evaluateFieldValue

	/**
	 * Server valuation
	 *
	 * @param 	$value		The field value to be evaluated.
	 * @param 	$is_in		The "is_in" value of the field configuration from TCA
	 * @param 	$set		Boolean defining if the value is written to the database or not. Must be passed by reference and changed if needed.
	 * @return 	string		Value
	 */
	public function evaluateFieldValue($value, $is_in, &$set) {
		if (t3lib_div::validEmail($value)) {
			$set = 1;
		} else {
			$set = 0;
			$value = 'errorinemail@tryagain.com';
		}
		return $value;
	}
开发者ID:rafu1987,项目名称:t3bootstrap-project,代码行数:17,代码来源:EvaluateEmail.php

示例3: check

 /**
  * Validates that a specified field has valid email syntax.
  *
  * @param array &$check The TypoScript settings for this error check
  * @param string $name The field name
  * @param array &$gp The current GET/POST parameters
  * @return string The error string
  */
 public function check(&$check, $name, &$gp)
 {
     $checkFailed = '';
     if (isset($gp[$name]) && strlen(trim($gp[$name])) > 0) {
         $valid = t3lib_div::validEmail($gp[$name]);
         if (!$valid) {
             $checkFailed = $this->getCheckFailed($check);
         }
     }
     return $checkFailed;
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:19,代码来源:Tx_Formhandler_ErrorCheck_Email.php

示例4: isValid

 /**
  * Validation of given Params
  *
  * @param Tx_WoehrlSeminare_Domain_Model_Subscriber $newSubscriber
  * @return bool
  */
 public function isValid($newSubscriber)
 {
     if (strlen($newSubscriber->getName()) < 3) {
         $error = $this->objectManager->get('Tx_Extbase_Error_Error', 'val_name', 1000);
         $this->result->forProperty('name')->addError($error);
         // usually $this->addError is enough but this doesn't set the CSS errorClass in the form-viewhelper :-(
         //			$this->addError('val_name', 1000);
         $this->isValid = FALSE;
     }
     if (!t3lib_div::validEmail($newSubscriber->getEmail())) {
         $error = $this->objectManager->get('Tx_Extbase_Error_Error', 'val_email', 1100);
         $this->result->forProperty('email')->addError($error);
         //			$this->addError('val_email', 1100);
         $this->isValid = FALSE;
     }
     if (strlen($newSubscriber->getCustomerid()) > 0 && filter_var($newSubscriber->getCustomerid(), FILTER_VALIDATE_INT) === FALSE) {
         $error = $this->objectManager->get('Tx_Extbase_Error_Error', 'val_customerid', 1110);
         $this->result->forProperty('customerid')->addError($error);
         //			$this->addError('val_customerid', 1110);
         $this->isValid = FALSE;
     }
     if (strlen($newSubscriber->getNumber()) == 0 || filter_var($newSubscriber->getNumber(), FILTER_VALIDATE_INT) === FALSE || $newSubscriber->getNumber() < 1) {
         $error = $this->objectManager->get('Tx_Extbase_Error_Error', 'val_number', 1120);
         $this->result->forProperty('number')->addError($error);
         //			$this->addError('val_number', 1120);
         $this->isValid = FALSE;
     } else {
         $event = $newSubscriber->getEvent();
         // limit reached already --> overbooked
         if ($this->subscriberRepository->countAllByEvent($event) + $newSubscriber->getNumber() > $event->getMaxSubscriber()) {
             $error = $this->objectManager->get('Tx_Extbase_Error_Error', 'val_number', 1130);
             $this->result->forProperty('number')->addError($error);
             //			    $this->addError('val_number', 1130);
             $this->isValid = FALSE;
         }
     }
     if ($newSubscriber->getEditcode() != $this->getSessionData('editcode')) {
         $error = $this->objectManager->get('Tx_Extbase_Error_Error', 'val_editcode', 1140);
         $this->result->forProperty('editcode')->addError($error);
         //			$this->addError('val_editcode', 1140);
         $this->isValid = FALSE;
     }
     return $this->isValid;
 }
开发者ID:woehrlag,项目名称:Intranet,代码行数:50,代码来源:SubscriberValidator.php

示例5: checkBeAction

	/**
	 * Check View Backend
	 *
	 * @param string $email email address
	 * @return void
	 */
	public function checkBeAction($email = NULL) {
		$this->view->assign('pid', t3lib_div::_GP('id'));

		if ($email) {
			if (t3lib_div::validEmail($email)) {
				$body = 'New <b>Test Email</b> from User ' . $GLOBALS['BE_USER']->user['username'] . ' (' . t3lib_div::getIndpEnv('HTTP_HOST') . ')';

				$message = t3lib_div::makeInstance('t3lib_mail_Message');
				$message
					->setTo(array($email => 'Receiver'))
					->setFrom(array('powermail@domain.net' => 'powermail'))
					->setSubject('New Powermail Test Email')
					->setBody($body, 'text/html')
					->send();

				$this->view->assign('issent', $message->isSent());
				$this->view->assign('email', $email);
			}
		}
	}
开发者ID:rafu1987,项目名称:t3bootstrap-project,代码行数:26,代码来源:ModuleController.php

示例6: startIndexing

 function startIndexing($verbose = true, $extConf, $mode = '')
 {
     // write starting timestamp into registry
     // this is a helper to delete all records which are older than starting timestamp in registry
     // this also prevents starting the indexer twice
     if ($this->registry->get('tx_kesearch', 'startTimeOfIndexer') === null) {
         $this->registry->set('tx_kesearch', 'startTimeOfIndexer', time());
     } else {
         // check lock time
         $lockTime = $this->registry->get('tx_kesearch', 'startTimeOfIndexer');
         $compareTime = time() - 60 * 60 * 12;
         if ($lockTime < $compareTime) {
             // lock is older than 12 hours - remove
             $this->registry->removeAllByNamespace('tx_kesearch');
             $this->registry->set('tx_kesearch', 'startTimeOfIndexer', time());
         } else {
             return 'You can\'t start the indexer twice. Please wait while first indexer process is currently running';
         }
     }
     // set indexing start time
     $this->startTime = time();
     // get configurations
     $configurations = $this->getConfigurations();
     // number of records that should be written to the database in one action
     $this->amountOfRecordsToSaveInMem = 500;
     // register additional fields which should be written to DB
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['registerAdditionalFields'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['registerAdditionalFields'] as $_classRef) {
             if (TYPO3_VERSION_INTEGER >= 7000000) {
                 $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
             } else {
                 $_procObj =& t3lib_div::getUserObj($_classRef);
             }
             $_procObj->registerAdditionalFields($this->additionalFields);
         }
     }
     // set some prepare statements
     $this->prepareStatements();
     foreach ($configurations as $indexerConfig) {
         $this->indexerConfig = $indexerConfig;
         // run default indexers shipped with ke_search
         if (in_array($this->indexerConfig['type'], $this->defaultIndexerTypes)) {
             if (TYPO3_VERSION_INTEGER < 6002000) {
                 $path = t3lib_extMgm::extPath('ke_search') . 'Classes/indexer/types/class.tx_kesearch_indexer_types_' . $this->indexerConfig['type'] . '.php';
             } else {
                 $path = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('ke_search') . 'Classes/indexer/types/class.tx_kesearch_indexer_types_' . $this->indexerConfig['type'] . '.php';
             }
             if (is_file($path)) {
                 require_once $path;
                 if (TYPO3_VERSION_INTEGER >= 6002000) {
                     $searchObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_kesearch_indexer_types_' . $this->indexerConfig['type'], $this);
                 } else {
                     $searchObj = t3lib_div::makeInstance('tx_kesearch_indexer_types_' . $this->indexerConfig['type'], $this);
                 }
                 $content .= $searchObj->startIndexing();
             } else {
                 $content = '<div class="error"> Could not find file ' . $path . '</div>' . "\n";
             }
         }
         // hook for custom indexer
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['customIndexer'])) {
             foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['customIndexer'] as $_classRef) {
                 if (TYPO3_VERSION_INTEGER >= 7000000) {
                     $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
                 } else {
                     $_procObj =& t3lib_div::getUserObj($_classRef);
                 }
                 $content .= $_procObj->customIndexer($indexerConfig, $this);
             }
         }
         // In most cases there are some records waiting in ram to be written to db
         $this->storeTempRecordsToIndex('both');
     }
     // process index cleanup
     $content .= $this->cleanUpIndex();
     // count index records
     $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('*', 'tx_kesearch_index');
     $content .= '<p><b>Index contains ' . $count . ' entries.</b></p>';
     // clean up process after indezing to free memory
     $this->cleanUpProcessAfterIndexing();
     // print indexing errors
     if (sizeof($this->indexingErrors)) {
         $content .= "\n\n" . '<br /><br /><br /><b>INDEXING ERRORS (' . sizeof($this->indexingErrors) . ')<br /><br />' . CHR(10);
         foreach ($this->indexingErrors as $error) {
             $content .= $error . '<br />' . CHR(10);
         }
     }
     // create plaintext report
     $plaintextReport = $this->createPlaintextReport($content);
     // send notification in CLI mode
     if ($mode == 'CLI') {
         // send finishNotification
         if (TYPO3_VERSION_INTEGER >= 7000000) {
             $isValidEmail = TYPO3\CMS\Core\Utility\GeneralUtility::validEmail($extConf['notificationRecipient']);
         } else {
             $isValidEmail = t3lib_div::validEmail($extConf['notificationRecipient']);
         }
         if ($extConf['finishNotification'] && $isValidEmail) {
             // send the notification message
             // use swiftmailer in 4.5 and above
//.........这里部分代码省略.........
开发者ID:brainformatik,项目名称:ke_search,代码行数:101,代码来源:class.tx_kesearch_indexer.php

示例7: sendInfo

 /**
  * Sends info mail to subscriber or displays a screen to update or delete the membership
  *
  * @param array $cObj: the cObject
  * @param array $langObj: the language object
  * @param array $controlData: the object of the control data
  * @param array $controlData: the object of the control data
  * @param string $theTable: the table in use
  * @param string $prefixId: the extension prefix id
  * @param array  Array with key/values being marker-strings/substitution values.
  * @return	string		HTML content message
  * @see init(),compile(), send()
  */
 public function sendInfo($conf, $cObj, $langObj, $controlData, $tcaObj, $markerObj, $dataObj, $displayObj, $setfixedObj, $theTable, $prefixId, $origArr, $securedArray, $markerArray, $cmd, $cmdKey, $templateCode, $failure, &$errorCode)
 {
     $content = FALSE;
     if ($conf['infomail'] && $conf['email.']['field']) {
         $fetch = $controlData->getFeUserData('fetch');
         if (isset($fetch) && !empty($fetch) && !$failure) {
             $pidLock = 'AND pid IN (' . ($cObj->data['pages'] ? $cObj->data['pages'] . ',' : '') . $controlData->getPid() . ')';
             $enable = $GLOBALS['TSFE']->sys_page->enableFields($theTable);
             // Getting records
             // $conf['email.']['field'] must be a valid field in the table!
             $DBrows = $GLOBALS['TSFE']->sys_page->getRecordsByField($theTable, $conf['email.']['field'], $fetch, $pidLock . $enable, '', '', '100');
             $errorContent = '';
             // Processing records
             if (is_array($DBrows)) {
                 $recipient = $DBrows[0][$conf['email.']['field']];
                 $dataObj->setDataArray($DBrows[0]);
                 $errorContent = $this->compile('INFOMAIL', $conf, $cObj, $langObj, $controlData, $tcaObj, $markerObj, $dataObj, $displayObj, $setfixedObj, $theTable, $prefixId, $DBrows, $DBrows, $securedArray, trim($recipient), $markerArray, $cmd, $cmdKey, $templateCode, $dataObj->getInError(), $conf['setfixed.'], $errorCode);
             } elseif (t3lib_div::validEmail($fetch)) {
                 $fetchArray = array('0' => array('email' => $fetch));
                 $errorContent = $this->compile('INFOMAIL_NORECORD', $conf, $cObj, $langObj, $controlData, $tcaObj, $markerObj, $dataObj, $displayObj, $setfixedObj, $theTable, $prefixId, $fetchArray, $fetchArray, $securedArray, $fetch, $markerArray, $cmd, $cmdKey, $templateCode, $dataObj->getInError(), array(), $errorCode);
             }
             if ($errorContent || is_array($errorCode)) {
                 $content = $errorContent;
             } else {
                 $subpartkey = '###TEMPLATE_' . $this->infomailPrefix . 'SENT###';
                 $content = $displayObj->getPlainTemplate($conf, $cObj, $langObj, $controlData, $tcaObj, $markerObj, $dataObj, $templateCode, $subpartkey, $markerArray, $origArr, $theTable, $prefixId, is_array($DBrows) ? $DBrows[0] : (is_array($fetchArray) ? $fetchArray[0] : ''), $securedArray, FALSE);
                 if (!$content) {
                     // compatibility until 1.1.2010
                     $subpartkey = '###' . $this->emailMarkPrefix . $this->infomailPrefix . 'SENT###';
                     $content = $displayObj->getPlainTemplate($conf, $cObj, $langObj, $controlData, $tcaObj, $markerObj, $dataObj, $templateCode, $subpartkey, $markerArray, $origArr, $theTable, $prefixId, is_array($DBrows) ? $DBrows[0] : (is_array($fetchArray) ? $fetchArray[0] : ''), $securedArray);
                 }
             }
         } else {
             $subpartkey = '###TEMPLATE_INFOMAIL###';
             if (isset($fetch) && !empty($fetch)) {
                 $markerArray['###FIELD_email###'] = htmlspecialchars($fetch);
             } else {
                 $markerArray['###FIELD_email###'] = '';
             }
             $content = $displayObj->getPlainTemplate($conf, $cObj, $langObj, $controlData, $tcaObj, $markerObj, $dataObj, $templateCode, $subpartkey, $markerArray, $origArr, $theTable, $prefixId, '', $securedArray, TRUE, $failure);
         }
     } else {
         $errorCode = array();
         $errorCode['0'] = 'internal_infomail_configuration';
     }
     return $content;
 }
开发者ID:raimundlandig,项目名称:winkel.de-DEV,代码行数:60,代码来源:class.tx_srfeuserregister_email.php

示例8: getReceipientsOfStage

 /**
  * Gets all assigned recipients of a particular stage.
  *
  * @param integer $stage
  * @return array
  */
 protected function getReceipientsOfStage($stage)
 {
     $result = array();
     $recipients = $this->getStageService()->getResponsibleBeUser($stage);
     foreach ($recipients as $id => $user) {
         if (t3lib_div::validEmail($user['email'])) {
             $name = $user['realName'] ? $user['realName'] : $user['username'];
             $result[] = array('boxLabel' => sprintf('%s (%s)', $name, $user['email']), 'name' => 'receipients-' . $id, 'checked' => TRUE);
         }
     }
     return $result;
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:18,代码来源:ActionHandler.php

示例9: validateEmailAddress

 /**
  * Validates that $emailAddress is non-empty and valid. If it is not, this method throws an exception.
  *
  * @param string $emailAddress the supposed e-mail address to check
  * @param string $roleDescription e.g., "To:" or "From:", must not be empty
  *
  * @return void
  *
  * @throws InvalidArgumentException
  */
 protected function validateEmailAddress($emailAddress, $roleDescription)
 {
     if ($emailAddress === '') {
         throw new InvalidArgumentException('The ' . $roleDescription . ' e-mail address "' . $emailAddress . '" was empty.', 1409601561);
     }
     if (!$this->isLocalhostAddress($emailAddress) && !t3lib_div::validEmail($emailAddress)) {
         throw new InvalidArgumentException('The ' . $roleDescription . ' e-mail address "' . $emailAddress . '" was not valid.', 1409601561);
     }
 }
开发者ID:Konafets,项目名称:oelib,代码行数:19,代码来源:AbstractMailer.php

示例10: validateAdditionalFields

 /**
  * This method checks any additional data that is relevant to the specific task
  * If the task class is not relevant, the method is expected to return true
  *
  * @param	array					$submittedData: reference to the array containing the data submitted by the user
  * @param	tx_scheduler_Module		$parentObject: reference to the calling object (Scheduler's BE module)
  * @return	boolean					True if validation was ok (or selected class is not relevant), false otherwise
  */
 public function validateAdditionalFields(array &$submittedData, tx_scheduler_Module $parentObject)
 {
     $bError = false;
     foreach ($this->getAdditionalFieldConfig() as $sKey => $aOptions) {
         $mValue =& $submittedData[$sKey];
         // bei einer checkbox ist der value immer 'on'!
         if ($aOptions['type'] && $mValue === 'on') {
             $mValue = 1;
         }
         $bMessage = false;
         // Die Einzelnen validatoren anwenden.
         if (!$bMessage) {
             foreach (t3lib_div::trimExplode(',', $aOptions['eval']) as $sEval) {
                 $sLabelKey = ($aOptions['label'] ? $aOptions['label'] : $sKey) . '_eval_' . $sEval;
                 switch ($sEval) {
                     case 'required':
                         $bMessage = empty($mValue);
                         break;
                     case 'trim':
                         $mValue = trim($mValue);
                         break;
                     case 'int':
                         $bMessage = !is_numeric($mValue);
                         if (!$bMessage) {
                             $mValue = intval($mValue);
                         }
                         break;
                     case 'date':
                         $mValue = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], $mValue);
                         break;
                     case 'email':
                         //wir unterstützen kommaseparierte listen von email andressen
                         if (!empty($mValue)) {
                             $aEmails = explode(',', $mValue);
                             $bMessage = false;
                             foreach ($aEmails as $sEmail) {
                                 if (!t3lib_div::validEmail($sEmail)) {
                                     $bMessage = true;
                                 }
                             }
                         }
                         break;
                     case 'folder':
                         tx_rnbase::load('tx_mklib_util_File');
                         $sPath = tx_mklib_util_File::getServerPath($mValue);
                         $bMessage = !@is_dir($sPath);
                         if (!$bMessage) {
                             $mValue = $sPath;
                         }
                         break;
                     case 'file':
                         tx_rnbase::load('tx_mklib_util_File');
                         $sPath = tx_mklib_util_File::getServerPath($mValue);
                         $bMessage = !@file_exists($sPath);
                         if (!$bMessage) {
                             $mValue = $sPath;
                         }
                         break;
                     case 'url':
                         $bMessage = !t3lib_div::isValidUrl($mValue);
                         break;
                     default:
                         // wir prüfen auf eine eigene validator methode in der Kindklasse.
                         // in eval muss validateLifetime stehen, damit folgende methode aufgerufen wird.
                         // protected function validateLifetime($mValue){ return true; }
                         // @TODO: clasname::method prüfen!?
                         if (method_exists($this, $sEval)) {
                             $ret = $this->{$sEval}($mValue, $submittedData);
                             if (is_string($ret)) {
                                 $bMessage = $sMessage = $ret;
                             }
                         }
                 }
                 // wir generieren nur eine meldung pro feld!
                 if ($bMessage) {
                     break;
                 }
             }
         }
         // wurde eine fehlermeldung erzeugt?
         if ($bMessage) {
             $sMessage = $sMessage ? $sMessage : $GLOBALS['LANG']->sL($sLabelKey);
             $sMessage = $sMessage ? $sMessage : ucfirst($sKey) . ' has to eval ' . $sEval . '.';
             $parentObject->addMessage($sMessage, t3lib_FlashMessage::ERROR);
             $bError = true;
             continue;
         }
     }
     return !$bError;
 }
开发者ID:RocKordier,项目名称:typo3-mklib,代码行数:98,代码来源:class.tx_mklib_scheduler_GenericFieldProvider.php

示例11: sysLog

 /**
  * Logs message to the system log.
  * This should be implemented around the source code, including the Core and both frontend and backend, logging serious errors.
  * If you want to implement the sysLog in your applications, simply add lines like:
  *		 t3lib_div::sysLog('[write message in English here]', 'extension_key', 'severity');
  *
  * @param	string		Message (in English).
  * @param	string		Extension key (from which extension you are calling the log) or "Core"
  * @param	integer		Severity: 0 is info, 1 is notice, 2 is warning, 3 is error, 4 is fatal error
  * @return	void
  */
 public static function sysLog($msg, $extKey, $severity = 0)
 {
     global $TYPO3_CONF_VARS;
     $severity = self::intInRange($severity, 0, 4);
     // is message worth logging?
     if (intval($TYPO3_CONF_VARS['SYS']['systemLogLevel']) > $severity) {
         return;
     }
     // initialize logging
     if (!$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogInit']) {
         self::initSysLog();
     }
     // do custom logging
     if (isset($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLog']) && is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLog'])) {
         $params = array('msg' => $msg, 'extKey' => $extKey, 'backTrace' => debug_backtrace(), 'severity' => $severity);
         $fakeThis = FALSE;
         foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLog'] as $hookMethod) {
             self::callUserFunction($hookMethod, $params, $fakeThis);
         }
     }
     // TYPO3 logging enabled?
     if (!$TYPO3_CONF_VARS['SYS']['systemLog']) {
         return;
     }
     $dateFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'];
     $timeFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'];
     // use all configured logging options
     foreach (explode(';', $TYPO3_CONF_VARS['SYS']['systemLog'], 2) as $log) {
         list($type, $destination, $level) = explode(',', $log, 4);
         // is message worth logging for this log type?
         if (intval($level) > $severity) {
             continue;
         }
         $msgLine = ' - ' . $extKey . ': ' . $msg;
         // write message to a file
         if ($type == 'file') {
             $file = fopen($destination, 'a');
             if ($file) {
                 flock($file, LOCK_EX);
                 // try locking, but ignore if not available (eg. on NFS and FAT)
                 fwrite($file, date($dateFormat . ' ' . $timeFormat) . $msgLine . LF);
                 flock($file, LOCK_UN);
                 // release the lock
                 fclose($file);
                 self::fixPermissions($destination);
             }
         } elseif ($type == 'mail') {
             list($to, $from) = explode('/', $destination);
             if (!t3lib_div::validEmail($from)) {
                 $from = t3lib_utility_Mail::getSystemFrom();
             }
             /** @var $mail t3lib_mail_Message */
             $mail = t3lib_div::makeInstance('t3lib_mail_Message');
             $mail->setTo($to)->setFrom($from)->setSubject('Warning - error in TYPO3 installation')->setBody('Host: ' . $TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogHost'] . LF . 'Extension: ' . $extKey . LF . 'Severity: ' . $severity . LF . LF . $msg);
             $mail->send();
         } elseif ($type == 'error_log') {
             error_log($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogHost'] . $msgLine, 0);
         } elseif ($type == 'syslog') {
             $priority = array(LOG_INFO, LOG_NOTICE, LOG_WARNING, LOG_ERR, LOG_CRIT);
             syslog($priority[(int) $severity], $msgLine);
         }
     }
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:74,代码来源:class.t3lib_div.php

示例12: getSystemFromAddress

 /**
  * Creates a valid email address for the sender of mail messages.
  *
  * Uses a fallback chain:
  *     $TYPO3_CONF_VARS['MAIL']['defaultMailFromAddress'] ->
  *     no-reply@FirstDomainRecordFound ->
  *     no-reply@php_uname('n') ->
  *     no-reply@example.com
  *
  * Ready to be passed to $mail->setFrom() (t3lib_mail)
  *
  * @return	string	An email address
  */
 public static function getSystemFromAddress()
 {
     // default, first check the localconf setting
     $address = $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress'];
     if (!t3lib_div::validEmail($address)) {
         // just get us a domain record we can use as the host
         $host = '';
         $domainRecord = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('domainName', 'sys_domain', 'hidden = 0', '', 'pid ASC, sorting ASC');
         if (!empty($domainRecord['domainName'])) {
             $tempUrl = $domainRecord['domainName'];
             if (!t3lib_div::isFirstPartOfStr($tempUrl, 'http')) {
                 // shouldn't be the case anyways, but you never know
                 // ... there're crazy people out there
                 $tempUrl = 'http://' . $tempUrl;
             }
             $host = parse_url($tempUrl, PHP_URL_HOST);
         }
         $address = 'no-reply@' . $host;
         if (!t3lib_div::validEmail($address)) {
             // still nothing, get host name from server
             $address = 'no-reply@' . php_uname('n');
             if (!t3lib_div::validEmail($address)) {
                 // if everything fails use a dummy address
                 $address = 'no-reply@example.com';
             }
         }
     }
     return $address;
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:42,代码来源:class.t3lib_utility_mail.php

示例13: validateAdditionalFields

 /**
  * This method checks any additional data that is relevant to the specific task.
  * If the task class is not relevant, the method is expected to return TRUE.
  *
  * @param	array		$submittedData: reference to the array containing the data submitted by the user
  * @param	tx_scheduler_module1		$parentObject: reference to the calling object (BE module of the Scheduler)
  * @return	boolean		True if validation was ok (or selected class is not relevant), FALSE otherwise
  */
 public function validateAdditionalFields(array &$submittedData, tx_scheduler_Module $schedulerModule)
 {
     $isValid = TRUE;
     //!TODO add validation to validate the $submittedData['configuration'] wich is normally a comma seperated string
     if (!empty($submittedData['linkvalidator']['email'])) {
         $emailList = t3lib_div::trimExplode(',', $submittedData['linkvalidator']['email']);
         foreach ($emailList as $emailAdd) {
             if (!t3lib_div::validEmail($emailAdd)) {
                 $isValid = FALSE;
                 $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.invalidEmail'), t3lib_FlashMessage::ERROR);
             }
         }
     }
     if ($res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'uid = ' . $submittedData['linkvalidator']['page'])) {
         if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) == 0 && $submittedData['linkvalidator']['page'] > 0) {
             $isValid = FALSE;
             $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.invalidPage'), t3lib_FlashMessage::ERROR);
         }
     } else {
         $isValid = FALSE;
         $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.invalidPage'), t3lib_FlashMessage::ERROR);
     }
     if ($submittedData['linkvalidator']['depth'] < 0) {
         $isValid = FALSE;
         $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.invalidDepth'), t3lib_FlashMessage::ERROR);
     }
     return $isValid;
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:36,代码来源:class.tx_linkvalidator_tasks_validatoradditionalfieldprovider.php

示例14: main

 /**
  * Displays an alternative, more advanced / user friendly login form (than the default)
  *
  * @param	string		Default content string, ignore
  * @param	array		TypoScript configuration for the plugin
  * @return	string		HTML for the plugin
  */
 function main($content, $conf)
 {
     // Loading TypoScript array into object variable:
     $this->conf = $conf;
     // Loading language-labels
     $this->pi_loadLL();
     // Init FlexForm configuration for plugin:
     $this->pi_initPIflexForm();
     // Get storage PIDs:
     if ($this->conf['storagePid']) {
         $spid['_STORAGE_PID'] = $this->conf['storagePid'];
     } else {
         $spid = $GLOBALS['TSFE']->getStorageSiterootPids();
     }
     // GPvars:
     $logintype = t3lib_div::GPvar('logintype');
     $redirect_url = t3lib_div::GPvar('redirect_url');
     // Auto redirect.
     // Feature to redirect to the page where the user came from (HTTP_REFERER).
     // Allowed domains to redirect to, can be configured with plugin.tx_newloginbox_pi1.domains
     // Thanks to plan2.net / Martin Kutschker for implementing this feature.
     if (!$redirect_url && $this->conf['domains']) {
         $redirect_url = t3lib_div::getIndpEnv('HTTP_REFERER');
         // is referring url allowed to redirect?
         $match = array();
         if (ereg('^http://([[:alnum:]._-]+)/', $redirect_url, $match)) {
             $redirect_domain = $match[1];
             $found = false;
             foreach (split(',', $this->conf['domains']) as $d) {
                 if (ereg('(^|\\.)' . $d . '$', $redirect_domain)) {
                     $found = true;
                     break;
                 }
             }
             if (!$found) {
                 $redirect_url = '';
             }
         }
         // avoid forced logout, when trying to login immediatly after a logout
         $redirect_url = ereg_replace("[&?]logintype=[a-z]+", "", $redirect_url);
     }
     // Store the entries we will use in the template
     $markerArray = array();
     $subPartArray = array();
     $wrapArray = array();
     // Store entries retrieved by post / get queries
     $workingData = array('forgot_email' => $this->piVars['DATA']['forgot_email'] ? trim($this->piVars['DATA']['forgot_email']) : '');
     if ($this->piVars['forgot']) {
         $markerArray['###STATUS_HEADER###'] = $this->pi_getLL('forgot_password', '', 1);
         if ($workingData['forgot_email'] && t3lib_div::validEmail($workingData['forgot_email'])) {
             $templateMarker = '###TEMPLATE_FORGOT_SENT###';
             $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('username, password', 'fe_users', sprintf('email=\'%s\' and pid=\'%d\' %s', addslashes($workingData['forgot_email']), intval($spid['_STORAGE_PID']), $this->cObj->enableFields('fe_users')));
             if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
                 $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
                 $msg = sprintf($this->pi_getLL('forgot_password_pswmsg', '', 0), $workingData['forgot_email'], $row['username'], $row['password']);
             } else {
                 $msg = sprintf($this->pi_getLL('forgot_password_no_pswmsg', '', 0), $workingData['forgot_email']);
             }
             // Hook (used by kb_md5fepw extension by Kraft Bernhard <kraftb@gmx.net>)
             if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['newloginbox']['forgotEmail'])) {
                 $_params = array('msg' => &$msg);
                 foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['newloginbox']['forgotEmail'] as $funcRef) {
                     t3lib_div::callUserFunction($funcRef, $_params, $this);
                 }
             }
             $this->cObj->sendNotifyEmail($msg, $workingData['forgot_email'], '', $this->conf['email_from'], $this->conf['email_fromName'], $this->conf['replyTo']);
             $markerArray['###STATUS_MESSAGE###'] = sprintf($this->pi_getLL('forgot_password_emailSent', '', 1), '<em>' . htmlspecialchars($workingData['forgot_email']) . '</em>');
             $markerArray['###FORGOT_PASSWORD_BACKTOLOGIN###'] = $this->pi_linkTP_keepPIvars($this->pi_getLL('forgot_password_backToLogin', '', 1), array('forgot' => ''));
         } else {
             $templateMarker = '###TEMPLATE_FORGOT###';
             $markerArray['###ACTION_URI###'] = htmlspecialchars(t3lib_div::getIndpEnv('REQUEST_URI'));
             $markerArray['###EMAIL_LABEL###'] = $this->pi_getLL('your_email', '', 1);
             $markerArray['###FORGOT_PASSWORD_ENTEREMAIL###'] = $this->pi_getLL('forgot_password_enterEmail', '', 1);
             $markerArray['###PREFIXID###'] = $this->prefixId;
             $markerArray['###SEND_PASSWORD###'] = $this->pi_getLL('send_password', '', 1);
         }
     } else {
         if ($GLOBALS['TSFE']->loginUser) {
             if ($logintype == 'login') {
                 $templateMarker = '###TEMPLATE_SUCCESS###';
                 $outH = $this->getOutputLabel('header_success', 's_success', 'header');
                 $outC = str_replace('###USER###', $GLOBALS['TSFE']->fe_user->user['username'], $this->getOutputLabel('msg_success', 's_success', 'message'));
                 if ($outH) {
                     $markerArray['###STATUS_HEADER###'] = $outH;
                 }
                 if ($outC) {
                     $markerArray['###STATUS_MESSAGE###'] = $outC;
                 }
                 // Hook for general actions after after login has been confirmed (by Thomas Danzl <thomas@danzl.org>)
                 if ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['newloginbox']['login_confirmed']) {
                     $_params = array();
                     foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['newloginbox']['login_confirmed'] as $_funcRef) {
                         if ($_funcRef) {
//.........这里部分代码省略.........
开发者ID:raimundlandig,项目名称:winkel.de-DEV,代码行数:101,代码来源:class.tx_newloginbox_pi1.php

示例15: viewNewBackendUser

    /**
     * Action to create a new BE user
     *
     * @param	array		$record: sys_action record
     * @return	string form to create a new user
     */
    protected function viewNewBackendUser($record)
    {
        $content = '';
        $beRec = t3lib_BEfunc::getRecord('be_users', intval($record['t1_copy_of_user']));
        // a record is neeed which is used as copy for the new user
        if (!is_array($beRec)) {
            $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->getLL('action_notReady', TRUE), $GLOBALS['LANG']->getLL('action_error'), t3lib_FlashMessage::ERROR);
            $content .= $flashMessage->render();
            return $content;
        }
        $vars = t3lib_div::_POST('data');
        $key = 'NEW';
        if ($vars['sent'] == 1) {
            $errors = array();
            // basic error checks
            if (!empty($vars['email']) && !t3lib_div::validEmail($vars['email'])) {
                $errors[] = $GLOBALS['LANG']->getLL('error-wrong-email');
            }
            if (empty($vars['username'])) {
                $errors[] = $GLOBALS['LANG']->getLL('error-username-empty');
            }
            if (empty($vars['password'])) {
                $errors[] = $GLOBALS['LANG']->getLL('error-password-empty');
            }
            if ($vars['key'] !== 'NEW' && !$this->isCreatedByUser($vars['key'], $record)) {
                $errors[] = $GLOBALS['LANG']->getLL('error-wrong-user');
            }
            // show errors if there are any
            if (count($errors) > 0) {
                $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', implode('<br />', $errors), $GLOBALS['LANG']->getLL('action_error'), t3lib_FlashMessage::ERROR);
                $content .= $flashMessage->render() . '<br />';
            } else {
                // save user
                $key = $this->saveNewBackendUser($record, $vars);
                // success messsage
                $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $vars['key'] === 'NEW' ? $GLOBALS['LANG']->getLL('success-user-created') : $GLOBALS['LANG']->getLL('success-user-updated'), $GLOBALS['LANG']->getLL('success'), t3lib_FlashMessage::OK);
                $content .= $flashMessage->render() . '<br />';
            }
        }
        // load BE user to edit
        if (intval(t3lib_div::_GP('be_users_uid')) > 0) {
            $tmpUserId = intval(t3lib_div::_GP('be_users_uid'));
            // check if the selected user is created by the current user
            $rawRecord = $this->isCreatedByUser($tmpUserId, $record);
            if ($rawRecord) {
                // delete user
                if (t3lib_div::_GP('delete') == 1) {
                    $this->deleteUser($tmpUserId, $record['uid']);
                }
                $key = $tmpUserId;
                $vars = $rawRecord;
            }
        }
        $this->JScode();
        $loadDB = t3lib_div::makeInstance('t3lib_loadDBGroup');
        $loadDB->start($vars['db_mountpoints'], 'pages');
        $content .= '<form action="" method="post" enctype="multipart/form-data">
						<fieldset class="fields">
							<legend>General fields</legend>
							<div class="row">
								<label for="field_disable">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xml:LGL.disable') . '</label>
								<input type="checkbox" id="field_disable" name="data[disable]" value="1" class="checkbox" ' . ($vars['disable'] == 1 ? ' checked="checked" ' : '') . ' />
							</div>
							<div class="row">
								<label for="field_realname">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xml:LGL.name') . '</label>
								<input type="text" id="field_realname" name="data[realName]" value="' . htmlspecialchars($vars['realName']) . '" />
							</div>
							<div class="row">
								<label for="field_username">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tca.xml:be_users.username') . '</label>
								<input type="text" id="field_username" name="data[username]" value="' . htmlspecialchars($vars['username']) . '" />
							</div>
							<div class="row">
								<label for="field_password">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tca.xml:be_users.password') . '</label>
								<input type="password" id="field_password" name="data[password]" value="" />
							</div>
							<div class="row">
								<label for="field_email">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xml:LGL.email') . '</label>
								<input type="text" id="field_email" name="data[email]" value="' . htmlspecialchars($vars['email']) . '" />
							</div>
						</fieldset>
						<fieldset class="fields">
							<legend>Configuration</legend>

							<div class="row">
								<label for="field_usergroup">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tca.xml:be_users.usergroup') . '</label>
								<select id="field_usergroup" name="data[usergroup][]" multiple="multiple">
									' . $this->getUsergroups($record, $vars) . '
								</select>
							</div>
							<div class="row">
								<label for="field_db_mountpoints">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tca.xml:be_users.options_db_mounts') . '</label>
								' . $this->t3lib_TCEforms->dbFileIcons('data[db_mountpoints]', 'db', 'pages', $loadDB->itemArray, '', array('size' => 3)) . '
							</div>
							<div class="row">
//.........这里部分代码省略.........
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:101,代码来源:class.tx_sysaction_task.php


注:本文中的t3lib_div::validEmail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。