forked from graulund/tweetnest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
authorize.php
565 lines (473 loc) · 19.2 KB
/
authorize.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
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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
<?php
// TWEET NEST
// File to help you authorize when you've just upgraded to OAuth
// ...a lot of this is shameless copy-paste from setup.php. Could be more DRY...
if(php_sapi_name() == 'cli'){
die("Please run this in a web browser.\n");
}
error_reporting(E_ALL ^ E_NOTICE);
ini_set('display_errors', true); // This is NOT a production page; errors can and should be visible to aid the user.
mb_language('uni');
mb_internal_encoding('UTF-8');
session_start();
header('Content-Type: text/html; charset=utf-8');
// Considerations regarding the configuration we already have:
require 'inc/config.php';
// No config at all? You're not supposed to be here.
if(!isset($config) || !is_array($config) || empty($config['twitter_screenname'])){
header('Location: ./setup.php');
exit;
}
// These values are already in the config? Nothing to do here!
if(isset($config['consumer_key']) && !empty($config['consumer_key'])){
die('Consumer key and secret are already set. Nothing to do here! You may delete this file.');
}
// ...Okay, good to continue!
$GLOBALS['error'] = false;
$_SESSION['redirect_source'] = 'authorize';
function s($str){ return htmlspecialchars($str, ENT_NOQUOTES); } // Shorthand
function displayErrors($e){
if(count($e) <= 0){ return false; }
$r = '';
if(count($e) > 1){
$r .= '<h2>Errors</h2><ul class="error">';
foreach($e as $error){
$r .= '<li>' . $error . '</li>';
// Not running htmlspecialchars 'cause errors are a set of finite approved messages
}
$r .= '</ul>';
} else {
$r .= "<h2>Error</h2>\n<p class=\"error\">" . current($e) . '</p>';
}
return $r . "\n";
}
function errorHandler($errno, $message, $filename, $line, $context){
if(error_reporting() == 0){ return false; }
if($errno & (E_ALL ^ E_NOTICE)){
$GLOBALS['error'] = true;
$types = array(
1 => 'error',
2 => 'warning',
4 => 'parse error',
8 => 'notice',
16 => 'core error',
32 => 'core warning',
64 => 'compile error',
128 => 'compile warning',
256 => 'user error',
512 => 'user warning',
1024 => 'user notice',
2048 => 'strict warning',
4096 => 'recoverable fatal error'
);
echo '<div class="serror"><strong>PHP ' . $types[$errno] . ':</strong> ' . s(strip_tags($message)) . ' in <code>' . s($filename) . '</code> on line ' . s($line) . ".</div>\n";
}
return true;
}
set_error_handler('errorHandler');
// Utility function, thanks to stackoverflow.com/questions/3835636
function str_lreplace($search, $replace, $subject){ $pos = strrpos($subject, $search); if($pos !== false){ $subject = substr_replace($subject, $replace, $pos, strlen($search)); } return $subject; }
// Function to insert configuration value into the array literal in the configuration file
function configSetting($cf, $setting, $value){
if($value === ''){ return $cf; } // Empty
$empty = is_bool($value) ? '(true|false)' : "''";
$val = is_bool($value) ? ($value ? 'true' : 'false') : "'" . preg_replace("/([\\'])/", '\\\$1', $value) . "'";
// First check if the directive exists in the config file.
$directiveHead = "'" . preg_quote($setting, '/') . "'(\s*)=>";
$exists = preg_match('/' . $directiveHead . '/', $cf);
if($exists){
// If it exists, simply add the value instead of an empty one
return preg_replace('/' . $directiveHead . '(\s*)' . $empty . '/', "'" . $setting . "'$1=>$2" . $val, $cf);
} else {
// If it does not exist, let's add it to the end of the literal array in the file.
return str_lreplace(');', "'" . $setting . "' => " . $val . ",\n);", $cf);
}
}
$e = array();
$log = array();
$success = false; // We are doomed :(
$post = (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST');
// Message shown when people have actively tried to go through OAuth but it failed verification
if(isset($_SESSION['status']) && $_SESSION['status'] == 'not verified'){
$e[] = '<strong>We could not verify you through Twitter.</strong> Please make sure you’ve entered the correct credentials on the Twitter authentication page.';
}
// Message shown when people have actively tried to go through OAuth but there was an old key or other mechanical mishap
if(isset($_SESSION['status']) && $_SESSION['status'] == 'try again'){
$e[] = '<strong>Something broke during the verification through Twitter.</strong> Please try again.';
}
// We have the access token! Everything should be good!
if(isset($_SESSION['status']) && $_SESSION['status'] == 'verified' && isset($_SESSION['access_token'])){
// Time to write the config file with the information we now have.
$cf = file_get_contents('inc/config.php');
$cf = configSetting($cf, 'consumer_key', $_SESSION['entered_consumer_key']);
$cf = configSetting($cf, 'consumer_secret', $_SESSION['entered_consumer_secret']);
$cf = configSetting($cf, 'your_tw_screenname', $_SESSION['access_token']['screen_name']);
$cf = configSetting($cf, 'twitter_token', $_SESSION['access_token']['oauth_token']);
$cf = configSetting($cf, 'twitter_token_secr', $_SESSION['access_token']['oauth_token_secret']);
$f = fopen('inc/config.php', 'wt');
$fe = 'Could not write configuration to <code>config.php</code>, please make sure that it is writable! Often, ' .
'this is done through giving every system user the write privileges on that file through FTP.';
if($f){
if(fwrite($f, $cf)){
fclose($f);
$success = true;
} else {
$e[] = $fe;
}
} else {
$e[] = $fe;
}
}
// Someone's submitting!
if($post && !$success){
if(
isset($_POST['consumer_key']) && !empty($_POST['consumer_key']) &&
isset($_POST['consumer_secret']) && !empty($_POST['consumer_secret'])
){
// Redirect them to Twitter to get the access token.
$config['consumer_key'] = $_SESSION['entered_consumer_key'] = $_POST['consumer_key'];
$config['consumer_secret'] = $_SESSION['entered_consumer_secret'] = $_POST['consumer_secret'];
require 'redirect.php';
exit;
} else {
$e[] = 'Please fill in your <strong>Twitter app consumer key and secret</strong>.';
}
}
// Form preparation
$enteredConsumerKey = '';
$enteredConsumerSecret = '';
if(isset($_SESSION['entered_consumer_key']) && !empty($_SESSION['entered_consumer_key'])){
$enteredConsumerKey = $_SESSION['entered_consumer_key'];
}
if(isset($_SESSION['entered_consumer_secret']) && !empty($_SESSION['entered_consumer_secret'])){
$enteredConsumerSecret = $_SESSION['entered_consumer_secret'];
}
if($post && isset($_POST['consumer_key']) && !empty($_POST['consumer_key'])){
$enteredConsumerKey = $_POST['consumer_key'];
}
if($post && isset($_POST['consumer_secret']) && !empty($_POST['consumer_secret'])){
$enteredConsumerSecret = $_POST['consumer_secret'];
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Authorize Tweet Nest<?php if($e){ ?> — Error!<?php } ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="ROBOTS" content="NOINDEX,NOFOLLOW" />
<style type="text/css">
body {
background: #eee url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXAAAAC/CAYAAADn0IfqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK8AAACvABQqw0mAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNAay06AAAAAWdEVYdENyZWF0aW9uIFRpbWUAMjIvMDUvMTDlojBHAAAKVklEQVR42u3dP2scZx7AcffbpFId1AtSpFAZEFxxjZPqQFUa9fsCVASuUHlB1TWC464RpMmhN5AXYIwxGGOMcYzBGGOM38He/JR5co8ez6x2pd3ZZ3Y/Cx8iS7Ozf6L97uiZZ2YfzGazB0Ddtu3SPKaDxtWOmK7h+fvj98KLAwR8AwE/26GAh0MBBwHfhnjv7Vi8w4WAg4BvQ8Af7mDAV7oVLuAg4JsK+HRHA/6fdugonDT2BRwE3Pj3eMVzMRFwEHABH+n4+LIRF3AQcAGvx7mAg4CPIeCngt3pKJulMxFwEPDa4r3fuBTrTv8u/n3Z7vDdE3AQcPEep3jODgQcBNzY93gjvifgIOCb2voW4vs5FXAQ8E0E/FCAV2Ii4CDgQ299/018V+IvAg4CPtRWt52W6xkPPxRwEHBDJmM+OZYXBwj4GgJ+IbADnKLWiwMEfA0BF9gBeHGAgAu4gAMCbgjFEApgJyZ2YoKAbzTitsTXc/5w0whBwF1G+uboQB4QcBcBBwTcRcABAXcRcBBwFwEHBNxFwAEBdxFwEHAXAQcE3EXAAQF3EXBgLQFv1jdpPGycdxymfdo4kkgBByoL+GzxjzmLuO9LpYADFQQ8tqxny3/2oogLOLDJgDfrOJjd/QN0f2icNM4a0/aNYCKjAg4ME/BVn9b10li5gANrDvgdhk6WIeICDqwx4KdrDHhsie9JqoADSwa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zoj7JQUEfMGAbzjef0ZcwAEBXz7g0w3HOzkRcGArA77k3O2DdibJtN0peZYdXPOwsZ8td1WRA7+kwM4F/A4H3Fzc4+CcdbnwSwrsTMDbMeyTykJ8H0d+UYGtD3gMhbRbrVdb5CIb3kn2nUsF2Kadj/sVDoEMcfDPkYCDgI824Dsa73Ks/EDAQcBHFfBK5m3X4ljAQcDHFPAT4b55hkMBBwGvPuDtVEHR/tKhgIOA1x5wW9/9p6idCDgIeM0BvxDr+ePhfslBwGu0L9ILzR8HBLw6RyJ9q3/Mbp73Zd8OThDwGhwL9J2czf5/8i5AwAV8hDs5nWMFBFzAR8zpakHABXzEh+B7IYCAD37+k78K8MpOV3vQ/ve4/XrivCog4Os6fD6mEP4ivivx66z/TId7Ag4CvsqDd3b9zIND7+x0WD4I+MoC7syDw0fctEMQ8Hs7ENTNzB0XcBBwM0/Ga98LBgRcwEd6ciwvGBDwZWecTLIpbmc7Esv/VnoI/tHMaWpBwBfcYXlkxonD8IHxDaHYYekwfGCkAT8TyerPauhFBALeSSTr50UEAi7gAg5sU8DtvKx/Z6YXEQh4p6lIVm3qBQQC3ifmfzvvSZ3O2/8/XkQg4L3zwCftlp7hlHqGTabiDXX4H3vh+U/GPa00AAAAAElFTkSuQmCC) no-repeat 0 0;
margin: 50px 0 100px;
font-family: "Helvetica Neue", Helvetica, sans-serif;
color: #999;
text-align: center;
}
strong { font-weight: bold; }
em { font-style: italic; }
a {
color: #29d;
text-decoration: none;
font-weight: bold;
}
a:hover {
text-decoration: underline;
}
h1 {
color: #666;
font-size: 269%;
font-weight: normal;
text-shadow: 0 2px #fafafa;
}
h1 strong {
color: #333;
}
a#pongsk {
display: block;
position: absolute;
top: 60px;
left: 0;
width: 187px;
height: 36px;
text-indent: -999em;
}
#content {
position: relative;
width: 670px;
padding: 35px 40px;
margin: 0 auto;
background-color: #fff;
text-align: left;
}
#content, .serror {
font: 63% "Lucida Grande", "Lucida Sans", Verdana, Tahoma, sans-serif;
line-height: 1.4em;
}
#content strong {
color: #666;
}
#content strong.remember {
color: #900;
}
code {
background-color: #eee;
color: #666;
padding: 0 2px;
white-space: nowrap;
}
h2 {
font-size: 160%;
font-weight: normal;
margin: 3em 0 .7em;
}
#excerpt {
font: 230% "Helvetica Neue", Helvetica, sans-serif;
line-height: 1.6em;
margin: 0 0 3em;
margin: 0;
}
#excerpt strong {
color: #666;
}
#greennotice {
position: absolute;
left: -120px;
width: 100px;
text-align: right;
color: #5d6;
text-shadow: 0 1px #fafafa;
}
#greennotice strong {
color: #5d6;
}
#greennotice span {
display: block;
width: 24px;
height: 12px;
background-color: #5d6;
margin: 0 0 3px auto;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-o-border-radius: 3px;
-khtml-border-radius: 3px;
box-shadow: 0 1px #fafafa;
-moz-box-shadow: 0 1px #fafafa;
-webkit-box-shadow: 0 1px #fafafa;
-o-box-shadow: 0 1px #fafafa;
-khtml-box-shadow: 0 1px #fafafa;
}
.address {
white-space: nowrap;
}
.input {
border-top: 1px solid #f3f3f3;
padding: 10px 0;
}
.lastinput {
border-bottom: 1px solid #f3f3f3;
}
.noteinput {
border-width: 0;
}
.input label {
float: left;
width: 130px;
color: #666;
font-weight: bold;
text-transform: uppercase;
margin: 0;
padding: 10px 0 0;
}
.input .field, .input .what {
margin-left: 150px;
}
.input .field {
border-left: 3px solid #fff;
font-size: 140%;
margin-bottom: 8px;
}
.input .field input.text, .input .field select {
border: 1px solid #ddd;
background: #fff url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAACCAYAAACHSIaUAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK8AAACvABQqw0mAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNAay06AAAAAWdEVYdENyZWF0aW9uIFRpbWUAMjIvMDUvMTDlojBHAAAAEklEQVQI12NgYGBgpQAzMJOLAR/xAHni8/cuAAAAAElFTkSuQmCC) repeat-x;
padding: 7px 9px;
font: 100% "Lucida Grande", "Lucida Sans", Verdana, Tahoma, sans-serif;
color: #666;
margin: 0 0 0 1px;
width: 496px; /* 670 - 150 - 4 - 2*9 - 2*1 */
}
.input .field input.text:focus, .input .field select:focus {
border-color: #999;
box-shadow: 0 0 10px #999;
-moz-box-shadow: 0 0 10px #999;
-webkit-box-shadow: 0 0 10px #999;
-o-box-shadow: 0 0 10px #999;
-khtml-box-shadow: 0 0 10px #999;
/*background-image: none;*/
-webkit-transition-property: -webkit-box-shadow;
-webkit-transition-duration: .4s;
}
@media screen and (-webkit-min-device-pixel-ratio:0){
.input .field input.text:focus {
outline-width: 0;
}
}
.input .field select {
width: 100%;
}
.input .field input.checkbox {
margin-top: 10px;
}
.input .required {
border-left-color: #5d6;
}
.input .what {
padding-left: 4px;
}
code, .input .field input.code {
font: 95% Menlo, "Menlo Regular", Monaco, monospace;
}
.note {
border: 1px solid #ccc;
border-width: 1px 0;
background-color: #f3f3f3;
font-size: 120%;
padding: 9px 12px;
}
.note p {
margin: 0;
line-height: 1.4em;
}
.note p.btw {
margin-top: 5px;
font-size: 83%;
line-height: 1.4em;
color: #aaa;
}
.note .retweet {
padding-right: 22px;
background: transparent url(data:image/gif;base64,R0lGODlhEgAOAJEAAKysrP///////wAAACH5BAEHAAIALAAAAAASAA4AAAIlFI6pYOsPYQhnWrpu1erO9DkhiGUlMnand26W28JhGtU20txMAQA7) no-repeat right center;
}
input.submit, a.proceed {
background: #fff url(data:image/gif;base64,R0lGODlhFQAeAMQAAP////7+/v39/fz8/Pv7+/r6+vn5+fj4+Pf39/b29vX19fT09PPz8/Ly8vHx8fDw8O/v7+7u7gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAHAP8ALAAAAAAVAB4AAAWBICCOZGmeaKqiQeu+cCzPsWDfeK4PfO//wKAQSCgaj8hkYclsOp/Q6NNArVqv2IN2y+16v2AvYkwum8/o9DnBbrvfcIV8Tq/b73j7Ys/v+/8MgYKDhIWGh4UNiouMjY4OkJGSk5SVlpQPmZqbnJ0Qn6ChoqOkpaMRqKmqq6ytrqwhADs=) repeat-x left bottom;
border: 1px solid #ccc;
color: #666;
font: bold 175% "Lucida Grande", "Lucida Sans", Verdana, Tahoma, sans-serif;
padding: 7px 15px;
text-shadow: 1px 1px #fff;
cursor: pointer;
border-radius: 12px;
-moz-border-radius: 12px;
-webkit-border-radius: 12px;
-o-border-radius: 12px;
-khtml-border-radius: 12px;
}
input.submit:hover {
color: #333;
-webkit-transition-property: color;
-webkit-transition-duration: .4s;
}
input.submit:active {
padding: 8px 15px 6px;
}
input[type=image] {
cursor: pointer;
}
option.deselected {
font-style: italic;
color: #999;
}
.error, .serror {
border: 1px solid #000;
border-width: 1px 0;
background-color: #333;
color: #ddd;
padding: 7px 15px;
font-size: 125%;
line-height: 1.4em;
}
.serror {
width: 670px;
padding: 7px 40px;
margin: 0 auto 20px;
text-align: left;
font-size: 78%;
}
#content .error strong, .serror strong {
color: #fff;
}
#content .error code, .serror code {
background-color: #000;
color: #fff;
}
.serror code {
white-space: normal;
}
.explanation {
font-size: 130%;
line-height: 1.6em;
}
.explanation li {
margin: 0 0 .5em;
}
#content strong.authorized {
color: #fff;
background-color: #0c0;
padding: 2px 8px;
border-radius: 3px;
margin-left: 1px;
}
p.intro {
font-size: 150%;
line-height: 1.6em;
}
</style>
</head>
<body>
<div id="container">
<a id="pongsk" href="http://pongsocket.com/" target="_blank" title="Open pongsocket.com in a new window">pongsocket</a>
<h1>Authorize <strong>Tweet Nest</strong></h1>
<div id="content">
<?php
if($success){
?>
<h2 id="excerpt"><strong>Success!</strong> You have now authorized Tweet Nest.</h2>
<p class="intro">You can now start <a href="./maintenance/loadtweets.php">loading your newest tweets</a>.</p>
<p class="intro">You may also remove this file.</p>
<p><strong>Running upgrade script...</strong> <?php require 'upgrade.php'; ?></p>
<?php
} else {
if($e && $post){
?>
<h2 id="excerpt"><strong>Whoops!</strong> An error occured that prevented you from being able to install Tweet Nest until it is fixed.</h2>
<?php echo displayErrors($e); ?>
<?php } ?>
<h2 id="excerpt"><strong>Due to Twitter’s newest policies,</strong> every connection made to Twitter now has to be
authenticated as coming from a source which is registered with Twitter. Because of this, to continue
to use Tweet Nest, you have to <strong>register your Tweet Nest installation as an app with Twitter</strong>.</h2>
<p class="intro">If you haven’t already done so, here’s a link to Twitter’s Developer Site where you can
click the “Create new application” button to register (link opens in a new window):</p>
<p><a class="proceed" href="//dev.twitter.com/apps" target="_blank">Go to Twitter’s Developer Site</a></p>
<p class="intro">When you do that, you get two strings in return, labeled the <em>consumer key</em> and the <em>consumer secret</em>.
Paste them below:</p>
<form action="" method="post">
<div class="input">
<label for="consumer_key">Twitter consumer key</label>
<div class="field required"><input type="text" class="text code" name="consumer_key" id="consumer_key" value="<?php echo s($enteredConsumerKey); ?>" /></div>
<div class="what">The consumer key of an app created and registered on <a href="//dev.twitter.com/apps" target="_blank">dev.twitter.com</a>.</div>
</div>
<div class="input">
<label for="consumer_secret">Twitter consumer secret</label>
<div class="field required"><input type="text" class="text code" name="consumer_secret" id="consumer_secret" value="<?php echo s($enteredConsumerSecret); ?>" /></div>
<div class="what">The consumer secret of the above.</div>
</div>
<h2><strong>That’s it!</strong></h2>
<p class="intro">With the provided strings above, clicking the button below will now redirect your browser to Twitter to
ask for your personal Twitter credentials, which will be used to let Tweet Nest access your tweets.</p>
<div><input type="submit" class="submit" value="Authorize" /></div>
</form>
<?php } ?>
</div>
</div>
</body>
</html>