コード例 #1
0
ファイル: scrobbler.class.php プロジェクト: ivan801/ampache
 /**
  * call_url
  * This is a generic caller for HTTP requests
  * It need the method (GET/POST), the url and the parameters
  */
 public function call_url($url, $method = 'GET', $vars = null)
 {
     // Encode parameters per RFC1738
     $params = http_build_query($vars);
     $opts = array('http' => array('method' => $method, 'header' => array('Host: ' . $this->host, 'User-Agent: Ampache/' . AmpConfig::get('version'))));
     // POST request need parameters in body and additional headers
     if ($method == 'POST') {
         $opts['http']['content'] = $params;
         $opts['http']['header'][] = 'Content-type: application/x-www-form-urlencoded';
         $opts['http']['header'][] = 'Content-length: ' . strlen($params);
         $params = '';
     }
     $context = stream_context_create($opts);
     if ($params != '') {
         // If there are paramters for GET request, adding the "?" caracter before
         $params = '?' . $params;
     }
     //debug_event('SCROBBLER', "$this->scheme://$this->host$url$params", 5);
     //debug_event('SCROBBLER', serialize($opts), 5);
     $fp = fopen("{$this->scheme}://{$this->host}{$url}{$params}", 'r', false, $context);
     if (!$fp) {
         return false;
     }
     ob_start();
     fpassthru($fp);
     $buffer = ob_get_contents();
     ob_end_clean();
     fclose($fp);
     //debug_event('SCROBBLER', $buffer, 5);
     return $buffer;
 }
コード例 #2
0
ファイル: webdav_catalog.class.php プロジェクト: nioc/ampache
 public function getName()
 {
     if ($this->catalog_id > 0) {
         $catalog = Catalog::create_from_id($this->catalog_id);
         return $catalog->name;
     }
     return AmpConfig::get('site_title');
 }
コード例 #3
0
ファイル: Piwik.plugin.php プロジェクト: bl00m/ampache
 /**
  * install
  * This is a required plugin function. It inserts our preferences
  * into Ampache
  */
 public function install()
 {
     // Check and see if it's already installed
     if (Preference::exists('piwik_site_id')) {
         return false;
     }
     Preference::insert('piwik_site_id', 'Piwik Site ID', '1', 100, 'string', 'plugins', 'piwik');
     Preference::insert('piwik_url', 'Piwik URL', AmpConfig::get('web_path') . '/piwik/', 100, 'string', 'plugins', $this->name);
     return true;
 }
コード例 #4
0
 /**
  * format
  * This format the string url according to settings.
  */
 public static function format($url)
 {
     if (AmpConfig::get('stream_beautiful_url')) {
         $url = str_replace('index.php?&', '', $url);
         $url = str_replace('index.php?', '', $url);
         $url = str_replace('&', '/', $url);
         $url = str_replace('=', '/', $url);
     }
     return $url;
 }
コード例 #5
0
ファイル: MOTDHome.plugin.php プロジェクト: ivan801/ampache
 /**
  * display_home
  * This display the module in home page
  */
 public function display_home()
 {
     if (@is_readable(AmpConfig::get('prefix') . '/config/motd.php')) {
         echo '<div id="motd">';
         UI::show_box_top(T_('Message of the Day'));
         require_once AmpConfig::get('prefix') . '/config/motd.php';
         UI::show_box_bottom();
         echo '</div>';
     }
 }
コード例 #6
0
ファイル: ShoutHome.plugin.php プロジェクト: bl00m/ampache
 /**
  * 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";
     }
 }
コード例 #7
0
ファイル: openid.class.php プロジェクト: nioc/ampache
 public static function get_policies()
 {
     $openid_required_pape = AmpConfig::get('openid_required_pape');
     $policies = array();
     if (!empty($openid_required_pape)) {
         $papes = explode(',', $openid_required_pape);
         foreach ($papes as $pape) {
             $policies[] = constant($pape);
         }
     }
     return $policies;
 }
コード例 #8
0
ファイル: plugin.class.php プロジェクト: ivan801/ampache
 /**
  * get_plugins
  * This returns an array of plugin names
  */
 public static function get_plugins($type = '')
 {
     // make static cache for optimization when multiple call
     static $plugins_list = array();
     if (isset($plugins_list[$type])) {
         return $plugins_list[$type];
     }
     $plugins_list[$type] = array();
     // Open up the plugin dir
     $basedir = AmpConfig::get('prefix') . '/modules/plugins';
     $handle = opendir($basedir);
     if (!is_resource($handle)) {
         debug_event('Plugins', 'Unable to read plugins directory', '1');
     }
     // Recurse the directory
     while (false !== ($file = readdir($handle))) {
         if ($file === '.' || $file === '..') {
             continue;
         }
         // Take care of directories only
         if (!is_dir($basedir . '/' . $file)) {
             debug_event('Plugins', $file . ' is not a directory.', 3);
             continue;
         }
         // Make sure the plugin base file exists inside the plugin directory
         if (!file_exists($basedir . '/' . $file . '/' . $file . '.plugin.php')) {
             debug_event('Plugins', 'Missing class for ' . $file, 3);
             continue;
         }
         if ($type != '') {
             $plugin = new Plugin($file);
             if (!Plugin::is_installed($plugin->_plugin->name)) {
                 debug_event('Plugins', 'Plugin ' . $plugin->_plugin->name . ' is not installed, skipping', 6);
                 continue;
             }
             if (!$plugin->is_valid()) {
                 debug_event('Plugins', 'Plugin ' . $file . ' is not valid, skipping', 6);
                 continue;
             }
             if (!method_exists($plugin->_plugin, $type)) {
                 debug_event('Plugins', 'Plugin ' . $file . ' does not support ' . $type . ', skipping', 6);
                 continue;
             }
         }
         // It's a plugin record it
         $plugins_list[$type][$file] = $file;
     }
     // end while
     // Little stupid but hey
     ksort($plugins_list[$type]);
     return $plugins_list[$type];
 }
コード例 #9
0
ファイル: i18n.php プロジェクト: axelsimon/ampache
/**
 * load_gettext
 * Sets up our local gettext settings.
 *
 * @return void
 */
function load_gettext()
{
    $lang = AmpConfig::get('lang');
    $charset = AmpConfig::get('site_charset') ?: 'UTF-8';
    $locale = $lang . '.' . $charset;
    //debug_event('i18n', 'Setting locale to ' . $locale, 5);
    T_setlocale(LC_MESSAGES, $locale);
    /* Bind the Text Domain */
    T_bindtextdomain('messages', AmpConfig::get('prefix') . "/locale/");
    T_bind_textdomain_codeset('messages', $charset);
    T_textdomain('messages');
    //debug_event('i18n', 'gettext is ' . (locale_emulation() ? 'emulated' : 'native'), 5);
}
コード例 #10
0
 /**
  * show_agreement
  * This shows the registration agreement, /config/registration_agreement.php
  */
 public static function show_agreement()
 {
     $filename = AmpConfig::get('prefix') . '/config/registration_agreement.php';
     if (!file_exists($filename)) {
         return false;
     }
     /* Check for existance */
     $fp = fopen($filename, 'r');
     if (!$fp) {
         return false;
     }
     $data = fread($fp, filesize($filename));
     /* Scrub and show */
     echo $data;
 }
コード例 #11
0
ファイル: plugin.class.php プロジェクト: nioc/ampache
 /**
  * get_plugins
  * This returns an array of plugin names
  */
 public static function get_plugins($type = '')
 {
     // make static cache for optimization when multiple call
     static $plugins_list = array();
     if (isset($plugins_list[$type])) {
         return $plugins_list[$type];
     }
     $plugins_list[$type] = array();
     // Open up the plugin dir
     $handle = opendir(AmpConfig::get('prefix') . '/modules/plugins');
     if (!is_resource($handle)) {
         debug_event('Plugins', 'Unable to read plugins directory', '1');
     }
     // Recurse the directory
     while (false !== ($file = readdir($handle))) {
         // Ignore non-plugin files
         if (substr($file, -10, 10) != 'plugin.php') {
             continue;
         }
         if (is_dir($file)) {
             continue;
         }
         $plugin_name = basename($file, '.plugin.php');
         if ($type != '') {
             $plugin = new Plugin($plugin_name);
             if (!Plugin::is_installed($plugin->_plugin->name)) {
                 debug_event('Plugins', 'Plugin ' . $plugin->_plugin->name . ' is not installed, skipping', 6);
                 continue;
             }
             if (!$plugin->is_valid()) {
                 debug_event('Plugins', 'Plugin ' . $plugin_name . ' is not valid, skipping', 6);
                 continue;
             }
             if (!method_exists($plugin->_plugin, $type)) {
                 debug_event('Plugins', 'Plugin ' . $plugin_name . ' does not support ' . $type . ', skipping', 6);
                 continue;
             }
         }
         // It's a plugin record it
         $plugins_list[$type][$plugin_name] = $plugin_name;
     }
     // end while
     // Little stupid but hey
     ksort($plugins_list[$type]);
     return $plugins_list[$type];
 }
コード例 #12
0
 /**
  * get_past_events
  * Returns a list of past events
  * @param Artist $artist
  * @return SimpleXMLElement|boolean
  */
 public static function get_past_events(Artist $artist)
 {
     if (isset($artist->mbid)) {
         $query = 'mbid=' . rawurlencode($artist->mbid);
     } else {
         $query = 'artist=' . rawurlencode($artist->name);
     }
     $limit = AmpConfig::get('concerts_limit_past');
     if ($limit) {
         $query .= '&limit=' . $limit;
     }
     $xml = Recommendation::get_lastfm_results('artist.getpastevents', $query);
     if ($xml->events) {
         return $xml->events;
     }
     return false;
 }
コード例 #13
0
 /**
  * display_home
  * This display the module in home page
  */
 public function display_home()
 {
     if (AmpConfig::get('sociable')) {
         $user_id = $GLOBALS['user']->id;
         if ($user_id) {
             $activities = Useractivity::get_friends_activities($user_id, $this->maxitems);
             if (count($activities) > 0) {
                 UI::show_box_top(T_('Friends Timeline'));
                 Useractivity::build_cache($activities);
                 foreach ($activities as $aid) {
                     $activity = new Useractivity($aid);
                     $activity->show();
                 }
                 UI::show_box_bottom();
             }
         }
     }
 }
コード例 #14
0
ファイル: Paypal.plugin.php プロジェクト: bl00m/ampache
 /**
  * display_user_field
  * This display the module in user page
  */
 public function display_user_field(library_item $libitem = null)
 {
     $name = $libitem != null ? $libitem->get_fullname() : T_('User') . " `" . $this->user->fullname . "` " . T_('on') . " " . AmpConfig::get('site_title');
     $lang = substr(AmpConfig::get('lang'), 0, 2);
     if (empty($lang)) {
         $lang = 'US';
     }
     echo "<form action='https://www.paypal.com/cgi-bin/webscr' method='post' target='_top'>\n";
     echo "<input type='hidden' name='cmd' value='_donations'>\n";
     echo "<input type='hidden' name='business' value='" . scrub_out($this->business) . "'>\n";
     echo "<input type='hidden' name='lc' value='" . $lang . "'>\n";
     echo "<input type='hidden' name='item_name' value='" . $name . "'>\n";
     echo "<input type='hidden' name='no_note' value='0'>\n";
     echo "<input type='hidden' name='currency_code' value='" . scrub_out($this->currency_code) . "'>\n";
     echo "<input type='hidden' name='bn' value='PP-DonationsBF:btn_donate_SM.gif:NonHostedGuest'>\n";
     echo "<input type='image' src='https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif' border='0' name='submit' alt='PayPal - The safer, easier way to pay online!'>\n";
     echo "<img alt='' border='0' src='https://www.paypalobjects.com/fr_XC/i/scr/pixel.gif' width='1' height='1'>\n";
     echo "</form>\n";
 }
コード例 #15
0
ファイル: slideshow.class.php プロジェクト: nioc/ampache
 protected static function get_images($artist_name)
 {
     $images = array();
     if (AmpConfig::get('echonest_api_key')) {
         $echonest = new EchoNest_Client(new EchoNest_HttpClient_Requests());
         $echonest->authenticate(AmpConfig::get('echonest_api_key'));
         try {
             $images = $echonest->getArtistApi()->setName($artist_name)->getImages();
         } catch (Exception $e) {
             debug_event('echonest', 'EchoNest artist images error: ' . $e->getMessage(), '1');
         }
     }
     foreach (Plugin::get_plugins('get_photos') as $plugin_name) {
         $plugin = new Plugin($plugin_name);
         if ($plugin->load($GLOBALS['user'])) {
             $images += $plugin->_plugin->get_photos($artist_name);
         }
     }
     return $images;
 }
コード例 #16
0
ファイル: batch.lib.php プロジェクト: axelsimon/ampache
/**
 * send_zip
 *
 * takes array of full paths to songs
 * zips them and sends them
 *
 * @param    string    $name    name of the zip file to be created
 * @param    array    $song_files    array of full paths to songs to zip create w/ call to get_song_files
 */
function send_zip($name, $song_files)
{
    // Check if they want to save it to a file, if so then make sure they've
    // got a defined path as well and that it's writable.
    $basedir = '';
    if (AmpConfig::get('file_zip_download') && AmpConfig::get('tmp_dir_path')) {
        // Check writeable
        if (!is_writable(AmpConfig::get('tmp_dir_path'))) {
            $in_memory = '1';
            debug_event('Error', 'File Zip Path:' . AmpConfig::get('tmp_dir_path') . ' is not writable', '1');
        } else {
            $in_memory = '0';
            $basedir = AmpConfig::get('tmp_dir_path');
        }
    } else {
        $in_memory = '1';
    }
    // if file downloads
    /* Require needed library */
    require_once AmpConfig::get('prefix') . '/modules/archive/archive.lib.php';
    $arc = new zip_file($name . ".zip");
    $options = array('inmemory' => $in_memory, 'basedir' => $basedir, 'storepaths' => 0, 'level' => 0, 'comment' => AmpConfig::get('file_zip_comment'), 'type' => "zip");
    $arc->set_options($options);
    foreach ($song_files as $dir => $files) {
        $arc->add_files($files, $dir);
    }
    if (count($arc->error)) {
        debug_event('archive', "Error: unable to add songs", '3');
        return false;
    }
    // if failed to add songs
    if (!$arc->create_archive()) {
        debug_event('archive', "Error: unable to create archive", '3');
        return false;
    }
    // if failed to create archive
    $arc->download_file();
}
コード例 #17
0
ファイル: show_songs.inc.php プロジェクト: axelsimon/ampache
    ?>
</th>
        <?php 
}
?>
        <?php 
if (AmpConfig::get('userflags')) {
    ?>
            <th class="cel_userflag"></th>
        <?php 
}
?>
            <th class="cel_action"></th>
        <?php 
if (isset($argument) && $argument) {
    ?>
            <th class="cel_drag"></th>
        <?php 
}
?>
        </tr>
    </tfoot>
</table>
<script src="<?php 
echo AmpConfig::get('web_path');
?>
/lib/javascript/tabledata.js" language="javascript" type="text/javascript"></script>
<?php 
if ($browse->get_show_header()) {
    require AmpConfig::get('prefix') . '/templates/list_header.inc.php';
}
コード例 #18
0
ファイル: init.php プロジェクト: nioc/ampache
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
 *
 * LICENSE: GNU General Public License, version 2 (GPLv2)
 * Copyright 2001 - 2015 Ampache.org
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License v2
 * as published by the Free Software Foundation.
 *
 * 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 */
require_once '../../lib/class/plex_xml_data.class.php';
$ow_config = array('http_host' => $_SERVER["SERVER_NAME"] . ':' . $_SERVER["SERVER_PORT"], 'web_path' => '/web');
require_once '../../lib/init.php';
if (!AmpConfig::get('plex_backend')) {
    echo "Disabled.";
    exit;
}
if (!defined('NO_SESSION') && !Access::check('interface', '100')) {
    echo T_('Unauthorized.');
    exit;
}
コード例 #19
0
ファイル: mail.php プロジェクト: cheese1/ampache
            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();
コード例 #20
0
ファイル: search.class.php プロジェクト: cheese1/ampache
 /**
  * playlist_to_sql
  *
  * Handles the generation of the SQL for playlist searches.
  */
 private function playlist_to_sql()
 {
     $sql_logic_operator = $this->logic_operator;
     $where = array();
     $table = array();
     $join = array();
     $group = array();
     $having = array();
     foreach ($this->rules as $rule) {
         $type = $this->name_to_basetype($rule[0]);
         $operator = array();
         foreach ($this->basetypes[$type] as $op) {
             if ($op['name'] == $rule[1]) {
                 $operator = $op;
                 break;
             }
         }
         $input = $this->_mangle_data($rule[2], $type, $operator);
         $sql_match_operator = $operator['sql'];
         $where[] = "`playlist`.`type` = 'public'";
         switch ($rule[0]) {
             case 'name':
                 $where[] = "`playlist`.`name` {$sql_match_operator} '{$input}'";
                 break;
             default:
                 // Nihil
                 break;
         }
         // switch on ruletype
     }
     // foreach rule
     $join['playlist_data'] = true;
     $join['song'] = $join['song'] || AmpConfig::get('catalog_disable');
     $join['catalog'] = AmpConfig::get('catalog_disable');
     $where_sql = implode(" {$sql_logic_operator} ", $where);
     if ($join['playlist_data']) {
         $table['playlist_data'] = "LEFT JOIN `playlist_data` ON `playlist_data`.`playlist` = `playlist`.`id`";
     }
     if ($join['song']) {
         $table['song'] = "LEFT JOIN `song` ON `song`.`id`=`playlist_data`.`object_id`";
         $where_sql .= " AND `playlist_data`.`object_type` = 'song'";
         if ($join['catalog']) {
             $table['catalog'] = "LEFT JOIN `catalog` AS `catalog_se` ON `catalog_se`.`id`=`song`.`catalog`";
             $where_sql .= " AND `catalog_se`.`enabled` = '1'";
         }
     }
     $table_sql = implode(' ', $table);
     $group_sql = implode(', ', $group);
     $having_sql = implode(" {$sql_logic_operator} ", $having);
     return array('base' => 'SELECT DISTINCT(`playlist`.`id`) FROM `playlist`', 'join' => $join, 'where' => $where, 'where_sql' => $where_sql, 'table' => $table, 'table_sql' => $table_sql, 'group_sql' => $group_sql, 'having_sql' => $having_sql);
 }
コード例 #21
0
    ?>
        <a rel="nohtml" href="<?php 
    echo AmpConfig::get('web_path');
    ?>
/batch.php?action=playlist&amp;id=<?php 
    echo $libitem->id;
    ?>
">
            <?php 
    echo UI::get_icon('batch_download', T_('Batch Download'));
    ?>
        </a>
<?php 
}
if (Access::check('interface', '25')) {
    if (AmpConfig::get('share')) {
        Share::display_ui('playlist', $libitem->id, false);
    }
}
if ($libitem->has_access()) {
    ?>
    <a id="<?php 
    echo 'edit_playlist_' . $libitem->id;
    ?>
" onclick="showEditDialog('playlist_row', '<?php 
    echo $libitem->id;
    ?>
', '<?php 
    echo 'edit_playlist_' . $libitem->id;
    ?>
', '<?php 
コード例 #22
0
ファイル: stream.php プロジェクト: axelsimon/ampache
// end action switch
// See if we need a special streamtype
switch ($_REQUEST['action']) {
    case 'download':
        $stream_type = 'download';
        break;
    case 'democratic':
        // Don't let them loop it
        // FIXME: This looks hacky
        if (AmpConfig::get('play_type') == 'democratic') {
            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)) {
    $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);
}
コード例 #23
0
 /**
  * _auto_init
  * Load in the cache settings once so we can avoid function calls
  */
 public static function _auto_init()
 {
     self::$_enabled = AmpConfig::get('memory_cache');
 }
コード例 #24
0
ファイル: show_podcasts.inc.php プロジェクト: bl00m/ampache
        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');
}
コード例 #25
0
ファイル: browse.class.php プロジェクト: nioc/ampache
 public function show_next_link($argument = null)
 {
     $limit = $this->get_offset();
     $start = $this->get_start();
     $total = $this->get_total();
     $next_offset = $start + $limit;
     if ($next_offset <= $total) {
         echo '<a class="jscroll-next" href="' . AmpConfig::get('ajax_url') . '?page=browse&action=page&browse_id=' . $this->id . '&start=' . $next_offset . '&xoutput=raw&xoutputnode=' . $this->get_content_div() . '&show_header=false' . $argument . '">' . T_('More') . '</a>';
     }
 }
コード例 #26
0
ファイル: Lastfm.plugin.php プロジェクト: cheese1/ampache
 /**
  * load
  * This loads up the data we need into this object, this stuff comes
  * from the preferences.
  */
 public function load($user)
 {
     $this->api_key = AmpConfig::get('lastfm_api_key');
     $this->secret = AmpConfig::get('lastfm_api_secret');
     $user->set_preferences();
     $data = $user->prefs;
     $this->user_id = $user->id;
     // check if user have a session key
     if (strlen(trim($data['lastfm_challenge']))) {
         $this->challenge = trim($data['lastfm_challenge']);
     } else {
         debug_event($this->name, 'No session key, not scrobbling (need to grant Ampache to last.fm)', '5');
         return false;
     }
     return true;
 }
コード例 #27
0
<td class="cel_userflag" id="userflag_<?php 
    echo $artist->id;
    ?>
_artist"><?php 
    Userflag::show($artist->id, 'artist');
    ?>
</td>
<?php 
}
?>
<td class="cel_action">
<?php 
if (Access::check_function('batch_download')) {
    ?>
    <a href="<?php 
    echo AmpConfig::get('web_path');
    ?>
/batch.php?action=artist&amp;id=<?php 
    echo $artist->id;
    ?>
">
            <?php 
    echo UI::get_icon('batch_download', '', T_('Batch Download'));
    ?>
        </a>
<?php 
}
if (Access::check('interface', '50')) {
    ?>
    <a id="<?php 
    echo 'edit_artist_' . $artist->id;
コード例 #28
0
if ($artists) {
    ?>
<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>
コード例 #29
0
ファイル: tag.class.php プロジェクト: nioc/ampache
 /**
  * get_display
  * This returns a csv formated version of the tags that we are given
  * it also takes a type so that it knows how to return it, this is used
  * by the formating functions of the different objects
  */
 public static function get_display($tags, $link = false, $filter_type = '')
 {
     //debug_event('tag.class.php', 'Get display tags called...', '5');
     if (!is_array($tags)) {
         return '';
     }
     $results = '';
     // Iterate through the tags, format them according to type and element id
     foreach ($tags as $tag_id => $value) {
         /*debug_event('tag.class.php', $tag_id, '5');
           foreach ($value as $vid=>$v) {
               debug_event('tag.class.php', $vid.' = {'.$v.'}', '5');
           }*/
         if ($link) {
             $results .= '<a href="' . AmpConfig::get('web_path') . '/browse.php?action=tag&show_tag=' . $value['id'] . (!empty($filter_type) ? '&type=' . $filter_type : '') . '" title="' . $value['name'] . '">';
         }
         $results .= $value['name'];
         if ($link) {
             $results .= '</a>';
         }
         $results .= ', ';
     }
     $results = rtrim($results, ', ');
     return $results;
 }
コード例 #30
-1
ファイル: i18n.php プロジェクト: bl00m/ampache
/**
 * load_gettext
 * Sets up our local gettext settings.
 *
 * @return void
 */
function load_gettext()
{
    $lang = AmpConfig::get('lang');
    $popath = AmpConfig::get('prefix') . '/locale/' . $lang . '/LC_MESSAGES/messages.po';
    $t = new Translator();
    if (file_exists($popath)) {
        $translations = Gettext\Translations::fromPoFile($popath);
        $t->loadTranslations($translations);
    }
    $t->register();
}