本文整理汇总了PHP中mci_check_login函数的典型用法代码示例。如果您正苦于以下问题:PHP mci_check_login函数的具体用法?PHP mci_check_login怎么用?PHP mci_check_login使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mci_check_login函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mc_login
/**
* Attempts to login the user.
* If logged in successfully, return user information.
* If failed to login in, then throw a fault.
*/
function mc_login($p_username, $p_password)
{
$t_user_id = mci_check_login($p_username, $p_password);
if ($t_user_id === false) {
return mci_soap_fault_login_failed();
}
return mci_user_get($p_username, $p_password, $t_user_id);
}
示例2: mc_user_pref_get_pref
/**
* Get the value for the specified user preference.
*
* @param string $p_username The user's username
* @param string $p_password The user's password
* @param int $p_project_id Project ID (0 = ALL_PROJECTS (mantisbt/core/constant_inc.php))
* @param string $p_pref_name The name of the preference
* @return string $t_user_pref The requested preference value
*/
function mc_user_pref_get_pref($p_username, $p_password, $p_project_id, $p_pref_name)
{
$t_user_id = mci_check_login($p_username, $p_password);
if ($t_user_id === false) {
return mci_soap_fault_login_failed();
}
if (!mci_has_readonly_access($t_user_id)) {
return mci_soap_fault_access_denied($t_user_id);
}
return user_pref_get_pref($t_user_id, $p_pref_name, $p_project_id);
}
示例3: mc_issue_attachment_delete
/**
* Delete an issue attachment given its id.
*
* @param string $p_username The name of the user trying to add an attachment to an issue.
* @param string $p_password The password of the user.
* @param integer $p_issue_attachment_id The id of the attachment to be deleted.
* @return true: success, false: failure
*/
function mc_issue_attachment_delete( $p_username, $p_password, $p_issue_attachment_id ) {
$t_user_id = mci_check_login( $p_username, $p_password );
if( $t_user_id === false ) {
return mci_soap_fault_login_failed();
}
$t_bug_id = file_get_field( $p_issue_attachment_id, 'bug_id' );
if( !access_has_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id, $t_user_id ) ) {
return mci_soap_fault_access_denied( $t_user_id );
}
return file_delete( $p_issue_attachment_id, 'bug' );
}
示例4: mc_project_attachment_delete
/**
* Delete a project attachment given its id.
*
* @param string $p_username The name of the user trying to add an attachment to an issue.
* @param string $p_password The password of the user.
* @param integer $p_project_attachment_id The id of the attachment to be deleted.
* @return true: success, false: failure
*/
function mc_project_attachment_delete($p_username, $p_password, $p_project_attachment_id)
{
$t_user_id = mci_check_login($p_username, $p_password);
if ($t_user_id === false) {
return new soap_fault('Client', '', 'Access Denied');
}
$t_project_id = file_get_field($p_project_attachment_id, 'project_id', 'project');
if (!access_has_project_level(config_get('upload_project_file_threshold'), $t_project_id, $t_user_id)) {
return new soap_fault('Client', '', 'Access Denied');
}
return file_delete($p_project_attachment_id, 'project');
}
示例5: mc_tag_delete
/**
*
* Deletes a tag
*
* @param string $p_username The user's username
* @param string $p_password The user's password * @param unknown_type $p_tag_id
* @param int $p_tag_id The id of the tag
* @return soap_fault|boolean
*/
function mc_tag_delete($p_username, $p_password, $p_tag_id)
{
$t_user_id = mci_check_login($p_username, $p_password);
if ($t_user_id === false) {
return mci_soap_fault_login_failed();
}
if (!access_has_global_level(config_get('tag_edit_threshold'))) {
return mci_soap_fault_access_denied($t_user_id);
}
if (!tag_exists($p_tag_id)) {
return SoapObjectsFactory::newSoapFault('Client', 'No tag with id ' . $p_tag_id);
}
return tag_delete($p_tag_id);
}
示例6: mc_config_get_string
function mc_config_get_string($p_username, $p_password, $p_config_var)
{
$t_user_id = mci_check_login($p_username, $p_password);
if ($t_user_id === false) {
return new soap_fault('Client', '', 'Access Denied');
}
if (!mci_has_readonly_access($t_user_id)) {
return new soap_fault('Client', '', 'Access Denied');
}
if (mci_config_is_private($p_config_var)) {
return new soap_fault('Client', '', "Access to '{$p_config_var}' is denied");
}
if (!config_is_set($p_config_var)) {
return new soap_fault('Client', '', "Config '{$p_config_var}' is undefined");
}
return config_get($p_config_var);
}
示例7: mc_config_get_string
function mc_config_get_string($p_username, $p_password, $p_config_var)
{
$t_user_id = mci_check_login($p_username, $p_password);
if ($t_user_id === false) {
return mci_soap_fault_login_failed();
}
if (!mci_has_readonly_access($t_user_id)) {
return mci_soap_fault_access_denied($t_user_id);
}
if (config_is_private($p_config_var)) {
return SoapObjectsFactory::newSoapFault('Client', "Access to '{$p_config_var}' is denied");
}
if (!config_is_set($p_config_var)) {
return SoapObjectsFactory::newSoapFault('Client', "Config '{$p_config_var}' is undefined");
}
return config_get($p_config_var);
}
示例8: mc_issue_attachment_delete
/**
* Delete an issue attachment given its id.
*
* @param string $p_username The name of the user trying to add an attachment to an issue.
* @param string $p_password The password of the user.
* @param integer $p_issue_attachment_id The id of the attachment to be deleted.
* @return true: success, false: failure
*/
function mc_issue_attachment_delete($p_username, $p_password, $p_issue_attachment_id)
{
$t_user_id = mci_check_login($p_username, $p_password);
if ($t_user_id === false) {
return mci_soap_fault_login_failed();
}
$t_bug_id = file_get_field($p_issue_attachment_id, 'bug_id');
# Perform access control checks
$t_attachment_owner = file_get_field($p_issue_attachment_id, 'user_id');
$t_current_user_is_attachment_owner = $t_attachment_owner == $t_user_id;
# Factor in allow_delete_own_attachments=ON|OFF
if (!$t_current_user_is_attachment_owner || $t_current_user_is_attachment_owner && !config_get('allow_delete_own_attachments')) {
# Check access against delete_attachments_threshold
if (!access_has_bug_level(config_get('delete_attachments_threshold'), $t_bug_id, $t_user_id)) {
return mci_soap_fault_access_denied($t_user_id);
}
}
return file_delete($p_issue_attachment_id, 'bug');
}
示例9: mc_user_profiles_get_all
/**
* Returns all the profiles for the user, including the global ones
*
* @param string $p_username The user's username.
* @param string $p_password The user's password.
* @param integer $p_page_number Page number.
* @param integer $p_per_page Results per page.
* @return mixed
*/
function mc_user_profiles_get_all($p_username, $p_password, $p_page_number, $p_per_page)
{
$t_user_id = mci_check_login($p_username, $p_password);
if ($t_user_id === false) {
return mci_soap_fault_login_failed();
}
if (!mci_has_readonly_access($t_user_id)) {
return mci_soap_fault_access_denied($t_user_id);
}
$t_results = array();
$t_start = max(array(0, $p_page_number - 1)) * $p_per_page;
foreach (profile_get_all_for_user($t_user_id) as $t_profile_row) {
$t_result = array('id' => $t_profile_row['id'], 'description' => $t_profile_row['description'], 'os' => $t_profile_row['os'], 'os_build' => $t_profile_row['os_build'], 'platform' => $t_profile_row['platform']);
if ($t_profile_row['user_id'] != 0) {
$t_result['user_id'] = mci_account_get_array_by_id($t_profile_row['user_id']);
}
$t_results[] = $t_result;
}
# the profile_api does not implement pagination in the backend, so we emulate it here
# we can always push the pagination in the database, but this seems unlikely in the
# near future, as the number of profiles is expected to be small
$t_paged_results = array_slice($t_results, $t_start, $p_per_page);
return array('total_results' => count($t_results), 'results' => $t_paged_results);
}
示例10: mc_issues_get_header
/**
* Get all issues header matching the ids.
*
* @param string $p_username The name of the user trying to access the filters.
* @param string $p_password The password of the user.
* @param IntegerArray $p_issue_ids Number of issues to display per page.
* @return array that represents an IssueHeaderDataArray structure
*/
function mc_issues_get_header($p_username, $p_password, $p_issue_ids)
{
global $g_project_override;
$t_user_id = mci_check_login($p_username, $p_password);
if ($t_user_id === false) {
return mci_soap_fault_login_failed();
}
$t_lang = mci_get_user_lang($t_user_id);
$t_result = array();
foreach ($p_issue_ids as $t_id) {
if (mci_check_access_to_bug($t_user_id, $t_id) === false) {
continue;
}
log_event(LOG_WEBSERVICE, 'getting details for issue \'' . $t_id . '\'');
$t_issue_data = bug_get($t_id, true);
$t_result[] = mci_issue_data_as_header_array($t_issue_data, $t_user_id, $t_lang);
}
return $t_result;
}
示例11: mc_filter_search_issue_ids
/**
* Get all issue ids matching the custom filter.
*
* @param string $p_username The name of the user trying to access the filters.
* @param string $p_password The password of the user.
* @param FilterSearchData $p_filter_search The custom filter.
* @param integer $p_page_number Start with the given page number (zero-based).
* @param integer $p_per_page Number of issues to display per page.
* @return array that represents an IntegerArray structure
*/
function mc_filter_search_issue_ids($p_username, $p_password, $p_filter_search, $p_page_number, $p_per_page)
{
$t_user_id = mci_check_login($p_username, $p_password);
if ($t_user_id === false) {
return mci_soap_fault_login_failed();
}
$t_rows = mci_filter_search_get_rows($t_user_id, $p_filter_search, $p_page_number, $p_per_page);
$t_result = array();
foreach ($t_rows as $t_issue_data) {
$t_result[] = $t_issue_data->id;
}
return $t_result;
}
示例12: mc_filter_get_issue_headers
/**
* Get the issue headers that match the specified filter and paging details.
*
* @param string $p_username The name of the user trying to access the filters.
* @param string $p_password The password of the user.
* @param integer $p_filter_id The id of the filter to apply.
* @param integer $p_page_number Start with the given page number (zero-based)
* @param integer $p_per_page Number of issues to display per page
* @return Array that represents an IssueDataArray structure
*/
function mc_filter_get_issue_headers($p_username, $p_password, $p_project_id, $p_filter_id, $p_page_number, $p_per_page)
{
$t_user_id = mci_check_login($p_username, $p_password);
if ($t_user_id === false) {
return mci_soap_fault_login_failed();
}
if (!mci_has_readonly_access($t_user_id, $p_project_id)) {
return mci_soap_fault_access_denied($t_user_id);
}
$t_orig_page_number = $p_page_number < 1 ? 1 : $p_page_number;
$t_page_count = 0;
$t_bug_count = 0;
$t_filter = filter_db_get_filter($p_filter_id);
$t_filter_detail = explode('#', $t_filter, 2);
if (!isset($t_filter_detail[1])) {
return SoapObjectsFactory::newSoapFault('Server', 'Invalid Filter');
}
$t_filter = unserialize($t_filter_detail[1]);
$t_filter = filter_ensure_valid_filter($t_filter);
$t_result = array();
$t_rows = filter_get_bug_rows($p_page_number, $p_per_page, $t_page_count, $t_bug_count, $t_filter, $p_project_id);
// the page number was moved back, so we have exceeded the actual page number, see bug #12991
if ($t_orig_page_number > $p_page_number) {
return $t_result;
}
foreach ($t_rows as $t_issue_data) {
$t_result[] = mci_issue_data_as_header_array($t_issue_data);
}
return $t_result;
}
示例13: mc_project_get_users
/**
* Get appropriate users assigned to a project by access level.
*
* @param string $p_username The name of the user trying to access the versions.
* @param string $p_password The password of the user.
* @param integer $p_project_id The id of the project to retrieve the users for.
* @param integer $p_access Minimum access level.
* @return Array representing a ProjectAttachmentDataArray structure.
*/
function mc_project_get_users($p_username, $p_password, $p_project_id, $p_access)
{
$t_user_id = mci_check_login($p_username, $p_password);
if ($t_user_id === false) {
return mci_soap_fault_login_failed();
}
$t_users = array();
$t_users = project_get_all_user_rows($p_project_id, $p_access);
# handles ALL_PROJECTS case
$t_display = array();
$t_sort = array();
$t_show_realname = ON == config_get('show_realname');
$t_sort_by_last_name = ON == config_get('sort_by_last_name');
foreach ($t_users as $t_user) {
$t_user_name = string_attribute($t_user['username']);
$t_sort_name = strtolower($t_user_name);
if ($t_show_realname && $t_user['realname'] != "") {
$t_user_name = string_attribute($t_user['realname']);
if ($t_sort_by_last_name) {
$t_sort_name_bits = explode(' ', strtolower($t_user_name), 2);
$t_sort_name = (isset($t_sort_name_bits[1]) ? $t_sort_name_bits[1] . ', ' : '') . $t_sort_name_bits[0];
} else {
$t_sort_name = strtolower($t_user_name);
}
}
$t_display[] = $t_user_name;
$t_sort[] = $t_sort_name;
}
array_multisort($t_sort, SORT_ASC, SORT_STRING, $t_users, $t_display);
$t_result = array();
for ($i = 0; $i < count($t_sort); $i++) {
$t_row = $t_users[$i];
// This is not very performant - But we have to assure that the data returned is exactly
// the same as the data that comes with an issue (test for equality - $t_row[] does not
// contain email fields).
$t_result[] = mci_account_get_array_by_id($t_row['id']);
}
return $t_result;
}
示例14: mc_enum_get
/**
* Get an appropriate enumeration. (Should become an internal function.)
*
* @param string $p_username The name of the user trying to access the enumeration.
* @param string $p_password The password of the user.
* @param string $p_enumeration The enumeration to get.
* @return string The requested enumeration.
*/
function mc_enum_get($p_username, $p_password, $p_enumeration)
{
$t_user_id = mci_check_login($p_username, $p_password);
if ($t_user_id === false) {
return new soap_fault('Client', '', 'Access Denied');
}
if (!mci_has_readonly_access($t_user_id)) {
return new soap_fault('Client', '', 'Access Denied');
}
$t_lang = mci_get_user_lang($t_user_id);
return lang_get($p_enumeration . '_enum_string', $t_lang);
}
示例15: mc_filter_get_issue_headers
/**
* Get the issue headers that match the specified filter and paging details.
*
* @param string $p_username The name of the user trying to access the filters.
* @param string $p_password The password of the user.
* @param integer $p_filter_id The id of the filter to apply.
* @param integer $p_page_number Start with the given page number (zero-based)
* @param integer $p_per_page Number of issues to display per page
* @return Array that represents an IssueDataArray structure
*/
function mc_filter_get_issue_headers($p_username, $p_password, $p_project_id, $p_filter_id, $p_page_number, $p_per_page)
{
$t_user_id = mci_check_login($p_username, $p_password);
if ($t_user_id === false) {
return mci_soap_fault_login_failed();
}
if (!mci_has_readonly_access($t_user_id, $p_project_id)) {
return mci_soap_fault_access_denied($t_user_id);
}
$t_page_count = 0;
$t_bug_count = 0;
$t_filter = filter_db_get_filter($p_filter_id);
$t_filter_detail = explode('#', $t_filter, 2);
if (!isset($t_filter_detail[1])) {
return new soap_fault('Server', '', 'Invalid Filter');
}
$t_filter = unserialize($t_filter_detail[1]);
$t_filter = filter_ensure_valid_filter($t_filter);
$t_result = array();
$t_rows = filter_get_bug_rows($p_page_number, $p_per_page, $t_page_count, $t_bug_count, $t_filter, $p_project_id);
foreach ($t_rows as $t_issue_data) {
$t_id = $t_issue_data->id;
$t_issue = array();
$t_issue['id'] = $t_id;
$t_issue['view_state'] = $t_issue_data->view_state;
$t_issue['last_updated'] = timestamp_to_iso8601($t_issue_data->last_updated);
$t_issue['project'] = $t_issue_data->project_id;
$t_issue['category'] = mci_get_category($t_issue_data->category_id);
$t_issue['priority'] = $t_issue_data->priority;
$t_issue['severity'] = $t_issue_data->severity;
$t_issue['status'] = $t_issue_data->status;
$t_issue['reporter'] = $t_issue_data->reporter_id;
$t_issue['summary'] = $t_issue_data->summary;
if (!empty($t_issue_data->handler_id)) {
$t_issue['handler'] = $t_issue_data->handler_id;
}
$t_issue['resolution'] = $t_issue_data->resolution;
$t_issue['attachments_count'] = count(mci_issue_get_attachments($t_issue_data->id));
$t_issue['notes_count'] = count(mci_issue_get_notes($t_issue_data->id));
$t_result[] = $t_issue;
}
return $t_result;
}