Esempio n. 1
0
function mx_mediadata($media, $fanship, $mystuff = false, $bmaker = false, $featbun = false)
{
    global $mxuser, $mediastatuses;
    if ($media->type == MXMEDIABASEBUNDLE) {
        $str = '<div class="bundledata bid_' . $media->id . '" xitemprop="bundle" xitemscope xitemtype="http://schema.org/MusicAlbum/MediaBundle">';
        $lmeds = '';
        // linked media for slideshow
        $lmedc = 0;
        $mediapic = mx_iconurl('mediabundle');
        foreach ($media->linked as $linked) {
            // look for a pic into linked media
            if ($linked->type == MXMEDIAPIC || $linked->type == MXMEDIABG) {
                // use first pic found
                $mediapic = mx_medialink('xx.jpg', $linked->hashcode, $media->hashdir, '-thumb');
                break;
            }
        }
        $media->pic = $mediapic;
        $media->dragpic = null;
        $media->mediapic = '<img tag="' . $media->id . '" class="bundlepic" src="' . $mediapic . '" xitemprop="image" />';
        $str .= '<table>';
        $media->share = '';
        $str .= '<td colspan="2" tag="' . $media->id . '" class="bundleright' . ($media->type == MXMEDIAREGULARBUNDLE ? ' newmedia' : ' workmedia') . '">';
        if ($media->buttons) {
            $str .= '<div class="bundlebuttons">' . '<div id="player">' . $media->buttons . '</div>' . '</div>';
        }
        $str .= '<div class="bundledetails">';
        $str .= '<div class="bundleinfo">' . sprintf(_('<b>Medias:</b> %s<br/><b>Size:</b> %s'), '<span' . ($mystuff ? ' id="numtracks"' : '') . ' xitemprop="numTracks">' . (0 + $media->cnt) . '</span>', '<span' . ($mystuff ? ' id="bunsize"' : '') . '>' . mx_size($media->size) . '</span>') . '</div>';
        $str .= '<meta itemprop="byArtist" content="' . $media->artistname . '" />';
        $str .= '<div class="bundletitle' . ($fanship == null ? ' ts_' . $media->status : '') . '" xitemprop="name">';
        $str .= _('The medias below are not currently part of any bundle');
        $str .= '</div>';
        // end title div
        if ($media->year) {
            $str .= '<div class="bundlerelease"' . ($mystuff ? ' id="bunyear" onclick="textedit(this);"' : '') . '>(' . ($media->month ? mx_monthname($media->month) . '-' : '') . '<span xitemprop="copyrightYear">' . $media->year . '</span>)</div>';
        }
        $str .= $media->content;
        $str .= '</div>';
        // end bundledetails
        $str .= '<div class="bundledmedia">';
        $str .= '<table' . ($mystuff ? ' class="sortmedia dropzone"' : '') . '><tr id="row_' . $media->id . '"><td' . ($mystuff ? ' colspan=' . ($bmaker ? '3' : '4') : '') . '>';
        if ($mystuff) {
            $str .= '<div class="dropzone">&darr; ';
            if ($media->type == MXMEDIABASEBUNDLE) {
                $str .= _('Drag and drop unused media here...');
            } else {
                if ($media->status >= MXMEDIAREADY && $media->status < MXMEDIAFANVISIBLE) {
                    $str .= _('Drag and drop and reorder already uploaded media here...');
                } else {
                    if ($media->status >= MXMEDIAFANVISIBLE && $media->status < MXMEDIAARCHIVED) {
                        $str .= _('Drag and drop between published bundles or reorder yourmedia...');
                    }
                }
            }
            $str .= '</div>';
        }
        $str .= '</td></tr>';
        //$bunstr=mx_showbundle($media->id,($mystuff?'newbun':'media'),'');
        //$str.='<!-- '.$bunstr.' -->';
        $str .= '</table></div>';
        $str .= '</td></table>';
        // bundleright
        $str .= '</div>';
        // end bundledata
    } else {
        if ($media->type == MXMEDIAREGULARBUNDLE) {
            // BUNDLES
            $str = '<div class="bundledata bid_' . $media->id . '" yitemprop="albums" yitemscope yitemtype="http://schema.org/MusicAlbum">';
            // /MediaBundle
            $media->schema = 'itemprop="album" itemscope itemtype="http://schema.org/MusicAlbum"';
            $media->meta = '';
            $lmeds = '';
            // linked media for slideshow
            $lmedc = 0;
            $mediapic = mx_iconurl('mediabundle');
            foreach ($media->linked as $linked) {
                // look for a pic into linked media
                if ($linked->type == MXMEDIAPIC || $linked->type == MXMEDIABG) {
                    // use first pic found
                    $mediapic = mx_medialink('xx.jpg', $linked->hashcode, $media->hashdir, '-thumb');
                    break;
                }
            }
            $media->pic = $mediapic;
            $media->dragpic = null;
            $media->mediapic = '<img tag="' . $media->id . '" class="bundlepic" src="' . $mediapic . '" yitemprop="image" />';
            $media->mediapicnoprop = '<img tag="' . $media->id . '" class="bundlepic mxobject" src="' . $mediapic . '" />';
            $str .= '<table><td class="bundleleft">';
            $url = mx_option('basicsiteurl') . '/m/' . $media->id;
            $media->url = $url;
            $str .= '<div class="bundlemainpic">' . '<a href="' . $url . '" title="' . $media->title . ' - ' . _('See Media Page') . '" class="pictooltip" yitemprop="url">' . $media->mediapic . '</a>' . '</div>';
            if ($media->purchase) {
                $str .= $media->pricetag . $media->purchase;
            }
            if (!is_logged() && !$mystuff && !$bmaker && ($media->status >= MXMEDIAFANVISIBLE && $media->status < MXMEDIAARCHIVED)) {
                $sharebutton = mx_sharebuttons('m' . $media->id, $url, $media->pic, $media->description);
                $media->share = $sharebutton;
                $str .= $sharebutton;
            } else {
                $media->share = '';
            }
            if ($fanship == null || $fanship[0] == MXME) {
                if ($mystuff) {
                    $sharestat = array(1, _('Shared With'), 'bundlestatus', '', _('<dl><dt>Public</dt><dd>(Recommended) <b>Everyone</b> can see the bundle and <b>preview</b> its content</dd>' . '<dt>Fans</dt><dd><b>Only fans</b> can see the bundle and <b>fully access</b> its content</dd></dl>'));
                    $str .= mx_formfield('bunshare_' . $media->id, $media->status, $sharestat);
                } else {
                    $str .= '<div class="bundlestatus ms_' . $media->status . '">' . $mediastatuses[$media->status] . '</div>';
                }
            }
            $links = '';
            if ($fanship == null && count($media->linked) > 0) {
                $str .= ' ' . mx_icon('linkmedia', _('Links'), 12, 'lm_' . $media->id, 'linkmediahover');
                $links = '<div class="bunlinks ld_' . $media->id . '">';
                foreach ($media->linked as $linked) {
                    $links .= '<div class="bunlink ld_' . $media->id . '_' . $linked->id . '">' . '<img src="' . mx_medialink('xx.jpg', $linked->hashcode, $media->hashdir, '-small') . '"/>' . '<div class="dellink">' . mx_icon('dellink', _('Remove'), 19, 'ul_' . $media->id . '_' . $linked->id, 'dellinkhover') . '</div>' . '</div>';
                }
                $links .= '</div>';
            }
            $str .= '</td>';
            // bundleleft
            $str .= '<td tag="' . $media->id . '" class="bundleright' . ($media->type == MXMEDIAREGULARBUNDLE ? ' newmedia' : ' workmedia') . '">';
            if ($media->buttons) {
                $str .= '<div class="bundlebuttons">' . '<div id="player">' . $media->buttons . '</div>' . '</div>';
            }
            $str .= '<div class="bundledetails">';
            $durh = floor($media->totaltime / 3600);
            $durm = floor(($media->totaltime - 3600 * $durh) / 60);
            $durs = $media->totaltime - 3600 * $durh - 60 * $durm;
            $dur = ($durh > 0 ? $durh . ':' : '') . sprintf('%02d:%02d', $durm, $durs);
            $str .= '<div class="bundleinfo">' . sprintf(_('<b>Duration:</b> %s<br/><b>Medias:</b> %s<br/><b>Size:</b> %s'), '<span' . ($mystuff ? ' id="playtime"' : '') . ' xitemprop="duration">' . $dur . '</span>', '<span' . ($mystuff ? ' id="numtracks"' : '') . ' xitemprop="numTracks">' . (0 + $media->cnt) . '</span>', '<span' . ($mystuff ? ' id="bunsize"' : '') . '>' . mx_size($media->size) . '</span>') . '</div>';
            $str .= '<meta yitemprop="byArtist" content="' . $media->artistname . '" />';
            $str .= '<div class="bundletitle' . ($fanship == null ? ' ts_' . $media->status : '') . '" yitemprop="name">';
            if ($mystuff) {
                $title = array(1, '', 'mediatitle', 80, '', _('Bundle Title'));
                $str .= mx_formfield('title_' . $media->id, $media->title, $title);
            } else {
                $str .= $media->title;
            }
            $str .= '</div>';
            // end title div
            if ($media->year) {
                $str .= '<div class="bundlerelease"' . ($mystuff ? ' id="bunyear" onclick="textedit(this);"' : '') . '>(' . ($media->month ? mx_monthname($media->month) . '-' : '') . '<span xitemprop="copyrightYear">' . $media->year . '</span>)</div>';
            }
            $str .= '<div class="bundledesc" yitemprop="description">';
            if ($mystuff) {
                $desc = array(1, '', 'mediadesc', 4, '', _('Bundle Description'), 60);
                $str .= mx_formfield('desc_' . $media->id, $media->description, $desc);
            } else {
                $str .= $media->description;
            }
            $str .= '</div>';
            $str .= $links;
            $str .= $media->content;
            $str .= '</div>';
            // end bundledetails
            $str .= '<div class="bundledmedia">';
            $str .= '<table' . ($mystuff ? ' class="sortmedia dropzone"' : '') . '><tr id="row_' . $media->id . '"><td' . ($mystuff ? ' colspan=' . ($bmaker ? '3' : '4') : '') . '>';
            if ($mystuff) {
                $str .= '<div class="dropzone">&darr; ';
                if ($media->type == MXMEDIABASEBUNDLE) {
                    $str .= _('Drag and drop unused media here...');
                } else {
                    if ($media->status >= MXMEDIAREADY && $media->status < MXMEDIAFANVISIBLE) {
                        $str .= _('Drag and drop and reorder already uploaded media here...');
                    } else {
                        if ($media->status >= MXMEDIAFANVISIBLE && $media->status < MXMEDIAARCHIVED) {
                            $str .= _('Drag and drop between published bundles or reorder yourmedia...');
                        }
                    }
                }
                $str .= '</div>';
            }
            $str .= '</td></tr>';
            if ($featbun) {
                $bunstr = mx_showbundle($media->id, $mystuff ? 'newbun' : 'media', '');
                $str .= $bunstr;
                $media->featured = true;
            }
            $str .= '</table></div>';
            $str .= '</td></table>';
            // bundleright
            $str .= '</div>';
            // end bundledata
        } else {
            // NORMAL MEDIA
            switch ($media->type) {
                case MXMEDIABG:
                case MXMEDIAPIC:
                    $schematype = 'CreativeWork';
                    $proptype = '';
                    //encodings';
                    $infotype = '';
                    break;
                case MXMEDIAINSTR:
                case MXMEDIASONG:
                    $schematype = 'MusicRecording';
                    $proptype = 'tracks';
                    $infotype = 'duration';
                    $infotxt = preg_replace('%^([0-9]+):([0-9]+)$%', 'PT\\1M\\2S', $media->info);
                    break;
                case MXMEDIAVIDEO:
                    $schematype = 'Movie';
                    $proptype = '';
                    //encoding';
                    $infotype = '';
                    break;
                default:
                    $schematype = 'CreativeWork';
            }
            $str2 = '<div class="mediadata">';
            $str = '<div class="mediadata bid_' . $media->id . '" ' . ($proptype ? 'itemprop="' . $proptype . '"' : '') . 'itemscope itemtype="http://schema.org/' . $schematype . '">';
            $media->schema = 'itemprop="' . $proptype . '" itemscope itemtype="http://schema.org/' . $schematype . '"';
            if ($media->type == MXMEDIAPIC || $media->type == MXMEDIABG) {
                $mediapic = mx_medialink('xx.jpg', $media->hashcode, $media->hashdir, '-thumb');
            } else {
                if (!$media->pic) {
                    if (!count($media->bundles)) {
                        $mediapic = mx_iconurl('mediatype_' . $media->type);
                    } else {
                        // take bundle pic by default...
                        $bundle = $media->bundles[0];
                        $bfanship = $mxuser->getfanship($bundle->owner_id, $bundle->id);
                        mx_medialist($bundle, $bfanship);
                        mx_mediadata($bundle, $bfanship);
                        $mediapic = $bundle->pic;
                    }
                } else {
                    $mediapic = $media->pic;
                }
            }
            $lmeds = '';
            // linked media for slideshow
            $lmedc = 0;
            $newpic = 0;
            foreach ($media->linked as $linked) {
                // look for a pic into linked media
                if (($linked->type == MXMEDIAPIC || $linked->type == MXMEDIABG) && !$newpic) {
                    // use first pic found
                    $mediapic = mx_medialink('xx.jpg', $linked->hashcode, $media->hashdir, '-thumb');
                    $newpic = 1;
                }
                $lmeds .= '<a href="' . mx_medialink('xx.jpg', $linked->hashcode, $media->hashdir, '-small') . '"' . ' id="lmedia_' . $media->id . '_l' . $lmedc . '"></a>';
                $lmedc++;
            }
            $media->pic = $mediapic;
            $media->dragpic = new stdClass();
            $media->dragpic->id = $media->id;
            $media->dragpic->type = $media->type;
            $media->dragpic->pic = $media->pic;
            $media->mediapic = '<img tag="' . $media->id . '" class="bundlepic" src="' . $mediapic . '" itemprop="image" />';
            $url = mx_option('basicsiteurl') . '/m/' . $media->id;
            $media->url = $url;
            $str2 .= $media->purchase;
            $str .= $media->purchase;
            if (!$mystuff) {
                $mpic = '<div class="mediamainpic">' . '<a href="' . $url . '" title="' . $media->title . ' - ' . 'See Media Page' . '" class="pictooltip" itemprop="url">' . $media->mediapic . '</a>' . '</div>';
                $str .= $mpic;
                $str2 .= $mpic;
            }
            $bitrate = floor($media->id3info['audio']['bitrate'] / 1000);
            $brmode = $media->id3info['audio']['bitrate_mode'];
            if (!$bitrate) {
                $quality = "";
            } else {
                if ($brmode == 'cbr' && $bitrate >= 320 || $brmode == 'vbr' && $bitrate > 128) {
                    $quality = ' <span class="hifi">HiFi</span>';
                } else {
                    if ($brmode == 'cbr' && $bitrate >= 160 || $brmode == 'vbr' && $bitrate > 96) {
                        $quality = ' <span class="mifi">MiFi</span>';
                    } else {
                        if ($brmode == 'cbr' && $bitrate >= 96 || $brmode == 'vbr' && $bitrate > 64) {
                            $quality = ' <span class="lofi">LoFi</span>';
                        } else {
                            $quality = ' <span class="nofi">NoFi</span>';
                        }
                    }
                }
            }
            $str .= '<div class="mediainfo">' . ($media->info ? $media->info . ' ' : '') . $quality . '</div>';
            if ($infotype) {
                $media->meta = '<meta itemprop="' . $infotype . '" content="' . $infotxt . '" />' . '<meta itemprop="url" content="' . $url . '" />';
                $str .= $media->meta;
            }
            if ($proptype == 'tracks') {
                $str .= '<meta itemprop="inalbum" content="' . $media->bundletitle . '" />';
            }
            $mbut = '<div class="mediabuttons">' . '<div id="player">' . $media->buttons . '</div>' . '</div>';
            $str .= $mbut;
            $str2 .= $mbut;
            $mtit = '<div class="mediatitle' . ($fanship == null ? ' ts_' . $media->status : '') . '" itemprop="name">';
            if ($media->position && !preg_match('%^[0-9]+ *[.)/-]%', $media->title)) {
                $mtit .= $media->position . '. ';
            }
            if ($mystuff) {
                $title = array(1, '', 'mediatitle', 80, '', _('Media Title'));
                $mtit .= mx_formfield('title_' . $media->id, $media->title, $title);
            } else {
                $mtit .= $media->title;
            }
            $str .= '</div>';
            $str .= $mtit;
            $str2 .= $mtit;
            //error_log('title='.$media->title.' status='.$media->status.' fanship='.print_r($fanship,true));
            $links = '';
            if ($fanship == null && count($media->linked) > 0) {
                /*
                $links=' '.mx_icon('linkmedia',_('Links'),12,'lm_'.$media->id,'linkmediahover')
                .'<div class="medlinks ld_'.$media->id.'"><table>';
                $l=0;
                foreach($media->linked as $linked) {
                	if ($l%3==0) $links.='<tr>';
                	$links.='<td><img src="'.mx_medialink('xx.jpg',$linked->hashcode,$media->hashdir,'-small')
                		.'"/></td>';
                	if ($l % 3 == 2) $links.='</tr>';
                	$l++;
                }
                if ($l%3>0) $links.='<td colspan="'.(3-($l%3)).'"></td></tr>';
                $links.='</table></div>';
                */
                $str .= ' ' . mx_icon('linkmedia', _('Links'), 12, 'lm_' . $media->id, 'linkmediahover');
                $links = '<div class="medlinks ld_' . $media->id . '">';
                foreach ($media->linked as $linked) {
                    $links .= '<div class="medlink ld_' . $media->id . '_' . $linked->id . '">' . '<img src="' . mx_medialink('xx.jpg', $linked->hashcode, $media->hashdir, '-small') . '"/>' . '<div class="dellink">' . mx_icon('dellink', _('Remove'), 19, 'ul_' . $media->id . '_' . $linked->id, 'dellinkhover') . '</div>' . '</div>';
                }
                $links .= '</div>';
            }
            if ($fanship && ($media->status == MXMEDIAPUBLIC && $fanship[0] < MXFAN || $media->status >= MXMEDIAMEMBERVISIBLE && $media->status <= MXMEDIAMEMBERSHARED && $fanship[0] > MXNONMEMBER && $fanship[0] < MXFAN)) {
                $mfpr = '<div class="fullpreview">' . _('Full-Preview') . '</div>';
                $str .= $mfpr;
                $str2 .= $mfpr;
            }
            $str .= '<meta itemprop="' . ($proptype == 'tracks' ? 'byArtist' : 'author') . '" content="' . $media->artistname . '" />';
            if ($media->year) {
                $str .= '<div class="mediarelease">(' . ($media->month ? mx_monthname($media->month) . '-' : '') . '<span itemprop="copyrightYear">' . $media->year . '</span>)</div>';
            }
            if ($fanship == null || $fanship[0] == MXME) {
                $str .= ' <div class="mediastatus ms_' . $media->status . '">' . $mediastatuses[$media->status] . '</div>';
            }
            if ($media->description || $mystuff || $bmaker) {
                $minf = ' ' . mx_icon('infomedia', _('Info'), 12, 'im_' . $media->id, 'infomedia_down');
                $str .= $minf;
                $str2 .= $minf;
            }
            if (!is_logged() && !$mystuff & !$bmaker && ($media->status > MXMEDIAREADY && $media->status < MXMEDIAARCHIVED)) {
                $sharebutton = mx_sharebuttons('m' . $media->id, $url, $media->pic, $media->description);
                $media->share = $sharebutton;
                $str .= '<div class="mediashare">' . $sharebutton . '</div>';
            } else {
                $media->share = '';
            }
            if ($mystuff || $bmaker) {
                $desc = array(1, '', 'mediadesc', 4, '', _('Media Description'), 20);
                $strdesc = mx_formfield('desc_' . $media->id, $media->description, $desc);
            } else {
                $strdesc = $media->description;
            }
            $mdsc = '<div class="meddesc md_' . $media->id . '" itemprop="description">' . $strdesc . '</div>';
            $str .= $mdsc;
            $str2 .= $mdsc;
            $str .= $links;
            $str .= $media->content . $lmeds;
            $str2 .= $media->content;
            $str .= '</div>';
            // end mediadata
            $str2 .= '</div>';
            $media->mediadatalight = $str2;
        }
    }
    return $str;
}
Esempio n. 2
0
function mx_showcustompage($page, $user, $media = null, $simul = '')
{
    global $mxuser, $transparencies, $windows, $mxdb;
    if ($simul == 'public') {
        $saveuser = $mxuser;
        $mxuser = new MXUser(-1);
        $user = $mxuser->getuserinfo($user->id, true);
        // get public info instead...
    }
    mx_checkvalues($user);
    //error_log(print_r($user,true));
    $locale = $mxuser->locale ? $mxuser->locale : 'en_US';
    $locpage = mx_option('pagesdir') . '/' . $locale . '/' . $page . '.html';
    if (file_exists($locpage)) {
        $html = file_get_contents(mx_option('pagesdir') . '/' . $locale . '/' . $page . '.html');
    } else {
        $locpage = mx_option('pagesdir') . '/en_US/' . $page . '.html';
        if (file_exists($locpage)) {
            $html = file_get_contents(mx_option('pagesdir') . '/en_US/' . $page . '.html');
            //$html='<div class="nottranslated">'.
            //_('(This page will be translated to your language soon)').'</div>'.$html;
        }
    }
    $html = preg_replace('%{playicon:([^}]+)}%', '<a class="playbutton" href="javascript:play(\'$1\');">' . mx_icon('playsound', 'listen', 16, 'i_$1') . '</a>', $html);
    $html = preg_replace('%{mail:([^},]+),([^},]+),?([^}]+)}%', '<a href="mailto:$1?Subject=$3" alt="$2">$2</a>', $html);
    if (preg_match_all('%{menu:([^},]+),?([^}]+)?}%', $html, $menus)) {
        for ($i = 0; $i < count($menus[0]); $i++) {
            $html = str_replace($menus[0][$i], mx_optionlink($menus[1][$i], $menus[2][$i]), $html);
        }
    }
    $html = preg_replace('%{aboutimg:([^,}]+)(,([^}]+))?}%', '<img class="about" src="' . mx_option('siteurl') . '/images/about/$1" alt="$3" />', $html);
    $html = str_replace('{firstname}', $mxuser->firstname ? $mxuser->firstname : $mxuser->fullname, $html);
    $html = str_replace('[', '<', $html);
    $html = str_replace(']', '>', $html);
    // user stuff
    $user->subs = $mxuser->getsub($user->id);
    $stotal = $sfoy = $sfofa = $slike = 0;
    foreach ($user->subs as $k => $sub) {
        ++$stotal;
        if ($sub->subtype == MXSUBFOY) {
            ++$sfoy;
        } else {
            if ($sub->subtype == MXSUBFOFA || $sub->subtype == MXUPGFOFA) {
                ++$sfofa;
            } else {
                if ($sub->subtype == MXSUBLIKE) {
                    ++$slike;
                }
            }
        }
    }
    $html = str_replace('{PIC}', '<img tag="' . $user->id . '" src="' . mx_fanpic($user->id, 'large') . '" />', $html);
    $html = str_replace('{ARTISTPIC}', '<img tag="' . $user->id . '" class="artistpic" src="' . mx_artpic($user->id, 'large', $user->gender) . '" itemprop="image"/>', $html);
    //if ($user->acctype==MXACCOUNTFAN) {
    if ($sfofa + $sfoy >= 10) {
        $fanrank = 'n1fan';
    } else {
        if ($sfofa + $sfoy >= 1) {
            $fanrank = 'truefan';
        } else {
            $fanrank = 'fanlogo';
        }
    }
    //}
    $html = str_replace('{FANPIC}', '<img tag="' . $user->id . '" class="fanpic" src="' . mx_fanpic($user->id, 'large', $user->gender) . '" itemprop="image"/>' . '<div class="picstamp"><img class="picstamp" src="' . mx_iconurl($fanrank) . '"/></div>', $html);
    $html = str_replace('{ARTISTNAME}', mx_getartistname($user), $html);
    $html = str_replace('{LASTSEEN}', mx_difftime($user->lastseen), $html);
    $html = str_replace('{NAME}', mx_getname($user), $html);
    $html = str_replace('{FULLNAME}', mx_getname($user), $html);
    if (strpos($html, '{BACKGROUND}') > 0) {
        $bg = $mxuser->getbackgroundurl($user->background_id);
        $html = str_replace('{BACKGROUND}', $bg, $html);
        if (!strpos($bg, 'tiled')) {
            $html = str_replace('{BACKGROUNDSIZE}', 'background-size:100%;', $html);
        }
    }
    // find transparency background
    $opt = 90;
    if (array_key_exists($user->transparency, $transparencies)) {
        $opt = 100 - $user->transparency;
    }
    if ($opt < 50) {
        $opt = 50;
    }
    $whitebg = $opt ? mx_option('siteurl') . '/images/background/white-dot-' . $opt . '.png' : '';
    $yellowbg = $opt ? mx_option('siteurl') . '/images/background/yellow-dot-' . $opt . '.png' : '';
    $html = str_replace('{WHITEBG}', $whitebg, $html);
    $html = str_replace('{YELLOWBG}', $yellowbg, $html);
    $html = str_replace('{OPACITY}', 1 - $user->transparency / 100, $html);
    $html = str_replace('{OPACITY100}', 100 - $user->transparency, $html);
    $html = str_replace('{BIO}', mx_urls2anchors(mx_cleanhtml($user->longbio)), $html);
    $html = str_replace('{AGE}', $user->age, $html);
    $html = str_replace('{BDAY}', $user->birthday, $html);
    $html = str_replace('{ABOUT}', mx_cleanhtml($user->shortbio), $html);
    $html = str_replace('{GENDER}', mx_gender($user->gender), $html);
    $html = str_replace('{WEBSITE}', mx_urls($user->website), $html);
    $html = str_replace('{EMAIL}', $user->email, $html);
    $artlinks = '<ul>';
    if ($user->username) {
        foreach (array('artist', 'artists', 'art', 'arts', 'at') as $aurl) {
            $link = 'http://' . $user->username . '.' . $aurl . '.example.com';
            $artlinks .= '<li><a href="' . $link . '">' . $link . '</a></li>';
        }
        $link = 'http://www.example.com/a/' . $user->username;
        $artlinks .= '<li><a href="' . $link . '">' . $link . '</a></li>';
    }
    $link = 'http://www.example.com/artists/artprof?a=' . $user->id;
    $artlinks .= '<li><a href="' . $link . '">' . $link . '</a></li>';
    $artlinks .= '</ul>';
    $html = str_replace('{ARTLINKS}', $artlinks, $html);
    $fanlinks = '<ul>';
    if ($user->username) {
        foreach (array('fan', 'fans') as $furl) {
            $link = 'http://' . $user->username . '.' . $furl . '.example.com';
            $fanlinks .= '<li><a href="' . $link . '">' . $link . '</a></li>';
        }
        $link = 'http://www.example.com/f/' . $user->username;
        $fanlinks .= '<li><a href="' . $link . '">' . $link . '</a></li>';
    }
    $link = 'http://www.example.com/fans/fanprof?a=' . $user->id;
    $fanlinks .= '<li><a href="' . $link . '">' . $link . '</a></li>';
    $fanlinks .= '</ul>';
    $html = str_replace('{FANLINKS}', $fanlinks, $html);
    if (strpos($html, '{STYLES}') > 0 || strpos($html, '{TASTES}') > 0) {
        $genres = $mxdb->listgenres();
        $cats = array();
        $subgenres = array();
        foreach ($genres as $genre) {
            if (!$genre->cat) {
                $cats[$genre->hash] = $genre->id;
                $subgenres[$genre->id] = array();
            }
        }
        foreach ($genres as $genre) {
            if ($genre->cat) {
                $subgenres[$cats[$genre->cat]][] = $genre->id;
                $catgenre[$genre->id] = $cats[$genre->cat];
            }
        }
        if (strpos($html, '{STYLES}') > 0) {
            $value = $user->genres;
        } else {
            $value = $user->tastes;
        }
        $str = '<table class="genres">';
        $ok = 0;
        for ($i = 0; $i < 5; $i++) {
            $genre = $value[$i];
            if ($genre) {
                $cat = $catgenre[$genre];
                $str .= '<tr><th>' . (!$i ? _('Primary') : ($i == 1 ? _('Secondary') : _('Other'))) . ':</th><td>' . $genres[$genre]->genre . ($cat ? ' (' . $genres[$cat]->genre . ')' : '') . '</td></tr>';
                $ok = 1;
            }
        }
        $str .= '</table>';
        if (!$ok) {
            $str = _('Not informed');
        }
        $html = str_replace('{TASTES}', $str, $html);
        $html = str_replace('{STYLES}', $str, $html);
    }
    if (strpos($html, '{MEDIA}') > 0) {
        //$mediatable=$mxuser->listartistmedia($user->id);
        //$html=str_replace('{MEDIA}',mx_showmediastr($mediatable),$html);
        //$mediatable=$mxuser->listartistmedia($user->id);
        $googlecrawler = mx_securestring($_GET['_escaped_fragment_']);
        $ob = preg_replace('%[^0-9]%', '', $googlecrawler);
        //error_log('ob='.$ob.' / media->id='.$media->id);
        $mediatable = mx_showmediastr($user->id, 'media', $ob ? $ob : $media->id);
        $html = str_replace('{MEDIA}', $mediatable, $html);
    }
    $location = '';
    if ($user->city) {
        $location .= '<span itemprop="addressLocality">' . $user->city . '</span>';
    }
    if ($user->state) {
        $location .= ($location ? ', ' : '') . '<span itemprop="addressRegion">' . $user->state . '</span>';
    }
    if ($user->country) {
        $location .= ($location ? ', ' : '') . '<span itemprop="addressCountry">' . mx_getcountryname($user->country) . '</span>';
    }
    $html = str_replace('{LOCATION}', $location, $html);
    $html = str_replace('{FACELIKE}', '<fb:like href="' . mx_actionurl_prod('artists', 'artprof', $user->id) . '" send="false" show_faces="false" width="60" font=""></fb:like>', $html);
    $html = str_replace('{PLUSONE}', '<g:plusone size="medium" href="' . mx_actionurl_prod('artists', 'artprof', $user->id) . '" callback="mxpluslike"></g:plusone>', $html);
    $html = str_replace('{FANFACELIKE}', '<fb:like href="' . mx_actionurl_prod('fans', 'fanprof', $user->id) . '" send="false" show_faces="true" width="60" font=""></fb:like>', $html);
    $html = str_replace('{FANPLUSONE}', '<g:plusone size="medium" href="' . mx_actionurl_prod('fans', 'fanprof', $user->id) . '"></g:plusone>', $html);
    $hassub = 0;
    if (strpos($html, '{SUBSCRIBERS}') > 0) {
        $html = str_replace('{SUBSCRIBERS}', mx_subscribers($user->id, false), $html);
    }
    if (strpos($html, '{LIKERS}') > 0) {
        $html = str_replace('{LIKERS}', mx_subscribers($user->id, true), $html);
    }
    if (strpos($html, '{SUBSCRIPTIONS}') > 0 || strpos($html, '{LIKES}') > 0 || strpos($html, '{SUBSCRIBE}') > 0) {
        if (strpos($html, '{SUBSCRIPTIONS}') > 0) {
            $html = str_replace('{SUBSCRIPTIONS}', mx_subscriptions($user->subs, false), $html);
        }
        if (strpos($html, '{LIKES}') > 0) {
            $html = str_replace('{LIKES}', mx_subscriptions($user->subs, true), $html);
        }
    }
    $mysubs = $mxuser->getsub();
    foreach ($mysubs as $sub) {
        if ($sub->subcat == MXARTSUB && $sub->objectid == $user->id && $sub->status != MXEXPIREDSUB) {
            $hassub = $sub->subtype;
            $autorenew = $sub->renewal;
            break;
        }
    }
    if (strpos($html, '{ILOVE}') > 0) {
        if (!$mxuser->id) {
            $str = '';
        } else {
            if ($hassub == MXSUBLIKE) {
                // likers
                $str = mx_icon('ilove', _('Like!'), '', 'nl_' . $user->id, 'ilovehover', 'class');
            } else {
                if ($hassub) {
                    // fan love
                    $str = mx_icon('fanlove', _('Fan Love'), '');
                } else {
                    if ($mxuser->id == $user->id) {
                        $str = mx_icon('melove', _('Love Me'), '');
                    } else {
                        $str = mx_icon('nolove', _('I LOVE THIS!'), '', 'il_' . $user->id, 'nolovehover', 'class');
                    }
                }
            }
        }
        $html = str_replace('{ILOVE}', $str, $html);
    }
    if (strpos($html, '{SUBSCRIBE}') > 0 && $mxuser->id && $mxuser->id != $user->id && $user->status != MXACCTDISABLED && ($user->pubcnt >= MXMINIMUMMEDIA || is_admin())) {
        $subscribefoy = _('1-Year: ${FOY}');
        //$subscribefofa=_('{FOFAYRS}: ${FOFA}');
        //$upgradefofa=_('Upgrade: ${FOFAUPG}');
        $subfoybtn = array(1, $subscribefoy, 'g-button', 'subs1year', '<b>F</b>an <b>O</b>ne <b>Y</b>ear (FOY)<br/>This fanship entitles you to <b>listen to and download all media</b>, <u>from this artist' . ' exclusively</u>, <b>during 1 year</b>. After the first renewal in 1 year, ' . 'you will get access to this artist\'s media forever.');
        $subfofabtn = array(1, $subscribefofa, 'g-button', 'subsforever', '<b>F</b>an <b>O</b>nce <b>F</b>an <b>A</b>lways (FOFA)<br/>This fanship entitles you to <b>download all media</b>, <u>from this artist' . ' exclusively</u>, <b>forever</b>');
        $subfofaupgbtn = array(1, $upgradefofa, 'g-button', 'subsforeverupg', 'This upgrade entitles you to <b>download all media</b>, <u>from this artist' . ' exclusively</u>, <b>forever</b>');
        if ($hassub == MXSUBFOFA || $hassub == MXUPGFOFA) {
            $subscribetxt = _('You\'re a Fan, FOREVER!');
            $cansubfoy = false;
            $cansubfofa = false;
            $canupgfofa = false;
        } else {
            if ($hassub == MXSUBFOY) {
                if ($autorenew) {
                    $subscribetxt = _('Auto-Renewal Enabled');
                } else {
                    $subscribetxt = _('Auto-Renewal Disabled');
                }
                $cansubfoy = false;
                $cansubfofa = false;
                $canupgfofa = false;
            } else {
                $subscribetxt = sprintf(_('Subscribe to this %s'), $user->acctype == MXACCOUNTARTIST ? _("Artist") : _("Band"));
                $cansubfoy = true;
                $cansubfofa = false;
                $canupgfofa = false;
            }
        }
        $addcart = '<form style="display:inline" name="addtocart" action="' . mx_pageurl('cart') . '" method="POST">' . '<div class="title"><img src="' . mx_option('templateURL') . '/icons/cart.png" />' . ' ' . $subscribetxt . '</div>' . '<input type="hidden" name="id" value="' . $user->id . '">' . '<input type="hidden" name="a" value="">' . ($cansubfoy ? mx_formfield('addfoy', $subscribefoy, $subfoybtn) : '') . ($cansubfofa ? mx_formfield('addfofa', $subscribefofa, $subfofabtn) : '') . ($canupgfofa ? mx_formfield('upgfofa', $upgradefofa, $subfofaupgbtn) : '') . '</form>';
        $html = str_replace('{SUBSCRIBE}', $addcart, $html);
    } else {
        if ($user->status == MXACCTDISABLED) {
            $html = str_replace('{SUBSCRIBE}', _('Sorry, this account is no more active.'), $html);
        } else {
            if ($mxuser->id == $user->id) {
                $html = str_replace('{SUBSCRIBE}', _('Hey! You\'re an artist!!'), $html);
            } else {
                $logfirst = '<div class="title"><img src="' . mx_option('templateURL') . '/icons/cart.png" /> ' . _('to become a FAN...') . '</div>' . sprintf(_('%s or %s'), '<a href="' . mx_actionurl('account', 'signin', '', '', 'artists,artprof,' . $user->id) . '" alt="' . _('Sign-in') . '">' . mx_icon('signinbtn', _('Sign-in'), '', 'xx', 'signinbtnhover') . '</a>', '<a href="' . mx_actionurl('account', 'register', '', '', 'artists,artprof,' . $user->id, '', 'i=' . $user->invitecode) . '" alt="' . _('Register') . '">' . mx_icon('registerbtn', _('Register'), '', 'xx', 'registerbtnhover') . '</a>');
                $html = str_replace('{SUBSCRIBE}', $logfirst, $html);
            }
        }
    }
    // fans stats
    $fanstats = '<table><tr><th>' . _('Stats') . '</th></tr>' . '<tr><td><a href="javascript:tabswitch(\'GENERAL\',\'SUBSCRIPTIONS\');">' . _('Fanships') . '</a>' . '<br/>' . _('FOFA:') . ' ' . $sfofa . '<br/>' . _('FOY:') . ' ' . $sfoy . '<br/>' . _('Likes:') . ' ' . $slike . '<br/><span class="stattotal">' . _('Total:') . ' ' . $stotal . '</span>' . '</td></tr>' . '</table>';
    $html = str_replace('{FANSTATS}', $fanstats, $html);
    // artists stats
    $stats = '<table><tr><th>' . _('Stats') . '</th></tr>' . '<tr><td class="first"><a href="javascript:tabswitch(\'GENERAL\',\'MEDIA\');">' . _('Media') . '</a>' . '<br/><span class="stathdr">' . _('Uploaded') . '</span><br/>' . $user->mediacnt . ($user->mediacnt != MXNOTINFORMED ? ' (' . mx_size($user->mediasize) . ')' : '') . '<br/><span class="stathdr">' . _('Published') . '</span><br/>' . $user->pubcnt . ' (' . mx_size($user->pubsize) . ')</td></tr>' . '<tr><td><a href="javascript:tabswitch(\'GENERAL\',\'SUBSCRIBERS\');">' . _('Fans') . '</a>' . '<br/>' . _('FOFA:') . ' ' . $user->subfofa . '<br/>' . _('FOY:') . ' ' . $user->subfoy . '<br/>' . _('Likes:') . ' ' . $user->sublike . '<br/><span class="stattotal">' . _('Total:') . ' ' . $user->subcnt . '</span>' . '</td></tr>' . '</table>';
    $html = str_replace('{STATS}', $stats, $html);
    $html = str_replace('{FOY}', MXFEEFOY, $html);
    $html = str_replace('{FOFA}', MXFEEFOFA, $html);
    $html = str_replace('{FOFAUPG}', sprintf('%.2d', MXFEEFOFA - MXFEEFOY), $html);
    $html = str_replace('{FOFAYRS}', MXFOFAYRS, $html);
    $html = str_replace('{FREE}', MXFEEFREE, $html);
    $html = str_replace('{BASIC}', MXFEEBASIC, $html);
    $html = str_replace('{PLUS}', MXFEEPLUS, $html);
    $html = str_replace('{PREMIUM}', MXFEEPREMIUM, $html);
    $html = str_replace('{1SONG}', MXFEE1SONG, $html);
    $html = str_replace('{SONGS}', MXFEESONGS, $html);
    $html = str_replace('{SETUPFEE}', MXFEESETUP, $html);
    $html = str_replace('{siteurl}', mx_option('siteurl'), $html);
    $html = str_replace('{WALL}', mx_showuserwallstr($user), $html);
    $html = str_replace('{MYREVIEWS}', _('Available Soon'), $html);
    $chats = '<iframe class="chat" src="../ext_includes/chat/index.php"></iframe>';
    $html = str_replace('{SHOWS}', _('Available Soon'), $html);
    $html = str_replace('{CHATS}', _('Available Soon'), $html);
    $html = str_replace('{MENTIONS}', _('Available Soon'), $html);
    $fbreviews = '<div class="fb-comments" data-href="' . mx_actionurl('artists', 'artprof', $user->id) . '" data-num-posts="10" data-width="540"></div>';
    $html = str_replace('{REVIEWS}', $fbreviews, $html);
    if (strpos($html, '{SHARE}') > 0) {
        $tools = mx_sharetools($user->id, true);
    }
    // artists tools
    if (strpos($html, '{SHAREFAN}') > 0) {
        $tools = mx_sharetools($user->id, false);
    }
    // fans tools
    $html = str_replace('{SHARE}', $tools, $html);
    // for artists
    $html = str_replace('{SHAREFAN}', $tools, $html);
    // for fans
    $html = str_replace('{QRCODE}', mx_qrcode($user, true), $html);
    // for artists
    $html = str_replace('{QRCODEFAN}', mx_qrcode($user, false), $html);
    // for fans
    // build tabs if needed
    $realnames = array('MEDIA' => _('Media'), 'GENERAL' => _('Info'), 'WALL' => _('Wall'), 'SHOWS' => _('Shows'), 'MENTIONS' => _('Mentions'), 'REVIEWS' => _('Reviews'), 'SUBSCRIBERS' => _('Fans'), 'LIKERS' => _('Likers'), 'MYREVIEWS' => _('My Reviews'), 'SUBSCRIPTIONS' => _('Fanships'), 'LIKES' => _('Likes'), 'FRIENDS' => _('Friends'), 'CHATS' => _('Chats'), 'SHARE' => _('Share!'), 'RESTRICTED' => _('RESTRICTED'));
    if (strpos($html, '{TABS}') > 0) {
        $html = str_replace('{TABS}', '<div class="form"><table><tr><td>', $html);
        $html = str_replace('{/TABS}', '</td></tr></table></div>', $html);
        $tabs = preg_match_all('%{TAB:([*+]?)([^}]+)}%', $html, $tabnames);
        $group = mx_secureword($_REQUEST['k']);
        if (!$group || !array_search($group, $tabnames[2])) {
            $group = $tabnames[2][0];
        }
        for ($i = 0; $i < $tabs; $i++) {
            //$newtab='<div id="artist_'.($form?'f_':'').$i.'" class="'.$style.((($i==$group) && !$form)?'':' hidden').'">';
            $newtab = '<div id="' . $tabnames[2][$i] . ($form ? '_f' : '') . '" class="' . $style . ($tabnames[2][$i] == $group && !$form ? '' : ' hidden') . '">';
            //$newtab.='<form name="artist_'.$i.'" method="POST" enctype="multipart/form-data"' .
            //		' onsubmit="return checkform(\'artist_'.$i.'\');">';
            $newtab .= '<table><tr><td>';
            $newtab .= '<fieldset>';
            for ($j = 0; $j < $tabs; $j++) {
                $tabclass = '';
                if ($tabnames[1][$j] == '*') {
                    if (!is_admin()) {
                        continue;
                    }
                    $tabclass = ' admin';
                } else {
                    if ($tabnames[1][$j] == '+') {
                        if ($mxuser->id != $user->id && !is_admin()) {
                            continue;
                        }
                        if ($mxuser->id == $user->id) {
                            $tabclass = ' owner';
                        } else {
                            $tabclass = ' admin';
                        }
                    }
                }
                if ($i == $j) {
                    $newtab .= '<legend class="seltab' . $tabclass . '">' . $realnames[$tabnames[2][$i]] . '</legend>';
                } else {
                    $newtab .= '<legend class="tab' . $tabclass . '"><a href="javascript:tabswitch(\'' . $tabnames[2][$i] . '\',\'' . $tabnames[2][$j] . '\');"' . ' alt="' . $realnames[$tabnames[2][$j]] . '">' . $realnames[$tabnames[2][$j]] . '</a></legend>';
                }
            }
            $html = str_replace($tabnames[0][$i], $newtab, $html);
        }
        //$html=str_replace('{/TAB}','</td></tr></table></fieldset></td></tr>',$html);
        $str = '</fieldset></td></tr></table>';
        //$str.='</form>';
        $str .= '</div>';
        $html = str_replace('{/TAB}', $str, $html);
    }
    // link to add as a friend
    if ($user->id == $mxuser->id) {
        $befriend = _('Hey, this is you!!');
    } else {
        if ($mxuser->isfriend($user->id)) {
            $befriend = sprintf('%s<br/>%s', _('This is one of your friends'), '<a href="' . mx_actionurl('account', 'messages', 'sm:' . $user->id, 'writemsg') . '">' . _('Send a Message') . '</a>');
            if ($user->acctype == MXACCOUNTARTIST) {
                $befriend .= '<br/><a href="' . mx_actionurl('artists', 'artprof', $user->id) . '">' . _('See Artist Page') . '</a>';
            }
        } else {
            $befriend = '<a href="' . mx_actionurl('account', 'messages', 'af:' . $user->id, 'writemsg') . '">' . _('Request Friendship') . '</a>';
            /*
            if (is_admin()) {
            	$befriend.='<br/><a href="'.mx_actionurl('artists','artprof',$user->id).'">'._('See Artist Page [ADM]').'</a>';
            }
            */
        }
    }
    $html = str_replace('{BEFRIEND}', $befriend, $html);
    $friends = $mxuser->getfriends($user->id);
    if (!$friends) {
        $friendslist = _('This person\'s friends list is hidden.');
    } else {
        if (!count($friends['confirmed'])) {
            $friendslist = _('This person\'s friends list is empty.');
        } else {
            $friendslist = mx_showdirstr($friends['confirmed']);
        }
    }
    $html = str_replace('{FRIENDS}', $friendslist, $html);
    $html = preg_replace('%\\r?\\n\\r?\\n%', '<br/><br/>', $html);
    // graphic stats
    if (strpos($html, '{MYSTATS}') > 0 && ($user->id == $mxuser->id || is_admin())) {
        $mystats = mx_statsstr($user);
        $html = str_replace('{MYSTATS}', $mystats, $html);
    }
    $html = str_replace('{PRICE}', '<table class="buymedia"><tr><td>', $html);
    $html = str_replace('{PRICE2}', '</td><td>', $html);
    $html = str_replace('{PRICE3}', '</td></tr></table>', $html);
    $media->purchase = str_replace('{PRICE}', '<table class="buymedia"><tr><td>', $media->purchase);
    $media->purchase = str_replace('{PRICE2}', '</td><td>', $media->purchase);
    $media->purchase = str_replace('{PRICE3}', '</td></tr></table>', $media->purchase);
    // media pages
    $html = str_replace('{MEDIASCHEMA}', $media->schema, $html);
    $html = str_replace('{BUYTAG}', $media->pricetag, $html);
    $html = str_replace('{BUYMEDIA}', $media->purchase, $html);
    $html = str_replace('{MEDIAMETA}', $media->meta, $html);
    $html = str_replace('{MEDIA_TITLE}', $media->title, $html);
    $html = str_replace('{MEDIA_DESC}', $media->description . $media->content, $html);
    $html = str_replace('{MEDIA_PIC}', $media->mediapic, $html);
    $html = str_replace('{MEDIA_BUTTONS}', $media->buttons ? '<div class="mediabuttons"><div id="player">' . $media->buttons . '</div></div>' : '', $html);
    if (strpos($html, '{MEDIA_CONTENT}') > 0) {
        if ($media->type == MXMEDIABASEBUNDLE || $media->type == MXMEDIAREGULARBUNDLE) {
            $mediatable = mx_xmlbundle($media->id, 'media', '', false);
            $mediatable = str_replace('pubmed', 'pubmed bundled bun_' . $media->id, $mediatable);
            $mediatable = preg_replace('%input_.%', 'bundled', $mediatable);
            $submedia = '<table class="mediadetails">';
            $submedia .= '<tr><td><h5>' . _('Medias') . '</h5></td></tr>';
            $submedia .= $mediatable . '</table>';
        } else {
            $submedia = '<table class="mediadetails">';
            $submedia .= '<tr><td><h5>' . (count($media->bundles) > 1 ? _('Bundles') : _('Bundle')) . '</h5></td></tr>';
            foreach ($media->bundles as $bundle) {
                $submedia .= '<tr class="pubmed bundled"><td class="msgcell bundled media_mediadata">' . '<div class="bundledetails" itemprop="inAlbum" itemscope itemtype="http://schema.org/MusicAlbum">' . '<div class="bundleminipic">' . '<a href="' . mx_actionurl('media', 'medprof', $bundle->id) . '" title="' . $bundle->title . ' - ' . _('See Media Page') . '" class="pictooltip" itemprop="url">' . $bundle->mediapic . '</a>' . '</div>' . '<div class="bundletitle" itemprop="name">' . $bundle->title . '</div>' . '<div class="bundledesc" itemprop="description">' . $bundle->description . '</div>' . '</div></td>' . '</tr>';
            }
            $submedia .= '</table>';
        }
        $html = str_replace('{MEDIA_CONTENT}', $submedia, $html);
    }
    $html = str_replace('{ARTISTLINK}', mx_actionurl('artist', 'artprof', $user->id), $html);
    if (strpos($html, '{ARTISTBUTTON}') > 0) {
        $artistbutton = '<div class="artistpic" itemprop="byArtist" itemscope itemtype="http://www.schema.org/MusicGroup">' . '<a href="' . mx_actionurl('artists', 'artprof', $user->id) . '" title="' . mx_getartistname($user) . ' - ' . _('See Page') . '" class="pictooltip" itemprop="url">' . '<img tag="' . $user->id . '" class="artistpic" src="' . mx_artpic($user->id, 'large', $user->gender) . '" itemprop="image">' . '</a>' . '<br/><span itemprop="name">' . mx_getartistname($user) . '</span>' . '</div>';
        $html = str_replace('{ARTISTBUTTON}', $artistbutton, $html);
    }
    if (strpos($html, '{USERSHARE}') > 0) {
        $url = $user->acctype == MXACCOUNTFAN ? mx_actionurl('fans', 'fanprof', $user->id) : mx_actionurl('artists', 'artprof', $user->id);
        if (!is_logged()) {
            $sharebutton = mx_sharebuttons('u_' . $user->id, $url, mx_artpic($user->id, 'large', $user->gender), $user->shortbio);
        } else {
            $sharebutton = '';
        }
        $html = str_replace('{USERSHARE}', $sharebutton, $html);
    }
    if (strpos($html, '{MEDIASHARE}') > 0) {
        $url = mx_option('basicsiteurl') . '/m/' . $media->id;
        if (!is_logged()) {
            $sharebutton = mx_sharebuttons('m' . $media->id, $url, $media->pic, $media->description);
        } else {
            $sharebutton = '';
        }
        $html = str_replace('{MEDIASHARE}', $sharebutton, $html);
    }
    // -end user stuff
    if ($html) {
        echo $html;
    } else {
        __('(Content not yet ready)');
    }
    if ($simul == 'public') {
        ?>
		<script>
		simul=$('<div class="simulation"><?php 
        __('Public View');
        ?>
</div>');
		simul.appendTo($('.artisttmpl1'));
		</script>
		<?php 
        $mxuser = new MXUser();
    }
}