Exemple #1
0
 /**
  * display_home
  * This display the module in home page
  */
 public function display_home()
 {
     if (AmpConfig::get('sociable')) {
         echo "<div id='shout_objects'>\n";
         $shouts = Shoutbox::get_top($this->maxitems);
         if (count($shouts)) {
             require_once AmpConfig::get('prefix') . UI::find_template('show_shoutbox.inc.php');
         }
         echo "</div>\n";
     }
 }
?>
</title>
<meta property="og:title" content="<?php 
echo AmpConfig::get('site_title');
?>
" />
<meta property="og:image" content="<?php 
echo AmpConfig::get('web_path');
?>
/themes/reborn/images/ampache.png"/>
<meta property="og:description" content="A web based audio/video streaming application and file manager allowing you to access your music & videos from anywhere, using almost any internet enabled device." />
<meta property="og:site_name" content="Ampache"/>
<?php 
if (!$is_share) {
    $playlist = new Stream_Playlist(scrub_in($_REQUEST['playlist_id']));
}
$isRadio = false;
$isVideo = false;
$radio = null;
if (isset($playlist)) {
    if (WebPlayer::is_playlist_radio($playlist)) {
        // Special stuff for web radio (to better handle Icecast/Shoutcast metadata ...)
        // No special stuff for now
        $isRadio = true;
        $radio = $playlist->urls[0];
    } else {
        $isVideo = WebPlayer::is_playlist_video($playlist);
    }
}
require_once AmpConfig::get('prefix') . UI::find_template('show_html5_player.inc.php');
Exemple #3
0
            if (ini_get($ini_default_charset)) {
                ini_set($ini_default_charset, "UTF-8");
            }
            mb_language("uni");
        }
        $mailer = new Mailer();
        // Set the vars on the object
        $mailer->subject = $_REQUEST['subject'];
        $mailer->message = $_REQUEST['message'];
        if ($_REQUEST['from'] == 'system') {
            $mailer->set_default_sender();
        } else {
            $mailer->sender = $GLOBALS['user']->email;
            $mailer->sender_name = $GLOBALS['user']->fullname;
        }
        if ($mailer->send_to_group($_REQUEST['to'])) {
            $title = T_('E-mail Sent');
            $body = T_('Your E-mail was successfully sent.');
        } else {
            $title = T_('E-mail Not Sent');
            $body = T_('Your E-mail was not sent.');
        }
        $url = AmpConfig::get('web_path') . '/admin/mail.php';
        show_confirmation($title, $body, $url);
        break;
    default:
        require_once AmpConfig::get('prefix') . UI::find_template('show_mail_users.inc.php');
        break;
}
// end switch
UI::show_footer();
</th>
        </tr>
    </thead>
    <tbody>
        <?php 
foreach ($concerts as $libitem) {
    ?>
        <tr id="concert_<?php 
    echo $libitem->id;
    ?>
" class="<?php 
    echo UI::flip_class();
    ?>
">
            <?php 
    require AmpConfig::get('prefix') . UI::find_template('show_concert_row.inc.php');
    ?>
        </tr>
        <?php 
}
?>
        <?php 
if (!$concerts || !count($concerts)) {
    ?>
        <tr class="<?php 
    echo UI::flip_class();
    ?>
">
            <td colspan="<?php 
    echo $thcount;
    ?>
    ?>
" type="text/css" />
<?php 
} else {
    ?>
<link rel="stylesheet" href="<?php 
    echo AmpConfig::get('web_path') . UI::find_template('jplayer.midnight.black.css');
    ?>
" type="text/css" />
<?php 
}
if (!$iframed) {
    require_once AmpConfig::get('prefix') . UI::find_template('stylesheets.inc.php');
    ?>
<link rel="stylesheet" href="<?php 
    echo AmpConfig::get('web_path') . UI::find_template('jquery-editdialog.css');
    ?>
" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php 
    echo AmpConfig::get('web_path');
    ?>
/modules/jquery-ui-ampache/jquery-ui.min.css" type="text/css" media="screen" />
<script src="<?php 
    echo AmpConfig::get('web_path');
    ?>
/lib/components/jquery/jquery.min.js" language="javascript" type="text/javascript"></script>
<script src="<?php 
    echo AmpConfig::get('web_path');
    ?>
/lib/components/jquery-ui/jquery-ui.min.js" language="javascript" type="text/javascript"></script>
<script src="<?php 
</th>
        </tr>
    </thead>
    <tbody>
        <?php 
foreach ($object_ids as $wanted_id) {
    $libitem = new Wanted($wanted_id);
    $libitem->format();
    ?>
        <tr id="walbum_<?php 
    echo $libitem->mbid;
    ?>
" class="<?php 
    echo UI::flip_class();
    ?>
">
            <?php 
    require AmpConfig::get('prefix') . UI::find_template('show_wanted_album_row.inc.php');
    ?>
        </tr>
        <?php 
}
?>
    </tbody>
</table>
<script src="<?php 
echo AmpConfig::get('web_path');
?>
/lib/javascript/tabledata.js" language="javascript" type="text/javascript"></script>
<?php 
UI::show_box_bottom();
Exemple #7
0
         }
     }
     UI::show_footer();
     exit;
 case 'create':
     if (AmpConfig::get('demo_mode')) {
         UI::access_denied();
         exit;
     }
     if (!Core::form_verify('add_channel', 'post')) {
         UI::access_denied();
         exit;
     }
     $created = Channel::create($_REQUEST['name'], $_REQUEST['description'], $_REQUEST['url'], $_REQUEST['type'], $_REQUEST['id'], $_REQUEST['interface'], $_REQUEST['port'], $_REQUEST['admin_password'], $_REQUEST['private'] ?: 0, $_REQUEST['max_listeners'], $_REQUEST['random'] ?: 0, $_REQUEST['loop'] ?: 0, $_REQUEST['stream_type'], $_REQUEST['bitrate']);
     if (!$created) {
         require_once AmpConfig::get('prefix') . UI::find_template('show_add_channel.inc.php');
     } else {
         $title = T_('Channel Created');
         show_confirmation($title, $body, AmpConfig::get('web_path') . '/browse.php?action=channel');
     }
     UI::show_footer();
     exit;
 case 'show_delete':
     $id = $_REQUEST['id'];
     $next_url = AmpConfig::get('web_path') . '/channel.php?action=delete&id=' . scrub_out($id);
     show_confirmation(T_('Channel Delete'), T_('Confirm Deletion Request'), $next_url, 1, 'delete_channel');
     UI::show_footer();
     exit;
 case 'delete':
     if (AmpConfig::get('demo_mode')) {
         UI::access_denied();
Exemple #8
0
    echo xoutput_from_array(array('rfc3514' => '0x1'));
    exit;
}
switch ($_REQUEST['action']) {
    case 'show_edit_object':
        ob_start();
        require AmpConfig::get('prefix') . UI::find_template('show_edit_' . $type . '.inc.php');
        $results = ob_get_contents();
        break;
    case 'refresh_updated':
        require AmpConfig::get('prefix') . UI::find_template('show_' . $type . '.inc.php');
        $results = ob_get_contents();
        break;
    case 'show_edit_playlist':
        ob_start();
        require AmpConfig::get('prefix') . UI::find_template('show_playlists_dialog.inc.php');
        $results = ob_get_contents();
        ob_end_clean();
        break;
    case 'edit_object':
        // Scrub the data, walk recursive through array
        $entities = function (&$data) use(&$entities) {
            foreach ($data as $key => $value) {
                $data[$key] = is_array($value) ? $entities($value) : unhtmlentities(scrub_in($value));
            }
            return $data;
        };
        $entities($_POST);
        $libitem = new $object_type($_POST['id']);
        if ($libitem->get_user_owner() == $GLOBALS['user']->id && AmpConfig::get('upload_allow_edit') && !Access::check('interface', 50)) {
            // TODO: improve this uniqueless check
Exemple #9
0
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
define('NO_SESSION', '1');
require_once 'lib/init.php';
// Avoid form login if still connected
if (AmpConfig::get('use_auth') && !isset($_GET['force_display'])) {
    $auth = false;
    if (Session::exists('interface', $_COOKIE[AmpConfig::get('session_name')])) {
        $auth = true;
    } else {
        if (Session::auth_remember()) {
            $auth = true;
        }
    }
    if ($auth) {
        header("Location: " . AmpConfig::get('web_path'));
        exit;
    }
}
require_once 'lib/login.php';
require AmpConfig::get('prefix') . UI::find_template('show_login_form.inc.php');
Exemple #10
0
 /**
  * show
  * This takes an id and a type and displays the rating if ratings are
  * enabled.  If $static is true, the rating won't be editable.
  */
 public static function show($object_id, $type, $static = false)
 {
     // If ratings aren't enabled don't do anything
     if (!AmpConfig::get('ratings')) {
         return false;
     }
     $rating = new Rating($object_id, $type);
     if ($static) {
         require AmpConfig::get('prefix') . UI::find_template('show_static_object_rating.inc.php');
     } else {
         require AmpConfig::get('prefix') . UI::find_template('show_object_rating.inc.php');
     }
 }
            <th class="cel_description"><?php 
echo T_('Description');
?>
</th>
            <th class="cel_action"><?php 
echo T_('Action');
?>
</th>
        </tr>
    </thead>
    <tbody>
        <?php 
foreach ($object_ids as $license_id) {
    $libitem = new License($license_id);
    $libitem->format();
    require AmpConfig::get('prefix') . UI::find_template('show_license_row.inc.php');
    ?>
        <?php 
}
if (!count($object_ids)) {
    ?>
        <tr class="<?php 
    echo UI::flip_class();
    ?>
">
            <td colspan="6" class="error"><?php 
    echo T_('No Licenses Found');
    ?>
</td>
        </tr>
        <?php 
Exemple #12
0
<?php

/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
 *
 * LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
 * Copyright 2001 - 2015 Ampache.org
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
UI::show_box_top(T_('Information'));
require_once AmpConfig::get('prefix') . UI::find_template('show_stats_recent.inc.php');
UI::show_box_bottom();
Exemple #13
0
        if (isset($_POST['license_id'])) {
            $license = new License($_POST['license_id']);
            if ($license->id) {
                $license->update($_POST);
            }
            $text = T_('License Updated');
        } else {
            License::create($_POST);
            $text = T_('License Created');
        }
        show_confirmation($text, '', AmpConfig::get('web_path') . '/admin/license.php');
        break;
    case 'show_edit':
        $license = new License($_REQUEST['license_id']);
    case 'show_create':
        require_once AmpConfig::get('prefix') . UI::find_template('show_edit_license.inc.php');
        break;
    case 'delete':
        License::delete($_REQUEST['license_id']);
        show_confirmation(T_('License Deleted'), '', AmpConfig::get('web_path') . '/admin/license.php');
        break;
    default:
        $browse = new Browse();
        $browse->set_type('license');
        $browse->set_simple_browse(true);
        $license_ids = $browse->get_objects();
        $browse->show_objects($license_ids);
        $browse->store();
        break;
}
UI::show_footer();
Exemple #14
0
            <?php 
    echo T_('Queries:');
    echo Dba::$stats['query'];
    ?>
 <?php 
    echo T_('Cache Hits:');
    echo database_object::$cache_hit;
    ?>
            <?php 
    $load_time_end = microtime(true);
    $load_time = number_format($load_time_end - AmpConfig::get('load_time_begin'), 4);
    ?>
            | <?php 
    echo T_('Load time:');
    echo $load_time;
    ?>
        <?php 
}
?>
        </div>
        <?php 
if (AmpConfig::get('ajax_load') && (!isset($_SESSION['login']) || !$_SESSION['login'])) {
    ?>
        <div id="webplayer"></div>
        <?php 
    require_once AmpConfig::get('prefix') . UI::find_template('uberviz.inc.php');
}
?>
    </body>
</html>
?>
" lang="<?php 
echo $htmllang;
?>
" dir="<?php 
echo $dir;
?>
">
    <head>
        <!-- Propulsed by Ampache | ampache.org -->
        <meta http-equiv="Content-Type" content="text/html; charset=<?php 
echo AmpConfig::get('site_charset');
?>
" />
        <?php 
require_once AmpConfig::get('prefix') . UI::find_template('stylesheets.inc.php');
?>
        <title> <?php 
echo scrub_out(AmpConfig::get('site_title'));
?>
 </title>
        <script type="text/javascript" language="javascript">
            function focus(){ document.login.username.focus(); }
        </script>
    </head>

    <body id="loginPage" onload="focus();">
        <div id="maincontainer">
            <div id="header"><!-- This is the header -->
                <a href="<?php 
echo $web_path;
Exemple #16
0
 public static function process_action($action, $catalogs, $options = null)
 {
     if (!$options || !is_array($options)) {
         $options = array();
     }
     switch ($action) {
         case 'add_to_all_catalogs':
             $catalogs = Catalog::get_catalogs();
         case 'add_to_catalog':
             if ($catalogs) {
                 foreach ($catalogs as $catalog_id) {
                     $catalog = Catalog::create_from_id($catalog_id);
                     if ($catalog !== null) {
                         $catalog->add_to_catalog($options);
                     }
                 }
                 if (!defined('SSE_OUTPUT')) {
                     AmpError::display('catalog_add');
                 }
             }
             break;
         case 'update_all_catalogs':
             $catalogs = Catalog::get_catalogs();
         case 'update_catalog':
             if ($catalogs) {
                 foreach ($catalogs as $catalog_id) {
                     $catalog = Catalog::create_from_id($catalog_id);
                     if ($catalog !== null) {
                         $catalog->verify_catalog();
                     }
                 }
             }
             break;
         case 'full_service':
             if (!$catalogs) {
                 $catalogs = Catalog::get_catalogs();
             }
             /* This runs the clean/verify/add in that order */
             foreach ($catalogs as $catalog_id) {
                 $catalog = Catalog::create_from_id($catalog_id);
                 if ($catalog !== null) {
                     $catalog->clean_catalog();
                     $catalog->verify_catalog();
                     $catalog->add_to_catalog();
                 }
             }
             Dba::optimize_tables();
             break;
         case 'clean_all_catalogs':
             $catalogs = Catalog::get_catalogs();
         case 'clean_catalog':
             if ($catalogs) {
                 foreach ($catalogs as $catalog_id) {
                     $catalog = Catalog::create_from_id($catalog_id);
                     if ($catalog !== null) {
                         $catalog->clean_catalog();
                     }
                 }
                 // end foreach catalogs
                 Dba::optimize_tables();
             }
             break;
         case 'update_from':
             $catalog_id = 0;
             // First see if we need to do an add
             if ($options['add_path'] != '/' && strlen($options['add_path'])) {
                 if ($catalog_id = Catalog_local::get_from_path($options['add_path'])) {
                     $catalog = Catalog::create_from_id($catalog_id);
                     if ($catalog !== null) {
                         $catalog->add_to_catalog(array('subdirectory' => $options['add_path']));
                     }
                 }
             }
             // end if add
             // Now check for an update
             if ($options['update_path'] != '/' && strlen($options['update_path'])) {
                 if ($catalog_id = Catalog_local::get_from_path($options['update_path'])) {
                     $songs = Song::get_from_path($options['update_path']);
                     foreach ($songs as $song_id) {
                         Catalog::update_single_item('song', $song_id);
                     }
                 }
             }
             // end if update
             if ($catalog_id <= 0) {
                 AmpError::add('general', T_("This subdirectory is not part of an existing catalog. Update cannot be processed."));
             }
             break;
         case 'gather_media_art':
             if (!$catalogs) {
                 $catalogs = Catalog::get_catalogs();
             }
             // Iterate throught the catalogs and gather as needed
             foreach ($catalogs as $catalog_id) {
                 $catalog = Catalog::create_from_id($catalog_id);
                 if ($catalog !== null) {
                     require AmpConfig::get('prefix') . UI::find_template('show_gather_art.inc.php');
                     flush();
                     $catalog->gather_art();
                 }
             }
             break;
     }
 }
Exemple #17
0
 /**
  * verify_catalog_proc
  * This function compares the DB's information with the ID3 tags
  */
 public function verify_catalog_proc()
 {
     debug_event('verify', 'Starting on ' . $this->name, 5);
     set_time_limit(0);
     $stats = self::get_stats($this->id);
     $number = $stats['videos'] + $stats['songs'];
     $total_updated = 0;
     $this->count = 0;
     if (!defined('SSE_OUTPUT')) {
         require_once AmpConfig::get('prefix') . UI::find_template('show_verify_catalog.inc.php');
         flush();
     }
     foreach (array('video', 'song') as $media_type) {
         $total = $stats[$media_type . 's'];
         // UGLY
         if ($total == 0) {
             continue;
         }
         $chunks = floor($total / 10000);
         foreach (range(0, $chunks) as $chunk) {
             // Try to be nice about memory usage
             if ($chunk > 0) {
                 $media_type::clear_cache();
             }
             $total_updated += $this->_verify_chunk($media_type, $chunk, 10000);
         }
     }
     debug_event('verify', "Finished, {$total_updated} updated in " . $this->name, 5);
     self::gc();
     $this->update_last_update();
     return array('total' => $number, 'updated' => $total_updated);
 }
Exemple #18
0
    echo $video->id;
    ?>
">
                <?php 
    echo UI::get_icon('delete', T_('Delete'));
    ?>
            </a>
        <?php 
}
?>
    </dd>
<?php 
$videoprops[gettext_noop('Title')] = scrub_out($video->f_title);
$videoprops[gettext_noop('Length')] = scrub_out($video->f_time);
if (!strtolower(get_class($video)) != 'video') {
    require AmpConfig::get('prefix') . UI::find_template('show_partial_' . strtolower(get_class($video)) . '.inc.php');
}
$videoprops[gettext_noop('Release Date')] = scrub_out($video->f_release_date);
$videoprops[gettext_noop('Codec')] = scrub_out($video->f_codec);
$videoprops[gettext_noop('Resolution')] = scrub_out($video->f_resolution);
$videoprops[gettext_noop('Display')] = scrub_out($video->f_display);
$videoprops[gettext_noop('Audio Bitrate')] = scrub_out($video->f_bitrate);
$videoprops[gettext_noop('Video Bitrate')] = scrub_out($video->f_video_bitrate);
$videoprops[gettext_noop('Frame Rate')] = scrub_out($video->f_frame_rate);
$videoprops[gettext_noop('Channels')] = scrub_out($video->channels);
if (Access::check('interface', '75')) {
    $videoprops[gettext_noop('Filename')] = scrub_out($video->file) . " " . $video->f_size;
}
if ($video->update_time) {
    $videoprops[gettext_noop('Last Updated')] = date("d/m/Y H:i", $video->update_time);
}
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
?>
<div>
<?php 
$objects = Stats::get_top('album');
$headers = array('f_link' => T_('Most Popular Albums'));
UI::show_box_top('', 'info-box box_popular_albums');
require AmpConfig::get('prefix') . UI::find_template('show_objects.inc.php');
UI::show_box_bottom();
$objects = Stats::get_top('artist');
$headers = array('f_link' => T_('Most Popular Artists'));
UI::show_box_top('', 'info-box box_popular_artists');
require AmpConfig::get('prefix') . UI::find_template('show_objects.inc.php');
UI::show_box_bottom();
if (AmpConfig::get('allow_video')) {
    $objects = Stats::get_top('video');
    $headers = array('f_link' => T_('Most Popular Videos'));
    UI::show_box_top('', 'info-box box_popular_videos');
    require AmpConfig::get('prefix') . UI::find_template('show_objects.inc.php');
    UI::show_box_bottom();
}
?>
</div>
Exemple #20
0
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
/**
 * Playlist Box
 * This box is used for actions on the main screen and on a specific playlist page
 * It changes depending on where it is
 */
ob_start();
require AmpConfig::get('prefix') . UI::find_template('show_playlist_title.inc.php');
$title = ob_get_contents();
ob_end_clean();
UI::show_box_top('<div id="playlist_row_' . $playlist->id . '">' . $title . '</div>', 'info-box');
if (User::is_registered()) {
    ?>
    <?php 
    if (AmpConfig::get('ratings')) {
        ?>
    <div style="display:table-cell;" id="rating_<?php 
        echo $playlist->id;
        ?>
_playlist">
            <?php 
        Rating::show($playlist->id, 'playlist');
        ?>
Exemple #21
0
/**
 * show_rating
 * This takes an artist id and includes the right file
 */
function show_rating($object_id, $type)
{
    $rating = new Rating($object_id, $type);
    require AmpConfig::get('prefix') . UI::find_template('show_object_rating.inc.php');
}
Exemple #22
0
                }
            }
        }
        $fullname = $GLOBALS['user']->fullname;
        $preferences = $GLOBALS['user']->get_preferences($_REQUEST['tab']);
        break;
    default:
        $fullname = $GLOBALS['user']->fullname;
        $preferences = $GLOBALS['user']->get_preferences($_REQUEST['tab']);
        break;
}
// End Switch Action
UI::show_header();
/**
 * switch on the view
 */
switch ($_REQUEST['action']) {
    case 'confirm':
    case 'grant':
        show_confirmation($title, $text, $next_url, $cancel);
        break;
    default:
        if (!empty($notification_text)) {
            display_notification($notification_text);
        }
        // Show the default preferences page
        require AmpConfig::get('prefix') . UI::find_template('show_preferences.inc.php');
        break;
}
// end switch on action
UI::show_footer();
Exemple #23
0
/**
 * show_now_playing
 * This shows the now playing templates and does some garbage collecion
 * this should really be somewhere else
 */
function show_now_playing()
{
    Session::gc();
    Stream::gc_now_playing();
    $web_path = AmpConfig::get('web_path');
    $results = Stream::get_now_playing();
    require_once AmpConfig::get('prefix') . UI::find_template('show_now_playing.inc.php');
}
Exemple #24
0
 /**
  * show_objects
  * This takes an array of objects
  * and requires the correct template based on the
  * type that we are currently browsing
  *
  * @param int[] $object_ids
  */
 public function show_objects($object_ids = null, $argument = null)
 {
     if ($this->is_simple() || !is_array($object_ids)) {
         $object_ids = $this->get_saved();
     } else {
         $this->save_objects($object_ids);
     }
     // Limit is based on the user's preferences if this is not a
     // simple browse because we've got too much here
     if ($this->get_start() >= 0 && count($object_ids) > $this->get_start() && !$this->is_simple()) {
         $object_ids = array_slice($object_ids, $this->get_start(), $this->get_offset(), true);
     } else {
         if (!count($object_ids)) {
             $this->set_total(0);
         }
     }
     // Load any additional object we need for this
     $extra_objects = $this->get_supplemental_objects();
     $browse = $this;
     foreach ($extra_objects as $class_name => $id) {
         ${$class_name} = new $class_name($id);
     }
     $match = '';
     // Format any matches we have so we can show them to the masses
     if ($filter_value = $this->get_filter('alpha_match')) {
         $match = ' (' . $filter_value . ')';
     } elseif ($filter_value = $this->get_filter('starts_with')) {
         $match = ' (' . $filter_value . ')';
         /*} elseif ($filter_value = $this->get_filter('regex_match')) {
               $match = ' (' . $filter_value . ')';
           } elseif ($filter_value = $this->get_filter('regex_not_match')) {
               $match = ' (' . $filter_value . ')';*/
     } elseif ($filter_value = $this->get_filter('catalog')) {
         // Get the catalog title
         $catalog = Catalog::create_from_id(intval($filter_value));
         $match = ' (' . $catalog->name . ')';
     }
     $type = $this->get_type();
     // Update the session value only if it's allowed on the current browser
     if ($this->get_update_session()) {
         $_SESSION['browse_current_' . $type]['start'] = $browse->get_start();
     }
     // Set the correct classes based on type
     $class = "box browse_" . $type;
     $argument_param = $argument ? '&argument=' . scrub_in($argument) : '';
     debug_event('browse', 'Show objects called for type {' . $type . '}', '5');
     $limit_threshold = $this->get_threshold();
     // Switch on the type of browsing we're doing
     switch ($type) {
         case 'song':
             $box_title = T_('Songs') . $match;
             Song::build_cache($object_ids, $limit_threshold);
             $box_req = AmpConfig::get('prefix') . UI::find_template('show_songs.inc.php');
             break;
         case 'album':
             Album::build_cache($object_ids);
             $box_title = T_('Albums') . $match;
             if (is_array($argument)) {
                 $allow_group_disks = $argument['group_disks'];
                 if ($argument['title']) {
                     $box_title = $argument['title'];
                 }
             } else {
                 $allow_group_disks = false;
             }
             $box_req = AmpConfig::get('prefix') . UI::find_template('show_albums.inc.php');
             break;
         case 'user':
             $box_title = T_('Users') . $match;
             $box_req = AmpConfig::get('prefix') . UI::find_template('show_users.inc.php');
             break;
         case 'artist':
             $box_title = T_('Artists') . $match;
             Artist::build_cache($object_ids, true, $limit_threshold);
             $box_req = AmpConfig::get('prefix') . UI::find_template('show_artists.inc.php');
             break;
         case 'live_stream':
             require_once AmpConfig::get('prefix') . UI::find_template('show_live_stream.inc.php');
             $box_title = T_('Radio Stations') . $match;
             $box_req = AmpConfig::get('prefix') . UI::find_template('show_live_streams.inc.php');
             break;
         case 'playlist':
             Playlist::build_cache($object_ids);
             $box_title = T_('Playlists') . $match;
             $box_req = AmpConfig::get('prefix') . UI::find_template('show_playlists.inc.php');
             break;
         case 'playlist_song':
             $box_title = T_('Playlist Songs') . $match;
             $box_req = AmpConfig::get('prefix') . UI::find_template('show_playlist_songs.inc.php');
             break;
         case 'playlist_localplay':
             $box_title = T_('Current Playlist');
             $box_req = AmpConfig::get('prefix') . UI::find_template('show_localplay_playlist.inc.php');
             UI::show_box_bottom();
             break;
         case 'smartplaylist':
             $box_title = T_('Smart Playlists') . $match;
             $box_req = AmpConfig::get('prefix') . UI::find_template('show_searches.inc.php');
             break;
         case 'catalog':
             $box_title = T_('Catalogs');
             $box_req = AmpConfig::get('prefix') . UI::find_template('show_catalogs.inc.php');
             break;
         case 'shoutbox':
             $box_title = T_('Shoutbox Records');
             $box_req = AmpConfig::get('prefix') . UI::find_template('show_manage_shoutbox.inc.php');
             break;
         case 'tag':
             Tag::build_cache($object_ids);
             $box_title = T_('Tag Cloud');
             $box_req = AmpConfig::get('prefix') . UI::find_template('show_tagcloud.inc.php');
             break;
         case 'video':
             Video::build_cache($object_ids);
             $video_type = 'video';
             $box_title = T_('Videos');
             $box_req = AmpConfig::get('prefix') . UI::find_template('show_videos.inc.php');
             break;
         case 'democratic':
             $box_title = T_('Democratic Playlist');
             $box_req = AmpConfig::get('prefix') . UI::find_template('show_democratic_playlist.inc.php');
             break;
         case 'wanted':
             $box_title = T_('Wanted Albums');
             $box_req = AmpConfig::get('prefix') . UI::find_template('show_wanted_albums.inc.php');
             break;
         case 'share':
             $box_title = T_('Shared Objects');
             $box_req = AmpConfig::get('prefix') . UI::find_template('show_shared_objects.inc.php');
             break;
         case 'song_preview':
             $box_title = T_('Songs');
             $box_req = AmpConfig::get('prefix') . UI::find_template('show_song_previews.inc.php');
             break;
         case 'channel':
             $box_title = T_('Channels');
             $box_req = AmpConfig::get('prefix') . UI::find_template('show_channels.inc.php');
             break;
         case 'broadcast':
             $box_title = T_('Broadcasts');
             $box_req = AmpConfig::get('prefix') . UI::find_template('show_broadcasts.inc.php');
             break;
         case 'license':
             $box_title = T_('Media Licenses');
             $box_req = AmpConfig::get('prefix') . UI::find_template('show_manage_license.inc.php');
             break;
         case 'tvshow':
             $box_title = T_('TV Shows');
             $box_req = AmpConfig::get('prefix') . UI::find_template('show_tvshows.inc.php');
             break;
         case 'tvshow_season':
             $box_title = T_('Seasons');
             $box_req = AmpConfig::get('prefix') . UI::find_template('show_tvshow_seasons.inc.php');
             break;
         case 'tvshow_episode':
             $box_title = T_('Episodes');
             $video_type = $type;
             $box_req = AmpConfig::get('prefix') . UI::find_template('show_videos.inc.php');
             break;
         case 'movie':
             $box_title = T_('Movies');
             $video_type = $type;
             $box_req = AmpConfig::get('prefix') . UI::find_template('show_videos.inc.php');
             break;
         case 'clip':
             $box_title = T_('Clips');
             $video_type = $type;
             $box_req = AmpConfig::get('prefix') . UI::find_template('show_videos.inc.php');
             break;
         case 'personal_video':
             $box_title = T_('Personal Videos');
             $video_type = $type;
             $box_req = AmpConfig::get('prefix') . UI::find_template('show_videos.inc.php');
             break;
         case 'label':
             $box_title = T_('Labels');
             $box_req = AmpConfig::get('prefix') . UI::find_template('show_labels.inc.php');
             break;
         case 'pvmsg':
             $box_title = T_('Private Messages');
             $box_req = AmpConfig::get('prefix') . UI::find_template('show_pvmsgs.inc.php');
             break;
         default:
             // Rien a faire
             break;
     }
     // end switch on type
     Ajax::start_container($this->get_content_div(), 'browse_content');
     if ($this->get_show_header()) {
         if (isset($box_req) && isset($box_title)) {
             UI::show_box_top($box_title, $class);
         }
     }
     if (isset($box_req)) {
         require $box_req;
     }
     if ($this->get_show_header()) {
         if (isset($box_req)) {
             UI::show_box_bottom();
         }
         echo '<script type="text/javascript">';
         echo Ajax::action('?page=browse&action=get_filters&browse_id=' . $this->id . $argument_param, '');
         echo ';</script>';
     } else {
         if (!$this->get_use_pages()) {
             $this->show_next_link($argument);
         }
     }
     Ajax::end_container();
 }
Exemple #25
0
                    $('#sidebar').show(500);
                });

                $.cookie('sidebar_state', newstate, { expires: 30, path: '/'});
            });
            </script>

            <div id="rightbar" class="rightbar-<?php 
echo AmpConfig::get('ui_fixed') ? 'fixed' : 'float';
?>
 <?php 
echo $count_temp_playlist ? '' : 'hidden';
?>
">
                <?php 
require_once AmpConfig::get('prefix') . UI::find_template('rightbar.inc.php');
?>
            </div>

            <!-- Tiny little div, used to cheat the system -->
            <div id="ajax-loading">Loading . . .</div>
            <div id="util_div" style="display:none;"></div>
            <iframe name="util_iframe" id="util_iframe" style="display:none;" src="<?php 
echo $web_path;
?>
/util.php"></iframe>
            <div id="content" class="content-<?php 
echo AmpConfig::get('ui_fixed') ? AmpConfig::get('topmenu') ? 'fixed-topmenu' : 'fixed' : 'float';
?>
 <?php 
echo $count_temp_playlist || AmpConfig::get('play_type') == 'localplay' ? '' : 'content-right-wild';
Exemple #26
0
    }
    ?>
                </td>
            </tr>
        </table><br />
        <?php 
    UI::show_box_bottom();
    ?>
        <?php 
}
?>
        <?php 
$data = Song::get_recently_played($client->id);
Song::build_cache(array_keys($data));
$user_id = $client->id;
require AmpConfig::get('prefix') . UI::find_template('show_recently_played.inc.php');
?>
        </div>
        <?php 
if (AmpConfig::get('allow_upload')) {
    ?>
        <div id="artists" class="tab_content">
        <?php 
    $sql = Catalog::get_uploads_sql('artist', $client->id);
    $browse = new Browse();
    $browse->set_type('artist', $sql);
    $browse->set_simple_browse(true);
    $browse->show_objects();
    $browse->store();
    ?>
        </div>
Exemple #27
0
            break;
        }
        $song = new Song($_REQUEST['song_id']);
        if (!Catalog::can_remove($song)) {
            debug_event('song', 'Unauthorized to remove the song `.' . $song->id . '`.', 1);
            UI::access_denied();
            exit;
        }
        if ($song->remove_from_disk()) {
            show_confirmation(T_('Song Deletion'), T_('Song has been deleted.'), AmpConfig::get('web_path'));
        } else {
            show_confirmation(T_('Song Deletion'), T_('Cannot delete this song.'), AmpConfig::get('web_path'));
        }
        break;
    case 'show_lyrics':
        $song = new Song($_REQUEST['song_id']);
        $song->format();
        $song->fill_ext_info();
        $lyrics = $song->get_lyrics();
        require_once AmpConfig::get('prefix') . UI::find_template('show_lyrics.inc.php');
        break;
    case 'show_song':
    default:
        $song = new Song($_REQUEST['song_id']);
        $song->format();
        $song->fill_ext_info();
        require_once AmpConfig::get('prefix') . UI::find_template('show_song.inc.php');
        break;
}
// end data collection
UI::show_footer();
Exemple #28
0
     break;
 case 'page':
     $browse->set_start($_REQUEST['start']);
     ob_start();
     $browse->show_objects(null, $argument);
     $results[$browse->get_content_div()] = ob_get_clean();
     break;
 case 'show_art':
     Art::set_enabled();
     ob_start();
     $browse->show_objects(null, $argument);
     $results[$browse->get_content_div()] = ob_get_clean();
     break;
 case 'get_filters':
     ob_start();
     require_once AmpConfig::get('prefix') . UI::find_template('browse_filters.inc.php');
     $results['browse_filters'] = ob_get_clean();
     break;
 case 'options':
     $option = $_REQUEST['option'];
     $value = $_REQUEST['value'];
     switch ($option) {
         case 'use_pages':
             $value = $value == 'true';
             $browse->set_use_pages($value);
             if ($value) {
                 $browse->set_start(0);
             }
             break;
         case 'use_alpha':
             $value = $value == 'true';
Exemple #29
0
        echo T_('Rating');
        ?>
</th>
                <?php 
    }
    ?>
                <?php 
    if (AmpConfig::get('userflags')) {
        ?>
                    <th class="cel_userflag"><?php 
        echo T_('Fav.');
        ?>
</th>
                <?php 
    }
    ?>
            <?php 
}
?>
            <th class="cel_action"><?php 
echo T_('Actions');
?>
</th>
        </tr>
    <tfoot>
</table>
<?php 
show_table_render();
if ($browse->get_show_header()) {
    require AmpConfig::get('prefix') . UI::find_template('list_header.inc.php');
}
Exemple #30
0
     // This one's a doozy
     $browse_type = isset($_REQUEST['type']) ? $_REQUEST['type'] : 'artist';
     $browse->set_simple_browse(false);
     $browse->save_objects(Tag::get_tags($browse_type, 0, 'name'));
     // Should add a pager?
     $object_ids = $browse->get_saved();
     $keys = array_keys($object_ids);
     Tag::build_cache($keys);
     UI::show_box_top(T_('Tag Cloud'), 'box box_tag_cloud');
     $browse2 = new Browse();
     $browse2->set_type($browse_type);
     $browse2->store();
     require_once AmpConfig::get('prefix') . UI::find_template('show_tagcloud.inc.php');
     UI::show_box_bottom();
     $type = $browse2->get_type();
     require_once AmpConfig::get('prefix') . UI::find_template('browse_content.inc.php');
     break;
 case 'artist':
     $browse->set_filter('catalog', $_SESSION['catalog']);
     if (AmpConfig::get('catalog_disable')) {
         $browse->set_filter('catalog_enabled', '1');
     }
     $browse->set_sort('name', 'ASC');
     $browse->update_browse_from_session();
     $browse->show_objects();
     break;
 case 'song':
     $browse->set_filter('catalog', $_SESSION['catalog']);
     if (AmpConfig::get('catalog_disable')) {
         $browse->set_filter('catalog_enabled', '1');
     }