Beispiel #1
0
function mx_showshows($action)
{
    global $mxuser;
    if (is_artist()) {
        $myshowarr = array('myshows' => array('select' => array(1, '<input name="checkshowsbox" type="checkbox" onclick="javascript:checkshows(\'updates\',\'selshows[]\');">', 'text', 3), 'show' => array(0, _('Show'), 'show')));
        $myshowsb = array('myshows' => array());
        $myshowsptr = null;
        //$mxuser->listmyshows();
        $myshows = array();
        $myshows['myshows'] = array();
        if ($myshowsptr) {
            while ($show = $mxuser->listmyshows($myshowsptr)) {
                $ashow = new StdClass();
                $ashow->select = '<input type="checkbox" name="selshows[]" value="' . $show->msgid . '">';
                $show->type = 'me';
                $show->mylikes = $mxuser->getlikes($show->msgid);
                $ashow->show = $show;
                $ashow->flags = $show->flags;
                $myshows['myshows'][] = $ashow;
            }
        }
        $updatebtns = array('post' => _('Post'), 'clear' => _('Clear'));
    }
    // filling msgs
    $allmsgs = array();
    /*$frshows=array(
    		'frshows' => array(
    			'select' => array(1,'<input name="checkshowsbox" type="checkbox" onclick="javascript:checkshows(\'updates\',\'selshows[]\');">','text',3),
    			'shows' => array(1,_('Wall'),'shows'),
    		)
    	);
    	$frshowsb=array(
    		'frshows' => array(
    			'delete_updates' => _('Delete'),
    			//'archive_inbox' => _('Archive'),
    		)
    	);*/
    /* -- friends shows...
    	$frshowsptr=$mxuser->listfrshows();
    	if ($frshowsptr) {
    		while ($show=$mxuser->listfrshows($frshowsptr)) {
    			$ashow=new StdClass();
    			$ashow->select='<input type="checkbox" name="selshows[]" value="'.$show->msgid.'">';
    			$show->type='friend';
    			$show->mylikes=$mxuser->getlikes($show->msgid);
    			$ashow->show=$show;
    			$ashow->flags=$show->flags;
    			//$frshows['frshows'][]=$ashow;
    			$allmsgs['frshows'][]=$ashow;
    		}
    	}
    	*/
    /* -- artists shows
    	$artshowsptr=$mxuser->listartshows();
    	if ($artshowsptr) {
    		while ($show=$mxuser->listartshows($artshowsptr)) {
    			$ashow=new StdClass();
    			$ashow->select='<input type="checkbox" name="selshows[]" value="'.$show->msgid.'">';
    			$show->type='artist';
    			$show->mylikes=$mxuser->getlikes($show->msgid);
    			$ashow->show=$show;
    			$ashow->flags=$show->flags;
    			//$frshows['frshows'][]=$ashow;
    			$allmsgs['artshows'][]=$ashow;
    		}
    	}
    	*/
    /* -- fans shows
    	$fanshowsptr=$mxuser->listfanshows();
    	if ($fanshowsptr) {
    		while ($show=$mxuser->listfanshows($fanshowsptr)) {
    			$ashow=new StdClass();
    			$ashow->select='<input type="checkbox" name="selshows[]" value="'.$show->msgid.'">';
    			$show->type='fans';
    			$show->mylikes=$mxuser->getlikes($show->msgid);
    			$ashow->show=$show;
    			$ashow->flags=$show->flags;
    			//$frshows['frshows'][]=$ashow;
    			$allmsgs['fanshows'][]=$ashow;
    		}
    	}
    	*/
    $msglist = array('showsmsgs', 1, _('The Shows'), sprintf(_('To post a new update to your shows, click %s.'), '<a href="javascript:tabswitch(\'frshows\',\'updates\');">' . _('here') . '</a>'), array('frshows' => array(), 'artshows' => array(), 'fanshows' => array(), 'updates' => array('newshow' => _('Add a Show'))), array('updates' => array(1, 'updates' => array(-1, _('Add a Show'), _('Please fill the form below...')), 'venue' => array(1, _('Venue'), 'text'), 'date' => array(1, _('Date'), 'date'), 'a' => array(1, 'none', 'hidden'), 'k' => array(1, 'fanshows', 'hidden'), 'a' => array(1, 'none', 'hidden'), 'k' => array(1, 'updates', 'hidden'), 'myshows' => array(-2, $myshows, $myshows, 'shows', $myshowsb, 'myshows')), 'frshows' => array(0, 'frshows' => array(-1, _('Friends\' Shows'), _('What\'s up friends?')), 'a' => array(1, 'none', 'hidden'), 'k' => array(1, 'frshows', 'hidden'), 'shows' => array(0, _('Wall'), 'shows')), 'artshows' => array(0, 'artshows' => array(-1, _('Artists\' Shows'), _('Whazzup fav\' bands?')), 'a' => array(1, 'none', 'hidden'), 'k' => array(1, 'artshows', 'hidden'), 'shows' => array(0, _('Wall'), 'shows')), 'fanshows' => array(0, 'fanshows' => array(-1, _('Fans\' Shows'), _('What are my fans talking about?')), 'a' => array(1, 'none', 'hidden'), 'k' => array(1, 'fanshows', 'hidden'), 'shows' => array(0, _('Wall'), 'shows'))));
    mx_showlist($msglist, $allmsgs, 'shows', true);
    if (preg_match('%(rp:([0-9]+))%', $action, $actionarg) > 0) {
        ?>
		<script language="javascript">buttonclick('reply:<?php 
        echo $actionarg[2];
        ?>
');</script>
		<?php 
    }
}
Beispiel #2
0
 function picture($size = 'large')
 {
     $str = '<img title="' . $this->getname() . ' - ' . _('See Your Page') . '" tag="' . $this->id . '" class="profilepic pictooltip" style="cursor:pointer;" src="' . mx_fanpic($this->id, $size, $this->gender, is_artist()) . '"' . ($this->id ? 'onclick="window.location=\'' . mx_pageurl('account') . '\';"' : MXICONCLICK) . '>';
     if ($this->picture == 'fb') {
         return '<div class="userpic">' . '<div class="pending">' . mx_icon('working.gif', 'updating', '16px') . '</div>' . $str . '<script>$(window).load(function() {savefbpics();});</script>' . '</div>';
     }
     return '<div class="userpic"' . ($this->id && $this->status >= MXACCTSETUP ? ' onmouseover="showbutton(\'profilepic\');"' . ' onmouseout="hidebutton(\'profilepic\');"' : '') . '>' . '<div id="profilepic" class="picbutton" onclick="window.location=\'' . mx_actionurl('account', 'profile', 'edit', 'picinfo') . '\';">' . _('Update Pic') . '</div>' . $str . '</div>';
 }
Beispiel #3
0
function mx_formfieldfld($field, $value, $fldinfo)
{
    global $mxdb, $mxuser, $facebook, $me, $defaultprivacy, $genresdefined;
    if (is_array($fldinfo)) {
        $fldtype = $fldinfo[2];
    } else {
        $fldtype = $fldinfo;
    }
    switch ($fldtype) {
        case 'captcha':
            require_once 'ext_includes/recaptchalib.php';
            $str = recaptcha_get_html(MX_RECAPTCHA_PUBLIC) . '<input type="hidden" name="' . $field . '" value="1">';
            return $str;
            break;
        case 'g-button':
            $str = '<input type="image" name="' . $field . '" value="' . $value . '" src="' . mx_iconurl($fldinfo[3]) . '" onmouseover="this.src=\'' . mx_iconurl($fldinfo[3] . 'hover') . '\';"' . ' onmouseout="this.src=\'' . mx_iconurl($fldinfo[3]) . '\';"' . ' onclick="return buttonclick(\'' . $field . '\');">';
            return $str;
            break;
        case 'genre':
            $genres = $mxdb->listgenres();
            //die(print_r($genres,true));
            $cats = array();
            $subgenres = array();
            foreach ($genres as $genre) {
                if (!$genre->cat) {
                    $cats[$genre->hash] = $genre->id;
                    $subgenres[$genre->id] = array();
                }
            }
            foreach ($genres as $genre) {
                if ($genre->cat) {
                    $subgenres[$cats[$genre->cat]][] = $genre->id;
                    $catgenre[$genre->id] = $cats[$genre->cat];
                }
            }
            if (!$genresdefined) {
                $str = '<script language="javascript">' . CRLF;
                $str .= 'var cats=new Array();' . CRLF;
                $str .= 'var subcats=new Array();' . CRLF;
                $str .= 'var subcatsndx=new Array();' . CRLF;
                foreach ($cats as $cat) {
                    $n = 1;
                    $str .= 'cats[' . $cat . ']=\'' . $genres[$cat]->genre . '\';' . CRLF;
                    $str .= 'subcats[' . $cat . ']=new Array();' . CRLF;
                    $str .= 'subcatsndx[' . $cat . ']=new Array();' . CRLF;
                    $str .= 'subcats[' . $cat . '][0]=\'' . _('Any') . '\';' . CRLF;
                    $str .= 'subcatsndx[' . $cat . '][0]=' . $cat . ';' . CRLF;
                    foreach ($subgenres[$cat] as $subcat) {
                        $str .= 'subcats[' . $cat . '][' . $n . ']=\'' . $genres[$subcat]->genre . '\';' . CRLF;
                        $str .= 'subcatsndx[' . $cat . '][' . $n++ . ']=\'' . $subcat . '\';' . CRLF;
                    }
                }
                $str .= '</script>' . CRLF;
                $genresdefined = true;
            }
            $str .= '<table class="genres">';
            $str .= '<tr><th></th><th>' . _('Category') . '</th><th>' . _('Subcategory') . '</th></tr>';
            for ($i = 0; $i < 5; $i++) {
                if ($value[$i] && $genres[$value[$i]]->cat) {
                    $cat = $catgenre[$value[$i]];
                } else {
                    $cat = $value[$i];
                }
                $subcat = $value[$i];
                $str .= '<tr><th>' . ($i == 0 ? _('Primary') : ($i == 1 ? _('Secondary') : _('Other'))) . ':</th>';
                $str .= '<td>';
                $str .= '<select name="' . $field . '_cat[' . $i . ']" onchange="javascript:showcats(\'' . $field . '_' . $i . '\',this.value);">';
                $str .= '<option value="0"' . (!$value[$i] ? ' selected' : '') . '>' . _('None') . '</option>';
                foreach ($cats as $acat) {
                    $str .= '<option value="' . $acat . '"' . ($acat == $cat ? ' selected' : '') . '>' . $genres[$acat]->genre . '</option>';
                    // ('.$genres[$cat]->wiki.')</option>';
                }
                $str .= '</select></td>';
                $str .= '<td><select id="' . $field . '_' . $i . '" name="' . $field . '[' . $i . ']">';
                //onchange="javascript:showpro(this.value);">';
                if (!$value[$i]) {
                    $str .= '<option value="0" selected>' . _('None') . '</option>';
                } else {
                    $str .= '<option value="' . $cat . '"' . ($value[$i] == $cat ? ' selected' : '') . '>' . _('Any') . '</option>';
                    foreach ($subgenres[$cat] as $sub) {
                        $str .= '<option value="' . $sub . '"' . ($value[$i] == $sub ? ' selected' : '') . '>' . $genres[$sub]->genre . '</option>';
                        // ('.$genres[$cat]->wiki.')</option>';
                    }
                }
                $str .= '</select>';
                $str .= '</td></tr>';
            }
            $str .= '</table>';
            return $str;
            break;
        case 'bundle':
            $str = '<select name="' . $field . '">';
            foreach ($value as $bid => $title) {
                $str .= '<option value="' . $bid . '">' . $title . '</option>';
            }
            $str .= '</select>';
            return $str;
            break;
        case 'transactionid':
            // for the cart
            $str = $value;
            $str .= '<input type="hidden" name="' . $field . '" value="' . $value . '">';
            return $str;
            break;
        case 'proid':
            if (!$value) {
                $value = -1;
            }
            $pros = $mxdb->listpros();
            $str = '<select name="' . $field . '" onchange="javascript:showpro(this.value);">';
            $str .= '<option value="-1"' . ($value == -1 ? ' selected' : '') . '>' . _('* Not Affiliated Yet') . '</option>';
            $def = ' selected';
            foreach ($pros as $i => $pro) {
                if ($value == $pro->id) {
                    $def = '';
                }
                $str .= '<option value="' . $pro->id . '"' . ($value == $pro->id ? ' selected' : '') . '>' . $pro->name . ' (' . $pro->website . ')</option>';
            }
            if ($value == -1) {
                $def = '';
            }
            $str .= '<option value="0"' . $def . '>' . _('* Not Listed, add below') . '</option>';
            // default if no other selected
            $str .= '</select>';
            $str .= '<div class="newpro" id="newpro"' . ($def ? ' style="display:block;"' : '') . '><table class="protable">';
            $str .= '<tr><th>' . _('PRO Name:') . '</th><td><input name="proname" type="text" value="' . mx_securestring($_REQUEST['proname']) . '" size="40"></td></tr>';
            $str .= '<tr><th>' . _('PRO Website:') . '</th><td><input name="prosite" type="text" value="' . mx_securestring($_REQUEST['prosite']) . '" size="60"></td></tr>';
            $str .= '</table>';
            $str .= '</div>';
            return $str;
            break;
        case 'acctype':
            global $acctypes, $acctypesdef;
            if ($value != MXACCOUNTUNDEFINED && $mxuser->status != MXACCTEMAILCONFIRMED && $value != MXACCOUNTFAN) {
                return $acctypes[$value];
            }
            $accfield = '';
            $accfield .= '<dl>';
            foreach ($acctypes as $i => $acctype) {
                if ($i == MXACCOUNTUNDEFINED || $value == MXACCOUNTUNDEFINED && $i > MXACCOUNTARTIST) {
                    continue;
                }
                // pull option 0: undefined
                //if ($i == MXACCOUNTFAN && $value==MXACCOUNTFAN) continue; // pull option fan if already a fan
                $accfield .= '<dt><input name="' . $field . '" type="radio" value="' . $i . '"' . ($value == $i ? ' checked' : '') . ($i > 2 ? ' disabled' : '') . '> ' . $acctypes[$i] . '</dt>';
                $accfield .= '<dd><ul>';
                foreach ($acctypesdef[$i] as $def) {
                    $accfield .= '<li>' . $def . '</li>';
                }
                $accfield .= '</ul></dd>';
            }
            $accfield .= '</dl>';
            /*
            $accfield='<select name="'.$field.'">';
            foreach($acctypes as $i => $acctype) { // pulling option 0:unknown
            	if ($i == MXACCOUNTUNDEFINED) continue;
            	$accfield.='<option value="'.$i.'"'.($value==$i?' selected':'').'>'.$acctypes[$i].'</option>';
            }
            $accfield.='</select>';
            */
            return $accfield;
            break;
        case 'timezone':
            $tzs = $mxdb->tzlist();
            $str = '<select name="' . $field . '">';
            foreach ($tzs as $tz) {
                $str .= '<option value="' . $tz . '"' . ($value == $tz ? ' selected' : '') . '>' . $tz . '</option>';
            }
            $str .= '</select>';
            return $str;
            break;
        case 'username':
            return '<input type="text" name="' . $field . '" value="' . $value . '"' . ($fldinfo[3] > 0 ? ' size="' . min($fldinfo[3], 40) . '"' : '') . ($fldinfo[5] ? ' placeholder="' . $fldinfo[5] . '"' : '') . ' onchange="checkusername(this);" onkeyup="checkusername(this);">' . '<div id="usernamevalidation" class="usernamevalidation"></div>';
            break;
        case 'hidden':
            return '<input type="hidden" id="' . $field . '" name="' . $field . '" value="' . $value . '">';
            break;
        case 'agreement':
            return '<input type="checkbox" id="' . $field . '" name="' . $field . '" value="1" ' . ($value && $value != "0000-00-00 00:00:00" || $fldinfo[5] ? 'checked' : '') . '> ' . $fldinfo[3];
            break;
        case 'checkbox':
            return '<input type="checkbox" id="' . $field . '" name="' . $field . '" value="1" ' . ($value || $fldinfo[5] ? 'checked' : '') . '> ' . $fldinfo[3];
            break;
        case 'legalname':
            // if defined, can't be changed by user
            if ($value && $mxuser->status != MXACCTEMAILCONFIRMED) {
                return $value . '<input type="hidden" name="' . $field . '" value="' . $value . '">';
                break;
            }
            // otherwise handle as normal text
        // otherwise handle as normal text
        case 'mediatitle':
            $value = htmlspecialchars($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 '<div id="' . $field . '" class="titlefld" onclick="javascript:clickedit(\'' . $field . '\',1);">' . ($value ? $value : _('Insert a title here')) . '</div>';
            break;
        case 'mediadesc':
            //$value=htmlspecialchars($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 '<div id="' . $field . '" class="descfld" onclick="javascript:clickedit(\'' . $field . '\',1);">' . ($value ? $value : _('Insert a description here')) . '</div>';
            break;
        case 'fullname':
        case 'text':
            return '<input type="text" name="' . $field . '" value="' . $value . '"' . ($fldinfo[3] > 0 ? ' size="' . min($fldinfo[3], 80) . '"' : '') . ($fldinfo[5] ? ' placeholder="' . $fldinfo[5] . '"' : '') . '>';
            break;
        case 'newpassword':
            $str = '<input type="password" name="new_' . $field . '" value="" placeholder="New Password"' . ($fldinfo[3] > 0 ? ' size="' . min($fldinfo[3], 40) . '"' : '') . '>';
            $str .= '<br/><input type="password" name="conf_' . $field . '" value="" placeholder="Confirm New Password"' . ($fldinfo[3] > 0 ? ' size="' . min($fldinfo[3], 40) . '"' : '') . '>';
            return $str;
            break;
        case 'password':
            $str = '<input type="password" name="' . $field . '" value="" placeholder="Current Password"' . ($fldinfo[3] > 0 ? ' size="' . min($fldinfo[3], 40) . '"' : '') . '>';
            if ($fldinfo[5] == true) {
                $str .= ' <input type="button" value="' . mx_optionname('account', 'pwdreset') . '" onclick="window.location=\'' . mx_optionurl('account', 'pwdreset') . '\';"/>';
                $str .= '<br/><input type="password" name="new_' . $field . '" value="" placeholder="New Password"' . ($fldinfo[3] > 0 ? ' size="' . min($fldinfo[3], 40) . '"' : '') . '>';
                $str .= '<br/><input type="password" name="conf_' . $field . '" value="" placeholder="Confirm New Password"' . ($fldinfo[3] > 0 ? ' size="' . min($fldinfo[3], 40) . '"' : '') . '>';
            }
            return $str;
            break;
        case 'integer':
            return '<input type="text" name="' . $field . '" value="' . $value . '"' . ($fldinfo[3] > 0 ? ' size="' . min($fldinfo[3], 40) . '"' : '') . ($fldinfo[5] ? ' placeholder="' . $fldinfo[5] . '"' : '') . '>';
            break;
        case 'boolean':
            global $bools;
            $boolfield = '<select id="' . $field . '" name="' . $field . '">';
            for ($i = 0; $i < 2; $i++) {
                $boolfield .= '<option value="' . ($i + 1) . '"' . ($value == $i + 1 ? ' selected' : '') . '>' . $bools[$i] . '</option>';
            }
            $boolfield .= '</select>';
            return $boolfield;
        case 'memo':
        case 'simplememo':
            $str = '<textarea id="' . $field . '"' . ' rows="' . $fldinfo[3] . '" cols="' . ($fldinfo[6] ? $fldinfo[6] : '67') . '"' . ' name="' . $field . '"' . ($fldinfo[5] ? ' placeholder="' . $fldinfo[5] . '"' : '') . ' onkeypress="var lnfeed=/\\n/g;var lf=this.value.match(lnfeed);if(lf){lfn=lf.length;}else{lfn=0;}this.rows=(1+Math.floor(this.value.length/this.cols)+lfn);"' . '>' . $value . '</textarea>';
            return $str;
            break;
        case 'date':
            preg_match_all('%([0-9]+)%', $value, $datevalues);
            $datefields = mx_formfield($field . '_d', $datevalues[1][2], array(1, $datevalues[1][2], 'integer', 2, '', 'DD')) . '&nbsp;' . mx_formfield($field . '_m', $datevalues[1][1], array(1, $datevalues[1][0], 'month')) . '&nbsp;' . mx_formfield($field . '_y', $datevalues[1][0], array(1, $datevalues[1][0], 'integer', 4, '', 'YYYY'));
            return $datefields;
            break;
        case 'month':
            global $months;
            $monthfield = '<select name="' . $field . '">';
            for ($i = 0; $i < 13; $i++) {
                $monthfield .= '<option value="' . $i . '"' . ($value == $i ? ' selected' : '') . '>' . $months[$i] . '</option>';
            }
            $monthfield .= '</select>';
            return $monthfield;
            break;
        case 'mediastatus':
            global $mediastatuses;
            if ($value == MXMEDIAVIRTUAL) {
                return _('This is a virtual bundle. Status cannot be changed.') . '<input type="hidden" name="' . $field . '" value="' . $value . '">';
            }
            $statusfield = '<select name="' . $field . '">';
            foreach ($mediastatuses as $i => $mediastatus) {
                if ($i > MXMEDIANEW && $i < MXMEDIASUSPENDED && $i != MXMEDIAMEMBERVISIBLE) {
                    $statusfield .= '<!-- ' . $i . ' --><option value="' . $i . '"' . ($value == $i ? ' selected' : '') . '>' . $mediastatus . '</option>';
                }
            }
            $statusfield .= '</select>';
            return $statusfield;
            break;
        case 'bundlestatus':
            global $mediastatuses;
            if ($value == MXMEDIAVIRTUAL) {
                return _('This is a virtual bundle. Status cannot be changed.') . '<input type="hidden" name="' . $field . '" value="' . $value . '">';
            }
            $statusfield = '<fieldset class="bundlestatus">';
            foreach ($mediastatuses as $i => $mediastatus) {
                if ($i >= MXMEDIAFANVISIBLE && $i < MXMEDIASUSPENDED && $i != MXMEDIAMEMBERVISIBLE || $i == MXMEDIAARCHIVED && ($value >= MXMEDIAFANVISIBLE && $value < MXMEDIASUSPENDED || $value == MXMEDIAARCHIVED) || $i == MXMEDIAREADY && $value == MXMEDIAREADY || $i == MXMEDIANEW && $value == MXMEDIANEW) {
                    $statusfield .= '<input type="radio" name="' . $field . '" id="st_' . $i . '" value="' . $i . '"' . ($value == $i ? ' checked' : '') . ' onclick="javascript:return changestatus(\'' . $field . '\',' . $value . ',' . $i . ');">' . '<label for="st_' . $i . '">' . sprintf($i == MXMEDIAPUBLIC ? '<b>%s</b>' : '%s', $mediastatus) . '</label><br/>';
                }
            }
            $statusfield .= '</fieldset>';
            return $statusfield;
            break;
        case 'locale':
            global $languages;
            $langfield = '<select name="' . $field . '">';
            foreach ($languages as $lcode => $lname) {
                $langfield .= '<option value="' . $lcode . '"' . ($value == $lcode ? ' selected' : '') . '>' . $lname . '</option>';
            }
            $langfield .= '</select>';
            return $langfield;
            break;
        case 'gender':
            global $genders;
            $genfield = '<select name="' . $field . '">';
            foreach ($genders as $i => $gender) {
                $genfield .= '<option value="' . $i . '"' . ($value == $i ? ' selected' : '') . '>' . $gender . '</option>';
            }
            $genfield .= '</select>';
            return $genfield;
            break;
        case 'privacy':
            global $privlevels;
            $col = 0;
            $privfield = '<table class="privacy"><tr>';
            foreach ($privlevels as $lname => $ldesc) {
                $privfield .= '<td><input type="checkbox" name="' . $field . '[]" value="' . $lname . '"';
                if (array_search($lname, $defaultprivacy)) {
                    $privfield .= ' disabled';
                }
                if (array_search($lname, explode(',', $value)) !== false || array_search($lname, $defaultprivacy)) {
                    $privfield .= ' checked';
                }
                $privfield .= '>' . $ldesc . (array_search($lname, $defaultprivacy) ? '<span class="mandatory"><sup>*</sup></span>' : '') . '</td>';
                $col = ++$col % 3;
                if (!$col) {
                    $privfield .= '</tr><tr>';
                }
            }
            $privfield .= '</tr></table>';
            $privfield .= '<span class="mandatoryhelp"><sup>*</sup>' . _('This information is always visible') . '</span>';
            return $privfield;
            break;
        case 'sharefilter':
            global $sharefilters;
            $col = 0;
            $filter = '<table class="sharefilter"><tr>';
            foreach ($sharefilters as $bit => $desc) {
                $filter .= '<td><input type="checkbox" name="' . $field . '[]" value="' . $bit . '"';
                if (!$value && $bit == MXSHAREALL || $value & $bit) {
                    $filter .= ' checked';
                }
                if ($bit == MXSHAREALL) {
                    $filter .= ' onclick="javascript:shareall(this.form);"';
                } else {
                    $filter .= ' onclick="javascript:unshareall(this.form);"';
                }
                $filter .= '>' . $desc . '</td>';
                $col = ++$col % 5;
                if (!$col) {
                    $filter .= '</tr><tr>';
                }
            }
            $filter .= '</tr></table>';
            return $filter;
            break;
        case 'url':
            return '<input type="text" name="' . $field . '" value="' . $value . '"' . ($fldinfo[3] > 0 ? ' size="' . min($fldinfo[3], 40) . '"' : '') . '>';
            break;
        case 'script':
            return '<script>' . $value . '</script>';
            break;
        case 'submit':
            return '<input type="submit" name="' . $field . '" value="' . $value . '">';
            break;
            /* case 'paypal-ck':
            			return '<input type="image" ' .
            				'src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" ' .
            				'onclick="if (buttonclick(\'pp-'.$field.'\')) submit();">';
            			break; */
        /* case 'paypal-ck':
        			return '<input type="image" ' .
        				'src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" ' .
        				'onclick="if (buttonclick(\'pp-'.$field.'\')) submit();">';
        			break; */
        case 'button':
            if (!$value) {
                return '&nbsp;&mdash;&nbsp;';
            }
            /*if ($field=='ppckout')
            		return '<div class="checkout">-- OR --<br/><input type="image" ' .
            		'src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" ' .
            		'onclick="if (buttonclick(\''.$field.'\')) submit();"></div>';*/
            if ($field == "checkout" && (MXPAYPALSANDBOX == false || is_admin() || MXBETA)) {
                return '<div class="checkout">' . '<input type="image" ' . 'src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" ' . 'onclick="if (buttonclick(\'pp-' . $field . '\')) submit();">' . '</div>';
            }
            if (($field == 'confckout' || $field == 'canckout') && (MXPAYPALSANDBOX == false || is_admin() || MXBETA)) {
                return '<div class="' . $field . '">' . '<input type="button"' . ' name="' . $field . '" value="' . $value . '"' . ' onclick="if (buttonclick(\'' . $field . '\')) submit();"' . (strpos($field, '-') === 0 ? ' disabled' : '') . '>' . '</div>';
            }
            if (MXCHECKOUTOK == false && !is_admin() && ($field == 'checkout' || $field == 'confckout' || $field == 'canckout')) {
                return '<br/><b>[ Sorry, CHECKOUT is temporarily disabled. ]</b>';
            }
            if (strpos($field, '*') === 0) {
                if (!is_admin()) {
                    return '';
                } else {
                    $field = substr($field, 1);
                }
            }
            if (strpos($field, '+') === 0) {
                $btntype = 'submit';
                $field = substr($field, 1);
            } else {
                if ($field == 'clear') {
                    $btntype = 'reset';
                } else {
                    $btntype = 'button';
                }
            }
            return '<input type="' . $btntype . '"' . ' name="' . $field . '" value="' . $value . '"' . ' onclick="if (buttonclick(\'' . $field . '\')) submit();"' . (strpos($field, '-') === 0 ? ' disabled' : '') . '>';
            break;
        case 'reset':
            return '<input type="reset" name="' . $field . '" value="' . $value . '">';
            break;
        case 'file':
            return '<input type="file" name="' . $field . '" value="' . $value . '">';
            break;
        case 'fileuploader':
            return '<div id="fileuploader"></div>';
            break;
        case 'filetype':
            global $filetypes;
            // bundle types cannot be changed
            if ($value == MXMEDIABASEBUNDLE || $value == MXMEDIAREGULARBUNDLE) {
                return $filetypes[$value] . '<input type="hidden" name="' . $field . '" value="' . $value . '">';
            }
            $ftypefield = '<select name="' . $field . '">';
            foreach ($filetypes as $ftvalue => $filetype) {
                if ($ftvalue == MXMEDIABASEBUNDLE || $ftvalue == MXMEDIAREGULARBUNDLE) {
                    continue;
                }
                $ftypefield .= '<option value="' . $ftvalue . '"' . ($value == $ftvalue ? ' selected' : '') . '>' . $filetype . '</option>';
            }
            $ftypefield .= '</select>';
            return $ftypefield;
            break;
        case 'completion':
            global $completions;
            $fcomp = '<select name="' . $field . '">';
            foreach ($completions as $fcvalue => $completion) {
                $fcomp .= '<option value="' . $fcvalue . '"' . ($value == $fcvalue ? ' selected' : '') . '>' . $completion . '</option>';
            }
            $fcomp .= '</select>';
            return $fcomp;
            break;
        case 'background':
            $bgs = $mxuser->getbackgrounds();
            $bgfld = '<select name="' . $field . '" onchange="javascript:bgtest(this.value);">';
            $pics = "";
            while ($bgs && ($bg = $mxuser->getbackgrounds($bgs))) {
                $pics .= '<img class="hidden" id="bg_' . $bg->id . '" src="' . $mxuser->getbackgroundurl($bg) . '"/>';
                //$backgrounds[$bg->id]=$bg->title;
                $bgfld .= '<option value="' . $bg->id . '"';
                if ($bg->id == $mxuser->background_id) {
                    $bgfld .= ' selected';
                }
                $bgfld .= '>' . $bg->title . '</option>';
            }
            $bgfld .= '</select><div class="bgtest"><img id="bgpic" src="' . $mxuser->getbackgroundurl($mxuser->background_id) . '"/>' . $pics . '</div>';
            return $bgfld;
            break;
        case 'transparency':
            global $transparencies;
            /*$scr='<script language="javascript">
            		function settransp(trsp) {
            			var mysheets=document.styleSheets;
            			var i,j;
            			var targetrule;
            			for (i=0; i<mysheets.length; i++) {
            				var mysheet=mysheets[i];
            				var myrules=mysheet.cssRules?mysheet.cssRules:mysheet.rules;
            				for (j=0; i<myrules.length; i++){
            					if(myrules[i].selectorText.toLowerCase()=="div.whitebg"){
            						targetrule=myrules[i]
            						break;
            					}
            				}
            			}
            			opt=100-trsp;' .
            					'targetrule.style.background="'.mx_option('siteurl').'/images/background/white-dot-"+opt+".png";' .
            					'alert(targetrule);
            		}
            		</script>';*/
            $trspfield = '<select name="' . $field . '">';
            foreach ($transparencies as $trvalue => $trdesc) {
                $trspfield .= '<option value="' . $trvalue . '"' . ($value == $trvalue ? ' selected' : '') . '>' . $trdesc . '</option>';
            }
            $trspfield .= '</select>';
            return $trspfield;
        case 'bandrole':
            global $bandroles;
            if ($value == null) {
                $value = MXBANDROLENONE;
            }
            $rolefield = '<select name="' . $field . '">';
            foreach ($bandroles as $rolecode => $rolename) {
                $rolefield .= '<option value="' . $rolecode . '"' . ($value == $rolecode ? ' selected' : '') . '>' . $rolename . '</option>';
            }
            $rolefield .= '</select>';
            return $rolefield;
            break;
        case 'user':
            if (preg_match('%^([0-9]+)$%', $value) > 0) {
                $userinfo = $mxuser->getuserinfo($value);
                return '<input type="text" id="' . $field . '" name="' . $field . '" value="' . mx_getname($userinfo) . '"' . ($fldinfo[3] > 0 ? ' size="' . min($fldinfo[3], 40) . '"' : '') . ' placeholder="' . _('Recipient Name') . '"' . ' onkeyup="return quicksearch(event,this,\'' . $field . '\');"' . ' onblur="return quicksearch(event,this,\'' . $field . '\');">' . ' <input type="hidden" id="h_' . $field . '" name="h_' . $field . '" value="' . $value . '">' . '<div id="to_icon">' . mx_icon('ok') . '</div>' . '<div class="usersearch" id="' . $field . '_search"></div>';
            }
            return '<input type="text" id="' . $field . '" name="' . $field . '" value="' . $value . '"' . ($fldinfo[3] > 0 ? ' size="' . min($fldinfo[3], 40) . '"' : '') . ' placeholder="' . _('Recipient Name') . '"' . ' onkeyup="return quicksearch(event,this,\'' . $field . '\');"' . ' onblur="return quicksearch(event,this,\'' . $field . '\');">' . ' <input type="hidden" id="h_' . $field . '" name="h_' . $field . '" value="">' . '<div id="to_icon" style="display:none;">' . mx_icon('ok') . '</div>' . '<div class="usersearch" id="' . $field . '_search"></div>';
            break;
        case 'subject':
            $disab = '';
            //($value?' disabled':'');
            return '<input id="' . $field . '" type="text" name="' . $field . '" value="' . $value . '"' . ' placeholder="' . _('Optional') . '"' . ($fldinfo[3] > 0 ? ' size="' . min($fldinfo[3], 40) . '"' : '') . $disab . '>';
            break;
        case 'picture':
            $str = '<div class="newpic"><img id="newpic" src="' . mx_fanpic($mxuser->id, 'large', $mxuser->gender, is_artist()) . '"/></div><ul id="piclist">';
            $str .= '<li><input type="radio" name="' . $field . '" value="' . $value . '" checked ' . ' onclick="var newpic=new Image(); newpic.src=\'' . mx_fanpic($mxuser->id, 'large', $mxuser->gender, is_artist()) . '\'; document.getElementById(\'newpic\').src=newpic.src;">' . _('Do not change') . '</li>';
            if ($mxuser->fbid && !$me) {
                $str .= '<li><input type="radio" name="' . $field . '" value="fb"' . ' onclick="var newpic=new Image(); newpic.src=\'http://graph.facebook.com/' . $mxuser->fbid . '/picture?type=large\'; document.getElementById(\'newpic\').src=newpic.src;">' . _('Update from Facebook') . '</li>';
            }
            if ($mxuser->fbid && $me) {
                $str .= '<li><input type="radio" name="' . $field . '" value="fb"' . ' onclick="var newpic=new Image(); newpic.src=\'http://graph.facebook.com/' . $mxuser->fbid . '/picture?type=large\'; document.getElementById(\'newpic\').src=newpic.src;">' . _('Update from Facebook') . '</li>';
            }
            $mypics = $mxuser->getpics();
            if ($mypics) {
                $str .= '<li><input type="radio" id="mediapic" name="' . $field . '" value=""' . ' onclick="var mp=document.getElementById(\'mediasel\');pictest(mp.value,\'' . $field . '\');">' . _('From My Media') . '<br/>';
                $picfld = '<select id="mediasel" name="' . $field . 'media" onchange="pictest(this.value,\'' . $field . '\');">';
                $pics = "";
                while ($pic = $mxuser->getpics($mypics)) {
                    $pics .= '<img class="hidden" id="pic_' . $pic->id . '" src="' . $mxuser->getpicurl($pic) . '"/>';
                    //$pictures[$pic->id]=$pic->title;
                    $picfld .= '<option value="' . $pic->id . '"';
                    //if ($pic->id==$mxuser->background_id) $picfld.=' selected';
                    $picfld .= '>' . $pic->title . '</option>';
                }
                $picfld .= '</select></li>' . $pics;
                $str .= $picfld;
            }
            $str .= '<li><div id="fileuploader"></div></li></ul>';
            return $str;
            break;
        case 'msgflags':
            $str = '';
            if ($value & MXFRIENDREQUEST) {
                $str .= _('Friendship');
            }
            return $str;
            break;
        case 'notif':
            global $notifs;
            $notiffield = '<select name="' . $field . '">';
            foreach ($notifs as $nvalue => $ntype) {
                $notiffield .= '<option value="' . $nvalue . '"' . ($value == $nvalue ? ' selected' : '') . '>' . $ntype . '</option>';
            }
            $notiffield .= '</select>';
            return $notiffield;
            break;
        default:
            return '[Unknown field/type: "' . $field . '" (' . $fldtype . ')] ' . $value;
            break;
    }
}
Beispiel #4
0
function mx_dropmenu()
{
    global $mx_dropmenu, $mxuser;
    $page = mx_secureword($_GET['p']);
    $option = mx_secureword($_GET['o']);
    $action = mx_securestring($_REQUEST['a']);
    if ($option == 'signin' || $option == 'register') {
        $tag = 'l';
    } else {
        if ($page == 'artists' && $option == 'artprof') {
            $tag = 'a:' . $action;
        } else {
            if ($page == 'fans' && $option == 'fanprof') {
                $tag = 'f:' . $action;
            } else {
                if ($page == 'account') {
                    $tag = 'p:' . $mxuser->id;
                } else {
                    if ($page == 'media' && $option == 'medprof') {
                        $tag = 'm:' . $action;
                    } else {
                        if ($page == '' || $page == 'main') {
                            $tag = 'l';
                        } else {
                            $tag = '';
                        }
                    }
                }
            }
        }
    }
    echo '<div class="dropmenu" tag="' . $tag . '"><ul>';
    foreach ($mx_dropmenu as $action => $actiondetails) {
        if (!$actiondetails[0] || $actiondetails[0] == 3 && is_logged() || $actiondetails[0] == 10 && is_artist()) {
            echo '<li>';
            if ($action == 'cartdrop' && $mxuser->cart->items) {
                echo '<div class="number"><div id="cartitems">' . $mxuser->cart->items . '</div></div>';
            } else {
                if ($action == 'maildrop' && $mxuser->newmsgs) {
                    echo '<div class="number"><div id="newmsgs">' . $mxuser->newmsgs . '</div></div>';
                } else {
                    if ($action == 'lovedrop' && $mxuser->subs['changed'] > 0) {
                        echo '<div class="number"><div id="newmsgs">' . $mxuser->subs['changed'] . '</div></div>';
                    }
                }
            }
            echo mx_icon($action, $actiondetails[1], 48, 'act_' . $action, $action . 'hover');
            echo '</li>';
        }
    }
    echo '</ul></div>';
}