本文整理汇总了PHP中xoonips_gethandler函数的典型用法代码示例。如果您正苦于以下问题:PHP xoonips_gethandler函数的具体用法?PHP xoonips_gethandler怎么用?PHP xoonips_gethandler使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xoonips_gethandler函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _get_item_log
function _get_item_log()
{
$log = '';
$item_type_handler =& xoonips_getormhandler('xoonips', 'item_type');
foreach ($this->_params['import_items'] as $item) {
//skip this item if don't import as new and update
if (!$item->getImportAsNewFlag() && !$item->getUpdateFlag()) {
continue;
}
$basic =& $item->getVar('basic');
$itemtype =& $item_type_handler->get($basic->get('item_type_id'));
$handler =& xoonips_gethandler($itemtype->get('name'), 'import_item');
$log .= "\n\n[item]\n" . $handler->getImportLog($item);
foreach ($item->getErrors() as $e) {
$log .= "\nerror {$e}";
}
if ($item->getDoiConflictFlag()) {
$log .= "\nerror doi conflict with following items" . " in exitsing item.";
}
foreach (array_merge($item->getDuplicateUnupdatableItemId(), $item->getDuplicateUpdatableItemId(), $item->getDuplicateLockedItemId()) as $item_id) {
$log .= "\nwarning conflict with " . xnpGetItemDetailURL($item_id);
}
}
return $log;
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:25,代码来源:import_finish.class.php
示例2: preAction
function preAction()
{
global $xoopsUser;
xoonips_allow_post_method();
xoonips_deny_guest_access();
$page = $this->_formdata->getValue('post', 'page', 'i', false);
xoonips_validate_request($page > 0);
$resolve_flag = $this->_formdata->getValue('post', 'resolve_conflict_flag', 'i', false);
xoonips_validate_request(1 == $resolve_flag || 0 == $resolve_flag);
$itemtype_handler =& xoonips_getormhandler('xoonips', 'item_type');
foreach ($itemtype_handler->getObjects() as $itemtype) {
if ('xoonips_index' == $itemtype->get('name')) {
continue;
}
$handler =& xoonips_gethandler($itemtype->get('name'), 'import_item');
$handler->create();
}
$sess_hander =& xoonips_getormhandler('xoonips', 'session');
$sess =& $sess_hander->get(session_id());
$session = unserialize($sess->get('sess_data'));
$this->_collection = unserialize(gzuncompress(base64_decode($session['xoonips_import_items'])));
xoonips_validate_request($this->_collection);
$this->_collection->setImportAsNewOption(!is_null($this->_formdata->getValue('post', 'import_as_new', 'i', false)));
$items =& $this->_collection->getItems();
foreach (array_keys($items) as $key) {
if (in_array($items[$key]->getPseudoId(), $this->getUpdatablePseudoId())) {
// set update flag of displayed item
$items[$key]->setUpdateFlag(in_array($items[$key]->getPseudoId(), $this->getUpdatePseudoId()));
}
}
$this->_params[] = $this->_collection->getItems();
$this->_params[] = $xoopsUser->getVar('uid');
$this->_params[] = $this->_collection->getImportAsNewOption();
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:34,代码来源:import_resolve_conflict.class.php
示例3: download_create_zipfile
function download_create_zipfile($file_id, $item_id, $file_name, $metadata)
{
$file_handler =& xoonips_gethandler('xoonips', 'file');
$file_path = $file_handler->getFilePath($file_id);
if (!file_exists($file_path)) {
// file not found
return false;
}
// open metafile
$dirutil =& xoonips_getutility('directory');
$metafile_path = $dirutil->get_template('XooNIpsDownloadMetaFile');
$metafile_fp = $dirutil->mkstemp($metafile_path);
if ($metafile_fp === false) {
// failed to create temporary file for metadata
return false;
}
register_shutdown_function('download_unlink', $metafile_path);
// write metafile
$unicode =& xoonips_getutility('unicode');
$metafile_body = '';
foreach ($metadata as $key => $val) {
$metafile_body .= $key;
// convert dos and mac new line code to unix
$val = str_replace("\r", "\n", str_replace("\r\n", "\n", $val));
$ar = explode("\n", $val);
$metafile_body .= ': ';
if (count($ar) <= 1) {
$metafile_body .= $val;
} else {
$metafile_body .= "\r\n " . implode("\r\n ", $ar);
}
$metafile_body .= "\r\n";
}
$metafile_body .= _MD_XOONIPS_ITEM_DETAIL_URL . ': ' . xnpGetItemDetailURL($item_id) . "\r\n";
$metafile_body = $unicode->encode_utf8($metafile_body);
fwrite($metafile_fp, $metafile_body);
// close metafile
fclose($metafile_fp);
// open zipfile
$zipfile_path = $dirutil->get_template('XooNIpsDownloadZipFile');
$zipfile_fp = $dirutil->mkstemp($zipfile_path);
if ($zipfile_fp === false) {
// failed to create temporary file for zip
return false;
}
register_shutdown_function('download_unlink', $zipfile_path);
fclose($zipfile_fp);
$ziputil =& xoonips_getutility('zip');
if ($ziputil->open($zipfile_path) == false) {
// failed to open zip file
return false;
}
// write zipfile
$ziputil->add($file_path, $file_name);
$ziputil->add($metafile_path, 'metainfo.txt');
// close zipfile
$ziputil->close();
return $zipfile_path;
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:59,代码来源:download.php
示例4: execute
function execute(&$vars, &$response)
{
$this->_import_items = $vars[0];
$handler =& xoonips_gethandler('xoonips', 'import_item');
$handler->findDuplicateItems($this->_import_items);
$success = array('import_items' => $this->_import_items, 'is_conflict' => $this->_is_conflict($this->_import_items));
$response->setResult(true);
$response->setSuccess($success);
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:9,代码来源:importcheckconflict.class.php
示例5: b_xoonips_moderator_show
function b_xoonips_moderator_show()
{
global $xoopsUser;
// hide block if user is guest
if (!is_object($xoopsUser)) {
return false;
}
$uid = $xoopsUser->getVar('uid', 'n');
// hide block if user is invalid xoonips user
$xsession_handler =& xoonips_getormhandler('xoonips', 'session');
if (!$xsession_handler->validateUser($uid, false)) {
return false;
}
// check moderator user
$xmember_handler =& xoonips_gethandler('xoonips', 'member');
if (!$xmember_handler->isModerator($uid)) {
// user is not moderator
return false;
}
// count certification requested users
$xu_ohandler =& xoonips_getormhandler('xoonips', 'users');
$join = new XooNIpsJoinCriteria('users', 'uid', 'uid', 'INNER', 'u');
$criteria = new CriteriaCompo(new Criteria('activate', 0));
$criteria->add(new Criteria('level', 0, '>', 'u'));
$cu_count = $xu_ohandler->getCount($criteria, $join);
// count certification requested items
$xil_handler =& xoonips_getormhandler('xoonips', 'index_item_link');
$join = new XooNIpsJoinCriteria('xoonips_index', 'index_id', 'index_id', 'INNER', 'x');
$criteria = new CriteriaCompo(new Criteria('certify_state', CERTIFY_REQUIRED));
$criteria->add(new Criteria('open_level', OL_PUBLIC, '=', 'x'));
$ci_count = $xil_handler->getCount($criteria, $join);
// count group items open to public certification requested indexes
if (xoonips_get_version() >= 340) {
$xgxl_handler =& xoonips_getormhandler('xoonips', 'index_group_index_link');
$gi_count = $xgxl_handler->getCount();
} else {
$gi_count = 0;
}
// assign block template variables
$block = array();
$block['lang_edit_group'] = _MB_XOONIPS_MODERATOR_EDIT_GROUPS;
$block['lang_certify_users'] = _MB_XOONIPS_MODERATOR_CERTIFY_USERS;
$block['lang_certify_users_count'] = $cu_count;
$block['lang_certify_items'] = _MB_XOONIPS_MODERATOR_CERTIFY_PUBLIC_ITEMS;
$block['lang_certify_items_count'] = $ci_count;
$block['lang_groupcertify_items'] = _MB_XOONIPS_MODERATOR_GROUP_CERTIFY_PUBLIC_ITEMS;
$block['lang_groupcertify_items_count'] = $gi_count;
$block['lang_edit_public_index'] = _MB_XOONIPS_MODERATOR_EDIT_PUBLIC_INDEX;
$block['lang_event_log'] = _MB_XOONIPS_MODERATOR_EVENT_LOG;
$block['xid'] = IID_PUBLIC;
return $block;
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:52,代码来源:xoonips_moderator.php
示例6: get_gids_to_subscribe
function get_gids_to_subscribe($uid, $item_ids)
{
$item_group_ids = xoonips_transfer_get_group_ids_of_items($item_ids);
$xgroup_handler =& xoonips_gethandler('xoonips', 'group');
$gids = $xgroup_handler->getGroupIds($uid);
// return array_diff( $item_group_ids, $gids );
$result = array();
foreach ($item_group_ids as $gid) {
if (!in_array($gid, $gids)) {
$result[] = $gid;
}
}
return $result;
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:14,代码来源:transfer.class.php
示例7: _get_item_log
function _get_item_log()
{
$log = '';
$item_type_handler =& xoonips_getormhandler('xoonips', 'item_type');
foreach ($this->_params['import_items'] as $item) {
$basic =& $item->getVar('basic');
$itemtype =& $item_type_handler->get($basic->get('item_type_id'));
$handler =& xoonips_gethandler($itemtype->get('name'), 'import_item');
$log .= "\n\n[item]\n" . $handler->getImportLog($item);
foreach ($item->getErrors() as $e) {
$log .= "\nerror {$e}";
}
foreach (array_merge($item->getDuplicateUnupdatableItemId(), $item->getDuplicateUpdatableItemId(), $item->getDuplicateLockedItemId()) as $item_id) {
$log .= "\nwarning conflict with " . xnpGetItemDetailURL($item_id);
}
}
return $log;
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:18,代码来源:import_log.class.php
示例8: execute
function execute(&$vars, &$response)
{
global $xoopsUser;
$success = array();
$error = false;
$transaction = XooNIpsTransaction::getInstance();
$transaction->start();
$itemtype_handler =& xoonips_getormhandler('xoonips', 'item_type');
foreach (array_keys($vars[0]) as $key) {
assert(!($vars[0][$key]->getImportAsNewFlag() && $vars[0][$key]->getUpdateFlag()));
//skip this item if don't import as new and update
if (!$vars[0][$key]->getImportAsNewFlag() && !$vars[0][$key]->getUpdateFlag()) {
continue;
}
$item_handler =& xoonips_getormcompohandler('xoonips', 'item');
if ($vars[0][$key]->getUpdateFlag() && !$item_handler->getPerm($vars[0][$key]->getUpdateItemId(), $xoopsUser->getVar('uid'), 'write')) {
//no write permission to updating exist item -> error
$vars[0][$key]->setErrors(E_XOONIPS_UPDATE_CERTIFY_REQUEST_LOCKED, "can't update locked item(" . $vars[0][$key]->getUpdateItemId() . ")");
$error = true;
break;
}
$basic =& $vars[0][$key]->getVar('basic');
$itemtype =& $itemtype_handler->get($basic->get('item_type_id'));
$handler =& xoonips_gethandler($itemtype->get('name'), 'import_item');
$handler->import($vars[0][$key]);
$error = $error || count($vars[0][$key]->getErrors()) > 0;
}
if ($error) {
$transaction->rollback();
} else {
foreach (array_keys($vars[0]) as $key) {
$basic =& $vars[0][$key]->getVar('basic');
$itemtype =& $itemtype_handler->get($basic->get('item_type_id'));
$handler =& xoonips_gethandler($itemtype->get('name'), 'import_item');
$handler->onImportFinished($vars[0][$key], $vars[0]);
$error = $error || count($vars[0][$key]->getErrors()) > 0;
}
$transaction->commit();
$this->_remove_files();
}
$success['import_items'] =& $vars[0];
$response->setResult(!$error);
$response->setSuccess($success);
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:44,代码来源:importimport.class.php
示例9: b_xoonips_group_show
function b_xoonips_group_show()
{
global $xoopsUser;
// hide block if user is guest
if (!is_object($xoopsUser)) {
return false;
}
$uid = $xoopsUser->getVar('uid', 'n');
// hide block if user is invalid xoonips user
$xsession_handler =& xoonips_getormhandler('xoonips', 'session');
if (!$xsession_handler->validateUser($uid, false)) {
return false;
}
// get administrable group ids
$xgroup_handler =& xoonips_gethandler('xoonips', 'group');
$admin_gids = $xgroup_handler->getGroupIds($uid, true);
if (empty($admin_gids)) {
// user is not group admin
return false;
}
// get index id of primary group
$gid = $admin_gids[0];
// primary gid
$group_index_id = $xgroup_handler->getGroupRootIndexId($gid);
// count certification requested items
$xil_handler =& xoonips_getormhandler('xoonips', 'index_item_link');
$join = new XooNIpsJoinCriteria('xoonips_index', 'index_id', 'index_id', 'INNER', 'x');
$criteria = new CriteriaCompo(new Criteria('certify_state', CERTIFY_REQUIRED));
$criteria->add(new Criteria('open_level', OL_GROUP_ONLY, '=', 'x'));
$criteria->add(new Criteria('gid', '(' . implode(',', $admin_gids) . ')', 'IN', 'x'));
$ci_count = $xil_handler->getCount($criteria, $join);
// assign block template variables
$block = array();
$block['lang_edit_group'] = _MB_XOONIPS_GROUP_EDIT_GROUP_MEMBERS;
$block['lang_certify_group_items'] = _MB_XOONIPS_GROUP_CERTIFY_GROUP_ITEMS;
$block['lang_certify_group_items_count'] = $ci_count;
$block['lang_edit_group_index'] = _MB_XOONIPS_GROUP_EDIT_GROUP_INDEX;
$block['xid'] = $group_index_id;
return $block;
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:40,代码来源:xoonips_groupadmin.php
示例10: onDelete
function onDelete($item_id)
{
//trigger_error( "Binder onDelete( $item_id )" );
$bilink_handler =& xoonips_getormhandler('xnpbinder', 'binder_item_link');
$criteria = new Criteria('item_id', $item_id);
$bilinks =& $bilink_handler->getObjects($criteria);
if (!$bilinks) {
return;
}
foreach ($bilinks as $bilink) {
$child_items =& $bilink_handler->getObjects(new Criteria('binder_id', $bilink->get('binder_id')));
if (!$child_items) {
continue;
}
$index_item_link_handler =& xoonips_getormhandler('xoonips', 'index_item_link');
$join = new XooNIpsJoinCriteria('xoonips_index', 'index_id', 'index_id');
$criteria = new CriteriaCompo(new Criteria('open_level', OL_PUBLIC));
$criteria->add(new Criteria('certify_state', CERTIFIED));
$criteria->add(new Criteria('item_id', $bilink->get('binder_id')));
$index_item_links =& $index_item_link_handler->getObjects($criteria, false, '', false, $join);
if (empty($index_item_links)) {
continue;
}
if (count($child_items) == 1) {
$item_handler =& xoonips_getormcompohandler('xnpbinder', 'item');
$binder = $item_handler->get($bilink->get('binder_id'));
$basic = $binder->getVar('basic');
// define tags here for notification message
$tags = xoonips_notification_get_item_tags($basic->get('item_id'));
$mhandler =& xoops_gethandler('module');
$module = $mhandler->getByDirName('xnpbinder');
$nhandler =& xoonips_gethandler('xoonips', 'notification');
$nhandler->triggerEvent2('user', 0, 'item_updated', _MD_XNPBINDER_USER_CONTENT_EMPTY_NOTIFYSBJ, $nhandler->getTemplateDirByMid($module->mid()), 'user_content_empty_notify', $tags, array($basic->get('uid')));
}
if (!$bilink_handler->delete($bilink)) {
die('cannnot remove a deleted item from a binder.');
}
}
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:39,代码来源:item_event_listener.class.php
示例11: preAction
function preAction()
{
xoonips_deny_guest_access();
xoonips_allow_post_method();
if (!$GLOBALS['xoopsGTicket']->check(true, 'import', false)) {
die('ticket error');
}
$itemtype_handler =& xoonips_getormhandler('xoonips', 'item_type');
foreach ($itemtype_handler->getObjects() as $itemtype) {
if ('xoonips_index' == $itemtype->get('name')) {
continue;
}
$handler =& xoonips_gethandler($itemtype->get('name'), 'import_item');
$handler->create();
}
$sess_handler =& xoonips_getormhandler('xoonips', 'session');
$sess =& $sess_handler->get(session_id());
$session = unserialize($sess->get('sess_data'));
$this->_collection = unserialize(gzuncompress(base64_decode($session['xoonips_import_items'])));
xoonips_validate_request($this->_collection);
$this->_make_clone_of_update_item($this->_collection);
$this->_begin_time = time();
$this->_params[] =& $this->_collection->getItems();
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:24,代码来源:import_import.class.php
示例12: xoops_module_uninstall_xoonips
/**
* xoonips uninstall function
*
* @param object $xoopsMod module instance
* @return bool false if failure
*/
function xoops_module_uninstall_xoonips($xoopsMod)
{
$mydirname = basename(__DIR__);
$uid = $GLOBALS['xoopsUser']->getVar('uid', 'n');
$mid = $xoopsMod->getVar('mid', 'n');
// get xoops administration handler
$admin_xoops_handler =& xoonips_gethandler('xoonips', 'admin_xoops');
// show original 'user' and 'login' blocks
$sys_blocks = array('user' => array(), 'login' => array());
if (defined('XOOPS_CUBE_LEGACY')) {
// for XOOPS Cube Legacy 2.1
$sys_blocks['user'][] = array('legacy', 'b_legacy_usermenu_show');
$sys_blocks['login'][] = array('user', 'b_user_login_show');
}
$sys_blocks['user'][] = array('system', 'b_system_user_show');
$sys_blocks['login'][] = array('system', 'b_system_login_show');
foreach ($sys_blocks as $type => $sys_type_blocks) {
foreach ($sys_type_blocks as $sys_block) {
list($dirname, $show_func) = $sys_block;
$sysmid = $admin_xoops_handler->getModuleId($dirname);
if ($sysmid === false) {
continue;
// module not found
}
$bids = $admin_xoops_handler->getBlockIds($sysmid, $show_func);
foreach ($bids as $bid) {
$admin_xoops_handler->setBlockPosition($bid, true, 0, 0);
}
if (count($bids) != 0) {
break;
// found this type's block
}
}
}
return true;
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:42,代码来源:onuninstall.inc.php
示例13: xoonips_group_get_groups
/**
* get group list
*
* @return array group list
*/
function xoonips_group_get_groups($uid, $gids = null)
{
$xgroup_handler =& xoonips_gethandler('xoonips', 'group');
$xmember_handler =& xoonips_gethandler('xoonips', 'member');
$u_handler =& xoonips_getormhandler('xoonips', 'xoops_users');
$is_admin = $xmember_handler->isAdmin($uid);
$xg_objs =& $xgroup_handler->getGroupObjects($gids);
$groups = array();
foreach ($xg_objs as $xg_obj) {
$gid = $xg_obj->get('gid');
$gadmin_uids = $xgroup_handler->getUserIds($gid, true);
$is_gadmin = in_array($uid, $gadmin_uids);
$gadmins = array();
foreach ($gadmin_uids as $gadmin_uid) {
$u_obj =& $u_handler->get($gadmin_uid);
if (!is_object($u_obj)) {
continue;
}
$gadmins[] = array('uid' => $gadmin_uid, 'uname' => $u_obj->getVar('uname', 's'));
}
$groups[] = array('gid' => $gid, 'gname' => $xg_obj->get('gname', 's'), 'gdesc' => $xg_obj->get('gdesc', 's'), 'locked' => !xoonips_group_check_perm($gid), 'gadmins' => $gadmins, 'is_admin' => $is_admin || $is_gadmin);
}
return $groups;
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:29,代码来源:group.inc.php
示例14: eval
$xoopsTpl->assign('download_file_id', $download_file_id);
}
$xoonips_module_header = '<link rel="stylesheet" type="text/css" href="style.css" />';
$func = $modname . 'GetHeadMeta';
if (function_exists($func)) {
eval('$xoonips_module_header .= "\\n".' . $func . '($item_id);');
}
$xoonips_module_header .= "\n" . $xoopsTpl->get_template_vars('xoops_module_header');
$xoopsTpl->assign('xoops_module_header', $xoonips_module_header);
// Record events(view item)
$eventlog_handler =& xoonips_getormhandler('xoonips', 'event_log');
$eventlog_handler->recordViewItemEvent($item_id);
$basic = xnpGetBasicInformationArray($item_id);
$xoopsTpl->assign('xoops_pagetitle', $textutil->html_special_chars($basic['titles'][0]));
// get item viewed count
$ranking_handler =& xoonips_gethandler('xoonips', 'ranking');
$ranking_handler->update();
$viewed_count = $ranking_handler->get_count_viewed_item($item_id);
$xoopsTpl->assign('viewed_count', $viewed_count);
//start of item comment function
$comconfig_handler =& xoonips_getormhandler('xoonips', 'config');
$com_dir_name = $comconfig_handler->getValue('item_comment_dirname');
$com_forum_id = $comconfig_handler->getValue('item_comment_forum_id');
$xoopsTpl->assign('dir_name', $com_dir_name);
$xoopsTpl->assign('forum_id', $com_forum_id);
//end of item comment function
include XOOPS_ROOT_PATH . '/footer.php';
function xoonips_delete_item($item_id)
{
$params = array(session_id(), $item_id, 'item_id');
$response = new XooNIpsResponse();
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:31,代码来源:detail.php
示例15: redirect_header
// //
// You may not change or alter any portion of this comment or credits //
// of supporting developers from this source code or any supporting //
// source code which is considered copyrighted (c) material of the //
// original comment or credit authors. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
// ------------------------------------------------------------------------- //
if (!defined('XOOPS_ROOT_PATH')) {
exit;
}
// check token ticket
require_once '../class/base/gtickets.php';
$ticket_area = 'xoonips_admin_maintenance_ranking';
if (!$xoopsGTicket->check(true, $ticket_area, false)) {
redirect_header($xoonips_admin['mypage_url'], 3, $xoopsGTicket->getErrors());
exit;
}
$admin_ranking_handler =& xoonips_gethandler('xoonips', 'admin_ranking');
if (!$admin_ranking_handler->clear_sum_data()) {
redirect_header($xoonips_admin['mypage_url'], 3, _AM_XOONIPS_MAINTENANCE_RANKING_LOCKED);
exit;
}
redirect_header($xoonips_admin['mypage_url'], 1, _AM_XOONIPS_MSG_DBUPDATED);
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:31,代码来源:maintenance_ranking_clear.php
示例16: xnpbookGetMetadata
function xnpbookGetMetadata($prefix, $item_id)
{
$mydirpath = dirname(dirname(__FILE__));
$mydirname = basename($mydirpath);
if (!in_array($prefix, array('oai_dc', 'junii2'))) {
return false;
}
// detail information
$detail_handler =& xoonips_getormhandler($mydirname, 'item_detail');
$author_handler =& xoonips_getormhandler($mydirname, 'author');
$detail_obj =& $detail_handler->get($item_id);
if (empty($detail_obj)) {
return false;
}
$detail = $detail_obj->getArray();
$criteria = new Criteria('book_id', $item_id);
$criteria->setSort('author_order');
$author_objs =& $author_handler->getObjects($criteria);
$detail['authors'] = array();
foreach ($author_objs as $author_obj) {
$detail['authors'][] = $author_obj->get('author');
}
// basic information
$basic = xnpGetBasicInformationArray($item_id);
$basic['publication_date_iso8601'] = xnpISO8601($basic['publication_year'], $basic['publication_month'], $basic['publication_mday']);
// indexes
$indexes = array();
if (xnp_get_index_id_by_item_id($_SESSION['XNPSID'], $item_id, $xids) == RES_OK) {
foreach ($xids as $xid) {
if (xnp_get_index($_SESSION['XNPSID'], $xid, $index) == RES_OK) {
$indexes[] = xnpGetIndexPathServerString($_SESSION['XNPSID'], $xid);
}
}
}
// files
$files = array();
$mimetypes = array();
if ($detail['attachment_dl_limit'] == 0) {
$file_handler =& xoonips_gethandler('xoonips', 'file');
$files = $file_handler->getFilesInfo($item_id, 'book_pdf');
foreach ($files as $file) {
if (!in_array($file['mime_type'], $mimetypes)) {
$mimetypes[] = $file['mime_type'];
}
}
}
// related to
$related_to_handler =& xoonips_getormhandler('xoonips', 'related_to');
$related_to_ids = $related_to_handler->getChildItemIds($item_id);
$related_tos = array();
foreach ($related_to_ids as $related_to_id) {
$related_tos[] = array('item_id' => $related_to_id, 'item_url' => XOOPS_URL . '/modules/xoonips/detail.php?item_id=' . $related_to_id);
}
// repository configs
$xconfig_handler =& xoonips_getormhandler('xoonips', 'config');
$myxoopsConfigMetaFooter =& xoonips_get_xoops_configs(XOOPS_CONF_METAFOOTER);
$repository = array('download_file_compression' => $xconfig_handler->getValue('download_file_compression'), 'nijc_code' => $xconfig_handler->getValue('repository_nijc_code'), 'publisher' => $xconfig_handler->getValue('repository_publisher'), 'institution' => $xconfig_handler->getValue('repository_institution'), 'meta_author' => $myxoopsConfigMetaFooter['meta_author']);
// assign template
global $xoopsTpl;
$tpl = new XoopsTpl();
$tpl->plugins_dir[] = XOONIPS_PATH . '/class/smarty/plugins';
$tpl->assign($xoopsTpl->get_template_vars());
$tpl->assign('basic', $basic);
$tpl->assign('detail', $detail);
$tpl->assign('indexes', $indexes);
$tpl->assign('files', $files);
$tpl->assign('mimetypes', $mimetypes);
$tpl->assign('related_tos', $related_tos);
$tpl->assign('repository', $repository);
$xml = $tpl->fetch('db:' . $mydirname . '_oaipmh_' . $prefix . '.xml');
return $xml;
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:72,代码来源:view.php
示例17: createGroupRootIndex
/**
* create group root index
*
* @access public
* @param int gid group id
* @return int created index id, false if failure
*/
function createGroupRootIndex($gid)
{
// check existing group index
$criteria = new CriteriaCompo(new Criteria('gid', $gid));
$criteria->add(new Criteria('parent_index_id', IID_ROOT));
if ($this->getCount($criteria) != 0) {
// already exists
return false;
}
// get group id (gname)
$xgroup_handler =& xoonips_gethandler('xoonips', 'group');
$xgroup_obj =& $xgroup_handler->getGroupObject($gid);
if (!is_object($xgroup_obj)) {
// group not found
return false;
}
$gname = $xgroup_obj->getVar('gname', 'n');
return $this->_createRootIndex($gname, false, $gid);
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:26,代码来源:index.class.php
示例18: _xnpal_isWritableInternal2
/**
* check ownerUID, ownerGID and openLevel indexes writable privileges
*
* @param string $sess_id session id
* @param int $uid user id
* @param int $ownerUID index owner user
* @param int $ownerGID index owner group
* @param int $openLevel open level of index
* @return bool
*
*/
function _xnpal_isWritableInternal2($sess_id, $uid, $ownerUID, $ownerGID, $openLevel)
{
if ($openLevel == OL_PUBLIC) {
} else {
if ($openLevel == OL_GROUP_ONLY) {
$xgroup_handler =& xoonips_gethandler('xoonips', 'group');
if ($xgroup_handler->isGroupAdmin($uid, $ownerGID)) {
return true;
}
} else {
if ($openLevel == OL_PRIVATE) {
if ($uid == $ownerUID) {
return true;
}
}
}
}
if (xnp_is_moderator($sess_id, $uid)) {
return true;
}
return false;
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:33,代码来源:AL.php
示例19: xoonips_notification_user_file_downloaded
function xoonips_notification_user_file_downloaded($file_id, $downloader_uid)
{
$file_handler =& xoonips_getormhandler('xoonips', 'file');
$file = $file_handler->get($file_id);
$user_handler =& xoops_gethandler('user');
$user = $user_handler->get($downloader_uid);
$item_basic_handler =& xoonips_getormhandler('xoonips', 'item_basic');
$item_basic = $item_basic_handler->get($file->get('item_id'));
$tags = xoonips_notification_get_item_tags($file->get('item_id'));
$tags['DOWNLOAD_TIMESTAMP'] = date('Y/m/d H:i:s');
$tags['ORIGINAL_FILE_NAME'] = $file->get('original_file_name');
$tags['UNAME'] = $user->getVar('uname');
$nhandler =& xoonips_gethandler('xoonips', 'notification');
$nhandler->triggerEvent2('user', 0, 'file_downloaded', _MD_XOONIPS_USER_FILE_DOWNLOADED_NOTIFYSBJ, $nhandler->getTemplateDirByMid(), 'user_file_downloaded_notify', $tags, array($item_basic->get('uid')));
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:15,代码来源:notification.inc.php
示例20: xoops_module_update_xoonips
//.........这里部分代码省略.........
`value` text,
`namespace` varchar(255) NOT NULL default '',
`namespace_uri` text,
PRIMARY KEY (`metadata_field_id`),
KEY `metadata_id` (`metadata_id`)
) TYPE=MyISAM;
-- xoonips_index
ALTER TABLE `xoonips_index`
MODIFY `index_id` int(10) unsigned NOT NULL;
-- xoonips_index_group_index_link
CREATE TABLE `xoonips_index_group_index_link` (
`index_group_index_link_id` int(10) unsigned NOT NULL auto_increment,
`index_id` int(10) unsigned NOT NULL default '0',
`group_index_id` int(10) unsigned NOT NULL default '0',
`gid` int(10) NOT NULL default '0',
`uid` int(10) NOT NULL default '0',
PRIMARY KEY (`index_group_index_link_id`),
UNIQUE KEY `index_id_2` (`index_id`,`group_index_id`),
KEY `index_id` (`index_id`),
KEY `item_id` (`group_index_id`)
) TYPE=InnoDB;
SQL;
// queries
if (!xoonips_sql_queries($sqls)) {
return false;
}
// fixed old update script bugs.
// from too old to 324
if (xoonips_sql_has_index('xoonips_file', 'sid')) {
$sql = sprintf('ALTER TABLE `%s` DROP INDEX `sid`, ADD INDEX (`sess_id`)', $xoopsDB->prefix('xoonips_file'));
$xoopsDB->query($sql);
}
if (xoonips_sql_has_index('xoonips_search_cache', 'sess_id')) {
$sql = sprintf('ALTER TABLE `%s` DROP INDEX `sess_id`', $xoopsDB->prefix('xoonips_search_cache'));
$xoopsDB->query($sql);
}
if (xoonips_sql_has_index('xoonips_search_text', 'search')) {
$sql = sprintf('ALTER TABLE `%s` DROP INDEX `search`, ADD FULLTEXT `search_text`', $xoopsDB->prefix('xoonips_search_text'));
$xoopsDB->query($sql);
}
// from 324 to 330
$sqls = <<<SQL
-- xoonips_changelog
ALTER TABLE `xoonips_changelog`
ENGINE=INNODB;
-- xoonips_ranking_searched_keyword
ALTER TABLE `xoonips_ranking_searched_keyword`
MODIFY `keyword` varchar(255) binary NOT NULL default '';
-- xoonips_ranking_sum_searched_keyword
ALTER TABLE `xoonips_ranking_sum_searched_keyword`
MODIFY `keyword` varchar(255) binary NOT NULL default '';
SQL;
// queries
if (!xoonips_sql_queries($sqls)) {
return false;
}
// remove obsolete configs
xoonips_delete_obsolete_configs(340);
case 340:
case 341:
case 342:
case 343:
case 344:
case 345:
// remove zombie related_to entries
xoonips_remove_zombie_related_to_ids();
// remove duplicated private item ids
xoonips_remove_duplicated_private_item_ids();
default:
break;
}
// enable available notifications
$admin_xoops_handler =& xoonips_gethandler('xoonips', 'admin_xoops');
$member_handler =& xoops_gethandler('member');
$uids = array_keys($member_handler->getUsers(null, true));
// php-indent: disable
$notifications = array('administrator' => array('subscribe' => array('item_transfer', 'account_certify', 'item_certify', 'group_item_certify_request'), 'unsubscribe' => array('binder_content_empty', 'item_certify_request')), 'user' => array('subscribe' => array('item_transfer', 'item_updated', 'item_certified', 'item_rejected', 'file_downloaded', 'group_item_certified', 'group_item_rejected'), 'unsubscribe' => array('index_renamed', 'index_moved', 'index_deleted')));
// php-indent: enable
foreach ($notifications as $category => $events) {
// enable module event
foreach ($events['subscribe'] as $event) {
$admin_xoops_handler->enableNotification($mid, $category, $event);
}
}
// subscribe all notifications to all users
foreach ($uids as $uid) {
foreach ($notifications as $category => $events) {
foreach ($events['subscribe'] as $event) {
$admin_xoops_handler->subscribeNotification($mid, $uid, $category, $event);
}
}
}
// unsubscribe obsolete notifications from all users
foreach ($notifications as $category => $events) {
foreach ($events['unsubscribe'] as $event) {
$admin_xoops_handler->unsubscribeNotification($mid, 0, $category, $event);
}
}
return true;
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:101,代码来源:onupdate.inc.php
注:本文中的xoonips_gethandler函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论