function postAction() { global $xoopsUser; if (!$this->_response->getResult()) { foreach ($this->_collection->getItems() as $item) { foreach ($item->getErrorCodes() as $code) { if ($code != E_XOONIPS_UPDATE_CERTIFY_REQUEST_LOCKED) { continue; } $titles =& $item->getVar('titles'); $item_lock_handler =& xoonips_getormhandler('xoonips', 'item_lock'); redirect_header(XOOPS_URL . '/modules/xoonips/import.php?action=default', 5, sprintf(_MD_XOONIPS_ERROR_CANNOT_OVERWRITE_LOCKED_ITEM, $titles[0]->get('title'), xoonips_get_lock_type_string($item_lock_handler->getLockType($item->getUpdateItemId())))); } } } $this->_finish_time = time(); $success =& $this->_response->getSuccess(); $this->_view_params['result'] = $this->_response->getResult(); $this->_view_params['import_items'] = $success['import_items']; $this->_view_params['begin_time'] = $this->_begin_time; $this->_view_params['finish_time'] = $this->_finish_time; $this->_view_params['filename'] = $this->_collection->getImportFileName(); $this->_view_params['uname'] = $xoopsUser->getVar('uname'); $this->_view_params['errors'] = array(); foreach ($success['import_items'] as $item) { foreach (array_unique($item->getErrorCodes()) as $code) { $this->_view_params['errors'][] = array('code' => $code, 'extra' => $item->getPseudoId()); } } }
/** show error message and redirect if $locked_index_id is locked. */ function xoonips_show_error_if_index_locked($locked_index_id, $current_index_id) { $item_lock_handler =& xoonips_getormhandler('xoonips', 'item_lock'); if ($item_lock_handler->isLocked($locked_index_id)) { redirect_header(XOOPS_URL . '/modules/xoonips/editindex.php?index_id=' . $current_index_id, 5, sprintf(_MD_XOONIPS_ERROR_CANNOT_EDIT_LOCKED_INDEX, xoonips_get_lock_type_string($item_lock_handler->getLockType($locked_index_id)))); exit; } }
if (!in_array($add_to_index_id, explode(',', $xoonipsCheckedXID))) { $xoonipsCheckedXID .= ',' . $add_to_index_id; } } $formdata->set('post', 'xoonipsCheckedXID', $xoonipsCheckedXID); foreach (array('item_id' => array('i', 0), 'op' => array('s', '')) as $k => $meta) { list($type, $default) = $meta; ${$k} = $formdata->getValue('both', $k, $type, false, $default); } xoonips_deny_guest_access(); $uid = $_SESSION['xoopsUserId']; $textutil =& xoonips_getutility('text'); //error if item is locked $item_lock_handler =& xoonips_getormhandler('xoonips', 'item_lock'); if ($item_lock_handler->isLocked($item_id)) { redirect_header(XOOPS_URL . '/modules/xoonips/detail.php?item_id=' . $item_id, 5, sprintf(_MD_XOONIPS_ERROR_CANNOT_EDIT_LOCKED_ITEM, xoonips_get_lock_type_string($item_lock_handler->getLockType($item_id)))); exit; } //retrieve item detail and set item type id to $item_type_id; $item = array(); if (xnp_get_item($xnpsid, $item_id, $item) != RES_OK) { redirect_header(XOOPS_URL . '/', 3, "ERROR xnp_get_item"); break; } else { $item_type_id = $item['item_type_id']; } //retrive module name to $itemtype $itemtypes = array(); if (xnp_get_item_types($itemtypes) != RES_OK) { redirect_header(XOOPS_URL . '/', 3, "ERROR xnp_get_item_types"); break;
eval("\$body = " . $modname . "GetPrinterFriendlyDetailBlock( \$item_id );"); echo "</head><body onload='window.print();'>\n"; $val = ""; xnp_get_config_value('printer_friendly_header', $val); $xoopsTpl->assign('printer_friendly_header', $val); $xoopsTpl->assign('item_url', xnpGetItemDetailURL($item_id, $doi)); $xoopsTpl->assign('body', $body); $xoopsTpl->display("db:xoonips_detail_print.html"); xoops_footer(); exit; } $xoopsOption['template_main'] = 'xoonips_detail.html'; include XOOPS_ROOT_PATH . '/header.php'; $item_lock_handler =& xoonips_getormhandler('xoonips', 'item_lock'); if ($item_lock_handler->isLocked($item_id)) { $xoopsTpl->assign('locked_message', sprintf(_MD_XOONIPS_WARNING_CANNOT_EDIT_LOCKED_ITEM, xoonips_get_lock_type_string($item_lock_handler->getLockType($item_id)))); } else { $xoopsTpl->assign('locked_message', false); } if ($item_compo_handler->getPerm($item_id, $uid, 'delete') && $op != 'print') { $xoopsTpl->assign('delete_button_visible', '1'); } else { $xoopsTpl->assign('delete_button_visible', '0'); } // makes Modify button visible if following case // user have write permission and this page is not for printer friendly. if ($item_compo_handler->getPerm($item_id, $uid, 'write') && $op != 'print') { $xoopsTpl->assign('modify_button_visible', '1'); } else { $xoopsTpl->assign('modify_button_visible', '0'); }