Added __LINE__ and __FILE__ to SQL queries. Considered having path_parts return clean variables

This commit is contained in:
zone 2001-06-16 03:54:10 +00:00
parent 9a523159af
commit 3d8137b0d5

View File

@ -264,9 +264,24 @@ class vfs
}
}
/*
We have to count it before because new keys will be added,
which would create an endless loop
*/
/*
$count = count ($rarray);
reset ($array);
for ($i = 0; (list ($key, $value) = each ($rarray)) && $i != $count; $i++)
{
$rarray[$key . "_clean"] = $this->db_clean ($value);
}
*/
if ($object)
{
$robject = new path_class;
reset ($rarray);
while (list ($key, $value) = each ($rarray))
{
$robject->$key = $value;
@ -567,7 +582,7 @@ class vfs
}
else
{
$query = $phpgw->db->query ("INSERT INTO phpgw_vfs SET owner_id='$this->working_id', directory='$p->fake_leading_dirs', name='$p->fake_name'");
$query = $phpgw->db->query ("INSERT INTO phpgw_vfs SET owner_id='$this->working_id', directory='$p->fake_leading_dirs', name='$p->fake_name'", __LINE__, __FILE__);
$this->set_attributes ($p->fake_full_path, array (RELATIVE_NONE), array ("createdby_id" => $account_id, "created" => $this->now, "size" => 0, "deleteable" => "Y", "app" => $currentapp));
$this->correct_attributes ($p->fake_full_path, array (RELATIVE_NONE));
@ -614,13 +629,13 @@ class vfs
{
$size = filesize ($t->real_full_path);
$query = $phpgw->db->query ("SELECT size, mime_type, deleteable, comment, app FROM phpgw_vfs WHERE directory='$f->fake_leading_dirs' AND name='$f->fake_name'");
$query = $phpgw->db->query ("SELECT size, mime_type, deleteable, comment, app FROM phpgw_vfs WHERE directory='$f->fake_leading_dirs' AND name='$f->fake_name'", __LINE__, __FILE__);
$phpgw->db->next_record ();
$record = $phpgw->db->Record;
if ($this->file_exists ($to, array ($relatives[1])))
{
$phpgw->db->query ("UPDATE phpgw_vfs SET owner_id='$this->working_id', directory='$t->fake_leading_dirs', name='$t->fake_name' WHERE owner_id='$this->working_id' AND directory='$t->fake_leading_dirs' AND name='$t->fake_name'");
$phpgw->db->query ("UPDATE phpgw_vfs SET owner_id='$this->working_id', directory='$t->fake_leading_dirs', name='$t->fake_name' WHERE owner_id='$this->working_id' AND directory='$t->fake_leading_dirs' AND name='$t->fake_name'", __LINE__, __FILE__);
$this->set_attributes ($t->fake_full_path, array (RELATIVE_NONE), array ("createdby_id" => $account_id, "created" => $this->now, "size" => $size, "mime_type" => $record["mime_type"], "deleteable" => $record["deleteable"], "comment" => $record["comment"], "app" => $record["app"]));
}
@ -710,7 +725,7 @@ class vfs
$ls = $this->ls ($f->fake_full_path, array (RELATIVE_NONE));
$this->delete ($t->fake_full_path, array (RELATIVE_NONE));
$query = $phpgw->db->query ("UPDATE phpgw_vfs SET name='$t->fake_name', directory='$t->fake_leading_dirs' WHERE directory='$f->fake_leading_dirs' AND name='$f->fake_name'");
$query = $phpgw->db->query ("UPDATE phpgw_vfs SET name='$t->fake_name', directory='$t->fake_leading_dirs' WHERE directory='$f->fake_leading_dirs' AND name='$f->fake_name'", __LINE__, __FILE__);
$this->set_attributes ($t->fake_full_path, array (RELATIVE_NONE), array ("modifiedby_id" => $account_id, modified => $this->now));
$this->correct_attributes ($t->fake_full_path, array (RELATIVE_NONE));
@ -728,7 +743,7 @@ class vfs
while (list ($num, $entry) = each ($ls))
{
$newdir = ereg_replace ("^$f->fake_full_path", $t->fake_full_path, $entry["directory"]);
$query = $phpgw->db->query ("UPDATE phpgw_vfs SET directory='$newdir' WHERE file_id='$entry[file_id]'");
$query = $phpgw->db->query ("UPDATE phpgw_vfs SET directory='$newdir' WHERE file_id='$entry[file_id]'", __LINE__, __FILE__);
$this->correct_attributes ("$newdir/$entry[name]", array (RELATIVE_NONE));
}
}
@ -764,14 +779,21 @@ class vfs
if (!$this->file_exists ($string, array ($relatives[0])))
{
unlink ($p->real_full_path);
$rr = unlink ($p->real_full_path);
return True;
if ($rr)
{
return True;
}
else
{
return False;
}
}
if ($this->file_type ($string, array ($relatives[0])) != "Directory")
{
$query = $phpgw->db->query ("DELETE FROM phpgw_vfs WHERE directory='$p->fake_leading_dirs' AND name='$p->fake_name'");
$query = $phpgw->db->query ("DELETE FROM phpgw_vfs WHERE directory='$p->fake_leading_dirs' AND name='$p->fake_name'", __LINE__, __FILE__);
$rr = unlink ($p->real_full_path);
if ($query || $rr)
@ -812,7 +834,7 @@ class vfs
}
/* Last, we delete the directory itself */
$query = $phpgw->db->query ("DELETE FROM phpgw_vfs WHERE directory='$p->fake_leading_dirs' AND name='$p->fake_name'");
$query = $phpgw->db->query ("DELETE FROM phpgw_vfs WHERE directory='$p->fake_leading_dirs' AND name='$p->fake_name'", __LINE__, __FILE__);
rmdir ($p->real_full_path);
return True;
@ -863,7 +885,7 @@ class vfs
{
if (!$this->file_exists ($p->fake_leading_dirs . "/" . $dir, array (RELATIVE_NONE)))
{
$query = $phpgw->db->query ("INSERT INTO phpgw_vfs SET owner_id='$this->working_id', name='$p->fake_name', directory='$p->fake_leading_dirs'");
$query = $phpgw->db->query ("INSERT INTO phpgw_vfs SET owner_id='$this->working_id', name='$p->fake_name', directory='$p->fake_leading_dirs'", __LINE__, __FILE__);
$this->set_attributes ($p->fake_full_path, array (RELATIVE_NONE), array ("createdby_id" => $account_id, "size" => 1024, "mime_type" => "Directory", "created" => $this->now, "modified" => '', deleteable => "Y", "app" => $currentapp));
@ -915,7 +937,7 @@ class vfs
depending on if the attribute was supplied in the $attributes array
*/
$query = $phpgw->db->query ("SELECT file_id, owner_id, createdby_id, modifiedby_id, created, modified, size, mime_type, deleteable, comment, app FROM phpgw_vfs WHERE directory='$p->fake_leading_dirs' AND name='$p->fake_name'");
$query = $phpgw->db->query ("SELECT file_id, owner_id, createdby_id, modifiedby_id, created, modified, size, mime_type, deleteable, comment, app FROM phpgw_vfs WHERE directory='$p->fake_leading_dirs' AND name='$p->fake_name'", __LINE__, __FILE__);
$phpgw->db->next_record ();
$record = $phpgw->db->Record;
@ -935,7 +957,7 @@ class vfs
$$attribute = $this->db_clean ($$attribute);
}
$query = $phpgw->db->query ("UPDATE phpgw_vfs SET owner_id='$owner_id', createdby_id='$createdby_id', modifiedby_id='$modifiedby_id', created='$created', modified='$modified', size='$size', mime_type='$mime_type', deleteable='$deleteable', comment='$comment', app='$app' WHERE file_id='$record[file_id]'");
$query = $phpgw->db->query ("UPDATE phpgw_vfs SET owner_id='$owner_id', createdby_id='$createdby_id', modifiedby_id='$modifiedby_id', created='$created', modified='$modified', size='$size', mime_type='$mime_type', deleteable='$deleteable', comment='$comment', app='$app' WHERE file_id='$record[file_id]'", __LINE__, __FILE__);
if ($query)
{
@ -996,7 +1018,7 @@ class vfs
$p = $this->path_parts ($file, array ($relatives[0]));
$query = $phpgw->db->query ("SELECT mime_type FROM phpgw_vfs WHERE directory='$p->fake_leading_dirs' AND name='$p->fake_name'");
$query = $phpgw->db->query ("SELECT mime_type FROM phpgw_vfs WHERE directory='$p->fake_leading_dirs' AND name='$p->fake_name'", __LINE__, __FILE__);
$phpgw->db->next_record ();
$mime_type = $phpgw->db->Record["mime_type"];
@ -1017,7 +1039,7 @@ class vfs
$p = $this->path_parts ($string, array ($relatives[0]));
$query = $phpgw->db->query ("SELECT name FROM phpgw_vfs WHERE directory='$p->fake_leading_dirs' AND name='$p->fake_name'");
$query = $phpgw->db->query ("SELECT name FROM phpgw_vfs WHERE directory='$p->fake_leading_dirs' AND name='$p->fake_name'", __LINE__, __FILE__);
if ($phpgw->db->next_record ())
{
@ -1095,7 +1117,7 @@ class vfs
{
$p = $this->path_parts ($dir, array (RELATIVE_NONE));
$query = $phpgw->db->query ("SELECT file_id, owner_id, createdby_id, modifiedby_id, created, modified, size, mime_type, deleteable, comment, app, directory, name FROM phpgw_vfs WHERE directory='$p->fake_leading_dirs' AND name='$p->fake_name'");
$query = $phpgw->db->query ("SELECT file_id, owner_id, createdby_id, modifiedby_id, created, modified, size, mime_type, deleteable, comment, app, directory, name FROM phpgw_vfs WHERE directory='$p->fake_leading_dirs' AND name='$p->fake_name'", __LINE__, __FILE__);
$phpgw->db->next_record ();
$record = $phpgw->db->Record;
@ -1113,7 +1135,7 @@ class vfs
$sql .= " ORDER BY directory";
$query = $phpgw->db->query ($sql);
$query = $phpgw->db->query ($sql, __LINE__, __FILE__);
$rarray = array ();
while ($phpgw->db->next_record ())