Example #1
0
if (getmoduleoption('ratenews')) {
    $xoopsTpl->assign('rates', true);
    $xoopsTpl->assign('lang_ratingc', _NW_RATINGC);
    $xoopsTpl->assign('lang_ratethisnews', _NW_RATETHISNEWS);
    $story['rating'] = number_format($article->rating(), 2);
    if ($article->votes == 1) {
        $story['votes'] = _NW_ONEVOTE;
    } else {
        $story['votes'] = sprintf(_NW_NUMVOTES, $article->votes);
    }
} else {
    $xoopsTpl->assign('rates', false);
}
$xoopsTpl->assign('story', $story);
/**
* META Keywords and description
*
* If you have set this module's option to 'yes' and if the information was entered, then they are rendered in the page else they are computed
*/
if (trim($article->keywords()) != '') {
    $xoopsTpl->assign('xoops_meta_keywords', $article->keywords());
} else {
    $xoopsTpl->assign('xoops_meta_keywords', news_createmeta_keywords($story['text']));
}
if (trim($article->description()) != '') {
    $xoopsTpl->assign('xoops_meta_description', $article->description());
} else {
    $xoopsTpl->assign('xoops_meta_description', $article->title());
}
include_once XOOPS_ROOT_PATH . '/include/comment_view.php';
include_once XOOPS_ROOT_PATH . '/footer.php';
Example #2
0
$gperm_handler =& xoops_gethandler('groupperm');
if (is_object($xoopsUser)) {
    $groups = $xoopsUser->getGroups();
} else {
    $groups = XOOPS_GROUP_ANONYMOUS;
}
if (!$gperm_handler->checkRight('news_view', $story->topicid(), $groups, $xoopsModule->getVar('mid'))) {
    redirect_header(XOOPS_URL . '/modules/news/index.php', 3, _NOPERM);
    exit;
}
$xoops_meta_keywords = '';
$xoops_meta_description = '';
if (trim($story->keywords()) != '') {
    $xoops_meta_keywords = $story->keywords();
} else {
    $xoops_meta_keywords = news_createmeta_keywords($story->hometext() . ' ' . $story->bodytext());
}
if (trim($story->description()) != '') {
    $xoops_meta_description = $story->description();
} else {
    $xoops_meta_description = strip_tags($story->title());
}
function PrintPage()
{
    global $xoopsConfig, $xoopsModule, $story, $xoops_meta_keywords, $xoops_meta_description;
    $myts =& MyTextSanitizer::getInstance();
    $datetime = formatTimestamp($story->published(), news_getmoduleoption('dateformat'));
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xml:lang="<?php 
Example #3
0
/**
 * Creates all the meta datas :
 * - For Mozilla/Netscape and Opera the site navigation's bar
 * - The Dublin's Core Metadata
 * - The link for Firefox 2 micro summaries
 * - The meta keywords
 * - The meta description
 *
 * @package News
 * @author Instant Zero (http://xoops.instant-zero.com)
 * @copyright (c) Instant Zero
 */
function news_CreateMetaDatas($story = null)
{
    global $xoopsConfig, $xoTheme, $xoopsTpl;
    $content = '';
    $myts =& MyTextSanitizer::getInstance();
    include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newstopic.php';
    /**
     * Firefox and Opera Navigation's Bar
     */
    if (news_getmoduleoption('sitenavbar')) {
        $content .= sprintf("<link rel=\"Home\" title=\"%s\" href=\"%s/\" />\n", $xoopsConfig['sitename'], XOOPS_URL);
        $content .= sprintf("<link rel=\"Contents\" href=\"%s\" />\n", XOOPS_URL . '/modules/news/index.php');
        $content .= sprintf("<link rel=\"Search\" href=\"%s\" />\n", XOOPS_URL . '/search.php');
        $content .= sprintf("<link rel=\"Glossary\" href=\"%s\" />\n", XOOPS_URL . '/modules/news/archive.php');
        $content .= sprintf("<link rel=\"%s\" href=\"%s\" />\n", $myts->htmlSpecialChars(_NW_SUBMITNEWS), XOOPS_URL . '/modules/news/submit.php');
        $content .= sprintf("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"%s\" href=\"%s/\" />\n", $xoopsConfig['sitename'], XOOPS_URL . '/backend.php');
        // Create chapters
        include_once XOOPS_ROOT_PATH . '/class/tree.php';
        include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newstopic.php';
        $xt = new NewsTopic();
        $allTopics = $xt->getAllTopics(news_getmoduleoption('restrictindex'));
        $topic_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid');
        $topics_arr = $topic_tree->getAllChild(0);
        foreach ($topics_arr as $onetopic) {
            $content .= sprintf("<link rel=\"Chapter\" title=\"%s\" href=\"%s\" />\n", $onetopic->topic_title(), XOOPS_URL . '/modules/news/index.php?storytopic=' . $onetopic->topic_id());
        }
    }
    /**
     * Meta Keywords and Description
     * If you have set this module's option to 'yes' and if the information was entered, then they are rendered in the page else they are computed
     */
    $meta_keywords = '';
    if (isset($story) && is_object($story)) {
        if (xoops_trim($story->keywords()) != '') {
            $meta_keywords = $story->keywords();
        } else {
            $meta_keywords = news_createmeta_keywords($story->hometext() . ' ' . $story->bodytext());
        }
        if (xoops_trim($story->description()) != '') {
            $meta_description = $story->description();
        } else {
            $meta_description = strip_tags($story->title());
        }
        if (isset($xoTheme) && is_object($xoTheme)) {
            $xoTheme->addMeta('meta', 'keywords', $meta_keywords);
            $xoTheme->addMeta('meta', 'description', $meta_description);
        } elseif (isset($xoopsTpl) && is_object($xoopsTpl)) {
            // Compatibility for old Xoops versions
            $xoopsTpl->assign('xoops_meta_keywords', $meta_keywords);
            $xoopsTpl->assign('xoops_meta_description', $meta_description);
        }
    }
    /**
     * Dublin Core's meta datas
     */
    if (news_getmoduleoption('dublincore') && isset($story) && is_object($story)) {
        $config_handler =& xoops_gethandler('config');
        $xoopsConfigMetaFooter =& $config_handler->getConfigsByCat(XOOPS_CONF_METAFOOTER);
        $content .= '<meta name="DC.Title" content="' . DublinQuotes($story->title()) . "\" />\n";
        $content .= '<meta name="DC.Creator" content="' . DublinQuotes($story->uname()) . "\" />\n";
        $content .= '<meta name="DC.Subject" content="' . DublinQuotes($meta_keywords) . "\" />\n";
        $content .= '<meta name="DC.Description" content="' . DublinQuotes($story->title()) . "\" />\n";
        $content .= '<meta name="DC.Publisher" content="' . DublinQuotes($xoopsConfig['sitename']) . "\" />\n";
        $content .= '<meta name="DC.Date.created" scheme="W3CDTF" content="' . date('Y-m-d', $story->created) . "\" />\n";
        $content .= '<meta name="DC.Date.issued" scheme="W3CDTF" content="' . date('Y-m-d', $story->published) . "\" />\n";
        $content .= '<meta name="DC.Identifier" content="' . XOOPS_URL . '/modules/news/article.php?storyid=' . $story->storyid() . "\" />\n";
        $content .= '<meta name="DC.Source" content="' . XOOPS_URL . "\" />\n";
        $content .= '<meta name="DC.Language" content="' . _LANGCODE . "\" />\n";
        $content .= '<meta name="DC.Relation.isReferencedBy" content="' . XOOPS_URL . '/modules/news/index.php?storytopic=' . $story->topicid() . "\" />\n";
        if (isset($xoopsConfigMetaFooter['meta_copyright'])) {
            $content .= '<meta name="DC.Rights" content="' . DublinQuotes($xoopsConfigMetaFooter['meta_copyright']) . "\" />\n";
        }
    }
    /**
     * Firefox 2 micro summaries
     */
    if (news_getmoduleoption('firefox_microsummaries')) {
        $content .= sprintf("<link rel=\"microsummary\" href=\"%s\" />\n", XOOPS_URL . '/modules/news/micro_summary.php');
    }
    if (isset($xoopsTpl) && is_object($xoopsTpl)) {
        $xoopsTpl->assign('xoops_module_header', $content);
    }
}