/**
  *
  * @brief return XoopsXmlRpcTag that has response of this request
  *
  * @return XoopsXmlRpcTag
  */
 function render()
 {
     $resp = new XoopsXmlRpcArray();
     $preference = $this->response->getSuccess();
     foreach ($preference as $key => $val) {
         $struct = new XoopsXmlRpcStruct();
         $struct->add('name', new XoopsXmlRpcString($key));
         $struct->add('value', new XoopsXmlRpcInt((int) $val));
         $resp->add($struct);
         unset($struct);
     }
     return $resp;
 }
 /**
  *
  * @brief return XoopsXmlRpcTag that has response of this request
  *
  * @return XoopsXmlRpcTag
  */
 function render()
 {
     $resp = new XoopsXmlRpcArray();
     foreach ($this->response->getSuccess() as $i) {
         $struct = new XoopsXmlRpcStruct();
         $struct->add('id', new XoopsXmlRpcInt($i->get('item_type_id')));
         $struct->add('name', new XoopsXmlRpcString($i->get('name')));
         $struct->add('title', new XoopsXmlRpcString($i->get('display_name')));
         $struct->add('description', new XoopsXmlRpcString($i->getDescription()));
         $resp->add($struct);
         unset($struct);
     }
     return $resp;
 }
 /**
  *
  * @brief return XoopsXmlRpcTag that has response of this request
  *
  * @return XoopsXmlRpcTag
  */
 function render()
 {
     $unicode =& xoonips_getutility('unicode');
     $resp = new XoopsXmlRpcArray();
     foreach ($this->response->getSuccess() as $index) {
         $struct = new XoopsXmlRpcStruct();
         $struct->add('id', new XoopsXmlRpcInt($index['id']));
         $struct->add('name', new XoopsXmlRpcString(htmlspecialchars($unicode->encode_utf8($index['name'], xoonips_get_server_charset()), ENT_QUOTES, 'UTF-8')));
         $struct->add('parent', new XoopsXmlRpcInt($index['parent']));
         $struct->add('open_level', new XoopsXmlRpcString(htmlspecialchars($unicode->encode_utf8($index['open_level'], xoonips_get_server_charset()), ENT_QUOTES, 'UTF-8')));
         $struct->add('path', new XoopsXmlRpcString(htmlspecialchars($unicode->encode_utf8($index['path'], xoonips_get_server_charset()), ENT_QUOTES, 'UTF-8')));
         $resp->add($struct);
         unset($struct);
     }
     return $resp;
 }
 /**
  *
  * @brief return XoopsXmlRpcTag that has response of this request
  *
  * @return XoopsXmlRpcTag
  */
 function render()
 {
     $resp = new XoopsXmlRpcArray();
     foreach ($this->response->getSuccess() as $i) {
         $matchfor = 0;
         if ($i->get('matchfor_item')) {
             $matchfor |= 1;
         }
         if ($i->get('matchfor_file')) {
             $matchfor |= 2;
         }
         if ($i->get('matchfor_index')) {
             $matchfor |= 4;
         }
         $struct = new XoopsXmlRpcStruct();
         $struct->add('item', new XoopsXmlRpcInt($i->get('item_id')));
         $struct->add('matchfor', new XoopsXmlRpcInt($matchfor));
         $resp->add($struct);
         unset($struct);
     }
     return $resp;
 }
Esempio n. 5
0
 function getCategoryList()
 {
     if (!$this->_checkUser($this->params[1], $this->params[2])) {
         $this->response->add(new XoopsXmlRpcFault(104));
     } else {
         $xoopsapi =& $this->_getXoopsApi($this->params);
         $xoopsapi->_setUser($this->user, $this->isadmin);
         $ret =& $xoopsapi->getCategories(false);
         if (is_array($ret)) {
             $arr = new XoopsXmlRpcArray();
             foreach ($ret as $id => $name) {
                 $struct = new XoopsXmlRpcStruct();
                 $struct->add('categoryId', new XoopsXmlRpcString($id));
                 $struct->add('categoryName', new XoopsXmlRpcString($name['title']));
                 $arr->add($struct);
                 unset($struct);
             }
             $this->response->add($arr);
         } else {
             $this->response->add(new XoopsXmlRpcFault(106));
         }
     }
 }
Esempio n. 6
0
 function &getCategories($respond = true)
 {
     if (!$this->_checkUser($this->params[1], $this->params[2])) {
         $this->response->add(new XoopsXmlRpcFault(104));
     } else {
         include_once XOOPS_ROOT_PATH . '/class/xoopstopic.php';
         $this->db =& XoopsDatabaseFactory::getDatabaseConnection();
         $xt = new XoopsTopic($db->prefix('topics'));
         $ret = $xt->getTopicsList();
         if (!$respond) {
             return $ret;
         } else {
             if (count($ret) == 0) {
                 $this->response->add(new XoopsXmlRpcFault(106, 'Found 0 Entries'));
             } else {
                 $arr = new XoopsXmlRpcArray();
                 foreach ($ret as $topic_id => $topic_vars) {
                     $struct = new XoopsXmlRpcStruct();
                     $struct->add('categoryId', new XoopsXmlRpcString($topic_id));
                     $struct->add('categoryName', new XoopsXmlRpcString($topic_vars['title']));
                     $struct->add('categoryPid', new XoopsXmlRpcString($topic_vars['pid']));
                     $arr->add($struct);
                     unset($struct);
                 }
                 $this->response->add($arr);
             }
         }
     }
 }
Esempio n. 7
0
 function getCategories()
 {
     if (!$this->_checkUser($this->params[1], $this->params[2])) {
         $this->response->add(new XoopsXmlRpcFault(104));
     } else {
         $xoopsapi =& $this->_getXoopsApi($this->params);
         $xoopsapi->_setUser($this->user, $this->isadmin);
         $ret =& $xoopsapi->getCategories(false);
         if (is_array($ret)) {
             $arr = new XoopsXmlRpcArray();
             foreach ($ret as $id => $detail) {
                 $struct = new XoopsXmlRpcStruct();
                 $struct->add('description', new XoopsXmlRpcString($detail));
                 $struct->add('htmlUrl', new XoopsXmlRpcString(XOOPS_URL . '/modules/news/index.php?storytopic=' . $id));
                 $struct->add('rssUrl', new XoopsXmlRpcString(''));
                 $catstruct = new XoopsXmlRpcStruct();
                 $catstruct->add($detail['title'], $struct);
                 $arr->add($catstruct);
                 unset($struct);
                 unset($catstruct);
             }
             $this->response->add($arr);
         } else {
             $this->response->add(new XoopsXmlRpcFault(106));
         }
     }
 }
Esempio n. 8
0
 function getUsersBlogs()
 {
     if (!$this->_checkUser($this->params[1], $this->params[2])) {
         $this->response->add(new XoopsXmlRpcFault(104));
     } else {
         $arr = new XoopsXmlRpcArray();
         $struct = new XoopsXmlRpcStruct();
         $struct->add('url', new XoopsXmlRpcString(XOOPS_URL . '/modules/' . $this->module->getVar('dirname') . '/'));
         $struct->add('blogid', new XoopsXmlRpcString($this->module->getVar('mid')));
         $struct->add('blogName', new XoopsXmlRpcString('XOOPS Blog'));
         $arr->add($struct);
         $this->response->add($arr);
     }
 }
Esempio n. 9
0
 function getCategories($respond = true)
 {
     global $xoopsDB;
     if (!$this->_checkUser($this->params[1], $this->params[2])) {
         $this->response->add(new XoopsXmlRpcFault(104));
     } else {
         if (!XoopsLoad::loadFile(\XoopsBaseConfig::get('root-path') . '/class/xoopstopic.php', true)) {
             $this->response->add(new XoopsXmlRpcFault(103));
             return;
         }
         //$this->db = xoopsDB;
         $xt = new XoopsTopic($xoopsDB->prefix('topics'));
         $ret = $xt->getTopicsList();
         if (!$respond) {
             return $ret;
         } else {
             if (count($ret) == 0) {
                 $this->response->add(new XoopsXmlRpcFault(106, 'Found 0 Entries'));
             } else {
                 $arr = new XoopsXmlRpcArray();
                 foreach ($ret as $topic_id => $topic_vars) {
                     $struct = new XoopsXmlRpcStruct();
                     $struct->add('categoryId', new XoopsXmlRpcString($topic_id));
                     $struct->add('categoryName', new XoopsXmlRpcString($topic_vars['title']));
                     $struct->add('categoryPid', new XoopsXmlRpcString($topic_vars['pid']));
                     $arr->add($struct);
                     unset($struct);
                 }
                 $this->response->add($arr);
             }
         }
     }
 }
 /**
  *
  * @brief return XoopsXmlRpcTag that has response of this request
  *
  * @return XoopsXmlRpcTag
  */
 function render()
 {
     $resp = new XoopsXmlRpcStruct();
     $itemtype = $this->response->getSuccess();
     $resp->add('id', new XoopsXmlRpcInt($itemtype->get('item_type_id')));
     $resp->add('name', new XoopsXmlRpcString($itemtype->get('name')));
     $resp->add('title', new XoopsXmlRpcString($itemtype->get('display_name')));
     $resp->add('description', new XoopsXmlRpcString($itemtype->getDescription()));
     $fields = new XoopsXmlRpcArray();
     $iteminfo = $itemtype->getIteminfo();
     // include language file of itemtype
     $langman =& xoonips_getutility('languagemanager');
     $modulename = $iteminfo['ormcompo']['module'];
     $langman->read('main.php', $modulename);
     $unicode =& xoonips_getutility('unicode');
     foreach ($iteminfo['io']['xmlrpc']['item'] as $i) {
         // data_type mapping
         switch ($i['xmlrpc']['type']) {
             case 'dateTime.iso8601':
                 $datatype = 'calendar';
                 break;
             case 'boolean':
                 $datatype = 'int';
                 break;
             default:
                 $datatype = $i['xmlrpc']['type'];
                 break;
         }
         $field = new XoopsXmlRpcStruct();
         $field->add('name', new XoopsXmlRpcString(implode('.', $i['xmlrpc']['field'])));
         $field->add('display_name', new XoopsXmlRpcString($unicode->encode_utf8(constant($i['xmlrpc']['display_name']), xoonips_get_server_charset())));
         $field->add('type', new XoopsXmlRpcString($datatype));
         if (isset($i['xmlrpc']['options'])) {
             $options = new XoopsXmlRpcArray();
             foreach ($i['xmlrpc']['options'] as $option_key => $option_val) {
                 $option = new XoopsXmlRpcStruct();
                 $option->add('option', new XoopsXmlRpcString($option_val['option']));
                 $option->add('display_name', new XoopsXmlRpcString($unicode->encode_utf8(constant($option_val['display_name']), xoonips_get_server_charset())));
                 $options->add($option);
                 unset($option);
             }
             $field->add('options', $options);
             unset($options);
         } else {
             $options = new XoopsXmlRpcArray();
             $field->add('options', $options);
             unset($options);
         }
         $field->add('required', new XoopsXmlRpcBoolean(isset($i['xmlrpc']['required']) ? $i['xmlrpc']['required'] : false));
         $field->add('multiple', new XoopsXmlRpcBoolean(isset($i['xmlrpc']['multiple']) ? $i['xmlrpc']['multiple'] : false));
         $field->add('readonly', new XoopsXmlRpcBoolean(isset($i['xmlrpc']['readonly']) ? $i['xmlrpc']['readonly'] : false));
         $fields->add($field);
         unset($field);
     }
     $resp->add('fields', $fields);
     if (strlen($itemtype->getMainFileName()) == 0) {
         $resp->add('mainfile', new XoopsXmlRpcString(''));
     } else {
         $iteminfo = $itemtype->getIteminfo();
         foreach ($iteminfo['io']['xmlrpc']['item'] as $f) {
             if ($f['orm']['field'][0]['orm'] == $itemtype->getMainFileName()) {
                 $resp->add('mainfile', new XoopsXmlRpcString(implode('.', $f['xmlrpc']['field'])));
                 break;
             }
         }
     }
     if (strlen($itemtype->getPreviewFileName()) == 0) {
         $resp->add('previewfile', new XoopsXmlRpcString(''));
     } else {
         $iteminfo = $itemtype->getIteminfo();
         foreach ($iteminfo['io']['xmlrpc']['item'] as $f) {
             if ($f['orm']['field'][0]['orm'] == $itemtype->getPreviewFileName()) {
                 $resp->add('previewfile', new XoopsXmlRpcString(implode('.', $f['xmlrpc']['field'])));
                 break;
             }
         }
     }
     return $resp;
 }