parent
3699728a3a
commit
8387cd8ae3
|
@ -21,6 +21,16 @@ $entries=OC_Log_Owncloud::getEntries(3);
|
||||||
$entriesremain = count(OC_Log_Owncloud::getEntries(4)) > 3;
|
$entriesremain = count(OC_Log_Owncloud::getEntries(4)) > 3;
|
||||||
|
|
||||||
$tmpl->assign('loglevel', OC_Config::getValue( "loglevel", 2 ));
|
$tmpl->assign('loglevel', OC_Config::getValue( "loglevel", 2 ));
|
||||||
|
$tmpl->assign('mail_domain', OC_Config::getValue( "mail_domain", '' ));
|
||||||
|
$tmpl->assign('mail_from_address', OC_Config::getValue( "mail_from_address", '' ));
|
||||||
|
$tmpl->assign('mail_smtpmode', OC_Config::getValue( "mail_smtpmode", '' ));
|
||||||
|
$tmpl->assign('mail_smtpsecure', OC_Config::getValue( "mail_smtpsecure", '' ));
|
||||||
|
$tmpl->assign('mail_smtphost', OC_Config::getValue( "mail_smtphost", '' ));
|
||||||
|
$tmpl->assign('mail_smtpport', OC_Config::getValue( "mail_smtpport", '' ));
|
||||||
|
$tmpl->assign('mail_smtpauthtype', OC_Config::getValue( "mail_smtpauthtype", '' ));
|
||||||
|
$tmpl->assign('mail_smtpauth', OC_Config::getValue( "mail_smtpauth", false ));
|
||||||
|
$tmpl->assign('mail_smtpname', OC_Config::getValue( "mail_smtpname", '' ));
|
||||||
|
$tmpl->assign('mail_smtppassword', OC_Config::getValue( "mail_smtppassword", '' ));
|
||||||
$tmpl->assign('entries', $entries);
|
$tmpl->assign('entries', $entries);
|
||||||
$tmpl->assign('entriesremain', $entriesremain);
|
$tmpl->assign('entriesremain', $entriesremain);
|
||||||
$tmpl->assign('htaccessworking', $htaccessworking);
|
$tmpl->assign('htaccessworking', $htaccessworking);
|
||||||
|
|
|
@ -0,0 +1,83 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @author Joas Schilling
|
||||||
|
* @copyright 2014 Joas Schilling nickvergessen@owncloud.com
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 3 of the License, or any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace OC\Settings\Admin;
|
||||||
|
|
||||||
|
class Controller {
|
||||||
|
public static function setMailSettings($args) {
|
||||||
|
\OC_Util::checkAdminUser();
|
||||||
|
\OCP\JSON::callCheck();
|
||||||
|
|
||||||
|
$l = \OC_L10N::get('settings');
|
||||||
|
|
||||||
|
$smtp_settings = array(
|
||||||
|
'mail_domain' => null,
|
||||||
|
'mail_from_address' => null,
|
||||||
|
'mail_smtpmode' => array('sendmail', 'smtp', 'qmail', 'php'),
|
||||||
|
'mail_smtpsecure' => array('', 'ssl', 'tls'),
|
||||||
|
'mail_smtphost' => null,
|
||||||
|
'mail_smtpport' => null,
|
||||||
|
'mail_smtpauthtype' => array('LOGIN', 'PLAIN', 'NTLM'),
|
||||||
|
'mail_smtpauth' => true,
|
||||||
|
'mail_smtpname' => null,
|
||||||
|
'mail_smtppassword' => null,
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($smtp_settings as $setting => $validate) {
|
||||||
|
if (!$validate) {
|
||||||
|
if (!isset($_POST[$setting]) || $_POST[$setting] === '') {
|
||||||
|
\OC_Config::deleteKey( $setting );
|
||||||
|
} else {
|
||||||
|
\OC_Config::setValue( $setting, $_POST[$setting] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (is_bool($validate)) {
|
||||||
|
if (!empty($_POST[$setting])) {
|
||||||
|
\OC_Config::setValue( $setting, (bool) $_POST[$setting] );
|
||||||
|
} else {
|
||||||
|
\OC_Config::deleteKey( $setting );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (is_array($validate)) {
|
||||||
|
if (!isset($_POST[$setting]) || $_POST[$setting] === '') {
|
||||||
|
\OC_Config::deleteKey( $setting );
|
||||||
|
} else if (in_array($_POST[$setting], $validate)) {
|
||||||
|
\OC_Config::setValue( $setting, $_POST[$setting] );
|
||||||
|
} else {
|
||||||
|
$message = $l->t('Invalid value supplied for %s', array(self::getFieldname($setting, $l)));
|
||||||
|
\OC_JSON::error( array( "data" => array( "message" => $message)) );
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
\OC_JSON::success(array("data" => array( "message" => $l->t("Saved") )));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getFieldname($setting, $l) {
|
||||||
|
switch ($setting) {
|
||||||
|
case 'mail_smtpmode':
|
||||||
|
return $l->t( 'SMTP mode' );
|
||||||
|
case 'mail_smtpsecure':
|
||||||
|
return $l->t( 'Secure SMTP' );
|
||||||
|
case 'mail_smtpauthtype':
|
||||||
|
return $l->t( 'Authentification method for SMTP' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -150,6 +150,18 @@ span.connectionwarning {color:#933; font-weight:bold; }
|
||||||
input[type=radio] { width:1em; }
|
input[type=radio] { width:1em; }
|
||||||
table.shareAPI td { padding-bottom: 0.8em; }
|
table.shareAPI td { padding-bottom: 0.8em; }
|
||||||
|
|
||||||
|
#mail_settings p label:first-child {
|
||||||
|
display: inline-block;
|
||||||
|
width: 300px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
#mail_settings p select:nth-child(2) {
|
||||||
|
width: 143px;
|
||||||
|
}
|
||||||
|
#mail_smtpport {
|
||||||
|
width: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
/* HELP */
|
/* HELP */
|
||||||
.pressed {background-color:#DDD;}
|
.pressed {background-color:#DDD;}
|
||||||
|
|
||||||
|
|
|
@ -34,4 +34,42 @@ $(document).ready(function(){
|
||||||
$('#security').change(function(){
|
$('#security').change(function(){
|
||||||
$.post(OC.filePath('settings','ajax','setsecurity.php'), { enforceHTTPS: $('#forcessl').val() },function(){} );
|
$.post(OC.filePath('settings','ajax','setsecurity.php'), { enforceHTTPS: $('#forcessl').val() },function(){} );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#mail_smtpauth').change(function() {
|
||||||
|
if (!this.checked) {
|
||||||
|
$('#mail_credentials').toggle(false);
|
||||||
|
} else {
|
||||||
|
$('#mail_credentials').toggle(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#mail_settings').change(function(){
|
||||||
|
OC.msg.startSaving('#mail_settings .msg');
|
||||||
|
var post = $( "#mail_settings" ).serialize();
|
||||||
|
$.post(OC.Router.generate('settings_mail_settings'), post, function(data){
|
||||||
|
OC.msg.finishedSaving('#mail_settings .msg', data);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
OC.msg={
|
||||||
|
startSaving:function(selector){
|
||||||
|
$(selector)
|
||||||
|
.html( t('settings', 'Saving...') )
|
||||||
|
.removeClass('success')
|
||||||
|
.removeClass('error')
|
||||||
|
.stop(true, true)
|
||||||
|
.show();
|
||||||
|
},
|
||||||
|
finishedSaving:function(selector, data){
|
||||||
|
if( data.status === "success" ){
|
||||||
|
$(selector).html( data.data.message )
|
||||||
|
.addClass('success')
|
||||||
|
.stop(true, true)
|
||||||
|
.delay(3000)
|
||||||
|
.fadeOut(900);
|
||||||
|
}else{
|
||||||
|
$(selector).html( data.data.message ).addClass('error');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
|
@ -70,6 +70,9 @@ $this->create('settings_ajax_getlog', '/settings/ajax/getlog.php')
|
||||||
->actionInclude('settings/ajax/getlog.php');
|
->actionInclude('settings/ajax/getlog.php');
|
||||||
$this->create('settings_ajax_setloglevel', '/settings/ajax/setloglevel.php')
|
$this->create('settings_ajax_setloglevel', '/settings/ajax/setloglevel.php')
|
||||||
->actionInclude('settings/ajax/setloglevel.php');
|
->actionInclude('settings/ajax/setloglevel.php');
|
||||||
|
$this->create('settings_mail_settings', '/settings/admin/mailsettings')
|
||||||
|
->post()
|
||||||
|
->action('OC\Settings\Admin\Controller', 'setMailSettings');
|
||||||
$this->create('settings_ajax_setsecurity', '/settings/ajax/setsecurity.php')
|
$this->create('settings_ajax_setsecurity', '/settings/ajax/setsecurity.php')
|
||||||
->actionInclude('settings/ajax/setsecurity.php');
|
->actionInclude('settings/ajax/setsecurity.php');
|
||||||
$this->create('isadmin', '/settings/js/isadmin.js')
|
$this->create('isadmin', '/settings/js/isadmin.js')
|
||||||
|
|
|
@ -11,6 +11,27 @@ $levelLabels = array(
|
||||||
$l->t( 'Errors and fatal issues' ),
|
$l->t( 'Errors and fatal issues' ),
|
||||||
$l->t( 'Fatal issues only' ),
|
$l->t( 'Fatal issues only' ),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$mail_smtpauthtype = array(
|
||||||
|
'' => $l->t('None'),
|
||||||
|
'LOGIN' => $l->t('Login'),
|
||||||
|
'PLAIN' => $l->t('Plain'),
|
||||||
|
'NTLM' => $l->t('NT LAN Manager'),
|
||||||
|
);
|
||||||
|
|
||||||
|
$mail_smtpsecure = array(
|
||||||
|
'' => $l->t('None'),
|
||||||
|
'ssl' => $l->t('SSL'),
|
||||||
|
'tls' => $l->t('TLS'),
|
||||||
|
);
|
||||||
|
|
||||||
|
$mail_smtpmode = array(
|
||||||
|
'sendmail',
|
||||||
|
'smtp',
|
||||||
|
'qmail',
|
||||||
|
'php',
|
||||||
|
);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
@ -250,6 +271,73 @@ if (!$_['internetconnectionworking']) {
|
||||||
</table>
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset id="mail_settings" class="personalblock">
|
||||||
|
<h2><?php p($l->t('Email Server'));?> <span class="msg"></span></h2>
|
||||||
|
|
||||||
|
<p><?php p($l->t('This is used for sending out notifications.')); ?></p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<label for="mail_smtpmode"><?php p($l->t( 'Send mode' )); ?></label>
|
||||||
|
<select name='mail_smtpmode' id='mail_smtpmode'>
|
||||||
|
<?php foreach ($mail_smtpmode as $smtpmode):
|
||||||
|
$selected = '';
|
||||||
|
if ($smtpmode == $_['mail_smtpmode']):
|
||||||
|
$selected = 'selected="selected"';
|
||||||
|
endif; ?>
|
||||||
|
<option value='<?php p($smtpmode)?>' <?php p($selected) ?>><?php p($smtpmode) ?></option>
|
||||||
|
<?php endforeach;?>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<label for="mail_smtpsecure"><?php p($l->t( 'Encryption' )); ?></label>
|
||||||
|
<select name='mail_smtpsecure' id='mail_smtpsecure'>
|
||||||
|
<?php foreach ($mail_smtpsecure as $secure => $name):
|
||||||
|
$selected = '';
|
||||||
|
if ($secure == $_['mail_smtpsecure']):
|
||||||
|
$selected = 'selected="selected"';
|
||||||
|
endif; ?>
|
||||||
|
<option value='<?php p($secure)?>' <?php p($selected) ?>><?php p($name) ?></option>
|
||||||
|
<?php endforeach;?>
|
||||||
|
</select>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<label for="mail_smtpauthtype"><?php p($l->t( 'Authentification method for SMTP' )); ?></label>
|
||||||
|
<select name='mail_smtpauthtype' id='mail_smtpauthtype'>
|
||||||
|
<?php foreach ($mail_smtpauthtype as $authtype => $name):
|
||||||
|
$selected = '';
|
||||||
|
if ($authtype == $_['mail_smtpauthtype']):
|
||||||
|
$selected = 'selected="selected"';
|
||||||
|
endif; ?>
|
||||||
|
<option value='<?php p($authtype)?>' <?php p($selected) ?>><?php p($name) ?></option>
|
||||||
|
<?php endforeach;?>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<input type="checkbox" name="mail_smtpauth" id="mail_smtpauth" value="1" <?php if ($_['mail_smtpauth']) print_unescaped('checked="checked"'); ?> />
|
||||||
|
<label for="mail_smtpauth"><?php p($l->t( 'Authentication required' )); ?></label>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p id="mail_credentials" <?php if (!$_['mail_smtpauth']) print_unescaped(' style="display: none;"'); ?>>
|
||||||
|
<label for="mail_smtpname"><?php p($l->t( 'SMTP credentials' )); ?></label>
|
||||||
|
<input type="text" name='mail_smtpname' id="mail_smtpname" placeholder="<?php p($l->t('SMTP Username'))?>" value='<?php p($_['mail_smtpname']) ?>' />
|
||||||
|
<input type="password" name='mail_smtppassword' id="mail_smtppassword" placeholder="<?php p($l->t('SMTP Password'))?>" value='<?php p($_['mail_smtppassword']) ?>' />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<label for="mail_smtphost"><?php p($l->t( 'SMTP server address' )); ?></label>
|
||||||
|
<input type="text" name='mail_smtphost' id="mail_smtphost" placeholder="<?php p('smtp.example.com')?>" value='<?php p($_['mail_smtphost']) ?>' />
|
||||||
|
:
|
||||||
|
<input type="text" name='mail_smtpport' id="mail_smtpport" placeholder="<?php p($l->t('Port'))?>" value='<?php p($_['mail_smtpport']) ?>' />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<label for="mail_from_address"><?php p($l->t( 'From address' )); ?></label>
|
||||||
|
<input type="text" name='mail_from_address' id="mail_from_address" placeholder="<?php p('owncloud')?>" value='<?php p($_['mail_from_address']) ?>' />
|
||||||
|
@
|
||||||
|
<input type="text" name='mail_domain' id="mail_domain" placeholder="<?php p('example.com')?>" value='<?php p($_['mail_domain']) ?>' />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
<fieldset class="personalblock">
|
<fieldset class="personalblock">
|
||||||
<h2><?php p($l->t('Log'));?></h2>
|
<h2><?php p($l->t('Log'));?></h2>
|
||||||
<?php p($l->t('Log level'));?> <select name='loglevel' id='loglevel'>
|
<?php p($l->t('Log level'));?> <select name='loglevel' id='loglevel'>
|
||||||
|
|
Loading…
Reference in New Issue