Exemplo n.º 1
0
function get_permalink($id)
{
    return getmyFullurl("story", $id);
}
Exemplo n.º 2
0
if (!preg_match("/^[hf]t[t]?p[s]?:\\/\\//", $tb_url)) {
    $tb_url = "";
}
/////
if (!empty($charset)) {
    $title = @iconv($charset, 'UTF-8//IGNORE', $title);
    $excerpt = @iconv($charset, 'UTF-8//IGNORE', $excerpt);
    $blog_name = @iconv($charset, 'UTF-8//IGNORE', $blog_name);
}
$tb_id = strip_tags($_GET['id']);
if (!is_numeric($tb_id)) {
    trackback_response(1, 'I really need an ID for this to work.');
}
if (empty($title) && empty($tb_url) && empty($blog_name)) {
    // If it doesn't look like a trackback at all...
    header('Location: ' . getmyFullurl("story", $tb_id));
    exit;
}
if (!empty($tb_url) && !empty($title) && !empty($tb_url)) {
    header('Content-Type: text/xml; charset=UTF-8');
    $title = htmlspecialchars(strip_tags($title));
    $title = strlen($title) > 150 ? substr($title, 0, 150) . '...' : $title;
    $excerpt = strip_tags($excerpt);
    $excerpt = strlen($excerpt) > 200 ? substr($excerpt, 0, 200) . '...' : $excerpt;
    $trackres = new Trackback();
    $trackres->link = $tb_id;
    $trackres->type = 'in';
    $trackres->url = $tb_url;
    $dupe = $trackres->read();
    if ($dupe) {
        trackback_response(1, $main_smarty->get_config_vars('PLIGG_Visual_Trackback_AlreadyPing'));
Exemplo n.º 3
0
        $description = preg_replace('/\\r/', ' ', $description);
        $description = preg_replace('/\\n/', ' <br />', $description);
        echo "\t<description><![CDATA[ " . $description . " ]]></description>\n";
        if (!empty($link_date)) {
            echo "\t<pubDate>" . date('D, d M Y H:i:s T', $link->{$link_date} - misc_timezone * 3600) . "</pubDate>\n";
        } else {
            echo "\t<pubDate>" . date('D, d M Y H:i:s T', time() - misc_timezone * 3600) . "</pubDate>\n";
        }
        echo "\t<dc:creator>" . htmlspecialchars($user->username) . "</dc:creator>\n";
        echo "\t<category>" . htmlspecialchars($category_name) . "</category>\n";
        // Calculate total vote count based on votes-downvotes
        $vote_total = $link->votes - $link->reports;
        echo "\t<votes>" . $vote_total . "</votes>\n";
        echo "\t<upvotes>" . $link->votes . "</upvotes>\n";
        echo "\t<downvotes>" . $link->reports . "</downvotes>\n";
        echo "\t<guid>" . getmyFullurl("storyURL", $link->category_safe_names($link->category), urlencode($link->title_url), $link->id) . "</guid>\n";
        // module system hook
        $vars = array('item' => $link);
        check_actions('rss_item', $vars);
        echo "</item>\n\n";
    }
}
// module system hook
$vars = '';
check_actions('rss_end_data', $vars);
do_rss_footer();
function do_rss_header($title)
{
    global $last_modified, $dblang, $main_smarty;
    header('Content-type: text/xml; charset=utf-8', true);
    echo '<?xml version="1.0"?>' . "\n";
Exemplo n.º 4
0
function do_rss_header($link)
{
    global $last_modified, $dblang, $main_smarty;
    header('Content-type: text/xml; charset=utf-8', true);
    echo '<?phpxml version="1.0" encoding="utf-8"?' . '>' . "\n";
    echo '<rss version="2.0" ' . "\n";
    echo 'xmlns:content="http://purl.org/rss/1.0/modules/content/"' . "\n";
    echo 'xmlns:wfw="http://wellformedweb.org/CommentAPI/"' . "\n";
    echo 'xmlns:dc="http://purl.org/dc/elements/1.1/"' . "\n";
    echo '>' . "\n";
    echo '<channel>' . "\n";
    echo '<title>' . htmlspecialchars($main_smarty->get_config_vars("PLIGG_Visual_Name")) . " - " . $link->title . '</title>' . "\n";
    echo "<link>" . getmyFullurl("storyURL", $link->category_safe_name($link->category), urlencode($link->title_url), $link->id) . "</link>\n";
    echo '<description>' . strip_tags($link->truncate_content()) . '</description>' . "\n";
    if (!empty($link->date)) {
        echo '<pubDate>' . date('D, d M Y H:i:s T', $link->date) . '</pubDate>' . "\n";
    } else {
        echo "<pubDate>" . date('D, d M Y H:i:s T', time()) . "</pubDate>\n";
    }
    echo '<language>' . $dblang . '</language>' . "\n";
}
Exemplo n.º 5
0
        $link->content = str_replace("–", "-", $link->content);
        $link->content = str_replace("—", "-", $link->content);
        $link->content = str_replace("“", "\"", $link->content);
        $link->content = str_replace("”", "\"", $link->content);
        echo "<item>\n";
        echo "<title><![CDATA[" . $link->title . "]]></title>\n";
        echo "<link>" . getmyFullurl("storyURL", $link->category_safe_name($link->category), $link->title_url, $link->id) . "</link>\n";
        echo "<comments>" . getmyFullurl("storyURL", $link->category_safe_name($link->category), $link->title_url, $link->id) . "</comments>\n";
        if (!empty($link_date)) {
            echo "<pubDate>" . date("r", $link->{$link_date}) . "</pubDate>\n";
        } else {
            echo "<pubDate>" . date("r", time()) . "</pubDate>\n";
        }
        echo "<dc:creator>" . $dblink->user_login . "</dc:creator>\n";
        echo "<category>" . htmlspecialchars($category_name) . "</category>\n";
        echo "<guid>" . getmyFullurl("storyURL", $link->category_safe_name($link->category), $link->title_url, $link->id) . "</guid>\n";
        echo "<description><![CDATA[" . $link->content . "<br/><br/>" . $link->votes . " " . $main_smarty->get_config_vars('PLIGG_Visual_RSS_Votes') . " ]]></description>\n";
        echo "</item>\n\n";
    }
}
do_rss_footer();
function do_rss_header($title)
{
    global $last_modified, $dblang, $login, $main_smarty;
    header('Content-type: text/xml; charset=utf-8', true);
    echo '<?phpxml version="1.0" encoding="utf-8"?' . '>' . "\n";
    echo '<rss version="2.0" ' . "\n";
    echo 'xmlns:content="http://purl.org/rss/1.0/modules/content/"' . "\n";
    echo 'xmlns:wfw="http://wellformedweb.org/CommentAPI/"' . "\n";
    echo 'xmlns:dc="http://purl.org/dc/elements/1.1/"' . "\n";
    echo '>' . "\n";
Exemplo n.º 6
0
function create_sitemap_pages()
{
    global $db, $my_base_url, $my_pligg_base, $URLMethod;
    if (XmlSitemaps_use_cache) {
        $icf = "cache/sitemap-pages.xml";
        if (file_exists($icf) && ($s = stat($icf)) && time() - $s['mtime'] < XmlSitemaps_cache_ttl) {
            echo my_file_get_contents($icf);
            return true;
        }
        ob_start();
    }
    echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
    echo '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/09/sitemap.xsd"     xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
    $sql = "SELECT link_modified  FROM " . table_links . " WHERE link_status!='discard' ORDER BY link_modified DESC LIMIT 1";
    $res = $db->get_col($sql);
    if (isset($res[0])) {
        $path = "{$my_base_url}{$my_pligg_base}";
        create_entry(strtotime($res[0]), $path);
    }
    ///////////////// Upcoming.............
    $sql = "SELECT UNIX_TIMESTAMP(link_date)  FROM " . table_links . " WHERE link_status='queued' ORDER BY link_date DESC LIMIT 1";
    $res = $db->get_col($sql);
    if (isset($res[0])) {
        if ($URLMethod == 1) {
            $path = "{$my_base_url}{$my_pligg_base}/upcoming.php";
        } else {
            if ($URLMethod == 2) {
                $path = "{$my_base_url}{$my_pligg_base}/upcoming";
            }
        }
        create_entry($res[0], $path);
    }
    //////////////////////...........categories.................
    $sql = "SELECT category_id,category_name,category_safe_name FROM " . table_categories . " WHERE category_enabled=1 AND category_name!='new category'";
    $cat = $db->get_results($sql);
    foreach ($cat as $i) {
        $sql = "SELECT UNIX_TIMESTAMP(link_published_date),link_id FROM " . table_links . " WHERE link_category=" . $i->category_id . " AND link_status='published' ORDER BY link_published_date DESC LIMIT 1";
        $res = $db->get_col($sql);
        if (isset($res[0])) {
            $path = getmyFullurl('maincategory', urlencode($i->category_safe_name));
            create_entry($res[0], $path);
        }
    }
    ////////////////////.............upcoming categories..........
    foreach ($cat as $i) {
        $sql = "SELECT UNIX_TIMESTAMP(link_date) FROM " . table_links . " WHERE link_category=" . $i->category_id . " AND link_status='queued' ORDER BY link_date DESC LIMIT 1";
        $res = $db->get_col($sql);
        if (isset($res[0])) {
            $path = getmyFullurl('queuedcategory', urlencode($i->category_safe_name));
            create_entry($res[0], $path);
        }
    }
    if (check_for_enabled_module('extra_pages', 0.1)) {
        //.............Tips page...............
        $sql = "SELECT UNIX_TIMESTAMP(modified_date) FROM " . table_prefix . "extra_pages  WHERE type='Tip' ORDER BY modified_date DESC LIMIT 1";
        $res = $db->get_col($sql);
        if (isset($res[0])) {
            if ($URLMethod == 1) {
                $path = "{$my_base_url}{$my_pligg_base}/module.php?module=extra_pages&amp;action=show_tips";
            } else {
                if ($URLMethod == 2) {
                    $path = "{$my_base_url}{$my_pligg_base}/tips";
                }
            }
            create_entry($res[0], $path);
        }
        //.............FAQ page................
        $sql = "SELECT UNIX_TIMESTAMP(modified_date) FROM " . table_prefix . "extra_pages  WHERE type='FAQ' ORDER BY modified_date DESC LIMIT 1";
        $res = $db->get_col($sql);
        if (isset($res[0])) {
            if ($URLMethod == 1) {
                $path = "{$my_base_url}{$my_pligg_base}/module.php?module=extra_pages&amp;action=show_faq";
            } else {
                if ($URLMethod == 2) {
                    $path = "{$my_base_url}{$my_pligg_base}/faq";
                }
            }
            create_entry($res[0], $path);
        }
    }
    //close xml
    echo '</urlset>';
    if (XmlSitemaps_use_cache) {
        $ret = ob_get_contents();
        ob_end_flush();
        my_file_put_contents($icf, $ret);
    }
    return true;
}
Exemplo n.º 7
0
function sitemap_add_page($name, $sql)
{
    global $db;
    $res = $db->get_var($sql);
    if ($res) {
        create_entry($res, getmyFullurl($name));
    }
}