/** * * @brief return XoopsXmlRpcTag that has response of this request * * @return XoopsXmlRpcTag */ function render() { $permission = $this->response->getSuccess(); $resp = new XoopsXmlRpcStruct(); $resp->add('read', new XoopsXmlRpcBoolean($permission['read'])); $resp->add('write', new XoopsXmlRpcBoolean($permission['write'])); $resp->add('delete', new XoopsXmlRpcBoolean($permission['delete'])); return $resp; }
/** * * @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) { $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; }
/** * * @brief return XoopsXmlRpcTag that has response of this request * * @return XoopsXmlRpcTag */ function render() { $unicode =& xoonips_getutility('unicode'); $index = $this->response->getSuccess(); $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'))); return $struct; }
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)); } } }
/** * * @brief return XoopsXmlRpcTag that has response of this request * * @return XoopsXmlRpcTag */ function render() { $file = $this->response->getSuccess(); $filetype_handler =& xoonips_getormhandler('xoonips', 'file_type'); $filetype = $filetype_handler->get($file->get('file_type_id')); if (!$filetype) { return new XooNIpsXmlRpcFault(106, 'file_type not found: id=' . $file->get('file_type_id')); } if (!file_exists($file->getFilepath())) { return new XooNIpsXmlRpcFault(106, 'file not found: id=' . $file->get('file_type_id')); } $resp = new XoopsXmlRpcStruct(); $resp->add('id', new XoopsXmlRpcInt($file->get('file_id'))); $resp->add('filetype', new XoopsXmlRpcString($filetype->get('name'))); $unicode =& xoonips_getutility('unicode'); $resp->add('originalname', new XoopsXmlRpcString(htmlspecialchars($unicode->encode_utf8($file->get('original_file_name'), xoonips_get_server_charset()), ENT_QUOTES, 'UTF-8'))); $resp->add('size', new XoopsXmlRpcInt($file->get('file_size'))); $resp->add('mimetype', new XoopsXmlRpcString($file->get('mime_type'))); $resp->add('caption', new XoopsXmlRpcString(htmlspecialchars($unicode->encode_utf8($file->get('caption'), xoonips_get_server_charset()), ENT_QUOTES, 'UTF-8'))); $resp->add('thumbnail', new XoopsXmlRpcBase64($file->get('thumbnail_file'))); $resp->add('data', new XoopsXmlRpcBase64(file_get_contents($file->getFilepath()))); 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; }
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); } } } }
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)); } } }
function getUserInfo() { if (!$this->_checkUser($this->params[1], $this->params[2])) { $this->response->add(new XoopsXmlRpcFault(104)); } else { $struct = new XoopsXmlRpcStruct(); $struct->add('nickname', new XoopsXmlRpcString($this->user->getVar('uname'))); $struct->add('userid', new XoopsXmlRpcString($this->user->getVar('uid'))); $struct->add('url', new XoopsXmlRpcString($this->user->getVar('url'))); $struct->add('email', new XoopsXmlRpcString($this->user->getVar('email'))); $struct->add('lastname', new XoopsXmlRpcString('')); $struct->add('firstname', new XoopsXmlRpcString($this->user->getVar('name'))); $this->response->add($struct); } }
/** * * @brief return XoopsXmlRpcTag that has response of this request * * @return XoopsXmlRpcTag */ function render() { $metadata = $this->response->getSuccess(); $resp = new XoopsXmlRpcStruct(); $unicode =& xoonips_getutility('unicode'); $resp->add('id', new XoopsXmlRpcInt($metadata['id'])); $resp->add('filetype', new XoopsXmlRpcString($metadata['filetype'])); $resp->add('originalname', new XoopsXmlRpcString(htmlspecialchars($unicode->encode_utf8($metadata['originalname'], xoonips_get_server_charset()), ENT_QUOTES, 'UTF-8'))); $resp->add('size', new XoopsXmlRpcInt($metadata['size'])); $resp->add('mimetype', new XoopsXmlRpcString($metadata['mimetype'])); $resp->add('caption', new XoopsXmlRpcString(htmlspecialchars($unicode->encode_utf8($metadata['caption'], xoonips_get_server_charset()), ENT_QUOTES, 'UTF-8'))); $resp->add('thumbnail', new XoopsXmlRpcBase64($metadata['thumbnail'])); $resp->add('registration_date', new XoopsXmlRpcDatetime($metadata['registration_date'])); $resp->add('last_modified_date', new XoopsXmlRpcDatetime($metadata['last_modified_date'])); $resp->add('download_count', new XoopsXmlRpcInt($metadata['download_count'])); $resp->add('download_count_sum', new XoopsXmlRpcInt($metadata['download_count_sum'])); return $resp; }
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); } } } }
/** * create XoopsXmlRpcTag of a field * * @access protected * @param assoc array $output * @return array of XoopsXmlRpcTag */ function render_field($output) { $result = array(); if (isset($output['xmlrpc']['multiple']) ? $output['xmlrpc']['multiple'] : false) { $orm = $this->item->getVar($output['orm']['field'][0]['orm']); if ($output['xmlrpc']['field'][0] != 'detail_field') { $result[0] = new XoopsXmlRpcArray(); } if (is_array($orm)) { $pos = 0; foreach ($orm as $o) { $in_var = array($o->get($output['orm']['field'][0]['field'])); $out_var = array(); $context = array('position' => $pos); eval(isset($output['eval']['orm2xmlrpc']) ? $output['eval']['orm2xmlrpc'] : '$out_var[0] = $in_var[0];'); if ($output['xmlrpc']['field'][0] == 'detail_field') { $struct = new XoopsXmlRpcStruct(); $struct->add('name', new XoopsXmlRpcString($output['xmlrpc']['field'][1])); $struct->add('value', $this->createTag($output['xmlrpc']['type'], $out_var[0])); $result[] = $struct; } else { $result[0]->add($this->createTag($output['xmlrpc']['type'], $out_var[0])); } $pos++; } } } else { $froms = $output['orm']['field']; if (isset($froms['orm']) && isset($froms['field'])) { $froms = array($froms); } $in_var = array(); $out_var = array(); foreach ($froms as $from) { $orm = $this->item->getVar($from['orm']); if (is_array($orm)) { $array_vars = array(); foreach ($orm as $o) { $array_vars[] = $o->get($from['field']); } $in_var[] = $array_vars; } else { $in_var[] = $orm->get($from['field']); } } eval(isset($output['eval']['orm2xmlrpc']) ? $output['eval']['orm2xmlrpc'] : '$out_var[0] = $in_var[0];'); if ($output['xmlrpc']['field'][0] == 'detail_field') { $struct = new XoopsXmlRpcStruct(); $struct->add('name', new XoopsXmlRpcString($output['xmlrpc']['field'][1])); $struct->add('value', $this->createTag($output['xmlrpc']['type'], $out_var[0])); $result[] = $struct; } else { $result[] = $this->createTag($output['xmlrpc']['type'], $out_var[0]); } } return $result; }
/** * * @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; }