Beispiel #1
0
     //$offset = $xoopsUser -> timezone() - $xoopsConfig['server_TZ'];
     //$pubdate = $pubdate - ( $offset * 3600 );
     $story->setPublished($pubdate);
 }
 if (!empty($_POST['autoexpdate']) && $approveprivilege) {
     $expiry_date = $_POST['expiry_date'];
     $expiry_date = strtotime($expiry_date['date']) + $expiry_date['time'];
     $offset = $xoopsUser->timezone() - $xoopsConfig['server_TZ'];
     $expiry_date = $expiry_date - $offset * 3600;
     $story->setExpired($expiry_date);
 } else {
     $story->setExpired(0);
 }
 if ($approveprivilege) {
     if (news_getmoduleoption('metadata')) {
         $story->Setdescription($_POST['description']);
         $story->Setkeywords($_POST['keywords']);
     }
     $story->setTopicdisplay($_POST['topicdisplay']);
     // Display Topic Image ? (Yes or No)
     $story->setTopicalign($_POST['topicalign']);
     // Topic Align, 'Right' or 'Left'
     $story->setIhome($_POST['ihome']);
     // Publish in home ? (Yes or No)
     if (isset($_POST['bodytext'])) {
         $story->setBodytext($_POST['bodytext']);
     } else {
         $story->setBodytext(' ');
     }
     $approve = isset($_POST['approve']) ? intval($_POST['approve']) : 0;
     if (!$story->published() && $approve) {
     $forum = "\n\n" . '[url=' . XOOPS_URL . '/modules/newbb/viewforum.php?forum=' . $one_amstopic['forum_id'] . ']' . _AMS_AM_LINKEDFORUM . '[/url]' . "\n";
 }
 // We create the story
 $news = new NewsStory();
 $news->setUid($text_lastversion['uid']);
 $news->setTitle($article['title']);
 $news->created = $article['created'];
 $news->setPublished($article['published']);
 $news->setExpired($article['expired']);
 $news->setHostname($article['hostname']);
 $news->setNohtml($article['nohtml']);
 $news->setNosmiley($article['nosmiley']);
 $news->setHometext($text_lastversion['hometext']);
 $news->setBodytext($text_lastversion['bodytext'] . $links . $forum);
 $news->Setkeywords('');
 $news->Setdescription('');
 $news->counter = $article['counter'];
 $news->setTopicId($news_topicid);
 $news->setIhome($article['ihome']);
 $news->setNotifyPub($article['notifypub']);
 $news->story_type = $article['story_type'];
 $news->setTopicdisplay($article['topicdisplay']);
 $news->setTopicalign($article['topicalign']);
 $news->setComments($article['comments']);
 $news->rating = $article['rating'];
 $news->votes = $votes['cpt'];
 $approved = $article['published'] > 0 ? true : false;
 $news->approved = $approved;
 $news->store($approved);
 echo '<br>&nbsp;&nbsp;This story was imported : ' . $news->title();
 $news_newsid = $news->storyid();