/** * Function for Xoops Global Search * This is used only on userinfo page. * * @version $Rev$ * @link $URL$ * * @param array $queryarray * @param string $andor * @param int $limit * @param int $offset * @param int $userid * @return array */ function openid_search($queryarray, $andor, $limit, $offset, $userid) { global $xoopsUserIsAdmin, $xoopsUser; if (!$userid) { return array(); } require_once XOOPS_ROOT_PATH . '/modules/openid/class/handler/identifier.php'; $moduleHandler =& xoops_gethandler('module'); $module =& $moduleHandler->getByDirname('openid'); $configHandler =& xoops_gethandler('config'); $config =& $configHandler->getConfigsByCat(0, $module->getVar('mid')); if ($xoopsUserIsAdmin) { $threshold = OPENID_IDENTIFIER_INACTIVE; } else { if (is_object(@$xoopsUser)) { if ($xoopsUser->getVar('uid') == $userid) { $threshold = OPENID_IDENTIFIER_INACTIVE; } else { if ($config['mode_policy'] == 0) { $threshold = OPENID_IDENTIFIER_OPEN2MEMBER; } else { if ($config['mode_policy'] == OPENID_IDENTIFIER_PRIVATE) { return array(); } else { $threshold = OPENID_IDENTIFIER_ACTIVE; } } } } else { if ($config['mode_policy'] == 0) { $threshold = OPENID_IDENTIFIER_PUBLIC; } else { if ($config['mode_policy'] < OPENID_IDENTIFIER_PUBLIC) { return array(); } else { $threshold = OPENID_IDENTIFIER_ACTIVE; } } } } $identifier_handler = new Openid_Handler_Identifier(); $records =& $identifier_handler->getByUid($userid, $limit, $offset, $threshold); $ret = array(); $i = 0; foreach ($records as $record) { $ret[$i] = array('image' => 'images/openid_small_logo_white.gif', 'title' => $record->get4Show('displayid'), 'time' => $record->get('utime')); if ($record->get('omode') == OPENID_IDENTIFIER_INACTIVE) { $ret[$i]['title'] .= ' (( inactive ))'; } if (!is_object(@$xoopsUser) || $xoopsUser->getVar('uid') != $userid) { $ret[$i]['link'] = '?op=redirect&id=' . $record->get4show('id') . '&to=' . rawurlencode($record->get('displayid')); } $i++; } return $ret; }
function updateAction() { global $xoopsUser, $xoopsModuleConfig; if (!isset($_POST['mode'])) { redirect_header($this->_url, 2, 'Bad operation.'); } $change = array(); $message = ''; $lang = $this->getModeList(); $identifiers =& $this->_handler->getByUid($xoopsUser->getVar('uid')); foreach ($identifiers as $identifier) { $id = $identifier->get('id'); $oldmode = intval($identifier->get('omode')); $mode = intval(@$_POST['mode'][$id]); if ($xoopsModuleConfig['mode_policy'] == 0) { if ($mode != $oldmode) { $change['mode[' . $id . ']'] = $mode; $message .= $identifier->get4Show('displayid') . ': ' . $lang[$oldmode] . ' => ' . $lang[$mode] . '<br />'; } } else { if ($oldmode == OPENID_IDENTIFIER_INACTIVE) { if ($mode == OPENID_IDENTIFIER_ACTIVE) { $change['mode[' . $id . ']'] = OPENID_IDENTIFIER_ACTIVE; $message .= $identifier->get4Show('displayid') . ': ' . $lang[OPENID_IDENTIFIER_INACTIVE] . ' => ' . $lang[OPENID_IDENTIFIER_ACTIVE] . '<br />'; } } else { if ($mode == OPENID_IDENTIFIER_INACTIVE) { $change['mode[' . $id . ']'] = OPENID_IDENTIFIER_INACTIVE; $message .= $identifier->get4Show('displayid') . ': ' . $lang[OPENID_IDENTIFIER_ACTIVE] . ' => ' . $lang[OPENID_IDENTIFIER_INACTIVE] . '<br />'; } } } } if ($change) { $change['op'] = 'updateok'; $message = _MD_OPENID_MESSAGE_UPDATEOK . $message; xoops_confirm($change, $this->_url, $message); } else { redirect_header($this->_url, 2, 'No OpenID was changed.'); } }