diff options
| author | Horus3 | 2014-04-21 20:26:26 +0200 |
|---|---|---|
| committer | Horus3 | 2014-04-21 20:26:26 +0200 |
| commit | 1301304d2ea739f550738e0fafc56d74a65905f4 (patch) | |
| tree | e309ae34480b6f768c086ca685c8d56c0c95b266 /www/class.files.php | |
| parent | def084a19a19e1d5c77600c0c0967e5a8fed5b93 (diff) | |
| download | files.iamfabulous.de-1301304d2ea739f550738e0fafc56d74a65905f4.tar.gz | |
Added documentation for class and new methods.
Diffstat (limited to 'www/class.files.php')
| -rw-r--r-- | www/class.files.php | 89 |
1 files changed, 71 insertions, 18 deletions
diff --git a/www/class.files.php b/www/class.files.php index 7ce7d64..8f4090a 100644 --- a/www/class.files.php +++ b/www/class.files.php @@ -5,6 +5,9 @@ class file { public $file; public $DirList; public $FileList; + public $OwnerId; + public $ParentId; + public $ParentName; function __construct($val = null){ if($val == null){ @@ -32,6 +35,21 @@ class file { $this->DirList = $DirRes; $this->FileList = $FileRes; + + $db = $GLOBALS["db"]; + + $OwnerId = user_id($GLOBALS["db"], $_GET["name"]); + $this->OwnerId = $OwnerId; + + $FileId = select_file_id($db, $OwnerId, $_GET["folder"]); + $ParentId_db = $db->query("SELECT parent FROM files WHERE id=".$FileId.";"); + $ParentId = $ParentId_db->fetchArray(SQLITE3_NUM); + $this->ParentId = $ParentId[0]; + + $ParentName_db = $db->query("SELECT name FROM files WHERE id=".$ParentId[0]); + $ParentName = $ParentName_db->fetchArray(SQLITE3_NUM); + $this->ParentName = $ParentName[0]; + } function NotFound(){ if($this->file == FILE_NOT_FOUND){ @@ -78,24 +96,14 @@ class file { return $res; } } - function getParent($val = null){ - $ar = $this->file; - if($val != null){ - if(!preg_match("/^[0-9]+$/", $val)){ - return false; - } - return $ar[$val][1]; - } else { - $res; - for($i=0; $i<count($ar); $i++){ - $res[$i] = $ar[$i][1]; - } - return $res; - } + function getParentId(){ + return $this->ParentId; + } + function getParentName(){ + return $this->ParentName; } function getOwnerId(){ - $id = user_id($GLOBALS["db"], $_GET["name"]); - return $id; + return $this->OwnerId; } function getOwnerName(){ return $_GET["name"]; @@ -160,7 +168,7 @@ class file { return $res; } } - function getHash($val = null){ + function getShare($val = null){ $ar = $this->file; if($val != null){ if(!preg_match("/^[0-9]+$/", $val)){ @@ -175,7 +183,7 @@ class file { return $res; } } - function getDownLink($val = null){ + function getHash($val = null){ $ar = $this->file; if($val != null){ if(!preg_match("/^[0-9]+$/", $val)){ @@ -190,6 +198,51 @@ class file { return $res; } } + function getDownLink($val = null){ + $ar = $this->file; + if($val != null){ + if(!preg_match("/^[0-9]+$/", $val)){ + return false; + } + return $ar[$val][9]; + } else { + $res; + for($i=0; $i<count($ar); $i++){ + $res[$i] = $ar[$i][9]; + } + return $res; + } + } + function getUploadTime($val = null){ + $ar = $this->file; + if($val != null){ + if(!preg_match("/^[0-9]+$/", $val)){ + return false; + } + return $ar[$val][10]; + } else { + $res; + for($i=0; $i<count($ar); $i++){ + $res[$i] = $ar[$i][10]; + } + return $res; + } + } + function getLastTime($val = null){ + $ar = $this->file; + if($val != null){ + if(!preg_match("/^[0-9]+$/", $val)){ + return false; + } + return $ar[$val][11]; + } else { + $res; + for($i=0; $i<count($ar); $i++){ + $res[$i] = $ar[$i][11]; + } + return $res; + } + } function getAll(){ return $this->file; } |
