/** * Update data source */ function sumo_update_datasource_data($data = array()) { if (!empty($data)) { global $SUMO; $query = "UPDATE " . SUMO_TABLE_DATASOURCES . " \n\t\t\t\tSET\n\t\t\t \tname='" . $data['name'] . "', \n\t\t\t \ttype='" . $data['type'] . "', \n\t\t\t \thost='" . $data['host'] . "',\n\t\t\t \tport=" . $data['port'] . ",\n\t\t\t \tusername='******'username'] . "',\n\t\t\t \tpassword='******'password'] . "',\n\t\t\t \tdb_name='" . $data['db_name'] . "',\n\t\t\t \tdb_table='" . $data['db_table'] . "',\n\t\t\t \tdb_field_user='******'db_field_user'] . "',\n\t\t\t \tdb_field_password='******'db_field_password'] . "',\n\t\t\t \tenctype='" . $data['enctype'] . "',\n\t\t\t \tldap_base='" . $data['ldap_base'] . "'\n\t\t\t WHERE id=" . $data['id'] . " AND id<>1"; $SUMO['DB']->Execute($query); // if data source updated if (sumo_verify_datasource_exist('id', $data['id'])) { sumo_write_log('I09006X', array($data['id'], $data['name'], $SUMO['user']['user']), 3, 3, 'system', FALSE); return TRUE; } else { return FALSE; } } else { return FALSE; } }
* @version 0.4.2 * @link http://sumoam.sourceforge.net SUMO Access Manager * @author Alberto Basso <*****@*****.**> * @copyright Copyright © 2003-2009, Alberto Basso * @package SUMO * @category Console */ // Patch for MySQLUsers if (strtolower($_POST['host'] == 'localhost')) { $_POST['host'] = '127.0.0.1'; } $data = array(array('dsname', $_POST['name'], 1), array('type', $_POST['type'], 1), array('hostname', $_POST['host']), array('port', $_POST['port']), array('username', $_POST['username']), array('password', $_POST['password']), array('db_name', $_POST['db_name']), array('db_table', $_POST['db_table']), array('enctype', $_POST['enctype']), array('username', $_POST['db_field_user']), array('password', $_POST['db_field_password']), array('enctype', $_POST['enctype']), array('ldap_base', $_POST['ldap_base'])); $validate = sumo_validate_data_network($data, TRUE); if ($validate[0]) { // verify if datasource already exist if (sumo_verify_datasource_exist('name', $_POST['name'])) { $validate = array(FALSE, sumo_get_message('I09002C', $_POST['name'])); } $ds = sumo_get_available_datasources(true); // MySQL / MySQLUsers / Postgres / Oracle / Joomla if (in_array($_POST['type'], $ds) && (!$_POST['db_name'] || !$_POST['db_table'] || !$_POST['db_field_user'] || !$_POST['db_field_password'])) { $validate = array(FALSE, sumo_get_message('I09004C', $_POST['db_name'])); } // LDAP/LDAPS if (($_POST['type'] == 'LDAP' || $_POST['type'] == 'LDAPS' || $_POST['type'] == 'ADAM') && !$_POST['ldap_base']) { $validate = array(FALSE, sumo_get_message('I09005C')); } } if (!$validate[0]) { $tpl['MESSAGE:H'] = sumo_get_message('DataSourceNotAdded', $_POST['name']) . ":<br>" . $validate[1]; } else {