forked from emoncms/event_archived
-
Notifications
You must be signed in to change notification settings - Fork 0
/
event_settings_view.php
105 lines (85 loc) · 4.31 KB
/
event_settings_view.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php global $user,$session; ?>
<h2>Event settings</h2>
<form action="savesettings" method="post">
<div class="row-fluid">
<div class="span4">
<h3><?php echo _('Email settings'); ?></h3>
<label><?php echo _('SMTP server'); ?></label>
<input type="text" name="smtpserver" value="<?php echo $settings['smtpserver']; ?>" />
<br>
<label><?php echo _('SMTP user'); ?></label>
<input type="text" name="smtpuser" value="<?php echo $settings['smtpuser']; ?>" />
<br>
<label><?php echo _('SMTP password'); ?></label>
<?php
$salt = $user->get_salt($session['userid']);
$c = base64_decode($settings['smtppassword']);
$ivlen = openssl_cipher_iv_length($cipher="AES-128-CBC");
$iv = substr($c, 0, $ivlen);
$hmac = substr($c, $ivlen, $sha2len=32);
$ciphertext_raw = substr($c, $ivlen+$sha2len);
$smtppassword = openssl_decrypt($ciphertext_raw, $cipher, $salt, $options=OPENSSL_RAW_DATA, $iv);
?>
<input type="password" name="smtppassword" value="<?php echo $smtppassword; ?>" />
<br>
<select name="smtpport">
<option <?php if ($settings['smtpport'] == '25') { echo "selected"; }?> value="25">25 (No SSL)</option>
<option <?php if ($settings['smtpport'] == '587') { echo "selected"; }?> value="587">587 (TSL)</option>
<option <?php if ($settings['smtpport'] == '465') { echo "selected"; }?> value="465">465 (SSL)</option>
</select>
<br><br>
<b><?php echo _('Note for gmail.com account:'); ?></b><br>
<p><?php echo _('You have to change the settings to allow less security apps and enable application to access gmail account.'); ?><br>
<?php echo _('Follow below steps:'); ?><br>
<?php echo _('1. login to your gmail account (same as you are using in this setting)'); ?><br>
<?php echo _('2. Go to below link and enable access to less security apps'); ?><br>
<a href="https://www.google.com/settings/security/lesssecureapps" target="_blank">https://www.google.com/settings/security/lesssecureapps</a></p>
</div>
<div class="span4">
<h3><?php echo _('Twitter settings'); ?></h3>
<label><?php echo _('Consumer key:'); ?></label>
<input type="text" name="consumerkey" value="<?php echo $settings['consumerkey']; ?>"/>
<label><?php echo _('Consumer secret:'); ?></label>
<input type="text" name="consumersecret" value="<?php echo $settings['consumersecret']; ?>"/>
<label><?php echo _('Access token:'); ?></label>
<input type="text" name="usertoken" value="<?php echo $settings['usertoken']; ?>"/>
<label><?php echo _('Access Token secret:'); ?></label>
<input type="text" name="usersecret" value="<?php echo $settings['usersecret']; ?>"/>
<br>
</div>
<div class="span4">
<h3><?php echo _('Prowl settings'); ?></h3>
<label><?php echo _('Prowl key:'); ?></label>
<input type="text" name="prowlkey" value="<?php echo $settings['prowlkey']; ?>" />
<br>
</div>
<div class="span4">
<h3><?php echo _('NMA settings'); ?></h3>
<label><?php echo _('NMA key:'); ?></label>
<input type="text" name="nmakey" value="<?php echo $settings['nmakey']; ?>" />
<br>
</div>
<div class="span4">
<h3><?php echo _('MQTT settings'); ?></h3>
<label><?php echo _('MQTT broker IP address:'); ?></label>
<input type="text" name="mqttbrokerip" value="<?php echo $settings['mqttbrokerip']; ?>" />
<label><?php echo _('MQTT broker port:'); ?></label>
<input type="text" name="mqttbrokerport" value="<?php echo $settings['mqttbrokerport']; ?>" />
<label><?php echo _('MQTT username:'); ?></label>
<input type="text" name="mqttusername" value="<?php echo $settings['mqttusername']; ?>" />
<label><?php echo _('MQTT password:'); ?></label>
<?php
$salt = $user->get_salt($session['userid']);
$c = base64_decode($settings['mqttpassword']);
$ivlen = openssl_cipher_iv_length($cipher="AES-128-CBC");
$iv = substr($c, 0, $ivlen);
$hmac = substr($c, $ivlen, $sha2len=32);
$ciphertext_raw = substr($c, $ivlen+$sha2len);
$mqttpassword = openssl_decrypt($ciphertext_raw, $cipher, $salt, $options=OPENSSL_RAW_DATA, $iv);
?>
<input type="password" name="mqttpassword" value="<?php echo $mqttpassword; ?>" />
<br>
</div>
</div>
<input type="submit" class="btn btn-danger" value="<?php echo _('Change'); ?>" />
</form>