Browse Source
disable twitter stuff if no twitter client is set
pull/111/head
Aaron Parecki
5 years ago
No known key found for this signature in database
GPG Key ID: 276C2817346D6056
2 changed files with
23 additions and
5 deletions
-
controllers/auth.php
-
views/settings.php
|
|
@ -256,6 +256,14 @@ $app->post('/auth/reset', function() use($app) { |
|
|
|
}); |
|
|
|
|
|
|
|
$app->post('/auth/twitter', function() use($app) { |
|
|
|
if(!Config::$twitterClientID) { |
|
|
|
$app->response()['Content-type'] = 'application/json'; |
|
|
|
$app->response()->body(json_encode(array( |
|
|
|
'result' => 'error' |
|
|
|
))); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if($user=require_login($app, false)) { |
|
|
|
$params = $app->request()->params(); |
|
|
|
// User just auth'd with twitter, store the access token
|
|
|
@ -284,6 +292,14 @@ function getTwitterLoginURL(&$twitter) { |
|
|
|
} |
|
|
|
|
|
|
|
$app->get('/auth/twitter', function() use($app) { |
|
|
|
if(!Config::$twitterClientID) { |
|
|
|
$app->response()['Content-type'] = 'application/json'; |
|
|
|
$app->response()->body(json_encode(array( |
|
|
|
'result' => 'error' |
|
|
|
))); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
$params = $app->request()->params(); |
|
|
|
if($user=require_login($app, false)) { |
|
|
|
|
|
|
|
|
|
@ -88,11 +88,11 @@ |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<?php if(!Config::$twitterClientID) ?>
|
|
|
|
<h3>Twitter</h3> |
|
|
|
<p>Connecting a Twitter account will automatically "favorite" and "retweet" tweets on Twitter when you favorite and retweet a Twitter URL in Quill.</p> |
|
|
|
<input type="button" id="twitter-button" value="Checking" class="btn"> |
|
|
|
|
|
|
|
<?php endif ?>
|
|
|
|
|
|
|
|
|
|
|
|
<h3>Backwards Compatibility</h3> |
|
|
@ -133,6 +133,7 @@ |
|
|
|
<script> |
|
|
|
$(function(){ |
|
|
|
|
|
|
|
<?php if(!Config::$twitterClientID): ?>
|
|
|
|
$.getJSON("/auth/twitter", function(data){ |
|
|
|
// Check if we're already authorized with twitter
|
|
|
|
if(data && data.result == 'ok') { |
|
|
@ -153,6 +154,7 @@ $(function(){ |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
<?php endif ?>
|
|
|
|
|
|
|
|
$("#send-html-content").click(function(){ |
|
|
|
var enabled = $(this).attr("checked") == "checked"; |
|
|
|