isError()) { exit_error(_('Error'), $group->getErrorMessage()); } if (getStringFromRequest('createdb')) { $newdbtypeid = getIntFromRequest('newdbtypeid'); //mysql takes issue with database names that have dashes in them - so strip the dashes, replace with "" //e.g. free-mysql becomes freemysql (it's a workaround) //if there is a dash in the groupname $dbname = str_replace("-", "", $group->getUnixName()); //check there is no name double up - if there is - add an incrementing to the number to the end $dbname = prdb_namespace_seek($dbname); $randompw = random_pwgen(); $res = db_query_params("INSERT INTO prdb_dbs(group_id,dbname,dbusername,dbuserpass,requestdate,dbtype,created_by,state) VALUES($1, $2, $2, $3, $4, $5, $6 ,2)", array($group_id, $dbname, $randompw, time(), $newdbtypeid, $LUSER->getID())); if (!$res || db_affected_rows($res) < 1) { $feedback .= _('Cannot add database entry').': '.db_error(); } else { $feedback .= _('Database scheduled for creation'); group_add_history('Created database '.$dbname.' type '.$row_db['dbsoftware'].' ','',$group_id); } } if (getStringFromRequest('updatedbrec')) { $dbid = getIntFromRequest('dbid'); $pw = getStringFromRequest('pw'); $pwconfirm = getStringFromRequest('pwconfirm'); $newdbtypeid = getIntFromRequest('newdbtypeid'); if ($pw == $pwconfirm) { //sync new password, and flag it as 'pending (an) update' $res = db_query_params (' UPDATE prdb_dbs SET dbuserpass = $1, state = $2 WHERE dbid = $3 AND group_id = $4 ', array($pw, '4', $dbid, $group_id)); if (!$res || db_affected_rows($res) < 1) { $feedback .= "Update failure - ".db_error().""; } else { $res = db_query_params (' SELECT * FROM prdb_types WHERE dbtypeid=$1 ', array($newdbtypeid)); $row_db = db_fetch_array($res); group_add_history('Updated database - (type: '.$row_db['dbsoftware'].')','',$group_id); } } else { $feedback .= "Operation failed. Password and Password Confirm are not the same"; } } if (getStringFromRequest('deletedbconfirm')) { $dbid = getIntFromRequest('dbid'); //schedule for deletion $res = db_query_params (' UPDATE prdb_dbs SET state=3 WHERE dbid=$1 AND group_id=$2 ', array($dbid, $group_id)); if (!$res || db_affected_rows($res) < 1) { $feedback .= 'Cannot delete database: '.db_error(); } else { $feedback .= "Database scheduled for deletion"; } } project_admin_header(array('title'=>_('Database Information').'','group'=>$group_id)); // XXX ogi: where's deletedb defined? if ($deletedb == 1) { print "
'._('Add New Database').'
'._('Clicking on "create" will schedule the creation of the database, and email the details to the project administrators').'
'._('Database Type').':
'; } else { ?>0) { $title=array(); $title[]=_('DB Type'); $title[]=_('State'); $title[]=_('New Password'); $title[]=_('Confirm New'); $title[]=_('Operations'); echo $GLOBALS['HTML']->listTableTop($title); while ($row_db = db_fetch_array($res_db)) { print '
'._('There are no databases currently allocated to this group').'
'; } project_admin_footer(array()); ?>