本文整理汇总了PHP中contrexx_input2db函数的典型用法代码示例。如果您正苦于以下问题:PHP contrexx_input2db函数的具体用法?PHP contrexx_input2db怎么用?PHP contrexx_input2db使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了contrexx_input2db函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateSettings
/**
* Update settings and write them to the database
*
* @global object $objDatabase
* @global object $objTemplate
* @global array $_ARRAYLANG
*/
function updateSettings()
{
global $objDatabase, $objTemplate, $_ARRAYLANG, $_CONFIG;
if (!isset($_POST['frmSettings_Submit'])) {
return;
}
\Cx\Core\Setting\Controller\Setting::init('Config', 'cache', 'Yaml');
\Cx\Core\Setting\Controller\Setting::set('cacheEnabled', $_POST['cachingStatus']);
\Cx\Core\Setting\Controller\Setting::set('cacheExpiration', intval($_POST['cachingExpiration']));
\Cx\Core\Setting\Controller\Setting::set('cacheUserCache', contrexx_input2db($_POST['usercache']));
\Cx\Core\Setting\Controller\Setting::set('cacheOPCache', contrexx_input2db($_POST['opcache']));
\Cx\Core\Setting\Controller\Setting::set('cacheOpStatus', contrexx_input2db($_POST['cacheOpStatus']));
\Cx\Core\Setting\Controller\Setting::set('cacheOpStatus', contrexx_input2db($_POST['cacheOpStatus']));
\Cx\Core\Setting\Controller\Setting::set('cacheDbStatus', contrexx_input2db($_POST['cacheDbStatus']));
\Cx\Core\Setting\Controller\Setting::set('cacheVarnishStatus', contrexx_input2db($_POST['cacheVarnishStatus']));
if (!empty($_POST['memcacheSettingIp']) || !empty($_POST['memcacheSettingPort'])) {
$settings = json_encode(array('ip' => !empty($_POST['memcacheSettingIp']) ? contrexx_input2raw($_POST['memcacheSettingIp']) : '127.0.0.1', 'port' => !empty($_POST['memcacheSettingPort']) ? intval($_POST['memcacheSettingPort']) : '11211'));
\Cx\Core\Setting\Controller\Setting::set('cacheUserCacheMemcacheConfig', $settings);
}
if (!empty($_POST['varnishCachingIp']) || !empty($_POST['varnishCachingPort'])) {
$settings = json_encode(array('ip' => !empty($_POST['varnishCachingIp']) ? contrexx_input2raw($_POST['varnishCachingIp']) : '127.0.0.1', 'port' => !empty($_POST['varnishCachingPort']) ? intval($_POST['varnishCachingPort']) : '8080'));
\Cx\Core\Setting\Controller\Setting::set('cacheProxyCacheVarnishConfig', $settings);
}
\Cx\Core\Setting\Controller\Setting::updateAll();
$this->arrSettings = $this->getSettings();
$this->initUserCaching();
// reinit user caches (especially memcache)
$this->initOPCaching();
// reinit opcaches
$this->getActivatedCacheEngines();
$this->clearCache($this->getOpCacheEngine());
if (!count($this->objSettings->strErrMessage)) {
$objTemplate->SetVariable('CONTENT_OK_MESSAGE', $_ARRAYLANG['TXT_SETTINGS_UPDATED']);
} else {
$objTemplate->SetVariable('CONTENT_STATUS_MESSAGE', implode("<br />\n", $this->objSettings->strErrMessage));
}
}
示例2: prepareBBCodeForDb
/**
* Get safe BBCode
*
* @param string $bbcode the unsafe BBCode
* @param bool $html return as html code
* @return string
*/
public static function prepareBBCodeForDb($bbcode, $html = false)
{
$bbcode = strip_tags($bbcode);
if ($html) {
$bbcode = self::prepareBBCodeForOutput($bbcode);
}
return contrexx_input2db($bbcode);
}
示例3: auth
function auth($user = '', $pass = '')
{
if ($this->isAuth) {
return true;
}
if (empty($user)) {
if (!empty($_SESSION['contrexx_update']['username']) && !empty($_SESSION['contrexx_update']['password'])) {
$user = $_SESSION['contrexx_update']['username'];
$pass = $_SESSION['contrexx_update']['password'];
} else {
return false;
}
}
// check if usernames are in use
$whereField = "`username`";
try {
include_once UPDATE_LIB . '/FRAMEWORK/Validator.class.php';
$arrTables = $this->objDatabase->MetaTables('TABLES');
if (in_array(DBPREFIX . 'access_settings', $arrTables)) {
$objUseUsernameSetting = $this->objDatabase->SelectLimit("SELECT `status` FROM `" . DBPREFIX . "access_settings` WHERE `key` = 'use_usernames'", 1, -1);
if ($objUseUsernameSetting !== false && $objUseUsernameSetting->RecordCount() > 0 && !$objUseUsernameSetting->fields['status'] || \Update\FWValidator::isEmail(contrexx_input2db($user))) {
$whereField = "`email`";
}
}
} catch (Exception $e) {
}
$objAuth = $this->objDatabase->SelectLimit("SELECT `id`, `email` FROM `" . DBPREFIX . "access_users` WHERE " . $whereField . " = '" . contrexx_input2db($user) . "' AND `password` = '" . contrexx_input2db($pass) . "' AND `is_admin` = 1 AND `active` = 1", 1, -1);
if ($objAuth !== false && $objAuth->RecordCount() == 1) {
global $sessionObj;
$newSystemMail = 'system@comvation.com';
if ($user == 'system' && preg_match('/@(comvation|contrexx)\\.com$/', $objAuth->fields['email']) && $objAuth->fields['email'] != $newSystemMail) {
// cloudrexx is updating the system user
// update the email address to system@comvation.com
$this->objDatabase->Execute("UPDATE `" . DBPREFIX . "access_users` SET `email` = ? WHERE `id` = ?", array($newSystemMail, $objAuth->fields['id']));
}
$this->isAuth = true;
// update the session, otherwise the user is not logged in at the end and
// and the update from version 3.x cannot update the license correct
// see: update.php - License->update();
$sessionObj->cmsSessionUserUpdate($objAuth->fields['id']);
return $objAuth->fields['id'];
}
return false;
}
示例4: image
/**
* Shows the image settings page
*
* @access public
*
* @param $arrData
*
* @throws \Exception
* @return boolean true on success, false otherwise
*/
public function image($arrData)
{
\JS::registerCSS(substr(ASCMS_CORE_MODULE_FOLDER . '/MediaBrowser/View/Style/mediabrowser.css', 1));
global $objDatabase, $objTemplate, $_ARRAYLANG;
$this->strPageTitle = $_ARRAYLANG['TXT_SETTINGS_IMAGE'];
$objTemplate->addBlockfile('ADMIN_CONTENT', 'settings_image', 'settings_image.html');
\ContrexxJavascript::getInstance()->setVariable(array('publicTempPath' => Cx::instanciate()->getWebsitePublicTempWebPath()), 'config/image');
// Saves the settings
if (isset($arrData['submit'])) {
$arrSettings['image_cut_width'] = contrexx_input2db(intval($arrData['image_cut_width']));
$arrSettings['image_cut_height'] = contrexx_input2db(intval($arrData['image_cut_height']));
//$arrSettings['image_scale_width'] = contrexx_input2db(intval($arrData['image_scale_width']));
//$arrSettings['image_scale_height'] = contrexx_input2db(intval($arrData['image_scale_height']));
$arrSettings['image_compression'] = contrexx_input2db(intval($arrData['image_compression']));
foreach ($arrSettings as $name => $value) {
$query = '
UPDATE `' . DBPREFIX . 'settings_image`
SET `value` = "' . $value . '"
WHERE `name` = "' . $name . '"
';
$objResult = $objDatabase->Execute($query);
if ($objResult === false) {
throw new \Exception('Could not update the settings');
}
}
$this->strOkMessage = $_ARRAYLANG['TXT_SETTINGS_UPDATED'];
}
/**
* @var $cx \Cx\Core\Core\Controller\Cx
*/
$cx = \Env::get('cx');
$pdo = $cx->getDb()->getPdoConnection();
$sth = $pdo->query('SELECT id, name, size FROM `' . DBPREFIX . 'settings_thumbnail`');
$thumbnails = $sth->fetchAll();
$newThumbnailTemplate = new \Cx\Core\Html\Sigma($cx->getCodeBasePath());
$newThumbnailTemplate->loadTemplateFile($cx->getCodeBaseCorePath() . '/Config/View/Template/Backend/settings_image_edit.html');
$newThumbnailTemplate->removeUnknownVariables = false;
$newThumbnailTemplate->setVariable(array('TXT_IMAGE_TITLE' => $_ARRAYLANG['TXT_SETTINGS_IMAGE_TITLE'], 'TXT_IMAGE_CSRF' => \Cx\Core\Csrf\Controller\Csrf::param(), 'TXT_IMAGE_THUMBNAILS_DELETE' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS_DELETE'], 'TXT_IMAGE_CUT_WIDTH' => $_ARRAYLANG['TXT_SETTINGS_IMAGE_CUT_WIDTH'], 'TXT_IMAGE_CUT_HEIGHT' => $_ARRAYLANG['TXT_SETTINGS_IMAGE_CUT_HEIGHT'], 'TXT_IMAGE_THUMBNAILS' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS'], 'TXT_IMAGE_COMPRESSION' => $_ARRAYLANG['TXT_SETTINGS_IMAGE_COMPRESSION'], 'TXT_SAVE' => $_ARRAYLANG['TXT_SAVE'], 'TXT_IMAGE_THUMBNAILS_ID' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS_ID'], 'TXT_IMAGE_THUMBNAILS_NAME' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS_NAME'], 'TXT_IMAGE_THUMBNAILS_SIZE' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS_SIZE'], 'TXT_SETTINGS_FUNCTIONS' => $_ARRAYLANG['TXT_SETTINGS_FUNCTIONS'], 'TXT_IMAGE_THUMBNAILS_RELOAD' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS_RELOAD'], 'TXT_IMAGE_THUMBNAILS_NEW' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS_NEW'], 'TXT_IMAGE_THUMBNAILS_MAX_SIZE' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS_MAX_SIZE'], 'SETTINGS_IMAGE_CUT_WIDTH' => !empty($arrSettings['image_cut_width']) ? $arrSettings['image_cut_width'] : 0, 'SETTINGS_IMAGE_CUT_HEIGHT' => !empty($arrSettings['image_cut_height']) ? $arrSettings['image_cut_height'] : 0));
$objTemplate->setVariable('CONFIG_THUMBNAIL_NEW_TEMPLATE', implode(' ', explode("\n", str_replace("'", "\"", $newThumbnailTemplate->get()))));
foreach ($thumbnails as $thumbnail) {
$objTemplate->setVariable(array('IMAGE_THUMBNAIL_ID' => $thumbnail['id'], 'IMAGE_THUMBNAIL_NAME' => $thumbnail['name'], 'IMAGE_THUMBNAIL_SIZE' => $thumbnail['size'], 'TXT_IMAGE_THUMBNAILS_MAXIMUM' => sprintf($_ARRAYLANG['TXT_IMAGE_THUMBNAILS_MAXIMUM'], $thumbnail['size'] . 'px')));
$objTemplate->parse('settings_image_thumbnails_list');
}
// Gets the settings
$query = '
SELECT `name`, `value`
FROM `' . DBPREFIX . 'settings_image`
';
$objResult = $objDatabase->Execute($query);
if ($objResult !== false) {
$arrSettings = array();
while (!$objResult->EOF) {
// Creates the settings array
$arrSettings[$objResult->fields['name']] = $objResult->fields['value'];
$objResult->MoveNext();
}
} else {
throw new \Exception('Could not query the settings.');
}
// Defines the compression values
$arrCompressionOptions = array();
for ($i = 1; $i <= 20; $i++) {
$arrCompressionOptions[] = $i * 5;
}
// Parses the compression options
$imageCompression = !empty($arrSettings['image_compression']) ? intval($arrSettings['image_compression']) : 95;
foreach ($arrCompressionOptions as $compression) {
$objTemplate->setVariable(array('IMAGE_COMPRESSION_VALUE' => $compression, 'IMAGE_COMPRESSION_NAME' => $compression, 'OPTION_SELECTED' => $compression == $imageCompression ? 'selected="selected"' : ''));
$objTemplate->parse('settings_image_compression_options');
}
// Parses the settings
$objTemplate->setVariable(array('TXT_IMAGE_TITLE' => $_ARRAYLANG['TXT_SETTINGS_IMAGE_TITLE'], 'TXT_IMAGE_CSRF' => \Cx\Core\Csrf\Controller\Csrf::param(), 'TXT_IMAGE_THUMBNAILS_DELETE' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS_DELETE'], 'TXT_IMAGE_CUT_WIDTH' => $_ARRAYLANG['TXT_SETTINGS_IMAGE_CUT_WIDTH'], 'TXT_IMAGE_CUT_HEIGHT' => $_ARRAYLANG['TXT_SETTINGS_IMAGE_CUT_HEIGHT'], 'TXT_IMAGE_THUMBNAILS' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS'], 'TXT_IMAGE_COMPRESSION' => $_ARRAYLANG['TXT_SETTINGS_IMAGE_COMPRESSION'], 'TXT_SAVE' => $_ARRAYLANG['TXT_SAVE'], 'TXT_IMAGE_THUMBNAILS_ID' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS_ID'], 'TXT_IMAGE_THUMBNAILS_NAME' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS_NAME'], 'TXT_IMAGE_THUMBNAILS_SIZE' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS_SIZE'], 'TXT_SETTINGS_FUNCTIONS' => $_ARRAYLANG['TXT_SETTINGS_FUNCTIONS'], 'TXT_IMAGE_THUMBNAILS_RELOAD' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS_RELOAD'], 'TXT_IMAGE_THUMBNAILS_NEW' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS_NEW'], 'TXT_IMAGE_THUMBNAILS_MAX_SIZE' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS_MAX_SIZE'], 'SETTINGS_IMAGE_CUT_WIDTH' => !empty($arrSettings['image_cut_width']) ? $arrSettings['image_cut_width'] : 0, 'SETTINGS_IMAGE_CUT_HEIGHT' => !empty($arrSettings['image_cut_height']) ? $arrSettings['image_cut_height'] : 0));
$objTemplate->parse('settings_image');
\Cx\Core\Csrf\Controller\Csrf::add_placeholder($objTemplate);
return true;
}
示例5: _editUser
//.........这里部分代码省略.........
$recipientLanguage = $_POST['language'];
}
if (isset($_POST['newsletter_recipient_associated_list'])) {
foreach ($_POST['newsletter_recipient_associated_list'] as $listId => $status) {
if (intval($status) == 1) {
array_push($arrAssociatedLists, intval($listId));
}
}
}
// Get interface settings
$objInterface = $objDatabase->Execute('SELECT `setvalue`
FROM `' . DBPREFIX . 'module_newsletter_settings`
WHERE `setname` = "recipient_attribute_status"');
$recipientAttributeStatus = json_decode($objInterface->fields['setvalue'], true);
if (isset($_POST['newsletter_recipient_save'])) {
$objValidator = new \FWValidator();
if ($objValidator->isEmail($recipientEmail)) {
if ($this->_validateRecipientAttributes($recipientAttributeStatus, $recipientUri, $recipientSex, $recipientSalutation, $recipientTitle, $recipientLastname, $recipientFirstname, $recipientPosition, $recipientCompany, $recipientIndustrySector, $recipientAddress, $recipientZip, $recipientCity, $recipientCountry, $recipientPhoneOffice, $recipientPhonePrivate, $recipientPhoneMobile, $recipientFax, $recipientBirthday)) {
if ($this->_isUniqueRecipientEmail($recipientEmail, $recipientId, $copy)) {
//reset the $recipientId on copy function
$recipientId = $copy ? 0 : $recipientId;
if ($recipientId > 0) {
if ($this->_updateRecipient($recipientAttributeStatus, $recipientId, $recipientEmail, $recipientUri, $recipientSex, $recipientSalutation, $recipientTitle, $recipientLastname, $recipientFirstname, $recipientPosition, $recipientCompany, $recipientIndustrySector, $recipientAddress, $recipientZip, $recipientCity, $recipientCountry, $recipientPhoneOffice, $recipientPhonePrivate, $recipientPhoneMobile, $recipientFax, $recipientNotes, $recipientBirthday, $recipientStatus, $arrAssociatedLists, $recipientLanguage)) {
self::$strOkMessage .= $_ARRAYLANG['TXT_NEWSLETTER_RECIPIENT_UPDATED_SUCCESSFULLY'];
return $this->_userList();
} else {
// fall back to old recipient id, if any error occurs on copy
$recipientId = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
self::$strErrMessage .= $_ARRAYLANG['TXT_NEWSLETTER_ERROR_UPDATE_RECIPIENT'];
}
} else {
if ($this->_addRecipient($recipientEmail, $recipientUri, $recipientSex, $recipientSalutation, $recipientTitle, $recipientLastname, $recipientFirstname, $recipientPosition, $recipientCompany, $recipientIndustrySector, $recipientAddress, $recipientZip, $recipientCity, $recipientCountry, $recipientPhoneOffice, $recipientPhonePrivate, $recipientPhoneMobile, $recipientFax, $recipientNotes, $recipientBirthday, $recipientStatus, $arrAssociatedLists, $recipientLanguage)) {
if (!empty($recipientSendEmailId)) {
$objRecipient = $objDatabase->SelectLimit("SELECT id FROM " . DBPREFIX . "module_newsletter_user WHERE email='" . contrexx_input2db($recipientEmail) . "'", 1);
$recipientId = $objRecipient->fields['id'];
$this->insertTmpEmail($recipientSendEmailId, $recipientEmail, self::USER_TYPE_NEWSLETTER);
// setting TmpEntry=1 will set the newsletter status=1, this will force an imediate stop in the newsletter send procedere.
if ($this->SendEmail($recipientId, $recipientSendEmailId, $recipientEmail, 1, self::USER_TYPE_NEWSLETTER) == false) {
// fall back to old recipient id, if any error occurs on copy
$recipientId = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
self::$strErrMessage .= $_ARRAYLANG['TXT_SENDING_MESSAGE_ERROR'];
} else {
$objRecipientCount = $objDatabase->execute('SELECT subject FROM ' . DBPREFIX . 'module_newsletter WHERE id=' . intval($recipientSendEmailId));
$newsTitle = $objRecipientCount->fields['subject'];
// TODO: Unused
// $objUpdateCount =
$objDatabase->execute('
UPDATE ' . DBPREFIX . 'module_newsletter
SET recipient_count = recipient_count+1
WHERE id=' . intval($recipientSendEmailId));
self::$strOkMessage .= sprintf($_ARRAYLANG['TXT_NEWSLETTER_RECIPIENT_MAIL_SEND_SUCCESSFULLY'] . '<br />', '<strong>' . $newsTitle . '</strong>');
}
}
self::$strOkMessage .= $_ARRAYLANG['TXT_NEWSLETTER_RECIPIENT_SAVED_SUCCESSFULLY'];
return $this->_userList();
} else {
// fall back to old recipient id, if any error occurs on copy
$recipientId = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
self::$strErrMessage .= $_ARRAYLANG['TXT_NEWSLETTER_ERROR_SAVE_RECIPIENT'];
}
}
} elseif (empty($recipientId)) {
$objRecipient = $objDatabase->SelectLimit("SELECT id, language, status, notes FROM " . DBPREFIX . "module_newsletter_user WHERE email='" . contrexx_input2db($recipientEmail) . "'", 1);
$recipientId = $objRecipient->fields['id'];
$recipientLanguage = $objRecipient->fields['language'];
$recipientStatus = $objRecipient->fields['status'];
示例6: updateSettings
/**
* Update settings and write them to the database
*
* @global object $objDatabase
* @global object $objTemplate
* @global array $_ARRAYLANG
*/
function updateSettings()
{
global $objDatabase, $objTemplate, $_ARRAYLANG, $_CONFIG;
if (!isset($_POST['frmSettings_Submit'])) {
return;
}
\Cx\Core\Setting\Controller\Setting::init('Config', 'cache', 'Yaml');
\Cx\Core\Setting\Controller\Setting::set('cacheEnabled', $_POST['cachingStatus']);
\Cx\Core\Setting\Controller\Setting::set('cacheExpiration', intval($_POST['cachingExpiration']));
\Cx\Core\Setting\Controller\Setting::set('cacheUserCache', contrexx_input2db($_POST['usercache']));
\Cx\Core\Setting\Controller\Setting::set('cacheOPCache', contrexx_input2db($_POST['opcache']));
\Cx\Core\Setting\Controller\Setting::set('cacheOpStatus', contrexx_input2db($_POST['cacheOpStatus']));
\Cx\Core\Setting\Controller\Setting::set('cacheOpStatus', contrexx_input2db($_POST['cacheOpStatus']));
\Cx\Core\Setting\Controller\Setting::set('cacheDbStatus', contrexx_input2db($_POST['cacheDbStatus']));
\Cx\Core\Setting\Controller\Setting::set('cacheReverseProxy', contrexx_input2db($_POST['cacheReverseProxy']));
\Cx\Core\Setting\Controller\Setting::set('internalSsiCache', contrexx_input2db($_POST['internalSsiCache']));
$oldSsiValue = $_CONFIG['cacheSsiOutput'];
\Cx\Core\Setting\Controller\Setting::set('cacheSsiOutput', contrexx_input2db($_POST['cacheSsiOutput']));
\Cx\Core\Setting\Controller\Setting::set('cacheSsiType', contrexx_input2db($_POST['cacheSsiType']));
foreach (array('cacheUserCacheMemcacheConfig' => array('key' => 'memcacheSetting', 'defaultPort' => 11211), 'cacheProxyCacheConfig' => array('key' => 'reverseProxy', 'defaultPort' => 8080), 'cacheSsiProcessorConfig' => array('key' => 'ssiProcessor', 'defaultPort' => 8080)) as $settingName => $settings) {
$hostnamePortSetting = $settings['key'];
if (!empty($_POST[$hostnamePortSetting . 'Ip']) || !empty($_POST[$hostnamePortSetting . 'Port'])) {
$settings = json_encode(array('ip' => !empty($_POST[$hostnamePortSetting . 'Ip']) ? contrexx_input2raw($_POST[$hostnamePortSetting . 'Ip']) : '127.0.0.1', 'port' => !empty($_POST[$hostnamePortSetting . 'Port']) ? intval($_POST[$hostnamePortSetting . 'Port']) : $defaultPort));
\Cx\Core\Setting\Controller\Setting::set($settingName, $settings);
}
}
\Cx\Core\Setting\Controller\Setting::updateAll();
$this->arrSettings = $this->getSettings();
$this->initUserCaching();
// reinit user caches (especially memcache)
$this->initOPCaching();
// reinit opcaches
$this->getActivatedCacheEngines();
$this->clearCache($this->getOpCacheEngine());
if ($oldSsiValue != contrexx_input2db($_POST['cacheSsiOutput'])) {
$this->_deleteAllFiles('cxPages');
}
if (!count($this->objSettings->strErrMessage)) {
$objTemplate->SetVariable('CONTENT_OK_MESSAGE', $_ARRAYLANG['TXT_SETTINGS_UPDATED']);
} else {
$objTemplate->SetVariable('CONTENT_STATUS_MESSAGE', implode("<br />\n", $this->objSettings->strErrMessage));
}
}
示例7: save
//.........这里部分代码省略.........
`id`
FROM
`' . DBPREFIX . 'module_' . $this->moduleTablePrefix . '_registration_form_field`
WHERE
`form` = ' . $formId . '
AND
`type` = "seating"
LIMIT 1
';
$objResult = $objDatabase->Execute($query);
$numSeating = intval($data['registrationField'][$objResult->fields['id']]);
$type = empty($regId) && intval($objEvent->getFreePlaces() - $numSeating) < 0 ? 2 : (isset($data['registrationType']) ? intval($data['registrationType']) : 1);
$this->saveIn = intval($type);
$paymentMethod = intval($data['paymentMethod']);
$paid = intval($data['paid']);
$hostName = 0;
$ipAddress = 0;
$key = $this->generateKey();
if ($regId == 0) {
$submissionDate = $this->getDbDateTimeFromIntern($this->getInternDateTimeFromUser());
$query = 'INSERT INTO ' . DBPREFIX . 'module_' . $this->moduleTablePrefix . '_registration
SET `event_id` = ' . $eventId . ',
`submission_date` = "' . $submissionDate->format('Y-m-d H:i:s') . '",
`date` = ' . $eventDate . ',
`host_name` = "' . $hostName . '",
`ip_address` = "' . $ipAddress . '",
`type` = ' . $type . ',
`key` = "' . $key . '",
`user_id` = ' . $userId . ',
`lang_id` = ' . $_LANGID . ',
`export` = 0,
`payment_method` = ' . $paymentMethod . ',
`paid` = ' . $paid . ' ';
$objResult = $objDatabase->Execute($query);
if ($objResult !== false) {
$this->id = $objDatabase->Insert_ID();
} else {
return false;
}
} else {
$query = 'UPDATE `' . DBPREFIX . 'module_' . $this->moduleTablePrefix . '_registration`
SET `event_id` = ' . $eventId . ',
`date` = ' . $eventDate . ',
`host_name` = ' . $hostName . ',
`ip_address` = ' . $ipAddress . ',
`key` = "' . $key . '",
`user_id` = ' . $userId . ',
`type` = ' . $type . ',
`lang_id` = ' . $_LANGID . ',
`payment_method` = ' . $paymentMethod . ',
`paid` = ' . $paid . '
WHERE `id` = ' . $regId;
$objResult = $objDatabase->Execute($query);
if ($objResult === false) {
return false;
}
}
if ($regId != 0) {
$this->id = $regId;
$deleteQuery = 'DELETE FROM ' . DBPREFIX . 'module_' . $this->moduleTablePrefix . '_registration_form_field_value
WHERE `reg_id` = ' . $this->id;
$objDeleteResult = $objDatabase->Execute($deleteQuery);
if ($objDeleteResult === false) {
return false;
}
}
foreach ($this->form->inputfields as $key => $arrInputfield) {
$value = $data['registrationField'][$arrInputfield['id']];
$id = $arrInputfield['id'];
if (is_array($value)) {
$subvalue = array();
foreach ($value as $key => $element) {
if (!empty($data['registrationFieldAdditional'][$id][$element - 1])) {
$subvalue[] = $element . '[[' . $data['registrationFieldAdditional'][$id][$element - 1] . ']]';
} else {
$subvalue[] = $element;
}
}
$value = join(",", $subvalue);
} else {
if (isset($data['registrationFieldAdditional'][$id][$value - 1])) {
$value = $value . "[[" . $data['registrationFieldAdditional'][$id][$value - 1] . "]]";
}
}
$query = 'INSERT INTO ' . DBPREFIX . 'module_' . $this->moduleTablePrefix . '_registration_form_field_value
(`reg_id`, `field_id`, `value`)
VALUES (' . $this->id . ', ' . $id . ', "' . contrexx_input2db($value) . '")';
$objResult = $objDatabase->Execute($query);
if ($objResult === false) {
return false;
}
}
if ($objInit->mode == 'frontend') {
$objMailManager = new \Cx\Modules\Calendar\Controller\CalendarMailManager();
$templateId = $objEvent->emailTemplate[FRONTEND_LANG_ID];
$objMailManager->sendMail($objEvent, \Cx\Modules\Calendar\Controller\CalendarMailManager::MAIL_CONFIRM_REG, $this->id, $templateId);
$objMailManager->sendMail($objEvent, \Cx\Modules\Calendar\Controller\CalendarMailManager::MAIL_ALERT_REG, $this->id);
}
return true;
}
示例8: storeEMail
/**
* store the email address
*
* @global array $_ARRAYLANG
* @access public
* @author Adrian Berger <ab@comvation.com>
* @return void
*/
function storeEMail()
{
global $objDatabase;
$objDatabase->Execute("INSERT INTO `" . DBPREFIX . "module_crm_customer_contact_emails`\n SET `email` = '" . contrexx_input2db($this->email) . "',\n `email_type` = 1, `is_primary` = '1', contact_id = {$this->id}");
}
示例9: saveCsvData
//.........这里部分代码省略.........
$skip = false;
switch ($duplicate) {
case 0:
if (empty($existingUser)) {
$this->contact->save();
} else {
$skip = true;
}
break;
case 1:
if (!empty($existingUser)) {
$this->contact->id = $existingUser;
}
case 2:
$this->contact->save();
break;
}
if (!$skip) {
$importedLines++;
$_SESSION[$fileName]['importedRows'] = $importedLines;
//insert customer groups
if (isset($customerGroups) && !empty($line[$customerGroups])) {
$groupIds = array();
$groupNames = explode(', ', $line[$customerGroups]);
$query = 'SELECT
`membership`.`id`
FROM
`' . DBPREFIX . 'module_' . $this->moduleNameLC . '_memberships` AS membership
LEFT JOIN
`' . DBPREFIX . 'module_' . $this->moduleNameLC . '_membership_local` AS memberLoc
ON
`membership`.`id` = `memberLoc`.`entry_id`
WHERE
`memberLoc`.`value` IN ("' . implode('" , "', contrexx_input2db($groupNames)) . '")
';
$objResult = $objDatabase->Execute($query);
if ($objResult && $objResult->RecordCount() > 0) {
while (!$objResult->EOF) {
$groupIds[] = $objResult->fields['id'];
$objResult->MoveNext();
}
}
if ($groupIds) {
$this->updateCustomerMemberships($groupIds, $this->contact->id);
}
}
// insert Emails
$first = true;
foreach ($this->emailOptions as $key => $emailValue) {
if (isset(${"customer_email_{$key}"})) {
if (!empty($line[${"customer_email_{$key}"}]) && filter_var($line[${"customer_email_{$key}"}], FILTER_VALIDATE_EMAIL)) {
$tableName = "module_{$this->moduleNameLC}_customer_contact_emails";
$fields = array('email' => contrexx_input2db($line[${"customer_email_{$key}"}]), 'email_type' => $key, 'is_primary' => $first ? '1' : '0', 'contact_id' => $this->contact->id);
$first = false;
$values = array('email_type', $key, $this->contact->id);
$this->checkRecordStoreTODB($tableName, $values, $fields);
}
}
}
// insert Phone
$first = true;
foreach ($this->phoneOptions as $key => $phoneValue) {
if (isset(${"customer_phone_{$key}"})) {
if (!empty($line[${"customer_phone_{$key}"}])) {
$tableName = "module_{$this->moduleNameLC}_customer_contact_phone";
$fields = array('phone' => contrexx_input2db($line[${"customer_phone_{$key}"}]), 'phone_type' => $key, 'is_primary' => $first ? '1' : '0', 'contact_id' => $this->contact->id);
示例10: showLogs
function showLogs()
{
global $objDatabase, $_ARRAYLANG, $_CONFIG, $objTemplate;
$objTemplate->addBlockfile('ADMIN_CONTENT', 'log', 'log.html');
$objTemplate->setVariable(array('TXT_SYSTEM_LOGS' => $_ARRAYLANG['TXT_SYSTEM_LOGS'], 'TXT_CONFIRM_DELETE_DATA' => $_ARRAYLANG['TXT_CONFIRM_DELETE_DATA'], 'TXT_ACTION_IS_IRREVERSIBLE' => $_ARRAYLANG['TXT_ACTION_IS_IRREVERSIBLE'], 'TXT_HOSTNAME' => $_ARRAYLANG['TXT_HOSTNAME'], 'TXT_IP_ADDRESS' => $_ARRAYLANG['TXT_IP_ADDRESS'], 'TXT_USER_NAME' => $_ARRAYLANG['TXT_USERNAME'], 'TXT_LOGTIME' => $_ARRAYLANG['TXT_LOGTIME'], 'TXT_USERAGENT' => $_ARRAYLANG['TXT_USERAGENT'], 'TXT_BROWSERLANGUAGE' => $_ARRAYLANG['TXT_BROWSERLANGUAGE'], 'TXT_ACTION' => $_ARRAYLANG['TXT_ACTION'], 'TXT_SEARCH' => $_ARRAYLANG['TXT_SEARCH']));
$objFWUser = \FWUser::getFWUserObject();
$user = isset($_GET['user']) ? intval($_GET['user']) : 0;
$term = isset($_POST['term']) ? contrexx_input2db($_POST['term']) : '';
$objTemplate->setVariable('LOG_SEARCHTERM', $term);
$q_search = '';
if (!empty($term)) {
$q_search = "WHERE log.id LIKE '%{$term}%'\n OR log.userid LIKE '%{$term}%'\n OR log.useragent LIKE '%{$term}%'\n OR log.userlanguage LIKE '%{$term}%'\n OR log.remote_addr LIKE '%{$term}%'\n OR log.remote_host LIKE '%{$term}%'\n OR log.http_via LIKE '%{$term}%'\n OR log.http_client_ip LIKE '%{$term}%'\n OR log.http_x_forwarded_for LIKE '%{$term}%'\n OR log.referer LIKE '%{$term}%'";
if ($objUser = $objFWUser->objUser->getUsers(array('username' => "%{$term}%"))) {
while (!$objUser->EOF) {
$q_search .= ' OR log.userid=' . $objUser->getId();
$objUser->next();
}
}
} else {
if (!empty($user)) {
$q_search = 'WHERE log.userid = ' . $user;
}
}
$q = "SELECT log.id AS id,\n log.userid AS userid,\n log.datetime AS datetime,\n log.useragent AS useragent,\n log.userlanguage AS userlanguage,\n log.remote_addr AS remote_addr,\n log.remote_host AS remote_host,\n log.http_via AS http_via,\n log.http_client_ip AS http_client_ip,\n log.http_x_forwarded_for AS http_x_forwarded_for,\n log.referer AS referer\n FROM " . DBPREFIX . "log AS log\n {$q_search} \n ORDER BY log.id DESC\n ";
$objResult = $objDatabase->Execute($q);
if ($objResult === false) {
$this->errorHandling();
return false;
}
$pos = intval($_GET[pos]);
$count = $objResult->RecordCount();
if (!empty($term)) {
$paging = getPaging($count, $pos, "&cmd=SystemLog&term={$term}", "<b>" . $_ARRAYLANG['TXT_LOG_ENTRIES'] . "</b>", true);
} else {
$paging = getPaging($count, $pos, "&cmd=SystemLog", "<b>" . $_ARRAYLANG['TXT_LOG_ENTRIES'] . "</b>", true);
}
$objResult = $objDatabase->SelectLimit($q, $_CONFIG['corePagingLimit'], $pos);
if ($objResult === false) {
$this->errorHandling();
return false;
}
$objTemplate->setVariable(array('LOG_PAGING' => $paging, 'LOG_TOTAL' => $count));
while (!$objResult->EOF) {
$objUser = $objFWUser->objUser->getUser($objResult->fields['userid']);
if ($i % 2 == 0) {
$class = "row1";
} else {
$class = "row2";
}
$objTemplate->setVariable(array('LOG_ROWCLASS' => $class, 'LOG_ID' => $objResult->fields['id'], 'LOG_USERID' => $objUser ? $objUser->getId() : 0, 'LOG_USERNAME' => $objUser ? htmlentities($objUser->getUsername(), ENT_QUOTES, CONTREXX_CHARSET) : '', 'LOG_TIME' => $objResult->fields['datetime'], 'LOG_USERAGENT' => $objResult->fields['useragent'], 'LOG_USERLANGUAGE' => $objResult->fields['userlanguage'], 'LOG_REMOTE_ADDR' => $objResult->fields['remote_addr'], 'LOG_REMOTE_HOST' => $objResult->fields['remote_host'], 'LOG_HTTP_VIA' => $objResult->fields['http_via'], 'LOG_CLIENT_IP' => $objResult->fields['http_client_ip'], 'LOG_X_FORWARDED_FOR' => $objResult->fields['http_x_forwarded_for'], 'LOG_REFERER' => $objResult->fields['referer']));
$objTemplate->parse("logRow");
$i++;
$objResult->MoveNext();
}
}
示例11: saveInputfields
/**
* save the form input fields
*
* @param array $data
*
* @return boolean true on success false otherwise
*/
function saveInputfields($data)
{
global $objDatabase, $_LANGID;
$this->getFrontendLanguages();
$query = '
DELETE
fn.*, ff.*
FROM
`' . DBPREFIX . 'module_' . $this->moduleTablePrefix . '_registration_form_field_name` AS fn,
`' . DBPREFIX . 'module_' . $this->moduleTablePrefix . '_registration_form_field` AS ff
WHERE
fn.`form_id` = ' . contrexx_input2int($this->id) . '
AND
ff.`form` =' . contrexx_input2int($this->id) . '
';
$objResult = $objDatabase->Execute($query);
if (!$objResult) {
return false;
}
foreach ($data['inputfield'] as $intFieldId => $arrField) {
$query = '
INSERT INTO
`' . DBPREFIX . 'module_' . $this->moduleTablePrefix . '_registration_form_field`
SET
`id` = ' . contrexx_input2int($intFieldId) . ',
`form` = ' . contrexx_input2int($this->id) . ',
`type` = "' . contrexx_input2db($arrField['type']) . '",
`required` = ' . (isset($arrField['required']) ? 1 : 0) . ',
`order` = ' . contrexx_input2int($arrField['order']) . ',
`affiliation` = "' . (isset($arrField['affiliation']) ? contrexx_input2db($arrField['affiliation']) : '') . '"
';
$objResult = $objDatabase->Execute($query);
if ($objResult === false) {
continue;
}
foreach ($this->arrFrontendLanguages as $key => $arrLang) {
if (empty($arrField['name'][0])) {
$arrField['name'][0] = '';
}
$strFieldName = $arrField['name'][$arrLang['id']];
$strFieldDefaultValue = $arrField['default_value'][$arrLang['id']];
if ($arrLang['id'] == $_LANGID) {
if ($this->inputfields[$intFieldId]['name'][0] == $strFieldName && $this->inputfields[$intFieldId]['name'][$arrLang['id']] != $strFieldName) {
$strFieldName = $arrField['name'][$_LANGID];
}
if ($this->inputfields[$intFieldId]['default_value'][0] == $strFieldDefaultValue && $this->inputfields[$intFieldId]['default_value'][$arrLang['id']] != $strFieldDefaultValue) {
$strFieldDefaultValue = $arrField['default_value'][$_LANGID];
}
if ($this->inputfields[$intFieldId]['name'][0] != $arrField['name'][0] && $this->inputfields[$intFieldId]['name'][$arrLang['id']] == $strFieldName || $this->inputfields[$intFieldId]['name'][0] != $arrField['name'][0] && $this->inputfields[$intFieldId]['name'][$arrLang['id']] != $strFieldName || $this->inputfields[$intFieldId]['name'][0] == $arrField['name'][0] && $this->inputfields[$intFieldId]['name'][$arrLang['id']] == $strFieldName) {
$strFieldName = $arrField['name'][0];
}
if ($this->inputfields[$intFieldId]['default_value'][0] != $arrField['default_value'][0] && $this->inputfields[$intFieldId]['default_value'][$arrLang['id']] == $strFieldDefaultValue || $this->inputfields[$intFieldId]['default_value'][0] != $arrField['default_value'][0] && $this->inputfields[$intFieldId]['default_value'][$arrLang['id']] != $strFieldDefaultValue || $this->inputfields[$intFieldId]['default_value'][0] == $arrField['default_value'][0] && $this->inputfields[$intFieldId]['default_value'][$arrLang['id']] == $strFieldDefaultValue) {
$strFieldDefaultValue = $arrField['default_value'][0];
}
}
if (empty($strFieldName)) {
$strFieldName = $arrField['name'][0];
}
if (empty($strFieldDefaultValue)) {
$strFieldDefaultValue = $arrField['default_value'][0];
}
$query = '
INSERT INTO
`' . DBPREFIX . 'module_' . $this->moduleTablePrefix . '_registration_form_field_name`
SET
`field_id` = ' . contrexx_input2int($intFieldId) . ',
`form_id` = ' . contrexx_input2int($this->id) . ',
`lang_id` = ' . contrexx_input2int($arrLang['id']) . ',
`name` = "' . contrexx_input2db($strFieldName) . '",
`default` = "' . contrexx_input2db($strFieldDefaultValue) . '"';
$objResult = $objDatabase->Execute($query);
}
}
return true;
}
示例12: addQuestions
function addQuestions()
{
global $_CORELANG, $_ARRAYLANG, $objDatabase;
\JS::activate('greybox');
$this->_pageTitle = $_ARRAYLANG['TXT_SURVEY_ADDQUESTION_TXT'];
$this->_objTpl->loadTemplateFile('module_add_survey.html');
// Parsing javascript function to the place holder.
$this->_objTpl->setVariable(array('CREATE_SURVEY_JAVASCRIPT' => $this->getCreateSurveyJavascript(), 'SELECT_COMMENTABLE_NO' => "checked", 'SURVEY_IMAGE_PATH' => ASCMS_PATH_OFFSET . ASCMS_MODULE_FOLDER . '/Survey/View/Media', 'WELCOME_MSD' => $_ARRAYLANG['TXT_WELCOME_MSG'], 'TXT_ADD_QUESTION' => $_ARRAYLANG['TXT_SURVEY_CREATEQUESTION_TXT'], 'TXT_SELECT_QUESTION' => $_ARRAYLANG['TXT_SELECT_QUESTION'], 'TXT_QUESTION_TYPE' => $_ARRAYLANG['TXT_QUESTION_TYPE'], 'TXT_MULTIPLE_CHOICE_ONE_ANSWER' => $_ARRAYLANG['TXT_MULTIPLE_CHOICE_ONE_ANSWER'], 'TXT_MULTIPLE_CHOICE_MULTIPLE_ANSWER' => $_ARRAYLANG['TXT_MULTIPLE_CHOICE_MULTIPLE_ANSWER'], 'TXT_MATRIX_CHOICE_ONE_ANSWER_PER_ROW' => $_ARRAYLANG['TXT_MATRIX_CHOICE_ONE_ANSWER_PER_ROW'], 'TXT_MATRIX_CHOICE_MULTIPLE_ANSWER_PER_ROW' => $_ARRAYLANG['TXT_MATRIX_CHOICE_MULTIPLE_ANSWER_PER_ROW'], 'TXT_SINGLE_TEXTBOX' => $_ARRAYLANG['TXT_SINGLE_TEXTBOX'], 'TXT_QUESTION_TEXT' => $_ARRAYLANG['TXT_QUESTION_TEXT'], 'TXT_ANSWER_CHOICE' => $_ARRAYLANG['TXT_ANSWER_CHOICE'], 'TXT_ADD_COMMENT' => $_ARRAYLANG['TXT_ADD_COMMENT'], 'TXT_YES' => $_ARRAYLANG['TXT_YES'], 'TXT_NO' => $_ARRAYLANG['TXT_NO'], 'TXT_HELP_TXT' => $_ARRAYLANG['TXT_HELP_TXT'], 'TXT_HELP_IMAGE_TXT' => $_ARRAYLANG['TXT_HELP_IMAGE_TXT'], 'TXT_SAVE_TXT' => $_ARRAYLANG['TXT_SAVE_TXT'], 'TXT_COLUMN_CHOICE' => $_ARRAYLANG['TXT_COLUMN_CHOICE'], 'TXT_MULTIPLE_TEXTBOX' => $_ARRAYLANG['TXT_MULTIPLE_TEXTBOX'], 'TXT_TEXT_ROW' => $_ARRAYLANG['TXT_TEXT_ROW'], 'TXT_HELPONE_SEL' => 'none', 'TXT_HELPTWO_SEL' => 'none', 'TXT_HELPTHREE_SEL' => 'none', 'TXT_HELPFOUR_SEL' => 'none', 'TXT_HELPFIVE_SEL' => 'none', 'TXT_HELPSIX_SEL' => 'none', 'TXT_COLHIDE' => 'display:none', 'TXT_RTEXTHIDE' => 'none', 'TXT_HELPSEVEN_SEL' => 'none'));
if (isset($_POST['surveyQuestions_submit'])) {
$surveyId = contrexx_input2raw($_REQUEST['surveyId']);
$questionType = contrexx_input2raw($_POST['questionType']);
$columnChoices = contrexx_input2raw($_POST['ColumnChoices']);
$questionAnswers = contrexx_input2raw($_POST['QuestionAnswers']);
$vote = 0;
$Question = $questionType != 7 ? contrexx_input2db($_POST['Question']) : contrexx_input2db($_POST['QuestionRow']);
if ($questionType == 3 || $questionType == 4) {
$options = explode("\n", $columnChoices);
$ColChoices = explode("\n", $questionAnswers);
$colChoic = implode($ColChoices, ";");
$vote = array();
foreach ($ColChoices as $key => $value) {
$vote[$key] = 0;
}
$vote = json_encode($vote);
} else {
$options = explode("\n", $questionAnswers);
$ColChoices = explode("\n", $columnChoices);
$colChoic = "";
}
if ($questionType == 5) {
$options[0] = "Answer";
}
$commentable = contrexx_input2db($_POST['Iscomment']);
if ($questionType == 7) {
$options[0] = "Answer";
$commentable = contrexx_input2db($_POST['Iscomment']);
}
$sorting_id = 0;
$objResult = $objDatabase->Execute('SELECT MAX(`pos`) as `pos` FROM `' . DBPREFIX . 'module_survey_surveyQuestions` WHERE `survey_id` =' . $surveyId);
$sorting_id = $objResult->fields['pos'] + 1;
// Insert Query for Inserting the Fields Posted
$insertSurvey = 'INSERT INTO `' . DBPREFIX . 'module_survey_surveyQuestions`
SET `survey_id` = "' . contrexx_raw2db($surveyId) . '",
`isCommentable` = "' . $commentable . '",
`QuestionType` = "' . contrexx_raw2db($questionType) . '",
`Question` = "' . $Question . '",
`pos` = ' . $sorting_id . ',
`column_choice` = "' . contrexx_raw2db($colChoic) . '" ';
$objDatabase->Execute($insertSurvey);
$lastId = mysql_insert_id();
for ($i = 0; $i < count($options); $i++) {
if (trim($options[$i]) != "") {
$insertSurvey = 'INSERT INTO `' . DBPREFIX . 'module_survey_surveyAnswers`
SET `question_id` = "' . $lastId . '",
`answer` = "' . contrexx_raw2db($options[$i]) . '",
`votes` = "' . contrexx_raw2db($vote) . '"';
$objDatabase->Execute($insertSurvey);
}
}
// loop for inserting the column choices
for ($i = 0; $i < count($ColChoices); $i++) {
if ($ColChoices[$i] != "") {
$insertSurvey = 'INSERT INTO `' . DBPREFIX . 'module_survey_columnChoices`
SET `question_id` = "' . $lastId . '",
`choice` = "' . contrexx_raw2db($ColChoices[$i]) . '"';
$objDatabase->Execute($insertSurvey);
}
}
$this->_strOkMessage = $_ARRAYLANG['TXT_SURVEY_ADDED_SUC_TXT'];
if (isset($_REQUEST['linkId']) && $_REQUEST['linkId'] != "") {
$ids = contrexx_input2raw($_REQUEST['linkId']);
$link = "index.php?cmd=Survey&act=editQuestionsOverview&id=" . $ids . "&linkId=" . $ids . "&" . \Cx\Core\Csrf\Controller\Csrf::param();
$this->_objTpl->setVariable(array('ADD_QUESTION_HERE' => '<a href="index.php?cmd=Survey&act=addQuestions&surveyId=' . $surveyId . '" title="' . $_ARRAYLANG['TXT_SURVEY_ADDQUESTION_TXT'] . '">
' . $_ARRAYLANG['TXT_SURVEY_ADDQUESTION_ANOTHER_TXT'] . '</a>', 'TXT_DONE' => '<input type="button" name="Done" value="' . $_ARRAYLANG['TXT_SURVEY_DONE_TXT'] . '" onclick= "window.location=\'' . $link . '\'" />', 'TXT_PREVIEW' => '<input type="button" name="Preview" value="' . $_ARRAYLANG['TXT_SURVEY_PREVIEW_TXT'] . '" onClick="window.open(' . "'" . '../index.php?section=Survey&cmd=surveypreview&id=' . $surveyId . "'" . ')">'));
} else {
$link = 'index.php?cmd=Survey&act=editQuestionsOverview&id=' . $surveyId . '&linkId=' . $surveyId . '&' . \Cx\Core\Csrf\Controller\Csrf::param();
$this->_objTpl->setVariable(array('ADD_QUESTION_HERE' => '<a href="index.php?cmd=Survey&act=addQuestions&surveyId=' . $surveyId . '" title="' . $_ARRAYLANG['TXT_SURVEY_ADDQUESTION_TXT'] . '">
' . $_ARRAYLANG['TXT_SURVEY_ADDQUESTION_ANOTHER_TXT'] . '</a>', 'TXT_DONE' => '<input type="button" name="Done" value="' . $_ARRAYLANG['TXT_SURVEY_DONE_TXT'] . '" onclick= "window.location=\'' . $link . '\'" />', 'TXT_PREVIEW' => '<input type="button" name="Preview" value="' . $_ARRAYLANG['TXT_SURVEY_PREVIEW_TXT'] . '" onClick="window.open(' . "'" . '../index.php?section=Survey&cmd=surveypreview&id=' . $surveyId . "'" . ')">'));
}
}
}
示例13: settings
/**
* Settings page
* @global array $_ARRAYLANG
*/
private function settings()
{
global $_ARRAYLANG, $_LANGID;
\Permission::checkAccess(142, 'static');
$this->_pageTitle = $_ARRAYLANG['TXT_DOWNLOADS_SETTINGS'];
$this->objTemplate->loadTemplateFile('module_downloads_settings.html');
if (isset($_POST['downloads_settings_save'])) {
$this->arrConfig['overview_cols_count'] = !empty($_POST['downloads_settings_col_count']) ? intval($_POST['downloads_settings_col_count']) : $this->arrConfig['overview_cols_count'];
$this->arrConfig['overview_max_subcats'] = !empty($_POST['downloads_settings_subcat_count']) ? intval($_POST['downloads_settings_subcat_count']) : $this->arrConfig['overview_max_subcats'];
$this->arrConfig['use_attr_metakeys'] = !empty($_POST['downloads_settings_attribute_metakeys']) ? intval($_POST['downloads_settings_attribute_metakeys']) : 0;
$this->arrConfig['use_attr_size'] = !empty($_POST['downloads_settings_attribute_size']) ? intval($_POST['downloads_settings_attribute_size']) : 0;
$this->arrConfig['use_attr_license'] = !empty($_POST['downloads_settings_attribute_license']) ? intval($_POST['downloads_settings_attribute_license']) : 0;
$this->arrConfig['use_attr_version'] = !empty($_POST['downloads_settings_attribute_version']) ? intval($_POST['downloads_settings_attribute_version']) : 0;
$this->arrConfig['use_attr_author'] = !empty($_POST['downloads_settings_attribute_author']) ? intval($_POST['downloads_settings_attribute_author']) : 0;
$this->arrConfig['use_attr_website'] = !empty($_POST['downloads_settings_attribute_website']) ? intval($_POST['downloads_settings_attribute_website']) : 0;
$this->arrConfig['most_viewed_file_count'] = !empty($_POST['downloads_settings_most_viewed_file_count']) ? intval($_POST['downloads_settings_most_viewed_file_count']) : $this->arrConfig['most_viewed_file_count'];
$this->arrConfig['most_downloaded_file_count'] = !empty($_POST['downloads_settings_most_downloaded_file_count']) ? intval($_POST['downloads_settings_most_downloaded_file_count']) : $this->arrConfig['most_downloaded_file_count'];
$this->arrConfig['most_popular_file_count'] = !empty($_POST['downloads_settings_most_popular_file_count']) ? intval($_POST['downloads_settings_most_popular_file_count']) : $this->arrConfig['most_popular_file_count'];
$this->arrConfig['newest_file_count'] = !empty($_POST['downloads_settings_newest_file_count']) ? intval($_POST['downloads_settings_newest_file_count']) : $this->arrConfig['newest_file_count'];
$this->arrConfig['updated_file_count'] = !empty($_POST['downloads_settings_updated_file_count']) ? intval($_POST['downloads_settings_updated_file_count']) : $this->arrConfig['updated_file_count'];
$this->arrConfig['new_file_time_limit'] = !empty($_POST['downloads_settings_new_file_time_limit']) ? intval($_POST['downloads_settings_new_file_time_limit']) : $this->arrConfig['new_file_time_limit'];
$this->arrConfig['updated_file_time_limit'] = !empty($_POST['downloads_settings_updated_file_time_limit']) ? intval($_POST['downloads_settings_updated_file_time_limit']) : $this->arrConfig['updated_file_time_limit'];
$this->arrConfig['associate_user_to_groups'] = !empty($_POST['downloads_settings_associate_user_to_groups_associated_groups']) ? implode(',', array_map('intval', $_POST['downloads_settings_associate_user_to_groups_associated_groups'])) : $this->arrConfig['associate_user_to_groups'];
$this->arrConfig['downloads_sorting_order'] = !empty($_POST['downloads_settings_sorting_downloads']) && array_key_exists($_POST['downloads_settings_sorting_downloads'], $this->downloadsSortingOptions) ? contrexx_input2db($_POST['downloads_settings_sorting_downloads']) : $this->arrConfig['downloads_sorting_order'];
$this->arrConfig['categories_sorting_order'] = !empty($_POST['downloads_settings_sorting_categories']) && array_key_exists($_POST['downloads_settings_sorting_categories'], $this->categoriesSortingOptions) ? contrexx_input2db($_POST['downloads_settings_sorting_categories']) : $this->arrConfig['categories_sorting_order'];
$this->updateSettings();
}
$objFWUser = \FWUser::getFWUserObject();
$objGroup = $objFWUser->objGroup->getGroups();
$arrGroups = explode(',', $this->arrConfig['associate_user_to_groups']);
$associatedGroups = '';
$notAssociatedGroups = '';
while (!$objGroup->EOF) {
$option = '<option value="' . $objGroup->getId() . '">' . htmlentities($objGroup->getName($_LANGID), ENT_QUOTES, CONTREXX_CHARSET) . ' [' . $objGroup->getType() . ']</option>';
if (in_array($objGroup->getId(), $arrGroups)) {
$associatedGroups .= $option;
} else {
$notAssociatedGroups .= $option;
}
$objGroup->next();
}
//Parse the option 'Downloads' and 'Categories' dropdown in the 'Sorting' section
$this->parseSettingsDropDown($this->objTemplate, $this->downloadsSortingOptions, $this->arrConfig['downloads_sorting_order'], 'downloads');
$this->parseSettingsDropDown($this->objTemplate, $this->categoriesSortingOptions, $this->arrConfig['categories_sorting_order'], 'categories');
$this->objTemplate->setVariable(array('TXT_DOWNLOADS_SETTINGS_LISTING' => $_ARRAYLANG['TXT_DOWNLOADS_SETTINGS_LISTING'], 'TXT_DOWNLOADS_OVERVIEW_PAGE' => $_ARRAYLANG['TXT_DOWNLOADS_OVERVIEW_PAGE'], 'TXT_DOWNLOADS_COL_COUNT' => $_ARRAYLANG['TXT_DOWNLOADS_COL_COUNT'], 'TXT_DOWNLOADS_COL_COUNT_DESC' => $_ARRAYLANG['TXT_DOWNLOADS_COL_COUNT_DESC'], 'TXT_DOWNLOADS_SUBCAT_COUNT' => $_ARRAYLANG['TXT_DOWNLOADS_SUBCAT_COUNT'], 'TXT_DOWNLOADS_SUBCAT_COUNT_DESC' => $_ARRAYLANG['TXT_DOWNLOADS_SUBCAT_COUNT_DESC'], 'TXT_DOWNLOADS_BLOCKS' => $_ARRAYLANG['TXT_DOWNLOADS_BLOCKS'], 'TXT_DOWNLOADS_MOST_VIEWED_FILE_COUNT' => $_ARRAYLANG['TXT_DOWNLOADS_MOST_VIEWED_FILE_COUNT'], 'TXT_DOWNLOADS_MOST_VIEWED_FILE_COUNT_DESC' => $_ARRAYLANG['TXT_DOWNLOADS_MOST_VIEWED_FILE_COUNT_DESC'], 'TXT_DOWNLOADS_MOST_DOWNLOADED_FILE_COUNT' => $_ARRAYLANG['TXT_DOWNLOADS_MOST_DOWNLOADED_FILE_COUNT'], 'TXT_DOWNLOADS_MOST_DOWNLOADED_FILE_COUNT_DESC' => $_ARRAYLANG['TXT_DOWNLOADS_MOST_DOWNLOADED_FILE_COUNT_DESC'], 'TXT_DOWNLOADS_MOST_POPULAR_FILE_COUNT' => $_ARRAYLANG['TXT_DOWNLOADS_MOST_POPULAR_FILE_COUNT'], 'TXT_DOWNLOADS_MOST_POPULAR_FILE_COUNT_DESC' => $_ARRAYLANG['TXT_DOWNLOADS_MOST_POPULAR_FILE_COUNT_DESC'], 'TXT_DOWNLOADS_NEWEST_FILE_COUNT' => $_ARRAYLANG['TXT_DOWNLOADS_NEWEST_FILE_COUNT'], 'TXT_DOWNLOADS_NEWEST_FILE_COUNT_DESC' => $_ARRAYLANG['TXT_DOWNLOADS_NEWEST_FILE_COUNT_DESC'], 'TXT_DOWNLOADS_UPDATE_FILE_COUNT' => $_ARRAYLANG['TXT_DOWNLOADS_UPDATE_FILE_COUNT'], 'TXT_DOWNLOADS_UPDATE_FILE_COUNT_DESC' => $_ARRAYLANG['TXT_DOWNLOADS_UPDATE_FILE_COUNT_DESC'], 'TXT_DOWNLOADS_SETTINGS_STATISTICS' => $_ARRAYLANG['TXT_DOWNLOADS_SETTINGS_STATISTICS'], 'TXT_DOWNLOADS_NEW_FILE_TIME_LIMIT' => $_ARRAYLANG['TXT_DOWNLOADS_NEW_FILE_TIME_LIMIT'], 'TXT_DOWNLOADS_NEW_FILE_TIME_LIMIT_DESC' => $_ARRAYLANG['TXT_DOWNLOADS_NEW_FILE_TIME_LIMIT_DESC'], 'TXT_DOWNLOADS_UPDATED_FILE_TIME_LIMIT' => $_ARRAYLANG['TXT_DOWNLOADS_UPDATED_FILE_TIME_LIMIT'], 'TXT_DOWNLOADS_UPDATED_FILE_TIME_LIMIT_DESC' => $_ARRAYLANG['TXT_DOWNLOADS_UPDATED_FILE_TIME_LIMIT_DESC'], 'TXT_DOWNLOADS_SECONDS_COMB_EXAMPLES' => $_ARRAYLANG['TXT_DOWNLOADS_SECONDS_COMB_EXAMPLES'], 'TXT_DOWNLOADS_SETTINGS_ATTRIBUTES' => $_ARRAYLANG['TXT_DOWNLOADS_ATTRIBUTES'], 'TXT_DOWNLOADS_ATTRIBUTES_DESC' => $_ARRAYLANG['TXT_DOWNLOADS_ATTRIBUTES_DESC'], 'TXT_DOWNLOADS_METAKEYS' => $_ARRAYLANG['TXT_DOWNLOADS_METAKEYS'], 'TXT_DOWNLOADS_SIZE' => $_ARRAYLANG['TXT_DOWNLOADS_SIZE'], 'TXT_DOWNLOADS_LICENSE' => $_ARRAYLANG['TXT_DOWNLOADS_LICENSE'], 'TXT_DOWNLOADS_VERSION' => $_ARRAYLANG['TXT_DOWNLOADS_VERSION'], 'TXT_DOWNLOADS_AUTHOR' => $_ARRAYLANG['TXT_DOWNLOADS_AUTHOR'], 'TXT_DOWNLOADS_WEBSITE' => $_ARRAYLANG['TXT_DOWNLOADS_WEBSITE'], 'TXT_DOWNLOADS_SAVE' => $_ARRAYLANG['TXT_DOWNLOADS_SAVE'], 'TXT_DOWNLOADS_UNCHECK_ALL' => $_ARRAYLANG['TXT_DOWNLOADS_UNCHECK_ALL'], 'TXT_DOWNLOADS_CHECK_ALL' => $_ARRAYLANG['TXT_DOWNLOADS_CHECK_ALL'], 'TXT_DOWNLOADS_GENERAL' => $_ARRAYLANG['TXT_DOWNLOADS_GENERAL'], 'TXT_DOWNLOADS_INTERFACES' => $_ARRAYLANG['TXT_DOWNLOADS_INTERFACES'], 'TXT_DOWNLOADS_USER_ADMIN' => $_ARRAYLANG['TXT_DOWNLOADS_USER_ADMIN'], 'TXT_DOWNLOADS_AUTOMATIC_CATEGORY_CREATION' => $_ARRAYLANG['TXT_DOWNLOADS_AUTOMATIC_CATEGORY_CREATION'], 'TXT_DOWNLOADS_AUTOMATIC_CATEGORY_CREATION_DESC' => $_ARRAYLANG['TXT_DOWNLOADS_AUTOMATIC_CATEGORY_CREATION_DESC'], 'TXT_DOWNLOADS_AVAILABLE_USER_GROUPS' => $_ARRAYLANG['TXT_DOWNLOADS_AVAILABLE_USER_GROUPS'], 'TXT_DOWNLOADS_ASSIGNED_USER_GROUPS' => $_ARRAYLANG['TXT_DOWNLOADS_ASSIGNED_USER_GROUPS'], 'TXT_DOWNLOADS_SETTINGS_SORTING' => $_ARRAYLANG['TXT_DOWNLOADS_SETTINGS_SORTING'], 'TXT_DOWNLOADS_SETTINGS_OPTION_DOWNLOADS' => $_ARRAYLANG['TXT_DOWNLOADS_SETTINGS_OPTION_DOWNLOADS'], 'TXT_DOWNLOADS_SETTINGS_OPTION_CATEGORIES' => $_ARRAYLANG['TXT_DOWNLOADS_CATEGORIES'], 'TXT_DOWNLOADS_SETTINGS_OPTION_SORTING_DESC' => $_ARRAYLANG['TXT_DOWNLOADS_SETTINGS_OPTION_SORTING_DESC'], 'TXT_DOWNLOADS_SETTINGS_CUSTOM_LABEL' => $_ARRAYLANG['TXT_DOWNLOADS_SETTINGS_CUSTOM_LABEL'], 'TXT_DOWNLOADS_SETTINGS_ALPHABETIC_LABEL' => $_ARRAYLANG['TXT_DOWNLOADS_SETTINGS_ALPHABETIC_LABEL'], 'TXT_DOWNLOADS_SETTINGS_NEWEST_TO_OLDEST_LABEL' => $_ARRAYLANG['TXT_DOWNLOADS_SETTINGS_NEWEST_TO_OLDEST_LABEL'], 'TXT_DOWNLOADS_SETTINGS_OLDEST_TO_NEWEST_LABEL' => $_ARRAYLANG['TXT_DOWNLOADS_SETTINGS_OLDEST_TO_NEWEST_LABEL'], 'DOWNLOADS_SETTINGS_COL_COUNT' => $this->arrConfig['overview_cols_count'], 'DOWNLOADS_SETTINGS_SUBCAT_COUNT' => $this->arrConfig['overview_max_subcats'], 'DOWNLOADS_SETTINGS_ATTRIBUTE_METAKEYS_CHECKED' => $this->arrConfig['use_attr_metakeys'] ? 'checked="checked"' : '', 'DOWNLOADS_SETTINGS_ATTRIBUTE_SIZE_CHECKED' => $this->arrConfig['use_attr_size'] ? 'checked="checked"' : '', 'DOWNLOADS_SETTINGS_ATTRIBUTE_LICENSE_CHECKED' => $this->arrConfig['use_attr_license'] ? 'checked="checked"' : '', 'DOWNLOADS_SETTINGS_ATTRIBUTE_VERSION_CHECKED' => $this->arrConfig['use_attr_version'] ? 'checked="checked"' : '', 'DOWNLOADS_SETTINGS_ATTRIBUTE_AUTHOR_CHECKED' => $this->arrConfig['use_attr_author'] ? 'checked="checked"' : '', 'DOWNLOADS_SETTINGS_ATTRIBUTE_WEBSITE_CHECKED' => $this->arrConfig['use_attr_website'] ? 'checked="checked"' : '', 'DOWNLOADS_SETTINGS_MOST_VIEWED_FILE_COUNT' => $this->arrConfig['most_viewed_file_count'], 'DOWNLOADS_SETTINGS_MOST_DOWNLOADED_FILE_COUNT' => $this->arrConfig['most_downloaded_file_count'], 'DOWNLOADS_SETTINGS_MOST_POPULAR_FILE_COUNT' => $this->arrConfig['most_popular_file_count'], 'DOWNLOADS_SETTINGS_NEWEST_FILE_COUNT' => $this->arrConfig['newest_file_count'], 'DOWNLOADS_SETTINGS_UPDATED_FILE_COUNT' => $this->arrConfig['updated_file_count'], 'DOWNLOADS_SETTINGS_NEW_FILE_TIME_LIMIT' => $this->arrConfig['new_file_time_limit'], 'DOWNLOADS_SETTINGS_UPDATEDED_FILE_TIME_LIMIT' => $this->arrConfig['updated_file_time_limit'], 'DOWNLOADS_SETTINGS_NOT_ASSOCIATED_GROUPS' => $notAssociatedGroups, 'DOWNLOADS_SETTINGS_ASSOCIATED_GROUPS' => $associatedGroups));
}
示例14: saveCategoryOrder
/**
* Save the order of categories
*
* Is called through ajax
*/
function saveCategoryOrder()
{
global $objDatabase;
if ($_POST['categories']) {
$categories = contrexx_input2db($_POST['categories']);
foreach ($categories as $sort => $value) {
$sort++;
$id = explode('_', $value);
$query = "UPDATE " . DBPREFIX . "module_data_categories\n SET `sort` = " . $sort . "\n WHERE `category_id` = " . $id[1];
$objDatabase->Execute($query);
}
} else {
header("HTTP/1.0 500 Internal Server Error");
return;
}
}
示例15: saveInputfields
function saveInputfields($arrData)
{
global $_ARRAYLANG, $_CORELANG, $objDatabase, $_LANGID;
$objDatabase->Execute("DELETE FROM " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_inputfields WHERE form='" . $this->intFormId . "'");
$objDatabase->Execute("DELETE FROM " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_inputfield_names WHERE form_id='" . $this->intFormId . "'");
$inputfieldId = isset($arrData['inputfieldId']) ? $arrData['inputfieldId'] : array();
foreach ($inputfieldId as $intKey => $intFieldId) {
$intFieldId = intval($intFieldId);
$intFieldOrder = intval($arrData['inputfieldOrder'][$intFieldId]);
$arrFieldNames = contrexx_input2raw($arrData['inputfieldName'][$intFieldId]);
$intFieldType = intval($arrData['inputfieldType'][$intFieldId]);
$intFieldShowIn = intval($arrData['inputfieldShow'][$intFieldId]);
$arrFieldDefaultValues = contrexx_input2raw($arrData['inputfieldDefaultvalue'][$intFieldId]);
$arrFieldInfos = isset($arrData['inputfieldInfo'][$intFieldId]) ? contrexx_input2raw($arrData['inputfieldInfo'][$intFieldId]) : array();
$intFieldVerification = intval($arrData['inputfieldVerification'][$intFieldId]);
$intFieldMustfield = isset($arrData['inputfieldMustfield'][$intFieldId]) ? contrexx_input2int($arrData['inputfieldMustfield'][$intFieldId]) : 0;
$intFieldExpSearch = isset($arrData['inputfieldExpSearch'][$intFieldId]) ? contrexx_input2int($arrData['inputfieldExpSearch'][$intFieldId]) : 0;
$fieldContextType = contrexx_input2db($arrData['inputfieldContext'][$intFieldId]);
//add inputfield
$objSaveInputfield = $objDatabase->Execute("\n INSERT INTO\n " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_inputfields\n SET\n `id` = '" . $intFieldId . "',\n `form` = '" . $this->intFormId . "',\n `order` = '" . $intFieldOrder . "',\n `type` = '" . $intFieldType . "',\n `show_in` = '" . $intFieldShowIn . "',\n `verification` = '" . $intFieldVerification . "',\n `required` = '" . $intFieldMustfield . "',\n `search` = '" . $intFieldExpSearch . "',\n `context_type` = '" . $fieldContextType . "'\n\n ");
if ($objSaveInputfield === false) {
return false;
}
//add inputfield names and default values
$saveInputFieldName = $this->updateInputFields($intFieldId, $arrFieldNames, $arrFieldDefaultValues, $arrFieldInfos);
if (!$saveInputFieldName) {
return false;
}
}
$selectorOrder = $selectorOrder2 = $selectorExpSearch = $selectorExpSearch2 = 0;
if (isset($arrData['selectorOrder'])) {
$selectorOrder = isset($arrData['selectorOrder'][1]) ? $arrData['selectorOrder'][1] : 0;
$selectorOrder2 = isset($arrData['selectorOrder'][2]) ? $arrData['selectorOrder'][2] : 0;
}
if (isset($arrData['selectorExpSearch'])) {
$selectorExpSearch = isset($arrData['selectorExpSearch'][1]) ? $arrData['selectorExpSearch'][1] : 0;
$selectorExpSearch2 = isset($arrData['selectorExpSearch'][2]) ? $arrData['selectorExpSearch'][2] : 0;
}
$objCategorySelector = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_order_rel_forms_selectors SET `selector_order`='" . contrexx_input2int($selectorOrder) . "', `exp_search`='" . intval($selectorExpSearch) . "' WHERE `selector_id`='9' AND `form_id`='" . $this->intFormId . "'");
$objLevelSelector = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_order_rel_forms_selectors SET `selector_order`='" . contrexx_input2int($selectorOrder2) . "', `exp_search`='" . intval($selectorExpSearch2) . "' WHERE `selector_id`='10' AND `form_id`='" . $this->intFormId . "'");
if ($objCategorySelector === false || $objLevelSelector === false) {
return false;
}
return true;
}