function mx_mnmystuff($page, $option, $action) { global $mxuser, $errors; if ($errors) { mx_warning($errors); } switch ($action) { case 'submit': print_r($_FILES); break; case 'fileupload': $tmpfiles = $mxuser->gettmpmedia(); if (!$tmpfiles) { __('No files seem to have been uploaded to your account.'); break; } $allmedia = array(); $mediaval = array(); $pid = 0; $onlynew = $_REQUEST['onlynew']; //echo 'onlynew:'.$onlynew.'<br/>time()='.time().' - date():'.date('U').' - gmdate():'.gmdate('U').'<br/>'; while ($tmpfiles && ($media = $mxuser->gettmpmedia($tmpfiles))) { $flds = array('filename_' . $pid => array(-1, $media->filename), 'id_' . $pid => array(1, $media->id, 'hidden'), 'name_' . $pid => array(0, $media->filename, 'hidden'), 'title_' . $pid => array(1, _('Title:'), 'text', 100), 'type_' . $pid => array(1, _('Type:'), 'filetype'), 'desc_' . $pid => array(1, _('Description:'), 'simplememo'), 'comp_' . $pid => array(1, _('State:'), 'completion'), 'delete_' . $pid => array(1, _('Delete:'), 'checkbox', _('Permanently remove this file from server'), null, $onlynew && $onlynew > strtotime($media->timestamp))); //echo 'id #'.$pid.' date:'.$media->timestamp.' ('.strtotime($media->timestamp).')<br/>'; switch (pathinfo($media->filename, PATHINFO_EXTENSION)) { case 'jpg': case 'png': case 'gif': $ftype = MXMEDIAPIC; break; case 'mp4': case 'm4v': case 'avi': case 'mov': $ftype = MXMEDIAVIDEO; break; case 'mp3': case 'wav': case 'aif': $ftype = MXMEDIASONG; break; default: $ftype = MXMEDIADOC; break; } $fvalues = array('title_' . $pid => $media->filename, 'type_' . $pid => $ftype, 'desc_' . $pid => _('You should describe your media here...'), 'comp_' . $pid => MXMEDIANOSTATUS, 'delete_' . $pid => 1); $allmedia = array_merge($allmedia, $flds); $mediaval = array_merge($mediaval, $fvalues); $pid++; } $allmedia['a'] = array(1, 'mediaupdate', 'hidden'); $buttons = array('mediaupdate' => _('Submit'), 'clear' => _('Clear')); $mediaform = array('mediaform', 0, _('Media Information'), _('Please fill in the information' . ' about the uploaded files'), $buttons, $allmedia); mx_showform($mediaform, $mediaval); break; case 'm_publishnew': case 'm_publisharch': case 'm_editpub': case 'm_editarch': case 'm_editmed': $selmedia = $_REQUEST['selmedia']; if (!$selmedia) { __('No media selected.'); break; } $medialist = $mxuser->listselectedmedia($selmedia); if (!$medialist) { __('No media selected.'); break; } $allmedia = array(); $mediaval = array(); $pid = 0; foreach ($medialist as $id => $media) { $flds = array('filename_' . $pid => array(-1, $media->filename), 'id_' . $pid => array(1, $id, 'hidden'), 'name_' . $pid => array(0, $media->filename, 'hidden'), 'title_' . $pid => array(1, _('Title:'), 'text', 60), 'desc_' . $pid => array(1, _('Description:'), 'simplememo', '', '', _('You should describe your media here...')), 'type_' . $pid => array(1, _('Type:'), 'filetype'), 'comp_' . $pid => array(1, _('State:'), 'completion'), 'size_' . $pid => array(0, _('Size:'), 'size'), 'status_' . $pid => array(1, _('Status:'), 'mediastatus')); //echo 'id #'.$pid.' date:'.$media->timestamp.' ('.strtotime($media->timestamp).')<br/>'; switch (pathinfo($media->filename, PATHINFO_EXTENSION)) { case 'jpg': case 'png': case 'gif': $ftype = MXMEDIAPIC; break; case 'mp4': case 'm4v': case 'avi': case 'mov': $ftype = MXMEDIAVIDEO; break; case 'mp3': case 'wav': case 'aif': $ftype = MXMEDIASONG; break; default: $ftype = MXMEDIADOC; break; } $fvalues = array('title_' . $pid => $media->title ? $media->title : $media->filename, 'size_' . $pid => $media->size, 'type_' . $pid => $media->type ? $media->type : $ftype, 'desc_' . $pid => $media->desc, 'comp_' . $pid => $media->comp, 'status_' . $pid => $media->status); $allmedia = array_merge($allmedia, $flds); $mediaval = array_merge($mediaval, $fvalues); $pid++; } $agreement = array('warning' => array(-1, _('Legal Terms'), _('By checking the box below,' . ' you acknowledge that any media made available to your current fans' . ' will be available to them for at least one full year from the date of' . ' its publication. Whoever is not a fan will lose access to any media as soon as you' . ' archive them.')), 'agreement' => array(1, _('Agreement'), 'checkbox', _('I fully agree with the above statement.'), _('You have to agree to continue...'))); $allmedia = array_merge($allmedia, $agreement); $allmedia['a'] = array(1, 'none', 'hidden'); //$mediaval['agreement']=0; $buttons = array('mediapublish' => _('Publish'), 'mymedia' => _('Cancel'), 'clear' => _('Reset form')); $mediaform = array('mediaform', 0, _('Media Information'), _('Please inform the scope of publication' . ' for each media'), $buttons, $allmedia); mx_showform($mediaform, $mediaval, true); break; case 'm_editnew': //case 'm_editpub': //case 'm_editarch': //case 'm_editmed': $selmedia = $_REQUEST['selmedia']; if (!$selmedia) { __('No media selected.'); break; } $medialist = $mxuser->listselectedmedia($selmedia); if (!$medialist) { __('No media selected.'); break; } $allmedia = array(); $mediaval = array(); $pid = 0; foreach ($medialist as $id => $media) { $flds = array('filename_' . $pid => array(-1, $media->filename), 'id_' . $pid => array(1, $id, 'hidden'), 'name_' . $pid => array(0, $media->filename, 'hidden'), 'title_' . $pid => array(1, _('Title:'), 'text', 100), 'type_' . $pid => array(1, _('Type:'), 'filetype'), 'size_' . $pid => array(0, _('Size:'), 'integer'), 'desc_' . $pid => array(1, _('Description:'), 'simplememo', '', '', _('You should describe your media here...')), 'comp_' . $pid => array(1, _('State:'), 'completion')); if ($action == 'm_editpub') { $flds['status_' . $pid] = array(1, _('Access'), 'mediastatus'); } //echo 'id #'.$pid.' date:'.$media->timestamp.' ('.strtotime($media->timestamp).')<br/>'; switch (pathinfo($media->filename, PATHINFO_EXTENSION)) { case 'jpg': case 'jpeg': case 'png': case 'gif': $ftype = MXMEDIAPIC; break; case 'mp4': case 'm4v': case 'avi': case 'mov': $ftype = MXMEDIAVIDEO; break; case 'mp3': case 'wav': case 'aif': $ftype = MXMEDIASONG; break; default: $ftype = MXMEDIADOC; break; } $fvalues = array('title_' . $pid => $media->title ? $media->title : $media->filename, 'size_' . $pid => $media->size, 'type_' . $pid => $media->type ? $media->type : $ftype, 'desc_' . $pid => $media->desc, 'comp_' . $pid => $media->comp, 'status_' . $pid => $media->status); $allmedia = array_merge($allmedia, $flds); $mediaval = array_merge($mediaval, $fvalues); $pid++; } $allmedia['a'] = array(1, 'mediadescupdate', 'hidden'); $buttons = array('mediadescupdate' => _('Submit'), 'mymedia' => _('Cancel'), 'clear' => _('Clear')); $mediaform = array('mediaform', 0, _('Media Information'), _('Please fill in the information' . ' about the uploaded files'), $buttons, $allmedia); mx_showform($mediaform, $mediaval); break; case 'mymedia': default: $mxuser->checkbundles(); $listorder = mx_secureword($_GET['s']); if ($listorder != '') { $listorder .= ' asc'; } $listorder .= ($listorder ? ',' : '') . 'timestamp desc'; $allmedia = array(); $medialist = array('medialist', 0, _('Media List'), '', array('new' => array('m_bundle' => _('Bundle Maker'), 'm_publishnew' => _('Publish'), 'm_deletenew' => _('Delete'), 'clear' => _('Clear')), 'published' => array('clear' => _('Clear')), 'archived' => array('*m_deletearch' => _('Delete [ADMIN]'), 'clear' => _('Clear')), 'allmedia' => array('clear' => _('Clear'))), array('new' => array('new' => array(-1, _('New Media & Uploads'), _('Below is the list of all media you uploaded recently' . ' and still haven\'t published for fans, members and/or everyone to discover.') . '<div class="helpnotice"><span class="helpnotice">' . _('On quality:') . '</span> ' . _('for music, we now <u>require</u> artists to upload 320Kbps/44KHz media files (HiFi) for the fans to enjoy a' . ' satisfactory listening experience.') . '<br/>' . _('Click or the Help button on the right for some help about the publishing process') . '</div>' . '<div id="fileuploader"></div>'), 'select' => array(0, '<input id="checkallbox" type="checkbox" onclick="javascript:checkall(\'new\');">', 'html', 3), 'mediadata' => array(0, '<div id="player">' . mx_mediabutton('openbundle', _('Open All Bundles'), 24, 'oa_', 0, 'hover') . mx_mediabutton('notready.gif', _('Please wait...'), 24, 'wa_', 0) . mx_mediabutton('closebundle', _('Close All Bundles'), 24, 'ca_', 0, 'hover') . '</div>', 'html'), 'a' => array(1, 'newbundle', 'hidden')), 'published' => array('published' => array(-1, _('Published'), _('The media you published so far.')), 'select' => array(0, '<input id="checkallbox" type="checkbox" onclick="javascript:checkall(\'published\');">', 'html', 3), 'mediadata' => array(0, '<div id="player">' . mx_mediabutton('openbundle', _('Open All Bundles'), 24, 'oa_', 0, 'hover') . mx_mediabutton('notready.gif', _('Please wait...'), 24, 'wa_', 0) . mx_mediabutton('closebundle', _('Close All Bundles'), 24, 'ca_', 0, 'hover') . '</div>', 'html'), 'a' => array(1, 'none', 'hidden')), 'archived' => array('archived' => array(-1, _('Archived'), _('The published media you decided to archive<br/>' . ' (still available to fans during one year after archived).')), 'select' => array(0, '<input id="checkallbox" type="checkbox" onclick="javascript:checkall(\'archived\');">', 'html', 3), 'mediadata' => array(0, '<div id="player">' . mx_mediabutton('openbundle', _('Open All Bundles'), 24, 'oa_', 0, 'hover') . mx_mediabutton('notready.gif', _('Please wait...'), 24, 'wa_', 0) . mx_mediabutton('closebundle', _('Close All Bundles'), 24, 'ca_', 0, 'hover') . '</div>', 'html'), 'a' => array(1, 'none', 'hidden')), 'allmedia' => array('allmedia' => array(-1, _('All Media'), _('Below is the list of all media you uploaded' . ' into your account.')), 'select' => array(0, '<input id="checkallbox" type="checkbox" onclick="javascript:checkall(\'allmedia\');">', 'html', 3), 'mediadata' => array(0, '<div id="player">' . mx_mediabutton('openbundle', _('Open All Bundles'), 24, 'oa_', 0, 'hover') . mx_mediabutton('notready.gif', _('Please wait...'), 24, 'wa_', 0) . mx_mediabutton('closebundle', _('Close All Bundles'), 24, 'ca_', 0, 'hover') . '</div>', 'html'), 'a' => array(1, 'none', 'hidden')))); $mediabundles = $mxuser->listbundles($mxuser->id, null, $listorder, true); while ($mediabundles && ($bundle = $mxuser->listbundles($mxuser->id, $mediabundles, $listorder, true))) { foreach ($mxuser->getmediainfo($bundle->id) as $key => $value) { $bundle->{$key} = $value; } $bundle->filesize = $bundle->size; //$bundle->info=sprintf(_('%d media<br/>(%s)'),$bundle->cnt,mx_size($bundle->size)); mx_medialist($bundle, null, false, true); //error_log(print_r($bundle,true)); if ($bundle->type == MXMEDIABASEBUNDLE) { $allmedia['new'][] = $bundle; $allmedia['published'][] = $bundle; $allmedia['archived'][] = $bundle; } else { if ($bundle->status < MXMEDIAFANVISIBLE) { $allmedia['new'][] = $bundle; } if ($bundle->status >= MXMEDIAFANVISIBLE && $bundle->status < MXMEDIAARCHIVED) { $allmedia['published'][] = $bundle; } if ($bundle->status == MXMEDIAARCHIVED) { $allmedia['archived'][] = $bundle; } } /* else if ($bundle->status==MXMEDIAVALIDATED || $bundle->status==MXMEDIAREADY) $allmedia['new'][]=$bundle; else if ($bundle->status==MXMEDIAARCHIVED) $allmedia['archived'][]=$bundle; else if ($bundle->status>=MXMEDIAFANVISIBLE && $bundle->status<=MXMEDIAPUBLICSHARED) { $allmedia['published'][]=$bundle; $allmedia['archived'][]=$bundle; }*/ $allmedia['allmedia'][] = $bundle; } //$str='<div id="mediaplayer"><div id="playerwindow"></div></div>'; //$str.='<div class="form">'; /*$str.='<form name="media">' .mx_showtablestr($medialist[5],$allmedia,'pubmed',$medialist[4],'media') .'</form></div>';*/ $str .= mx_showliststr($medialist, $allmedia, 'media', true); /*$str.='<script type="text/javascript" charset="utf-8"> // Add VideoJS to all video tags on the page when the DOM is ready VideoJS.setupAllWhenReady(); </script>';*/ echo $str; echo '<script language="javascript">'; foreach ($allmedia['allmedia'] as $bundle) { echo 'setdroppable(' . $bundle->id . ');'; if ($bundle->type == MXMEDIABASEBUNDLE) { echo 'setworksortable(' . $bundle->id . ');'; } else { echo 'setsortable(' . $bundle->id . ');'; } } $wbundleid = $mxuser->getbasebundle(); echo 'openbundle(' . $wbundleid . ');'; echo '</script>'; ?> <script language="javascript"> function createUploader(){ var uploader = new qq.FileUploader({ element: document.getElementById('fileuploader'), action: '<?php echo mx_option('siteurl') . '/fileupload.php'; ?> ', params: { id: '<?php echo $mxuser->id; ?> ' }, allowedExtensions: ['jpg','jpeg','png','mp3','m4v','pdf','mp4','mov'], sizeLimit: <?php echo MXMAXFILESIZE; ?> , onComplete: function(id,filename,result) { if ('success' in result) showupload(result); } }); } // in your app create uploader as soon as the DOM is ready // don't wait for the window to load if (window.onload) { var oldloadfunction=window.onload; window.onload = (typeof window.onload != 'function') ? createUploader : function() { oldloadfunction(); createUploader(); }; } else window.onload = createUploader; </script> <?php break; case 'upload': ?> <div id="basicuploader"> <noscript> <?php __('Javascript is not currently enabled in your browser. You can enjoy a easier and' . ' simpler file uploader if you enable that feature. If you prefer, consult' . ' your manual, activate Javascript and reload this page...'); ?> </noscript> <? $buttons=array( 'submit' => _('Submit'), 'clear' => _('Clear') ); $uploadform=array( 'basicupload',0,_('Media Upload [Basic Uploader]'),_('Please fill the form below to upload' . ' new media to your account'), $buttons, array( 'fileinfo' => array(-1,_('File Information'),_('Please describe the file you' . ' will upload')), 'name' => array(1,_('Media name:'),'text',100), 'filename' => array(1,_('File:'),'file'), 'type' => array(1,_('Type:'),'filetype'), 'description' => array(1,_('Description:'),'simplememo'), 'authorship' => array(-1,_('Legal Bindings'),_('By clicking the box below,' . ' you hereby certify to the full extends of copyright laws that you' . ' fully own the rights' . ' on the material you are going to upload, or are legally' . ' authorized to do so. You also confirm, that you are aware that' . ' any false claim is subject to prosecution by the legal copyrights' . ' owner to whom you will directly and exclusively respond to.')), 'agreement' => array(1,_('I Agree'),'boolean',2), 'a' => array(1,'submit','hidden') ) ); mx_showform($uploadform,'',true); ?> </div> <div id='jsuploader' style="display:none;"> <?php $oldmedia = ""; $tmpfiles = $mxuser->gettmpmedia(); while ($tmpfiles && ($media = $mxuser->gettmpmedia($tmpfiles))) { $oldmedia .= $media->filename . '<br/>'; } $buttons = array('submit' => _('Submit'), 'clear' => _('Clear')); $uploadform = array('jsupload', 0, _('Media Upload [Javascript Uploader]'), _('Please upload one or more files' . ' below by clicking on the Upload button or using drag-and-drop, then submit the' . ' form to fill the necessary information about the files'), $buttons, array('upload' => array(-1, _('File Upload'), _('Please click the Upload button or' . ' drag-and-drop your files on it<br/>' . 'If you already uploaded files and want to validate them,' . ' just agree with the legal terms and submit the form.')), 'oldfiles' => array(0, _('Previously Uploaded:'), 'text'), 'onlynew' => array(1, _('Only New'), 'checkbox', _('Discard previously uploaded files')), 'files' => array(1, _('Files:'), 'fileuploader'), 'authorship' => array(-1, _('Legal Bindings'), _('By clicking the box below,' . ' you hereby certify to the full extends of copyright laws that you' . ' fully own the rights' . ' on the material you are going to upload, or are legally' . ' authorized to do so. You also confirm, that you are aware that' . ' any false claim is subject to prosecution by the legal copyrights' . ' owner to whom you will directly and exclusively respond to.')), 'agreement' => array(1, _('I Agree'), 'boolean', 2), 'a' => array(1, 'fileupload', 'hidden'))); mx_showform($uploadform, array('oldfiles' => $oldmedia ? $oldmedia : _('None'), 'onlynew' => time()), true); ?> </div> <script language="javascript"> var jsuploader=document.getElementById('jsuploader'); jsuploader.style.display='block'; var bsuploader=document.getElementById('basicuploader'); bsuploader.style.display='none'; function createUploader(){ var uploader = new qq.FileUploader({ element: document.getElementById('fileuploader'), action: '<?php echo mx_option('siteurl') . '/fileupload.php'; ?> ', params: { id: '<?php echo $mxuser->id; ?> ' }, allowedExtensions: ['jpg','jpeg','png','mp3','m4v','pdf','mp4','mov'], sizeLimit: <?php echo MXMAXFILESIZE; ?> }); } // in your app create uploader as soon as the DOM is ready // don't wait for the window to load if (window.onload) { var oldloadfunction=window.onload; window.onload = (typeof window.onload != 'function') ? createUploader : function() { oldloadfunction(); createUploader(); }; } else window.onload = createUploader; </script> <?php } ?> <script type="text/javascript" charset="utf-8"> // Add VideoJS to all video tags on the page when the DOM is ready VideoJS.setupAllWhenReady(); </script> <?php }
function mx_showlist($list, $values, $listtype = '', $submit = false, $counts = false) { echo mx_showliststr($list, $values, $listtype, $submit, $counts); }