Switch from "on"/"off" config style to "1"/<unset>

pull/113/head
Matthew Exon 2013-04-01 19:47:40 +08:00
parent d235df3f48
commit 84744911c6
2 changed files with 5 additions and 6 deletions

Binary file not shown.

View File

@ -74,7 +74,7 @@ function mailstream_generate_id($a, $uri) {
} }
function mailstream_post_remote_hook(&$a, &$item) { function mailstream_post_remote_hook(&$a, &$item) {
if (get_pconfig($item['uid'], 'mailstream', 'enabled') !== 'on') { if (!get_pconfig($item['uid'], 'mailstream', 'enabled')) {
return; return;
} }
if (!$item['uid']) { if (!$item['uid']) {
@ -266,7 +266,6 @@ function mailstream_cron($a, $b) {
function mailstream_plugin_settings(&$a,&$s) { function mailstream_plugin_settings(&$a,&$s) {
$enabled = get_pconfig(local_user(), 'mailstream', 'enabled'); $enabled = get_pconfig(local_user(), 'mailstream', 'enabled');
$enabled_mu = ($enabled === 'on') ? ' checked="true"' : '';
$address = get_pconfig(local_user(), 'mailstream', 'address'); $address = get_pconfig(local_user(), 'mailstream', 'address');
$template = get_markup_template('settings.tpl', 'addon/mailstream/'); $template = get_markup_template('settings.tpl', 'addon/mailstream/');
$s .= replace_macros($template, array( $s .= replace_macros($template, array(
@ -284,14 +283,14 @@ function mailstream_plugin_settings(&$a,&$s) {
} }
function mailstream_plugin_settings_post($a,$post) { function mailstream_plugin_settings_post($a,$post) {
if ($_POST['address'] != "") { if ($_POST['mailstream_address'] != "") {
set_pconfig(local_user(), 'mailstream', 'address', $_POST['address']); set_pconfig(local_user(), 'mailstream', 'address', $_POST['mailstream_address']);
} }
else { else {
del_pconfig(local_user(), 'mailstream', 'address'); del_pconfig(local_user(), 'mailstream', 'address');
} }
if ($_POST['enabled']) { if ($_POST['mailstream_enabled']) {
set_pconfig(local_user(), 'mailstream', 'enabled', $_POST['enabled']); set_pconfig(local_user(), 'mailstream', 'enabled', $_POST['mailstream_enabled']);
} }
else { else {
del_pconfig(local_user(), 'mailstream', 'enabled'); del_pconfig(local_user(), 'mailstream', 'enabled');