]> git.wh0rd.org Git - tt-rss.git/commitdiff
allow logging in by sharepopup
authorAndrew Dolgov <fox@fakecake.org>
Mon, 10 Sep 2012 15:13:41 +0000 (19:13 +0400)
committerAndrew Dolgov <fox@fakecake.org>
Mon, 10 Sep 2012 15:13:41 +0000 (19:13 +0400)
classes/handler/public.php

index c06121d02b8e85872996a628e35d6e6378a7a9d1..4d6c117eb5b5931e6da6dd740fcd1f3e89a594e8 100644 (file)
@@ -386,59 +386,95 @@ class Handler_Public extends Handler {
 
                if ($_SESSION["uid"]) {
 
-                       if (!$action) {
+                       if ($action == 'share') {
 
-                               print "<table height='100%' width='100%'><tr><td colspan='2'>";
-                               print "<h1>".__("Share with Tiny Tiny RSS")."</h1>";
-                               print "</td></tr>";
+                               $title = db_escape_string(strip_tags($_REQUEST["title"]));
+                               $url = db_escape_string(strip_tags($_REQUEST["url"]));
+                               $content = db_escape_string(strip_tags($_REQUEST["content"]));
 
-                               print "<form id='share_form' name='share_form'>";
+                               create_published_article($this->link, $title, $url, $content, $_SESSION["uid"]);
 
-                               print "<input type=\"hidden\" name=\"op\" value=\"sharepopup\">";
-                               print "<input type=\"hidden\" name=\"action\" value=\"share\">";
+                               print "<script type='text/javascript'>";
+                               print "window.close();";
+                               print "</script>";
 
+                       } else {
                                $title = htmlspecialchars($_REQUEST["title"]);
                                $url = htmlspecialchars($_REQUEST["url"]);
 
-                               print "<tr><td>".__("Title:")."</td><td width='80%'><input name='title' value=\"$title\"></td></tr>";
-                               print "<tr><td>".__("URL:")."</td><td><input name='url' value=\"$url\"></td></tr>";
-                               print "<tr><td>".__("Content:")."</td><td><input name='content' value=\"\"></td></tr>";
+                               ?>
 
-                               print "<script type='text/javascript'>";
-                               print "document.forms[0].title.focus();";
-                               print "</script>";
+                               <table height='100%' width='100%'><tr><td colspan='2'>
+                               <h1><?php echo __("Share with Tiny Tiny RSS") ?></h1>
+                               </td></tr>
 
-                               print "<tr><td colspan='2'>
-                                       <div style='float : right' class='insensitive-small'>".
-                                       __("Shared article will appear in the Published feed.").
-                                       "</div><button type=\"submit\">".
-                                               __('Share')."</button>
-                                       <button onclick=\"return window.close()\">".
-                                               __('Cancel')."</button>
-                                       </div>";
+                               <form id='share_form' name='share_form'>
 
-                               print "</form>";
-                               print "</td></tr></table>";
+                               <input type="hidden" name="op" value="sharepopup">
+                               <input type="hidden" name="action" value="share">
 
-                               print "</body></html>";
+                               <tr><td><?php echo __("Title:") ?></td>
+                               <td width='80%'><input name='title' value="<?php echo $title ?>"></td></tr>
+                               <tr><td><?php echo __("URL:") ?></td>
+                               <td><input name='url' value="<?php echo $url ?>"></td></tr>
+                               <tr><td><?php __("Content:") ?></td>
+                               <td><input name='content' value=""></td></tr>
 
-                       } else {
+                               <script type='text/javascript'>document.forms[0].title.focus();</script>
 
-                               $title = db_escape_string(strip_tags($_REQUEST["title"]));
-                               $url = db_escape_string(strip_tags($_REQUEST["url"]));
-                               $content = db_escape_string(strip_tags($_REQUEST["content"]));
+                               <tr><td colspan='2'>
+                                       <div style='float : right' class='insensitive-small'>
+                                       <?php echo __("Shared article will appear in the Published feed.") ?>
+                                       </div>
+                                       <button type="submit"><?php echo __('Share') ?></button>
+                                       <button onclick="return window.close()"><?php echo __('Cancel') ?></button>
+                                       </div>
 
-                               create_published_article($this->link, $title, $url, $content, $_SESSION["uid"]);
+                               </form>
+                               </td></tr></table>
+                               </body></html>
+                               <?php
 
-                               print "<script type='text/javascript'>";
-                               print "window.close();";
-                               print "</script>";
                        }
 
                } else {
 
-                       print "<table><tr><td>" . __("Not logged in.") . "</td></tr></table>";
-
+                       $return = urlencode($_SERVER["REQUEST_URI"])
+                       ?>
+
+                       <form action="public.php?return=<?php echo $return ?>"
+                               method="POST" id="loginForm" name="loginForm" onsubmit="return validateLoginForm(this)">
+
+                       <input type="hidden" name="op" value="login">
+
+                       <table height='100%' width='100%'><tr><td colspan='2'>
+                       <tr><td colspan='2'><h1><?php echo __("Not logged in") ?></h1></td></tr>
+
+                       <tr><td align="right"><?php echo __("Login:") ?></td>
+                       <td align="right"><input name="login"
+                               value="<?php echo $_SESSION["fake_login"] ?>"></td></tr>
+                               <tr><td align="right"><?php echo __("Password:") ?></td>
+                               <td align="right"><input type="password" name="password"
+                               value="<?php echo $_SESSION["fake_password"] ?>"></td></tr>
+                       <tr><td align="right"><?php echo __("Language:") ?></td>
+                       <td align="right">
+                       <?php
+                               print_select_hash("language", $_COOKIE["ttrss_lang"], get_translations(),
+                                       "style='width : 100%''");
+
+                       ?>
+                       </td></tr>
+                       <tr><td colspan='2'>
+                               <button type="submit">
+                                       <?php echo __('Log in') ?></button>
+
+                               <button onclick="return window.close()">
+                                       <?php echo __('Cancel') ?></button>
+                       </td></tr>
+                       </table>
+
+                       </form>
+                       <?php
                }
        }