本文整理汇总了PHP中xoonips_getutility函数的典型用法代码示例。如果您正苦于以下问题:PHP xoonips_getutility函数的具体用法?PHP xoonips_getutility怎么用?PHP xoonips_getutility使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xoonips_getutility函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: render
function render()
{
global $xoopsOption, $xoopsConfig, $xoopsUser, $xoopsUserIsAdmin, $xoopsLogger, $xoopsTpl;
$textutil =& xoonips_getutility('text');
$xoopsOption['template_main'] = 'xoonips_import_log.html';
if ($this->_params['result']) {
include XOOPS_ROOT_PATH . '/header.php';
$xoopsTpl->assign('result', $this->_params['result']);
$xoopsTpl->assign('filename', $textutil->html_special_chars($this->_params['filename']));
$xoopsTpl->assign('number_of_items', $this->_number_of_items());
$xoopsTpl->assign('uname', $textutil->html_special_chars($this->_params['uname']));
$xoopsTpl->assign('errors', $this->_params['errors']);
$xoopsTpl->assign('log', $textutil->html_special_chars($this->_get_item_log()));
include XOOPS_ROOT_PATH . '/footer.php';
} else {
include XOOPS_ROOT_PATH . '/header.php';
$xoopsTpl->assign('result', false);
$xoopsTpl->assign('filename', $this->_params['filename']);
$xoopsTpl->assign('number_of_items', $this->_number_of_items());
$xoopsTpl->assign('uname', $this->_params['uname']);
$xoopsTpl->assign('errors', $this->_params['errors']);
$xoopsTpl->assign('log', $this->_get_item_log());
include XOOPS_ROOT_PATH . '/footer.php';
}
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:25,代码来源:import_log.class.php
示例2: xoonips_extra_param_restore
/**
*
* @return array associative array of extra parameters
*/
function xoonips_extra_param_restore()
{
$formdata =& xoonips_getutility('formdata');
$extra_param_name = $formdata->getValueArray('post', 'extra_param_name', 's', false);
$extra_params = array();
foreach ($extra_param_name as $name) {
if (!isset($_POST[$name])) {
continue;
}
if (is_array($_POST[$name])) {
$extra_params[$name] = $formdata->getValueArray('post', $name, 's', false);
} else {
$extra_params[$name] = $formdata->getValue('post', $name, 's', false);
}
}
if (!empty($extra_params)) {
return $extra_params;
}
// try to get serialized extra_param request
$extra_param = $formdata->getValue('post', 'extra_param', 's', false);
$extra_params = @unserialize($extra_param);
if (is_array($extra_params)) {
return $extra_params;
}
return array();
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:30,代码来源:extra_param.inc.php
示例3: item_get_userlist
function item_get_userlist($upage)
{
global $xoopsDB;
global $xoopsUser;
// myuid
$myuid = $xoopsUser->getVar('uid', 'n');
$xusers_handler =& xoonips_getormhandler('xoonips', 'users');
$tables['users'] = $xoopsDB->prefix('users');
$tables['xusers'] = $xoopsDB->prefix('xoonips_users');
$join_criteria = new XooNIpsJoinCriteria('users', 'uid', 'uid');
$criteria = new Criteria($tables['users'] . '.level', 0, '>');
$criteria->setSort($tables['users'] . '.uname');
$fields = array();
$fields[] = $tables['xusers'] . '.uid';
$fields[] = $tables['users'] . '.uname';
$xusers_objs =& $xusers_handler->getObjects($criteria, false, implode(',', $fields), false, $join_criteria);
$textutil =& xoonips_getutility('text');
$users = array();
$users[] = array('uid' => 0, 'uname' => $textutil->html_special_chars(_AM_XOONIPS_MAINTENANCE_ITEM_LABEL_ALLUSERS), 'selected' => 'selected="selected"');
foreach ($xusers_objs as $xusers_obj) {
$uid = $xusers_obj->getVar('uid', 'e');
$uname = $textutil->html_special_chars($xusers_obj->getExtraVar('uname'));
$users[] = array('uid' => $uid, 'uname' => $uname, 'selected' => '');
}
return $users;
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:26,代码来源:maintenance_item_uselect.php
示例4: doAction
function doAction()
{
$textutil =& xoonips_getutility('text');
$this->_view_params['url_to_back'] = 'oaipmh_search.php?action=search';
$this->_view_params['repository_name'] = $this->getRepositoryName($this->_formdata->getValue('post', 'identifier', 's', false));
$this->_view_params['metadata'] = $this->getMetadataArray($this->_formdata->getValue('post', 'identifier', 's', false));
$this->_view_params['hidden'] = array(array('name' => 'search_cache_id', 'value' => $this->_formdata->getValue('post', 'search_cache_id', 'i', false)), array('name' => 'search_flag', 'value' => '0'), array('name' => 'repository_id', 'value' => $this->_formdata->getValue('post', 'repository_id', 'i', false)), array('name' => 'keyword', 'value' => $textutil->html_special_chars($this->_formdata->getValue('post', 'keyword', 's', false))), array('name' => 'order_by', 'value' => $textutil->html_special_chars($this->_formdata->getValue('post', 'order_by', 's', false))), array('name' => 'order_dir', 'value' => $textutil->html_special_chars($this->_formdata->getValue('post', 'order_dir', 's', false))), array('name' => 'page', 'value' => $this->_formdata->getValue('post', 'page', 'i', false)), array('name' => 'metadata_per_page', 'value' => $this->_formdata->getValue('post', 'metadata_per_page', 'i', false)));
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:8,代码来源:oaipmh_search_detail.class.php
示例5: xoonips_item_list_header
function xoonips_item_list_header()
{
$formdata =& xoonips_getutility('formdata');
$order_by = $formdata->getValue('post', 'order_by', 's', false);
$order_dir = $formdata->getValue('post', 'order_dir', 'i', false);
$item_per_page = $formdata->getValue('post', 'item_per_page', 'i', false);
return array('order_by' => $order_by, 'order_dir' => $order_dir, 'item_per_page' => $item_per_page);
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:8,代码来源:item_list_header.inc.php
示例6: XooNIpsAction
function XooNIpsAction()
{
$this->_params = array();
$this->_response = new XooNIpsResponse();
$this->_error =& $this->_response->getError();
$this->_view_params = array();
$this->_formdata =& xoonips_getutility('formdata');
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:8,代码来源:action.class.php
示例7: render
/**
*
* @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;
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:18,代码来源:getrootindex.class.php
示例8: render
function render()
{
global $xoopsOption, $xoopsConfig, $xoopsUser, $xoopsUserIsAdmin, $xoopsLogger, $xoopsTpl;
$textutil =& xoonips_getutility('text');
//create handler to include item_type.class.php
$item_lock_handler =& xoonips_getormhandler('xoonips', 'item_lock');
$xoopsOption['template_main'] = 'xoonips_transfer_user_item_confirm.html';
include XOOPS_ROOT_PATH . '/header.php';
$this->setXooNIpsStyleSheet($xoopsTpl);
$xoopsTpl->assign('token_hidden', $GLOBALS['xoopsGTicket']->getTicketHtml(__LINE__, 600, 'xoonips_transfer_user_item_confirm'));
$xoopsTpl->assign('to_uname', $textutil->html_special_chars($this->get_uname_by_uid($this->_params['to_uid'])));
$xoopsTpl->assign('transfer_items', $this->get_transfer_item_template_vars());
$xoopsTpl->assign('not_subscribed_group_message', sprintf(_MD_XOONIPS_TRANSFER_USER_ITEM_CONFIRM_USER_IS_NOT_SUBSCRIBED_TO_GROUPS, $textutil->html_special_chars($this->get_uname_by_uid($this->_params['to_uid'])), $this->get_gname_csv()));
foreach ($this->_params as $key => $val) {
$xoopsTpl->assign($key, $val);
}
include XOOPS_ROOT_PATH . '/footer.php';
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:18,代码来源:transfer_user_item_confirm.class.php
示例9: getRepositoryArrays
/**
*
* note: repository name is truncated in 70 chars
* @access private
* @return array of associative array of repository
*/
function getRepositoryArrays()
{
$textutil =& xoonips_getutility('text');
$handler =& xoonips_getormhandler('xoonips', 'oaipmh_repositories');
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('last_success_date', null, '!='));
$criteria->add(new Criteria('enabled', 1));
$criteria->add(new Criteria('deleted', 0));
$rows =& $handler->getObjects($criteria);
if (!$rows) {
return array();
}
$result = array();
foreach ($rows as $row) {
$result[] = array('repository_id' => $row->getVar('repository_id', 's'), 'repository_name' => $textutil->truncate(trim($row->getVar('repository_name', 's')) != '' ? $row->getVar('repository_name', 's') : $row->getVar('URL', 's'), 70, '...'), 'metadata_count' => $row->getVar('metadata_count', 's'));
}
return $result;
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:24,代码来源:oaipmh_search_default.class.php
示例10: render
/**
*
* @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;
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:24,代码来源:getfilemetadata.class.php
示例11: xoonips_admin_system_check_mysql
function xoonips_admin_system_check_mysql(&$category)
{
// mysql class
$mysqlinfo =& xoonips_getutility('mysqlinfo');
// version
$name = 'MySQL version';
$res = new XooNIpsAdminSystemCheckResult($name);
$version = $mysqlinfo->getVersion('full');
$res->setResult(_XASC_STATUS_OK, $version, _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK);
$category->registerResult($res);
unset($res);
if ($mysqlinfo->isVersion41orHigher()) {
$keys = array('character_set_database' => true, 'character_set_client' => false, 'character_set_connection' => false, 'character_set_results' => false);
foreach ($keys as $key => $is_database) {
$res = new XooNIpsAdminSystemCheckResult($key);
$charset = $mysqlinfo->getVariable($key);
$accept_charsets = $mysqlinfo->getAcceptableCharsets($is_database, _CHARSET);
if (in_array($charset, $accept_charsets)) {
$res->setResult(_XASC_STATUS_OK, $charset, _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK);
} else {
$res->setResult(_XASC_STATUS_FAIL, $charset, _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL);
$res->setMessage('This variable have to set ' . implode(' or ', $accept_charsets));
$category->setError(_XASC_ERRORTYPE_MYSQL, _XASC_STATUS_FAIL);
}
$category->registerResult($res);
unset($res);
}
} else {
$key = 'character_set';
$res = new XooNIpsAdminSystemCheckResult($key);
$charset = $mysqlinfo->getVariable($key);
$accept_charsets = $mysqlinfo->getAcceptableCharsets(true, _CHARSET);
if (in_array($charset, $accept_charsets)) {
$res->setResult(_XASC_STATUS_OK, $charset, _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK);
} else {
$res->setResult(_XASC_STATUS_FAIL, $charset, _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL);
$res->setMessage('This variable have to set ' . implode(' or ', $accept_charsets));
$category->setError(_XASC_ERRORTYPE_MYSQL, _XASC_STATUS_FAIL);
}
$category->registerResult($res);
unset($res);
}
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:43,代码来源:system_check_test_mysql.php
示例12: execute
/**
* load and execute xoonips logic.
*
* @param[in] XooNIpsXmlRpcRequest $request
* @param[out] XooNIpsXmlRpcResponse $response
* result of logic(success/fault, response, error)
*/
function execute(&$request, &$response)
{
// load logic instance
$factory =& XooNIpsLogicFactory::getInstance();
$logic =& $factory->create($request->getMethodName());
if (!is_object($logic)) {
$response->setResult(false);
$error =& $response->getError();
$logic = $request->getMethodName();
$error->add(XNPERR_SERVER_ERROR, "can't create a logic of {$logic}");
return;
}
// execute logic
$params =& $request->getParams();
$xoonips_response = new XooNIpsResponse();
if (count($params) < 3) {
$response->setResult(false);
$error =& $response->getError();
$error->add(XNPERR_MISSING_PARAM);
return false;
} else {
if (count($params) > 3) {
$response->setResult(false);
$error =& $response->getError();
$error->add(XNPERR_EXTRA_PARAM);
return false;
}
}
$vars = array();
$vars[0] = $params[0];
$unicode =& xoonips_getutility('unicode');
$vars[1] = array();
foreach ($params[1] as $key => $val) {
$vars[1][$key] = $unicode->decode_utf8($val, xoonips_get_server_charset(), 'h');
}
$vars[2] = $params[2];
$logic->execute($vars, $xoonips_response);
//
$response->setResult($xoonips_response->getResult());
$response->setError($xoonips_response->getError());
$response->setSuccess($xoonips_response->getSuccess());
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:49,代码来源:getsimpleitems.class.php
示例13: xmlEndElementHandler
/**
*
* @param
* @return void
*/
function xmlEndElementHandler($parser, $name)
{
global $xoopsDB;
$binder_item_links =& $this->_import_item->getVar('binder_item_links');
$unicode =& xoonips_getutility('unicode');
switch (implode('/', $this->_tag_stack)) {
case "ITEM/DETAIL":
if (count($binder_item_links) == 0) {
$this->_import_item->setErrors(E_XOONIPS_TAG_NOT_FOUND, " no binder_item_link" . $this->_get_parser_error_at());
}
break;
case "ITEM/DETAIL/BINDER_ITEM_LINK":
$handler =& xoonips_getormhandler('xnpbinder', 'binder_item_link');
$link =& $handler->create();
$link->set('item_id', intval($unicode->decode_utf8($this->_cdata, xoonips_get_server_charset(), 'h')));
$binder_item_links[] =& $link;
break;
}
parent::xmlEndElementHandler($parser, $name);
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:25,代码来源:xnpbinder_import_item.class.php
示例14: smarty_modifier_xoonips_escape
/**
* Smarty xoonips_escape modifier plugin
*
* Type: modifier<br>
* Name: xoonips_escape<br>
* Purpose: Escape the string according to escapement type
* @param string $text input
* @param string $type type of escape html, xml or javascript
* @return string
*/
function smarty_modifier_xoonips_escape($text, $type = 'html')
{
if (!function_exists('xoonips_getutility')) {
// return empty string if xoonips function not loaded.
return '';
}
$textutil =& xoonips_getutility('text');
switch ($type) {
case 'html':
$text = $textutil->html_special_chars($text);
break;
case 'xml':
$text = $textutil->xml_special_chars($text, _CHARSET);
break;
case 'javascript':
$text = $textutil->javascript_special_chars($text);
break;
}
return $text;
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:30,代码来源:modifier.xoonips_escape.php
示例15: xoonips_get_backend
function xoonips_get_backend()
{
$formdata =& xoonips_getutility('formdata');
$itemtype = $formdata->getValue('get', 'itemtype', 's', true);
$action = $formdata->getValue('get', 'action', 's', true);
// check item type name
$item_type_handler =& xoonips_getormhandler('xoonips', 'item_type');
$criteria = new CriteriaCompo(new Criteria('name', $itemtype));
$criteria->add(new Criteria('mid', NULL, '!='));
if ($item_type_handler->getCount($criteria) != 1) {
die('illegal request');
}
// check action name
if (!preg_match('/^[a-z][_a-z]*$/', $action)) {
die('illegal request');
}
$backend = '../' . $itemtype . '/backend/' . $action . '.php';
if (!file_exists($backend)) {
die('illegal request');
}
return $backend;
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:22,代码来源:backend.php
示例16: _open_file
/**
* open file resource
*
* @acccess protected
* @param string $filename file name
*/
function _open_file($filename)
{
if ($this->use_antiword) {
// for antiword
putenv('ANTIWORDHOME=' . $this->antiwordhome);
$cmd = sprintf('antiword -t -m UTF-8.txt %s', $filename);
$this->handle = @popen($cmd, 'rb');
} else {
// for wv
$dirutil =& xoonips_getutility('directory');
$this->tmpfile = $dirutil->tempnam($dirutil->get_tempdir(), 'XooNIpsFileSearchPluginWord');
$cmd = sprintf('wvText %s %s', escapeshellarg($filename), escapeshellarg($this->tmpfile));
// set LANG to UTF-8 for wvText(elinks)
$lang = getenv('LANG');
putenv('LANG=en_US.UTF-8');
// execute wvText command
@system($cmd);
// restore original lang
putenv('LANG=' . ($lang === false ? '' : $lang));
$this->handle = @fopen($this->tmpfile, 'rb');
}
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:28,代码来源:word.php
示例17: render
/**
*
* @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;
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:29,代码来源:getfile.class.php
示例18: getObject
function getObject($array)
{
$obj = new XooNIpsOrmFile();
//$file_handler=&xoonips_getormhandler('xoonips', 'file');
//$obj=&$file_handler->create();
//
// filetype to file_type_id
$file_type_handler =& xoonips_getormhandler('xoonips', 'file_type');
$filetypes =& $file_type_handler->getObjects(new Criteria('name', $array['filetype']));
if (!$filetypes || count($filetypes) != 1) {
return false;
}
//
//
$unicode =& xoonips_getutility('unicode');
$obj->assignVar('file_id', $array['id']);
$obj->assignVar('file_type_id', $filetypes[0]->get('file_type_id'));
$obj->assignVar('original_file_name', $unicode->decode_utf8($array['originalname'], xoonips_get_server_charset(), 'h'));
$obj->assignVar('file_size', intval($array['size']));
$obj->assignVar('mime_type', $array['mimetype']);
$obj->assignVar('caption', $unicode->decode_utf8($array['caption'], xoonips_get_server_charset(), 'h'));
$obj->assignVar('thumbnail_file', $array['thumbnail']);
return $obj;
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:24,代码来源:xmlrpctransformfile.class.php
示例19: doAction
function doAction()
{
global $xoopsUser;
// get item_id
$item_id = $this->_formdata->getValue('get', 'item_id', 'i', false);
// permission check
$item_compo_handler =& xoonips_getormcompohandler('xoonips', 'item');
if (!$item_compo_handler->getPerm($item_id, $xoopsUser->getVar('uid'), 'read')) {
$this->show_no_permission_error_page();
}
// get item_info_compo of $item_id
$item_basic_handler =& xoonips_getormhandler('xoonips', 'item_basic');
$item_basic = $item_basic_handler->get($item_id);
$item_type_handler =& xoonips_getormhandler('xoonips', 'item_type');
$item_type = $item_type_handler->get($item_basic->get('item_type_id'));
$info_compo_handler =& xoonips_getormcompohandler($item_type->get('name'), 'item');
$info_compo = $info_compo_handler->get($item_id);
// read language file of item
$langman =& xoonips_getutility('languagemanager');
$langman->read('main.php', $item_type->get('name'));
// set params
$this->_view_params['template_file_name'] = $info_compo_handler->getTemplateFileName(XOONIPS_TEMPLATE_TYPE_TRANSFER_ITEM_DETAIL);
$this->_view_params['template_vars'] = $info_compo_handler->getTemplateVar(XOONIPS_TEMPLATE_TYPE_TRANSFER_ITEM_DETAIL, $item_id, $xoopsUser->getVar('uid'));
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:24,代码来源:transfer_user_detail_item.class.php
示例20: xmlEndElementHandler
/**
*
* @param
* @return void
*/
function xmlEndElementHandler($parser, $name)
{
global $xoopsDB;
$detail =& $this->_import_item->getVar('detail');
$unicode =& xoonips_getutility('unicode');
switch (implode('/', $this->_tag_stack)) {
case "ITEM/DETAIL":
foreach (array('model_type', 'rights', 'readme', 'use_cc', 'cc_commercial_use', 'cc_modification') as $key) {
if (is_null($detail->get($key, 'n'))) {
$this->_import_item->setErrors(E_XOONIPS_TAG_NOT_FOUND, " no {$key}" . $this->_get_parser_error_at());
}
}
//error if no creators
if (count($this->_import_item->getVar('creator')) == 0) {
$this->_import_item->setErrors(E_XOONIPS_TAG_NOT_FOUND, " no creator" . $this->_get_parser_error_at());
}
break;
case "ITEM/DETAIL/MODEL_TYPE":
case "ITEM/DETAIL/RIGHTS":
case "ITEM/DETAIL/README":
case "ITEM/DETAIL/USE_CC":
case "ITEM/DETAIL/CC_MODIFICATION":
case "ITEM/DETAIL/CC_COMMERCIAL_USE":
$detail->set(strtolower(end($this->_tag_stack)), $unicode->decode_utf8($this->_cdata, xoonips_get_server_charset(), 'h'), true);
break;
case 'ITEM/DETAIL/CREATORS/CREATOR':
if ($this->_detail_version != '1.03') {
break;
}
$creators =& $this->_import_item->getVar('creator');
$creator_handler =& xoonips_getormhandler('xnpmodel', 'creator');
$creator =& $creator_handler->create();
$creator->set('creator', $unicode->decode_utf8($this->_cdata, xoonips_get_server_charset(), 'h'));
$creator->set('creator_order', count($creators));
$creators[] = $creator;
break;
case "ITEM/DETAIL/CREATOR":
if ($this->_detail_version != '1.00' && $this->_detail_version != '1.01' && $this->_detail_version != '1.02') {
//<creator> is only for 1.00, 1.01 and 1.02
break;
}
$creator_handler =& xoonips_getormhandler('xnpmodel', 'creator');
$creators =& $this->_import_item->getVar('creator');
$creator =& $creator_handler->create();
$creator->set('creator', trim($unicode->decode_utf8($this->_cdata, xoonips_get_server_charset(), 'h')));
$creator->set('creator_order', 0);
$creators[0] = $creator;
break;
case "ITEM/DETAIL/ATTACHMENT_DL_LIMIT":
if ($this->_attachment_dl_limit_flag) {
$this->_import_item->setErrors(E_XOONIPS_TAG_REDUNDANT, "attachment_dl_limit is redundant" . $this->_get_parser_error_at());
} else {
if (ctype_digit($this->_cdata)) {
$detail->set('attachment_dl_limit', intval($this->_cdata));
$this->_attachment_dl_limit_flag = true;
} else {
$this->_import_item->setErrors(E_XOONIPS_INVALID_VALUE, "invalid value(" . $this->_cdata . ") of attachment_dl_limit" . $this->_get_parser_error_at());
}
}
break;
case "ITEM/DETAIL/ATTACHMENT_DL_NOTIFY":
if ($this->_attachment_dl_notify_limit_flag) {
$this->_import_item->setErrors(E_XOONIPS_TAG_REDUNDANT, "attachment_dl_notify is redundant" . $this->_get_parser_error_at());
} else {
if (ctype_digit($this->_cdata)) {
$detail->set('attachment_dl_notify', intval($this->_cdata));
$this->_attachment_dl_notify_limit_flag = true;
} else {
$this->_import_item->setErrors(E_XOONIPS_INVALID_VALUE, "invalid value(" . $this->_cdata . ") of attachment_dl_notify" . $this->_get_parser_error_at());
}
}
break;
case "ITEM/DETAIL/FILE":
$file_handler =& xoonips_getormhandler('xoonips', 'file');
if ($this->_file_type_attribute == 'model_data') {
$this->_model_data_flag = true;
if (!$file_handler->insert($this->_model_data)) {
global $xoopsDB;
$this->_import_item->setErrors(E_XOONIPS_DB_QUERY, "can't insert attachment file:" . $this->_model_data->get('original_file_name') . $this->_get_parser_error_at());
trigger_error($xoopsDB->error());
}
$this->_model_data = $file_handler->get($this->_model_data->get('file_id'));
$this->_import_item->setVar('model_data', $this->_model_data);
$this->_import_item->setHasModelData();
$this->_file_type_attribute = null;
} else {
if ($this->_file_type_attribute == 'preview') {
$this->_preview_flag = true;
if (!$file_handler->insert($this->_preview)) {
$this->_import_item->setErrors(E_XOONIPS_DB_QUERY, "can't insert attachment file:" . $this->_preview->get('original_file_name') . $this->_get_parser_error_at());
}
$this->_preview = $file_handler->get($this->_preview->get('file_id'));
$previews =& $this->_import_item->getVar('preview');
$previews[] = $this->_preview;
$this->_import_item->setHasPreview();
//.........这里部分代码省略.........
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:101,代码来源:xnpmodel_import_item.class.php
注:本文中的xoonips_getutility函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论