本文整理汇总了PHP中contrexx_stripslashes函数的典型用法代码示例。如果您正苦于以下问题:PHP contrexx_stripslashes函数的具体用法?PHP contrexx_stripslashes怎么用?PHP contrexx_stripslashes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了contrexx_stripslashes函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseResults
/**
* Parse query results
*
* Loop through the query results and assign them to the
* result array. $cb is the reference function which is to be
* called to generate a proper URI.
* @param object $rs
* @param reference $cb
*/
private function parseResults($rs, $cb)
{
while (!$rs->EOF) {
$this->results[] = array("uri" => $this->{$cb}($rs->fields['id']), "title" => contrexx_stripslashes($rs->fields['title']), "id" => contrexx_stripslashes($rs->fields['id']));
$rs->MoveNext();
}
}
示例2: __construct
/**
* Constructor
*
* Gets the options
*/
function __construct()
{
if (!isset($_POST['import_options_csv_separator'])) {
return false;
}
$this->separator = contrexx_stripslashes($_POST['import_options_csv_separator']);
if ($this->separator == '\\t') {
$this->separator = "\t";
}
if (strlen($_POST['import_options']) == 1) {
$this->enclosure = $_POST['import_options_csv_enclosure'];
}
}
示例3: showImport
function showImport($step, $objTpl)
{
global $_ARRAYLANG, $_CORELANG, $_LANGID, $objDatabase;
$objTpl->addBlockfile($this->moduleLangVar . '_INTERFACES_CONTENT', 'interfaces_content', 'module_' . $this->moduleNameLC . '_interfaces_import.html');
$objTpl->setVariable(array('TXT_' . $this->moduleLangVar . '_FROM_DATABASE' => $_ARRAYLANG['TXT_MEDIADIR_FROM_DATABASE'], 'TXT_' . $this->moduleLangVar . '_FROM_FILE' => $_ARRAYLANG['TXT_MEDIADIR_FROM_FILE']));
switch ($step) {
case 'assignCols':
$objTpl->hideBlock($this->moduleNameLC . 'InterfacesImportSqlSetTable');
$tableName = contrexx_stripslashes($_POST['interfacesImportSqlTable']);
$formId = intval($_POST['interfacesImportSqlForm']);
$formId = 15;
$categoryId = intval($_POST['interfacesImportSqlCategory']);
$categoryId = 162;
$objResult = $objDatabase->Execute('SHOW FIELDS FROM ' . $tableName);
while (!$objResult->EOF) {
$avaiableCols .= '<option value="' . $objResult->fields['Field'] . '">' . $objResult->fields['Field'] . '</option>';
$objResult->MoveNext();
}
$objInputfield = new MediaDirectoryInputfield($formId, false, null, $this->moduleName);
foreach ($objInputfield->arrInputfields as $key => $inputfield) {
if ($key != 1 && $key != 2) {
$givenCols .= '<option value="' . $inputfield['id'] . '">' . $inputfield['name'][0] . '</option>';
}
}
$objTpl->setVariable(array($this->moduleLangVar . '_INTERFACES_IMPORT_SQL_TABLE_COLS' => $avaiableCols, $this->moduleLangVar . '_INTERFACES_IMPORT_SQL_GIVEN_COLS' => $givenCols, $this->moduleLangVar . '_INTERFACES_IMPORT_SQL_TABLE_NANE' => $tableName, $this->moduleLangVar . '_INTERFACES_IMPORT_SQL_FORM_ID' => $formId, $this->moduleLangVar . '_INTERFACES_IMPORT_SQL_CATEGORY_ID' => $categoryId));
$objTpl->parse($this->moduleNameLC . 'InterfacesImportSqlAssignCols');
break;
default:
$objTpl->hideBlock($this->moduleNameLC . 'InterfacesImportSqlAssignCols');
$objResult = $objDatabase->Execute('SHOW TABLE STATUS LIKE "%"');
while (!$objResult->EOF) {
$dbName = $objResult->fields['Name'];
$avaiableTables .= '<option value="' . $dbName . '">' . $dbName . '</option>';
$objResult->MoveNext();
}
$objTpl->setVariable(array($this->moduleLangVar . '_INTERFACES_IMPORT_SQL_TABLES' => $avaiableTables));
$objTpl->parse($this->moduleNameLC . 'InterfacesImportSqlSetTable');
break;
}
$objTpl->parse('interfaces_content');
}
示例4: getPage
/**
* Reads $_GET['cmd'] and selects (depending on the value) an action
*/
function getPage()
{
if (isset($_GET['act'])) {
if ($_GET['act'] == "shadowbox") {
$this->shadowbox();
}
}
if (!isset($_GET['cmd'])) {
$_GET['cmd'] = '';
} else {
$this->curCmd = $_GET['cmd'];
}
if (isset($_GET['cid'])) {
$this->showCategory($_GET['cid']);
} elseif (isset($_GET['id'])) {
$this->showDetails($_GET['id']);
} elseif ($this->curCmd == 'search') {
$this->showSearch(isset($_POST['term']) ? contrexx_stripslashes($_POST['term']) : '');
} else {
$this->showCategoryOverview();
}
return $this->_objTpl->get();
}
示例5: handleRequest
/**
* @override
*/
public function handleRequest()
{
// Get parameters
$chunk = $_POST['partitionIndex'];
$chunks = $_POST['partitionCount'];
$fileName = contrexx_stripslashes($_FILES['file']['name']);
$fileCount = $_GET['files'];
// check if the file has a valid file extension
if (\FWValidator::is_file_ending_harmless($fileName)) {
try {
$this->addChunk($fileName, $chunk, $chunks);
} catch (UploaderException $e) {
die('Error:' . $e->getMessage());
}
if ($chunk == $chunks - 1) {
//upload of current file finished
$this->handleCallback($fileCount);
}
} else {
$this->addHarmfulFileToResponse($fileName);
}
die(0);
}
示例6: processCreateDirectory
private function processCreateDirectory($objCategory)
{
if (empty($_POST['downloads_category_name'])) {
return;
} else {
$name = contrexx_stripslashes($_POST['downloads_category_name']);
}
\Cx\Core\Csrf\Controller\Csrf::check_code();
// check for sufficient permissiosn
if ($objCategory->getAddSubcategoriesAccessId() && !\Permission::checkAccess($objCategory->getAddSubcategoriesAccessId(), 'dynamic', true) && $objCategory->getOwnerId() != $this->userId) {
return;
}
// parse name and description attributres
$arrLanguageIds = array_keys(\FWLanguage::getLanguageArray());
foreach ($arrLanguageIds as $langId) {
$arrNames[$langId] = $name;
$arrDescriptions[$langId] = '';
}
$objSubcategory = new Category();
$objSubcategory->setParentId($objCategory->getId());
$objSubcategory->setActiveStatus(true);
$objSubcategory->setVisibility($objCategory->getVisibility());
$objSubcategory->setNames($arrNames);
$objSubcategory->setDescriptions($arrDescriptions);
$objSubcategory->setPermissions(array('read' => array('protected' => (bool) $objCategory->getAddSubcategoriesAccessId(), 'groups' => array()), 'add_subcategories' => array('protected' => (bool) $objCategory->getAddSubcategoriesAccessId(), 'groups' => array()), 'manage_subcategories' => array('protected' => (bool) $objCategory->getAddSubcategoriesAccessId(), 'groups' => array()), 'add_files' => array('protected' => (bool) $objCategory->getAddSubcategoriesAccessId(), 'groups' => array()), 'manage_files' => array('protected' => (bool) $objCategory->getAddSubcategoriesAccessId(), 'groups' => array())));
//
// foreach ($this->arrPermissionTypes as $protectionType) {
// $arrCategoryPermissions[$protectionType]['protected'] = isset($_POST['downloads_category_'.$protectionType]) && $_POST['downloads_category_'.$protectionType];
// $arrCategoryPermissions[$protectionType]['groups'] = !empty($_POST['downloads_category_'.$protectionType.'_associated_groups']) ? array_map('intval', $_POST['downloads_category_'.$protectionType.'_associated_groups']) : array();
// }
//
// $objCategory->setPermissionsRecursive(!empty($_POST['downloads_category_apply_recursive']));
// $objCategory->setPermissions($arrCategoryPermissions);
if (!$objSubcategory->store()) {
$this->arrStatusMsg['error'] = array_merge($this->arrStatusMsg['error'], $objSubcategory->getErrorMsg());
}
}
示例7: _smtpModify
function _smtpModify()
{
global $objTemplate, $_ARRAYLANG;
$error = false;
$id = !empty($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
if (isset($_POST['settings_smtp_save'])) {
$arrSmtp = array('name' => !empty($_POST['settings_smtp_account']) ? contrexx_stripslashes(trim($_POST['settings_smtp_account'])) : '', 'hostname' => !empty($_POST['settings_smtp_hostname']) ? contrexx_stripslashes(trim($_POST['settings_smtp_hostname'])) : '', 'port' => !empty($_POST['settings_smtp_port']) ? intval($_POST['settings_smtp_port']) : 25, 'username' => !empty($_POST['settings_smtp_username']) ? contrexx_stripslashes(trim($_POST['settings_smtp_username'])) : '', 'password' => !empty($_POST['settings_smtp_password']) ? contrexx_stripslashes($_POST['settings_smtp_password']) : '');
if (!$arrSmtp['port']) {
$arrSmtp['port'] = 25;
}
if (empty($arrSmtp['name'])) {
$error = true;
$this->strErrMessage[] = $_ARRAYLANG['TXT_SETTINGS_EMPTY_ACCOUNT_NAME_TXT'];
} elseif (!\SmtpSettings::_isUniqueSmtpAccountName($arrSmtp['name'], $id)) {
$error = true;
$this->strErrMessage[] = sprintf($_ARRAYLANG['TXT_SETTINGS_NOT_UNIQUE_SMTP_ACCOUNT_NAME'], htmlentities($arrSmtp['name']));
}
if (empty($arrSmtp['hostname'])) {
$error = true;
$this->strErrMessage[] = $_ARRAYLANG['TXT_SETTINGS_EMPTY_SMTP_HOST_TXT'];
}
if (!$error) {
if ($id) {
if (\SmtpSettings::_updateSmtpAccount($id, $arrSmtp)) {
$this->strOkMessage .= sprintf($_ARRAYLANG['TXT_SETTINGS_SMTP_ACCOUNT_UPDATE_SUCCEED'], $arrSmtp['name']) . '<br />';
return $this->_smtpOverview();
} else {
$this->strErrMessage[] = sprintf($_ARRAYLANG['TXT_SETTINGS_SMTP_ACCOUNT_UPDATE_FAILED'], $arrSmtp['name']);
}
} else {
if (\SmtpSettings::_addSmtpAccount($arrSmtp)) {
$this->strOkMessage .= sprintf($_ARRAYLANG['TXT_SETTINGS_SMTP_ACCOUNT_ADD_SUCCEED'], $arrSmtp['name']) . '<br />';
return $this->_smtpOverview();
} else {
$this->strErrMessage[] = $_ARRAYLANG['TXT_SETTINGS_SMTP_ACCOUNT_ADD_FAILED'];
}
}
}
} else {
$arrSmtp = \SmtpSettings::getSmtpAccount($id, false);
if ($arrSmtp === false) {
$id = 0;
$arrSmtp = array('name' => '', 'hostname' => '', 'port' => 25, 'username' => '', 'password' => 0);
}
}
$objTemplate->addBlockfile('ADMIN_CONTENT', 'settings_smtp_modify', 'settings_smtp_modify.html');
$this->strPageTitle = $id ? $_ARRAYLANG['TXT_SETTINGS_MODIFY_SMTP_ACCOUNT'] : $_ARRAYLANG['TXT_SETTINGS_ADD_NEW_SMTP_ACCOUNT'];
$objTemplate->setVariable(array('TXT_SETTINGS_ACCOUNT' => $_ARRAYLANG['TXT_SETTINGS_ACCOUNT'], 'TXT_SETTINGS_NAME_OF_ACCOUNT' => $_ARRAYLANG['TXT_SETTINGS_NAME_OF_ACCOUNT'], 'TXT_SETTINGS_SMTP_SERVER' => $_ARRAYLANG['TXT_SETTINGS_SMTP_SERVER'], 'TXT_SETTINGS_HOST' => $_ARRAYLANG['TXT_SETTINGS_HOST'], 'TXT_SETTINGS_PORT' => $_ARRAYLANG['TXT_SETTINGS_PORT'], 'TXT_SETTINGS_AUTHENTICATION' => $_ARRAYLANG['TXT_SETTINGS_AUTHENTICATION'], 'TXT_SETTINGS_USERNAME' => $_ARRAYLANG['TXT_SETTINGS_USERNAME'], 'TXT_SETTINGS_PASSWORD' => $_ARRAYLANG['TXT_SETTINGS_PASSWORD'], 'TXT_SETTINGS_SMTP_AUTHENTICATION_TXT' => $_ARRAYLANG['TXT_SETTINGS_SMTP_AUTHENTICATION_TXT'], 'TXT_SETTINGS_BACK' => $_ARRAYLANG['TXT_SETTINGS_BACK'], 'TXT_SETTINGS_SAVE' => $_ARRAYLANG['TXT_SETTINGS_SAVE']));
$objTemplate->setVariable(array('SETTINGS_SMTP_TITLE' => $id ? $_ARRAYLANG['TXT_SETTINGS_MODIFY_SMTP_ACCOUNT'] : $_ARRAYLANG['TXT_SETTINGS_ADD_NEW_SMTP_ACCOUNT'], 'SETTINGS_SMTP_ID' => $id, 'SETTINGS_SMTP_ACCOUNT' => htmlentities($arrSmtp['name'], ENT_QUOTES, CONTREXX_CHARSET), 'SETTINGS_SMTP_HOST' => htmlentities($arrSmtp['hostname'], ENT_QUOTES, CONTREXX_CHARSET), 'SETTINGS_SMTP_PORT' => $arrSmtp['port'], 'SETTINGS_SMTP_USERNAME' => htmlentities($arrSmtp['username'], ENT_QUOTES, CONTREXX_CHARSET), 'SETTINGS_SMTP_PASSWORD' => str_pad('', $arrSmtp['password'], ' ')));
$objTemplate->parse('settings_smtp_modify');
return true;
}
示例8: 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;
}
}
示例9: _modifyTicker
function _modifyTicker()
{
global $_ARRAYLANG, $objDatabase;
$id = !empty($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
$pos = !empty($_REQUEST['pos']) ? intval($_REQUEST['pos']) : 0;
$defaultCharset = CONTREXX_CHARSET;
if ($arrTicker = $this->_getTicker($id)) {
$this->pageTitle = $_ARRAYLANG['TXT_NEWS_MODIFY_TICKER'];
$name = $arrTicker['name'];
$charset = $arrTicker['charset'];
$urlencode = $arrTicker['urlencode'];
$prefix = $arrTicker['prefix'];
} else {
$id = 0;
$this->pageTitle = $_ARRAYLANG['TXT_NEWS_CREATE_TICKER'];
$name = '';
$charset = $defaultCharset;
$content = '';
$urlencode = 0;
$prefix = '';
}
if (isset($_POST['news_save_ticker'])) {
$newName = isset($_POST['news_ticker_filename']) ? contrexx_stripslashes(trim($_POST['news_ticker_filename'])) : '';
$charset = isset($_POST['news_ticker_charset']) ? addslashes($_POST['news_ticker_charset']) : '';
$content = isset($_POST['news_ticker_content']) ? contrexx_stripslashes($_POST['news_ticker_content']) : '';
$urlencode = isset($_POST['news_ticker_urlencode']) ? intval($_POST['news_ticker_urlencode']) : 0;
$prefix = isset($_POST['news_ticker_prefix']) ? contrexx_stripslashes($_POST['news_ticker_prefix']) : '';
if (!empty($newName)) {
if ($name != $newName && file_exists(\Env::get('cx')->getWebsiteFeedPath() . '/' . $newName)) {
$this->strErrMessage = sprintf($_ARRAYLANG['TXT_NEWS_FILE_DOES_ALREADY_EXIST'], htmlentities($newName, ENT_QUOTES, CONTREXX_CHARSET), \Env::get('cx')->getWebsiteFeedPath()) . '<br />';
$this->strErrMessage .= $_ARRAYLANG['TXT_NEWS_SELECT_OTHER_FILENAME'];
} elseif ($name != $newName && !@touch(\Env::get('cx')->getWebsiteFeedPath() . '/' . $newName)) {
$this->strErrMessage = sprintf($_ARRAYLANG['TXT_NEWS_COULD_NOT_ATTACH_FILE'], htmlentities($newName, ENT_QUOTES, CONTREXX_CHARSET), \Env::get('cx')->getWebsiteFeedPath() . '/') . '<br />';
$this->strErrMessage .= sprintf($_ARRAYLANG['TXT_NEWS_SET_CHMOD'], \Env::get('cx')->getWebsiteFeedPath() . '/');
} else {
if ($objDatabase->Execute(($id > 0 ? "UPDATE" : "INSERT INTO") . " `" . DBPREFIX . "module_news_ticker` SET `name` = '" . addslashes($newName) . "', `charset` = '" . addslashes($charset) . "', `urlencode` = " . $urlencode . ", `prefix` = '" . addslashes($prefix) . "'" . ($id > 0 ? " WHERE `id` = " . $id : ''))) {
$objFile = new \File();
$objFile->setChmod(\Env::get('cx')->getWebsiteFeedPath(), ASCMS_FEED_WEB_PATH, $newName);
$fpTicker = @fopen(\Env::get('cx')->getWebsiteFeedPath() . '/' . $newName, 'wb');
if ($fpTicker) {
if ($defaultCharset != $charset) {
$content = iconv($defaultCharset, $charset, $content);
$prefix = iconv($defaultCharset, $charset, $prefix);
}
$content2w = $prefix . ($urlencode ? rawurlencode($content) : $content);
if (@fwrite($fpTicker, $content2w) !== false) {
$this->strOkMessage = $_ARRAYLANG['TXT_NEWS_NEWSTICKER_SUCCESSFULLY_UPDATED'];
if ($name != $newName && file_exists(\Env::get('cx')->getWebsiteFeedPath() . '/' . $name)) {
@unlink(\Env::get('cx')->getWebsiteFeedPath() . '/' . $name);
}
return $this->_tickerOverview();
} else {
$this->strErrMessage = sprintf($_ARRAYLANG['TXT_NEWS_UNABLE_TO_UPDATE_FILE'], htmlentities($newName, ENT_QUOTES, CONTREXX_CHARSET), \Env::get('cx')->getWebsiteFeedPath() . '/') . '<br />';
$this->strErrMessage .= sprintf($_ARRAYLANG['TXT_NEWS_SET_CHMOD'], \Env::get('cx')->getWebsiteFeedPath() . '/' . $newName);
}
} else {
$this->strErrMessage = sprintf($_ARRAYLANG['TXT_NEWS_FILE_DOES_NOT_EXIST'], \Env::get('cx')->getWebsiteFeedPath() . '/' . $newName);
}
} else {
$this->strErrMessage = $_ARRAYLANG['TXT_NEWS_UNABLE_TO_RENAME_NEWSTICKER'];
@unlink(\Env::get('cx')->getWebsiteFeedPath() . '/' . $newName);
}
}
} else {
$this->strErrMessage = $_ARRAYLANG['TXT_NEWS_YOU_MUST_SET_FILENAME'];
}
$name = $newName;
} elseif ($id > 0) {
if (!file_exists(\Env::get('cx')->getWebsiteFeedPath() . '/' . $name) && !@touch(\Env::get('cx')->getWebsiteFeedPath() . '/' . $name)) {
$this->strErrMessage = sprintf($_ARRAYLANG['TXT_NEWS_COULD_NOT_ATTACH_FILE'], htmlentities($name, ENT_QUOTES, CONTREXX_CHARSET), \Env::get('cx')->getWebsiteFeedPath() . '/') . '<br />';
$this->strErrMessage .= sprintf($_ARRAYLANG['TXT_NEWS_SET_CHMOD'], \Env::get('cx')->getWebsiteFeedPath() . '/');
} else {
$content = file_get_contents(\Env::get('cx')->getWebsiteFeedPath() . '/' . $name);
if (!empty($prefix) && strpos($content, $prefix) === 0) {
$content = substr($content, strlen($prefix));
}
if ($urlencode) {
$content = rawurldecode($content);
}
if ($charset != $defaultCharset) {
$content = iconv($charset, $defaultCharset, $content);
$prefix = iconv($charset, $defaultCharset, $prefix);
}
}
}
$this->_objTpl->addBlockfile('NEWS_TICKER_TEMPLATE', 'module_news_ticker_modify', 'module_news_ticker_modify.html');
$this->_objTpl->setVariable(array('TXT_NEWS_FILENAME' => $_ARRAYLANG['TXT_NEWS_FILENAME'], 'TXT_NEWS_MODIFY_FILENAME' => $_ARRAYLANG['TXT_NEWS_MODIFY_FILENAME'], 'TXT_NEWS_CONTENT' => $_ARRAYLANG['TXT_NEWS_CONTENT'], 'TXT_NEWS_CHARSET' => $_ARRAYLANG['TXT_NEWS_CHARSET'], 'TXT_NEWS_SAVE' => $_ARRAYLANG['TXT_NEWS_SAVE'], 'TXT_NEWS_CANCEL' => $_ARRAYLANG['TXT_NEWS_CANCEL'], 'TXT_NEWS_URL_ENCODING' => $_ARRAYLANG['TXT_NEWS_URL_ENCODING'], 'TXT_NEWS_URL_ENCODING_TXT' => $_ARRAYLANG['TXT_NEWS_URL_ENCODING_TXT'], 'TXT_NEWS_PREFIX' => $_ARRAYLANG['TXT_NEWS_PREFIX'], 'TXT_NEWS_TICKER_PREFIX_MSG' => $_ARRAYLANG['TXT_NEWS_TICKER_PREFIX_MSG'], 'TXT_NEWS_GENERAL' => $_ARRAYLANG['TXT_NEWS_GENERAL'], 'TXT_NEWS_ADVANCED' => $_ARRAYLANG['TXT_NEWS_ADVANCED']));
$this->_objTpl->setVariable(array('NEWS_MODIFY_TITLE_TXT' => $id > 0 ? $_ARRAYLANG['TXT_NEWS_MODIFY_TICKER'] : $_ARRAYLANG['TXT_NEWS_CREATE_TICKER'], 'NEWS_TICKER_ID' => $id, 'NEWS_TICKER_FILENAME' => htmlentities($name, ENT_QUOTES, CONTREXX_CHARSET), 'NEWS_TICKER_CHARSET_MENU' => $this->_getCharsetMenu($charset, 'name="news_ticker_charset"'), 'NEWS_TICKER_CONTENT' => htmlentities($content, ENT_QUOTES, CONTREXX_CHARSET), 'NEWS_TICKER_URLENCODE' => $urlencode ? 'checked="checked"' : '', 'NEWS_TICKER_POS' => $pos, 'NEWS_TICKER_PREFIX' => $prefix));
$this->_objTpl->parse('module_news_ticker_modify');
}
示例10: setProfile
public function setProfile($arrProfile, $ignoreAccessPermissions = false)
{
$arrDate = array();
$arrDateFormat = array();
foreach ($arrProfile as $attributeId => $arrValue) {
if (!is_array($arrValue)) {
continue;
}
$objAttribute = $this->objAttribute->getById($attributeId);
if (in_array($objAttribute->getType(), array('menu_option', 'group', 'frame', 'history'))) {
continue;
}
if (isset($this->arrLoadedUsers[$this->id]['profile'][$attributeId])) {
$arrStoredAttributeData = $this->arrLoadedUsers[$this->id]['profile'][$attributeId];
} else {
$arrStoredAttributeData = array();
}
$this->arrLoadedUsers[$this->id]['profile'][$attributeId] = array();
foreach ($arrValue as $historyId => $value) {
if ($this->objAttribute->isHistoryChild($attributeId) && !$historyId) {
continue;
}
if ($this->objAttribute->isHistoryChild($attributeId) && $historyId === 'new') {
$historyId = 0;
$arrValues = $value;
} else {
$arrValues = array($value);
}
foreach ($arrValues as $nr => $value) {
$value = trim(contrexx_stripslashes($value));
if ($objAttribute->getType() === 'date') {
if (is_array($value)) {
$objDateTime = new DateTime("{$value['month']}/{$value['day']}/{$value['year']}");
$value = $objDateTime->format(ASCMS_DATE_FORMAT_DATE);
}
if (preg_match_all('#([djmnYy])+#', ASCMS_DATE_FORMAT_DATE, $arrDateFormat, PREG_PATTERN_ORDER) && preg_match_all('#([0-9]+)#', $value, $arrDate)) {
foreach ($arrDateFormat[1] as $charNr => $char) {
$arrDateCombined[$char] = $arrDate[1][$charNr];
}
$value = mktime(1, 0, 0, isset($arrDateCombined['m']) ? $arrDateCombined['m'] : $arrDateCombined['n'], isset($arrDateCombined['d']) ? $arrDateCombined['d'] : $arrDateCombined['j'], isset($arrDateCombined['Y']) ? $arrDateCombined['Y'] : $arrDateCombined['y'] + ($arrDateCombined['y'] < 70 ? 2000 : 1900));
} elseif ($this->objAttribute->isCoreAttribute($attributeId)) {
$value = '';
} else {
continue;
}
}
if ($objAttribute->getId() && ($ignoreAccessPermissions || !$objAttribute->isProtected() || (Permission::checkAccess($objAttribute->getAccessId(), 'dynamic', true) || $objAttribute->checkModifyPermission((in_array($attributeId, array('title', 'country')) ? $attributeId . '_' : '') . (isset($arrStoredAttributeData[$historyId]) ? $arrStoredAttributeData[$historyId] : null), (in_array($attributeId, array('title', 'country')) ? $attributeId . '_' : '') . $value)))) {
if ($this->objAttribute->isHistoryChild($attributeId) && !$historyId) {
$historyId = (isset($this->arrAttributeHistories[$this->id][$this->objAttribute->getHistoryAttributeId($attributeId)]) ? max($this->arrAttributeHistories[$this->id][$this->objAttribute->getHistoryAttributeId($attributeId)]) : 0) + 1;
}
$this->arrLoadedUsers[$this->id]['profile'][$attributeId][$historyId + $nr] = $value;
if ($historyId + $nr && (!isset($this->arrUpdatedAttributeHistories[$this->id][$this->objAttribute->getHistoryAttributeId($attributeId)]) || !in_array($historyId + $nr, $this->arrUpdatedAttributeHistories[$this->id][$this->objAttribute->getHistoryAttributeId($attributeId)]))) {
$this->arrUpdatedAttributeHistories[$this->id][$this->objAttribute->getHistoryAttributeId($attributeId)][] = $historyId + $nr;
}
} else {
$this->arrLoadedUsers[$this->id]['profile'][$attributeId] = $arrStoredAttributeData;
continue;
}
}
}
}
// synchronize history-ID's
$this->arrAttributeHistories[$this->id] = $this->arrUpdatedAttributeHistories[$this->id];
return true;
}
示例11: showForum
/**
* Show all threads of a forum
*
* @global ADONewConnection
* @global array
* @global Cache
* @param integer $intForumId: The id of the forum which should be shown
*/
function showForum($intForumId)
{
global $objDatabase, $_ARRAYLANG, $_LANGID, $_CORELANG;
if ($intForumId == 0) {
//wrong id, redirect
\Cx\Core\Csrf\Controller\Csrf::header('location: index.php?section=Forum');
die;
}
$objFWUser = \FWUser::getFWUserObject();
$this->_communityLogin();
$intCounter = 1;
$intForumId = intval($intForumId);
$intThreadId = !empty($_REQUEST['threadid']) ? intval($_REQUEST['threadid']) : 0;
$pos = !empty($_REQUEST['pos']) ? intval($_REQUEST['pos']) : 0;
if ($objFWUser->objUser->login()) {
$this->_objTpl->touchBlock('notificationRow');
} else {
$this->_objTpl->hideBlock('notificationRow');
}
$_REQUEST['act'] = !empty($_REQUEST['act']) ? $_REQUEST['act'] : '';
if ($_REQUEST['act'] == 'delete') {
if ($this->_checkAuth($intForumId, 'delete')) {
if ($this->_deleteThread($intThreadId, $intForumId)) {
$this->_objTpl->setVariable('TXT_FORUM_SUCCESS', '<br />' . $_ARRAYLANG['TXT_FORUM_DELETED_SUCCESSFULLY']);
} else {
$this->_objTpl->setVariable('TXT_FORUM_ERROR', '<br />' . $_ARRAYLANG['TXT_FORUM_DELETE_FAILED']);
}
} else {
$this->_objTpl->setVariable('TXT_FORUM_ERROR', '<br />' . $_ARRAYLANG['TXT_FORUM_NO_ACCESS']);
return false;
}
}
$arrThreads = $this->createThreadArray($intForumId, $pos);
$subject = !empty($_REQUEST['thread_subject']) ? contrexx_stripslashes($_REQUEST['thread_subject']) : '';
$keywords = !empty($_REQUEST['thread_keywords']) ? contrexx_stripslashes($_REQUEST['thread_keywords']) : '';
$content = !empty($_REQUEST['thread_message']) ? contrexx_stripslashes($_REQUEST['thread_message']) : '';
if ($this->_arrSettings['wysiwyg_editor'] == 1) {
//IF WYSIWIG enabled..
$strMessageInputHTML = new \Cx\Core\Wysiwyg\Wysiwyg('thread_message', $content, 'bbcode');
} else {
//plain textarea
$strMessageInputHTML = '<textarea style="width: 400px; height: 150px;" rows="5" cols="10" name="thread_message">' . htmlentities($content, ENT_QUOTES, CONTREXX_CHARSET) . '</textarea>';
}
//Initialize the Uploader
$this->initForumUploader();
$this->_objTpl->setGlobalVariable(array('FORUM_NAME' => $this->_shortenString($this->_arrTranslations[$intForumId][$this->_intLangId]['name'], $this->_maxStringlength), 'FORUM_TREE' => $this->_createNavTree($intForumId), 'FORUM_DROPDOWN' => $this->createForumDD('forum_quickaccess', $intForumId, 'onchange="gotoForum(this);"', ''), 'FORUM_JAVASCRIPT_GOTO' => $this->getJavascript('goto'), 'FORUM_JAVASCRIPT_DELETE' => $this->getJavascript('deleteThread'), 'FORUM_JAVASCRIPT_INSERT_TEXT' => $this->getJavascript('insertText'), 'TXT_FORUM_ICON' => $_ARRAYLANG['TXT_FORUM_ICON'], 'TXT_FORUM_CREATE_THREAD' => $_ARRAYLANG['TXT_FORUM_CREATE_THREAD'], 'TXT_FORUM_NOTIFY_NEW_POSTS' => $_ARRAYLANG['TXT_FORUM_NOTIFY_NEW_POSTS'], 'TXT_FORUM_UPDATE_NOTIFICATION' => $_ARRAYLANG['TXT_FORUM_UPDATE_NOTIFICATION'], 'FORUM_NOTIFICATION_CHECKBOX_CHECKED' => $this->_hasNotification($intThreadId) ? 'checked="checked"' : '', 'TXT_FORUM_CAPTCHA' => $_CORELANG['TXT_CORE_CAPTCHA'], 'FORUM_CAPTCHA_CODE' => \Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->getCode(), 'FORUM_FORUM_ID' => $intForumId, 'FORUM_SUBJECT' => htmlentities($subject, ENT_QUOTES, CONTREXX_CHARSET), 'FORUM_KEYWORDS' => htmlentities($keywords, ENT_QUOTES, CONTREXX_CHARSET), 'FORUM_MESSAGE_INPUT' => $strMessageInputHTML, 'TXT_FORUM_CHOOSE_FILE' => $_ARRAYLANG['TXT_FORUM_CHOOSE_FILE']));
if ($objFWUser->objUser->login()) {
$this->_objTpl->hideBlock('captcha');
} else {
$this->_objTpl->touchBlock('captcha');
}
$this->_setIcons($this->_getIcons());
$this->_objTpl->setVariable(array('TXT_THREADS_SUBJECTAUTHOR' => $_ARRAYLANG['TXT_FORUM_THREADS_SUBJECTAUTHOR'], 'TXT_THREADS_LASTTOPIC' => $_ARRAYLANG['TXT_FORUM_OVERVIEW_LASTPOST'], 'TXT_THREADS_REPLIES' => $_ARRAYLANG['TXT_FORUM_THREADS_REPLIES'], 'TXT_THREADS_HITS' => $_ARRAYLANG['TXT_FORUM_THREADS_HITS'], 'TXT_FORUM_ADD_THREAD' => $_ARRAYLANG['TXT_FORUM_ADD_THREAD'], 'TXT_FORUM_SUBJECT' => $_ARRAYLANG['TXT_FORUM_SUBJECT'], 'TXT_FORUM_MESSAGE' => $_ARRAYLANG['TXT_FORUM_MESSAGE'], 'TXT_FORUM_RESET' => $_ARRAYLANG['TXT_FORUM_RESET'], 'TXT_FORUM_CREATE_THREAD' => $_ARRAYLANG['TXT_FORUM_CREATE_THREAD'], 'TXT_FORUM_PREVIEW' => $_ARRAYLANG['TXT_FORUM_PREVIEW'], 'TXT_FORUM_FILE_ATTACHMENT' => $_ARRAYLANG['TXT_FORUM_FILE_ATTACHMENT'], 'TXT_FORUM_COMMA_SEPARATED_KEYWORDS' => $_ARRAYLANG['TXT_FORUM_COMMA_SEPARATED_KEYWORDS'], 'TXT_FORUM_KEYWORDS' => $_ARRAYLANG['TXT_FORUM_KEYWORDS']));
if (!$this->_checkAuth($intForumId, 'write')) {
$this->_objTpl->hideBlock('addThread');
$this->_objTpl->hideBlock('addPostAnchor');
} else {
$this->_objTpl->touchBlock('addPostAnchor');
}
if (count($arrThreads) > 0) {
if (!$this->_checkAuth($intForumId, 'read')) {
$this->_objTpl->setVariable('TXT_FORUM_ERROR', '<br />' . $_ARRAYLANG['TXT_FORUM_NO_ACCESS']);
return false;
}
$intCounter = 0;
foreach ($arrThreads as $threadId => $arrValues) {
$strUserProfileLink = $arrValues['user_id'] > 0 ? '<a href="index.php?section=Access&cmd=user&id=' . $arrValues['user_id'] . '">' . $arrValues['user_name'] . '</a>' : $this->_anonymousName;
$this->_objTpl->setVariable(array('FORUM_THREADS_ROWCLASS' => $intCounter++ % 2 + 1, 'FORUM_THREADS_SYMBOL' => '<img title="comment.gif" alt="comment.gif" src="' . ASCMS_MODULE_WEB_PATH . '/Forum/View/Media/comment.gif" border="0" />', 'FORUM_THREADS_ICON' => $arrValues['thread_icon'], 'FORUM_THREADS_ID' => $arrValues['thread_id'], 'FORUM_THREADS_NAME' => $arrValues['subject'], 'FORUM_THREADS_AUTHOR' => $strUserProfileLink, 'FORUM_THREADS_LASTPOST_DATE' => $arrValues['lastpost_time'], 'FORUM_THREADS_LASTPOST_AUTHOR' => $arrValues['lastpost_author'], 'FORUM_THREADS_REPLIES' => $arrValues['replies'], 'FORUM_THREADS_HITS' => $arrValues['views']));
if ($this->_checkAuth($intForumId, 'delete')) {
$this->_objTpl->setVariable('FORUM_THREAD_ID', $intThreadId);
$this->_objTpl->touchBlock('deleteThread');
} else {
$this->_objTpl->hideBlock('deleteThread');
}
$this->_objTpl->parse('forumThreads');
}
$this->_objTpl->setVariable(array('FORUM_THREADS_PAGING' => getPaging($this->_threadCount, $pos, '§ion=Forum&cmd=board&id=' . $intForumId, $_ARRAYLANG['TXT_FORUM_THREAD'], true, $this->_arrSettings['thread_paging'])));
$this->_objTpl->hideBlock('forumNoThreads');
} else {
//no threads in this board, show message
$this->_objTpl->setVariable('TXT_FORUM_NO_THREADS', $_ARRAYLANG['TXT_FORUM_NO_THREADS']);
$this->_objTpl->parse('forumNoThreads');
$this->_objTpl->hideBlock('forumThreads');
}
if (!empty($_REQUEST['create']) && $_REQUEST['create'] == $_ARRAYLANG['TXT_FORUM_CREATE_THREAD']) {
//addthread code
if (!$this->_checkAuth($intForumId, 'write')) {
$this->_objTpl->setVariable('TXT_FORUM_ERROR', '<br />' . $_ARRAYLANG['TXT_FORUM_NO_ACCESS']);
$this->_objTpl->hideBlock('addThread');
return false;
}
if (!$objFWUser->objUser->login() && !\Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->check()) {
//.........这里部分代码省略.........
示例12: addUpdateVariable
/**
* Gets the language add variable page
*
* @global array
* @global ADONewConnection
* @return boolean True on success, false on failure
*/
function addUpdateVariable()
{
global $_ARRAYLANG, $objDatabase;
$moduleId = intval($_POST['moduleId']);
$regex = '#\\[[\'"](.*)[\'"]\\][[:space:]]*=[[:space:]]*["\'](.*)["\'];#';
//multiple variables
if (!empty($_REQUEST['backend_lang_vars']) || !empty($_REQUEST['frontend_lang_vars'])) {
$backendVars = array();
$frontendVars = array();
$bothVars = array();
//for identical backend and frontend variables
$_REQUEST['backend_lang_vars'] = contrexx_stripslashes($_REQUEST['backend_lang_vars']);
$_REQUEST['frontend_lang_vars'] = contrexx_stripslashes($_REQUEST['frontend_lang_vars']);
$backendVarLines = explode("\n", $_REQUEST['backend_lang_vars']);
$frontendVarLines = explode("\n", $_REQUEST['frontend_lang_vars']);
$result = array();
foreach ($backendVarLines as $backendVar) {
if (trim($backendVar) == '' || substr(trim($backendVar), 0, 11) != '$_ARRAYLANG') {
continue;
}
preg_match($regex, $backendVar, $result);
//ugly key => val regex
if (!empty($result[1]) && !empty($result[2])) {
$backendVars[$result[1]] = $result[2];
} else {
$this->strErrMessage .= 'Invalid $_ARRAYLANG format (backend) - regex: ' . $regex . '<br />';
}
}
foreach ($frontendVarLines as $frontendVar) {
if (trim($frontendVar) == '' || substr(trim($frontendVar), 0, 11) != '$_ARRAYLANG') {
continue;
}
preg_match($regex, $frontendVar, $result);
if (!empty($result[1]) && !empty($result[2])) {
if (in_array($result[1], array_keys($backendVars))) {
if (in_array($result[2], $backendVars)) {
$bothVars[$result[1]] = $result[2];
unset($frontendVars[$result[1]]);
unset($backendVars[$result[1]]);
continue;
}
}
$frontendVars[$result[1]] = $result[2];
} else {
$this->strErrMessage .= 'Invalid $_ARRAYLANG format (frontend ) - regex: ' . $regex . '<br />';
}
}
//_writeVarsToDB($name, $content, $moduleId, $isBackend, $isFrontend, $langId = 1, $status = 1)
foreach ($backendVars as $varName => $varValue) {
$this->_writeVarsToDB($varName, $varValue, $moduleId, 1, 0);
}
foreach ($frontendVars as $varName => $varValue) {
$this->_writeVarsToDB($varName, $varValue, $moduleId, 0, 1);
}
foreach ($bothVars as $varName => $varValue) {
$this->_writeVarsToDB($varName, $varValue, $moduleId, 1, 1);
}
if (isset($_POST['writeFiles']) && !empty($_POST['writeFiles'])) {
$this->createFiles();
}
return true;
}
//single variable
if (!empty($_POST['submit']) && !empty($_POST['name'])) {
$name = contrexx_addslashes($_POST['name']);
$adminzone = intval($_POST['backend']);
$website = intval($_POST['frontend']);
$moduleId = intval($_POST['moduleId']);
// Add new variable
if (empty($_POST['id'])) {
$objResult = $objDatabase->Execute("SELECT name\n FROM " . DBPREFIX . "language_variable_names\n WHERE name = '" . $name . "'\n AND module_id =" . $moduleId);
if ($objResult !== false) {
if ($objResult->RecordCount() >= 1) {
$this->strErrMessage = $_ARRAYLANG['TXT_LANGUAGE_VARIABLE_ALREADY_EXIST'];
return false;
} else {
$objDatabase->Execute("INSERT INTO " . DBPREFIX . "language_variable_names\n SET name='" . $name . "',\n module_id='" . $moduleId . "',\n backend='" . $adminzone . "',\n frontend='" . $website . "'");
$varId = $objDatabase->Insert_ID();
foreach ($_POST['content'] as $langId => $content) {
$status = intval($_POST['status'][$langId]);
$objDatabase->Execute("INSERT INTO " . DBPREFIX . "language_variable_content\n SET varid=" . $varId . ",\n content='" . contrexx_addslashes($content) . "',\n status=" . $status . ",\n lang_id=" . intval($langId));
}
$this->strOkMessage = $_ARRAYLANG['TXT_LANGUAGE_VARIABLE_ADDED_SUCCESSFUL'];
if (isset($_POST['writeFiles']) && !empty($_POST['writeFiles'])) {
$this->createFiles();
}
return true;
}
}
} else {
// Update variable
// Edit not add
$id = intval($_POST['id']);
//.........这里部分代码省略.........
示例13: checkLogin
/**
* Checks the login
*
* @return bool|mixed false or user id
*/
public function checkLogin()
{
$username = isset($_POST['USERNAME']) && $_POST['USERNAME'] != '' ? contrexx_stripslashes($_POST['USERNAME']) : null;
$password = isset($_POST['PASSWORD']) && $_POST['PASSWORD'] != '' ? md5(contrexx_stripslashes($_POST['PASSWORD'])) : null;
if (isset($username) && isset($password)) {
return $this->objUser->checkLoginData($username, $password, \Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->check());
}
return false;
}
示例14: signUp
private function signUp()
{
global $_ARRAYLANG, $_CORELANG;
if (!empty($_GET['u']) && !empty($_GET['k'])) {
$this->_objTpl->hideBlock('access_signup_store_success');
$this->_objTpl->hideBlock('access_signup_store_error');
if ($this->confirmSignUp(intval($_GET['u']), contrexx_stripslashes($_GET['k']))) {
$this->_objTpl->setVariable('ACCESS_SIGNUP_MESSAGE', $_ARRAYLANG['TXT_ACCESS_ACCOUNT_SUCCESSFULLY_ACTIVATED']);
$this->_objTpl->parse('access_signup_confirm_success');
$this->_objTpl->hideBlock('access_signup_confirm_error');
} else {
$this->_objTpl->setVariable('ACCESS_SIGNUP_MESSAGE', implode('<br />', $this->arrStatusMsg['error']));
$this->_objTpl->parse('access_signup_confirm_error');
$this->_objTpl->hideBlock('access_signup_confirm_success');
}
return;
} else {
$this->_objTpl->hideBlock('access_signup_confirm_success');
$this->_objTpl->hideBlock('access_signup_confirm_error');
}
$arrSettings = \User_Setting::getSettings();
$objUser = null;
if (!empty($_SESSION['user_id'])) {
$objUser = \FWUser::getFWUserObject()->objUser->getUser($_SESSION['user_id']);
if ($objUser) {
$objUser->releaseRestoreKey();
$active = $arrSettings['sociallogin_active_automatically']['status'];
$objUser->setActiveStatus($active);
$this->_objTpl->hideBlock('access_logindata');
}
}
if (!$objUser) {
$objUser = new \User();
}
if (isset($_POST['access_signup'])) {
$objUser->setUsername(isset($_POST['access_user_username']) ? trim(contrexx_stripslashes($_POST['access_user_username'])) : '');
$objUser->setEmail(isset($_POST['access_user_email']) ? trim(contrexx_stripslashes($_POST['access_user_email'])) : '');
$objUser->setFrontendLanguage(isset($_POST['access_user_frontend_language']) ? intval($_POST['access_user_frontend_language']) : 0);
$assignedGroups = $objUser->getAssociatedGroupIds();
if (empty($assignedGroups)) {
$objUser->setGroups(explode(',', $arrSettings['assigne_to_groups']['value']));
}
$objUser->setSubscribedNewsletterListIDs(isset($_POST['access_user_newsletters']) && is_array($_POST['access_user_newsletters']) ? $_POST['access_user_newsletters'] : array());
if ((!isset($_POST['access_profile_attribute']) || !is_array($_POST['access_profile_attribute']) || ($arrProfile = $_POST['access_profile_attribute']) && (!isset($_FILES['access_profile_attribute_images']) || !is_array($_FILES['access_profile_attribute_images']) || ($uploadImageError = $this->addUploadedImagesToProfile($objUser, $arrProfile, $_FILES['access_profile_attribute_images'])) === true) && $objUser->setProfile($arrProfile)) && $objUser->setPassword(isset($_POST['access_user_password']) ? trim(contrexx_stripslashes($_POST['access_user_password'])) : '', isset($_POST['access_user_password_confirmed']) ? trim(contrexx_stripslashes($_POST['access_user_password_confirmed'])) : '') && ($arrSettings['user_account_verification']['value'] === 0 || $objUser->checkMandatoryCompliance()) && $this->checkCaptcha() && $this->checkToS() && $objUser->signUp()) {
if ($this->handleSignUp($objUser)) {
if (isset($_SESSION['user_id'])) {
unset($_SESSION['user_id']);
}
$this->_objTpl->setVariable('ACCESS_SIGNUP_MESSAGE', implode('<br />', $this->arrStatusMsg['ok']));
$this->_objTpl->parse('access_signup_store_success');
$this->_objTpl->hideBlock('access_signup_store_error');
} else {
$this->_objTpl->setVariable('ACCESS_SIGNUP_MESSAGE', implode('<br />', $this->arrStatusMsg['error']));
$this->_objTpl->parse('access_signup_store_error');
$this->_objTpl->hideBlock('access_signup_store_success');
}
$this->_objTpl->hideBlock('access_signup_form');
return;
} else {
if (is_array($uploadImageError)) {
$this->arrStatusMsg['error'] = array_merge($this->arrStatusMsg['error'], $uploadImageError);
}
$this->arrStatusMsg['error'] = array_merge($this->arrStatusMsg['error'], $objUser->getErrorMsg());
$this->_objTpl->hideBlock('access_signup_store_success');
$this->_objTpl->hideBlock('access_signup_store_error');
}
} else {
$this->_objTpl->hideBlock('access_signup_store_success');
$this->_objTpl->hideBlock('access_signup_store_error');
}
$this->parseAccountAttributes($objUser, true);
while (!$objUser->objAttribute->EOF) {
$objAttribute = $objUser->objAttribute->getById($objUser->objAttribute->getId());
if (!$objAttribute->isProtected() || (\Permission::checkAccess($objAttribute->getAccessId(), 'dynamic', true) || $objAttribute->checkModifyPermission())) {
$this->parseAttribute($objUser, $objAttribute->getId(), 0, true);
}
$objUser->objAttribute->next();
}
$this->parseNewsletterLists($objUser);
$this->attachJavaScriptFunction('accessSetWebsite');
$this->_objTpl->setVariable(array('ACCESS_SIGNUP_BUTTON' => '<input type="submit" name="access_signup" value="' . $_ARRAYLANG['TXT_ACCESS_CREATE_ACCOUNT'] . '" />', 'ACCESS_JAVASCRIPT_FUNCTIONS' => $this->getJavaScriptCode(), 'ACCESS_SIGNUP_MESSAGE' => implode("<br />\n", $this->arrStatusMsg['error'])));
if (!$arrSettings['use_usernames']['status']) {
if ($this->_objTpl->blockExists('access_user_username')) {
$this->_objTpl->hideBlock('access_user_username');
}
}
// set captcha
if ($this->_objTpl->blockExists('access_captcha')) {
if ($arrSettings['user_captcha']['status']) {
$this->_objTpl->setVariable(array('ACCESS_CAPTCHA_CODE' => \Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->getCode(), 'TXT_ACCESS_CAPTCHA' => $_CORELANG['TXT_CORE_CAPTCHA']));
$this->_objTpl->parse('access_captcha');
} else {
$this->_objTpl->hideBlock('access_captcha');
}
}
// set terms and conditions
if ($this->_objTpl->blockExists('access_tos')) {
if ($arrSettings['user_accept_tos_on_signup']['status']) {
$uriTos = CONTREXX_SCRIPT_PATH . '?section=Agb';
$this->_objTpl->setVariable(array('TXT_ACCESS_TOS' => $_ARRAYLANG['TXT_ACCESS_TOS'], 'ACCESS_TOS' => '<input type="checkbox" name="access_user_tos" id="access_user_tos"' . (!empty($_POST['access_user_tos']) ? ' checked="checked"' : '') . ' /><label for="access_user_tos">' . sprintf($_ARRAYLANG['TXT_ACCESS_ACCEPT_TOS'], $uriTos) . '</label>'));
//.........这里部分代码省略.........
示例15: send
function send()
{
global $objDatabase, $_ARRAYLANG, $_CONFIG;
$this->_objTpl->setTemplate($this->pageContent);
// Initialize variables
$code = substr(md5(rand()), 1, 10);
$url = \Cx\Core\Routing\Url::fromModuleAndCmd('Ecard', 'show', '', array('code' => $code))->toString();
// Initialize POST variables
$id = intval($_POST['selectedEcard']);
$message = contrexx_addslashes($_POST['ecardMessage']);
$recipientSalutation = contrexx_stripslashes($_POST['ecardRecipientSalutation']);
$senderName = contrexx_stripslashes($_POST['ecardSenderName']);
$senderEmail = \FWValidator::isEmail($_POST['ecardSenderEmail']) ? $_POST['ecardSenderEmail'] : '';
$recipientName = contrexx_stripslashes($_POST['ecardRecipientName']);
$recipientEmail = \FWValidator::isEmail($_POST['ecardRecipientEmail']) ? $_POST['ecardRecipientEmail'] : '';
if (empty($senderEmail) || empty($recipientEmail)) {
$this->_objTpl->setVariable(array('STATUS_MESSAGE' => $_ARRAYLANG['TXT_ECARD_SENDING_ERROR']));
return false;
}
$query = "\n SELECT `setting_name`, `setting_value`\n FROM " . DBPREFIX . "module_ecard_settings";
$objResult = $objDatabase->Execute($query);
while (!$objResult->EOF) {
switch ($objResult->fields['setting_name']) {
case 'validdays':
$validdays = $objResult->fields['setting_value'];
break;
// Never used
// case 'greetings':
// $greetings = $objResult->fields['setting_value'];
// break;
// Never used
// case 'greetings':
// $greetings = $objResult->fields['setting_value'];
// break;
case 'subject':
$subject = $objResult->fields['setting_value'];
break;
case 'emailText':
$emailText = strip_tags($objResult->fields['setting_value']);
break;
}
$objResult->MoveNext();
}
$timeToLife = $validdays * 86400;
// Replace placeholders with used in notification mail with user data
$emailText = str_replace('[[ECARD_RECIPIENT_SALUTATION]]', $recipientSalutation, $emailText);
$emailText = str_replace('[[ECARD_RECIPIENT_NAME]]', $recipientName, $emailText);
$emailText = str_replace('[[ECARD_RECIPIENT_EMAIL]]', $recipientEmail, $emailText);
$emailText = str_replace('[[ECARD_SENDER_NAME]]', $senderName, $emailText);
$emailText = str_replace('[[ECARD_SENDER_EMAIL]]', $senderEmail, $emailText);
$emailText = str_replace('[[ECARD_VALID_DAYS]]', $validdays, $emailText);
$emailText = str_replace('[[ECARD_URL]]', $url, $emailText);
$body = $emailText;
// Insert ecard to DB
$query = "\n INSERT INTO `" . DBPREFIX . "module_ecard_ecards` (\n code, date, TTL, salutation,\n senderName, senderEmail,\n recipientName, recipientEmail,\n message\n ) VALUES (\n '" . $code . "',\n '" . time() . "',\n '" . $timeToLife . "',\n '" . addslashes($recipientSalutation) . "',\n '" . addslashes($senderName) . "',\n '" . $senderEmail . "',\n '" . addslashes($recipientName) . "',\n '" . $recipientEmail . "',\n '" . $message . "');";
if ($objDatabase->Execute($query)) {
$query = "\n SELECT setting_value\n FROM " . DBPREFIX . "module_ecard_settings\n WHERE setting_name='motive_{$id}'";
$objResult = $objDatabase->SelectLimit($query, 1);
// Copy motive to new file with $code as filename
$fileExtension = preg_replace('/^.+(\\.[^\\.]+)$/', '$1', $objResult->fields['setting_value']);
$fileName = $objResult->fields['setting_value'];
$objFile = new \File();
if ($objFile->copyFile(ASCMS_ECARD_OPTIMIZED_PATH . '/', $fileName, ASCMS_ECARD_SEND_ECARDS_PATH . '/', $code . $fileExtension)) {
$objMail = new \phpmailer();
// Check e-mail settings
if ($_CONFIG['coreSmtpServer'] > 0 && @(include_once ASCMS_CORE_PATH . '/SmtpSettings.class.php')) {
$objSmtpSettings = new \SmtpSettings();
if (($arrSmtp = $objSmtpSettings->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'];
}
}
// Send notification mail to ecard-recipient
$objMail->CharSet = CONTREXX_CHARSET;
$objMail->SetFrom($senderEmail, $senderName);
$objMail->Subject = $subject;
$objMail->IsHTML(false);
$objMail->Body = $body;
$objMail->AddAddress($recipientEmail);
if ($objMail->Send()) {
$this->_objTpl->setVariable(array('STATUS_MESSAGE' => $_ARRAYLANG['TXT_ECARD_HAS_BEEN_SENT']));
} else {
$this->_objTpl->setVariable(array('STATUS_MESSAGE' => $_ARRAYLANG['TXT_ECARD_MAIL_SENDING_ERROR']));
}
}
} else {
$this->_objTpl->setVariable(array('STATUS_MESSAGE' => $_ARRAYLANG['TXT_ECARD_SENDING_ERROR']));
}
}