X-Git-Url: https://git.llucax.com/z.facultad/75.43/tp1.git/blobdiff_plain/fd4f756623539286daf30ce3fc6a3518d2325103..refs/heads/master:/src/lib/Info.php?ds=sidebyside diff --git a/src/lib/Info.php b/src/lib/Info.php index d2bbbaa..a6d2baa 100644 --- a/src/lib/Info.php +++ b/src/lib/Info.php @@ -69,19 +69,16 @@ class Info extends Item } function saveExisting() { - if (($f = fopen($this->infoCSVConst, 'r')) == false) return false; // error + if (($f = fopen($this->infoCSVConst, 'r+')) == false) return false; // error $index = 0; - $indexSave = 0; while (!feof($f)) { + $index = ftell($f); $d = fgetcsv($f, 4096); - $index++; - if ($d[0] == $this->id) + if ($d[0] == $this->id) { - fclose($f); - if (($f = fopen($this->infoCSVConst, 'r+')) == false) return false; // error - while ($indexSave!=($index-1)) { fgetcsv($f, 4096); $indexSave++; } - fputcsv($f, array($this->id, $this->tema, $this->url, $this->autor, $this->comentario, $this->ranking, $this->fecha)); + fseek($f,$index); + fputcsv($f, array($this->id, $this->tema, $this->url, $this->autor, $this->comentario, $this->ranking, $this->fecha)); fclose($f); return true; } @@ -113,18 +110,6 @@ class Info extends Item return $resultado; } - function modificar( $pId, $pTema, $pURL, $pAutor, $pComentario ) { - $this->saveLoadThis( $pId, $pTema, $pURL, $pAutor, $pComentario ); - $resultado = ""; - if (!$this->saveExisting()) { - $resultado = "ERROR al modificar la informacion. Revise que los parametros sean los adecuados"; - file_log_add($pAutor,$resultado); - } else { - file_log_add($pAutor,"Se modificó la información"); - } - return $resultado; - } - function toHTML() { ?> icono tema