本文整理汇总了PHP中Cx\Core\Setting\Controller\Setting::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Setting::add方法的具体用法?PHP Setting::add怎么用?PHP Setting::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cx\Core\Setting\Controller\Setting
的用法示例。
在下文中一共展示了Setting::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateGlobalSetting
/**
* Update the global setting
*
* @param int $value
* @throws DatabaseError
* @global $objDatabase
*/
protected function updateGlobalSetting($value)
{
\Cx\Core\Setting\Controller\Setting::init('Config', 'component', 'Yaml');
if (isset($value)) {
if (!\Cx\Core\Setting\Controller\Setting::isDefined('useKnowledgePlaceholders')) {
\Cx\Core\Setting\Controller\Setting::add('useKnowledgePlaceholders', $value, 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component');
} else {
\Cx\Core\Setting\Controller\Setting::set('useKnowledgePlaceholders', $value);
\Cx\Core\Setting\Controller\Setting::update('useKnowledgePlaceholders');
}
}
}
示例2: parsePage
/**
* Use this to parse your backend page
*
* You will get the template located in /View/Template/{CMD}.html
* You can access Cx class using $this->cx
* To show messages, use \Message class
* @param \Cx\Core\Html\Sigma $template Template for current CMD
* @param array $cmd CMD separated by slashes
* @global array $_ARRAYLANG Language data
*/
public function parsePage(\Cx\Core\Html\Sigma $template, array $cmd)
{
global $_ARRAYLANG;
// Parse entity view generation pages
$entityClassName = $this->getNamespace() . '\\Model\\Entity\\' . current($cmd);
if (in_array($entityClassName, $this->getEntityClasses())) {
$this->parseEntityClassPage($template, $entityClassName, current($cmd));
return;
}
// Not an entity, parse overview or settings
switch (current($cmd)) {
case 'Settings':
\Cx\Core\Setting\Controller\Setting::init('Wysiwyg', 'config', 'Yaml');
if (isset($_POST) && isset($_POST['bsubmit'])) {
\Cx\Core\Setting\Controller\Setting::set('specificStylesheet', isset($_POST['specificStylesheet']) ? 1 : 0);
\Cx\Core\Setting\Controller\Setting::set('replaceActualContents', isset($_POST['replaceActualContents']) ? 1 : 0);
\Cx\Core\Setting\Controller\Setting::storeFromPost();
}
$i = 0;
if (!\Cx\Core\Setting\Controller\Setting::isDefined('specificStylesheet') && !\Cx\Core\Setting\Controller\Setting::add('specificStylesheet', '0', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_CHECKBOX, '1', 'config')) {
throw new \Exception("Failed to add new configuration option");
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('replaceActualContents') && !\Cx\Core\Setting\Controller\Setting::add('replaceActualContents', '0', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_CHECKBOX, '1', 'config')) {
throw new \Exception("Failed to add new configuration option");
}
$tmpl = new \Cx\Core\Html\Sigma();
\Cx\Core\Setting\Controller\Setting::show($tmpl, 'index.php?cmd=Config&act=Wysiwyg&tpl=Settings', $_ARRAYLANG['TXT_CORE_WYSIWYG'], $_ARRAYLANG['TXT_CORE_WYSIWYG_ACT_SETTINGS'], 'TXT_CORE_WYSIWYG_');
$template->setVariable('WYSIWYG_CONFIG_TEMPLATE', $tmpl->get());
break;
case '':
default:
if ($template->blockExists('overview')) {
$template->touchBlock('overview');
}
break;
}
}
示例3: createNewDynamicAccessId
/**
* Generates a new dynamic access-ID
*
* @return mixed Returns the newly created dynamic access-ID or FALSE on failure.
*/
public static function createNewDynamicAccessId()
{
\Cx\Core\Setting\Controller\Setting::init('Config', 'core', 'Yaml');
if (!\Cx\Core\Setting\Controller\Setting::isDefined('lastAccessId')) {
$newAccessId = 1;
\Cx\Core\Setting\Controller\Setting::add('lastAccessId', $newAccessId, 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, '', 'core');
} else {
$newAccessId = \Cx\Core\Setting\Controller\Setting::getValue('lastAccessId', 'Config') + 1;
\Cx\Core\Setting\Controller\Setting::set('lastAccessId', $newAccessId);
if (!\Cx\Core\Setting\Controller\Setting::update('lastAccessId')) {
return false;
}
}
// verify that the update was successful
\Cx\Core\Setting\Controller\Setting::init('Config', 'core', 'Yaml');
if (\Cx\Core\Setting\Controller\Setting::getValue('lastAccessId', 'Config') != $newAccessId) {
return false;
}
return $newAccessId;
}
示例4: save
/**
*
* @global type $_POST
* @param \settingsManager $settingsManager
* @param \ADONewConnection $objDb
*/
public function save($objDb)
{
\Cx\Core\Setting\Controller\Setting::init('Config', 'license', 'Yaml');
// core
if (!\Cx\Core\Setting\Controller\Setting::isDefined('installationId')) {
\Cx\Core\Setting\Controller\Setting::add('installationId', $this->getInstallationId(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'core');
} else {
\Cx\Core\Setting\Controller\Setting::set('installationId', $this->getInstallationId());
}
// license
if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseKey')) {
\Cx\Core\Setting\Controller\Setting::add('licenseKey', $this->getLicenseKey(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('licenseKey', $this->getLicenseKey());
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseState')) {
\Cx\Core\Setting\Controller\Setting::add('licenseState', $this->getState(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('licenseState', $this->getState());
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseValidTo')) {
\Cx\Core\Setting\Controller\Setting::add('licenseValidTo', $this->getValidToDate(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_DATETIME, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('licenseValidTo', $this->getValidToDate());
}
// we must encode the serialized objects to prevent that non-ascii chars
// get written into the config/settings.php file
if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseMessage')) {
\Cx\Core\Setting\Controller\Setting::add('licenseMessage', base64_encode(serialize($this->getMessages())), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('licenseMessage', base64_encode(serialize($this->getMessages())));
}
// see comment above why we encode the serialized data here
if (!\Cx\Core\Setting\Controller\Setting::isDefined('licensePartner')) {
\Cx\Core\Setting\Controller\Setting::add('licensePartner', base64_encode(serialize($this->getPartner())), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('licensePartner', base64_encode(serialize($this->getPartner())));
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseCustomer')) {
\Cx\Core\Setting\Controller\Setting::add('licenseCustomer', base64_encode(serialize($this->getCustomer())), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('licenseCustomer', base64_encode(serialize($this->getCustomer())));
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('upgradeUrl')) {
\Cx\Core\Setting\Controller\Setting::add('upgradeUrl', $this->getUpgradeUrl(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('upgradeUrl', $this->getUpgradeUrl());
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseCreatedAt')) {
\Cx\Core\Setting\Controller\Setting::add('licenseCreatedAt', $this->getCreatedAtDate(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_DATE, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('licenseCreatedAt', $this->getCreatedAtDate());
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseDomains')) {
\Cx\Core\Setting\Controller\Setting::add('licenseDomains', base64_encode(serialize($this->getRegisteredDomains())), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('licenseDomains', base64_encode(serialize($this->getRegisteredDomains())));
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('availableComponents')) {
\Cx\Core\Setting\Controller\Setting::add('availableComponents', base64_encode(serialize($this->getAvailableComponents())), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('availableComponents', base64_encode(serialize($this->getAvailableComponents())));
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('dashboardMessages')) {
\Cx\Core\Setting\Controller\Setting::add('dashboardMessages', base64_encode(serialize($this->getDashboardMessages())), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('dashboardMessages', base64_encode(serialize($this->getDashboardMessages())));
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('isUpgradable')) {
\Cx\Core\Setting\Controller\Setting::add('isUpgradable', $this->isUpgradable() ? 'on' : 'off', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, 'on:Activated,off:Deactivated', 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('isUpgradable', $this->isUpgradable() ? 'on' : 'off');
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseGrayzoneMessages')) {
\Cx\Core\Setting\Controller\Setting::add('licenseGrayzoneMessages', base64_encode(serialize($this->getGrayzoneMessages())), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('licenseGrayzoneMessages', base64_encode(serialize($this->getGrayzoneMessages())));
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseGrayzoneTime')) {
\Cx\Core\Setting\Controller\Setting::add('licenseGrayzoneTime', $this->getGrayzoneTime(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('licenseGrayzoneTime', $this->getGrayzoneTime());
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseLockTime')) {
\Cx\Core\Setting\Controller\Setting::add('licenseLockTime', $this->getFrontendLockTime(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('licenseLockTime', $this->getFrontendLockTime());
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseUpdateInterval')) {
\Cx\Core\Setting\Controller\Setting::add('licenseUpdateInterval', $this->getRequestInterval(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('licenseUpdateInterval', $this->getRequestInterval());
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseFailedUpdate')) {
//.........这里部分代码省略.........
示例5: overview
/**
* Show on overview of the mail templates for the given section and group
*
* If empty, the $limit defaults to the
* "numof_mailtemplate_per_page_backend" setting for the given section
* and group.
* @param string $section The section
* @param string $group The group
* @param integer $limit The optional limit for the number
* of templates to be shown
* @param string $act The action of the mail template
* default set to mailtemplate_overview
* @return \Cx\Core\Html\Sigma The template object
*/
static function overview($section, $group, $limit = 0, $useDefaultActs = true, $act = 'mailtemplate_edit')
{
global $_CORELANG;
$objTemplateLocal = new \Cx\Core\Html\Sigma(\Env::get('cx')->getCodeBaseCorePath() . '/MailTemplate/View/Template/Generic');
$objTemplateLocal->setErrorHandling(PEAR_ERROR_DIE);
\Cx\Core\Csrf\Controller\Csrf::add_placeholder($objTemplateLocal);
if (!$objTemplateLocal->loadTemplateFile('Overview.html')) {
die("Failed to load template Overview.html");
}
if (empty($section) || empty($group)) {
\Message::error($_CORELANG['TXT_CORE_MAILTEMPLATE_ERROR_NO_SECTION_OR_GROUP']);
return false;
}
if (empty($limit)) {
\Cx\Core\Setting\Controller\Setting::init($section, $group);
$limit = \Cx\Core\Setting\Controller\Setting::getValue('numof_mailtemplate_per_page_backend', $section);
// TODO: TEMPORARY
if (is_null($limit)) {
$limit = 25;
\Cx\Core\Setting\Controller\Setting::add('numof_mailtemplate_per_page_backend', $limit, 1001, 'text', '', $group);
}
}
$uri = \Html::getRelativeUri_entities();
$tab_index = \Cx\Core\Setting\Controller\Setting::tab_index();
\Html::replaceUriParameter($uri, 'active_tab=' . $tab_index);
\Html::replaceUriParameter($uri, 'userFrontendLangId=' . FRONTEND_LANG_ID);
//echo("Made uri for sorting: ".htmlentities($uri)."<br />");
\Html::stripUriParam($uri, 'key');
\Html::stripUriParam($uri, 'delete_mailtemplate_key');
$uri_edit = $uri_overview = $uri;
//echo("Made uri for sorting: ".htmlentities($uri)."<br />");
if ($useDefaultActs) {
\Html::stripUriParam($uri, 'act');
\Html::replaceUriParameter($uri_edit, 'act=mailtemplate_edit');
\Html::replaceUriParameter($uri_overview, 'act=mailtemplate_overview');
}
$objSorting = new \Sorting($uri_overview, array('name' => $_CORELANG['TXT_CORE_MAILTEMPLATE_NAME'], 'key' => $_CORELANG['TXT_CORE_MAILTEMPLATE_KEY'], 'html' => $_CORELANG['TXT_CORE_MAILTEMPLATE_IS_HTML'], 'protected' => $_CORELANG['TXT_CORE_MAILTEMPLATE_PROTECTED']), true, 'order_mailtemplate');
$count = 0;
// Template titles are shown in the current language only, no need
// (and no way either) to load them all. Names are shown in the
// currently active frontend language only.
$pagingParameterName = $section . '_' . $group;
$arrTemplates = self::getArray($section, FRONTEND_LANG_ID, $objSorting->getOrder(), \Paging::getPosition($pagingParameterName), $limit, $count);
$arrLanguageName = \FWLanguage::getNameArray();
$objTemplateLocal->setGlobalVariable($_CORELANG + array('CORE_MAILTEMPLATE_NAME' => $objSorting->getHeaderForField('name'), 'CORE_MAILTEMPLATE_KEY' => $objSorting->getHeaderForField('key'), 'CORE_MAILTEMPLATE_HTML' => $objSorting->getHeaderForField('html'), 'CORE_MAILTEMPLATE_PROTECTED' => $objSorting->getHeaderForField('protected'), 'PAGING' => \Paging::get($uri_overview, $_CORELANG['TXT_CORE_MAILTEMPLATE_PAGING'], $count, $limit, true, null, $pagingParameterName), 'URI_BASE' => $uri, 'URI_EDIT' => $uri_edit, 'CORE_MAILTEMPLATE_COLSPAN' => 5 + count($arrLanguageName)));
foreach ($arrLanguageName as $language_name) {
$objTemplateLocal->setVariable('MAILTEMPLATE_LANGUAGE_HEADER', $language_name);
$objTemplateLocal->parse('core_mailtemplate_language_header');
}
if (empty($arrTemplates)) {
\Message::information($_CORELANG['TXT_CORE_MAILTEMPLATE_WARNING_NONE']);
$arrTemplates = array();
}
// Load *all* templates and languages
self::init($section);
$i = 0;
foreach ($arrTemplates as $arrTemplate) {
$key = $arrTemplate['key'];
$objTemplateLocal->setVariable(array('MAILTEMPLATE_ROWCLASS' => ++$i % 2 + 1, 'MAILTEMPLATE_PROTECTED' => \Html::getCheckmark($arrTemplate['protected']), 'MAILTEMPLATE_HTML' => \Html::getCheckmark($arrTemplate['html']), 'MAILTEMPLATE_NAME' => '<a href="' . $uri_edit . '&key=' . urlencode($key) . '">' . contrexx_raw2xhtml($arrTemplate['name']) . '</a>', 'MAILTEMPLATE_KEY' => $arrTemplate['key'], 'MAILTEMPLATE_FUNCTIONS' => \Html::getBackendFunctions(array('copy' => $uri_edit . '&copy=1&key=' . $arrTemplate['key'], 'edit' => $uri_edit . '&key=' . $arrTemplate['key'], 'delete' => $arrTemplate['protected'] ? '' : $uri_overview . '&delete_mailtemplate_key=' . $arrTemplate['key'] . '&csrf=' . \Cx\Core\Csrf\Controller\Csrf::code()), array('delete' => $_CORELANG['TXT_CORE_MAILTEMPLATE_DELETE_CONFIRM']))));
foreach (array_keys($arrLanguageName) as $lang_id) {
$available = isset(self::$arrTemplates[$lang_id][$key]) && self::$arrTemplates[$lang_id][$key]['available'];
$title = $available ? $_CORELANG['TXT_CORE_MAILTEMPLATE_EDIT'] : $_CORELANG['TXT_CORE_MAILTEMPLATE_NEW'];
$icon = '<a href="' . CONTREXX_DIRECTORY_INDEX . "?cmd={$section}&act=" . $act . '&key=' . $key . '&userFrontendLangId=' . $lang_id . '"' . ' title="' . $title . '">' . '<img src="../core/Core/View/Media/icons/' . ($available ? 'edit.gif' : 'add.png') . '"' . ' width="16" height="16" alt="' . $title . '" border="0" /></a>';
$objTemplateLocal->setVariable('MAILTEMPLATE_LANGUAGE', $icon);
$objTemplateLocal->parse('core_mailtemplate_language_column');
}
$objTemplateLocal->parse('core_mailtemplate_row');
}
return $objTemplateLocal;
}
示例6: errorHandler
/**
* Fixes database errors.
*
* Also migrates settings from the old Shop settings table to \Cx\Core\Setting.
* @return boolean False. Always.
* @throws Cx\Lib\Update_DatabaseException
*/
static function errorHandler()
{
global $_CONFIGURATION;
// ShopSettings
\Cx\Core\Setting\Controller\Setting::errorHandler();
\Cx\Core\Setting\Controller\Setting::init('Shop', 'config');
$table_name = DBPREFIX . 'module_shop_config';
$i = 0;
if (\Cx\Lib\UpdateUtil::table_exist($table_name)) {
// Migrate all entries using the \Cx\Core\Setting\Controller\Setting class
$query = "\n SELECT `name`, `value`, `status`\n FROM " . DBPREFIX . "module_shop_config\n ORDER BY `id` ASC";
$objResult = \Cx\Lib\UpdateUtil::sql($query);
if (!$objResult) {
throw new \Cx\Lib\Update_DatabaseException('Failed to query old Shop settings', $query);
}
while (!$objResult->EOF) {
$name = $objResult->fields['name'];
$value = $objResult->fields['value'];
$status = $objResult->fields['status'];
$name_status = null;
switch ($name) {
// OBSOLETE
case 'tax_default_id':
case 'tax_enabled':
case 'tax_included':
case 'tax_number':
// Ignore, do not migrate!
$name = null;
break;
// VALUE ONLY (RE: arrConfig\[.*?\]\[.value.\])
// VALUE ONLY (RE: arrConfig\[.*?\]\[.value.\])
case 'confirmation_emails':
$name = 'email_confirmation';
break;
case 'country_id':
case 'datatrans_merchant_id':
case 'datatrans_request_type':
break;
case 'datatrans_status':
$name = 'datatrans_active';
break;
case 'datatrans_use_testserver':
case 'email':
case 'fax':
case 'orderitems_amount_max':
case 'paypal_default_currency':
case 'postfinance_mobile_ijustwanttotest':
case 'postfinance_mobile_sign':
case 'postfinance_mobile_status':
case 'postfinance_mobile_webuser':
case 'product_sorting':
case 'saferpay_finalize_payment':
case 'saferpay_window_option':
break;
case 'shop_address':
case 'shop_company':
case 'shop_show_products_default':
case 'shop_thumbnail_max_height':
case 'shop_thumbnail_max_width':
case 'shop_thumbnail_quality':
case 'shop_weight_enable':
$name = preg_replace('/^shop_/', '', $name);
break;
case 'telephone':
case 'vat_default_id':
case 'vat_enabled_foreign_customer':
case 'vat_enabled_foreign_reseller':
case 'vat_enabled_home_customer':
case 'vat_enabled_home_reseller':
case 'vat_included_foreign_customer':
case 'vat_included_foreign_reseller':
case 'vat_included_home_customer':
case 'vat_included_home_reseller':
case 'vat_number':
case 'vat_other_id':
break;
case 'yellowpay_accepted_payment_methods':
case 'yellowpay_authorization_type':
case 'yellowpay_hash_seed':
case 'yellowpay_hash_signature_in':
case 'yellowpay_hash_signature_out':
case 'yellowpay_use_testserver':
$name = preg_replace('/^yellowpay(.*)$/', 'postfinance$1', $name);
break;
case 'yellowpay_id':
// Obsolete
$name = null;
break;
// VALUE & STATUS
// VALUE & STATUS
case 'paypal_account_email':
$name_status = 'paypal_active';
break;
//.........这里部分代码省略.........
示例7: updateSettings
/**
* update settings
* @access public
* @global array
* @global ADONewConnection
* @global array
* @global array
*/
function updateSettings()
{
global $objDatabase, $_CORELANG, $_ARRAYLANG;
if (isset($_POST['set_sys_submit'])) {
//get post data
foreach ($_POST['setvalue'] as $id => $value) {
//update settings
// check for description field to be required
if ($id == 13 && $value == 1) {
$objDatabase->Execute("UPDATE `" . DBPREFIX . "module_directory_inputfields` SET active='1', is_required='1', active_backend='1' WHERE name='description'");
}
if (ini_get('allow_url_fopen') == false && $id == 19) {
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_settings SET setvalue='0' WHERE setid=" . intval($id));
} else {
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_settings SET setvalue='" . contrexx_addslashes($value) . "' WHERE setid=" . intval($id));
}
}
$this->strOkMessage = $_ARRAYLANG['TXT_DIR_SETTINGS_SUCCESFULL_SAVE'];
}
if (isset($_POST['set_google_submit'])) {
//get post data
foreach ($_POST['setvalue'] as $id => $value) {
//update settings
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_settings_google SET setvalue='" . contrexx_addslashes($value) . "' WHERE setid=" . intval($id));
}
$this->strOkMessage = $_ARRAYLANG['TXT_DIR_SETTINGS_SUCCESFULL_SAVE'];
}
if (isset($_POST['set_homecontent_submit'])) {
//update settings
\Cx\Core\Setting\Controller\Setting::init('Config', 'component', 'Yaml');
if (isset($_POST['setHomeContent'])) {
if (!\Cx\Core\Setting\Controller\Setting::isDefined('directoryHomeContent')) {
\Cx\Core\Setting\Controller\Setting::add('directoryHomeContent', contrexx_addslashes($_POST['setHomeContent']), 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component');
} else {
\Cx\Core\Setting\Controller\Setting::set('directoryHomeContent', contrexx_addslashes($_POST['setHomeContent']));
\Cx\Core\Setting\Controller\Setting::update('directoryHomeContent');
}
}
\Cx\Core\Csrf\Controller\Csrf::header('Location: ?cmd=Directory&act=settings&tpl=homecontent');
exit;
$this->strOkMessage = $_ARRAYLANG['TXT_DIR_SETTINGS_SUCCESFULL_SAVE'];
}
if (isset($_POST['set_mail_submit'])) {
//update settings
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_mail SET title='" . contrexx_addslashes($_POST['mailConfirmTitle']) . "', content='" . $_POST['mailConfirmContent'] . "' WHERE id='1'");
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_mail SET title='" . contrexx_addslashes($_POST['mailRememberTitle']) . "', content='" . $_POST['mailRememberContent'] . "' WHERE id='2'");
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_settings SET setvalue='" . contrexx_addslashes($_POST['mailRememberAdress']) . "' WHERE setid='30'");
$this->strOkMessage = $_ARRAYLANG['TXT_DIR_SETTINGS_SUCCESFULL_SAVE'];
}
if (isset($_POST['set_inputs_submit'])) {
//update settings
// title field should stay active, required and available for search
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_inputfields SET active='0' Where id !='1'");
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_inputfields SET is_search='0' Where id !='1'");
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_inputfields SET is_required='0' Where id !='1'");
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_inputfields SET active_backend='0' Where id !='1'");
//get post data
if ($_POST['setStatus'] != "") {
$addressElements = 0;
$googleMapIsEnabled = false;
foreach ($_POST['setStatus'] as $id => $value) {
//update settings
$objResult = $objDatabase->Execute("SELECT `name` FROM " . DBPREFIX . "module_directory_inputfields WHERE id=" . intval($id));
$name = $objResult->fields['name'];
switch ($name) {
case 'country':
case 'zip':
case 'street':
case 'city':
$addressElements++;
break;
case 'googlemap':
$googleMapIsEnabled = true;
break;
default:
}
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_inputfields SET active='" . contrexx_addslashes($value) . "' WHERE id=" . intval($id));
}
if ($googleMapIsEnabled && $addressElements < 4) {
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_inputfields SET active='1' WHERE name='country'");
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_inputfields SET active='1' WHERE name='zip'");
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_inputfields SET active='1' WHERE name='street'");
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_inputfields SET active='1' WHERE name='city'");
$this->strOkMessage = $_ARRAYLANG['TXT_DIRECTORY_GOOGLEMAP_REQUIRED_FIELDS_MISSING'];
}
}
//get post data
if ($_POST['setStatusBackend'] != "") {
$addressElements = 0;
$googleMapIsEnabled = false;
foreach ($_POST['setStatusBackend'] as $id => $value) {
//update settings
//.........这里部分代码省略.........
示例8: errorHandler
/**
* Fixes database errors.
*
* @global array $_CONFIG
*
* @return boolean
* @throws SupportException
*/
static function errorHandler()
{
global $_CONFIG;
try {
\Cx\Core\Setting\Controller\Setting::init('Support', '', 'Yaml');
//setup group
\Cx\Core\Setting\Controller\Setting::init('Support', 'setup', 'Yaml');
if (!\Cx\Core\Setting\Controller\Setting::isDefined('faqUrl') && !\Cx\Core\Setting\Controller\Setting::add('faqUrl', 'https://www.cloudrexx.com/FAQ', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'setup')) {
throw new SupportException("Failed to add Setting entry for faq url");
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('recipientMailAddress') && !\Cx\Core\Setting\Controller\Setting::add('recipientMailAddress', $_CONFIG['coreAdminEmail'], 2, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'setup')) {
throw new SupportException("Failed to add Setting entry for recipient mail address");
}
} catch (\Exception $e) {
\DBG::msg($e->getMessage());
}
// Always!
return false;
}
示例9: deactivateSetting
private function deactivateSetting($config)
{
if (\Permission::checkAccess(17, 'static', true)) {
\Cx\Core\Setting\Controller\Setting::init('Config', 'administrationArea', 'Yaml');
if (!\Cx\Core\Setting\Controller\Setting::isDefined($config)) {
$status = \Cx\Core\Setting\Controller\Setting::add($config, 'off', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, 'on:TXT_ACTIVATED,off:TXT_DEACTIVATED', 'administrationArea');
} else {
\Cx\Core\Setting\Controller\Setting::set($config, 'off');
$status = \Cx\Core\Setting\Controller\Setting::update($config);
}
if ($status) {
die('success');
}
}
die('error');
}
示例10: _updateHomeContentSettings
function _updateHomeContentSettings()
{
\Cx\Core\Setting\Controller\Setting::init('Config', 'component', 'Yaml');
$status = false;
if (isset($_POST['setHomeContent'])) {
$setHomeContent = intval($_POST['setHomeContent']);
if (!\Cx\Core\Setting\Controller\Setting::isDefined('podcastHomeContent')) {
$status = \Cx\Core\Setting\Controller\Setting::add('podcastHomeContent', $setHomeContent, 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component');
} else {
\Cx\Core\Setting\Controller\Setting::set('podcastHomeContent', $setHomeContent);
$status = \Cx\Core\Setting\Controller\Setting::update('podcastHomeContent');
}
}
return $status;
}
示例11: updateSettings
/**
* Validate and save new settings.
*
* @global ADONewConnection
* @global array
* @global array
*/
function updateSettings()
{
global $objDatabase, $_ARRAYLANG;
//update settings table and write new settings file for /config
if (isset($_POST['set_homecontent_submit'])) {
//update settings
\Cx\Core\Setting\Controller\Setting::init('Config', 'component', 'Yaml');
if (isset($_POST['setHomeContent'])) {
$setHomeContent = intval($_POST['setHomeContent']);
if (!\Cx\Core\Setting\Controller\Setting::isDefined('forumHomeContent')) {
\Cx\Core\Setting\Controller\Setting::add('forumHomeContent', $setHomeContent, 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component');
} else {
\Cx\Core\Setting\Controller\Setting::set('forumHomeContent', $setHomeContent);
\Cx\Core\Setting\Controller\Setting::update('forumHomeContent');
}
}
if (isset($_POST['setTagContent'])) {
$forumTagContent = intval($_POST['setTagContent']);
if (!\Cx\Core\Setting\Controller\Setting::isDefined('forumTagContent')) {
\Cx\Core\Setting\Controller\Setting::add('forumTagContent', $forumTagContent, 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component');
} else {
\Cx\Core\Setting\Controller\Setting::set('forumTagContent', $forumTagContent);
\Cx\Core\Setting\Controller\Setting::update('forumTagContent');
}
}
}
foreach ($_POST['setvalue'] as $intSetId => $strSetValue) {
switch ($intSetId) {
case 1:
$strSetValue = intval($strSetValue) == 0 ? $this->_arrSettings['thread_paging'] : intval($strSetValue);
break;
case 2:
$strSetValue = intval($strSetValue) == 0 ? $this->_arrSettings['posting_paging'] : intval($strSetValue);
break;
case 3:
$strSetValue = intval($strSetValue) == 0 ? $this->_arrSettings['latest_entries_count'] : intval($strSetValue);
break;
default:
}
$objDatabase->Execute(' UPDATE ' . DBPREFIX . 'module_forum_settings
SET value="' . addslashes($strSetValue) . '"
WHERE id=' . intval($intSetId) . '
LIMIT 1');
}
$this->_arrSettings = $this->createSettingsArray();
// $objCache = new \CacheManager();
// $objCache->deleteAllFiles();
$this->_strOkMessage = $_ARRAYLANG['TXT_FORUM_SETTINGS_UPDATE_OK'];
}
示例12: initConfig
/**
* Fixes database errors.
*
* @return boolean
* @throws GeoIpException
*/
static function initConfig()
{
try {
\Cx\Core\Setting\Controller\Setting::init('GeoIp', '', 'Yaml');
//setup config
\Cx\Core\Setting\Controller\Setting::init('GeoIp', 'config', 'Yaml');
if (!\Cx\Core\Setting\Controller\Setting::isDefined('serviceStatus') && !\Cx\Core\Setting\Controller\Setting::add('serviceStatus', 0, 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'config')) {
throw new GeoIpException("Failed to add Setting entry for GeoIp Service Status");
}
} catch (\Exception $e) {
\DBG::msg($e->getMessage());
}
// Always!
return false;
}
示例13: errorHandler
/**
* Handles errors ocurring in this class
*
* Applies to the section (module) SettingsDb has been initialized with.
* In particular, tries to add missing Settings using the defaults.
* However, you will have to set them to their correct values after this.
* Note that you *MUST* call \Cx\Core\Setting\Controller\Setting::init() using the proper section
* and group parameters beforehand. Otherwise, no settings will be added.
*/
static function errorHandler()
{
// Yellowpay
\Cx\Core\Setting\Controller\Setting::errorHandler();
// You *MUST* call this yourself beforehand, using the proper section!
//\Cx\Core\Setting\Controller\Setting::init('Shop', 'config');
// Signature: ($name, $value, $ord, $type, $values, $key)
\Cx\Core\Setting\Controller\Setting::add('postfinance_shop_id', 'Ihr Kontoname', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT);
\Cx\Core\Setting\Controller\Setting::add('postfinance_active', '0', 2, \Cx\Core\Setting\Controller\Setting::TYPE_CHECKBOX, '1');
\Cx\Core\Setting\Controller\Setting::add('postfinance_authorization_type', 'SAL', 3, \Cx\Core\Setting\Controller\Setting::TYPE_DROPDOWN, 'RES:Reservation,SAL:Verkauf');
// OBSOLETE
// As it appears that in_array(0, $array) is true for each non-empty
// $array, indices for the entries must be numbered starting at 1.
// $arrPayments = array();
// foreach (self::$arrKnownPaymentMethod as $index => $name) {
// $arrPayments[$index] = $name;
// }
// \Cx\Core\Setting\Controller\Setting::add('postfinance_accepted_payment_methods', '',
// 4, \Cx\Core\Setting\Controller\Setting::TYPE_CHECKBOXGROUP,
// \Cx\Core\Setting\Controller\Setting::joinValues($arrPayments));
\Cx\Core\Setting\Controller\Setting::add('postfinance_hash_signature_in', 'Mindestens 16 Buchstaben, Ziffern und Zeichen', 5, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT);
\Cx\Core\Setting\Controller\Setting::add('postfinance_hash_signature_out', 'Mindestens 16 Buchstaben, Ziffern und Zeichen', 6, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT);
\Cx\Core\Setting\Controller\Setting::add('postfinance_use_testserver', '1', 7, \Cx\Core\Setting\Controller\Setting::TYPE_CHECKBOX, '1');
// Always
return false;
}
示例14: _saveSettings
/**
* Save the settings associated to the block system
*
* @access private
* @param array $arrSettings
*/
function _saveSettings($arrSettings)
{
\Cx\Core\Setting\Controller\Setting::init('Config', 'component', 'Yaml');
if (isset($arrSettings['blockStatus'])) {
if (!\Cx\Core\Setting\Controller\Setting::isDefined('blockStatus')) {
\Cx\Core\Setting\Controller\Setting::add('blockStatus', $arrSettings['blockStatus'], 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component');
} else {
\Cx\Core\Setting\Controller\Setting::set('blockStatus', $arrSettings['blockStatus']);
\Cx\Core\Setting\Controller\Setting::update('blockStatus');
}
}
if (isset($arrSettings['blockRandom'])) {
if (!\Cx\Core\Setting\Controller\Setting::isDefined('blockRandom')) {
\Cx\Core\Setting\Controller\Setting::add('blockRandom', $arrSettings['blockRandom'], 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component');
} else {
\Cx\Core\Setting\Controller\Setting::set('blockRandom', $arrSettings['blockRandom']);
\Cx\Core\Setting\Controller\Setting::update('blockRandom');
}
}
}
示例15: view_settings_vat
static function view_settings_vat()
{
global $_ARRAYLANG;
// TODO: Temporary. Remove in release with working update
// Returns NULL on missing entries even when other settings are properly loaded
$vat_number = \Cx\Core\Setting\Controller\Setting::getValue('vat_number', 'Shop');
if (is_null($vat_number)) {
\Cx\Core\Setting\Controller\Setting::add('vat_number', '12345678', 1, 'text', '', 'config');
}
// Shop general settings template
self::$objTemplate->addBlockfile('SHOP_SETTINGS_FILE', 'settings_block', 'module_shop_settings_vat.html');
self::$objTemplate->setGlobalVariable($_ARRAYLANG);
$enabled_home_customer = \Cx\Core\Setting\Controller\Setting::getValue('vat_enabled_home_customer', 'Shop');
$included_home_customer = \Cx\Core\Setting\Controller\Setting::getValue('vat_included_home_customer', 'Shop');
$enabled_home_reseller = \Cx\Core\Setting\Controller\Setting::getValue('vat_enabled_home_reseller', 'Shop');
$included_home_reseller = \Cx\Core\Setting\Controller\Setting::getValue('vat_included_home_reseller', 'Shop');
$enabled_foreign_customer = \Cx\Core\Setting\Controller\Setting::getValue('vat_enabled_foreign_customer', 'Shop');
$included_foreign_customer = \Cx\Core\Setting\Controller\Setting::getValue('vat_included_foreign_customer', 'Shop');
$enabled_foreign_reseller = \Cx\Core\Setting\Controller\Setting::getValue('vat_enabled_foreign_reseller', 'Shop');
$included_foreign_reseller = \Cx\Core\Setting\Controller\Setting::getValue('vat_included_foreign_reseller', 'Shop');
self::$objTemplate->setVariable(array('SHOP_VAT_NUMBER' => \Cx\Core\Setting\Controller\Setting::getValue('vat_number', 'Shop'), 'SHOP_VAT_CHECKED_HOME_CUSTOMER' => $enabled_home_customer ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_VAT_DISPLAY_HOME_CUSTOMER' => $enabled_home_customer ? 'block' : 'none', 'SHOP_VAT_SELECTED_HOME_CUSTOMER_INCLUDED' => $included_home_customer ? \Html::ATTRIBUTE_SELECTED : '', 'SHOP_VAT_SELECTED_HOME_CUSTOMER_EXCLUDED' => $included_home_customer ? '' : \Html::ATTRIBUTE_SELECTED, 'SHOP_VAT_CHECKED_HOME_RESELLER' => $enabled_home_reseller ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_VAT_DISPLAY_HOME_RESELLER' => $enabled_home_reseller ? 'block' : 'none', 'SHOP_VAT_SELECTED_HOME_RESELLER_INCLUDED' => $included_home_reseller ? \Html::ATTRIBUTE_SELECTED : '', 'SHOP_VAT_SELECTED_HOME_RESELLER_EXCLUDED' => $included_home_reseller ? '' : \Html::ATTRIBUTE_SELECTED, 'SHOP_VAT_CHECKED_FOREIGN_CUSTOMER' => $enabled_foreign_customer ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_VAT_DISPLAY_FOREIGN_CUSTOMER' => $enabled_foreign_customer ? 'block' : 'none', 'SHOP_VAT_SELECTED_FOREIGN_CUSTOMER_INCLUDED' => $included_foreign_customer ? \Html::ATTRIBUTE_SELECTED : '', 'SHOP_VAT_SELECTED_FOREIGN_CUSTOMER_EXCLUDED' => $included_foreign_customer ? '' : \Html::ATTRIBUTE_SELECTED, 'SHOP_VAT_CHECKED_FOREIGN_RESELLER' => $enabled_foreign_reseller ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_VAT_DISPLAY_FOREIGN_RESELLER' => $enabled_foreign_reseller ? 'block' : 'none', 'SHOP_VAT_SELECTED_FOREIGN_RESELLER_INCLUDED' => $included_foreign_reseller ? \Html::ATTRIBUTE_SELECTED : '', 'SHOP_VAT_SELECTED_FOREIGN_RESELLER_EXCLUDED' => $included_foreign_reseller ? '' : \Html::ATTRIBUTE_SELECTED, 'SHOP_VAT_DEFAULT_MENUOPTIONS' => Vat::getMenuoptions(\Cx\Core\Setting\Controller\Setting::getValue('vat_default_id', 'Shop'), true), 'SHOP_VAT_OTHER_MENUOPTIONS' => Vat::getMenuoptions(\Cx\Core\Setting\Controller\Setting::getValue('vat_other_id', 'Shop'), true)));
// start value added tax (VAT) display
// fill in the VAT fields of the template
$i = 0;
foreach (Vat::getArray() as $vat_id => $arrVat) {
self::$objTemplate->setVariable(array('SHOP_ROWCLASS' => 'row' . (++$i % 2 + 1), 'SHOP_VAT_ID' => $vat_id, 'SHOP_VAT_RATE' => $arrVat['rate'], 'SHOP_VAT_CLASS' => $arrVat['class']));
self::$objTemplate->parse('vatRow');
}
}