コード例 #1
0
ファイル: index.php プロジェクト: severnaya99/Sg-2010
    $xoopsTpl->assign('column_width', intval(1/$column_count*100));
	if ($xoopsModuleConfig['ratenews']) {
		$xoopsTpl->assign('rates', true);
		$xoopsTpl->assign('lang_ratingc', _MA_NW_RATINGC);
		$xoopsTpl->assign('lang_ratethisnews', _MA_NW_RATETHISNEWS);
	} else {
		$xoopsTpl->assign('rates', false);
	}

	$xt = new nw_NewsTopic();
    $alltopics =& $xt->getTopicsList(true,$xoopsModuleConfig['restrictindex']);
    $smarty_topics = array();
    $topicstories = array();

    foreach ($alltopics as $topicid => $topic) {
		$allstories = nw_NewsStory::getAllPublished($xoopsModuleConfig['storyhome'], 0, $xoopsModuleConfig['restrictindex'], $topicid);
    	$storieslist=array();
    	foreach ($allstories as $thisstory) {
    		$storieslist[]=$thisstory->storyid();
    	}
		$filesperstory = $sfiles->getCountbyStories($storieslist);
		foreach ($allstories as $thisstory) {
			$filescount = array_key_exists($thisstory->storyid(),$filesperstory) ? $filesperstory[$thisstory->storyid()] : 0;
			$story = $thisstory->prepare2show($filescount);
			$story['topic_title'] = $thisstory->textlink();
			$story['topic_separator'] =  ( $thisstory->textlink() != '' ) ? _MA_NW_SP : '';
			$story['news_title'] = $story['title'];
			$topicstories[$topicid][] = $story;
		}
		if(isset($topicstories[$topicid])) {
			$smarty_topics[$topicstories[$topicid][0]['posttimestamp']] = array('title' => $topic['title'], 'stories' => $topicstories[$topicid], 'id' => $topicid, 'topic_color'=>$topic['color']);
コード例 #2
0
ファイル: article.php プロジェクト: severnaya99/Sg-2010
 *
 * When you are viewing an article, you can see a summary table containing
 * the first n links to the last published news.
 * This summary table is visible according to a module's option (showsummarytable)
 * The number of items is equal to the module's option "storyhome" ("Select the number
 * of news items to display on top page")
 * We also use the module's option "restrictindex" ("Restrict Topics on Index Page"), like
 * this you (the webmaster) select if users can see restricted stories or not.
 */
if (nw_getmoduleoption('showsummarytable', NW_MODULE_DIR_NAME)) {
	$xoopsTpl->assign('showsummary', true);
	$xoopsTpl->assign('lang_other_story',_MA_NW_OTHER_ARTICLES);
	$count=0;
	$tmparticle = new nw_NewsStory();
	$infotips=nw_getmoduleoption('infotips', NW_MODULE_DIR_NAME);
	$sarray = $tmparticle->getAllPublished($cfg['article_summary_items_count'], 0, $xoopsModuleConfig['restrictindex']);
	if(count($sarray)>0) {
		foreach ($sarray as $onearticle) {
			$count++;
			$htmltitle='';
			$tooltips='';
			$htmltitle='';
			if($infotips>0) {
				$tooltips = nw_make_infotips($onearticle->hometext());
				$htmltitle=' title="'.$tooltips.'"';
			}
 			$xoopsTpl->append('summary', array('story_id'=>$onearticle->storyid(), 'htmltitle'=>$htmltitle, 'infotips'=>$tooltips, 'story_title'=>$onearticle->title(), 'story_hits'=>$onearticle->counter(), 'story_published'=>formatTimestamp($onearticle->published,$dateformat)));
   		}
   	}
   	$xoopsTpl->assign('summary_count',$count);
	unset($tmparticle);
コード例 #3
0
ファイル: index.php プロジェクト: severnaya99/Sg-2010
/**
 * Shows last x published stories
 *
 * This list can be view in the module's admin when you click on the tab named "Post/Edit News"
 * Actually you can see the the story's ID, its title, the topic, the author, the number of hits
 * and two links. The first link is used to edit the story while the second is used to remove the story.
 * The table only contains the last X published stories.
 * You can modify the number of visible stories with the module's option named
 * "Number of new articles to display in admin area".
 * As the number of displayed stories is limited, below this list you can find a text box
 * that you can use to enter a story's Id, then with the scrolling list you can select
 * if you want to edit or delete the story.
 */
function lastStories()
{
    global $dateformat;
	nw_collapsableBar('laststories', 'toplaststories');
	echo "<img onclick=\"toggle('toptable'); toggleIcon('toptableicon');\" id='toplaststories' name='toplaststories' src='" . NW_MODULE_URL . "/images/close12.gif' alt='' /></a>&nbsp;".sprintf(_AM_NW_LAST10ARTS,nw_getmoduleoption('storycountadmin', NW_MODULE_DIR_NAME))."</h4>";
	echo "<div id='laststories'>";
	echo '<br />';
    echo "<div style='text-align: center;'>";
    $start = isset($_GET['start']) ? intval($_GET['start']) : 0;
    $storyarray = nw_NewsStory :: getAllPublished(nw_getmoduleoption('storycountadmin', NW_MODULE_DIR_NAME), $start, false, 0, 1 );
    $storiescount = nw_NewsStory :: getAllStoriesCount(4,false);
    $pagenav = new XoopsPageNav( $storiescount, nw_getmoduleoption('storycountadmin', NW_MODULE_DIR_NAME), $start, 'start', 'op=newarticle');
    $class='';
    echo "<table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'><tr class='bg3'><td align='center'>" . _AM_NW_STORYID . "</td><td align='center'>" . _AM_NW_TITLE . "</td><td align='center'>" . _AM_NW_TOPIC . "</td><td align='center'>" . _AM_NW_POSTER . "</td><td align='center' class='news'>" . _AM_NW_PUBLISHED . "</td><td align='center' class='news'>" . _AM_NW_HITS . "</td><td align='center'>" . _AM_NW_ACTION . "</td></tr>";
    foreach( $storyarray as $eachstory ) {
        $published = formatTimestamp($eachstory->published(),$dateformat );
        // $expired = ( $eachstory -> expired() > 0 ) ? formatTimestamp($eachstory->expired(),$dateformat) : '---';
        $topic = $eachstory -> topic();
        $class = ($class == 'even') ? 'odd' : 'even';
        echo "<tr class='".$class."'>";
        echo "<td align='center'><b>" . $eachstory -> storyid() . "</b>
        	</td><td align='left'><a href='" . NW_MODULE_URL . "/article.php?storyid=" . $eachstory -> storyid() . "'>" . $eachstory -> title() . "</a>
        	</td><td align='center'>" . $topic -> topic_title() . "
        	</td><td align='center'><a href='" . XOOPS_URL . "/userinfo.php?uid=" . $eachstory -> uid() . "'>" . $eachstory -> uname() . "</a></td><td align='center' class='news'>" . $published . "</td><td align='center'>" . $eachstory -> counter() . "</td><td align='center'><a href='".NW_MODULE_URL . "/submit.php?returnside=1&amp;op=edit&amp;storyid=" . $eachstory -> storyid() . "'>" . _AM_NW_EDIT . "</a>-<a href='".NW_MODULE_URL . "/admin/index.php?op=delete&amp;storyid=" . $eachstory -> storyid() . "'>" . _AM_NW_DELETE . "</a>";
        echo "</td></tr>\n";
    }
    echo '</table><br />';
	echo "<div align='right'>".$pagenav->renderNav().'</div><br />';

    echo "<form action='index.php' method='get'>" . _AM_NW_STORYID . " <input type='text' name='storyid' size='10' />
    	<select name='op'>
    		<option value='edit' selected='selected'>" . _AM_NW_EDIT . "</option>
    		<option value='delete'>" . _AM_NW_DELETE . "</option>
    	</select>
		<input type='hidden' name='returnside' value='1'>
    	<input type='submit' value='" . _AM_NW_GO . "' />
    	</form>
	</div>";
    echo '</div><br />';
}
コード例 #4
0
ファイル: news_top.php プロジェクト: severnaya99/Sg-2010
/**
* Function used to edit the block
*/
function nw_b_news_top_edit($options) {
    global $xoopsDB;
    $tmpstory = new nw_NewsStory;
    $form = _MB_NW_ORDER."&nbsp;<select name='options[]'>";
    $form .= "<option value='published'";
    if ( $options[0] == 'published' ) {
        $form .= " selected='selected'";
    }
    $form .= '>'._MB_NW_DATE."</option>\n";

    $form .= "<option value='counter'";
    if($options[0] == 'counter'){
        $form .= " selected='selected'";
    }
    $form .= '>'._MB_NW_HITS.'</option>';
    $form .= "<option value='rating'";
    if ( $options[0] == 'rating' ) {
        $form .= " selected='selected'";
    }
    $form .= '>' . _MB_NW_RATE . '</option>';
    $form .= "</select>\n";

    $form .= '&nbsp;'._MB_NW_DISP."&nbsp;<input type='text' name='options[]' value='".$options[1]."'/>&nbsp;"._MB_NW_ARTCLS;
    $form .= "&nbsp;<br /><br />"._MB_NW_CHARS."&nbsp;<input type='text' name='options[]' value='".$options[2]."'/>&nbsp;"._MB_NW_LENGTH.'<br /><br />';

    $form .= _MB_NW_TEASER." <input type='text' name='options[]' value='".$options[3]."' />"._MB_NW_LENGTH;
    $form .= '<br /><br />';

    $form .= _MB_NW_SPOTLIGHT." <input type='radio' name='options[]' value='1'";
    if ($options[4] == 1) {
        $form .= " checked='checked'";
    }
    $form .= ' />'._YES;
    $form .= "<input type='radio' name='options[]' value='0'";
    if ($options[4] == 0) {
        $form .= " checked='checked'";
    }
    $form .= ' />'._NO.'<br /><br />';

	$form .= _MB_NW_WHAT_PUBLISH ." <select name='options[]'><option value='1'";
    if ($options[5] == 1) {
        $form .= ' selected';
    }
    $form .= ' />'._MB_NW_RECENT_NEWS;
    $form .= "</option><option value='0'";
    if ($options[5] == 0) {
        $form .= ' selected';
    }
    $form .= ' />'._MB_NW_RECENT_SPECIFIC.'</option></select>';

    $form .= '<br /><br />'._MB_NW_SPOTLIGHT_ARTICLE.'<br />';
    $articles = $tmpstory->getAllPublished(200,0,false,0,0,false);		// I have limited the listbox to the last 200 articles
    $form .= "<select name ='options[]'>";
    $form .= "<option value='0'>"._MB_NW_FIRST.'</option>';
    foreach ($articles as $storyid => $storytitle) {
        $sel = '';
        if ($options[6] == $storyid) {
            $sel = " selected='selected'";
        }
        $form .= "<option value='$storyid'$sel>".$storytitle.'</option>';
    }
    $form .= '</select><br /><br />';

    $form .= _MB_NW_IMAGE."&nbsp;<input type='text' id='spotlightimage' name='options[]' value='".$options[7]."' size='50'/>";
    $form .= "&nbsp;<img align='middle' onmouseover='style.cursor=\"hand\"' onclick='javascript:openWithSelfMain(\"".XOOPS_URL."/imagemanager.php?target=spotlightimage\",\"imgmanager\",400,430);' src='".XOOPS_URL."/images/image.gif' alt='image' title='image' />";
    $form .= '<br /><br />'._MB_NW_DISP."&nbsp;<select name='options[]'><option value='1' ";
    if($options[8]==1) {
    	$form .= 'selected';
    }
    $form .= '>'._MB_NW_VIEW_TYPE1."</option><option value='2' ";
    if($options[8]==2) {
    	$form .= 'selected';
    }
    $form .= '>'._MB_NW_VIEW_TYPE2.'</option></select><br /><br />';

	$form .= "<table border=0>\n";
	$form .= "<tr><td colspan='2' align='center'><u>"._MB_NW_DEFAULT_COLORS."</u></td></tr>";
	$form .= "<tr><td>"._MB_NW_TAB_COLOR1 . "</td><td><input type='text' name='options[]' value='".$options[9]."' size=7></td></tr>";
	$form .= "<tr><td>"._MB_NW_TAB_COLOR2 . "</td><td><input type='text' name='options[]' value='".$options[10]."' size=7></td></tr>";
	$form .= "<tr><td>"._MB_NW_TAB_COLOR3 . "</td><td><input type='text' name='options[]' value='".$options[11]."' size=7></td></tr>";
	$form .= "<tr><td>"._MB_NW_TAB_COLOR4 . "</td><td><input type='text' name='options[]' value='".$options[12]."' size=7></td></tr>";
	$form .= "<tr><td>"._MB_NW_TAB_COLOR5 . "</td><td><input type='text' name='options[]' value='".$options[13]."' size=7></td></tr>";
	$form .= "</table>\n";

    $form .= '<br /><br />'._MB_NW_SPOTLIGHT_TOPIC."<br /><select name='options[]' multiple='multiple'>";
    include_once NW_MODULE_PATH . '/class/class.newstopic.php';
    $topics_arr=array();
    include_once XOOPS_ROOT_PATH . '/class/xoopstree.php';
    $xt = new XoopsTree($xoopsDB->prefix('nw_topics'), 'topic_id', 'topic_pid');
    $topics_arr = $xt->getChildTreeArray(0,'topic_title');
    $size = count($options);
    foreach ($topics_arr as $onetopic) {
    	$sel = '';
		if($onetopic['topic_pid']!=0) {
			$onetopic['prefix'] = str_replace('.','-',$onetopic['prefix']) . '&nbsp;';
		} else {
			$onetopic['prefix'] = str_replace('.','',$onetopic['prefix']);
		}
        for ( $i = 14; $i < $size; $i++ ) {
            if ($options[$i] == $onetopic['topic_id']) {
                $sel = " selected='selected'";
            }
        }
        $form .= "<option value='".$onetopic['topic_id']."'$sel>".$onetopic['prefix'].$onetopic['topic_title'].'</option>';
	}
    $form .= '</select><br />';
    return $form;
}
コード例 #5
0
ファイル: backendt.php プロジェクト: severnaya99/Sg-2010
	mb_http_output('pass');
}

$restricted = nw_getmoduleoption('restrictindex', NW_MODULE_DIR_NAME);
$newsnumber = nw_getmoduleoption('storyhome', NW_MODULE_DIR_NAME);

$charset = 'utf-8';

header ('Content-Type:text/xml; charset='.$charset);
$story = new nw_NewsStory();
$tpl = new XoopsTpl();
$tpl->xoops_setCaching(2);
$tpl->xoops_setCacheTime(3600);								// Change this to the value you want
if (!$tpl->is_cached('db:nw_news_rss.html', $topicid)) {
	$xt = new nw_NewsTopic($topicid);
	$sarray = $story->getAllPublished($newsnumber, 0, $restricted, $topicid);
	if (is_array($sarray) && count($sarray)>0) {
		$sitename = htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES);
		$slogan = htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES);
		$tpl->assign('channel_title', xoops_utf8_encode($sitename));
		$tpl->assign('channel_link', XOOPS_URL.'/');
		$tpl->assign('channel_desc', xoops_utf8_encode($slogan));
		$tpl->assign('channel_lastbuild', formatTimestamp(time(), 'rss'));
		$tpl->assign('channel_webmaster', checkEmail($xoopsConfig['adminmail'],true));	// Fed up with spam
		$tpl->assign('channel_editor', checkEmail($xoopsConfig['adminmail'],true));	// Fed up with spam
		$tpl->assign('channel_category', $xt->topic_title());
		$tpl->assign('channel_generator', 'XOOPS');
		$tpl->assign('channel_language', _LANGCODE);
		$tpl->assign('image_url', XOOPS_URL.'/images/logo.gif');
		$dimention = getimagesize(XOOPS_ROOT_PATH.'/images/logo.gif');
		if (empty($dimention[0])) {
コード例 #6
0
ファイル: micro_summary.php プロジェクト: severnaya99/Sg-2010
 * This file is responsible for creating micro summaries for Firefox 2 web navigator
 * For more information, see this page : http://wiki.mozilla.org/Microsummaries
 *
 * @package News
 * @author Instant Zero (http://xoops.instant-zero.com)
 * @copyright (c) Instant Zero
 *
 * NOTE : If you use this code, please make credit.
 *
 */
include_once 'header.php';
include_once NW_MODULE_PATH . '/class/class.newsstory.php';
include_once NW_MODULE_PATH . '/include/functions.php';
if(!nw_getmoduleoption('firefox_microsummaries', NW_MODULE_DIR_NAME)) {
	exit();
}
$story = new nw_NewsStory();
$restricted = nw_getmoduleoption('restrictindex', NW_MODULE_DIR_NAME);
$sarray = array();
// Get the last news from all topics according to the module's restrictions
$sarray = $story->getAllPublished(1, 0, $restricted, 0);
if (count($sarray)>0) {
	$laststory = null;
	$laststory = $sarray[0];
	if(is_object($laststory)) {
		header ('Content-Type:text;');
		echo $laststory->title(). ' - '.$xoopsConfig['sitename'];
	}
}
?>