Exemple #1
0
 /**
  * Controller
  */
 public function process()
 {
     $this->url()->send('music');
     Phpfox::isUser(true);
     if (Phpfox::getParam('music.music_user_group_id') == Phpfox::getUserBy('user_group_id')) {
         $this->url()->send('music');
     }
     $aUser = array('full_name' => Phpfox::getUserBy('full_name'));
     $aSettings = Phpfox::getService('custom')->getForEdit(array('user_main', 'user_panel', 'profile_panel'), Phpfox::getUserId(), Phpfox::getParam('music.music_user_group_id'));
     $aParams = array('full_name' => Phpfox::getPhrase('music.provide_a_artist_band_name'), 'agree' => Phpfox::getPhrase('music.tick_the_box_to_agree_to_our_terms_and_privacy_policy'));
     foreach ($aSettings as $sKey => $aSetting) {
         if ($aSetting['is_required']) {
             $aParams['custom_field_' . $aSetting['field_id']] = array('title' => Phpfox::getPhrase('music.provide_a_value_for') . ': ' . Phpfox::getPhrase($aSetting['phrase_var_name']), 'def' => 'required', 'php_id' => 'custom[' . $aSetting['field_id'] . ']');
         }
     }
     $oValid = Phpfox_Validator::instance()->set(array('sFormName' => 'js_form', 'aParams' => $aParams));
     if ($aVals = $this->request()->getArray('val')) {
         if ($oValid->isValid($aVals)) {
             if (Music_Service_Process::instance()->convertMember($aVals, $this->request()->getArray('custom'))) {
                 $this->url()->send('music', null, Phpfox::getPhrase('music.you_have_successfully_converted_your_account'));
             }
         }
     }
     $this->template()->setTitle(Phpfox::getPhrase('music.musician_registration'))->setBreadcrumb(Phpfox::getPhrase('music.music'), $this->url()->makeUrl('music'))->setBreadcrumb(Phpfox::getPhrase('music.registration'), null, true)->setFullSite()->assign(array('aForms' => $aUser, 'sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm(), 'aSettings' => $aSettings));
 }
Exemple #2
0
 /**
  * Controller
  */
 public function process()
 {
     if ($playId = $this->request()->get('play')) {
         Music_Service_Process::instance()->play($this->request()->get('play'));
         return ['played' => true];
     }
     Phpfox::getUserParam('music.can_access_music', true);
     if (Phpfox::isUser() && Phpfox::isModule('notification')) {
         Phpfox::getService('notification.process')->delete('comment_music_song', $this->request()->getInt('req2'), Phpfox::getUserId());
         Phpfox::getService('notification.process')->delete('music_song_like', $this->request()->getInt('req2'), Phpfox::getUserId());
     }
     if (!($aSong = Phpfox::getService('music')->getSong($this->request()->get('req2')))) {
         return Phpfox_Error::display(Phpfox::getPhrase('music.the_song_you_are_looking_for_cannot_be_found'));
     }
     if (Phpfox::isModule('notification') && $aSong['user_id'] == Phpfox::getUserId()) {
         Phpfox::getService('notification.process')->delete('music_songapproved', $aSong['song_id'], Phpfox::getUserId());
     }
     $aCallback = false;
     if (!empty($aSong['module_id'])) {
         if ($aCallback = Phpfox::callback($aSong['module_id'] . '.getMusicDetails', $aSong)) {
             $this->template()->setBreadcrumb($aCallback['breadcrumb_title'], $aCallback['breadcrumb_home']);
             $this->template()->setBreadcrumb($aCallback['title'], $aCallback['url_home']);
             if ($aSong['module_id'] == 'pages' && !Phpfox::getService('pages')->hasPerm($aCallback['item_id'], 'music.view_browse_music')) {
                 return Phpfox_Error::display(Phpfox::getPhrase('music.unable_to_view_this_item_due_to_privacy_settings'));
             }
         }
     }
     Phpfox::getService('core.redirect')->check($aSong['title']);
     if (Phpfox::isModule('privacy')) {
         Privacy_Service_Privacy::instance()->check('music_song', $aSong['song_id'], $aSong['user_id'], $aSong['privacy'], $aSong['is_friend']);
     }
     $this->setParam('aSong', $aSong);
     $this->setParam('aRatingCallback', array('type' => 'music_song', 'total_rating' => Phpfox::getPhrase('music.total_rating_ratings', array('total_rating' => $aSong['total_rating'])), 'default_rating' => $aSong['total_score'], 'item_id' => $aSong['song_id'], 'stars' => array('2' => Phpfox::getPhrase('music.poor'), '4' => Phpfox::getPhrase('music.nothing_special'), '6' => Phpfox::getPhrase('music.worth_listening_too'), '8' => Phpfox::getPhrase('music.pretty_cool'), '10' => Phpfox::getPhrase('music.awesome'))));
     $this->template()->setBreadcrumb(Phpfox::getPhrase('music.music'), $aCallback === false ? $this->url()->makeUrl('music') : $aCallback['url_home_photo']);
     if (!empty($aSong['album_url'])) {
         $this->template()->setBreadcrumb($aSong['album_url'], $this->url()->permalink('music.album', $aSong['album_id'], $aSong['album_url']));
     }
     $this->template()->setBreadcrumb($aSong['title'], $this->url()->permalink('music', $aSong['song_id'], $aSong['title']), true);
     $this->setParam('aFeed', array('comment_type_id' => 'music_song', 'privacy' => $aSong['privacy'], 'comment_privacy' => $aSong['privacy_comment'], 'like_type_id' => 'music_song', 'feed_is_liked' => $aSong['is_liked'], 'feed_is_friend' => $aSong['is_friend'], 'item_id' => $aSong['song_id'], 'user_id' => $aSong['user_id'], 'total_comment' => $aSong['song_total_comment'], 'total_like' => $aSong['total_like'], 'feed_link' => $this->url()->permalink('music', $aSong['song_id'], $aSong['title']), 'feed_title' => $aSong['title'], 'feed_display' => 'view', 'feed_total_like' => $aSong['total_like'], 'report_module' => 'music_song', 'report_phrase' => Phpfox::getPhrase('music.report_this_song_lowercase')));
     if (Phpfox::isModule('rate')) {
         $this->template()->setPhrase(array('rate.thanks_for_rating'))->setHeader('cache', array('rate.js' => 'module_rate'))->setHeader(array('<script type="text/javascript">$Behavior.rateSong = function() {  $Core.rate.init({module: \'music_song\', display: ' . ($aSong['has_rated'] ? 'false' : ($aSong['user_id'] == Phpfox::getUserId() ? 'false' : 'true')) . ', error_message: \'' . ($aSong['has_rated'] ? Phpfox::getPhrase('music.you_have_already_voted', array('phpfox_squote' => true)) : Phpfox::getPhrase('music.you_cannot_rate_your_own_song', array('phpfox_squote' => true))) . '\'}); }</script>'));
     }
     $this->template()->setTitle($aSong['title'])->setMeta('og:image', Phpfox::getLib('image.helper')->display(array('user' => $aSong, 'suffix' => '_50', 'return_url' => true)))->setMeta('description', $aSong['title'])->setHeader('cache', array('jquery/plugin/star/jquery.rating.js' => 'static_script', 'jquery/plugin/jquery.highlightFade.js' => 'static_script', 'jquery/plugin/jquery.scrollTo.js' => 'static_script', 'quick_edit.js' => 'static_script', 'jquery.rating.css' => 'style_css', 'comment.css' => 'style_css', 'pager.css' => 'style_css', 'feed.js' => 'module_feed', 'view.css' => 'module_music'))->setHeader(array('<script type="text/javascript">var bLoadedMusicSong = false; $Behavior.playSongOnView = function() { bLoadedMusicSong = false; if ($(\'#js_music_player\').length > 0) { $Core.player.load({on_start: function() { if (!bLoadedMusicSong) {  bLoadedMusicSong = true; $.ajaxCall(\'music.play\', \'id=' . $aSong['song_id'] . '\', \'GET\'); } }, id: \'js_music_player\', type: \'music\', auto: true, play: \'' . $aSong['song_path'] . '\'}); } $Behavior.playSongOnView = function() {}; }</script>'))->setEditor(array('load' => 'simple'))->assign(array('aSong' => $aSong));
     if ($sPlugin = Phpfox_Plugin::get('music.component_controller_music_view')) {
         eval($sPlugin);
     }
 }
 /**
  * Action to take when user cancelled their account
  * @param int $iUser
  */
 public function onDeleteUser($iUser)
 {
     // delete albums (it runs a delete on the songs as well)
     $aAlbums = $this->database()->select('album_id')->from(Phpfox::getT('music_album'))->where('user_id = ' . (int) $iUser)->execute('getSlaveRows');
     foreach ($aAlbums as $aAlbum) {
         Phpfox::getService('music.album.process')->delete($aAlbum['album_id']);
     }
     // delete songs
     $aSongs = $this->database()->select('song_id')->from(Phpfox::getT('music_song'))->where('user_id = ' . (int) $iUser)->execute('getSlaveRows');
     foreach ($aSongs as $aSong) {
         Music_Service_Process::instance()->delete($aSong['song_id']);
     }
     // delete genre_user
     $this->database()->delete(Phpfox::getT('music_genre_user'), 'user_id = ' . (int) $iUser);
     $this->database()->delete(Phpfox::getT('music_user'), 'user_id = ' . (int) $iUser);
     $this->database()->delete(Phpfox::getT('music_user_value'), 'user_id = ' . (int) $iUser);
 }
 /**
  * Controller
  */
 public function process()
 {
     if (defined('PHPFOX_IS_USER_PROFILE') && ($sLegacyTitle = $this->request()->get('req4')) && !empty($sLegacyTitle)) {
         Phpfox::getService('core')->getLegacyItem(array('field' => array('song_id', 'title'), 'table' => 'music_song', 'redirect' => 'music', 'title' => $sLegacyTitle));
     }
     if (defined('PHPFOX_IS_USER_PROFILE') && ($sLegacyTitle = $this->request()->get('req3')) && !empty($sLegacyTitle)) {
         Phpfox::getService('core')->getLegacyItem(array('field' => array('album_id', 'name'), 'table' => 'music_album', 'redirect' => 'music.album', 'search' => 'name_url', 'title' => $sLegacyTitle));
     }
     Phpfox::getUserParam('music.can_access_music', true);
     $aParentModule = $this->getParam('aParentModule');
     if ($this->request()->get('req2') == 'delete' && ($iDeleteId = $this->request()->getInt('id')) && ($mDeleteReturn = Music_Service_Process::instance()->delete($iDeleteId))) {
         if (is_bool($mDeleteReturn)) {
             $this->url()->send('music', null, Phpfox::getPhrase('music.song_successfully_deleted'));
         } else {
             $this->url()->forward($mDeleteReturn, Phpfox::getPhrase('music.song_successfully_deleted'));
         }
     }
     $oServiceSongBrowse = Phpfox::getService('music.song.browse');
     $sView = $this->request()->get('view');
     if (($sRedirect = $this->request()->getInt('redirect')) && ($aSong = Phpfox::getService('music')->getSong(Phpfox::getUserId(), $sRedirect, true))) {
         $this->url()->send($aSong['user_name'], array('music', $aSong['album_id'] ? $aSong['album_url'] : 'view', $aSong['title_url']));
     }
     if ($aParentModule === null && $this->request()->getInt('req2')) {
         return Phpfox_Module::instance()->setController('music.view');
     }
     $bIsProfile = false;
     if (defined('PHPFOX_IS_AJAX_CONTROLLER')) {
         $bIsProfile = true;
         $aUser = Phpfox::getService('user')->get($this->request()->get('profile_id'));
         $this->setParam('aUser', $aUser);
     } else {
         $bIsProfile = $this->getParam('bIsProfile');
         if ($bIsProfile === true) {
             $aUser = $this->getParam('aUser');
         }
     }
     $this->template()->setTitle($bIsProfile ? Phpfox::getPhrase('music.fullname_s_songs', array('full_name' => $aUser['full_name'])) : Phpfox::getPhrase('music.music'))->setBreadcrumb(Phpfox::getPhrase('music.music'), $bIsProfile ? $this->url()->makeUrl($aUser['user_name'], 'music') : $this->url()->makeUrl('music'));
     if ($aParentModule === null) {
         Phpfox::getService('music')->getSectionMenu();
     }
     $this->search()->set(array('type' => 'music_song', 'field' => 'm.song_id', 'search_tool' => array('table_alias' => 'm', 'search' => array('action' => defined('PHPFOX_IS_PAGES_VIEW') ? $aParentModule['url'] . 'music/' : ($bIsProfile === true ? $this->url()->makeUrl($aUser['user_name'], array('music', 'view' => $this->request()->get('view'))) : $this->url()->makeUrl('music', array('view' => $this->request()->get('view')))), 'default_value' => Phpfox::getPhrase('music.search_songs'), 'name' => 'search', 'field' => 'm.title'), 'sort' => array('latest' => array('m.time_stamp', Phpfox::getPhrase('music.latest')), 'most-viewed' => array('m.total_play', Phpfox::getPhrase('music.most_viewed')), 'most-liked' => array('m.total_like', Phpfox::getPhrase('music.most_liked')), 'most-talked' => array('m.total_comment', Phpfox::getPhrase('music.most_discussed'))), 'show' => array(10, 20, 30))));
     $aBrowseParams = array('module_id' => 'music.song', 'alias' => 'm', 'field' => 'song_id', 'table' => Phpfox::getT('music_song'), 'hide_view' => array('pending', 'my'));
     $iGenre = $this->request()->getInt('req3');
     switch ($sView) {
         case 'my':
             Phpfox::isUser(true);
             $this->search()->setCondition('AND m.user_id = ' . Phpfox::getUserId());
             break;
         case 'pending':
             Phpfox::isUser(true);
             Phpfox::getUserParam('music.can_approve_songs', true);
             $this->search()->setCondition('AND m.view_id = 1');
             $this->template()->assign('bIsInPendingMode', true);
             break;
         default:
             if ($bIsProfile === true) {
                 $this->search()->setCondition("AND m.view_id IN(" . ($aUser['user_id'] == Phpfox::getUserId() ? '0,1' : '0') . ") AND m.privacy IN(" . (Phpfox::getParam('core.section_privacy_item_browsing') ? '%PRIVACY%' : Phpfox::getService('core')->getForBrowse($aUser)) . ") AND m.user_id = " . $aUser['user_id'] . "");
             } else {
                 $this->search()->setCondition("AND m.view_id = 0 AND m.privacy IN(%PRIVACY%)");
                 if ($sView == 'featured') {
                     $this->search()->setCondition('AND m.is_featured = 1');
                 }
             }
             break;
     }
     if ($iGenre && ($aGenre = Phpfox::getService('music.genre')->getGenre($iGenre))) {
         $this->search()->setCondition('AND m.genre_id = ' . (int) $iGenre);
         $this->template()->setBreadcrumb($aGenre['name'], $this->url()->permalink('browse.song.genre', $aGenre['genre_id'], $aGenre['name']), true);
     }
     if ($aParentModule !== null) {
         $this->search()->setCondition("AND m.module_id = '" . Phpfox_Database::instance()->escape($aParentModule['module_id']) . "' AND m.item_id = " . (int) $aParentModule['item_id']);
     } else {
         $this->search()->setCondition('AND m.item_id = 0');
     }
     $this->search()->browse()->params($aBrowseParams)->execute();
     $aSongs = $this->search()->browse()->getRows();
     // d($aSongs); exit;
     Phpfox_Pager::instance()->set(array('page' => $this->search()->getPage(), 'size' => $this->search()->getDisplay(), 'count' => $this->search()->browse()->getCount()));
     if ($sPlugin = Phpfox_Plugin::get('music.component_controller_music_index')) {
         eval($sPlugin);
     }
     $this->template()->setHeader('cache', array('feed.js' => 'module_feed', 'browse.css' => 'module_music'))->assign(array('aSongs' => $aSongs, 'sMusicView' => $sView));
     $this->setParam('global_moderation', array('name' => 'musicsong', 'ajax' => 'music.moderation', 'menu' => array(array('phrase' => Phpfox::getPhrase('music.delete'), 'action' => 'delete'), array('phrase' => Phpfox::getPhrase('music.approve'), 'action' => 'approve'), array('phrase' => Phpfox::getPhrase('music.feature'), 'action' => 'feature'), array('phrase' => Phpfox::getPhrase('music.un_feature'), 'action' => 'un-feature'))));
 }
Exemple #5
0
 public function delete($iId)
 {
     $aAlbum = $this->database()->select('*')->from($this->_sTable)->where('album_id = ' . (int) $iId)->execute('getSlaveRow');
     if (!isset($aAlbum['album_id'])) {
         return Phpfox_Error::set(Phpfox::getPhrase('music.album_you_are_trying_to_delete_cannot_be_found'));
     }
     if ($aAlbum['user_id'] == Phpfox::getUserId() && Phpfox::getUserParam('music.can_delete_own_music_album') || Phpfox::getUserParam('music.can_delete_other_music_albums')) {
         $this->deleteImage($aAlbum['album_id'], $aAlbum);
         $aSongs = $this->database()->select('*')->from(Phpfox::getT('music_song'))->where('album_id = ' . $aAlbum['album_id'])->execute('getRows');
         foreach ($aSongs as $aSong) {
             Music_Service_Process::instance()->delete($aSong['song_id'], $aSong);
         }
         Phpfox::isModule('feed') ? Phpfox::getService('feed.process')->delete('comment_music_album', $iId) : null;
         $this->database()->delete($this->_sTable, 'album_id = ' . $aAlbum['album_id']);
         $this->database()->delete(Phpfox::getT('music_album_text'), 'album_id = ' . $aAlbum['album_id']);
         $this->database()->delete(Phpfox::getT('music_album_rating'), 'item_id = ' . $aAlbum['album_id']);
         if ($aAlbum['is_sponsor'] == 1) {
             $this->cache()->remove('music_album_sponsored');
         }
         ($sPlugin = Phpfox_Plugin::get('music.service_album_process_delete__1')) ? eval($sPlugin) : false;
         return true;
     }
     return Phpfox_Error::set(Phpfox::getPhrase('music.not_allowed_to_delete_this_album'));
 }
    /**
     * Controller
     */
    public function process()
    {
        Phpfox::isUser(true);
        Phpfox::getUserParam('music.can_upload_music_public', true);
        $sModule = $this->request()->get('module', false);
        $iItem = $this->request()->getInt('item', false);
        $aCallback = false;
        if ($sModule !== false && $iItem !== false && Phpfox::hasCallback($sModule, 'getMusicDetails')) {
            if ($aCallback = Phpfox::callback($sModule . '.getMusicDetails', array('item_id' => $iItem))) {
                $this->template()->setBreadcrumb($aCallback['breadcrumb_title'], $aCallback['breadcrumb_home']);
                $this->template()->setBreadcrumb($aCallback['title'], $aCallback['url_home']);
                if ($sModule == 'pages' && !Phpfox::getService('pages')->hasPerm($iItem, 'music.share_music')) {
                    return Phpfox_Error::display('Unable to view this item due to privacy settings.');
                }
            }
        }
        $bIsEdit = false;
        $aValidation = array('title' => Phpfox::getPhrase('music.provide_a_name_for_this_song'));
        $oValidator = Phpfox_Validator::instance()->set(array('sFormName' => 'js_music_form', 'aParams' => $aValidation));
        if (($iId = $this->request()->getInt('id')) && ($aEditSong = Phpfox::getService('music')->getForEdit($iId))) {
            if ($aEditSong['module_id'] == 'pages') {
                Phpfox::getService('pages')->setIsInPage();
            }
            $bIsEdit = true;
            $this->template()->assign(array('aForms' => $aEditSong));
        }
        $sMethod = Phpfox::getParam('music.music_enable_mass_uploader') && $this->request()->get('method', 'massuploader') == 'massuploader' ? 'massuploader' : 'simple';
        // used to tell the template where to link for the opposite method
        $sMethodUrl = str_replace(array('method_simple/', 'method_massuploader/'), '', $this->url()->getFullUrl()) . 'method_' . ($sMethod == 'simple' ? 'massuploader' : 'simple') . '/';
        $aVals = $this->request()->getArray('val');
        if (isset($aVals['method'])) {
            $sMethod = $aVals['method'];
        }
        if ($bIsEdit && !empty($aVals) && $this->request()->get('upload_via_song')) {
            if ($oValidator->isValid($aVals)) {
                if (Music_Service_Process::instance()->update($aEditSong['song_id'], $aVals)) {
                    $this->url()->permalink('music', $aEditSong['song_id'], $aEditSong['title'], true, 'Song successfully updated.');
                }
            }
        } else {
            if ($sMethod == 'simple' && !empty($aVals)) {
                if (isset($aVals['music_title'])) {
                    $aVals['title'] = $aVals['music_title'];
                }
                if ($oValidator->isValid($aVals)) {
                    if ($aSong = Music_Service_Process::instance()->upload($aVals, isset($aVals['album_id']) ? (int) $aVals['album_id'] : 0)) {
                        if (isset($aVals['iframe'])) {
                            if (isset($aVals['music_title'])) {
                                $iFeedId = Phpfox::getService('feed.process')->getLastId();
                                echo "<script type=\"text/javascript\">";
                                if (Phpfox::isModule('video') && Phpfox::getParam('video.convert_servers_enable')) {
                                    echo 'document.domain = "' . Phpfox::getParam('video.convert_js_parent') . '";';
                                }
                                ($sPlugin = Phpfox_Plugin::get('music.component_controller_upload_feed')) ? eval($sPlugin) : false;
                                echo 'window.parent.$.ajaxCall(\'music.displayFeed\', \'id=' . $iFeedId . '&song_id=' . $aSong['song_id'] . '\', \'GET\');';
                                echo "</script>";
                            } else {
                                Phpfox::addMessage(Phpfox::getPhrase('music.song_successfully_uploaded'));
                                echo "<script type=\"text/javascript\">";
                                echo 'window.parent.location.href = "' . $this->url()->makeUrl('music.album.track', array('id' => $aVals['album_id'], 'method' => 'simple')) . '";';
                                echo '</script>';
                            }
                        } else {
                            Phpfox::addMessage(Phpfox::getPhrase('music.song_successfully_uploaded'));
                            echo "<script type=\"text/javascript\">";
                            echo 'window.parent.location.href = "' . $this->url()->permalink('music', $aSong['song_id'], $aSong['title']) . '";';
                            echo '</script>';
                            exit;
                        }
                        exit;
                    } else {
                        if (isset($aVals['music_title'])) {
                            echo "<script type=\"text/javascript\">";
                            echo 'window.parent.$Core.resetActivityFeedError(\'' . implode('<br />', Phpfox_Error::get()) . '\');';
                            echo "</script>";
                        } else {
                            echo "<script type=\"text/javascript\">";
                            echo 'window.parent.$(\'#js_music_upload_song\').show(); window.parent.$(\'.js_upload_song\').remove();';
                            echo 'window.parent.alert(\'' . implode('\\n', Phpfox_Error::get()) . '\');';
                            echo "</script>";
                            exit;
                        }
                    }
                } else {
                    if (isset($aVals['music_title'])) {
                        echo "<script type=\"text/javascript\">";
                        echo 'window.parent.$Core.resetActivityFeedError(\'' . implode('<br />', Phpfox_Error::get()) . '\');';
                        echo "</script>";
                    } else {
                        echo '<script type="text/javascript">';
                        echo 'window.parent.$Core.resetActivityFeedError(\'' . implode('<br />', Phpfox_Error::get()) . '\');';
                        echo 'window.parent.$Core.music.resetUploadForm(\'' . implode('<br />', Phpfox_Error::get()) . '\');';
                        echo '</script>';
                        exit;
                    }
                }
            } elseif ($sMethod == 'massuploader' && isset($_FILES['Filedata'])) {
                $_FILES['mp3'] = $_FILES['Filedata'];
                if ($aSong = Music_Service_Process::instance()->upload($aVals, isset($aVals['album_id']) ? (int) $aVals['album_id'] : 0)) {
                    if (isset($aVals['inline'])) {
                        $aSong = Phpfox::getService('music')->getSong($aSong['song_id']);
                        $this->template()->assign(array('aSong' => $aSong));
                        $this->template()->getTemplate('music.block.track-entry');
                        $sOutput = Phpfox_Ajax::instance()->getContent(false);
                        Phpfox::addMessage(Phpfox::getPhrase('music.song_successfully_uploaded'));
                        echo 'window.location.href = "' . $this->url()->makeUrl('music.album.track', array('id' => $aVals['album_id'])) . '";';
                        exit;
                    }
                    echo 'window.location.href = "' . $this->url()->permalink('music', $aSong['song_id'], $aSong['title']) . '";';
                    exit;
                } else {
                    echo '$(\'#js_music_upload_song\').show(); $(\'.js_upload_song\').remove();';
                    echo 'alert(\'' . implode('\\n', Phpfox_Error::get()) . '\');';
                    exit;
                }
            }
        }
        if ($sMethod == 'massuploader') {
            $iMaxFileSize = Phpfox::getUserParam('music.music_max_file_size') === 0 ? null : Phpfox::getUserParam('music.music_max_file_size');
            $this->template()->setHeader('cache', array('massuploader/swfupload.js' => 'static_script', 'massuploader/upload.js' => 'static_script', '<script type="text/javascript">
						$oSWF_settings =
						{
							object_holder: function()
							{
								return \'swf_music_upload_button_holder\';
							},
							
							div_holder: function()
							{
								return \'swf_music_upload_button\';
							},
							
							get_settings: function()
							{		
								swfu.setUploadURL("' . $this->url()->makeUrl('music.upload') . '");
								swfu.setFileSizeLimit("' . $iMaxFileSize . ' MB");
								swfu.setFileUploadLimit(1);
								swfu.setFileQueueLimit(1);
								swfu.customSettings.flash_user_id = ' . Phpfox::getUserId() . ';
								swfu.customSettings.sHash = "' . Phpfox::getService('core')->getHashForUpload() . '";
								swfu.setFileTypes("*.mp3","*.mp3");
								swfu.atFileQueue = function()
								{
									$(\'#js_music_form :input\').each(function(iKey, oObject)
									{
										swfu.addPostParam($(oObject).attr(\'name\'), $(oObject).val());
									});
								}
							}
						}
					</script>', 'upload.css' => 'module_music'))->setPhrase(array('core.name', 'core.status', 'core.in_queue', 'core.upload_failed_your_file_size_is_larger_then_our_limit_file_size', 'core.more_queued_than_allowed'));
        }
        $this->template()->setTitle($bIsEdit ? Phpfox::getPhrase('music.editing_song') . ': ' . $aEditSong['title'] : Phpfox::getPhrase('music.upload_a_song'))->setBreadcrumb(Phpfox::getPhrase('music.music'), $aCallback === false ? $this->url()->makeUrl('music') : $aCallback['url_home_photo'])->setBreadcrumb($bIsEdit ? Phpfox::getPhrase('music.editing_song') . ': ' . $aEditSong['title'] : Phpfox::getPhrase('music.upload_a_song'), $bIsEdit ? $this->url()->makeUrl('music.upload', array('id' => $iId)) : $this->url()->makeUrl('music.upload'), true)->setFullSite()->setPhrase(array('music.select_an_mp3'))->setHeader('cache', array('upload.js' => 'module_music', 'progress.css' => 'style_css', 'progress.js' => 'static_script', '<script type="text/javascript">$Behavior.musicUpload = function(){ if ($Core.exists(\'#js_music_form_holder\')) { oProgressBar = {holder: \'#js_music_form_holder\', progress_id: \'#js_progress_bar\', total: 1, max_upload: 1, uploader: \'#js_progress_uploader\', frame_id: \'js_upload_frame\', file_id: \'mp3\'}; $Core.progressBarInit(); }}</script>'))->assign(array('sModule' => $sModule, 'iItem' => $iItem, 'bIsEdit' => $bIsEdit, 'aUploadAlbums' => Phpfox::getService('music.album')->getForUpload($aCallback), 'sCreateJs' => $oValidator->createJS(), 'sGetJsForm' => $oValidator->getJsForm(false), 'iUploadLimit' => Phpfox_File::instance()->getLimit(Phpfox::getUserParam('music.music_max_file_size')), 'aGenres' => Phpfox::getService('music.genre')->getList(), 'sMethod' => $sMethod, 'sMethodUrl' => $sMethodUrl));
    }
Exemple #7
0
 public function moderation()
 {
     Phpfox::isUser(true);
     switch ($this->get('action')) {
         case 'approve':
             Phpfox::getUserParam('music.can_approve_songs', true);
             foreach ((array) $this->get('item_moderate') as $iId) {
                 Music_Service_Process::instance()->approve($iId);
                 $this->remove('#js_controller_music_track_' . $iId);
             }
             $this->updateCount();
             $sMessage = Phpfox::getPhrase('music.songs_s_successfully_approved');
             break;
         case 'delete':
             Phpfox::getUserParam('music.can_delete_other_tracks', true);
             foreach ((array) $this->get('item_moderate') as $iId) {
                 Music_Service_Process::instance()->delete($iId);
                 $this->slideUp('#js_controller_music_track_' . $iId);
             }
             $sMessage = Phpfox::getPhrase('music.songs_s_successfully_deleted');
             break;
         case 'feature':
             Phpfox::getUserParam('music.can_feature_songs', true);
             foreach ((array) $this->get('item_moderate') as $iId) {
                 Music_Service_Process::instance()->feature($iId, 1);
                 $this->addClass('#js_controller_music_track_' . $iId, 'row_featured');
             }
             $sMessage = Phpfox::getPhrase('music.songs_s_successfully_featured');
             break;
         case 'un-feature':
             Phpfox::getUserParam('music.can_feature_songs', true);
             foreach ((array) $this->get('item_moderate') as $iId) {
                 Music_Service_Process::instance()->feature($iId, 0);
                 $this->removeClass('#js_controller_music_track_' . $iId, 'row_featured');
             }
             $sMessage = Phpfox::getPhrase('music.songs_s_successfully_un_featured');
             break;
     }
     $this->alert($sMessage, 'Moderation', 300, 150, true);
     $this->hide('.moderation_process');
 }