@@ 43-79 (lines=37) @@ | ||
40 | } else { |
|
41 | if (!$fields =& $this->_getPostFields(null, $this->params[1])) { |
|
42 | $this->response->add(new XoopsXmlRpcFault(106)); |
|
43 | } else { |
|
44 | $missing = array(); |
|
45 | $post = array(); |
|
46 | foreach ($fields as $tag => $detail) { |
|
47 | $maptag = $this->_getXoopsTagMap($tag); |
|
48 | $data = $this->_getTagCdata($this->params[4], $maptag, true); |
|
49 | if (trim($data) == ''){ |
|
50 | if ($detail['required']) { |
|
51 | $missing[] = $maptag; |
|
52 | } |
|
53 | } else { |
|
54 | $post[$tag] = $data; |
|
55 | } |
|
56 | } |
|
57 | if (count($missing) > 0) { |
|
58 | $msg = ''; |
|
59 | foreach ($missing as $m) { |
|
60 | $msg .= '<' . $m . '> '; |
|
61 | } |
|
62 | $this->response->add(new XoopsXmlRpcFault(109, $msg)); |
|
63 | } else { |
|
64 | $newparams = array(); |
|
65 | // Xoops Api ignores App key |
|
66 | $newparams[0] = $this->params[1]; |
|
67 | $newparams[1] = $this->params[2]; |
|
68 | $newparams[2] = $this->params[3]; |
|
69 | foreach ($post as $key => $value) { |
|
70 | $newparams[3][$key] = $value; |
|
71 | unset($value); |
|
72 | } |
|
73 | $newparams[3]['xoops_text'] = $this->params[4]; |
|
74 | $newparams[4] = $this->params[5]; |
|
75 | $xoopsapi = $this->_getXoopsApi($newparams); |
|
76 | $xoopsapi->_setUser($this->user, $this->isadmin); |
|
77 | $xoopsapi->newPost(); |
|
78 | } |
|
79 | } |
|
80 | } |
|
81 | } |
|
82 | ||
@@ 87-125 (lines=39) @@ | ||
84 | { |
|
85 | if (!$this->_checkUser($this->params[2], $this->params[3])) { |
|
86 | $this->response->add(new XoopsXmlRpcFault(104)); |
|
87 | } else { |
|
88 | if (!$fields = $this->_getPostFields($this->params[1])) { |
|
89 | } else { |
|
90 | $missing = array(); |
|
91 | $post = array(); |
|
92 | foreach ($fields as $tag => $detail) { |
|
93 | $data = $this->_getTagCdata($this->params[4], $tag, true); |
|
94 | if (trim($data) == ''){ |
|
95 | if ($detail['required']) { |
|
96 | $missing[] = $tag; |
|
97 | } |
|
98 | } else { |
|
99 | $post[$tag] = $data; |
|
100 | } |
|
101 | } |
|
102 | if (count($missing) > 0) { |
|
103 | $msg = ''; |
|
104 | foreach ($missing as $m) { |
|
105 | $msg .= '<' . $m . '> '; |
|
106 | } |
|
107 | $this->response->add(new XoopsXmlRpcFault(109, $msg)); |
|
108 | } else { |
|
109 | $newparams = array(); |
|
110 | // XOOPS API ignores App key (index 0 of params) |
|
111 | $newparams[0] = $this->params[1]; |
|
112 | $newparams[1] = $this->params[2]; |
|
113 | $newparams[2] = $this->params[3]; |
|
114 | foreach ($post as $key => $value) { |
|
115 | $newparams[3][$key] = $value; |
|
116 | unset($value); |
|
117 | } |
|
118 | $newparams[3]['xoops_text'] = $this->params[4]; |
|
119 | $newparams[4] = $this->params[5]; |
|
120 | $xoopsapi = $this->_getXoopsApi($newparams); |
|
121 | $xoopsapi->_setUser($this->user, $this->isadmin); |
|
122 | $xoopsapi->editPost(); |
|
123 | } |
|
124 | } |
|
125 | } |
|
126 | } |
|
127 | ||
128 | public function deletePost() |