示例#1
0
function mx_showmessages($action)
{
    global $mxuser;
    $listorder = mx_secureword($_GET['s']);
    if ($listorder != '') {
        $listorder .= ' asc';
    }
    $msgs = $mxuser->listmessages(null, $listorder);
    if (!$msgs) {
        __('Your message box is empty.');
        return;
    }
    $allmsgs = array();
    $msglist = array('msglist', 0, _('Message List'), sprintf(_('If you want to compose a new message, click %s.'), '<a href="javascript:tabswitch(\'inbox\',\'writemsg\');">' . _('here') . '</a>'), array('inbox' => array('delete_inbox' => _('Delete'), 'archive_inbox' => _('Archive')), 'outbox' => array('delete_outbox' => _('Delete'), 'archive_outbox' => _('Archive')), 'requests' => array('accept_requests' => _('Accept'), 'recuse_requests' => _('Recuse'), 'ignore_requests' => _('Ignore')), 'reqsent' => array('cancel_reqsent' => _('Cancel'), 'archive_reqsent' => _('Archive')), 'archives' => array('delete_archives' => _('Delete')), 'drafts' => array('delete_drafts' => _('Delete'), 'archive_drafts' => _('Archive')), 'writemsg' => array('send' => _('Send'), 'save' => _('Save'), 'clear' => _('Clear'))), array('inbox' => array(0, 'inbox' => array(-1, _('Inbox'), _('The messages you received')), 'select' => array(0, '<input name="checkallbox" type="checkbox" onclick="javascript:checkall(\'inbox\');">', 'text', 3), 'contact' => array(0, _('From'), 'text', 40), 'topic' => array(0, _('Topic'), 'text', 40), 'flags' => array(0, 0, 'hidden'), 'date' => array(0, _('Date'), 'timestamp', 12), 'a' => array(1, 'none', 'hidden'), 'k' => array(1, 'inbox', 'hidden')), 'outbox' => array(0, 'outbox' => array(-1, _('Outbox'), _('The messages you sent')), 'select' => array(0, '<input name="checkallbox" type="checkbox" onclick="javascript:checkall(\'outbox\');">', 'text', 3), 'contact' => array(0, _('To'), 'text', 40), 'topic' => array(0, _('Topic'), 'text', 40), 'flags' => array(0, 0, 'hidden'), 'date' => array(0, _('Date'), 'timestamp', 12), 'a' => array(1, 'none', 'hidden'), 'k' => array(1, 'outbox', 'hidden')), 'requests' => array(0, 'requests' => array(-1, _('Requests'), _('Checking your pending requests?')), 'select' => array(0, '<input name="checkallbox" type="checkbox" onclick="javascript:checkall(\'requests\');">', 'text', 3), 'contact' => array(0, _('From'), 'text', 60), 'flags' => array(0, _('Type'), 'msgflags', 20), 'date' => array(0, _('Date'), 'timestamp', 12), 'a' => array(1, 'none', 'hidden'), 'k' => array(1, 'requests', 'hidden')), 'reqsent' => array(0, 'reqsent' => array(-1, _('Sent Req.'), _('Do you want to cancel any requests you sent?')), 'select' => array(0, '<input name="checkallbox" type="checkbox" onclick="javascript:checkall(\'reqsent\');">', 'text', 3), 'contact' => array(0, _('From'), 'text', 60), 'flags' => array(0, _('Type'), 'msgflags', 20), 'date' => array(0, _('Date'), 'timestamp', 12), 'a' => array(1, 'none', 'hidden'), 'k' => array(1, 'reqsent', 'hidden')), 'archives' => array(0, 'archives' => array(-1, _('Archives'), _('Your arquived messages')), 'select' => array(0, '<input name="checkallbox" type="checkbox" onclick="javascript:checkall(\'archives\');">', 'text', 3), 'contact' => array(0, _('From | To'), 'text', 40), 'topic' => array(0, _('Topic'), 'text', 40), 'a' => array(1, 'none', 'hidden'), 'date' => array(0, _('Date'), 'timestamp', 12), 'flags' => array(0, 0, 'hidden'), 'k' => array(1, 'archives', 'hidden')), 'drafts' => array(0, 'drafts' => array(-1, _('Drafts'), _('Messages previously saved')), 'select' => array(0, '<input name="checkallbox" type="checkbox" onclick="javascript:checkall(\'drafts\');">', 'text', 3), 'contact' => array(0, _('To'), 'text', 40), 'topic' => array(0, _('Topic'), 'text', 40), 'date' => array(0, _('Date'), 'timestamp', 12), 'flags' => array(0, 0, 'hidden'), 'a' => array(1, 'none', 'hidden'), 'k' => array(1, 'drafts', 'hidden')), 'writemsg' => array(1, 'writemsg' => array(-1, _('Write Box'), _('Hey! Writing to friends?')), 'to' => array(1, _('To'), 'user', 40), 'subject' => array(1, _('Subject'), 'subject', 40), 'body' => array(1, _('Body'), 'memo', 10, null, _('Verba volant, scripta manent...'), 54), 'history' => array(0, _('Message History'), 'hiddenmemo', 5), 'flags' => array(1, 0, 'hidden'), 'a' => array(1, 'none', 'hidden'), 'priority' => array(1, 0, 'hidden'), 'refid' => array(1, 0, 'hidden'), 'k' => array(1, 'writemsg', 'hidden'))));
    /* new sorting method: buttons next/previous should work per msg category...
    	while ($msg=$mxuser->listmessages($msgs)) {
    		$buttons=null;
    		if ($msg->flags & MXREQUEST) {
    			if ($msg->sender==$mxuser->id) {
    				$buttons['cancel:'.$msg->msgid]=_('Cancel');
    				$buttons['archive:'.$msg->msgid]=_('Archive');
    			} else {
    				$buttons['accept:'.$msg->msgid]=_('Accept');
    				$buttons['recuse:'.$msg->msgid]=_('Recuse');
    				$buttons['ignore:'.$msg->msgid]=_('Ignore');
    				$buttons['sep4']=null;
    				$buttons['reply:'.$msg->msgid]=_('Reply');
    				$buttons['forward:'.$msg->msgid]=_('Forward');
    			}
    			$buttons['sep3']=null;
    		} else {
    			if ($msg->sender==$mxuser->id) {
    				$buttons['resend:'.$msg->msgid]=_('Resend');
    				$buttons['sep2']=null;
    			}
    			$buttons['delete:'.$msg->msgid]=_('Delete');
    			$buttons['archive:'.$msg->msgid]=_('Archive');
    			$buttons['sep1']=null;
    		}
    		if ($msg->prev) $buttons['previous:'.$msg->prev]=_('Previous');
    		else $buttons['-previous']=_('Previous');
    		if ($msg->next) $buttons['next:'.$msg->next]=_('Next');
    		else $buttons['-next']=_('Next');
    		$msg->select='<input type="checkbox" name="selmsg[]" value="'.$msg->msgid.'">';
    		$msg->select.='<div class="contentframe"><div id="'.$msg->msgid.'" class="msgcontent" style="display:none;">';
    		$msgform=array(
    			'msgform',0,_('Message read'),_('Details...'),
    			$buttons,
    			array(
    				'from'  => array(1,_('From:'),'text',40),
    				'h_from'  => array(1,0,'hidden',40),
    				'to'  => array(1,_('To:'),'text',40),
    				'h_to'  => array(1,0,'hidden',40),
    				'date'  => array(1,_('Date:'),'text',40),
    				'flags'  => array(1,_('Flags:'),'msgflags',40),
    				'subject' => array(0,_('Subject:'),'text',40),
    				'body' => array(0,_('Body:'),'text',60)
    			)
    		);
    		$msg->select.=mx_letterstr($msgform,array(
    			'from' => ($mxuser->id==$msg->sender)?_('Me'):($msg->fullname?$msg->fullname:$msg->artistname),
    			'to' => ($mxuser->id==$msg->receiver)?_('Me'):($msg->fullname?$msg->fullname:$msg->artistname),
    			'h_to' => ($mxuser->id==$msg->receiver)?$mxuser->id:$msg->receiver,
    			'h_from' => ($mxuser->id==$msg->sender)?$mxuser->id:$msg->sender,
    			'date' => $msg->date,
    			'subject' => $msg->subject,
    			'flags' => $msg->flags,
    			'body' => mx_msgformat($msg->body),
    			'msgid' => $msg->msgid
    			),false);
    		$msg->select.='<div class="msgclose"><a href="javascript:hidecontent('.$msg->msgid.')">'._('X').'</a>' .
    			'</div></div></div>';
    		$msg->contact='<div class="msgline"><img class="msgpic" src="'.mx_fanpic($msg->id,'square').'" />';
    		$msg->contact.=' '.(($mxuser->id==$msg->sender)?(_('Me').' &rarr;'):'');
    		$msg->contact.=' '.($msg->fullname?$msg->fullname:$msg->artistname);
    		$msg->contact.=' '.(($mxuser->id==$msg->sender)?'':('&rarr; '._('Me')));
    		$msg->contact.='</div>';
    		$msg->topic=$msg->subject.'<div class="bodyextract">&ldquo;'.(strlen($msg->body)>40?(substr($msg->body,0,40).'[&hellip;]'):$msg->body).'&rdquo;</div>';
    		$msg->read = ($msg->status & MXMSGREAD)?true:false;
    		//$msg->flags = ($msg->flags | MXMSGREQUEST)?'true':'false';
    		if (!$msg->level) $msg->level='';
    		$allmsgs['messages'][]=$msg;
    		if ($mxuser->id==$msg->receiver) { // receiver
    			if (!($msg->status & MXMSGDELETED)) {
    				if ($msg->status & MXMSGARCHIVED) $allmsgs['archives'][]=$msg;
    				else $allmsgs['inbox'][]=$msg;
    			}
    		}
    		if ($mxuser->id==$msg->sender) {
    			if (!($msg->sstatus & MXMSGDELETED)) {
    				if ($msg->sstatus & MXMSGARCHIVED) $allmsgs['archives'][]=$msg;
    				else $allmsgs['outbox'][]=$msg;
    				if ($msg->sstatus & MXMSGDRAFT) $allmsgs['drafts'][]=$msg;
    			}
    		}
    		if ($msg->flags & MXREQUEST) $allmsgs['requests'][]=$msg;
    		$msg=$nmsg;
    	}
    	*/
    /* old sorting method buttons next/previous are global :-( */
    $msg = null;
    while ($msgs && ($nmsg = $mxuser->listmessages($msgs)) || $msg) {
        //print_r($msg);
        if (!$msg) {
            $msg = $nmsg;
            $msg->prev = null;
            continue;
        } else {
            if ($nmsg) {
                $nmsg->prev = $msg->msgid;
            }
        }
        if (!$nmsg) {
            $msg->next = null;
            $msgs = null;
        } else {
            $msg->next = $nmsg->msgid;
        }
        $buttons = null;
        if ($msg->flags & MXREQUEST) {
            if ($msg->sender == $mxuser->id) {
                $buttons['cancel:' . $msg->msgid] = _('Cancel');
                $buttons['archive:' . $msg->msgid] = _('Archive');
            } else {
                $buttons['accept:' . $msg->msgid] = _('Accept');
                $buttons['recuse:' . $msg->msgid] = _('Recuse');
                $buttons['ignore:' . $msg->msgid] = _('Ignore');
                $buttons['sep4'] = null;
                $buttons['reply:' . $msg->msgid] = _('Reply');
                $buttons['forward:' . $msg->msgid] = _('Forward');
            }
            $buttons['sep3'] = null;
        } else {
            if ($msg->sender == $mxuser->id) {
                $buttons['resend:' . $msg->msgid] = _('Resend');
                $buttons['sep2'] = null;
            } else {
                $buttons['reply:' . $msg->msgid] = _('Reply');
                $buttons['forward:' . $msg->msgid] = _('Forward');
                $buttons['sep2'] = null;
            }
            $buttons['delete:' . $msg->msgid] = _('Delete');
            $buttons['archive:' . $msg->msgid] = _('Archive');
            $buttons['sep1'] = null;
        }
        if ($msg->prev) {
            $buttons['previous:' . $msg->prev] = _('Previous');
        } else {
            $buttons['-previous'] = _('Previous');
        }
        if ($msg->next) {
            $buttons['next:' . $msg->next] = _('Next');
        } else {
            $buttons['-next'] = _('Next');
        }
        $msg->select = '<input type="checkbox" name="selmsg[]" value="' . $msg->msgid . '">';
        $msg->select .= '<div class="contentframe"><div id="' . $msg->msgid . '" class="msgcontent" style="display:none;">';
        $msgform = array('msgform', 0, _('Message read'), _('Details...'), $buttons, array('from' => array(1, _('From:'), 'text', 40), 'h_from' => array(1, 0, 'hidden', 40), 'to' => array(1, _('To:'), 'text', 40), 'h_to' => array(1, 0, 'hidden', 40), 'date' => array(1, _('Date:'), 'date', 40), 'flags' => array(1, _('Flags:'), 'msgflags', 40), 'subject' => array(0, _('Subject:'), 'text', 40), 'body' => array(0, _('Body:'), 'text', 60)));
        $msg->select .= mx_letterstr($msgform, array('from' => $mxuser->id == $msg->sender ? _('Me') : ($msg->fullname ? $msg->fullname : $msg->artistname), 'to' => $mxuser->id == $msg->receiver ? _('Me') : ($msg->fullname ? $msg->fullname : $msg->artistname), 'h_to' => $mxuser->id == $msg->receiver ? $mxuser->id : $msg->receiver, 'h_from' => $mxuser->id == $msg->sender ? $mxuser->id : $msg->sender, 'date' => $msg->date, 'subject' => $msg->subject, 'flags' => $msg->flags, 'body' => mx_msgformat($msg->body), 'msgid' => $msg->msgid), false);
        $msg->select .= '<div class="msgclose"><a href="javascript:hidecontent(' . $msg->msgid . ')">' . _('X') . '</a>' . '</div></div></div>';
        $msg->contact = '<div class="msgline"><img class="msgpic" src="' . mx_fanpic($msg->id, 'square', $msg->gender, $msg->acctype == MXACCOUNTARTIST) . '" />';
        $msg->contact .= ' ' . ($mxuser->id == $msg->sender ? _('Me') . ' &rarr;' : '');
        $msg->contact .= ' ' . ($msg->fullname ? $msg->fullname : $msg->artistname);
        $msg->contact .= ' ' . ($mxuser->id == $msg->sender ? '' : '&rarr; ' . _('Me'));
        $msg->contact .= '</div>';
        $msg->topic = $msg->subject . '<div class="bodyextract">&ldquo;' . (strlen($msg->body) > 40 ? substr($msg->body, 0, 40) . '[&hellip;]' : $msg->body) . '&rdquo;</div>';
        $msg->read = $msg->status & MXMSGREAD ? true : false;
        $msg->ignored = $msg->status & MXREQIGNORED ? true : false;
        $msg->cancelled = $msg->status & MXREQCANCELLED ? true : false;
        //$msg->flags = ($msg->flags | MXMSGREQUEST)?'true':'false';
        if (!$msg->level) {
            $msg->level = '';
        }
        $allmsgs['messages'][] = $msg;
        if ($mxuser->id == $msg->receiver) {
            // receiver
            if (!($msg->status & (MXMSGDELETED | MXREQCANCELLED | MXREQIGNORED))) {
                if ($msg->status & MXMSGARCHIVED) {
                    $allmsgs['archives'][] = $msg;
                } else {
                    if ($msg->flags & MXREQUEST) {
                        $allmsgs['requests'][] = $msg;
                    } else {
                        $allmsgs['inbox'][] = $msg;
                    }
                }
            }
        }
        if ($mxuser->id == $msg->sender) {
            if (!($msg->sstatus & (MXMSGDELETED | MXREQCANCELLED))) {
                if ($msg->sstatus & MXMSGARCHIVED) {
                    $allmsgs['archives'][] = $msg;
                } else {
                    if ($msg->flags & MXREQUEST) {
                        $allmsgs['reqsent'][] = $msg;
                    } else {
                        if ($msg->sstatus & MXMSGDRAFT) {
                            $allmsgs['drafts'][] = $msg;
                        } else {
                            $allmsgs['outbox'][] = $msg;
                        }
                    }
                }
            }
        }
        $msg = $nmsg;
    }
    /* end old sorting method */
    if (preg_match('%^(af:(.+))$%', $action, $actionarg) > 0) {
        $user = $mxuser->getuserinfo($actionarg[2]);
        $allmsgs['writemsg'] = array('to' => $user->id, 'subject' => _('Friendship Request'), 'flags' => MXFRIENDREQUEST, 'body' => _('Hi there. Could you please accept this request for friendship...?'));
        //error_log(print_r($allmsgs['writemsg'],true));
    }
    //error_log($action);
    if (preg_match('%^(sm:(.+))$%', $action, $actionarg) > 0) {
        $user = $mxuser->getuserinfo($actionarg[2]);
        $allmsgs['writemsg'] = array('to' => $user->id, 'subject' => '', 'body' => '');
    }
    mx_showlist($msglist, $allmsgs, 'messages', true, true);
    if (preg_match('%(rp:([0-9]+))%', $action, $actionarg) > 0) {
        ?>
		<script language="javascript">buttonclick('reply:<?php 
        echo $actionarg[2];
        ?>
');</script>
		<?php 
    }
}
示例#2
0
require 'includes/mx_media.php';
if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
    if (!$mxuser->id) {
        return;
    }
    $pid = trim(strtolower(preg_replace('![^0-9]!', '', mx_secureword($_REQUEST['p']))));
    // pic id or pos
    $mid = trim(strtolower(preg_replace('![^0-9]!', '', mx_secureword($_REQUEST['m']))));
    // media id
    $st = trim(strtolower(preg_replace('![^0-9]!', '', mx_secureword($_REQUEST['s']))));
    // new status
    $bid = trim(strtolower(preg_replace('![^0-9]!', '', mx_secureword($_REQUEST['b']))));
    // bundle id
    $did = trim(strtolower(preg_replace('![^0-9]!', '', mx_secureword($_REQUEST['d']))));
    // destination bundle id
    $fld = trim(strtolower(preg_replace('![^a-zA-Z]!', '', mx_secureword($_REQUEST['f']))));
    // fld (title or desc)
    $txt = trim(urldecode($_REQUEST['t']));
    // fld text
    if (!$mid && !$st) {
        return;
    }
    if ($st && $mid) {
        die(json_encode($mxuser->setmediastatus($mid, $st)));
    }
    if ($fld) {
        die(json_encode($mxuser->updatemediainfo($mid, $fld, $txt)));
    }
    if ($did) {
        // p=pos
        die(json_encode($mxuser->movetobundle($mid, $did, $pid)));
示例#3
0
    Copyright � 2010 by Philippe Hilger
 */
require 'includes/mx_account.php';
if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
    if (!$mxuser->id) {
        return;
    }
    $rid = trim(strtolower(preg_replace('![^0-9]!', '', mx_secureword($_REQUEST['r']))));
    // favid to remove
    $fid = trim(strtolower(preg_replace('![^0-9]!', '', mx_secureword($_REQUEST['f']))));
    // obj id to add
    $tid = trim(strtolower(preg_replace('![^0-9]!', '', mx_secureword($_REQUEST['t']))));
    // obj type
    $bg = trim(strtolower(preg_replace('![^0-9]!', '', mx_secureword($_REQUEST['bg']))));
    // obj id to set as bg
    $ty = trim(strtolower(preg_replace('![^a-z]!', '', mx_secureword($_REQUEST['ty']))));
    // obj type
    if (!$rid && (!$fid || !$tid) && (!$bg || !$ty)) {
        return;
    }
    if ($rid) {
        die(json_encode($mxuser->delfav($rid)));
    }
    if ($fid && $tid) {
        die(json_encode($mxuser->addfav($fid, $tid)));
    }
    if ($bg && $ty) {
        $bgok = 0;
        if ($ty == 'm') {
            $media = $mxuser->getmediainfo($bg);
            if ($media->type == MXMEDIABG || $media->type == MXMEDIAPIC) {
示例#4
0
 * Author:  phil
 * Date:    11/15/2011
 * ---
 * License:

    This file is part of musxpand.

    musxpand is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    musxpand is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with musxpand.  If not, see <http://www.gnu.org/licenses/>.

    Copyright � 2010 by Philippe Hilger
 */
require 'includes/mx_init.php';
if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
    if (!$mxuser->id) {
        return;
    }
    $mid = preg_replace('![^0-9]!', '', mx_secureword($_REQUEST['m']));
    $lid = preg_replace('![^0-9]!', '', mx_secureword($_REQUEST['l']));
    $mxuser->unlinkmedia($lid, $mid);
}
示例#5
0
function mx_showcustompage($page, $user, $media = null, $simul = '')
{
    global $mxuser, $transparencies, $windows, $mxdb;
    if ($simul == 'public') {
        $saveuser = $mxuser;
        $mxuser = new MXUser(-1);
        $user = $mxuser->getuserinfo($user->id, true);
        // get public info instead...
    }
    mx_checkvalues($user);
    //error_log(print_r($user,true));
    $locale = $mxuser->locale ? $mxuser->locale : 'en_US';
    $locpage = mx_option('pagesdir') . '/' . $locale . '/' . $page . '.html';
    if (file_exists($locpage)) {
        $html = file_get_contents(mx_option('pagesdir') . '/' . $locale . '/' . $page . '.html');
    } else {
        $locpage = mx_option('pagesdir') . '/en_US/' . $page . '.html';
        if (file_exists($locpage)) {
            $html = file_get_contents(mx_option('pagesdir') . '/en_US/' . $page . '.html');
            //$html='<div class="nottranslated">'.
            //_('(This page will be translated to your language soon)').'</div>'.$html;
        }
    }
    $html = preg_replace('%{playicon:([^}]+)}%', '<a class="playbutton" href="javascript:play(\'$1\');">' . mx_icon('playsound', 'listen', 16, 'i_$1') . '</a>', $html);
    $html = preg_replace('%{mail:([^},]+),([^},]+),?([^}]+)}%', '<a href="mailto:$1?Subject=$3" alt="$2">$2</a>', $html);
    if (preg_match_all('%{menu:([^},]+),?([^}]+)?}%', $html, $menus)) {
        for ($i = 0; $i < count($menus[0]); $i++) {
            $html = str_replace($menus[0][$i], mx_optionlink($menus[1][$i], $menus[2][$i]), $html);
        }
    }
    $html = preg_replace('%{aboutimg:([^,}]+)(,([^}]+))?}%', '<img class="about" src="' . mx_option('siteurl') . '/images/about/$1" alt="$3" />', $html);
    $html = str_replace('{firstname}', $mxuser->firstname ? $mxuser->firstname : $mxuser->fullname, $html);
    $html = str_replace('[', '<', $html);
    $html = str_replace(']', '>', $html);
    // user stuff
    $user->subs = $mxuser->getsub($user->id);
    $stotal = $sfoy = $sfofa = $slike = 0;
    foreach ($user->subs as $k => $sub) {
        ++$stotal;
        if ($sub->subtype == MXSUBFOY) {
            ++$sfoy;
        } else {
            if ($sub->subtype == MXSUBFOFA || $sub->subtype == MXUPGFOFA) {
                ++$sfofa;
            } else {
                if ($sub->subtype == MXSUBLIKE) {
                    ++$slike;
                }
            }
        }
    }
    $html = str_replace('{PIC}', '<img tag="' . $user->id . '" src="' . mx_fanpic($user->id, 'large') . '" />', $html);
    $html = str_replace('{ARTISTPIC}', '<img tag="' . $user->id . '" class="artistpic" src="' . mx_artpic($user->id, 'large', $user->gender) . '" itemprop="image"/>', $html);
    //if ($user->acctype==MXACCOUNTFAN) {
    if ($sfofa + $sfoy >= 10) {
        $fanrank = 'n1fan';
    } else {
        if ($sfofa + $sfoy >= 1) {
            $fanrank = 'truefan';
        } else {
            $fanrank = 'fanlogo';
        }
    }
    //}
    $html = str_replace('{FANPIC}', '<img tag="' . $user->id . '" class="fanpic" src="' . mx_fanpic($user->id, 'large', $user->gender) . '" itemprop="image"/>' . '<div class="picstamp"><img class="picstamp" src="' . mx_iconurl($fanrank) . '"/></div>', $html);
    $html = str_replace('{ARTISTNAME}', mx_getartistname($user), $html);
    $html = str_replace('{LASTSEEN}', mx_difftime($user->lastseen), $html);
    $html = str_replace('{NAME}', mx_getname($user), $html);
    $html = str_replace('{FULLNAME}', mx_getname($user), $html);
    if (strpos($html, '{BACKGROUND}') > 0) {
        $bg = $mxuser->getbackgroundurl($user->background_id);
        $html = str_replace('{BACKGROUND}', $bg, $html);
        if (!strpos($bg, 'tiled')) {
            $html = str_replace('{BACKGROUNDSIZE}', 'background-size:100%;', $html);
        }
    }
    // find transparency background
    $opt = 90;
    if (array_key_exists($user->transparency, $transparencies)) {
        $opt = 100 - $user->transparency;
    }
    if ($opt < 50) {
        $opt = 50;
    }
    $whitebg = $opt ? mx_option('siteurl') . '/images/background/white-dot-' . $opt . '.png' : '';
    $yellowbg = $opt ? mx_option('siteurl') . '/images/background/yellow-dot-' . $opt . '.png' : '';
    $html = str_replace('{WHITEBG}', $whitebg, $html);
    $html = str_replace('{YELLOWBG}', $yellowbg, $html);
    $html = str_replace('{OPACITY}', 1 - $user->transparency / 100, $html);
    $html = str_replace('{OPACITY100}', 100 - $user->transparency, $html);
    $html = str_replace('{BIO}', mx_urls2anchors(mx_cleanhtml($user->longbio)), $html);
    $html = str_replace('{AGE}', $user->age, $html);
    $html = str_replace('{BDAY}', $user->birthday, $html);
    $html = str_replace('{ABOUT}', mx_cleanhtml($user->shortbio), $html);
    $html = str_replace('{GENDER}', mx_gender($user->gender), $html);
    $html = str_replace('{WEBSITE}', mx_urls($user->website), $html);
    $html = str_replace('{EMAIL}', $user->email, $html);
    $artlinks = '<ul>';
    if ($user->username) {
        foreach (array('artist', 'artists', 'art', 'arts', 'at') as $aurl) {
            $link = 'http://' . $user->username . '.' . $aurl . '.example.com';
            $artlinks .= '<li><a href="' . $link . '">' . $link . '</a></li>';
        }
        $link = 'http://www.example.com/a/' . $user->username;
        $artlinks .= '<li><a href="' . $link . '">' . $link . '</a></li>';
    }
    $link = 'http://www.example.com/artists/artprof?a=' . $user->id;
    $artlinks .= '<li><a href="' . $link . '">' . $link . '</a></li>';
    $artlinks .= '</ul>';
    $html = str_replace('{ARTLINKS}', $artlinks, $html);
    $fanlinks = '<ul>';
    if ($user->username) {
        foreach (array('fan', 'fans') as $furl) {
            $link = 'http://' . $user->username . '.' . $furl . '.example.com';
            $fanlinks .= '<li><a href="' . $link . '">' . $link . '</a></li>';
        }
        $link = 'http://www.example.com/f/' . $user->username;
        $fanlinks .= '<li><a href="' . $link . '">' . $link . '</a></li>';
    }
    $link = 'http://www.example.com/fans/fanprof?a=' . $user->id;
    $fanlinks .= '<li><a href="' . $link . '">' . $link . '</a></li>';
    $fanlinks .= '</ul>';
    $html = str_replace('{FANLINKS}', $fanlinks, $html);
    if (strpos($html, '{STYLES}') > 0 || strpos($html, '{TASTES}') > 0) {
        $genres = $mxdb->listgenres();
        $cats = array();
        $subgenres = array();
        foreach ($genres as $genre) {
            if (!$genre->cat) {
                $cats[$genre->hash] = $genre->id;
                $subgenres[$genre->id] = array();
            }
        }
        foreach ($genres as $genre) {
            if ($genre->cat) {
                $subgenres[$cats[$genre->cat]][] = $genre->id;
                $catgenre[$genre->id] = $cats[$genre->cat];
            }
        }
        if (strpos($html, '{STYLES}') > 0) {
            $value = $user->genres;
        } else {
            $value = $user->tastes;
        }
        $str = '<table class="genres">';
        $ok = 0;
        for ($i = 0; $i < 5; $i++) {
            $genre = $value[$i];
            if ($genre) {
                $cat = $catgenre[$genre];
                $str .= '<tr><th>' . (!$i ? _('Primary') : ($i == 1 ? _('Secondary') : _('Other'))) . ':</th><td>' . $genres[$genre]->genre . ($cat ? ' (' . $genres[$cat]->genre . ')' : '') . '</td></tr>';
                $ok = 1;
            }
        }
        $str .= '</table>';
        if (!$ok) {
            $str = _('Not informed');
        }
        $html = str_replace('{TASTES}', $str, $html);
        $html = str_replace('{STYLES}', $str, $html);
    }
    if (strpos($html, '{MEDIA}') > 0) {
        //$mediatable=$mxuser->listartistmedia($user->id);
        //$html=str_replace('{MEDIA}',mx_showmediastr($mediatable),$html);
        //$mediatable=$mxuser->listartistmedia($user->id);
        $googlecrawler = mx_securestring($_GET['_escaped_fragment_']);
        $ob = preg_replace('%[^0-9]%', '', $googlecrawler);
        //error_log('ob='.$ob.' / media->id='.$media->id);
        $mediatable = mx_showmediastr($user->id, 'media', $ob ? $ob : $media->id);
        $html = str_replace('{MEDIA}', $mediatable, $html);
    }
    $location = '';
    if ($user->city) {
        $location .= '<span itemprop="addressLocality">' . $user->city . '</span>';
    }
    if ($user->state) {
        $location .= ($location ? ', ' : '') . '<span itemprop="addressRegion">' . $user->state . '</span>';
    }
    if ($user->country) {
        $location .= ($location ? ', ' : '') . '<span itemprop="addressCountry">' . mx_getcountryname($user->country) . '</span>';
    }
    $html = str_replace('{LOCATION}', $location, $html);
    $html = str_replace('{FACELIKE}', '<fb:like href="' . mx_actionurl_prod('artists', 'artprof', $user->id) . '" send="false" show_faces="false" width="60" font=""></fb:like>', $html);
    $html = str_replace('{PLUSONE}', '<g:plusone size="medium" href="' . mx_actionurl_prod('artists', 'artprof', $user->id) . '" callback="mxpluslike"></g:plusone>', $html);
    $html = str_replace('{FANFACELIKE}', '<fb:like href="' . mx_actionurl_prod('fans', 'fanprof', $user->id) . '" send="false" show_faces="true" width="60" font=""></fb:like>', $html);
    $html = str_replace('{FANPLUSONE}', '<g:plusone size="medium" href="' . mx_actionurl_prod('fans', 'fanprof', $user->id) . '"></g:plusone>', $html);
    $hassub = 0;
    if (strpos($html, '{SUBSCRIBERS}') > 0) {
        $html = str_replace('{SUBSCRIBERS}', mx_subscribers($user->id, false), $html);
    }
    if (strpos($html, '{LIKERS}') > 0) {
        $html = str_replace('{LIKERS}', mx_subscribers($user->id, true), $html);
    }
    if (strpos($html, '{SUBSCRIPTIONS}') > 0 || strpos($html, '{LIKES}') > 0 || strpos($html, '{SUBSCRIBE}') > 0) {
        if (strpos($html, '{SUBSCRIPTIONS}') > 0) {
            $html = str_replace('{SUBSCRIPTIONS}', mx_subscriptions($user->subs, false), $html);
        }
        if (strpos($html, '{LIKES}') > 0) {
            $html = str_replace('{LIKES}', mx_subscriptions($user->subs, true), $html);
        }
    }
    $mysubs = $mxuser->getsub();
    foreach ($mysubs as $sub) {
        if ($sub->subcat == MXARTSUB && $sub->objectid == $user->id && $sub->status != MXEXPIREDSUB) {
            $hassub = $sub->subtype;
            $autorenew = $sub->renewal;
            break;
        }
    }
    if (strpos($html, '{ILOVE}') > 0) {
        if (!$mxuser->id) {
            $str = '';
        } else {
            if ($hassub == MXSUBLIKE) {
                // likers
                $str = mx_icon('ilove', _('Like!'), '', 'nl_' . $user->id, 'ilovehover', 'class');
            } else {
                if ($hassub) {
                    // fan love
                    $str = mx_icon('fanlove', _('Fan Love'), '');
                } else {
                    if ($mxuser->id == $user->id) {
                        $str = mx_icon('melove', _('Love Me'), '');
                    } else {
                        $str = mx_icon('nolove', _('I LOVE THIS!'), '', 'il_' . $user->id, 'nolovehover', 'class');
                    }
                }
            }
        }
        $html = str_replace('{ILOVE}', $str, $html);
    }
    if (strpos($html, '{SUBSCRIBE}') > 0 && $mxuser->id && $mxuser->id != $user->id && $user->status != MXACCTDISABLED && ($user->pubcnt >= MXMINIMUMMEDIA || is_admin())) {
        $subscribefoy = _('1-Year: ${FOY}');
        //$subscribefofa=_('{FOFAYRS}: ${FOFA}');
        //$upgradefofa=_('Upgrade: ${FOFAUPG}');
        $subfoybtn = array(1, $subscribefoy, 'g-button', 'subs1year', '<b>F</b>an <b>O</b>ne <b>Y</b>ear (FOY)<br/>This fanship entitles you to <b>listen to and download all media</b>, <u>from this artist' . ' exclusively</u>, <b>during 1 year</b>. After the first renewal in 1 year, ' . 'you will get access to this artist\'s media forever.');
        $subfofabtn = array(1, $subscribefofa, 'g-button', 'subsforever', '<b>F</b>an <b>O</b>nce <b>F</b>an <b>A</b>lways (FOFA)<br/>This fanship entitles you to <b>download all media</b>, <u>from this artist' . ' exclusively</u>, <b>forever</b>');
        $subfofaupgbtn = array(1, $upgradefofa, 'g-button', 'subsforeverupg', 'This upgrade entitles you to <b>download all media</b>, <u>from this artist' . ' exclusively</u>, <b>forever</b>');
        if ($hassub == MXSUBFOFA || $hassub == MXUPGFOFA) {
            $subscribetxt = _('You\'re a Fan, FOREVER!');
            $cansubfoy = false;
            $cansubfofa = false;
            $canupgfofa = false;
        } else {
            if ($hassub == MXSUBFOY) {
                if ($autorenew) {
                    $subscribetxt = _('Auto-Renewal Enabled');
                } else {
                    $subscribetxt = _('Auto-Renewal Disabled');
                }
                $cansubfoy = false;
                $cansubfofa = false;
                $canupgfofa = false;
            } else {
                $subscribetxt = sprintf(_('Subscribe to this %s'), $user->acctype == MXACCOUNTARTIST ? _("Artist") : _("Band"));
                $cansubfoy = true;
                $cansubfofa = false;
                $canupgfofa = false;
            }
        }
        $addcart = '<form style="display:inline" name="addtocart" action="' . mx_pageurl('cart') . '" method="POST">' . '<div class="title"><img src="' . mx_option('templateURL') . '/icons/cart.png" />' . ' ' . $subscribetxt . '</div>' . '<input type="hidden" name="id" value="' . $user->id . '">' . '<input type="hidden" name="a" value="">' . ($cansubfoy ? mx_formfield('addfoy', $subscribefoy, $subfoybtn) : '') . ($cansubfofa ? mx_formfield('addfofa', $subscribefofa, $subfofabtn) : '') . ($canupgfofa ? mx_formfield('upgfofa', $upgradefofa, $subfofaupgbtn) : '') . '</form>';
        $html = str_replace('{SUBSCRIBE}', $addcart, $html);
    } else {
        if ($user->status == MXACCTDISABLED) {
            $html = str_replace('{SUBSCRIBE}', _('Sorry, this account is no more active.'), $html);
        } else {
            if ($mxuser->id == $user->id) {
                $html = str_replace('{SUBSCRIBE}', _('Hey! You\'re an artist!!'), $html);
            } else {
                $logfirst = '<div class="title"><img src="' . mx_option('templateURL') . '/icons/cart.png" /> ' . _('to become a FAN...') . '</div>' . sprintf(_('%s or %s'), '<a href="' . mx_actionurl('account', 'signin', '', '', 'artists,artprof,' . $user->id) . '" alt="' . _('Sign-in') . '">' . mx_icon('signinbtn', _('Sign-in'), '', 'xx', 'signinbtnhover') . '</a>', '<a href="' . mx_actionurl('account', 'register', '', '', 'artists,artprof,' . $user->id, '', 'i=' . $user->invitecode) . '" alt="' . _('Register') . '">' . mx_icon('registerbtn', _('Register'), '', 'xx', 'registerbtnhover') . '</a>');
                $html = str_replace('{SUBSCRIBE}', $logfirst, $html);
            }
        }
    }
    // fans stats
    $fanstats = '<table><tr><th>' . _('Stats') . '</th></tr>' . '<tr><td><a href="javascript:tabswitch(\'GENERAL\',\'SUBSCRIPTIONS\');">' . _('Fanships') . '</a>' . '<br/>' . _('FOFA:') . ' ' . $sfofa . '<br/>' . _('FOY:') . ' ' . $sfoy . '<br/>' . _('Likes:') . ' ' . $slike . '<br/><span class="stattotal">' . _('Total:') . ' ' . $stotal . '</span>' . '</td></tr>' . '</table>';
    $html = str_replace('{FANSTATS}', $fanstats, $html);
    // artists stats
    $stats = '<table><tr><th>' . _('Stats') . '</th></tr>' . '<tr><td class="first"><a href="javascript:tabswitch(\'GENERAL\',\'MEDIA\');">' . _('Media') . '</a>' . '<br/><span class="stathdr">' . _('Uploaded') . '</span><br/>' . $user->mediacnt . ($user->mediacnt != MXNOTINFORMED ? ' (' . mx_size($user->mediasize) . ')' : '') . '<br/><span class="stathdr">' . _('Published') . '</span><br/>' . $user->pubcnt . ' (' . mx_size($user->pubsize) . ')</td></tr>' . '<tr><td><a href="javascript:tabswitch(\'GENERAL\',\'SUBSCRIBERS\');">' . _('Fans') . '</a>' . '<br/>' . _('FOFA:') . ' ' . $user->subfofa . '<br/>' . _('FOY:') . ' ' . $user->subfoy . '<br/>' . _('Likes:') . ' ' . $user->sublike . '<br/><span class="stattotal">' . _('Total:') . ' ' . $user->subcnt . '</span>' . '</td></tr>' . '</table>';
    $html = str_replace('{STATS}', $stats, $html);
    $html = str_replace('{FOY}', MXFEEFOY, $html);
    $html = str_replace('{FOFA}', MXFEEFOFA, $html);
    $html = str_replace('{FOFAUPG}', sprintf('%.2d', MXFEEFOFA - MXFEEFOY), $html);
    $html = str_replace('{FOFAYRS}', MXFOFAYRS, $html);
    $html = str_replace('{FREE}', MXFEEFREE, $html);
    $html = str_replace('{BASIC}', MXFEEBASIC, $html);
    $html = str_replace('{PLUS}', MXFEEPLUS, $html);
    $html = str_replace('{PREMIUM}', MXFEEPREMIUM, $html);
    $html = str_replace('{1SONG}', MXFEE1SONG, $html);
    $html = str_replace('{SONGS}', MXFEESONGS, $html);
    $html = str_replace('{SETUPFEE}', MXFEESETUP, $html);
    $html = str_replace('{siteurl}', mx_option('siteurl'), $html);
    $html = str_replace('{WALL}', mx_showuserwallstr($user), $html);
    $html = str_replace('{MYREVIEWS}', _('Available Soon'), $html);
    $chats = '<iframe class="chat" src="../ext_includes/chat/index.php"></iframe>';
    $html = str_replace('{SHOWS}', _('Available Soon'), $html);
    $html = str_replace('{CHATS}', _('Available Soon'), $html);
    $html = str_replace('{MENTIONS}', _('Available Soon'), $html);
    $fbreviews = '<div class="fb-comments" data-href="' . mx_actionurl('artists', 'artprof', $user->id) . '" data-num-posts="10" data-width="540"></div>';
    $html = str_replace('{REVIEWS}', $fbreviews, $html);
    if (strpos($html, '{SHARE}') > 0) {
        $tools = mx_sharetools($user->id, true);
    }
    // artists tools
    if (strpos($html, '{SHAREFAN}') > 0) {
        $tools = mx_sharetools($user->id, false);
    }
    // fans tools
    $html = str_replace('{SHARE}', $tools, $html);
    // for artists
    $html = str_replace('{SHAREFAN}', $tools, $html);
    // for fans
    $html = str_replace('{QRCODE}', mx_qrcode($user, true), $html);
    // for artists
    $html = str_replace('{QRCODEFAN}', mx_qrcode($user, false), $html);
    // for fans
    // build tabs if needed
    $realnames = array('MEDIA' => _('Media'), 'GENERAL' => _('Info'), 'WALL' => _('Wall'), 'SHOWS' => _('Shows'), 'MENTIONS' => _('Mentions'), 'REVIEWS' => _('Reviews'), 'SUBSCRIBERS' => _('Fans'), 'LIKERS' => _('Likers'), 'MYREVIEWS' => _('My Reviews'), 'SUBSCRIPTIONS' => _('Fanships'), 'LIKES' => _('Likes'), 'FRIENDS' => _('Friends'), 'CHATS' => _('Chats'), 'SHARE' => _('Share!'), 'RESTRICTED' => _('RESTRICTED'));
    if (strpos($html, '{TABS}') > 0) {
        $html = str_replace('{TABS}', '<div class="form"><table><tr><td>', $html);
        $html = str_replace('{/TABS}', '</td></tr></table></div>', $html);
        $tabs = preg_match_all('%{TAB:([*+]?)([^}]+)}%', $html, $tabnames);
        $group = mx_secureword($_REQUEST['k']);
        if (!$group || !array_search($group, $tabnames[2])) {
            $group = $tabnames[2][0];
        }
        for ($i = 0; $i < $tabs; $i++) {
            //$newtab='<div id="artist_'.($form?'f_':'').$i.'" class="'.$style.((($i==$group) && !$form)?'':' hidden').'">';
            $newtab = '<div id="' . $tabnames[2][$i] . ($form ? '_f' : '') . '" class="' . $style . ($tabnames[2][$i] == $group && !$form ? '' : ' hidden') . '">';
            //$newtab.='<form name="artist_'.$i.'" method="POST" enctype="multipart/form-data"' .
            //		' onsubmit="return checkform(\'artist_'.$i.'\');">';
            $newtab .= '<table><tr><td>';
            $newtab .= '<fieldset>';
            for ($j = 0; $j < $tabs; $j++) {
                $tabclass = '';
                if ($tabnames[1][$j] == '*') {
                    if (!is_admin()) {
                        continue;
                    }
                    $tabclass = ' admin';
                } else {
                    if ($tabnames[1][$j] == '+') {
                        if ($mxuser->id != $user->id && !is_admin()) {
                            continue;
                        }
                        if ($mxuser->id == $user->id) {
                            $tabclass = ' owner';
                        } else {
                            $tabclass = ' admin';
                        }
                    }
                }
                if ($i == $j) {
                    $newtab .= '<legend class="seltab' . $tabclass . '">' . $realnames[$tabnames[2][$i]] . '</legend>';
                } else {
                    $newtab .= '<legend class="tab' . $tabclass . '"><a href="javascript:tabswitch(\'' . $tabnames[2][$i] . '\',\'' . $tabnames[2][$j] . '\');"' . ' alt="' . $realnames[$tabnames[2][$j]] . '">' . $realnames[$tabnames[2][$j]] . '</a></legend>';
                }
            }
            $html = str_replace($tabnames[0][$i], $newtab, $html);
        }
        //$html=str_replace('{/TAB}','</td></tr></table></fieldset></td></tr>',$html);
        $str = '</fieldset></td></tr></table>';
        //$str.='</form>';
        $str .= '</div>';
        $html = str_replace('{/TAB}', $str, $html);
    }
    // link to add as a friend
    if ($user->id == $mxuser->id) {
        $befriend = _('Hey, this is you!!');
    } else {
        if ($mxuser->isfriend($user->id)) {
            $befriend = sprintf('%s<br/>%s', _('This is one of your friends'), '<a href="' . mx_actionurl('account', 'messages', 'sm:' . $user->id, 'writemsg') . '">' . _('Send a Message') . '</a>');
            if ($user->acctype == MXACCOUNTARTIST) {
                $befriend .= '<br/><a href="' . mx_actionurl('artists', 'artprof', $user->id) . '">' . _('See Artist Page') . '</a>';
            }
        } else {
            $befriend = '<a href="' . mx_actionurl('account', 'messages', 'af:' . $user->id, 'writemsg') . '">' . _('Request Friendship') . '</a>';
            /*
            if (is_admin()) {
            	$befriend.='<br/><a href="'.mx_actionurl('artists','artprof',$user->id).'">'._('See Artist Page [ADM]').'</a>';
            }
            */
        }
    }
    $html = str_replace('{BEFRIEND}', $befriend, $html);
    $friends = $mxuser->getfriends($user->id);
    if (!$friends) {
        $friendslist = _('This person\'s friends list is hidden.');
    } else {
        if (!count($friends['confirmed'])) {
            $friendslist = _('This person\'s friends list is empty.');
        } else {
            $friendslist = mx_showdirstr($friends['confirmed']);
        }
    }
    $html = str_replace('{FRIENDS}', $friendslist, $html);
    $html = preg_replace('%\\r?\\n\\r?\\n%', '<br/><br/>', $html);
    // graphic stats
    if (strpos($html, '{MYSTATS}') > 0 && ($user->id == $mxuser->id || is_admin())) {
        $mystats = mx_statsstr($user);
        $html = str_replace('{MYSTATS}', $mystats, $html);
    }
    $html = str_replace('{PRICE}', '<table class="buymedia"><tr><td>', $html);
    $html = str_replace('{PRICE2}', '</td><td>', $html);
    $html = str_replace('{PRICE3}', '</td></tr></table>', $html);
    $media->purchase = str_replace('{PRICE}', '<table class="buymedia"><tr><td>', $media->purchase);
    $media->purchase = str_replace('{PRICE2}', '</td><td>', $media->purchase);
    $media->purchase = str_replace('{PRICE3}', '</td></tr></table>', $media->purchase);
    // media pages
    $html = str_replace('{MEDIASCHEMA}', $media->schema, $html);
    $html = str_replace('{BUYTAG}', $media->pricetag, $html);
    $html = str_replace('{BUYMEDIA}', $media->purchase, $html);
    $html = str_replace('{MEDIAMETA}', $media->meta, $html);
    $html = str_replace('{MEDIA_TITLE}', $media->title, $html);
    $html = str_replace('{MEDIA_DESC}', $media->description . $media->content, $html);
    $html = str_replace('{MEDIA_PIC}', $media->mediapic, $html);
    $html = str_replace('{MEDIA_BUTTONS}', $media->buttons ? '<div class="mediabuttons"><div id="player">' . $media->buttons . '</div></div>' : '', $html);
    if (strpos($html, '{MEDIA_CONTENT}') > 0) {
        if ($media->type == MXMEDIABASEBUNDLE || $media->type == MXMEDIAREGULARBUNDLE) {
            $mediatable = mx_xmlbundle($media->id, 'media', '', false);
            $mediatable = str_replace('pubmed', 'pubmed bundled bun_' . $media->id, $mediatable);
            $mediatable = preg_replace('%input_.%', 'bundled', $mediatable);
            $submedia = '<table class="mediadetails">';
            $submedia .= '<tr><td><h5>' . _('Medias') . '</h5></td></tr>';
            $submedia .= $mediatable . '</table>';
        } else {
            $submedia = '<table class="mediadetails">';
            $submedia .= '<tr><td><h5>' . (count($media->bundles) > 1 ? _('Bundles') : _('Bundle')) . '</h5></td></tr>';
            foreach ($media->bundles as $bundle) {
                $submedia .= '<tr class="pubmed bundled"><td class="msgcell bundled media_mediadata">' . '<div class="bundledetails" itemprop="inAlbum" itemscope itemtype="http://schema.org/MusicAlbum">' . '<div class="bundleminipic">' . '<a href="' . mx_actionurl('media', 'medprof', $bundle->id) . '" title="' . $bundle->title . ' - ' . _('See Media Page') . '" class="pictooltip" itemprop="url">' . $bundle->mediapic . '</a>' . '</div>' . '<div class="bundletitle" itemprop="name">' . $bundle->title . '</div>' . '<div class="bundledesc" itemprop="description">' . $bundle->description . '</div>' . '</div></td>' . '</tr>';
            }
            $submedia .= '</table>';
        }
        $html = str_replace('{MEDIA_CONTENT}', $submedia, $html);
    }
    $html = str_replace('{ARTISTLINK}', mx_actionurl('artist', 'artprof', $user->id), $html);
    if (strpos($html, '{ARTISTBUTTON}') > 0) {
        $artistbutton = '<div class="artistpic" itemprop="byArtist" itemscope itemtype="http://www.schema.org/MusicGroup">' . '<a href="' . mx_actionurl('artists', 'artprof', $user->id) . '" title="' . mx_getartistname($user) . ' - ' . _('See Page') . '" class="pictooltip" itemprop="url">' . '<img tag="' . $user->id . '" class="artistpic" src="' . mx_artpic($user->id, 'large', $user->gender) . '" itemprop="image">' . '</a>' . '<br/><span itemprop="name">' . mx_getartistname($user) . '</span>' . '</div>';
        $html = str_replace('{ARTISTBUTTON}', $artistbutton, $html);
    }
    if (strpos($html, '{USERSHARE}') > 0) {
        $url = $user->acctype == MXACCOUNTFAN ? mx_actionurl('fans', 'fanprof', $user->id) : mx_actionurl('artists', 'artprof', $user->id);
        if (!is_logged()) {
            $sharebutton = mx_sharebuttons('u_' . $user->id, $url, mx_artpic($user->id, 'large', $user->gender), $user->shortbio);
        } else {
            $sharebutton = '';
        }
        $html = str_replace('{USERSHARE}', $sharebutton, $html);
    }
    if (strpos($html, '{MEDIASHARE}') > 0) {
        $url = mx_option('basicsiteurl') . '/m/' . $media->id;
        if (!is_logged()) {
            $sharebutton = mx_sharebuttons('m' . $media->id, $url, $media->pic, $media->description);
        } else {
            $sharebutton = '';
        }
        $html = str_replace('{MEDIASHARE}', $sharebutton, $html);
    }
    // -end user stuff
    if ($html) {
        echo $html;
    } else {
        __('(Content not yet ready)');
    }
    if ($simul == 'public') {
        ?>
		<script>
		simul=$('<div class="simulation"><?php 
        __('Public View');
        ?>
</div>');
		simul.appendTo($('.artisttmpl1'));
		</script>
		<?php 
        $mxuser = new MXUser();
    }
}
示例#6
0
function mx_FBinit()
{
    global $FBsession, $facebook;
    $page = mx_secureword($_GET['p']);
    $option = mx_secureword($_GET['o']);
    $action = mx_secureword($_REQUEST['a']);
    $section = mx_secureword($_REQUEST['k']);
    $invite = mx_secureword($_GET['i']);
    $redir = mx_secureredir(urldecode($_GET['r']));
    ?>
    <div id="fb-root"></div>
    <script>
      window.fbAsyncInit = function() {
        FB.init({
          appId   : '<?php 
    echo $facebook->getAppId();
    ?>
',
          //session : <?php 
    echo json_encode($FBsession);
    ?>
, // don't refetch the session when PHP already has it
       	  channelURL : '<?php 
    echo mx_option('siteurl') . '/fb-channel.php';
    ?>
',
          status  : false, // check login status
          cookie  : true, // enable cookies to allow the server to access the session
          xfbml   : true, // parse XFBML
          oauth   : true
        });

        FB.Event.subscribe('auth.statusChange', function(response) {
        	//FB.getLoginStatus(function(response) {
			if (response.status === 'connected') {
				//alert('Connected!');
				<?php 
    if ($option == 'signin' || $option == 'register') {
        echo 'blackout(\'' . _('Signing you in<br/>using Facebook') . '\'); window.location=\'' . mx_actionurl($page, $option, 'fb', '', $redir) . '\';';
    } else {
        //echo 'blackout(\''._('Signing you in<br/>using Facebook').'\'); window.location=\''.mx_loginfbredirecturl($page,$option,$action,$section).($invite?('&i='.$invite):'').'\';';
    }
    ?>
			} else if (response.status === 'not_authorized') {
        	    // the user is logged in to Facebook,
       		    // but has not authenticated your app
      		} else {
        	    // the user isn't logged in to Facebook.
        	}
        });

        FB.Event.subscribe('auth.authResponseChange', function(response) {
        	if (response.status=='connected') {
               	<?php 
    if ($option == 'signin' || $option == 'register') {
        echo 'blackout(\'' . _('Signing you in<br/>using Facebook') . '\'); window.location=\'' . mx_actionurl($page, $option, 'fb', '', $redir) . '\';';
    } else {
        //echo 'blackout(\''._('Signing you in<br/>using Facebook').'\'); window.location=\''.mx_loginfbredirecturl($page,$option,$action,$section).($invite?('&i='.$invite):'').'\';';
    }
    ?>
         	  } else {
             	  window.location='<?php 
    echo mx_actionurl($page, $option, $action);
    ?>
';
             	  //alert('status='+response.status);
             	  //window.location.reload();
         	  }
          	});

        FB.Event.subscribe('edge.create',
        	    function(response) {
    	    		if (response.indexOf('artists/artprof')>0) {
        	    		art=response.substr(response.lastIndexOf('a=')+2);
        	    		iconclick('il_'+art,'','');
    	    		}
        	    }
        	);

        FB.Event.subscribe('edge.remove',
        	    function(response) {
		    		if (response.indexOf('artists/artprof')>0) {
			    		art=response.substr(response.lastIndexOf('a=')+2);
			    		iconclick('nl_'+art,'','');
		    		}
        	    }
        	);

<?php 
    if ($_GET['canvas'] || $_GET['fbp']) {
        // resize FB Canvas
        ?>
        var psize=new Object;
        psize.width=$(document).width();
        psize.height=$(document).height();
        FB.Canvas.setSize(psize);
        FB.Canvas.setAutoGrow(1000);
<?php 
    }
    ?>
      };

      (function(d){
    	     var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
    	     js = d.createElement('script'); js.id = id; js.async = true;
    	     js.src = "//connect.facebook.net/en_US/all.js";
    	     d.getElementsByTagName('head')[0].appendChild(js);
    	   }(document));
      //(function() {
      //  var e = document.createElement('script');
      //  e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
      //  e.async = true;
      //  document.getElementById('fb-root').appendChild(e);
      //}());

      function addToPage() {
        // calling the API ...
        var obj = {
          method: 'pagetab'
          //redirect_uri: '<?php 
    echo mx_optionurl($page, $option);
    ?>
',
        };

        FB.ui(obj);
      }

    </script>
<?php 
}
示例#7
0
/* ---
 * Project: musxpand
 * File:    paypal.php
 * Author:  phil
 * Date:    09/09/2011
 * ---
 * License:

    This file is part of musxpand.

    musxpand is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    musxpand is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with musxpand.  If not, see <http://www.gnu.org/licenses/>.

    Copyright � 2010 by Philippe Hilger
 */
require 'includes/mx_check.php';
if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
    $query = mx_secureword($_REQUEST['u']);
    die(mx_checkusername(strtolower($mxuser->username), $query));
}
示例#8
0
    You should have received a copy of the GNU General Public License
    along with musxpand.  If not, see <http://www.gnu.org/licenses/>.

    Copyright � 2010 by Philippe Hilger
 */
require 'includes/mx_account.php';
if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
    $mid = trim(strtolower(preg_replace('![^0-9]!', '', mx_secureword($_REQUEST['m']))));
    // media id
    $mpt = trim(strtolower(preg_replace('![^0-9]!', '', mx_secureword($_REQUEST['mt']))));
    // media playtype
    $act = trim(strtolower(mx_secureword($_REQUEST['a'])));
    // action
    $per = trim(strtolower(preg_replace('![^0-9.]!', '', mx_secureword($_REQUEST['p']))));
    // percent played
    $tim = trim(strtolower(preg_replace('![^0-9]!', '', mx_secureword($_REQUEST['t']))));
    // time played (sec)
    $rat = trim(strtolower(preg_replace('![^0-9]!', '', mx_secureword($_REQUEST['r']))));
    // rating
    $st = trim(strtolower(preg_replace('![^0-9]!', '', mx_secureword($_REQUEST['s']))));
    // status
    $id = trim(strtolower(preg_replace('![^0-9]!', '', mx_secureword($_REQUEST['id']))));
    // playid
    if (!$mid || !$act) {
        return;
    }
    if ($act != 'update') {
        error_log('play: [uid=' . $mxuser->id . ',mid=' . $mid . ',mpt=' . $mpt . ',act=' . $act . ',id=' . $id . ',per=' . $per . ',tim=' . $tim . ',rat=' . $rat . ',st=' . $st . ']');
    }
    die(json_encode($mxuser->setplaytime($mid, $mpt, $act, $id, $per, $tim, $rat, $st)));
}
示例#9
0
 * Author:  phil
 * Date:    09/09/2011
 * ---
 * License:

    This file is part of musxpand.

    musxpand is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    musxpand is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with musxpand.  If not, see <http://www.gnu.org/licenses/>.

    Copyright � 2010 by Philippe Hilger
 */
require 'includes/mx_messages.php';
if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
    $msgid = trim(strtolower(preg_replace('![%]!', '', mx_secureword($_REQUEST['m']))));
    if (!$msgid) {
        return;
    }
    $action = mx_secureword($_REQUEST['a']);
    echo mx_xmlmessage($action, $msgid);
}
示例#10
0
function mx_frads($adtag)
{
    return;
    $page = mx_secureword($_GET['p']);
    $option = mx_secureword($_GET['o']);
    if ($page == 'artists') {
        $ptype = 'a';
    } else {
        if ($page == 'fans') {
            $ptype = 'f';
        } else {
            if ($page == 'account' && ($option == 'signin' || $option == 'register')) {
                $ptype = 'l';
            } else {
                if ($page == 'media') {
                    $ptype = 'm';
                } else {
                    if ($page != 'account' || $option != 'profile' && $option != 'setup') {
                        $ptype = 'o';
                    } else {
                        $ptype = '';
                    }
                }
            }
        }
    }
    switch ($adtag) {
        case 'mxleft':
            switch ($ptype) {
                case 'a':
                    ?>
					<script type="text/javascript"><!--
					google_ad_client = "ca-pub-9134103384133476";
					/* Artist Skyscraper */
					google_ad_slot = "8168451933";
					google_ad_width = 160;
					google_ad_height = 600;
					//-->
					</script>
					<script type="text/javascript"
					src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
					</script>
					<?php 
                    break;
                case 'f':
                    ?>
					<script type="text/javascript"><!--
					google_ad_client = "ca-pub-9134103384133476";
					/* Member Skyscraper */
					google_ad_slot = "4883634994";
					google_ad_width = 160;
					google_ad_height = 600;
					//-->
					</script>
					<script type="text/javascript"
					src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
					</script>
					<?php 
                    break;
                case 'l':
                    ?>
					<script type="text/javascript"><!--
					google_ad_client = "ca-pub-9134103384133476";
					/* Login Skyscraper */
					google_ad_slot = "8937798150";
					google_ad_width = 160;
					google_ad_height = 600;
					//-->
					</script>
					<script type="text/javascript"
					src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
					</script>
					<?php 
                    break;
                case 'm':
                    ?>
					<script type="text/javascript"><!--
					google_ad_client = "ca-pub-9134103384133476";
					/* Media Skyscraper */
					google_ad_slot = "3002453629";
					google_ad_width = 160;
					google_ad_height = 600;
					//-->
					</script>
					<script type="text/javascript"
					src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
					</script>
					<?php 
                    break;
                case 'o':
                    ?>
					<script type="text/javascript"><!--
					google_ad_client = "ca-pub-9134103384133476";
					/* General Skyscraper */
					google_ad_slot = "8515852109";
					google_ad_width = 160;
					google_ad_height = 600;
					//-->
					</script>
					<script type="text/javascript"
					src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
					</script>
					<?php 
                    break;
                default:
                    // no ads (protected pages)
                    break;
            }
            break;
    }
}
示例#11
0
function mx_mnartprof($page, $option, $action, $simul = '')
{
    global $mxuser;
    if ($action) {
        $mediaid = mx_secureword($_GET['m']);
        if (!$mediaid) {
            $mediaid = -1;
        }
        mx_showartistpage($action, $mediaid, $simul);
    } else {
        mx_showhtmlpage('artprof');
    }
}
示例#12
0
function mx_ckcart($page, $option, $action)
{
    global $mxuser, $prodtypes, $subtypes, $prodprice;
    $cartid = mx_secureword($_REQUEST['cartid']);
    $token = mx_securestring($_GET['token']);
    $cart = $mxuser->getcart($cartid ? $cartid : null, $action == 'printorder' || $action == 'confckout');
    // get informed cart, pending cart or open new one
    if ($token && $action == '') {
        $action = 'ppcall';
    }
    //if ($action=='pp-checkout' || $action=='confckout') {
    $cart->lines = $mxuser->getcartdetails($cart->id);
    $cart->total = 0;
    foreach ($cart->lines as $line) {
        //if ($line->prodtype!=MXARTSUB || $line->prodvar!=MXSUBFOY)
        $cart->total += $line->price;
        if ($line->prodtype == MXARTSUB) {
            $user = $mxuser->getuserinfo($line->prodref);
            $line->name = htmlentities(substr(mx_getartistname($user), 0, 80));
        } else {
            if ($line->prodtype == MXSITESUB) {
                $line->name = sprintf('Account #%d', $mxuser->id);
            } else {
                if ($line->prodtype == MXMEDSUB) {
                    $media = $mxuser->getmediainfo($line->prodref);
                    $line->name = htmlentities(substr($media->title, 0, 80));
                } else {
                    $line->name = _('Unnamed Product');
                }
            }
        }
        $line->desc = $prodtypes[$line->prodtype][0] . ', ' . $prodtypes[$line->prodtype][1][$line->prodvar];
    }
    switch ($cart->taxcountrycode) {
        // Add for CANADIAN TAXES
        /*
        case 'CA':
        	$cart->taxes=$cart->total*MXTAXHST;
        	break;
        */
        default:
            $cart->taxes = 0;
            break;
    }
    $cart->items = count($cart->lines);
    //}
    switch ($action) {
        // adding to cart
        case 'addfoy':
        case 'addfofa':
        case 'upgfofa':
            $subnum = 0;
            $artistid = mx_secureword($_REQUEST['id']);
            $prodvar = $action == 'addfoy' ? MXSUBFOY : ($action == 'addfofa' ? MXSUBFOFA : MXUPGFOFA);
            $price = $action == 'addfoy' ? MXFEEFOY : ($action == 'addfofa' ? MXFEEFOFA : MXFEEFOFA - MXFEEFOY);
            foreach ($cart->lines as $line) {
                $subnum += $line->prodtype == MXARTSUB && $line->prodref != $artistid ? 1 : 0;
            }
            if ($subnum < 10) {
                $mxuser->addcart($cart->id, MXARTSUB, $artistid, $prodvar, $price);
                $prodprice = $price;
            } else {
                $cart->err = array('sorry' => _('We\'re sorry but our payment processing' . ' company<br/>limits the number of yearly fanships per order to 10.<br/>' . ' In case you would like to become a fan of more than 10 artists,<br/>' . ' please do it in separate orders. Thank you.'));
            }
            //$mxuser->addwish(MXARTSUB,$artistid,$prodvar,$price);
            $cart->progress = 1;
            break;
            //case 'freesub':
        //case 'freesub':
        case 'basicsub':
        case 'plussub':
        case 'premsub':
            $subnum = 0;
            $prodref = -1;
            // site wide (no ref)
            $prodvar = $subtypes[$action];
            // site subscription type
            if ($action == 'freesub') {
                $price = MXFEEFREE;
            } else {
                if ($action == 'basicsub') {
                    $price = MXFEEBASIC;
                } else {
                    if ($action == 'plussub') {
                        $price = MXFEEPLUS;
                    } else {
                        if ($action == 'premsub') {
                            $price = MXFEEPREMIUM;
                        }
                    }
                }
            }
            foreach ($cart->lines as $line) {
                $subnum += $line->prodtype != MXSITESUB ? 1 : 0;
            }
            if ($subnum < 10) {
                $mxuser->addcart($cart->id, MXSITESUB, $prodref, $prodvar, $price);
                $prodprice = $price;
            } else {
                $cart->err = array('sorry' => _('We\'re sorry but our payment processing' . ' company<br/>limits the number of subscriptions per order to 10.<br/>' . ' In case you would like to make more than 10 subscriptions,<br/>' . ' please do so in separate orders. Thank you.'));
            }
            //$mxuser->addwish(MXSITESUB,$artistid,$prodvar,$price);
            $cart->progress = 1;
            break;
        case 'medbuy':
            $prodref = preg_replace('%[^0-9]%', '', mx_secureword($_REQUEST['m']));
            $media = $mxuser->getmediainfo($prodref);
            if ($media->type == MXMEDIABASEBUNDLE || $media->type == MXMEDIAREGULARBUNDLE) {
                $price = $media->cartprice;
                //round(MXFEESONGS*($media->tracks+($media->bigpics>4?($media->bigpics-4):0)+$media->videos),2);
                $prodvar = MXBUYBUNDLE;
            } else {
                if ($media->type == MXMEDIAINSTR || ($media->type = MXMEDIASONG)) {
                    $price = $media->cartprice;
                    //MXFEE1SONG;
                    $prodvar = MXBUYMEDIA;
                } else {
                    $price = $media->cartprice;
                    //MXFEE1SONG;
                    $prodvar = MXBUYMEDIA;
                }
            }
            $mxuser->addcart($cart->id, MXMEDSUB, $prodref, $prodvar, $price);
            $cart->progress = 1;
            break;
        case 'medunbuy':
            $prodref = preg_replace('%[^0-9]%', '', mx_secureword($_REQUEST['m']));
            $prodline = 0;
            foreach ($cart->lines as $line) {
                if ($line->prodtype == MXMEDSUB && $line->prodref == $prodref) {
                    $prodline = $line->id;
                }
            }
            if ($prodline) {
                $mxuser->deletecart($cart->id, array($prodline));
            }
            $cart->progress = 1;
            break;
        case 'delcart':
            $cartlines = $_POST['cartline'];
            $mxuser->deletecart($cart->id, $cartlines);
            $cart->progress = 1;
            break;
        case 'delwish':
            $wishlines = $_POST['wishline'];
            $mxuser->deletewish($wishlines);
            $cart->progress = 1;
            break;
        case 'tocart':
            $wishlines = $_POST['wishline'];
            $mxuser->wishtocart($cart->id, $wishlines);
            $_REQUEST['k'] = 'cart';
            $cart->progress = 1;
            break;
        case 'towish':
            $cartlines = $_POST['cartline'];
            $mxuser->carttowish($cart->id, $cartlines);
            $cart->progress = 1;
            break;
        case 'shopmore':
        case 'shopmore_w':
            header('location: ' . mx_optionurl('artists', 'artsdir'));
            $cart->progress = 1;
            break;
        case 'checkout':
            $cart->progress = 2;
            $mxuser->setcart($cart->id, 'status', MXCARTCHECKOUTADDRESS);
            break;
        case 'pp-checkout':
            $mxuser->setcart($cart->id, 'status', MXCARTCHECKOUTPAYPAL);
            $cart->err = mx_checkout($cart);
            // at this point we should have been redirected to paypal, otherwise: not good :(
            $cart->progress = 2;
            break;
        case 'ppcall':
            /*
            die(phpinfo());
            preg_match_all('%([a-zA-Z0-9_]+)=([^&]+)%',$_SERVER['REQUEST_URI'],$ppparams);
            foreach ($ppparams[1] as $key => $elem) {
            	$ppal[$elem]=$ppparams[2][$key];
            }
            */
            $orderinfo = mx_orderreview();
            $cart->orderinfo = $orderinfo;
            $billadd = array('addresstype' => MXBILLINGADDRESS, 'cartid' => $cart->id, 'email' => $orderinfo['EMAIL'], 'salutation' => $orderinfo['SALUTATION'], 'first' => $orderinfo['FIRSTNAME'], 'middle' => $orderinfo['MIDDLENAME'], 'last' => $orderinfo['LASTNAME'], 'suffix' => $orderinfo['SUFFIX'], 'business' => $orderinfo['BUSINESS'], 'pppayerid' => $orderinfo['PAYERID'], 'pppayerstatus' => $orderinfo['PAYERSTATUS']);
            $shipadd = array('addresstype' => MXSHIPPINGADDRESS, 'cartid' => $cart->id, 'shiptoname' => $orderinfo['SHIPTONAME'], 'street1' => $orderinfo['SHIPTOSTREET'], 'street2' => $orderinfo['SHIPTOSTREET2'], 'city' => $orderinfo['SHIPTOCITY'], 'state' => $orderinfo['SHIPTOSTATE'], 'countrycode' => $orderinfo['SHIPTOCOUNTRYCODE'], 'zip' => $orderinfo['SHIPTOZIP'], 'addressstatus' => $orderinfo['ADDRESSSTATUS'], 'phone' => $orderinfo['SHIPTOPHONENUM']);
            $mxuser->clearaddresses($cart->id);
            $billid = $mxuser->addaddress($billadd);
            $shipid = $mxuser->addaddress($shipadd);
            $mxuser->setcart($cart->id, 'billingid', $billid);
            $mxuser->setcart($cart->id, 'shippingid', $shipid);
            $mxuser->setcart($cart->id, 'status', MXCARTCONFIRM);
            $mxuser->setcart($cart->id, 'memo', $orderinfo['PAYMENTREQUEST_0_NOTETEXT']);
            $mxuser->setcart($cart->id, 'invoicenum', $orderinfo['INVNUM']);
            $mxuser->setcart($cart->id, 'taxcountrycode', $shipadd['countrycode']);
            $cart->taxcountrycode = $shipadd['countrycode'];
            $cart->progress = 3;
            break;
        case 'ppcancel':
            // cancelled in paypal
        // cancelled in paypal
        case 'canckout':
            // cancelled at order review
            /*
            preg_match_all('%([a-zA-Z0-9_]+)=([^&]+)%',$_SERVER['REQUEST_URI'],$ppparams);
            foreach ($ppparams[1] as $key => $elem) {
            	$ppal[$elem]=$ppparams[2][$key];
            }
            */
            //die(phpinfo());
            $cart->progress = 1;
            // cancel token for paypal session
            $mxuser->setcart($cart->id, 'token', '');
            $mxuser->setcart($cart->id, 'status', $action == 'ppcancel' ? MXCARTCANCELLEDFROMPAYPAL : MXCARTCANCELLEDFROMCONFIRM);
            // remove billing/shipping addresses
            $mxuser->deladdress($cart->billingid);
            $mxuser->deladdress($cart->shippingid);
            $mxuser->setcart($cart->id, 'billingid', '');
            $mxuser->setcart($cart->id, 'shippingid', '');
            $cart->info = _('You just canceled the checkout process.<br/>' . 'You can make changes to your cart, adding new items to it<br/>' . ' or moving some items to your wish list for a later purchase.');
            break;
        case 'confckout':
        case 'printorder':
            /*
            die(phpinfo());
            preg_match_all('%([a-zA-Z0-9_]+)=([^&]+)%',$_SERVER['REQUEST_URI'],$ppparams);
            foreach ($ppparams[1] as $key => $elem) {
            	$ppal[$elem]=$ppparams[2][$key];
            }
            */
            $cart->paymentoption = mx_securestring($_POST['paymentoption']);
            if (!$cart->transactionid) {
                // first submit (saving payment to DB)
                if ($cart->total > 0) {
                    $orderconfirm = mx_orderconfirmation($cart);
                    $cart->orderconfirm = $orderconfirm;
                    $paymentinfo = array('transactionid' => $orderconfirm['PAYMENTINFO_0_TRANSACTIONID'], 'ordertime' => preg_replace('%[^0-9]%', '', $orderconfirm['PAYMENTINFO_0_ORDERTIME']), 'total' => $orderconfirm['PAYMENTINFO_0_AMT'], 'paypalfee' => $orderconfirm['PAYMENTINFO_0_FEEAMT'], 'taxes' => $orderconfirm['PAYMENTINFO_0_TAXAMT'], 'currency' => $orderconfirm['PAYMENTINFO_0_CURRENCYCODE'], 'paymentstatus' => $orderconfirm['PAYMENTINFO_0_PAYMENTSTATUS'], 'pendingreason' => $orderconfirm['PAYMENTINFO_0_PENDINGREASON'], 'reasoncode' => $orderconfirm['PAYMENTINFO_0_REASONCODE'], 'receiptid' => $orderconfirm['PAYMENTINFO_0_RECEIPTID'], 'status' => MXCARTCONFIRMED);
                } else {
                    // subscriptions only
                    $cart->orderconfirm = array();
                    $paymentinfo = array('paymentstatus' => 'Pending', 'pendingreason' => 'RecurrentPaymentValidation', 'status' => MXCARTCONFIRMED);
                }
                $mxuser->setcartbatch($cart->id, $paymentinfo);
                mx_addsubs($mxuser->id, $cart->id);
                if ($paymentinfo['paymentstatus'] == 'Completed') {
                    mx_confirmcart($mxuser->id, $cart->id);
                }
                foreach ($cart->lines as $line) {
                    if ($line->prodtype == MXARTSUB && $line->prodvar == MXSUBFOY || $line->prodtype == MXSITESUB && $line->prodvar != MXSUBFREE) {
                        $ppinfo = mx_recurrentpayment($cart, $line);
                        mx_setsubinfo($mxuser->id, $line, $ppinfo);
                    }
                }
            } else {
                // already confirmed do not submit again, but get the data from the DB instead...
                if ($cart->total > 0) {
                    $orderconfirm = array('PAYMENTINFO_0_PAYMENTSTATUS' => $cart->paymentstatus, 'PAYMENTINFO_0_TRANSACTIONID' => $cart->transactionid, 'PAYMENTINFO_0_ORDERTIME' => $cart->ordertime, 'PAYMENTINFO_0_AMT' => $cart->total, 'PAYMENTINFO_0_TAXAMT' => $cart->taxes, 'PAYMENTINFO_0_CURRENCYCODE' => $cart->currency);
                } else {
                    // subscriptions only
                    $orderconfirm = array();
                }
                $cart->orderconfirm = $orderconfirm;
            }
            $cart->info = _('Thanks for your order.<br/>We will activate your subscriptions and purchases' . '<br/>as soon as we get the confirmation of your payment.<br/>' . 'Please print this page for your records');
            $cart->progress = 4;
            break;
        default:
            $cart->progress = 1;
            break;
    }
    // get new cart details
    if ($action != 'pp-checkout' && $action != 'confckout') {
        $cart->lines = $mxuser->getcartdetails($cart->id);
    }
    foreach ($cart->lines as $ndx => $line) {
        $note = '';
        if ($line->prodtype == MXMEDSUB) {
            $media = $mxuser->getmediainfo($line->prodref);
            foreach ($cart->lines as $other) {
                //error_log('other: '.$other->prodtype.' '.$other->prodref);
                //error_log('bun[0]: '.$media->bundles[0]->id);
                if ($other->prodtype == MXARTSUB && $other->prodref == $media->owner_id) {
                    $note = buywarn(sprintf(_('This media is already included in your subscription to %s'), $media->artistname));
                    //error_log('included sub!!');
                } else {
                    if ($other->prodtype == MXMEDSUB && $other->prodref == $media->bundles[0]->id) {
                        $note = buywarn(sprintf(_('This media is already part of bundle "%s"'), $media->bundles[0]->title));
                        //error_log('included bundle!!');
                    }
                }
            }
            if ($media->owner_id == $mxuser->id) {
                $note = buywarn(_('Buying your own media...?'));
            }
        } else {
            if ($line->prodtype == MXARTSUB) {
                if ($line->prodref == $mxuser->id) {
                    $note = buywarn(_('Hey! That\'s your own account...'));
                }
            }
        }
        $cart->lines[$ndx]->note = $note;
    }
    $cart->items = count($cart->lines);
    $cart->wishes = $mxuser->getwishlist();
    //$cart->items=count($cart->lines);
    $mxuser->cart = $cart;
}
示例#13
0
    musxpand is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    musxpand is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with musxpand.  If not, see <http://www.gnu.org/licenses/>.

    Copyright � 2010 by Philippe Hilger
 */
require 'includes/mx_media.php';
if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
    //if (!$mxuser->id) return;
    $bid = trim(strtolower(preg_replace('![^0-9]!', '', mx_secureword($_REQUEST['b']))));
    $k = mx_secureword($_REQUEST['k']);
    $s = mx_secureword($_REQUEST['s']);
    $pub = mx_secureword($_REQUEST['pub']);
    if (!$bid || !$k) {
        return;
    }
    if ($pub) {
        $mxuser = new MXUser(-1);
    }
    echo mx_xmlbundle($bid, $k, $s);
}
示例#14
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;
                    }
                }
            }
        }
    }
}
示例#15
0
<?php

/* ---
 * Project: musXpand
 * File:    audioanalyzer.php
 * Author:  phil
 * Date:    Nov 13, 2011
 * ---
    This file is part of project_name.
    Copyright � 2010-2011 by Philippe Hilger
 */
include 'includes/mx_mediaanalyzer.php';
$map = mx_secureword($_GET['m']);
mx_showsitemap($map);
示例#16
0
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with musxpand.  If not, see <http://www.gnu.org/licenses/>.

    Copyright � 2010 by Philippe Hilger
 */
require 'includes/mx_walls.php';
if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
    if (!$mxuser->id) {
        return;
    }
    $msgid = trim(strtolower(preg_replace('![^0-9]!', '', mx_secureword($_REQUEST['m']))));
    $like = mx_secureword($_REQUEST['l']);
    $dislike = mx_secureword($_REQUEST['d']);
    $b = mx_securestring($_REQUEST['b']);
    $a = mx_securestring($_REQUEST['a']);
    $k = mx_securestring($_REQUEST['k']);
    if (!$msgid) {
        return;
    }
    if ($a == 'd') {
        // delete wall
        die($mxuser->markwalldeleted($msgid));
    }
    //$fld=mx_securestring($_REQUEST['f']);
    if ($b) {
        $msg = new StdClass();
        $msg->body = $b;
        $msg->filter = MXSHAREALL;
示例#17
0
<?php

/* ---
 * Project: musxpand
 * File:    apis.php
 * Author:  phil
 * Date:    Sep 18, 2012
 * ---
    This file is part of MusXpand.
    Copyright � 2010-2012 by Philippe Hilger
 */
require 'includes/mx_apis.php';
if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
    $apiname = trim(preg_replace('[^a-zA-Z]', '', mx_secureword($_REQUEST['a'])));
    // api name
    $apifunc = trim(preg_replace('[^a-zA-Z0-9]', '', mx_secureword($_REQUEST['f'])));
    // api subcommand
    $apipar = json_encode(array('mxappkey' => 'myapp', 'user' => '*****@*****.**', 'pwhash' => 'mypwhash', 'apphash' => 'myapphash'));
    //trim(preg_replace('[^a-zA-Z0-9]','',mx_secureword($_POST['p']))); // api parameters (JSON)
    //if (!$apiname || !$apipar) die('Crap.');
    die(json_encode(mx_apicall($apiname, $apifunc, $apipar)));
}
示例#18
0
function mx_ckprofile($page, $option, $action)
{
    global $mxuser, $msgs, $mxsession, $errors, $usernameerrs;
    if ($action == 'update' || preg_match('%setup_%', $action) || $action == 'done') {
        //die(phpinfo());
        $section = preg_replace('%[^0-9]%', '', $action);
        // just step number in case we're in the setup
        /*
        if (!$section || $section=='' || $section>count($steps)) {
        	$section=null;
        }
        */
        //phpinfo();
        $msgs = null;
        // list of fields that should have been posted to check mandatory ones have been filled...
        $prevsection = mx_secureword($_REQUEST['k']);
        $oldflds = array();
        foreach ($mxuser->infogroups($action == 'done' || $action == 'update' ? null : $prevsection) as $grp => $details) {
            foreach ($details[1] as $field) {
                $oldflds[$field] = 1;
            }
        }
        if (array_key_exists('PROid', $_REQUEST) && $_REQUEST['PROid'] == MXNOPROYET) {
            $_POST['PROmemberid'] = '-';
        }
        //error_log(print_r($oldflds,true));
        foreach ($mxuser->infogroups() as $grp => $details) {
            foreach ($details[1] as $field) {
                $fldinfo = $mxuser->fielddesc($field);
                if (!$fldinfo[0]) {
                    continue;
                }
                if (array_key_exists($field . '_y', $_POST)) {
                    $_POST[$field] = $_POST[$field . '_y'] . '-' . $_POST[$field . '_m'] . '-' . $_POST[$field . '_d'];
                }
                if (!array_key_exists($field, $_POST)) {
                    // field was not posted
                    if ($mxuser->{$field}) {
                        continue;
                    }
                    // field is already set
                    if (!array_key_exists($field, $oldflds)) {
                        continue;
                    }
                    // not in the previous form and not blank
                    if ($fldinfo[0] < 3 || $mxuser->acctype == MXACCOUNTFAN && $fldinfo[0] == 4) {
                        continue;
                    }
                    // not mandatory
                    if ($section && $section < $prevsection) {
                        continue;
                    }
                    // we're back to the previous form: don't bother...
                    $_REQUEST['a'] = 'setup_' . $prevsection;
                    $errors[$field] = _('This field is mandatory!');
                    continue;
                }
                if (!$_POST[$field] && $field != 'PROid') {
                    // field blank
                    if ($fldinfo[0] >= 3 && ($mxuser->acctype != MXACCOUNTFAN || $fldinfo[0] != 4) && ($section == '' || $section > $prevsection)) {
                        // we're going to the next step...
                        if ($prevsection) {
                            $_REQUEST['a'] = 'setup_' . $prevsection;
                        } else {
                            $_REQUEST['a'] = 'edit';
                        }
                        $errors[$field] = _('This field is mandatory!');
                        continue;
                    }
                }
                switch ($fldinfo[2]) {
                    // CAREFUL: testing types not fields!!
                    case 'legalname':
                        $postfld = ucwords(mx_securestring($_POST[$field]));
                        break;
                    case 'fullname':
                        $postfld = mx_securestring($_POST[$field]);
                        if ($postfld == strtolower($postfld)) {
                            $postfld = ucwords($postfld);
                        }
                        // if all lowercase capitalize initials
                        break;
                    case 'proid':
                        $postfld = mx_secureword($_POST[$field]);
                        if ($postfld == 0) {
                            $proname = mx_securestring($_POST['proname']);
                            $prosite = mx_securestring($_POST['prosite']);
                            if ($proname && $prosite) {
                                $postfld = $mxuser->addpro($proname, $prosite);
                            } else {
                                //$errors[$field]=_('You must inform your PRO organization');
                                if (!$proname && !$prosite) {
                                    $errors[$field] = _('We need this information.');
                                } else {
                                    if (!$proname) {
                                        $errors[$field] = _('You must inform the association\'s name/acronym');
                                    } else {
                                        $errors[$field] = _('You must inform a website');
                                    }
                                }
                                if ($prevsection) {
                                    $_REQUEST['a'] = 'setup_' . $prevsection;
                                } else {
                                    $_REQUEST['a'] = 'edit';
                                }
                                continue;
                            }
                        }
                        break;
                    case 'acctype':
                        // ignore this field
                        if ($mxuser->acctype != MXACCOUNTFAN && $mxuser->status != MXACCTEMAILCONFIRMED) {
                            $postfld = $mxuser->acctype;
                        } else {
                            $postfld = preg_replace('%[^0-9]%', '', $_POST[$field]);
                        }
                        break;
                    case 'date':
                        $postfld = $_POST[$field . '_y'] . '-' . $_POST[$field . '_m'] . '-' . $_POST[$field . '_d'];
                        break;
                    case 'privacy':
                        if (is_array($_POST[$field])) {
                            $postfld = implode(',', $_POST[$field]);
                        } else {
                            $postfld = '';
                        }
                        break;
                    case 'password':
                        $chkold = hash('sha256', $_POST[$field]);
                        if (!$_POST[$field]) {
                            $postfld = $mxuser->{$field};
                            // no old password -> don't change :-)
                        } else {
                            if ($chkold != $mxuser->pwdhash) {
                                $msgs->err = _('Wrong password entered.<br/>Your present password was left unchanged.');
                                $postfld = $mxuser->{$field};
                                // do not change password!
                            } else {
                                $postfld = hash('sha256', $_POST['new_' . $field]);
                                $chkconf = hash('sha256', $_POST['conf_' . $field]);
                                if ($chkconf != $postfld) {
                                    $msgs->err = _('Password confirmation does not match new password!<br/>Your password was left unchanged.');
                                    $postfld = $mxuser->{$field};
                                    // do not change password!
                                } else {
                                    $msgs->ok = _('Your password was successfully updated.');
                                    $field = 'pwdhash';
                                    // we'll update the hash!
                                }
                            }
                        }
                        break;
                    case 'username':
                        $postfld = trim(strtolower(preg_replace('![^0-9a-zA-Z-_.]!', '', $_POST[$field])));
                        if ($postfld != $mxuser->{$field}) {
                            $ckusername = mx_checkusername($mxuser->username, $postfld);
                            if ($ckusername) {
                                $msgs->err .= sprintf(_('Username was not updated: %s'), $ckusername > 0 ? _('Username already used') : $usernameerrs[$ckusername]);
                                $postfld = $mxuser->{$field};
                            } else {
                                $msgs->ok .= _('Username was updated.');
                            }
                        }
                        break;
                    case 'agreement':
                        if (!$mxuser->agreement || $mxuser->agreement == '0000-00-00 00:00:00') {
                            $postfld = date('Y-m-d H:i:s');
                        } else {
                            $postfld = $mxuser->agreement;
                        }
                        break;
                    case 'genre':
                        $postfld = $_POST[$field];
                        break;
                    default:
                        $postfld = stripslashes($_POST[$field]);
                        break;
                }
                if ($postfld != $mxuser->{$field}) {
                    $mxuser->setoption($field, $postfld);
                    //$mxuser->$field=$postfld; // already done in setoption...
                }
                if ($field == 'pwdhash') {
                    // needs to clear the session with new password credentials :-)
                    mx_setsession($mxuser, time());
                }
            }
        }
        if ($action == 'done' && !$errors) {
            $mxuser->setoption('status', MXACCTSETUP);
        }
        //header('Location: '.mx_actionurl($page,$option,'done'));
    }
    //error_log(print_r($errors,true));
}
示例#19
0
function mx_minimenu()
{
    global $mx_minimenu, $mxuser;
    $page = mx_secureword($_GET['p']);
    echo '<div class="minimenu"><ul>';
    foreach ($mx_minimenu as $action => $actiondetails) {
        if (!is_array($actiondetails)) {
            echo '<li>&nbsp;&nbsp;&nbsp;</li>';
        } else {
            if (!$actiondetails[0] && !is_logged() && $page != 'account' || $actiondetails[0] == 2 || $actiondetails[0] > 0 && $actiondetails[0] < 3 && is_logged() || $actiondetails[0] >= 3 && $mxuser->status >= MXACCTSETUP) {
                echo '<li>' . mx_icon($action, $actiondetails[1], 48, 'act_' . $action, $action . 'hover') . '</li>';
            }
        }
    }
    echo '</ul></div>';
}
示例#20
0
function mx_showmediastr($artistid, $section = 'media', $openmedia = -1)
{
    global $mxuser;
    $listorder = mx_secureword($_GET['s']);
    if ($listorder != '') {
        $listorder .= ' asc';
    } else {
        $listorder = 'type asc, title asc';
    }
    $listorder .= ($listorder ? ',' : '') . 'timestamp desc';
    /*
    if (is_array($artistid)) {
    	foreach($artistid as $oneid) {
    		$fanship[$oneid]=$mxuser->getfanship($oneid);  // TODO: fanship should be defined properly
    	}
    }
    else if ($artistid==null) $fanship=array(MXNONMEMBER,null);
    else if (!$artistid) $fanship=array(MXMEMBER,null);
    else $fanship[$artistid]=$mxuser->getfanship($artistid);
    */
    $allmedia = array();
    $mediaarray = array();
    $mediaarray[$section] = array(-1, _('Media'), _('The following media are currently available.'));
    //$mediaarray['buttons']=array(0,'','text',30);
    /*
    if (!$artistid || is_array($artistid)) { // if not individual artist, list artist name
    		$mediaarray['artistname']=array(0,'','text');
    }
    */
    $mediaarray['mediadata'] = array(0, _('Media'), 'html');
    /*
    $mediaarray['meddesc']=array(0,_('Title').mx_orderlink('title'),'text');
    if ($artistid && !is_array($artistid) && $section!='fanmed') {
    	$mediaarray['status']=array(0,_('Access').mx_orderlink('status'),'mediastatus');
    }
    $mediaarray['type']=array(0,_('Type').mx_orderlink('type'),'mediatype');
    $mediaarray['info']=array(0,_('Info'),'text');
    $mediaarray['timestamp']=array(0,_('Date'),'update');
    */
    $medialist = array('medialist', 0, _('Media List'), '', array($section => array()), array($section => $mediaarray));
    // --- BUNDLES
    $mediabundles = $mxuser->listbundles($artistid, null, $listorder);
    $featbunok = false;
    while ($mediabundles && ($bundle = $mxuser->listbundles($artistid, $mediabundles, $listorder))) {
        if (!$bundle->cnt) {
            continue;
        }
        $fanship = $mxuser->getfanship($bundle->owner_id, $bundle->id);
        foreach ($mxuser->getmediainfo($bundle->id) as $key => $value) {
            $bundle->{$key} = $value;
        }
        $bundle->info = sprintf(_('%d media<br/>(%s)'), $bundle->cnt, mx_size($bundle->size));
        if (($bundle->type == MXMEDIABASEBUNDLE || $bundle->type == MXMEDIAREGULARBUNDLE) && ($bundle->status >= MXMEDIAFANVISIBLE && $bundle->status < MXMEDIAARCHIVED || $bundle->status == MXMEDIAVIRTUAL)) {
            if (!$featbunok && $openmedia <= 0 && $bundle->type == MXMEDIAREGULARBUNDLE || $openmedia == $bundle->id) {
                $featbun = $featbunok = true;
            } else {
                $featbun = false;
            }
            mx_medialist($bundle, $fanship, false, false, $featbun);
            $bundle->filesize = $bundle->size;
            $allmedia[$section][] = $bundle;
        } else {
            mx_medialist($bundle, $fanship, false, false, $featbun);
            $bundle->filesize = $bundle->size;
            if ($bundle->status >= MXMEDIAVALIDATED || $bundle->status < MXMEDIAFANVISIBLE) {
                $allmedia['new'][] = $bundle;
            }
            if ($bundle->status == MXMEDIAARCHIVED) {
                $allmedia['archived'][] = $bundle;
            }
            if ($bundle->status >= MXMEDIAFANVISIBLE && $bundle->status <= MXMEDIAPUBLICSHARED) {
                $allmedia['published'][] = $bundle;
            }
            if ($bundle->status == MXMEDIAVIRTUAL) {
                $allmedia['new'][] = $bundle;
                $allmedia['published'][] = $bundle;
                $allmedia['archived'][] = $bundle;
            }
            /*
            if (($bundle->status>MXMEDIAREADY && $bundle->status<=MXMEDIAPUBLICSHARED)) {
            	$allmedia['media'][]=$bundle;
            }
            */
            $allmedia['allmedia'][] = $bundle;
        }
    }
    // --- END BUNDLES
    //foreach($mediatable as $media) {
    /*
    // --- NO BUNDLES
    $mediatable=$mxuser->listmedia($artistid,null,$listorder);
    if (!$mediatable) {
    	//return _('No media available for the moment...');
    }
    while ($mediatable && $media=$mxuser->listmedia($artistid,$mediatable)) {
    	//error_log(print_r($media,true));
    	$buttons=null;
    	if (($media->status>MXMEDIAREADY && $media->status<=MXMEDIAPUBLICSHARED) || $artistid==$mxuser->id) {
    		mx_medialist($media,$fanship); // prepare media fields
    		$allmedia['media'][]=$media;
    	}
    }
    // --- END NO BUNDLES
    */
    //$str='<a name="mediaplayer"></a>';
    //$str.='<div id="mediaplayer"><div id="playerwindow"></div></div>';
    $str .= '<div class="form"><a name="medialist"></a>';
    $str .= '<form name="media">' . mx_showtablestr($medialist[5], $allmedia, 'pubmed', $medialist[4], $section) . '</form></div>';
    /*$str.='<script type="text/javascript" charset="utf-8">
       // Add VideoJS to all video tags on the page when the DOM is ready
       VideoJS.setupAllWhenReady();
     	</script>';*/
    if (false && $openmedia > 0) {
        $media = $mxuser->getmediainfo($openmedia);
        if ($media->type == MXMEDIABASEBUNDLE || $media->type == MXMEDIAREGULARBUNDLE) {
            $openbundle = $openmedia;
            $str .= '<script language="javascript">openbundle(' . $openbundle . ');</script>';
        } else {
            $openbundle = $media->bundles[0]->id;
            $str .= '<script language="javascript">openbundle(' . $openbundle . ',' . $openmedia . ');</script>';
        }
    }
    return $str;
}
示例#21
0
<?php

/* ---
 * Project: musxpand
 * File:    apis.php
 * Author:  phil
 * Date:    Sep 18, 2012
 * ---
    This file is part of MusXpand.
    Copyright � 2010-2012 by Philippe Hilger
 */
require 'includes/mx_oauth.php';
if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
    $oauthfunc = trim(preg_replace('[^a-z_]', '', mx_secureword($_REQUEST['a'])));
    // oauth function
    mx_oauth($oauthfunc);
}