Example #1
0
function mx_mnfriends($page, $option, $action)
{
    global $mxuser, $me, $facebook;
    echo '<p>' . _('Welcome to your Friends page') . '</p>';
    $mxfriends = $mxuser->getfriends($mxuser->id);
    echo '<h5>' . _('Current friends') . '</h5>';
    mx_showdir($mxfriends['confirmed']);
    echo '<h5>' . _('Pending friends') . '</h5>';
    mx_showdir($mxfriends['pending']);
    echo '<h5>' . _('Recused friends') . '</h5>';
    mx_showdir($mxfriends['recused']);
    echo '<h5>' . _('Ignored friends') . '</h5>';
    mx_showdir($mxfriends['ignored']);
    if ($mxuser->fbid) {
        echo '<h5>' . _('Facebook friends already on MusXpand') . '</h5>';
        if ($action == 'showfb') {
            mx_checkfblogin();
        }
        if ($me) {
            $fbfriends = $facebook->api('/me/friends');
            $fbfriendsids = array();
            foreach ($fbfriends['data'] as $fbfriend) {
                $fbfriendsids[] = $fbfriend['id'];
            }
            $friends = $mxuser->checkfbfriends($fbfriendsids);
            mx_showdir($friends, true);
            //echo sprintf(_('If you want to check which of your Facebook friends' .
            //' are already on MusXpand, please %s'),
            //'<fb:login-button>'._('Synchronize with Facebook').'</fb:login-button>');
        } else {
            echo '<p>';
            echo sprintf(_('Click %s to see which Facebook friends are already on MusXpand'), '<a href="' . mx_actionurl($page, $option, 'showfb') . '" alt="' . _('Facebook friends') . '">' . _('here') . '</a>');
            echo '</p>';
        }
    }
}
Example #2
0
function mx_mnfandir($page, $option, $action)
{
    global $mxdb, $mxuser;
    $mode = array('alpha' => _('Alphabetical'), 'genres' => _('By Genres'), 'subs' => _('Subscribers'), 'super' => _('SuperFans'), 'random' => _('Random Selection'));
    $selsub = '';
    if ($action) {
        if (preg_match('%([^:]+):?(.*)%', $action, $modes)) {
        }
        $selmode = $modes[1];
        $selsub = $modes[2];
    } else {
        $selmode = 'subs';
    }
    echo '<div class="directory">';
    echo '<table class="dirtabs"><tr>';
    foreach ($mode as $ord => $ordname) {
        $dis = false;
        if (substr($ord, 0, 1) == '-') {
            $dis = true;
        }
        $class = $ord == $selmode ? 'dirtabsel' : (substr($ord, 0, 1) == '-' ? 'dirtabdis' : 'dirtab');
        echo '<td class="' . $class . '">';
        if (!$dis) {
            echo '<a href="' . mx_actionurl($page, $option, $ord) . '">' . $ordname . '</a>';
        } else {
            echo $ordname;
        }
        echo '</td>';
    }
    //echo '<td class="dirtablast"></td>';
    echo '</tr>';
    echo '</table>';
    $fanfilter = '(a.acctype=' . MXACCOUNTFAN . ' OR 0 < (SELECT count(b.id) FROM mx_subscriptions b WHERE b.fanid=a.id' . ' AND b.subcat=' . MXARTSUB . ' AND b.subtype!=' . MXSUBLIKE . ' AND b.status!=' . MXEXPIREDSUB . ' AND b.status!=' . MXENDEDSUB . ') )';
    switch ($selmode) {
        case 'random':
            // pure fans or subscribers
            $filter = $fanfilter;
            // pure fan or subscriber
            break;
        case 'subs':
            // subs only
            $filter = '0 < (SELECT count(b.id) FROM mx_subscriptions b WHERE b.fanid=a.id' . ' AND b.subcat=' . MXARTSUB . ' AND b.subtype!=' . MXSUBLIKE . ' AND b.status!=' . MXEXPIREDSUB . ' AND b.status!=' . MXENDEDSUB . ')';
            break;
        case 'super':
            // 5 subs mini
            $filter = '4 < (SELECT count(b.id) FROM mx_subscriptions b WHERE b.fanid=a.id' . ' AND b.subcat=' . MXARTSUB . ' AND b.subtype!=' . MXSUBLIKE . ' AND b.status!=' . MXEXPIREDSUB . ' AND b.status!=' . MXENDEDSUB . ')';
            break;
        case 'genres':
            $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];
                }
            }
            /*
            $str='<script language="javascript">'.CRLF;
            $str.='var cats=new Array();'.CRLF;
            $str.='var subcats=new Array();'.CRLF;
            $str.='var subcatsndx=new Array();'.CRLF;
            foreach($cats as $cat) {
            	$n=1;
            	$str.='cats['.$cat.']=\''.$genres[$cat]->genre.'\';'.CRLF;
            	$str.='subcats['.$cat.']=new Array();'.CRLF;
            	$str.='subcatsndx['.$cat.']=new Array();'.CRLF;
            	$str.='subcats['.$cat.'][0]=\''._('Any').'\';'.CRLF;
            	$str.='subcatsndx['.$cat.'][0]='.$cat.';'.CRLF;
            	foreach($subgenres[$cat] as $subcat) {
            		$str.='subcats['.$cat.']['.$n.']=\''.$genres[$subcat]->genre.'\';'.CRLF;
            		$str.='subcatsndx['.$cat.']['.$n++.']=\''.$subcat.'\';'.CRLF;
            	}
            }
            $str.='</script>'.CRLF;
            echo $str;
            */
            if ($selsub && $genres[$selsub]->cat) {
                $cat = $catgenre[$selsub];
            } else {
                $cat = $selsub;
            }
            $subcat = $selsub;
            echo '<table class="dirgen"><tr>';
            echo '<td class="dirgencat"><table class="dirgencat">';
            foreach ($cats as $catid) {
                $class = $catid == $cat ? 'dirgensel' : 'dirgentab';
                echo '<tr><td class="' . $class . '"><a href="' . mx_actionurl($page, $option, $selmode . ':' . $catid) . '">' . $genres[$catid]->genre . '</a></td><td class="dirarrow">' . ($catid == $cat ? '&rarr;' : '') . '</td></tr>';
            }
            echo '</table></td>';
            echo '<td class="dirgenre"><div class="dirgenre"><table id="dirgenre" class="dirgenre">';
            if ($selsub) {
                echo _('<div class="genrehelp">&darr; Select a subcategory below [optional]</div>');
                $col = 0;
                foreach ($subgenres[$cat] as $subcatid) {
                    if (!$col) {
                        echo '<tr>';
                    }
                    $class = $subcatid == $selsub ? 'dirgensel' : 'dirgentab';
                    echo '<td class="' . $class . '"><a href="' . mx_actionurl($page, $option, $selmode . ':' . $subcatid) . '">' . $genres[$subcatid]->genre . '</a></td>';
                    $col = ++$col % 3;
                    if (!$col) {
                        echo '</tr>';
                    }
                }
                if ($col) {
                    echo '<td colspan="' . (3 - $col) . '"></td></tr>';
                }
            } else {
                echo '<tr><td><div class="genrehelp">' . _('&larr; Select a genre on the left<br/>to show subcategories') . '</div></td></tr>';
            }
            echo '</table></div></td>';
            echo '</tr></table>';
            if ($cat && $cat == $subcat) {
                // main cat
                $filter = array('mx_acc2tast c', 'c.genre=' . $selsub . ' AND a.id=c.userid AND ' . $fanfilter, sprintf(_('Listed in %s'), $genres[$cat]->genre));
                // sub cats
                $filter2 = array('mx_acc2tast c, mx_genres d', 'd.cat=\'' . $genres[$cat]->hash . '\' AND c.genre=d.id AND a.id=c.userid' . ' AND ' . $fanfilter, sprintf(_('Listed in subcategories of %s'), $genres[$cat]->genre));
            } else {
                if ($cat) {
                    // main subcat
                    $filter = array('mx_acc2tast c', 'c.genre=' . $selsub . ' AND a.id=c.userid AND ' . $fanfilter, sprintf(_('Listed in %s'), $genres[$selsub]->genre));
                    // top cat
                    $filter2 = array('mx_acc2tast c', 'c.genre=' . $cat . ' AND a.id=c.userid AND ' . $fanfilter, sprintf(_('Listed in %s'), $genres[$cat]->genre));
                    $filter3 = array('mx_acc2tast c, mx_genres d', '(d.cat=\'' . $genres[$cat]->hash . '\' AND d.id!=' . $selsub . ') AND c.genre=d.id AND a.id=c.userid AND ' . $fanfilter, sprintf(_('Listed in other subcategories of %s'), $genres[$cat]->genre));
                }
            }
            break;
        case 'alpha':
        default:
            $ndx = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
            if (!$selsub) {
                $selsub = substr($ndx, rand(0, strlen($ndx) - 1), 1);
            }
            echo '<table class="diralpha"><tr>';
            for ($i = 0; $i < strlen($ndx); $i++) {
                $letter = substr($ndx, $i, 1);
                $class = $letter == $selsub ? 'diralphasel' : 'diralphatab';
                echo '<td class="' . $class . '"><a href="' . mx_actionurl($page, $option, $selmode . ':' . $letter) . '">' . ($letter == '_' ? _('Others') : $letter) . '</a></td>';
            }
            //echo '<td class="diralphalast"></td>';
            echo '</tr>';
            echo '</table>';
            if ($selsub == '_') {
                $selsub = '[^a-zA-Z0-9]';
            }
            $filter = $fanfilter . ' AND fullname RLIKE \'^' . $selsub . '.*\'';
            // 'OR lastname RLIKE \'^'.$selsub.'.*\'';
            break;
    }
    if ($filter) {
        $afilter[] = $filter;
    }
    if ($filter2) {
        $afilter[] = $filter2;
    }
    if ($filter3) {
        $afilter[] = $filter3;
    }
    foreach ($afilter as $flt) {
        if (is_array($flt)) {
            echo '<h5>' . $flt[2] . '</h5>';
        }
        $fansqr = $mxdb->fanlist($flt);
        echo '<table class="fanlist"><tr>';
        $c = 0;
        if ($fansqr['count'] == 30) {
            echo '<td colspan="6">' . _('(30 fans chosen at random...)') . '</td></tr><tr>';
        }
        for ($i = 0; $i < $fansqr['count']; $i++) {
            $fan = $mxdb->fanlist(null, $fansqr['mxq']);
            if ($fan) {
                echo '<td class="friend">';
                // onclick="window.location=\''.mx_actionurl('fans','fanprof',$fan->id).'\';">';
                echo '<a href="' . mx_actionurl('fans', 'fanprof', $fan->id) . '" title="' . mx_getname($fan) . ' - ' . _('See Page') . '" class="pictooltip">';
                echo '<img tag="' . $fan->id . '" class="dirpic" src="' . mx_fanpic($fan->id, 'square', $fan->gender) . '">';
                echo '</a>';
                echo '<br/>' . mx_getname($fan);
                echo '</td>';
                $c = ++$c % 6;
                if (!$c) {
                    echo '</tr><tr>';
                }
            }
        }
        if (!$i) {
            echo '<td colspan="6">' . _('No fan listed here.') . '</td>';
        }
        echo '</tr></table>';
    }
    echo '</div>';
}
Example #3
0
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('&rarr; ' . $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 
    }
}
Example #4
0
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>';
}
Example #5
0
function mx_mnsearch($page, $option, $action)
{
    global $query, $mxdb, $mxuser;
    //echo 'Soon, you\'ll be able to find the results of your search for ['.$action.'] here...';
    error_log('search for:[' . $action . ']');
    $search = $mxdb->search($action);
    if (!$search) {
        __('No result found.');
        return;
    }
    //die(print_r($search));
    /*foreach ($search as $type => $results) {
    		echo '<h3>'.$type.'</h3>';
    		echo '<ul>';
    		foreach ($results as $id => $result) {
    			echo '<li>' .
    			'<div class="searchpic">'.($type=='persons'?('<img src="'.mx_fanpic($id).'">'):'')
    			.'</div><div class="searchname">'.$result.'</div>'
    			.'<div class="searchaction">action</div>'
    			.'</li>';
    		}
    		echo '</ul>';
    	}*/
    $reslist = array('reslist', 0, _('Search Results'), _('Is this what you were looking for...?'), array(), array('persons' => array('persons' => array(-1, _('Individuals'), _('Matching accounts')), 'picture' => array(0, _('Picture'), 'picture', 10), 'name' => array(0, _('Name'), 'text', 40), 'actions' => array(0, _('Actions'), 'actions', 40)), 'artists' => array('artists' => array(-1, _('Artists'), _('Matching artists')), 'picture' => array(0, _('Picture'), 'picture', 10), 'name' => array(0, _('Name'), 'text', 40), 'actions' => array(0, _('Actions'), 'actions', 40)), 'medias' => array('medias' => array(-1, _('Medias'), _('Matching medias')), 'picture' => array(0, _('Picture'), 'picture', 10), 'name' => array(0, _('Name'), 'text', 40), 'actions' => array(0, _('Actions'), 'actions', 40))));
    //while ($msgs && $msg=$mxuser->listmessages($msgs)) {
    //print_r($msg);
    foreach ($search as $type => $results) {
        $resarray[$type] = array();
        foreach ($results as $id => $result) {
            $res = new stdClass();
            switch ($type) {
                case 'persons':
                    $res->picture = new StdClass();
                    $res->picture->pic = mx_fanpic($id, 'square', $result->gender, false);
                    $res->picture->id = $id;
                    $res->picture->type = 'person';
                    $res->name = '<a href="' . mx_actionurl('fans', 'fanprof', $id) . '" alt="' . $result->fullname . '">' . $result->fullname . '</a>';
                    $res->actions = array('fanprof' => array(_('See Page'), mx_actionurl('fans', 'fanprof', $id)), 'addfriend' => array(_('Add as a Friend'), mx_actionurl('account', 'messages', 'af:' . $id, 'writemsg')), 'sendmsg' => array(_('Send a Message'), mx_actionurl('account', 'messages', 'sm:' . $id, 'writemsg')));
                    break;
                case 'artists':
                    $res->picture = new StdClass();
                    $res->picture->pic = mx_fanpic($id, 'square', $result->gender, true);
                    $res->picture->id = $id;
                    $res->picture->type = 'person';
                    $res->name = '<a href="' . mx_actionurl('artists', 'artprof', $id) . '" alt="' . $result->artistname . '">' . $result->artistname . '</a>' . '<div class="artisttype">' . ($result->acctype == MXACCOUNTBAND ? _('Band') : _('Artist')) . '</div>';
                    $res->actions = array('artprof' => array(_('See Profile'), mx_actionurl('artists', 'artprof', $id)));
                    break;
                case 'archipelagoes':
                case 'islands':
                    $res->name = '<a href="' . mx_actionurl('musxpace', 'viewprof', $id) . '" alt="' . $result->name . '">' . $result->name . '</a>';
                    $res->description = $result->description;
                    $res->actions = array();
                    break;
                case 'medias':
                    $media = null;
                    $media = $mxuser->getmediainfo($id);
                    $fanship = $mxuser->getfanship($media->owner_id, $media->id);
                    mx_medialist($media, $fanship);
                    $res->picture = new StdClass();
                    $res->picture->pic = $media->pic;
                    $res->picture->id = $id;
                    $res->picture->type = 'media';
                    $res->name = '<a href="' . mx_actionurl('media', 'medprof', $id) . '" alt="' . $media->title . '">' . sprintf('%s <br/>by %s', $media->title, $media->artistname) . '</a>';
                    $res->actions = array('medprof' => array(_('Media Info'), mx_actionurl('media', 'medprof', $id)));
                    break;
            }
            $resarray[$type][] = $res;
        }
    }
    mx_showlist($reslist, $resarray, 'search', false, true);
}
Example #6
0
 function notify($msg)
 {
     $receiver = $this->getuserinfo($msg->to);
     $to = $receiver->fullname . ' <' . $receiver->email . '>';
     $subj = sprintf(_('You just received a new %s from %s'), $msg->flags & MXREQUEST ? _('request') : _('message'), $this->fullname ? $this->fullname : $this->artistname);
     if ($msg->flags & MXREQUEST) {
         $msgtype = '';
         if ($msg->flags & MXFRIENDREQUEST) {
             $msgtype = 'friend ';
         }
         $msgtype .= 'request';
     } else {
         $msgtype = "message";
     }
     $html = mx_showhtmlpagestr('yougotmail');
     $html = str_replace('{RECEIVER}', $receiver->firstname, $html);
     $html = str_replace('{MESSAGETYPE}', $msgtype, $html);
     $html = str_replace('{MESSAGE}', ($msg->subject ? '<b>' . $msg->subject . "</b><br/>" : '') . $msg->body, $html);
     $msgaction = mx_actionurl('account', 'messages', 'rp:' . $msg->msgid, $msg->flags & MXREQUEST ? 'requests' : 'inbox');
     $html = str_replace('{MESSAGEACTION}', '<a href="' . $msgaction . '">MusXpand</a>', $html);
     $notifyurl = mx_actionurl('account', 'profile', '-', 'notifs');
     $html = str_replace('{NOTIFYURL}', '<a href="' . $notifyurl . '">' . $notifyurl . '</a>', $html);
     $headers = 'From: MusXpand Notification <' . MXNOREPLYEMAIL . '>';
     mx_sendmail($to, $subj, mx_html2text($html), $html);
 }
Example #7
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;
                    }
                }
            }
        }
    }
}
Example #8
0
function mx_frbuy()
{
    global $prodtypes, $subtypes, $subprices;
    if (!MXBETA) {
        return;
    }
    echo '<div class="mx-infobar">';
    echo '<h4>' . _('Subscribe') . '</h4>';
    echo '<ul class="featlist">';
    foreach ($subtypes as $subkey => $subtype) {
        echo '<li><a href="' . mx_actionurl('cart', '', $subkey) . '">' . $prodtypes[MXSITESUB][1][$subtype] . '</a>';
        echo '<div class="buyprice">' . sprintf('$%.2f', $subprices[$subkey]) . '</div>';
        echo '</li>';
    }
    echo '</ul>';
    echo '</div>';
}
Example #9
0
function mx_actionlink($page, $option, $action = '', $section = '', $redir = '', $other = '')
{
    global $mx_ctxmenu;
    //if ($action) $act='&a='.$action;
    if (array_key_exists($page, $mx_ctxmenu)) {
        if (array_key_exists($option, $mx_ctxmenu[$page][2])) {
            return '<a href="' . mx_actionurl($page, $option, $action, $section, $redir, null, $other) . '" alt="' . $mx_ctxmenu[$page][2][$option][1] . '">' . $mx_ctxmenu[$page][2][$option][1] . '</a>';
        } else {
            return '<a href="' . mx_pageurl($page) . '" alt="' . $mx_ctxmenu[$page][1] . '">' . $mx_ctxmenu[$page][1] . '</a>';
        }
    } else {
        return '<a href="' . mx_pageurl($page) . '" alt="' . $page . '">' . $page . '</a>';
    }
}
Example #10
0
function mx_randminipics()
{
    global $mxdb;
    $artsqr = $mxdb->artslist('status>=' . MXACCTSETUP);
    // random
    for ($i = 0; $i < $artsqr['count']; $i++) {
        $arts = $mxdb->artslist(null, $artsqr['mxq']);
        if ($arts && $arts->picture == 'local') {
            echo '<a href="' . mx_actionurl('artists', 'artprof', $arts->id) . '">';
            echo '<img tag="' . $arts->id . '" class="minipic pictooltip" src="' . mx_artpic($arts->id, 'square', $arts->gender) . '"' . ' title="' . htmlentities(mx_getartistname($arts)) . ' - ' . ($arts->shortbio ? htmlentities($arts->shortbio) : _('No Description')) . '">';
            echo '</a>';
        }
    }
}
Example #11
0
function mx_mncart($page, $option, $action)
{
    global $mxuser, $prodtypes, $mxdb, $prodprice;
    $prodlist = array();
    $progress = $mxuser->cart->progress;
    if ($mxuser->cart->lines) {
        foreach ($mxuser->cart->lines as $line) {
            //if ($mxuser->cart->orderinfo || $mxuser->cart->orderconfirm)
            if ($mxuser->cart->progress > 1) {
                $line->select = '<img height="12px" src="' . mx_iconurl('okmark') . '">';
            } else {
                $line->select = '<input type="checkbox" name="cartline[]" value="' . $line->id . '">';
            }
            $line->proddesc = mx_proddesc($line);
            /*if ($line->prodtype==MXARTSUB) {
            			$user=$mxuser->getuserinfo($line->prodref);
            			$line->prodref='<div class="cartline"><img class="cartpic" src="'.mx_fanpic($user->id).'" /> '.mx_getartistname($user).'</div>';
            		}*/
            $line->prodvar = $prodtypes[$line->prodtype][1][$line->prodvar];
            $line->prodtype = $prodtypes[$line->prodtype][0];
            $prodlist['cart'][] = $line;
        }
    }
    if ($mxuser->cart->wishes) {
        foreach ($mxuser->cart->wishes as $line) {
            $line->select = '<input type="checkbox" name="wishline[]" value="' . $line->id . '">';
            $line->proddesc = mx_proddesc($line);
            /*if ($line->prodtype==MXARTSUB) {
            			$user=$mxuser->getuserinfo($line->prodref);
            			$line->prodref=mx_getartistname($user);
            		}*/
            $line->prodvar = $prodtypes[$line->prodtype][1][$line->prodvar];
            $line->prodtype = $prodtypes[$line->prodtype][0];
            $prodlist['wishlist'][] = $line;
        }
    }
    if ($mxuser->cart->items > 0) {
        $contshoppinglabel = _('Continue Shopping');
    } else {
        $contshoppinglabel = _('Go Shopping');
    }
    $yourehere = _('** YOU\'RE HERE **');
    $progresstable = '<table class="form progress"><tr class="top">' . '<td class="' . ($progress == 1 ? 'current' : 'done') . '">' . _('Shopping Cart') . '</td>' . '<td' . ($progress > 1 ? ' class="done"' : ' class="todo"') . '>&rarr;</td>' . '<td class="' . ($progress == 2 ? 'current' : ($progress < 2 ? 'next' : 'done')) . '">' . _('Shipping/Billing') . '</td>' . '<td' . ($progress > 2 ? ' class="done"' : ' class="todo"') . '>&rarr;</td>' . '<td class="' . ($progress == 3 ? 'current' : ($progress < 3 ? 'next' : 'done')) . '">' . _('Order Review') . '</td>' . '<td' . ($progress > 3 ? ' class="done"' : ' class="todo"') . '>&rarr;</td>' . '<td class="' . ($progress == 4 ? 'current' : 'next') . '">' . _('Order Confirmation') . '</td>' . '<td class="last"></td>' . '</tr><tr class="bottom">' . '<td>' . ($progress == 1 ? $yourehere : '') . '</td>' . '<td></td>' . '<td>' . ($progress == 2 ? $yourehere : '') . '</td>' . '<td></td>' . '<td>' . ($progress == 3 ? $yourehere : '') . '</td>' . '<td></td>' . '<td>' . ($progress == 4 ? $yourehere : '') . '</td>' . '<td class="last"></td>' . '</tr></table>';
    if ($mxuser->cart->err) {
        $progresstable .= mx_warningstr(implode('<br/>', $mxuser->cart->err));
    }
    if ($mxuser->cart->info) {
        $progresstable .= mx_infomsgstr($mxuser->cart->info);
    }
    //echo $progresstable;
    if ($mxuser->cart->orderinfo) {
        // checkcout confirmation
        $ckoutbuttons = array('canckout' => _('Cancel Checkout'), 'confckout' => _('Confirm PAYPAL Payment'));
        $cartlist = array('cart' => array('select' => array(0, '', 'text', 3), 'prodtype' => array(0, _('Item'), 'text', 20), 'proddesc' => array(0, _('Description'), 'html', 30), 'prodvar' => array(0, _('Type'), 'text', 20), 'price' => array(0, _('Price'), 'price', 10)));
        $salesterms = mx_windowedpage('salesterms', _('Terms & Conditions'));
        $ckoutlist = array('checkout', 0, _('Checkout Review Page'), $progresstable, $ckoutbuttons, array('cart' => array(-1, _('Checking out these products'), _('The following items are currently in your cart')), 'cartcontent' => array(-2, $cartlist, $prodlist, 'cart', array(), 'cart'), 'billing' => array(-1, _('Billing Information'), ''), 'FIRSTNAME' => array(0, _('Firstname'), 'text', 30), 'LASTNAME' => array(0, _('Lastname'), 'text', 30), 'COUNTRYCODE' => array(0, _('Country'), 'text', 3), 'EMAIL' => array(0, _('Billing E-Mail'), 'text', 40), 'shipping' => array(-1, _('Shipping Information'), _('Please check your shipping information')), 'SHIPTONAME' => array(0, _('Ship To'), 'text', 30), 'SHIPTOSTREET' => array(0, _('Address'), 'text', 30), 'SHIPTOCITY' => array(0, _('City'), 'text', 20), 'SHIPTOSTATE' => array(0, _('State/Province'), 'text', 20), 'SHIPTOZIP' => array(0, _('Zip Code'), 'text', 10), 'SHIPTOCOUNTRYNAME' => array(0, _('Country'), 'text', 20), 'salesterms' => array(-1, _('Sales Terms And Conditions'), sprintf(_('Please read and agree with our %s before' . ' confirming your payment'), $salesterm)), 'agreement' => array(1, _('Agreement'), 'checkbox', sprintf(_('I accept MusXpand\'s sales %s'), mx_windowedpage('salesterms', _('terms & conditions'))), _('You have to agree to continue...')), 'a' => array(1, 'none', 'hidden'), 'PAYERID' => array(1, 'none', 'hidden'), 'cartid' => array(1, $mxuser->cart->id, 'hidden'), 'paymentoption' => array(1, 'PayPal', 'hidden')));
        mx_showform($ckoutlist, $mxuser->cart->orderinfo, true, true);
        //echo print_r($mxuser->cart->orderinfo);
    } else {
        if ($mxuser->cart->progress == 4) {
            // order confirmation
            if ($action != 'printorder') {
                $ckoutbuttons = array('printorder' => _('Print this Confirmation Page'));
            } else {
                $ckoutbuttons = array();
            }
            $cartlist = array('cart' => array('select' => array(0, '', 'text', 3), 'prodtype' => array(0, _('Item'), 'text', 20), 'proddesc' => array(0, _('Description'), 'html', 30), 'prodvar' => array(0, _('Type'), 'text', 20), 'price' => array(0, _('Price'), 'price', 10)));
            $values = $mxuser->cart->orderconfirm;
            $values['invoicenum'] = $mxuser->cart->invoicenum;
            //sprintf(_('%06d'),$mxuser->cart->id);
            $billing = $mxuser->getaddress($mxuser->cart->billingid);
            $shipping = $mxuser->getaddress($mxuser->cart->shippingid);
            $values['FIRSTNAME'] = $billing['first'];
            $values['LASTNAME'] = $billing['last'];
            $values['EMAIL'] = $billing['email'];
            $values['SHIPTONAME'] = $shipping['shiptoname'];
            $values['SHIPTOSTREET'] = $shipping['street1'];
            $values['SHIPTOCITY'] = $shipping['city'];
            $values['SHIPTOSTATE'] = $shipping['state'];
            $values['SHIPTOZIP'] = $shipping['zip'];
            $values['SHIPTOCOUNTRYNAME'] = $shipping['countrycode'];
            $values['termscond'] = mx_showhtmlpagestr('salesterms');
            $ckoutlist = array('checkout', 0, _('Order Confirmation'), $action != 'printorder' ? $progresstable : mx_infomsgstr($mxuser->cart->info), $ckoutbuttons, array('cart' => array(-1, sprintf(_('Invoice # %s'), $mxuser->cart->invoicenum), _('You purchased the following items.')), 'cartcontent' => array(-2, $cartlist, $prodlist, 'cart', array(), 'cart'), 'billing' => array(-1, _('Billing Information'), ''), 'FIRSTNAME' => array(0, _('Firstname'), 'text', 30), 'LASTNAME' => array(0, _('Lastname'), 'text', 30), 'EMAIL' => array(0, _('Billing E-Mail'), 'text', 40), 'shipping' => array(-1, _('Shipping Information'), ''), 'SHIPTONAME' => array(0, _('Ship To'), 'text', 30), 'SHIPTOSTREET' => array(0, _('Address'), 'text', 30), 'SHIPTOCITY' => array(0, _('City'), 'text', 20), 'SHIPTOSTATE' => array(0, _('State/Province'), 'text', 20), 'SHIPTOZIP' => array(0, _('Zip Code'), 'text', 10), 'SHIPTOCOUNTRYNAME' => array(0, _('Country'), 'text', 20), 'confirmation' => array(-1, _('Payment Confirmation'), _('Below are the details of the transaction')), 'invoicenum' => array(0, _('Invoice #'), 'text', 30), 'PAYMENTINFO_0_PAYMENTSTATUS' => array(0, _('Payment Status'), 'text', 20), 'PAYMENTINFO_0_TRANSACTIONID' => array(0, _('Transaction ID'), 'transactionid', 20), 'PAYMENTINFO_0_ORDERTIME' => array(0, _('Order Time'), 'text', 20), 'PAYMENTINFO_0_AMT' => array(0, _('Total Amount'), 'price', 20), 'PAYMENTINFO_0_TAXAMT' => array(0, _('Taxes included'), 'price', 20), 'PAYMENTINFO_0_CURRENCYCODE' => array(0, _('Currency'), 'text', 20), 'terms' => array(-1, _('Sales Terms'), _('Please keep the following sales conditions along with your purchase receipt.')), 'termscond' => array(0, _('Buyer Information'), 'html'), 'a' => array(1, 'none', 'hidden'), 'PAYERID' => array(1, 'none', 'hidden'), 'cartid' => array(1, $mxuser->cart->id, 'hidden'), 'paymentoption' => array(1, 'PayPal', 'hidden')));
            //mx_showform($ckoutlist,$mxuser->cart->orderconfirm,true,true);
            mx_showform($ckoutlist, $values, true, true);
            // confirmation emails
            if ($action != 'printorder') {
                // email to buyer
                $ckoutemail = $ckoutlist;
                $ckoutemail[4] = array();
                $ckoutemail[3] = mx_infomsgstr($mxuser->cart->info);
                $to = $mxuser->fullname . ' <' . $mxuser->email . '>';
                $subj = sprintf(_('Order Confirmation - Invoice # %06d'), $mxuser->cart->id);
                $html = mx_showhtmlpagestr('orderconfirmation');
                $confform = mx_showformstr($ckoutemail, $values, true, true);
                $html = str_replace('{ORDERFORM}', $confform, $html);
                $html = str_replace('{INVOICENUM}', $mxuser->cart->invoicenum, $html);
                // sprintf('%06d',$mxuser->cart->id)
                $txt = sprintf(_('To print your order confirmation, please go to %s'), mx_actionurl('cart', '', 'printorder', '', '', 'secure', 'cartid=' . $mxuser->cart->id));
                mx_sendmail($to, $subj, $txt, $html);
                // email to artists
                foreach ($prodlist['cart'] as $line) {
                    if ($prodtype == MXARTSUB) {
                        $artistid = $line->prodref;
                    } else {
                        if ($prodtype == MXMEDSUB) {
                            $media = $mxuser->getmediainfo($line->prodref);
                            $artistid = $media->owner_id;
                        } else {
                            $artistid = 0;
                        }
                    }
                    $prodtype = $line->prodtype;
                    $prodvar = $line->prodvar;
                    $prodprice = sprintf('US$ %.02f', $line->price);
                    if ($artistid) {
                        $artist = $mxdb->getuserinfo($mxuser->id, $artistid);
                    }
                    if ($artist && $artist->email) {
                        $to = mx_getartistname($artist) . ' <' . $artist->email . '>';
                        if ($prodtype == MXARTSUB) {
                            $subj = _('You just made a new fan');
                            // html version
                            $html = mx_showhtmlpagestr('newfan');
                            // text version
                            $txt = _("Hey {ARTISTNAME}!\n\n" . "We just wanted to give you the good news:\n\n" . "You just made a new fan in {FANNAME}:\n" . "{FANNAME} just purchased a {PRODVAR} {PRODTYPE} from you for {PRICE}\n\n" . "Sales Team,\nMusXpand.\n" . MXSALESEMAIL . "\n" . mx_option('basicsiteurl'));
                            mx_fbaction('musxpand:subscribe_to?artist=' . urlencode(mx_actionurl('artists', 'artprof', $artistid)));
                        } else {
                            if ($prodtype == MXMEDSUB) {
                                $subj = _('Someone bought media from you');
                                // html version
                                $html = mx_showhtmlpagestr('newbuyer');
                                // text version
                                $txt = _("Hey {ARTISTNAME}!\n\n" . "We just wanted to give you the good news:\n\n" . "{FANNAME} bought some media from you:\n" . "{FANNAME} just purchased \"{MEDIANAME}\" from you for {PRICE}\n\n" . "Sales Team,\nMusXpand.\n" . MXSALESEMAIL . "\n" . mx_option('basicsiteurl'));
                            }
                        }
                        $fan = '<a href="' . mx_actionurl('fans', 'fanprof', $mxuser->id) . '">' . mx_getname($mxuser) . '</a>';
                        $html = str_replace('{ARTISTNAME}', mx_getartistname($artist), $html);
                        $html = str_replace('{PRICE}', $prodprice, $html);
                        $html = str_replace('{FANNAME}', $fan, $html);
                        $html = str_replace('{MEDIANAME}', $media->title, $html);
                        $html = str_replace('{PRODVAR}', $prodvar, $html);
                        $html = str_replace('{PRODTYPE}', $prodtype, $html);
                        $siteurl = '<a href="' . mx_option('basicsiteurl') . '">MusXpand</a>';
                        $html = str_replace('{SITEURL}', $siteurl, $html);
                        $html = str_replace('{SALESEMAIL}', MXSALESEMAIL, $html);
                        $txt = str_replace('{ARTISTNAME}', mx_getartistname($artist), $txt);
                        $txt = str_replace('{PRICE}', $prodprice, $txt);
                        $fan = mx_getname($mxuser);
                        $txt = str_replace('{FANNAME}', $fan, $txt);
                        $txt = str_replace('{MEDIANAME}', $media->title, $txt);
                        $txt = str_replace('{PRODVAR}', $prodvar, $txt);
                        $txt = str_replace('{PRODTYPE}', $prodtype, $txt);
                        mx_sendmail($to, $subj, $txt, $html);
                    }
                }
            } else {
                // purchase
                ?>

<!-- Google Code for Bought Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 949396365;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "f7QfCNPfzwMQjcfaxAM";
var google_conversion_value = <?php 
                echo $mxuser->cart->total;
                ?>
;
/* ]]> */
</script>
<script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/949396365/?label=f7QfCNPfzwMQjcfaxAM&amp;guid=ON&amp;script=0"/>
</div>
</noscript>

		<?php 
            }
            /*$ckoutlist[0]='printout';
            		echo '<div id="order"><div class="order">';
            		mx_showform($ckoutlist,$mxuser->cart->orderinfo,false,true);
            		echo '</div></div>';*/
            //echo print_r($mxuser->cart->orderconfirm);
        } else {
            // cart and wishlist display
            $cartbuttons = array('towish' => _('Move to Wishlist'), 'delcart' => _('Remove Checked Items'), 'sep' => null, 'shopmore' => $contshoppinglabel, 'checkout' => _('Proceed to Checkout'));
            $cartlist = array('cartlist', 0, _('Cart & Wishlist Content'), $progresstable, array('cart' => $cartbuttons, 'wishlist' => array('tocart' => _('Move to Cart'), 'delwish' => _('Remove Checked Items'), 'sep' => null, 'shopmore_w' => $contshoppinglabel)), array('cart' => array('cart' => array(-1, _('Your Cart'), _('The following items are currently in your cart')), 'select' => array(0, '<input id="checkallbox" type="checkbox" onclick="javascript:checkall(\'cart\');">', 'text', 3), 'prodtype' => array(0, _('Item'), 'text', 20), 'proddesc' => array(0, _('Description'), 'html', 30), 'prodvar' => array(0, _('Type'), 'text', 20), 'price' => array(0, _('Price'), 'price', 10), 'a' => array(1, 'none', 'hidden'), 'k' => array(1, 'cart', 'hidden')), 'wishlist' => array('wishlist' => array(-1, _('Your Wish List'), _('The following items are currently in your wishlist')), 'select' => array(0, '<input id="checkallbox" type="checkbox" onclick="javascript:checkall(\'wishlist\');">', 'text', 3), 'prodtype' => array(0, _('Item'), 'text', 20), 'proddesc' => array(0, _('Description'), 'html', 30), 'prodvar' => array(0, _('Type'), 'text', 20), 'price' => array(0, _('Price'), 'price', 10), 'a' => array(1, 'none', 'hidden'), 'k' => array(1, 'wishlist', 'hidden'))));
            mx_showlist($cartlist, $prodlist, 'cart', true, true);
            //if ($action=='addfoy' || $action=='adfofa' || $action=='upgfofa') {
            ?>

<!-- Google Code for Added To Cart Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 949396365;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "ziXpCNvezwMQjcfaxAM";
var google_conversion_value = <?php 
            echo $prodprice;
            ?>
;
/* ]]> */
</script>
<script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/949396365/?label=ziXpCNvezwMQjcfaxAM&amp;guid=ON&amp;script=0"/>
</div>
</noscript>

			<?php 
            //}
        }
    }
    //phpinfo();
}
Example #12
0
function mx_mnfblikeus($page, $option, $action)
{
    global $mxuser, $facebook;
    echo '<div class="fblikeus">';
    if (!is_pagelike() && !$mxuser->fbdata['user_id']) {
        echo mx_icon('click_like', _('Like us!'));
    } else {
        if (!is_pagelike()) {
            echo mx_icon('click_like_registered', _('Like us!'));
        } else {
            echo mx_icon('click_liked', _('Like us!')) . '<br/><a target=_blank href="' . mx_actionurl('account', 'register', '', '', '', '', '', true) . '">' . mx_icon('click_register', _('Register!')) . '</a>';
            ?>
		<!--
		<script>
		function checkappstatus() {
			FB.getLoginStatus(function(response) {
				if (response.status === 'connected') {
					window.location='<?php 
            echo mx_pageurl('main');
            ?>
';
				} else {
					setTimeout('checkappstatus();',2000);
				}
			},true);
		}
		setTimeout('checkappstatus();',2000);
		</script>
		-->
		<?php 
        }
    }
    echo '</div>';
    //echo print_r($mxuser,true);
}
Example #13
0
function mx_checkout($cart)
{
    global $mxuser;
    // ==================================
    // PayPal Express Checkout Module
    // ==================================
    //'------------------------------------
    //' The paymentAmount is the total value of
    //' the shopping cart, that was set
    //' earlier in a session variable
    //' by the shopping cart page
    //'------------------------------------
    $paymentAmount = $cart->total + $cart->taxes;
    $_SESSION["Payment_Amount"] = $paymentAmount;
    //'------------------------------------
    //' The currencyCodeType and paymentType
    //' are set to the selections made on the Integration Assistant
    //'------------------------------------
    $currencyCodeType = "USD";
    $paymentType = "Sale";
    //'------------------------------------
    //' The returnURL is the location where buyers return to when a
    //' payment has been succesfully authorized.
    //'
    //' This is set to the value entered on the Integration Assistant
    //'------------------------------------
    $returnURL = mx_optionurl_secure('cart', '');
    //'------------------------------------
    //' The cancelURL is the location buyers are sent to when they hit the
    //' cancel button during authorization of payment during the PayPal flow
    //'
    //' This is set to the value entered on the Integration Assistant
    //'------------------------------------
    $cancelURL = mx_actionurl('cart', '', 'ppcancel');
    // callback URL to calculate taxes (and shipping fees)
    $callbackURL = mx_option('secure_siteurl') . '/paypal.php';
    //'------------------------------------
    //' Calls the SetExpressCheckout API call
    //'
    //' The CallShortcutExpressCheckout function is defined in the file PayPalFunctions.php,
    //' it is included at the top of this file.
    //'-------------------------------------------------
    $resArray = CallShortcutExpressCheckout($cart, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $callbackURL);
    $ack = strtoupper($resArray["ACK"]);
    if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") {
        $mxuser->setcart($cart->id, 'token', $resArray['TOKEN']);
        $mxuser->setcart($cart->id, 'ordertime', preg_replace('%[^0-9]%', '', $resArray['TIMESTAMP']));
        RedirectToPayPal($resArray["TOKEN"]);
    } else {
        //Display a user friendly Error on the page using any of the following error information returned by PayPal
        $ErrorCode = urldecode($resArray["L_ERRORCODE0"]);
        $ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]);
        $ErrorLongMsg = urldecode($resArray["L_LONGMESSAGE0"]);
        $ErrorSeverityCode = urldecode($resArray["L_SEVERITYCODE0"]);
        //echo "SetExpressCheckout API call failed. <br/>"
        //."Detailed Error Message: " . $ErrorLongMsg.'<br/>'
        //."Short Error Message: " . $ErrorShortMsg.'<br/>'
        //."Error Code: " . $ErrorCode.'<br/>'
        //."Error Severity Code: " . $ErrorSeverityCode;
    }
    return $resArray;
}
Example #14
0
 function requesthandle($userid, $msgid, $status)
 {
     $dbid = $this->dbid;
     $qstr = 'SELECT sender,receiver FROM mx_msg2acc WHERE msgid=' . $msgid;
     $mxq = $this->query($qstr);
     if (!$mxq) {
         die(mxerror($dbid->error, __FILE__, __LINE__, $qstr));
     }
     $qr = $mxq->fetch_object();
     $mxq->free();
     switch ($status) {
         case MXREQCANCELLED:
             // the author is cancelling its request
             $qstr = 'DELETE FROM mx_friends' . ' WHERE account1_id=' . $userid . ' AND account2_id=' . $qr->receiver . ' AND NOT confirmed & ' . MXMSGREAD;
             break;
         case MXREQACCEPTED:
             // the recipient accepts the request
             $qstr = 'UPDATE mx_friends SET confirmed=1 ' . ' WHERE account1_id=' . $qr->sender . ' AND account2_id=' . $userid;
             break;
         case MXREQRECUSED:
             // the recipient recuses the request
             $qstr = 'UPDATE mx_friends SET confirmed=2 ' . ' WHERE account1_id=' . $qr->sender . ' AND account2_id=' . $userid;
             break;
         case MXREQIGNORED:
             // the recipient ignores the request
             $qstr = 'UPDATE mx_friends SET confirmed=3 ' . ' WHERE account1_id=' . $qr->sender . ' AND account2_id=' . $userid;
             break;
     }
     $mxq = $this->query($qstr);
     if (!$mxq) {
         die(mxerror($dbid->error, __FILE__, __LINE__, $qstr));
     }
     if ($dbid->affected_rows > 0) {
         if ($status == MXREQACCEPTED) {
             mx_fbaction('musxpand:become_a_friend_of?fan=' . mx_actionurl('fans', 'fanprof', $qr->sender));
         }
         return $this->markmsg($userid, $msgid, $status);
     } else {
         return 0;
     }
 }