示例#1
0
// MyTextSanitizer object
$sfiles = new sFiles($fileid);
// Do we have the right to see the file ?
$article = new NewsStory($sfiles->getStoryid());
// and the news, can we see it ?
if ($article->published() == 0 || $article->published() > time()) {
    redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOSTORY);
    exit;
}
// Expired
if ($article->expired() != 0 && $article->expired() < time()) {
    redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOSTORY);
    exit;
}
$gperm_handler =& xoops_gethandler('groupperm');
if (is_object($xoopsUser)) {
    $groups = $xoopsUser->getGroups();
} else {
    $groups = XOOPS_GROUP_ANONYMOUS;
}
if (!$gperm_handler->checkRight('news_view', $article->topicid(), $groups, $xoopsModule->getVar('mid'))) {
    redirect_header(XOOPS_URL . '/modules/news/index.php', 3, _NOPERM);
    exit;
}
$sfiles->updateCounter();
$url = XOOPS_UPLOAD_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;
示例#2
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 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);
         $onecomment->setVar('com_itemid', $news_newsid);
         $comment_handler->insert($onecomment);