';
if($title) {
echo "\n".'';
showmultititle(1);
}
if(!$nobody) {
echo "\n".'
';
}
}
function showmultititle($nofloat = 0) {
global $_G;
if(isset($_G['showtableheader_multi']) && $_G['showsetting_multi'] == 0) {
$i = 0;
$rows = '';
foreach($_G['showtableheader_multi'] as $row) {
$i++;
$rows .= '
'.$row.'
';
}
if($nofloat) {
echo '
'.$rows.' |
';
} else {
echo '
'.$rows.'
';
echo '';
}
}
}
function showtagheader($tagname, $id, $display = FALSE, $classname = '') {
global $_G;
if(!empty($_G['showsetting_multi'])) {
return;
}
echo '<'.$tagname.(!isset($_G['showsetting_multi']) && $classname ? " class=\"$classname\"" : '').' id="'.$id.'"'.($display ? '' : ' style="display: none"').'>';
}
function showtitle($title, $extra = '', $multi = 1) {
global $_G;
if(!empty($_G['showsetting_multi'])) {
return;
}
echo "\n".'
'.cplang($title).' |
---|
';
if($multi) {
showmultititle(1);
}
}
function showboxtitle($title, $extra = '', $multi = 1) {
global $_G;
if(!empty($_G['showsetting_multi'])) {
return;
}
echo "\n".'';
}
function showsubtitle($title = array(), $rowclass='header', $tdstyle=array()) {
if(is_array($title)) {
$subtitle = "\n
";
foreach($title as $k => $v) {
if($v !== NULL) {
$subtitle .= ''.cplang($v).' | ';
}
}
$subtitle .= '
';
echo $subtitle;
}
}
function showtablerow($trstyle = '', $tdstyle = array(), $tdtext = array(), $return = FALSE) {
$rowswapclass = '';
if(!preg_match('/class\s*=\s*[\'"]([^\'"<>]+)[\'"]/i', $trstyle, $matches)) {
$rowswapclass = is_array($tdtext) && count($tdtext) > 2 ? ' class="hover"' : '';
} else {
if(is_array($tdtext) && count($tdtext) > 2) {
$rowswapclass = " class=\"{$matches[1]} hover\"";
$trstyle = preg_replace('/class\s*=\s*[\'"]([^\'"<>]+)[\'"]/i', '', $trstyle);
}
}
$cells = "\n".'
';
if(isset($tdtext)) {
if(is_array($tdtext)) {
foreach($tdtext as $key => $td) {
$cells .= ''.$td.' | ';
}
} else {
$cells .= ''.$tdtext.' | ';
}
}
$cells .= '
';
if($return) {
return $cells;
}
echo $cells;
}
function showboxrow($trstyle = '', $tdstyle = array(), $tdtext = array(), $return = FALSE) {
$rowswapclass = '';
if(preg_match('/class\s*=\s*[\'"]([^\'"<>]+)[\'"]/i', $trstyle, $matches)) {
$rowswapclass = $matches[1];
$trstyle = preg_replace('/class\s*=\s*[\'"]([^\'"<>]+)[\'"]/i', '', $trstyle);
}
if(is_array($tdtext) && count($tdtext) > 2) {
$rowswapclass .= ' hover';
}
$rowswapclass = ' class="drow'.($rowswapclass?(' '.$rowswapclass):'').'"';
$cells = "\n".'
';
if(isset($tdtext)) {
if(is_array($tdtext)) {
foreach($tdtext as $key => $td) {
$cells .= '
'.$td.'
';
}
} else {
$cells .= '
'.$tdtext.'
';
}
}
$cells .= '
';
if($return) {
return $cells;
}
echo $cells;
}
function showboxbody($class = '', $text = '', $extra = '') {
echo '
'.$text.'
';
}
function showsetting($setname, $varname, $value, $type = 'radio', $disabled = '', $hidden = 0, $comment = '', $extra = '', $setid = '', $nofaq = false, $inbox = 0) {
global $_G;
$s = "\n";
$check = array();
$noborder = false;
if(is_array($disabled)) {
$hidden = $disabled['hidden'];
$comment = $disabled['comment'];
$extra = $disabled['extra'];
$setid = $disabled['setid'];
$nofaq = $disabled['nofaq'];
$inbox = $disabled['inbox'];
$disabled = $disabled['disabled'];
}
if(substr($disabled, 0, 8) == 'noborder') {
$disabled = trim(substr($disabled, 8));
$noborder = 'class="noborder" ';
}
$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 ? ' onclick="$(\'hidden_'.$setname.'\').style.display = \'\';"' : '';
$check['hidden0'] = $hidden ? ' onclick="$(\'hidden_'.$setname.'\').style.display = \'none\';"' : '';
$onclick = $disabled && $disabled == 'readonly' ? ' onclick="return false"' : ($extra ? $extra : '');
$s .= '
';
} elseif($type == 'text' || $type == 'password' || $type == 'number') {
$s .= '
';
} elseif($type == 'htmltext') {
$id .= 'html'.random(2);
$s .= '
'.$value.'
';
} elseif($type == 'file') {
$s .= '
';
} elseif($type == 'filetext') {
$defaulttype = $value ? 1 : 0;
$id = 'file'.random(2);
$s .= '
'.
'
'.
'
'.cplang('switch_upload').' '.
'
'.cplang('switch_url').'';
} elseif($type == 'textarea') {
$readonly = $disabled ? 'readonly' : '';
$s .= "
";
} elseif($type == 'select') {
$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: 900px"' : '';
if(is_array($varname)) {
$radiocheck = array($value => ' checked');
$s .= '
';
}
} elseif($type == 'mcheckbox' || $type == 'mcheckbox2') {
$nocomment = $type != 'mcheckbox2' && count($varname[1]) > 3 && !isset($_G['showsetting_multi']) ? true : false;
$addstyle = $nocomment ? ' style="float: left;'.(empty($_G['showsetting_multirow']) ? ' width: 18%;overflow: hidden;' : '').'"' : '';
$ulstyle = $nocomment && empty($_G['showsetting_multirow']) ? ' style="width: 900px"' : '';
$s .= '
';
} elseif($type == 'binmcheckbox') {
$checkboxs = count($varname[1]);
$value = sprintf('%0'.$checkboxs.'b', $value);$i = 1;
$s .= '
';
} elseif($type == 'omcheckbox') {
$nocomment = count($varname[1]) > 3 ? true : false;
$addstyle = $nocomment ? 'style="float: left; width: 18%"' : '';
$ulstyle = $nocomment ? 'style="width: 900px"' : '';
$s .= '
';
} elseif($type == 'mselect') {
$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('/^(https?:)?\/\//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' ? ' onclick="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) {
echo '
';
$_G['showsetting_multirow_n'] = 0;
}
return;
}
if(!isset($_G['showsetting_multi'])) {
if($inbox) {
echo '
'.$name.'
';
} else {
showtablerow('', '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.'\'] += \'
'.$name.'
\';';
}
if(!$nocomment && ($type != 'omcheckbox' || $varname[2] != 'isfloat')) {
if(!isset($_G['showsetting_multi'])) {
if($inbox) {
echo '
'.$s.'
'.($comment ? $comment : cplang($setname.'_comment', false)).($type == 'textarea' ? '
'.cplang('tips_textarea') : '').
($disabled ? '
'.cplang($setname.'_disabled', false).'' : NULL).'
';
} else {
showtablerow('class="noborder" onmouseover="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.'\'] += \'
'.$s.'
\';';
}
} else {
showtablerow('class="noborder" onmouseover="setfaq(this, \'faq'.$setid.'\')"', array('colspan="2" class="vtop rowform"'), array($s));
}
if($hidden) {
showtagheader('tbody', 'hidden_'.$setname, $value, 'sub');
}
}
function showmulti() {
global $_G;
$_G['setting_JS'] .= <<
';
if(is_array($items)) {
foreach($items as $value => $item) {
$list .= ' '.$item.'';
}
}
$list .= '';
return $list;
}
function mcheckbox($name, $items = array(), $checked = array()) {
$list = '';
return $list;
}
function showsubmit($name = '', $value = 'submit', $before = '', $after = '', $floatright = '', $entersubmit = true) {
global $_G;
if(!empty($_G['showsetting_multi'])) {
return;
}
$str = '';
$str .= $name && in_array($before, array('del', 'select_all', 'td')) ? ''.($before != 'td' ? '' : '').' | ' : '';
$str .= '';
$str .= $floatright ? ' '.$floatright.' ' : '';
$str .= '';
$str .= $before && !in_array($before, array('del', 'select_all', 'td')) ? $before.' ' : '';
$str .= $name ? '' : '';
$after = $after == 'more_options' ? '' : $after;
$str = $after ? $str.(($before && $before != 'del') || $name ? ' ' : '').$after : $str;
$str .= ' | ';
$str .= '
';
echo $str.($name && $entersubmit ? '' : '');
}
function showtagfooter($tagname) {
global $_G;
if(!empty($_G['showsetting_multi'])) {
return;
}
echo ''.$tagname.'>';
}
function showtablefooter() {
global $_G;
if(!empty($_G['showsetting_multi'])) {
return;
}
echo '