本文整理汇总了PHP中xoonips_gethandler函数的典型用法代码示例。如果您正苦于以下问题:PHP xoonips_gethandler函数的具体用法?PHP xoonips_gethandler怎么用?PHP xoonips_gethandler使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xoonips_gethandler函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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();
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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.');
}
}
}
示例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();
}
示例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;
}
示例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;
}
示例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();
示例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);