Example #1
0
function mx_sharetools($userid, $artist = true)
{
    global $s3, $mxdb;
    $user = mx_getuserpublicinfo($userid);
    mx_checkvalues($user);
    //die(print_r($user,true));
    if ($artist) {
        $name = $user->artistname;
        $page = 'artists';
        $opt = 'artprof';
    } else {
        $name = mx_getname($user);
        $page = 'fans';
        $opt = 'fanprof';
    }
    if (!$name) {
        return _('Available Soon');
    }
    //die(print_r($user,true));
    //if (!is_admin()) return _('Available Soon');
    // big badges
    $fmt = array('large' => '150px wide', 'small' => '100px wide', 'square' => '80px x 96px');
    // smaller on-musxpand badges
    $badgesize = array(_('Small') => '-small', _('Large') => '');
    $badgecolor = array(_('White') => '', _('Black') => '-black');
    if (!$user->badges) {
        // QR codes generation
        /*
        $xcard=new XMLWriter();
        $xcard->openMemory();
        $xcard->startDocument('1.0','UTF-8');
        $xcard->startElementNs(null,'vcards','urn:ietf:params:xml:ns:vcard-4.0');
        $xcard->startElement('vcard');
        
        $xcard->startElement('n'); // name
        $xcard->startElement('surname'); // family name
        $xcard->text($user->lastname);
        $xcard->endElement(); // surname
        $xcard->startElement('given'); // first name
        $xcard->text($user->firstname);
        $xcard->endElement(); // given
        $xcard->endElement(); // n
        
        $xcard->startElement('fn'); // fullname
        $xcard->startElement('text'); // text
        $xcard->text($name);
        $xcard->endElement(); // text
        $xcard->endElement(); // fn
        
        $xcard->startElement('org'); // org
        $xcard->startElement('text'); // text
        $xcard->text('MusXpand');
        $xcard->endElement(); // text
        $xcard->endElement(); // org
        
        $xcard->startElement('title'); // shortbio
        $xcard->startElement('text'); // text
        $xcard->text($user->about);
        $xcard->endElement(); // text
        $xcard->endElement(); // shortbio
        
        $xcard->startElement('photo'); // photo
        $xcard->startElement('uri'); // URI
        $xcard->text(mx_fanpic($user->id,'small',$user->gender,$isartist));
        $xcard->endElement(); // URI
        $xcard->endElement(); // photo
        
        $xcard->startElement('adr'); // address
        $xcard->startElement('parameters'); // parameters
        $xcard->startElement('type'); // type
        $xcard->text($isartist?'work':'home');
        $xcard->endElement(); // type
        $xcard->startElement('label'); // label
        $location='';
        if ($user->city) $location.=$user->city;
        if ($user->state) $location.=($location?', ':'').$user->state;
        if ($user->country) $location.=($location?'\n':'').mx_getcountryname($user->country);
        $xcard->text($location);
        $xcard->endElement(); // label
        $xcard->startElement('locality'); // locality
        $xcard->text($user->city);
        $xcard->endElement(); // locality
        $xcard->startElement('region'); // region
        $xcard->text($user->state);
        $xcard->endElement(); // region
        $xcard->startElement('country'); // country
        $xcard->text(mx_getcountryname($user->country));
        $xcard->endElement(); // country
        $xcard->endElement(); // parameters
        $xcard->endElement(); // address
        
        $xcard->startElement('email'); // country
        $xcard->startElement('text'); // text
        $xcard->text($user->email);
        $xcard->endElement(); // text
        $xcard->endElement(); // email
        
        $xcard->startElement('rev'); // revision
        $xcard->startElement('timestamp'); // date
        $xcard->text(gmdate('Ymd\THis\Z'));
        $xcard->endElement(); // date
        $xcard->endElement(); // rev
        
        $xcard->endElement(); // vcard
        $xcard->endElement(); // vcards
        
        $xvcard=$xcard->flush();
        */
        $saveart = $artist;
        foreach (array(true, false) as $artist) {
            $vcard = 'BEGIN:VCARD' . CRLF . 'VERSION:4.0' . CRLF;
            //$vcard.='SOURCE:'.mx_option('siteurl').'/vcf.php?a='.$user->id.CRLF;
            $vcard .= 'KIND:individual' . CRLF;
            //$vcard.='XML:'.$xvcard.CRLF;
            if ($artist) {
                $vcard .= 'FN:' . $name . CRLF;
                $vcard .= 'N:' . $user->lastname . ';' . $user->firstname . CRLF;
            } else {
                $vcard .= 'FN:' . $user->fullname . CRLF;
                $vcard .= 'N:' . $user->lastname . ';' . $user->firstname . CRLF;
            }
            $vcard .= 'PHOTO:' . mx_fanpic($user->id, 'small', $user->gender, $artist) . CRLF;
            if ($user->gender != MXNOSEX) {
                $vcard .= 'GENDER:' . ($user->gender == MXSEXMALE ? 'M' : 'F') . CRLF;
            }
            if ($user->birthdate) {
                $vcard .= 'BDAY:' . str_replace('-', '', $user->birthdate) . CRLF;
            }
            $vcard .= 'ADR;TYPE=' . ($artist ? 'work' : 'home') . ':;;;' . $user->city . ';' . $user->state . ';;' . mx_getcountryname($user->country) . CRLF;
            $vcard .= 'EMAIL:' . $user->email . CRLF;
            if ($user->timezone) {
                $vcard .= 'TZ:' . $user->timezone . CRLF;
            }
            if ($user->about) {
                $vcard .= 'TITLE:"' . $user->shortbio . '"' . CRLF;
            }
            $vcard .= 'LOGO:' . mx_option('logoURL') . CRLF;
            //$vcard.='ORG:'.CRLF;
            $vcard .= 'UID:urn:uuid:' . $user->hashdir . CRLF;
            $vcard .= 'URL:' . mx_actionurl($artist ? 'artists' : 'fans', $artist ? 'artprof' : 'fanprof', $user->id) . CRLF;
            $vcard .= 'REV:' . gmdate('Ymd\\THis\\Z') . CRLF;
            $vcard .= 'END:VCARD' . CRLF;
            QRcode::png($vcard, mx_option('usersdir') . '/tmp/' . $user->hashdir . '_QR' . ($artist ? 'a' : 'f') . '.png', 'L', 2, 4);
            $keyname = 'users/' . $user->hashdir . '/pics/qr_' . ($artist ? 'a' : 'f') . '.png';
            $res = $s3->create_object(MXS3BUCKET, $keyname, array('fileUpload' => mx_option('usersdir') . '/tmp/' . $user->hashdir . '_QR' . ($artist ? 'a' : 'f') . '.png', 'acl' => AmazonS3::ACL_PUBLIC));
            //@unlink(mx_option('usersdir').'/tmp/'.$user->hashdir.'_'.$value.'.jpg');
            file_put_contents(mx_option('usersdir') . '/tmp/' . $user->hashdir . '_vCard' . ($artist ? 'a' : 'f') . '.vcf', $vcard);
            $keyname = 'users/' . $user->hashdir . '/pics/vCard_' . ($artist ? 'a' : 'f') . '.vcf';
            $res = $s3->create_object(MXS3BUCKET, $keyname, array('fileUpload' => mx_option('usersdir') . '/tmp/' . $user->hashdir . '_vCard' . ($artist ? 'a' : 'f') . '.vcf', 'acl' => AmazonS3::ACL_PUBLIC));
            @unlink(mx_option('usersdir') . '/tmp/' . $user->hashdir . '_vCard' . ($artist ? 'a' : 'f') . '.vcf');
        }
        $artist = $saveart;
    }
    if (!$user->badges) {
        // badges generation
        ini_set('allow_url_fopen', 1);
        $keyname = 'users/' . $user->hashdir . '/pics/me_large.jpg';
        $picurl = mx_secureurl(gets3url($keyname, '2 minutes'));
        // load pic
        $pic = imagecreatefromjpeg($picurl);
        if (!$pic) {
            $pic = imagecreatefrompng(mx_fanpic($user->id, 'large', $user->gender, false));
        }
        $w = imagesx($pic);
        $h = imagesy($pic);
        $nhl = round($h * 150 / $w);
        $nhs = round($h * 100 / $w);
        $mwh = min($w, $h);
        $imlarge = imagecreatetruecolor(150, $nhl + 16);
        $imsmall = imagecreatetruecolor(100, $nhs + 16);
        $imsquare = imagecreatetruecolor(80, 80 + 16);
        $fgl = imagecolorallocate($imlarge, 255, 255, 255);
        $fgs = imagecolorallocate($imsmall, 255, 255, 255);
        $fgq = imagecolorallocate($imsquare, 255, 255, 255);
        $bgl = imagecolorallocate($imlarge, 0xff, 0xff, 0x99);
        $bgs = imagecolorallocate($imsmall, 0xff, 0xff, 0x99);
        $bgq = imagecolorallocate($imsquare, 0xff, 0xff, 0x99);
        //imagefill($imlarge,0,0,$fcl);
        //imagefill($imsmall,0,0,$fcs);
        //imagefill($imsquare,0,0,$fcq);
        //imagefilledrectangle($imlarge,1,$nhl,148,$nhl+14,$bgl);
        //imagefilledrectangle($imsmall,1,$nhs,98,$nhs+14,$bgs);
        //imagefilledrectangle($imsquare,1,80,78,80+14,$bgq);
        imageline($imlarge, 0, $nhl - 1, 150 - 1, $nhl - 1, $fgl);
        imageline($imsmall, 0, $nhs - 1, 100 - 1, $nhs - 1, $fgs);
        imageline($imsquare, 0, 80 - 1, 80 - 1, 80 - 1, $fgq);
        imageantialias($imlarge, true);
        imageantialias($imsmall, true);
        imageantialias($imsquare, true);
        imagecopyresampled($imlarge, $pic, 1, 1, 0, 0, 150 - 2, $nhl - 2, $w, $h);
        imagecopyresampled($imsmall, $pic, 1, 1, 0, 0, 100 - 2, $nhs - 2, $w, $h);
        imagecopyresampled($imsquare, $pic, 1, 1, $mwh == $h ? ($w - $mwh) / 2 : 0, $mwh == $w ? ($h - $mwh) / 2 : 0, 80 - 2, 80 - 2, $mwh, $mwh);
        // add artistname
        $font = mx_option('rootdir') . '/fonts/HoboStd.otf';
        $textl = $texts = $textq = strtoupper($name);
        while (($factl = 16 / max(array(16, strlen($textl)))) < 0.6) {
            $textl = substr($textl, 0, strrpos($textl, ' ')) . '...';
        }
        while (($facts = 12 / max(array(12, strlen($texts)))) < 0.6) {
            $texts = substr($texts, 0, strrpos($texts, ' ')) . '...';
        }
        while (($factq = 9 / max(array(9, strlen($textq)))) < 0.6) {
            $textq = substr($textq, 0, strrpos($textq, ' ')) . '...';
        }
        $szl = 9.4 * $factl;
        $szs = 9.4 * $facts;
        $szq = 9.4 * $factq;
        $txtl = imagettfbbox($szl, 0, $font, $textl);
        $txts = imagettfbbox($szs, 0, $font, $texts);
        $txtq = imagettfbbox($szq, 0, $font, $textq);
        imagettftext($imlarge, $szl, 0, (150 - $txtl[2] - $txtl[0]) / 2 - 1, $nhl + (16 - $txtl[1] - $txtl[7]) / 2, $fgl, $font, $textl);
        imagettftext($imsmall, $szs, 0, (100 - $txts[2] - $txts[0]) / 2 - 1, $nhs + (16 - $txts[1] - $txts[7]) / 2, $fgs, $font, $texts);
        imagettftext($imsquare, $szq, 0, (80 - $txtq[2] - $txtq[0]) / 2 - 1, 80 + (16 - $txtq[1] - $txtq[7]) / 2, $fgq, $font, $textq);
        /*
        $logo=imagecreatefrompng(mx_option('rootdir').'/images/general/musxpand-logo.png');
        $imlogo=imagerotate($logo,90,0);
        $lw=imagesx($imlogo);
        $lh=imagesy($imlogo);
        imagecopyresampled($imlarge,$imlogo,129,0,0,0,$lw/2,$lh/2,$lw,$lh);
        */
        imagejpeg($imlarge, mx_option('usersdir') . '/tmp/' . $user->hashdir . '_large.jpg');
        imagejpeg($imsquare, mx_option('usersdir') . '/tmp/' . $user->hashdir . '_square.jpg');
        imagejpeg($imsmall, mx_option('usersdir') . '/tmp/' . $user->hashdir . '_small.jpg');
        foreach ($fmt as $value => $desc) {
            $keyname = 'users/' . $user->hashdir . '/pics/badge_' . $value . '.jpg';
            $res = $s3->create_object(MXS3BUCKET, $keyname, array('fileUpload' => mx_option('usersdir') . '/tmp/' . $user->hashdir . '_' . $value . '.jpg', 'acl' => AmazonS3::ACL_PUBLIC));
            @unlink(mx_option('usersdir') . '/tmp/' . $user->hashdir . '_' . $value . '.jpg');
        }
        // mini-badges
        $keyname = 'users/' . $user->hashdir . '/pics/me_square.jpg';
        $picurl = mx_secureurl(gets3url($keyname, '2 minutes'));
        // load pic
        $pic = imagecreatefromjpeg($picurl);
        if (!$pic) {
            $pic = imagecreatefrompng(mx_fanpic($user->id, 'large', $user->gender, false));
        }
        $pw = imagesx($pic);
        $ph = imagesy($pic);
        $badgepref = 'badge-on-musxpand';
        foreach ($badgesize as $sname => $ssuf) {
            switch ($ssuf) {
                case '':
                    $offx = 9;
                    $offy = 1;
                    break;
                case '-small':
                default:
                    $offx = -2;
                    $offy = 1;
                    break;
            }
            foreach ($badgecolor as $cname => $csuf) {
                $badgemask = imagecreatefrompng(mx_option('rootdir') . '/images/badges/' . $badgepref . $ssuf . $csuf . '.png');
                $bw = imagesx($badgemask);
                $bh = imagesy($badgemask);
                $badge = imagecreatetruecolor($bw, $bh);
                //imagepalettecopy($badge, $badgemask);
                $transp = imagecolorallocatealpha($badge, 0, 0, 0, 127);
                imagefill($badge, 0, 0, $transp);
                imageantialias($badge, true);
                //imagealphablending($badge,false);
                //imagealphablending($badgemask,false);
                imagecopyresampled($badge, $pic, floor(($bh - 72) / 2) + $offx, floor(($bh - 72) / 2) + $offy, 0, 0, 72, 72, $pw, $ph);
                imagecopyresampled($badge, $badgemask, 0, 0, 0, 0, $bw, $bh, $bw, $bh);
                imagesavealpha($badge, true);
                $tmpfile = mx_option('usersdir') . '/tmp/' . $user->hashdir . '_mini' . $ssuf . $csuf . '.png';
                imagepng($badge, $tmpfile);
                $keyname = 'users/' . $user->hashdir . '/pics/minibadge' . $ssuf . $csuf . '.png';
                $res = $s3->create_object(MXS3BUCKET, $keyname, array('fileUpload' => $tmpfile, 'acl' => AmazonS3::ACL_PUBLIC));
                @unlink($tmpfile);
            }
        }
        ini_set('allow_url_fopen', 0);
        $user->badges = 1;
        $mxdb->updateuser($user, 'badges');
    }
    $str = '<div class="badges"><table><tr>';
    foreach ($fmt as $value => $desc) {
        $str .= '<th>' . sprintf(_('Badge %s'), $desc) . '</th>';
    }
    $str .= '</tr><tr>';
    foreach ($fmt as $value => $desc) {
        $keyname = 'users/' . $user->hashdir . '/pics/badge_' . $value . '.jpg';
        $str .= '<td><img src="' . mx_secureurl(gets3url($keyname)) . '" /></td>';
    }
    $str .= '</tr><tr>';
    foreach ($fmt as $value => $desc) {
        $str .= '<th>' . _('Code') . '</th>';
    }
    $str .= '</tr><tr>';
    foreach ($fmt as $value => $desc) {
        $keyname = 'users/' . $user->hashdir . '/pics/badge_' . $value . '.jpg';
        $str .= '<td>';
        $str .= '<textarea id="b_' . $value . '" onmouseover="this.select(); setcopybtn(\'bt_' . $value . '\',\'b_' . $value . '\');">';
        $str .= '<a href="' . mx_actionurl($page, $opt, $user->id) . '" alt="' . $name . '">' . '<img src="' . mx_secureurl(gets3url($keyname)) . '" />' . '</a>';
        $str .= '</textarea><br/>';
        $str .= '<a style="display:none;" href="#" class="toclipbtn" id="bt_' . $value . '">' . _('Copy') . '</a>';
        $str .= '</td>';
    }
    $str .= '</tr></table>';
    //$str.='<center><a href="'.mx_actionurl('artists','artprof',$user->id).'">'.$user->artistname.'</a></center>';
    $str .= '</div>';
    // smaller on-musxpand badges
    $str .= '<div class="badges"><table>';
    $i = 0;
    foreach ($badgesize as $sname => $ssuf) {
        $i++;
        $j = 0;
        foreach ($badgecolor as $cname => $csuf) {
            $j++;
            $value = $i . '_' . $j;
            $str .= '<tr><th>' . sprintf(_('MX Badge, %s, %s'), $sname, $cname) . '</th>' . '<th>' . _('Code') . '</th></tr>';
            $keyname = 'users/' . $user->hashdir . '/pics/minibadge' . $ssuf . $csuf . '.png';
            $str .= '<tr><td><img src="' . mx_secureurl(gets3url($keyname)) . '" /></td>';
            $str .= '<td>';
            $str .= '<textarea id="b_' . $value . '" onmouseover="this.select(); setcopybtn(\'bt_' . $value . '\',\'b_' . $value . '\');">';
            $str .= '<a href="' . mx_actionurl($page, $opt, $user->id) . '" alt="' . $name . '">' . '<img src="' . mx_secureurl(gets3url($keyname)) . '" />' . '</a>';
            $str .= '</textarea><br/>';
            $str .= '<a style="display:none;" href="#" class="toclipbtn" id="bt_' . $value . '">' . _('Copy') . '</a>';
            $str .= '</td>';
            $str .= '</tr>';
        }
    }
    $str .= '</table>';
    $str .= '</div>';
    return $str;
}
Example #2
0
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;
                    }
                }
            }
        }
    }
}