Exemplo n.º 1
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));
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 } 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) {
         $story->setPublished(time());
     }
     if (!$story->expired()) {
         $story->setExpired(0);
     }
     if (!$approve) {
         $story->setPublished(0);
     }
 } elseif ($xoopsModuleConfig['autoapprove'] == 1 && !$approveprivilege) {
     if (empty($storyid)) {
Exemplo n.º 3
0
         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)) {
     $notification_handler->triggerEvent('story', $story->storyid(), 'approve', $tags);
 }
Exemplo n.º 4
0
 $story->setNohtml($nohtml);
 /**/
 $story->setNosmiley(0);
 /**/
 $story->setNotifyPub(0);
 /**/
 $story->setType('admin');
 $story->setExpired(0);
 /**/
 $story->setTopicdisplay(0);
 /**/
 $story->setTopicalign('R');
 /**/
 $story->setIhome(0);
 /**/
 $story->setBodytext(' ');
 /**/
 $story->setExpired(0);
 /**/
 $story->setPublished(0);
 /**/
 $story->setApproved(0);
 /**/
 //save the story
 $result = $story->store();
 //notify
 if ($result) {
     $notification_handler =& xoops_gethandler('notification');
     $tags['WAITINGSTORIES_URL'] = XOOPS_URL . '/modules/news/admin/index.php?op=newarticle';
     $notification_handler->triggerEvent('global', 0, 'story_submit', $tags);
     $tags = array();
Exemplo n.º 5
0
 $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'];
 $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);