* @uses config_api.php * @uses event_api.php * @uses form_api.php * @uses gpc_api.php * @uses print_api.php * @uses project_api.php */ require_once 'core.php'; require_api('access_api.php'); require_api('authentication_api.php'); require_api('config_api.php'); require_api('event_api.php'); require_api('form_api.php'); require_api('gpc_api.php'); require_api('print_api.php'); require_api('project_api.php'); form_security_validate('manage_proj_update'); auth_reauthenticate(); $f_project_id = gpc_get_int('project_id'); $f_name = gpc_get_string('name'); $f_description = gpc_get_string('description'); $f_status = gpc_get_int('status'); $f_view_state = gpc_get_int('view_state'); $f_file_path = gpc_get_string('file_path', ''); $f_enabled = gpc_get_bool('enabled'); $f_inherit_global = gpc_get_bool('inherit_global', 0); access_ensure_project_level(config_get('manage_project_threshold'), $f_project_id); project_update($f_project_id, $f_name, $f_description, $f_status, $f_view_state, $f_file_path, $f_enabled, $f_inherit_global); event_signal('EVENT_MANAGE_PROJECT_UPDATE', array($f_project_id)); form_security_purge('manage_proj_update'); print_header_redirect('manage_proj_page.php');
/** * Update a project * * @param string $p_username The name of the user. * @param string $p_password The password of the user. * @param integer $p_project_id A project's identifier. * @param stdClass $p_project A new ProjectData structure. * @return boolean returns true or false depending on the success of the update action */ function mc_project_update($p_username, $p_password, $p_project_id, stdClass $p_project) { global $g_project_override; $t_user_id = mci_check_login($p_username, $p_password); if ($t_user_id === false) { return mci_soap_fault_access_denied(); } if (!mci_has_administrator_access($t_user_id, $p_project_id)) { return mci_soap_fault_access_denied($t_user_id); } if (!project_exists($p_project_id)) { return SoapObjectsFactory::newSoapFault('Client', 'Project \'' . $p_project_id . '\' does not exist.'); } $g_project_override = $p_project_id; $p_project = SoapObjectsFactory::unwrapObject($p_project); if (!isset($p_project['name'])) { return SoapObjectsFactory::newSoapFault('Client', 'Missing required field \'name\'.'); } else { $t_name = $p_project['name']; } # check to make sure project doesn't already exist if ($t_name != project_get_name($p_project_id)) { if (!project_is_name_unique($t_name)) { return SoapObjectsFactory::newSoapFault('Client', 'Project name exists'); } } if (!isset($p_project['description'])) { $t_description = project_get_field($p_project_id, 'description'); } else { $t_description = $p_project['description']; } if (!isset($p_project['status'])) { $t_status = project_get_field($p_project_id, 'status'); } else { $t_status = $p_project['status']; } if (!isset($p_project['view_state'])) { $t_view_state = project_get_field($p_project_id, 'view_state'); } else { $t_view_state = $p_project['view_state']; } if (!isset($p_project['file_path'])) { $t_file_path = project_get_field($p_project_id, 'file_path'); } else { $t_file_path = $p_project['file_path']; } if (!isset($p_project['enabled'])) { $t_enabled = project_get_field($p_project_id, 'enabled'); } else { $t_enabled = $p_project['enabled']; } if (!isset($p_project['inherit_global'])) { $t_inherit_global = project_get_field($p_project_id, 'inherit_global'); } else { $t_inherit_global = $p_project['inherit_global']; } $t_project_status = mci_get_project_status_id($t_status); $t_project_view_state = mci_get_project_view_state_id($t_view_state); project_update($p_project_id, $t_name, $t_description, $t_project_status, $t_project_view_state, $t_file_path, $t_enabled, $t_inherit_global); return true; }
/** * Update a project * * @param string $p_username The name of the user * @param string $p_password The password of the user * @param integer $p_project_id A project's id * @param Array $p_project A new ProjectData structure * @return bool returns true or false depending on the success of the update action */ function mc_project_update($p_username, $p_password, $p_project_id, $p_project) { $t_user_id = mci_check_login($p_username, $p_password); if ($t_user_id === false) { return new soap_fault('Client', '', 'Access Denied', 'Username/password combination was incorrect'); } if (!mci_has_administrator_access($t_user_id, $p_project_id)) { return new soap_fault('Client', '', 'Access Denied', 'User does not have administrator access'); } if (!project_exists($p_project_id)) { return new soap_fault('Client', '', "Project '{$p_project_id}' does not exist."); } if (!isset($p_project['name'])) { return new soap_fault('Client', '', 'Missing Field', 'Required Field Missing'); } else { $t_name = $p_project['name']; } // check to make sure project doesn't already exist if ($t_name != project_get_name($p_project_id)) { if (!project_is_name_unique($t_name)) { return new soap_fault('Client', '', 'Project name exists', 'The project name you attempted to add exists already'); } } if (!isset($p_project['description'])) { $t_description = project_get_field($p_project_id, 'description'); } else { $t_description = $p_project['description']; } if (!isset($p_project['status'])) { $t_status = project_get_field($p_project_id, 'status'); } else { $t_status = $p_project['status']; } if (!isset($p_project['view_state'])) { $t_view_state = project_get_field($p_project_id, 'view_state'); } else { $t_view_state = $p_project['view_state']; } if (!isset($p_project['file_path'])) { $t_file_path = project_get_field($p_project_id, 'file_path'); } else { $t_file_path = $p_project['file_path']; } if (!isset($p_project['enabled'])) { $t_enabled = project_get_field($p_project_id, 'enabled'); } else { $t_enabled = $p_project['enabled']; } if (!isset($p_project['inherit_global'])) { $t_inherit_global = project_get_field($p_project_id, 'inherit_global'); } else { $t_inherit_global = $p_project['inherit_global']; } $t_project_status = mci_get_project_status_id($t_status); $t_project_view_state = mci_get_project_view_state_id($t_view_state); return project_update($p_project_id, $t_name, $t_description, $t_project_status, $t_project_view_state, $t_file_path, $t_enabled, $t_inherit_global); }
# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org # Copyright (C) 2002 - 2007 Mantis Team - mantisbt-dev@lists.sourceforge.net # Mantis is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # Mantis 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 Mantis. If not, see <http://www.gnu.org/licenses/>. # -------------------------------------------------------- # $Id: manage_proj_update.php,v 1.27.2.1 2007-10-13 22:33:43 giallu Exp $ # -------------------------------------------------------- require_once 'core.php'; form_security_validate('manage_proj_update'); auth_reauthenticate(); $f_project_id = gpc_get_int('project_id'); $f_name = gpc_get_string('name'); $f_description = gpc_get_string('description'); $f_status = gpc_get_int('status'); $f_view_state = gpc_get_int('view_state'); $f_file_path = gpc_get_string('file_path', ''); $f_enabled = gpc_get_bool('enabled'); access_ensure_project_level(config_get('manage_project_threshold'), $f_project_id); project_update($f_project_id, $f_name, $f_description, $f_status, $f_view_state, $f_file_path, $f_enabled); form_security_purge('manage_proj_update'); print_header_redirect('manage_proj_page.php');