本文整理匯總了PHP中Flyspray::getUserDetails方法的典型用法代碼示例。如果您正苦於以下問題:PHP Flyspray::getUserDetails方法的具體用法?PHP Flyspray::getUserDetails怎麽用?PHP Flyspray::getUserDetails使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Flyspray
的用法示例。
在下文中一共展示了Flyspray::getUserDetails方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: action_sendmagic
/**
* action_sendmagic
*
* @access public
* @return array
*/
function action_sendmagic()
{
global $db, $baseurl;
// Check that the username exists
if (strpos(Post::val('user_name'), '@') === false) {
$user = Flyspray::getUserDetails(Flyspray::UserNameToId(Post::val('user_name')));
} else {
$user_id = $db->x->GetOne('SELECT user_id FROM {users} WHERE email_address = ?', null, Post::val('user_name'));
$user = Flyspray::getUserDetails($user_id);
}
// If the username doesn't exist, throw an error
if (!is_array($user) || !count($user)) {
return array(ERROR_RECOVER, L('usernotexist'));
}
$magic_url = md5(uniqid(mt_rand(), true));
// Insert the random "magic url" into the user's profile
$db->x->execParam('UPDATE {users}
SET magic_url = ?
WHERE user_id = ?', array($magic_url, $user['user_id']));
Notifications::send($user['user_id'], ADDRESS_USER, NOTIFY_PW_CHANGE, array($baseurl, $magic_url));
return array(SUBMIT_OK, L('magicurlsent'));
}
示例2: delete_user
/**
* Deletes a user
* @param integer $uid
* @access public
* @return bool
* @version 1.0
*/
public static function delete_user($uid)
{
global $db, $user;
if (!$user->perms('is_admin')) {
return false;
}
$userDetails = Flyspray::getUserDetails($uid);
if (is_file(BASEDIR . '/avatars/' . $userDetails['profile_image'])) {
unlink(BASEDIR . '/avatars/' . $userDetails['profile_image']);
}
$tables = array('users', 'users_in_groups', 'searches', 'notifications', 'assigned', 'votes', 'effort');
# FIXME Deleting a users effort without asking when user is deleted may not be wanted in every situation.
# For example for billing a project and the deleted user worked for a project.
# The better solution is to just deactivate the user, but maybe there are cases a user MUSt be deleted from the database.
# Move that effort to an 'anonymous users' effort if the effort(s) was legal and should be measured for project(s)?
foreach ($tables as $table) {
if (!$db->Query('DELETE FROM ' . '{' . $table . '}' . ' WHERE user_id = ?', array($uid))) {
return false;
}
}
if (!empty($userDetails['profile_image']) && is_file(BASEDIR . '/avatars/' . $userDetails['profile_image'])) {
unlink(BASEDIR . '/avatars/' . $userDetails['profile_image']);
}
$db->Query('DELETE FROM {registrations} WHERE email_address = ?', array($userDetails['email_address']));
$db->Query('DELETE FROM {user_emails} WHERE id = ?', array($uid));
$db->Query('DELETE FROM {reminders} WHERE to_user_id = ? OR from_user_id = ?', array($uid, $uid));
// for the unusual situuation that a user ID is re-used, make sure that the new user doesn't
// get permissions for a task automatically
$db->Query('UPDATE {tasks} SET opened_by = 0 WHERE opened_by = ?', array($uid));
Flyspray::logEvent(0, 31, serialize($userDetails));
return true;
}
示例3: delete_user
/**
* Deletes a user
* @param integer $uid
* @access public
* @return bool
* @version 1.0
*/
function delete_user($uid)
{
global $db, $user;
if (!$user->perms('is_admin')) {
return false;
}
$user_data = Flyspray::getUserDetails($uid);
$tables = array('users', 'users_in_groups', 'searches', 'notifications', 'assigned');
foreach ($tables as $table) {
if (!$db->x->execParam('DELETE FROM ' . '{' . $table . '}' . ' WHERE user_id = ?', $uid)) {
return false;
}
}
// for the unusual situuation that a user ID is re-used, make sure that the new user doesn't
// get permissions for a task automatically
$db->x->execParam('UPDATE {tasks} SET opened_by = 0 WHERE opened_by = ?', $uid);
Backend::UpdateRedudantUserData($user_data['user_name']);
Flyspray::logEvent(0, 31, serialize($user_data));
return true;
}
示例4: delete_user
/**
* Deletes a user
* @param integer $uid
* @access public
* @return bool
* @version 1.0
*/
public static function delete_user($uid)
{
global $db, $user;
if (!$user->perms('is_admin')) {
return false;
}
$userDetails = Flyspray::getUserDetails($uid);
if (is_file(BASEDIR . '/avatars/' . $userDetails['profile_image'])) {
unlink(BASEDIR . '/avatars/' . $userDetails['profile_image']);
}
$tables = array('users', 'users_in_groups', 'searches', 'notifications', 'assigned', 'votes', 'effort');
foreach ($tables as $table) {
if (!$db->Query('DELETE FROM ' . '{' . $table . '}' . ' WHERE user_id = ?', array($uid))) {
return false;
}
}
if (!empty($userDetails['profile_image']) && is_file(BASEDIR . '/avatars/' . $userDetails['profile_image'])) {
unlink(BASEDIR . '/avatars/' . $userDetails['profile_image']);
}
$db->Query('DELETE FROM {registrations} WHERE email_address = ?', array($userDetails['email_address']));
$db->Query('DELETE FROM {user_emails} WHERE email_address = ?', array($userDetails['email_address']));
$db->Query('DELETE FROM {reminders} WHERE to_user_id = ? OR from_user_id = ?', array($uid, $uid));
// for the unusual situuation that a user ID is re-used, make sure that the new user doesn't
// get permissions for a task automatically
$db->Query('UPDATE {tasks} SET opened_by = 0 WHERE opened_by = ?', array($uid));
Flyspray::logEvent(0, 31, serialize($userDetails));
return true;
}