当前位置: 首页>>代码示例>>PHP>>正文


PHP make_local_datetime函数代码示例

本文整理汇总了PHP中make_local_datetime函数的典型用法代码示例。如果您正苦于以下问题:PHP make_local_datetime函数的具体用法?PHP make_local_datetime怎么用?PHP make_local_datetime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了make_local_datetime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 function index()
 {
     print "<div dojoType=\"dijit.layout.AccordionContainer\" region=\"center\">";
     print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"" . __('Error Log') . "\">";
     if (LOG_DESTINATION == "sql") {
         $result = $this->dbh->query("SELECT errno, errstr, filename, lineno,\n\t\t\t\tcreated_at, login FROM ttrss_error_log\n\t\t\t\tLEFT JOIN ttrss_users ON (owner_uid = ttrss_users.id)\n\t\t\t\tORDER BY ttrss_error_log.id DESC\n\t\t\t\tLIMIT 100");
         print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"updateSystemList()\">" . __('Refresh') . "</button> ";
         print "&nbsp;<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"clearSqlLog()\">" . __('Clear log') . "</button> ";
         print "<p><table width=\"100%\" cellspacing=\"10\" class=\"prefErrorLog\">";
         print "<tr class=\"title\">\n\t\t\t\t<td width='5%'>" . __("Error") . "</td>\n\t\t\t\t<td>" . __("Filename") . "</td>\n\t\t\t\t<td>" . __("Message") . "</td>\n\t\t\t\t<td width='5%'>" . __("User") . "</td>\n\t\t\t\t<td width='5%'>" . __("Date") . "</td>\n\t\t\t\t</tr>";
         while ($line = $this->dbh->fetch_assoc($result)) {
             print "<tr class=\"errrow\">";
             foreach ($line as $k => $v) {
                 $line[$k] = htmlspecialchars($v);
             }
             print "<td class='errno'>" . Logger::$errornames[$line["errno"]] . " (" . $line["errno"] . ")</td>";
             print "<td class='filename'>" . $line["filename"] . ":" . $line["lineno"] . "</td>";
             print "<td class='errstr'>" . $line["errstr"] . "</td>";
             print "<td class='login'>" . $line["login"] . "</td>";
             print "<td class='timestamp'>" . make_local_datetime($line["created_at"], false) . "</td>";
             print "</tr>";
         }
         print "</table>";
     } else {
         print_notice("Please set LOG_DESTINATION to 'sql' in config.php to enable database logging.");
     }
     print "</div>";
     PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB, "hook_prefs_tab", "prefSystem");
     print "</div>";
     #container
 }
开发者ID:Verisor,项目名称:tt-rss,代码行数:31,代码来源:system.php

示例2: getfeedtree

 function getfeedtree()
 {
     $search = $_SESSION["prefs_feed_search"];
     if ($search) {
         $search_qpart = " AND LOWER(title) LIKE LOWER('%{$search}%')";
     }
     $root = array();
     $root['id'] = 'root';
     $root['name'] = __('Feeds');
     $root['items'] = array();
     $root['type'] = 'category';
     if (get_pref($this->link, 'ENABLE_FEED_CATS')) {
         $show_empty_cats = get_pref($this->link, '_PREFS_SHOW_EMPTY_CATS');
         $result = db_query($this->link, "SELECT id, title FROM ttrss_feed_categories\n\t\t\t\tWHERE owner_uid = " . $_SESSION["uid"] . " ORDER BY order_id, title");
         while ($line = db_fetch_assoc($result)) {
             $cat = array();
             $cat['id'] = 'CAT:' . $line['id'];
             $cat['bare_id'] = $feed_id;
             $cat['name'] = $line['title'];
             $cat['items'] = array();
             $cat['checkbox'] = false;
             $cat['type'] = 'category';
             $feed_result = db_query($this->link, "SELECT id, title, last_error,\n\t\t\t\t\t" . SUBSTRING_FOR_DATE . "(last_updated,1,19) AS last_updated\n\t\t\t\t\tFROM ttrss_feeds\n\t\t\t\t\tWHERE cat_id = '" . $line['id'] . "' AND owner_uid = " . $_SESSION["uid"] . "{$search_qpart} ORDER BY order_id, title");
             while ($feed_line = db_fetch_assoc($feed_result)) {
                 $feed = array();
                 $feed['id'] = 'FEED:' . $feed_line['id'];
                 $feed['bare_id'] = $feed_line['id'];
                 $feed['name'] = $feed_line['title'];
                 $feed['checkbox'] = false;
                 $feed['error'] = $feed_line['last_error'];
                 $feed['icon'] = getFeedIcon($feed_line['id']);
                 $feed['param'] = make_local_datetime($this->link, $feed_line['last_updated'], true);
                 array_push($cat['items'], $feed);
             }
             $cat['param'] = T_sprintf('(%d feeds)', count($cat['items']));
             if (count($cat['items']) > 0 || $show_empty_cats) {
                 array_push($root['items'], $cat);
             }
             $root['param'] += count($cat['items']);
         }
         /* Uncategorized is a special case */
         $cat = array();
         $cat['id'] = 'CAT:0';
         $cat['bare_id'] = 0;
         $cat['name'] = __("Uncategorized");
         $cat['items'] = array();
         $cat['type'] = 'category';
         $cat['checkbox'] = false;
         $feed_result = db_query($this->link, "SELECT id, title,last_error,\n\t\t\t\t" . SUBSTRING_FOR_DATE . "(last_updated,1,19) AS last_updated\n\t\t\t\tFROM ttrss_feeds\n\t\t\t\tWHERE cat_id IS NULL AND owner_uid = " . $_SESSION["uid"] . "{$search_qpart} ORDER BY order_id, title");
         while ($feed_line = db_fetch_assoc($feed_result)) {
             $feed = array();
             $feed['id'] = 'FEED:' . $feed_line['id'];
             $feed['bare_id'] = $feed_line['id'];
             $feed['name'] = $feed_line['title'];
             $feed['checkbox'] = false;
             $feed['error'] = $feed_line['last_error'];
             $feed['icon'] = getFeedIcon($feed_line['id']);
             $feed['param'] = make_local_datetime($this->link, $feed_line['last_updated'], true);
             array_push($cat['items'], $feed);
         }
         $cat['param'] = T_sprintf('(%d feeds)', count($cat['items']));
         if (count($cat['items']) > 0 || $show_empty_cats) {
             array_push($root['items'], $cat);
         }
         $root['param'] += count($cat['items']);
         $root['param'] = T_sprintf('(%d feeds)', $root['param']);
     } else {
         $feed_result = db_query($this->link, "SELECT id, title, last_error,\n\t\t\t\t" . SUBSTRING_FOR_DATE . "(last_updated,1,19) AS last_updated\n\t\t\t\tFROM ttrss_feeds\n\t\t\t\tWHERE owner_uid = " . $_SESSION["uid"] . "{$search_qpart} ORDER BY order_id, title");
         while ($feed_line = db_fetch_assoc($feed_result)) {
             $feed = array();
             $feed['id'] = 'FEED:' . $feed_line['id'];
             $feed['bare_id'] = $feed_line['id'];
             $feed['name'] = $feed_line['title'];
             $feed['checkbox'] = false;
             $feed['error'] = $feed_line['last_error'];
             $feed['icon'] = getFeedIcon($feed_line['id']);
             $feed['param'] = make_local_datetime($this->link, $feed_line['last_updated'], true);
             array_push($root['items'], $feed);
         }
         $root['param'] = T_sprintf('(%d feeds)', count($root['items']));
     }
     $fl = array();
     $fl['identifier'] = 'id';
     $fl['label'] = 'name';
     $fl['items'] = array($root);
     print json_encode($fl);
     return;
 }
开发者ID:4iji,项目名称:Tiny-Tiny-RSS,代码行数:88,代码来源:pref_feeds.php

示例3: index

 function index()
 {
     global $access_level_names;
     print "<div id=\"pref-user-wrap\" dojoType=\"dijit.layout.BorderContainer\" gutters=\"false\">";
     print "<div id=\"pref-user-header\" dojoType=\"dijit.layout.ContentPane\" region=\"top\">";
     print "<div id=\"pref-user-toolbar\" dojoType=\"dijit.Toolbar\">";
     $user_search = $this->dbh->escape_string($_REQUEST["search"]);
     if (array_key_exists("search", $_REQUEST)) {
         $_SESSION["prefs_user_search"] = $user_search;
     } else {
         $user_search = $_SESSION["prefs_user_search"];
     }
     print "<div style='float : right; padding-right : 4px;'>\n\t\t\t\t<input dojoType=\"dijit.form.TextBox\" id=\"user_search\" size=\"20\" type=\"search\"\n\t\t\t\t\tvalue=\"{$user_search}\">\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"updateUsersList()\">" . __('Search') . "</button>\n\t\t\t\t</div>";
     $sort = $this->dbh->escape_string($_REQUEST["sort"]);
     if (!$sort || $sort == "undefined") {
         $sort = "login";
     }
     print "<div dojoType=\"dijit.form.DropDownButton\">" . "<span>" . __('Select') . "</span>";
     print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
     print "<div onclick=\"selectTableRows('prefUserList', 'all')\"\n\t\t\t\tdojoType=\"dijit.MenuItem\">" . __('All') . "</div>";
     print "<div onclick=\"selectTableRows('prefUserList', 'none')\"\n\t\t\t\tdojoType=\"dijit.MenuItem\">" . __('None') . "</div>";
     print "</div></div>";
     print "<button dojoType=\"dijit.form.Button\" onclick=\"addUser()\">" . __('Create user') . "</button>";
     print "\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"selectedUserDetails()\">" . __('Details') . "</button dojoType=\"dijit.form.Button\">\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"editSelectedUser()\">" . __('Edit') . "</button dojoType=\"dijit.form.Button\">\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"removeSelectedUsers()\">" . __('Remove') . "</button dojoType=\"dijit.form.Button\">\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"resetSelectedUserPass()\">" . __('Reset password') . "</button dojoType=\"dijit.form.Button\">";
     PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION, "hook_prefs_tab_section", "prefUsersToolbar");
     print "</div>";
     #toolbar
     print "</div>";
     #pane
     print "<div id=\"pref-user-content\" dojoType=\"dijit.layout.ContentPane\" region=\"center\">";
     print "<div id=\"sticky-status-msg\"></div>";
     if ($user_search) {
         $user_search = explode(" ", $user_search);
         $tokens = array();
         foreach ($user_search as $token) {
             $token = trim($token);
             array_push($tokens, "(UPPER(login) LIKE UPPER('%{$token}%'))");
         }
         $user_search_query = "(" . join($tokens, " AND ") . ") AND ";
     } else {
         $user_search_query = "";
     }
     $result = $this->dbh->query("SELECT\n\t\t\t\t\tid,login,access_level,email,\n\t\t\t\t\t" . SUBSTRING_FOR_DATE . "(last_login,1,16) as last_login,\n\t\t\t\t\t" . SUBSTRING_FOR_DATE . "(created,1,16) as created\n\t\t\t\tFROM\n\t\t\t\t\tttrss_users\n\t\t\t\tWHERE\n\t\t\t\t\t{$user_search_query}\n\t\t\t\t\tid > 0\n\t\t\t\tORDER BY {$sort}");
     if ($this->dbh->num_rows($result) > 0) {
         print "<p><table width=\"100%\" cellspacing=\"0\"\n\t\t\t\tclass=\"prefUserList\" id=\"prefUserList\">";
         print "<tr class=\"title\">\n\t\t\t\t\t\t<td align='center' width=\"5%\">&nbsp;</td>\n\t\t\t\t\t\t<td width='30%'><a href=\"#\" onclick=\"updateUsersList('login')\">" . __('Login') . "</a></td>\n\t\t\t\t\t\t<td width='30%'><a href=\"#\" onclick=\"updateUsersList('access_level')\">" . __('Access Level') . "</a></td>\n\t\t\t\t\t\t<td width='20%'><a href=\"#\" onclick=\"updateUsersList('created')\">" . __('Registered') . "</a></td>\n\t\t\t\t\t\t<td width='20%'><a href=\"#\" onclick=\"updateUsersList('last_login')\">" . __('Last login') . "</a></td></tr>";
         $lnum = 0;
         while ($line = $this->dbh->fetch_assoc($result)) {
             $uid = $line["id"];
             print "<tr id=\"UMRR-{$uid}\">";
             $line["login"] = htmlspecialchars($line["login"]);
             $line["created"] = make_local_datetime($line["created"], false);
             $line["last_login"] = make_local_datetime($line["last_login"], false);
             print "<td align='center'><input onclick='toggleSelectRow2(this);'\n\t\t\t\t\tdojoType=\"dijit.form.CheckBox\" type=\"checkbox\"\n\t\t\t\t\tid=\"UMCHK-{$uid}\"></td>";
             $onclick = "onclick='editUser({$uid}, event)' title='" . __('Click to edit') . "'";
             print "<td {$onclick}><img src='images/user.png' class='markedPic' alt=''> " . $line["login"] . "</td>";
             if (!$line["email"]) {
                 $line["email"] = "&nbsp;";
             }
             print "<td {$onclick}>" . $access_level_names[$line["access_level"]] . "</td>";
             print "<td {$onclick}>" . $line["created"] . "</td>";
             print "<td {$onclick}>" . $line["last_login"] . "</td>";
             print "</tr>";
             ++$lnum;
         }
         print "</table>";
     } else {
         print "<p>";
         if (!$user_search) {
             print_warning(__('No users defined.'));
         } else {
             print_warning(__('No matching users found.'));
         }
         print "</p>";
     }
     print "</div>";
     #pane
     PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB, "hook_prefs_tab", "prefUsers");
     print "</div>";
     #container
 }
开发者ID:zamentur,项目名称:ttrss_ynh,代码行数:81,代码来源:users.php

示例4: generate_dashboard_feed

 private function generate_dashboard_feed()
 {
     $reply = array();
     $reply['headlines']['id'] = -5;
     $reply['headlines']['is_cat'] = false;
     $reply['headlines']['toolbar'] = '';
     $reply['headlines']['content'] = "<div class='whiteBox'>" . __('No feed selected.');
     $reply['headlines']['content'] .= "<p><span class=\"insensitive\">";
     $result = $this->dbh->query("SELECT " . SUBSTRING_FOR_DATE . "(MAX(last_updated), 1, 19) AS last_updated FROM ttrss_feeds\n\t\t\tWHERE owner_uid = " . $_SESSION['uid']);
     $last_updated = $this->dbh->fetch_result($result, 0, "last_updated");
     $last_updated = make_local_datetime($last_updated, false);
     $reply['headlines']['content'] .= sprintf(__("Feeds last updated at %s"), $last_updated);
     $result = $this->dbh->query("SELECT COUNT(id) AS num_errors\n\t\t\tFROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION["uid"]);
     $num_errors = $this->dbh->fetch_result($result, 0, "num_errors");
     if ($num_errors > 0) {
         $reply['headlines']['content'] .= "<br/>";
         $reply['headlines']['content'] .= "<a class=\"insensitive\" href=\"#\" onclick=\"showFeedsWithErrors()\">" . __('Some feeds have update errors (click for details)') . "</a>";
     }
     $reply['headlines']['content'] .= "</span></p>";
     $reply['headlines-info'] = array("count" => 0, "vgroup_last_feed" => '', "unread" => 0, "disable_cache" => true);
     return $reply;
 }
开发者ID:zamentur,项目名称:ttrss_ynh,代码行数:22,代码来源:feeds.php

示例5: module_pref_users

function module_pref_users($link)
{
    global $access_level_names;
    if (!SINGLE_USER_MODE && $_SESSION["access_level"] < 10) {
        print __("Your access level is insufficient to open this tab.");
        return;
    }
    $subop = $_REQUEST["subop"];
    if ($subop == "user-details") {
        header("Content-Type: text/xml");
        print "<dlg id=\"{$subop}\">";
        $uid = sprintf("%d", $_REQUEST["id"]);
        print "<title>" . __('User details') . "</title>";
        print "<content><![CDATA[";
        $result = db_query($link, "SELECT login,\n\t\t\t\t" . SUBSTRING_FOR_DATE . "(last_login,1,16) AS last_login,\n\t\t\t\taccess_level,\n\t\t\t\t(SELECT COUNT(int_id) FROM ttrss_user_entries\n\t\t\t\t\tWHERE owner_uid = id) AS stored_articles,\n\t\t\t\t" . SUBSTRING_FOR_DATE . "(created,1,16) AS created\n\t\t\t\tFROM ttrss_users\n\t\t\t\tWHERE id = '{$uid}'");
        if (db_num_rows($result) == 0) {
            print "<h1>" . __('User not found') . "</h1>";
            return;
        }
        // print "<h1>User Details</h1>";
        $login = db_fetch_result($result, 0, "login");
        print "<table width='100%'>";
        $last_login = make_local_datetime($link, db_fetch_result($result, 0, "last_login"), true);
        $created = make_local_datetime($link, db_fetch_result($result, 0, "created"), true);
        $access_level = db_fetch_result($result, 0, "access_level");
        $stored_articles = db_fetch_result($result, 0, "stored_articles");
        print "<tr><td>" . __('Registered') . "</td><td>{$created}</td></tr>";
        print "<tr><td>" . __('Last logged in') . "</td><td>{$last_login}</td></tr>";
        $result = db_query($link, "SELECT COUNT(id) as num_feeds FROM ttrss_feeds\n\t\t\t\tWHERE owner_uid = '{$uid}'");
        $num_feeds = db_fetch_result($result, 0, "num_feeds");
        print "<tr><td>" . __('Subscribed feeds count') . "</td><td>{$num_feeds}</td></tr>";
        print "</table>";
        print "<h1>" . __('Subscribed feeds') . "</h1>";
        $result = db_query($link, "SELECT id,title,site_url FROM ttrss_feeds\n\t\t\t\tWHERE owner_uid = '{$uid}' ORDER BY title");
        print "<ul class=\"userFeedList\">";
        $row_class = "odd";
        while ($line = db_fetch_assoc($result)) {
            $icon_file = ICONS_URL . "/" . $line["id"] . ".ico";
            if (file_exists($icon_file) && filesize($icon_file) > 0) {
                $feed_icon = "<img class=\"tinyFeedIcon\" src=\"{$icon_file}\">";
            } else {
                $feed_icon = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\">";
            }
            print "<li class=\"{$row_class}\">{$feed_icon}&nbsp;<a href=\"" . $line["site_url"] . "\">" . $line["title"] . "</a></li>";
            $row_class = toggleEvenOdd($row_class);
        }
        if (db_num_rows($result) < $num_feeds) {
            // FIXME - add link to show ALL subscribed feeds here somewhere
            print "<li><img\n\t\t\t\t\tclass=\"tinyFeedIcon\" src=\"images/blank_icon.gif\">&nbsp;...</li>";
        }
        print "</ul>";
        print "<div align='center'>\n\t\t\t\t<button onclick=\"closeInfoBox()\">" . __("Close this window") . "</button></div>";
        print "]]></content></dlg>";
        return;
    }
    if ($subop == "edit") {
        header("Content-Type: text/xml");
        $id = db_escape_string($_REQUEST["id"]);
        print "<dlg id=\"{$subop}\">";
        print "<title>" . __('User Editor') . "</title>";
        print "<content><![CDATA[";
        print "<form id=\"user_edit_form\" onsubmit='return false'>";
        print "<input type=\"hidden\" name=\"id\" value=\"{$id}\">";
        print "<input type=\"hidden\" name=\"op\" value=\"pref-users\">";
        print "<input type=\"hidden\" name=\"subop\" value=\"editSave\">";
        $result = db_query($link, "SELECT * FROM ttrss_users WHERE id = '{$id}'");
        $login = db_fetch_result($result, 0, "login");
        $access_level = db_fetch_result($result, 0, "access_level");
        $email = db_fetch_result($result, 0, "email");
        $sel_disabled = $id == $_SESSION["uid"] ? "disabled" : "";
        print "<div class=\"dlgSec\">" . __("User") . "</div>";
        print "<div class=\"dlgSecCont\">";
        if ($sel_disabled) {
            print "<input type=\"hidden\" name=\"login\" value=\"{$login}\">";
            print "<input size=\"30\" style=\"font-size : 16px\"\n\t\t\t\t\tonkeypress=\"return filterCR(event, userEditSave)\" {$sel_disabled}\n\t\t\t\t\tvalue=\"{$login}\">";
        } else {
            print "<input size=\"30\" style=\"font-size : 16px\"\n\t\t\t\t\tonkeypress=\"return filterCR(event, userEditSave)\" {$sel_disabled}\n\t\t\t\t\tname=\"login\" value=\"{$login}\">";
        }
        print "</div>";
        print "<div class=\"dlgSec\">" . __("Authentication") . "</div>";
        print "<div class=\"dlgSecCont\">";
        print __('Access level: ') . " ";
        if (!$sel_disabled) {
            print_select_hash("access_level", $access_level, $access_level_names, $sel_disabled);
        } else {
            print_select_hash("", $access_level, $access_level_names, $sel_disabled);
            print "<input type=\"hidden\" name=\"access_level\" value=\"{$access_level}\">";
        }
        print "<br/>";
        print __('Change password to') . " <input size=\"20\" onkeypress=\"return filterCR(event, userEditSave)\"\n\t\t\t\tname=\"password\">";
        print "</div>";
        print "<div class=\"dlgSec\">" . __("Options") . "</div>";
        print "<div class=\"dlgSecCont\">";
        print __('E-mail: ') . " <input size=\"30\" name=\"email\" onkeypress=\"return filterCR(event, userEditSave)\"\n\t\t\t\tvalue=\"{$email}\">";
        print "</div>";
        print "</table>";
        print "</form>";
        print "<div class=\"dlgButtons\">\n\t\t\t\t<button onclick=\"return userEditSave()\">" . __('Save') . "</button>\n\t\t\t\t<button onclick=\"return userEditCancel()\">" . __('Cancel') . "</button></div>";
        print "]]></content></dlg>";
        return;
//.........这里部分代码省略.........
开发者ID:nougad,项目名称:Tiny-Tiny-RSS,代码行数:101,代码来源:pref-users.php

示例6: index

 function index()
 {
     if (!function_exists('curl_init')) {
         print "<div style='padding : 1em'>";
         print_error("This functionality requires CURL functions. Please enable CURL in your PHP configuration (you might also want to disable open_basedir in php.ini) and reload this page.");
         print "</div>";
     }
     print "<div id=\"pref-instance-wrap\" dojoType=\"dijit.layout.BorderContainer\" gutters=\"false\">";
     print "<div id=\"pref-instance-header\" dojoType=\"dijit.layout.ContentPane\" region=\"top\">";
     print "<div id=\"pref-instance-toolbar\" dojoType=\"dijit.Toolbar\">";
     $sort = db_escape_string($_REQUEST["sort"]);
     if (!$sort || $sort == "undefined") {
         $sort = "access_url";
     }
     print "<div dojoType=\"dijit.form.DropDownButton\">" . "<span>" . __('Select') . "</span>";
     print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
     print "<div onclick=\"selectTableRows('prefInstanceList', 'all')\"\n\t\t\tdojoType=\"dijit.MenuItem\">" . __('All') . "</div>";
     print "<div onclick=\"selectTableRows('prefInstanceList', 'none')\"\n\t\t\tdojoType=\"dijit.MenuItem\">" . __('None') . "</div>";
     print "</div></div>";
     print "<button dojoType=\"dijit.form.Button\" onclick=\"addInstance()\">" . __('Link instance') . "</button>";
     print "<button dojoType=\"dijit.form.Button\" onclick=\"editSelectedInstance()\">" . __('Edit') . "</button>";
     print "<button dojoType=\"dijit.form.Button\" onclick=\"removeSelectedInstances()\">" . __('Remove') . "</button>";
     print "</div>";
     #toolbar
     $result = db_query($this->link, "SELECT *,\n\t\t\t(SELECT COUNT(*) FROM ttrss_linked_feeds\n\t\t\t\tWHERE instance_id = ttrss_linked_instances.id) AS num_feeds\n\t\t\tFROM ttrss_linked_instances\n\t\t\tORDER BY {$sort}");
     print "<p class=\"insensitive\" style='margin-left : 1em;'>" . __("You can connect other instances of Tiny Tiny RSS to this one to share Popular feeds. Link to this instance of Tiny Tiny RSS by using this URL:");
     print " <a href=\"#\" onclick=\"alert('" . htmlspecialchars(get_self_url_prefix()) . "')\">(display url)</a>";
     print "<p><table width='100%' id='prefInstanceList' class='prefInstanceList' cellspacing='0'>";
     print "<tr class=\"title\">\n\t\t\t<td align='center' width=\"5%\">&nbsp;</td>\n\t\t\t<td width=''><a href=\"#\" onclick=\"updateInstanceList('access_url')\">" . __('Instance URL') . "</a></td>\n\t\t\t<td width='20%'><a href=\"#\" onclick=\"updateInstanceList('access_key')\">" . __('Access key') . "</a></td>\n\t\t\t<td width='10%'><a href=\"#\" onclick=\"updateUsersList('last_connected')\">" . __('Last connected') . "</a></td>\n\t\t\t<td width='10%'><a href=\"#\" onclick=\"updateUsersList('last_status_out')\">" . __('Status') . "</a></td>\n\t\t\t<td width='10%'><a href=\"#\" onclick=\"updateUsersList('num_feeds')\">" . __('Stored feeds') . "</a></td>\n\t\t\t</tr>";
     $lnum = 0;
     while ($line = db_fetch_assoc($result)) {
         $class = $lnum % 2 ? "even" : "odd";
         $id = $line['id'];
         $this_row_id = "id=\"LIRR-{$id}\"";
         $line["last_connected"] = make_local_datetime($this->link, $line["last_connected"], false);
         print "<tr class=\"{$class}\" {$this_row_id}>";
         print "<td align='center'><input onclick='toggleSelectRow(this);'\n\t\t\t\ttype=\"checkbox\" id=\"LICHK-{$id}\"></td>";
         $onclick = "onclick='editInstance({$id}, event)' title='" . __('Click to edit') . "'";
         $access_key = mb_substr($line['access_key'], 0, 4) . '...' . mb_substr($line['access_key'], -4);
         print "<td {$onclick}>" . htmlspecialchars($line['access_url']) . "</td>";
         print "<td {$onclick}>" . htmlspecialchars($access_key) . "</td>";
         print "<td {$onclick}>" . htmlspecialchars($line['last_connected']) . "</td>";
         print "<td {$onclick}>" . $this->status_codes[$line['last_status_out']] . "</td>";
         print "<td {$onclick}>" . htmlspecialchars($line['num_feeds']) . "</td>";
         print "</tr>";
         ++$lnum;
     }
     print "</table>";
     print "</div>";
     #pane
     print "</div>";
     #container
 }
开发者ID:rolfkleef,项目名称:Tiny-Tiny-RSS,代码行数:53,代码来源:instances.php

示例7: render_article

function render_article($link, $id, $feed_id, $cat_id, $is_cat)
{
    $query = "SELECT title,link,content,feed_id,comments,int_id,\n\t\t\tmarked,unread,published,\n\t\t\t" . SUBSTRING_FOR_DATE . "(updated,1,16) as updated,\n\t\t\tauthor\n\t\t\tFROM ttrss_entries,ttrss_user_entries\n\t\t\tWHERE\tid = '{$id}' AND ref_id = id AND owner_uid = " . $_SESSION["uid"];
    $result = db_query($link, $query);
    if (db_num_rows($result) != 0) {
        $line = db_fetch_assoc($result);
        $tmp_result = db_query($link, "UPDATE ttrss_user_entries\n\t\t\t\tSET unread = false,last_read = NOW()\n\t\t\t\tWHERE ref_id = '{$id}'\n\t\t\t\tAND owner_uid = " . $_SESSION["uid"]);
        $updated_fmt = make_local_datetime($link, $line['updated'], false);
        $title = $line["title"];
        $article_link = $line["link"];
        if (!$is_cat) {
            $feed_title = getFeedTitle($link, $feed_id);
        } else {
            $feed_title = getCategoryTitle($link, $feed_id);
        }
        print "<div class=\"panel\" id=\"article-{$id}\" title=\"{$title}\"\n\t\t\t\tselected=\"true\"\n\t\t\t\tmyBackLabel='{$feed_title}' myBackHref='feed.php?id={$feed_id}&cat={$cat_id}&is_cat={$is_cat}'>";
        if ($line['feed_id'] != $feed_id) {
            $real_feed_title = getFeedTitle($link, $line['feed_id']);
            $real_feed_id = $line['feed_id'];
            $feed_link = "(<a href=\"feed.php?id={$real_feed_id}\">{$real_feed_title}</a>)";
        }
        //			print "<fieldset>";
        print "<div style='float : right'>({$updated_fmt})</div>";
        print "<h2><a target='_blank' href='{$article_link}'>{$title}</a> {$feed_link}</h2>";
        print "<hr>";
        /*			print "<div class=\"row\">";
        			print "<label id='title'><a target='_blank' href='$article_link'>$title</a></label>";
        			print "</div>"; */
        $is_starred = sql_bool_to_bool($line["marked"]) ? "true" : "false";
        $is_published = sql_bool_to_bool($line["published"]) ? "true" : "false";
        //print "<div class=\"row\">";
        //print "<label id='updated'>Updated:</label>";
        //print "<input type='text' enabled='false' name='updated' disabled value='$updated_fmt'/>";
        //print "</div>";
        //			print "</fieldset>";
        $content = sanitize($link, $line["content"]);
        $content = preg_replace("/href=/i", "target=\"_blank\" href=", $content);
        if (!mobile_get_pref($link, "SHOW_IMAGES")) {
            $content = preg_replace('/<img[^>]+>/is', '', $content);
        }
        print "<p>{$content}</p>";
        print "<div class='nav'>\n                    <label>Navigation</label>\n                    <div class='button left' onclick='goPrev({$id}, {$feed_id}, this)'>Prev</div>\n                    <div class='button right' onclick='goNext({$id}, {$feed_id}, this)'>Next</div>\n                  </div>";
        print "<fieldset>";
        print "<div class=\"row\">\n\t                <label>Starred</label>\n\t                <div class=\"toggle\" onclick=\"toggleMarked({$id}, this)\" toggled=\"{$is_starred}\"><span class=\"thumb\"></span><span class=\"toggleOn\">ON</span><span class=\"toggleOff\">OFF</span></div>\n\t            </div>";
        print "<div class=\"row\">\n\t                <label>Published</label>\n\t                <div class=\"toggle\" onclick=\"togglePublished({$id}, this)\" toggled=\"{$is_published}\"><span class=\"thumb\"></span><span class=\"toggleOn\">ON</span><span class=\"toggleOff\">OFF</span></div>\n\t            </div>";
        print "<div class=\"row\">\n\t                <label>Unread</label>\n\t                <div class=\"toggle\" onclick=\"toggleUnread({$id}, this)\" toggled=\"{$is_unread}\"><span class=\"thumb\"></span><span class=\"toggleOn\">ON</span><span class=\"toggleOff\">OFF</span></div>\n\t            </div>";
        print "</fieldset>";
        print "</div>";
    }
}
开发者ID:bohoo,项目名称:tiny_tiny_rss-openshift-quickstart-1,代码行数:50,代码来源:mobile-functions.php

示例8: getFeedCounters

function getFeedCounters($active_feed = false)
{
    $ret_arr = array();
    $query = "SELECT ttrss_feeds.id,\n\t\t\t\tttrss_feeds.title,\n\t\t\t\t" . SUBSTRING_FOR_DATE . "(ttrss_feeds.last_updated,1,19) AS last_updated,\n\t\t\t\tlast_error, value AS count\n\t\t\tFROM ttrss_feeds, ttrss_counters_cache\n\t\t\tWHERE ttrss_feeds.owner_uid = " . $_SESSION["uid"] . "\n\t\t\t\tAND ttrss_counters_cache.owner_uid = ttrss_feeds.owner_uid\n\t\t\t\tAND ttrss_counters_cache.feed_id = id";
    $result = db_query($query);
    while ($line = db_fetch_assoc($result)) {
        $id = $line["id"];
        $count = $line["count"];
        $last_error = htmlspecialchars($line["last_error"]);
        $last_updated = make_local_datetime($line['last_updated'], false);
        $has_img = feed_has_icon($id);
        if (date('Y') - date('Y', strtotime($line['last_updated'])) > 2) {
            $last_updated = '';
        }
        $cv = array("id" => $id, "updated" => $last_updated, "counter" => (int) $count, "has_img" => (int) $has_img);
        if ($last_error) {
            $cv["error"] = $last_error;
        }
        //			if (get_pref('EXTENDED_FEEDLIST'))
        //				$cv["xmsg"] = getFeedArticles($id)." ".__("total");
        if ($active_feed && $id == $active_feed) {
            $cv["title"] = truncate_string($line["title"], 30);
        }
        array_push($ret_arr, $cv);
    }
    return $ret_arr;
}
开发者ID:nota-ja,项目名称:tt-rss,代码行数:27,代码来源:functions.php

示例9: getfeedtree

 function getfeedtree()
 {
     $search = $_SESSION["prefs_feed_search"];
     if ($search) {
         $search_qpart = " AND LOWER(title) LIKE LOWER('%{$search}%')";
     }
     $root = array();
     $root['id'] = 'root';
     $root['name'] = __('Feeds');
     $root['items'] = array();
     $root['type'] = 'category';
     $enable_cats = get_pref($this->link, 'ENABLE_FEED_CATS');
     if ($_REQUEST['mode'] == 2) {
         if ($enable_cats) {
             $cat_hidden = get_pref($this->link, "_COLLAPSED_SPECIAL");
             $cat = $this->feedlist_init_cat(-1, $cat_hidden);
         } else {
             $cat['items'] = array();
         }
         foreach (array(-4, -3, -1, -2, 0, -6) as $i) {
             array_push($cat['items'], $this->feedlist_init_feed($i));
         }
         if ($enable_cats) {
             array_push($root['items'], $cat);
         } else {
             $root['items'] = array_merge($root['items'], $cat['items']);
         }
         $result = db_query($this->link, "SELECT * FROM\n\t\t\t\tttrss_labels2 WHERE owner_uid = " . $_SESSION['uid'] . " ORDER by caption");
         if (db_num_rows($result) > 0) {
             if (get_pref($this->link, 'ENABLE_FEED_CATS')) {
                 $cat_hidden = get_pref($this->link, "_COLLAPSED_LABELS");
                 $cat = $this->feedlist_init_cat(-2, $cat_hidden);
             } else {
                 $cat['items'] = array();
             }
             while ($line = db_fetch_assoc($result)) {
                 $label_id = -$line['id'] - 11;
                 $count = getFeedUnread($this->link, $label_id);
                 $feed = $this->feedlist_init_feed($label_id, false, $count);
                 $feed['fg_color'] = $line['fg_color'];
                 $feed['bg_color'] = $line['bg_color'];
                 array_push($cat['items'], $feed);
             }
             if ($enable_cats) {
                 array_push($root['items'], $cat);
             } else {
                 $root['items'] = array_merge($root['items'], $cat['items']);
             }
         }
     }
     if ($enable_cats) {
         $show_empty_cats = $_REQUEST['mode'] != 2 && get_pref($this->link, '_PREFS_SHOW_EMPTY_CATS');
         $result = db_query($this->link, "SELECT id, title, collapsed FROM ttrss_feed_categories\n\t\t\t\tWHERE owner_uid = " . $_SESSION["uid"] . " AND parent_cat IS NULL ORDER BY order_id, title");
         while ($line = db_fetch_assoc($result)) {
             $cat = array();
             $cat['id'] = 'CAT:' . $line['id'];
             $cat['bare_id'] = (int) $line['id'];
             $cat['name'] = $line['title'];
             $cat['items'] = array();
             $cat['checkbox'] = false;
             $cat['hidden'] = sql_bool_to_bool($line['collapsed']);
             $cat['type'] = 'category';
             $cat['unread'] = 0;
             $cat['child_unread'] = 0;
             $cat['items'] = $this->get_category_items($line['id']);
             $cat['param'] = T_sprintf('(%d feeds)', count($cat['items']));
             if (count($cat['items']) > 0 || $show_empty_cats) {
                 array_push($root['items'], $cat);
             }
             $root['param'] += count($cat['items']);
         }
         /* Uncategorized is a special case */
         $cat = array();
         $cat['id'] = 'CAT:0';
         $cat['bare_id'] = 0;
         $cat['name'] = __("Uncategorized");
         $cat['items'] = array();
         $cat['hidden'] = get_pref($this->link, "_COLLAPSED_UNCAT");
         $cat['type'] = 'category';
         $cat['checkbox'] = false;
         $cat['unread'] = 0;
         $cat['child_unread'] = 0;
         $feed_result = db_query($this->link, "SELECT id, title,last_error,\n\t\t\t\t" . SUBSTRING_FOR_DATE . "(last_updated,1,19) AS last_updated\n\t\t\t\tFROM ttrss_feeds\n\t\t\t\tWHERE cat_id IS NULL AND owner_uid = " . $_SESSION["uid"] . "{$search_qpart} ORDER BY order_id, title");
         while ($feed_line = db_fetch_assoc($feed_result)) {
             $feed = array();
             $feed['id'] = 'FEED:' . $feed_line['id'];
             $feed['bare_id'] = (int) $feed_line['id'];
             $feed['name'] = $feed_line['title'];
             $feed['checkbox'] = false;
             $feed['error'] = $feed_line['last_error'];
             $feed['icon'] = getFeedIcon($feed_line['id']);
             $feed['param'] = make_local_datetime($this->link, $feed_line['last_updated'], true);
             $feed['unread'] = 0;
             $feed['type'] = 'feed';
             array_push($cat['items'], $feed);
         }
         $cat['param'] = T_sprintf('(%d feeds)', count($cat['items']));
         if (count($cat['items']) > 0 || $show_empty_cats) {
             array_push($root['items'], $cat);
         }
//.........这里部分代码省略.........
开发者ID:nvdnkpr,项目名称:Tiny-Tiny-RSS,代码行数:101,代码来源:feeds.php

示例10: module_popup_dialog


//.........这里部分代码省略.........
        print "<div class=\"dlgSec\">" . __("Options") . "</div>";
        print "<div class=\"dlgSecCont\">";
        print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"enabled\" id=\"enabled\" checked=\"1\">\n\t\t\t\t\t<label for=\"enabled\">" . __('Enabled') . "</label><hr/>";
        print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"inverse\" id=\"inverse\">\n\t\t\t\t<label for=\"inverse\">" . __('Inverse match') . "</label>";
        print "</div>";
        print "<div class=\"dlgButtons\">";
        print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').test()\">" . __('Test') . "</button> ";
        print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').execute()\">" . __('Create') . "</button> ";
        print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').hide()\">" . __('Cancel') . "</button>";
        print "</div>";
        //return;
    }
    if ($id == "inactiveFeeds") {
        if (DB_TYPE == "pgsql") {
            $interval_qpart = "NOW() - INTERVAL '3 months'";
        } else {
            $interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)";
        }
        $result = db_query($link, "SELECT ttrss_feeds.title, ttrss_feeds.site_url,\n\t\t\t  \t\tttrss_feeds.feed_url, ttrss_feeds.id, MAX(updated) AS last_article\n\t\t\t\tFROM ttrss_feeds, ttrss_entries, ttrss_user_entries WHERE\n\t\t\t\t\t(SELECT MAX(updated) FROM ttrss_entries, ttrss_user_entries WHERE\n\t\t\t\t\t\tttrss_entries.id = ref_id AND\n\t\t\t\t\t\t\tttrss_user_entries.feed_id = ttrss_feeds.id) < {$interval_qpart}\n\t\t\t\tAND ttrss_feeds.owner_uid = " . $_SESSION["uid"] . " AND\n\t\t\t\t\tttrss_user_entries.feed_id = ttrss_feeds.id AND\n\t\t\t\t\tttrss_entries.id = ref_id\n\t\t\t\tGROUP BY ttrss_feeds.title, ttrss_feeds.id, ttrss_feeds.site_url, ttrss_feeds.feed_url\n\t\t\t\tORDER BY last_article");
        print __("These feeds have not been updated with new content for 3 months (oldest first):");
        print "<div class=\"inactiveFeedHolder\">";
        print "<table width=\"100%\" cellspacing=\"0\" id=\"prefInactiveFeedList\">";
        $lnum = 1;
        while ($line = db_fetch_assoc($result)) {
            $class = $lnum % 2 ? "even" : "odd";
            $feed_id = $line["id"];
            $this_row_id = "id=\"FUPDD-{$feed_id}\"";
            print "<tr class=\"\" {$this_row_id}>";
            $edit_title = htmlspecialchars($line["title"]);
            print "<td width='5%' align='center'><input\n\t\t\t\t\tonclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"\n\t\t\t\t\ttype=\"checkbox\"></td>";
            print "<td>";
            print "<a class=\"visibleLink\" href=\"#\" " . "title=\"" . __("Click to edit feed") . "\" " . "onclick=\"editFeed(" . $line["id"] . ")\">" . htmlspecialchars($line["title"]) . "</a>";
            print "</td><td class=\"insensitive\" align='right'>";
            print make_local_datetime($link, $line['last_article'], false);
            print "</td>";
            print "</tr>";
            ++$lnum;
        }
        print "</table>";
        print "</div>";
        print "<div class='dlgButtons'>";
        print "<div style='float : left'>";
        print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('inactiveFeedsDlg').removeSelected()\">" . __('Unsubscribe from selected feeds') . "</button> ";
        print "</div>";
        print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('inactiveFeedsDlg').hide()\">" . __('Close this window') . "</button>";
        print "</div>";
    }
    if ($id == "feedsWithErrors") {
        #			print "<title>".__('Feeds with update errors')."</title>";
        #			print "<content><![CDATA[";
        print __("These feeds have not been updated because of errors:");
        $result = db_query($link, "SELECT id,title,feed_url,last_error,site_url\n\t\t\tFROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION["uid"]);
        print "<div class=\"inactiveFeedHolder\">";
        print "<table width=\"100%\" cellspacing=\"0\" id=\"prefErrorFeedList\">";
        $lnum = 1;
        while ($line = db_fetch_assoc($result)) {
            $class = $lnum % 2 ? "even" : "odd";
            $feed_id = $line["id"];
            $this_row_id = "id=\"FUPDD-{$feed_id}\"";
            print "<tr class=\"\" {$this_row_id}>";
            $edit_title = htmlspecialchars($line["title"]);
            print "<td width='5%' align='center'><input\n\t\t\t\t\tonclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"\n\t\t\t\t\ttype=\"checkbox\"></td>";
            print "<td>";
            print "<a class=\"visibleLink\" href=\"#\" " . "title=\"" . __("Click to edit feed") . "\" " . "onclick=\"editFeed(" . $line["id"] . ")\">" . htmlspecialchars($line["title"]) . "</a>: ";
            print "<span class=\"insensitive\">";
            print htmlspecialchars($line["last_error"]);
开发者ID:nougad,项目名称:Tiny-Tiny-RSS,代码行数:67,代码来源:popup-dialog.php

示例11: prepare_headlines_digest

function prepare_headlines_digest($link, $user_id, $days = 1, $limit = 1000)
{
    require_once "lib/MiniTemplator.class.php";
    $tpl = new MiniTemplator();
    $tpl_t = new MiniTemplator();
    $tpl->readTemplateFromFile("templates/digest_template_html.txt");
    $tpl_t->readTemplateFromFile("templates/digest_template.txt");
    $user_tz_string = get_pref($link, 'USER_TIMEZONE', $user_id);
    $local_ts = convert_timestamp(time(), 'UTC', $user_tz_string);
    $tpl->setVariable('CUR_DATE', date('Y/m/d', $local_ts));
    $tpl->setVariable('CUR_TIME', date('G:i', $local_ts));
    $tpl_t->setVariable('CUR_DATE', date('Y/m/d', $local_ts));
    $tpl_t->setVariable('CUR_TIME', date('G:i', $local_ts));
    $affected_ids = array();
    if (DB_TYPE == "pgsql") {
        $interval_query = "ttrss_entries.date_updated > NOW() - INTERVAL '{$days} days'";
    } else {
        if (DB_TYPE == "mysql") {
            $interval_query = "ttrss_entries.date_updated > DATE_SUB(NOW(), INTERVAL {$days} DAY)";
        }
    }
    $result = db_query($link, "SELECT ttrss_entries.title,\n\t\t\t\tttrss_feeds.title AS feed_title,\n\t\t\t\tCOALESCE(ttrss_feed_categories.title, '" . __('Uncategorized') . "') AS cat_title,\n\t\t\t\tdate_updated,\n\t\t\t\tttrss_user_entries.ref_id,\n\t\t\t\tlink,\n\t\t\t\tscore,\n\t\t\t\tcontent,\n\t\t\t\t" . SUBSTRING_FOR_DATE . "(last_updated,1,19) AS last_updated\n\t\t\tFROM\n\t\t\t\tttrss_user_entries,ttrss_entries,ttrss_feeds\n\t\t\tLEFT JOIN\n\t\t\t\tttrss_feed_categories ON (cat_id = ttrss_feed_categories.id)\n\t\t\tWHERE\n\t\t\t\tref_id = ttrss_entries.id AND feed_id = ttrss_feeds.id\n\t\t\t\tAND include_in_digest = true\n\t\t\t\tAND {$interval_query}\n\t\t\t\tAND ttrss_user_entries.owner_uid = {$user_id}\n\t\t\t\tAND unread = true\n\t\t\t\tAND score >= 0\n\t\t\tORDER BY ttrss_feed_categories.title, ttrss_feeds.title, score DESC, date_updated DESC\n\t\t\tLIMIT {$limit}");
    $cur_feed_title = "";
    $headlines_count = db_num_rows($result);
    $headlines = array();
    while ($line = db_fetch_assoc($result)) {
        array_push($headlines, $line);
    }
    for ($i = 0; $i < sizeof($headlines); $i++) {
        $line = $headlines[$i];
        array_push($affected_ids, $line["ref_id"]);
        $updated = make_local_datetime($link, $line['last_updated'], false, $user_id);
        /*			if ($line["score"] != 0) {
        				if ($line["score"] > 0) $line["score"] = '+' . $line["score"];
        
        				$line["title"] .= " (".$line['score'].")";
        			} */
        if (get_pref($link, 'ENABLE_FEED_CATS', $user_id)) {
            $line['feed_title'] = $line['cat_title'] . " / " . $line['feed_title'];
        }
        $tpl->setVariable('FEED_TITLE', $line["feed_title"]);
        $tpl->setVariable('ARTICLE_TITLE', $line["title"]);
        $tpl->setVariable('ARTICLE_LINK', $line["link"]);
        $tpl->setVariable('ARTICLE_UPDATED', $updated);
        $tpl->setVariable('ARTICLE_EXCERPT', truncate_string(strip_tags($line["content"]), 300));
        //			$tpl->setVariable('ARTICLE_CONTENT',
        //				strip_tags($article_content));
        $tpl->addBlock('article');
        $tpl_t->setVariable('FEED_TITLE', $line["feed_title"]);
        $tpl_t->setVariable('ARTICLE_TITLE', $line["title"]);
        $tpl_t->setVariable('ARTICLE_LINK', $line["link"]);
        $tpl_t->setVariable('ARTICLE_UPDATED', $updated);
        //			$tpl_t->setVariable('ARTICLE_EXCERPT',
        //				truncate_string(strip_tags($line["excerpt"]), 100));
        $tpl_t->addBlock('article');
        if ($headlines[$i]['feed_title'] != $headlines[$i + 1]['feed_title']) {
            $tpl->addBlock('feed');
            $tpl_t->addBlock('feed');
        }
    }
    $tpl->addBlock('digest');
    $tpl->generateOutputToString($tmp);
    $tpl_t->addBlock('digest');
    $tpl_t->generateOutputToString($tmp_t);
    return array($tmp, $headlines_count, $affected_ids, $tmp_t);
}
开发者ID:bohoo,项目名称:tiny_tiny_rss-openshift-quickstart-1,代码行数:66,代码来源:digest.php

示例12: render_headlines


//.........这里部分代码省略.........
        $timing_info = print_checkpoint("H1", $timing_info);
    }
    $result = $qfh_ret[0];
    $feed_title = $qfh_ret[1];
    $feed_site_url = $qfh_ret[2];
    $last_error = $qfh_ret[3];
    /// STOP //////////////////////////////////////////////////////////////////////////////////
    if (!$result) {
        print "<div align='center'>" . __("Could not display feed (query failed). Please check label match syntax or local configuration.") . "</div>";
        return;
    }
    print "<div id=\"heading\">";
    #		if (!$cat_view && file_exists("../icons/$feed.ico") && filesize("../icons/$feed.ico") > 0) {
    #			print "<img class=\"feedIcon\" src=\"../icons/$feed.ico\">";
    #		}
    print "{$feed_title} <span id=\"headingAddon\">(";
    print "<a href=\"index.php\">" . __("Back") . "</a>, ";
    print "<a href=\"index.php?go=sform&aid={$feed}&ic={$cat_view}\">" . __("Search") . "</a>, ";
    print "<a href=\"index.php?go=vf&id={$feed}&subop=ForceUpdate\">" . __("Update") . "</a>";
    #		print "Mark as read: ";
    #		print "<a href=\"index.php?go=vf&id=$feed&subop=MarkAsRead\">Page</a>, ";
    #		print "<a href=\"index.php?go=vf&id=$feed&subop=MarkAllRead\">Feed</a>";
    print ")</span>";
    print "&nbsp;" . __('View:');
    print "<form style=\"display : inline\" method=\"GET\" action=\"index.php\">";
    /* print "<select name=\"viewmode\">
    			<option selected value=\"adaptive\"> " . __('Adaptive') . "</option>
    			<option value=\"all_articles\">" . __('All Articles') . "</option>
    			<option value=\"marked\">" . __('Starred') . "</option>
    			<option value=\"unread\">" . __('Unread') . "</option>
    			</select>"; */
    $sel_values = array("adaptive" => __("Adaptive"), "all_articles" => __("All Articles"), "unread" => __("Unread"), "marked" => __("Starred"));
    print_select_hash("viewmode", $view_mode, $sel_values);
    print "<input type=\"hidden\" name=\"id\" value=\"{$feed}\">\n\t\t<input type=\"hidden\" name=\"cat\" value=\"{$cat_view}\">\n\t\t<input type=\"hidden\" name=\"go\" value=\"vf\">\n\t\t<input type=\"submit\" value=\"" . __('Refresh') . "\">";
    print "</form>";
    print "</div>";
    if (db_num_rows($result) > 0) {
        print "<form method=\"GET\" action=\"index.php\">";
        print "<input type=\"hidden\" name=\"go\" value=\"vf\">";
        print "<input type=\"hidden\" name=\"id\" value=\"{$feed}\">";
        print "<input type=\"hidden\" name=\"cat\" value=\"{$cat_view}\">";
        print "<ul class=\"headlines\" id=\"headlines\">";
        $page_art_ids = array();
        $lnum = 0;
        error_reporting(DEFAULT_ERROR_LEVEL);
        $num_unread = 0;
        while ($line = db_fetch_assoc($result)) {
            $class = $lnum % 2 ? "even" : "odd";
            $id = $line["id"];
            $feed_id = $line["feed_id"];
            array_push($page_art_ids, $id);
            if ($line["last_read"] == "" && ($line["unread"] != "t" && $line["unread"] != "1")) {
                $update_pic = "<img id='FUPDPIC-{$id}' src=\"images/updated.png\" \n\t\t\t\t\t\talt=\"" . __("Updated") . "\">";
            } else {
                $update_pic = "<img id='FUPDPIC-{$id}' src=\"images/blank_icon.gif\" \n\t\t\t\t\t\talt=\"" . __("Updated") . "\">";
            }
            if ($line["unread"] == "t" || $line["unread"] == "1") {
                $class .= "Unread";
                ++$num_unread;
                $is_unread = true;
            } else {
                $is_unread = false;
            }
            if ($line["marked"] == "t" || $line["marked"] == "1") {
                $marked_pic = "<img alt=\"S\" class='marked' src=\"../../images/mark_set.png\">";
            } else {
                $marked_pic = "<img alt=\"s\" class='marked' src=\"../../images/mark_unset.png\">";
            }
            if ($line["published"] == "t" || $line["published"] == "1") {
                $published_pic = "<img alt=\"P\" class='marked' src=\"../../images/pub_set.gif\">";
            } else {
                $published_pic = "<img alt=\"p\" class='marked' src=\"../../images/pub_unset.gif\">";
            }
            $content_link = "<a href=\"?go=view&id={$id}&cat={$cat_view}&ret_feed={$feed}&feed={$feed_id}\">" . $line["title"] . "</a>";
            $updated_fmt = make_local_datetime($link, $line['updated'], false);
            print "<li class='{$class}' id=\"HROW-{$id}\">";
            print "<input type=\"checkbox\" name=\"sel_ids[{$id}]\"\n\t\t\t\t  \tid=\"HSCB-{$id}\" onchange=\"toggleSelectRow(this, {$id})\">";
            print "<a href=\"?go=vf&id={$feed}&ts={$id}&cat={$cat_view}\">{$marked_pic}</a>";
            print "<a href=\"?go=vf&id={$feed}&tp={$id}&cat={$cat_view}\">{$published_pic}</a>";
            print $content_link;
            if ($line["feed_title"]) {
                print " (<a href='?go=vf&id={$feed_id}'>" . $line["feed_title"] . "</a>)";
            }
            print "<span class='hlUpdated'> ({$updated_fmt})</span>";
            print "</li>";
            ++$lnum;
        }
        print "</ul>";
        print "<div class='footerAddon'>";
        $_SESSION["last_page_ids.{$feed}"] = $page_art_ids;
        /*			print "<a href=\"index.php?go=vf&id=$feed&subop=MarkPageRead\">Page</a>, ";
        			print "<a href=\"index.php?go=vf&id=$feed&subop=MarkAllRead\">Feed</a></div>"; */
        print "Select: \n\t\t\t\t<a href=\"javascript:selectHeadlines(1)\">" . __("All") . "</a>,\n\t\t\t\t<a href=\"javascript:selectHeadlines(2)\">" . __("Unread") . "</a>,\n\t\t\t\t<a href=\"javascript:selectHeadlines(3)\">" . __("None") . "</a>,\n\t\t\t\t<a href=\"javascript:selectHeadlines(4)\">" . __("Invert") . "</a>";
        print " ";
        print "<select name=\"catchup_op\">\n\t\t\t\t<option value=\"selection\">" . __("Selection") . "</option>\n\t\t\t\t<option value=\"page\">" . __("Page") . "</option>\n\t\t\t\t<option value=\"feed\">" . __("Entire feed") . "</option>\n\t\t\t</select>\n\t\t\t<input type=\"hidden\" name=\"cat\" value=\"{$cat_view}\">\n\t\t\t<input type=\"submit\" value=\"" . __("Mark as read") . "\">";
        print "</form>";
    } else {
        print "<div align='center'>No articles found.</div>";
    }
}
开发者ID:nougad,项目名称:Tiny-Tiny-RSS,代码行数:101,代码来源:functions.php

示例13: module_pref_instances

function module_pref_instances($link)
{
    if (!SINGLE_USER_MODE && $_SESSION["access_level"] < 10) {
        print __("Your access level is insufficient to open this tab.");
        return;
    }
    $subop = $_REQUEST['subop'];
    if ($subop == "remove") {
        $ids = db_escape_string($_REQUEST['ids']);
        db_query($link, "DELETE FROM ttrss_linked_instances WHERE\n\t\t\t\tid IN ({$ids})");
        return;
    }
    if ($subop == "add") {
        $id = db_escape_string($_REQUEST["id"]);
        $access_url = db_escape_string($_REQUEST["access_url"]);
        $access_key = db_escape_string($_REQUEST["access_key"]);
        db_query($link, "BEGIN");
        $result = db_query($link, "SELECT id FROM ttrss_linked_instances\n\t\t\t\tWHERE access_url = '{$access_url}'");
        if (db_num_rows($result) == 0) {
            db_query($link, "INSERT INTO ttrss_linked_instances\n\t\t\t\t\t(access_url, access_key, last_connected, last_status_in, last_status_out)\n\t\t\t\t\tVALUES\n\t\t\t\t\t('{$access_url}', '{$access_key}', '1970-01-01', -1, -1)");
        }
        db_query($link, "COMMIT");
        return;
    }
    if ($subop == "edit") {
        $id = db_escape_string($_REQUEST["id"]);
        $result = db_query($link, "SELECT * FROM ttrss_linked_instances WHERE\n\t\t\t\tid = '{$id}'");
        print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\"  name=\"id\" value=\"{$id}\">";
        print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\"  name=\"op\" value=\"pref-instances\">";
        print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\"  name=\"subop\" value=\"editSave\">";
        print "<div class=\"dlgSec\">" . __("Instance") . "</div>";
        print "<div class=\"dlgSecCont\">";
        /* URL */
        $access_url = htmlspecialchars(db_fetch_result($result, 0, "access_url"));
        print __("URL:") . " ";
        print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\"\n\t\t\t\tplaceHolder=\"" . __("Instance URL") . "\"\n\t\t\t\tregExp='^(http|https)://.*'\n\t\t\t\tstyle=\"font-size : 16px; width: 20em\" name=\"access_url\"\n\t\t\t\tvalue=\"{$access_url}\">";
        print "<hr/>";
        $access_key = htmlspecialchars(db_fetch_result($result, 0, "access_key"));
        /* Access key */
        print __("Access key:") . " ";
        print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\"\n\t\t\t\tplaceHolder=\"" . __("Access key") . "\" regExp='\\w{40}'\n\t\t\t\tstyle=\"width: 20em\" name=\"access_key\" id=\"instance_edit_key\"\n\t\t\t\tvalue=\"{$access_key}\">";
        print "<p class='insensitive'>" . __("Use one access key for both linked instances.");
        print "</div>";
        print "<div class=\"dlgButtons\">\n\t\t\t\t<div style='float : left'>\n\t\t\t\t\t<button dojoType=\"dijit.form.Button\"\n\t\t\t\t\t\tonclick=\"return dijit.byId('instanceEditDlg').regenKey()\">" . __('Generate new key') . "</button>\n\t\t\t\t</div>\n\t\t\t\t<button dojoType=\"dijit.form.Button\"\n\t\t\t\t\tonclick=\"return dijit.byId('instanceEditDlg').execute()\">" . __('Save') . "</button>\n\t\t\t\t<button dojoType=\"dijit.form.Button\"\n\t\t\t\t\tonclick=\"return dijit.byId('instanceEditDlg').hide()\"\">" . __('Cancel') . "</button></div>";
        return;
    }
    if ($subop == "editSave") {
        $id = db_escape_string($_REQUEST["id"]);
        $access_url = db_escape_string($_REQUEST["access_url"]);
        $access_key = db_escape_string($_REQUEST["access_key"]);
        db_query($link, "UPDATE ttrss_linked_instances SET\n\t\t\t\taccess_key = '{$access_key}', access_url = '{$access_url}',\n\t\t\t\tlast_connected = '1970-01-01'\n\t\t\t\tWHERE id = '{$id}'");
        return;
    }
    if (!function_exists('curl_init')) {
        print "<div style='padding : 1em'>";
        print_error("This functionality requires CURL functions. Please enable CURL in your PHP configuration (you might also want to disable open_basedir in php.ini) and reload this page.");
        print "</div>";
    }
    print "<div id=\"pref-instance-wrap\" dojoType=\"dijit.layout.BorderContainer\" gutters=\"false\">";
    print "<div id=\"pref-instance-header\" dojoType=\"dijit.layout.ContentPane\" region=\"top\">";
    print "<div id=\"pref-instance-toolbar\" dojoType=\"dijit.Toolbar\">";
    $sort = db_escape_string($_REQUEST["sort"]);
    if (!$sort || $sort == "undefined") {
        $sort = "access_url";
    }
    print "<div dojoType=\"dijit.form.DropDownButton\">" . "<span>" . __('Select') . "</span>";
    print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
    print "<div onclick=\"selectTableRows('prefInstanceList', 'all')\"\n\t\t\tdojoType=\"dijit.MenuItem\">" . __('All') . "</div>";
    print "<div onclick=\"selectTableRows('prefInstanceList', 'none')\"\n\t\t\tdojoType=\"dijit.MenuItem\">" . __('None') . "</div>";
    print "</div></div>";
    print "<button dojoType=\"dijit.form.Button\" onclick=\"addInstance()\">" . __('Link instance') . "</button>";
    print "<button dojoType=\"dijit.form.Button\" onclick=\"editSelectedInstance()\">" . __('Edit') . "</button>";
    print "<button dojoType=\"dijit.form.Button\" onclick=\"removeSelectedInstances()\">" . __('Remove') . "</button>";
    print "</div>";
    #toolbar
    $result = db_query($link, "SELECT *,\n\t\t\t(SELECT COUNT(*) FROM ttrss_linked_feeds\n\t\t\t\tWHERE instance_id = ttrss_linked_instances.id) AS num_feeds\n\t\t\tFROM ttrss_linked_instances\n\t\t\tORDER BY {$sort}");
    print "<p class=\"insensitive\" style='margin-left : 1em;'>" . __("You can connect other instances of Tiny Tiny RSS to this one to share Popular feeds. Link to this instance of Tiny Tiny RSS by using this URL:");
    print " <a href=\"#\" onclick=\"alert('" . htmlspecialchars(get_self_url_prefix()) . "')\">(display url)</a>";
    print "<p><table width='100%' id='prefInstanceList' class='prefInstanceList' cellspacing='0'>";
    print "<tr class=\"title\">\n\t\t\t<td align='center' width=\"5%\">&nbsp;</td>\n\t\t\t<td width=''><a href=\"#\" onclick=\"updateInstanceList('access_url')\">" . __('Instance URL') . "</a></td>\n\t\t\t<td width='20%'><a href=\"#\" onclick=\"updateInstanceList('access_key')\">" . __('Access key') . "</a></td>\n\t\t\t<td width='10%'><a href=\"#\" onclick=\"updateUsersList('last_connected')\">" . __('Last connected') . "</a></td>\n\t\t\t<td width='10%'><a href=\"#\" onclick=\"updateUsersList('num_feeds')\">" . __('Stored feeds') . "</a></td>\n\t\t\t</tr>";
    $lnum = 0;
    while ($line = db_fetch_assoc($result)) {
        $class = $lnum % 2 ? "even" : "odd";
        $id = $line['id'];
        $this_row_id = "id=\"LIRR-{$id}\"";
        $line["last_connected"] = make_local_datetime($link, $line["last_connected"], false);
        print "<tr class=\"{$class}\" {$this_row_id}>";
        print "<td align='center'><input onclick='toggleSelectRow(this);'\n\t\t\t\ttype=\"checkbox\" id=\"LICHK-{$id}\"></td>";
        $onclick = "onclick='editInstance({$id}, event)' title='" . __('Click to edit') . "'";
        $access_key = mb_substr($line['access_key'], 0, 4) . '...' . mb_substr($line['access_key'], -4);
        print "<td {$onclick}>" . htmlspecialchars($line['access_url']) . "</td>";
        print "<td {$onclick}>" . htmlspecialchars($access_key) . "</td>";
        print "<td {$onclick}>" . htmlspecialchars($line['last_connected']) . "</td>";
        print "<td {$onclick}>" . htmlspecialchars($line['num_feeds']) . "</td>";
        print "</tr>";
        ++$lnum;
    }
    print "</table>";
    print "</div>";
    #pane
//.........这里部分代码省略.........
开发者ID:nougad,项目名称:Tiny-Tiny-RSS,代码行数:101,代码来源:pref-instances.php

示例14: format_article

function format_article($link, $id, $mark_as_read = true, $zoom_mode = false, $owner_uid = false)
{
    if (!$owner_uid) {
        $owner_uid = $_SESSION["uid"];
    }
    $rv = array();
    $rv['id'] = $id;
    /* we can figure out feed_id from article id anyway, why do we
     * pass feed_id here? let's ignore the argument :( */
    $result = db_query($link, "SELECT feed_id FROM ttrss_user_entries\n\t\t\tWHERE ref_id = '{$id}'");
    $feed_id = (int) db_fetch_result($result, 0, "feed_id");
    $rv['feed_id'] = $feed_id;
    //if (!$zoom_mode) { print "<article id='$id'><![CDATA["; };
    if ($mark_as_read) {
        $result = db_query($link, "UPDATE ttrss_user_entries\n\t\t\t\tSET unread = false,last_read = NOW()\n\t\t\t\tWHERE ref_id = '{$id}' AND owner_uid = {$owner_uid}");
        ccache_update($link, $feed_id, $owner_uid);
    }
    $result = db_query($link, "SELECT id,title,link,content,feed_id,comments,int_id,\n\t\t\t" . SUBSTRING_FOR_DATE . "(updated,1,16) as updated,\n\t\t\t(SELECT site_url FROM ttrss_feeds WHERE id = feed_id) as site_url,\n\t\t\tnum_comments,\n\t\t\ttag_cache,\n\t\t\tauthor,\n\t\t\torig_feed_id,\n\t\t\tnote,\n\t\t\tcached_content\n\t\t\tFROM ttrss_entries,ttrss_user_entries\n\t\t\tWHERE\tid = '{$id}' AND ref_id = id AND owner_uid = {$owner_uid}");
    if ($result) {
        $line = db_fetch_assoc($result);
        $tag_cache = $line["tag_cache"];
        $line["tags"] = get_article_tags($link, $id, $owner_uid, $line["tag_cache"]);
        unset($line["tag_cache"]);
        $line["content"] = sanitize($link, $line["content"], false, $owner_uid, $line["site_url"]);
        global $pluginhost;
        foreach ($pluginhost->get_hooks($pluginhost::HOOK_RENDER_ARTICLE) as $p) {
            $line = $p->hook_render_article($line);
        }
        $num_comments = $line["num_comments"];
        $entry_comments = "";
        if ($num_comments > 0) {
            if ($line["comments"]) {
                $comments_url = htmlspecialchars($line["comments"]);
            } else {
                $comments_url = htmlspecialchars($line["link"]);
            }
            $entry_comments = "<a target='_blank' href=\"{$comments_url}\">{$num_comments} comments</a>";
        } else {
            if ($line["comments"] && $line["link"] != $line["comments"]) {
                $entry_comments = "<a target='_blank' href=\"" . htmlspecialchars($line["comments"]) . "\">comments</a>";
            }
        }
        if ($zoom_mode) {
            header("Content-Type: text/html");
            $rv['content'] .= "<html><head>\n\t\t\t\t\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n\t\t\t\t\t\t<title>Tiny Tiny RSS - " . $line["title"] . "</title>\n\t\t\t\t\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"tt-rss.css\">\n\t\t\t\t\t</head><body>";
        }
        $title_escaped = htmlspecialchars($line['title']);
        $rv['content'] .= "<div id=\"PTITLE-FULL-{$id}\" style=\"display : none\">" . strip_tags($line['title']) . "</div>";
        $rv['content'] .= "<div class=\"postReply\" id=\"POST-{$id}\">";
        $rv['content'] .= "<div class=\"postHeader\" id=\"POSTHDR-{$id}\">";
        $entry_author = $line["author"];
        if ($entry_author) {
            $entry_author = __(" - ") . $entry_author;
        }
        $parsed_updated = make_local_datetime($link, $line["updated"], true, $owner_uid, true);
        $rv['content'] .= "<div class=\"postDate\">{$parsed_updated}</div>";
        if ($line["link"]) {
            $rv['content'] .= "<div class='postTitle'><a target='_blank'\n\t\t\t\t\ttitle=\"" . htmlspecialchars($line['title']) . "\"\n\t\t\t\t\thref=\"" . htmlspecialchars($line["link"]) . "\">" . $line["title"] . "<span class='author'>{$entry_author}</span></a></div>";
        } else {
            $rv['content'] .= "<div class='postTitle'>" . $line["title"] . "{$entry_author}</div>";
        }
        $tags_str = format_tags_string($line["tags"], $id);
        $tags_str_full = join(", ", $line["tags"]);
        if (!$tags_str_full) {
            $tags_str_full = __("no tags");
        }
        if (!$entry_comments) {
            $entry_comments = "&nbsp;";
        }
        # placeholder
        $rv['content'] .= "<div class='postTags' style='float : right'>\n\t\t\t\t<img src='" . theme_image($link, 'images/tag.png') . "'\n\t\t\t\tclass='tagsPic' alt='Tags' title='Tags'>&nbsp;";
        if (!$zoom_mode) {
            $rv['content'] .= "<span id=\"ATSTR-{$id}\">{$tags_str}</span>\n\t\t\t\t\t<a title=\"" . __('Edit tags for this article') . "\"\n\t\t\t\t\thref=\"#\" onclick=\"editArticleTags({$id}, {$feed_id})\">(+)</a>";
            $rv['content'] .= "<div dojoType=\"dijit.Tooltip\"\n\t\t\t\t\tid=\"ATSTRTIP-{$id}\" connectId=\"ATSTR-{$id}\"\n\t\t\t\t\tposition=\"below\">{$tags_str_full}</div>";
            global $pluginhost;
            foreach ($pluginhost->get_hooks($pluginhost::HOOK_ARTICLE_BUTTON) as $p) {
                $rv['content'] .= $p->hook_article_button($line);
            }
        } else {
            $tags_str = strip_tags($tags_str);
            $rv['content'] .= "<span id=\"ATSTR-{$id}\">{$tags_str}</span>";
        }
        $rv['content'] .= "</div>";
        $rv['content'] .= "<div clear='both'>{$entry_comments}</div>";
        if ($line["orig_feed_id"]) {
            $tmp_result = db_query($link, "SELECT * FROM ttrss_archived_feeds\n\t\t\t\t\tWHERE id = " . $line["orig_feed_id"]);
            if (db_num_rows($tmp_result) != 0) {
                $rv['content'] .= "<div clear='both'>";
                $rv['content'] .= __("Originally from:");
                $rv['content'] .= "&nbsp;";
                $tmp_line = db_fetch_assoc($tmp_result);
                $rv['content'] .= "<a target='_blank'\n\t\t\t\t\t\thref=' " . htmlspecialchars($tmp_line['site_url']) . "'>" . $tmp_line['title'] . "</a>";
                $rv['content'] .= "&nbsp;";
                $rv['content'] .= "<a target='_blank' href='" . htmlspecialchars($tmp_line['feed_url']) . "'>";
                $rv['content'] .= "<img title='" . __('Feed URL') . "'class='tinyFeedIcon' src='images/pub_set.svg'></a>";
                $rv['content'] .= "</div>";
            }
        }
        $rv['content'] .= "</div>";
        $rv['content'] .= "<div id=\"POSTNOTE-{$id}\">";
//.........这里部分代码省略.........
开发者ID:rclsilver,项目名称:openshift-tt-rss,代码行数:101,代码来源:functions.php

示例15: outputFeedList

 private function outputFeedList($special = true)
 {
     $feedlist = array();
     $enable_cats = get_pref($this->link, 'ENABLE_FEED_CATS');
     $feedlist['identifier'] = 'id';
     $feedlist['label'] = 'name';
     $feedlist['items'] = array();
     $owner_uid = $_SESSION["uid"];
     /* virtual feeds */
     if ($special) {
         if ($enable_cats) {
             $cat_hidden = get_pref($this->link, "_COLLAPSED_SPECIAL");
             $cat = $this->feedlist_init_cat(-1, $cat_hidden);
         } else {
             $cat['items'] = array();
         }
         foreach (array(-4, -3, -1, -2, 0) as $i) {
             array_push($cat['items'], $this->feedlist_init_feed($i));
         }
         if ($enable_cats) {
             array_push($feedlist['items'], $cat);
         } else {
             $feedlist['items'] = array_merge($feedlist['items'], $cat['items']);
         }
         $result = db_query($this->link, "SELECT * FROM\r\n\t\t\t\tttrss_labels2 WHERE owner_uid = '{$owner_uid}' ORDER by caption");
         if (db_num_rows($result) > 0) {
             if (get_pref($this->link, 'ENABLE_FEED_CATS')) {
                 $cat_hidden = get_pref($this->link, "_COLLAPSED_LABELS");
                 $cat = $this->feedlist_init_cat(-2, $cat_hidden);
             } else {
                 $cat['items'] = array();
             }
             while ($line = db_fetch_assoc($result)) {
                 $label_id = -$line['id'] - 11;
                 $count = getFeedUnread($this->link, $label_id);
                 $feed = $this->feedlist_init_feed($label_id, false, $count);
                 $feed['fg_color'] = $line['fg_color'];
                 $feed['bg_color'] = $line['bg_color'];
                 array_push($cat['items'], $feed);
             }
             if ($enable_cats) {
                 array_push($feedlist['items'], $cat);
             } else {
                 $feedlist['items'] = array_merge($feedlist['items'], $cat['items']);
             }
         }
     }
     /*		if (get_pref($this->link, 'ENABLE_FEED_CATS')) {
     			if (get_pref($this->link, "FEEDS_SORT_BY_UNREAD")) {
     				$order_by_qpart = "order_id,category,unread DESC,title";
     			} else {
     				$order_by_qpart = "order_id,category,title";
     			}
     		} else {
     			if (get_pref($this->link, "FEEDS_SORT_BY_UNREAD")) {
     				$order_by_qpart = "unread DESC,title";
     			} else {
     				$order_by_qpart = "title";
     			}
     		} */
     /* real feeds */
     if ($enable_cats) {
         $order_by_qpart = "ttrss_feed_categories.order_id,category,\r\n\t\t\t\tttrss_feeds.order_id,title";
     } else {
         $order_by_qpart = "title";
     }
     $query = "SELECT ttrss_feeds.id, ttrss_feeds.title,\r\n\t\t\t" . SUBSTRING_FOR_DATE . "(last_updated,1,19) AS last_updated_noms,\r\n\t\t\tcat_id,last_error,\r\n\t\t\tCOALESCE(ttrss_feed_categories.title, '" . __('Uncategorized') . "') AS category,\r\n\t\t\tttrss_feed_categories.collapsed,\r\n\t\t\tvalue AS unread\r\n\t\t\tFROM ttrss_feeds LEFT JOIN ttrss_feed_categories\r\n\t\t\t\tON (ttrss_feed_categories.id = cat_id)\r\n\t\t\tLEFT JOIN ttrss_counters_cache\r\n\t\t\t\tON\r\n\t\t\t\t\t(ttrss_feeds.id = feed_id)\r\n\t\t\tWHERE\r\n\t\t\t\tttrss_feeds.owner_uid = '{$owner_uid}'\r\n\t\t\tORDER BY {$order_by_qpart}";
     $result = db_query($this->link, $query);
     $actid = $_REQUEST["actid"];
     if (db_num_rows($result) > 0) {
         $category = "";
         if (!$enable_cats) {
             $cat['items'] = array();
         } else {
             $cat = false;
         }
         while ($line = db_fetch_assoc($result)) {
             $feed = htmlspecialchars(trim($line["title"]));
             if (!$feed) {
                 $feed = "[Untitled]";
             }
             $feed_id = $line["id"];
             $unread = $line["unread"];
             $cat_id = $line["cat_id"];
             $tmp_category = $line["category"];
             if ($category != $tmp_category && $enable_cats) {
                 $category = $tmp_category;
                 $collapsed = sql_bool_to_bool($line["collapsed"]);
                 // workaround for NULL category
                 if ($category == __("Uncategorized")) {
                     $collapsed = get_pref($this->link, "_COLLAPSED_UNCAT");
                 }
                 if ($cat) {
                     array_push($feedlist['items'], $cat);
                 }
                 $cat = $this->feedlist_init_cat($cat_id, $collapsed);
             }
             $updated = make_local_datetime($this->link, $line["updated_noms"], false);
             array_push($cat['items'], $this->feedlist_init_feed($feed_id, $feed, $unread, $line['last_error'], $updated));
         }
//.........这里部分代码省略.........
开发者ID:4iji,项目名称:Tiny-Tiny-RSS,代码行数:101,代码来源:feeds.php


注:本文中的make_local_datetime函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。