31 if (!defined(
'XOOPS_ROOT_PATH')) {
32 die(
"XOOPS root path not defined");
34 require_once XOOPS_ROOT_PATH.
'/class/xml/rpc/xmlrpcapi.php';
49 if (!$this->
_checkUser($this->params[1], $this->params[2])) {
58 foreach (
$fields as $tag => $detail) {
60 if (!isset($this->params[3][$maptag])) {
61 $data = $this->
_getTagCdata($this->params[3][
'description'], $maptag,
true);
62 if (trim($data) ==
''){
63 if ($detail[
'required']) {
70 $post[$tag] = $this->params[3][$maptag];
73 if (count($missing) > 0) {
75 foreach ($missing as $m) {
76 $msg .=
'<'.$m.
'> ';echo $m;
81 $newparams[0] = $this->params[0];
82 $newparams[1] = $this->params[1];
83 $newparams[2] = $this->params[2];
84 foreach ($post as $key => $value) {
85 $newparams[3][$key] =& $value;
88 $newparams[3][
'xoops_text'] = $this->params[3][
'description'];
89 if (isset($this->params[3][
'categories']) && is_array($this->params[3][
'categories'])) {
90 foreach ($this->params[3][
'categories'] as $k => $v) {
91 $newparams[3][
'categories'][$k] = $v;
94 $newparams[4] = $this->params[4];
96 $xoopsapi->_setUser($this->user, $this->isadmin);
105 if (!$this->
_checkUser($this->params[1], $this->params[2])) {
112 foreach (
$fields as $tag => $detail) {
114 if (!isset($this->params[3][$maptag])) {
115 $data = $this->
_getTagCdata($this->params[3][
'description'], $maptag,
true);
116 if (trim($data) ==
''){
117 if ($detail[
'required']) {
124 $post[$tag] =& $this->params[3][$maptag];
127 if (count($missing) > 0) {
129 foreach ($missing as $m) {
134 $newparams = array();
135 $newparams[0] = $this->params[0];
136 $newparams[1] = $this->params[1];
137 $newparams[2] = $this->params[2];
138 foreach ($post as $key => $value) {
139 $newparams[3][$key] =& $value;
142 if (isset($this->params[3][
'categories']) && is_array($this->params[3][
'categories'])) {
143 foreach ($this->params[3][
'categories'] as $k => $v) {
144 $newparams[3][
'categories'][$k] = $v;
147 $newparams[3][
'xoops_text'] = $this->params[3][
'description'];
148 $newparams[4] = $this->params[4];
150 $xoopsapi->_setUser($this->user, $this->isadmin);
151 $xoopsapi->editPost();
159 if (!$this->
_checkUser($this->params[1], $this->params[2])) {
163 $xoopsapi->_setUser($this->user, $this->isadmin);
164 $ret =& $xoopsapi->getPost(
false);
165 if (is_array(
$ret)) {
168 foreach (
$ret as $key => $value) {
179 $struct->add(
'link',
new XoopsXmlRpcString(XOOPS_URL.
'/modules/xoopssections/item.php?item='.$value));
180 $struct->add(
'permaLink',
new XoopsXmlRpcString(XOOPS_URL.
'/modules/xoopssections/item.php?item='.$value));
186 $content .=
'<'.$key.
'>'.trim($value).
'</'.$key.
'>';
191 $this->response->add($struct);
200 if (!$this->
_checkUser($this->params[1], $this->params[2])) {
204 $xoopsapi->_setUser($this->user, $this->isadmin);
205 $ret =& $xoopsapi->getRecentPosts(
false);
206 if (is_array(
$ret)) {
208 $count = count(
$ret);
212 for (
$i = 0;
$i < $count;
$i++) {
215 foreach(
$ret[
$i] as $key => $value) {
226 $struct->add(
'link',
new XoopsXmlRpcString(XOOPS_URL.
'/modules/news/article.php?item_id='.$value));
227 $struct->add(
'permaLink',
new XoopsXmlRpcString(XOOPS_URL.
'/modules/news/article.php?item_id='.$value));
233 $content .=
'<'.$key.
'>'.trim($value).
'</'.$key.
'>';
241 $this->response->add($arr);
251 if (!$this->
_checkUser($this->params[1], $this->params[2])) {
255 $xoopsapi->_setUser($this->user, $this->isadmin);
256 $ret =& $xoopsapi->getCategories(
false);
257 if (is_array(
$ret)) {
259 foreach (
$ret as $id => $detail) {
262 $struct->add(
'htmlUrl',
new XoopsXmlRpcString(XOOPS_URL.
'/modules/news/index.php?storytopic='.$id));
265 $catstruct->add($detail[
'title'], $struct);
266 $arr->add($catstruct);
270 $this->response->add($arr);