diff options
author | Andrew Dolgov <[email protected]> | 2010-11-22 16:31:01 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2010-11-22 16:31:01 +0300 |
commit | 392b6d0459b20ca9efa0ad25eda9755f36b5213c (patch) | |
tree | b8f04a4597184463ff34578e7153f8a7d77cabd6 | |
parent | 57e24c82675e37ea9262e54e30836596caf77e76 (diff) |
add config.php defines for twitter, only enable twitter pane when they are filled in
-rw-r--r-- | config.php-dist | 5 | ||||
-rw-r--r-- | modules/pref-feeds.php | 46 |
2 files changed, 30 insertions, 21 deletions
diff --git a/config.php-dist b/config.php-dist index a7ab86283..824b843c7 100644 --- a/config.php-dist +++ b/config.php-dist @@ -174,6 +174,11 @@ define('ENABLE_TWEET_BUTTON', false); // Enable 'tweet this' button for articles + define('CONSUMER_KEY', ''); + define('CONSUMER_SECRET', ''); + // Your OAuth instance authentication information for Twitter, visit + // http://twitter.com/oauth_clients to register your instance. + define('CONFIG_VERSION', 20); // Expected config version. Please update this option in config.php // if necessary (after migrating all new options from this file). diff --git a/modules/pref-feeds.php b/modules/pref-feeds.php index df854f35e..ed320d191 100644 --- a/modules/pref-feeds.php +++ b/modules/pref-feeds.php @@ -1329,31 +1329,35 @@ print "</div>"; #pane - print "<div id=\"pref-feeds-twitter\" dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Twitter')."\">"; + if (defined('CONSUMER_KEY') && CONSUMER_KEY != '') { - $result = db_query($link, "SELECT COUNT(*) AS cid FROM ttrss_users - WHERE twitter_oauth IS NOT NULL AND twitter_oauth != '' AND - id = " . $_SESSION['uid']); - - $is_registered = db_fetch_result($result, 0, "cid") != 0; + print "<div id=\"pref-feeds-twitter\" dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Twitter')."\">"; + + $result = db_query($link, "SELECT COUNT(*) AS cid FROM ttrss_users + WHERE twitter_oauth IS NOT NULL AND twitter_oauth != '' AND + id = " . $_SESSION['uid']); + + $is_registered = db_fetch_result($result, 0, "cid") != 0; + + if (!$is_registered) { + print_notice(__('Before you can update your Twitter feeds, you must register this instance of Tiny Tiny RSS with Twitter.com.')); + } else { + print_notice(__('You have been successfully registered with Twitter.com and should be able to access your Twitter feeds.')); + } + + print "<button dojoType=\"dijit.form.Button\" onclick=\"window.location.href = 'twitter.php?op=register'\">". + __("Register with Twitter.com")."</button>"; + + print " "; + + print "<button dojoType=\"dijit.form.Button\" + onclick=\"return clearTwitterCredentials()\">". + __("Clear stored credentials")."</button>"; + + print "</div>"; # pane - if (!$is_registered) { - print_notice(__('Before you can update your Twitter feeds, you must register this instance of Tiny Tiny RSS with Twitter.com.')); - } else { - print_notice(__('You have been successfully registered with Twitter.com and should be able to access your Twitter feeds.')); } - print "<button dojoType=\"dijit.form.Button\" onclick=\"window.location.href = 'twitter.php?op=register'\">". - __("Register with Twitter.com")."</button>"; - - print " "; - - print "<button dojoType=\"dijit.form.Button\" - onclick=\"return clearTwitterCredentials()\">". - __("Clear stored credentials")."</button>"; - - print "</div>"; - print "</div>"; #container } |