-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.php
More file actions
246 lines (228 loc) · 11.6 KB
/
settings.php
File metadata and controls
246 lines (228 loc) · 11.6 KB
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<?php
/*
* Property of Writale
* All rights reserved
* Writale © 2013
*/
require realpath(dirname(__FILE__) . "/class/init.php");
require realpath(dirname(__FILE__) . "/control/session/saved.php");
require realpath(dirname(__FILE__) . "/control/general/cache.php");
$pro_link = $_protocol.$_SERVER['HTTP_HOST'].'/'.$_SESSION['q_un'];
$acc = new AccountUtility ($_SESSION['uid']);
$_amend_hash_ts = $acc->getLastHashTime ();
$time = new Time ($_amend_hash_ts);
$_reltime = $time->showTime ();
$_tt_time = $time->showToolTip ();
$_amend_machine = $acc->getMachinePlaceDetail ();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Settings · Writale</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Writale is a simple, powerful way to read and build social stories." />
<link rel="shortcut icon" type="image/x-icon" href="//<?php echo $_SERVER['HTTP_HOST']; ?>/resource/image/icon/favicon.ico" />
<link rel="stylesheet" type="text/css" href="//<?php echo $_SERVER['HTTP_HOST'] . '/style/universal.css'; ?>" />
<link rel="stylesheet" type="text/css" href="//<?php echo $_SERVER['HTTP_HOST'] . '/style/strydlg.css'; ?>" />
<link rel="stylesheet" type="text/css" href="//<?php echo $_SERVER['HTTP_HOST'] . '/style/stngs-0156-28032014.css'; ?>" />
<script src="//<?php echo $_SERVER['HTTP_HOST'] ?>/script/common.js"></script>
</head>
<body class="settings-body">
<?php
include realpath(dirname(__FILE__) . '/control/decorator/userpanel.php');
?>
<div id="general-outer-container">
<?php require realpath(dirname(__FILE__) . '/control/decorator/sidebar.php') ?>
<div id="general-middle-container">
<?php require realpath(dirname(__FILE__) . '/control/decorator/openstorypanel.php'); ?>
<div id="general-central-outline">
<div id="general-settings">
<div id="gen-settings-title">
General Settings
</div>
<div id="email-box">
Email Address <span class="bold"><?php echo $_SESSION['q_email']; ?></span>
</div>
<div class="settings-box" id="username-section">
<div class="section-title">
Change Username
</div>
<div class="section-content">
<div class="main-cont">
Your username gives you a vanity profile link :
<a class="bold" id="pro-link" href="<?php echo $pro_link;?>">
<?php echo $pro_link; ?>
</a>
</div>
<div class="sec-content">
You may choose some other unique username :
</div>
<div class="end-content bold">
https://www.writale.com/ <input type="text" id="plink-inpt" />
</div>
</div>
<div class="section-bottom">
<div class="yellow-info" id="pl-error"></div>
<div class="button-std button-gen" id="update-pl-butt">
Update
</div>
</div>
</div>
<div class="settings-box" id="passwd-section">
<div class="section-title">
Change Password
</div>
<div class="section-content">
<div class="main-cont">
Your password was last changed :
<span id="change-detail" class="bold" title="<?php echo $_tt_time; ?>">
<?php echo $_reltime.', Using '.$_amend_machine['machine']['browser'].
' on '.$_amend_machine['machine']['platform'].' machine, near '.
$_amend_machine['location']; ?>
</span>
</div>
<div class="sec-content">
Enter your current password : <br />
<input type="password" class="passwd-inpt" id="old-passwd-inpt" />
</div>
<div class="end-content">
New password : <br />
<input type="password" class="passwd-inpt" id="new-passwd-inpt" />
</div>
</div>
<div class="section-bottom">
<div class="yellow-info" id="n-passwd-error"></div>
<div class="button-std button-gen" id="update-pwd-butt">
Update
</div>
</div>
</div>
</div>
<div id="delete-acc">
If you wish to remove your account from Writale,<br /> send an email to privacy@writale.com, specifying a reason.
</div>
<div class="end-line"></div>
</div>
<?php require realpath(dirname(__FILE__) . '/control/decorator/pagefooter.php'); ?>
</div>
<div class="sidebar-right">
</div>
<span class="stretch"></span>
</div>
<?php
include realpath(dirname(__FILE__) . '/control/decorator/openstory.php');
include realpath(dirname(__FILE__) . '/control/decorator/utilbottom.php');
include realpath(dirname(__FILE__) . '/control/decorator/savedutil.php');
?>
<script>
(function () {
var settings = (function () {
var
nUpdatePL = _gAny('update-pl-butt'),
nUpdatePasswd = _gAny('update-pwd-butt'),
tbProfileLink = _gAny('plink-inpt'),
tbOldPasswd = _gAny('old-passwd-inpt'),
tbNewPasswd = _gAny('new-passwd-inpt'),
nPLError = _gAny('pl-error'),
nPasswdError = _gAny('n-passwd-error'),
notice = _gAny('notice-white');
function init () {
addEvent.call(nUpdatePL,'click', processProfileLink, false);
addEvent.call(nUpdatePasswd,'click', processPassword, false);
}
function processProfileLink () {
var
sLink = tbProfileLink.value.trim (),
sArg;
if(sLink.length === 0) {
util.genError(nPLError,"You didn't enter new profile link!");
}
else if(sLink.length < 3) {
util.genError(nPLError,"Profile link should be greater than 3 characters.");
}
else {
util.dotLoader(this,1,'40px');
sArg = 'uvan='+encodeURIComponent(sLink);
wxhr.sendPostRequest (sArg, '/general/generic',afterUpdatingPL);
}
}
function afterUpdatingPL (response) {
var
res = JSON.parse(response),
nProLink = _gAny('pro-link');
util.dotLoader(nUpdatePL,0,'40px');
nUpdatePL.innerHTML = 'Update';
if(res.success) {
tbProfileLink.value = '';
util.firstChild(notice).innerHTML = 'Your profile link was changed successfully!';
fade(notice,1);
nProLink.innerHTML = res.link;
nProLink.href = res.link;
}
else {
if(res.code === 2) {
util.genError(nPLError,"Profile link is invalid.");
}
else if(res.code === 1) {
util.genError(nPLError,"Sorry! This profile link is not available.");
}
else
util.genError(nPLError,"Whoops! Something's wrong. Try later.");
}
}
function processPassword () {
var
sOld = tbOldPasswd.value.trim (),
sNew = tbNewPasswd.value.trim (),
sArg;
if(sOld.length === 0 && sNew.length === 0) {
util.genError(nPasswdError,"Please provide your old and new password.");
}
else if(sOld.length === 0) {
util.genError(nPasswdError,"Please enter your old password!");
}
else if(sNew.length === 0) {
util.genError(nPasswdError,"Please enter your new password!");
}
else if(sNew.length < 6) {
util.genError(nPasswdError,"Password should contain at least six characters.");
}
else {
util.dotLoader(this,1,'40px');
sArg = 'op='+encodeURIComponent(sOld)+'&np='+encodeURIComponent(sNew);
wxhr.sendPostRequest (sArg,'/general/set',afterUpdatingPasswd);
}
}
function afterUpdatingPasswd (response) {
var
res = JSON.parse (response),
sDetail;
util.dotLoader(nUpdatePasswd,0,'40px');
nUpdatePasswd.innerHTML = 'Update';
if(res.success) {
notice.top = "100px";
tbOldPasswd.value = '';
tbNewPasswd.value = '';
util.firstChild(notice).innerHTML = 'Your password was changed successfully!';
fade(notice,1);
sDetail = 'Few seconds ago, Using '+res.browser+' on '+res.platform+' machine, near '+
res.location;
_gAny('change-detail').innerHTML = sDetail;
}
else {
if (res.code === 8)
util.genError(nPasswdError, "Old password is not correct!");
else
util.genError(nPasswdError, "Whooops! Something's wrong. Please try later.");
}
}
return {
init : init
};
})();
settings.init ();
})();
</script>
</body>
</html>