Example #1
0
    } else {
        $current_groups = array(-1);
    }
    if (0 == count($current_groups)) {
        $current_groups = array(-1);
    }
} else {
    $current_user = -1;
    $current_groups = array(-1);
}
//
// Initalizing static string wrapper
//
PMF_String::init($LANGCODE);
$faq = new PMF_Faq($current_user, $current_groups);
$rssData = $faq->getTopTenData(PMF_NUMBER_RECORDS_TOPTEN);
$num = count($rssData);
$rss = new XMLWriter();
$rss->openMemory();
$rss->setIndent(true);
$rss->startDocument('1.0', 'utf-8');
$rss->startElement('rss');
$rss->writeAttribute('version', '2.0');
$rss->startElement('channel');
$rss->writeElement('title', $faqconfig->get('main.titleFAQ') . ' - ' . $PMF_LANG['msgTopTen']);
$rss->writeElement('description', html_entity_decode($faqconfig->get('main.metaDescription')));
$rss->writeElement('link', PMF_Link::getSystemUri('/feed/topten/rss.php'));
if ($num > 0) {
    $i = 0;
    foreach ($rssData as $item) {
        $i++;
Example #2
0
    return $node;
}
//
// Future improvements
// WHEN a User PMF Sitemap will be:
//   a. bigger than 10MB (!)
//   b. w/ more than 50K URLs (!)
// we'll manage this issue using a Sitemap Index Files produced by this PHP code
// including Sitemap URLs always produced by this same PHP code (see PMF_SITEMAP_GOOGLE_GET_INDEX)
//
PMF_Init::cleanRequest();
session_name(PMF_COOKIE_NAME_AUTH . trim($faqconfig->get('main.phpMyFAQToken')));
session_start();
$oFaq = new PMF_Faq();
// Load the faq
$items = $oFaq->getTopTenData(PMF_SITEMAP_GOOGLE_MAX_URLS - 1);
$visitsMax = 0;
$visitMin = 0;
if (count($items) > 0) {
    $visitsMax = $items[0]['visits'];
    $visitMin = $items[count($items) - 1]['visits'];
}
// Sitemap header
$sitemap = '<?xml version="1.0" encoding="UTF-8"?>' . '<urlset xmlns="http://www.google.com/schemas/sitemap/0.84"' . ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . ' xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84' . ' http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">';
// 1st entry: the faq server itself
$sitemap .= buildSitemapNode(PMF_Link::getSystemUri('/sitemap.google.php'), PMF_Date::createISO8601Date($_SERVER['REQUEST_TIME'], false), PMF_SITEMAP_GOOGLE_CHANGEFREQ_DAILY, PMF_SITEMAP_GOOGLE_PRIORITY_MAX);
// nth entry: each faq
foreach ($items as $item) {
    $priority = PMF_SITEMAP_GOOGLE_PRIORITY_DEFAULT;
    if ($visitsMax - $visitMin > 0) {
        $priority = sprintf('%.1f', PMF_SITEMAP_GOOGLE_PRIORITY_DEFAULT * (1 + ($item['visits'] - $visitMin) / ($visitsMax - $visitMin)));
Example #3
0
function printHTTPStatus404()
{
    if ('cgi' == substr(php_sapi_name(), 0, 3) || isset($_SERVER['ALL_HTTP'])) {
        header('Status: 404 Not Found');
    } else {
        header('HTTP/1.0 404 Not Found');
    }
    exit;
}
// }}}
PMF_Init::cleanRequest();
session_name(PMF_COOKIE_NAME_AUTH . trim($faqconfig->get('main.phpMyFAQToken')));
session_start();
$oFaq = new PMF_Faq();
// Load the faq
$items = $oFaq->getTopTenData(PMF_SITEMAP_YAHOO_MAX_URLS - 1);
$sitemap = '';
// 1st entry: the faq server itself
$sitemap .= PMF_Link::getSystemUri('/sitemap.yahoo.php') . PMF_SITEMAP_YAHOO_END_OF_LINE;
// nth entry: each faq
foreach ($items as $item) {
    // a. We use plain PMF urls w/o any SEO schema
    $link = str_replace($_SERVER['PHP_SELF'], '/index.php', $item['url']);
    // b. We use SEO PMF urls
    if (PMF_SITEMAP_YAHOO_USE_SEO) {
        if (isset($item['thema'])) {
            $oL = new PMF_Link($link);
            $oL->itemTitle = $item['thema'];
            $link = $oL->toString();
        }
    }