Ejemplo n.º 1
0
 /**
  * format
  * This formats a video object so that it is human readable
  */
 public function format()
 {
     $this->f_title = scrub_out($this->title);
     $this->f_link = scrub_out($this->title);
     $this->f_codec = $this->video_codec . ' / ' . $this->audio_codec;
     $this->f_resolution = $this->resolution_x . 'x' . $this->resolution_y;
     $this->f_tags = '';
     $this->f_length = floor($this->time / 60) . ' ' . T_('minutes');
 }
Ejemplo n.º 2
0
function arrayToJSON($array)
{
    $json = '{ ';
    foreach ($array as $key => $value) {
        $json .= '"' . $key . '" : ';
        if (is_array($value)) {
            $json .= arrayToJSON($value);
        } else {
            // Make sure to strip backslashes and convert things to
            // entities in our output
            $json .= '"' . scrub_out(str_replace('\\', '', $value)) . '"';
        }
        $json .= ' , ';
    }
    $json = rtrim($json, ', ');
    return $json . ' }';
}
?>
">
<table cellpadding="3" cellspacing="0" class="tabledata">
<?php 
foreach ($fields as $key => $field) {
    ?>
<tr>
    <td><?php 
    echo $field['description'];
    ?>
</td>
    <td><input type="text" name="<?php 
    echo $key;
    ?>
" value="<?php 
    echo scrub_out($instance[$key]);
    ?>
" /></td>
</tr>
<?php 
}
?>
</table>
    <div class="formValidation">
        <input type="submit" value="<?php 
echo T_('Update Instance');
?>
" />
  </div>
</form>
<?php 
Ejemplo n.º 4
0
" /></td>
            </tr>
            <tr>
                <td class="edit_dialog_content_header"><?php 
echo T_('Copyright');
?>
</td>
                <td><input type="text" name="copyright" value="<?php 
echo scrub_out($libitem->copyright);
?>
" /></td>
            </tr>
            <tr>
                <td class="edit_dialog_content_header"><?php 
echo T_('Website');
?>
</td>
                <td><input type="text" name="website" value="<?php 
echo scrub_out($libitem->website);
?>
" /></td>
            </tr>
        </table>
        <input type="hidden" name="id" value="<?php 
echo $libitem->id;
?>
" />
        <input type="hidden" name="type" value="podcast_row" />
    </form>
</div>
Ejemplo n.º 5
0
            <tr>
                <td class="edit_dialog_content_header"><?php 
echo T_('Random');
?>
</td>
                <td><input type="checkbox" name="random" value="1" <?php 
if ($libitem->random) {
    echo "checked";
}
?>
 /></td>
            </tr>
            <tr>
                <td class="edit_dialog_content_header"><?php 
echo T_('Item Limit (0 = unlimited)');
?>
</td>
                <td><input type="text" name="limit" value="<?php 
echo scrub_out($libitem->limit);
?>
" /></td>
            </tr>
        </table>
        <input type="hidden" name="id" value="<?php 
echo $libitem->id;
?>
" />
        <input type="hidden" name="type" value="search_row" />
    </form>
</div>
Ejemplo n.º 6
0
 /**
  * get
  * This functions returns an array containing information about
  * The songs that vlc currently has in it's playlist. This must be
  * done in a standardized fashion
  * Warning ! if you got files in vlc medialibary those files will be sent to the php xml parser
  * to, not to your browser but still this can take a lot of work for your server.
  * The xml files of vlc need work, not much documentation on them....
  */
 public function get()
 {
     /* Get the Current Playlist */
     $list = $this->_vlc->get_tracks();
     if (!$list) {
         return array();
     }
     $counterforarray = 0;
     // here we look if there are song in the playlist when media libary is used
     if ($list['node']['node'][0]['leaf'][$counterforarray]['attr']['uri']) {
         while ($list['node']['node'][0]['leaf'][$counterforarray]) {
             $songs[] = htmlspecialchars_decode($list['node']['node'][0]['leaf'][$counterforarray]['attr']['uri'], ENT_NOQUOTES);
             $songid[] = $list['node']['node'][0]['leaf'][$counterforarray]['attr']['id'];
             $counterforarray++;
         }
         // if there is only one song look here,and media libary is used
     } elseif ($list['node']['node'][0]['leaf']['attr']['uri']) {
         $songs[] = htmlspecialchars_decode($list['node']['node'][0]['leaf']['attr']['uri'], ENT_NOQUOTES);
         $songid[] = $list['node']['node'][0]['leaf']['attr']['id'];
     } elseif ($list['node']['node']['leaf'][$counterforarray]['attr']['uri']) {
         while ($list['node']['node']['leaf'][$counterforarray]) {
             $songs[] = htmlspecialchars_decode($list['node']['node']['leaf'][$counterforarray]['attr']['uri'], ENT_NOQUOTES);
             $songid[] = $list['node']['node']['leaf'][$counterforarray]['attr']['id'];
             $counterforarray++;
         }
     } elseif ($list['node']['node']['leaf']['attr']['uri']) {
         $songs[] = htmlspecialchars_decode($list['node']['node']['leaf']['attr']['uri'], ENT_NOQUOTES);
         $songid[] = $list['node']['node']['leaf']['attr']['id'];
     } else {
         return array();
     }
     $counterforarray = 0;
     foreach ($songs as $key => $entry) {
         $data = array();
         /* Required Elements */
         $data['id'] = $songid[$counterforarray];
         // id number of the files in the vlc playlist, needed for other operations
         $data['raw'] = $entry;
         $url_data = $this->parse_url($entry);
         switch ($url_data['primary_key']) {
             case 'oid':
                 $data['oid'] = $url_data['oid'];
                 $song = new Song($data['oid']);
                 $song->format();
                 $data['name'] = $song->f_title . ' - ' . $song->f_album . ' - ' . $song->f_artist;
                 $data['link'] = $song->f_link;
                 break;
             case 'demo_id':
                 $democratic = new Democratic($url_data['demo_id']);
                 $data['name'] = T_('Democratic') . ' - ' . $democratic->name;
                 $data['link'] = '';
                 break;
             case 'random':
                 $data['name'] = T_('Random') . ' - ' . scrub_out(ucfirst($url_data['type']));
                 $data['link'] = '';
                 break;
             default:
                 /* If we don't know it, look up by filename */
                 $filename = Dba::escape($entry);
                 $sql = "SELECT `name` FROM `live_stream` WHERE `url`='{$filename}' ";
                 $db_results = Dba::read($sql);
                 if ($row = Dba::fetch_assoc($db_results)) {
                     //if stream is known just send name
                     $data['name'] = htmlspecialchars(substr($row['name'], 0, 50));
                 } elseif (strncmp($entry, 'http', 4) == 0) {
                     $data['name'] = htmlspecialchars("(VLC stream) " . substr($entry, 0, 50));
                 } else {
                     $getlast = explode("/", $entry);
                     $lastis = count($getlast) - 1;
                     $data['name'] = htmlspecialchars("(VLC local) " . substr($getlast[$lastis], 0, 50));
                 }
                 // end if loop
                 break;
         }
         // end switch on primary key type
         $data['track'] = $key + 1;
         $counterforarray++;
         $results[] = $data;
     }
     // foreach playlist items
     return $results;
 }
Ejemplo n.º 7
0
                <td class="edit_dialog_content_header"><?php 
echo T_('Stream Type');
?>
</td>
                <td><input type="text" name="stream_type" value="<?php 
echo scrub_out($libitem->stream_type);
?>
" /></td>
            </tr>
            <tr>
                <td class="edit_dialog_content_header"><?php 
echo T_('Bitrate');
?>
</td>
                <td><input type="text" name="bitrate" value="<?php 
echo scrub_out($libitem->bitrate);
?>
" /></td>
            </tr>
            <tr>
                <td class="edit_dialog_content_header"><?php 
echo T_('Genre');
?>
</td>
                <td><input type="text" name="edit_tags" id="edit_tags" value="<?php 
echo Tag::get_display($libitem->tags);
?>
" /></td>
            </tr>
        </table>
        <input type="hidden" name="id" value="<?php 
Ejemplo n.º 8
0
    ?>
            <th class="cel_agent"><?php 
    echo T_('Agent');
    ?>
</th>
            <?php 
}
?>
        </tr>
    </tfoot>
</table>
<div id="recent_more">
<?php 
$user_id_a = '';
if (isset($user_id) && !empty($user_id)) {
    $user_id_a = "&amp;user_id=" . scrub_out($user_id);
}
?>
    <a href="<?php 
echo AmpConfig::get('web_path');
?>
/stats.php?action=recent<?php 
echo $user_id_a;
?>
"><?php 
echo T_('More');
?>
</a>
</div>
<script language="javascript" type="text/javascript">
$(document).ready(function () {
Ejemplo n.º 9
0
    ?>
<tr class="<?php 
    echo UI::flip_class();
    ?>
">
    <td class="cel_preference"><?php 
    echo scrub_out(T_($preference['description']));
    ?>
</td>
    <td class="cel_level">
        <?php 
    $level_name = "is_" . $preference['level'];
    ${$level_name} = 'selected="selected"';
    ?>
        <select name="prefs[<?php 
    echo scrub_out($preference['name']);
    ?>
]">
            <option value="5" <?php 
    echo $is_5;
    ?>
><?php 
    echo T_('Guest');
    ?>
</option>
            <option value="25" <?php 
    echo $is_25;
    ?>
><?php 
    echo T_('User');
    ?>
Ejemplo n.º 10
0
 *
 */
?>
<div>
    <form method="post" id="edit_playlist_<?php 
echo $libitem->id;
?>
" class="edit_dialog_content">
        <table class="tabledata" cellspacing="0" cellpadding="0">
            <tr>
                <td class="edit_dialog_content_header"><?php 
echo T_('Name');
?>
</td>
                <td><input type="text" name="name" value="<?php 
echo scrub_out($libitem->name);
?>
" autofocus /></td>
            </tr>
            <tr>
                <td class="edit_dialog_content_header"><?php 
echo T_('Type');
?>
</td>
                <td>
                    <?php 
$name = 'select_' . $libitem->type;
?>
                    <?php 
${$name} = ' selected="selected"';
?>
Ejemplo n.º 11
0
</option>
                    <option value="system" title="System"><?php 
echo T_('Ampache');
?>
</option>
                </select>
            </td>
        </tr>
        <tr>
            <td><?php 
echo T_('Subject');
?>
:</td>
            <td colspan="3">
                <input name="subject" value="<?php 
echo scrub_out($_POST['subject']);
?>
" />
            </td>
        </tr>
        <tr>
            <td valign="top"><?php 
echo T_('Message');
?>
:</td>
            <td>
                <textarea class="input" name="message" rows="10" cols="70"></textarea>
            </td>
        </tr>
    </table>
    <div class="formValidation">
Ejemplo n.º 12
0
    ?>
">
            <td class="cel_name"><?php 
    echo scrub_out($plugin->_plugin->name);
    ?>
</td>
            <td class="cel_description"><?php 
    echo scrub_out($plugin->_plugin->description);
    ?>
</td>
            <td class="cel_version"><?php 
    echo scrub_out($plugin->_plugin->version);
    ?>
</td>
            <td class="cel_iversion"><?php 
    echo scrub_out($installed_version);
    ?>
</td>
            <td class="cel_action"><?php 
    echo $action;
    ?>
</td>
        </tr>
        <?php 
}
if (!count($plugins)) {
    ?>
        <tr class="<?php 
    echo UI::flip_class();
    ?>
">
Ejemplo n.º 13
0
 /**
  * get_songs
  * This functions returns an array containing information about
  * the songs that MPD currently has in its playlist. This must be
  * done in a standardized fashion
  */
 public function get()
 {
     // If we don't have the playlist yet, pull it
     if (!isset($this->_mpd->playlist)) {
         $this->_mpd->RefreshInfo();
     }
     /* Get the Current Playlist */
     $playlist = $this->_mpd->playlist;
     foreach ($playlist as $entry) {
         $data = array();
         /* Required Elements */
         $data['id'] = $entry['Pos'];
         $data['raw'] = $entry['file'];
         $url_data = $this->parse_url($entry['file']);
         switch ($url_data['primary_key']) {
             case 'oid':
                 $data['oid'] = $url_data['oid'];
                 $song = new Song($data['oid']);
                 $song->format();
                 $data['name'] = $song->f_title . ' - ' . $song->f_album . ' - ' . $song->f_artist;
                 $data['link'] = $song->f_link;
                 break;
             case 'demo_id':
                 $democratic = new Democratic($url_data['demo_id']);
                 $data['name'] = T_('Democratic') . ' - ' . $democratic->name;
                 $data['link'] = '';
                 break;
             case 'random':
                 $data['name'] = T_('Random') . ' - ' . scrub_out(ucfirst($url_data['type']));
                 $data['link'] = '';
                 break;
             default:
                 /* If we don't know it, look up by filename */
                 $filename = Dba::escape($entry['file']);
                 $sql = "SELECT `id`,'song' AS `type` FROM `song` WHERE `file` LIKE '%{$filename}' " . "UNION ALL " . "SELECT `id`,'live_stream' AS `type` FROM `live_stream` WHERE `url`='{$filename}' ";
                 $db_results = Dba::read($sql);
                 if ($row = Dba::fetch_assoc($db_results)) {
                     $media = new $row['type']($row['id']);
                     $media->format();
                     switch ($row['type']) {
                         case 'song':
                             $data['name'] = $media->f_title . ' - ' . $media->f_album . ' - ' . $media->f_artist;
                             $data['link'] = $media->f_link;
                             break;
                         case 'live_stream':
                             $frequency = $media->frequency ? '[' . $media->frequency . ']' : '';
                             $site_url = $media->site_url ? '(' . $media->site_url . ')' : '';
                             $data['name'] = "{$media->name} {$frequency} {$site_url}";
                             $data['link'] = $media->site_url;
                             break;
                     }
                     // end switch on type
                 } else {
                     $data['name'] = T_('Unknown');
                     $data['link'] = '';
                 }
                 break;
         }
         // end switch on primary key type
         /* Optional Elements */
         $data['track'] = $entry['Pos'] + 1;
         $results[] = $data;
     }
     // foreach playlist items
     return $results;
 }
Ejemplo n.º 14
0
/**
 * show_playlist_select
 * This one is for playlists!
 */
function show_playlist_select($name, $selected = '', $style = '')
{
    echo "<select name=\"{$name}\" style=\"{$style}\">\n";
    echo "\t<option value=\"\">" . T_('None') . "</option>\n";
    $sql = "SELECT `id`,`name` FROM `playlist` ORDER BY `name`";
    $db_results = Dba::read($sql);
    $nb_items = Dba::num_rows($db_results);
    $index = 1;
    $already_selected = false;
    while ($row = Dba::fetch_assoc($db_results)) {
        $select_txt = '';
        if (!$already_selected && ($row['id'] == $selected || $index == $nb_items)) {
            $select_txt = 'selected="selected"';
            $already_selected = true;
        }
        echo "\t<option value=\"" . $row['id'] . "\" {$select_txt}>" . scrub_out($row['name']) . "</option>\n";
        ++$index;
    }
    // end while users
    echo "</select>\n";
}
Ejemplo n.º 15
0
                <td class="edit_dialog_content_header"><?php 
echo T_('Name');
?>
</td>
                <td><input type="text" name="name" value="<?php 
echo scrub_out($libitem->name);
?>
" autofocus /></td>
            </tr>
            <tr>
                <td class="edit_dialog_content_header"><?php 
echo T_('Description');
?>
</td>
                <td><input type="text" name="description" value="<?php 
echo scrub_out($libitem->description);
?>
" /></td>
            </tr>
            <tr>
                <td class="edit_dialog_content_header"></td>
                <td><input type="checkbox" name="private" value="1" <?php 
echo $libitem->is_private ? 'checked' : '';
?>
 /> <?php 
echo T_('Authentication Required');
?>
</td>
            </tr>
            <tr>
                <td class="edit_dialog_content_header"><?php 
Ejemplo n.º 16
0
</label>
    <div class="col-sm-8">
        <input type="text" class="form-control" id="local_host" name="local_host" value="<?php 
echo scrub_out($_REQUEST['local_host']);
?>
">
    </div>
</div>
<div class="form-group">
    <label for="local_port" class="col-sm-4 control-label"><?php 
echo T_('MySQL Port (optional)');
?>
</label>
    <div class="col-sm-8">
        <input type="text" class="form-control" id="local_port" name="local_port" value="<?php 
echo scrub_out($_REQUEST['local_port']);
?>
"/>
    </div>
</div>
<div class="form-group">
    <label for="local_username" class="col-sm-4 control-label"><?php 
echo T_('MySQL Username');
?>
</label>
    <div class="col-sm-8">
        <input type="text" class="form-control" id="local_username" name="local_username" value="<?php 
echo $local_username;
?>
"/>
    </div>
Ejemplo n.º 17
0
?>
    </ul>
</div>
<?php 
UI::show_box_bottom();
?>
<div id="additional_information">
&nbsp;
</div>
<?php 
define('TABLE_RENDERED', 1);
$album_suite = $album->get_group_disks_ids();
foreach ($album_suite as $album_id) {
    $c_album = new Album($album_id);
    $c_album->format();
    $c_title = scrub_out($c_album->name) . "&nbsp;<span class=\"discnb disc" . $c_album->disk . "\">, " . T_('Disk') . " " . $c_album->disk . "</span>";
    $show_direct_play = $show_direct_play_cfg;
    $show_playlist_add = Access::check('interface', '25');
    if ($directplay_limit > 0) {
        $show_playlist_add = $c_album->song_count <= $directplay_limit;
        if ($show_direct_play) {
            $show_direct_play = $show_playlist_add;
        }
    }
    ?>
    <div class="album_group_disks_title"><span> <?php 
    echo $c_title;
    ?>
</span></div>
    <div class="album_group_disks_actions">
        <?php 
Ejemplo n.º 18
0
            </td>
        </tr>
        <tr>
            <td><?php 
echo T_('Clear Stats');
?>
:</td>
            <td>
                <input type="checkbox" name="clear_stats" value="1" />
            </td>
        </tr>
    </table>
    <div class="formValidation">
            <input type="hidden" name="user_id" value="<?php 
echo scrub_out($client->id);
?>
" />
            <?php 
echo Core::form_register('update_user');
?>
            <input type="hidden" name="tab" value="<?php 
echo scrub_out($_REQUEST['tab']);
?>
" />
            <input class="button" type="submit" value="<?php 
echo T_('Update Account');
?>
" />
    </div>
</form>
Ejemplo n.º 19
0
    ?>
/image.php?id=<?php 
    echo $media->album;
    ?>
" rel="prettyPhoto">
        <img align="middle" src="<?php 
    echo $web_path;
    ?>
/image.php?id=<?php 
    echo $media->album;
    ?>
&amp;thumb=1" alt="<?php 
    echo scrub_out($media->f_album_full);
    ?>
" title="<?php 
    echo scrub_out($media->f_album_full);
    ?>
" height="80" width="80" />
      </a>
  </div>
</div>
<?php 
}
?>

<?php 
if (AmpConfig::get('show_similar')) {
    ?>
<div class="np_group similars" id="similar_items_<?php 
    echo $media->id;
    ?>
Ejemplo n.º 20
0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php 
echo $htmllang;
?>
" lang="<?php 
echo $htmllang;
?>
" dir="<?php 
echo is_rtl(AmpConfig::get('lang')) ? 'rtl' : 'ltr';
?>
">
    <head>
        <!-- Propulsed by Ampache | ampache.org -->
        <link rel="search" type="application/opensearchdescription+xml" title="<?php 
echo scrub_out(AmpConfig::get('site_title'));
?>
" href="<?php 
echo $web_path;
?>
/search.php?action=descriptor" />
        <?php 
if (AmpConfig::get('use_rss')) {
    ?>
        <link rel="alternate" type="application/rss+xml" title="<?php 
    echo T_('Now Playing');
    ?>
" href="<?php 
    echo $web_path;
    ?>
/rss.php" />
Ejemplo n.º 21
0
echo scrub_out($_REQUEST['email']);
?>
" />
        <?php 
AmpError::display('email');
?>
    </td>
</tr>
<tr>
    <td><?php 
echo T_('Website');
?>
</td>
    <td>
        <input type="text" name="website" value="<?php 
echo scrub_out($_REQUEST['website']);
?>
" />
        <?php 
AmpError::display('website');
?>
    </td>
</tr>
</table>
<div class="formValidation">
    <?php 
echo Core::form_register('add_label');
?>
    <input class="button" type="submit" value="<?php 
echo T_('Add');
?>
    }
    ?>
        <tr class="<?php 
    echo UI::flip_class();
    ?>
">
            <td class="cel_name"><?php 
    echo scrub_out($localplay->f_name);
    ?>
</td>
            <td class="cel_description"><?php 
    echo scrub_out($localplay->f_description);
    ?>
</td>
            <td class="cel_version"><?php 
    echo scrub_out($localplay->f_version);
    ?>
</td>
            <td class="cel_action"><a href="<?php 
    echo $web_path;
    ?>
/admin/modules.php?action=<?php 
    echo $action;
    ?>
&amp;type=<?php 
    echo urlencode($controller);
    ?>
"><?php 
    echo $action_txt;
    ?>
</a></td>
Ejemplo n.º 23
0
 /**
  * url
  * This returns the constructed URL for the art in question
  * @param int $uid
  * @param string $type
  * @param string $sid
  * @param int|null $thumb
  * @return string
  */
 public static function url($uid, $type, $sid = null, $thumb = null)
 {
     if (!Core::is_library_item($type)) {
         return null;
     }
     if (AmpConfig::get('use_auth') && AmpConfig::get('require_session')) {
         $sid = $sid ? scrub_out($sid) : scrub_out(session_id());
         if ($sid == null) {
             $sid = Session::create(array('type' => 'api'));
         }
     }
     $key = $type . $uid;
     if (parent::is_cached('art', $key . '275x275') && AmpConfig::get('resize_images')) {
         $row = parent::get_from_cache('art', $key . '275x275');
         $mime = $row['mime'];
     }
     if (parent::is_cached('art', $key . 'original')) {
         $row = parent::get_from_cache('art', $key . 'original');
         $thumb_mime = $row['mime'];
     }
     if (!isset($mime) && !isset($thumb_mime)) {
         $sql = "SELECT `object_type`, `object_id`, `mime`, `size` FROM `image` WHERE `object_type` = ? AND `object_id` = ?";
         $db_results = Dba::read($sql, array($type, $uid));
         while ($row = Dba::fetch_assoc($db_results)) {
             parent::add_to_cache('art', $key . $row['size'], $row);
             if ($row['size'] == 'original') {
                 $mime = $row['mime'];
             } else {
                 if ($row['size'] == '275x275' && AmpConfig::get('resize_images')) {
                     $thumb_mime = $row['mime'];
                 }
             }
         }
     }
     $mime = isset($thumb_mime) ? $thumb_mime : (isset($mime) ? $mime : null);
     $extension = self::extension($mime);
     if (AmpConfig::get('stream_beautiful_url')) {
         if (empty($extension)) {
             $extension = 'jpg';
         }
         $url = AmpConfig::get('web_path') . '/play/art/' . $sid . '/' . scrub_out($type) . '/' . scrub_out($uid) . '/thumb';
         if ($thumb) {
             $url .= $thumb;
         }
         $url .= '.' . $extension;
     } else {
         $url = AmpConfig::get('web_path') . '/image.php?object_id=' . scrub_out($uid) . '&object_type=' . scrub_out($type) . '&auth=' . $sid;
         if ($thumb) {
             $url .= '&thumb=' . $thumb;
         }
         if (!empty($extension)) {
             $name = 'art.' . $extension;
             $url .= '&name=' . $name;
         }
     }
     return $url;
 }
Ejemplo n.º 24
0
                $defaultimg .= "blankmovie.png";
                break;
            default:
                $mime = 'image/png';
                $defaultimg .= "blankalbum.png";
                break;
        }
        $image = file_get_contents($defaultimg);
    } else {
        if ($_GET['thumb']) {
            $thumb_data = $art->get_thumb($size);
            $etag .= '-' . $_GET['thumb'];
        }
        $mime = isset($thumb_data['thumb_mime']) ? $thumb_data['thumb_mime'] : $art->raw_mime;
        $image = isset($thumb_data['thumb']) ? $thumb_data['thumb'] : $art->raw;
    }
}
if (!empty($image)) {
    $extension = Art::extension($mime);
    $filename = scrub_out($filename . '.' . $extension);
    // Send the headers and output the image
    $browser = new Horde_Browser();
    if (!empty($etag)) {
        header('ETag: ' . $etag);
        header('Cache-Control: private');
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', time()));
    }
    header("Access-Control-Allow-Origin: *");
    $browser->downloadHeaders($filename, $mime, true);
    echo $image;
}
<div class="np_group similars">
    <div class="np_cell cel_similar">
        <label><?php 
    echo T_('Similar Artists');
    ?>
</label>
        <?php 
    foreach ($artists as $a) {
        ?>
            <div class="np_cell cel_similar_artist">
            <?php 
        if (is_null($a['id'])) {
            if (AmpConfig::get('wanted') && $a['mbid']) {
                echo "<a class=\"missing_album\" href=\"" . AmpConfig::get('web_path') . "/artists.php?action=show_missing&mbid=" . $a['mbid'] . "\" title=\"" . scrub_out($a['name']) . "\">" . scrub_out($a['name']) . "</a>";
            } else {
                echo scrub_out($a['name']);
            }
        } else {
            $artist = new Artist($a['id']);
            $artist->format();
            echo $artist->f_link;
        }
        ?>
            </div>
        <?php 
    }
    ?>
    </div>
</div>
<?php 
}
Ejemplo n.º 26
0
    <?php 
if ($show_direct_play) {
    echo Ajax::button('?page=stream&action=directplay&object_type=artist&object_id=' . $libitem->id, 'play', T_('Play'), 'play_artist_' . $libitem->id);
    if (Stream_Playlist::check_autoplay_append()) {
        echo Ajax::button('?page=stream&action=directplay&object_type=artist&object_id=' . $libitem->id . '&append=true', 'play_add', T_('Play last'), 'addplay_artist_' . $libitem->id);
        if (Stream_Playlist::check_autoplay_next()) {
            echo Ajax::button('?page=stream&action=directplay&object_type=artist&object_id=' . $libitem->id . '&playnext=true', 'play_next', T_('Play next'), 'nextplay_artist_' . $libitem->id);
        }
    }
}
?>
    </div>
</td>
<?php 
if (Art::is_enabled()) {
    $name = scrub_out($libitem->full_name);
    ?>
<td class="cel_cover">
    <?php 
    Art::display('artist', $libitem->id, $name, 1, AmpConfig::get('web_path') . '/artists.php?action=show&artist=' . $libitem->id);
    ?>
</td>
<?php 
}
?>
<td class="cel_artist"><?php 
echo $libitem->f_link;
?>
</td>
<td class="cel_add">
    <span class="cel_item_add">
Ejemplo n.º 27
0
            </a>
        <?php 
}
?>
    </span>
</td>
<td class="cel_type"><?php 
echo $libitem->f_type;
?>
</td>
<td class="cel_songs"><?php 
echo $libitem->get_song_count();
?>
</td>
<td class="cel_owner"><?php 
echo scrub_out($libitem->f_user);
?>
</td>
<?php 
if (User::is_registered()) {
    if (AmpConfig::get('ratings')) {
        ?>
    <td class="cel_rating" id="rating_<?php 
        echo $libitem->id;
        ?>
_playlist"><?php 
        Rating::show($libitem->id, 'playlist');
        ?>
</td>
    <?php 
    }
Ejemplo n.º 28
0
 /**
  * getAlbumList
  * Get a list of random, newest, highest rated etc. albums.
  * Takes the list type with optional size and offset in parameters.
  */
 public static function getalbumlist($input, $elementName = "albumList")
 {
     self::check_version($input, "1.2.0");
     $type = self::check_parameter($input, 'type');
     $size = $input['size'];
     $offset = $input['offset'];
     $musicFolderId = $input['musicFolderId'] ?: 0;
     // Get albums from all catalogs by default
     // Catalog filter is not supported for all request type for now.
     $catalogs = null;
     if ($musicFolderId > 0) {
         $catalogs = array();
         $catalogs[] = $musicFolderId;
     }
     $r = Subsonic_XML_Data::createSuccessResponse();
     $errorOccured = false;
     $albums = array();
     if ($type == "random") {
         $albums = Album::get_random($size);
     } else {
         if ($type == "newest") {
             $albums = Stats::get_newest("album", $size, $offset, $musicFolderId);
         } else {
             if ($type == "highest") {
                 $albums = Rating::get_highest("album", $size, $offset);
             } else {
                 if ($type == "frequent") {
                     $albums = Stats::get_top("album", $size, '', $offset);
                 } else {
                     if ($type == "recent") {
                         $albums = Stats::get_recent("album", $size, $offset);
                     } else {
                         if ($type == "starred") {
                             $albums = Userflag::get_latest('album');
                         } else {
                             if ($type == "alphabeticalByName") {
                                 $albums = Catalog::get_albums($size, $offset, $catalogs);
                             } else {
                                 if ($type == "alphabeticalByArtist") {
                                     $albums = Catalog::get_albums_by_artist($size, $offset, $catalogs);
                                 } else {
                                     if ($type == "byYear") {
                                         $fromYear = $input['fromYear'];
                                         $toYear = $input['toYear'];
                                         if ($fromYear || $toYear) {
                                             $search = array();
                                             $search['limit'] = $size;
                                             $search['offset'] = $offset;
                                             $search['type'] = "album";
                                             $i = 0;
                                             if ($fromYear) {
                                                 $search['rule_' . $i . '_input'] = $fromYear;
                                                 $search['rule_' . $i . '_operator'] = 0;
                                                 $search['rule_' . $i . ''] = "year";
                                                 ++$i;
                                             }
                                             if ($toYear) {
                                                 $search['rule_' . $i . '_input'] = $toYear;
                                                 $search['rule_' . $i . '_operator'] = 1;
                                                 $search['rule_' . $i . ''] = "year";
                                                 ++$i;
                                             }
                                             $query = new Search(null, 'album');
                                             $albums = $query->run($search);
                                         }
                                     } else {
                                         if ($type == "byGenre") {
                                             $genre = self::check_parameter($input, 'genre');
                                             $tag_id = Tag::tag_exists($genre);
                                             if ($tag_id) {
                                                 $albums = Tag::get_tag_objects('album', $tag_id, $size, $offset);
                                             }
                                         } else {
                                             $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_GENERIC, "Invalid list type: " . scrub_out($type));
                                             $errorOccured = true;
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if (!$errorOccured) {
         Subsonic_XML_Data::addAlbumList($r, $albums, $elementName);
     }
     self::apiOutput($input, $r);
 }
Ejemplo n.º 29
0
?>
</th>
    </tr>
    <tr>
        <td valign="top">
            <select name="field">
            <?php 
$fields = Song::get_fields();
foreach ($fields as $key => $value) {
    $name = ucfirst(str_replace('_', ' ', $key));
    ?>
                <option value="<?php 
    echo scrub_out($key);
    ?>
"><?php 
    echo scrub_out($name);
    ?>
</option>
            <?php 
}
?>
            </select>
        </td>
        <td>
            <select name="operator">
                <option value="eq">=</option>
                <option value="nq">!=</option>
                <option value="gt">&gt;</option>
                <option value="gte">&gt;=</option>
                <option value="lt">&lt;</option>
                <option value="lte">&lt;=</option>
Ejemplo n.º 30
0
/**
 * debug_result
 *
 * Convenience function to format the output.
 */
function debug_result($status = false, $value = null, $comment = '')
{
    $class = $status ? 'success' : 'danger';
    if (!$value) {
        $value = $status ? 'OK' : 'ERROR';
    }
    return '<button type="button" class="btn btn-' . $class . '">' . scrub_out($value) . '</span> <em>' . $comment . '</em></button>';
}