31 if (!defined(
'XOOPS_ROOT_PATH')) {
32 die(
"XOOPS root path not defined");
34 require_once XOOPS_ROOT_PATH.
'/class/xml/rpc/xmlrpcapi.php';
46 if (!$this->
_checkUser($this->params[1], $this->params[2])) {
53 foreach (
$fields as $tag => $detail) {
54 if (!isset($this->params[3][$tag])) {
55 $data = $this->
_getTagCdata($this->params[3][
'xoops_text'], $tag,
true);
56 if (trim($data) ==
''){
57 if ($detail[
'required']) {
64 $post[$tag] =& $this->params[3][$tag];
67 if (count($missing) > 0) {
69 foreach ($missing as $m) {
75 include_once XOOPS_ROOT_PATH.
'/modules/news/class/class.newsstory.php';
76 $story =
new NewsStory();
78 if (intval($this->params[4]) > 0) {
84 $story->setType(
'admin');
85 $story->setApproved(
true);
86 $story->setPublished(time());
90 $story->setType(
'user');
92 $story->setType(
'admin');
96 if (isset($post[
'categories']) && !empty($post[
'categories'][0])) {
97 $story->setTopicId(intval($post[
'categories'][0][
'categoryId']));
99 $story->setTopicId(1);
101 $story->setTitle(addslashes(trim($post[
'title'])));
102 if (isset($post[
'moretext'])) {
103 $story->setBodytext(addslashes(trim($post[
'moretext'])));
105 if (!isset($post[
'hometext'])) {
106 $story->setHometext(addslashes(trim($this->params[3][
'xoops_text'])));
108 $story->setHometext(addslashes(trim($post[
'hometext'])));
110 $story->setUid($this->user->getVar(
'uid'));
111 $story->setHostname(
$_SERVER[
'REMOTE_ADDR']);
113 $story->setNohtml(1);
115 $story->setNohtml(0);
117 $story->setNosmiley(0);
118 $story->setNotifyPub(1);
119 $story->setTopicalign(
'R');
120 $ret = $story->store();
134 if (!$this->
_checkUser($this->params[1], $this->params[2])) {
140 foreach (
$fields as $tag => $detail) {
141 if (!isset($this->params[3][$tag])) {
142 $data = $this->
_getTagCdata($this->params[3][
'xoops_text'], $tag,
true);
143 if (trim($data) ==
''){
144 if ($detail[
'required']) {
151 $post[$tag] = $this->params[3][$tag];
154 if (count($missing) > 0) {
156 foreach ($missing as $m) {
162 include_once XOOPS_ROOT_PATH.
'/modules/news/class/class.newsstory.php';
163 $story =
new NewsStory($this->params[0]);
164 $storyid = $story->storyid();
165 if (empty($storyid)) {
170 $story->setTitle(addslashes(trim($post[
'title'])));
171 if (isset($post[
'moretext'])) {
172 $story->setBodytext(addslashes(trim($post[
'moretext'])));
174 if (!isset($post[
'hometext'])) {
175 $story->setHometext(addslashes(trim($this->params[3][
'xoops_text'])));
177 $story->setHometext(addslashes(trim($post[
'hometext'])));
179 if ($this->params[4]) {
180 $story->setApproved(
true);
181 $story->setPublished(time());
183 $story->setTopicalign(
'R');
184 if (!$story->store()) {
197 if (!$this->
_checkUser($this->params[1], $this->params[2])) {
204 include_once XOOPS_ROOT_PATH.
'/modules/news/class/class.newsstory.php';
205 $story =
new NewsStory($this->params[0]);
206 if (!$story->delete()) {
218 if (!$this->
_checkUser($this->params[1], $this->params[2])) {
222 include_once XOOPS_ROOT_PATH.
'/modules/news/class/class.newsstory.php';
223 $story =
new NewsStory($this->params[0]);
224 $ret = array(
'uid' => $story->uid(),
'published' => $story->published(),
'storyid' => $story->storyId(),
'title' => $story->title(
'Edit'),
'hometext' => $story->hometext(
'Edit'),
'moretext' => $story->bodytext(
'Edit'));
233 foreach (
$ret as $key => $value) {
243 $struct->add(
'link',
new XoopsXmlRpcString(XOOPS_URL.
'/modules/news/article.php?item_id='.$value));
244 $struct->add(
'permaLink',
new XoopsXmlRpcString(XOOPS_URL.
'/modules/news/article.php?item_id='.$value));
250 $content .=
'<'.$key.
'>'.trim($value).
'</'.$key.
'>';
255 $this->response->add($struct);
263 if (!$this->
_checkUser($this->params[1], $this->params[2])) {
266 include_once XOOPS_ROOT_PATH.
'/modules/news/class/class.newsstory.php';
267 if (isset($this->params[4]) && intval($this->params[4]) > 0) {
268 $stories =& NewsStory::getAllPublished(intval($this->params[3]), 0, $this->params[4]);
270 $stories =& NewsStory::getAllPublished(intval($this->params[3]));
272 $scount = count($stories);
274 for (
$i = 0;
$i < $scount;
$i++) {
275 $ret[] = array(
'uid' => $stories[
$i]->uid(),
'published' => $stories[
$i]->published(),
'storyid' => $stories[
$i]->storyId(),
'title' => $stories[
$i]->title(
'Edit'),
'hometext' => $stories[
$i]->hometext(
'Edit'),
'moretext' => $stories[
$i]->bodytext(
'Edit'));
280 if (count(
$ret) == 0) {
284 $count = count(
$ret);
285 for (
$i = 0;
$i < $count;
$i++) {
288 foreach(
$ret[
$i] as $key => $value) {
298 $struct->add(
'link',
new XoopsXmlRpcString(XOOPS_URL.
'/modules/news/article.php?item_id='.$value));
299 $struct->add(
'permaLink',
new XoopsXmlRpcString(XOOPS_URL.
'/modules/news/article.php?item_id='.$value));
305 $content .=
'<'.$key.
'>'.trim($value).
'</'.$key.
'>';
313 $this->response->add($arr);
321 if (!$this->
_checkUser($this->params[1], $this->params[2])) {
324 include_once XOOPS_ROOT_PATH.
'/class/xoopstopic.php';
327 $ret = $xt->getTopicsList();
331 if (count($ret) == 0) {
335 foreach ($ret as $topic_id => $topic_vars) {
343 $this->response->add($arr);