| @@ 44-88 (lines=45) @@ | ||
| 41 | } else { |
|
| 42 | if (!$fields = $this->_getPostFields(null, $this->params[0])) { |
|
| 43 | $this->response->add(new XoopsXmlRpcFault(106)); |
|
| 44 | } else { |
|
| 45 | $missing = array(); |
|
| 46 | $post = array(); |
|
| 47 | foreach ($fields as $tag => $detail) { |
|
| 48 | $maptag = $this->_getXoopsTagMap($tag); |
|
| 49 | if (!isset($this->params[3][$maptag])) { |
|
| 50 | $data = $this->_getTagCdata($this->params[3]['description'], $maptag, true); |
|
| 51 | if (trim($data) == '') { |
|
| 52 | if ($detail['required']) { |
|
| 53 | $missing[] = $maptag; |
|
| 54 | } |
|
| 55 | } else { |
|
| 56 | $post[$tag] = $data; |
|
| 57 | } |
|
| 58 | } else { |
|
| 59 | $post[$tag] = $this->params[3][$maptag]; |
|
| 60 | } |
|
| 61 | } |
|
| 62 | if (count($missing) > 0) { |
|
| 63 | $msg = ''; |
|
| 64 | foreach ($missing as $m) { |
|
| 65 | $msg .= '<' . $m . '> '; |
|
| 66 | echo $m; |
|
| 67 | } |
|
| 68 | $this->response->add(new XoopsXmlRpcFault(109, $msg)); |
|
| 69 | } else { |
|
| 70 | $newparams = array(); |
|
| 71 | $newparams[0] = $this->params[0]; |
|
| 72 | $newparams[1] = $this->params[1]; |
|
| 73 | $newparams[2] = $this->params[2]; |
|
| 74 | foreach ($post as $key => $value) { |
|
| 75 | $newparams[3][$key] = $value; |
|
| 76 | unset($value); |
|
| 77 | } |
|
| 78 | $newparams[3]['xoops_text'] = $this->params[3]['description']; |
|
| 79 | if (isset($this->params[3]['categories']) && is_array($this->params[3]['categories'])) { |
|
| 80 | foreach ($this->params[3]['categories'] as $k => $v) { |
|
| 81 | $newparams[3]['categories'][$k] = $v; |
|
| 82 | } |
|
| 83 | } |
|
| 84 | $newparams[4] = $this->params[4]; |
|
| 85 | $xoopsapi = $this->_getXoopsApi($newparams); |
|
| 86 | $xoopsapi->_setUser($this->user, $this->isadmin); |
|
| 87 | $xoopsapi->newPost(); |
|
| 88 | } |
|
| 89 | } |
|
| 90 | } |
|
| 91 | } |
|
| @@ 99-143 (lines=45) @@ | ||
| 96 | $this->response->add(new XoopsXmlRpcFault(104)); |
|
| 97 | } else { |
|
| 98 | if (!$fields = $this->_getPostFields($this->params[0])) { |
|
| 99 | } else { |
|
| 100 | $missing = array(); |
|
| 101 | $post = array(); |
|
| 102 | foreach ($fields as $tag => $detail) { |
|
| 103 | $maptag = $this->_getXoopsTagMap($tag); |
|
| 104 | if (!isset($this->params[3][$maptag])) { |
|
| 105 | $data = $this->_getTagCdata($this->params[3]['description'], $maptag, true); |
|
| 106 | if (trim($data) == ''){ |
|
| 107 | if ($detail['required']) { |
|
| 108 | $missing[] = $tag; |
|
| 109 | } |
|
| 110 | } else { |
|
| 111 | $post[$tag] = $data; |
|
| 112 | } |
|
| 113 | } else { |
|
| 114 | $post[$tag] = $this->params[3][$maptag]; |
|
| 115 | } |
|
| 116 | } |
|
| 117 | if (count($missing) > 0) { |
|
| 118 | $msg = ''; |
|
| 119 | foreach ($missing as $m) { |
|
| 120 | $msg .= '<' . $m . '> '; |
|
| 121 | } |
|
| 122 | $this->response->add(new XoopsXmlRpcFault(109, $msg)); |
|
| 123 | } else { |
|
| 124 | $newparams = array(); |
|
| 125 | $newparams[0] = $this->params[0]; |
|
| 126 | $newparams[1] = $this->params[1]; |
|
| 127 | $newparams[2] = $this->params[2]; |
|
| 128 | foreach ($post as $key => $value) { |
|
| 129 | $newparams[3][$key] = $value; |
|
| 130 | unset($value); |
|
| 131 | } |
|
| 132 | if (isset($this->params[3]['categories']) && is_array($this->params[3]['categories'])) { |
|
| 133 | foreach ($this->params[3]['categories'] as $k => $v) { |
|
| 134 | $newparams[3]['categories'][$k] = $v; |
|
| 135 | } |
|
| 136 | } |
|
| 137 | $newparams[3]['xoops_text'] = $this->params[3]['description']; |
|
| 138 | $newparams[4] = $this->params[4]; |
|
| 139 | $xoopsapi = $this->_getXoopsApi($newparams); |
|
| 140 | $xoopsapi->_setUser($this->user, $this->isadmin); |
|
| 141 | $xoopsapi->editPost(); |
|
| 142 | } |
|
| 143 | } |
|
| 144 | } |
|
| 145 | } |
|
| 146 | ||