/zina/theme.php
PHP | 2627 lines | 2098 code | 335 blank | 194 comment | 409 complexity | 40374136df0ede9f79ec5558f4bcf280 MD5 | raw file
Large files files are truncated, but you can click here to view the full file
- <?php
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * ZINA2 (Zina2 is not Zina)
- *
- * Zina2 is a graphical interface to your MP3 collection, a personal
- * jukebox, an MP3 streamer. It can run on its own, embeded into an
- * existing website, or as a Drupal/Joomla/Wordpress/etc. module.
- *
- * https://bitbucket.org/helmespc/zina2
- * Author: Patrick Helmes <helmespc@gmail.com>
- * Support: https://bitbucket.org/helmespc/zina2/wiki/Home
- * License: GNU GPL2 <http://www.gnu.org/copyleft/gpl.html>
- *
- * This Software is a fork of Zina (is not Andromeda):
- * http://www.pancake.org/zina
- * Author: Ryan Lathouwers <ryanlath@pacbell.net>
- * Support: http://sourceforge.net/projects/zina/
- * License: GNU GPL2 <http://www.gnu.org/copyleft/gpl.html>
- *
- * TODO:
- * - organize this file
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
- /*
- * YOU SHOULD NOT MODIFY THIS FILE...
- *
- * You should override all these functions in your own theme:
- * 1) Copy a theme folder
- * 2) in MYTHEME/index.php copy any function you want to
- * override into that file
- * 3) rename that function to MYTHEME_function()
- * - e.g. ztheme_icon -> MYTHEME_icon
- * 4) modify that function to suit your needs
- * x) An easy way to see what a function is passing is zdbg($var);
- */
-
- /*
- * Complete Page (Standalone)
- */
- function ztheme_page_complete($zina) {
- $theme_path = $zina['theme_path'];
-
- $output = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'.
- '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><title>'.$zina['title'].'</title>'.
- '<meta http-equiv="Content-Type" content="text/html; charset='.$zina['charset'].'" />'.
- '<link rel="shortcut icon" href="'.$theme_path.'/zina.ico" type="image/x-icon" />'.
- '<link rel="stylesheet" href="'.$theme_path.'/index.css" type="text/css" />'.
- '<!--[if lt IE 7]><link type="text/css" rel="stylesheet" media="all" href="'.$theme_path.'/fix-ie.css" /><![endif]-->'.
- $zina['head_html'].$zina['head_css'].$zina['head_js'].'</head><body>';
-
- $output .= '<div id="header-region" class="clear-block"></div>'.
- '<div id="wrapper"><div id="container" class="clear-block">'.
- '<div id="header"><h1>'.$zina['title'].'</h1>'.
- '<div class="header-right">';
-
- if (isset($zina['dir_year']) || isset($zina['dir_genre'])) {
- $output .= '<span class="title_details">';
- if (isset($zina['dir_genre'])) $output .= $zina['dir_genre'];
- if (!empty($zina['dir_year'])) $output .= ' ('.$zina['dir_year'].')';
- $output .= '</span>';
- }
-
- $output .= '</div></div>'.
- '<div id="center"><div class="right-corner"><div class="left-corner">'.
- '<div class="breadcrumb">'.ztheme('breadcrumb',$zina['breadcrumb']).'</div>'.
- '<div class="breadcrumb-right">';
-
- if (isset($zina['admin_config'])) {
- $output .= zl(ztheme('icon','config.gif',zt('Settings')),$zina['admin_config']['path'],$zina['admin_config']['query']);
- }
- $lang['login'] = zt('Login');
- $lang['logout'] = zt('Logout');
- if (isset($zina['login'])) {
- $output .= zl(ztheme('icon',$zina['login']['type'].'.gif',$lang[$zina['login']['type']]), $zina['login']['path'], $zina['login']['query']);
- }
-
- $output .= '</div><div id="zina" class="clear-block">';
- if (!isset($zina['popup'])) {
- $output .= '<div class="subheader clear-block"><div class="subheader-left">'.$zina['searchform'].'</div>'.
- '<div class="subheader-right">'.$zina['randomplayform'].'</div></div>';
- if (!empty($zina['zinamp']) && (!isset($zina['page_main']) || isset($zina['category']))) {
- $output .= '<div style="text-align:right;">'.$zina['zinamp'].'</div>';
- }
- }
-
- $output .= '<div id="zina_messages">'.$zina['messages'].'</div>'.$zina['content'].ztheme('page_footer',$zina).
- '</div></div></div></div></div></div></body></html>';
-
- return $output;
- }
-
- function ztheme_page_main($zina) {
- $path = $zina['path'];
- $output = '';
-
- $lang['dir'] = zt('Edit Text');
- $lang['dir_opts'] = zt('Options');
- $lang['podcast'] = zt('Edit Podcast');
- $lang['rename'] = zt('Rename');
- $lang['images'] = zt('Edit Images');
- $lang['tags'] = zt('Edit Tags');
-
- if (isset($zina['category'])) {
- if (!empty($zina['description']) || isset($zina['dir_edit_opts'])) {
- $output .= '<table border="0" cellpadding="5" cellspacing="0" width="100%">'.
- '<tr><td valign="top" width="100%">';
- if (!empty($zina['description'])) $output .= '<p>'.$zina['description'].'</p>';
-
- # todo: dup with below...
- if (isset($zina['dir_edit_opts'])) {
- $options = array();
- foreach ($zina['dir_edit_opts'] as $opt => $opts) {
- $options[] = zl($lang[$opt],$opts['path'], $opts['query']);
- }
- $output .= '<p class="small">';
- $output .= implode(' | ', $options);
- $output .= '</p>';
- }
- $output .= '</td></tr></table>';
- }
-
- if (isset($zina['category']) && !empty($zina['category']['sort'])) {
- $output .= '<table width="100%"><tr><td class="quarterwidth">'.$zina['category']['sort'].'</td>';
- if (isset($zina['category']['navigation'])) {
- $output .= '<td class="halfwidth" align="center">'.$zina['category']['navigation'].'</td>'.
- '<td class="quarterwidth"></td>';
- }
- $output .= '</tr></table>';
- } else {
- if (isset($zina['category']['navigation'])) $output .= $zina['category']['navigation'];
- }
-
- $output .= ''.$zina['category']['content'];
-
- if (isset($zina['category']['navigation'])) $output .= $zina['category']['navigation'];
- } else {
- $output .= '<div class="section">';
- $subdirs = ($zina['subdir_num'] > 0);
- $altdirs = ($zina['alt_num'] > 0);
-
- if (($subdirs && $zina['dir_list']) || $altdirs || isset($zina['alt_list_edit']) || !empty($zina['zinamp']) || $zina['pls_included']) {
- $output .= '<div class="directory_list">';
- if (!empty($zina['zinamp'])) $output .= '<div style="margin-bottom:5px;">'.$zina['zinamp'].'</div>';
- $form_content = '';
- if ($subdirs && $zina['dir_list']) $form_content .= ztheme('directory_list', $zina['subdirs'], $zina['subdir_truncate']);
-
- if ($altdirs || isset($zina['alt_list_edit'])) {
- $form_content .= ztheme('directory_alt_list', $zina['alt_items'], $zina['subdir_truncate']);
- if (isset($zina['alt_list_edit'])) {
- $form_content .= '<div class="small">'.zl(zt('Edit "See Also"'),$path,$zina['alt_list_edit']['query']).'</div>';
- }
- }
-
- if ($zina['pls_included']) {
- $form_content .= '<div style="margin:10px 0 10px 0">'.ztheme('playlists_block', $zina['pls_included']['items'], $zina['subdir_truncate']);
- if (isset($zina['pls_included']['more'])) {
- $form_content .= '<div class="small">'.zl(zt('More'),$zina['pls_included']['more']['path'],$zina['pls_included']['more']['query']).'</div>';
-
- }
-
- $form_content .= '</div>';
- }
-
- $output .= (!empty($zina['list_form_opts'])) ? ztheme('form', $zina['list_form_opts'], $form_content.$zina['list_form']) : $form_content;
- if ($zina['amg']) {
- $output .= '<div class="amg">'.ztheme('amg',$zina).'</div>';
- }
- $output .= '</div>';
- }
- if (isset($zina['dir_image'])) $output .= '<div class="directory-image">'.$zina['dir_image'].'</div>';
- if (isset($zina['dir_opts'])) {
- $output .= '<p class="dir-opts">'.ztheme('dir_opts',$zina['dir_opts'],$zina['title_raw']).'</p>';
- }
-
- $votes = (isset($zina['dir_rating']) && $zina['dir_rating']['sum_votes'] > 0);
- if ($votes || isset($zina['dir_rate'])) {
- $output .= '<p class="small">';
- if ($votes) {
- $output .= ztheme('rating_display', $zina['dir_rating']['sum_rating']).
- ztheme('votes_display',$zina['dir_rating']['sum_votes']);
- if (isset($zina['dir_rate'])) $output .= ' | ';
- }
- if (isset($zina['dir_rate'])) $output .= zt('Rate').': '.$zina['dir_rate'];
- $output .= '</p>';
- }
-
- if (isset($zina['description'])) $output .= $zina['description'];
- if (isset($zina['podcast'])) {
- $type = $zina['podcast']['type'];
- $icon_title = ($type == 'podcast') ? zt('Podcast') : zt('RSS Feed');
- $output .= '<p>'.zl(ztheme('icon',$type.'.gif', $icon_title),$zina['podcast']['url'],$zina['podcast']['query']).'</p>';
- }
-
- $output .= ztheme('addthis', $zina, 'bookmark');
-
- if (isset($zina['dir_edit_opts'])) {
- $options = array();
- foreach ($zina['dir_edit_opts'] as $opt => $opts) {
- $options[] = zl($lang[$opt],$opts['path'], $opts['query']);
- }
- $output .= '<p class="small">';
- $output .= implode(' | ', $options);
- $output .= '</p>';
- }
-
- $output .= '</div>';
-
- if ($subdirs && $zina['subdir_images']) {
- $output .= '<div class="section">'.ztheme('image_list', $zina['subdirs'], $zina['subdir_cols']).'</div>';
- }
-
- if ($altdirs) {
- $output .= '<div class="section">'.ztheme('image_alt_list', $zina['alt_items'], $zina['subdir_cols']).'</div>';
- }
- }
-
- if (isset($zina['songs'])) $output .= '<div class="section">'.$zina['songs'].'</div>';
-
- if (isset($zina['multimedia'])) {
- $output .= '<div class="section">'.
- ztheme('multimedia_section', ztheme('multimedia_list', $zina['multimedia'])).
- '</div>';
- }
- return $output;
- }
-
- #todo: try <ul>
- function ztheme_category($dirs, $cols, $images = false, $truncate = 25, $full_page_split = false) {
- $output = '';
- if (!empty($dirs)) {
-
- if ($images) {
- if ($full_page_split) {
- $output = '';
- foreach($dirs as $letter => $items) {
- if (strlen($letter) > 3) {
- $output .= '<h1 class="zina-cat-letter"><a name="'.strtolower($letter).'" href="'.zurl($letter).'" class="zina-cat-letter">'.$letter.'</a></h1>';
- } else {
- $letter = ($letter == 'zzz') ? zt('Other') : $letter;
- $output .= '<h1 class="zina-cat-letter">'.$letter.'<a name="'.strtolower($letter).'" class="zina-cat-letter" /></h1>';
- }
- $output .= '<br style="clear:both;"/>'.ztheme('image_list_category', $items, $cols);
- }
- return $output;
- } else {
- return ztheme('image_list_category', $dirs, $cols);
- }
- }
-
- $columns = $i = $row = 0;
- $letter_height = 3;
- $items = ($full_page_split) ? $full_page_split + (count($dirs)*$letter_height) : count($dirs);
- $rows_in_col = ceil($items/$cols);
- if ($rows_in_col < $cols) $cols = ceil($items/$rows_in_col);
- $col_width = round(100/$cols);
- $img_new = ztheme('icon','new.gif',zt('New'));
-
- zina_set_css('inline','.catcolwidth{width:'.$col_width.'%;}');
-
- $output .= '<table width="100%" class="category"><tr>';
-
- if ($full_page_split) {
- zina_set_css('inline', 'td.catcolwidth a{margin-left:5px;}');
- $first = true;
- foreach($dirs as $letter => $dir) {
- $count = count($dir) + $letter_height;
- $row += $count;
-
- if (($first || $row > $rows_in_col + ($letter_height*2)) && $columns < $cols) {
- $row = $count;
- if (!$first) $output .= '</td>';
- $output .= '<td class="catcolwidth'.(($cols != ++$i) ? ' category_cols' : '').'" valign="top">';
- $first = false;
- $columns++;
- } else {
- $output .= "<br/>\n";
- }
-
- if (strlen($letter) > 3) {
- $output .= '<h1 class="zina-cat-letter"><a name="'.strtolower($letter).'" href="'.zurl($letter).'" class="zina-cat-letter">'.$letter.'</a></h1>';
- } else {
- $letter = ($letter == 'zzz') ? zt('Other') : $letter;
- $output .= '<h1 class="zina-cat-letter">'.$letter.'<a name="'.strtolower($letter).'" class="zina-cat-letter" /></h1>';
- }
-
- foreach($dir as $key => $opts) {
- $title = ztheme('truncate', $opts['title'], $truncate);
- $output .= zl($title,$opts['path'],$opts['query']);
- if ($opts['new']) $output .= ' '.$img_new;
- $output .= ' <br/>'."\n";
- }
- }
- $output .= '</td>'."\n";
- } else {
- foreach ($dirs as $opts) {
- if ($row == 0) {
- $output .= '<td class="catcolwidth'.(($cols != ++$i) ? ' category_cols' : '').'" valign="top">';
- }
- $title = ztheme('truncate', $opts['title'], $truncate);
- $output .= zl($title,$opts['path'],$opts['query']);
- if ($opts['new']) $output .= ' '.$img_new;
- $output .= '<br/>'."\n";
-
- $row = ++$row % $rows_in_col;
- if ($row == 0) $output .= '</td>';
- }
- if ($row != 0) $output .= '</td>';
- }
- $output .= '</tr></table>';
- }
- return $output;
- }
-
- /*
- * Category Pages Navigation
- *
- * e.g. Start - First - 1 - 2 - Next - Last
- */
- function ztheme_category_pages($path, $current, $total, $query='') {
- $output = '';
- if ($total > 1) {
- $output .= '<div class="category_pages">';
- if ($current != 1) {
- $output .= zl(ztheme('icon','first.gif',zt('First')),$path,$query.'page=1');
- $output .= zl(ztheme('icon','back.gif',zt('Previous')),$path,$query.'page='.($current-1));
- } else {
- $output .= ztheme('icon','first_un.gif',zt('First'));
- $output .= ztheme('icon','back_un.gif',zt('Previous'));
- }
- $output .= ' ';
- for($i=1;$i<=$total;$i++) {
- $arr[] = ($current == $i) ? "<strong>$i</strong>" : zl($i,$path,$query.'page='.$i);
- }
- $output .= implode(' · ',$arr);
- $output .= ' ';
- if ($current == $total) {
- $output .= ztheme('icon','forward_un.gif',zt('Next'));
- $output .= ztheme('icon','last_un.gif',zt('Last'));
- } else {
- $output .= zl(ztheme('icon','forward.gif',zt('Next')),$path,$query.'page='.($current+1));
- $output .= zl(ztheme('icon','last.gif',zt('Last')),$path,$query.'page='.$total);
- }
- $output .= '</div>';
- }
- return $output;
- }
-
- /*
- * Category Alphabet Navigation
- *
- * e.g. A - B - C - D...
- */
- function ztheme_category_alphabet($path, $current, $letters, $query='', $full_page = false) {
- $output = '<div class="category_pages">';
- if ($full_page) {
- foreach ($letters as $key) {
- $letter = ($key == 'zzz') ? zt('Other') : $key;
- $links[] = zl($letter,$path,$query,strtolower($letter));
- }
- } else {
- foreach ($letters as $key) {
- $letter = ($key == 'zzz') ? zt('Other') : $key;
- $links[] = ($current == $key) ? "<strong>$letter</strong>" : zl($letter,$path,$query.'page='.$key);
- }
- }
- $output .= implode(' · ',$links);
- return $output.'</div>';
- }
-
- /*
- * Category Split by Alphabet helper
- */
- function ztheme_category_alphabet_split($dirs, $sort_ignore) {
- $splits = array();
- foreach ($dirs as $key=>$item) {
- $key = $item['title'];
- if ($item['person']) {
- if (($pos = strripos($key, ' ')) !== false) {
- $letter = zina_strtoupper(zcheck_utf8(zina_substr($key, $pos+1,1)));
- } else {
- $letter = zina_strtoupper(zcheck_utf8($key[0]));
- }
- } else if ($sort_ignore && preg_match('/^('.$sort_ignore.')\s/i',$key, $matches)) {
- # ignore certain thing like "the" and "a"
- $letter = zina_strtoupper(zina_substr($key, zina_strlen($matches[1])+1, 1));
- } elseif (preg_match('/^(\W|\d)/', $key, $matches)) {
- # non-alpha characters get grouped together...
- $letter = 'zzz';
- } else {
- # upper and lowercase are same
- $letter = zina_strtoupper(zcheck_utf8($key[0]));
- }
- $splits[$letter][$key] = $item;
- }
- ksort($splits);
- return $splits;
- }
-
- /*
- * Category Sort Alpha/Date
- */
- function ztheme_category_sort($path, $cat) {
- $lang['asc'] = zt('Sort Ascending');
- $lang['desc'] = zt('Sort Descending');
- return '<span class="small">'.zt('Sort').': '.
- zl(zt('Alpha'), $path, $cat['alpha']['query']).' '.
- zl(ztheme('icon','sort_'.$cat['alpha']['sort'].'.gif', $lang[$cat['alpha']['sort']]), $path,$cat['alpha']['query']).
- ' '.
- zl(zt('Date'), $path, $cat['date']['query']).' '.
- zl(ztheme('icon','sort_'.$cat['date']['sort'].'.gif',$lang[$cat['date']['sort']]),$path,$cat['date']['query']).'</span>';
- }
-
- function ztheme_playlists_block($playlists, $truncate=25) {
- $output='';
- if ($playlists) {
- $output .= '<h3>'.zt('Tracks Appear On').'</h3>';
- $output .= ztheme('directory_list_helper', $playlists, $truncate);
- }
- return $output;
- }
-
- function ztheme_directory_list($dirs, $truncate=25) {
- $output='';
- if ($dirs) {
- $output .= '<h3>'.zt('Albums').'</h3>';
- $output .= ztheme('directory_list_helper', $dirs, $truncate);
- }
- return $output;
- }
-
- function ztheme_directory_alt_list($dirs, $truncate=25) {
- $output='';
- $output .= '<h3>'.zt('See Also').'</h3>';
- if ($dirs) {
- $output .= ztheme('directory_list_helper', $dirs, $truncate);
- }
- return $output;
- }
-
- function ztheme_directory_list_helper($dirs, $truncate=25) {
- global $zc;
-
- $lang['play'] = zt('Play');
- $lang['play_lofi'] = zt('Play Low Fidelity');
- $lang['download'] = zt('Download');
- $lang['play_rec'] = zt('Play recursively');
- $lang['play_rec_rand'] = zt('Play recursively random');
-
- $class = "zinamp";
-
- $img_new = ztheme('icon','new.gif',zt('New'));
- $output = '<ul>';
- foreach ($dirs as $opts) {
- $output .= '<li>';
- if (isset($opts['opts'])) {
- foreach ($opts['opts'] as $type=>$opt) {
- $attr = (substr($type,0,4) == 'play') ? 'class="'.$class.'"' : '';
- //$attr = (substr($type,0,4) == 'play') ? 'class="zinamp"' : '';
- $output .= zl(ztheme('icon',$type.'.gif',$lang[$type]),$opt['path'],$opt['query'], null, false, $attr);
- }
- }
-
- if (isset($opts['checkbox'])) $output .= ztheme('form_checkbox', $opts['checkbox']['name'], $opts['checkbox']['value'], $opts['checkbox']['checked']).' ';
-
- $title = ztheme('truncate', $opts['title'], $truncate);
-
- $output .= zl($title,$opts['path'], isset($opts['query']) ? $opts['query'] : null);
- if (!empty($opts['info']->year)) $output .= ' ('.$opts['info']->year.')';
- if ($opts['new']) $output .= ' '.$img_new;
- $output .= '</li>';
- }
- $output .= '</ul>';
- return $output;
- }
-
- function ztheme_image_list($dirs, $cols) {
- return '<h3>'.zt('Albums').'</h3>'.ztheme('image_list_helper', $dirs, $cols);
- }
-
- function ztheme_image_alt_list($dirs, $cols) {
- return '<h3>'.zt('See Also').'</h3>'.ztheme('image_list_helper', $dirs, $cols);
- }
-
- function ztheme_image_list_helper($dirs, $cols) {
- $col = 0;
- $col_width = round(100/$cols).'%';
- zina_set_css('inline', 'td.zinaimgcolwidth{width:'.$col_width.';}');
-
- $align[$cols - 1] = 'right';
- $align[0] = 'left';
- for($i=1; $i < $cols - 1; $i++) $align[$i] = 'center';
-
- $first = 1;
- $output = '<table cellpadding="5" width="100%">';
- foreach($dirs as $dir => $opts) {
- if ($col==0) {
- if ($first) {
- $output .= '<tr>';
- $first = false;
- } else {
- $output .= '</tr><tr>';
- }
- }
- #$title = $opts['title'];
-
- $output .= '<td class="zinaimgcolwidth" align="'.$align[$col].'" valign="top">'.$opts['image'].'</td>';
- /*
- * outputs a play icon over album covers
- $output .= '<td class="zinaimgcolwidth" align="'.$align[$col].'" valign="top">'.
- $opts['image'].'<span class="image-inner">'.zl(ztheme('icon','play.gif',zt('Play')),$dir,'l=8&m=0').'</span></td>';
- */
-
- if ($col==$cols) $output .= '</tr>';
- $col = ++$col % $cols;
- }
-
- if ($col <> 0 ) {
- for ($i = $col; $i < $cols; $i++) $output .= '<td class="zinaimgcolwidth"> </td>';
- }
- $output .= '</tr></table>';
-
- return $output;
- }
-
- function ztheme_image_list_category($dirs, $cols) {
- $col = 0;
- $col_width = round(100/$cols).'%';
- zina_set_css('inline','.imglistcatwidth{width:'.$col_width.';}');
-
- $output = '<table cellpadding="0" cellspacing="0" width="100%" class="image-list-category">';
- foreach($dirs as $dir => $opts) {
- if ($col==0) { $row = $row1 = '<tr>'; }
- $row .= '<td class="imglistcatwidth" align="center">'.$opts['image'].'</td>';
- $row1 .= '<td class="imglistcatwidth" align="center" valign="top"><h3>'.zl($opts['title'], $opts['path'], $opts['query']).'</h3></td>';
-
- if (++$col==$cols) { $output .= $row.'</tr>'."\n".$row1.'</tr>'."\n"; }
- $col = $col % $cols;
- }
-
- if ($col <> 0 ) {
- for ($i = $col; $i < $cols; $i++) {
- $row .= '<td class="imglistcatwidth"> </td>';
- $row1 .= '<td class="imglistcatwidth"> </td>';
- }
- $output .= $row.'</tr>'.$row1.'</tr>';
- }
- $output .= '</table>';
- return $output;
- }
-
- #TODO: rename? and then have song_list call "generic" func? use array for opts
- function ztheme_song_list($songs, $various = false, $images = false, $stats = false, $reorder = false, $song_info = true, $checkbox = true) {
- global $zc;
- if (empty($songs)) return '';
-
- $class = "zinamp";
-
- if ($reorder){
- zina_add_tabledrag('table-playlist', 'order', 'sibling', 'order');
- zina_set_css('file', 'extras/tabledrag.css');
- $table_id = ' id="table-playlist"';
- $row_class = 'draggable ';
- $row_id = ' id="order"';
- $row_order = true;
- } else {
- $table_id = $row_class = $row_id = '';
- $row_order = false;
- }
- $img_new = ztheme('icon','new.gif',zt('New'));
- $lang['download'] = zt('Download');
- $lang['play'] = zt('Play');
- $lang['play_lofi'] = zt('Play Low Fidelity');
- $lang['edit'] = zt('Edit');
- $lang['more'] = zt('More');
- #remove next two - > used to be for playlists...test?
- $lang['rename'] = zt('Rename');
- $lang['delete'] = zt('Delete');
-
- $lang['play_lofi'] = zt('Play low fidelity');
- $lang['play_lofi_custom'] = zt('Play custom low fidelity');
- $lang['play_rec'] = zt('Play recursively');
- $lang['play_rec_rand'] = zt('Play recursively random');
-
- $i = $stat_prev = 0;
- $p = 1;
-
- $output = '<table cellpadding="5" cellspacing="0" width="100%"'.$table_id.'>';
-
- foreach($songs as $song) {
- #todo: $class = ++$i % 2 == 0 ? 'even' : 'odd';
- $v = (isset($song['description']) && !$images) ? ' valign="top"' : '';
- $output .= '<tr class="'.$row_class.'row'.$i.'"'.$v.$row_id.'>';
- if ($row_order) $output .= '<td></td><td style="display:none;"><input type="hidden" name="order[]" value="'.($p).'" size="2" class="order" /></td>';
- $output .= '<td class="song'.$i.' nowrap">';
-
- if (isset($song['opts'])) {
- foreach ($song['opts'] as $type=>$opt) {
- $attr = (substr($type,0,4) == 'play') ? ' class="'.$class.'"' : '';
- $output .= zl(ztheme('icon',$type.'.gif',$lang[$type]),$opt['path'],$opt['query'], null, false, $attr);
- }
- }
- if (isset($song['extras'])) {
- foreach ($song['extras'] as $type=>$extra) {
- $output .= zl(ztheme('icon',$type.'.gif',$extra['text']),$extra['path'],$extra['query'],NULL,FALSE,$extra['attr']);
- }
- }
- $output .= '</td>';
-
- if (isset($song['opts_edit']) || isset($song['extras_edit'])) {
- $output .= '<td class="song'.$i.' nowrap">';
- if (isset($song['opts_edit'])) {
- foreach ($song['opts_edit'] as $type=>$opt) {
- $output .= zl(ztheme('icon',$type.'.gif',$lang[$type]),$opt['path'],$opt['query']);
- }
- }
- if (isset($song['extras_edit'])) {
- foreach ($song['extras_edit'] as $type=>$extra) {
- $output .= zl(ztheme('icon',$type.'_edit.gif',$extra['text']),$extra['path'],$extra['query'],NULL,FALSE,$extra['attr']);
- }
- }
- if (isset($song['delete'])) {
- $type = 'delete';
- $output .= zl(ztheme('icon',$type.'.gif',$lang[$type], $lang[$type], " onclick='return(confirm(\"".zt('Delete file?')."\"));'"),$song['delete']['path'],$song['delete']['query']);
- }
- $output .= '</td>';
- }
- if ($checkbox) {
- $output .= '<td class="song'.$i.' nowrap">';
- if (isset($song['checkbox']) && $song['checkbox']) {
- $output .= ztheme('form_checkbox', $song['checkbox']['name'], $song['checkbox']['value'], $song['checkbox']['checked']);
- }
- $output .= '</td>';
- }
- #if (isset($song['track'])) $output .= '</td><td align="right" class="song'.$i.' nowrap">'. $song['track'];
-
- if ($images) {
- $output .= '<td class="song'.$i.'"'.$v.'>';
- if (isset($song['image']) && !empty($song['image'])) {
- $output .= '<div class="search-results">';
- #if (isset($song['title_link'])) {
- # $output .= zl($song['image'],$song['title_link']['path'],$song['title_link']['query']);
- if (isset($song['image_link'])) {
- $output .= zl($song['image'],$song['image_link']['path'],$song['image_link']['query']);
- } else {
- $output .= $song['image'];
- }
- $output .= '</div>';
- }
- $output .= '</td>';
- }
-
- $td = '<td align="right" class="song_info'.$i.' nowrap"'.$v.'>';
-
- if ($stats) {
- $output .= $td.(($stat_prev == $song['stat']) ? '' : $p.'.').'</td>';
- $stat_prev = $song['stat'];
- }
-
- $output .= '<td class="song'.$i.' fullwidth"'.$v.'>';
- $title = $song['title'];
-
- if ($various) {
- if (isset($song['info']->artist)) $title = $song['info']->artist.' - '.$title;
- }
- if (isset($song['title_link'])) {
- $output .= zl($title,$song['title_link']['path'],$song['title_link']['query'], null, false, isset($song['title_link']['attr']) ? $song['title_link']['attr'] : '');
- } else {
- $output .= '<span class="song_title">'.$title.'</span>';
- }
- if ($song['new']) $output .= $img_new;
- if (isset($song['description']) && !empty($song['description'])) {
- $output .= '<br/><span class="song_blurb'.$i.'">'.$song['description'].'</span>';
- }
- if (isset($song['options'])) {
- $output .= '<br/><span class="song_blurb'.$i.'"><small>'.implode(' | ', $song['options']).'</small></span>';
- }
- $output .= '</td>';
-
- if ($stats) {
- if ($song['stat_type'] == 'votes' || $song['stat_type'] == 'rating') {
- $output .= $td.'<span class="zina-rating">'.ztheme('votes_display',$song['votes']).'</span></td>';
- $output .= '<td class="song_info'.$i.' nowrap"'.$v.'>'.ztheme('rating_display', $song['stat']).'</td>';
- } elseif ($song['stat_type'] == 'latest' || $song['stat_type'] == 'added') {
- $output .= $td.ztheme('stat_date', $song['stat']).'</td>';
- } else {
- $output .= $td.number_format($song['stat']).'</td>';
- }
- } else {
- if ($song['ratings']) {
- $output .= $td.'<span class="zina-rating">'.ztheme('votes_display',$song['sum_votes']).'</span></td>';
- $output .= '<td class="song_info'.$i.' nowrap"'.$v.'>'.
- '<div class="stars-song">'.ztheme('rating_display', $song['sum_rating']).'</div></td>';
-
- if (isset($song['full_path']))
- $output .= $td.'<div class="stars-song">'.ztheme('vote', zina_get_vote_url($song['full_path']), $song['user_rating']).'</div></td>';
- else
- $output .= $td.' '.'</td>';
- /*
- * If you are using statistics, there are also
- * $song['sum_plays'] & $songs['sum_downloads']
- */
- } else {
- $output .= $td.' '.'</td>';
- $output .= $td.' '.'</td>';
- $output .= $td.' '.'</td>';
- }
- if ($song_info) {
- if (isset($song['info']->info)) {
- $info = &$song['info'];
- $output .= $td.((isset($info->time) && !empty($info->time)) ? $info->time : ' ').'</td>';
- $output .= $td.((isset($info->bitrate) && !empty($info->bitrate)) ? $info->bitrate.' kbps' : ' ').'</td>';
- $output .= $td.((isset($info->frequency) && !empty($info->frequency)) ? round($info->frequency/1000,1).' kHz' : ' ').'</td>';
- $output .= $td.((isset($info->filesize) && !empty($info->filesize)) ? sprintf("%.2f", round($info->filesize/1000000,2)).' Mb' : ' ').'</td>';
- } else {
- $output .= $td.'</td>';
- $output .= $td.'</td>';
- $output .= $td.'</td>';
- $output .= $td.((isset($song['info']->filesize)) ? sprintf("%.2f", round($song['info']->filesize/1000000,2)).' Mb' : ' ').'</td>';
- }
- }
- }
- $output .= '</tr>'."\n";
- $i = ++$i % 2;
- $p++;
- }
- zevenodd($i);
- $output .= '</table>';
- return $output;
- }
-
- function ztheme_stats_form_select($action, $selects) {
- $form = '<form id="sform" method="post" action="'.$action.'" class="z_small"><div>';
- $form .= '<strong>'.zt('Statistic').': </strong>';
-
- foreach($selects as $name=>$select) {
- $form .= '<select class="z_form_select" name="'.$name.'" onchange=\'this.form.submit();\'>';
- foreach($select['options'] as $key=>$value) {
- $sel = ($key == $select['default']) ? ' selected="selected"' : '';
- $form .= '<option value="'.$key.'"'.$sel.'>'.$value.'</option>';
- }
- $form .= '</select>';
- }
- $form .= ' '.zl(ztheme('icon','more.gif',zt('More')),"javascript:document.forms.sform.submit();").'</div></form>';
- return $form;
- }
-
- function ztheme_stats_list($items, $various = false, $images = false) {
- return ztheme_song_list($items, $various, $images, true);
- }
-
- function ztheme_breadcrumb($links) {
- return (!empty($links)) ? implode(' > ',$links) : '';
- }
-
- function ztheme_breadcrumb_home($links) {
- return implode(' / ', $links);
- }
-
- function ztheme_page_title($links) {
- #return implode(' • ',$links);
- return implode(' · ',$links);
- }
-
- function ztheme_search_song_titles($titles) {
- return implode(' / ', $titles);
- }
-
- /*
- * Theme file to use for missing image
- * $type is 'dir' or 'sub'
- */
- function ztheme_missing_image($type) {
- return 'missing_'.$type.'.jpg';
- }
-
- /*
- * Theme for rating (currently "stars")
- * $rating is float with one decimal place, e.g. 4.5
- */
- function ztheme_rating_display($rating) {
- $output='';
- if ($rating > 0) {
- $output .= '<span class="stars">';
- $star = ztheme('icon','star.gif','*');
- $rating = number_format($rating,1);
- $arr = explode('.',$rating);
- $output .= str_repeat($star, $arr[0]);
- if ($arr[1] >= 5) $output .= ztheme('icon','star-half.gif','½');
- $output .= '</span>';
- }
- return $output;
- }
-
- /*
- * Theme for voting
- *
- * currently "stars" and utilizes ajax
- */
- function ztheme_vote($url, $user_rating = 0) {
- static $num = 0;
- if ($num == 0) zina_set_js('vars', ztheme('vote_js').'var zv=new Array();');
- $pr = 'zv'.$num;
-
- zina_set_js('vars', 'zv['.$num.']=\''.$url.'\';');
- $remove = '';
- if ($user_rating > 0) {
- $remove = zl(ztheme('icon','delete.gif',zt('Remove Vote')),'javascript: void 0;', null, null, null, ' onclick="ajax(zv['.$num.']+\'0\',\'span'.$pr.'\');"');
- }
-
- $output = '<span id="span'.$pr.'">'.$remove.ztheme('icon','stars-0.gif',NULL,NULL,'id="'.$pr.'" height="14" width="70" usemap="#'.$pr.'map"').
- '</span>'.
- '<map name="'.$pr.'map" id="'.$pr.'map">';
- for($i=1;$i<=5;$i++) {
- $output .= '<area coords="'.(($i-1)*14).',0,'.($i*14).',14" onmouseover="imgOn(\''.$pr.'\','.$i.
- ');" onmouseout="imgOff(\''.$pr.'\');" title="'.$i.'" alt="'.$i.'" '.
- 'href="javascript: void 0;" onclick="vote(\''.$pr.'\','.$i.');ajax('.
- 'zv['.$num.']+\''.$i.'\',\'span'.$pr.'\');" />';
- }
- $output .= '</map>';
- if ($user_rating > 0) $output .= '<script type="text/javascript">vote(\''.$pr.'\','.$user_rating.');</script>';
- $num++;
- return $output;
- }
-
- /*
- * Star voting javascript
- *
- * gets put in html head
- */
- function ztheme_vote_js() {
- $theme = zpath_to_theme().'/icons/stars-';
- $output = '';
-
- for($i=0;$i<=5;$i++) {
- $output .= "onImgArr[$i]=new Image(70,14);onImgArr[$i].src=zImgBase+'$i.gif';";
- }
-
- return 'var onImgArr=new Array();var zImgBase=\''.$theme.'\';'.
- $output.'var aVote=new Array();'.
- 'function imgOn(img,i){if(aVote[img]==null)document.getElementById(img).src=onImgArr[i].src;}'.
- 'function imgOff(img){if(aVote[img]==null)document.getElementById(img).src=zImgBase+\'0.gif\';}'.
- 'function vote(img,i){aVote[img]=null;imgOn(img,i);aVote[img]=i;}';
- }
- /*
- * Voting plurality
- *
- * "(1 vote)" or "(2 votes)"
- */
- function ztheme_votes_display($votes) {
- if (!empty($votes)) {
- return ' ('.$votes.' '.(($votes == 1) ? zt('vote') : zt('votes')) .')';
- }
- return '';
- }
-
- function ztheme_genres($dirs, $cols, $images, $truncate, $zina, $navigation = false, $full_page_split = false) {
- $output = '';
- if (!empty($zina['messages'])) $output .= '<div id="zina_messages">'.$zina['messages'].'</div>';
- if ($navigation) $output .= $navigation;
-
- $output .= ztheme('category', $dirs, $cols, $images, $truncate, $full_page_split);
- return $output;
- }
-
- function ztheme_multimedia_section($list) {
- return '<h3>'.zt('Multimedia').'</h3>'.$list;
- }
-
- function ztheme_image_missing_nav($select, $close) {
- return zt('Directories with no image:').$select.zl(zt('Close'), $close['path'], $close['query']).'<br/><br/>';
- }
-
- function ztheme_edit_images_page($title, $images, $new, $missing_navigation = '') {
- $output = '';
-
- if (!empty($missing_navigation)) $output .= $missing_navigation;
-
- if (!empty($images)) {
- $output .= '<div class="section">'.
- '<h3>'.zt('Current Images').'</h3>'.
- ztheme('image_list_helper', $images, 3).
- '</div>';
- }
-
- if (!empty($new)) {
- $output .= '<div class="section"><h3>'.zt('Remote Images').'</h3>';
- foreach($new as $opt) {
- $output .= $opt['image'];
- }
- }
-
- return $output;
- }
-
- function ztheme_addthis($zina, $type = 'bookmark') {
- global $zc;
- static $first = true;
-
- $output = '';
- if ($zina['addthis']) {
- if ($first) {
- $output .= '<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js"></script>';
- zina_set_js('vars', 'var addthis_pub = "'.$zina['addthis_id'].'";');
- if (!empty($zina['site_name'])) zina_set_js('vars', 'var addthis_brand = "'.$zina['site_name'].'";');
- $first = false;
- }
-
- $source = zurl($zina['addthis_path'], $zina['addthis_query'], null, true);
-
- if ($type == 'feed') {
- $output .= ' <a href="http://www.addthis.com/feed.php" '.
- 'onclick="return addthis_open(this, \'feed\', \''.$source.'\')">' .
- '<img src="http://s7.addthis.com/static/btn/sm-rss-en.gif" width="83" height="16" alt="'.zt('Subscribe').'" title="'.zt('Subscribe using any feed reader!').'" class="icon"/></a>';
- } else { # bookmark
- $output .= '<p><a href="http://www.addthis.com/bookmark.php" '.
- 'onmouseover="return addthis_open(this,\'\',\''.$source.'\',\''.$zina['title'].'\');" '.
- 'onmouseout="addthis_close();" '.
- 'onclick="return addthis_sendto();"><img src="http://s7.addthis.com/static/btn/lg-share-en.gif" width="125" height="16" title="'.zt('Share').'" alt="'.zt('Share').'" /></a></p>';
- }
- }
-
- return $output;
- }
-
- function ztheme_stats_page($form_attr, $stats, $stat_opts, $zina) {
- $output = '';
-
- $output .= '<div class="clear-block" style="margin-bottom:20px;">'.$zina['statsformselect'].'</div>';
- if (empty($stats)) {
- $output .= '<h3>'.zt('No data found for this period.').'</h3>';
- } else {
- $output .= ztheme('form', $form_attr, $stats.'<div class="section">'.$stat_opts.'</div>');
- }
- return $output;
- }
-
- function ztheme_stats_section($title, $list, $type, $zina, $rss_title = '', $rss_path = false) {
- if ($rss_path) {
- $rss_icon = ($type == 'song') ? 'podcast.gif' : 'rss.png';
-
- $zina['addthis_path'] = $rss_path;
- $zina['addthis_query'] = null;
-
- $addthis = ztheme('addthis', $zina, 'feed');
-
- return '<div class="section"><div class="stats">'.
- '<div class="stats-left"><h3>'.$title.'</h3></div>'.
- '<div class="stats-right">'.zl(ztheme('icon', $rss_icon, $rss_title),$rss_path).$addthis.'</div></div>'.
- $list.'</div>';
-
- } else {
- return '<div class="section"><h3>'.$title.'</h3>'.$list.'</div>';
- }
- }
-
- function ztheme_stat_date($time) {
- return date("M j, Y g:i a", $time);
- }
-
- /*
- * NEXT THREE FUNCTIONS:
- * Take an array, expect an array back
- * - unset ones you don't want
- * - reorder, change text, etc.
- */
- function ztheme_stats_pages($pages) { return $pages; }
- function ztheme_stats_periods($periods) { return $periods; }
- function ztheme_stats_types($types) { return $types; }
-
- function ztheme_stats_list_opts($items, $form) {
- return ztheme('song_list_opts',$items, $form);
- }
-
- function ztheme_search_list($items, $images = false) {
- return ztheme('song_list',$items, false, $images);
- }
-
- function ztheme_playlist_list($items, $images = false, $reorder = false) {
- return ztheme('song_list',$items, false, $images, false, $reorder, false);
- }
-
- function ztheme_playlists_list_db($items, $count, $navigation, $action, $form_attr, $list_opts, $selected = false, $checkbox = false) {
- $output = '';
-
- if ($count > 0) {
- if ($navigation) $output .= $navigation;
- $output .= '<table class="search-header"><tr><td align="left">'.
- '<em>'.zt('@total Playlists', array('@total'=>$count)).'</em></td>';
- if ($selected) $output .= '<td align="right" style="text-align:right;">'.ztheme('playlist_header', $action, $selected).'</td>';
- $output .= '</tr></table>';
- }
- $list = ztheme('song_list',$items, false, true, false, false, false, $checkbox);
- return $output.ztheme('form', $form_attr, $list.$list_opts);
-
- #return $output.ztheme('song_list',$items, false, true, false, false, false, $checkbox);
- }
-
- function ztheme_playlists_list($items, $zina, $reorder = false) {
- global $zc;
- if (empty($items)) return '';
-
- if ($reorder) {
- zina_add_tabledrag('table-playlist', 'order', 'sibling', 'order');
- zina_set_css('file', 'extras/tabledrag.css');
- }
-
- $class = "zinamp";
-
- $songs = &$items;
- zina_set_css('inline', '.zinaplswidthA{width:90px;}.zinaplswidthB{width:20px}');
-
- $lang['download'] = zt('Download');
- $lang['play'] = zt('Play');
- $lang['more'] = zt('More');
- $lang['rename'] = zt('Rename');
- $lang['delete'] = zt('Delete');
- $lang['play_rec_rand'] = zt('Play random');
-
- $i = 0;
- $j = 1;
- $output = '';
- $output .= '<table cellpadding="5" cellspacing="0" id="table-playlist">';
- foreach($songs as $song) {
- $v = (isset($song['description'])) ? ' valign="top"' : '';
- $output .= '<tr class="draggable row'.$i.'"'.$v.' id="order'.($j).'"><td class="song'.$i.' zinaplswidthA nowrap">';
- if (isset($song['opts'])) {
- foreach ($song['opts'] as $type=>$opt) {
- $attr = (substr($type,0,4) == 'play') ? "class='$class'" : '';
- $output .= zl(ztheme('icon',$type.'.gif',$lang[$type]),$opt['path'],$opt['query'], null, false, $attr);
- }
- }
-
- if (isset($song['checkbox'])) {
- $output .= '</td><td class="song'.$i.' zinaplswidthB nowrap">'.
- ztheme('form_checkbox', $song['checkbox']['name'], $song['checkbox']['value'], $song['checkbox']['checked']).'</td>'.
- '<td style="display:none;"><input type="hidden" name="order[]" value="'.($j).'" size="2" class="order" />';
- }
- $output .= '</td><td class="song'.$i.'"'.$v.'>';
-
- $title = $song['title'];
-
- if (isset($song['title_link'])) {
- $output .= zl($title,$song['title_link']['path'],$song['title_link']['query']);
- } else {
- $output .= $title;
- }
- if (isset($song['description'])) $output.= '<br/>'.$song['description'];
- $output .= '</td>';
- $output .= '</tr>';
- $i = ++$i % 2;
- $j++;
- }
- zevenodd($i);
- $output .= '</table>';
-
- return $output;
- }
-
- function ztheme_form_checkbox($name, $value, $check = false) {
- $checked = ($check) ? ' checked="checked"' : '';
- return '<input type="checkbox" name="'.$name.'" value="'.$value.'"'.$checked.'/>';
- }
-
- function ztheme_form_hidden($name, $value) {
- return '<input type="hidden" name="'.$name.'" value="'.$value.'"/>';
- }
-
- function ztheme_multimedia_list($items) {
- if (empty($items)) return '';
- $img_new = ztheme('icon','new.gif',zt('New'));
- $lang['edit'] = zt('Edit');
-
- $i = 0;
- $output = '<table cellpadding="5" cellspacing="0" width="100%">';
- foreach($items as $song) {
- $v = (isset($song['description'])) ? ' valign="top"' : '';
- $output .= '<tr class="row'.$i.'"'.$v.'><td class="song'.$i.' nowrap">';
- if (isset($song['opts'])) {
- if (isset($song['opts']['play']) && $song['opts']['play']['local']) {
- $output .= zl(ztheme('icon','mm/'.$song['ext'].'.gif',zt('Play')),$song['opts']['play']['path'],$song['opts']['play']['query']);
- }
- if (isset($song['opts']['download'])) {
- $icon = (isset($song['opts']['play']) && $song['opts']['play']['local']) ? 'download' : 'mm/'.$song['ext'];
- $output .= zl(ztheme('icon',$icon.'.gif',zt('Download')),$song['opts']['download']['path'],$song['opts']['download']['query']);
- }
- }
-
- if (isset($song['opts_edit'])) {
- $output .= '</td><td class="song'.$i.' nowrap">';
- foreach ($song['opts_edit'] as $type=>$opt) {
- $output .= zl(ztheme('icon',$type.'.gif',$lang[$type]),$opt['path'],$opt['query']);
- }
- }
-
- $output .= '</td><td class="song'.$i.' fullwidth"'.$v.'>';
- $title = $song['title'];
-
- if (isset($song['title_link'])) {
- $output .= zl($title,$song['title_link']['path'],$song['title_link']['query']);
- } else {
- $output .= $title;
- }
- if ($song['new']) $output .= $img_new;
- if (isset($song['description'])) {
- $output .= '<br/><span class="song_blurb'.$i.'">'.$song['description'].'</span>';
- }
- $output .= '</td>';
- $output .= '</tr>';
- $i = ++$i % 2;
- }
- zevenodd($i);
- $output .= '</table>';
- return $output;
- }
-
- function ztheme_playlists_section($page,$form_attr,$list,$list_opts, $opts = array()) {
-
- $lang['play'] = zt('Play');
- $lang['playlist'] = zt('View Playlists');
- $lang['rename'] = zt('Rename');
- $lang['delete'] = zt('Delete');
- $output = '';
-
- $output .= '<div class="genre-page clear-block">';
- if ($page['image']) $output .= $page['image'];
-
- if ($opts['user']) {
- $lang['download'] = zt('Download');
- $lang['play'] = zt('Play');
- $lang['play_lofi'] = zt('Play Low Fidelity');
- $lang['play_rec_rand'] = zt('Play random');
-
- $output .= '<p>';
- $items = &$opts['user'];
- foreach($items as $type=>$opt) {
- $output.= zl(ztheme('icon',$type.'.gif',$lang[$type]),$items[$type]['path'],$items[$type]['query'],NULL,FALSE,$items[$type]['attr']);
- }
- $output .= zl(zt('Play @pls Playlist', array('@pls'=>$page['title'])),$items['play']['path'], $items['play']['query'], null, false, $items['play']['attr']).
- '</p>';
- }
-
- $votes = (isset($page['pls_ratings']) && $page['sum_votes'] > 0);
- if ($votes || isset($page['pls_rate_output'])) {
- $output .= '<p class="small">';
- if ($votes) {
- $output .= ztheme('rating_display', $page['sum_rating']).
- ztheme('votes_display',$page['sum_votes']);
- if (isset($page['pls_rate_output'])) $output .= ' | ';
- }
- if (isset($page['pls_rate_output'])) $output .= zt('Rate').': '.$page['pls_rate_output'];
- $output .= '</p>';
- }
-
- if (isset($page['description']) && !empty($page['description'])) {
- $output .= '<p>'.$page['description'].'</p>';
- }
-
- if (isset($page['podcast'])) {
- $type = $page['podcast']['type'];
- $icon_title = ($type == 'podcast') ? zt('Podcast') : zt('RSS Feed');
- $output .= '<p>'.zl(ztheme('icon',$type.'.gif', $icon_title),$page['podcast']['url'],$page['podcast']['query']).'</p>';
- }
-
- $output .= ztheme('addthis', $page, 'bookmark');
-
- $date = (!empty($page['date_created'])) ? zina_date('F j, Y', $page['date_created']) : null;
-
- $output .= '<p class="small">';
- if (isset($page['username'])) {
- $name = (isset($page['profile_url'])) ? '<a href="'.$page['profile_url'].'">'.$page['username'].'</a>' : $page['username'];
- if (!empty($date)) {
- $output.= zt('Created by !name on @date.', array('!name'=>$name, '@date'=>$date));
- }
- } else {
- if (!empty($date)) {
- $output.= zt('Created on @date.', array('@date'=>$date));
- }
- }
- if (isset($page['sum_views'])) $output .= ' '.zt('Viewed @num times.', array('@num'=>$page['sum_views']));
- if (isset($page['sum_plays'])) $output .= ' '.zt('Played @num times.', array('@num'=>$page['sum_plays']));
- $output .= '</p>';
-
- $admin = &$opts['admin'];
- if ($admin['edit'] || $admin['delete']) {
- $output .= '<p class="small">';
- if ($admin['edit']) $output .= zl(zt('Edit Playlist'),$admin['edit']['path'], $admin['edit']['query']).' | ';
- if ($admin['delete']) $output .= zl(zt('Delete Playlist'),$admin['delete']['path'], $admin['delete']['query']);
- $output .= '</p>';
- }
- $output .= '</div>';
-
- if ($page['count'] > 0) {
- $output .= '<table class="search-header"><tr><td align="left">'.
- '<em>'.zt('@total Items', array('@total'=>$page['count'])).'</em></td>';
- #if ($selected) $output .= '<td align="right">'.ztheme('search_header', 'XXX', $genre, $action, $selected).'</td>';
- $output .= '</tr></table>';
- }
-
- $output .= ztheme('form', $form_attr, $list.$list_opts);
- return $output;
- }
-
- function ztheme_form($attr, $content, $method = 'post') {
- return '<form method="'.$method.'" '.$attr.'><div>'.$content.zina_get_form_token().'</div></form>';
- }
-
- function ztheme_song_section($form_attr,$song_list,$song_list_opts) {
- return '<h3>'.zt('Songs').'</h3>'.ztheme('form', $form_attr, $song_list.$song_list_opts);
- }
-
- function ztheme_search_page($term, $results, $total, $navigation, $form_attr, $list, $list_opts, $action, $selected, $zina) {
- $output = '';
- $output .= '<h3>'.zt('Search Results').'</h3>';
- if (empty($results)) {
- $output .= '<p><em>'.zt('0 total items found').'</em></p>';
- } else {
- if ($navigation) $output .= $navigation;
- $output .= '<table class="search-header"><tr><td align="left">';
- $output .= '<em>'.zt('@total items found', array('@total'=>$total)).'</em>';
- $output .= '</td>';
- if ($selected) $output .= '<td align="right">'.ztheme('search_header', 'search', $term, $action, $selected).'</td>';
- $output .= '</tr></table>';
-
- $output .= ztheme('form', $form_attr, $list.$list_opts);
- }
- return $output;
- }
-
- function ztheme_year_page($term, $results, $total, $search_navigation, $navigation, $form_attr, $list, $list_opts, $opts, $action, $selected, $zina) {
- return ztheme('genres_page',$term, $results, $total, $search_navigation, $navigation, $form_attr, $list, $list_opts, $opts, $action, $selected, $zina);
- }
-
- function ztheme_genres_page($genre, $results, $total, $navigation, $genre_navigation, $form_attr, $list, $list_opts, $opts, $action, $selected, $zina) {
- global $zc;
-
- $class="zinamp";
-
- $output = '';
- if (!empty($zina['messages'])) $output .= '<div id="zina_messages">'.$zina['messages'].'</div>';
-
- $output .= '<div class="genre-page clear-block">';
- if ($opts['image']) $output .= ztheme('image', zina_get_genre_image_path($genre), $genre, null, 'class="genre-image"');
- if ($genre_navigation) $output .= '<div class="genre-select">'.$genre_navigation.'</div>';
- $output .= '<p>'.
- zl(ztheme('icon','play.gif',zt('Play')),'',$opts['play_query'], null, false, "class='$class'").
- zl(zt('Play @genre', array('@genre'=>$genre)),'', $opts['play_query'], null, false, "class='$class'").
- '</p>';
-
- if ($opts['description'] && !empty($opts['description'])) {
- $output .= '<p>'.$opts['description'].'</p>';
- }
- if ($opts['genre_edit']) {
- $output .= '<p class="small">'.zl(zt('Edit Genre'),$opts['genre_edit']['path'], $opts['genre_edit']['query']).'</p>';
- }
-
- $output .= '</div>';
-
- if (isset($zina['subgenres'])) {
- $output .= '<table class="search-header"><tr><td align="left"><h3>'.zt('Genre Family').'</h3></td></tr></table>';
- $output .= $zina['subgenres'];
- }
-
- $output .= '<table class="search-header"><tr><td align="left" width="30%">';
- $output .= '<em>'.zt('@total items found', array('@total'=>$total)).'</em>';
- $output .= '</td><td>'.(($navigation) ? $navigation : '').'</td>';
- $output .= '<td align="right" width="30%">';
- if ($selected) $output .= ztheme('search_header', $zina['search_page_type'], $genre, $action, $selected);
- $output .= '</td></tr></table>';
-
- if (empty($results) || $selected['type'] == 'artist') $list_opts = '';
-
- $output .= ztheme('form', $form_attr, $list.$list_opts);
- return $output;
- }
-
- function ztheme_playlist_list_opts($items, $form) {
- if (empty($items)) return '';
- if (empty($items['submit']) && empty($items['checkbox']) && !isset($items['playlist_form_elements'])) return '';
- $submit = ($items['submit']) ? '<input type="submit" value="'.zt('Update Playlist').'"/>' : '';
- if ($items['checkbox']) {
- $checkbox = ' '.zt('Check').': '.
- zl(zt('All'),'javascript: void 0;',NULL,NULL,FALSE,' onclick="CheckBoxes(\''.$form.'\',true);"').' | '.
- zl(zt('None'),'javascript:void 0;',NULL,NULL,FALSE,' onclick="CheckBoxes(\''.$form.'\',false);"');
- } else {
- $checkbox = '';
- }
-
- $output = '<table cellpadding="5" cellspacing="0" width="100%"><tr class="row'.zevenodd().'">';
- $output .= '<td>'.$submit.$checkbox.'</td>';
- $output .= '<td align="right">'.((isset($items['playlist_form_elements'])) ? $items['playlist_form_elements'] : ' ').'</td>';
- $output .= '</tr></table>';
-
- return $output;
- }
-
- function ztheme_search_list_opts($items, $form) {
- return ztheme('song_list_opts',$items, $form);
- }
-
- function ztheme_song_list_opts($items, $form) {
- if (empty($items)) return '';
-
- $output = '<table cellpadding="5" cellspacing="0" width="100%"><tr class="row'.zevenodd().'">';
- if (isset($items['checkboxes'])) {
- $submit = '';
- if (isset($items['submit'])) {
- $val = ($items['submit']['exists']) ? zt('Update custom playlist') : zt('Create custom playlist');
- $submit = '<input type="submit" value="'.$val.'" onclick="'.$items['submit']['js'].'"/> ';
- }
- $output .= '<td>'.$submit.zt('Check').': '.
- zl(zt('All'),'javascript: void 0;',NULL,NULL,FALSE,' onclick="CheckBoxes(\''.$form.'\',true);"').' | '.
- zl(zt('None'),'javascript:void 0;',NULL,NULL,FALSE,' onclick="CheckBoxes(\''.$form.'\',false);"').'</td>';
- }
-
- if (isset($items['opts'])) {
- $lang['download'] = zt('Download');
- $lang['play'] = zt('Play');
- $lang['play_lofi'] = zt('Play Low Fidelity');
- $lang['play_rec_rand'] = zt('Play random');
-
- $output .= '<td >'.zt('Selected').': ';
- foreach($items['opts'] as $type=>$opt) {
- $output.= zl(ztheme('icon',$type.'.gif',$lang[$type]),$opt['path'],$opt['query'],NULL,FALSE,$opt['attr']);
- }
- $output .= '</td>';
- }
- $output .= '<td align="right">'.((isset($items['playlist_form_elements'])) ? $items['playlist_form_elements'] : ' ').'</td>';
- $output .= '</tr></table>';
- return $output;
- }
-
- function ztheme_song_extra($type, $title, $content, $url = false) {
- if ($url) {
- $content = zt('Loading...');
- zina_set_js('jquery', '$("p#zina-'.$type.'").load("'.$url.'");');
- …
Large files files are truncated, but you can click here to view the full file