Allow iframe authentication V01.54
authorRaphael Velt <raph.velt@gmail.com>
Thu, 22 Mar 2012 12:21:22 +0100
changeset 557 636258d3fe4b
parent 556 511810f90c93
child 558 541bc68826a4
Allow iframe authentication
web/callback.php
web/client.php
web/res/css/tweetcast.css
--- a/web/callback.php	Wed Mar 21 17:38:20 2012 +0100
+++ b/web/callback.php	Thu Mar 22 12:21:22 2012 +0100
@@ -32,7 +32,7 @@
     /**
      * With Access Token in hand, let's try accessing the client again
      */
-    header('Location: ' . URL_ROOT . "$rep/client.php" );
+    header('Location: ' . ( isset($_SESSION['TWITTER_REDIRECT_URL']) ? $_SESSION['TWITTER_REDIRECT_URL'] : ( URL_ROOT . "$rep/client.php" ) ) );
 } else {
     /**
      * Mistaken request? Some malfeasant trying something?
--- a/web/client.php	Wed Mar 21 17:38:20 2012 +0100
+++ b/web/client.php	Thu Mar 22 12:21:22 2012 +0100
@@ -26,6 +26,10 @@
      * approve our access
      */
     $consumer->redirect();
+} else {
+    if (isset($_SESSION['TWITTER_REDIRECT_URL'])) {
+        unset($_SESSION['TWITTER_REDIRECT_URL']);
+    }
 }
 
 
@@ -42,6 +46,9 @@
     $embed = (isset($_REQUEST['embed']) && $_REQUEST['embed']);
     $videoWidth = ( $embed ? 412 : 480 );
     $videoHeight = ( $embed ? 280 : 320 );
+    if ($embed && !isset($_SESSION['TWITTER_ACCESS_TOKEN']) && isset($_SERVER['HTTP_REFERER'])) {
+        $_SESSION['TWITTER_REDIRECT_URL'] = $_SERVER['HTTP_REFERER'];
+    };
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
@@ -92,17 +99,6 @@
     
     $(document).ready(function() {
         
-/*        setTimeout(function() {
-            $.scrollTo(70, 1000);
-        }, 2000); */
-
-            //$("txt").hide();
-            $(".loginbutton").click(function() {
-                document.location.href="<?php echo(URL_ROOT.$rep); ?>/client.php?CONNECT=true";
-            });
-            $("#IDENTIFIER").click(function() {
-                document.location.href="<?php echo(URL_ROOT.$rep); ?>/client.php?CONNECT=true";
-            });
             
             function updateCounter() {
                 var _v = $("#status").val();
@@ -302,15 +298,17 @@
                     <li class="acctitre">
                         <h3><?php echo($translate->_('keywords')); ?></h3>
                     </li>
-                    <li class="fl">
-                        <ul class="fl">
+                    <li>
+                        <ul>
                             <li class="acctexte">
                                 <div class="accsubtitle">
                                     <div class="aroundsubtitle">
                                         <h4><?php echo($translate->_('suggested')); ?></h4>
                                     </div>
                                 </div>
-                                <div class="tagcloud" id="suggkw"></div>
+                                <div class="tagcloud" id="suggkw">
+                                    <div class="clearer"></div>
+                                </div>
                             </li>
                             <li class="acctexte">
                                 <div class="accsubtitle">
@@ -318,7 +316,9 @@
                                         <h4><?php echo($translate->_('contextual')); ?></h4>
                                     </div>
                                 </div>
-                                <div class="tagcloud" id="motscles"></div>
+                                <div class="tagcloud" id="motscles">
+                                    <div class="clearer"></div>
+                                </div>
                             </li>
                         </ul>
                     </li>
@@ -373,7 +373,7 @@
                         <h3 class="tweetWriterTitle"><?php print $translate->_("ClientTitle1 :"); ?></h3>
                         <form  action="tweet.php" method="post" id="statusform" >
                             <?php if (!isset($_SESSION['TWITTER_ACCESS_TOKEN'])){
-                                echo("<div class='loginbutton'><a href='".URL_ROOT."$rep/client.php?CONNECT=true' class='loginlink'>".$translate->_("Vous n'êtes pas connecté.")."</a></div>");
+                                echo("<div class='loginbutton'><a href='".URL_ROOT."$rep/client.php?CONNECT=true' target='_top' class='loginlink'>".$translate->_("Vous n'êtes pas connecté.")."</a></div>");
                             } else {
                                 echo("<textarea name='status' id='status' rows='3' cols='50'>$config[hashtag]</textarea>");
                             }
--- a/web/res/css/tweetcast.css	Wed Mar 21 17:38:20 2012 +0100
+++ b/web/res/css/tweetcast.css	Thu Mar 22 12:21:22 2012 +0100
@@ -62,6 +62,10 @@
     float: left;
 }
 
+.clearer {
+    width: 100%; height: 0px; clear: both;
+}
+
 /* feedback */
 
 #sendUsFeedBack {
@@ -617,7 +621,7 @@
 }
 
 .acctexte ul {
-    list-style: disc; font-size: 12px; padding-left: 1em;
+    list-style: disc; font-size: 12px; padding-left: 1.5em;
 }
 
 .acctexte ol {