3 * Copyright 2011, Sabri LABBENE - Institut Télécom
6 * This file is part of FusionForge.
8 * FusionForge is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * FusionForge is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 require_once '../../../env.inc.php';
24 require_once $gfwww.'include/pre.php';
26 $account_id = getIntFromPost('account_id');
27 $user_id = getIntFromPost('user_id');
28 $login_name = getStringFromPost('login_name');
29 $account_password = getStringFromPost('account_password');
30 $forge_software = getIntFromPost('forge_software');
31 $account_domain = getStringFromPost('account_domain');
32 $account_uri = getStringFromPost('account_uri');
33 $account_is_foaf = getIntFromPost('account_is_foaf');
34 $oslc_uri = getStringFromPost('oslc_uri');
35 $rss_uri = getStringFromPost('rss_uri');
36 $soap_wsdl = getStringFromPost('soap_wsdl');
37 $projects_discovery = getIntFromPost('projects_discovery_method');
38 $artifacts_discovery = getIntFromPost('artifacts_discovery_method');
40 $user = session_get_user();
41 if($user->getID() != $user_id) {
42 session_redirect( '/plugins/globaldashboard/admin/manage_accounts.php?type=user&id='.$user_id.'&pluginname=globaldashboard&error_msg='. urlencode(_('You can edit only YOUR remote accounts !!!')));
45 $t_account_table = "plugin_globaldashboard_user_forge_account";
47 $t_acc_query = "UPDATE $t_account_table ".
48 " SET forge_account_login_name=$1,".
49 " forge_account_password=$2,".
50 " forge_software=$3,".
51 " forge_account_domain=$4,".
52 " forge_account_uri=$5,".
53 " forge_account_is_foaf=$6,".
54 " forge_oslc_discovery_uri=$7,".
55 " forge_account_rss_uri=$8,".
56 " forge_account_soap_wsdl_uri=$9".
57 " WHERE account_id=$10".
60 $result = db_query_params( $t_acc_query, array( $login_name, $account_password, $forge_software, $account_domain, $account_uri, $account_is_foaf, $oslc_uri,
61 $rss_uri, $soap_wsdl, $account_id, $user_id
65 // Now try to update discovery table
66 $t_discovery_table = "plugin_globaldashboard_account_discovery";
67 $t_disc_query = "UPDATE $t_discovery_table ".
68 " SET projects_discovery_method=$1,".
69 " artifacts_discovery_method=$2".
70 " WHERE account_id=$3";
71 $disc_result = db_query_params($t_disc_query, array($projects_discovery, $artifacts_discovery, $account_id));
73 session_redirect( '/plugins/globaldashboard/admin/manage_accounts.php?type=user&id='.$user_id.'&pluginname=globaldashboard&feedback='. _('Remote Account successfully updated'));
75 session_redirect( '/plugins/globaldashboard/admin/manage_accounts.php?type=user&id='.$user_id.'&pluginname=globaldashboard&feedback='.printf('Unable to update remote account: '.db_error()));
78 session_redirect( '/plugins/globaldashboard/admin/manage_accounts.php?type=user&id='.$user_id.'&pluginname=globaldashboard&feedback='.printf('Unable to update remote account: '.db_error()));