Beispiel #1
0
 $nohtml_db = 1;
 if ($xoopsUser) {
     $uid = $xoopsUser->getVar('uid');
     if ($xoopsUser->isAdmin($xoopsModule->mid())) {
         $nohtml_db = empty($nohtml) ? 0 : 1;
     }
 } else {
     if ($xoopsModuleConfig['anonpost'] == 1) {
         $uid = 0;
     } else {
         redirect_header("index.php", 3, _NOPERM);
         exit;
     }
 }
 $story = new NewsStory();
 $story->setTitle($subject);
 $story->setHometext($message);
 $story->setUid($uid);
 $story->setTopicId($topic_id);
 $story->setHostname(xoops_getenv('REMOTE_ADDR'));
 $story->setNohtml($nohtml_db);
 $nosmiley = isset($nosmiley) ? intval($nosmiley) : 0;
 $notifypub = isset($notifypub) ? intval($notifypub) : 0;
 $story->setNosmiley($nosmiley);
 $story->setNotifyPub($notifypub);
 $story->setType('user');
 if ($xoopsModuleConfig['autoapprove'] == 1) {
     $approve = 1;
     $story->setApproved($approve);
     $story->setPublished(time());
     $story->setExpired(0);
 function editPost()
 {
     if (!$this->_checkUser($this->params[1], $this->params[2])) {
         $this->response->add(new XoopsXmlRpcFault(104));
     } else {
         if (!($fields =& $this->_getPostFields($this->params[0]))) {
         } else {
             $missing = array();
             foreach ($fields as $tag => $detail) {
                 if (!isset($this->params[3][$tag])) {
                     $data = $this->_getTagCdata($this->params[3]['xoops_text'], $tag, true);
                     if (trim($data) == '') {
                         if ($detail['required']) {
                             $missing[] = $tag;
                         }
                     } else {
                         $post[$tag] = $data;
                     }
                 } else {
                     $post[$tag] = $this->params[3][$tag];
                 }
             }
             if (count($missing) > 0) {
                 $msg = '';
                 foreach ($missing as $m) {
                     $msg .= '<' . $m . '> ';
                 }
                 $this->response->add(new XoopsXmlRpcFault(109, $msg));
             } else {
                 // will be removed... don't worry if this looks bad
                 include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
                 $story = new NewsStory($this->params[0]);
                 $storyid = $story->storyid();
                 if (empty($storyid)) {
                     $this->response->add(new XoopsXmlRpcFault(106));
                 } elseif (!$this->_checkAdmin()) {
                     $this->response->add(new XoopsXmlRpcFault(111));
                 } else {
                     $story->setTitle(addslashes(trim($post['title'])));
                     if (isset($post['moretext'])) {
                         $story->setBodytext(addslashes(trim($post['moretext'])));
                     }
                     if (!isset($post['hometext'])) {
                         $story->setHometext(addslashes(trim($this->params[3]['xoops_text'])));
                     } else {
                         $story->setHometext(addslashes(trim($post['hometext'])));
                     }
                     if ($this->params[4]) {
                         $story->setApproved(true);
                         $story->setPublished(time());
                     }
                     $story->setTopicalign('R');
                     if (!$story->store()) {
                         $this->response->add(new XoopsXmlRpcFault(106));
                     } else {
                         $this->response->add(new XoopsXmlRpcBoolean(true));
                     }
                 }
             }
         }
     }
 }
Beispiel #3
0
 } else {
     if (isset($_POST['storyid'])) {
         $storyid = intval($_POST['storyid']);
     } else {
         $storyid = 0;
     }
 }
 if (empty($storyid)) {
     $story = new NewsStory();
     $editmode = false;
 } else {
     $story = new NewsStory($storyid);
     $editmode = true;
 }
 $story->setUid($uid);
 $story->setTitle($_POST['title']);
 $story->setHometext($_POST['hometext']);
 $story->setTopicId(intval($_POST['topic_id']));
 $story->setHostname(xoops_getenv('REMOTE_ADDR'));
 $story->setNohtml($nohtml_db);
 $nosmiley = isset($_POST['nosmiley']) ? intval($_POST['nosmiley']) : 0;
 $story->setNosmiley($nosmiley);
 $notifypub = isset($_POST['notifypub']) ? intval($_POST['notifypub']) : 0;
 $story->setNotifyPub($notifypub);
 $story->setType($_POST['type']);
 if (!empty($_POST['autodate']) && $approveprivilege) {
     $publish_date = $_POST['publish_date'];
     $pubdate = strtotime($publish_date['date']) + $publish_date['time'];
     //$offset = $xoopsUser -> timezone() - $xoopsConfig['server_TZ'];
     //$pubdate = $pubdate - ( $offset * 3600 );
     $story->setPublished($pubdate);
Beispiel #4
0
$op = 'form';
if (isset($_GET['post_id'])) {
    $post_id = intval($_GET['post_id']);
} elseif (isset($_POST['post']) || isset($_POST['post_id'])) {
    $op = 'post';
    $post_id = intval($_POST['post_id']);
} else {
    redirect_header('index.php', 3, _MD_ERRORPOST);
}
switch ($op) {
    case 'post':
        //get the post
        $post_handler =& xoops_getmodulehandler('post', 'newbb');
        $post = $post_handler->get($post_id);
        $story = new NewsStory();
        $story->setTitle($post->getVar('subject', 'e'));
        /**/
        $story->setHometext($post->getVar('post_text', 'e'));
        /**/
        $story->setUid($post->getVar('uid'));
        /**/
        $story->setTopicId(1);
        /**/
        $story->setHostname(xoops_getenv('REMOTE_ADDR'));
        /**/
        $dohtml = $post->getVar('dohtml');
        $nohtml = empty($dohtml) ? 1 : 0;
        $story->setNohtml($nohtml);
        /**/
        $story->setNosmiley(0);
        /**/
Beispiel #5
0
     if ($xoopsUser->isAdmin($xoopsModule->mid())) {
         $nohtml_db = empty($_POST['nohtml']) ? 0 : 1;
     }
     if ($xoopsModuleConfig['anonpost'] == 1 && $noname) {
         $uid = 0;
     }
 } else {
     if ($xoopsModuleConfig['anonpost'] == 1) {
         $uid = 0;
     } else {
         redirect_header("index.php", 3, _NOPERM);
         exit;
     }
 }
 $story = new NewsStory();
 $story->setTitle($_POST['subject']);
 $story->setHometext($_POST['message']);
 $story->setUid($uid);
 $story->setTopicId($topic_id);
 $story->setHostname(xoops_getenv('REMOTE_ADDR'));
 $story->setNohtml($nohtml_db);
 $story->setNosmiley($nosmiley);
 $story->setNotifyPub($notifypub);
 $story->setType('user');
 if ($xoopsModuleConfig['autoapprove'] == 1) {
     $approve = 1;
     $story->setApproved($approve);
     $story->setPublished(time());
     $story->setExpired(0);
     $story->setTopicalign('R');
 }
Beispiel #6
0
         $isnew = 1;
     } else {
         if (!empty($movetotop)) {
             $story->setPublished(time());
         }
     }
     if (!empty($autoexpdate)) {
         $expdate = mktime($autoexphour, $autoexpmin, 0, $autoexpmonth, $autoexpday, $autoexpyear);
         $offset = $xoopsUser->timezone() - $xoopsConfig['server_TZ'];
         $expdate = $expdate - $offset * 3600;
         $story->setExpired($expdate);
     }
 }
 $story->setApproved($approve);
 $story->setTopicId($topicid);
 $story->setTitle($title);
 $story->setHometext($hometext);
 $story->setBodytext($bodytext);
 $nohtml = empty($nohtml) ? 0 : 1;
 $nosmiley = empty($nosmiley) ? 0 : 1;
 $story->setNohtml($nohtml);
 $story->setNosmiley($nosmiley);
 $story->setIhome($ihome);
 $story->setTopicalign($topicalign);
 $story->setTopicdisplay($topicdisplay);
 $story->store();
 $notification_handler =& xoops_gethandler('notification');
 $tags = array();
 $tags['STORY_NAME'] = $story->title();
 $tags['STORY_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/article.php?storyid=' . $story->storyid();
 if (!empty($isnew)) {
     while ($link = $db->fetchArray($result7)) {
         if (trim($links) == '') {
             $links = "\n\n" . _AMS_NW_RELATEDARTICLES . "\n\n";
         }
         $links .= _AMS_NW_EXTERNALLINK . ' [url=' . $link['link_link'] . ']' . $link['link_title'] . '[/url]' . "\n";
     }
 }
 // The forum
 $forum = '';
 if ($use_forum && $one_amstopic['forum_id'] != 0) {
     $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'];