本文整理汇总了PHP中Network::get_user_type方法的典型用法代码示例。如果您正苦于以下问题:PHP Network::get_user_type方法的具体用法?PHP Network::get_user_type怎么用?PHP Network::get_user_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Network
的用法示例。
在下文中一共展示了Network::get_user_type方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: log_in
public function log_in($uid, $remember_me, $login_source)
{
$user_type = Network::get_user_type(PA::$network_info->network_id, $uid);
if ($user_type == DISABLED_MEMBER) {
throw new CNException(USER_ACCESS_DENIED, 'Your account has been temporarily disabled by the administrator.');
}
$logged_user = new User();
// load user
$logged_user->load((int) $uid);
$logged_user->set_last_login();
PA::$login_user = $logged_user;
register_session($logged_user->login_name, $logged_user->user_id, $logged_user->role, $logged_user->first_name, $logged_user->last_name, $logged_user->email, $logged_user->picture);
if ($remember_me) {
// set login cookie
if ($this->login_cookie->is_new()) {
$this->login_cookie->new_session($uid);
}
$cookie_value = $this->login_cookie->get_cookie();
$cookie_expiry = time() + LoginCookie::$cookie_lifetime;
// update tracking info
$this->login_cookie->update_tracking_info($_SERVER['HTTP_USER_AGENT'], $_SERVER['REMOTE_ADDR']);
} else {
// clear login cookie
$cookie_value = "";
$cookie_expiry = 0;
}
// remember series ID, so we can destroy session on logout
$_SESSION['login_series'] = $this->login_cookie->get_series();
// remember login source, so we know if it's safe to let user change password, etc
$_SESSION['login_source'] = $login_source;
// set new cookie for next login! (or delete cookie, if not remembering login)
setcookie(PA_Login::$cookie_name, $cookie_value, $cookie_expiry, PA::$local_url, "." . PA::$domain_suffix);
}
示例2: leave
/**
* let the user leave network
* @access public
* @param id of the network,uid of user
* @return flag for joining request moderated or success message
*/
static function leave($network_id, $uid)
{
Logger::log("Enter: static function Network leave");
// if (Network::is_mother_network($network_id)) {
// throw new PAException(OPERATION_NOT_PERMITTED, "You cant delete mother network.");
// }
if (!Network::member_exists($network_id, $uid)) {
throw new PAException(OPERATION_NOT_PERMITTED, "You are not member of this network.");
}
$user_type = Network::get_user_type($network_id, $uid);
if ($user_type == NETWORK_OWNER) {
throw new PAException(OPERATION_NOT_PERMITTED, "You cant leave your own network!!.");
}
$res = Dal::query("DELETE FROM {networks_users} WHERE network_id = ? AND user_id = ? ", array($network_id, $uid));
// delete all user roles for this network
Roles::delete_user_roles($uid, -1);
// -1 means: all user roles will be deleted
// Update cached member count
Network::update_network_member_count($network_id);
Logger::log("Exit: static function Network leave");
return TRUE;
}