コード例 #1
0
function b_news_topics_show()
{
    global $storytopic;
    // Don't know why this is used and where it's coming from ....
    include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
    include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newstopic.php';
    include_once XOOPS_ROOT_PATH . "/modules/news/class/tree.php";
    $jump = XOOPS_URL . '/modules/news/index.php?storytopic=';
    $storytopic = !empty($storytopic) ? intval($storytopic) : 0;
    $restricted = news_getmoduleoption('restrictindex');
    $xt = new NewsTopic();
    $allTopics = $xt->getAllTopics($restricted);
    $topic_tree = new MyXoopsObjectTree($allTopics, 'topic_id', 'topic_pid');
    $additional = " onchange='location=\"" . $jump . "\"+this.options[this.selectedIndex].value'";
    $block['selectbox'] = $topic_tree->makeSelBox('storytopic', 'topic_title', '-- ', '', true, 0, $additional);
    return $block;
}
コード例 #2
0
include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
include_once XOOPS_ROOT_PATH . '/modules/news/config.php';
$sform = new XoopsThemeForm(_NW_SUBMITNEWS, "storyform", XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/submit.php');
$sform->setExtra('enctype="multipart/form-data"');
$sform->addElement(new XoopsFormText(_NW_TITLE, 'title', 50, 255, $title), true);
// Topic's selection box
if (!isset($xt)) {
    $xt = new NewsTopic();
}
if ($xt->getAllTopicsCount() == 0) {
    redirect_header("index.php", 4, _NW_POST_SORRY);
    exit;
}
include_once XOOPS_ROOT_PATH . "/class/tree.php";
$allTopics = $xt->getAllTopics($xoopsModuleConfig['restrictindex'], 'news_submit');
$topic_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid');
$topic_select = $topic_tree->makeSelBox('topic_id', 'topic_title', '-- ', $topicid, false);
$sform->addElement(new XoopsFormLabel(_NW_TOPIC, $topic_select));
//If admin - show admin form
//TODO: Change to "If submit privilege"
if ($approveprivilege) {
    //Show topic image?
    $sform->addElement(new XoopsFormRadioYN(_AM_TOPICDISPLAY, 'topicdisplay', $topicdisplay));
    //Select image position
    $posselect = new XoopsFormSelect(_AM_TOPICALIGN, 'topicalign', $topicalign);
    $posselect->addOption('R', _AM_RIGHT);
    $posselect->addOption('L', _AM_LEFT);
    $sform->addElement($posselect);
    //Publish in home?
    //TODO: Check that pubinhome is 0 = no and 1 = yes (currently vice versa)
コード例 #3
0
ファイル: index.php プロジェクト: BackupTheBerlios/soopa
 if ($xoopsModuleConfig['ratenews']) {
     $xoopsTpl->assign('rates', true);
     $xoopsTpl->assign('lang_ratingc', _NW_RATINGC);
     $xoopsTpl->assign('lang_ratethisnews', _NW_RATETHISNEWS);
 } else {
     $xoopsTpl->assign('rates', false);
 }
 if ($xoopsOption['storytopic']) {
     $xt->getTopic($xoopsOption['storytopic']);
     $xoopsTpl->assign('topic_description', $xt->topic_description('S'));
     $xoopsTpl->assign('topic_color', '#' . $xt->topic_color('S'));
     $topictitle = $xt->topic_title();
 }
 if ($xoopsModuleConfig['displaynav'] == 1) {
     $xoopsTpl->assign('displaynav', true);
     $allTopics = $xt->getAllTopics($xoopsModuleConfig['restrictindex']);
     $topic_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid');
     $topic_select = $topic_tree->makeSelBox('storytopic', 'topic_title', '-- ', $xoopsOption['storytopic'], true);
     $xoopsTpl->assign('topic_select', $topic_select);
     $storynum_options = '';
     for ($i = 5; $i <= 30; $i = $i + 5) {
         $sel = '';
         if ($i == $xoopsOption['storynum']) {
             $sel = ' selected="selected"';
         }
         $storynum_options .= '<option value="' . $i . '"' . $sel . '>' . $i . '</option>';
     }
     $xoopsTpl->assign('storynum_options', $storynum_options);
 } else {
     $xoopsTpl->assign('displaynav', false);
 }
コード例 #4
0
ファイル: index.php プロジェクト: BackupTheBerlios/soopa
/**
* News export
*
* You can use this function in the module's admin when you click on the tab named "News Export"
* First select a range of date, possibly a range of topics and if you want, check the option "Include Topics Definitions"
* to also export the topics.
* News, and topics, will be exported to the XML format.
*/
function NewsExport()
{
    global $xoopsDB;
    include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
    xoops_cp_header();
    adminmenu(4);
    echo "<br />";
    $sform = new XoopsThemeForm(_AM_NEWS_EXPORT_NEWS, "exportform", XOOPS_URL . '/modules/news/admin/index.php', 'post');
    $dates_tray = new XoopsFormElementTray(_AM_NEWS_EXPORT_BETWEEN);
    $date1 = new XoopsFormTextDateSelect('', 'date1', 15, time());
    $date2 = new XoopsFormTextDateSelect(_AM_NEWS_EXPORT_AND, 'date2', 15, time());
    $dates_tray->addElement($date1);
    $dates_tray->addElement($date2);
    $sform->addElement($dates_tray);
    $topiclist = new XoopsFormSelect(_AM_NEWS_PRUNE_TOPICS, 'export_topics', '', 5, true);
    $topics_arr = array();
    $xt = new NewsTopic();
    $allTopics = $xt->getAllTopics(false);
    // The webmaster can see everything
    $topic_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid');
    $topics_arr = $topic_tree->getAllChild(0);
    if (count($topics_arr)) {
        foreach ($topics_arr as $onetopic) {
            $topiclist->addOption($onetopic->topic_id(), $onetopic->topic_title());
        }
    }
    $topiclist->setDescription(_AM_NEWS_EXPORT_PRUNE_DSC);
    $sform->addElement($topiclist, false);
    $sform->addElement(new XoopsFormRadioYN(_AM_NEWS_EXPORT_INCTOPICS, 'includetopics', 0), false);
    $sform->addElement(new XoopsFormHidden('op', 'launchexport'), false);
    $button_tray = new XoopsFormElementTray('', '');
    $submit_btn = new XoopsFormButton('', 'post', _SUBMIT, 'submit');
    $button_tray->addElement($submit_btn);
    $sform->addElement($button_tray);
    $sform->display();
}
コード例 #5
0
if (is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $modversion['dirname'] && $xoopsModule->getVar('isactive')) {
    // 2) If there's no topics to display as sub menus we can go on
    if (!isset($_SESSION['items_count']) || $_SESSION['items_count'] == -1) {
        $sql = "SELECT COUNT(*) as cpt FROM " . $xoopsDB->prefix("topics") . " WHERE menu=1";
        $result = $xoopsDB->query($sql);
        list($count) = $xoopsDB->fetchRow($result);
        $_SESSION['items_count'] = $count;
    } else {
        $count = $_SESSION['items_count'];
    }
    if ($count > 0) {
        include_once XOOPS_ROOT_PATH . '/class/tree.php';
        include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newstopic.php';
        include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.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);
        if ($module) {
            foreach ($topics_arr as $onetopic) {
                if ($gperm_handler->checkRight('news_view', $onetopic->topic_id(), $groups, $xoopsModule->getVar('mid')) && $onetopic->menu()) {
                    $modversion['sub'][$i]['name'] = $onetopic->topic_title();
                    $modversion['sub'][$i]['url'] = "index.php?storytopic=" . $onetopic->topic_id();
                }
                $i++;
            }
        }
        unset($xt);
    }
}
$modversion['sub'][$i]['name'] = _MI_NEWS_SMNAME2;
コード例 #6
0
ファイル: functions.php プロジェクト: BackupTheBerlios/soopa
/**
 * Creates, for Mozilla/Netscape and Opera the site navigation's bar
 *
 * @package News
 * @author Hervé Thouzard (www.herve-thouzard.com)
 * @copyright (c) The Xoops Project - www.xoops.org
*/
function CreateSiteNavBar()
{
    global $xoopsConfig;
    $content = '';
    $myts =& MyTextSanitizer::getInstance();
    include_once XOOPS_ROOT_PATH . "/modules/news/class/class.newstopic.php";
    $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(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());
    }
    return $content;
}
コード例 #7
0
ファイル: functions.php プロジェクト: mambax7/xoopseditors
/**
 * 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);
    }
}