示例#1
0
function mx_mntestusers($page, $option, $action)
{
    global $facebook;
    echo 'Disabled.';
    return;
    $fbapp = new Facebook(array('appId' => FACEBOOK_APP_ID, 'secret' => FACEBOOK_SECRET, 'grant_type' => 'client_credentials'));
    $acctok = $fbapp->getAccessToken();
    if ($_REQUEST['createuser']) {
        $newuser = $fbapp->api('/' . FACEBOOK_APP_ID . '/accounts/test-users?installed=true&permissions=&access_token=' . $acctok, 'POST');
    } else {
        if ($_REQUEST['deleteuser']) {
            foreach ($_REQUEST['selected'] as $user) {
                $testusers = $fbapp->api('/' . $user . '?access_token=' . $acctok, 'DELETE');
                mx_deleteuser($user);
                // delete should only be possible for test users!!
            }
        }
    }
    $testusers = $fbapp->api('/' . FACEBOOK_APP_ID . '/accounts/test-users&access_token=' . $acctok, 'GET');
    echo '<form action="' . mx_optionurl($page, $option) . '" method=POST>';
    echo '<table border=1 width=100%><tr><th>Sel</th><th>ID</th><!-- <th>access_token</th> --><th>login_url</th></tr>';
    foreach ($testusers['data'] as $testuser) {
        echo '<tr><td><input type=checkbox name="selected[]" value="' . $testuser['id'] . '"></td>' . '<td>' . $testuser['id'] . '</td>';
        //$user=$facebook->api('/'.$testuser['id']);
        //die(print_r($user));
        //echo '<td>'.$user['name'].'</td>';
        echo '<!-- <td>' . $testuser['access_token'] . '</td> --><td>' . '<a href="' . $testuser['login_url'] . '">' . $testuser['login_url'] . '</a></td></tr>';
    }
    echo '<tr><td colspan=3 align=center><input type=submit name="createuser" value="Create User">' . ' <input type=submit name="deleteuser" value="Delete User(s)"></td></tr>';
    echo '</table></form>';
}
示例#2
0
function mx_ckmain($page, $option, $action)
{
    global $mxuser;
    if ($mxuser->id) {
        if ($mxuser->cart->items > 0) {
            mx_sendnotice('red', $mxuser->cart->items == 1 ? _('You have 1 item in your cart') : sprintf(_('You have %d items in your cart'), $mxuser->cart->items), 'cart', '');
        }
        if ($mxuser->newmsgs > 0) {
            mx_sendnotice('green', $mxuser->newmsgs == 1 ? _('You got 1 new message') : sprintf(_('You got %d new messages'), $mxuser->newmsgs), 'account', 'messages');
        }
        if ($mxuser->subs['expired'] > 0) {
            mx_sendnotice('red', sprintf(_('%d of your fanships expired'), $mxuser->subs['expired']), 'account', 'mysubs', '-', 'expired');
        }
        if ($mxuser->subs['new'] > 0) {
            mx_sendnotice('green', $mxuser->subs['new'] == 1 ? _('1 new fanship activated') : sprintf(_('%d new fanship activated'), $mxuser->subs['new']), 'account', 'mysubs', '-', 'active');
        }
        if ($mxuser->subs['renewed'] > 0) {
            mx_sendnotice('green', $mxuser->subs['renewed'] == 1 ? _('1 fanship was renewed') : sprintf(_('%d fanships were renewed'), $mxuser->subs['renewed']), 'account', 'mysubs', '-', 'active');
        }
    } else {
        if (MXDEFFEATURES & MXFTNEWLOGIN) {
            if (false && !MXBETA) {
                header('location: ' . mx_optionurl('account', 'signin'));
                die;
            }
        }
    }
}
示例#3
0
function mx_mnmxversion($page, $option, $action)
{
    global $MXVersion, $MXRelease, $MXRelDate, $MXlines, $MXCodinoma;
    $versform = array('mxversion', 0, 'MusXpand Version', _('Some information about MusXpand\'s development...'), array(), array('coding' => array(-1, _('Version Information'), _('About current version of MusXpand Software')), 'version' => array(0, _('Version:'), 'text'), 'codename' => array(0, _('Codename:'), 'quote'), 'release' => array(0, _('Release:'), 'text'), 'reldate' => array(0, _('Release Date:'), 'text'), 'lines' => array(0, _('Code Lines:'), 'text'), 'hosting' => array(-1, _('Hosting'), _('What\'s behind?')), 'location' => array(1, _('Server Location:'), 'text'), 'system' => array(1, _('System:'), 'text'), 'server' => array(1, _('Server:'), 'text'), 'php' => array(1, _('PHP Version:'), 'text'), 'team' => array(-1, _('Project Information'), _('The MusXpand Development Facts')), 'startdev' => array(0, _('Started:'), 'text'), 'developer' => array(0, _('Developer:'), 'text'), 'testers' => array(0, _('Local/Remote<br/>Beta-Testers:'), 'text'), 'equipments' => array(0, _('Development<br/>platforms:'), 'text'), 'software' => array(0, _('Software:'), 'text'), 'tests' => array(0, _('Tests:'), 'text'), 'a' => array(1, 'submit', 'hidden')));
    $fp = popen('uname -sr', 'r');
    $system = fgets($fp);
    pclose($fp);
    $fp = popen('uname -p', 'r');
    $machine = fgets($fp);
    pclose($fp);
    preg_match('%(Apache/(?P<apache>[^ ]+))%i', $_SERVER['SERVER_SOFTWARE'], $sver);
    $location = mx_locate(gethostbyname("www.example.com"));
    if ($location) {
        $region = mx_region($location);
    } else {
        $region = '';
    }
    $versvalues = array('startdev' => '28-Sep-2010', 'developer' => mx_peoplepage('peergum') . ', IT Engineer and somehow musician (FR)', 'testers' => mx_peoplepage(45) . ', Music Fan & Wife :-) (BR)' . '<br/>' . mx_peoplepage(47) . ', Artist (US)' . '<br/>' . mx_peoplepage('limey59') . ', Music Fan (CA)' . '<br/><a href="' . mx_optionurl('about', 'cQ') . '">Christopher Quinn, Artist (US) - R.I.P.</a>' . '<br/>' . mx_peoplepage('anubisspire') . ', Artist (US)' . '<br/>' . mx_peoplepage('carosta') . ', Artist (DE)' . '<br/>' . mx_peoplepage(58) . ', Artist (US)' . '<br/>' . mx_peoplepage('francisvoignier') . ', Artist (US)' . '<br/>' . mx_peoplepage('iMickeyD') . ', Artist (US)' . '<br/>' . mx_peoplepage('skyfire') . ', Music Fan (AU)', 'equipments' => 'MacBook Pro (500GB/8GB)' . '<br/>Fedora Linux Server (Dell)' . '<br/>Windows 7 PC (Dell)', 'software' => 'Mac OS X 10.7' . '<br/>Windows 7' . '<br/>Eclipse' . '<br/>Subversion (SVN)' . '<br/>XAMP & LAMP (Apache/MySQL/PHP on Mac OS X and Linux)' . '<br/>unix shell scripts (bash,awk)', 'tests' => 'Mac: Safari + Firefox' . '<br/>Windows: Internet Explorer + Firefox', 'version' => $MXVersion, 'codename' => $MXCodinoma, 'release' => $MXRelease, 'reldate' => $MXRelDate, 'lines' => $MXlines, 'location' => ($location->city ? $location->city : '') . ($region ? ' (' . $region . '),' : ($location->region ? '/' . $location->region . ',' : '')) . ' ' . $location->countryName, 'server' => 'Apache ' . $sver['apache'], 'php' => phpversion(), 'system' => $system, 'processor' => $machine);
    echo '<div class="mx-message">';
    mx_showform($versform, $versvalues, false);
    echo '</div>';
    //print_r($location);
    //phpinfo();
}
示例#4
0
function mx_ckmystuff($page, $option, $action)
{
    global $mxuser, $errors;
    switch ($action) {
        case 'm_bundle':
            header('location:' . mx_optionurl('account', 'bundle'));
            die;
        case 'mediapublish':
            $pid = 0;
            //die(phpinfo());
            while ($fid = $_POST['id_' . $pid]) {
                //$fname=$_POST['name_'.$pid];
                $ftitle = $_POST['title_' . $pid];
                $ftype = $_POST['type_' . $pid];
                $fdesc = $_POST['desc_' . $pid];
                $fcomp = $_POST['comp_' . $pid];
                $status = $_POST['status_' . $pid];
                if ($ftype == MXMEDIABASEBUNDLE) {
                    $status = MXMEDIAVIRTUAL;
                }
                if ($status >= MXMEDIAREADY) {
                    $mxuser->publishmedia($fid, $status, $ftitle, $ftype, $fdesc, $fcomp);
                    if ($ftype == MXMEDIAREGULARBUNDLE) {
                        //error_log('bundle publishing!');
                        $bundledmedia = $mxuser->listmediafrombundle($fid, '', $mxuser->id);
                        foreach ($bundledmedia as $media) {
                            //error_log('publishing '.$media->title);
                            $mxuser->publishmedia($media->id, $status, $media->title, $media->type, $media->description, $media->completion);
                        }
                    }
                } else {
                    if ($errors) {
                        $errors .= '<br/>';
                    }
                    $errors .= sprintf(_('[%s] is not ready and cannot be changed at this time'), $ftitle);
                }
                $pid++;
            }
            $_REQUEST['k'] = 'published';
            break;
        case 'mediaupdate':
            $pid = 0;
            //die(phpinfo());
            while ($fid = $_POST['id_' . $pid]) {
                //$fname=$_POST['name_'.$pid];
                $ftitle = $_POST['title_' . $pid];
                $ftype = $_POST['type_' . $pid];
                $fdesc = $_POST['desc_' . $pid];
                $status = $_POST['status_' . $pid];
                $fcomp = $_POST['comp_' . $pid];
                if ($ftype == MXMEDIABASEBUNDLE) {
                    $status = MXMEDIAVIRTUAL;
                }
                if ($status >= MXMEDIAREADY) {
                    $mxuser->publishmedia($fid, $status, $ftitle, $ftype, $fdesc, $fcomp);
                    if ($ftype == MXMEDIAREGULARBUNDLE) {
                        //error_log('bundle publishing!');
                        $bundledmedia = $mxuser->listmediafrombundle($fid, '', $mxuser->id);
                        foreach ($bundledmedia as $media) {
                            //error_log('publishing '.$media->title);
                            $mxuser->publishmedia($media->id, $status, $media->title, $media->type, $media->description, $media->completion);
                        }
                    }
                } else {
                    if ($errors) {
                        $errors .= '<br/>';
                    }
                    $errors .= sprintf(_('[%s] is not ready and cannot be changed at this time'), $ftitle);
                }
                $pid++;
            }
            break;
        case 'mediadescupdate':
            $pid = 0;
            //die(phpinfo());
            while ($fid = $_POST['id_' . $pid]) {
                $fname = $_POST['name_' . $pid];
                $ftitle = $_POST['title_' . $pid];
                $ftype = $_POST['type_' . $pid];
                $fdesc = $_POST['desc_' . $pid];
                $fcomp = $_POST['comp_' . $pid];
                $fdelete = $_POST['delete_' . $pid];
                //if ($status>=MXMEDIAREADY) {
                if ($fdelete == '1') {
                    $mxuser->deletemedia($fid, $fname);
                } else {
                    $mxuser->updatemediadesc($fid, $ftitle, $ftype, $fdesc, $fcomp);
                }
                /*} else {
                			if ($errors) $errors.='<br/>';
                			$errors.=sprintf(_('[%s] is not ready and cannot be changed at this time'),$ftitle);
                		}*/
                $pid++;
            }
            break;
        case 'newbundle':
            $bundle = mx_securestring($_REQUEST['bundlename']);
            if ($bundle) {
                if (!$mxuser->createbundle($bundle)) {
                    $errors = _('Error: Bundle was not created.');
                }
            } else {
                $errors = _('You did not inform a name for the new bundle.');
            }
            break;
        case 'm_movenew':
        case 'm_movepub':
            $bid = mx_secureword($_REQUEST['bundleid']);
            if ($bid) {
                $selmedia = $_REQUEST['selmedia'];
                if (!$selmedia) {
                    $errors = _('No media selected.');
                    break;
                }
                $medialist = $mxuser->listselectedmedia($selmedia);
                if (!$medialist) {
                    $errors = _('No media selected.');
                    break;
                }
                $errors = '';
                foreach ($medialist as $id => $media) {
                    if ($res = $mxuser->movetobundle($id, $bid)) {
                        if ($errors) {
                            $errors .= '<br/>';
                        }
                        switch ($res) {
                            case MXDBERROR:
                                $errors .= sprintf(_('Failed moving [%s] to bundle'), $media->title);
                                break;
                            case MXNOCHANGE:
                                $errors .= sprintf(_('[%s] is shared: cannot be moved to a non-shared bundle.'), $media->title);
                                break;
                        }
                    }
                }
            } else {
                $errors = _('You did not inform the bundle to move your media to.');
            }
            $_REQUEST['k'] = $action == 'm_movenew' ? 'new' : 'published';
            break;
        case 'm_linknew':
        case 'm_linkpub':
            $selmedia = $_REQUEST['selmedia'];
            if (!$selmedia) {
                $errors = _('No media selected.');
                break;
            }
            $medialist = $mxuser->listselectedmedia($selmedia);
            if (!$medialist) {
                $errors = _('No media selected.');
                break;
            }
            $errors = '';
            // see what we need to link
            $pic = $trk = $doc = 0;
            $trkmedia = array();
            $picmedia = array();
            $docmedia = array();
            foreach ($medialist as $id => $media) {
                switch ($media->type) {
                    case MXMEDIAPIC:
                    case MXMEDIABG:
                        $picmedia[$id] = $media;
                        $pic++;
                        break;
                    case MXMEDIASONG:
                    case MXMEDIAINSTR:
                    case MXMEDIAVIDEO:
                    case MXMEDIAREGULARBUNDLE:
                    case MXMEDIABASEBUNDLE:
                        $trkmedia[$id] = $media;
                        $trk++;
                        break;
                    case MXMEDIADOC:
                        $docmedia[$id] = $media;
                        $doc++;
                        break;
                }
            }
            if ($pic + $doc + $trk < 2) {
                $errors = _('We need at least two medias for a link, e.g. a picture and a track/bundle');
                break;
            }
            if (!$pic && !$doc) {
                $errors = _('You need to select one picture OR one document to link to the tracks/bundles');
                break;
            }
            if (!$trk && $pic > 1 && $doc > 1) {
                $errors = _('I\'m a bit confused about what to link to what...?!');
                break;
            }
            if (!$trk && !$doc) {
                $errors = _('You cannot link pictures together...');
                break;
            }
            if (!$trk && !$pic) {
                $errors = _('You cannot link documents together...');
                break;
            }
            if ($trk) {
                // link pics and/or docs to tracks or bundles
                $linkmedia = array_replace($picmedia, $docmedia);
                $destmedia = $trkmedia;
            } else {
                if ($pic == 1) {
                    // link pic to docs
                    $linkmedia = $picmedia;
                    $destmedia = $docmedia;
                } else {
                    if ($doc == 1) {
                        // link doc to pics
                        $linkmedia = $docmedia;
                        $destmedia = $picmedia;
                    }
                }
            }
            foreach ($destmedia as $id => $media) {
                foreach ($linkmedia as $lid => $lmedia) {
                    if ($lmedia->owner_id != $mxuser->id) {
                        // something wrong: linking media from someone else...
                        if ($errors) {
                            $errors .= '<br/>';
                        }
                        $errors .= sprintf(_('Media [%s] is not yours!'), $lmedia->title);
                    } else {
                        if ($media->owner_id != $mxuser->id) {
                            // idem: media linked to is not ours!!
                            if ($errors) {
                                $errors .= '<br/>';
                            }
                            $errors .= sprintf(_('Media [%s] is not yours!'), $media->title);
                        } else {
                            if ($res = $mxuser->linkmedia($lid, $id)) {
                                if ($errors) {
                                    $errors .= '<br/>';
                                }
                                switch ($res) {
                                    case MXDBERROR:
                                    case MXNOLINK:
                                        $errors .= sprintf(_('Failed linking [%s] to [%s]'), $lmedia->title, $media->title);
                                        break;
                                }
                            }
                        }
                    }
                }
            }
            if ($action == 'm_linknew') {
                $_REQUEST['k'] = 'new';
            } else {
                $_REQUEST['k'] = 'published';
            }
            break;
        case 'm_scannew':
        case 'm_scanpub':
        case 'm_scanarch':
        case 'm_scanmed':
            $selmedia = $_REQUEST['selmedia'];
            if (!$selmedia) {
                $errors = _('No media selected.');
                break;
            }
            $medialist = $mxuser->listselectedmedia($selmedia);
            if (!$medialist) {
                $errors = _('No media selected.');
                break;
            }
            $errors = '';
            foreach ($medialist as $id => $media) {
                if ($media->type == MXMEDIABASEBUNDLE || $media->type == MXMEDIAREGULARBUNDLE) {
                    continue;
                }
                $mxuser->rescanmedia($media);
                //$mxuser->setmediastatus($id,MXMEDIAVALIDATED);
            }
            break;
        case 'm_deletenew':
        case 'm_deletepub':
        case 'm_deletearch':
            $selmedia = $_REQUEST['selmedia'];
            if (!$selmedia) {
                $errors = _('No media selected.');
                break;
            }
            $medialist = $mxuser->listselectedmedia($selmedia);
            if (!$medialist) {
                $errors = _('No media selected.');
                break;
            }
            foreach ($medialist as $id => $media) {
                $res = $mxuser->deletemedia($id, $media->filename);
                if (array_key_exists('error', $res)) {
                    if ($errors) {
                        $errors .= '<br/>';
                    }
                    $errors .= $res['error'];
                }
            }
            break;
        case 'm_archivepub':
            $selmedia = $_REQUEST['selmedia'];
            if (!$selmedia) {
                $errors = _('No media selected.');
                break;
            }
            $medialist = $mxuser->listselectedmedia($selmedia);
            if (!$medialist) {
                $errors = _('No media selected.');
                break;
            }
            foreach ($medialist as $id => $media) {
                $mxuser->archivemedia($id, $media->filename);
            }
            $_REQUEST['k'] = 'archived';
            break;
        case 'm_publishnew':
        case 'm_publisharch':
        case 'm_editnew':
        case 'm_editpub':
        case 'm_editarch':
        case 'm_editmed':
            $selmedia = $_REQUEST['selmedia'];
            if (!$selmedia) {
                $errors = _('No media selected.');
                $_REQUEST['a'] = '';
            }
            break;
        default:
            break;
    }
}
示例#5
0
function mx_showhtmlpagestr($page, $windowedpages = array())
{
    global $mxuser, $acctypes, $browser, $prodtypes;
    if (array_key_exists($page, $windowedpages)) {
        return '';
    }
    $windowedpages[$page] = 1;
    $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('%\n\n%','<br/><br/>',$html);
    $html = preg_replace('%(\\n\\n|$)%', '</p>\\1', $html);
    $html = preg_replace('%[\\n]\\* ([^\\n]+)%', '<li>\\1</li>', $html);
    $html = preg_replace('%(^|\\n\\n)([\\([a-zA-Z0-9].*)%', '<p>\\2', $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], $menus[3][$i]), $html);
        }
    }
    if (preg_match_all('%{icon:([^},]+),?([^},]+)?}%', $html, $icon)) {
        for ($i = 0; $i < count($icon[0]); $i++) {
            $html = str_replace($icon[0][$i], mx_icon($icon[1][$i], $icon[2][$i], '48', 'act_' . $icon[1][$i], $icon[1][$i] . 'hover'), $html);
        }
    }
    $html = str_replace('{PRIVACY}', _('Privacy Policy'), $html);
    if ($browser) {
        $mybrowser = sprintf('<b>%s, version %s, on %s %s</b>', $browser->getBrowser(), $browser->getVersion(), $browser->getPlatform(), $browser->isAol() ? ' [AOL Version' . $browser->getAolVersion() . ']' : '' . $browser->isMobile() ? _(' (Mobile)') : '');
    } else {
        $mybrowser = 'Undefined';
    }
    $html = str_replace('{GOBACK}', '<a href="javascript:history.back();">' . _('Back') . '</a>', $html);
    $html = str_replace('{FACEBOOK_APP_ID}', FACEBOOK_APP_ID, $html);
    $html = str_replace('{BROWSER}', $mybrowser, $html);
    $html = str_replace('{TERMS}', _('Terms & Conditions'), $html);
    $html = str_replace('{SALESTERMS}', _('Sales Terms & Conditions'), $html);
    if (preg_match_all('%{window:([^},]+),?([^},]+)?}%', $html, $wins)) {
        for ($i = 0; $i < count($wins[0]); $i++) {
            $wpage = mx_windowedpage($wins[1][$i], $wins[2][$i], true, $windowedpages);
            $html = str_replace($wins[0][$i], $wpage['str'], $html);
            $html .= $wpage['div'];
        }
    }
    if (strpos($html, '{ADDBASIC}') > 0) {
        $html = str_replace('{ADDBASIC}', '<table class="buymedia"><tr><td>' . mx_icon('cartmedia', _('Add to Cart'), '24px', 'bs_basicsub', 'cartmediahover') . '</td><td>' . sprintf('$%.2f', MXFEEBASIC) . '</td></tr></table>', $html);
    }
    if (strpos($html, '{ADDPLUS}') > 0) {
        $html = str_replace('{ADDPLUS}', '<table class="buymedia"><tr><td>' . mx_icon('cartmedia', _('Add to Cart'), '24px', 'bs_plussub', 'cartmediahover') . '</td><td>' . sprintf('$%.2f', MXFEEPLUS) . '</td></tr></table>', $html);
    }
    if (strpos($html, '{ADDPREMIUM}') > 0) {
        $html = str_replace('{ADDPREMIUM}', '<table class="buymedia"><tr><td>' . mx_icon('cartmedia', _('Add to Cart'), '24px', 'bs_premsub', 'cartmediahover') . '</td><td>' . sprintf('$%.2f', MXFEEPREMIUM) . '</td></tr></table>', $html);
    }
    if (strpos($html, '{ADDFREE}') > 0) {
        $html = str_replace('{ADDFREE}', '<table class="buymedia"><tr><td>' . mx_icon('cartmedia', _('Add to Cart'), '24px', 'bs_freesub', 'cartmediahover') . '</td><td>' . sprintf('$%.2f', MXFEEFREE) . '</td></tr></table>', $html);
    }
    $html = str_replace('{SIGNIN}', mx_icon('enterdrop', _('Enter - Sign in or sign up'), 48, 'act_enterdrop', 'enterdrophover'), $html);
    $html = str_replace('{ACCTYPE}', $acctypes[$mxuser->acctype], $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('{MAXINVITES}', MXMAXINVITES, $html);
    $html = str_replace('{siteurl}', mx_option('siteurl'), $html);
    $html = str_replace('{googlemap}', '<div class="googlemap"><iframe width="300" height="300" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.ca/maps/ms?msa=0&amp;msid=217503076480382472301.0004a98d653fcbd092ac2&amp;hl=en&amp;ie=UTF8&amp;ll=49.205402,-123.134594&amp;spn=0.008412,0.012875&amp;z=15&amp;output=embed"></iframe><br /><small>View <a href="http://maps.google.ca/maps/ms?msa=0&amp;msid=217503076480382472301.0004a98d653fcbd092ac2&amp;hl=en&amp;ie=UTF8&amp;ll=49.205402,-123.134594&amp;spn=0.008412,0.012875&amp;z=15&amp;source=embed" style="color:#0000FF;text-align:left">MusXpand</a> in a larger map</small></div>', $html);
    $html = preg_replace('%{aboutimg:([^,}]+)(,([^}]+))?}%', '<img class="about" src="' . mx_option('siteurl') . '/images/about/$1" alt="$3" />', $html);
    $html = preg_replace('%{aboutpic:([^,}]+)(,([^}]+))?}%', '<div class="about"><img src="' . mx_option('siteurl') . '/images/about/$1-comic.jpg" alt="$3" ' . 'onmouseover="this.src=\'' . mx_option('siteurl') . '/images/about/$1-normal.jpg' . '\';" ' . ' onmouseout="this.src=\'' . mx_option('siteurl') . '/images/about/$1-comic.jpg' . '\';"/>' . '<br/>$3</div>', $html);
    /*$html=preg_replace('%{officepic:([^,}]+)(,([^}]+))?}%',
    		'<img class="officepic" src="http://www.example.com/webcam/$1?'.time().'" alt="$3" />',$html);*/
    $html = preg_replace('%{seismograph:([^,}]+)(,([^}]+))?}%', '<a href="' . MXPRODSITE . '/$1" target=_blank><img class="seismograph" src="' . MXPRODSITE . '/images/about/$1?' . time() . '" alt="$3" /></a>', $html);
    $html = str_replace('{firstname}', $mxuser->firstname ? $mxuser->firstname : $mxuser->fullname, $html);
    $registerurl = mx_optionurl('account', 'register') . '?i=' . $mxuser->invitecode;
    $registerlink = '<a href="' . $registerurl . '" alt="' . _('Register') . '">MusXpand</a>' . sprintf(_(' (link: %s)'), $registerurl);
    $html = str_replace('{REGISTERURL}', $registerlink, $html);
    $html = str_replace('{HIS_HER}', $mxuser->gender == MXSEXMALE ? 'his' : ($mxuser->gender == MXSEXFEMALE ? 'her' : 'their'), $html);
    $html = str_replace('{FRIENDNAME}', $mxuser->fullname . ($mxuser->acctype == MXACCOUNTARTIST ? ' (' . $mxuser->artistname . ')' : ''), $html);
    $html = str_replace('{MUSXPANDLOGO}', '<img src="' . mx_option('logoURL') . '" alt="' . _('Logo') . '" height="48"/>', $html);
    $html = str_replace('{M-LOGO}', '<img src="' . mx_option('m-logoURL') . '" alt="' . _('Logo') . '" height="48"/>', $html);
    $html = str_replace('{GUITARLOGO}', '<img src="' . mx_option('guitarlogo') . '" alt="' . _('Logo') . '" />', $html);
    $html = str_replace('{EMAIL}', $mxuser->email, $html);
    $html = str_replace('{SENDER}', $mxuser->fullname ? $mxuser->fullname : $mxuser->artistname, $html);
    $html = str_replace('{localtime}', date('r'), $html);
    $html = str_replace('{RULE}', '<hr>', $html);
    $html = str_replace('{TOP}', '<a class="backtotop" href="#pagetop">' . _('Back') . '</a>', $html);
    $html = str_replace('[', '<', $html);
    $html = str_replace(']', '>', $html);
    return $html;
}
示例#6
0
function mx_mninvites($page, $option, $action)
{
    global $mxuser, $to;
    echo '<div class="mx-message">';
    //mx_showhtmlpage('invites');
    //echo '<p>'.sprintf(_('You have %d invites left.'),MXMAXINVITES-$mxuser->invites).'</p>';
    if ($action == 'sendinvites' && is_array($to) && count($to) > 0) {
        echo '<div class="invitessent"><ul>';
        foreach ($to as $recip) {
            echo '<li>' . $recip . '</li>';
        }
        echo '</ul></div>';
    }
    $invitetbl = array('invitelist', 0, _('Invites'), '', array('invites' => array('submit' => _('Send'))), array('invites' => array('invites' => array(-1, _('Invites'), _('Please enter the names and emails of the people you want' . ' to invite to MusXpand.') . '<br/>' . _('You can click on the question mark on the right to get more information about Reward Points')), 'names[]' => array(1, _('Name'), 'text', '30', null, _('Your friend\'s first or fullname')), 'emails[]' => array(1, _('Email'), 'text', '40', null, _('Your friend\'s email address')), 'a' => array(1, 'sendinvites', 'hidden'))));
    $invite = null;
    $invite->name = '';
    $invite->email = '';
    for ($i = 0; $i < 10; $i++) {
        $invites['invites'][] = $invite;
    }
    $str = '<div class="form invites"><form name="invites" method="POST" enctype="multipart/form-data"' . ' onsubmit="return checkform(\'invites\');">';
    $str .= mx_showtablestr($invitetbl[5], $invites, 'invites', $invitetbl[4], 'invites');
    $str .= '</form></div>';
    // show invite URL
    $registerurl = mx_optionurl('account', 'register') . '?i=' . $mxuser->invitecode;
    $str .= '<p>' . sprintf(_('Alternatively, you can send your friend an email informing the link below,' . ' that will also allow them to register, or post the link on Facebook, Twitter... so that anyone in your network can be one of your referees:<br/>%s<br/><center>(copy and paste the complete link to your email)</center>'), '<center><b>' . $registerurl . '</b></center>') . '</p>';
    echo $str;
    echo '</div>';
}
示例#7
0
function mx_musxmenu()
{
    global $mx_musxmenu, $MXVersion, $MXRelease;
    echo '<div class="copyright">&copy; 2010-2012, MusXpand' . ' <span class="version"><a href="' . mx_optionurl('help', 'mxversion') . '">(' . $MXVersion . '|' . $MXRelease . ')</a></span></div>';
    mx_showmenu($mx_musxmenu, 2);
}
示例#8
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;
}
示例#9
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 
}