Ejemplo n.º 1
0
// This file is part of Pipecode.
//
// Pipecode is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Pipecode is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Pipecode.  If not, see <http://www.gnu.org/licenses/>.
//
include "feed.php";
header("Content-Type: text/plain");
header_expires();
$row = run_sql("select fid, uri, time from feed");
for ($i = 0; $i < count($row); $i++) {
    $fid = $row[$i]["fid"];
    $uri = $row[$i]["uri"];
    $time = $row[$i]["time"];
    if (time() > $time + 60 * 5) {
        print "downloading fid [{$fid}] uri [{$uri}] ";
        $data = download_feed($uri);
        print "len [" . strlen($data) . "]\n";
        save_feed($fid, $data);
    }
}
print "done";
Ejemplo n.º 2
0
function print_header($title = "", $link_name = array(), $link_icon = array(), $link_url = array())
{
    global $request_script;
    global $auth_zid;
    global $auth_user;
    global $user_page;
    global $server_title;
    global $server_name;
    global $https_enabled;
    global $request_script;
    global $javascript_enabled;
    global $protocol;
    global $story_image_enabled;
    header_expires();
    header("Content-Type: text/html; charset=utf-8");
    writeln('<!DOCTYPE html>');
    writeln('<html>');
    writeln('<head>');
    if ($title != "") {
        $title .= " - ";
    }
    if ($user_page == "") {
        $title .= $server_title;
    } else {
        $title .= $user_page . '.' . $server_name;
    }
    writeln('<title>' . $title . '</title>');
    writeln('<meta http-equiv="Content-type" content="text/html;charset=UTF-8">');
    writeln('<link rel="stylesheet" href="/style.css" type="text/css"/>');
    if ($request_script == "/") {
        writeln('<link rel="alternate" href="/atom" type="application/atom+xml" title="Stories">');
    }
    if ($javascript_enabled) {
        writeln('<script type="text/javascript" src="/lib/jquery/jquery.js"></script>');
        writeln('<script type="text/javascript" src="/common.js"></script>');
    }
    writeln('</head>');
    writeln('<body>');
    writeln('<header>');
    writeln('<table class="title">');
    writeln('	<tr>');
    if ($user_page == "") {
        writeln('		<td><a href="/"><img alt="' . $server_title . '" src="/images/logo-top.png"/></a></td>');
    } else {
        writeln('		<td><a href="' . $protocol . '://' . $server_name . '/"><img alt="' . $server_title . '" src="/images/logo-top.png"/></a></td>');
    }
    if ($user_page == "") {
        if ($auth_zid == "") {
            $link_name[] = "Submit";
            $link_name[] = "Sign Up";
            $link_name[] = "Sign In";
        } else {
            $link_name[] = "Submit";
            $link_name[] = "Home";
            $link_name[] = "Sign Out";
        }
    } else {
        if ($auth_zid == "") {
            $link_name[] = "Sign In";
        } else {
            if ($_SERVER["REQUEST_URI"] != "/menu/") {
                $link_name[] = "Home";
            }
            $link_name[] = "Sign Out";
        }
    }
    writeln("\t\t<td class=\"title_links\">");
    for ($i = 0; $i < count($link_name); $i++) {
        $name = $link_name[$i];
        $icon = "";
        $link = "";
        if ($name == "Submit") {
            $icon = "notepad";
            $link = "/submit";
        } else {
            if ($name == "Home") {
                $icon = "home";
                $link = user_page_link($auth_zid) . "menu/";
            } else {
                if ($name == "Sign Up") {
                    $icon = "contact-new";
                    $link = ($https_enabled ? "https" : $protocol) . "://{$server_name}/sign_up";
                } else {
                    if ($name == "Sign In") {
                        $icon = "users";
                        $link = ($https_enabled ? "https" : $protocol) . "://{$server_name}/sign_in";
                    } else {
                        if ($name == "Sign Out") {
                            $icon = "exit";
                            $link = "{$protocol}://{$server_name}/sign_out";
                        }
                    }
                }
            }
        }
        if ($icon == "") {
            $icon = $link_icon[$i];
        }
        if ($link == "") {
            $link = $link_url[$i];
        }
        writeln("\t\t\t<a href=\"{$link}\" class=\"icon_16\" style=\"background-image: url('/images/{$icon}-16.png')\">{$name}</a>" . ($i == count($link_name) - 1 ? '' : ' | '));
    }
    writeln("\t\t</td>");
    writeln('	</tr>');
    writeln('</table>');
    writeln('</header>');
    if ($story_image_enabled && $user_page == "") {
        writeln('<img alt="Story" class="story_image" src="/images/logo-256.png"/>');
    }
}