2020-03-09 22:16:54 +01:00
< ? php
require ( 'include/glob.php' );
require ( 'include/muoribene.php' );
require ( 'include/sessionstart.php' );
require ( 'include/myconn.php' );
2020-04-05 22:45:21 +02:00
require ( 'include/getadmacc.php' );
if ( $account [ 'Level' ] != 'guest' ) {
require ( 'include/menu.php' );
$menu [ 'istanze' ][ 'href' ] = null ;
$menu [ 'istanze' ][ 'selected' ] = true ;
$menu [ 'istanze' ][ 'submenu' ][ 'modifica' ][ 'href' ] = null ;
$menu [ 'istanze' ][ 'submenu' ][ 'modifica' ][ 'selected' ] = true ;
buildmenu ( $menu );
} else {
$menuout = '' ;
}
2020-03-09 22:16:54 +01:00
$dbg = '' ;
use function mysqli_real_escape_string as myesc ;
// praticamente una macro
function hspech ( $str ) {
return ( htmlspecialchars ( $str , ENT_QUOTES | ENT_HTML5 , 'UTF-8' ));
}
2020-04-04 19:17:10 +02:00
$dbg .= $dlang . '<br>' . N ;
2020-03-24 23:22:07 +01:00
$dbg .= '<pre>' . print_r ( $_GET , 1 ) . '</pre>' ;
2020-03-09 22:16:54 +01:00
2020-03-24 23:22:07 +01:00
if ( array_key_exists ( 'id' , $_GET ) && preg_match ( '/^[0-9]+$/' , $_GET [ 'id' ]) === 1 ) {
2020-04-05 22:45:21 +02:00
$_GET [ 'id' ] += 0 ;
if ( $account [ 'Level' ] == 'guest' && ! in_array ( $_GET [ 'id' ], $account [ 'Insts' ]))
muoribene ( 'You can’ t edit data for an instance you don’ t own.' , true );
2020-03-24 23:22:07 +01:00
$res = mysqli_query ( $link , 'SELECT * FROM Instances WHERE ID=' . $_GET [ 'id' ])
2020-04-03 10:59:02 +02:00
or muoribene ( __LINE__ . ': ' . mysqli_error ( $link ), true );
2020-03-24 23:22:07 +01:00
if ( mysqli_num_rows ( $res ) != 1 )
2020-04-05 22:45:21 +02:00
muoribene ( __LINE__ . ': There is no instance with ID=' . $_GET [ 'ID' ] . '.' , true );
2020-03-24 23:22:07 +01:00
$inst = mysqli_fetch_assoc ( $res );
2020-04-05 22:45:21 +02:00
} else {
muoribene ( 'Malformed input.' , true );
2020-03-24 23:22:07 +01:00
}
2020-04-07 19:39:06 +02:00
$dbg .= '<pre>' . print_r ( $inst , 1 ) . '</pre>' . N ;
2020-03-09 22:16:54 +01:00
2020-03-24 23:22:07 +01:00
function check ( $row , $col ) {
if ( $row [ $col ] > 0 )
2020-04-05 22:45:21 +02:00
return ( ' checked' );
else
return ( '' );
2020-03-24 23:22:07 +01:00
}
2020-03-09 22:16:54 +01:00
?>
<! DOCTYPE HTML >
2020-04-03 10:59:02 +02:00
< html lang = " en " >
2020-03-09 22:16:54 +01:00
< head >
2020-04-03 10:59:02 +02:00
< title > Mastodon Startpage Admin - Editing « < ? php echo ( $inst [ 'URI' ]); ?> » form</title>
2020-03-09 22:16:54 +01:00
< meta http - equiv = " Content-Type " content = " text/html; charset=utf-8 " >
< meta name = " description " content = " Admin pages for Mastodon Startpage " >
< meta name = " viewport " content = " width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no " >
< link rel = " icon " type = " image/png " href = " imgs/icona-32.png " sizes = " 32x32 " >
< link rel = " icon " type = " image/png " href = " imgs/icona-192.png " sizes = " 192x192 " >
< link rel = " icon " type = " image/png " href = " imgs/icona-512.png " sizes = " 512x512 " >
< link rel = " apple-touch-icon-precomposed " href = " imgs/icona-180.png " >
2020-03-11 17:25:06 +01:00
< script language = " JavaScript " src = " js/menu.js?v=<?php echo( $cjrand ); ?> " ></ script >
2020-03-09 22:16:54 +01:00
< script language = " JavaScript " src = " js/confirma.js?v=<?php echo( $cjrand ); ?> " ></ script >
< script language = " JavaScript " src = " js/alerta.js?v=<?php echo( $cjrand ); ?> " ></ script >
< link rel = " stylesheet " type = " text/css " href = " theme.css?v=<?php echo( $cjrand ); ?> " >
< script language = " JavaScript " >
<!--
2020-03-24 23:22:07 +01:00
function getselarr ( selid ) {
2020-04-03 10:59:02 +02:00
var sel = document . getElementById ( selid ), selc = sel . length , i , arr = [];
for ( i = 0 ; i < selc ; i ++ )
arr . push ([ sel . options [ i ] . text , sel . options [ i ] . value , sel . options [ i ] . selected ]);
return arr ;
}
function updselarr ( selid , selarr ) {
var sel = document . getElementById ( selid ), selc = sel . length , selarrc = selarr . length , i , ii ;
sel = sel . options ;
ii = 0 ;
2020-03-24 23:22:07 +01:00
for ( i = 0 ; i < selc ; i ++ ) {
2020-04-03 10:59:02 +02:00
while ( ii < selarrc ) {
if ( selarr [ ii ][ 1 ] == sel [ i ] . value ) {
( sel [ i ] . selected ) ? selarr [ ii ][ 2 ] = true : selarr [ ii ][ 2 ] = false ;
break ;
}
ii ++ ;
}
2020-03-24 23:22:07 +01:00
}
2020-04-03 10:59:02 +02:00
return selarr ;
2020-03-24 23:22:07 +01:00
}
function filtsel ( selarr , filt , selid , recbid , inpid , ocol , ecol ) {
var sel = document . getElementById ( selid ), selarrc = selarr . length , i , ii , go = true ;
if ( ! document . getElementById ( recbid ) . checked ) {
filt = filt . replace ( / ([ . ? *+^ $ [ \ ] \\ (){} |- ]) / g , '\\$1' );
} else {
try { ( RegExp ( filt )); }
catch ( e ) { go = false ; }
}
if ( go ) {
sel . length = 0 ;
for ( i = 0 ; i < selarrc ; i ++ ) {
if ( RegExp ( filt , 'i' ) . test ( selarr [ i ][ 0 ]))
sel . options . add ( new Option ( selarr [ i ][ 0 ], selarr [ i ][ 1 ], false , selarr [ i ][ 2 ]));
}
if ( ocol != null )
document . getElementById ( inpid ) . style . backgroundColor = ocol ;
} else if ( ecol != null ) {
document . getElementById ( inpid ) . style . backgroundColor = ecol ;
}
}
function selup ( selid ) {
var sel = document . getElementById ( selid ), len = sel . length , i , prevopt , curopt ;
if ( sel . selectedIndex > 0 ) {
for ( i = 0 ; i < len ; i ++ ) {
if ( sel . options [ i ] . selected ) {
prevopt = sel . options [ i - 1 ];
curopt = sel . options [ i ];
sel . remove ( i - 1 );
sel . remove ( i - 1 );
sel . add ( curopt , i - 1 );
sel . add ( prevopt , i );
}
}
}
}
function seltop ( selid ) {
var sel = document . getElementById ( selid );
while ( sel . selectedIndex > 0 )
selup ( selid );
}
function seldown ( selid ) {
var sel = document . getElementById ( selid ), len = sel . length , i , nextopt , curopt ;
if ( ! sel . options [ len - 1 ] . selected ) {
for ( i = len - 1 ; i >- 1 ; i -- ) {
if ( sel . options [ i ] . selected ) {
curopt = sel . options [ i ];
nextopt = sel . options [ i + 1 ];
sel . remove ( i );
sel . remove ( i );
sel . add ( curopt , i );
sel . add ( nextopt , i );
}
}
}
}
function selbot ( selid ) {
var sel = document . getElementById ( selid ), len = sel . length ;
if ( sel . selectedIndex >= 0 ) {
while ( ! sel . options [ len - 1 ] . selected )
seldown ( selid );
}
}
2020-04-03 10:59:02 +02:00
function rmelbyval ( refarr , val ) {
2020-03-24 23:22:07 +01:00
var len = refarr . length , i ;
for ( i = len - 1 ; i >- 1 ; i -- ) {
2020-04-03 10:59:02 +02:00
if ( refarr [ i ][ 1 ] == val ) {
2020-03-24 23:22:07 +01:00
refarr . splice ( i , 1 );
2020-04-03 10:59:02 +02:00
break ;
}
}
return refarr ;
}
// usato da edinsth.php
function cheltxtbyval ( refarr , val , ntxt ) {
var len = refarr . length , i ;
for ( i = len - 1 ; i >- 1 ; i -- ) {
if ( refarr [ i ][ 1 ] == val ) {
refarr [ i ][ 0 ] = ntxt ;
break ;
}
}
return refarr ;
}
// usato da edinsth.php
function chelvalbyval ( refarr , val , nval ) {
var len = refarr . length , i ;
for ( i = len - 1 ; i >- 1 ; i -- ) {
if ( refarr [ i ][ 1 ] == val ) {
refarr [ i ][ 1 ] = nval ;
break ;
}
2020-03-24 23:22:07 +01:00
}
return refarr ;
}
function seladd ( fromselid , toselid , refarr ) {
var fromsel = document . getElementById ( fromselid ), fslen = fromsel . length , tosel = document . getElementById ( toselid ), i ;
// farlo a scalare invece che a crescere inverte nella select di destinazione l'ordine delle opzioni scelte in quella di origine, perciò lo faccio a crescere
for ( i = 0 ; i < fslen ; i ++ ) {
if ( fromsel . options [ i ] . selected ) {
2020-04-03 10:59:02 +02:00
refarr = rmelbyval ( refarr , fromsel . options [ i ] . value );
2020-03-24 23:22:07 +01:00
tosel . add ( fromsel . options [ i ]);
fslen -- ;
i -- ;
}
}
return refarr ;
}
function sortByKey ( array , key ) {
return array . sort ( function ( a , b ) {
2020-04-03 10:59:02 +02:00
var x = a [ key ] . toLowerCase (); var y = b [ key ] . toLowerCase ();
2020-03-24 23:22:07 +01:00
return (( x < y ) ? - 1 : (( x > y ) ? 1 : 0 ));
});
}
2020-04-03 10:59:02 +02:00
function selrem ( fromselid , toselid , refarr , searchid , regexcbid ) {
2020-03-24 23:22:07 +01:00
var fromsel = document . getElementById ( fromselid ), fslen = fromsel . length , tosel = document . getElementById ( toselid ), i ;
for ( i = fslen - 1 ; i >- 1 ; i -- ) {
if ( fromsel . options [ i ] . selected ) {
refarr . push ([ fromsel . options [ i ] . text , fromsel . options [ i ] . value , true ]);
fromsel . remove ( i );
}
}
refarr = sortByKey ( refarr , 0 );
2020-04-03 10:59:02 +02:00
filtsel ( refarr , document . getElementById ( searchid ) . value , toselid , regexcbid , searchid , 'white' , '#ff8080' );
2020-03-24 23:22:07 +01:00
return refarr ;
}
function selordalf ( selid ) {
var sel = document . getElementById ( selid ), len = sel . length , arr = [], i ;
for ( i = 0 ; i < len ; i ++ )
arr . push ([ sel . options [ i ] . text , sel . options [ i ] . value , sel . options [ i ] . selected ]);
arr = sortByKey ( arr , 0 );
sel . length = 0 ;
for ( i = 0 ; i < len ; i ++ )
sel . add ( new Option ( arr [ i ][ 0 ], arr [ i ][ 1 ], false , arr [ i ][ 2 ]));
}
function selordinv ( selid ) {
var sel = document . getElementById ( selid ), len = sel . length , arr = [], i ;
for ( i = 0 ; i < len ; i ++ )
arr . push ([ sel . options [ i ] . text , sel . options [ i ] . value , sel . options [ i ] . selected ]);
arr = arr . reverse ();
sel . length = 0 ;
for ( i = 0 ; i < len ; i ++ )
sel . add ( new Option ( arr [ i ][ 0 ], arr [ i ][ 1 ], false , arr [ i ][ 2 ]));
}
function closeinpup () {
document . getElementById ( 'inpopup' ) . innerHTML = '<div id="popupcont">...</div>' ;
document . getElementById ( 'popup' ) . style . display = 'none' ;
}
function edit ( selid , what , mode ) {
var act = '' , id = 0 ;
if ( mode == 'edit' )
2020-04-03 10:59:02 +02:00
act = { 0 : 'Editing' , 1 : 'edit' };
2020-03-24 23:22:07 +01:00
else if ( mode == 'add' )
2020-04-03 10:59:02 +02:00
act = { 0 : 'Adding' , 1 : 'add' };
2020-03-24 23:22:07 +01:00
else if ( mode == 'remove' )
2020-04-03 10:59:02 +02:00
act = { 0 : 'Removing' , 1 : 'remove' };
2020-03-24 23:22:07 +01:00
var sel = document . getElementById ( selid );
if (( mode == 'edit' || mode == 'remove' ) && sel . selectedIndex < 0 ) {
2020-04-03 10:59:02 +02:00
alerta ( '<p>You have to select an entry to ' + act [ 1 ] + ' ;-)</p>' , true );
2020-03-24 23:22:07 +01:00
} else {
if ( mode == 'edit' || mode == 'remove' )
id = sel . options [ sel . selectedIndex ] . value ;
2020-04-03 10:59:02 +02:00
document . getElementById ( 'inpopup' ) . innerHTML = '<div class="hiftit"><img src="imgs/p.png" style="float:left;width:24px;height:24px">' + act [ 0 ] + ' «' + what + '» entry<img src="imgs/close.svg" class="imgbut" style="float:right;" onclick="closeinpup()"></div><iframe src="edinsth.php?w=' + selid + '&i=' + id + '&m=' + mode + '" class="hiframe"></iframe>' ;
2020-03-24 23:22:07 +01:00
document . getElementById ( 'popup' ) . style . display = 'table' ;
}
2020-03-09 22:16:54 +01:00
}
2020-04-03 10:59:02 +02:00
function ckf () {
var selids = [ 'ChosenLangs[]' , 'ChosenFinModes[]' , 'ChosenPolicies[]' , 'ChosenTags[]' ], len = selids . length , i , sel , ii ;
for ( i = 0 ; i < len ; i ++ ) {
sel = document . getElementById ( selids [ i ]) . options ;
for ( ii = 0 ; ii < sel . length ; ii ++ )
sel [ ii ] . selected = true ;
}
document . getElementById ( 'f' ) . submit ();
}
2020-03-09 22:16:54 +01:00
//-->
</ script >
</ head >
< body >
< nav >
< div id = " hmenu " >
< ul >
< ? php echo ( $menuout ); ?>
</ ul >
2020-04-07 19:39:06 +02:00
< div class = " mtit " > Editing « < ? php echo ( $inst [ 'URI' ]); ?> »</div>
2020-03-09 22:16:54 +01:00
< div id = " rightdiv " >
2020-04-03 10:59:02 +02:00
< a href = " logout.php " class = " rlinks " >< img src = " imgs/esci.svg " title = " Sign out " ></ a >
2020-03-09 22:16:54 +01:00
</ div >
2020-03-24 23:22:07 +01:00
</ div >
2020-03-09 22:16:54 +01:00
</ nav >
< div id = " popup " >
< div id = " inpopup " >
< div id = " popupcont " >
...
</ div >
</ div >
</ div >
<!-- < div id = " footer " >
</ div > -->
< div id = " fullscreen " >
< div id = " middlerow " >
2020-03-24 23:22:07 +01:00
2020-04-03 10:59:02 +02:00
< form action = " edinstres.php " method = " post " id = " f " onsubmit = " return ckf(); " >
< input type = " hidden " id = " id " name = " id " value = " <?php echo( $_GET['id'] +0); ?> " >
2020-03-09 22:16:54 +01:00
< table class = " edtab " >
2020-03-24 23:22:07 +01:00
< tr >< td class = " insthead " >< ? php echo ( $inst [ 'URI' ]); ?> </td></tr>
2020-03-09 22:16:54 +01:00
< tr >< td >
2020-03-24 23:22:07 +01:00
2020-04-05 22:45:21 +02:00
< ? php
if ( $account [ 'Level' ] != 'guest' )
echo ( ' < table class = " cbtab " >
< tr >< td >< label for = " Blacklisted " > Blacklisted :</ label ></ td >< td >& nbsp ; < input type = " checkbox " name = " Blacklisted " id = " Blacklisted " '.check($inst,' Blacklisted ').' ></ td ></ tr >
< tr >< td >< label for = " New " > New :</ label ></ td >< td >& nbsp ; < input type = " checkbox " name = " New " id = " New " '.check($inst,' New ').' ></ td ></ tr >
< tr >< td >< label for = " Chosen " > Chosen :</ label ></ td >< td >& nbsp ; < input type = " checkbox " name = " Chosen " id = " Chosen " '.check($inst,' Chosen ').' ></ td ></ tr >
< tr >< td >< label for = " Visible " > Visible :</ label ></ td >< td >& nbsp ; < input type = " checkbox " name = " Visible " id = " Visible " '.check($inst,' Visible ').' ></ td ></ tr >
2020-03-11 08:43:56 +01:00
</ table >
2020-04-05 22:45:21 +02:00
< div class = " ruler " ></ div > ' . N );
?>
2020-03-24 23:22:07 +01:00
2020-04-03 10:59:02 +02:00
< div class = " tit " >< label for = " OurDesc " > Our description ( original language ) </ label ></ div >
2020-03-24 23:22:07 +01:00
< textarea name = " OurDesc " id = " OurDesc " rows = " 10 " class = " tarea " >< ? php echo ( hspech ( $inst [ 'OurDesc' ])); ?> </textarea>
2020-03-11 08:43:56 +01:00
< div class = " ruler " ></ div >
2020-04-05 22:45:21 +02:00
2020-04-04 19:17:10 +02:00
< div class = " tit " >< label for = " OurDescEN " > Our description ( english ) </ label ></ div >
< textarea name = " OurDescEN " id = " OurDescEN " rows = " 10 " class = " tarea " >< ? php echo ( hspech ( $inst [ 'OurDescEN' ])); ?> </textarea>
2020-03-24 23:22:07 +01:00
< ? php
2020-04-03 10:59:02 +02:00
function selbox ( $o ) {
2020-03-24 23:22:07 +01:00
global $link ;
2020-04-03 10:59:02 +02:00
( $o [ 'multi' ]) ? $seladdprops = ' multiple' : $seladdprops = ' name="' . $o [ 'dispselid' ] . '"' ;
2020-03-24 23:22:07 +01:00
echo ( ' < div class = " ruler " ></ div >
< div class = " tit " >< label for = " '. $o['dispselid'] .' " > '.$o[' title '].' </ label ></ div >
< table class = " picktab " >< tr >
2020-04-03 10:59:02 +02:00
< td style = " width:98% " >< input type = " text " placeholder = " Filter ... " class = " search " title = " '. $o['searchtit'] .' " id = " '. $o['searchid'] .' " onkeyup = " filtsel('. $o['disparr'] .', this.value, \ ''. $o['dispselid'] .' \ ', \ ''. $o['regexcbid'] .' \ ', \ ''. $o['searchid'] .' \ ', \ 'white \ ', \ '#ff8080 \ ') " ></ td >
< td style = " width:1%;padding-left:3px;padding-right:3px; " >< label for = " '. $o['regexcbid'] .' " title = " Use regular espression " > RegEx :</ label ></ td >
< td style = " width:1% " >< input type = " checkbox " id = " '. $o['regexcbid'] .' " style = " float:right; " title = " Use regular espression " onchange = " filtsel('. $o['disparr'] .', document.getElementById( \ ''. $o['searchid'] .' \ ').value, \ ''. $o['dispselid'] .' \ ', \ ''. $o['regexcbid'] .' \ ', \ ''. $o['searchid'] .' \ ', \ 'white \ ', \ '#ff8080 \ ') " ></ td >
2020-03-24 23:22:07 +01:00
</ tr ></ table >
2020-03-11 08:43:56 +01:00
< table class = " picktab " >
< tr >
< td style = " width:99%; " >
2020-04-03 10:59:02 +02:00
< select id = " '. $o['dispselid'] .' " '.$seladdprops.' size = " 8 " class = " mselect " onchange = " '. $o['disparr'] .'=updselarr( \ ''. $o['dispselid'] .' \ ','. $o['disparr'] .') " > ' . N );
2020-03-24 23:22:07 +01:00
$res = mysqli_query ( $link , $o [ 'dispque' ])
2020-04-03 10:59:02 +02:00
or muoribene ( __LINE__ . ': ' . mysqli_error ( $link ), true );
2020-03-24 23:22:07 +01:00
while ( $row = mysqli_fetch_assoc ( $res )) {
2020-04-03 10:59:02 +02:00
$selected = '' ;
if ( ! $o [ 'multi' ] && $row [ $o [ 'valcol' ]] == $o [ 'instselid' ]) $selected = ' selected' ;
echo ( '<option value="' . $row [ $o [ 'valcol' ]] . '"' . $selected . '>' . hspech ( $row [ $o [ 'txtcol' ]]) . '</option>' . N );
2020-03-24 23:22:07 +01:00
}
echo ( ' </ select >
< script type = " text/javascript " >
<!--
selordalf ( \ '' . $o [ 'dispselid' ] . ' \ ' );
var '.$o[' disparr '].' = getselarr ( \ '' . $o [ 'dispselid' ] . ' \ ' );
//-->
</ script >
2020-03-11 08:43:56 +01:00
</ td >
2020-04-05 22:45:21 +02:00
< td style = " width:1%; " > ' . N );
if ( ! array_key_exists ( 'edavail' , $o ) || $o [ 'edavail' ])
echo ( '<div class="butdiv"><img src="imgs/edit.svg" class="imgbut" title="Edit first selected entry" onclick="edit(\'' . $o [ 'dispselid' ] . '\',\'' . $o [ 'title' ] . '\',\'edit\')"></div>' . N );
if ( ! array_key_exists ( 'addavail' , $o ) || $o [ 'addavail' ])
echo ( '<div class="butdiv"><img src="imgs/plus.svg" class="imgbut" title="Add an entry" onclick="edit(\'' . $o [ 'dispselid' ] . '\',\'' . $o [ 'title' ] . '\',\'add\')"></div>' . N );
if ( ! array_key_exists ( 'remavail' , $o ) || $o [ 'remavail' ])
echo ( '<div class="butdiv"><img src="imgs/minus.svg" class="imgbut" title="Remove first selected entry" onclick="edit(\'' . $o [ 'dispselid' ] . '\',\'' . $o [ 'title' ] . '\',\'remove\')"></div>' . N );
echo ( ' </ td >
2020-04-03 10:59:02 +02:00
</ tr > ' . N );
if ( $o [ 'multi' ]) {
echo ( ' < tr >
2020-03-11 08:43:56 +01:00
< td style = " width:99%; " >
2020-03-24 23:22:07 +01:00
< div class = " move " > '.$o[' dida '].'
2020-04-04 19:17:10 +02:00
< img src = " imgs/fresu.svg " class = " imgbut " style = " float:left; " title = " Move selected entries from chosen list to available list " onclick = " '. $o['disparr'] .'=selrem( \ ''. $o['chosenselid'] .' \ ', \ ''. $o['dispselid'] .' \ ', '. $o['disparr'] .', \ ''. $o['searchid'] .' \ ', \ ''. $o['regexcbid'] .' \ ') " >
< img src = " imgs/fregiu.svg " class = " imgbut " style = " float:right; " title = " Move selected entries from available list to chosen list " onclick = " '. $o['disparr'] .'=seladd( \ ''. $o['dispselid'] .' \ ', \ ''. $o['chosenselid'] .' \ ', '. $o['disparr'] .') " >
2020-03-24 23:22:07 +01:00
</ div >
2020-03-11 08:43:56 +01:00
</ td >
< td style = " width:1%; " >
</ td >
</ tr >
2020-03-24 23:22:07 +01:00
< tr >
< td style = " width:99%; " >
2020-04-03 10:59:02 +02:00
< select id = " '. $o['chosenselid'] .' " name = " '. $o['chosenselid'] .' " multiple size = " 12 " class = " mselect " > ' . N );
$res = mysqli_query ( $link , $o [ 'chosenque' ])
or muoribene ( __LINE__ . ': ' . mysqli_error ( $link ), true );
while ( $row = mysqli_fetch_assoc ( $res )) {
echo ( '<option value="' . $row [ $o [ 'chosenvalcol' ]] . '">' . hspech ( $row [ $o [ 'txtcol' ]]) . '</option>' . N );
}
echo ( ' </ select >
2020-03-24 23:22:07 +01:00
</ td >
< td style = " width:1%; " >
2020-04-03 10:59:02 +02:00
< div class = " butdiv " >< img src = " imgs/fresucim.svg " class = " imgbut " title = " Move to top " onclick = " seltop( \ ''. $o['chosenselid'] .' \ ') " ></ div >
< div class = " butdiv " >< img src = " imgs/fresu.svg " class = " imgbut " title = " Move up " onclick = " selup( \ ''. $o['chosenselid'] .' \ ') " ></ div >
< div class = " butdiv " >< img src = " imgs/fregiu.svg " class = " imgbut " title = " Move down " onclick = " seldown( \ ''. $o['chosenselid'] .' \ ') " ></ div >
< div class = " butdiv " >< img src = " imgs/fregiufon.svg " class = " imgbut " title = " Move to bottome " onclick = " selbot( \ ''. $o['chosenselid'] .' \ ') " ></ div >
< div class = " butdiv " >< img src = " imgs/alph.svg " class = " imgbut " title = " Sort alphabetically " onclick = " selordalf( \ ''. $o['chosenselid'] .' \ ') " ></ div >
< div class = " butdiv " >< img src = " imgs/invert.svg " class = " imgbut " title = " Invert sort " onclick = " selordinv( \ ''. $o['chosenselid'] .' \ ') " ></ div >
2020-03-24 23:22:07 +01:00
</ td >
2020-04-03 10:59:02 +02:00
</ tr > ' . N );
}
echo ( '</table>' . N );
2020-03-24 23:22:07 +01:00
}
2020-04-03 10:59:02 +02:00
selbox ( array (
'multi' => false ,
'dispselid' => 'LocalityID' ,
'instselid' => $inst [ 'LocalityID' ],
'title' => 'Locality' ,
'searchid' => 'locsearch' ,
'searchtit' => 'Filter available localities' ,
'disparr' => 'locselarr' ,
'regexcbid' => 'locselre' ,
2020-04-04 19:17:10 +02:00
'dispque' => 'SELECT ID, Name' . $dlang . ' FROM Localities ORDER BY NameOrig ASC' ,
2020-04-03 10:59:02 +02:00
'valcol' => 'ID' ,
2020-04-04 19:17:10 +02:00
'txtcol' => 'Name' . $dlang ));
2020-04-03 10:59:02 +02:00
2020-04-07 19:39:06 +02:00
$o = array (
2020-04-03 10:59:02 +02:00
'multi' => true ,
2020-03-24 23:22:07 +01:00
'dispselid' => 'DispLangs' ,
2020-04-03 10:59:02 +02:00
'title' => 'Languages' ,
2020-03-24 23:22:07 +01:00
'searchid' => 'langsearch' ,
2020-04-03 10:59:02 +02:00
'searchtit' => 'Filter available languages' ,
2020-03-24 23:22:07 +01:00
'disparr' => 'langselarr' ,
'regexcbid' => 'langselre' ,
2020-04-07 19:39:06 +02:00
'dispque' => 'SELECT ID, CONCAT(Name' . $dlang . '," [",Code,"]") AS Txt FROM Languages WHERE ID NOT IN (SELECT OurLangID FROM InstOurLangs WHERE InstID=' . $inst [ 'ID' ] . ') ORDER BY Name' . $dlang . ' ASC' ,
2020-03-24 23:22:07 +01:00
'valcol' => 'ID' ,
2020-04-07 19:39:06 +02:00
'txtcol' => 'Txt' ,
2020-04-03 10:59:02 +02:00
'dida' => 'Above: available languages; below: chosen languages' ,
'chosenselid' => 'ChosenLangs[]' ,
2020-04-07 19:39:06 +02:00
'chosenque' => 'SELECT OurLangID, CONCAT(Name' . $dlang . '," [",Code,"]") AS Txt FROM InstOurLangs LEFT JOIN Languages ON Languages.ID=OurLangID WHERE InstID=' . $inst [ 'ID' ] . ' ORDER BY Pos ASC' ,
'chosenvalcol' => 'OurLangID' );
if ( $account [ 'Level' ] == 'guest' ) {
$o [ 'edavail' ] = false ;
$o [ 'addavail' ] = false ;
$o [ 'remavail' ] = false ;
}
selbox ( $o );
2020-03-24 23:22:07 +01:00
2020-04-04 19:17:10 +02:00
?>
< table class = " cbtab " >
2020-04-07 19:39:06 +02:00
< tr >< td >< label for = " OurLangsLock " title = " Prevent languages from being overwritten on next crawler run " > Lock this list :& nbsp ; </ label ></ td >< td >< input type = " checkbox " id = " OurLangsLock " name = " OurLangsLock " title = " Prevent languages from being overwritten on next crawler run " < ? php if ( $account [ 'Level' ] == 'guest' ) echo ( ' checked' ); else echo ( check ( $inst , 'OurLangsLock' )); ?> ></td></tr>
2020-04-04 19:17:10 +02:00
</ table >
< ? php
2020-04-03 10:59:02 +02:00
selbox ( array (
'multi' => true ,
2020-03-24 23:22:07 +01:00
'dispselid' => 'DispFinModes' ,
2020-04-03 10:59:02 +02:00
'title' => 'Financing methods' ,
2020-03-24 23:22:07 +01:00
'searchid' => 'finsearch' ,
2020-04-03 10:59:02 +02:00
'searchtit' => 'Filter available financing methods' ,
2020-03-24 23:22:07 +01:00
'disparr' => 'finselarr' ,
'regexcbid' => 'finselre' ,
'dispque' => 'SELECT * FROM Financing WHERE ID NOT IN (SELECT FinID FROM InstFinancing WHERE InstID=' . $inst [ 'ID' ] . ') ORDER BY Type ASC' ,
'valcol' => 'ID' ,
'txtcol' => 'Type' ,
2020-04-03 10:59:02 +02:00
'dida' => 'Above: available fin. methods; below: chosen fin. methods' ,
'chosenselid' => 'ChosenFinModes[]' ,
2020-03-24 23:22:07 +01:00
'chosenque' => 'SELECT * FROM InstFinancing LEFT JOIN Financing ON Financing.ID=FinID WHERE InstID=' . $inst [ 'ID' ] . ' ORDER BY Pos ASC' ,
'chosenvalcol' => 'FinID' ));
2020-04-03 10:59:02 +02:00
selbox ( array (
'multi' => true ,
2020-03-24 23:22:07 +01:00
'dispselid' => 'DispPolicies' ,
2020-04-03 10:59:02 +02:00
'title' => 'Policies' ,
2020-03-24 23:22:07 +01:00
'searchid' => 'polsearch' ,
2020-04-03 10:59:02 +02:00
'searchtit' => 'Filter policies' ,
2020-03-24 23:22:07 +01:00
'disparr' => 'polselarr' ,
'regexcbid' => 'polselre' ,
'dispque' => 'SELECT * FROM Policies WHERE ID NOT IN (SELECT PolID FROM InstPolicies WHERE InstID=' . $inst [ 'ID' ] . ') ORDER BY Name ASC' ,
'valcol' => 'ID' ,
'txtcol' => 'Name' ,
2020-04-03 10:59:02 +02:00
'dida' => 'Above: available policies; below: chosen policies' ,
'chosenselid' => 'ChosenPolicies[]' ,
2020-03-24 23:22:07 +01:00
'chosenque' => 'SELECT * FROM InstPolicies LEFT JOIN Policies ON Policies.ID=PolID WHERE InstID=' . $inst [ 'ID' ] . ' ORDER BY Pos ASC' ,
'chosenvalcol' => 'PolID' ));
2020-04-03 10:59:02 +02:00
selbox ( array (
'multi' => true ,
2020-03-24 23:22:07 +01:00
'dispselid' => 'DispTags' ,
'title' => 'Tags' ,
'searchid' => 'tagsearch' ,
2020-04-03 10:59:02 +02:00
'searchtit' => 'Filter tags' ,
2020-03-24 23:22:07 +01:00
'disparr' => 'tagselarr' ,
'regexcbid' => 'tagselre' ,
'dispque' => 'SELECT * FROM Tags WHERE ID NOT IN (SELECT TagID FROM InstTags WHERE InstID=' . $inst [ 'ID' ] . ') ORDER BY Name ASC' ,
'valcol' => 'ID' ,
'txtcol' => 'Name' ,
2020-04-03 10:59:02 +02:00
'dida' => 'Above: available tags; below: chosen tags' ,
'chosenselid' => 'ChosenTags[]' ,
2020-03-24 23:22:07 +01:00
'chosenque' => 'SELECT * FROM InstTags LEFT JOIN Tags ON Tags.ID=TagID WHERE InstID=' . $inst [ 'ID' ] . ' ORDER BY Pos ASC' ,
'chosenvalcol' => 'TagID' ));
?>
2020-04-03 10:59:02 +02:00
< div class = " ruler " ></ div >
< input type = " button " value = " Save " class = " button " onclick = " ckf() " >
2020-03-24 23:22:07 +01:00
2020-03-09 22:16:54 +01:00
</ td ></ tr >
</ table >
2020-04-03 10:59:02 +02:00
</ form >
2020-03-09 22:16:54 +01:00
</ div >
</ div >
2020-03-24 23:22:07 +01:00
< div id = " debug " >
< ? php echo ( $dbg ); ?>
</ div >
2020-03-09 22:16:54 +01:00
</ body >
</ html >
2020-03-24 23:22:07 +01:00
< ? php
mysqli_close ( $link );
?>