本文整理汇总了PHP中FWValidator::isEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP FWValidator::isEmail方法的具体用法?PHP FWValidator::isEmail怎么用?PHP FWValidator::isEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FWValidator
的用法示例。
在下文中一共展示了FWValidator::isEmail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDetailPage
public function getDetailPage()
{
global $_ARRAYLANG, $objDatabase;
$cx = \Cx\Core\Core\Controller\Cx::instanciate();
$file = str_replace($cx->getWebsiteOffsetPath(), '', $_GET["path"]) . $_GET["file"];
$objResult = $objDatabase->Execute("SELECT `id`, `file`, `source`, `hash`, `check`, `expiration_date` FROM " . DBPREFIX . "module_filesharing WHERE `source` = '" . contrexx_raw2db($file) . "'");
$existing = $objResult !== false && $objResult->RecordCount() > 0;
if ($_GET["switch"]) {
if ($existing) {
$objDatabase->Execute("DELETE FROM " . DBPREFIX . "module_filesharing WHERE `source` = '" . contrexx_raw2db($file) . "'");
} else {
$hash = FileSharingLib::createHash();
$check = FileSharingLib::createCheck($hash);
$source = str_replace($cx->getWebsiteOffsetPath(), '', $_GET["path"]) . $_GET["file"];
$objDatabase->Execute("INSERT INTO " . DBPREFIX . "module_filesharing (`file`, `source`, `hash`, `check`) VALUES ('" . contrexx_raw2db($source) . "', '" . contrexx_raw2db($source) . "', '" . contrexx_raw2db($hash) . "', '" . contrexx_raw2db($check) . "')");
}
$existing = !$existing;
}
if ($existing) {
$this->_objTpl->setVariable(array('FILE_STATUS' => $_ARRAYLANG["TXT_FILESHARING_SHARED"], 'FILE_STATUS_SWITCH' => $_ARRAYLANG["TXT_FILESHARING_STOP_SHARING"], 'FILE_STATUS_SWITCH_HREF' => 'index.php?cmd=Media&archive=FileSharing&act=filesharing&path=' . $_GET["path"] . '&file=' . $_GET["file"] . '&switch=1'));
$this->_objTpl->touchBlock('shared');
} else {
$this->_objTpl->setVariable(array('FILE_STATUS' => $_ARRAYLANG["TXT_FILESHARING_NOT_SHARED"], 'FILE_STATUS_SWITCH' => $_ARRAYLANG["TXT_FILESHARING_START_SHARING"], 'FILE_STATUS_SWITCH_HREF' => 'index.php?cmd=Media&archive=FileSharing&act=filesharing&path=' . $_GET["path"] . '&file=' . $_GET["file"] . '&switch=1'));
$this->_objTpl->hideBlock('shared');
}
if ($_POST["shareFiles"]) {
$emails = array();
foreach (preg_split('/[;,\\s]+/', $_POST["email"]) as $email) {
if (\FWValidator::isEmail($email)) {
$emails[] = contrexx_input2raw($email);
}
}
if (count($emails) > 0) {
FileSharingLib::sendMail($objResult->fields["id"], $_POST["subject"], $emails, $_POST["message"]);
}
} elseif ($_POST["saveExpiration"]) {
if ($_POST["expiration"]) {
$objDatabase->Execute("UPDATE " . DBPREFIX . "module_filesharing SET `expiration_date` = NULL WHERE `id` = " . $objResult->fields["id"]);
} else {
$objDatabase->Execute("UPDATE " . DBPREFIX . "module_filesharing SET `expiration_date` = '" . date('Y-m-d H:i:s', strtotime($_POST["expirationDate"])) . "' WHERE `id` = " . $objResult->fields["id"]);
}
}
$objResult = $objDatabase->Execute("SELECT `id`, `hash`, `check`, `expiration_date` FROM " . DBPREFIX . "module_filesharing WHERE `source` = '" . contrexx_raw2db($file) . "'");
$this->_objTpl->setVariable(array('FORM_ACTION' => 'index.php?cmd=Media&archive=FileSharing&act=filesharing&path=' . $_GET["path"] . '&file=' . $_GET["file"], 'FORM_METHOD' => 'POST', 'FILESHARING_INFO' => $_ARRAYLANG['TXT_FILESHARING_INFO'], 'FILESHARING_LINK_BACK_HREF' => 'index.php?cmd=Media&archive=FileSharing&path=' . $_GET["path"], 'FILESHARING_LINK_BACK' => $_ARRAYLANG['TXT_FILESHARING_LINK_BACK'], 'FILESHARING_DOWNLOAD_LINK' => $_ARRAYLANG['TXT_FILESHARING_DOWNLOAD_LINK'], 'FILE_DOWNLOAD_LINK_HREF' => FileSharingLib::getDownloadLink($objResult->fields["id"]), 'FILE_DELETE_LINK_HREF' => FileSharingLib::getDeleteLink($objResult->fields["id"]), 'FILESHARING_DELETE_LINK' => $_ARRAYLANG['TXT_FILESHARING_DELETE_LINK'], 'FILESHARING_STATUS' => $_ARRAYLANG['TXT_FILESHARING_STATUS'], 'FILESHARING_EXPIRATION' => $_ARRAYLANG['TXT_FILESHARING_EXPIRATION'], 'FILESHARING_NEVER' => $_ARRAYLANG['TXT_FILESHARING_NEVER'], 'FILESHARING_EXPIRATION_CHECKED' => htmlentities($objResult->fields["expiration_date"] == NULL ? 'checked="checked"' : '', ENT_QUOTES, CONTREXX_CHARSET), 'FILESHARING_EXPIRATION_DATE' => htmlentities($objResult->fields["expiration_date"] != NULL ? date('d.m.Y H:i', strtotime($objResult->fields["expiration_date"])) : date('d.m.Y H:i', time() + 3600 * 24 * 7), ENT_QUOTES, CONTREXX_CHARSET), 'FILESHARING_SEND_MAIL' => $_ARRAYLANG['TXT_FILESHARING_SEND_MAIL'], 'FILESHARING_EMAIL' => $_ARRAYLANG["TXT_FILESHARING_EMAIL"], 'FILESHARING_EMAIL_INFO' => $_ARRAYLANG["TXT_FILESHARING_EMAIL_INFO"], 'FILESHARING_SUBJECT' => $_ARRAYLANG["TXT_FILESHARING_SUBJECT"], 'FILESHARING_SUBJECT_INFO' => $_ARRAYLANG["TXT_FILESHARING_SUBJECT_INFO"], 'FILESHARING_MESSAGE' => $_ARRAYLANG["TXT_FILESHARING_MESSAGE"], 'FILESHARING_MESSAGE_INFO' => $_ARRAYLANG["TXT_FILESHARING_MESSAGE_INFO"], 'FILESHARING_SEND' => $_ARRAYLANG["TXT_FILESHARING_SEND"], 'FILESHARING_SAVE' => $_ARRAYLANG["TXT_FILESHARING_SAVE"], 'TXT_CORE_MAILTEMPLATE_NOTE_TO' => $_ARRAYLANG['TXT_CORE_MAILTEMPLATE_NOTE_TO']));
}
示例2: verify_account
/**
* Verifies the account data present in the session
* @param boolean $silent If true, no messages are created.
* Defaults to false
* @return boolean True if the account data is complete
* and valid, false otherwise
*/
static function verify_account($silent = false)
{
global $_ARRAYLANG;
//\DBG::log("Verify account");
$status = true;
//\DBG::log("POST: ". var_export($_POST, true));
if (isset($_POST) && !self::verifySessionAddress()) {
if ($silent) {
return false;
}
$status = \Message::error($_ARRAYLANG['TXT_FILL_OUT_ALL_REQUIRED_FIELDS']);
}
// Registered Customers are okay now
if (self::$objCustomer) {
return $status;
}
if (\Cx\Core\Setting\Controller\Setting::getValue('register', 'Shop') == ShopLibrary::REGISTER_MANDATORY || \Cx\Core\Setting\Controller\Setting::getValue('register', 'Shop') == ShopLibrary::REGISTER_OPTIONAL && empty($_SESSION['shop']['dont_register'])) {
if (isset($_SESSION['shop']['password']) && !\User::isValidPassword($_SESSION['shop']['password'])) {
if ($silent) {
return false;
}
global $objInit;
$objInit->loadLanguageData('Access');
$status = \Message::error(\Cx\Core_Modules\Access\Controller\AccessLib::getPasswordInfo());
}
} else {
// User is not trying to register, so she doesn't need a password.
// Mind that this is necessary in order to avoid passwords filled
// in automatically by the browser, which may be wrong, or
// invalid, or both.
$_SESSION['shop']['password'] = NULL;
}
if (isset($_SESSION['shop']['email']) && !\FWValidator::isEmail($_SESSION['shop']['email'])) {
if ($silent) {
return false;
}
$status = \Message::error($_ARRAYLANG['TXT_INVALID_EMAIL_ADDRESS']);
}
if (!$status) {
return false;
}
if (isset($_SESSION['shop']['email'])) {
// Ignore "unregistered" Customers. These will silently be updated
if (Customer::getUnregisteredByEmail($_SESSION['shop']['email'])) {
return true;
}
$objUser = new \User();
$objUser->setUsername($_SESSION['shop']['email']);
$objUser->setEmail($_SESSION['shop']['email']);
\Message::save();
// This method will set an error message we don't want here
// (as soon as it uses the Message class, that is)
if (!($objUser->validateUsername() && $objUser->validateEmail())) {
//\DBG::log("Shop::verify_account(): Username or e-mail in use");
\Message::restore();
$_POST['email'] = $_SESSION['shop']['email'] = NULL;
if ($silent) {
return false;
}
return \Message::error(sprintf($_ARRAYLANG['TXT_EMAIL_USED_BY_OTHER_CUSTOMER'], \Cx\Core\Routing\Url::fromModuleAndCmd('Shop', 'login') . '?redirect=' . base64_encode(\Cx\Core\Routing\Url::fromModuleAndCmd('Shop', 'account')))) || \Message::error(sprintf($_ARRAYLANG['TXT_SHOP_GOTO_SENDPASS'], \Cx\Core\Routing\Url::fromModuleAndCmd('Shop', 'sendpass')));
}
\Message::restore();
}
return $status;
}
示例3: validateUserData
/**
* Validate user input data.
*
* @access private
* @param array $arrUserData user input data from submitted form
* @return array $arrFieldsToHighlight contains all fields which need to be highlighted
*/
private function validateUserData($arrUserData)
{
global $_ARRAYLANG;
$arrFieldsToHighlight = array();
foreach ($arrUserData['numeric'] as $key => $field) {
if (!empty($field['mandatory'])) {
if (empty($field['value'])) {
$msg = $_ARRAYLANG['TXT_CHECKOUT_VALIDATION_FIELD_EMPTY'];
$msg = str_replace('{FIELD_NAME}', $field['name'], $msg);
$this->arrStatusMessages['error'][] = $msg;
$arrFieldsToHighlight[$key] = '';
continue;
}
}
if (strlen($field['value']) > $field['length']) {
$msg = $_ARRAYLANG['TXT_CHECKOUT_VALIDATION_FIELD_LENGTH_EXCEEDED'];
$msg = str_replace('{FIELD_NAME}', $field['name'], $msg);
$msg = str_replace('{MAX_LENGTH}', $field['length'], $msg);
$this->arrStatusMessages['error'][] = $msg;
$arrFieldsToHighlight[$key] = '';
continue;
}
if (!empty($field['value']) && !is_numeric($field['value'])) {
$msg = $_ARRAYLANG['TXT_CHECKOUT_VALIDATION_FIELD_NOT_NUMERIC'];
$msg = str_replace('{FIELD_NAME}', $field['name'], $msg);
$this->arrStatusMessages['error'][] = $msg;
$arrFieldsToHighlight[$key] = '';
continue;
}
if (!empty($field['value']) && $field['value'] < 1) {
$msg = $_ARRAYLANG['TXT_CHECKOUT_VALIDATION_FIELD_NOT_POSITIVE'];
$msg = str_replace('{FIELD_NAME}', $field['name'], $msg);
$this->arrStatusMessages['error'][] = $msg;
$arrFieldsToHighlight[$key] = '';
continue;
}
}
foreach ($arrUserData['text'] as $key => $field) {
if (!empty($field['mandatory'])) {
if (empty($field['value'])) {
$msg = $_ARRAYLANG['TXT_CHECKOUT_VALIDATION_FIELD_EMPTY'];
$msg = str_replace('{FIELD_NAME}', $field['name'], $msg);
$this->arrStatusMessages['error'][] = $msg;
$arrFieldsToHighlight[$key] = '';
continue;
}
}
if (strlen($field['value']) > $field['length']) {
$msg = $_ARRAYLANG['TXT_CHECKOUT_VALIDATION_FIELD_LENGTH_EXCEEDED'];
$msg = str_replace('{FIELD_NAME}', $field['name'], $msg);
$msg = str_replace('{MAX_LENGTH}', $field['length'], $msg);
$this->arrStatusMessages['error'][] = $msg;
$arrFieldsToHighlight[$key] = '';
continue;
}
}
foreach ($arrUserData['selection'] as $key => $field) {
if (!empty($field['mandatory'])) {
if (empty($field['value'])) {
$msg = $_ARRAYLANG['TXT_CHECKOUT_VALIDATION_SELECTION_EMPTY'];
$msg = str_replace('{FIELD_NAME}', $field['name'], $msg);
$this->arrStatusMessages['error'][] = $msg;
$arrFieldsToHighlight[$key] = '';
continue;
}
}
if (!empty($field['value']) && !isset($field['options'][$field['value']])) {
$msg = $_ARRAYLANG['TXT_CHECKOUT_VALIDATION_SELECTION_INVALID_OPTION'];
$msg = str_replace('{FIELD_NAME}', $field['name'], $msg);
$this->arrStatusMessages['error'][] = $msg;
$arrFieldsToHighlight[$key] = '';
continue;
}
}
foreach ($arrUserData['email'] as $key => $field) {
if (!empty($field['mandatory'])) {
if (empty($field['value'])) {
$msg = $_ARRAYLANG['TXT_CHECKOUT_VALIDATION_FIELD_EMPTY'];
$msg = str_replace('{FIELD_NAME}', $field['name'], $msg);
$this->arrStatusMessages['error'][] = $msg;
$arrFieldsToHighlight[$key] = '';
continue;
}
}
if (strlen($field['value']) > $field['length']) {
$msg = $_ARRAYLANG['TXT_CHECKOUT_VALIDATION_FIELD_LENGTH_EXCEEDED'];
$msg = str_replace('{FIELD_NAME}', $field['name'], $msg);
$msg = str_replace('{MAX_LENGTH}', $field['length'], $msg);
$this->arrStatusMessages['error'][] = $msg;
$arrFieldsToHighlight[$key] = '';
continue;
}
if (!empty($field['value']) && !\FWValidator::isEmail($field['value'])) {
//.........这里部分代码省略.........
示例4: ValidateAddress
/**
* Check that a string looks roughly like an email address should
* Static so it can be used without instantiation
* Tries to use PHP built-in validator in the filter extension (from PHP 5.2), falls back to a reasonably competent regex validator
* Conforms approximately to RFC2822
* @link http://www.hexillion.com/samples/#Regex Original pattern found here
* @param string $address The email address to check
* @return boolean
* @static
* @access public
*/
public static function ValidateAddress($address)
{
return FWValidator::isEmail($address);
/* if (function_exists('filter_var')) { //Introduced in PHP 5.2 */
/* if(filter_var($address, FILTER_VALIDATE_EMAIL) === FALSE) { */
/* return false; */
/* } else { */
/* return true; */
/* } */
/* } else { */
/* return preg_match('/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!\.)){0,61}[a-zA-Z0-9_-]?\.)+[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!$)){0,61}[a-zA-Z0-9_]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/', $address); */
/* } */
}
示例5: checkAccountId
/**
* check the account id
*
* @global object $objFWUser
*
* @return json
*/
function checkAccountId()
{
global $objFWUser;
$accountId = isset($_GET['id']) ? (int) $_GET['id'] : '';
$accountEmail = isset($_GET['email']) ? trim($_GET['email']) : '';
$show = !empty($accountId) || !empty($accountEmail) ? true : false;
if (!empty($accountId)) {
$objUsers = $objFWUser->objUser->getUsers($filter = array('id' => intval($accountId)));
if ($objUsers) {
$email = $objUsers->getEmail();
}
}
if (empty($accountId) && !empty($accountEmail) && \FWValidator::isEmail($accountEmail)) {
$objFWUser = \FWUser::getFWUserObject();
$objUsers = $objFWUser->objUser->getUsers($filter = array('email' => addslashes($accountEmail)));
if ($objUsers) {
$id = $objUsers->getId();
$email = $objUsers->getEmail();
$company = trim($objUsers->getProfileAttribute('company'));
$lastname = trim($objUsers->getProfileAttribute('lastname'));
$firstname = trim($objUsers->getProfileAttribute('firstname'));
$defaultUser = !empty($company) ? trim($company . ', ' . $firstname . ' ' . $lastname) : trim($firstname . ' ' . $lastname);
$setDefaultUser = !empty($defaultUser) ? $defaultUser : 'unknown';
} else {
$sendLoginCheck = true;
$email = $accountEmail;
}
} else {
$email = $accountEmail;
}
$json[] = array('show' => $show, 'id' => $id, 'email' => $email, 'sendLoginCheck' => $sendLoginCheck, 'setDefaultUser' => $setDefaultUser);
echo json_encode($json);
exit;
}
示例6: isValidUsername
/**
* Returns true if the given $username is valid
*
* @param string $username
*
* @return boolean
*/
protected function isValidUsername($username)
{
if (preg_match('/^[a-zA-Z0-9-_]+$/', $username)) {
return true;
}
if (\FWValidator::isEmail($username)) {
return true;
}
return false;
}
示例7: isEmail
/**
* Validate the email
*
* @param string $string
* @return boolean result
*/
function isEmail($string)
{
return \FWValidator::isEmail($string);
}
示例8: intval
/**
* Update guestbook
*
* @global ADONewConnection
* @global array
*/
function _update()
{
global $objDatabase, $_ARRAYLANG;
$guestbookId = intval($_GET['id']);
$error = "";
if (!empty($guestbookId)) {
$forename = contrexx_addslashes(strip_tags($_POST['forename']));
$name = contrexx_addslashes(strip_tags($_POST['name']));
$gender = contrexx_addslashes(strip_tags($_POST['malefemale']));
$mail = isset($_POST['email']) ? contrexx_addslashes(strip_tags($_POST['email'])) : '';
$url = isset($_POST['url']) && strlen($_POST['url']) > 7 ? contrexx_addslashes(strip_tags($_POST['url'])) : "";
$comment = contrexx_addslashes(strip_tags($_POST['comment']));
$location = contrexx_addslashes(strip_tags($_POST['location']));
$ip = contrexx_addslashes(strip_tags($_POST['ip']));
$date = contrexx_addslashes(strip_tags($_POST['datetime']));
$objValidator = new \FWValidator();
if (!empty($url)) {
if (!$this->isUrl($url)) {
$error .= $_ARRAYLANG['TXT_INVALID_INTERNET_ADDRESS'] . "<br />";
}
}
if (!$objValidator->isEmail($mail)) {
$error .= $_ARRAYLANG['TXT_INVALID_EMAIL_ADDRESS'] . "<br />";
}
if (!empty($forename) && !empty($name)) {
$query = "UPDATE " . DBPREFIX . "module_guestbook\n SET forename='{$forename}',\n name='{$name}',\n gender='{$gender}',\n email='{$mail}',\n url='{$url}',\n comment='{$comment}',\n location='{$location}',\n ip='{$ip}',\n datetime='{$date}',\n lang_id='{$this->langId}'\n WHERE id={$guestbookId}";
$objDatabase->Execute($query);
}
}
if (empty($error)) {
$this->strOkMessage = $_ARRAYLANG['TXT_DATA_RECORD_UPDATED_SUCCESSFUL'];
} else {
$this->strErrMessage = $error;
}
}
示例9: import_csv
/**
* Import Users from a CSV file
*
* Sets up common User and Profile fields as well as
* Newsletter list relations.
* Fields and their mapping:
* Anrede -> Titel
* Vorname
* Name
* eMail
* Firma
* Strasse -> Zusammen mit Hausnummer in Adresse
* Hausnummer -> Zusammen mit Strasse in Adresse
* PLZ
* Ort
* Land
* Bundesland -> Evtl in Ort?
* Tel.-Vorwahl -> Zusammen mit Tel.-Nummer in phone_office
* Tel.-Nummer -> Zusammen mit Tel.-Vorwahl in phone_office
* Fax-Vorwahl -> Zusammen mit Fax.-Nummer in phone_fax
* Fax-Nummer -> Zusammen mit Fax.-Vorwahl in phone_fax
* Mobil-Vorwahl -> Zusammen mit Mobil-Nummer in phone_mobile
* Mobil-Nummer -> Zusammen mit Mobil-Vorwahl in phone_mobile
* P1 -> Interessen: Newsletter Listen, kommagetrennt
* -> Nicht vorhandene Listen werden angelegt
* P2 -> Antwort: ?
* P3 -> ?
* P4 -> Titel: ?
* P5 -> ?
* Ursprungsformular -> ?
* Permission -> ?
* Ausgetragen -> Wenn true, alle Listenzuordnungen entfernen, sonst fehlende anlegen
* Anzahl Hard-Bounces -> Nicht vorhanden?
* Status -> Bedeutung?
* Sprache -> Wird die verwendet?
* ID -> Bedeutung?
* Eintragungsdatum -> regdate
* Aenderungsdatum -> ? (Nur regdate)
* Austragungsdatum -> ? (Nur regdate)
* @param string $file_name The CSV file name
*/
static function import_csv($file_name)
{
global $_ARRAYLANG;
\Env::get('ClassLoader')->loadFile(ASCMS_LIBRARY_PATH . '/importexport/lib/csv.class.php');
//DBG::activate(DBG_ADODB_ERROR|DBG_LOG_FIREPHP|DBG_PHP);
$objUser = \FWUser::getFWUserObject()->objUser;
$objCsv = new \CsvLib();
$arrCsv = $objCsv->parse($file_name);
// $arrFields = $arrCsv['fieldnames'];
$arrUsers = $arrCsv['data'];
//DBG::log("Found ".count($arrUsers)." Users in the CSV file");
foreach ($arrUsers as $arrUser) {
//echo(var_export($arrUser, true)."<br />");// var_export($objUser, true)."<hr />"
$email = $arrUser['3'];
//DBG::log("Found e-mail $email");
if (!\FWValidator::isEmail($email)) {
self::$arrStatusMsg['error'][] = sprintf($_ARRAYLANG['TXT_ACCESS_IMPORT_MESSAGE_TEMPLATE'], $email, $_ARRAYLANG['TXT_ACCESS_IMPORT_ERROR_INVALID_EMAIL']);
continue;
}
// TODO: I suppose that the imported file is ISO-8859-1 or so
$title = utf8_encode($arrUser[0]);
$gender = preg_match('//', $title) ? 'gender_male' : 'gender_female';
$firstname = utf8_encode($arrUser[1]);
$lastname = utf8_encode($arrUser[2]);
$company = utf8_encode($arrUser[4]);
$address = utf8_encode($arrUser[5]) . ' ' . utf8_encode($arrUser[6]);
$zip = utf8_encode($arrUser[7]);
$city = utf8_encode($arrUser[8]);
$country = utf8_encode($arrUser[9]);
$state = utf8_encode($arrUser[10]);
if ($state) {
$city .= ", {$state}";
}
$phone_office = utf8_encode($arrUser[11]) . ' ' . utf8_encode($arrUser[12]);
$phone_fax = utf8_encode($arrUser[13]) . ' ' . utf8_encode($arrUser[14]);
$phone_mobile = utf8_encode($arrUser[15]) . ' ' . utf8_encode($arrUser[16]);
$p1_lists = utf8_encode($arrUser[17]);
$unsubscribed = utf8_encode($arrUser[24]);
$language = utf8_encode($arrUser[27]);
// These are all unused for the time being
// $p2_answer = $arrUser[18];
// $p3 = $arrUser[19];
// $p4_title = $arrUser[20];
// $p5 = $arrUser[21];
// $source = $arrUser[22];
// $permission = $arrUser[23];
// $bounces = $arrUser[25];
// $status = $arrUser[26];
// $id = $arrUser[28];
// $date_subscribed = $arrUser[29];
// $date_changed = $arrUser[30];
// $date_unsubscribe = $arrUser[31];
$objUser = new \User();
$objUser = $objUser->getUsers(array('email' => array($email)));
$new_user = false;
if (!$objUser) {
$new_user = true;
$objUser = new \User();
$objUser->setUsername(\User::makeUsername($lastname, $firstname));
//.........这里部分代码省略.........
示例10: votingShowCurrent
/**
* Show current voting
*/
function votingShowCurrent($page_content)
{
global $objDatabase, $_CONFIG, $_ARRAYLANG, $_COOKIE;
$paging = '';
$objTpl = new \Cx\Core\Html\Sigma('.');
\Cx\Core\Csrf\Controller\Csrf::add_placeholder($objTpl);
$objTpl->setErrorHandling(PEAR_ERROR_DIE);
$objTpl->setTemplate($page_content);
if (!isset($_GET['vid'])) {
$_GET['vid'] = '';
}
if (!isset($_POST['votingemail'])) {
$_POST['votingemail'] = '';
}
$votingId = intval($_GET['vid']);
$msg = '';
$voted = false;
if ($_POST["votingoption"]) {
$voteId = intval($_POST["votingoption"]);
$query = "SELECT voting_system_id from " . DBPREFIX . "voting_results WHERE id=" . $voteId;
$objResult = $objDatabase->SelectLimit($query, 1);
if (!$objResult->EOF) {
$votingId = $objResult->fields["voting_system_id"];
}
$objVoting = $objDatabase->SelectLimit("SELECT submit_check FROM `" . DBPREFIX . "voting_system` WHERE `id`=" . $votingId, 1);
if ($objVoting !== false && $objVoting->RecordCount() == 1) {
if ($objVoting->fields['submit_check'] == 'email') {
$email = contrexx_addslashes($_POST['votingemail']);
$objValidator = new \FWValidator();
if ($objValidator->isEmail($email)) {
if (!_alreadyVotedWithEmail($votingId, $email)) {
if (($msg = VotingSubmitEmail($votingId, $voteId, $email)) === true) {
$msg = '';
$voted = true;
} else {
$msg = $_ARRAYLANG['TXT_VOTING_NONEXISTENT_EMAIL'] . '<br /><br />';
}
} else {
$msg = $_ARRAYLANG['TXT_VOTING_ALREADY_VOTED'] . '<br /><br />';
}
} else {
$msg = $_ARRAYLANG['TXT_VOTING_INVALID_EMAIL_ERROR'] . '<br /><br />';
}
} else {
VotingSubmit();
$voted = true;
}
}
}
if ($_GET['vid'] != '' && $_GET['act'] != 'delete') {
$query = "SELECT\n\t\t\tid, status,\n\t\t\tdate as datesec, question,\n\t\t\tvotes, submit_check,\n\t\t\tadditional_nickname, additional_forename,\n\t\t\tadditional_surname, additional_phone,\n\t\t\tadditional_street, additional_zip,\n additional_city, additional_email,\n additional_comment\n\n\t\t\tFROM " . DBPREFIX . "voting_system where id=" . intval($_GET['vid']);
} else {
$query = "SELECT\n\t\t\tid, status,\n\t\t\tdate as datesec, question,\n\t\t\tvotes, submit_check,\n\t\t\tadditional_nickname, additional_forename,\n\t\t\tadditional_surname, additional_phone,\n\t\t\tadditional_street, additional_zip,\n\t\t \tadditional_city, additional_email,\n additional_comment\n\n\t\t\tFROM " . DBPREFIX . "voting_system where status=1";
}
$objResult = $objDatabase->Execute($query);
if ($objResult->RecordCount() == 0) {
// Only show old records when no voting is set available
$objTpl->setVariable(array('VOTING_TITLE' => $_ARRAYLANG['TXT_VOTING_NOT_AVAILABLE'], 'VOTING_DATE' => '', 'VOTING_OLDER_TEXT' => '', 'VOTING_OLDER_DATE' => '', 'VOTING_PAGING' => '', 'TXT_DATE' => '', 'TXT_TITLE' => '', 'VOTING_RESULTS_TEXT' => '', 'VOTING_RESULTS_TOTAL_VOTES' => '', 'VOTING_OLDER_TITLE' => $_ARRAYLANG['TXT_VOTING_OLDER'], 'TXT_SUBMIT' => ''));
/** start paging **/
$query = "SELECT id, date as datesec, title, votes FROM " . DBPREFIX . "voting_system order by id desc";
$objResult = $objDatabase->SelectLimit($query, 5);
$count = $objResult->RecordCount();
$pos = intval($_GET[pos]);
if ($count > intval($_CONFIG['corePagingLimit'])) {
$paging = getPaging($count, $pos, "§ion=Voting", "<b>" . $_ARRAYLANG['TXT_VOTING_ENTRIES'] . "</b>", true);
}
/** end paging **/
$query = "SELECT id, date as datesec, title, votes FROM " . DBPREFIX . "voting_system order by id desc ";
$objResult = $objDatabase->SelectLimit($query, $_CONFIG['corePagingLimit'], $pos);
while (!$objResult->EOF) {
$votingid = $objResult->fields['id'];
$votingTitle = stripslashes($objResult->fields['title']);
$votingVotes = $objResult->fields['votes'];
$votingDate = strtotime($objResult->fields['datesec']);
if ($i % 2 == 0) {
$class = "row2";
} else {
$class = "row1";
}
$objTpl->setVariable(array('VOTING_OLDER_TEXT' => '<a href="index.php?section=Voting&vid=' . $votingid . '" title="' . $votingTitle . '">' . $votingTitle . '</a>', 'VOTING_OLDER_DATE' => showFormattedDate($votingDate), 'VOTING_VOTING_ID' => $votingid, 'VOTING_LIST_CLASS' => $class, 'VOTING_PAGING' => $paging));
$objTpl->parse("votingRow");
$i++;
$objResult->MoveNext();
}
} else {
if (!$objResult->EOF) {
$votingId = $objResult->fields['id'];
$votingTitle = stripslashes($objResult->fields['question']);
$votingVotes = $objResult->fields['votes'];
$votingDate = strtotime($objResult->fields['datesec']);
$votingStatus = $objResult->fields['status'];
$votingMethod = $objResult->fields['submit_check'];
$additional_fields = _create_additional_input_fields($objResult);
$objResult->MoveNext();
} else {
errorHandling();
return false;
//.........这里部分代码省略.........
示例11: validateSenderMail
function validateSenderMail()
{
global $_CORELANG;
$objValidator = new FWValidator();
if ($objValidator->isEmail($this->sender_mail)) {
return true;
} else {
$this->error_msg[] = $_CORELANG['TXT_ACCESS_INVALID_SENDER_ADDRESS'];
return false;
}
}
示例12: FWValidator
/**
* function handling protected link requests
* @return void
*/
function _getPDF()
{
global $objDatabase, $_ARRAYLANG, $_CONFIG;
$objValidator = new FWValidator();
$ids = explode('_', $_GET['id']);
$immoID = intval($ids[0]);
$fieldID = intval($ids[1]);
if (isset($_POST['immo_id'])) {
//form was sent
$name = !empty($_POST['name']) ? contrexx_addslashes(strip_tags($_POST['name'])) : '';
$firstname = !empty($_POST['firstname']) ? contrexx_addslashes(strip_tags($_POST['firstname'])) : '';
$company = !empty($_POST['company']) ? contrexx_addslashes(strip_tags($_POST['company'])) : '';
$street = !empty($_POST['street']) ? contrexx_addslashes(strip_tags($_POST['street'])) : '';
$zip = !empty($_POST['zip']) ? intval($_POST['zip']) : '';
$location = !empty($_POST['location']) ? contrexx_addslashes(strip_tags($_POST['location'])) : '';
$telephone = !empty($_POST['telephone']) ? contrexx_addslashes(strip_tags($_POST['telephone'])) : '';
$telephone_office = !empty($_POST['telephone_office']) ? contrexx_addslashes(strip_tags($_POST['telephone_office'])) : '';
$telephone_mobile = !empty($_POST['telephone_mobile']) ? contrexx_addslashes(strip_tags($_POST['telephone_mobile'])) : '';
$purchase = isset($_POST['purchase']) ? 1 : 0;
$funding = isset($_POST['funding']) ? 1 : 0;
$email = !empty($_POST['email']) ? contrexx_addslashes(strip_tags($_POST['email'])) : '';
$comment = !empty($_POST['comment']) ? contrexx_addslashes(strip_tags($_POST['comment'])) : '';
$immoID = !empty($_POST['immo_id']) ? intval($_POST['immo_id']) : '';
$fieldID = !empty($_POST['field_id']) ? intval($_POST['field_id']) : '';
$error = 0;
if ($objValidator->isEmail($email)) {
if (!empty($name) && !empty($telephone) && !empty($email) && $immoID > 0 && $fieldID > 0) {
require_once ASCMS_LIBRARY_PATH . DS . '/phpmailer' . DS . "class.phpmailer.php";
$objRS = $objDatabase->SelectLimit("SELECT email\n FROM " . DBPREFIX . "module_immo_contact\n WHERE immo_id = '{$immoID}'\n AND email = '{$email}'\n AND timestamp > " . (mktime() - 600), 1);
if ($objRS->RecordCount() > 0) {
$this->_objTpl->setVariable('TXT_IMMO_STATUS', '<span class="errmsg">' . $_ARRAYLANG['TXT_IMMO_ALREADY_SENT_RECENTLY'] . '</span>');
$this->_showContactForm($immoID, $fieldID);
return false;
}
$objRS = $objDatabase->SelectLimit("SELECT fieldvalue\n FROM " . DBPREFIX . "module_immo_content\n WHERE immo_id = '{$immoID}'\n AND field_id = '{$fieldID}'\n AND lang_id = '" . $this->frontLang . "'", 1);
if ($objRS) {
$link = 'http://' . $_CONFIG['domainUrl'] . str_replace(" ", "%20", $objRS->fields['fieldvalue']);
$mailer = new PHPMailer();
$objDatabase->Execute("INSERT INTO " . DBPREFIX . "module_immo_contact\n VALUES\n (NULL, '{$email}', '{$name}', '{$firstname}', '{$street}', '{$zip}', '{$location}', '{$company}', '{$telephone}', '{$telephone_office}', '{$telephone_mobile}', '{$purchase}', '{$funding}', '{$comment}', '{$immoID}', '{$fieldID}', " . mktime() . " )");
$mailer->CharSet = CONTREXX_CHARSET;
$mailer->IsHTML(false);
$mailer->SetFrom($this->arrSettings['sender_email'], $this->arrSettings['sender_name']);
$mailer->Subject = $this->arrSettings['prot_link_message_subject'];
$mailer->Body = str_replace('[[IMMO_PROTECTED_LINK]]', $link, $this->arrSettings['prot_link_message_body']) . "\n\n";
$mailer->AddAddress($email);
$mailer->Send();
} else {
$this->_objTpl->setVariable('TXT_IMMO_STATUS', '<span class="errmsg">DB error.</span>');
}
} else {
$error = 1;
}
} else {
$error = 1;
}
if ($error == 1) {
$this->_objTpl->setVariable('TXT_IMMO_STATUS', '<span class="errmsg">' . $_ARRAYLANG['TXT_IMMO_MISSIONG_OR_INVALID_FIELDS'] . '</span>');
} else {
$this->_objTpl->setVariable('TXT_IMMO_STATUS', '<span class="okmsg">' . $_ARRAYLANG['TXT_IMMO_CONTACT_SUCCESSFUL'] . '</span>');
}
}
// else { //form was not sent }
return $this->_showContactForm($immoID, $fieldID);
}
示例13: addComment
/**
* Insert a new comment for a message into database, if the function is activated. Furthermore, all input values are validated.
* Sends also the notification mail to the administrator, if it is enabled in options.
*
* @global ADONewConnection
* @global array
* @global array
*/
function addComment()
{
global $objDatabase, $_ARRAYLANG, $_CONFIG;
\Cx\Core\Csrf\Controller\Csrf::check_code();
$this->initUserId();
//Check for activated function
if (!$this->_arrSettings['blog_comments_activated']) {
$this->_strErrorMessage = $_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_INSERT_ERROR_ACTIVATED'];
return;
}
if ($this->hasUserJustCommented()) {
$this->_strErrorMessage = str_replace('[SECONDS]', intval($this->_arrSettings['blog_comments_timeout']), $_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_INSERT_ERROR_TIMEOUT']);
return;
}
//Create validator-object
$objValidator = new \FWValidator();
//Get general-input
$intMessageId = intval($_POST['frmAddComment_MessageId']);
$strSubject = contrexx_addslashes(strip_tags($_POST['frmAddComment_Subject']));
$strComment = \Cx\Core\Wysiwyg\Wysiwyg::prepareBBCodeForDb($_POST['frmAddComment_Comment']);
//Get specified-input
if ($this->_intCurrentUserId == 0) {
$intUserId = 0;
$strName = contrexx_addslashes(strip_tags($_POST['frmAddComment_Name']));
$strEMail = contrexx_addslashes(strip_tags($_POST['frmAddComment_EMail']));
$strWWW = contrexx_addslashes(strip_tags($objValidator->getUrl($_POST['frmAddComment_WWW'])));
} else {
$intUserId = $this->_intCurrentUserId;
$strName = '';
$strEMail = '';
$strWWW = '';
}
//Get options
$intIsActive = intval($this->_arrSettings['blog_comments_autoactivate']);
$intIsNotification = intval($this->_arrSettings['blog_comments_notification']);
//Validate general-input
if ($intMessageId <= 0) {
$this->_strErrorMessage .= $this->getFormError($_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_INSERT_MID']);
}
if (empty($strSubject)) {
$this->_strErrorMessage .= $this->getFormError($_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_ADD_SUBJECT']);
}
if (empty($strComment)) {
$this->_strErrorMessage .= $this->getFormError($_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_ADD_COMMENT']);
}
//Validate specified-input
if ($this->_intCurrentUserId == 0) {
if (empty($strName)) {
$this->_strErrorMessage .= $this->getFormError($_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_ADD_NAME']);
}
if (!$objValidator->isEmail($strEMail)) {
$this->_strErrorMessage .= $this->getFormError($_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_ADD_EMAIL']);
}
}
$captchaCheck = true;
if (!\FWUser::getFWUserObject()->objUser->login() && !\Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->check()) {
$captchaCheck = false;
}
//Now check error-string
if (empty($this->_strErrorMessage) && $captchaCheck) {
//No errors, insert entry
$objDatabase->Execute(' INSERT INTO ' . DBPREFIX . 'module_blog_comments
SET message_id = ' . $intMessageId . ',
lang_id = ' . $this->_intLanguageId . ',
is_active = "' . $intIsActive . '",
time_created = ' . time() . ',
ip_address = "' . $_SERVER['REMOTE_ADDR'] . '",
user_id = ' . $intUserId . ',
user_name = "' . $strName . '",
user_mail = "' . $strEMail . '",
user_www = "' . $strWWW . '",
subject = "' . $strSubject . '",
comment = "' . $strComment . '"
');
//Set a cookie with the current timestamp. Avoids flooding.
setcookie('BlogCommentLast', time(), 0, ASCMS_PATH_OFFSET . '/');
$this->_strStatusMessage = $_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_INSERT_SUCCESS'];
$this->writeCommentRSS();
if ($intIsNotification) {
//Send notification to administrator
if (\Env::get('ClassLoader')->loadFile(ASCMS_LIBRARY_PATH . '/phpmailer/class.phpmailer.php')) {
$objMail = new \phpmailer();
if ($_CONFIG['coreSmtpServer'] > 0) {
if (($arrSmtp = \SmtpSettings::getSmtpAccount($_CONFIG['coreSmtpServer'])) !== false) {
$objMail->IsSMTP();
$objMail->Host = $arrSmtp['hostname'];
$objMail->Port = $arrSmtp['port'];
$objMail->SMTPAuth = true;
$objMail->Username = $arrSmtp['username'];
$objMail->Password = $arrSmtp['password'];
}
}
//.........这里部分代码省略.........
示例14: verifyParameter
/**
* Verifies a name/value pair
*
* May change the value before returning it.
* Use the value returned when adding to the form in any case.
* @access private
* @param string $name The name of the parameter
* @param string $value The value of the parameter
* @return boolean The verified value on success,
* null otherwise
*/
static function verifyParameter($name, $value)
{
switch ($name) {
// Mandatory
case 'ORDERID':
if ($value) {
return $value;
}
break;
case 'AMOUNT':
// Fix cents, like "1.23" to "123"
if (preg_match('/\\./', $value)) {
$value = intval($value * 100);
}
if ($value === intval($value)) {
return $value;
}
break;
case 'CURRENCY':
if (preg_match('/^\\w{3}$/', $value)) {
return $value;
}
break;
case 'PSPID':
if (preg_match('/.+/', $value)) {
return $value;
}
break;
// The above four are needed to form the hash:
// The above four are needed to form the hash:
case 'SHASIGN':
// 40 digit hexadecimal string, like
// 4d0a445beac3561528dc26023e9ecb2d38fadc61
if (preg_match('/^[0-9a-f]{40}$/i', $value)) {
return $value;
}
case 'LANGUAGE':
if (preg_match('/^\\w{2}(?:_\\w{2})?$/', $value)) {
return $value;
}
break;
case 'OPERATION':
if ($value == 'RES' || $value == 'SAL') {
return $value;
}
break;
case 'ACCEPTURL':
case 'DECLINEURL':
case 'EXCEPTIONURL':
case 'CANCELURL':
case 'BACKURL':
// if (FWValidator::isUri($value)) return $value;
// *SHOULD* verify the URIs, but the expression is not fit
if ($value) {
return $value;
}
break;
// Optional
// optional customer details, highly recommended for fraud prevention: see chapter 5.2
// Optional
// optional customer details, highly recommended for fraud prevention: see chapter 5.2
case 'CN':
case 'OWNERADDRESS':
case 'OWNERCTY':
case 'OWNERZIP':
case 'OWNERTOWN':
case 'OWNERTELNO':
case 'COM':
if (preg_match('/.*/', $value)) {
return $value;
}
break;
case 'EMAIL':
if (FWValidator::isEmail($value)) {
return $value;
}
break;
case 'PMLIST':
if (preg_match('/.*/', $value)) {
return $value;
}
break;
case 'WIN3DS':
if ($value == 'MAINW' || ($value = 'POPUP')) {
return $value;
}
break;
// post payment parameters: see chapter 8.2
// post payment parameters: see chapter 8.2
//.........这里部分代码省略.........
示例15: checkInput
/**
* checks input
*/
function checkInput()
{
global $_ARRAYLANG;
$objValidator = new \FWValidator();
$captchaCheck = true;
$_POST['forename'] = strip_tags(contrexx_stripslashes($_POST['forename']));
$_POST['name'] = strip_tags(contrexx_stripslashes($_POST['name']));
$_POST['comment'] = htmlentities(strip_tags(contrexx_stripslashes($_POST['comment'])), ENT_QUOTES, CONTREXX_CHARSET);
$_POST['location'] = strip_tags(contrexx_stripslashes($_POST['location']));
$_POST['email'] = strip_tags(contrexx_stripslashes($_POST['email']));
$_POST['url'] = strip_tags(contrexx_stripslashes($_POST['url']));
if (!\FWUser::getFWUserObject()->objUser->login() && !\Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->check()) {
$captchaCheck = false;
}
if (empty($_POST['name']) || empty($_POST['forename'])) {
$this->makeError($_ARRAYLANG['TXT_NAME']);
}
if (empty($_POST['comment'])) {
$this->makeError($_ARRAYLANG['TXT_COMMENT']);
}
if (empty($_POST['malefemale'])) {
$this->makeError($_ARRAYLANG['TXT_SEX']);
}
if (empty($_POST['location'])) {
$this->makeError($_ARRAYLANG['TXT_LOCATION']);
}
if (!$objValidator->isEmail($_POST['email'])) {
$this->makeError($_ARRAYLANG['TXT_EMAIL']);
}
if (empty($this->error) && $captchaCheck) {
return true;
} else {
return false;
}
}