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; }
function mx_infofield($field, $value, $fldinfo) { global $mxdb, $mxuser, $defaultprivacy; if (is_array($fldinfo)) { $fldtype = $fldinfo[2]; } else { $fldtype = $fldinfo; } //error_log('infofield: '.$fldtype.' '.print_r($value,true)); switch ($fldtype) { case 'percent': return ($value > 100 ? 100 : floor($value)) . '%'; case 'playtime': $hr = floor($value / 3600); $mn = floor(($value - 3600 * $hr) / 60); $sc = $value - 3600 * hr - 60 * $mn; return ($hr ? $hr . ':' : '') . sprintf('%02d:%02d', $mn, $sc); case 'mediaplay': $media = $mxuser->getmediainfo($value); $fanship = $mxuser->getfanship($media->owner_id, $media->id); mx_medialist($media, $fanship); $str = $media->mediadatalight; $str = str_replace('{PRICE}', '<table class="buymedia"><tr><td>', $str); $str = str_replace('{PRICE2}', '</td><td>', $str); $str = str_replace('{PRICE3}', '</td></tr></table>', $str); return $str; break; case 'playtype': global $playtypes; return $playtypes[$value + 0]; break; case 'genre': $genres = $mxdb->listgenres(); $cats = array(); $subgenres = array(); foreach ($genres as $genre) { if (!$genre->cat) { $cats[$genre->hash] = $genre->id; $subgenres[$genre->id] = array(); } } foreach ($genres as $genre) { if ($genre->cat) { $subgenres[$cats[$genre->cat]][] = $genre->id; $catgenre[$genre->id] = $cats[$genre->cat]; } } $str = '<table class="genres">'; $ok = 0; for ($i = 0; $i < 5; $i++) { $genre = $value[$i]; if ($genre) { $cat = $catgenre[$genre]; $str .= '<tr><th>' . (!$i ? _('Primary') : ($i == 1 ? _('Secondary') : _('Other'))) . ':</th><td>' . $genres[$genre]->genre . ($cat ? ' (' . $genres[$cat]->genre . ')' : '') . '</td></tr>'; $ok = 1; } } $str .= '</table>'; if (!$ok) { return _('Not informed'); } return $str; break; case 'pagepic': if (!$value) { return ''; } return '<img class="fanpic" src="' . $value . '">'; break; case 'size': return mx_size($value); break; case 'invites': return sprintf(_('So far, %d of your referrees registered'), $value); break; case 'agreement': if ($value == "0000-00-00 00:00:00") { return sprintf(_('%s not yet accepted.'), mx_windowedpage('terms', _('Terms & Conditions'))); } return sprintf(_('%s Accepted: %s.'), mx_windowedpage('terms', _('Terms & Conditions')), mx_difftime($value)); break; case 'proid': if ($value == MXNOPROYET) { return _('Not Affiliated Yet'); } if (!$value) { return _('Undefined'); } $pro = $mxdb->listpros($value); if ($pro[0]) { return $pro[0]->name . ' (' . $pro[0]->website . ')'; } else { return _('Undefined'); } break; case 'editbutton': return '<input type="' . ($field == 'submit' ? 'submit' : ($field == 'clear' ? 'reset' : 'button')) . '"' . ' name="' . $field . '" value="' . $value . '"' . ' onclick="if (buttonclick(\'' . $field . '\')) submit();"' . (strpos($field, '-') === 0 ? ' disabled' : '') . '>'; break; case 'mediabtns': //$str='<div class="media">'; //$str.='<div class="icons">'. $str = mx_icon('playmedia', _('Play'), 24, 'pm_' . $value, 'pausemedia') . ' ' . mx_icon('downmedia', _('Download'), 24, 'dm_' . $value, 'downmedia_active') . mx_icon('addmedia', _('Add'), 24, 'am_' . $value, 'addedmedia'); return $str; break; case 'mediainfo': //$str='<div class="media">'; //$str.='<div class="icons">'. $str = mx_icon('infomedia', _('Info'), 16, 'im_' . $value, 'infomedia_down'); return $str; break; case 'wall': $userinfo = $mxuser->getuserinfo($value->authid); $str = '<div class="wall wid_' . $value->msgid . '">'; $str .= '<div class="wauth">'; /*$str.= '<img class="wallpic" src="'.mx_fanpic($value->authid,'square').'" />' .' '.mx_getartistname($userinfo); */ $str .= '<table><tr><td class="subline"><img class="wallpic" src="' . mx_fanpic($value->authid, 'square') . '" /></td>' . '<td>'; if ($value->type == 'artist') { $name = mx_getartistname($userinfo); $str .= '<a href="' . mx_actionurl('artists', 'artprof', $userinfo->id) . '" alt="' . $name . '">' . $name . '</a>'; } else { $name = mx_getname($userinfo); $str .= '<a href="' . mx_actionurl('fans', 'fanprof', $userinfo->id) . '" alt="' . $name . '">' . $name . '</a>'; } $str .= '</td></tr></table>'; $str .= '</div>'; //$filters=str_replace(', ','<br/>',mx_sharefilter($value->filter)); $filters = mx_sharefilter($value->filter); if ($value->flags & MXWALLDELETED) { $str .= '<div class="canwall">' . _('DELETED') . '</div>'; } else { $str .= '<div class="wfilter">' . $filters . '</div>'; } $str .= '<div class="wdate">' . mx_difftime($value->date) . '</div>'; $str .= '<div class="wbody">'; if ($value->refid) { $str .= '<div class="refwall">Ref. Wall#' . $value->refid . _(' (will be shown later)') . '</div><br/>'; } $body = mx_urls2anchors(htmlspecialchars($value->body)); $str .= preg_replace('%\\n%', '<br/>', $body); $str .= '</div>'; // class body if ($mxuser->id) { if ($value->authid == $mxuser->id) { $str .= '<div class="wdelete" onclick="javascript:deletewall(\'' . $value->msgid . '\');">'; $str .= _('Delete'); $str .= '</div>'; // wdelete } else { $str .= '<div class="wreport">'; $str .= _('Flag This'); $str .= '</div>'; // wreport } $str .= '<div class="wcomments" onclick="javascript:switchcomments(\'' . $value->type . '\',\'' . $value->msgid . '\');">'; if (!$value->comments) { $str .= _('Any comment?'); } else { $str .= sprintf($value->comments == 1 ? _('%d comment.') : _('%d comments.'), $value->comments); } $str .= '</div>'; // wcomments $str .= '<div class="wlikes">'; $str .= mx_likeicon($value->msgid, MXLIKEIT, $value->mylikes, $mxuser->id) . '<div name="ln_' . $value->msgid . '">' . sprintf('%d', $value->likes ? $value->likes : 0) . '</div>' . mx_likeicon($value->msgid, MXDISLIKEIT, $value->mylikes, $mxuser->id) . '<div name="dn_' . $value->msgid . '">' . sprintf('%d', $value->dislikes ? $value->dislikes : 0) . '</div>'; $str .= '</div>'; // wlikes $str .= '<div class="wcommentspanel" id="' . $value->type . 'cm_' . $value->msgid . '">'; $str .= '</div>'; } $str .= '</div>'; // class wall return $str; break; case 'fan': $userinfo = $mxuser->getuserinfo($value); $name = mx_getname($userinfo); /*return '<div class="subline"><img class="subpic" src="'.mx_fanpic($userinfo->id).'" />' .'<a href="'.mx_actionurl('artists','artprof',$userinfo->id).'" alt="'.$name.'">' .$name .'</a>' .'</div>';*/ return '<table class="name"><tr><td class="subline"><img tag="' . $userinfo->id . '" class="subpic" src="' . mx_fanpic($userinfo->id, 'square', $userinfo->gender) . '" itemprop="image" /></td>' . '<td><a href="' . mx_actionurl('fans', 'fanprof', $userinfo->id) . '" alt="' . $name . '" itemprop="url">' . '<span itemprop="name">' . $name . '</span>' . '</a>' . '</td></tr></table>'; break; case 'artist': $userinfo = $mxuser->getuserinfo($value); $name = mx_getartistname($userinfo); /*return '<div class="subline"><img class="subpic" src="'.mx_fanpic($userinfo->id).'" />' .'<a href="'.mx_actionurl('artists','artprof',$userinfo->id).'" alt="'.$name.'">' .$name .'</a>' .'</div>';*/ return '<table class="name"><tr><td class="subline"><img tag="' . $userinfo->id . '" class="subpic" src="' . mx_artpic($userinfo->id, 'square', $userinfo->gender) . '" itemprop="image" /></td>' . '<td><a href="' . mx_actionurl('artists', 'artprof', $userinfo->id) . '" alt="' . $name . '" itemprop="url">' . '<span itemprop="name">' . $name . '</span>' . '</a></td></tr></table>'; break; case 'subcat': // subscriptions types only global $prodtypes; return $prodtypes[$value][0]; break; case 'subtype': // subscriptions types only global $prodtypes; return $prodtypes[MXARTSUB][1][$value]; break; case 'newsubtype': // subscriptions types only global $prodtypes; return $prodtypes[$value['subcat']][1][$value['subtype']]; break; case 'substatus': // subscriptions statuses global $substatuses; $status = $substatuses[$value]; if ($value == MXNEWSUB || $value == MXRENEWEDSUB) { $status = '<span class="newsub">' . $status . '</span>'; } return $status; break; case 'subrenewal': // subscriptions statuses global $subrenewals; if (!$value) { return MXNONAPPLICABLE; } $status = $subrenewals[$value]; //if ($value==MXNEWSUB || $value==MXRENEWEDSUB) // $status='<span class="newsub">'.$status.'</span>'; return $status; break; case 'hidden': return '[invisible:' . $field . ']'; break; case 'price': return str_replace(' ', ' ', sprintf('US$ %6.2f', $value)); /* case 'prodtype': global $prodtypes; return $prodtypes[$value][0]; case 'prodvar': global $prodtypes; return $prodtypes[$value[0]][0]; case 'artistid': $user=$mxuser->getuserinfo($value); return mx_getartistname($user); */ /* case 'prodtype': global $prodtypes; return $prodtypes[$value][0]; case 'prodvar': global $prodtypes; return $prodtypes[$value[0]][0]; case 'artistid': $user=$mxuser->getuserinfo($value); return mx_getartistname($user); */ case 'hiddenmemo': return '<textarea id="' . $field . '" rows="' . $fldinfo[3] . '" cols="50" name="' . $field . '"' . ' disabled>' . ($value ? $value : _('No history available')) . '</textarea>'; break; case 'html': return $value; case 'text': return $value ? $value : '<i>' . _('Undefined') . '</i>'; break; case 'friends': return $value ? $value : '<i>' . _('Undefined') . '</i>'; break; case 'quote': return '<span class="codinoma">' . $value . '</span>'; break; case 'password': $str = $value != '' ? '[' . $value . '] (' . _('generated') . ')' : str_repeat('•', 12); return $str; break; case 'integer': return $value; break; case 'boolean': global $bools; return $bools[$value]; break; case 'memo': $value = htmlspecialchars($value); $value = mx_urls2anchors($value); /*$value=preg_replace('%(https?://([^ \n,.]|(\.[a-zA-Z0-9]))+)([ .,\n]|$)%i', '<a href="\1" target="_blank">\1</a>\4',$value);*/ $value = preg_replace('%\\n%', '<br/>', $value); return $value; break; case 'simplememo': $value = htmlspecialchars($value); $value = preg_replace('%\\n%', '<br/>', $value); return $value; break; case 'update': $str = _('Updated:<br/>'); if (!$value || $value == '0000-00-00') { return $str . _('Unspecified'); } return $str . mx_difftime($value); break; case 'date': case 'timestamp': if (!$value || $value == '0000-00-00') { return _('Unspecified'); } return mx_difftime($value); break; case 'expdate': if ($value == '0000-00-00') { return _('Unspecified'); } if ($value == '9999-01-01') { return _('Never'); } if (!$value) { return _('None'); } preg_match_all('%([0-9]+)%', $value, $datevalues); $datefields = mx_infofield($field . '_d', $datevalues[1][2], array(1, $datevalues[1][2], 'integer', 2)) . '-' . mx_infofield($field . '_m', $datevalues[1][1], array(1, $datevalues[1][1], 'month')) . '-' . mx_infofield($field . '_y', $datevalues[1][0], array(1, $datevalues[1][0], 'integer', 4)); if ($fldtype == 'expdate' && $value != '9999-01-01') { $vtime = strtotime($value); if ($vtime > time() && $vtime < time() + 86400 * 7) { return '<span class="expiring">' . $datefields . '</span>'; } if ($vtime < time()) { return '<span class="expired">' . $datefields . '</span>'; } } return $datefields; break; case 'month': global $months; return $months[$value + 0]; break; case 'locale': global $languages; return $languages[$value]; break; case 'gender': global $genders; return $genders[$value]; break; case 'url': $value = mx_urls($value); return $value; break; case 'submit': return '[' . $value . ']'; break; case 'reset': return '[' . $value . ']'; break; case 'acctype': global $acctypes; return $acctypes[$value]; break; case 'status': global $statuses; return $statuses[$value]; break; case 'island': $islcnt = $mxdb->islcnt($value); if ($value == 0) { return sprintf(_('Nowhere Island [%d souls]'), $islcnt); } break; case 'archipelago': $archicnt = $mxdb->archicnt($value); if ($value == 0) { return sprintf(_('Middle Of The Sea [%d souls]'), $archicnt); } break; case 'privacy': global $privlevels; $col = 0; $privfield = '<table class="privacy"><tr>'; foreach ($privlevels as $lname => $ldesc) { $privfield .= '<td>'; if (array_search($lname, explode(',', $value)) !== false || array_search($lname, $defaultprivacy)) { $privfield .= '<span class="priv">' . $ldesc . '</span>' . (array_search($lname, $defaultprivacy) ? '<span class="mandatory"><sup>*</sup></span>' : ''); } else { $privfield .= '<span class="nopriv">' . $ldesc . '</span>'; } $privfield .= '</td>'; $col = ++$col % 4; if (!$col) { $privfield .= '</tr><tr>'; } } $privfield .= '</tr></table>'; $privfield .= '<span class="mandatoryhelp"><sup>*</sup>' . _('This information is always visible') . '</span>'; return $privfield; break; case 'filetype': global $filetypes; $ft = $filetypes[$value]; $ftfile = '/icons/mediatype_' . $value . '.png'; if (file_exists(mx_option('templatedir') . $ftfile)) { return '<img class="mediatype" src="' . mx_option('templateURL') . $ftfile . '"' . ' alt="' . $ft . '"/>'; } return $ft; break; case 'mediatype': global $filetypes; $ft = $filetypes[$value]; return $ft; break; case 'completion': global $completions; if (!$value) { $value = MXMEDIANOSTATUS; } return $completions[$value]; break; case 'mediastatus': global $mediastatuses; return $mediastatuses[$value]; break; case 'pubstatus': global $pubstatuses; return $pubstatuses[$value]; break; case 'media': global $filetypes; switch ($fldinfo[3]) { case MXMEDIAPIC: case MXMEDIABG: $w = $fldinfo[4]['video']['resolution_x']; $h = $fldinfo[4]['video']['resolution_y']; if (!$w || $w > 320) { $w = '320'; $h = ''; } return '<img src="' . $value . '"' . ($w ? ' width="' . $w . '"' : '') . ($h ? ' height="' . $h . '"' : '') . '>'; case MXMEDIAINSTR: case MXMEDIASONG: return mx_soundplayerbutton($value, $fldinfo[6]) . mx_soundplayertrack($value, $fldinfo[6]); case MXMEDIAVIDEO: return mx_videoplayerbutton($value, $fldinfo[6]) . mx_videoplayertrack($value, $fldinfo[6], $fldinfo[4], $fldinfo[5]); default: return '(Media type not yet handled)'; } break; case 'array': return mx_arraytotable($value); case 'background': $bg = $mxuser->getbackground($value); if (!$bg) { $bgpic = _('Standard'); } else { $bgpic = $bg->title; } return $bgpic . '<div class="bgtest"><img id="bgpic" src="' . $mxuser->getbackgroundurl($value) . '" /></div>'; case 'transparency': global $transparencies; return $transparencies[$value]; break; case 'bandrole': global $bandroles; if ($value == null || !array_key_exists($value, $bandroles)) { $value = MXBANDROLEOTHER; } return $bandroles[$value]; break; case 'priority': global $priorities; if ($value == null || !array_key_exists($value, $priorities)) { $value = MXLOW; } return $priorities[$value]; break; /*case 'timestamp': $today=date("%Y-m-d%"); $yesterday=date("%Y-m-d%",time()-86400); $value=preg_replace($today,_('Today'),$value); $value=preg_replace($yesterday,_('Yesterday'),$value); return $value; break;*/ /*case 'timestamp': $today=date("%Y-m-d%"); $yesterday=date("%Y-m-d%",time()-86400); $value=preg_replace($today,_('Today'),$value); $value=preg_replace($yesterday,_('Yesterday'),$value); return $value; break;*/ case 'picture': //return '<img src="'.mx_fanpic($mxuser->id,'large',$mxuser->gender,is_artist()).'"/>'; if (!$value) { return ''; } if (!is_object($value)) { return '<img class="dirpic" src="' . $value . '"/>'; } else { return '<img class="' . ($value->type == 'person' ? 'dirpic' : 'bundlepic') . '" tag="' . $value->id . '" src="' . $value->pic . '"/>'; } break; case 'dragdroppic': //return '<img src="'.mx_fanpic($mxuser->id,'large',$mxuser->gender,is_artist()).'"/>'; if (!$value) { return ''; } return '<img class="dirpic' . ($value->type == MXMEDIAPIC || $value->type == MXMEDIABG ? ' dragpic' : ' droppic') . '" tag="' . $value->id . '" src="' . $value->pic . '"/>'; break; case 'actions': $str = '<div class="actionmenu"><ul>'; if ($value) { foreach ($value as $vaction) { $str .= '<li><a href="' . $vaction[1] . '" alt="' . $vaction[0] . '">' . $vaction[0] . '</a></li>'; } } else { $str .= '<li class="inactive"><span class="inactive">' . _('No action') . '</span></li>'; } $str .= '</ul></div>'; return $str; break; case 'msgfld': return $value . '<div class="hidden" id="' . $field . '">' . $value . '</div>'; break; case 'msgflags': $str = ''; if ($value & MXFRIENDREQUEST) { $str .= _('Friendship'); } return $str ? $str : _('Message'); break; case 'notif': global $notifs; return $notifs[$value ? $value : MXEMAILNOTIF]; break; default: return mx_infofield($field, $value, 'text'); break; } }