本文整理汇总了PHP中Settings::AddNew方法的典型用法代码示例。如果您正苦于以下问题:PHP Settings::AddNew方法的具体用法?PHP Settings::AddNew怎么用?PHP Settings::AddNew使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Settings
的用法示例。
在下文中一共展示了Settings::AddNew方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateToVersion
updateToVersion('0.9.32');
}
if (isFroxlorVersion('0.9.32')) {
showUpdateStep("Updating from 0.9.32 to 0.9.33-dev1", false);
showUpdateStep("Adding settings for custom newsfeed on customer-dashboard");
Settings::AddNew("customer.show_news_feed", isset($_POST['customer_show_news_feed']) ? (int) $_POST['customer_show_news_feed'] : '0');
Settings::AddNew("customer.news_feed_url", isset($_POST['customer_news_feed_url']) ? $_POST['customer_news_feed_url'] : '');
lastStepStatus(0);
updateToVersion('0.9.33-dev1');
}
if (isFroxlorVersion('0.9.33-dev1')) {
showUpdateStep("Updating from 0.9.33-dev1 to 0.9.33-dev2", false);
showUpdateStep("Adding settings for hostname-dns-entry");
Settings::AddNew("system.dns_createhostnameentry", isset($_POST['dns_createhostnameentry']) ? (int) $_POST['dns_createhostnameentry'] : '0');
lastStepStatus(0);
updateToVersion('0.9.33-dev2');
}
if (isFroxlorVersion('0.9.33-dev2')) {
showUpdateStep("Updating from 0.9.33-dev2 to 0.9.33-dev3", false);
showUpdateStep("Adding settings for password-generation options");
Settings::AddNew("panel.password_alpha_lower", '1');
Settings::AddNew("panel.password_alpha_upper", '1');
Settings::AddNew("panel.password_numeric", '0');
Settings::AddNew("panel.password_special_char_required", '0');
Settings::AddNew("panel.password_special_char", '!?<>§$%&+#=@');
lastStepStatus(0);
showUpdateStep("Adding settings for fpm-apache2.4-mod_proxy integration");
Settings::AddNew("phpfpm.use_mod_proxy", '0');
lastStepStatus(0);
updateToVersion('0.9.33-dev3');
}
示例2: lastStepStatus
lastStepStatus(1, "not needed");
}
showUpdateStep("Updating language descriptions to be in the native language");
$upd_stmt = Database::prepare("UPDATE `" . TABLE_PANEL_LANGUAGE . "` SET `language` = :lang WHERE `iso` = :iso");
Database::pexecute($upd_stmt, array('lang' => 'Français', 'iso' => 'fr'), false);
Database::pexecute($upd_stmt, array('lang' => 'Português', 'iso' => 'pt'), false);
Database::pexecute($upd_stmt, array('lang' => 'Italiano', 'iso' => 'it'), false);
Database::pexecute($upd_stmt, array('lang' => 'Nederlands', 'iso' => 'nl'), false);
Database::pexecute($upd_stmt, array('lang' => 'Svenska', 'iso' => 'sv'), false);
lastStepStatus(0);
updateToVersion('0.9.34-dev1');
}
if (isFroxlorVersion('0.9.34-dev1')) {
showUpdateStep("Updating from 0.9.34-dev1 to 0.9.34-dev2", false);
showUpdateStep("Adding new settings for apache-itk-mpm");
Settings::AddNew("system.apacheitksupport", '0');
lastStepStatus(0);
showUpdateStep("Increase text-field size of domain-ssl table");
Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` MODIFY `ssl_cert_file` mediumtext NOT NULL");
Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` MODIFY `ssl_key_file` mediumtext NOT NULL");
Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` MODIFY `ssl_ca_file` mediumtext NOT NULL");
Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` MODIFY `ssl_cert_chainfile` mediumtext NOT NULL");
lastStepStatus(0);
updateToVersion('0.9.34-dev2');
}
if (isFroxlorVersion('0.9.34-dev2')) {
showUpdateStep("Updating from 0.9.34-dev2 to 0.9.34-dev3", false);
$do_update = true;
showUpdateStep("Checking for required PHP mbstring-extension");
if (!extension_loaded('mbstring')) {
$do_update = false;
示例3: lastStepStatus
Settings::AddNew("system.mail_smtp_port", $smtp_port);
Settings::AddNew("system.mail_smtp_usetls", $smtp_usetls);
Settings::AddNew("system.mail_smtp_auth", $smtp_useauth);
Settings::AddNew("system.mail_smtp_user", $smtp_user);
Settings::AddNew("system.mail_smtp_passwd", $smtp_passwd);
lastStepStatus(0);
updateToDbVersion('201609200');
}
if (isDatabaseVersion('201609200')) {
showUpdateStep("Changing tables to be more mysql strict-mode compatible");
Database::query("ALTER TABLE `" . TABLE_MAIL_VIRTUAL . "` CHANGE `destination` `destination` TEXT NOT NULL DEFAULT '';");
Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` CHANGE `registration_date` `registration_date` DATE NULL DEFAULT NULL;");
Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` CHANGE `termination_date` `termination_date` DATE NULL DEFAULT NULL;");
lastStepStatus(0);
updateToDbVersion('201609240');
}
if (isDatabaseVersion('201609240')) {
showUpdateStep("Add HSTS settings for froxlor-vhost");
Settings::AddNew("system.hsts_maxage", 0);
Settings::AddNew("system.hsts_incsub", 0);
Settings::AddNew("system.hsts_preload", 0);
lastStepStatus(0);
showUpdateStep("Settings HSTS default values for all domains (deactivated)");
Database::query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `hsts_sub` = '0', `hsts_preload` = '0';");
lastStepStatus(0);
updateToDbVersion('201610070');
}
if (isFroxlorVersion('0.9.37')) {
showUpdateStep("Updating from 0.9.37 to 0.9.38-rc1", false);
updateToVersion('0.9.38-rc1');
}
示例4: showUpdateStep
showUpdateStep("Updating from 0.9.34.2 to 0.9.35-dev1");
lastStepStatus(0);
showUpdateStep("Adding Let's Encrypt - certificate fields");
Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` ADD `expirationdate` DATETIME NULL AFTER `ssl_cert_chainfile`;");
Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` ADD `lepublickey` MEDIUMTEXT DEFAULT NULL AFTER `custom_notes_show`");
Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` ADD `leprivatekey` MEDIUMTEXT DEFAULT NULL AFTER `lepublickey`;");
Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD `letsencrypt` TINYINT(1) NOT NULL DEFAULT '0' AFTER `ismainbutsubto`;");
Settings::AddNew("system.leprivatekey", 'unset');
Settings::AddNew("system.lepublickey", 'unset');
showUpdateStep("Adding new cron-module for Let's encrypt");
$stmt = Database::prepare("\n INSERT INTO `" . TABLE_PANEL_CRONRUNS . "` SET\n `module` = 'froxlor/letsencrypt',\n `cronfile` = 'letsencrypt',\n `interval` = '5 MINUTE',\n `desc_lng_key` = 'cron_letsencrypt',\n `lastrun` = NOW(),\n `isactive` = 1");
Database::pexecute($stmt);
lastStepStatus(0);
updateToVersion('0.9.35-dev1');
}
if (isFroxlorVersion('0.9.35-dev1')) {
showUpdateStep("Updating from 0.9.35-dev1 to 0.9.35-dev2");
lastStepStatus(0);
showUpdateStep("Adding Let's Encrypt - settings");
Settings::AddNew("system.letsencryptca", 'testing');
Settings::AddNew("system.letsencryptcountrycode", 'DE');
Settings::AddNew("system.letsencryptstate", 'Germany');
lastStepStatus(0);
updateToVersion('0.9.35-dev2');
}
if (isFroxlorVersion('0.9.35-dev2')) {
showUpdateStep("Updating from 0.9.35-dev2 to 0.9.35-dev3");
Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD `termination_date` date NOT NULL AFTER `registration_date`");
lastStepStatus(0);
updateToVersion('0.9.35-dev3');
}
示例5: lastStepStatus
lastStepStatus(0);
updateToDbVersion('201605090');
}
if (isDatabaseVersion('201605090')) {
showUpdateStep("Adjusting SPF record setting");
$current_spf = Settings::Get('spf.spf_entry');
// @ IN TXT "v=spf1 a mx -all"
$new_spf = substr($current_spf, strpos($current_spf, '"'));
Settings::Set('spf.spf_entry', $new_spf, true);
lastStepStatus(0);
updateToDbVersion('201605120');
}
if (isDatabaseVersion('201605120')) {
showUpdateStep("Adding new dns-server setting");
$new_dns_daemon = isset($_POST['new_dns_daemon']) ? $_POST['new_dns_daemon'] : "bind";
Settings::AddNew("system.dns_server", $new_dns_daemon);
lastStepStatus(0);
updateToDbVersion('201605170');
}
if (isDatabaseVersion('201605170')) {
showUpdateStep("Adding new dns-editor setting for customers");
Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` ADD `dnsenabled` tinyint(1) NOT NULL default '0' AFTER `perlenabled`;");
lastStepStatus(0);
updateToDbVersion('201605180');
}
if (isDatabaseVersion('201605180')) {
showUpdateStep("Changing tables to be more mysql strict-mode compatible");
Database::query("ALTER TABLE `" . TABLE_FTP_USERS . "` CHANGE `last_login` `last_login` DATETIME NULL DEFAULT NULL;");
Database::query("ALTER TABLE `" . TABLE_PANEL_IPSANDPORTS . "` CHANGE `specialsettings` `specialsettings` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;");
Database::query("ALTER TABLE `" . TABLE_PANEL_TASKS . "` CHANGE `data` `data` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;");
lastStepStatus(0);
示例6: panel_customers
Database::query("ALTER TABLE `panel_traffic`\n \tDROP KEY `customerid`,\n \tADD FOREIGN KEY `fk_customer` (customerid)\n \tREFERENCES panel_customers(customerid)\n \tON UPDATE CASCADE ON DELETE CASCADE;");
Database::query("ALTER TABLE `panel_traffic_admins`\n \tDROP KEY `adminid`,\n \t\tADD FOREIGN KEY `fk_admin` (adminid)\n \tREFERENCES panel_admins(adminid)\n \tON UPDATE CASCADE ON DELETE CASCADE;");
// it seems there are occasions where diskspace info
// for deleted customers is still in the database.
// remove that, just in case
Database::query("DELETE FROM `panel_diskspace` WHERE customerid NOT IN (SELECT customerid FROM `panel_customers`)");
Database::query("ALTER TABLE `panel_diskspace`\n \tDROP KEY `customerid`,\n \tADD FOREIGN KEY `fk_customer` (customerid)\n \tREFERENCES panel_customers(customerid)\n \tON UPDATE CASCADE ON DELETE CASCADE;");
Database::query("ALTER TABLE `panel_diskspace_admins`\n \tDROP KEY `adminid`,\n \tADD FOREIGN KEY `fk_admin` (adminid)\n \tREFERENCES panel_admins(adminid)\n \tON UPDATE CASCADE ON DELETE CASCADE;");
Database::query("ALTER TABLE `panel_tickets`\n \tMODIFY COLUMN `adminid` INT(11) UNSIGNED NOT NULL,\n \tMODIFY COLUMN `customerid` INT(11) UNSIGNED DEFAULT NULL");
Database::query("UPDATE `panel_tickets` set customerid=NULL where customerid='0'");
Database::query("ALTER TABLE `panel_tickets`\n\t\tDROP KEY `customerid`,\n \t ADD FOREIGN KEY `fk_admin` (adminid)\n\t REFERENCES panel_admins(adminid)\n \t ON UPDATE CASCADE ON DELETE CASCADE,\n \tADD FOREIGN KEY `fk_customer` (customerid)\n \tREFERENCES panel_customers(customerid)\n \tON UPDATE CASCADE ON DELETE CASCADE;");
Database::query("ALTER TABLE `panel_ticket_categories`\n \tMODIFY COLUMN `adminid` INT(11) UNSIGNED DEFAULT NULL,\n \tADD FOREIGN KEY `fk_admin` (adminid)\n \tREFERENCES panel_admins(adminid)\n \tON UPDATE CASCADE ON DELETE CASCADE;");
// it seems there can be redirect codes for deleted
// domains. Delete those, too
Database::query("DELETE from `domain_redirect_codes` where did not in (select id from `panel_domains`)");
Database::query("ALTER TABLE `domain_redirect_codes`\n \tADD PRIMARY KEY `pk` (`rid`,`did`),\n \tADD FOREIGN KEY `fk_redirect` (`rid`)\n\t REFERENCES redirect_codes(id)\n \t ON UPDATE CASCADE ON DELETE CASCADE,\n \tADD FOREIGN KEY `fk_domain` (did)\n \tREFERENCES panel_domains(id)\n \tON UPDATE CASCADE ON DELETE CASCADE;");
Database::query("ALTER TABLE `domain_ssl_settings`\n \tMODIFY COLUMN `domainid` INT(11) UNSIGNED NOT NULL,\n \tADD FOREIGN KEY `fk_domain` (domainid)\n \tREFERENCES panel_domains(id)\n \tON UPDATE CASCADE ON DELETE CASCADE;");
Database::query("ALTER TABLE `panel_domaintoip`\n \tADD FOREIGN KEY `fk_domain` (id_domain)\n \tREFERENCES panel_domains(id)\n \tON UPDATE CASCADE ON DELETE CASCADE,\n \tADD FOREIGN KEY `fk_ipandport` (id_ipandports)\n \tREFERENCES panel_ipsandports(id)\n \tON UPDATE CASCADE ON DELETE CASCADE;");
Database::query("ALTER TABLE `ftp_quotalimits`\n\t\tADD PRIMARY KEY `pk` (`name`, `quota_type`);");
Database::query("ALTER TABLE `ftp_quotatallies`\n\t\tADD PRIMARY KEY `pk` (`name`, `quota_type`);");
// add setting for webserver group
Settings::AddNew('system.customerdir_group_webserver', '0');
// add multinode version
Settings::AddNew('multinode.version', '0.0.1.0');
}
if (MN_getVersion() == array(0, 0, 1, 0)) {
showUpdateStep("Updating to multinode 0.0.2.0", false);
Database::query("CREATE TABLE `panel_nodes` (\n \t\t`id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n \t\t`name` varchar(64) NOT NULL,\n \t\t`image_name` varchar(128) NOT NULL,\n \t\t`image_tag` varchar(128) DEFAULT 'latest' NOT NULL,\n \t\t`is_default` tinyint(1) DEFAULT '0',\n \t\tPRIMARY KEY (`id`)\n\t\t) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;");
Database::query("CREATE TABLE `panel_nodetodomain` (\n \t\t`id_node` int(11) unsigned NOT NULL,\n \t\t`id_domain` int(11) unsigned NOT NULL,\n \t\tPRIMARY KEY (`id_node`,`id_domain`),\n \t\tFOREIGN KEY `fk_node` (id_node)\n \t\t\tREFERENCES panel_nodes(id)\n \t\tON UPDATE CASCADE ON DELETE CASCADE,\n \t\tFOREIGN KEY `fk_domain` (id_domain)\n \t\t\tREFERENCES panel_domains(id)\n \t\tON UPDATE CASCADE ON DELETE CASCADE\n\t\t) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;");
Settings::Set('multinode.version', '0.0.2.0');
}
示例7: isset
// get user-chosen value
$websrv_default = "/etc/apache2/conf-enabled/acme.conf";
if (Settings::Get('system.webserver') == 'nginx') {
$websrv_default = "/etc/nginx/acme.conf";
}
$acmeconffile = isset($_POST['acmeconffile']) ? $_POST['acmeconffile'] : $websrv_default;
$acmeconffile = makeCorrectFile($acmeconffile);
Settings::AddNew("system.letsencryptacmeconf", $acmeconffile);
lastStepStatus(0);
updateToDbVersion('201609120');
}
if (isDatabaseVersion('201609120')) {
showUpdateStep("Adding new SMTP settings for emails sent by froxlor");
// get user-chosen value
$smtp_enable = isset($_POST['smtp_enable']) ? (int) $_POST['smtp_enable'] : 0;
$smtp_host = isset($_POST['smtp_host']) ? $_POST['smtp_host'] : "localhost";
$smtp_port = isset($_POST['smtp_port']) ? (int) $_POST['smtp_port'] : 25;
$smtp_usetls = isset($_POST['smtp_usetls']) ? (int) $_POST['smtp_usetls'] : 1;
$smtp_useauth = isset($_POST['smtp_auth']) ? (int) $_POST['smtp_auth'] : 1;
$smtp_user = isset($_POST['smtp_user']) ? $_POST['smtp_user'] : "";
$smtp_passwd = isset($_POST['smtp_passwd']) ? $_POST['smtp_passwd'] : "";
Settings::AddNew("system.mail_use_smtp", $smtp_enable);
Settings::AddNew("system.mail_smtp_host", $smtp_host);
Settings::AddNew("system.mail_smtp_port", $smtp_port);
Settings::AddNew("system.mail_smtp_usetls", $smtp_usetls);
Settings::AddNew("system.mail_smtp_auth", $smtp_useauth);
Settings::AddNew("system.mail_smtp_user", $smtp_user);
Settings::AddNew("system.mail_smtp_passwd", $smtp_passwd);
lastStepStatus(0);
updateToDbVersion('201609200');
}