function mx_frlogo() { ?> <div class='logo'><a href='<?php mx_proption('basicsiteurl'); ?> ' alt='<?php __('Home'); ?> '><img tag="musxpand" class="logopic" src='<?php mx_proption('m-logoURL'); ?> ' /></a> <?php echo '<img tag="mxversion" class="betapic" src="' . mx_option('betalogoURL') . '" />'; ?> </div> <?php }
function tp_index() { ?> <div class='mainwrapper'> <div class='mainpage'> <div class='leftcolumn'> <div class='logo'><img src='<?php echo mx_option(templatedir) . '/images/mxproject-logo.png'; ?> ' /></div> <div class='usermenu'> <?php mx_usermenu(); ?> </div> </div> <div class='maincolumn'> <div class='header'> header </div> <div class='ctxmenu'><?php mx_ctxmenu(); ?> </div> <div class='main'> main content <div class='rightbar'> Right <div> </div> </div> </div> </div> <?php }
function mx_medialist(&$media, $fanship = null, $nobundlebuttons = false, $mystuff = false, $featbun = false) { global $mxuser, $mediacache; //error_log('medialist '.$media->id); if (array_key_exists($media->id, $mediacache)) { //error_log('cached!'); $media = $mediacache[$media->id]; return; } //error_log('not cached!'); if ($media->type == MXMEDIABASEBUNDLE) { $media->select = ''; } else { if (true || $media->status >= MXMEDIAREADY) { $media->select = '<input type="checkbox" name="selmedia[]" value="' . $media->id . '">'; } else { $media->select = '<input disabled type="checkbox" name="selmedia[]" value="' . $media->id . '">'; } } if ($mystuff) { $media->grabber = mx_icon('draghand', _('Grab Me'), 24); } else { $media->grabber = ''; } /*if ($mystuff) { $media->dragdrop=mx_icon('draghand',_('Drag'),24,'dr_'.$media->id); }*/ preg_match('%[^.]+$%', $media->filename, $ext); $mediafile = mx_option('usersdir') . '/' . $media->hashdir . '/media/' . $media->hashcode . '.' . $ext[0]; $id3info = $media->id3info; //$fp=fopen('/tmp/id3read.log','a'); //fputs($fp,"\n".print_r($id3info,true)); //fclose($fp); $status = $media->status; $media->linked = $mxuser->getlinkedmedia($media->id); $media->buttons = ''; // purchase button if not fan/buyer $media->purchase = ''; //if (is_admin() || MXBETA) { $media->pricetag = ''; //error_log('media '.$media->id.' fanship='.print_r($fanship,true)); if (is_array($fanship) && $fanship[0] != MXME && $fanship[0] != MXFAN && $fanship[0] != MXBUYER) { $gotit = $gotit2 = 0; $mxuser->cart->lines = $mxuser->getcartdetails($mxuser->cart->id); if ($mxuser->cart->lines) { foreach ($mxuser->cart->lines as $line) { if ($line->prodtype == MXMEDSUB && $line->prodref == $media->id) { $gotit = 1; } else { if ($line->prodtype == MXMEDSUB && $line->prodref == $media->bundles[0]->id) { $gotit2 = 1; } } } } if ($gotit) { $media->purchase = mx_mediabutton('cartmediabuying', _('In cart'), '24px', 'um_', $media->id, 'hover'); } else { if ($gotit2) { $media->purchase = mx_icon('cartmediaincluded', _('In cart'), '24px'); $media->price = str_replace('buyprice', 'buystrike', $media->price); } else { $media->purchase = mx_mediabutton('cartmedia', _('Add to Cart'), '24px', 'bm_', $media->id, 'hover'); } } $media->purchase = sprintf('{PRICE}%s{PRICE2}%s{PRICE3}', $media->purchase, $media->price); /* if ($media->type==MXMEDIABASEBUNDLE || $media->type==MXMEDIAREGULARBUNDLE) $media->pricetag=_('Buy this Bundle:'); else $media->pricetag=_('Buy this Media:'); $media->pricetag=sprintf('<div class="pricetag">%s</div>',$media->pricetag); */ } else { if ($fanship[0] == MXFAN || $fanship[0] == MXBUYER) { $media->purchase = '<div class="fanmedia">' . mx_icon('fanlove', _('Fan'), '24') . '</div>'; //sprintf('<div class="fanmedia">%s</div>',_('Fan')); } } /* else if ($fanship[0]==MXBUYER) { $media->purchase=mx_icon('fanbought',_('Bought'),'24'); //sprintf('<div class="boughtmedia">%s</div>',_('Bought')); } */ //} $media->content = ''; /*if ($media->type==MXMEDIABASEBUNDLE || $media->type==MXMEDIAREGULARBUNDLE) { $media->buttons.=mx_mediabutton('openbundle',_('Open'),24,'ob_',$media->id,'hover') .mx_mediabutton('notready.gif',_('Not Ready'),24,'wb_',$media->id) .mx_mediabutton('closebundle',_('Close'),24,'cb_',$media->id,'hover'); } else */ if ($status < MXMEDIAREADY) { $media->buttons .= mx_mediabutton('notready.gif', _('Not Ready'), 24, 'xx'); } else { if (!$fanship || ($status == MXMEDIAFANVISIBLE || $status == MXMEDIAARCHIVED) && $fanship[0] >= MXFAN || ($status == MXMEDIAMEMBERVISIBLE || $status == MXMEDIAMEMBERSHARED) && $fanship[0] >= MXMEMBER || ($status == MXMEDIAPUBLIC || $status == MXMEDIAPUBLICSHARED || $status->type == MXMEDIABASEBUNDLE) || $status >= MXMEDIAFANVISIBLE && $media->type == MXMEDIAREGULARBUNDLE) { //$preview=((($status==MXMEDIAFANVISIBLE || $status==MXMEDIAFANSHARED) && $fanship[0]<MXFAN) // || (($status==MXMEDIAMEMBERVISIBLE || $status==MXMEDIAMEMBERSHARED) && $fanship[0]<MXMEMBER)); switch ($media->type) { case MXMEDIAPIC: case MXMEDIABG: $media->buttons .= mx_docplayerbutton(mx_medialink($media->filename, $media->hashcode, $media->hashdir), $media->id, true); $media->content .= mx_docplayertrack(mx_medialink($media->filename, $media->hashcode, $media->hashdir, ''), $media->id, $media->title); //$media->buttons.=mx_icon('noplaymedia',_('NoPlay'),24,'xx'); break; case MXMEDIAINSTR: case MXMEDIASONG: $mediapic = ''; // by default no media pic linked foreach ($media->linked as $linked) { // look for a pic into linked media if ($linked->type == MXMEDIAPIC) { // use first pic found $mediapic = mx_medialink('xx.jpg', $linked->hashcode, $media->hashdir, '-small'); break; } } if (!$mediapic && $media->haspic) { $mediapic = mx_medialink('xxx.' . $media->haspic, $media->hashcode, $media->hashdir); } $media->pic = $mediapic; $media->buttons .= mx_soundplayerbutton(mx_medialink($media->filename, $media->hashcode, $media->hashdir), $media->id, true); $media->content = mx_soundplayertrack(mx_medialink($media->filename, $media->hashcode, $media->hashdir), $media->id, $mediapic, mx_medialink('wave.png', $media->hashcode, $media->hashdir, '-wave'), $media->title); break; case MXMEDIAVIDEO: $media->buttons .= mx_videoplayerbutton(mx_medialink($media->filename, $media->hashcode, $media->hashdir), $media->id, true); $media->content = mx_videoplayertrack(mx_medialink($media->filename, $media->hashcode, $media->hashdir), $media->id, $media->id3info, false, $media->title); break; case MXMEDIABASEBUNDLE: case MXMEDIAREGULARBUNDLE: if (!$nobundlebuttons && $mystuff) { $media->buttons .= mx_mediabutton('openbundle', _('Open'), 24, 'ob_', $media->id, 'hover', $mystuff) . mx_mediabutton('notready.gif', _('Not Ready'), 24, 'wb_', $media->id) . mx_mediabutton('closebundle', _('Close'), 24, 'cb_', $media->id, 'hover', $mystuff); } break; default: $media->buttons .= mx_mediabutton('noplaymedia', _('NoPlay'), 24, 'xx'); } if ((!$fanship || $fanship[0] == MXFAN || $fanship[0] == MXBUYER) && $media->type != MXMEDIABASEBUNDLE && $media->type != MXMEDIAREGULARBUNDLE) { $media->buttons .= mx_mediabutton('golddownmedia', _('Download'), 24, 'dm_', $media->id, 'hover'); $media->content .= mx_downloadlink(mx_medialink($media->filename, $media->hashcode, $media->hashdir, '', true), $media->id); } //else $media->buttons.=mx_mediabutton('nodownmedia',_('NoDownload'),24,'xx'); //$media->buttons.=mx_mediabutton('addmedia',_('Add'),24,'am_',$media->id,'hover'); } else { if ($media->status >= MXMEDIAFANVISIBLE) { switch ($media->type) { case MXMEDIABASEBUNDLE: case MXMEDIAREGULARBUNDLE: if (!$nobundlebuttons && $mystuff) { $media->buttons .= mx_mediabutton('nobundle', _('Restricted'), 24, 'xx'); } break; case MXMEDIAINSTR: case MXMEDIASONG: //$media->title=sprintf(_('%s [extract]'),$media->title); if ($media->preview) { $mediapic = ''; // by default no media pic linked foreach ($media->linked as $linked) { // look for a pic into linked media if ($linked->type == MXMEDIAPIC) { // use first pic found $mediapic = mx_medialink('xx.jpg', $linked->hashcode, $media->hashdir, '-small'); break; } } if (!$mediapic && $media->haspic) { $mediapic = mx_medialink('xxx.' . $media->haspic, $media->hashcode, $media->hashdir); } $media->pic = $mediapic; $media->buttons .= mx_soundplayerbutton(mx_medialink($media->filename, $media->hashcode, $media->hashdir), $media->id); $media->content = mx_soundplayertrack(mx_medialink($media->filename, $media->hashcode, $media->hashdir, '-preview'), $media->id, $mediapic, '', sprintf(_('%s [extract]'), $media->title)); } else { $media->buttons .= mx_mediabutton('noplaymedia', _('NoPlay'), 24, 'xx'); } break; case MXMEDIAPIC: case MXMEDIABG: //$media->title=sprintf(_('%s [preview]'),$media->title); if ($media->preview) { $media->buttons .= mx_docplayerbutton(mx_medialink($media->filename, $media->hashcode, $media->hashdir), $media->id); $media->content .= mx_docplayertrack(mx_medialink('xx.jpg', $media->hashcode, $media->hashdir, '-small'), $media->id, sprintf(_('%s [preview]'), $media->title)); } else { $media->buttons .= mx_icon('noplaymedia', _('NoPlay'), 24, 'xx'); } break; default: $media->buttons .= mx_mediabutton('noplaymedia', _('NoPlay'), 24, 'xx'); } //$media->buttons.=mx_mediabutton('nodownmedia',_('NoDownload'),24,'xx'); //$media->buttons.=mx_mediabutton('noaddmedia',_('NoAdd'),24,'xx'); } else { //$media->title=sprintf(_('%s [restricted]'),$media->title); } } } //$media->buttons='<div id="player">'.$media->buttons.'</div>'; // player $media->infobtn = $media->id; $media->meddesc = $media->title; if ($media->description) { $media->meddesc .= ' ' . mx_icon('infomedia', _('Info'), 12, 'im_' . $media->id, 'infomedia_down') . '<div class="meddesc md_' . $media->id . '">' . preg_replace('%\\n%', '<br/>', htmlspecialchars($media->description)) . '</div>'; } if (!$fanship && count($media->linked) > 0) { /* $links=' '.mx_icon('linkmedia',_('Links'),12,'lm_'.$media->id,'linkmediahover') .'<div class="medlinks ld_'.$media->id.'"><table>'; $l=0; foreach($media->linked as $linked) { if ($l%3==0) $links.='<tr>'; $links.='<td><img src="'.mx_medialink('xx.jpg',$linked->hashcode,$media->hashdir,'-small') .'"/></td>'; if ($l % 3 == 2) $links.='</tr>'; $l++; } if ($l%3>0) $links.='<td colspan="'.(3-($l%3)).'"></td></tr>'; $links.='</table></div>'; */ $links = ' ' . mx_icon('linkmedia', _('Links'), 12, 'lm_' . $media->id, 'linkmediahover') . '<div class="medlinks ld_' . $media->id . '">'; foreach ($media->linked as $linked) { $links .= '<div class="medlink ld_' . $media->id . '_' . $linked->id . '">' . '<img src="' . mx_medialink('xx.jpg', $linked->hashcode, $media->hashdir, '-small') . '"/>' . '<div class="dellink">' . mx_icon('dellink', _('Remove'), 19, 'ul_' . $media->id . '_' . $linked->id, 'dellinkhover') . '</div>' . '</div>'; } $links .= '</div>'; $media->meddesc .= $links; } $media->meddesc .= $media->content; switch ($id3info['fileformat']) { case 'mp3': case 'mp4': $media->info = $id3info['playtime_string']; $media->duration = round($id3info['playtime_seconds']); break; case 'png': case 'jpg': case 'gif': $x = $id3info['video']['resolution_x']; $y = $id3info['video']['resolution_y']; $media->info = $x . ' x ' . $y; break; default: $media->info = ''; break; } $media->mediadata = mx_mediadata($media, $fanship, $mystuff, $nobundlebuttons, $featbun); $mediacache[$media->id] = $media; }
' ' For the sandbox, the URL is https://www.sandbox.paypal.com/webscr&cmd=_express-checkout&token= ' For the live site, the URL is https://www.paypal.com/webscr&cmd=_express-checkout&token= */ if ($SandboxFlag == true) { $API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp"; $PAYPAL_URL = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token="; $PAYPAL_IPN_URL = "ssl://www.sandbox.paypal.com"; $PAYPAL_IPN_SCRIPT = "/webscr"; } else { $API_Endpoint = "https://api-3t.paypal.com/nvp"; $PAYPAL_URL = "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token="; $PAYPAL_IPN_URL = "ssl://www.paypal.com"; $PAYPAL_IPN_SCRIPT = "/cgi-bin/webscr"; } $IPNNotifyURL = mx_option('secure_siteurl') . '/paypal.php'; $USE_PROXY = false; $API_version = "64"; if (session_id() == "") { session_start(); } /* An express checkout transaction starts with a token, that identifies to PayPal your transaction In this example, when the script sees a token, the script knows that the buyer has already authorized payment through paypal. If no token was found, the action is to send the buyer to PayPal to first authorize payment */ /* '------------------------------------------------------------------------------------------------------------------------------------------- ' Purpose: Prepares the parameters for the SetExpressCheckout API Call.
function mx_sharetools($userid, $artist = true) { global $s3, $mxdb; $user = mx_getuserpublicinfo($userid); mx_checkvalues($user); //die(print_r($user,true)); if ($artist) { $name = $user->artistname; $page = 'artists'; $opt = 'artprof'; } else { $name = mx_getname($user); $page = 'fans'; $opt = 'fanprof'; } if (!$name) { return _('Available Soon'); } //die(print_r($user,true)); //if (!is_admin()) return _('Available Soon'); // big badges $fmt = array('large' => '150px wide', 'small' => '100px wide', 'square' => '80px x 96px'); // smaller on-musxpand badges $badgesize = array(_('Small') => '-small', _('Large') => ''); $badgecolor = array(_('White') => '', _('Black') => '-black'); if (!$user->badges) { // QR codes generation /* $xcard=new XMLWriter(); $xcard->openMemory(); $xcard->startDocument('1.0','UTF-8'); $xcard->startElementNs(null,'vcards','urn:ietf:params:xml:ns:vcard-4.0'); $xcard->startElement('vcard'); $xcard->startElement('n'); // name $xcard->startElement('surname'); // family name $xcard->text($user->lastname); $xcard->endElement(); // surname $xcard->startElement('given'); // first name $xcard->text($user->firstname); $xcard->endElement(); // given $xcard->endElement(); // n $xcard->startElement('fn'); // fullname $xcard->startElement('text'); // text $xcard->text($name); $xcard->endElement(); // text $xcard->endElement(); // fn $xcard->startElement('org'); // org $xcard->startElement('text'); // text $xcard->text('MusXpand'); $xcard->endElement(); // text $xcard->endElement(); // org $xcard->startElement('title'); // shortbio $xcard->startElement('text'); // text $xcard->text($user->about); $xcard->endElement(); // text $xcard->endElement(); // shortbio $xcard->startElement('photo'); // photo $xcard->startElement('uri'); // URI $xcard->text(mx_fanpic($user->id,'small',$user->gender,$isartist)); $xcard->endElement(); // URI $xcard->endElement(); // photo $xcard->startElement('adr'); // address $xcard->startElement('parameters'); // parameters $xcard->startElement('type'); // type $xcard->text($isartist?'work':'home'); $xcard->endElement(); // type $xcard->startElement('label'); // label $location=''; if ($user->city) $location.=$user->city; if ($user->state) $location.=($location?', ':'').$user->state; if ($user->country) $location.=($location?'\n':'').mx_getcountryname($user->country); $xcard->text($location); $xcard->endElement(); // label $xcard->startElement('locality'); // locality $xcard->text($user->city); $xcard->endElement(); // locality $xcard->startElement('region'); // region $xcard->text($user->state); $xcard->endElement(); // region $xcard->startElement('country'); // country $xcard->text(mx_getcountryname($user->country)); $xcard->endElement(); // country $xcard->endElement(); // parameters $xcard->endElement(); // address $xcard->startElement('email'); // country $xcard->startElement('text'); // text $xcard->text($user->email); $xcard->endElement(); // text $xcard->endElement(); // email $xcard->startElement('rev'); // revision $xcard->startElement('timestamp'); // date $xcard->text(gmdate('Ymd\THis\Z')); $xcard->endElement(); // date $xcard->endElement(); // rev $xcard->endElement(); // vcard $xcard->endElement(); // vcards $xvcard=$xcard->flush(); */ $saveart = $artist; foreach (array(true, false) as $artist) { $vcard = 'BEGIN:VCARD' . CRLF . 'VERSION:4.0' . CRLF; //$vcard.='SOURCE:'.mx_option('siteurl').'/vcf.php?a='.$user->id.CRLF; $vcard .= 'KIND:individual' . CRLF; //$vcard.='XML:'.$xvcard.CRLF; if ($artist) { $vcard .= 'FN:' . $name . CRLF; $vcard .= 'N:' . $user->lastname . ';' . $user->firstname . CRLF; } else { $vcard .= 'FN:' . $user->fullname . CRLF; $vcard .= 'N:' . $user->lastname . ';' . $user->firstname . CRLF; } $vcard .= 'PHOTO:' . mx_fanpic($user->id, 'small', $user->gender, $artist) . CRLF; if ($user->gender != MXNOSEX) { $vcard .= 'GENDER:' . ($user->gender == MXSEXMALE ? 'M' : 'F') . CRLF; } if ($user->birthdate) { $vcard .= 'BDAY:' . str_replace('-', '', $user->birthdate) . CRLF; } $vcard .= 'ADR;TYPE=' . ($artist ? 'work' : 'home') . ':;;;' . $user->city . ';' . $user->state . ';;' . mx_getcountryname($user->country) . CRLF; $vcard .= 'EMAIL:' . $user->email . CRLF; if ($user->timezone) { $vcard .= 'TZ:' . $user->timezone . CRLF; } if ($user->about) { $vcard .= 'TITLE:"' . $user->shortbio . '"' . CRLF; } $vcard .= 'LOGO:' . mx_option('logoURL') . CRLF; //$vcard.='ORG:'.CRLF; $vcard .= 'UID:urn:uuid:' . $user->hashdir . CRLF; $vcard .= 'URL:' . mx_actionurl($artist ? 'artists' : 'fans', $artist ? 'artprof' : 'fanprof', $user->id) . CRLF; $vcard .= 'REV:' . gmdate('Ymd\\THis\\Z') . CRLF; $vcard .= 'END:VCARD' . CRLF; QRcode::png($vcard, mx_option('usersdir') . '/tmp/' . $user->hashdir . '_QR' . ($artist ? 'a' : 'f') . '.png', 'L', 2, 4); $keyname = 'users/' . $user->hashdir . '/pics/qr_' . ($artist ? 'a' : 'f') . '.png'; $res = $s3->create_object(MXS3BUCKET, $keyname, array('fileUpload' => mx_option('usersdir') . '/tmp/' . $user->hashdir . '_QR' . ($artist ? 'a' : 'f') . '.png', 'acl' => AmazonS3::ACL_PUBLIC)); //@unlink(mx_option('usersdir').'/tmp/'.$user->hashdir.'_'.$value.'.jpg'); file_put_contents(mx_option('usersdir') . '/tmp/' . $user->hashdir . '_vCard' . ($artist ? 'a' : 'f') . '.vcf', $vcard); $keyname = 'users/' . $user->hashdir . '/pics/vCard_' . ($artist ? 'a' : 'f') . '.vcf'; $res = $s3->create_object(MXS3BUCKET, $keyname, array('fileUpload' => mx_option('usersdir') . '/tmp/' . $user->hashdir . '_vCard' . ($artist ? 'a' : 'f') . '.vcf', 'acl' => AmazonS3::ACL_PUBLIC)); @unlink(mx_option('usersdir') . '/tmp/' . $user->hashdir . '_vCard' . ($artist ? 'a' : 'f') . '.vcf'); } $artist = $saveart; } if (!$user->badges) { // badges generation ini_set('allow_url_fopen', 1); $keyname = 'users/' . $user->hashdir . '/pics/me_large.jpg'; $picurl = mx_secureurl(gets3url($keyname, '2 minutes')); // load pic $pic = imagecreatefromjpeg($picurl); if (!$pic) { $pic = imagecreatefrompng(mx_fanpic($user->id, 'large', $user->gender, false)); } $w = imagesx($pic); $h = imagesy($pic); $nhl = round($h * 150 / $w); $nhs = round($h * 100 / $w); $mwh = min($w, $h); $imlarge = imagecreatetruecolor(150, $nhl + 16); $imsmall = imagecreatetruecolor(100, $nhs + 16); $imsquare = imagecreatetruecolor(80, 80 + 16); $fgl = imagecolorallocate($imlarge, 255, 255, 255); $fgs = imagecolorallocate($imsmall, 255, 255, 255); $fgq = imagecolorallocate($imsquare, 255, 255, 255); $bgl = imagecolorallocate($imlarge, 0xff, 0xff, 0x99); $bgs = imagecolorallocate($imsmall, 0xff, 0xff, 0x99); $bgq = imagecolorallocate($imsquare, 0xff, 0xff, 0x99); //imagefill($imlarge,0,0,$fcl); //imagefill($imsmall,0,0,$fcs); //imagefill($imsquare,0,0,$fcq); //imagefilledrectangle($imlarge,1,$nhl,148,$nhl+14,$bgl); //imagefilledrectangle($imsmall,1,$nhs,98,$nhs+14,$bgs); //imagefilledrectangle($imsquare,1,80,78,80+14,$bgq); imageline($imlarge, 0, $nhl - 1, 150 - 1, $nhl - 1, $fgl); imageline($imsmall, 0, $nhs - 1, 100 - 1, $nhs - 1, $fgs); imageline($imsquare, 0, 80 - 1, 80 - 1, 80 - 1, $fgq); imageantialias($imlarge, true); imageantialias($imsmall, true); imageantialias($imsquare, true); imagecopyresampled($imlarge, $pic, 1, 1, 0, 0, 150 - 2, $nhl - 2, $w, $h); imagecopyresampled($imsmall, $pic, 1, 1, 0, 0, 100 - 2, $nhs - 2, $w, $h); imagecopyresampled($imsquare, $pic, 1, 1, $mwh == $h ? ($w - $mwh) / 2 : 0, $mwh == $w ? ($h - $mwh) / 2 : 0, 80 - 2, 80 - 2, $mwh, $mwh); // add artistname $font = mx_option('rootdir') . '/fonts/HoboStd.otf'; $textl = $texts = $textq = strtoupper($name); while (($factl = 16 / max(array(16, strlen($textl)))) < 0.6) { $textl = substr($textl, 0, strrpos($textl, ' ')) . '...'; } while (($facts = 12 / max(array(12, strlen($texts)))) < 0.6) { $texts = substr($texts, 0, strrpos($texts, ' ')) . '...'; } while (($factq = 9 / max(array(9, strlen($textq)))) < 0.6) { $textq = substr($textq, 0, strrpos($textq, ' ')) . '...'; } $szl = 9.4 * $factl; $szs = 9.4 * $facts; $szq = 9.4 * $factq; $txtl = imagettfbbox($szl, 0, $font, $textl); $txts = imagettfbbox($szs, 0, $font, $texts); $txtq = imagettfbbox($szq, 0, $font, $textq); imagettftext($imlarge, $szl, 0, (150 - $txtl[2] - $txtl[0]) / 2 - 1, $nhl + (16 - $txtl[1] - $txtl[7]) / 2, $fgl, $font, $textl); imagettftext($imsmall, $szs, 0, (100 - $txts[2] - $txts[0]) / 2 - 1, $nhs + (16 - $txts[1] - $txts[7]) / 2, $fgs, $font, $texts); imagettftext($imsquare, $szq, 0, (80 - $txtq[2] - $txtq[0]) / 2 - 1, 80 + (16 - $txtq[1] - $txtq[7]) / 2, $fgq, $font, $textq); /* $logo=imagecreatefrompng(mx_option('rootdir').'/images/general/musxpand-logo.png'); $imlogo=imagerotate($logo,90,0); $lw=imagesx($imlogo); $lh=imagesy($imlogo); imagecopyresampled($imlarge,$imlogo,129,0,0,0,$lw/2,$lh/2,$lw,$lh); */ imagejpeg($imlarge, mx_option('usersdir') . '/tmp/' . $user->hashdir . '_large.jpg'); imagejpeg($imsquare, mx_option('usersdir') . '/tmp/' . $user->hashdir . '_square.jpg'); imagejpeg($imsmall, mx_option('usersdir') . '/tmp/' . $user->hashdir . '_small.jpg'); foreach ($fmt as $value => $desc) { $keyname = 'users/' . $user->hashdir . '/pics/badge_' . $value . '.jpg'; $res = $s3->create_object(MXS3BUCKET, $keyname, array('fileUpload' => mx_option('usersdir') . '/tmp/' . $user->hashdir . '_' . $value . '.jpg', 'acl' => AmazonS3::ACL_PUBLIC)); @unlink(mx_option('usersdir') . '/tmp/' . $user->hashdir . '_' . $value . '.jpg'); } // mini-badges $keyname = 'users/' . $user->hashdir . '/pics/me_square.jpg'; $picurl = mx_secureurl(gets3url($keyname, '2 minutes')); // load pic $pic = imagecreatefromjpeg($picurl); if (!$pic) { $pic = imagecreatefrompng(mx_fanpic($user->id, 'large', $user->gender, false)); } $pw = imagesx($pic); $ph = imagesy($pic); $badgepref = 'badge-on-musxpand'; foreach ($badgesize as $sname => $ssuf) { switch ($ssuf) { case '': $offx = 9; $offy = 1; break; case '-small': default: $offx = -2; $offy = 1; break; } foreach ($badgecolor as $cname => $csuf) { $badgemask = imagecreatefrompng(mx_option('rootdir') . '/images/badges/' . $badgepref . $ssuf . $csuf . '.png'); $bw = imagesx($badgemask); $bh = imagesy($badgemask); $badge = imagecreatetruecolor($bw, $bh); //imagepalettecopy($badge, $badgemask); $transp = imagecolorallocatealpha($badge, 0, 0, 0, 127); imagefill($badge, 0, 0, $transp); imageantialias($badge, true); //imagealphablending($badge,false); //imagealphablending($badgemask,false); imagecopyresampled($badge, $pic, floor(($bh - 72) / 2) + $offx, floor(($bh - 72) / 2) + $offy, 0, 0, 72, 72, $pw, $ph); imagecopyresampled($badge, $badgemask, 0, 0, 0, 0, $bw, $bh, $bw, $bh); imagesavealpha($badge, true); $tmpfile = mx_option('usersdir') . '/tmp/' . $user->hashdir . '_mini' . $ssuf . $csuf . '.png'; imagepng($badge, $tmpfile); $keyname = 'users/' . $user->hashdir . '/pics/minibadge' . $ssuf . $csuf . '.png'; $res = $s3->create_object(MXS3BUCKET, $keyname, array('fileUpload' => $tmpfile, 'acl' => AmazonS3::ACL_PUBLIC)); @unlink($tmpfile); } } ini_set('allow_url_fopen', 0); $user->badges = 1; $mxdb->updateuser($user, 'badges'); } $str = '<div class="badges"><table><tr>'; foreach ($fmt as $value => $desc) { $str .= '<th>' . sprintf(_('Badge %s'), $desc) . '</th>'; } $str .= '</tr><tr>'; foreach ($fmt as $value => $desc) { $keyname = 'users/' . $user->hashdir . '/pics/badge_' . $value . '.jpg'; $str .= '<td><img src="' . mx_secureurl(gets3url($keyname)) . '" /></td>'; } $str .= '</tr><tr>'; foreach ($fmt as $value => $desc) { $str .= '<th>' . _('Code') . '</th>'; } $str .= '</tr><tr>'; foreach ($fmt as $value => $desc) { $keyname = 'users/' . $user->hashdir . '/pics/badge_' . $value . '.jpg'; $str .= '<td>'; $str .= '<textarea id="b_' . $value . '" onmouseover="this.select(); setcopybtn(\'bt_' . $value . '\',\'b_' . $value . '\');">'; $str .= '<a href="' . mx_actionurl($page, $opt, $user->id) . '" alt="' . $name . '">' . '<img src="' . mx_secureurl(gets3url($keyname)) . '" />' . '</a>'; $str .= '</textarea><br/>'; $str .= '<a style="display:none;" href="#" class="toclipbtn" id="bt_' . $value . '">' . _('Copy') . '</a>'; $str .= '</td>'; } $str .= '</tr></table>'; //$str.='<center><a href="'.mx_actionurl('artists','artprof',$user->id).'">'.$user->artistname.'</a></center>'; $str .= '</div>'; // smaller on-musxpand badges $str .= '<div class="badges"><table>'; $i = 0; foreach ($badgesize as $sname => $ssuf) { $i++; $j = 0; foreach ($badgecolor as $cname => $csuf) { $j++; $value = $i . '_' . $j; $str .= '<tr><th>' . sprintf(_('MX Badge, %s, %s'), $sname, $cname) . '</th>' . '<th>' . _('Code') . '</th></tr>'; $keyname = 'users/' . $user->hashdir . '/pics/minibadge' . $ssuf . $csuf . '.png'; $str .= '<tr><td><img src="' . mx_secureurl(gets3url($keyname)) . '" /></td>'; $str .= '<td>'; $str .= '<textarea id="b_' . $value . '" onmouseover="this.select(); setcopybtn(\'bt_' . $value . '\',\'b_' . $value . '\');">'; $str .= '<a href="' . mx_actionurl($page, $opt, $user->id) . '" alt="' . $name . '">' . '<img src="' . mx_secureurl(gets3url($keyname)) . '" />' . '</a>'; $str .= '</textarea><br/>'; $str .= '<a style="display:none;" href="#" class="toclipbtn" id="bt_' . $value . '">' . _('Copy') . '</a>'; $str .= '</td>'; $str .= '</tr>'; } } $str .= '</table>'; $str .= '</div>'; return $str; }
function getbackgroundurl($media = null) { // media is media (object) OR media_id (int) global $defaultbackgrounds; if ($media == NULL) { $media = $this->background_id; } if ($media) { if (is_object($media)) { $bg = $media; } else { $bg = $this->getbackground($media); } if ($bg) { if (!$bg->owner_id) { return mx_option('siteurl') . '/images/background/' . $bg->filename; } //$bgfile=$bg->hashdir.'/media/'.$bg->hashcode.'.'. // strtolower(pathinfo($bg->filename,PATHINFO_EXTENSION)); $keyname = 'users/' . $bg->hashdir . '/media/' . $bg->hashcode . '-small.jpg'; $url = gets3url($keyname, '2 minutes'); if ($_SERVER['HTTPS']) { return str_replace('http:', 'https:', $url); } return $url; } } //$img=rand(0,count($defaultbackgrounds)-1); //return mx_option('siteurl').'/images/background/'.$defaultbackgrounds[$img]; return mx_option('siteurl') . '/images/background/greystuff.jpg'; }
(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 */ include_once 'includes/mx_init.php'; require_once 'ext_includes/fileuploader.php'; // list of valid extensions, ex. array("jpeg", "xml", "bmp") $allowedExtensions = array('jpg', 'jpeg', 'png', 'gif'); // max file size in bytes $sizeLimit = 10 * 1024 * 1024; $uploader = new qqFileUploader($allowedExtensions, $sizeLimit); //$userdir = mx_option('usersdir').'/'.$mxuser->hashdir; //$mxuser->checkuserdir(); $result = $uploader->handleUpload(mx_option('usersdir') . '/tmp/', true); error_log(print_r($result, true)); if (!array_key_exists('error', $result)) { $result = $mxuser->addmedia($uploader->getName(), $uploader->getSize(), MXMEDIAREADY, 'Profile Pic', MXMEDIAPIC, $uploader->getName()); //$result['error']=$result['link']; } //error_log(print_r($result,true)); // to pass data through iframe you will need to encode all html tags print_r(htmlspecialchars(json_encode($result), ENT_NOQUOTES)); //error_log('picupload return: '.htmlspecialchars(json_encode($result), ENT_NOQUOTES));
//die(mx_option('usersdir').'/'.$mxuser->hashdir.'/media/4c5fc57c429c299a8d03e65d6de08735.mp3'); $hash = $_GET['hc']; $id = $_GET['id']; $stream = $mxdb->getstream($id, $hash); if (!$stream) { die; } preg_match('%([^.]+)$%', $stream->filename, $ext); $mimetypes = array('mp3' => 'audio/mpeg', 'wav' => 'audio/x-wav', 'aif' => 'audio/x-aiff', 'jpg' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png', 'pdf' => 'application/pdf', 'mpg' => 'video/mpeg', 'mpeg' => 'video/mpeg', 'mp4' => 'video/mpeg', 'm4v' => 'video/mpeg', 'qt' => 'video/quicktime', 'mov' => 'video/quicktime', 'doc' => 'application/msword'); /*switch($filetypes[$stream->type]) { case 'Song': case 'Instrumental': case 'Demo/Draft (incomplete)': case 'Demo/Draft (complete)': header('content-type: audio/binary'); break; case 'Video': header('content-type: video/binary'); break; case 'Picture': header('content-type: image/binary'); break; default: header('content-type: text/plain'); echo 'file: '.$stream->filename.' type: '.$filetypes[$stream->type]; die(); }*/ header('content-type: ' . $mimetypes[$ext[0]]); //header('content-length: '.$stream->filesize); $song = file_get_contents(mx_option('usersdir') . '/' . $mxuser->hashdir . '/media/' . $hash . '.' . strtolower($ext[0])); echo $song;
function mx_sitetitle() { global $mxuser; $page = $_GET['p']; $option = $_GET['o']; $action = $_GET['a']; if (!$page) { echo 'MusXpand - ' . mx_option('title'); return; } if (!$option) { echo 'MusXpand - ' . mx_pagename($page); return; } if (($page == 'artists' && $option == 'artprof' || $page == 'fans' && $option == 'fanprof') && $action) { $user = $mxuser->getuserinfo($action); if ($option == 'fanprof') { echo sprintf(_('%s - MusXpand'), mx_getname($user)); } else { echo sprintf(_('%s - MusXpand'), mx_getartistname($user)); } return; } else { if ($page == 'media' && $option == 'medprof') { $media = $mxuser->getmediainfo($action); echo sprintf(_('%s by %s - MusXpand'), $media->title, $media->artistname); return; } } echo 'MusXpand - ' . mx_pagename($page) . ' - ' . mx_optionname($page, $option); }
function mx_analyzequeue() { global $s3, $sqs, $mxuser, $maxhandle; if ($mxuser && $mxuser->id) { error_log('Access Error.'); die; } ini_set('error_log', '/var/log/mxmedia-error.log'); error_log('start wait.'); while (--$maxhandle > 0) { gc_enable(); $mxuser = null; $res = $sqs->receive_message(MXMEDIAQUEUEURL, array('VisibilityTimeout' => DEBUG ? 15 : 60, 'MaxNumberOfMessages' => 1)); if ($res->isOK()) { $msgcnt = 0; if ($msg = $res->body->Message(0)) { $msgcnt++; //print_r('msg: '.$msg->Body); $req = unserialize($msg->Body); error_log(print_r($req, true)); $ffile = $req['ffile']; $media = $req['media']; $userid = $req['userid']; $ffmt = $req['ffmt']; $rescan = $req['rescan']; $fwave = ''; $fpreview = ''; $id3info = ''; if (!$userid) { error_log('No USERID in message...'); } else { $mxuser = new MXUser($userid); if (!$mxuser->id) { error_log('Can\'t switch to user ' . $userid . '. EXITING.'); die; } error_log("I am now: " . $mxuser->getname()); //error_log('mxuser='******''; $fpic = ''; if ($rescan && !file_exists($ffile)) { // retrieve uploaded version to re-analyse $ffile = mx_option('usersdir') . '/tmp/' . $media->filename; $fhash = $media->hashcode; $ext = preg_replace('%^.*\\.([^.]+)$%', '\\1', $media->filename); $ffmt = $ext; $hashdir = $mxuser->hashdir; $keyname = 'users/' . $hashdir . '/media/' . $fhash . '.' . $ext; error_log('loading ' . $keyname); if (!file_exists($ffile)) { $s3->get_object(MXS3BUCKET, $keyname, array('fileDownload' => $ffile)); } // get miniature if any since it may not be anymore in the mp3 $keyname2 = 'users/' . $hashdir . '/media/' . $fhash . '.jpg'; if ($keyname2 != $keyname) { $fpic = preg_replace('%^(.*)[.][^.]+$%', '\\1.jpg', $ffile); if ($s3->if_object_exists(MXS3BUCKET, $keyname2)) { error_log('loading ' . $keyname2); $s3->get_object(MXS3BUCKET, $keyname2, array('fileDownload' => $fpic)); } if (file_exists($fpic)) { $img = imagecreatefromjpeg($fpic); if ($img) { $w = imagesx($img); $h = imagesy($img); if ($w > 320) { $sc = $w / 320; $img2 = imagecreatetruecolor(320, round($h / $sc)); imagecopyresampled($img2, $img, 0, 0, 0, 0, 320, round($h / $sc), $w, $h); $fpic = preg_replace('%^(.*)[.][^.]+$%', '\\1.jpg', $ffile); imagejpeg($img2, $fpic); imagedestroy($img2); } imagedestroy($img); } $picext = 'jpg'; } else { $fpic = ''; } } } if (file_exists($ffile)) { $rescode = 0; $getID3 = new getID3(); $id3info = $getID3->analyze($ffile); switch ($ffmt) { case 'mp3': // type MP3 $sffile = preg_replace('%([\'"])%', '\\1', $ffile); //preg_replace('%([^a-zA-Z0-9-_/.])%','\1',$ffile); //error_log($sffile); $output = array(); //$res=exec('/usr/local/bin/id3v2 --delete-all "'.$sffile.'"',$output,$rescode); $res = exec('/usr/local/bin/id3v2 --remove-frame "APIC" "' . $sffile . '"', $output, $rescode); if (!$rescode) { $tags = $id3info['id3v2']; if (is_array($tags) && array_key_exists('PIC', $tags)) { $trackpic = $tags['PIC'][0]['data']; $picext = strtolower($tags['PIC'][0]['imagetype']); $fpic = preg_replace('%^(.*)[.][^.]+$%', '\\1.' . $picext, $ffile); file_put_contents($fpic, $trackpic); $img = ''; if ($picext == 'jpg' || $picext == 'jpeg') { $img = imagecreatefromjpeg($fpic); } else { if ($picext == 'png') { $img = imagecreatefrompng($fpic); } else { if ($picext == 'gif') { $img = imagecreatefromgif($fpic); } } } if ($img) { $w = imagesx($img); $h = imagesy($img); if ($w > 320) { $sc = $w / 320; $img2 = imagecreatetruecolor(320, round($h / $sc)); imagecopyresampled($img2, $img, 0, 0, 0, 0, 320, round($h / $sc), $w, $h); $fpic = preg_replace('%^(.*)[.][^.]+$%', '\\1.jpg', $ffile); imagejpeg($img2, $fpic); $picext = 'jpg'; imagedestroy($img2); } imagedestroy($img); } } } unset($id3info['id3v2']['PIC']); unset($id3info['comments']['picture']); unset($id3info['id3v2']); $mxuser->resetid3info($media->id, $id3info); //proc_nice(+15); error_log('generating waveform...'); $fwave = mp3_waveform($ffile, 400, 50, '#ccff99', '#000000'); error_log('generating preview...'); $fpreview = str_replace('.mp3', '-preview.mp3', $sffile); $res = exec('/usr/local/bin/sox --norm "' . $sffile . '" --rate 48k "' . $fpreview . '" fade t 0 0:0:45 5', $output, $rescode); //proc_nice(-15); break; case 'png': case 'jpg': case 'jpeg': case 'gif': $picext = $ffmt; if ($picext == 'jpg' || $picext == 'jpeg') { $img = imagecreatefromjpeg($ffile); } else { if ($picext == 'png') { $img = imagecreatefrompng($ffile); } else { if ($picext == 'gif') { $img = imagecreatefromgif($ffile); } } } if ($img) { $w = imagesx($img); $h = imagesy($img); if ($w > 320 || $h > 320) { $sc = max(array($w, $h)) / 320; } else { $sc = 1; } $img2 = imagecreatetruecolor(round($w / $sc), round($h / $sc)); imagecopyresampled($img2, $img, 0, 0, 0, 0, round($w / $sc), round($h / $sc), $w, $h); //$img2=imagecreatetruecolor($w,$h); //imagecopyresampled($img2,$img,0,0,0,0,$w,$h,$w,$h); $fpic = preg_replace('%^(.*)[.][^.]+$%', '\\1-thumb.jpg', $ffile); //imageinterlace($img2,1); imagejpeg($img2, $fpic); $picext = 'jpg'; imagedestroy($img2); } if ($img) { $w = imagesx($img); $h = imagesy($img); if ($w > 320 || $h > 320) { $sc = max(array($w, $h)) / 320; } else { $sc = 1; } //$img2=imagecreatetruecolor(round($w/$sc),round($h/$sc)); //imagecopyresampled($img2,$img,0,0,0,0,round($w/$sc),round($h/$sc),$w,$h); $img2 = imagecreatetruecolor($w, $h); imagecopyresampled($img2, $img, 0, 0, 0, 0, $w, $h, $w, $h); $fpic = preg_replace('%^(.*)[.][^.]+$%', '\\1-small.jpg', $ffile); imageinterlace($img2, 1); imagejpeg($img2, $fpic, 50); $picext = 'jpg'; imagedestroy($img2); } if ($img) { imagedestroy($img); } break; case 'mov': case 'avi': case 'm4v': case 'mpeg': case 'real': case 'quicktime': break; default: break; } if (!$rescode) { error_log('uploading media...'); $ret = $mxuser->uploadmedia($media->id, $media->filename, $media->title, $media->type, $media->description, $media->completion, $fpic, $fpreview); if (!array_key_exists('error', $ret)) { // set to ready OR restore previous media status if ($media->status < MXMEDIAREADY) { $mxuser->setmediastatus($media->id, MXMEDIAREADY); } else { $mxuser->setmediastatus($media->id, $media->status); } if ($fpreview && file_exists($fpreview) || $fpic && file_exists($fpic)) { $mxuser->setmediafield($media->id, 'preview', 1); } $mxuser->setmediapic($media->id, $picext); @unlink($ffile); if ($fpic) { @unlink($fpic); } if ($fwave) { @unlink($fwave); } if ($fpreview) { @unlink($fpreview); } error_log('OK'); } else { error_log($ret['error']); } } } else { error_log('file ' . $ffile . ' missing...'); } } $sqs->delete_message(MXMEDIAQUEUEURL, $msg->ReceiptHandle); $sqs->delete_message(MXMEDIAQUEUEURL, $msg->ReceiptHandle); } if (!$msgcnt) { sleep(15); } } else { // receive message error error_log($res); sleep(60); } } // while true error_log('end wait.'); }
function tp_index() { ?> <style> body { background: #ffffff url('<?php mx_proption('backgroundURL'); ?> ') center repeat fixed; } div.whitebg { background: url('<?php mx_proption('transparencyURL'); ?> ') repeat; } </style> <div class='mainwrapper whitebg'> <div class='header'> <div class='logo'><a href='<?php mx_proption('basicsiteurl'); ?> ' alt='<?php __('Home'); ?> '><img src='<?php mx_proption('logoURL'); ?> ' /></a> <?php /*if (MXBETA==false) echo '<a href="'.mx_optionurl('about','cQ') .'" alt="'._('Version').'"><img src="'.mx_option('versionlogoURL').'" /></a>'; else */ echo '<img src="' . mx_option('betalogoURL') . '" />'; ?> </div> <div class='topbar'><?php echo '<div class="supportphone">' . MXSUPPORTPHONE . '</div>'; /*mx_ctxmenu();*/ mx_searchbox(); mx_helpmenu(); ?> </div> <div class='topright'><?php mx_iconmenu(); ?> </div> </div> <div class='columns'> <div class='leftcolumn'> <?php mx_userpic(); ?> <?php mx_showname(); ?> <?php mx_mainmenu(); ?> <?php mx_usermenu(); ?> <?php mx_counton(); ?> <?php mx_frdonline(); ?> <?php mx_artonline(); ?> <?php mx_sociallikes(); ?> <?php //echo gmdate('c'); ?> </div> <div class='maincolumn' id='maincolumn'> <?php //if (!is_logged()) { ?> <div class='banner'> <?php mx_banner(); ?> </div> <?php //} ?> <div class='main'> <div class='rightbar'> </div> <div id="content" class='content'> <?php mx_content(); ?> </div> </div> </div> <div class='rightcolumn'> <?php mx_notice(); ?> <?php mx_ads(); ?> </div> </div> <div class='footer'> <div class='bottomleft'></div> <div class='bottombar'><?php mx_musxmenu(); ?> </div> <div class='bottomright'> <?php mx_infosecure(); ?> </div> </div> </div> <?php }
function mx_actionurl($page = 'main', $option = '', $action = '', $section = '', $redir = '', $site = null, $other = '', $nofacebook = false) { switch ($site) { case 'prod': $host = 'http://www.example.com'; break; case 'normal': $host = mx_option('basicsiteurl'); break; case 'secure': $host = mx_option('secure_siteurl'); break; default: $host = mx_option('siteurl'); } // --- stay in canvas or facebook page mode if (!$nofacebook) { if ($_GET['canvas']) { $other .= ($other ? '&' : '') . 'canvas=1'; } if ($_GET['fbp']) { $other .= ($other ? '&' : '') . 'fbp=1'; } if ($_REQUEST['signed_request']) { $other .= ($other ? '&' : '') . 'signed_request=' . $_REQUEST['signed_request']; } } $r = mx_secureredir(urldecode($_GET['r'])); //error_log('actionurl: redir='.$redir.' r='.$r.' other='.$other); $i = mx_secureword($_GET['i']); if ($r && !$redir && ($option == 'signin' || $option == 'register')) { $redir = $r; } if ($i && strpos($other, 'i=') === false && ($option == 'signin' || $option == 'register')) { $other .= ($other ? '&' : '') . 'i=' . $i; } // --- $str = $host . '/' . $page; if ($option) { $str .= '/' . $option; } $qr = ''; if ($action) { $qr .= 'a=' . $action; } if ($section) { $qr .= ($qr ? '&' : '') . 'k=' . $section; } if ($redir) { $qr .= ($qr ? '&' : '') . 'r=' . urlencode($redir); } //return mx_option('siteurl').'/index.php?p='.$page.'&o='.$option.'&a='.$action.'&k='.$section; if ($other) { $qr .= ($qr ? '&' : '') . $other; } if ($qr) { $str .= '?' . $qr; } return $str; }
function mx_mncart($page, $option, $action) { global $mxuser, $prodtypes, $mxdb, $prodprice; $prodlist = array(); $progress = $mxuser->cart->progress; if ($mxuser->cart->lines) { foreach ($mxuser->cart->lines as $line) { //if ($mxuser->cart->orderinfo || $mxuser->cart->orderconfirm) if ($mxuser->cart->progress > 1) { $line->select = '<img height="12px" src="' . mx_iconurl('okmark') . '">'; } else { $line->select = '<input type="checkbox" name="cartline[]" value="' . $line->id . '">'; } $line->proddesc = mx_proddesc($line); /*if ($line->prodtype==MXARTSUB) { $user=$mxuser->getuserinfo($line->prodref); $line->prodref='<div class="cartline"><img class="cartpic" src="'.mx_fanpic($user->id).'" /> '.mx_getartistname($user).'</div>'; }*/ $line->prodvar = $prodtypes[$line->prodtype][1][$line->prodvar]; $line->prodtype = $prodtypes[$line->prodtype][0]; $prodlist['cart'][] = $line; } } if ($mxuser->cart->wishes) { foreach ($mxuser->cart->wishes as $line) { $line->select = '<input type="checkbox" name="wishline[]" value="' . $line->id . '">'; $line->proddesc = mx_proddesc($line); /*if ($line->prodtype==MXARTSUB) { $user=$mxuser->getuserinfo($line->prodref); $line->prodref=mx_getartistname($user); }*/ $line->prodvar = $prodtypes[$line->prodtype][1][$line->prodvar]; $line->prodtype = $prodtypes[$line->prodtype][0]; $prodlist['wishlist'][] = $line; } } if ($mxuser->cart->items > 0) { $contshoppinglabel = _('Continue Shopping'); } else { $contshoppinglabel = _('Go Shopping'); } $yourehere = _('** YOU\'RE HERE **'); $progresstable = '<table class="form progress"><tr class="top">' . '<td class="' . ($progress == 1 ? 'current' : 'done') . '">' . _('Shopping Cart') . '</td>' . '<td' . ($progress > 1 ? ' class="done"' : ' class="todo"') . '>→</td>' . '<td class="' . ($progress == 2 ? 'current' : ($progress < 2 ? 'next' : 'done')) . '">' . _('Shipping/Billing') . '</td>' . '<td' . ($progress > 2 ? ' class="done"' : ' class="todo"') . '>→</td>' . '<td class="' . ($progress == 3 ? 'current' : ($progress < 3 ? 'next' : 'done')) . '">' . _('Order Review') . '</td>' . '<td' . ($progress > 3 ? ' class="done"' : ' class="todo"') . '>→</td>' . '<td class="' . ($progress == 4 ? 'current' : 'next') . '">' . _('Order Confirmation') . '</td>' . '<td class="last"></td>' . '</tr><tr class="bottom">' . '<td>' . ($progress == 1 ? $yourehere : '') . '</td>' . '<td></td>' . '<td>' . ($progress == 2 ? $yourehere : '') . '</td>' . '<td></td>' . '<td>' . ($progress == 3 ? $yourehere : '') . '</td>' . '<td></td>' . '<td>' . ($progress == 4 ? $yourehere : '') . '</td>' . '<td class="last"></td>' . '</tr></table>'; if ($mxuser->cart->err) { $progresstable .= mx_warningstr(implode('<br/>', $mxuser->cart->err)); } if ($mxuser->cart->info) { $progresstable .= mx_infomsgstr($mxuser->cart->info); } //echo $progresstable; if ($mxuser->cart->orderinfo) { // checkcout confirmation $ckoutbuttons = array('canckout' => _('Cancel Checkout'), 'confckout' => _('Confirm PAYPAL Payment')); $cartlist = array('cart' => array('select' => array(0, '', 'text', 3), 'prodtype' => array(0, _('Item'), 'text', 20), 'proddesc' => array(0, _('Description'), 'html', 30), 'prodvar' => array(0, _('Type'), 'text', 20), 'price' => array(0, _('Price'), 'price', 10))); $salesterms = mx_windowedpage('salesterms', _('Terms & Conditions')); $ckoutlist = array('checkout', 0, _('Checkout Review Page'), $progresstable, $ckoutbuttons, array('cart' => array(-1, _('Checking out these products'), _('The following items are currently in your cart')), 'cartcontent' => array(-2, $cartlist, $prodlist, 'cart', array(), 'cart'), 'billing' => array(-1, _('Billing Information'), ''), 'FIRSTNAME' => array(0, _('Firstname'), 'text', 30), 'LASTNAME' => array(0, _('Lastname'), 'text', 30), 'COUNTRYCODE' => array(0, _('Country'), 'text', 3), 'EMAIL' => array(0, _('Billing E-Mail'), 'text', 40), 'shipping' => array(-1, _('Shipping Information'), _('Please check your shipping information')), 'SHIPTONAME' => array(0, _('Ship To'), 'text', 30), 'SHIPTOSTREET' => array(0, _('Address'), 'text', 30), 'SHIPTOCITY' => array(0, _('City'), 'text', 20), 'SHIPTOSTATE' => array(0, _('State/Province'), 'text', 20), 'SHIPTOZIP' => array(0, _('Zip Code'), 'text', 10), 'SHIPTOCOUNTRYNAME' => array(0, _('Country'), 'text', 20), 'salesterms' => array(-1, _('Sales Terms And Conditions'), sprintf(_('Please read and agree with our %s before' . ' confirming your payment'), $salesterm)), 'agreement' => array(1, _('Agreement'), 'checkbox', sprintf(_('I accept MusXpand\'s sales %s'), mx_windowedpage('salesterms', _('terms & conditions'))), _('You have to agree to continue...')), 'a' => array(1, 'none', 'hidden'), 'PAYERID' => array(1, 'none', 'hidden'), 'cartid' => array(1, $mxuser->cart->id, 'hidden'), 'paymentoption' => array(1, 'PayPal', 'hidden'))); mx_showform($ckoutlist, $mxuser->cart->orderinfo, true, true); //echo print_r($mxuser->cart->orderinfo); } else { if ($mxuser->cart->progress == 4) { // order confirmation if ($action != 'printorder') { $ckoutbuttons = array('printorder' => _('Print this Confirmation Page')); } else { $ckoutbuttons = array(); } $cartlist = array('cart' => array('select' => array(0, '', 'text', 3), 'prodtype' => array(0, _('Item'), 'text', 20), 'proddesc' => array(0, _('Description'), 'html', 30), 'prodvar' => array(0, _('Type'), 'text', 20), 'price' => array(0, _('Price'), 'price', 10))); $values = $mxuser->cart->orderconfirm; $values['invoicenum'] = $mxuser->cart->invoicenum; //sprintf(_('%06d'),$mxuser->cart->id); $billing = $mxuser->getaddress($mxuser->cart->billingid); $shipping = $mxuser->getaddress($mxuser->cart->shippingid); $values['FIRSTNAME'] = $billing['first']; $values['LASTNAME'] = $billing['last']; $values['EMAIL'] = $billing['email']; $values['SHIPTONAME'] = $shipping['shiptoname']; $values['SHIPTOSTREET'] = $shipping['street1']; $values['SHIPTOCITY'] = $shipping['city']; $values['SHIPTOSTATE'] = $shipping['state']; $values['SHIPTOZIP'] = $shipping['zip']; $values['SHIPTOCOUNTRYNAME'] = $shipping['countrycode']; $values['termscond'] = mx_showhtmlpagestr('salesterms'); $ckoutlist = array('checkout', 0, _('Order Confirmation'), $action != 'printorder' ? $progresstable : mx_infomsgstr($mxuser->cart->info), $ckoutbuttons, array('cart' => array(-1, sprintf(_('Invoice # %s'), $mxuser->cart->invoicenum), _('You purchased the following items.')), 'cartcontent' => array(-2, $cartlist, $prodlist, 'cart', array(), 'cart'), 'billing' => array(-1, _('Billing Information'), ''), 'FIRSTNAME' => array(0, _('Firstname'), 'text', 30), 'LASTNAME' => array(0, _('Lastname'), 'text', 30), 'EMAIL' => array(0, _('Billing E-Mail'), 'text', 40), 'shipping' => array(-1, _('Shipping Information'), ''), 'SHIPTONAME' => array(0, _('Ship To'), 'text', 30), 'SHIPTOSTREET' => array(0, _('Address'), 'text', 30), 'SHIPTOCITY' => array(0, _('City'), 'text', 20), 'SHIPTOSTATE' => array(0, _('State/Province'), 'text', 20), 'SHIPTOZIP' => array(0, _('Zip Code'), 'text', 10), 'SHIPTOCOUNTRYNAME' => array(0, _('Country'), 'text', 20), 'confirmation' => array(-1, _('Payment Confirmation'), _('Below are the details of the transaction')), 'invoicenum' => array(0, _('Invoice #'), 'text', 30), 'PAYMENTINFO_0_PAYMENTSTATUS' => array(0, _('Payment Status'), 'text', 20), 'PAYMENTINFO_0_TRANSACTIONID' => array(0, _('Transaction ID'), 'transactionid', 20), 'PAYMENTINFO_0_ORDERTIME' => array(0, _('Order Time'), 'text', 20), 'PAYMENTINFO_0_AMT' => array(0, _('Total Amount'), 'price', 20), 'PAYMENTINFO_0_TAXAMT' => array(0, _('Taxes included'), 'price', 20), 'PAYMENTINFO_0_CURRENCYCODE' => array(0, _('Currency'), 'text', 20), 'terms' => array(-1, _('Sales Terms'), _('Please keep the following sales conditions along with your purchase receipt.')), 'termscond' => array(0, _('Buyer Information'), 'html'), 'a' => array(1, 'none', 'hidden'), 'PAYERID' => array(1, 'none', 'hidden'), 'cartid' => array(1, $mxuser->cart->id, 'hidden'), 'paymentoption' => array(1, 'PayPal', 'hidden'))); //mx_showform($ckoutlist,$mxuser->cart->orderconfirm,true,true); mx_showform($ckoutlist, $values, true, true); // confirmation emails if ($action != 'printorder') { // email to buyer $ckoutemail = $ckoutlist; $ckoutemail[4] = array(); $ckoutemail[3] = mx_infomsgstr($mxuser->cart->info); $to = $mxuser->fullname . ' <' . $mxuser->email . '>'; $subj = sprintf(_('Order Confirmation - Invoice # %06d'), $mxuser->cart->id); $html = mx_showhtmlpagestr('orderconfirmation'); $confform = mx_showformstr($ckoutemail, $values, true, true); $html = str_replace('{ORDERFORM}', $confform, $html); $html = str_replace('{INVOICENUM}', $mxuser->cart->invoicenum, $html); // sprintf('%06d',$mxuser->cart->id) $txt = sprintf(_('To print your order confirmation, please go to %s'), mx_actionurl('cart', '', 'printorder', '', '', 'secure', 'cartid=' . $mxuser->cart->id)); mx_sendmail($to, $subj, $txt, $html); // email to artists foreach ($prodlist['cart'] as $line) { if ($prodtype == MXARTSUB) { $artistid = $line->prodref; } else { if ($prodtype == MXMEDSUB) { $media = $mxuser->getmediainfo($line->prodref); $artistid = $media->owner_id; } else { $artistid = 0; } } $prodtype = $line->prodtype; $prodvar = $line->prodvar; $prodprice = sprintf('US$ %.02f', $line->price); if ($artistid) { $artist = $mxdb->getuserinfo($mxuser->id, $artistid); } if ($artist && $artist->email) { $to = mx_getartistname($artist) . ' <' . $artist->email . '>'; if ($prodtype == MXARTSUB) { $subj = _('You just made a new fan'); // html version $html = mx_showhtmlpagestr('newfan'); // text version $txt = _("Hey {ARTISTNAME}!\n\n" . "We just wanted to give you the good news:\n\n" . "You just made a new fan in {FANNAME}:\n" . "{FANNAME} just purchased a {PRODVAR} {PRODTYPE} from you for {PRICE}\n\n" . "Sales Team,\nMusXpand.\n" . MXSALESEMAIL . "\n" . mx_option('basicsiteurl')); mx_fbaction('musxpand:subscribe_to?artist=' . urlencode(mx_actionurl('artists', 'artprof', $artistid))); } else { if ($prodtype == MXMEDSUB) { $subj = _('Someone bought media from you'); // html version $html = mx_showhtmlpagestr('newbuyer'); // text version $txt = _("Hey {ARTISTNAME}!\n\n" . "We just wanted to give you the good news:\n\n" . "{FANNAME} bought some media from you:\n" . "{FANNAME} just purchased \"{MEDIANAME}\" from you for {PRICE}\n\n" . "Sales Team,\nMusXpand.\n" . MXSALESEMAIL . "\n" . mx_option('basicsiteurl')); } } $fan = '<a href="' . mx_actionurl('fans', 'fanprof', $mxuser->id) . '">' . mx_getname($mxuser) . '</a>'; $html = str_replace('{ARTISTNAME}', mx_getartistname($artist), $html); $html = str_replace('{PRICE}', $prodprice, $html); $html = str_replace('{FANNAME}', $fan, $html); $html = str_replace('{MEDIANAME}', $media->title, $html); $html = str_replace('{PRODVAR}', $prodvar, $html); $html = str_replace('{PRODTYPE}', $prodtype, $html); $siteurl = '<a href="' . mx_option('basicsiteurl') . '">MusXpand</a>'; $html = str_replace('{SITEURL}', $siteurl, $html); $html = str_replace('{SALESEMAIL}', MXSALESEMAIL, $html); $txt = str_replace('{ARTISTNAME}', mx_getartistname($artist), $txt); $txt = str_replace('{PRICE}', $prodprice, $txt); $fan = mx_getname($mxuser); $txt = str_replace('{FANNAME}', $fan, $txt); $txt = str_replace('{MEDIANAME}', $media->title, $txt); $txt = str_replace('{PRODVAR}', $prodvar, $txt); $txt = str_replace('{PRODTYPE}', $prodtype, $txt); mx_sendmail($to, $subj, $txt, $html); } } } else { // purchase ?> <!-- Google Code for Bought Conversion Page --> <script type="text/javascript"> /* <![CDATA[ */ var google_conversion_id = 949396365; var google_conversion_language = "en"; var google_conversion_format = "3"; var google_conversion_color = "ffffff"; var google_conversion_label = "f7QfCNPfzwMQjcfaxAM"; var google_conversion_value = <?php echo $mxuser->cart->total; ?> ; /* ]]> */ </script> <script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js"> </script> <noscript> <div style="display:inline;"> <img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/949396365/?label=f7QfCNPfzwMQjcfaxAM&guid=ON&script=0"/> </div> </noscript> <?php } /*$ckoutlist[0]='printout'; echo '<div id="order"><div class="order">'; mx_showform($ckoutlist,$mxuser->cart->orderinfo,false,true); echo '</div></div>';*/ //echo print_r($mxuser->cart->orderconfirm); } else { // cart and wishlist display $cartbuttons = array('towish' => _('Move to Wishlist'), 'delcart' => _('Remove Checked Items'), 'sep' => null, 'shopmore' => $contshoppinglabel, 'checkout' => _('Proceed to Checkout')); $cartlist = array('cartlist', 0, _('Cart & Wishlist Content'), $progresstable, array('cart' => $cartbuttons, 'wishlist' => array('tocart' => _('Move to Cart'), 'delwish' => _('Remove Checked Items'), 'sep' => null, 'shopmore_w' => $contshoppinglabel)), array('cart' => array('cart' => array(-1, _('Your Cart'), _('The following items are currently in your cart')), 'select' => array(0, '<input id="checkallbox" type="checkbox" onclick="javascript:checkall(\'cart\');">', 'text', 3), 'prodtype' => array(0, _('Item'), 'text', 20), 'proddesc' => array(0, _('Description'), 'html', 30), 'prodvar' => array(0, _('Type'), 'text', 20), 'price' => array(0, _('Price'), 'price', 10), 'a' => array(1, 'none', 'hidden'), 'k' => array(1, 'cart', 'hidden')), 'wishlist' => array('wishlist' => array(-1, _('Your Wish List'), _('The following items are currently in your wishlist')), 'select' => array(0, '<input id="checkallbox" type="checkbox" onclick="javascript:checkall(\'wishlist\');">', 'text', 3), 'prodtype' => array(0, _('Item'), 'text', 20), 'proddesc' => array(0, _('Description'), 'html', 30), 'prodvar' => array(0, _('Type'), 'text', 20), 'price' => array(0, _('Price'), 'price', 10), 'a' => array(1, 'none', 'hidden'), 'k' => array(1, 'wishlist', 'hidden')))); mx_showlist($cartlist, $prodlist, 'cart', true, true); //if ($action=='addfoy' || $action=='adfofa' || $action=='upgfofa') { ?> <!-- Google Code for Added To Cart Conversion Page --> <script type="text/javascript"> /* <![CDATA[ */ var google_conversion_id = 949396365; var google_conversion_language = "en"; var google_conversion_format = "3"; var google_conversion_color = "ffffff"; var google_conversion_label = "ziXpCNvezwMQjcfaxAM"; var google_conversion_value = <?php echo $prodprice; ?> ; /* ]]> */ </script> <script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js"> </script> <noscript> <div style="display:inline;"> <img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/949396365/?label=ziXpCNvezwMQjcfaxAM&guid=ON&script=0"/> </div> </noscript> <?php //} } } //phpinfo(); }
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 }
function mx_checkout($cart) { global $mxuser; // ================================== // PayPal Express Checkout Module // ================================== //'------------------------------------ //' The paymentAmount is the total value of //' the shopping cart, that was set //' earlier in a session variable //' by the shopping cart page //'------------------------------------ $paymentAmount = $cart->total + $cart->taxes; $_SESSION["Payment_Amount"] = $paymentAmount; //'------------------------------------ //' The currencyCodeType and paymentType //' are set to the selections made on the Integration Assistant //'------------------------------------ $currencyCodeType = "USD"; $paymentType = "Sale"; //'------------------------------------ //' The returnURL is the location where buyers return to when a //' payment has been succesfully authorized. //' //' This is set to the value entered on the Integration Assistant //'------------------------------------ $returnURL = mx_optionurl_secure('cart', ''); //'------------------------------------ //' The cancelURL is the location buyers are sent to when they hit the //' cancel button during authorization of payment during the PayPal flow //' //' This is set to the value entered on the Integration Assistant //'------------------------------------ $cancelURL = mx_actionurl('cart', '', 'ppcancel'); // callback URL to calculate taxes (and shipping fees) $callbackURL = mx_option('secure_siteurl') . '/paypal.php'; //'------------------------------------ //' Calls the SetExpressCheckout API call //' //' The CallShortcutExpressCheckout function is defined in the file PayPalFunctions.php, //' it is included at the top of this file. //'------------------------------------------------- $resArray = CallShortcutExpressCheckout($cart, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $callbackURL); $ack = strtoupper($resArray["ACK"]); if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") { $mxuser->setcart($cart->id, 'token', $resArray['TOKEN']); $mxuser->setcart($cart->id, 'ordertime', preg_replace('%[^0-9]%', '', $resArray['TIMESTAMP'])); RedirectToPayPal($resArray["TOKEN"]); } else { //Display a user friendly Error on the page using any of the following error information returned by PayPal $ErrorCode = urldecode($resArray["L_ERRORCODE0"]); $ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]); $ErrorLongMsg = urldecode($resArray["L_LONGMESSAGE0"]); $ErrorSeverityCode = urldecode($resArray["L_SEVERITYCODE0"]); //echo "SetExpressCheckout API call failed. <br/>" //."Detailed Error Message: " . $ErrorLongMsg.'<br/>' //."Short Error Message: " . $ErrorShortMsg.'<br/>' //."Error Code: " . $ErrorCode.'<br/>' //."Error Severity Code: " . $ErrorSeverityCode; } return $resArray; }