当前位置: 首页>>代码示例>>PHP>>正文


PHP Stream::get_session方法代码示例

本文整理汇总了PHP中Stream::get_session方法的典型用法代码示例。如果您正苦于以下问题:PHP Stream::get_session方法的具体用法?PHP Stream::get_session怎么用?PHP Stream::get_session使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Stream的用法示例。


在下文中一共展示了Stream::get_session方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: display_ui_links

 public static function display_ui_links($object_type, $object_id)
 {
     echo "<ul>";
     echo "<li><a onclick=\"handleShareAction('" . AmpConfig::get('web_path') . "/share.php?action=show_create&type=" . $object_type . "&id=" . $object_id . "')\">" . UI::get_icon('share', T_('Advanced Share')) . " &nbsp;" . T_('Advanced Share') . "</a></li>";
     if (AmpConfig::get('download')) {
         $dllink = "";
         if ($object_type == "song" || $object_type == "video") {
             $dllink = AmpConfig::get('web_path') . "/play/index.php?action=download&type=" . $object_type . "&oid=" . $object_id . "&uid=-1";
         } else {
             if (Access::check_function('batch_download') && check_can_zip($object_type)) {
                 $dllink = AmpConfig::get('web_path') . "/batch.php?action=" . $object_type . "&id=" . $object_id;
             }
         }
         if (!empty($dllink)) {
             if (AmpConfig::get('require_session')) {
                 // Add session information to the link to avoid authentication
                 $dllink .= "&ssid=" . Stream::get_session();
             }
             echo "<li><a rel=\"nohtml\" href=\"" . $dllink . "\">" . UI::get_icon('download', T_('Temporary direct link')) . " &nbsp;" . T_('Temporary direct link') . "</a></li>";
         }
     }
     echo "<li style='padding-top: 8px; text-align: right;'>";
     $plugins = Plugin::get_plugins('external_share');
     foreach ($plugins as $plugin_name) {
         echo "<a onclick=\"handleShareAction('" . AmpConfig::get('web_path') . "/share.php?action=external_share&plugin=" . $plugin_name . "&type=" . $object_type . "&id=" . $object_id . "')\" target=\"_blank\">" . UI::get_icon('share_' . strtolower($plugin_name), $plugin_name) . "</a>&nbsp;";
     }
     echo "</li>";
     echo "</ul>";
 }
开发者ID:cheese1,项目名称:ampache,代码行数:29,代码来源:share.class.php

示例2: function

    // Hide few UI information on listening mode
    $('.jp-previous').css('visibility', 'hidden');
    $('.jp-play').css('visibility', 'hidden');
    $('.jp-pause').css('visibility', 'hidden');
    $('.jp-next').css('visibility', 'hidden');
    $('.jp-stop').css('visibility', 'hidden');
    $('.jp-toggles').css('visibility', 'hidden');
    $('.jp-playlist').css('visibility', 'hidden');
    $('#broadcast').css('visibility', 'hidden');

    $('.jp-seek-bar').css('pointer-events', 'none');

    brconn.onopen = function(e) {
        sendBroadcastMessage('AUTH_SID', '<?php 
echo Stream::get_session();
?>
');
        sendBroadcastMessage('REGISTER_LISTENER', broadcast_id);
    };
}

function listenBroadcast()
{
    if (brconn != null) {
        stopBroadcast();
    }

    brconn = new WebSocket('<?php 
echo Broadcast_Server::get_address();
?>
开发者ID:bl00m,项目名称:ampache,代码行数:30,代码来源:show_html5_player_headers.inc.php

示例3: debug_event

            AmpConfig::set('play_type', 'stream', true);
        }
    default:
        $stream_type = AmpConfig::get('play_type');
        if ($stream_type == 'stream') {
            $stream_type = AmpConfig::get('playlist_type');
        }
        break;
}
debug_event('stream.php', 'Stream Type: ' . $stream_type . ' Media IDs: ' . json_encode($media_ids), 5);
if (count($media_ids) || isset($urls)) {
    if ($stream_type != 'democratic') {
        if (!User::stream_control($media_ids)) {
            debug_event('UI::access_denied', 'Stream control failed for user ' . $GLOBALS['user']->username, 3);
            UI::access_denied();
            exit;
        }
    }
    if ($GLOBALS['user']->id > -1) {
        Session::update_username(Stream::get_session(), $GLOBALS['user']->username);
    }
    $playlist = new Stream_Playlist();
    $playlist->add($media_ids);
    if (isset($urls)) {
        $playlist->add_urls($urls);
    }
    // Depending on the stream type, will either generate a redirect or actually do the streaming.
    $playlist->generate_playlist($stream_type, true);
} else {
    debug_event('stream.php', 'No item. Ignoring...', 5);
}
开发者ID:nioc,项目名称:ampache,代码行数:31,代码来源:stream.php

示例4: debug_event

} else {
    debug_event('play', 'Starting stream of ' . $media->file . ' with size ' . $media->size, 5);
}
if (!isset($_REQUEST['segment'])) {
    if ($media->time) {
        header('X-Content-Duration: ' . $media->time);
    }
    // Stats registering must be done before play. Do not move it.
    // It can be slow because of scrobbler plugins (lastfm, ...)
    if ($start > 0) {
        debug_event('play', 'Content-Range doesn\'t start from 0, stats should already be registered previously; not collecting stats', 5);
    } else {
        if (!$share_id) {
            if ($_SERVER['REQUEST_METHOD'] != 'HEAD') {
                debug_event('play', 'Registering stream stats for {' . $media->get_stream_name() . '}...', 5);
                $sessionkey = $sid ?: Stream::get_session();
                $agent = Session::agent($sessionkey);
                $location = Session::get_geolocation($sessionkey);
                $GLOBALS['user']->update_stats($type, $media->id, $agent, $location, isset($_REQUEST['noscrobble']));
            }
        }
    }
}
if ($transcode || $demo_id) {
    header('Accept-Ranges: none');
} else {
    header('Accept-Ranges: bytes');
}
$mime = $media->mime;
if ($transcode && isset($transcoder)) {
    $mime = $media->type_to_mime($transcoder['format']);
开发者ID:ivan801,项目名称:ampache,代码行数:31,代码来源:index.php

示例5: notifySong

 /**
  *
  * @param \Ratchet\ConnectionInterface $from
  * @param int $song_id
  */
 protected function notifySong(ConnectionInterface $from, $song_id)
 {
     if ($this->isBroadcaster($from)) {
         $broadcast = $this->broadcasters[$from->resourceId];
         $clients = $this->getListeners($broadcast);
         Session::extend(Stream::get_session(), 'stream');
         $broadcast->update_song($song_id);
         $this->broadcastMessage($clients, self::BROADCAST_SONG, base64_encode($this->getSongJS($song_id)));
         if ($this->verbose) {
             echo "[" . time() . "][info]Broadcast " . $broadcast->id . " now playing song " . $song_id . "." . "\r\n";
         }
     } else {
         debug_event('broadcast', 'Action unauthorized.', '3');
     }
 }
开发者ID:cheese1,项目名称:ampache,代码行数:20,代码来源:broadcast_server.class.php

示例6: _itemVideo

 private static function _itemVideo($video, $parent)
 {
     $api_session = AmpConfig::get('require_session') ? Stream::get_session() : false;
     $art_url = Art::url($video->id, 'video', $api_session);
     $fileTypesByExt = self::_getFileTypes();
     $arrFileType = $fileTypesByExt[$video->type];
     return array('id' => $parent . '/' . $video->id, 'parentID' => $parent, 'restricted' => '1', 'dc:title' => self::_replaceSpecialSymbols($video->f_title), 'upnp:class' => isset($arrFileType['class']) ? $arrFileType['class'] : 'object.item.unknownItem', 'upnp:albumArtURI' => $art_url, 'upnp:genre' => Tag::get_display($video->tags, false, 'video'), 'res' => Video::play_url($video->id, '', 'api'), 'protocolInfo' => $arrFileType['mime'], 'size' => $video->size, 'duration' => $video->f_time_h . '.0');
 }
开发者ID:nioc,项目名称:ampache,代码行数:8,代码来源:upnp_api.class.php

示例7: media_object_to_url

 /**
  * media_object_to_url
  */
 public static function media_object_to_url($object, $additional_params = '', $urltype = 'web')
 {
     $surl = null;
     $url = array();
     $type = strtolower(get_class($object));
     $url['type'] = $type;
     // Don't add disabled media objects to the stream playlist
     // Playing a disabled media return a 404 error that could make failed the player (mpd ...)
     if (!isset($object->enabled) || make_bool($object->enabled)) {
         if ($urltype == 'file') {
             $url['url'] = $object->file;
             // Relative path
             if (!empty($additional_params) && strpos($url['url'], $additional_params) === 0) {
                 $url['url'] = substr($url['url'], strlen($additional_params));
                 if (strlen($url['url']) < 1) {
                     return null;
                 }
                 if ($url['url'][0] == DIRECTORY_SEPARATOR) {
                     $url['url'] = substr($url['url'], 1);
                 }
             }
         } else {
             //FIXME: play_url shouldn't be static
             $url['url'] = $type::play_url($object->id, $additional_params);
         }
         $api_session = AmpConfig::get('require_session') ? Stream::get_session() : false;
         // Set a default which can be overridden
         $url['author'] = 'Ampache';
         $url['time'] = $object->time;
         switch ($type) {
             case 'song':
                 $url['title'] = $object->title;
                 $url['author'] = $object->f_artist_full;
                 $url['info_url'] = $object->f_link;
                 $url['image_url'] = Art::url($object->album, 'album', $api_session, AmpConfig::get('ajax_load') ? 3 : 4);
                 $url['album'] = $object->f_album_full;
                 $url['track_num'] = $object->f_track;
                 break;
             case 'video':
                 $url['title'] = 'Video - ' . $object->title;
                 $url['author'] = $object->f_artist_full;
                 $url['resolution'] = $object->f_resolution;
                 break;
             case 'live_stream':
                 $url['title'] = 'Radio - ' . $object->name;
                 if (!empty($object->site_url)) {
                     $url['title'] .= ' (' . $object->site_url . ')';
                 }
                 $url['codec'] = $object->codec;
                 break;
             case 'song_preview':
                 $url['title'] = $object->title;
                 $url['author'] = $object->f_artist_full;
                 break;
             case 'channel':
                 $url['title'] = $object->name;
                 break;
             case 'random':
                 $url['title'] = 'Random URL';
                 break;
             default:
                 $url['title'] = 'URL-Add';
                 $url['time'] = -1;
                 break;
         }
         $surl = new Stream_URL($url);
     }
     return $surl;
 }
开发者ID:cheese1,项目名称:ampache,代码行数:72,代码来源:stream_playlist.class.php

示例8: media_to_urlarray

 /**
  * media_to_urlarray
  * Formats the URL and media information and adds it to the object
  */
 public static function media_to_urlarray($media, $additional_params = '')
 {
     $urls = array();
     foreach ($media as $medium) {
         $url = array();
         if ($medium['custom_play_action']) {
             $additional_params .= "&custom_play_action=" . $medium['custom_play_action'];
         }
         if ($_SESSION['iframe']['subtitle']) {
             $additional_params .= "&subtitle=" . $_SESSION['iframe']['subtitle'];
         }
         $type = $medium['object_type'];
         $object_id = $medium['object_id'];
         $url['type'] = $type;
         $object = new $type($object_id);
         $object->format();
         // Don't add disabled media objects to the stream playlist
         // Playing a disabled media return a 404 error that could make failed the player (mpd ...)
         if (!isset($object->enabled) || make_bool($object->enabled)) {
             //FIXME: play_url shouldn't be static
             $url['url'] = $type::play_url($object->id, $additional_params);
             $api_session = AmpConfig::get('require_session') ? Stream::get_session() : false;
             // Set a default which can be overridden
             $url['author'] = 'Ampache';
             $url['time'] = $object->time;
             switch ($type) {
                 case 'song':
                     $url['title'] = $object->title;
                     $url['author'] = $object->f_artist_full;
                     $url['info_url'] = $object->f_link;
                     $url['image_url'] = Art::url($object->album, 'album', $api_session, AmpConfig::get('ajax_load') ? 3 : 4);
                     $url['album'] = $object->f_album_full;
                     break;
                 case 'video':
                     $url['title'] = 'Video - ' . $object->title;
                     $url['author'] = $object->f_artist_full;
                     $url['resolution'] = $object->f_resolution;
                     break;
                 case 'live_stream':
                     $url['title'] = 'Radio - ' . $object->name;
                     if (!empty($object->site_url)) {
                         $url['title'] .= ' (' . $object->site_url . ')';
                     }
                     $url['codec'] = $object->codec;
                     break;
                 case 'song_preview':
                     $url['title'] = $object->title;
                     $url['author'] = $object->f_artist_full;
                     break;
                 case 'channel':
                     $url['title'] = $object->name;
                     break;
                 case 'random':
                     $url['title'] = 'Random URL';
                     break;
                 default:
                     $url['title'] = 'URL-Add';
                     $url['time'] = -1;
                     break;
             }
             $urls[] = new Stream_URL($url);
         }
     }
     return $urls;
 }
开发者ID:nioc,项目名称:ampache,代码行数:69,代码来源:stream_playlist.class.php

示例9: _itemPodcastEpisode

 private static function _itemPodcastEpisode($episode, $parent)
 {
     $api_session = AmpConfig::get('require_session') ? Stream::get_session() : false;
     $art_url = Art::url($episode->podcast, 'podcast', $api_session);
     $fileTypesByExt = self::_getFileTypes();
     $arrFileType = !empty($episode->type) ? $fileTypesByExt[$episode->type] : array();
     $ret = array('id' => 'amp://music/podcasts/' . $episode->podcast . '/' . $episode->id, 'parentID' => $parent, 'restricted' => '1', 'dc:title' => self::_replaceSpecialSymbols($episode->f_title), 'upnp:album' => self::_replaceSpecialSymbols($episode->f_podcast), 'upnp:class' => isset($arrFileType['class']) ? $arrFileType['class'] : 'object.item.unknownItem', 'upnp:albumArtURI' => $art_url);
     if (isset($arrFileType['mime'])) {
         $ret['res'] = Podcast_Episode::play_url($episode->id, '', 'api');
         $ret['protocolInfo'] = $arrFileType['mime'];
         $ret['size'] = $episode->size;
         $ret['duration'] = $episode->f_time_h . '.0';
     }
     return $ret;
 }
开发者ID:bl00m,项目名称:ampache,代码行数:15,代码来源:upnp_api.class.php


注:本文中的Stream::get_session方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。