| 158 | | // Display file. Todo: Break this off into a library or call file lib |
|---|
| 159 | | if ($file = get_record_select('files', "ident=$object_id")) |
|---|
| 160 | | { |
|---|
| 161 | | if (run("users:access_level_check",$file->access) == true || $file->owner == $_SESSION['userid']) |
|---|
| 162 | | { |
|---|
| 163 | | |
|---|
| 164 | | $username = $owner_username; |
|---|
| 165 | | $ident = (int) $file->ident; |
|---|
| 166 | | $folder->ident = $file->folder; |
|---|
| 167 | | $title = get_access_description($file->access); |
|---|
| 168 | | $title .= stripslashes($file->title); |
|---|
| 169 | | $description = nl2br(stripslashes($file->description)); |
|---|
| 170 | | $filetitle = urlencode($title); |
|---|
| 171 | | $originalname = stripslashes($file->originalname); |
|---|
| 172 | | $filemenu = round(($file->size / 1048576),4) . "MB "; |
|---|
| 173 | | $icon = $CFG->wwwroot . "_icon/file/" . $file->ident; |
|---|
| 174 | | $filepath = $CFG->wwwroot . "$username/files/$folder->ident/$ident/" . urlencode($originalname); |
|---|
| 175 | | |
|---|
| 176 | | $mimetype = mimeinfo('type',$file->originalname); |
|---|
| 177 | | |
|---|
| 178 | | if ($mimetype == "audio/mpeg" || $mimetype == "audio/mp3") { |
|---|
| 179 | | $filemenu .= " <object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" |
|---|
| 180 | | codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" |
|---|
| 181 | | width=\"17\" height=\"17\" > |
|---|
| 182 | | <param name=\"allowScriptAccess\" value=\"sameDomain\" /> |
|---|
| 183 | | <param name=\"movie\" value=\"" . $CFG->wwwroot . "mod/file/mp3player/musicplayer.swf?song_url=$filepath&song_title=$filetitle\" /> |
|---|
| 184 | | <param name=\"quality\" value=\"high\" /> |
|---|
| 185 | | <embed src=\"" . $CFG->wwwroot . "mod/file/mp3player/musicplayer.swf?song_url=$filepath&song_title=$filetitle\" |
|---|
| 186 | | quality=\"high\" bgcolor=\"#E6E6E6\" name=\"xspf_player\" allowscriptaccess=\"sameDomain\" |
|---|
| 187 | | type=\"application/x-shockwave-flash\" |
|---|
| 188 | | pluginspage=\"http://www.macromedia.com/go/getflashplayer\" |
|---|
| 189 | | align=\"center\" height=\"17\" width=\"17\" /> |
|---|
| 190 | | </object>"; |
|---|
| 191 | | } |
|---|
| 192 | | |
|---|
| 193 | | |
|---|
| 194 | | $keywords = display_output_field(array("","keywords","file","file",$ident,$file->owner)); |
|---|
| 195 | | if ($keywords) { |
|---|
| 196 | | $keywords = __gettext("Keywords: ") . $keywords; |
|---|
| 197 | | } |
|---|
| 198 | | |
|---|
| 199 | | $return = <<< END |
|---|
| 200 | | <table> |
|---|
| 201 | | <tr> |
|---|
| 202 | | <td><img src="$icon" alt="$originalname" /></td> |
|---|
| 203 | | <td> |
|---|
| 204 | | <p><b>$title</b></p> |
|---|
| 205 | | <p>$description</p> |
|---|
| 206 | | <p>$originalname</p> |
|---|
| 207 | | </td> |
|---|
| 208 | | </tr> |
|---|
| 209 | | </table> |
|---|
| 210 | | END; |
|---|
| 211 | | |
|---|
| 212 | | } |
|---|
| 213 | | } |
|---|
| 214 | | |
|---|
| 215 | | return $return; |
|---|
| 216 | | |
|---|
| 217 | | /* |
|---|
| 218 | | // Display a preview - currently only file types are supported here |
|---|
| 219 | | // TODO: Some sort of clever |
|---|