function showsetting($setname, $varname, $value, $type = 'radio', $disabled = '', $hidden = 0, $comment = '', $extra = '', $setid = '') {
global $_G;
$s = "\n";
$check = array();
$check['disabled'] = $disabled ? ($disabled == 'readonly' ? ' readonly' : ' disabled') : '';
$check['disabledaltstyle'] = $disabled ? ', 1' : '';
$nocomment = false;
if(isset($_G['showsetting_multi'])) {
$hidden = 0;
if(is_array($varname)) {
$varnameid = '_'.str_replace(array('[', ']'), '_', $varname[0]).'|'.$_G['showsetting_multi'];
$varname[0] = preg_replace('/\w+new/', 'multinew['.$_G['showsetting_multi'].'][\\0]', $varname[0]);
} else {
$varnameid = '_'.str_replace(array('[', ']'), '_', $varname).'|'.$_G['showsetting_multi'];
$varname = preg_replace('/\w+new/', 'multinew['.$_G['showsetting_multi'].'][\\0]', $varname);
}
} else {
$varnameid = '';
}
if($type == 'radio') {
$value ? $check['true'] = "checked" : $check['false'] = "checked";
$value ? $check['false'] = '' : $check['true'] = '';
$check['hidden1'] = $hidden ? ' οnclick="$(\'hidden_'.$setname.'\').style.display = \'\';"' : '';
$check['hidden0'] = $hidden ? ' οnclick="$(\'hidden_'.$setname.'\').style.display = \'none\';"' : '';
$onclick = $disabled && $disabled == 'readonly' ? ' οnclick="return false"' : '';
$s .= '
- '.
'
'.cplang('yes').''.'
'.cplang('no').''.'
';} elseif($type == 'text' || $type == 'password' || $type == 'number') {
$s .= '';
} elseif($type == 'file') {
$s .= '';
} elseif($type == 'filetext') {
$defaulttype = $value ? 1 : 0;
$id = 'file'.random(2);
$s .= ''.
'
'.
''.cplang('switch_upload').' '.
} elseif($type == 'textarea') {
$readonly = $disabled ? 'readonly' : '';
$s .= "".dhtmlspecialchars($value)."";
} elseif($type == 'select') {
$s .= '';
foreach($varname[1] as $option) {
$selected = $option[0] == $value ? 'selected="selected"' : '';
if(empty($option[2])) {
$s .= "".$option[1]."\n";
} else {
$s .= "\n";
}
}
$s .= '';
} elseif($type == 'mradio' || $type == 'mradio2') {
$nocomment = $type == 'mradio2' && !isset($_G['showsetting_multi']) ? true : false;
$addstyle = $nocomment ? ' style="float: left; width: 18%"' : '';
$ulstyle = $nocomment ? ' style="width: 830px"' : '';
if(is_array($varname)) {
$radiocheck = array($value => ' checked');
$s .= '
- ';
foreach($varname[1] as $varary) {
if(is_array($varary) && !empty($varary)) {
$onclick = '';
if(!isset($_G['showsetting_multi']) && !empty($varary[2])) {
foreach($varary[2] as $ctrlid => $display) {
$onclick .= '$(\''.$ctrlid.'\').style.display = \''.$display.'\';';
}
}
$onclick && $onclick = ' οnclick="'.$onclick.'"';
$s .= '
'.$varary[1].'';}
}
$s .= '
';}
} elseif($type == 'mcheckbox' || $type == 'mcheckbox2') {
$nocomment = $type != 'mcheckbox2' && count($varname[1]) > 3 && !isset($_G['showsetting_multi']) ? true : false;
$addstyle = $nocomment ? ' style="float: left; width: 18%"' : '';
$ulstyle = $nocomment ? ' style="width: 830px"' : '';
$s .= '
- ';
foreach($varname[1] as $varary) {
if(is_array($varary) && !empty($varary)) {
$onclick = !isset($_G['showsetting_multi']) && !empty($varary[2]) ? ' οnclick="$(\''.$varary[2].'\').style.display = $(\''.$varary[2].'\').style.display == \'none\' ? \'\' : \'none\';"' : '';
$checked = is_array($value) && in_array($varary[0], $value) ? ' checked' : '';
$s .= '
'.$varary[1].'';}
}
$s .= '
';} elseif($type == 'binmcheckbox') {
$checkboxs = count($varname[1]);
$value = sprintf('%0'.$checkboxs.'b', $value);$i = 1;
$s .= '
- ';
foreach($varname[1] as $key => $var) {
$s .= '
'.$var.'';$i++;
}
$s .= '
';} elseif($type == 'omcheckbox') {
$nocomment = count($varname[1]) > 3 ? true : false;
$addstyle = $nocomment ? 'style="float: left; width: 18%"' : '';
$ulstyle = $nocomment ? 'style="width: 830px"' : '';
$s .= '
- ';
foreach($varname[1] as $varary) {
if(is_array($varary) && !empty($varary)) {
$checked = is_array($value) && $value[$varary[0]] ? ' checked' : '';
$s .= '
'.$varary[1].'';}
}
$s .= '
';} elseif($type == 'mselect') {
$s .= '';
foreach($varname[1] as $option) {
$selected = is_array($value) && in_array($option[0], $value) ? 'selected="selected"' : '';
if(empty($option[2])) {
$s .= "".$option[1]."\n";
} else {
$s .= "\n";
}
}
$s .= '';
} elseif($type == 'color') {
global $stylestuff;
$preview_varname = str_replace('[', '_', str_replace(']', '', $varname));
$code = explode(' ', $value);
$css = '';
for($i = 0; $i <= 1; $i++) {
if($code[$i] != '') {
if($code[$i]{0} == '#') {
$css .= strtoupper($code[$i]).' ';
} elseif(preg_match('/^http:\/\//i', $code[$i])) {
$css .= 'url(\''.$code[$i].'\') ';
} else {
$css .= 'url(\''.$stylestuff['imgdir']['subst'].'/'.$code[$i].'\') ';
}
}
}
$background = trim($css);
$colorid = ++$GLOBALS['coloridcount'];
$s .= "\n".
"\n$extra";
} elseif($type == 'calendar') {
$s .= "\n";
} elseif(in_array($type, array('multiply', 'range', 'daterange'))) {
$onclick = $type == 'daterange' ? ' οnclick="showcalendar(event, this)"' : '';
if(isset($_G['showsetting_multi'])) {
$varname[1] = preg_replace('/\w+new/', 'multinew['.$_G['showsetting_multi'].'][\\0]', $varname[1]);
}
$s .= "".($type == 'multiply' ? ' X ' : ' -- ')."";
} else {
$s .= $type;
}
$name = cplang($setname);
$name .= $name && substr($name, -1) != ':' ? ':' : '';
$name = $disabled ? ''.$name.'' : $name;
$setid = !$setid ? substr(md5($setname), 0, 4) : $setid;
$setid = isset($_G['showsetting_multi']) ? 'S'.$setid : $setid;
if(!empty($_G['showsetting_multirow'])) {
if(empty($_G['showsetting_multirow_n'])) {
echo '
';}
echo '
'.$name.'
'.$s.'';$_G['showsetting_multirow_n']++;
if($_G['showsetting_multirow_n'] == 2) {
if(empty($_G['showsetting_multirow_n'])) {
echo '
';}
$_G['showsetting_multirow_n'] = 0;
}
return;
}
if(!isset($_G['showsetting_multi'])) {
$faqurl = 'http://faq.comsenz.com?type=admin&ver='.$_G['setting']['version'].'&action='.rawurlencode($_GET['action']).'&operation='.rawurlencode($_GET['operation']).'&key='.rawurlencode($setname);
showtablerow('οnmοuseοver="setfaq(this, \'faq'.$setid.'\')"', 'colspan="2" class="td27" s="1"', $name.' ');
} else {
if(empty($_G['showsetting_multijs'])) {
$_G['setting_JS'] .= 'var ss = new Array();';
$_G['showsetting_multijs'] = 1;
}
if($_G['showsetting_multi'] == 0) {
showtablerow('', array('class="td27"'), array('
$_G['setting_JS'] .= 'ss[\'D'.$setid.'\'] = new Array();';
}
$name = preg_replace("/\r\n|\n|\r/", '\n', addcslashes($name, "'\\"));
$_G['setting_JS'] .= 'ss[\'D'.$setid.'\'] += \'
}
if(!$nocomment && ($type != 'omcheckbox' || $varname[2] != 'isfloat')) {
if(!isset($_G['showsetting_multi'])) {
showtablerow('class="noborder" οnmοuseοver="setfaq(this, \'faq'.$setid.'\')"', array('class="vtop rowform"', 'class="vtop tips2" s="1"'), array(
$s,
($comment ? $comment : cplang($setname.'_comment', false)).($type == 'textarea' ? '
'.cplang('tips_textarea') : '').
($disabled ? ''.cplang($setname.'_disabled', false).'' : NULL)
));
} else {
if($_G['showsetting_multi'] == 0) {
showtablerow('class="noborder"', array('class="vtop rowform" style="width:auto"'), array(
'
));
$_G['setting_JS'] .= 'ss[\''.$setid.'\'] = new Array();';
}
$s = preg_replace("/\r\n|\n|\r/", '\n', addcslashes($s, "'\\"));
$_G['setting_JS'] .= 'ss[\''.$setid.'\'] += \'
}
} else {
showtablerow('class="noborder" οnmοuseοver="setfaq(this, \'faq'.$setid.'\')"', array('colspan="2" class="vtop rowform"'), array($s));
}
if($hidden) {
showtagheader('tbody', 'hidden_'.$setname, $value, 'sub');
}
}