示例#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));
                     }
                 }
             }
         }
     }
 }
示例#2
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();
     $tags['STORY_NAME'] = $post->getVar('subject', 'e');
     $tags['STORY_URL'] = XOOPS_URL . '/modules/news/ticle.php?storyid=' . $story->storyid();
     $tags['WAITINGSTORIES_URL'] = XOOPS_URL . '/modules/news/admin/index.php?op=newarticle';
     $notification_handler->triggerEvent('global', 0, 'story_submit', $tags);
 }
 redirect_header(XOOPS_URL . '/modules/news/submit.php?op=edit&amp;storyid=' . $story->storyid(), 3, _MD_THANKSSUBMIT);
示例#3
0
 }
 $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);
     $story->setTopicalign('R');
 }
 $result = $story->store();
 if ($result) {
     // Notification
     $notification_handler =& xoops_gethandler('notification');
     $tags = array();
     $tags['STORY_NAME'] = $subject;
     $tags['STORY_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/article.php?storyid=' . $story->storyid();
     if ($xoopsModuleConfig['autoapprove'] == 1) {
         $notification_handler->triggerEvent('global', 0, 'new_story', $tags);
     } else {
         $tags['WAITINGSTORIES_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/index.php?op=newarticle';
示例#4
0
         $isnew = 1;
     } else {
         if (!empty($_POST['movetotop'])) {
             $story->setPublished(time());
         }
     }
     if (!empty($_POST['autoexpdate'])) {
         $expdate = mktime($_POST['autoexphour'], $_POST['autoexpmin'], 0, $_POST['autoexpmonth'], $_POST['autoexpday'], $_POST['autoexpyear']);
         if (!empty($autoexpdate)) {
             $offset = $xoopsUser->timezone() - $xoopsConfig['server_TZ'];
         }
         $expdate = $expdate - $offset * 3600;
         $story->setExpired($expdate);
     }
 }
 $story->setApproved($_POST['approve']);
 $story->setTopicId($_POST['topicid']);
 $story->setTitle($_POST['title']);
 $story->setHometext($_POST['hometext']);
 $story->setBodytext($_POST['bodytext']);
 $nohtml = empty($_POST['nohtml']) ? 0 : 1;
 $nosmiley = empty($_POST['nosmiley']) ? 0 : 1;
 $story->setNohtml($nohtml);
 $story->setNosmiley($nosmiley);
 $story->setIhome($_POST['ihome']);
 $story->setTopicalign($_POST['topicalign']);
 $story->setTopicdisplay($_POST['topicdisplay']);
 $story->store();
 $notification_handler =& xoops_gethandler('notification');
 $tags = array();
 $tags['STORY_NAME'] = $story->title();