Esempio n. 1
0
  				$news->store($approved);
  				echo '<br>&nbsp;&nbsp;This story was imported : '.$news->title();
  				$news_newsid=$news->storyid();	// ********************

  				// The files
				$result4 = $db->query('SELECT * FROM '.$ams_files.' WHERE storyid='.$ams_newsid);
				while ( $file = $db->fetchArray($result4) ) {
					$sfile = new nw_sFiles();
  					$sfile->setFileRealName($file['filerealname']);
  					$sfile->setStoryid($news_newsid);
  					$sfile->date=$file['date'];
  					$sfile->setMimetype($file['mimetype']);
  					$sfile->setDownloadname($file['downloadname']);
  					$sfile->counter=$file['counter'];
  					$sfile->store();
  					echo '<br>&nbsp;&nbsp;&nbsp;&nbsp;This file was imported : '.$sfile->getDownloadname();
  					$news_fileid=$sfile->fileid;
				}

				// The ratings
				$result5 = $db->query('SELECT * FROM '.$ams_rating.' WHERE storyid='.$ams_newsid);
				while ( $ratings = $db->fetchArray($result5) ) {
					$result6 = $db->queryF('INSERT INTO '.$news_stories_votedata." (storyid, ratinguser, rating, ratinghostname, ratingtimestamp) VALUES (".$news_newsid.','.$ratings['ratinguser'].','.$ratings['rating'].','.$ratings['ratinghostname'].','.$ratings['ratingtimestamp'].')');
				}

				// The comments
				$comments =& $comment_handler->getByItemId($ams_mid, $ams_newsid, 'ASC');
				if(is_array($comments) && count($comments)>0) {
					foreach($comments as $onecomment) {
						$onecomment->setNew();
						$onecomment->setVar('com_modid',$news_mid);
Esempio n. 2
0
if ( $article->published() == 0 || $article->published() > time() ) {
    redirect_header(NW_MODULE_URL . '/index.php', 2, _MA_NW_NOSTORY);
    exit();
}
// Expired
if ( $article->expired() != 0 && $article->expired() < time() ) {
    redirect_header(NW_MODULE_URL . '/index.php', 2, _MA_NW_NOSTORY);
    exit();
}


$gperm_handler =& xoops_gethandler('groupperm');
if (is_object($xoopsUser)) {
    $groups = $xoopsUser->getGroups();
} else {
	$groups = XOOPS_GROUP_ANONYMOUS;
}
if (!$gperm_handler->checkRight('nw_view', $article->topicid(), $groups, $xoopsModule->getVar('mid'))) {
	redirect_header(NW_MODULE_URL . '/index.php', 3, _NOPERM);
	exit();
}

$sfiles->updateCounter();
$url=NW_ATTACHED_FILES_URL.'/'.$sfiles->getDownloadname();
if (!preg_match("/^ed2k*:\/\//i", $url)) {
	Header("Location: $url");
}
echo "<html><head><meta http-equiv=\"Refresh\" content=\"0; URL=".$myts->htmlSpecialChars($url)."\"></meta></head><body></body></html>";
exit();
?>