/**\r
* Represents the media objects for a certain member\r
*/\r
-class MEDIA {\r
-\r
+class Media\r
+{\r
/**\r
- * Gets the list of collections available to the currently logged\r
- * in member\r
- *\r
- * @returns array of dirname => display name\r
- */\r
- function getCollectionList($exceptReadOnly = false) {\r
+ * Gets the list of collections available to the currently logged\r
+ * in member\r
+ *\r
+ * @returns array of dirname => display name\r
+ */\r
+ public function getCollectionList($exceptReadOnly = false)\r
+ {\r
global $member, $DIR_MEDIA;\r
-\r
+ \r
$collections = array();\r
-\r
+ \r
// add private directory for member\r
$collections[$member->getID()] = PRIVATE_COLLECTION;\r
\r
}\r
\r
/**\r
- * Returns an array of MEDIAOBJECT objects for a certain collection\r
+ * Returns an array of MediaObject objects for a certain collection\r
*\r
* @param $collection\r
* name of the collection\r
$dirhandle = opendir($mediadir);\r
while ($filename = readdir($dirhandle)) {\r
// only add files that match the filter\r
- if (!@is_dir($filename) && MEDIA::checkFilter($filename, $filter))\r
- array_push($filelist, new MEDIAOBJECT($collection, $filename, filemtime($mediadir . $filename)));\r
+ if (!@is_dir($filename) && Media::checkFilter($filename, $filter))\r
+ array_push($filelist, new MediaObject($collection, $filename, filemtime($mediadir . $filename)));\r
}\r
closedir($dirhandle);\r
\r
if ($collectionName === (string)$member->getID())\r
return true;\r
\r
- $collections = MEDIA::getCollectionList($exceptReadOnly);\r
+ $collections = Media::getCollectionList($exceptReadOnly);\r
$dirname = $collections[$collectionName];\r
if ($dirname == NULL || $dirname === PRIVATE_COLLECTION)\r
return false; \r
\r
// don't allow uploads to unknown or forbidden collections\r
$exceptReadOnly = true;\r
- if (!MEDIA::isValidCollection($collection,$exceptReadOnly))\r
+ if (!Media::isValidCollection($collection,$exceptReadOnly))\r
return _ERROR_DISALLOWED;\r
\r
// check dir permissions (try to create dir if it does not exist)\r
* - collection: collection to which the file belongs (can also be a owner ID, for private collections)\r
* - private: true if the media belongs to a private member collection\r
*/\r
-class MEDIAOBJECT {\r
-\r
- var $private;\r
- var $collection;\r
- var $filename;\r
- var $timestamp;\r
-\r
- function MEDIAOBJECT($collection, $filename, $timestamp) {\r
+class MediaObject\r
+{\r
+ public $private;\r
+ public $collection;\r
+ public $filename;\r
+ public $timestamp;\r
+ \r
+ public function __construct($collection, $filename, $timestamp)\r
+ {\r
$this->private = is_numeric($collection);\r
$this->collection = $collection;\r
$this->filename = $filename;\r
$this->timestamp = $timestamp;\r
+ return;\r
}\r
-\r
}\r
\r
/**\r
- * User-defined sort method to sort an array of MEDIAOBJECTS\r
+ * User-defined sort method to sort an array of MediaObjects\r
*/\r
function sort_media($a, $b) {\r
if ($a->timestamp == $b->timestamp) return 0;\r
return ($a->timestamp > $b->timestamp) ? -1 : 1;\r
}\r
-\r
-?>\r