diff --git a/campcaster/src/modules/htmlUI/var/ui_base.inc.php b/campcaster/src/modules/htmlUI/var/ui_base.inc.php index 985f1b73f..14e523cc8 100644 --- a/campcaster/src/modules/htmlUI/var/ui_base.inc.php +++ b/campcaster/src/modules/htmlUI/var/ui_base.inc.php @@ -233,11 +233,13 @@ class uiBase } else { $this->id = M2tree::GetObjId($this->login, $this->gb->storId); } - $parentId = M2tree::GetParent($this->id); - $this->pid = ($parentId != 1) ? $parentId : FALSE; - $this->type = Greenbox::getFileType($this->id); - $this->fid = ($this->type == 'Folder') ? $this->id : $this->pid; - $this->homeid = M2tree::GetObjId($this->login, $this->gb->storId); + if (!is_null($this->id)) { + $parentId = M2tree::GetParent($this->id); + $this->pid = ($parentId != 1) ? $parentId : FALSE; + $this->type = Greenbox::getFileType($this->id); + $this->fid = ($this->type == 'Folder') ? $this->id : $this->pid; + $this->homeid = M2tree::GetObjId($this->login, $this->gb->storId); + } } } diff --git a/campcaster/src/modules/storageServer/var/BasicStor.php b/campcaster/src/modules/storageServer/var/BasicStor.php index 7d7c18cd4..0ff933492 100644 --- a/campcaster/src/modules/storageServer/var/BasicStor.php +++ b/campcaster/src/modules/storageServer/var/BasicStor.php @@ -41,7 +41,7 @@ class BasicStor { public function __construct() { - $this->rootId = M2tree::GetRootNode(); + $this->rootId = M2tree::GetRootNode(); $this->storId = M2tree::GetObjId('StorageRoot', $this->rootId); } @@ -81,19 +81,18 @@ class BasicStor { * @param string $mdataLoc * 'file'|'string' * @return int - * @exception PEAR::error + * @exception PEAR_Error */ public function bsPutFile($parid, $fileName, $mediaFileLP, $mdataFileLP, - $gunid=NULL, $ftype='unKnown', $mdataLoc='file') + $gunid=NULL, $ftype='unknown', $mdataLoc='file') { $ftype = strtolower($ftype); $id = BasicStor::AddObj($fileName, $ftype, $parid); if (PEAR::isError($id)) { return $id; } - $ac = StoredFile::insert( - $this, $id, $fileName, $mediaFileLP, $mdataFileLP, $mdataLoc, - $gunid, $ftype); + $ac = StoredFile::insert($this, $id, $fileName, + $mediaFileLP, $mdataFileLP, $mdataLoc, $gunid, $ftype); if (PEAR::isError($ac)) { $res = $this->removeObj($id); // catch constraint violations @@ -1447,7 +1446,7 @@ class BasicStor { return $listArr[$i]['type']; } $listArr[$i]['gunid'] = $gunid; - + // THE BUG IS HERE - "_getState()" IS NOT A STATIC FUNCTION! if (StoredFile::_getState($gunid) == 'incomplete') { unset($listArr[$i]); @@ -1586,7 +1585,7 @@ class BasicStor { public static function GetObjType($oid) { $type = M2tree::GetObjType($oid); - if ($type == 'File') { + if ( !PEAR::isError($type) && ($type == 'File') ) { $gunid = BasicStor::GunidFromId($oid); if (PEAR::isError($gunid)) { return $gunid; @@ -2295,7 +2294,7 @@ class BasicStor { */ public function debug($va) { - echo"
\n"; 
+        echo"
\n";
         print_r($va);
     }