Update of /cvsroot/openfirst/update
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17574
Modified Files:
system.php
Added Files:
folder1.png selectinstalldir.php
Log Message:
Add selection of installation directory to system settings.
--- NEW FILE: selectinstalldir.php ---
<?php
if(! isset($ftpreachable)) {
include_once("../config/globals.php");
include_once($header);
$standalone = true;
$system = mysql_fetch_object(mysql_query("SELECT * FROM ofirst_systems WHERE id='" . $_REQUEST["sysid"] . "' AND owner='$user->id';"));
$ftpreachable = ftp_connect($system->ftpserver);
if($ftpreachable) {
$loginokay = @ftp_login($ftpreachable, $system->ftpusername, $system->ftppassword);
}
if(! $ftpreachable || ! $loginokay) {
echo "FTP server is unreachable or cannot login properly.";
include_once($footer);
die();
}
if(ftp_size($ftpreachable, $_REQUEST["dir"]) == -1 && isset($_REQUEST["dir"])) {
// update database
echo "Install directory for $system->displayname updated.";
mysql_query("UPDATE ofirst_systems SET installdirectory='" . $_REQUEST["dir"] . "' WHERE id='$system->id' AND owner='$user->id';");
include_once($footer);
die();
} elseif(isset($_REQUEST["dir"])) {
echo "Could not browse to directory. Change for $system->displayname aborted.";
die();
}
}
function displaylist($ftpdir = "") {
global $ftpreachable;
global $system;
if($ftpdir != "") {
$dirs = ftp_nlist($ftpreachable, $ftpdir);
if(is_array($dirs)) {
foreach($dirs as $dir) {
if(ftp_size($ftpreachable, $dir) == -1) {
echo "<tr><td><img src='folder1.png' alt=''></td><td><a href='selectinstalldir.php?sysid=$system->id&dir=$dir'>$dir</a></td></tr>";
displaylist($dir);
}
}
}
}
}
echo "Specify installation directory on server";
echo "<br>" . ftp_pwd($ftpreachable);
echo "<table>";
displaylist(ftp_pwd($ftpreachable));
echo "</table>";
if(isset($standalone)) { include_once($footer); }
?>
--- NEW FILE: folder1.png ---
(This appears to be a binary file; contents omitted.)
Index: system.php
===================================================================
RCS file: /cvsroot/openfirst/update/system.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** system.php 19 Nov 2004 20:46:21 -0000 1.9
--- system.php 19 Nov 2004 22:03:18 -0000 1.10
***************
*** 25,33 ****
$sq = mysql_query("SELECT id, displayname FROM ofirst_systems WHERE owner='$user->id' ORDER BY displayname;");
while($s = mysql_fetch_object($sq)) {
! echo "<tr
! ><th>
<img src='network.png'></th><td>
<a href='system.php?id=$s->id'>$s->displayname</a></td><td>
! [ <a href=\"javascript: alert('Remove system functionality has not been added yet.');\">Remove System</a> ]
</td></tr>";
}
--- 25,32 ----
$sq = mysql_query("SELECT id, displayname FROM ofirst_systems WHERE owner='$user->id' ORDER BY displayname;");
while($s = mysql_fetch_object($sq)) {
! echo "<tr><th>
<img src='network.png'></th><td>
<a href='system.php?id=$s->id'>$s->displayname</a></td><td>
! [ <a href=\"javascript: alert('Remove system functionality has not been added yet.');\">Remove System</a> | <a href='selectinstalldir.php?sysid=$s->id'>Change installation directory</a> ]
</td></tr>";
}
***************
*** 57,60 ****
--- 56,63 ----
echo "FTP connection okay.<br>";
+ $system = mysql_fetch_object(mysql_query("SELECT * FROM ofirst_systems WHERE id='" . mysql_insert_id()
+ . "' AND owner='$user->id';"));
+ include("selectinstalldir.php");
+
// Add as a new system
mysql_query("INSERT INTO ofirst_systems
***************
*** 92,95 ****
--- 95,100 ----
echo "FTP connection okay.<br>";
+ $system = mysql_fetch_object(mysql_query("SELECT * FROM ofirst_systems WHERE id='" . $_REQUEST["id"] . "' AND owner='$user->id';"));
+ include("selectinstalldir.php");
// Update existing system configuration
|