* The rest Copyright 2002-2004 (c) GForge Team
* http://fusionforge.org/
*
- * This file is part of FusionForge.
- *
- * FusionForge 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.
+ * This file is part of FusionForge. FusionForge 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 Licence, or (at your option)
+ * any later version.
*
* FusionForge 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 FusionForge; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
$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)
+ //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);
if (!$res || db_affected_rows($res) < 1) {
$error_msg .= _('Cannot add database entry').': '.db_error();
} else {
-
+
$feedback .= _('Database scheduled for creation');
group_add_history('Created database '.$dbname.' type '.$row_db['dbsoftware'].' ','',$group_id);
-
+
}
}
//sync new password, and flag it as 'pending (an) update'
$res = db_query_params ('
- UPDATE prdb_dbs
+ UPDATE prdb_dbs
SET dbuserpass = $1,
state = $2
- WHERE dbid = $3
+ WHERE dbid = $3
AND group_id = $4
',
array($pw,
'4',
$dbid,
- $group_id));
+ $group_id));
if (!$res || db_affected_rows($res) < 1) {
$error_msg .= "Update failure - ".db_error()."";
} else {
$res = db_query_params ('
- SELECT *
- FROM prdb_types
+ SELECT *
+ FROM prdb_types
WHERE dbtypeid=$1
',
array($newdbtypeid));
//schedule for deletion
$res = db_query_params ('
- UPDATE prdb_dbs
- SET state=3
+ UPDATE prdb_dbs
+ SET state=3
WHERE dbid=$1
AND group_id=$2
',
}
$res_db = db_query_params ('
- SELECT *
- FROM prdb_types
+ SELECT *
+ FROM prdb_types
WHERE dbsoftware NOT IN (
- SELECT dbsoftware
- FROM prdb_dbs,prdb_types
- WHERE dbtypeid=dbtype
+ SELECT dbsoftware
+ FROM prdb_dbs,prdb_types
+ WHERE dbtypeid=dbtype
AND group_id=$1
AND state IN (1,2,4)
)
print '
<p><strong><span style="text-decoration:underline">'._('Add New Database').'</span></strong></p>
- <p><em>'._('Clicking on "create" will schedule the creation of the database, and email the details to the project administrators').'</em></p>
+ <p><em>'._('Clicking on "create" will schedule the creation of the database, and email the details to the project administrators').'</em></p>
<p><strong>'._('Database Type').':</strong></p>
<p><form action="'.getStringFromServer('PHP_SELF').'" method="post">
while ($res_row = db_fetch_array($res_db)) {
- print "<option value=\"".$res_row['dbtypeid']."\">".$res_row['dbsoftware']."</option>";
+ print "<option value=\"".$res_row['dbtypeid']."\">".$res_row['dbsoftware']."</option>";
}
print '
</select>
<input type="submit" name="Create" value="'._('Create').'" />
</form></p>
- ';
+ ';
} else {
?>
}
$res_db = db_query_params("
- SELECT *
- FROM prdb_dbs,prdb_states,prdb_types
+ SELECT *
+ FROM prdb_dbs,prdb_states,prdb_types
WHERE group_id=$1
- AND stateid=state
+ AND stateid=state
AND dbtype=dbtypeid
", array($group_id));
';
//if database is active or pending update allow the record to be deleted or password changed
-
+
if (($row_db['state'] == 1) || ($row_db['state'] == 4) || ($row_db['state'] == 2)) {
print '<form name="dbupdate" method="post" action="'.getStringFromServer('PHP_SELF').'?group_id='.$group_id.'">
<td>
<input type="submit" name="submit" value="'._('Update').'" />
</td>
- </form>
+ </form>
';
} else {
<td> </td>
';
}
-
+
print '</tr>';
}