예제 #1
0
function PrintPage($articleid)
{
    global $xoopsConfig, $xoopsDB, $xoopsModule, $wfsConfig;
    $story = new WfsArticle($articleid);
    $datetime = formatTimestamp($story->created(), $wfsConfig['timestamp']);
    echo "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>\n";
    echo "<html>\n<head>\n";
    echo "<title>" . $xoopsConfig['sitename'] . "</title>\n";
    echo "<meta http-equiv='Content-Type' content='text/html; charset=" . _CHARSET . "' />\n";
    echo "<meta name='AUTHOR' content='" . $xoopsConfig['sitename'] . "' />\n";
    echo "<meta name='COPYRIGHT' content='Copyright (c) 2001 by " . $xoopsConfig['sitename'] . "' />\n";
    echo "<meta name='DESCRIPTION' content='" . $xoopsConfig['slogan'] . "' />\n";
    echo "<meta name='GENERATOR' content='" . XOOPS_VERSION . "' />\n\n\n";
    echo "<body bgcolor='#ffffff' text='#000000'>\n            <table border='0'><tr><td align='center'>\n            <table border='0' width='650' cellpadding='0' cellspacing='1' bgcolor='#000000'><tr><td>\n            <table border='0' width='650' cellpadding='20' cellspacing='1' bgcolor='#ffffff'><tr><td align='center'>\n            <img src='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/logo.gif' border='0' alt='' /><br />\n            <h2>" . $story->title() . "</h2><hr />";
    if ($story->htmlpage) {
        $includepage = XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->dirname() . "/html/" . $story->htmlpage();
        $maintext = '';
        $maintext = (include $includepage);
        $maintext = $maintext;
    } else {
        $maintext = $story->maintext();
        //if (!empty($maintext)) $maintext .= "<hr />";
        $maintext = preg_replace("/\\[pagebreak\\]/", "<hr width='75%' />", $maintext);
    }
    echo "<tr><td>" . $maintext . "<br /><br /><br /><hr /><br />";
    echo "<small><b>" . _WFS_DATE . "</b>&nbsp;" . $datetime . "<br /><b>" . _WFS_TOPICC . "</b>&nbsp;" . $story->categoryTitle() . "<br /><b>" . _WFS_URLFORSTORY . "</b>&nbsp;" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/article.php?articleid=" . $story->articleid() . "</small><br /></td></tr>";
    echo "</td></tr></table></td></tr></table>\n\n            </td></tr></table>\n            </body>\n            </html>\n            ";
}
예제 #2
0
function PrintPage($articleid) {

    global $xoopsConfig, $xoopsDB, $xoopsModule, $wfsConfig;

        $story = new WfsArticle($articleid);

// BUG 174: offline article is displayed
// check the showing property
	if ( !$story->checkPublish() ) 
	{
		redirect_header("index.php",2,_WFS_NOSTORY);
		exit();
	}

// change the date from created to published same as displaying article
//    $datetime = formatTimestamp($story->created(), $wfsConfig['timestamp']);
    $datetime = formatTimestamp($story->published(), $wfsConfig['timestamp']);

    echo "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>\n";
        echo "<html>\n<head>\n";
        echo "<title>".$xoopsConfig['sitename']."</title>\n";
        echo "<meta http-equiv='Content-Type' content='text/html; charset="._CHARSET."' />\n";
        echo "<meta name='AUTHOR' content='".$xoopsConfig['sitename']."' />\n";
        echo "<meta name='COPYRIGHT' content='Copyright (c) 2001 by ".$xoopsConfig['sitename']."' />\n";
        echo "<meta name='DESCRIPTION' content='".$xoopsConfig['slogan']."' />\n";
        echo "<meta name='GENERATOR' content='".XOOPS_VERSION."' />\n\n\n";

// change the image from fixation at "logo.gif" to Main Index Image set up by Index Page Management.
//    echo "<body bgcolor='#ffffff' text='#000000'>
//            <table border='0'><tr><td align='center'>
//            <table border='0' width='650' cellpadding='0' cellspacing='1' bgcolor='#000000'><tr><td>
//            <table border='0' width='650' cellpadding='20' cellspacing='1' bgcolor='#ffffff'><tr><td align='center'>
//            <img src='".XOOPS_URL."/modules/".$xoopsModule->dirname()."/images/logo.gif' border='0' alt='' /><br />
//            <h2>".$story->title()."</h2><hr />";

	$indeximage = XOOPS_URL."/modules/".$xoopsModule->dirname()."/images/".$wfsConfig['indeximage'];

	echo "<body bgcolor='#ffffff' text='#000000'>
    	<table border='0'><tr><td align='center'>
		<table border='0' width='650' cellpadding='0' cellspacing='1' bgcolor='#000000'><tr><td>
		<table border='0' width='650' cellpadding='20' cellspacing='1' bgcolor='#ffffff'><tr><td align='center'>
		<img src='$indeximage' border='0' alt='indeximage' /><br />
		<h2>".$story->title()."</h2><hr />";

//      If($story->htmlpage) {
//                                      $includepage = XOOPS_ROOT_PATH."/modules/".$xoopsModule->dirname()."/html/".$story->htmlpage();
//                                      $maintext = '';
//                                      $maintext = include($includepage);
//                             $maintext = $maintext;
//                } else {
//           $maintext = $story->maintext();
//    //if (!empty($maintext)) $maintext .= "<hr />";
//    $maintext = preg_replace("/\[pagebreak\]/","<hr width='75%' />",$maintext);
//    }

// BUG 8569: Warning: failed to open $includepage
// same as article.php
	$maintext = $story->maintext();
	$maintext = preg_replace("/\[pagebreak\]/","<hr width='75%' />",$maintext);

	if($story->ishtml != '0' && $story->htmlpage())
	{
		$maintextfile = XOOPS_ROOT_PATH.'/'.$wfsConfig['htmlpath'].'/'.$story->htmlpage;
		if (file_exists($maintextfile) && false !== $fp = fopen($maintextfile, 'r')) 
		{
			$maintext = fread($fp, filesize($maintextfile));
			fclose($fp);
		}
	}

        echo "<tr><td>".$maintext."<br /><br /><br /><hr /><br />";
        echo "<small><b>"._WFS_DATE."</b>&nbsp;".$datetime."<br /><b>"
        ._WFS_TOPICC."</b>&nbsp;".$story->categoryTitle()."<br /><b>"
        ._WFS_URLFORSTORY."</b>&nbsp;".XOOPS_URL."/modules/".$xoopsModule->dirname()."/article.php?articleid=".$story->articleid()
        ."</small><br /></td></tr>";
        echo "</td></tr></table></td></tr></table>\n
            </td></tr></table>
            </body>
            </html>
            ";
}
예제 #3
0
if ($action == 'submitted') $dataselect = 2;
if ($action == 'all') $dataselect = 3;
if ($action == 'online') $dataselect = 4;
if ($action == 'offline') $dataselect = 5;
if ($action == 'autoexpire') $dataselect = 6;
if ($action == 'autoart') $dataselect = 7;
if ($action == 'expired') $dataselect = 8;
if ($action == 'noshowart') $dataselect = 9;
xoops_cp_header();

    	$articlearray = WfsArticle::getAllArticle($wfsConfig['lastart'], $start, $xoopsOption, $dataselect);

// it will operate incorrectly, if there are many records.
//		$scount = count(WfsArticle::getAllArticle($wfsConfig['lastart'], 0, 0, $dataselect));
//		$totalcount = count(WfsArticle::getAllArticle(0, 0, 0, $dataselect));
		$totalcount = WfsArticle::getNumArticle($dataselect);

// unify a article menu and a title
		echo "<div><h4>"._AM_ARTICLEMANAGEMENT.": ";
		if ($action == 'all')        echo _AM_ALLARTICLES;
		if ($action == 'published')  echo _AM_PUBLARTICLES;
		if ($action == 'submitted')  echo _AM_SUBLARTICLES;
		if ($action == 'online')     echo _AM_ONLINARTICLES;
		if ($action == 'offline')    echo _AM_OFFLIARTICLES;
		if ($action == 'autoexpire') echo _AM_AUTOEXPIREARTICLES;
		if ($action == 'expired')    echo _AM_EXPIREDARTICLES;
		if ($action == 'autoart')    echo _AM_AUTOARTICLES;
		if ($action == 'noshowart')  echo _AM_NOSHOWARTICLES;
		echo "</h4></div>";

// display at first page
예제 #4
0
function listArticle($catid, $start = 0, $num = 20) {

	global $xoopsDB, $xoopsConfig, $xoopsModule, $wfsConfig, $weight, $art;
	
	$xt = new WfsCategory($catid);
	
	$weight = array();
	$art = array();
	
	$sarray = WfsArticle::getAllArticle($num, $start, $catid, $dataselect='1');

// bug fix : can't display ten or more articles
//	$articlecount = WfsArticle::countByCategory($catid);
	
	echo "<form name='reaorder' METHOD='post'>"; 
	echo "<table border='0' cellpadding='2' cellspacing='1' width = '100%' class = 'outer'>";
	
		echo "<tr align='left'>"; 
		echo "<td align='center' class='bg3' width = '3%'><b>"._AM_REORDERID."</b></td>";
		echo "<td align='left' width = '30%'class='bg3'><b>" . _AM_REORDERTITLE . "</b></td>";
		echo "<td align='left' width = '60%' class='bg3'><b>" . _AM_REORDERSUMMARY . "</b></td>"; 
		echo "<td align='center' width = '17%' class='bg3'><b>" . _AM_REORDERWEIGHT . "</b></td>";
		echo "</tr>";

// bug fix : can't display ten or more articles
//	if ($articlecount != 0) {
	if ($num != 0) {

		foreach ($sarray as $article) {
			$articlelink = "";
				
			echo "<tr>";
			echo "<td class='head'>$article->articleid</td>";
			echo "<td class='even' nowrap='nowrap'><a href='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/admin/index.php?op=edit&articleid=" . $article->articleid() . "'>" . $article->title() . "</a></td>";
			echo "<input type='hidden' name='art[]' value='".$article->articleid."' />";
			echo "<td align='left'class='odd'>".$article->summary."</td>";
			echo "<td align='center' class='even'><input type='text' name='weight[]' value='".$article->weight."' size='5' maxlenght='5'></td>";
			echo "</tr>";
		} 
	} else {
		echo "<tr>";
		echo "<td colspan = 4 align = 'center' class='even'>No Articles within this section</td>";
		echo "</tr>";
	}
	echo "
		<tr><td> </td></tr>
		<tr><td class='foot' align='center' colspan='4'>
		<input type='hidden' name='op' value=reaorder />
		<input type='submit' name='submit' value='"._SUBMIT."' />
		</td></tr>
		
		";
	echo "</table>";
	
	echo "<table border='0' cellpadding='1' cellspacing='1' width='100%'>";
	echo "<br />";

// multi language
//	echo "<tr><td align='center' class='head' >[ <a href='javascript:history.back(1)'><a href='./reorder.php'>Return to Category re-order</a> ]</a></td></tr>";
	echo "<tr><td align='center' class='head' >[ <a href='javascript:history.back(1)'><a href='./reorder.php'>"._AM_CATEGORY_REORDER_RETURN."</a> ]</a></td></tr>";

	echo "</table>";
	echo "<br />";
} 
예제 #5
0
function listArticle($catid, $start = 0, $num = 20) 
{
	global $xoopsDB, $orderby, $xoopsConfig, $xoopsUser, $xoopsModule, $wfsConfig, $myts, $counter, $mydownloads_popular, $dataselect;
	
	global $wfsModule;	// add
	
	$xt = new WfsCategory($catid);
 
	if (file_exists(XOOPS_ROOT_PATH . "/" . $wfsConfig['sgraphicspath'] . "/" . $xt->imgurl) && $xt->imgurl !='blank.gif' ) {
		$image = "<img src='" . XOOPS_URL . "/" . $wfsConfig['sgraphicspath'] . "/" . $xt->imgurl("S") . "'>";
	} else {
		if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid()) && $xt->imgurl !='blank.gif') {

// multi language
//			$image = "ERROR: Please check path/file for image";
			$image = "<font color=red>"._WFS_ERROR_IMAGE."</font>";

		} else {
			$image = '';
		} 
	} 

	$title = $xt->title() ;
	$catdescription = $xt->catdescription('S');

	echo "<table border='0' cellpadding='2' cellspacing='1' valign='top' align = 'center' width = '100%'>";
	if ((!empty($xt->imgurl) && $xt->displayimg == 1)) {
		echo "<tr><td colspan='5' align='center'>".$image."</td></tr>\n";
	} 
	echo "<tr><td colspan='5' align='center'>&nbsp;</td></tr>\n";
	echo "<tr><td colspan='5' align='center'><h3>".$title."</h3></td></tr>\n";
	
	echo "<tr><td>";
	// -- Skalpack2 [start]

// easy to rename module and table
//	$jump = XOOPS_URL."/modules/wfsection/index.php?";
	$jump = XOOPS_URL."/modules/$wfsModule/index.php?";

	$tree = new wfsTree($xt->table, "id", "pid");
	switch ($wfsConfig['aidxpathtype']) {
	case 1:	// Local selectbox
		$tree->makeMyRootedSelBox('title', 'title', $xt->id, true, $xt->id, true, "", "location.href='{$jump}category='+this.options[this.selectedIndex].value");
		break;
	case 2:	// Linked path

// BUG 217: category link is wrong
//		echo preg_replace('/&id=/', '&category=', $tree->getNicePathFromId($xt->id, "title", $jump));
		echo preg_replace('/&amp;id=/', '&category=', $tree->getNicePathFromId($xt->id, "title", $jump));

		break;
	case 3: // Path and local select box

// BUG 217: category link is wrong
//		echo preg_replace('/&id=/', '&category=', $tree->getNicePathFromId($xt->pid, "title", $jump));
		echo preg_replace('/&amp;id=/', '&category=', $tree->getNicePathFromId($xt->pid, "title", $jump));

// bug fix: it can't jump at Path and local select box
//		$tree->makeMySelBox('title', 'title', $xt->id, true, $xt->id, true, "", "location.href='{$jump}category='+this.options[this.selectedIndex].value");
		$tree->makeMyRootedSelBox('title', 'title', $xt->id, true, $xt->id, true, "", "location.href='{$jump}category='+this.options[this.selectedIndex].value");

		break;
	case 4:	// None
		break;
	case 0: // Full selectbox
	default:
		$xt->makeSelBox(1, $xt->id, "pid", "location.href='{$jump}category='+this.options[this.selectedIndex].value")."";
		break;
	}
// -- Skalpack2 [/end]	echo "</td></td>";
	
	echo "<tr><td colspan='5'><br />$catdescription<br /></td></tr>\n";
	echo "<tr><td colspan='5'>&nbsp;</td></tr>\n";
	echo "</table>\n";
				
	$sarray = WfsArticle::getAllArticle($num, $start, $catid, $dataselect='4');
	$articlecount = WfsArticle::countByCategory($catid);
	echo "<table border='0' cellpadding='2' cellspacing='1' width = '100%' class= 'outer'>";
	If ($articlecount != 0) {
		
		echo "<tr align='left'>"; 
		// These will always be shown
		echo "<td align='left' width = '30%' class='itemHead'><b>" . _WFS_ARTICLE . "</b></td>";
		if ($wfsConfig['summary']) {
			echo "<td align='left' width = '50%' class='itemHead'><b>" . _WFS_SUMMARY . "</b></td>"; 
		}
		// You can choose which of these to show
		if ($wfsConfig['showauthor']) 
		   echo "<td align='center' class='itemHead'><b>" . _WFS_AUTH . "</b></td>";
		if ($wfsConfig['showhits']) echo "<td align='center' class='itemHead'><b>" . _WFS_HITS . "</b></td>";
		if ($wfsConfig['showcomments']) { 
			if ($wfsConfig['comments']) echo "<td align='center' class='itemHead'><b>" . _WFS_COMMENT . "</b></td>";
		}
		if ($wfsConfig['showfile']) echo "<td align='center' class='itemHead'><b>" . _WFS_FILES . "</b></td>";
		if ($wfsConfig['novote']) {
			if ($wfsConfig['showrated']) echo "<td align='center' class='itemHead'><b>" . _WFS_RATED . "</b></td>";
		}
		if ($wfsConfig['novote']) {
			if ($wfsConfig['showvotes']) echo "<td align='center' class='itemHead'><b>" . _WFS_VOTES . "</b></td>";
		}
		if ($wfsConfig['showupdated']) echo "<td align='center' class='itemHead'><b>" . _WFS_PUBLISHEDHOME . "</b></td>";
		echo "</tr>\n";

		foreach ($sarray as $article) {
			$counter = $article->counter();
			$time = $article->created();
			$stat = $article->changed();
			$articlelink = "<a href='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/article.php?articleid=" . $article->articleid() . "'>";
			if ($wfsConfig['picon']) {
				$articlelink .= "".$article->iconLink("S") . "</a>";
			} else {
				$articlelink .= "".$article->textLink("S") . "</a>";
			}
			
			$summary = $article->summary();
			$published = formatTimestamp($article->published(), $wfsConfig['timestamp']);
			$counter = $article->counter();
			if ($wfsConfig['comments']) $commentcount = $article->getCommentsCount();
			$attachedfiles = $article->getFilesCount();
			
			if ($article->uid > 0) {
				$user = new xoopsUser($article->uid);
				if (($wfsConfig['realname']) && $user->getvar('name')) {
						$username = $user->getvar('name');
					} else {
				   		$username = $user->getvar('uname');
					} 
				$username = "******".XOOPS_URL."/userinfo.php?uid=".$article->uid()."'>".$username."</a>";
			} else {
				$username = $GLOBALS['xoopsConfig']['anonymous'];
			}
						
			//$username = "******" . XOOPS_URL . "/userinfo.php?uid=" . $article->uid() . "'>" . $article->uname() . "</a>";
			if ($wfsConfig['novote']) $rating = number_format($article->rating, 2);
			$groupid = $article->groupid;
			if ($wfsConfig['novote']) $votes = $myts->makeTboxData4Show($article->votes) ;
			$status = 1;
			$orderbyTrans = convertorderbytrans($orderby);

			if ($stat != $time) $status = 2;
			if (checkAccess($groupid)) {
			
				echo "<tr><td valign='top' class='even'>$articlelink";
				if ($wfsConfig['noicons']) { 
				popgraphic($counter);
				newdownloadgraphic($time, $status);
				}
				echo "</td>";
				if ($wfsConfig['summary']) echo "<td valign='top' class='even'>$summary</td>";
				if ($wfsConfig['showauthor']) echo "<td align='center'  valign='top' class='even' nowrap='nowrap'>$username</td>";
				if ($wfsConfig['showhits']) echo "<td align='center'  valign='top' class='even'>$counter</td>";
				//if ($wfsConfig['comments']) {
				if ($wfsConfig['showcomments']) { 
					if ($wfsConfig['comments']) echo "<td align='center'  valign='top' class='even'>$commentcount</td>";
				}
				if ($wfsConfig['showfile']) echo "<td align='center'  valign='top' class='even'>$attachedfiles</td>";
				if ($wfsConfig['novote']) {
					if ($wfsConfig['showrated']) echo "<td align='center'  valign='top' class='even'>$rating</td>";
					if ($wfsConfig['showvotes']) echo "<td align='center'  valign='top' class='even'>$votes</td>";
				}
				if ($wfsConfig['showupdated']) {
					echo "<td align='center' nowrap='nowrap' valign='top' class='even'>$published</td></tr>\n";
				} 
			} 
		} //end check access
	} 
	echo "</table>\n";

	if ($articlecount > $num) {
		echo "<table border='0' width='100%' cellpadding='0' cellspacing='0' align='center' valign='top'><tr><td align='center'>";

// take over the order to previos and next page
//		if ($articlecount < $start + $num) echo "<a href='index.php?category=" . $catid . "&amp;start=" . ($start - $num) . "'>" . _WFS_PREVPAGE . "</a>&nbsp;";
//		if ($articlecount > $start + $num) echo "<a href='index.php?category=" . $catid . "&amp;start=" . ($start + $num) . "'>" . _WFS_NEXTPAGE . "</a>&nbsp;";

		$orderbyOut = convertorderbyout($orderby);
		if ($articlecount < $start + $num) echo "<a href='index.php?category=" . $catid . "&amp;start=" . ($start - $num) . "&amp;orderby=" . $orderbyOut . "'>" . _WFS_PREVPAGE . "</a>&nbsp;";
		if ($articlecount > $start + $num) echo "<a href='index.php?category=" . $catid . "&amp;start=" . ($start + $num) . "&amp;orderby=" . $orderbyOut . "'>" . _WFS_NEXTPAGE . "</a>&nbsp;";

// BUG 8186: page number is displayed too many
//		for($i = 0, $j = 1; $i <= $articlecount; $i += $num, $j++) 
		for($i = 0, $j = 1; $i < $articlecount; $i += $num, $j++) 

		{
			if (($i <= $start) && ($start < ($i + $num))) {
				echo $j . "&nbsp;";
			} else {

// take over the order to previos and next page
//				echo "<a href='index.php?category=" . $catid . "&amp;start=" . ($i) . "'>" . ($j) . "</a>&nbsp;";
				echo "<a href='index.php?category=" . $catid . "&amp;start=" . ($i) . "&amp;orderby=" . $orderbyOut . "'>" . ($j) . "</a>&nbsp;";

			} 
		} 
		echo "</td></tr></table>\n";
	} 

	echo "<table cellpadding='2' cellspacing='1' width='100%'>";
	if ($xt->catfooter)
	{
		echo "<tr><td><br />\n";
		echo $xt->catfooter('S') . "<br /><br />\n";
		echo "</td></tr>\n";
	}
	echo "</table>\n";

	echo "<table border='0' cellpadding='1' cellspacing='1' width='100%'>";
	if (!$xt->catfooter) echo "<br />";
	echo "<tr><td align='center' class='head' >[ <a href='javascript:history.back(1)'>" . _WFS_BACK2 . "</a> | <a href='./index.php'>" . _WFS_RETURN2INDEX . "</a> ]</a></td></tr>\n";
	echo "</table>\n";
	echo "<br />";

	if (($articlecount > 0)) {
		echo "<table border='0' cellpadding='1' cellspacing='1' width='100%' class = 'outer'>";
		echo "<tr><td align='center' class='even'>";
		$orderbyTrans = convertorderbytrans($orderby);

// BUG 7854: redundant samll tag
//		echo "<small><center>" . _WFS_SORTBY1 . "&nbsp;";
		echo "<center>" . _WFS_SORTBY1 . "&nbsp;";

       	echo "  " . _WFS_TITLE1 . " (<a href='index.php?category=$catid&orderby=titleA'><img src='images/up.gif' border='0' align='middle' alt='' /></a><a href='index.php?category=$catid&orderby=titleD'><img src='images/down.gif' border='0' align='middle' alt='' /></a>)";
       	echo "  " . _WFS_DATE1 . " (<a href='index.php?category=$catid&orderby=createdA'><img src='images/up.gif' border='0' align='middle' alt='' /></a><a href='index.php?category=$catid&orderby=createdD'><img src='images/down.gif' border='0' align='middle' alt='' /></a>)";
	    echo "  " . _WFS_WEIGHT . " (<a href='index.php?category=$catid&orderby=weight'>Reset</a>)";

      	if ($wfsConfig['novote']) {
		echo "	" . _WFS_RATING1 . " (<a href='index.php?category=$catid&orderby=ratingA'><img src='images/up.gif' border='0' align='middle' alt='' /></a><a href=index.php?category=$catid&orderby=ratingD><img src='images/down.gif' border='0' align='middle' alt='' /></a>)";
       	}
		echo "	" . _WFS_POPULARITY1 . " (<a href='index.php?category=$catid&orderby=counterA'><img src='images/up.gif' border='0' align='middle' alt='' /></a><a href='index.php?category=$catid&orderby=counterD'><img src='images/down.gif' border='0' align='middle' alt='' /></a>)";
       
		echo "<br /><b><small>";
		printf(_WFS_CURSORTBY1, $orderbyTrans);
		$orderby = convertorderbyout($orderby);
		echo "</small></b></center>";
		echo "</td></tr></table>\n";
	} 

} 
예제 #6
0
function duplicateSection($cat, $targetid, $newtitle='', $recurse=false, $dupcontent=false) {
	$sourceid = $cat->id;

// bug fix: create sub category two or more times
//	$category_arr = $cat->getAllChild();
	$category_arr = $cat->getFirstChild();

	$cat->setPid($targetid);
	if (!empty($newtitle)) {
		$cat->setTitle($newtitle);
	}
	$cat->id = 0;				// Clear object id, so store() will create a new category
	$cat->store();				// Duplicate section
	if ($cat->id == 0) {
		$cat->id = $cat->db->getInsertId();
	}

	if ($dupcontent) {
		// Also duplicate each story in this section
		$article_arr = WfsArticle::getByCategory($sourceid);
			foreach($article_arr as $eacharticle){
			$eacharticle->setCategoryid($cat->id);	// move (copy) to newly created category

// create new article when storing
// bug fix: update the same article, instead of creating new article 
//			$eacharticle->articleid = 0;
			unset($eacharticle->articleid);

			$eacharticle->store();
		}
	}
	if ($recurse) {
		// Duplicate every sub-section to newly created one
		foreach ($category_arr as $subcat) {
			duplicateSection($subcat, $cat->id, '', true, $dupcontent);
		}
	}
}
예제 #7
0
             $body .= "\n\n" . _NW_TITLE . ": " . $story->title();
             $body .= "\n" . _POSTEDBY . ": " . XoopsUser::getUnameFromId($uid);
             $body .= "\n" . _DATE . ": " . formatTimestamp(time(), 'm', $xoopsConfig['default_TZ']);
             $body .= "\n\n" . XOOPS_URL . '/modules/wfsection/admin/index.php?op=edit&articleid=' . $result;
             $xoopsMailer->setBody($body);
             $xoopsMailer->send();
         }
     } else {
         echo 'error';
     }
     redirect_header("index.php", 2, _WFS_THANKS);
     break;
 case "edit":
     include_once XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->dirname() . "/class/wfscategory.php";
     include_once XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->dirname() . "/class/wfsarticle.php";
     $story = new WfsArticle('articleid');
     $subject = $story->title();
     $message = $story->mainText();
     $summary = $story->summary("Edit");
     $url = $story->url();
     $urlname = $story->urlname();
     //$story->Uid();
     //$story->setCategoryid($id);
     //$story->setNohtml($nohtml_db);
     $nosmiley = isset($nosmiley) ? intval($nosmiley) : 0;
     $notifypub = isset($notifypub) ? intval($notifypub) : 0;
     $story->setHtmlpage("");
     $story->setIshtml(0);
     //$story->setGroupid($groupid);
     //$story->setNosmiley($nosmiley);
     //$story->setPublished(0);
예제 #8
0
function articlemenu() 
{
	global $xoopsDB, $xoopsModule;
	global $wfsTableBroken;

	include_once XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->dirname().'/class/wfsarticle.php';

	$total_published  = WfsArticle::getNumArticle(1);
	$total_submitted  = WfsArticle::getNumArticle(2);
	$total_all        = WfsArticle::getNumArticle(3);
	$total_online     = WfsArticle::getNumArticle(4);
	$total_offline    = WfsArticle::getNumArticle(5);
	$total_autoexpire = WfsArticle::getNumArticle(6);
	$total_autoart    = WfsArticle::getNumArticle(7);
	$total_expired    = WfsArticle::getNumArticle(8);
	$total_noshowart  = WfsArticle::getNumArticle(9);                             
	                       		
	echo "<table width='100%' border='0' cellpadding = '2' cellspacing='0' class='outer'>";
	echo "<tr class = 'even'><td>";

	echo "<div><a href='allarticles.php?action=all'>"._AM_ALLARTICLES."</a> ($total_all)</div>";

	echo "<div><a href='allarticles.php?action=submitted'>"._AM_SUBLARTICLES."</a> ";
	if ($total_submitted) echo "<font color=red><b>($total_submitted)</b></font>";
	else                  echo "($total_submitted)";
	echo "<div>";

	echo "<div><a href='allarticles.php?action=published'>"._AM_PUBLARTICLES."</a> ($total_published)</div>";
	echo "<div><a href='allarticles.php?action=autoart'>"._AM_AUTOARTICLES."</a> ($total_autoart)<div>";
	echo "<div><a href='allarticles.php?action=expired'>"._AM_EXPIREDARTICLES."</a> ($total_expired)<div>";
	echo "<div><a href='allarticles.php?action=autoexpire'>"._AM_AUTOEXPIREARTICLES."</a> ($total_autoexpire)<div>";
	echo "<div><a href='allarticles.php?action=online'>"._AM_ONLINARTICLES."</a> ($total_online)<div>";
	echo "<div><a href='allarticles.php?action=offline'>"._AM_OFFLIARTICLES."</a> ($total_offline)<div>";
	echo "<div><a href='allarticles.php?action=noshowart'>"._AM_NOSHOWARTICLES."</a> ($total_noshowart)<div>";

	echo "</td></tr></table><br>";
}
예제 #9
0
        xoops_cp_header();
        echo "<div><h4>" . _AM_ARTICLEMANAGEMENT . "</h4></div>";
        adminmenu();
        echo "<table width='100%' border='0' cellpadding = '1' cellspacing='0' class='outer'>";
        echo "<tr class = 'even'><td>";
        echo "<div><a href='allarticles.php?action=all'>" . _AM_ALLARTICLES . "</a></div>";
        echo "<div><a href='allarticles.php?action=published'>" . _AM_PUBLARTICLES . "</a></div>";
        echo "<div><a href='allarticles.php?action=autoart'>" . _AM_AUTOARTICLES . "</a><div>";
        echo "<div><a href='allarticles.php?action=expired'>" . _AM_EXPIREDARTICLES . "</a><div>";
        echo "<div><a href='allarticles.php?action=autoexpire'>" . _AM_AUTOEXPIREARTICLES . "</a><div>";
        echo "<div><a href='allarticles.php?action=submitted'>" . _AM_SUBLARTICLES . "</a><div>";
        echo "<div><a href='allarticles.php?action=online'>" . _AM_ONLINARTICLES . "</a><div>";
        echo "<div><a href='allarticles.php?action=offline'>" . _AM_OFFLIARTICLES . "</a><div>";
        echo "</td></tr></table><br>";
        if (WfsCategory::countByArticle() > 0) {
            echo "<table width='100%' border='0' cellspacing='1' cellpadding = '2' class='outer'><tr>";
            echo "<td class='even'>";
            echo "<div class= 'bg3'><h4>" . _AM_POSTNEWARTICLE . "</h4></div>";
            $article = new WfsArticle();
            $article->editform();
            echo "</td></tr></table>";
        } else {
            echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td class='odd'>";
            echo "<h4>" . _AM_NOCATEGORY . "</h4>";
            echo "<div><b><a href='category.php?op=default'>" . _AM_CATEGORYTAKEMETO . "</a></b></div>";
            echo "</td></tr></table>";
        }
        wfsfooter();
        break;
}
xoops_cp_footer();
예제 #10
0
global $wfsConfig;
foreach ($HTTP_POST_VARS as $k => $v) {
    ${$k} = $v;
}
foreach ($HTTP_GET_VARS as $k => $v) {
    ${$k} = $v;
}
$article_id = isset($HTTP_GET_VARS['articleid']) ? intval($HTTP_GET_VARS['articleid']) : 0;
$item_id = isset($HTTP_GET_VARS['item_id']) ? intval($HTTP_GET_VARS['item_id']) : 0;
$item_id = !empty($articleid) ? $articleid : $item_id;
if (empty($item_id)) {
    redirect_header("index.php", 2, _WFS_NOSTORY);
    exit;
}
$myts =& MyTextSanitizer::getInstance();
$article = new WfsArticle($item_id);
if ($article->ishtml == '2') {
    $xoopsOption['template_main'] = 'wfsection_htmlart.html';
} else {
    $xoopsOption['template_main'] = 'wfsection_article.html';
}
include_once XOOPS_ROOT_PATH . "/header.php";
//$article = new WfsArticle($item_id);
if (checkAccess($article->groupid)) {
    if (isset($HTTP_GET_VARS['page'])) {
        $page = intval($HTTP_GET_VARS['page']);
    } else {
        $page = 0;
        if (!($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid()))) {
            $article->updateCounter();
        }
예제 #11
0
if ( isset($_POST['id']) )         $id        = intval( $_POST['id'] );
if ( isset($_POST['notifypub']) )  $notifypub = intval( $_POST['notifypub'] );
if ( isset($_POST['nobr']) )       $nobr      = intval( $_POST['nobr'] );
if ( isset($_POST['nosmiley']) )   $nosmiley  = intval( $_POST['nosmiley'] );
if ( isset($_POST['enaamp']) )     $enaamp    = intval( $_POST['enaamp'] );
if ( isset($_POST['subject']) )    $subject = $_POST['subject'];
if ( isset($_POST['message']) )    $message = $_POST['message'];
if ( isset($_POST['summary']) )    $summary = $_POST['summary'];
if ( isset($_POST['groupid']) )    $groupid = $_POST['groupid'];
if ( isset($_POST['url']) )        $url     = $_POST['url'];
if ( isset($_POST['urlname']) )    $urlname = $_POST['urlname'];

$uid = 0;
if ( $xoopsUser ) {	$uid = $xoopsUser->getVar('uid');	}

$article = new WfsArticle($articleid);

// permition check
if (!$wfsAutherEdit || ($uid == 0) || ($uid != $article->uid()) ) 
{
	redirect_header("index.php", 1, _NOPERM);
	exit();
}

$myts =& MyTextSanitizer::getInstance(); // MyTextSanitizer object

$submitform_title = _WFS_MODIFY_TITLE;

// file upload
$file_submitform_flag = 0;
예제 #12
0
function db_store($maintext,$title,$time)
{
	global $xoopsUser, $wfsConfig;

	$cid       = $_POST['categoryid'];
	$flag_test = $_POST['test'];

	if ($flag_test) { return; }
	if (!$maintext) { return false; }
	if (!$title)    { return false; }
	if (!$time)     { return false; }
	if (!$cid)      { return false; }

	$article = new WfsArticle();

// bug 
// title occure error in DB processing, whiche have an escape character
//	$article->setTitle($title);

// bug
// double addslashes when magic_quotes_gpc is off 
//	$article->setTitle( addslashes($title) );
//	$article->setMainText( addslashes($maintext) );

	if (get_magic_quotes_gpc()) 
	{
		$title    = addslashes($title);
		$maintext = addslashes($maintext);
	}

	$article->setTitle( $title );
	$article->setMainText( $maintext );

	$article->setPublished($time);
	$article->setCategoryid($cid);
	$article->setUid( $xoopsUser->getvar('uid') );

	$article->settype("admin");
	$article->groupid = saveAccess('1 3 2'); // admin guest user
	$article->setChangeuser(-1);
	$article->setHtmlpage('');
	$article->setWeight(0);
	$article->setExpired(0);
	$article->noshowart = 0;
	$article->nohtml    = 0;
	$article->nosmiley  = 0;
	$article->approved  = 0;
	$article->offline   = 0;
	$article->notifypub = 0;
	$article->ishtml    = 0;
	$article->nobr      = 1;
	$article->enaamp    = 1;

	if ( $article->store() ) { return true; }
	else { return false; }
}
예제 #13
0
function searchArticleByTitle($title, $limit=20) 
{
	$match_array   = array();

	$start  = 0; 
	$catid  = '';	// all category
	$sarray = WfsArticle::searchByTitle($title,$limit,$start,$catid);

	if (!$sarray) { return; }	// no match

	foreach ($sarray as $article) 
	{	$id       = $article->articleid;
		$title    = $article->title;
		$category = $article->category->title();
		array_push( $match_array,array($id,$title,$category) );
	}

	return $match_array;
} 
예제 #14
0
 echo "Total Attached file/s: " . $totalfiles . "<br /><br />";
 while (list($fileid, $filerealname, $filetext, $articleid, $fileshowname, $date, $ext, $minetype, $downloadname, $counter, $filedescript) = $xoopsDB->fetchRow($result)) {
     $icon = get_icon(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $filerealname);
     $iconshow = "<img src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/" . $icon . " align = absmiddle>";
     $mimeshow = $mimetype->getType(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $filerealname);
     $editlink = "<a href='index.php?op=fileedit&amp;fileid=" . $fileid . "'>" . _AM_EDIT . "</a>";
     $dellink = "<a href='index.php?op=delfile&amp;fileid=" . $fileid . "'>" . _AM_DELETE . "</a>";
     if (!is_file(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $filerealname)) {
         $filerealname = "Error!";
     }
     if (is_file(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $filerealname)) {
         $size = Prettysize(filesize(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $filerealname));
     } else {
         $size = '0';
     }
     $article = new WfsArticle($articleid);
     $articlelink = "<a href='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/article.php?articleid=" . $articleid . "'>" . $article->textLink() . "</a>";
     echo "<tr>";
     echo "<td class='head' align = 'center' >{$fileid}</td>";
     echo "<td align='center' class='even'>{$articlelink}</td>";
     echo "<td class='even' align = 'center' nowrap='nowrap'>{$filerealname}</a></td>";
     echo "<td class='even' align = 'center'>{$fileshowname}</td>";
     echo "<td class='even' align = 'center' nowrap='nowrap' >{$iconshow} ({$ext})</a></td>";
     echo "<td align='center' class='even'>{$mimeshow}</td>";
     echo "<td align='center' class='even'>{$size}</td>";
     echo "<td align='center' class='even'>{$editlink} {$dellink}</td>";
     echo "</tr>";
 }
 echo "</table>";
 wfsfooter();
 xoops_cp_footer();
예제 #15
0
if ($action == 'autoexpire') {
    $dataselect = 6;
}
if ($action == 'autoart') {
    $dataselect = 7;
}
if ($action == 'expired') {
    $dataselect = 8;
}
if ($action == 'noshowart') {
    $dataselect = 9;
}
xoops_cp_header();
$articlearray = WfsArticle::getAllArticle($wfsConfig['lastart'], $start, $xoopsOption, $dataselect);
$scount = count(WfsArticle::getAllArticle($wfsConfig['lastart'], 0, 0, $dataselect));
$totalcount = count(WfsArticle::getAllArticle(0, 0, 0, $dataselect));
echo "<div><h4>" . _AM_ARTICLEMANAGEMENT . "</h4></div>";
adminmenu();
echo "<table width='100%' border='0' cellpadding = '2' cellspacing='0' class='outer'>";
echo "<tr class = 'even'><td>";
echo "<div><a href='" . $HTTP_SERVER_VARS['PHP_SELF'] . "?action=all'>" . _AM_ALLARTICLES . "</a></div>";
echo "<div><a href='" . $HTTP_SERVER_VARS['PHP_SELF'] . "?action=published'>" . _AM_PUBLARTICLES . "</a></div>";
echo "<div><a href='" . $HTTP_SERVER_VARS['PHP_SELF'] . "?action=autoart'>" . _AM_AUTOARTICLES . "</a><div>";
echo "<div><a href='" . $HTTP_SERVER_VARS['PHP_SELF'] . "?action=expired'>" . _AM_EXPIREDARTICLES . "</a><div>";
echo "<div><a href='" . $HTTP_SERVER_VARS['PHP_SELF'] . "?action=autoexpire'>" . _AM_AUTOEXPIREARTICLES . "</a><div>";
echo "<div><a href='" . $HTTP_SERVER_VARS['PHP_SELF'] . "?action=submitted'>" . _AM_SUBLARTICLES . "</a><div>";
echo "<div><a href='" . $HTTP_SERVER_VARS['PHP_SELF'] . "?action=online'>" . _AM_ONLINARTICLES . "</a><div>";
echo "<div><a href='" . $HTTP_SERVER_VARS['PHP_SELF'] . "?action=offline'>" . _AM_OFFLIARTICLES . "</a><div>";
echo "<div><a href='" . $HTTP_SERVER_VARS['PHP_SELF'] . "?action=noshowart'>" . _AM_NOSHOWARTICLES . "</a><div>";
echo "</td></tr></table><br>";
echo "<table width='100%' border='0' cellpadding ='2' cellspacing='1' class='outer'>";