function mx_showmediapage($id) { global $mxuser; $id = preg_replace('%[^0-9]%', '', $id); // filter fake media ids $media = $mxuser->getmediainfo($id); if (!$media) { __('Sorry, this media could not be found.'); return; } $fanship = $mxuser->getfanship($media->owner_id, $id); if ($media->status == MXMEDIAREADY || $media->type == MXMEDIABASEBUNDLE && $fanship != null) { __('This media has not been released yet'); return; } mx_medialist($media, $fanship, true); foreach ($media->bundles as $bundle) { $bfanship = $mxuser->getfanship($bundle->owner_id, $bundle->id); mx_medialist($bundle, $bfanship, true); } $dbuser = $mxuser->getuserinfo($media->owner_id); if ($dbuser->status == MXACCTDISABLED) { __('Media is unavailable.'); return; } if ($dbuser->acctype == MXACCOUNTFAN) { echo sprintf(_('This media is private' . 'and belongs to this %s.'), mx_actionlink('fans', 'fanprof', $id)); return; } if (!$dbuser || $dbuser->status == MXACCTDISABLED) { mx_optiontitle('error', _('Media unavailable.')); return; } mx_optionsubtitle('→ ' . $media->title); $authflds = $mxuser->getauthorizedfields($dbuser->id); $authgrps = $mxuser->getauthorizedgroups($authflds); $media->artist = $dbuser; //echo mx_mediadata($media,$fanship); $section = ''; if (!$authgrps || !$authflds) { __('No information available.'); return; } $custpage = 'basicmediatemplate'; mx_showcustompage($custpage, $dbuser, $media); if ($media->type == MXMEDIAREGULARBUNDLE) { mx_fbaction('musxpand:examine?bundle=' . urlencode(mx_actionurl('media', 'medprof', $id))); } if ($_GET['z']) { ?> <script type='text/javascript'> $(window).ready(function() { play(0); }); </script> <?php } }
function mx_onefav($fav) { global $mxuser; switch ($fav->favtype) { case MXFAVUSER: $user = $mxuser->getuserinfo($fav->favid); $link = mx_actionurl('artists', 'artprof', $fav->favid); $pic = mx_artpic($fav->favid, 'square', MXSEXMALE); $class = 'artistpic'; $alt = mx_getartistname($user); break; case MXFAVMEDIA: $media = $mxuser->getmediainfo($fav->favid); $fanship = $mxuser->getfanship($media->owner_id, $media->id); mx_medialist($media, $fanship); $link = mx_actionurl('media', 'medprof', $fav->favid); $pic = $media->pic; $alt = $media->title; $class = 'bundlepic'; break; default: $pic = 'xx'; $link = ''; $alt = ''; $class = ''; } return '<div class="favorite" tag="' . $fav->id . '"' . ' onmouseover="$(this).find(\'.favdel\').show();"' . ' onmouseout="$(this).find(\'.favdel\').hide();">' . '<a href="' . $link . '" title="' . $alt . ' - ' . _('See Page') . '" class="pictooltip">' . '<img tag="' . $fav->favid . '" class="' . $class . '" src="' . $pic . '" alt="' . $alt . '"/>' . '</a>' . '<div class="favdel"><div' . ' onclick="return delfav(' . $fav->id . ');"' . ' onmouseover="$(this).css(\'background\',\'black\');"' . ' onmouseout="$(this).css(\'background\',\'white\');"' . '>X</div></div>' . '</div>'; }
function mx_metatags() { global $mxuser; $page = mx_secureword($_GET['p']); $option = mx_secureword($_GET['o']); $action = $_REQUEST['a']; $updtime = '<meta property="og:updated_time" content="' . time() . '" />'; if ($page != 'artists' && $page != 'fans' && $page != 'media') { echo '<meta property="og:title" content="MusXpand - ' . mx_option('title') . '" />' . '<meta name="title" content="MusXpand - ' . mx_option('title') . '" />' . '<meta property="og:type" content="website" />' . '<meta property="og:url" content="' . mx_option('basicsiteurl') . '" />' . '<meta property="og:image" content="' . mx_option('m-logoURL-48x48') . '" />' . '<meta property="og:site_name" content="MusXpand" />' . '<meta property="fb:app_id" content="' . FACEBOOK_APP_ID . '" />' . '<meta property="fb:admins" content="100001498041340" />' . $updtime . '<meta name="description" content="MusXpand is an open social network for artists and fans to share media, news and comments." />' . '<meta name="copyright" content="2010-2012 © MusXpand." />' . '<meta name="keywords" content="' . MXKEYWORDS . '" />' . '<link rel="canonical" href="http://www.example.com">'; return; } if ($page == 'artists' && $option == 'artprof' && $action) { $user = $mxuser->getuserinfo($action); $artistname = mx_getartistname($user); $location = ''; if ($user->city) { $location .= $user->city; } if ($user->state) { $location .= ($location ? ', ' : '') . $user->state; } if ($user->country) { $location .= ($location ? ', ' : '') . mx_getcountryname($user->country); } if ($location) { $location .= '. '; } $url = $user->username ? mx_option('basicsiteurl') . '/a/' . $user->username : mx_actionurl_prod($page, $option, $user->id, '', '', true); echo '<meta property="og:title" content="' . $artistname . '" />' . '<meta name="title" content="' . sprintf(_('%s on MusXpand'), $artistname) . '" />' . '<meta name="description" content="' . htmlentities($user->shortbio) . ' - ' . $artistname . ' is a MusXpand Artist." />' . '<meta name="copyright" content="2010-2012 © MusXpand & ' . $artistname . '" />' . '<meta name="keywords" content="' . MXKEYWORDS . ',' . $artistname . '" />' . '<meta property="og:type" content="musxpand:artist" />' . '<meta property="og:url" content="' . $url . '" />' . '<meta property="og:audio" content="' . $url . '" />' . '<meta property="og:audio:type" content="vnd.facebook.bridge" />' . '<meta property="og:image" content="' . mx_fanpic($user->id, 'large') . '" />' . '<meta property="og:site_name" content="MusXpand" />' . '<meta property="og:description" content="' . htmlentities($location . $user->shortbio) . '" />' . $updtime . '<meta property="fb:app_id" content="' . FACEBOOK_APP_ID . '" />' . ($user->fbid ? '<meta property="fb:admins" content="' . $user->fbid . '" />' : '') . '<link rel="canonical" href="' . mx_actionurl_prod($page, $option, $user->id, '', '', true) . '">'; return; } else { if ($page == 'account' && $option == 'myartpage') { $artistname = $mxuser->getartistname(); $location = ''; if ($mxuser->city) { $location .= $mxuser->city; } if ($mxuser->state) { $location .= ($location ? ', ' : '') . $mxuser->state; } if ($mxuser->country) { $location .= ($location ? ', ' : '') . mx_getcountryname($mxuser->country); } if ($location) { $location .= '. '; } $url = $user->username ? mx_option('basicsiteurl') . '/a/' . $mxuser->username : mx_actionurl_prod('artists', 'artprof', $mxuser->id, '', '', true); echo '<meta property="og:title" content="' . $artistname . '" />' . '<meta name="title" content="' . sprintf(_('%s on MusXpand'), $artistname) . '" />' . '<meta name="description" content="' . htmlentities($mxuser->shortbio) . ' - ' . $artistname . ' is a MusXpand Artist." />' . '<meta name="copyright" content="2010-2012 © MusXpand & ' . $artistname . '" />' . '<meta name="keywords" content="' . MXKEYWORDS . ',' . $artistname . '" />' . '<meta property="og:type" content="musxpand:artist" />' . '<meta property="og:url" content="' . $url . '" />' . '<meta property="og:audio" content="' . $url . '" />' . '<meta property="og:audio:type" content="vnd.facebook.bridge" />' . '<meta property="og:image" content="' . mx_fanpic($mxuser->id, 'large') . '" />' . '<meta property="og:site_name" content="MusXpand" />' . '<meta property="og:description" content="' . htmlentities($location . $mxuser->shortbio) . '" />' . $updtime . '<meta property="fb:app_id" content="' . FACEBOOK_APP_ID . '" />' . ($mxuser->fbid ? '<meta property="fb:admins" content="' . $mxuser->fbid . '" />' : '') . '<link rel="canonical" href="' . mx_actionurl_prod('artists', 'artprof', $mxuser->id, '', '', true) . '">'; return; } else { if ($page == 'fans' && $option == 'fanprof' && $action) { $user = $mxuser->getuserinfo($action); $fanname = mx_getname($user); $location = ''; if ($user->city) { $location .= $user->city; } if ($user->state) { $location .= ($location ? ', ' : '') . $user->state; } if ($user->country) { $location .= ($location ? ', ' : '') . mx_getcountryname($user->country); } $url = $user->username ? mx_option('basicsiteurl') . '/f/' . $user->username : mx_actionurl_prod($page, $option, $user->id, '', '', true); echo '<meta property="og:title" content="' . $fanname . '" />' . '<meta name="title" content="' . sprintf(_('%s on MusXpand'), $fanname) . '" />' . '<meta name="description" content="' . htmlentities($user->shortbio) . ' - ' . $fanname . ' is a MusXpand Fan." />' . '<meta name="copyright" content="2010-2012 © MusXpand & ' . $fanname . '" />' . '<meta name="keywords" content="' . MXKEYWORDS . ',' . $fanname . '" />' . '<meta property="og:type" content="profile" />' . '<meta property="og:url" content="' . $url . '" />' . '<meta property="og:image" content="' . mx_fanpic($user->id, 'large') . '" />' . '<meta property="og:site_name" content="MusXpand" />' . '<meta property="og:description" content="' . htmlentities($user->shortbio) . '" />' . $updtime . '<meta property="musxpand:location" content="' . $location . '" />' . '<meta property="fb:app_id" content="' . FACEBOOK_APP_ID . '" />' . ($user->fbid ? '<meta property="fb:admins" content="' . $user->fbid . '" />' : '') . '<link rel="canonical" href="' . mx_actionurl_prod($page, $option, $user->id, '', '', true) . '">'; return; } else { if ($page == 'account' && $option == 'myfanpage') { $fanname = $mxuser->getname(); $location = ''; if ($mxuser->city) { $location .= $mxuser->city; } if ($mxuser->state) { $location .= ($location ? ', ' : '') . $mxuser->state; } if ($mxuser->country) { $location .= ($location ? ', ' : '') . mx_getcountryname($mxuser->country); } $url = $user->username ? mx_option('basicsiteurl') . '/f/' . $mxuser->username : mx_actionurl_prod('fans', 'fanprof', $mxuser->id, '', '', true); echo '<meta property="og:title" content="' . $fanname . '" />' . '<meta name="title" content="' . sprintf(_('%s on MusXpand'), $fanname) . '" />' . '<meta name="description" content="' . htmlentities($mxuser->shortbio) . ' - ' . $fanname . ' is a MusXpand Fan." />' . '<meta name="copyright" content="2010-2012 © MusXpand & ' . $fanname . '" />' . '<meta name="keywords" content="' . MXKEYWORDS . ',' . $fanname . '" />' . '<meta property="og:type" content="profile" />' . '<meta property="og:url" content="' . $url . '" />' . '<meta property="og:image" content="' . mx_fanpic($mxuser->id, 'large') . '" />' . '<meta property="og:site_name" content="MusXpand" />' . '<meta property="og:description" content="' . htmlentities($mxuser->shortbio) . '" />' . $updtime . '<meta property="musxpand:location" content="' . $location . '" />' . '<meta property="fb:app_id" content="' . FACEBOOK_APP_ID . '" />' . ($mxuser->fbid ? '<meta property="fb:admins" content="' . $mxuser->fbid . '" />' : '') . '<link rel="canonical" href="' . mx_actionurl_prod('fans', 'fanprof', $mxuser->id, '', '', true) . '">'; return; } else { if ($page == 'media' && $option == 'medprof' && $action) { $media = $mxuser->getmediainfo($action); $artistname = mx_getartistname($media); $fanship = $mxuser->getfanship($media->owner_id, $media->id); mx_medialist($media, $fanship, true); $mediameta = ''; $mediadesc = $media->description; $url = mx_option('basicsiteurl') . '/m/' . $action; switch ($media->type) { case MXMEDIAINSTR: case MXMEDIASONG: //$mediatype='music.song'; $mediatype = 'musxpand:media'; $mediaurl = mx_medialink($media->filename, $media->hashcode, $media->hashdir, '-preview'); $mediameta = '<meta property="music:duration" content="' . $media->duration . '" />' . '<meta property="og:audio" content="' . $mediaurl . '" />' . '<meta property="og:audio:secure_url" content="' . str_replace('http:', 'https:', $mediaurl) . '" />' . '<meta property="og:audio:type" content="audio/vnd.facebook.bridge" />' . '<meta property="music:musician" content="' . mx_actionurl('artists', 'artprof', $media->owner_id) . '" />' . '<meta property="music:album" content="' . mx_actionurl('media', 'medprof', $media->bundles[0]->id) . '" />' . '<meta property="og:audio:title" content="' . $media->title . ' (' . _('Sample') . ')" />' . '<meta property="og:audio:artist" content="' . $artistname . '" />' . '<meta property="og:audio:album" content="' . htmlentities($media->bundles[0]->title) . '" />' . '<meta property="og:video" content="' . mx_option('siteurl') . '/flash/xspf_player_slim.swf?' . 'player_title=' . htmlentities('Listen to music on MusXpand') . '&song_url=' . urlencode($mediaurl) . '&song_title=' . htmlentities($media->title) . '" />' . '<meta property="og:video:secure_url" content="' . mx_option('secure_siteurl') . '/flash/xspf_player_slim.swf?' . 'player_title=' . htmlentities('Listen to music on MusXpand') . '&song_url=' . urlencode($mediaurl) . '&song_title=' . htmlentities($media->title) . '" />' . '<meta property="og:video:height" content="17" />' . '<meta property="og:video:type" content="application/x-shockwave-flash" />'; //.'<meta property="og:video:title" content="'.$media->title.' ('._('Sample').')" />' //.'<meta property="og:video:director" content="'.$artistname.'" />' //.'<meta property="og:video:album" content="'.htmlentities($media->bundles[0]->title).'" />' break; case MXMEDIABG: case MXMEDIAPIC: $mediatype = 'musxpand:picture'; break; case MXMEDIABASEBUNDLE: case MXMEDIAREGULARBUNDLE: $mediatype = 'musxpand:bundle'; /*$mediameta='<meta property="og:audio" content="'.$url.'" />' .'<meta property="og:audio:type" content="vnd.facebook.bridge" />';*/ break; case MXMEDIAVIDEO: //$mediatype='musxpand:videoclip'; $mediatype = 'musxpand:media'; $mediaurl = mx_medialink($media->filename, $media->hashcode, $media->hashdir, ''); $mediameta = '<meta property="og:video" content="' . $mediaurl . '" />' . '<meta property="og:video:secure_url" content="' . str_replace('http:', 'https:', $mediaurl) . '" />' . '<meta property="og:video:type" content="video/mp4" />'; break; case MXMEDIADOC: $mediatype = 'musxpand:document'; break; default: $mediatype = 'musxpand:media'; } echo '<meta property="og:title" content="' . htmlentities(sprintf(_('%s by %s'), $media->title, $artistname)) . '" />' . '<meta name="title" content="' . htmlentities(sprintf(_('%s by %s'), $media->title, $artistname)) . '" />' . '<meta name="description" content="' . htmlentities($media->description) . '" />' . '<meta name="copyright" content="2010-2012 © MusXpand & ' . $artistname . '" />' . '<meta name="keywords" content="' . MXKEYWORDS . ',' . $artistname . ',' . $media->title . '" />' . '<meta property="og:type" content="' . $mediatype . '" />' . '<meta property="og:url" content="' . $url . '" />' . '<meta property="og:image" content="' . $media->pic . '" />' . $mediameta . '<meta property="musxpand:artist" content="' . mx_actionurl('artists', 'artprof', $media->owner_id) . '" />' . ($media->type != MXMEDIAREGULARBUNDLE && $media->type != MXMEDIABASEBUNDLE ? '<meta property="musxpand:bundle" content="' . mx_actionurl('media', 'medprof', $media->bundles[0]->id) . '" />' : '') . '<meta property="og:site_name" content="MusXpand" />' . '<meta property="og:description" content="' . htmlentities($mediadesc) . '" />' . $updtime . '<meta property="fb:app_id" content="' . FACEBOOK_APP_ID . '" />' . ($media->fbid ? '<meta property="fb:admins" content="' . $media->fbid . '" />' : '') . '<link rel="canonical" href="' . mx_actionurl_prod('media', 'medprof', $media->id, '', '', true) . '">'; return; } } } } } }
function mx_xmlsearch($query, $qtype = 'persons', $fld) { global $mxdb, $mxuser; //echo 'Soon, you\'ll be able to find the results of your search for ['.$action.'] here...'; $search = $mxdb->search($query); if (!$search) { __('No result found.'); return; } if ($qtype == 'persons') { echo '<table class="searchresult">'; $class = ''; // class="selected"'; if (count($search['persons']) > 0) { $i = 0; foreach ($search['persons'] as $result) { if ($i > 3) { continue; } $i++; $foundstr = str_ireplace($query, '<span class="searchstring">' . $query . '</span>', $result->fullname); echo '<tr id="' . $result->id . '"' . $class . ' onmouseover="selresult(this);" onmouseout="unselresult(this);">' . '<td onclick="setfield(\'' . $fld . '\',\'' . $result->id . '\',\'' . $result->fullname . '\');">' . '<img src="' . mx_fanpic($result->id, 'square', $result->gender, false) . '"/> ' . $foundstr . ' <span class="resulttype">(' . _('Fan') . ')</span>' . '<input type="hidden" id="n_' . $result->id . '" value="' . $result->fullname . '"></td></tr>'; $class = ''; } } if (count($search['artists']) > 0) { $i = 0; foreach ($search['artists'] as $result) { if ($i > 3) { continue; } $i++; $foundstr = str_ireplace($query, '<span class="searchstring">' . $query . '</span>', $result->artistname); echo '<tr id="' . $result->id . '"' . $class . ' onmouseover="selresult(this);" onmouseout="unselresult(this);">' . '<td onclick="setfield(\'' . $fld . '\',\'' . $result->id . '\',\'' . $result->artistname . '\');">' . '<img src="' . mx_fanpic($result->id, 'square', $result->gender, true) . '"> ' . $foundstr . ' <span class="resulttype">(' . ($result->acctype == MXACCOUNTBAND ? _('Band') : _('Artist')) . ')</span>' . '<input type="hidden" id="n_' . $result->id . '" value="' . $result->artistname . '"></td></tr>'; $class = ''; } } if (count($search['medias']) > 0) { $i = 0; foreach ($search['medias'] as $result) { if ($i > 3) { continue; } $i++; $media = $mxuser->getmediainfo($result->id); $fanship = $mxuser->getfanship($media->owner_id, $media->id); mx_medialist($media, $fanship); $foundstr = sprintf('%s<br/>by %s', str_ireplace($query, '<span class="searchstring">' . $query . '</span>', $media->title), $media->artistname); echo '<tr id="' . $result->id . '"' . $class . ' onmouseover="selresult(this);" onmouseout="unselresult(this);">' . '<td onclick="setfield(\'' . $fld . '\',\'' . $result->id . '\',\'' . $result->title . '\');">' . '<img src="' . $media->pic . '"> ' . $foundstr . ' <span class="resulttype">(' . _('Media') . ')</span>' . '<input type="hidden" id="n_' . $result->id . '" value="' . $media->title . '"></td></tr>'; $class = ''; } } if ($fld != 'to') { echo '<tr id="default"' . $class . ' onmouseover="selresult(this);">' . '<td onclick="setfield(\'' . $fld . '\',\'default\',\'' . $query . '\');">' . '→' . _('More Results') . '<input type="hidden" id="n_default" value="' . $query . '"></td></tr>'; } echo '</table>'; } }
function mx_proddesc($product) { global $mxuser; switch ($product->prodtype) { case MXARTSUB: $userinfo = $mxuser->getuserinfo($product->prodref); $name = mx_getartistname($userinfo); return '<table class="name"><tr><td class="subline"><img tag="' . $userinfo->id . '" class="subpic" src="' . mx_artpic($userinfo->id, 'square', $userinfo->gender) . '"/></td>' . '<td><a href="' . mx_actionurl('artists', 'artprof', $userinfo->id) . '" alt="' . $name . '">' . $name . $product->note . '</a></td></tr></table>'; break; case MXSITESUB: return '<table class="name"><tr><td class="subline"><img class="subpic" src="' . mx_option('m-logoURL-48x48') . '"/></td>' . '<td><a href="#" alt="' . 'MusXpand' . '">' . 'MusXpand Account #' . $mxuser->id . '<br/>(' . $mxuser->getname() . ')' . '</a></td></tr></table>'; break; case MXMEDSUB: $media = $mxuser->getmediainfo($product->prodref); $fanship = $mxuser->getfanship($media->owner_id, $media->id); mx_medialist($media, $fanship); return '<table class="name"><tr><td class="subline"><img tag="' . $media->id . '" class="subpic" src="' . $media->pic . '" /></td>' . '<td><a href="' . mx_actionurl('media', 'medprof', $media->id) . '">' . $media->title . '</a><br/><span class="byartist">' . sprintf('by %s', '<a href="' . mx_actionurl('artists', 'artprof', $media->owner_id) . '">' . $media->artistname . '</a>') . $product->note . '</span></td></tr></table>'; break; default: return _('Undefined Product'); } }