31 parent::__construct($params, $response, $module);
39 if (!$this->
_checkUser($this->params[1], $this->params[2])) {
46 foreach ($fields as $tag => $detail) {
47 if (!isset($this->params[3][$tag])) {
48 $data = $this->
_getTagCdata($this->params[3][
'xoops_text'], $tag,
true);
49 if (trim($data) ==
''){
50 if ($detail[
'required']) {
57 $post[$tag] = $this->params[3][$tag];
60 if (count($missing) > 0) {
62 foreach ($missing as $m) {
72 $story =
new NewsStory();
74 if (intval($this->params[4]) > 0) {
80 $story->setType(
'admin');
81 $story->setApproved(
true);
82 $story->setPublished(time());
86 $story->setType(
'user');
88 $story->setType(
'admin');
92 if (isset($post[
'categories']) && !empty($post[
'categories'][0])) {
93 $story->setTopicId(intval($post[
'categories'][0][
'categoryId']));
95 $story->setTopicId(1);
97 $story->setTitle(addslashes(trim($post[
'title'])));
98 if (isset($post[
'moretext'])) {
99 $story->setBodytext(addslashes(trim($post[
'moretext'])));
101 if (!isset($post[
'hometext'])) {
102 $story->setHometext(addslashes(trim($this->params[3][
'xoops_text'])));
104 $story->setHometext(addslashes(trim($post[
'hometext'])));
106 $story->setUid($this->user->getVar(
'uid'));
107 $story->setHostname(
$_SERVER[
'REMOTE_ADDR']);
109 $story->setNohtml(1);
111 $story->setNohtml(0);
113 $story->setNosmiley(0);
114 $story->setNotifyPub(1);
115 $story->setTopicalign(
'R');
116 $ret = $story->store();
130 if (!$this->
_checkUser($this->params[1], $this->params[2])) {
136 foreach ($fields as $tag => $detail) {
137 if (!isset($this->params[3][$tag])) {
138 $data = $this->
_getTagCdata($this->params[3][
'xoops_text'], $tag,
true);
139 if (trim($data) ==
''){
140 if ($detail[
'required']) {
147 $post[$tag] = $this->params[3][$tag];
150 if (count($missing) > 0) {
152 foreach ($missing as $m) {
162 $story =
new NewsStory($this->params[0]);
163 $storyid = $story->storyid();
164 if (empty($storyid)) {
169 $story->setTitle(addslashes(trim($post[
'title'])));
170 if (isset($post[
'moretext'])) {
171 $story->setBodytext(addslashes(trim($post[
'moretext'])));
173 if (!isset($post[
'hometext'])) {
174 $story->setHometext(addslashes(trim($this->params[3][
'xoops_text'])));
176 $story->setHometext(addslashes(trim($post[
'hometext'])));
178 if ($this->params[4]) {
179 $story->setApproved(
true);
180 $story->setPublished(time());
182 $story->setTopicalign(
'R');
183 if (!$story->store()) {
196 if (!$this->
_checkUser($this->params[1], $this->params[2])) {
207 $story =
new NewsStory($this->params[0]);
208 if (!$story->delete()) {
220 if (!$this->
_checkUser($this->params[1], $this->params[2])) {
228 $story =
new NewsStory($this->params[0]);
229 $ret = array(
'uid' => $story->uid(),
'published' => $story->published(),
'storyid' => $story->storyId(),
'title' => $story->title(
'Edit'),
'hometext' => $story->hometext(
'Edit'),
'moretext' => $story->bodytext(
'Edit'));
238 foreach ($ret as $key => $value) {
255 $content .=
'<'.$key.
'>'.trim($value).
'</'.$key.
'>';
260 $this->response->add($struct);
268 if (!$this->
_checkUser($this->params[1], $this->params[2])) {
275 if (isset($this->params[4]) && intval($this->params[4]) > 0) {
276 $stories = NewsStory::getAllPublished(intval($this->params[3]), 0, $this->params[4]);
278 $stories = NewsStory::getAllPublished(intval($this->params[3]));
280 $scount = count($stories);
282 for (
$i = 0;
$i < $scount; ++
$i) {
283 $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'));
288 if (count($ret) == 0) {
296 foreach($ret[
$i] as $key => $value) {
313 $content .=
'<'.$key.
'>'.trim($value).
'</'.$key.
'>';
321 $this->response->add($arr);
330 if (!$this->
_checkUser($this->params[1], $this->params[2])) {
338 $xt =
new XoopsTopic($xoopsDB->prefix(
'topics'));
339 $ret = $xt->getTopicsList();
343 if (count($ret) == 0) {
347 foreach ($ret as $topic_id => $topic_vars) {
355 $this->response->add($arr);
if(empty($settings['ROOT_PATH'])) elseif(empty($settings['DB_PARAMETERS'])) $error
_getTagCdata(&$text, $tag, $remove=true)
_getPostFields($post_id=null, $blog_id=null)
getCategories($respond=true)
getRecentPosts($respond=true)
_checkUser($username, $password)
if(!is_object($module)||!$module->getVar('isactive')) $msg
static loadFile($file, $once=true)
__construct(array &$params, XoopsXmlRpcResponse &$response, XoopsModule &$module)