fixing some missing GLOBAL + issue with variables_set

This commit is contained in:
Benjamin Sonntag 2015-09-02 11:30:40 +02:00
parent 179f4dd580
commit b71619c6f5
5 changed files with 40 additions and 7 deletions

View File

@ -445,6 +445,7 @@ ORDER BY
* or false if an error occured ($err is filled accordingly)
*/
function hook_dom_del_mx_domain($dom_id) {
global $db;
$list=$this->enum_domain_mails($dom_id,"",0,-1);
if (is_array($list)) {
foreach($list as $one) {

View File

@ -109,7 +109,7 @@ function variable_get($name, $default = null, $createit_comment = null) {
* of serialization as necessary.
*/
function variable_set($name, $value, $comment=null) {
global $conf, $db, $err;
global $conf, $db, $err, $hook;
$err->log('variable', 'variable_set', '+'.serialize($value).'+'.$comment.'+');
variable_init_maybe();
@ -117,10 +117,13 @@ function variable_set($name, $value, $comment=null) {
if (is_object($value) || is_array($value)) {
$value2 = serialize($value);
}
if (array_key_exists($name,$conf)) {
$previous=$conf[$name];
} else {
$previous=null;
}
if (!array_key_exists($name,$conf) || $value!=$conf[$name]) {
$previous=$conf[$name];
$conf[$name] = $value;
if ( empty($comment) ) {
$query = "INSERT INTO variable (name, value) values ('".$name."', '".addslashes($value2)."') on duplicate key update name='$name', value='$value';";
} else {

7
debian/changelog vendored
View File

@ -1,3 +1,10 @@
alternc (3.1.9) oldoldstable; urgency=low
* fix missing GLOBALS in various places
* fix non-installed default_spf_value and default_dmarc_value in variables
-- Benjamin Sonntag <benjamin@sonntag.fr> Wed, 3 Sep 2015 15:53:16 +0200
alternc (3.1.8) oldoldstable; urgency=low
* fix non-working levensthein call for checkPolicy, fixed using preg_split instead

View File

@ -0,0 +1,22 @@
#!/usr/bin/php
<?php
// We check that mysql php module is loaded
if(!function_exists('mysql_connect')) {
if(!dl("mysql.so"))
exit(1);
}
// we don't check our AlternC session
if(!chdir("/usr/share/alternc/panel"))
exit(1);
require("/usr/share/alternc/panel/class/config_nochk.php");
// we do it that way, so that the HOOK will be triggered, changing the zone files:
variable_set('default_spf_value','a mx ?all', 'This variable (if set) tells the SPF/TXT DNS field that will be published as a SPF entry, telling which server(s) are allowed to send email for this one. You can still change it later in the advanced DNS entries for ONE domain, this entry is only set once for new domains (or when you change it here).');
variable_set('default_dmarc_value', 'p=none;pct=100;rua=%%ADMINMAIL%%;aspf=r;adkim=r', 'This variable (if set) tells the DMARC/TXT DNS field that will be published as a DMARC entry, telling which policy you apply to this domain name. You can still change it later in the advanced DNS entries for ONE domain, this entry is only set once for new domains (or when you change it here). You can use %%ADMINMAIL%% or %%USERMAIL%% to substitute to admin-account or alternc user-account email address.');
// strict dmarc would be 'p=reject;pct=100;rua=%%ADMINMAIL%%;aspf=s;adkim=s'

View File

@ -1,13 +1,13 @@
--- changelog 2014-06-24 13:42:50.234304438 +0200
+++ changelog.wheezy 2014-06-24 13:43:51.978313552 +0200
@@ -1,3 +1,10 @@
+alternc (3.2.8) oldstable; urgency=low
+alternc (3.2.9) oldstable; urgency=low
+
+ * Version identical to 3.1 for Squeeze
+ * Includes a small dovecot patch / dependency for dovecot 2.0 for Wheezy
+
+ -- Benjamin Sonntag <benjamin@sonntag.fr> Mon, 3 Aug 2015 15:54:12 +0200
+ -- Benjamin Sonntag <benjamin@sonntag.fr> Wed, 3 Sep 2015 15:54:12 +0200
+
alternc (3.1.8) oldoldstable; urgency=low
alternc (3.1.9) oldoldstable; urgency=low
* fix non-working levensthein call for checkPolicy, fixed using preg_split instead
* fix missing GLOBALS in various places